1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22 package org.miloss.fgsms.presentation;
23
24 import java.util.List;
25 import javax.xml.ws.BindingProvider;
26 import org.apache.log4j.Level;
27 import org.miloss.fgsms.common.Constants;
28 import org.miloss.fgsms.services.interfaces.agentcallbackservice.RemoteAgentCallbackPort;
29 import org.miloss.fgsms.services.interfaces.common.GetOperatingStatusRequestMessage;
30 import org.miloss.fgsms.services.interfaces.common.GetOperatingStatusResponseMessage;
31 import org.miloss.fgsms.services.interfaces.common.SecurityWrapper;
32 import org.miloss.fgsms.services.interfaces.policyconfiguration.PropertyPair;
33 import org.miloss.fgsms.services.interfaces.status.OpStatusService;
34
35
36
37
38
39
40
41 public class OsAgentStatusHelper {
42
43 public static String GetStatus(OpStatusService svc, String callbackUrl, SecurityWrapper c) {
44 GetOperatingStatusRequestMessage req = new GetOperatingStatusRequestMessage();
45 req.setClassification(c);
46 BindingProvider bp = (BindingProvider) svc;
47 bp.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, callbackUrl);
48 GetOperatingStatusResponseMessage operatingStatus;
49 try {
50 operatingStatus = svc.getOperatingStatus(req);
51 return OpStatHelper.toHtmlFormatedString(operatingStatus, callbackUrl);
52 } catch (Exception ex) {
53 LogHelper.getLog().log(Level.WARN, null, ex);
54 return ex.getMessage();
55 }
56 }
57
58
59
60
61
62
63 public static boolean ContainsOSAgentCallbackURL(List<PropertyPair> list) {
64 if (list == null) {
65 return false;
66 }
67 for (int i = 0; i < list.size(); i++) {
68 if (list.get(i).getPropertyname().equalsIgnoreCase(org.miloss.fgsms.common.Constants.PROPERTYPAIR_OS_AGENT_CALLBACK_URL)) {
69 return true;
70 }
71 }
72 return false;
73 }
74
75
76
77
78
79
80
81 public static String GetOSAgentCallBackURL(List<PropertyPair> list) {
82 if (list == null) {
83 return null;
84 }
85 for (int i = 0; i < list.size(); i++) {
86 if (list.get(i).getPropertyname().equalsIgnoreCase(org.miloss.fgsms.common.Constants.PROPERTYPAIR_OS_AGENT_CALLBACK_URL)) {
87 return list.get(i).getPropertyvalue();
88 }
89 }
90 return null;
91 }
92 }