This project has retired. For details please refer to its
Attic page.
RegistryImpl xref
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.apache.ws.scout.registry;
17
18 import java.io.ByteArrayInputStream;
19 import java.io.ByteArrayOutputStream;
20 import java.io.IOException;
21 import java.io.StringReader;
22 import java.net.URI;
23 import java.net.URISyntaxException;
24 import java.security.AccessController;
25 import java.security.PrivilegedAction;
26 import java.util.Arrays;
27 import java.util.Properties;
28
29 import javax.xml.bind.JAXBContext;
30 import javax.xml.bind.JAXBElement;
31 import javax.xml.bind.JAXBException;
32 import javax.xml.bind.Marshaller;
33 import javax.xml.bind.Unmarshaller;
34 import javax.xml.parsers.DocumentBuilder;
35 import javax.xml.parsers.DocumentBuilderFactory;
36 import javax.xml.parsers.ParserConfigurationException;
37 import javax.xml.registry.InvalidRequestException;
38 import javax.xml.transform.stream.StreamSource;
39
40 import org.apache.commons.logging.Log;
41 import org.apache.commons.logging.LogFactory;
42 import org.apache.ws.scout.model.uddi.v2.AssertionStatusReport;
43 import org.apache.ws.scout.model.uddi.v2.AuthToken;
44 import org.apache.ws.scout.model.uddi.v2.BindingDetail;
45 import org.apache.ws.scout.model.uddi.v2.BindingTemplate;
46 import org.apache.ws.scout.model.uddi.v2.BusinessDetail;
47 import org.apache.ws.scout.model.uddi.v2.BusinessEntity;
48 import org.apache.ws.scout.model.uddi.v2.BusinessList;
49 import org.apache.ws.scout.model.uddi.v2.BusinessService;
50 import org.apache.ws.scout.model.uddi.v2.CategoryBag;
51 import org.apache.ws.scout.model.uddi.v2.DeleteBinding;
52 import org.apache.ws.scout.model.uddi.v2.DeleteBusiness;
53 import org.apache.ws.scout.model.uddi.v2.DeletePublisherAssertions;
54 import org.apache.ws.scout.model.uddi.v2.DeleteService;
55 import org.apache.ws.scout.model.uddi.v2.DeleteTModel;
56 import org.apache.ws.scout.model.uddi.v2.DiscoveryURLs;
57 import org.apache.ws.scout.model.uddi.v2.DispositionReport;
58 import org.apache.ws.scout.model.uddi.v2.FindBinding;
59 import org.apache.ws.scout.model.uddi.v2.FindBusiness;
60 import org.apache.ws.scout.model.uddi.v2.FindQualifiers;
61 import org.apache.ws.scout.model.uddi.v2.FindService;
62 import org.apache.ws.scout.model.uddi.v2.FindTModel;
63 import org.apache.ws.scout.model.uddi.v2.GetAssertionStatusReport;
64 import org.apache.ws.scout.model.uddi.v2.GetAuthToken;
65 import org.apache.ws.scout.model.uddi.v2.GetBusinessDetail;
66 import org.apache.ws.scout.model.uddi.v2.GetPublisherAssertions;
67 import org.apache.ws.scout.model.uddi.v2.GetRegisteredInfo;
68 import org.apache.ws.scout.model.uddi.v2.GetServiceDetail;
69 import org.apache.ws.scout.model.uddi.v2.GetTModelDetail;
70 import org.apache.ws.scout.model.uddi.v2.IdentifierBag;
71 import org.apache.ws.scout.model.uddi.v2.Name;
72 import org.apache.ws.scout.model.uddi.v2.ObjectFactory;
73 import org.apache.ws.scout.model.uddi.v2.PublisherAssertion;
74 import org.apache.ws.scout.model.uddi.v2.PublisherAssertions;
75 import org.apache.ws.scout.model.uddi.v2.RegisteredInfo;
76 import org.apache.ws.scout.model.uddi.v2.SaveBinding;
77 import org.apache.ws.scout.model.uddi.v2.SaveBusiness;
78 import org.apache.ws.scout.model.uddi.v2.SaveService;
79 import org.apache.ws.scout.model.uddi.v2.SaveTModel;
80 import org.apache.ws.scout.model.uddi.v2.ServiceDetail;
81 import org.apache.ws.scout.model.uddi.v2.ServiceList;
82 import org.apache.ws.scout.model.uddi.v2.SetPublisherAssertions;
83 import org.apache.ws.scout.model.uddi.v2.TModel;
84 import org.apache.ws.scout.model.uddi.v2.TModelBag;
85 import org.apache.ws.scout.model.uddi.v2.TModelDetail;
86 import org.apache.ws.scout.model.uddi.v2.TModelList;
87 import org.apache.ws.scout.transport.Transport;
88 import org.apache.ws.scout.transport.TransportException;
89 import org.apache.ws.scout.util.XMLUtils;
90 import org.w3c.dom.Document;
91 import org.w3c.dom.Element;
92 import org.w3c.dom.NodeList;
93 import org.xml.sax.SAXException;
94
95
96
97
98
99
100
101
102
103
104
105
106
107 public class RegistryImpl implements IRegistry {
108
109 public static final String DEFAULT_ADMIN_ENDPOINT = "http://localhost:8080/juddi/admin";
110 public static final String DEFAULT_TRANSPORT_CLASS = "org.apache.ws.scout.transport.SaajTransport";
111 public static final String DEFAULT_SECURITY_PROVIDER = "com.sun.net.ssl.internal.ssl.Provider";
112 public static final String DEFAULT_PROTOCOL_HANDLER = "com.sun.net.ssl.internal.www.protocol";
113 public static final String DEFAULT_UDDI_VERSION = "2.0";
114 public static final String DEFAULT_UDDI_NAMESPACE = "urn:uddi-org:api_v2";
115
116 private URI adminURI;
117 private URI inquiryURI;
118 private URI publishURI;
119 private URI securityURI;
120
121 private Transport transport;
122
123 private String securityProvider;
124 private String protocolHandler;
125 private String uddiVersion;
126 private String uddiNamespace;
127
128 private ObjectFactorytFactory.html#ObjectFactory">ObjectFactory objectFactory = new ObjectFactory();
129
130 private Marshaller marshaller = null;
131 private Unmarshaller unmarshaller = null;
132
133 private static Log log = LogFactory.getLog(RegistryImpl.class);
134
135
136
137
138
139 public RegistryImpl(Properties props) throws InvalidRequestException {
140 super();
141
142 this.init(props);
143 }
144
145
146
147
148
149 private void init(Properties props) throws InvalidRequestException {
150
151
152 if (props == null) props = new Properties();
153
154
155 try {
156 setInquiryURI(new URI(props.getProperty(ConnectionFactoryImpl.QUERYMANAGER_PROPERTY)));
157 if (props.containsKey(ConnectionFactoryImpl.LIFECYCLEMANAGER_PROPERTY)) {
158 setPublishURI(new URI(props.getProperty(ConnectionFactoryImpl.LIFECYCLEMANAGER_PROPERTY)));
159 }
160 String securityURL = props.getProperty(ConnectionFactoryImpl.SECURITYMANAGER_PROPERTY,
161 props.getProperty(ConnectionFactoryImpl.LIFECYCLEMANAGER_PROPERTY));
162 if (securityURL!=null) setSecurityURI(new URI(securityURL));
163 setAdminURI(new URI(props.getProperty(ConnectionFactoryImpl.ADMIN_ENDPOINT_PROPERTY, DEFAULT_ADMIN_ENDPOINT)));
164 setSecurityProvider(props.getProperty(ConnectionFactoryImpl.SECURITY_PROVIDER_PROPERTY, DEFAULT_SECURITY_PROVIDER));
165 setProtocolHandler(props.getProperty(ConnectionFactoryImpl.PROTOCOL_HANDLER_PROPERTY, DEFAULT_PROTOCOL_HANDLER));
166 setUddiVersion(props.getProperty(ConnectionFactoryImpl.UDDI_VERSION_PROPERTY, DEFAULT_UDDI_VERSION));
167 setUddiNamespace(props.getProperty(ConnectionFactoryImpl.UDDI_NAMESPACE_PROPERTY, DEFAULT_UDDI_NAMESPACE));
168 setTransport(getTransport(props.getProperty(ConnectionFactoryImpl.TRANSPORT_CLASS_PROPERTY, DEFAULT_TRANSPORT_CLASS)));
169
170 JAXBContext context = JAXBContextUtil.getContext(JAXBContextUtil.UDDI_V2_VERSION);
171 unmarshaller = context.createUnmarshaller();
172 marshaller = context.createMarshaller();
173 } catch (URISyntaxException muex) {
174 throw new InvalidRequestException(muex.getMessage(),muex);
175 } catch(JAXBException e) {
176 throw new RuntimeException(e);
177 }
178 }
179
180
181
182
183
184
185
186 public String execute(String uddiRequest, String urltype)
187 throws TransportException {
188 URI endPointURL = null;
189 if (urltype.equalsIgnoreCase("INQUIRY"))
190 endPointURL = this.getInquiryURI();
191 else
192 endPointURL = this.getPublishURI();
193
194
195
196
197 return transport.send(uddiRequest, endPointURL);
198 }
199
200
201
202
203 public JAXBElement<?> execute(JAXBElement<?> uddiRequest, URI endPointURI)
204 throws RegistryException {
205
206 ByteArrayOutputStream baos = new ByteArrayOutputStream();
207
208 Document doc;
209 try {
210 DocumentBuilderFactory docBuilderFactory = DocumentBuilderFactory.newInstance();
211 docBuilderFactory.setNamespaceAware(true);
212 DocumentBuilder docBuilder= docBuilderFactory.newDocumentBuilder();
213 this.marshaller.marshal(uddiRequest, baos);
214 doc = docBuilder.parse(new ByteArrayInputStream(baos.toByteArray()));
215 } catch (SAXException saxe) {
216 throw (new RegistryException(saxe));
217 } catch (ParserConfigurationException pce) {
218 throw (new RegistryException(pce));
219 } catch (IOException ioe) {
220 throw (new RegistryException(ioe));
221 } catch (JAXBException ioe) {
222 throw (new RegistryException(ioe));
223 }
224 Element request = doc.getDocumentElement();
225
226 request.setAttribute("xmlns", this.getUddiNamespace());
227 if (!"3.0".equals(this.getUddiVersion())) {
228 request.setAttribute("generic", this.getUddiVersion());
229 }
230
231
232
233
234
235 Element response;
236 try {
237 response = transport.send(request, endPointURI);
238 } catch (TransportException te) {
239 throw new RegistryException(te);
240 }
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256 if (response.getNamespaceURI()==null) {
257 response.setAttributeNS("http://www.w3.org/2000/xmlns/","xmlns", this.getUddiNamespace());
258 }
259
260
261
262
263
264
265 String responseName = response.getLocalName();
266 if (responseName == null) {
267 throw new RegistryException("Unsupported response "
268 + "from registry. A value was not present.");
269 }
270
271 if (responseName.toLowerCase().equals("fault")) {
272 NodeList nodeList = null;
273
274
275 String fCode = null;
276 nodeList = response.getElementsByTagName("faultcode");
277 if (nodeList.getLength() > 0)
278 fCode = nodeList.item(0).getNodeValue();
279
280 String fString = null;
281 nodeList = response.getElementsByTagName("faultstring");
282 if (nodeList.getLength() > 0)
283 fString = nodeList.item(0).getNodeValue();
284
285 String fActor = null;
286 nodeList = response.getElementsByTagName("faultactor");
287 if (nodeList.getLength() > 0)
288 fActor = nodeList.item(0).getNodeValue();
289
290 DispositionReport dispRpt = null;
291
292 nodeList = response.getElementsByTagName("detail");
293 if (nodeList.getLength() > 0) {
294 nodeList = ((Element) nodeList.item(0))
295 .getElementsByTagName("dispositionReport");
296 if (nodeList.getLength() > 0) {
297 JAXBElement<DispositionReport> dispRptObj = null;
298 try {
299 dispRptObj = (JAXBElement<DispositionReport>) unmarshaller.unmarshal((Element) nodeList
300 .item(0));
301 } catch (JAXBException xmle) {
302 throw (new RegistryException(xmle));
303 }
304 dispRpt = dispRptObj.getValue();
305 }
306 }
307
308 RegistryException e = new RegistryException(fCode, fString, fActor, dispRpt);
309
310
311 throw e;
312 }
313
314
315
316
317
318
319
320
321
322
323
324 JAXBElement<?> uddiResponse = null;
325 try {
326 String xml = XMLUtils.convertNodeToXMLString(response);
327 log.debug("Response is: " + xml);
328
329 StringReader reader = new StringReader(xml);
330 uddiResponse = (JAXBElement<?>) unmarshaller.unmarshal(new StreamSource(reader));
331
332
333
334 } catch (JAXBException xmle) {
335 throw (new RegistryException(xmle));
336 }
337
338 return uddiResponse;
339 }
340
341
342
343
344 public URI getAdminURI() {
345 return this.adminURI;
346 }
347
348
349
350
351
352 public void setAdminURI(URI url) {
353 this.adminURI = url;
354 }
355
356
357
358
359 public URI getInquiryURI() {
360 return this.inquiryURI;
361 }
362
363
364
365
366
367 public void setInquiryURI(URI inquiryURI) {
368 this.inquiryURI = inquiryURI;
369 }
370
371
372
373
374 public String getProtocolHandler() {
375 return this.protocolHandler;
376 }
377
378
379
380
381
382 public void setProtocolHandler(String protocolHandler) {
383 this.protocolHandler = protocolHandler;
384 }
385
386
387
388
389 public URI getPublishURI() {
390 return this.publishURI;
391 }
392
393
394
395
396 public URI getSecurityURI() {
397 return this.securityURI;
398 }
399
400
401
402
403
404 public void setPublishURI(URI publishURI) {
405 this.publishURI = publishURI;
406 }
407
408
409
410
411
412 public void setSecurityURI(URI securityURI) {
413 this.securityURI = securityURI;
414 }
415
416
417
418
419 public String getSecurityProvider() {
420 return this.securityProvider;
421 }
422
423
424
425
426
427 public void setSecurityProvider(String securityProvider) {
428 this.securityProvider = securityProvider;
429 }
430
431
432
433
434 public Transport getTransport() {
435 return transport;
436 }
437
438
439
440
441
442 public void setTransport(Transport transport) {
443 this.transport = transport;
444 }
445
446
447
448
449 public String getUddiNamespace() {
450 return this.uddiNamespace;
451 }
452
453
454
455
456
457 public void setUddiNamespace(String uddiNS) {
458 this.uddiNamespace = uddiNS;
459 }
460
461
462
463
464 public String getUddiVersion() {
465 return this.uddiVersion;
466 }
467
468
469
470
471
472 public void setUddiVersion(String uddiVersion) {
473 this.uddiVersion = uddiVersion;
474 }
475
476
477
478
479
480
481
482 public DispositionReport deleteBinding(String authInfo,
483 String[] bindingKeyArray) throws RegistryException {
484 DeleteBinding request = this.objectFactory.createDeleteBinding();
485
486 if (authInfo != null) {
487 request.setAuthInfo(authInfo);
488 }
489
490 if (bindingKeyArray != null) {
491 request.getBindingKey().addAll(Arrays.asList(bindingKeyArray));
492 }
493
494 DispositionReport dr;
495 JAXBElement<?> o = execute(this.objectFactory.createDeleteBinding(request), this.getPublishURI());
496 dr = (DispositionReport) o.getValue();
497
498 return dr;
499 }
500
501
502
503
504
505
506 public DispositionReport deleteBusiness(String authInfo,
507 String[] businessKeyArray) throws RegistryException {
508 DeleteBusiness request = this.objectFactory.createDeleteBusiness();
509
510 if (authInfo != null) {
511 request.setAuthInfo(authInfo);
512 }
513
514 if (businessKeyArray != null) {
515 request.getBusinessKey().addAll(Arrays.asList(businessKeyArray));
516 }
517
518 DispositionReport dr;
519 JAXBElement<?> o = execute(this.objectFactory.createDeleteBusiness(request), this.getPublishURI());
520 dr = (DispositionReport) o.getValue();
521
522 return dr;
523 }
524
525
526
527
528 public DispositionReport deletePublisherAssertions(String authInfo,
529 PublisherAssertion[] assertionArray) throws RegistryException {
530 DeletePublisherAssertions request = this.objectFactory.createDeletePublisherAssertions();
531
532 if (authInfo != null) {
533 request.setAuthInfo(authInfo);
534 }
535
536 if (assertionArray != null) {
537 request.getPublisherAssertion().addAll(Arrays.asList(assertionArray));
538 }
539
540 DispositionReport dr;
541 JAXBElement<?> o = execute(this.objectFactory.createDeletePublisherAssertions(request),
542 this.getPublishURI());
543 dr = (DispositionReport) o.getValue();
544
545 return dr;
546 }
547
548
549
550
551
552
553
554 public DispositionReport deleteService(String authInfo,
555 String[] serviceKeyArray) throws RegistryException {
556 DeleteService request = this.objectFactory.createDeleteService();
557
558 if (authInfo != null) {
559 request.setAuthInfo(authInfo);
560 }
561
562 if (serviceKeyArray != null) {
563 request.getServiceKey().addAll(Arrays.asList(serviceKeyArray));
564 }
565
566 DispositionReport dr;
567 JAXBElement<?> o = execute(this.objectFactory.createDeleteService(request),
568 this.getPublishURI());
569 dr = (DispositionReport) o.getValue();
570
571 return dr;
572 }
573
574
575
576
577
578
579
580
581 public DispositionReport deleteTModel(String authInfo,
582 String[] tModelKeyArray) throws RegistryException {
583 DeleteTModel request = this.objectFactory.createDeleteTModel();
584
585 if (authInfo != null) {
586 request.setAuthInfo(authInfo);
587 }
588
589 if (tModelKeyArray != null) {
590 request.getTModelKey().addAll(Arrays.asList(tModelKeyArray));
591 }
592
593 DispositionReport dr;
594 JAXBElement<?> o = execute(this.objectFactory.createDeleteTModel(request),
595 this.getPublishURI());
596 dr = (DispositionReport) o.getValue();
597
598 return dr;
599 }
600
601
602
603
604
605
606
607 public BusinessList findBusiness(Name[] nameArray,
608 DiscoveryURLs discoveryURLs, IdentifierBag identifierBag,
609 CategoryBag categoryBag, TModelBag tModelBag,
610 FindQualifiers findQualifiers, int maxRows)
611 throws RegistryException {
612 FindBusiness request = this.objectFactory.createFindBusiness();
613
614 if (nameArray != null) {
615 request.getName().addAll(Arrays.asList(nameArray));
616 }
617
618 if (discoveryURLs != null) {
619 request.setDiscoveryURLs(discoveryURLs);
620 }
621
622 if (identifierBag != null) {
623 request.setIdentifierBag(identifierBag);
624 }
625
626 if (categoryBag != null) {
627 request.setCategoryBag(categoryBag);
628 }
629
630 if (tModelBag != null) {
631 request.setTModelBag(tModelBag);
632 } else {
633 request.setTModelBag(this.objectFactory.createTModelBag());
634 }
635
636 if (findQualifiers != null) {
637 request.setFindQualifiers(findQualifiers);
638 }
639
640 request.setMaxRows(maxRows);
641
642 BusinessList bl;
643 JAXBElement<?> o = execute(this.objectFactory.createFindBusiness(request),
644 this.getInquiryURI());
645 bl = (BusinessList) o.getValue();
646
647 return bl;
648 }
649
650
651
652
653
654
655
656 public BindingDetail findBinding(String serviceKey,
657 CategoryBag categoryBag, TModelBag tModelBag,
658 FindQualifiers findQualifiers, int maxRows)
659 throws RegistryException {
660
661
662
663
664
665
666 FindBinding request = this.objectFactory.createFindBinding();
667
668 if (serviceKey != null) {
669 request.setServiceKey(serviceKey);
670 }
671
672 if (tModelBag != null) {
673 request.setTModelBag(tModelBag);
674 } else {
675 TModelBag tmb = this.objectFactory.createTModelBag();
676 request.setTModelBag(tmb);
677 }
678
679 if (findQualifiers != null) {
680 request.setFindQualifiers(findQualifiers);
681 }
682 request.setMaxRows(maxRows);
683
684 BindingDetail bd;
685 JAXBElement<?> o = execute(this.objectFactory.createFindBinding(request),
686 this.getInquiryURI());
687 bd = (BindingDetail) o.getValue();
688
689 return bd;
690 }
691
692
693
694
695
696
697
698
699
700 public ServiceList findService(String businessKey, Name[] nameArray,
701 CategoryBag categoryBag, TModelBag tModelBag,
702 FindQualifiers findQualifiers, int maxRows)
703 throws RegistryException {
704 FindService request = this.objectFactory.createFindService();
705
706 if (businessKey != null) {
707 request.setBusinessKey(businessKey);
708 }
709
710 if (nameArray != null) {
711 request.getName().addAll(Arrays.asList(nameArray));
712 }
713
714 if (categoryBag != null) {
715 request.setCategoryBag(categoryBag);
716 }
717
718 if (tModelBag != null) {
719 request.setTModelBag(tModelBag);
720 }
721
722 if (findQualifiers != null) {
723 request.setFindQualifiers(findQualifiers);
724 }
725
726 request.setMaxRows(maxRows);
727
728 ServiceList sl;
729 JAXBElement<?> o = execute(this.objectFactory.createFindService(request),
730 this.getInquiryURI());
731 sl = (ServiceList) o.getValue();
732
733 return sl;
734 }
735
736
737
738
739
740
741
742 public TModelList findTModel(String name, CategoryBag categoryBag,
743 IdentifierBag identifierBag, FindQualifiers findQualifiers,
744 int maxRows) throws RegistryException {
745 FindTModel request = this.objectFactory.createFindTModel();
746
747 Name jaxbName = this.objectFactory.createName();
748
749 if (name != null) {
750 jaxbName.setValue(name);
751 }
752
753 request.setName(jaxbName);
754
755 if (categoryBag != null) {
756 request.setCategoryBag(categoryBag);
757 }
758
759 if (identifierBag != null) {
760 request.setIdentifierBag(identifierBag);
761 }
762
763 if (findQualifiers != null) {
764 request.setFindQualifiers(findQualifiers);
765 }
766
767 request.setMaxRows(maxRows);
768
769 TModelList tml;
770 JAXBElement<?> o = execute(this.objectFactory.createFindTModel(request),
771 this.getInquiryURI());
772 tml = (TModelList) o.getValue();
773
774 return tml;
775 }
776
777
778
779
780 public AssertionStatusReport getAssertionStatusReport(String authInfo,
781 String completionStatus) throws RegistryException {
782 GetAssertionStatusReport request = this.objectFactory.createGetAssertionStatusReport();
783
784 if (authInfo != null) {
785 request.setAuthInfo(authInfo);
786 }
787
788 if (completionStatus != null) {
789 request.setCompletionStatus(completionStatus);
790 }
791
792 AssertionStatusReport asr;
793 JAXBElement<?> o = execute(this.objectFactory.createGetAssertionStatusReport(request),
794 this.getPublishURI());
795 asr = (AssertionStatusReport) o.getValue();
796
797 return asr;
798 }
799
800
801
802
803
804
805
806
807
808 public AuthToken getAuthToken(String userID, String cred)
809 throws RegistryException {
810 GetAuthToken request = this.objectFactory.createGetAuthToken();
811
812 if (userID != null) {
813 request.setUserID(userID);
814 }
815
816 if (cred != null) {
817 request.setCred(cred);
818 }
819
820 URI getAuthTokenURI = getSecurityURI();;
821
822 AuthToken at;
823 JAXBElement<?> o = execute(this.objectFactory.createGetAuthToken(request),
824 getAuthTokenURI);
825 at = (AuthToken) o.getValue();
826
827 return at;
828 }
829
830
831
832
833
834
835
836 public BusinessDetail getBusinessDetail(String businessKey)
837 throws RegistryException {
838 String[] keys = new String[1];
839 keys[0] = businessKey;
840
841 return getBusinessDetail(keys);
842 }
843
844
845
846
847
848
849
850 public BusinessDetail getBusinessDetail(String[] businessKeyArray)
851 throws RegistryException {
852 GetBusinessDetail request = this.objectFactory.createGetBusinessDetail();
853
854 if (businessKeyArray != null) {
855 request.getBusinessKey().addAll(Arrays.asList(businessKeyArray));
856 }
857
858 BusinessDetail bd;
859 JAXBElement<?> o = execute(this.objectFactory.createGetBusinessDetail(request),
860 this.getInquiryURI());
861 bd = (BusinessDetail) o.getValue();
862 return bd;
863 }
864
865
866
867
868 public PublisherAssertions getPublisherAssertions(String authInfo)
869 throws RegistryException {
870 GetPublisherAssertions request = this.objectFactory.createGetPublisherAssertions();
871
872 if (authInfo != null) {
873 request.setAuthInfo(authInfo);
874 }
875
876 PublisherAssertions pa;
877 JAXBElement<?> o = execute(this.objectFactory.createGetPublisherAssertions(request),
878 this.getPublishURI());
879 pa = (PublisherAssertions) o.getValue();
880
881 return pa;
882 }
883
884
885
886
887 public RegisteredInfo getRegisteredInfo(String authInfo)
888 throws RegistryException {
889 GetRegisteredInfo request = this.objectFactory.createGetRegisteredInfo();
890
891 if (authInfo != null) {
892 request.setAuthInfo(authInfo);
893 }
894
895 RegisteredInfo ri;
896 JAXBElement<?> o = execute(this.objectFactory.createGetRegisteredInfo(request),
897 this.getPublishURI());
898 ri = (RegisteredInfo) o.getValue();
899
900 return ri;
901 }
902
903
904
905
906
907
908
909 public ServiceDetail getServiceDetail(String serviceKey)
910 throws RegistryException {
911 String[] keys = new String[1];
912 keys[0] = serviceKey;
913
914 return getServiceDetail(keys);
915 }
916
917
918
919
920
921
922
923 public ServiceDetail getServiceDetail(String[] serviceKeyArray)
924 throws RegistryException {
925 GetServiceDetail request = this.objectFactory.createGetServiceDetail();
926
927 if (serviceKeyArray != null) {
928 request.getServiceKey().addAll(Arrays.asList(serviceKeyArray));
929 }
930
931 ServiceDetail sd;
932 JAXBElement<?> o = execute(this.objectFactory.createGetServiceDetail(request),
933 this.getInquiryURI());
934 sd = (ServiceDetail) o.getValue();
935
936 return sd;
937 }
938
939
940
941
942
943
944
945 public TModelDetail getTModelDetail(String tModelKey)
946 throws RegistryException {
947 String[] keys = new String[1];
948 keys[0] = tModelKey;
949
950 return getTModelDetail(keys);
951 }
952
953
954
955
956
957
958
959 public TModelDetail getTModelDetail(String[] tModelKeyArray)
960 throws RegistryException {
961 GetTModelDetail request = this.objectFactory.createGetTModelDetail();
962
963 if (tModelKeyArray != null) {
964 request.getTModelKey().addAll(Arrays.asList(tModelKeyArray));
965 }
966
967 TModelDetail tmd;
968 JAXBElement<?> o = execute(this.objectFactory.createGetTModelDetail(request),
969 this.getInquiryURI());
970 tmd = (TModelDetail) o.getValue();
971
972 return tmd;
973 }
974
975
976
977
978 public PublisherAssertions setPublisherAssertions(String authInfo,
979 PublisherAssertion[] assertionArray) throws RegistryException {
980 SetPublisherAssertions request = this.objectFactory.createSetPublisherAssertions();
981
982 if (authInfo != null) {
983 request.setAuthInfo(authInfo);
984 }
985
986 if (assertionArray != null) {
987 request.getPublisherAssertion().addAll(Arrays.asList(assertionArray));
988 }
989
990 PublisherAssertions pa;
991 JAXBElement<?> o = execute(this.objectFactory.createSetPublisherAssertions(request),
992 this.getPublishURI());
993 pa = (PublisherAssertions) o.getValue();
994
995 return pa;
996 }
997
998
999
1000
1001
1002
1003
1004
1005 public BindingDetail saveBinding(String authInfo,
1006 BindingTemplate[] bindingArray) throws RegistryException {
1007 SaveBinding request = this.objectFactory.createSaveBinding();
1008
1009 if (authInfo != null) {
1010 request.setAuthInfo(authInfo);
1011 }
1012
1013 if (bindingArray != null) {
1014 request.getBindingTemplate().addAll(Arrays.asList(bindingArray));
1015 }
1016
1017 BindingDetail bd;
1018 JAXBElement<?> o = execute(this.objectFactory.createSaveBinding(request),
1019 this.getPublishURI());
1020 bd = (BindingDetail) o.getValue();
1021
1022 return bd;
1023 }
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033 public BusinessDetail saveBusiness(String authInfo,
1034 BusinessEntity[] businessArray) throws RegistryException {
1035 SaveBusiness request = this.objectFactory.createSaveBusiness();
1036
1037 if (authInfo != null) {
1038 request.setAuthInfo(authInfo);
1039 }
1040
1041 if (businessArray != null) {
1042 request.getBusinessEntity().addAll(Arrays.asList(businessArray));
1043 }
1044
1045 BusinessDetail bd;
1046 JAXBElement<?> o = execute(this.objectFactory.createSaveBusiness(request),
1047 this.getPublishURI());
1048 bd = (BusinessDetail) o.getValue();
1049
1050 return bd;
1051 }
1052
1053
1054
1055
1056
1057
1058
1059 public ServiceDetail saveService(String authInfo,
1060 BusinessService[] serviceArray) throws RegistryException {
1061 SaveService request = this.objectFactory.createSaveService();
1062
1063 if (authInfo != null) {
1064 request.setAuthInfo(authInfo);
1065 }
1066
1067 if (serviceArray != null) {
1068 request.getBusinessService().addAll(Arrays.asList(serviceArray));
1069 }
1070
1071 ServiceDetail sd;
1072 JAXBElement<?> o = execute(this.objectFactory.createSaveService(request),
1073 this.getPublishURI());
1074 sd = (ServiceDetail) o.getValue();
1075
1076 return sd;
1077 }
1078
1079
1080
1081
1082
1083
1084 public TModelDetail saveTModel(String authInfo, TModel[] tModelArray)
1085 throws RegistryException {
1086 SaveTModel request = this.objectFactory.createSaveTModel();
1087
1088 if (authInfo != null) {
1089 request.setAuthInfo(authInfo);
1090 }
1091
1092 if (tModelArray != null) {
1093 request.getTModel().addAll(Arrays.asList(tModelArray));
1094 }
1095
1096 TModelDetail tmd;
1097 JAXBElement<?> o = execute(this.objectFactory.createSaveTModel(request),
1098 this.getPublishURI());
1099 tmd = (TModelDetail) o.getValue();
1100 return tmd;
1101 }
1102
1103
1104
1105
1106
1107
1108
1109
1110 public Transport getTransport(String className) {
1111 Transport transport = null;
1112 Class transportClass = null;
1113
1114
1115
1116 if (className == null)
1117 className = DEFAULT_TRANSPORT_CLASS;
1118
1119 try {
1120
1121 transportClass = getClassForName(className);
1122 } catch (ClassNotFoundException cnfex) {
1123 throw new RuntimeException(cnfex);
1124 }
1125
1126 try {
1127
1128 transport = (Transport) transportClass.newInstance();
1129 } catch (Exception ex) {
1130 throw new RuntimeException(ex);
1131 }
1132
1133 return transport;
1134 }
1135
1136
1137
1138
1139
1140
1141
1142
1143 public static Class getClassForName(String name)
1144 throws ClassNotFoundException, NoClassDefFoundError {
1145 Class clazz = null;
1146
1147 try {
1148
1149 ClassLoader ccl = AccessController.doPrivileged(new PrivilegedAction<ClassLoader>()
1150 {
1151 public ClassLoader run() {
1152 return Thread.currentThread().getContextClassLoader();
1153 }
1154 });
1155
1156 clazz = Class.forName(name, true, ccl);
1157 } catch (Exception e) {
1158 log.debug("Failed to load the class " + name + " with context class loader " + e);
1159 }
1160
1161 if (null == clazz) {
1162 ClassLoader scl = AccessController.doPrivileged(new PrivilegedAction<ClassLoader>()
1163 {
1164 public ClassLoader run() {
1165 return ClassLoader.getSystemClassLoader();
1166 }
1167 });
1168
1169 try {
1170 clazz = Class.forName(name, true, scl);
1171 } catch (Exception e) {
1172 throw new RuntimeException(e);
1173 }
1174 }
1175
1176 return clazz;
1177 }
1178 }