View Javadoc

1   /*
2    * Copyright 2010 Capgemini
3    * Licensed under the Apache License, Version 2.0 (the "License"); 
4    * you may not use this file except in compliance with the License. 
5    * You may obtain a copy of the License at 
6    * 
7    * http://www.apache.org/licenses/LICENSE-2.0 
8    * 
9    * Unless required by applicable law or agreed to in writing, software 
10   * distributed under the License is distributed on an "AS IS" BASIS, 
11   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
12   * See the License for the specific language governing permissions and 
13   * limitations under the License. 
14   * 
15   */
16  package net.sf.appstatus.demo.check;
17  
18  import net.sf.appstatus.core.check.ICheckResult;
19  
20  public class GoogleHttpStatusChecker extends AbstractHttpCheck {
21  
22  	public ICheckResult checkStatus() {
23  		ICheckResult result = null;
24  
25  		try {
26  			this.doHttpGet("http://www.google.com");
27  			result = createResult(OK);
28  			result.setDescription("Google Access ok");
29  		} catch (Exception e) {
30  			result = createResult(FATAL);
31  			result.setDescription("Google access failed");
32  			result.setResolutionSteps("Your server does not have internet access : "
33  					+ e.getMessage());
34  		}
35  
36  		return result;
37  	}
38  
39  	public String getGroup() {
40  		return "google";
41  	}
42  
43  	public String getName() {
44  		return "Google Http check";
45  	}
46  
47  }