/[projects]/dao/JavaPumpClient/src/dk/daoas/PumpClient/PumpClientMain.java
ViewVC logotype

Contents of /dao/JavaPumpClient/src/dk/daoas/PumpClient/PumpClientMain.java

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2009 - (show annotations) (download)
Tue Jul 9 19:37:14 2013 UTC (10 years, 10 months ago) by torben
File size: 1323 byte(s)
Initial import.
1 package dk.daoas.PumpClient;
2
3 import org.datacontract.schemas._2004._07.DaoMqPump2.StatusData;
4 import org.tempuri.RemoteControlLocator;
5
6 import Samples.ServiceModel.Microsoft.IRemoteControl;
7
8 public class PumpClientMain {
9
10 final static int EXIT_OK = 0;
11 final static int EXIT_WARN = 1;
12 final static int EXIT_CRIT = 2;
13 final static int EXIT_UNKNOWN = 3;
14
15 public static void main(String[] args) {
16
17
18
19 if (args.length != 1) {
20 System.out.println("Missing Commandline argument: transport name" );
21 System.exit(EXIT_CRIT);
22
23 }
24
25 try {
26 RemoteControlLocator loc = new RemoteControlLocator();
27 IRemoteControl remote = loc.getBasicHttpBinding_IRemoteControl();
28
29 StatusData status = remote.getTransportStatus( args[0] );
30
31 if (status.getTransportEnabled() == true) {
32 if (status.getLastrunOk() == true) {
33 System.out.println("Transport running OK");
34 System.exit(EXIT_OK);
35 } else {
36 System.out.println("Transport error");
37 System.exit(EXIT_CRIT);
38 }
39
40 } else {
41 System.out.println("Transport disabled");
42 System.exit(EXIT_WARN);
43
44 }
45 System.out.println( status.getTransportEnabled() );
46
47
48
49 } catch (Exception e) {
50 System.out.println("Communication error: " + e.getMessage() );
51 System.exit(EXIT_UNKNOWN);
52 }
53
54 }
55
56 }

  ViewVC Help
Powered by ViewVC 1.1.20