1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21 package org.miloss.fgsms.uddipub;
22
23 import java.io.StringWriter;
24 import java.math.BigInteger;
25 import java.net.URL;
26 import java.sql.Connection;
27 import java.sql.PreparedStatement;
28 import java.sql.ResultSet;
29 import java.text.SimpleDateFormat;
30 import java.util.*;
31 import java.util.concurrent.atomic.AtomicReference;
32 import javax.net.ssl.*;
33 import javax.xml.bind.JAXBContext;
34 import javax.xml.bind.Marshaller;
35 import javax.xml.datatype.DatatypeFactory;
36 import javax.xml.datatype.Duration;
37 import java.util.Calendar;
38 import javax.xml.ws.BindingProvider;
39 import javax.xml.ws.handler.Handler;
40 import org.apache.juddi.v3.client.UDDIService;
41 import org.apache.log4j.Level;
42 import org.miloss.fgsms.common.Logger;;
43 import org.miloss.fgsms.agents.JAXWSGenericAgent;
44 import org.miloss.fgsms.agents.JAXWSGenericClientAgent;
45 import org.miloss.fgsms.common.AuditLogger;
46 import org.miloss.fgsms.common.DBSettingsLoader;
47 import org.miloss.fgsms.common.PublicationConstants;
48 import org.miloss.fgsms.common.Utility;
49 import org.miloss.fgsms.services.interfaces.common.NameValuePair;
50 import org.miloss.fgsms.services.interfaces.common.PolicyType;
51 import org.miloss.fgsms.services.interfaces.dataaccessservice.QuickStatData;
52 import org.miloss.fgsms.services.interfaces.dataaccessservice.QuickStatWrapper;
53 import org.miloss.fgsms.services.interfaces.policyconfiguration.*;
54 import org.uddi.api_v3.*;
55 import org.uddi.v3_service.DispositionReportFaultMessage;
56 import org.uddi.v3_service.UDDIInquiryPortType;
57 import org.uddi.v3_service.UDDIPublicationPortType;
58 import org.uddi.v3_service.UDDISecurityPortType;
59
60
61
62
63
64
65
66
67 public class UddiPublisher implements org.miloss.fgsms.plugins.federation.FederationInterface {
68
69 protected static final Logger log = Logger.getLogger("fgsms.UDDIPublisher");
70
71
72
73
74
75 private UDDIService uddi = new UDDIService();
76 private UDDIInquiryPortType inquiry = null;
77 private UDDISecurityPortType security = null;
78 private UDDIPublicationPortType publication = null;
79 private boolean isPooled = false;
80 private boolean ClientCertRequired = false;
81 private String inquiryurl = "";
82 private String publishurl = "";
83 private String securityurl = "";
84 public static final String OPTION_PUBLISH_TIME_RANGE = "Range";
85 public static final String OPTION_PUBLISH_STATUS = "Status";
86 public static final String OPTION_PUBLISH_SLA = "SLA";
87 public static final String OPTION_PUBLISH_MAX = "Maximums";
88 public static final String OPTION_PUBLISH_UPTIME = "Uptime";
89 public static final String OPTION_PUBLISH_FAULTS = "Faults";
90 public static final String OPTION_PUBLISH_SUCCESS = "Success";
91 public static final String OPTION_PUBLISH_AVG_RES_TIME = "Averages";
92 public static final String OPTION_BINDING_KEY = "Binding";
93 public static final String OPTION_PUBLISH_USERNAME = "Username";
94 public static final String OPTION_PUBLISH_PASSWORD = "Password";
95
96 public UddiPublisher() {
97
98 this(true);
99 }
100
101 public UddiPublisher(boolean pooled) {
102 isPooled = pooled;
103 try {
104 String t = "";
105 KeyNameValueEnc p = DBSettingsLoader.GetPropertiesFromDB(isPooled, "UddiPublisher", "Username");
106 if (p != null && p.getKeyNameValue() != null) {
107 username = p.getKeyNameValue().getPropertyValue();
108 }
109 p = DBSettingsLoader.GetPropertiesFromDB(isPooled, "UddiPublisher", "password");
110 if (p != null && p.getKeyNameValue() != null) {
111 password = p.getKeyNameValue().getPropertyValue();
112 }
113 p = DBSettingsLoader.GetPropertiesFromDB(isPooled, "UddiPublisher", "ClientCertRequired");
114 if (p != null && p.getKeyNameValue() != null) {
115 try {
116 ClientCertRequired = Boolean.parseBoolean(p.getKeyNameValue().getPropertyValue());
117 } catch (Exception ex) {
118 ClientCertRequired = false;
119 }
120 }
121 p = DBSettingsLoader.GetPropertiesFromDB(isPooled, "UddiPublisher", "AuthMode");
122 if (p != null && p.getKeyNameValue() != null) {
123 t = p.getKeyNameValue().getPropertyValue();
124 try {
125 uddiauth = AuthMode.valueOf(t);
126 } catch (Exception ex) {
127 log.log(Level.WARN, "Unable to parse the value of UddiPublisher.AuthMode!", ex);
128 throw ex;
129 }
130 }
131
132 inquiryurl = "";
133 publishurl = "";
134 securityurl = "";
135
136 p = DBSettingsLoader.GetPropertiesFromDB(isPooled, "UddiPublisher", "InquiryURL");
137 if (p != null && p.getKeyNameValue() != null) {
138 inquiryurl = p.getKeyNameValue().getPropertyValue();
139 }
140 p = DBSettingsLoader.GetPropertiesFromDB(isPooled, "UddiPublisher", "PublishURL");
141 if (p != null && p.getKeyNameValue() != null) {
142 publishurl = p.getKeyNameValue().getPropertyValue();
143 }
144 p = DBSettingsLoader.GetPropertiesFromDB(isPooled, "UddiPublisher", "SecurityURL");
145 if (p != null && p.getKeyNameValue() != null) {
146 securityurl = p.getKeyNameValue().getPropertyValue();
147 }
148
149 String jbossconfigpath = "";
150 if (!Utility.stringIsNullOrEmpty(System.getProperty("jboss.server.config.url"))) {
151 jbossconfigpath = System.getProperty("jboss.server.config.url");
152 }
153
154 String truststore = null;
155 String truststorepass = null;
156 String keystore = null;
157 String keystorepass = null;
158 p = DBSettingsLoader.GetPropertiesFromDB(isPooled, "defaults", "keystore");
159 if (p != null && p.getKeyNameValue() != null) {
160 keystore = jbossconfigpath + p.getKeyNameValue().getPropertyValue();
161 }
162 p = DBSettingsLoader.GetPropertiesFromDB(isPooled, "defaults", "keystorepass");
163 if (p != null && p.getKeyNameValue() != null) {
164 keystorepass = p.getKeyNameValue().getPropertyValue();
165 }
166 p = DBSettingsLoader.GetPropertiesFromDB(isPooled, "defaults", "truststore");
167 if (p != null && p.getKeyNameValue() != null) {
168 truststore = jbossconfigpath + p.getKeyNameValue().getPropertyValue();
169 }
170 p = DBSettingsLoader.GetPropertiesFromDB(isPooled, "defaults", "truststorepass");
171 if (p != null && p.getKeyNameValue() != null) {
172 truststorepass = p.getKeyNameValue().getPropertyValue();
173 }
174 p = DBSettingsLoader.GetPropertiesFromDB(isPooled, "UddiPublisher", "keystore");
175 if (p != null && p.getKeyNameValue() != null) {
176 keystore = jbossconfigpath + p.getKeyNameValue().getPropertyValue();
177 }
178 p = DBSettingsLoader.GetPropertiesFromDB(isPooled, "UddiPublisher", "keystorepass");
179 if (p != null && p.getKeyNameValue() != null) {
180 keystorepass = p.getKeyNameValue().getPropertyValue();
181 }
182
183
184 boolean ignoresslerrors = false;
185 p = DBSettingsLoader.GetPropertiesFromDB(isPooled, "UddiPublisher", "IgnoreSSLErrors");
186 if (p != null && p.getKeyNameValue() != null) {
187 try {
188 ignoresslerrors = Boolean.parseBoolean(p.getKeyNameValue().getPropertyValue());
189 } catch (Exception ex) {
190 ignoresslerrors = false;
191 }
192 }
193 if (ignoresslerrors) {
194 HostnameVerifier ignoreHostName = new HostnameVerifier() {
195 public boolean verify(String string, SSLSession ssls) {
196 return true;
197 }
198 };
199 TrustManager[] trustAllCerts = new TrustManager[]{
200 new X509TrustManager() {
201 public java.security.cert.X509Certificate[] getAcceptedIssuers() {
202 return null;
203 }
204
205 public void checkClientTrusted(
206 java.security.cert.X509Certificate[] certs, String authType) {
207 }
208
209 public void checkServerTrusted(
210 java.security.cert.X509Certificate[] certs, String authType) {
211 }
212 }
213 };
214
215 SSLContext sc = SSLContext.getInstance("SSL");
216 sc.init(null, trustAllCerts, new java.security.SecureRandom());
217 HttpsURLConnection.setDefaultSSLSocketFactory(sc.getSocketFactory());
218 HttpsURLConnection.setDefaultHostnameVerifier(ignoreHostName);
219 SSLContext.setDefault(sc);
220 }
221
222
223
224
225 inquiry = uddi.getUDDIInquiryPort();
226
227 BindingProvider bpPCS = (BindingProvider) inquiry;
228 addMontior(bpPCS);
229 Map<String, Object> contextPCS = bpPCS.getRequestContext();
230 contextPCS.put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, inquiryurl.trim());
231
232 if (uddiauth == AuthMode.Http && !Utility.stringIsNullOrEmpty(password) && !Utility.stringIsNullOrEmpty(username)) {
233 contextPCS.put(BindingProvider.PASSWORD_PROPERTY, Utility.DE(password));
234 contextPCS.put(BindingProvider.USERNAME_PROPERTY, username);
235 }
236 if (inquiryurl.toLowerCase().startsWith("https")) {
237 if (!Utility.stringIsNullOrEmpty(truststore) && !Utility.stringIsNullOrEmpty(truststorepass)) {
238 log.log(Level.INFO, "Inquiry Endpoint: Loading truststore from " + truststore);
239 contextPCS.put("javax.net.ssl.trustStorePassword", Utility.DE(truststorepass));
240 contextPCS.put("javax.net.ssl.trustStore", truststore);
241 }
242 }
243 if (ClientCertRequired && Utility.stringIsNullOrEmpty(keystore) && Utility.stringIsNullOrEmpty(keystorepass)) {
244 contextPCS.put("javax.net.ssl.keyStorePassword", Utility.DE(keystorepass));
245 contextPCS.put("javax.net.ssl.keyStore", keystore);
246 log.log(Level.INFO, "Inquiry Endpoint: Loading keystore from " + keystore);
247 }
248
249
250 publication = uddi.getUDDIPublicationPort();
251 bpPCS = (BindingProvider) publication;
252 addMontior(bpPCS);
253 contextPCS = bpPCS.getRequestContext();
254
255 contextPCS.put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, publishurl.trim());
256 if (uddiauth == AuthMode.Http && !Utility.stringIsNullOrEmpty(password) && !Utility.stringIsNullOrEmpty(username)) {
257 contextPCS.put(BindingProvider.PASSWORD_PROPERTY, Utility.DE(password));
258 contextPCS.put(BindingProvider.USERNAME_PROPERTY, username);
259 }
260 if (publishurl.toLowerCase().startsWith("https")) {
261 if (!Utility.stringIsNullOrEmpty(truststore) && !Utility.stringIsNullOrEmpty(truststorepass)) {
262 contextPCS.put("javax.net.ssl.trustStorePassword", Utility.DE(truststorepass));
263 contextPCS.put("javax.net.ssl.trustStore", truststore);
264 log.log(Level.INFO, "Publish Endpoint: Loading truststore from " + truststore);
265 }
266 }
267 if (ClientCertRequired && Utility.stringIsNullOrEmpty(keystore) && Utility.stringIsNullOrEmpty(keystorepass)) {
268 contextPCS.put("javax.net.ssl.keyStorePassword", Utility.DE(keystorepass));
269 contextPCS.put("javax.net.ssl.keyStore", keystore);
270 log.log(Level.INFO, "Publish Endpoint: Loading keystore from " + truststore);
271 }
272
273 if (uddiauth == AuthMode.Uddi) {
274
275
276 security = uddi.getUDDISecurityPort();
277 bpPCS = (BindingProvider) security;
278 addMontior(bpPCS);
279 contextPCS = bpPCS.getRequestContext();
280 contextPCS.put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, securityurl.trim());
281 if (securityurl.toLowerCase().startsWith("https")) {
282 if (!Utility.stringIsNullOrEmpty(truststore) && !Utility.stringIsNullOrEmpty(truststorepass)) {
283 contextPCS.put("javax.net.ssl.trustStorePassword", Utility.DE(truststorepass));
284 contextPCS.put("javax.net.ssl.trustStore", truststore);
285 log.log(Level.INFO, "Security Endpoint: Loading truststore from " + truststore);
286 }
287 }
288 if (ClientCertRequired && Utility.stringIsNullOrEmpty(keystore) && Utility.stringIsNullOrEmpty(keystorepass)) {
289 contextPCS.put("javax.net.ssl.keyStorePassword", Utility.DE(keystorepass));
290 contextPCS.put("javax.net.ssl.keyStore", keystore);
291 log.log(Level.INFO, "Security Endpoint: Loading truststore from " + keystore);
292 }
293 }
294
295 } catch (Exception ex) {
296 State = false;
297 log.warn("check for configuration file, uddi.properties", ex);
298 return;
299 }
300 State = true;
301 }
302
303 private boolean TmodelKeyIsfgsms(String tModelKey) {
304 String[] items = PublicationConstants.getAllTmodelKeys();
305 for (int i = 0; i < items.length; i++) {
306 if (tModelKey.equalsIgnoreCase(items[i])) {
307 return true;
308 }
309 }
310 return false;
311 }
312
313
314
315
316
317
318
319
320
321 private QuickStatData getRecord(QuickStatWrapper data, long timeInMs) {
322 if (data == null) {
323 return null;
324 }
325 for (int i = 0; i < data.getQuickStatData().size(); i++) {
326 if ((data.getQuickStatData().get(i).getTimeInMinutes().longValue() * 60 * 1000) == timeInMs) {
327 return data.getQuickStatData().get(i);
328 }
329 }
330 return null;
331 }
332
333 private String getLastChangeTimeStamp(String uri, boolean pooled) {
334 try {
335 Calendar cal = null;
336 Connection con = null;
337 if (pooled) {
338 con = Utility.getPerformanceDBConnection();
339 } else {
340 con = Utility.getPerformanceDB_NONPOOLED_Connection();
341 }
342 PreparedStatement com = con.prepareStatement("select * from availability where uri=? order by utcdatetime desc limit 1");
343 com.setString(1, uri);
344
345 ResultSet rs = com.executeQuery();
346 if (rs.next()) {
347 long changeat = rs.getLong("utcdatetime");
348 DatatypeFactory f = DatatypeFactory.newInstance();
349 GregorianCalendar gcal = new GregorianCalendar();
350 gcal.setTimeInMillis(changeat);
351 cal = (gcal);
352 }
353 rs.close();
354 com.close();
355 con.close();
356 if (cal != null) {
357 return cal.toString();
358 }
359 } catch (Exception ex) {
360 log.log(Level.ERROR, null, ex);
361 }
362 return "";
363 }
364
365 @Override
366 public boolean ValidateConfiguration(FederationPolicy fp, AtomicReference<String> outMessage) {
367
368 boolean ok = true;
369 if (outMessage == null) {
370 outMessage = new AtomicReference<String>("");
371 }
372 FederationPolicyExt e = new FederationPolicyExt(fp);
373 if (e.getPublishTimeRange().isEmpty()) {
374 ok = false;
375 outMessage.set("Time Range is required to have at least one value.");
376 }
377 if (Utility.stringIsNullOrEmpty(e.getBindingKey())) {
378 ok = false;
379 outMessage.set("A binding key is required for publication.");
380 }
381 return ok;
382 }
383
384
385
386
387
388 @Override
389 public void Publish(boolean pooled, QuickStatWrapper data, ServicePolicy sp, FederationPolicy fp) {
390 log.log(Level.INFO, "Starting UDDI publication for " + sp.getURL());
391 this.isPooled = pooled;
392 if (!checkTmodelPublication()) {
393 log.log(Level.ERROR, "Unable to publish tModel definitions to the UDDI registry, registry publication is not possible: URLs (i/p/s) " + inquiryurl + " " + publishurl + " " + securityurl);
394 State = false;
395 return;
396 }
397 FederationPolicyExt policy = new FederationPolicyExt(fp);
398
399 String auth = loginWrapper();
400 try {
401
402 if (Utility.stringIsNullOrEmpty(policy.getBindingKey())) {
403 log.log(Level.WARN, "unable to publish UDDI data for service " + sp.getURL() + " because the binding key is null or empty");
404 return;
405 }
406 GetBindingDetail ir = new GetBindingDetail();
407 ir.setAuthInfo(auth);
408 ir.getBindingKey().add(policy.getBindingKey());
409 BindingDetail irr = null;
410 try {
411 irr = inquiry.getBindingDetail(ir);
412 } catch (DispositionReportFaultMessage ex) {
413 log.log(Level.ERROR, "Could not publish data for service " + sp.getURL() + " to UDDI binding key " + policy.getBindingKey() + dispositionReportFaultMessageToString(ex), ex);
414 return;
415 } catch (Exception ex) {
416 log.log(Level.ERROR, "Could not publish data for service " + sp.getURL() + " to UDDI binding key " + policy.getBindingKey(), ex);
417 return;
418 }
419 if (irr == null || irr.getBindingTemplate() == null || irr.getBindingTemplate().isEmpty()) {
420 log.log(Level.ERROR, "Could not publish data for service " + sp.getURL() + " to UDDI binding key " + policy.getBindingKey() + ". The UDDI server didn't return any binding templates matching the provided key");
421 return;
422 }
423 if (irr.getBindingTemplate().size() > 1) {
424 log.log(Level.WARN, "The UDDI returned more than one binding template for the service " + sp.getURL() + " to UDDI binding key " + policy.getBindingKey() + ". Only the first binding will be modified");
425 return;
426 }
427
428 if (data == null) {
429 log.log(Level.ERROR, "No quick stat data is available for " + sp.getURL() + ", unable to publish");
430 return;
431 }
432
433 List<TModelInstanceInfo> kr = new ArrayList<TModelInstanceInfo>();
434
435 for (int aa = 0; aa < policy.getPublishTimeRange().size(); aa++) {
436
437
438
439
440
441 long time = Utility.durationToTimeInMS(policy.getPublishTimeRange().get(aa));
442
443 QuickStatData localdata = getRecord(data, time);
444 if (localdata == null) {
445 log.log(Level.WARN, "No quick stat data for the time period " + time + " for the service " + sp.getURL() + " is available, skipping.");
446 continue;
447 }
448 if (time == 300000) {
449
450 if (policy.isPublishSuccessCount()) {
451 String val = (new Long(localdata.getSuccessCount()).toString());
452 if (Utility.stringIsNullOrEmpty(val)) {
453 val = (NaN);
454 }
455 kr.add(createTmodelInstnaceInfo(PublicationConstants.tmodelSuccessCount5min, val, PublicationConstants.tmodelSuccessText));
456 }
457 if (policy.isPublishFailureCount()) {
458 String val = (new Long(localdata.getFailureCount()).toString());
459 if (Utility.stringIsNullOrEmpty(val)) {
460 val = (NaN);
461 }
462 kr.add(createTmodelInstnaceInfo(PublicationConstants.tmodelFailureCount5min, val, PublicationConstants.tmodelFailureCountText));
463
464 val = new String();
465
466 if (localdata.getMTBF() != null) {
467 val = (Utility.durationToString(localdata.getMTBF()));
468 } else {
469 val = (NaN);
470 }
471 if (Utility.stringIsNullOrEmpty(val)) {
472 val = (NaN);
473 }
474 kr.add(createTmodelInstnaceInfo(PublicationConstants.tmodelMTBF5min, val, PublicationConstants.tmodelMTBFText));
475
476 }
477 if (policy.isPublishSLAFaults()) {
478 String val = (new Long(localdata.getSLAViolationCount()).toString());
479 if (Utility.stringIsNullOrEmpty(val)) {
480 val = (NaN);
481 }
482 kr.add(createTmodelInstnaceInfo(PublicationConstants.tmodelSLAViolations5min, val, PublicationConstants.tmodelSLAViolationsText));
483
484 }
485
486 if (policy.isPublishAverageResponseTime()) {
487 String val = (new Long(localdata.getAverageResponseTime()).toString());
488 if (Utility.stringIsNullOrEmpty(val)) {
489 val = NaN;
490 }
491 kr.add(createTmodelInstnaceInfo(PublicationConstants.tmodelAverageResponseTime5min, val,PublicationConstants.tmodelAverageResponseTimeText ));
492 }
493
494 if (policy.isPublishUpTimePercent()) {
495
496 String val = (new Long(localdata.getAverageResponseTime()).toString());
497 if (Utility.stringIsNullOrEmpty(val)) {
498 val = NaN;
499 }
500 kr.add(createTmodelInstnaceInfo(PublicationConstants.tmodelUpDownTimePercentage5min, val, PublicationConstants.tmodelUpDownTimePercentageText));
501 }
502
503 if (policy.isPublishMaximums()) {
504
505 String val = (new Long(localdata.getMaximumRequestSize()).toString());
506 if (Utility.stringIsNullOrEmpty(val)) {
507 val = NaN;
508 }
509 kr.add(createTmodelInstnaceInfo(PublicationConstants.tmodelMaxRequestSize5min, val, PublicationConstants.tmodelMaxRequestSizeText));
510
511 val = (new Long(localdata.getMaximumResponseSize()).toString());
512 if (Utility.stringIsNullOrEmpty(val)) {
513 val = NaN;
514 }
515 kr.add(createTmodelInstnaceInfo(PublicationConstants.tmodelMaxResponseSize5min, val, PublicationConstants.tmodelMaxResponseSizeText));
516
517 val = (new Long(localdata.getMaximumResponseTime()).toString());
518 if (Utility.stringIsNullOrEmpty(val)) {
519 val = NaN;
520 }
521 kr.add(createTmodelInstnaceInfo(PublicationConstants.tmodelMaxresponseTime5min, val, PublicationConstants.tmodelMaxresponseTimeText));
522
523 }
524 } else if (time == 900000) {
525
526 if (policy.isPublishSuccessCount()) {
527
528 String val = (new Long(localdata.getSuccessCount()).toString());
529 if (Utility.stringIsNullOrEmpty(val)) {
530 val = NaN;
531 }
532 kr.add(createTmodelInstnaceInfo(PublicationConstants.tmodelSuccessCount15min, val, PublicationConstants.tmodelSuccessText));
533 }
534 if (policy.isPublishFailureCount()) {
535
536 String val = (new Long(localdata.getFailureCount()).toString());
537 if (Utility.stringIsNullOrEmpty(val)) {
538 val = NaN;
539 }
540 kr.add(createTmodelInstnaceInfo(PublicationConstants.tmodelFailureCount15min, val, PublicationConstants.tmodelFailureCountText));
541
542 if (localdata.getMTBF() != null) {
543 val = (Utility.durationToString(localdata.getMTBF()));
544 } else {
545 val = NaN;
546 }
547 if (Utility.stringIsNullOrEmpty(val)) {
548 val = NaN;
549 }
550 kr.add(createTmodelInstnaceInfo(PublicationConstants.tmodelMTBF15min, val, PublicationConstants.tmodelMTBFText));
551
552 }
553 if (policy.isPublishSLAFaults()) {
554
555 String val = (new Long(localdata.getSLAViolationCount()).toString());
556 if (Utility.stringIsNullOrEmpty(val)) {
557 val = NaN;
558 }
559 kr.add(createTmodelInstnaceInfo(PublicationConstants.tmodelSLAViolations15min, val, PublicationConstants.tmodelSLAViolationsText));
560
561 }
562
563 if (policy.isPublishAverageResponseTime()) {
564
565 String val = (new Long(localdata.getAverageResponseTime()).toString());
566 if (Utility.stringIsNullOrEmpty(val)) {
567 val = NaN;
568 }
569 kr.add(createTmodelInstnaceInfo(PublicationConstants.tmodelAverageResponseTime15min, val,PublicationConstants.tmodelAverageResponseTimeText ));
570 }
571
572 if (policy.isPublishUpTimePercent()) {
573
574 String val = (new Long(localdata.getAverageResponseTime()).toString());
575 if (Utility.stringIsNullOrEmpty(val)) {
576 val = NaN;
577 }
578 kr.add(createTmodelInstnaceInfo(PublicationConstants.tmodelUpDownTimePercentage15min, val, PublicationConstants.tmodelUpDownTimePercentageText));
579 }
580
581 if (policy.isPublishMaximums()) {
582
583 String val = (new Long(localdata.getMaximumRequestSize()).toString());
584 if (Utility.stringIsNullOrEmpty(val)) {
585 val = NaN;
586 }
587 kr.add(createTmodelInstnaceInfo(PublicationConstants.tmodelMaxRequestSize15min, val, PublicationConstants.tmodelMaxRequestSizeText));
588
589 val = (new Long(localdata.getMaximumResponseSize()).toString());
590 if (Utility.stringIsNullOrEmpty(val)) {
591 val = NaN;
592 }
593 kr.add(createTmodelInstnaceInfo(PublicationConstants.tmodelMaxResponseSize15min, val, PublicationConstants.tmodelMaxResponseSizeText));
594
595 val = (new Long(localdata.getMaximumResponseTime()).toString());
596 if (Utility.stringIsNullOrEmpty(val)) {
597 val = NaN;
598 }
599 kr.add(createTmodelInstnaceInfo(PublicationConstants.tmodelMaxresponseTime15min, val, PublicationConstants.tmodelMaxresponseTimeText));
600
601 }
602 } else if (time == 3600000) {
603
604 if (policy.isPublishSuccessCount()) {
605 String val = (new Long(localdata.getSuccessCount()).toString());
606 if (Utility.stringIsNullOrEmpty(val)) {
607 val = NaN;
608 }
609 kr.add(createTmodelInstnaceInfo(PublicationConstants.tmodelSuccessCount60min, val, PublicationConstants.tmodelSuccessText));
610 }
611 if (policy.isPublishFailureCount()) {
612
613 String val = (new Long(localdata.getFailureCount()).toString());
614 if (Utility.stringIsNullOrEmpty(val)) {
615 val = NaN;
616 }
617 kr.add(createTmodelInstnaceInfo(PublicationConstants.tmodelFailureCount60min, val, PublicationConstants.tmodelFailureCountText));
618
619 if (localdata.getMTBF() != null) {
620 val = (Utility.durationToString(localdata.getMTBF()));
621 } else {
622 val = NaN;
623 }
624 if (Utility.stringIsNullOrEmpty(val)) {
625 val = NaN;
626 }
627 kr.add(createTmodelInstnaceInfo(PublicationConstants.tmodelMTBF60min, val, PublicationConstants.tmodelMTBFText));
628
629 }
630 if (policy.isPublishSLAFaults()) {
631
632 String val = (new Long(localdata.getSLAViolationCount()).toString());
633 if (Utility.stringIsNullOrEmpty(val)) {
634 val = NaN;
635 }
636 kr.add(createTmodelInstnaceInfo(PublicationConstants.tmodelSLAViolations60min, val, PublicationConstants.tmodelSLAViolationsText));
637
638 }
639
640 if (policy.isPublishAverageResponseTime()) {
641
642 String val = (new Long(localdata.getAverageResponseTime()).toString());
643 if (Utility.stringIsNullOrEmpty(val)) {
644 val = NaN;
645 }
646 kr.add(createTmodelInstnaceInfo(PublicationConstants.tmodelAverageResponseTime60min, val,PublicationConstants.tmodelAverageResponseTimeText ));
647 }
648
649 if (policy.isPublishUpTimePercent()) {
650
651 String val = (new Long(localdata.getAverageResponseTime()).toString());
652 if (Utility.stringIsNullOrEmpty(val)) {
653 val = NaN;
654 }
655 kr.add(createTmodelInstnaceInfo(PublicationConstants.tmodelUpDownTimePercentage60min, val, PublicationConstants.tmodelUpDownTimePercentageText));
656 }
657
658 if (policy.isPublishMaximums()) {
659
660 String val = (new Long(localdata.getMaximumRequestSize()).toString());
661 if (Utility.stringIsNullOrEmpty(val)) {
662 val = NaN;
663 }
664 kr.add(createTmodelInstnaceInfo(PublicationConstants.tmodelMaxRequestSize60min, val, PublicationConstants.tmodelMaxRequestSizeText));
665
666 val = (new Long(localdata.getMaximumResponseSize()).toString());
667 if (Utility.stringIsNullOrEmpty(val)) {
668 val = NaN;
669 }
670 kr.add(createTmodelInstnaceInfo(PublicationConstants.tmodelMaxResponseSize60min, val, PublicationConstants.tmodelMaxResponseSizeText));
671
672 val = (new Long(localdata.getMaximumResponseTime()).toString());
673 if (Utility.stringIsNullOrEmpty(val)) {
674 val = NaN;
675 }
676 kr.add(createTmodelInstnaceInfo(PublicationConstants.tmodelMaxresponseTime60min, val, PublicationConstants.tmodelMaxresponseTimeText));
677
678 }
679 } else if (time == 86400000) {
680
681 if (policy.isPublishSuccessCount()) {
682
683 String val = (new Long(localdata.getSuccessCount()).toString());
684 if (Utility.stringIsNullOrEmpty(val)) {
685 val = NaN;
686 }
687 kr.add(createTmodelInstnaceInfo(PublicationConstants.tmodelSuccessCount24hr, val, PublicationConstants.tmodelSuccessText));
688 }
689 if (policy.isPublishFailureCount()) {
690
691 String val = (new Long(localdata.getFailureCount()).toString());
692 if (Utility.stringIsNullOrEmpty(val)) {
693 val = NaN;
694 }
695 kr.add(createTmodelInstnaceInfo(PublicationConstants.tmodelFailureCount24hr, val, PublicationConstants.tmodelFailureCountText));
696
697 if (localdata.getMTBF() != null) {
698 val = (Utility.durationToString(localdata.getMTBF()));
699 } else {
700 val = NaN;
701 }
702 if (Utility.stringIsNullOrEmpty(val)) {
703 val = NaN;
704 }
705 kr.add(createTmodelInstnaceInfo(PublicationConstants.tmodelMTBF24hr, val, PublicationConstants.tmodelMTBFText));
706
707
708 }
709 if (policy.isPublishSLAFaults()) {
710
711 String val = (new Long(localdata.getSLAViolationCount()).toString());
712 if (Utility.stringIsNullOrEmpty(val)) {
713 val = NaN;
714 }
715 kr.add(createTmodelInstnaceInfo(PublicationConstants.tmodelSLAViolations24hr, val, PublicationConstants.tmodelSLAViolationsText));
716
717 }
718
719 if (policy.isPublishAverageResponseTime()) {
720
721 String val = (new Long(localdata.getAverageResponseTime()).toString());
722 if (Utility.stringIsNullOrEmpty(val)) {
723 val = NaN;
724 }
725 kr.add(createTmodelInstnaceInfo(PublicationConstants.tmodelAverageResponseTime24hr, val,PublicationConstants.tmodelAverageResponseTimeText ));
726 }
727
728 if (policy.isPublishUpTimePercent()) {
729
730 String val = (new Long(localdata.getAverageResponseTime()).toString());
731 if (Utility.stringIsNullOrEmpty(val)) {
732 val = NaN;
733 }
734 kr.add(createTmodelInstnaceInfo(PublicationConstants.tmodelUpDownTimePercentage24hr, val, PublicationConstants.tmodelUpDownTimePercentageText));
735 }
736
737 if (policy.isPublishMaximums()) {
738
739 String val = (new Long(localdata.getMaximumRequestSize()).toString());
740 if (Utility.stringIsNullOrEmpty(val)) {
741 val = NaN;
742 }
743 kr.add(createTmodelInstnaceInfo(PublicationConstants.tmodelMaxRequestSize24hr, val, PublicationConstants.tmodelMaxRequestSizeText));
744
745 val = (new Long(localdata.getMaximumResponseSize()).toString());
746 if (Utility.stringIsNullOrEmpty(val)) {
747 val = NaN;
748 }
749 kr.add(createTmodelInstnaceInfo(PublicationConstants.tmodelMaxResponseSize24hr, val, PublicationConstants.tmodelMaxResponseSizeText));
750
751 val = (new Long(localdata.getMaximumResponseTime()).toString());
752 if (Utility.stringIsNullOrEmpty(val)) {
753 val = NaN;
754 }
755 kr.add(createTmodelInstnaceInfo(PublicationConstants.tmodelMaxresponseTime24hr, val, PublicationConstants.tmodelMaxresponseTimeText));
756
757 }
758 }
759 }
760
761
762
763
764
765
766
767
768
769
770
771
772 String val = (GetMonitoredStatusFromDB(sp.getURL(), isPooled));
773 if (Utility.stringIsNullOrEmpty(val)) {
774 val = NaN;
775 }
776 kr.add(createTmodelInstnaceInfo(PublicationConstants.tmodelOperationalMonitoredBy, val, PublicationConstants.tmodelOperationalMonitoredByText));
777
778
779 Calendar xcal = ((GregorianCalendar) GregorianCalendar.getInstance());
780 if (Utility.stringIsNullOrEmpty(val)) {
781 val = NaN;
782 } else {
783 val = Utility.formatDateTime(xcal.getTime());
784 }
785 kr.add(createTmodelInstnaceInfo(PublicationConstants.tmodelPublishTimeStamp, val, PublicationConstants.tmodelPublishTimeStampText));
786
787 if (policy.isPublishLastKnownStatus()) {
788
789 val = (getOperationalStatusFromDB(sp.getURL(), isPooled));
790 if (Utility.stringIsNullOrEmpty(val)) {
791 val = NaN;
792 }
793 kr.add(createTmodelInstnaceInfo(PublicationConstants.tmodelOperationalStatus, val, PublicationConstants.tmodelOperationalStatusText));
794
795 val = (getOperationalStatusTimeStamp(sp.getURL(), isPooled));
796 if (Utility.stringIsNullOrEmpty(val)) {
797 val = NaN;
798 }
799 kr.add(createTmodelInstnaceInfo(PublicationConstants.tmodelOperationalStatusTimeStamp, val, PublicationConstants.tmodelOperationalStatusTimeStampText));
800 }
801 if (policy.isPublishTimeSinceLastStatusChange()) {
802
803 val = (getLastChangeTimeStamp(sp.getURL(), isPooled));
804 if (Utility.stringIsNullOrEmpty(val)) {
805 val = NaN;
806 }
807 kr.add(createTmodelInstnaceInfo(PublicationConstants.tmodelOperationalStatuschange, val,PublicationConstants.tmodelOperationalStatuschangeText));
808 }
809
810
811 if (irr.getBindingTemplate().get(0).getTModelInstanceDetails() == null || irr.getBindingTemplate().get(0).getTModelInstanceDetails().getTModelInstanceInfo() == null
812 || irr.getBindingTemplate().get(0).getTModelInstanceDetails().getTModelInstanceInfo().isEmpty()) {
813
814 irr.getBindingTemplate().get(0).setTModelInstanceDetails(new TModelInstanceDetails());
815 } else {
816
817
818 for (int k4 = 0; k4 < irr.getBindingTemplate().get(0).getTModelInstanceDetails().getTModelInstanceInfo().size(); k4++) {
819 String j = irr.getBindingTemplate().get(0).getTModelInstanceDetails().getTModelInstanceInfo().get(k4).getTModelKey();
820 if (!TmodelKeyIsfgsms(j)) {
821 kr.add(irr.getBindingTemplate().get(0).getTModelInstanceDetails().getTModelInstanceInfo().get(k4));
822 }
823
824 }
825 }
826 irr.getBindingTemplate().get(0).getTModelInstanceDetails().getTModelInstanceInfo().addAll(kr);
827
828 SaveBinding sb = new SaveBinding();
829 sb.setAuthInfo(auth);
830 sb.getBindingTemplate().add(irr.getBindingTemplate().get(0));
831 publication.saveBinding(sb);
832 log.log(Level.INFO, "fgsms performance data for " + sp.getURL() + " has been successfully published to UDDI.");
833 if (isPooled) {
834 AuditLogger.logItem(this.getClass().getCanonicalName(), "PublishUddiData", "UddiPublisher", sp.getURL() + " publishing successful", AuditLogger.unspecified, null);
835 }
836 } catch (DispositionReportFaultMessage ex) {
837 log.log(Level.ERROR, "error saving publication data " + dispositionReportFaultMessageToString(ex), ex);
838 if (isPooled) {
839 AuditLogger.logItem(this.getClass().getCanonicalName(), "PublishUddiData", "UddiPublisher", sp.getURL() + " publishing failed", AuditLogger.unspecified, null);
840 }
841 } catch (Exception ex) {
842 log.log(Level.ERROR, "error saving publication data", ex);
843 if (isPooled) {
844 AuditLogger.logItem(this.getClass().getCanonicalName(), "PublishUddiData", "UddiPublisher", sp.getURL() + " publishing failed", AuditLogger.unspecified, null);
845 }
846 }
847
848 }
849
850 @Override
851 public String GetDisplayName() {
852 return "UDDI Metrics Publisher";
853 }
854
855 @Override
856 public String GetHtmlFormattedHelp() {
857 return "This federation plugin will expose data for the given service via a web service request using the UDDI v3 specification using WSDM QoS parameters. A UDDI v3"
858 + "compliant server is required that supports at least the Inquiry and Publicaion endpoints. This plugin attaches tModel Instance Info data elements to the specified "
859 + "binding template key. This information is published periodically (administratively controlled).<br><br>"
860 + "<ul>"
861 + "<li>" + OPTION_PUBLISH_TIME_RANGE + " - Required, a comma delimted time range in millseconds. It must be one or more of the following"
862 + "<ul><li>5 min = 300000</li>" + " <li>15min = 900000</li>" + " <li>1hr = 3600000</li>" + " <li>24hr = 86400000</li>" + "</ul></li>"
863 + "<li>" + OPTION_BINDING_KEY + " - Required. This is the key of the binding template in UDDI from which data will be attached</li>"
864 + "<li>" + OPTION_PUBLISH_AVG_RES_TIME + " - Optional, valid values =true/false. Publishes average response time. Default = false</li>"
865 + "<li>" + OPTION_PUBLISH_FAULTS + " - Optional, valid values =true/false. Publishes fault counts and MTBF. Default = false</li>"
866 + "<li>" + OPTION_PUBLISH_MAX + " - Optional, valid values =true/false. Publishes the maximum response times and message sizes. Default = false</li>"
867 + "<li>" + OPTION_PUBLISH_SLA + " - Optional, valid values =true/false. Publishes SLA violations count. Default = false</li>"
868 + "<li>" + OPTION_PUBLISH_STATUS + " - Optional, valid values =true/false. Publishes last known status and the time stamp. Default = false</li>"
869 + "<li>" + OPTION_PUBLISH_SUCCESS + " - Optional, valid values =true/false. Publishes successful message counts. Default = false</li>"
870 + "<li>" + OPTION_PUBLISH_UPTIME + " - Optional, valid values =true/false. Publishes Up/Down time information. Default = false</li>"
871 + "</ul>";
872 }
873
874 @Override
875 public List<NameValuePair> GetRequiredParameters() {
876 List<NameValuePair> ret = new ArrayList<NameValuePair>();
877 ret.add(Utility.newNameValuePair(OPTION_PUBLISH_TIME_RANGE, null, false, false));
878 ret.add(Utility.newNameValuePair(OPTION_BINDING_KEY, null, false, false));
879 return ret;
880 }
881
882 @Override
883 public List<NameValuePair> GetOptionalParameters() {
884 ArrayList<NameValuePair> ret = new ArrayList<NameValuePair>();
885 ret.add(Utility.newNameValuePair(OPTION_PUBLISH_AVG_RES_TIME, null, false, false));
886 ret.add(Utility.newNameValuePair(OPTION_PUBLISH_FAULTS, null, false, false));
887 ret.add(Utility.newNameValuePair(OPTION_PUBLISH_MAX, null, false, false));
888 ret.add(Utility.newNameValuePair(OPTION_PUBLISH_SLA, null, false, false));
889 ret.add(Utility.newNameValuePair(OPTION_PUBLISH_STATUS, null, false, false));
890 ret.add(Utility.newNameValuePair(OPTION_PUBLISH_SUCCESS, null, false, false));
891 ret.add(Utility.newNameValuePair(OPTION_PUBLISH_UPTIME, null, false, false));
892
893
894 return ret;
895 }
896
897 @Override
898 public List<PolicyType> GetAppliesTo() {
899 List<PolicyType> ret = new ArrayList<PolicyType>();
900 ret.add(PolicyType.STATUS);
901 ret.add(PolicyType.TRANSACTIONAL);
902 return ret;
903 }
904
905 private TModelInstanceInfo createTmodelInstnaceInfo(String key, String value, String description) {
906 TModelInstanceInfo r = new TModelInstanceInfo();
907 r.setTModelKey(key);
908 r.getDescription().add(new Description(description, PublicationConstants.lang));
909 r.setInstanceDetails(new InstanceDetails());
910 r.getInstanceDetails().setInstanceParms(value);
911 return r;
912 }
913
914
915
916
917
918 public static void addMontior(BindingProvider bpPCS) {
919 if (bpPCS==null)return;
920 List<Handler> handlerChain = bpPCS.getBinding().getHandlerChain();
921 if (handlerChain==null)
922 handlerChain = new ArrayList<Handler>();
923 for (int i=0; i < handlerChain.size(); i++){
924 if (handlerChain.get(i) instanceof JAXWSGenericClientAgent)
925 return;
926 if (handlerChain.get(i) instanceof JAXWSGenericAgent)
927 return;
928 }
929 handlerChain.add(new JAXWSGenericClientAgent());
930 bpPCS.getBinding().setHandlerChain(handlerChain);
931
932
933
934 }
935
936 private enum AuthMode {
937
938 Uddi, Http
939 }
940 private AuthMode uddiauth = AuthMode.Http;
941
942
943
944
945 public boolean State = false;
946 protected String username = "";
947 protected String password = "";
948
949
950
951
952 private String loginWrapper() {
953
954 return login(username, password);
955 }
956
957
958
959
960 public long getUddiPublishInterval() {
961 try {
962 KeyNameValueEnc p = DBSettingsLoader.GetPropertiesFromDB(isPooled, "UddiPublisher", "Interval");
963 if (p != null) {
964 String t = p.getKeyNameValue().getPropertyValue();
965 long l = Long.parseLong(t);
966 return l;
967 }
968 } catch (Exception ex) {
969 }
970 return 24 * 60 * 60 * 1000;
971 }
972
973 private String login(String username, String password) {
974 if (Utility.stringIsNullOrEmpty(username) || Utility.stringIsNullOrEmpty(password)) {
975 return "";
976 }
977 if (uddiauth != AuthMode.Uddi) {
978 return "";
979 }
980
981
982 GetAuthToken request = new GetAuthToken();
983 request.setUserID(username);
984 request.setCred(Utility.DE(password));
985 try {
986 AuthToken response = security.getAuthToken(request);
987 return response.getAuthInfo();
988 } catch (Exception ex) {
989 log.log(Level.ERROR, "Error authenticating to the UDDI server: ", ex);
990 throw new IllegalArgumentException("can't authenticate to UDDI with the provided credentials");
991
992 }
993 }
994
995
996
997
998
999 private boolean checkTmodelPublication() {
1000 GetTModelDetail req = new GetTModelDetail();
1001 req.setAuthInfo(loginWrapper());
1002 String[] items = PublicationConstants.getAllTmodelKeys();
1003 for (int i = 0; i < items.length; i++) {
1004 req.getTModelKey().add(items[i]);
1005 }
1006
1007 TModelDetail response = null;
1008 try {
1009 response = inquiry.getTModelDetail(req);
1010 } catch (DispositionReportFaultMessage f) {
1011 log.log(Level.WARN, "error caught probing for tmodels " + dispositionReportFaultMessageToString(f), f);
1012 } catch (Exception ex) {
1013 }
1014 if (response == null || response.getTModel() == null || response.getTModel().size() < items.length) {
1015 log.log(Level.WARN, "Some or all of the fgsms tModels are not present, publishing....");
1016 if (isPooled) {
1017 AuditLogger.logItem(this.getClass().getCanonicalName(), "CheckTmodelPublication", "UddiPublisher", "Publishing tModel definitions", AuditLogger.unspecified, null);
1018 }
1019 return publishTmodels();
1020 } else {
1021 log.log(Level.INFO, "All fgsms tModels are present");
1022 }
1023 return true;
1024
1025 }
1026
1027
1028
1029 private boolean publishTmodels() {
1030
1031
1032
1033 org.uddi.api_v3.ObjectFactory fac = new org.uddi.api_v3.ObjectFactory();
1034 TModel t;
1035 Name n;
1036 Description d;
1037 CategoryBag c;
1038
1039 KeyedReference keygen = new KeyedReference();
1040 keygen.setTModelKey("uddi:uddi.org:categorization:types");
1041 keygen.setKeyName("keyGenerator");
1042 keygen.setKeyValue("keyGenerator");
1043
1044 SaveTModel request = new SaveTModel();
1045 request.setAuthInfo(loginWrapper());
1046 t = new TModel();
1047 t.setTModelKey(PublicationConstants.tmodelKeyGen);
1048 n = new Name();
1049 n.setLang(PublicationConstants.lang);
1050 n.setValue(PublicationConstants.tmodelKeyGenText);
1051 t.setName(n);
1052 d = new Description();
1053 d.setLang(PublicationConstants.lang);
1054 d.setValue(PublicationConstants.tmodelKeyGenText);
1055 t.getDescription().add(d);
1056 c = new CategoryBag();
1057 c.getKeyedReference().add((keygen));
1058 t.setCategoryBag(c);
1059 request.getTModel().add(t);
1060 try {
1061 publication.saveTModel(request);
1062 log.log(Level.INFO, "successfullly created the fgsms UDDI Key Geneator");
1063 if (isPooled) {
1064 AuditLogger.logItem(this.getClass().getCanonicalName(), "PublishTmodels", "UddiPublisher", "fgsms Key Generator Published", AuditLogger.unspecified, null);
1065 }
1066 } catch (DispositionReportFaultMessage f) {
1067
1068 log.log(Level.ERROR, "unable to set keygenerator tmodel" + dispositionReportFaultMessageToString(f), f);
1069 } catch (Exception ex) {
1070 log.log(Level.ERROR, "unable to set keygenerator tmodel", ex);
1071 if (isPooled) {
1072 AuditLogger.logItem(this.getClass().getCanonicalName(), "PublishTmodels", "UddiPublisher", "fgsms Key Generator Failed", AuditLogger.unspecified, null);
1073 }
1074 return false;
1075
1076 }
1077
1078 KeyedReference shared = new KeyedReference();
1079 shared.setTModelKey("uddi:uddi.org:categorization:types");
1080 shared.setKeyName("uddi-org:types:categorization");
1081 shared.setKeyValue("categorization");
1082
1083 request = new SaveTModel();
1084 request.setAuthInfo(loginWrapper());
1085
1086
1087 t = new TModel();
1088 t.setTModelKey(PublicationConstants.tmodelSLAViolations5min);
1089 n = new Name();
1090 n.setLang(PublicationConstants.lang);
1091 n.setValue(PublicationConstants.tmodelSLAViolationsDescription5min);
1092 t.setName(n);
1093 d = new Description();
1094 d.setLang(PublicationConstants.lang);
1095 d.setValue(PublicationConstants.tmodelSLAViolationsText);
1096 t.getDescription().add(d);
1097 c = new CategoryBag();
1098 c.getKeyedReference().add((shared));
1099 t.setCategoryBag(c);
1100 request.getTModel().add(t);
1101
1102 t = new TModel();
1103 t.setTModelKey(PublicationConstants.tmodelSLAViolations15min);
1104 n = new Name();
1105 n.setLang(PublicationConstants.lang);
1106 n.setValue(PublicationConstants.tmodelSLAViolationsDescription15min);
1107 t.setName(n);
1108 d = new Description();
1109 d.setLang(PublicationConstants.lang);
1110 d.setValue(PublicationConstants.tmodelSLAViolationsText);
1111 t.getDescription().add(d);
1112 c = new CategoryBag();
1113 c.getKeyedReference().add((shared));
1114 t.setCategoryBag(c);
1115 request.getTModel().add(t);
1116
1117 t = new TModel();
1118 t.setTModelKey(PublicationConstants.tmodelSLAViolations60min);
1119 n = new Name();
1120 n.setLang(PublicationConstants.lang);
1121 n.setValue(PublicationConstants.tmodelSLAViolationsDescription60min);
1122 t.setName(n);
1123 d = new Description();
1124 d.setLang(PublicationConstants.lang);
1125 d.setValue(PublicationConstants.tmodelSLAViolationsText);
1126 t.getDescription().add(d);
1127 c = new CategoryBag();
1128 c.getKeyedReference().add((shared));
1129 t.setCategoryBag(c);
1130 request.getTModel().add(t);
1131
1132 t = new TModel();
1133 t.setTModelKey(PublicationConstants.tmodelSLAViolations24hr);
1134 n = new Name();
1135 n.setLang(PublicationConstants.lang);
1136 n.setValue(PublicationConstants.tmodelSLAViolationsDescription24hr);
1137 t.setName(n);
1138 d = new Description();
1139 d.setLang(PublicationConstants.lang);
1140 d.setValue(PublicationConstants.tmodelSLAViolationsText);
1141 t.getDescription().add(d);
1142 c = new CategoryBag();
1143 c.getKeyedReference().add((shared));
1144 t.setCategoryBag(c);
1145 request.getTModel().add(t);
1146
1147 t = new TModel();
1148 t.setTModelKey(PublicationConstants.tmodelSuccessCount5min);
1149 n = new Name();
1150 n.setLang(PublicationConstants.lang);
1151 n.setValue(PublicationConstants.tmodelSuccessCountDescription5min);
1152 t.setName(n);
1153 d = new Description();
1154 d.setLang(PublicationConstants.lang);
1155 d.setValue(PublicationConstants.tmodelSuccessText);
1156 t.getDescription().add(d);
1157 c = new CategoryBag();
1158 c.getKeyedReference().add((shared));
1159 t.setCategoryBag(c);
1160 request.getTModel().add(t);
1161
1162
1163 t = new TModel();
1164 t.setTModelKey(PublicationConstants.tmodelSuccessCount15min);
1165 n = new Name();
1166 n.setLang(PublicationConstants.lang);
1167 n.setValue(PublicationConstants.tmodelSuccessCountDescription15min);
1168 t.setName(n);
1169 d = new Description();
1170 d.setLang(PublicationConstants.lang);
1171 d.setValue(PublicationConstants.tmodelSuccessText);
1172 t.getDescription().add(d);
1173 c = new CategoryBag();
1174 c.getKeyedReference().add((shared));
1175 t.setCategoryBag(c);
1176 request.getTModel().add(t);
1177
1178
1179 t = new TModel();
1180 t.setTModelKey(PublicationConstants.tmodelSuccessCount60min);
1181 n = new Name();
1182 n.setLang(PublicationConstants.lang);
1183 n.setValue(PublicationConstants.tmodelSuccessCountDescription60min);
1184 t.setName(n);
1185 d = new Description();
1186 d.setLang(PublicationConstants.lang);
1187 d.setValue(PublicationConstants.tmodelSuccessText);
1188 t.getDescription().add(d);
1189 c = new CategoryBag();
1190 c.getKeyedReference().add((shared));
1191 t.setCategoryBag(c);
1192 request.getTModel().add(t);
1193
1194
1195 t = new TModel();
1196 t.setTModelKey(PublicationConstants.tmodelSuccessCount24hr);
1197 n = new Name();
1198 n.setLang(PublicationConstants.lang);
1199 n.setValue(PublicationConstants.tmodelSuccessCountDescription24hr);
1200 t.setName(n);
1201 d = new Description();
1202 d.setLang(PublicationConstants.lang);
1203 d.setValue(PublicationConstants.tmodelSuccessText);
1204 t.getDescription().add(d);
1205 c = new CategoryBag();
1206 c.getKeyedReference().add((shared));
1207 t.setCategoryBag(c);
1208 request.getTModel().add(t);
1209
1210
1211 t = new TModel();
1212 t.setTModelKey(PublicationConstants.tmodelFailureCount5min);
1213 n = new Name();
1214 n.setLang(PublicationConstants.lang);
1215 n.setValue(PublicationConstants.tmodelFailureCountDescription5min);
1216 t.setName(n);
1217 d = new Description();
1218 d.setLang(PublicationConstants.lang);
1219 d.setValue(PublicationConstants.tmodelFailureCountText);
1220 t.getDescription().add(d);
1221 c = new CategoryBag();
1222 c.getKeyedReference().add((shared));
1223 t.setCategoryBag(c);
1224 request.getTModel().add(t);
1225
1226
1227 t = new TModel();
1228 t.setTModelKey(PublicationConstants.tmodelFailureCount15min);
1229 n = new Name();
1230 n.setLang(PublicationConstants.lang);
1231 n.setValue(PublicationConstants.tmodelFailureCountDescription15min);
1232 t.setName(n);
1233 d = new Description();
1234 d.setLang(PublicationConstants.lang);
1235 d.setValue(PublicationConstants.tmodelFailureCountText);
1236 t.getDescription().add(d);
1237 c = new CategoryBag();
1238 c.getKeyedReference().add((shared));
1239 t.setCategoryBag(c);
1240 request.getTModel().add(t);
1241
1242
1243 t = new TModel();
1244 t.setTModelKey(PublicationConstants.tmodelFailureCount60min);
1245 n = new Name();
1246 n.setLang(PublicationConstants.lang);
1247 n.setValue(PublicationConstants.tmodelFailureCountDescription60min);
1248 t.setName(n);
1249 d = new Description();
1250 d.setLang(PublicationConstants.lang);
1251 d.setValue(PublicationConstants.tmodelFailureCountText);
1252 t.getDescription().add(d);
1253 c = new CategoryBag();
1254 c.getKeyedReference().add((shared));
1255 t.setCategoryBag(c);
1256 request.getTModel().add(t);
1257
1258
1259 t = new TModel();
1260 t.setTModelKey(PublicationConstants.tmodelFailureCount24hr);
1261 n = new Name();
1262 n.setLang(PublicationConstants.lang);
1263 n.setValue(PublicationConstants.tmodelFailureCountDescription24hr);
1264 t.setName(n);
1265 d = new Description();
1266 d.setLang(PublicationConstants.lang);
1267 d.setValue(PublicationConstants.tmodelFailureCountText);
1268 t.getDescription().add(d);
1269 c = new CategoryBag();
1270 c.getKeyedReference().add((shared));
1271 t.setCategoryBag(c);
1272 request.getTModel().add(t);
1273
1274
1275 t = new TModel();
1276 t.setTModelKey(PublicationConstants.tmodelMTBF5min);
1277 n = new Name();
1278 n.setLang(PublicationConstants.lang);
1279 n.setValue(PublicationConstants.tmodelMTBFDescription5min);
1280 t.setName(n);
1281 d = new Description();
1282 d.setLang(PublicationConstants.lang);
1283 d.setValue(PublicationConstants.tmodelMTBFText);
1284 t.getDescription().add(d);
1285 c = new CategoryBag();
1286 c.getKeyedReference().add((shared));
1287 t.setCategoryBag(c);
1288 request.getTModel().add(t);
1289
1290
1291 t = new TModel();
1292 t.setTModelKey(PublicationConstants.tmodelMTBF15min);
1293 n = new Name();
1294 n.setLang(PublicationConstants.lang);
1295 n.setValue(PublicationConstants.tmodelMTBFDescription15min);
1296 t.setName(n);
1297 d = new Description();
1298 d.setLang(PublicationConstants.lang);
1299 d.setValue(PublicationConstants.tmodelMTBFText);
1300 t.getDescription().add(d);
1301 c = new CategoryBag();
1302 c.getKeyedReference().add((shared));
1303 t.setCategoryBag(c);
1304 request.getTModel().add(t);
1305
1306
1307 t = new TModel();
1308 t.setTModelKey(PublicationConstants.tmodelMTBF60min);
1309 n = new Name();
1310 n.setLang(PublicationConstants.lang);
1311 n.setValue(PublicationConstants.tmodelMTBFDescription60min);
1312 t.setName(n);
1313 d = new Description();
1314 d.setLang(PublicationConstants.lang);
1315 d.setValue(PublicationConstants.tmodelMTBFText);
1316 t.getDescription().add(d);
1317 c = new CategoryBag();
1318 c.getKeyedReference().add((shared));
1319 t.setCategoryBag(c);
1320 request.getTModel().add(t);
1321
1322
1323 t = new TModel();
1324 t.setTModelKey(PublicationConstants.tmodelMTBF24hr);
1325 n = new Name();
1326 n.setLang(PublicationConstants.lang);
1327 n.setValue(PublicationConstants.tmodelMTBFDescription24hr);
1328 t.setName(n);
1329 d = new Description();
1330 d.setLang(PublicationConstants.lang);
1331 d.setValue(PublicationConstants.tmodelMTBFText);
1332 t.getDescription().add(d);
1333 c = new CategoryBag();
1334 c.getKeyedReference().add((shared));
1335 t.setCategoryBag(c);
1336 request.getTModel().add(t);
1337
1338
1339
1340 t = new TModel();
1341 t.setTModelKey(PublicationConstants.tmodelUpDownTimePercentage5min);
1342 n = new Name();
1343 n.setLang(PublicationConstants.lang);
1344 n.setValue(PublicationConstants.tmodelUpDownTimePercentageDescription5min);
1345 t.setName(n);
1346 d = new Description();
1347 d.setLang(PublicationConstants.lang);
1348 d.setValue(PublicationConstants.tmodelUpDownTimePercentage5min);
1349 t.getDescription().add(d);
1350 c = new CategoryBag();
1351 c.getKeyedReference().add((shared));
1352 t.setCategoryBag(c);
1353 request.getTModel().add(t);
1354
1355 t = new TModel();
1356 t.setTModelKey(PublicationConstants.tmodelUpDownTimePercentage15min);
1357 n = new Name();
1358 n.setLang(PublicationConstants.lang);
1359 n.setValue(PublicationConstants.tmodelUpDownTimePercentageDescription15min);
1360 t.setName(n);
1361 d = new Description();
1362 d.setLang(PublicationConstants.lang);
1363 d.setValue(PublicationConstants.tmodelUpDownTimePercentage15min);
1364 t.getDescription().add(d);
1365 c = new CategoryBag();
1366 c.getKeyedReference().add((shared));
1367 t.setCategoryBag(c);
1368 request.getTModel().add(t);
1369
1370 t = new TModel();
1371 t.setTModelKey(PublicationConstants.tmodelUpDownTimePercentage60min);
1372 n = new Name();
1373 n.setLang(PublicationConstants.lang);
1374 n.setValue(PublicationConstants.tmodelUpDownTimePercentageDescription60min);
1375 t.setName(n);
1376 d = new Description();
1377 d.setLang(PublicationConstants.lang);
1378 d.setValue(PublicationConstants.tmodelUpDownTimePercentage60min);
1379 t.getDescription().add(d);
1380 c = new CategoryBag();
1381 c.getKeyedReference().add((shared));
1382 t.setCategoryBag(c);
1383 request.getTModel().add(t);
1384
1385 t = new TModel();
1386 t.setTModelKey(PublicationConstants.tmodelUpDownTimePercentage24hr);
1387 n = new Name();
1388 n.setLang(PublicationConstants.lang);
1389 n.setValue(PublicationConstants.tmodelUpDownTimePercentageDescription24hr);
1390 t.setName(n);
1391 d = new Description();
1392 d.setLang(PublicationConstants.lang);
1393 d.setValue(PublicationConstants.tmodelUpDownTimePercentage24hr);
1394 t.getDescription().add(d);
1395 c = new CategoryBag();
1396 c.getKeyedReference().add((shared));
1397 t.setCategoryBag(c);
1398 request.getTModel().add(t);
1399
1400
1401 t = new TModel();
1402 t.setTModelKey(PublicationConstants.tmodelMaxResponseSize5min);
1403 n = new Name();
1404 n.setLang(PublicationConstants.lang);
1405 n.setValue(PublicationConstants.tmodelMaxResponseSizeDescription5min);
1406 t.setName(n);
1407 d = new Description();
1408 d.setLang(PublicationConstants.lang);
1409 d.setValue(PublicationConstants.tmodelMaxResponseSizeText);
1410 t.getDescription().add(d);
1411 c = new CategoryBag();
1412 c.getKeyedReference().add((shared));
1413 t.setCategoryBag(c);
1414 request.getTModel().add(t);
1415
1416 t = new TModel();
1417 t.setTModelKey(PublicationConstants.tmodelMaxResponseSize15min);
1418 n = new Name();
1419 n.setLang(PublicationConstants.lang);
1420 n.setValue(PublicationConstants.tmodelMaxResponseSizeDescription15min);
1421 t.setName(n);
1422 d = new Description();
1423 d.setLang(PublicationConstants.lang);
1424 d.setValue(PublicationConstants.tmodelMaxResponseSizeText);
1425 t.getDescription().add(d);
1426 c = new CategoryBag();
1427 c.getKeyedReference().add((shared));
1428 t.setCategoryBag(c);
1429 request.getTModel().add(t);
1430
1431 t = new TModel();
1432 t.setTModelKey(PublicationConstants.tmodelMaxResponseSize60min);
1433 n = new Name();
1434 n.setLang(PublicationConstants.lang);
1435 n.setValue(PublicationConstants.tmodelMaxResponseSizeDescription60min);
1436 t.setName(n);
1437 d = new Description();
1438 d.setLang(PublicationConstants.lang);
1439 d.setValue(PublicationConstants.tmodelMaxResponseSizeText);
1440 t.getDescription().add(d);
1441 c = new CategoryBag();
1442 c.getKeyedReference().add((shared));
1443 t.setCategoryBag(c);
1444 request.getTModel().add(t);
1445
1446 t = new TModel();
1447 t.setTModelKey(PublicationConstants.tmodelMaxResponseSize24hr);
1448 n = new Name();
1449 n.setLang(PublicationConstants.lang);
1450 n.setValue(PublicationConstants.tmodelMaxResponseSizeDescription24hr);
1451 t.setName(n);
1452 d = new Description();
1453 d.setLang(PublicationConstants.lang);
1454 d.setValue(PublicationConstants.tmodelMaxResponseSizeText);
1455 t.getDescription().add(d);
1456 c = new CategoryBag();
1457 c.getKeyedReference().add((shared));
1458 t.setCategoryBag(c);
1459 request.getTModel().add(t);
1460
1461 t = new TModel();
1462 t.setTModelKey(PublicationConstants.tmodelMaxRequestSize5min);
1463 n = new Name();
1464 n.setLang(PublicationConstants.lang);
1465 n.setValue(PublicationConstants.tmodelMaxRequestSizeDescription5min);
1466 t.setName(n);
1467 d = new Description();
1468 d.setLang(PublicationConstants.lang);
1469 d.setValue(PublicationConstants.tmodelMaxresponseTimeText);
1470 t.getDescription().add(d);
1471 c = new CategoryBag();
1472 c.getKeyedReference().add((shared));
1473 t.setCategoryBag(c);
1474 request.getTModel().add(t);
1475
1476 t = new TModel();
1477 t.setTModelKey(PublicationConstants.tmodelMaxRequestSize15min);
1478 n = new Name();
1479 n.setLang(PublicationConstants.lang);
1480 n.setValue(PublicationConstants.tmodelMaxRequestSizeDescription15min);
1481 t.setName(n);
1482 d = new Description();
1483 d.setLang(PublicationConstants.lang);
1484 d.setValue(PublicationConstants.tmodelMaxRequestSizeText);
1485 t.getDescription().add(d);
1486 c = new CategoryBag();
1487 c.getKeyedReference().add((shared));
1488 t.setCategoryBag(c);
1489 request.getTModel().add(t);
1490
1491 t = new TModel();
1492 t.setTModelKey(PublicationConstants.tmodelMaxRequestSize60min);
1493 n = new Name();
1494 n.setLang(PublicationConstants.lang);
1495 n.setValue(PublicationConstants.tmodelMaxRequestSizeDescription60min);
1496 t.setName(n);
1497 d = new Description();
1498 d.setLang(PublicationConstants.lang);
1499 d.setValue(PublicationConstants.tmodelMaxRequestSizeText);
1500 t.getDescription().add(d);
1501 c = new CategoryBag();
1502 c.getKeyedReference().add((shared));
1503 t.setCategoryBag(c);
1504 request.getTModel().add(t);
1505
1506 t = new TModel();
1507 t.setTModelKey(PublicationConstants.tmodelMaxRequestSize24hr);
1508 n = new Name();
1509 n.setLang(PublicationConstants.lang);
1510 n.setValue(PublicationConstants.tmodelMaxRequestSizeDescription24hr);
1511 t.setName(n);
1512 d = new Description();
1513 d.setLang(PublicationConstants.lang);
1514 d.setValue(PublicationConstants.tmodelMaxRequestSizeText);
1515 t.getDescription().add(d);
1516 c = new CategoryBag();
1517 c.getKeyedReference().add((shared));
1518 t.setCategoryBag(c);
1519 request.getTModel().add(t);
1520
1521 t = new TModel();
1522 t.setTModelKey(PublicationConstants.tmodelMaxresponseTime5min);
1523 n = new Name();
1524 n.setLang(PublicationConstants.lang);
1525 n.setValue(PublicationConstants.tmodelMaxresponseTimeDescription5min);
1526 t.setName(n);
1527 d = new Description();
1528 d.setLang(PublicationConstants.lang);
1529 d.setValue(PublicationConstants.tmodelMaxresponseTimeText);
1530 t.getDescription().add(d);
1531 c = new CategoryBag();
1532 c.getKeyedReference().add((shared));
1533 t.setCategoryBag(c);
1534 request.getTModel().add(t);
1535
1536 t = new TModel();
1537 t.setTModelKey(PublicationConstants.tmodelMaxresponseTime15min);
1538 n = new Name();
1539 n.setLang(PublicationConstants.lang);
1540 n.setValue(PublicationConstants.tmodelMaxresponseTimeDescription15min);
1541 t.setName(n);
1542 d = new Description();
1543 d.setLang(PublicationConstants.lang);
1544 d.setValue(PublicationConstants.tmodelMaxresponseTimeText);
1545 t.getDescription().add(d);
1546 c = new CategoryBag();
1547 c.getKeyedReference().add((shared));
1548 t.setCategoryBag(c);
1549 request.getTModel().add(t);
1550
1551 t = new TModel();
1552 t.setTModelKey(PublicationConstants.tmodelMaxresponseTime60min);
1553 n = new Name();
1554 n.setLang(PublicationConstants.lang);
1555 n.setValue(PublicationConstants.tmodelMaxresponseTimeDescription60min);
1556 t.setName(n);
1557 d = new Description();
1558 d.setLang(PublicationConstants.lang);
1559 d.setValue(PublicationConstants.tmodelMaxresponseTimeText);
1560 t.getDescription().add(d);
1561 c = new CategoryBag();
1562 c.getKeyedReference().add((shared));
1563 t.setCategoryBag(c);
1564 request.getTModel().add(t);
1565
1566 t = new TModel();
1567 t.setTModelKey(PublicationConstants.tmodelMaxresponseTime24hr);
1568 n = new Name();
1569 n.setLang(PublicationConstants.lang);
1570 n.setValue(PublicationConstants.tmodelMaxresponseTimeDescription24hr);
1571 t.setName(n);
1572 d = new Description();
1573 d.setLang(PublicationConstants.lang);
1574 d.setValue(PublicationConstants.tmodelMaxresponseTimeText);
1575 t.getDescription().add(d);
1576 c = new CategoryBag();
1577 c.getKeyedReference().add((shared));
1578 t.setCategoryBag(c);
1579 request.getTModel().add(t);
1580
1581 t = new TModel();
1582 t.setTModelKey(PublicationConstants.tmodelMaxRequestSize5min);
1583 n = new Name();
1584 n.setLang(PublicationConstants.lang);
1585 n.setValue(PublicationConstants.tmodelMaxRequestSizeDescription5min);
1586 t.setName(n);
1587 d = new Description();
1588 d.setLang(PublicationConstants.lang);
1589 d.setValue(PublicationConstants.tmodelMaxRequestSizeText);
1590 t.getDescription().add(d);
1591 c = new CategoryBag();
1592 c.getKeyedReference().add((shared));
1593 t.setCategoryBag(c);
1594 request.getTModel().add(t);
1595
1596
1597 t = new TModel();
1598 t.setTModelKey(PublicationConstants.tmodelMaxRequestSize15min);
1599 n = new Name();
1600 n.setLang(PublicationConstants.lang);
1601 n.setValue(PublicationConstants.tmodelMaxRequestSizeDescription15min);
1602 t.setName(n);
1603 d = new Description();
1604 d.setLang(PublicationConstants.lang);
1605 d.setValue(PublicationConstants.tmodelMaxRequestSizeText);
1606 t.getDescription().add(d);
1607 c = new CategoryBag();
1608 c.getKeyedReference().add((shared));
1609 t.setCategoryBag(c);
1610 request.getTModel().add(t);
1611
1612
1613 t = new TModel();
1614 t.setTModelKey(PublicationConstants.tmodelMaxRequestSize24hr);
1615 n = new Name();
1616 n.setLang(PublicationConstants.lang);
1617 n.setValue(PublicationConstants.tmodelMaxRequestSizeDescription24hr);
1618 t.setName(n);
1619 d = new Description();
1620 d.setLang(PublicationConstants.lang);
1621 d.setValue(PublicationConstants.tmodelMaxRequestSizeText);
1622 t.getDescription().add(d);
1623 c = new CategoryBag();
1624 c.getKeyedReference().add((shared));
1625 t.setCategoryBag(c);
1626 request.getTModel().add(t);
1627
1628
1629 t = new TModel();
1630 t.setTModelKey(PublicationConstants.tmodelMaxRequestSize5min);
1631 n = new Name();
1632 n.setLang(PublicationConstants.lang);
1633 n.setValue(PublicationConstants.tmodelMaxRequestSizeDescription5min);
1634 t.setName(n);
1635 d = new Description();
1636 d.setLang(PublicationConstants.lang);
1637 d.setValue(PublicationConstants.tmodelMaxRequestSizeText);
1638 t.getDescription().add(d);
1639 c = new CategoryBag();
1640 c.getKeyedReference().add((shared));
1641 t.setCategoryBag(c);
1642 request.getTModel().add(t);
1643
1644
1645 t = new TModel();
1646 t.setTModelKey(PublicationConstants.tmodelAverageResponseTime5min);
1647 n = new Name();
1648 n.setLang(PublicationConstants.lang);
1649 n.setValue(PublicationConstants.tmodelAverageResponseTimeDescription5min);
1650 t.setName(n);
1651 d = new Description();
1652 d.setLang(PublicationConstants.lang);
1653 d.setValue(PublicationConstants.tmodelAverageResponseTimeText);
1654 t.getDescription().add(d);
1655 c = new CategoryBag();
1656 c.getKeyedReference().add((shared));
1657 t.setCategoryBag(c);
1658 request.getTModel().add(t);
1659
1660 t = new TModel();
1661 t.setTModelKey(PublicationConstants.tmodelAverageResponseTime15min);
1662 n = new Name();
1663 n.setLang(PublicationConstants.lang);
1664 n.setValue(PublicationConstants.tmodelAverageResponseTimeDescription15min);
1665 t.setName(n);
1666 d = new Description();
1667 d.setLang(PublicationConstants.lang);
1668 d.setValue(PublicationConstants.tmodelAverageResponseTimeText);
1669 t.getDescription().add(d);
1670 c = new CategoryBag();
1671 c.getKeyedReference().add((shared));
1672 t.setCategoryBag(c);
1673 request.getTModel().add(t);
1674
1675 t = new TModel();
1676 t.setTModelKey(PublicationConstants.tmodelAverageResponseTime60min);
1677 n = new Name();
1678 n.setLang(PublicationConstants.lang);
1679 n.setValue(PublicationConstants.tmodelAverageResponseTimeDescription60min);
1680 t.setName(n);
1681 d = new Description();
1682 d.setLang(PublicationConstants.lang);
1683 d.setValue(PublicationConstants.tmodelAverageResponseTimeText);
1684 t.getDescription().add(d);
1685 c = new CategoryBag();
1686 c.getKeyedReference().add((shared));
1687 t.setCategoryBag(c);
1688 request.getTModel().add(t);
1689
1690 t = new TModel();
1691 t.setTModelKey(PublicationConstants.tmodelMaxRequestSize24hr);
1692 n = new Name();
1693 n.setLang(PublicationConstants.lang);
1694 n.setValue(PublicationConstants.tmodelMaxRequestSizeDescription24hr);
1695 t.setName(n);
1696 d = new Description();
1697 d.setLang(PublicationConstants.lang);
1698 d.setValue(PublicationConstants.tmodelMaxresponseTimeText);
1699 t.getDescription().add(d);
1700 c = new CategoryBag();
1701 c.getKeyedReference().add((shared));
1702 t.setCategoryBag(c);
1703 request.getTModel().add(t);
1704
1705
1706 t = new TModel();
1707 t.setTModelKey(PublicationConstants.tmodelMaxRequestSize5min);
1708 n = new Name();
1709 n.setLang(PublicationConstants.lang);
1710 n.setValue(PublicationConstants.tmodelMaxRequestSizeDescription5min);
1711 t.setName(n);
1712 d = new Description();
1713 d.setLang(PublicationConstants.lang);
1714 d.setValue(PublicationConstants.tmodelMaxresponseTimeText);
1715 t.getDescription().add(d);
1716 c = new CategoryBag();
1717 c.getKeyedReference().add((shared));
1718 t.setCategoryBag(c);
1719 request.getTModel().add(t);
1720
1721 t = new TModel();
1722 t.setTModelKey(PublicationConstants.tmodelAverageResponseTime60min);
1723 n = new Name();
1724 n.setLang(PublicationConstants.lang);
1725 n.setValue(PublicationConstants.tmodelAverageResponseTimeDescription60min);
1726 t.setName(n);
1727 d = new Description();
1728 d.setLang(PublicationConstants.lang);
1729 d.setValue(PublicationConstants.tmodelAverageResponseTimeText);
1730 t.getDescription().add(d);
1731 c = new CategoryBag();
1732 c.getKeyedReference().add((shared));
1733 t.setCategoryBag(c);
1734 request.getTModel().add(t);
1735
1736
1737 t = new TModel();
1738 t.setTModelKey(PublicationConstants.tmodelAverageResponseTime24hr);
1739 n = new Name();
1740 n.setLang(PublicationConstants.lang);
1741 n.setValue(PublicationConstants.tmodelAverageResponseTimeDescription24hr);
1742 t.setName(n);
1743 d = new Description();
1744 d.setLang(PublicationConstants.lang);
1745 d.setValue(PublicationConstants.tmodelAverageResponseTimeText);
1746 t.getDescription().add(d);
1747 c = new CategoryBag();
1748 c.getKeyedReference().add((shared));
1749 t.setCategoryBag(c);
1750 request.getTModel().add(t);
1751
1752
1753 t = new TModel();
1754 t.setTModelKey(PublicationConstants.tmodelTimeRange);
1755 n = new Name();
1756 n.setLang(PublicationConstants.lang);
1757 n.setValue(PublicationConstants.tmodelTimeRangeDescription);
1758 t.setName(n);
1759 d = new Description();
1760 d.setLang(PublicationConstants.lang);
1761 d.setValue(PublicationConstants.tmodelTimeRangeText);
1762 t.getDescription().add(d);
1763 c = new CategoryBag();
1764 c.getKeyedReference().add((shared));
1765 t.setCategoryBag(c);
1766 request.getTModel().add(t);
1767
1768
1769 t = new TModel();
1770 t.setTModelKey(PublicationConstants.tmodelOperationalMonitoredBy);
1771 n = new Name();
1772 n.setLang(PublicationConstants.lang);
1773 n.setValue(PublicationConstants.tmodelOperationalMonitoredByDescription);
1774 t.setName(n);
1775 d = new Description();
1776 d.setLang(PublicationConstants.lang);
1777 d.setValue(PublicationConstants.tmodelOperationalMonitoredByDescription);
1778 t.getDescription().add(d);
1779 c = new CategoryBag();
1780 c.getKeyedReference().add((shared));
1781 t.setCategoryBag(c);
1782 request.getTModel().add(t);
1783
1784
1785 t = new TModel();
1786 t.setTModelKey(PublicationConstants.tmodelOperationalStatusTimeStamp);
1787 n = new Name();
1788 n.setLang(PublicationConstants.lang);
1789 n.setValue(PublicationConstants.tmodelOperationalStatusTimeStampDescription);
1790 t.setName(n);
1791 d = new Description();
1792 d.setLang(PublicationConstants.lang);
1793 d.setValue(PublicationConstants.tmodelOperationalStatusTimeStampText);
1794 t.getDescription().add(d);
1795 c = new CategoryBag();
1796 c.getKeyedReference().add((shared));
1797 t.setCategoryBag(c);
1798 request.getTModel().add(t);
1799
1800
1801 t = new TModel();
1802 t.setTModelKey(PublicationConstants.tmodelOperationalStatus);
1803 n = new Name();
1804 n.setLang(PublicationConstants.lang);
1805 n.setValue(PublicationConstants.tmodelOperationalStatusDescription);
1806 t.setName(n);
1807 d = new Description();
1808 d.setLang(PublicationConstants.lang);
1809 d.setValue(PublicationConstants.tmodelOperationalStatusText);
1810 t.getDescription().add(d);
1811 c = new CategoryBag();
1812 c.getKeyedReference().add((shared));
1813 t.setCategoryBag(c);
1814 request.getTModel().add(t);
1815
1816
1817 t = new TModel();
1818 t.setTModelKey(PublicationConstants.tmodelOperationalStatuschange);
1819 n = new Name();
1820 n.setLang(PublicationConstants.lang);
1821 n.setValue(PublicationConstants.tmodelOperationalStatuschangeDescription);
1822 t.setName(n);
1823 d = new Description();
1824 d.setLang(PublicationConstants.lang);
1825 d.setValue(PublicationConstants.tmodelOperationalStatuschangeText);
1826 t.getDescription().add(d);
1827 c = new CategoryBag();
1828 c.getKeyedReference().add((shared));
1829 t.setCategoryBag(c);
1830 request.getTModel().add(t);
1831
1832
1833 t = new TModel();
1834 t.setTModelKey(PublicationConstants.tmodelPublishTimeStamp);
1835 n = new Name();
1836 n.setLang(PublicationConstants.lang);
1837 n.setValue(PublicationConstants.tmodelPublishTimeStampDescription);
1838 t.setName(n);
1839 d = new Description();
1840 d.setLang(PublicationConstants.lang);
1841 d.setValue(PublicationConstants.tmodelPublishTimeStampText);
1842 t.getDescription().add(d);
1843 c = new CategoryBag();
1844 c.getKeyedReference().add((shared));
1845 t.setCategoryBag(c);
1846 request.getTModel().add(t);
1847
1848 try {
1849 TModelDetail response = publication.saveTModel(request);
1850 log.log(Level.INFO, "successfullly created the fgsms UDDI tModels");
1851 if (isPooled) {
1852 AuditLogger.logItem(this.getClass().getCanonicalName(), "PublishTmodels", "UddiPublisher", "fgsms tModels Published", AuditLogger.unspecified, null);
1853 }
1854 return true;
1855 } catch (DispositionReportFaultMessage f) {
1856 log.log(Level.ERROR, "Error publishing tmodel definitions: " + dispositionReportFaultMessageToString(f), f);
1857 if (isPooled) {
1858 AuditLogger.logItem(this.getClass().getCanonicalName(), "PublishTmodels", "UddiPublisher", "fgsms tModel Publishing failed", AuditLogger.unspecified, null);
1859 }
1860 return false;
1861 } catch (Exception ex) {
1862 log.log(Level.ERROR, "Error publishing tmodel definitions: ", ex);
1863 if (isPooled) {
1864 AuditLogger.logItem(this.getClass().getCanonicalName(), "PublishTmodels", "UddiPublisher", "fgsms tModel Publishing failed", AuditLogger.unspecified, null);
1865 }
1866 return false;
1867 }
1868
1869 }
1870 private static final String NaN = "NaN";
1871 public static final String FederationTarget_UDDI_Publisher = "UDDI";
1872
1873
1874
1875
1876
1877 protected boolean publishTestPublisher() {
1878 try {
1879 SaveBusiness sb1 = new SaveBusiness();
1880
1881 BusinessEntity e = new BusinessEntity();
1882 e.setBusinessKey("uddi:org.miloss.fgsms:test");
1883 Name n = new Name();
1884 n.setValue("Test Business Entity");
1885 n.setLang(PublicationConstants.lang);
1886 e.getName().add(n);
1887
1888 sb1.getBusinessEntity().add(e);
1889 sb1.setAuthInfo(loginWrapper());
1890 publication.saveBusiness(sb1);
1891 return true;
1892 } catch (DispositionReportFaultMessage ex) {
1893 log.log(Level.ERROR, "error publising test business entity", ex);
1894 log.log(Level.ERROR, "error publising test business entity" + dispositionReportFaultMessageToString(ex), ex);
1895 return false;
1896 } catch (Exception ex) {
1897 log.log(Level.ERROR, "error publising test business entity", ex);
1898 return false;
1899 }
1900 }
1901
1902
1903
1904
1905 protected boolean publishTestBusiness() {
1906 try {
1907 SaveBusiness sb1 = new SaveBusiness();
1908
1909 BusinessEntity e = new BusinessEntity();
1910 e.setBusinessKey("uddi:org:miloss:fgsms:test");
1911 Name n = new Name();
1912 n.setValue("Test Business Entity");
1913 n.setLang(PublicationConstants.lang);
1914 e.getName().add(n);
1915
1916 sb1.getBusinessEntity().add(e);
1917 sb1.setAuthInfo(loginWrapper());
1918 publication.saveBusiness(sb1);
1919 return true;
1920 } catch (DispositionReportFaultMessage ex) {
1921 log.log(Level.ERROR, "error publising test business entity", ex);
1922 log.log(Level.ERROR, "error publising test business entity" + dispositionReportFaultMessageToString(ex), ex);
1923 return false;
1924 } catch (Exception ex) {
1925 log.log(Level.ERROR, "error publising test business entity", ex);
1926 return false;
1927 }
1928 }
1929
1930
1931
1932
1933 protected boolean publishTestService() {
1934 try {
1935 SaveService sb1 = new SaveService();
1936 BusinessService s = new BusinessService();
1937 s.setBusinessKey("uddi:org:miloss:fgsms:test");
1938 Name n = new Name();
1939 n.setLang(PublicationConstants.lang);
1940 n.setValue("Test Service fgsms DAS");
1941 s.getName().add(n);
1942 s.setServiceKey("uddi:org:miloss:fgsms:test:service1");
1943 BindingTemplates l = new BindingTemplates();
1944 BindingTemplate bt = new BindingTemplate();
1945 bt.setBindingKey("uddi:fgsms.DAS");
1946
1947 AccessPoint ap = new AccessPoint();
1948 ap.setValue("http://localhost:8080/DAS/DAS4jBean");
1949 bt.setAccessPoint(ap);
1950 l.getBindingTemplate().add(bt);
1951 s.setBindingTemplates(l);
1952 sb1.getBusinessService().add(s);
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969 sb1.setAuthInfo(loginWrapper());
1970 publication.saveService(sb1);
1971 log.log(Level.INFO, "Service saved successfully");
1972 return true;
1973 } catch (DispositionReportFaultMessage ex) {
1974 log.log(Level.ERROR, "Error saving test service", ex);
1975 log.log(Level.ERROR, "Error saving test service" + dispositionReportFaultMessageToString(ex), ex);
1976 return false;
1977 } catch (Exception ex) {
1978 log.log(Level.ERROR, "Error saving test service", ex);
1979
1980 return false;
1981 }
1982 }
1983
1984 private String getOperationalStatusFromDB(String uRL, boolean pooled) {
1985 try {
1986
1987 Connection configCon=Utility.getConfigurationDBConnection();
1988 PreparedStatement com = configCon.prepareStatement("select status from status where uri=?");
1989 com.setString(1, uRL);
1990 ResultSet rs = com.executeQuery();
1991 if (rs.next()) {
1992 Boolean s = rs.getBoolean("status");
1993 rs.close();
1994 com.close();
1995
1996 if (s) {
1997 return "Operational";
1998 }
1999
2000 return "Unavailable";
2001 } else {
2002 rs.close();
2003 com.close();
2004
2005 return "Status Unavailable";
2006 }
2007 } catch (Exception ex) {
2008 log.log(Level.ERROR, "Error getting operational status from db", ex);
2009 return "Status Unavailable";
2010 }
2011 }
2012
2013 private String GetMonitoredStatusFromDB(String uRL, boolean pooled) {
2014 try {
2015 Connection con = Utility.getConfigurationDBConnection();
2016 PreparedStatement com = con.prepareStatement("select monitored from status where uri=?");
2017 com.setString(1, uRL);
2018 ResultSet rs = com.executeQuery();
2019 if (rs.next()) {
2020 boolean s = rs.getBoolean("monitored");
2021 rs.close();
2022 com.close();
2023 con.close();
2024 if (s) {
2025 return "true";
2026 } else {
2027 return "false";
2028 }
2029 } else {
2030 rs.close();
2031 com.close();
2032 con.close();
2033 return "false";
2034 }
2035 } catch (Exception ex) {
2036 log.log(Level.ERROR, "Error getting monitored status from db", ex);
2037 return "false";
2038 }
2039 }
2040
2041 private String getOperationalStatusTimeStamp(String uRL, boolean pooled) {
2042 try {
2043 Connection con = Utility.getConfigurationDBConnection();
2044 PreparedStatement com = con.prepareStatement("select utcdatetime from status where uri=?");
2045 com.setString(1, uRL);
2046 ResultSet rs = com.executeQuery();
2047 if (rs.next()) {
2048 Long timeinms = rs.getLong("utcdatetime");
2049 GregorianCalendar cal = (GregorianCalendar) GregorianCalendar.getInstance();
2050 cal.setTimeInMillis(timeinms);
2051
2052 Calendar xcal = (cal);
2053
2054 rs.close();
2055 com.close();
2056 con.close();
2057 if (xcal != null) {
2058 return xcal.toString();
2059 }
2060 } else {
2061 rs.close();
2062 com.close();
2063 con.close();
2064 }
2065 } catch (Exception ex) {
2066 log.log(Level.ERROR, "error getting operational status timestamp from db", ex);
2067
2068 }
2069 return "Operational Status Timestamp Unavailable";
2070 }
2071
2072
2073 protected void inquiry(String servicekey) {
2074 try {
2075 GetServiceDetail r = new GetServiceDetail();
2076 r.getServiceKey().add(servicekey);
2077 ServiceDetail serviceDetail = inquiry.getServiceDetail(r);
2078 if (serviceDetail != null && serviceDetail.getBusinessService() != null
2079 && !serviceDetail.getBusinessService().isEmpty()) {
2080 JAXBContext jc = JAXBContext.newInstance(ServiceDetail.class);
2081
2082
2083
2084
2085
2086 Marshaller m = jc.createMarshaller();
2087 StringWriter sw = new StringWriter();
2088 m.marshal(serviceDetail, sw);
2089
2090 log.log(Level.INFO, "Results" + sw.toString());
2091
2092 } else {
2093 log.log(Level.WARN, "no results return ");
2094
2095 }
2096
2097 } catch (Exception ex) {
2098 Logger.getLogger(UddiPublisher.class.getName()).log(Level.ERROR, null, ex);
2099 }
2100
2101 }
2102
2103
2104
2105 private static String dispositionReportFaultMessageToString(DispositionReportFaultMessage f) {
2106 StringBuilder err = new StringBuilder();
2107 if (f != null && f.getFaultInfo() != null) {
2108 for (int i = 0; i < f.getFaultInfo().getResult().size(); i++) {
2109 err.append("Error number" + f.getFaultInfo().getResult().get(i).getErrno());
2110 if (f.getFaultInfo().getResult().get(i).getKeyType() != null) {
2111 err.append(" keytype " + f.getFaultInfo().getResult().get(i).getKeyType().value());
2112 }
2113 if (f.getFaultInfo().getResult().get(i).getErrInfo() != null) {
2114 err.append(
2115 " errocode " + f.getFaultInfo().getResult().get(i).getErrInfo().getErrCode()
2116 + " msg " + f.getFaultInfo().getResult().get(i).getErrInfo().getValue());
2117 }
2118 }
2119 }
2120 return err.toString();
2121 }
2122 }