Coverage Report - org.apache.ws.scout.registry.RegistryV3Impl
 
Classes in this File Line Coverage Branch Coverage Complexity
RegistryV3Impl
0%
0/385
0%
0/148
0
RegistryV3Impl$1
0%
0/2
N/A
0
RegistryV3Impl$2
0%
0/2
N/A
0
 
 1  
 /*
 2  
  * Copyright 2001-2004 The Apache Software Foundation.
 3  
  * 
 4  
  * Licensed under the Apache License, Version 2.0 (the "License");
 5  
  * you may not use this file except in compliance with the License.
 6  
  * You may obtain a copy of the License at
 7  
  * 
 8  
  *      http://www.apache.org/licenses/LICENSE-2.0
 9  
  * 
 10  
  * Unless required by applicable law or agreed to in writing, software
 11  
  * distributed under the License is distributed on an "AS IS" BASIS,
 12  
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 13  
  * See the License for the specific language governing permissions and
 14  
  * limitations under the License.
 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.List;
 28  
 import java.util.Properties;
 29  
 
 30  
 import javax.xml.bind.JAXBContext;
 31  
 import javax.xml.bind.JAXBElement;
 32  
 import javax.xml.bind.JAXBException;
 33  
 import javax.xml.bind.Marshaller;
 34  
 import javax.xml.bind.Unmarshaller;
 35  
 import javax.xml.parsers.DocumentBuilder;
 36  
 import javax.xml.parsers.DocumentBuilderFactory;
 37  
 import javax.xml.parsers.ParserConfigurationException;
 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.transport.Transport;
 43  
 import org.apache.ws.scout.transport.TransportException;
 44  
 import org.apache.ws.scout.util.XMLUtils;
 45  
 import org.uddi.api_v3.AssertionStatusReport;
 46  
 import org.uddi.api_v3.AuthToken;
 47  
 import org.uddi.api_v3.BindingDetail;
 48  
 import org.uddi.api_v3.BindingTemplate;
 49  
 import org.uddi.api_v3.BusinessDetail;
 50  
 import org.uddi.api_v3.BusinessEntity;
 51  
 import org.uddi.api_v3.BusinessList;
 52  
 import org.uddi.api_v3.BusinessService;
 53  
 import org.uddi.api_v3.CategoryBag;
 54  
 import org.uddi.api_v3.CompletionStatus;
 55  
 import org.uddi.api_v3.DeleteBinding;
 56  
 import org.uddi.api_v3.DeleteBusiness;
 57  
 import org.uddi.api_v3.DeletePublisherAssertions;
 58  
 import org.uddi.api_v3.DeleteService;
 59  
 import org.uddi.api_v3.DeleteTModel;
 60  
 import org.uddi.api_v3.DiscoveryURLs;
 61  
 import org.uddi.api_v3.DispositionReport;
 62  
 import org.uddi.api_v3.FindBinding;
 63  
 import org.uddi.api_v3.FindBusiness;
 64  
 import org.uddi.api_v3.FindQualifiers;
 65  
 import org.uddi.api_v3.FindService;
 66  
 import org.uddi.api_v3.FindTModel;
 67  
 import org.uddi.api_v3.GetAssertionStatusReport;
 68  
 import org.uddi.api_v3.GetAuthToken;
 69  
 import org.uddi.api_v3.GetBusinessDetail;
 70  
 import org.uddi.api_v3.GetPublisherAssertions;
 71  
 import org.uddi.api_v3.GetRegisteredInfo;
 72  
 import org.uddi.api_v3.GetServiceDetail;
 73  
 import org.uddi.api_v3.GetTModelDetail;
 74  
 import org.uddi.api_v3.IdentifierBag;
 75  
 import org.uddi.api_v3.Name;
 76  
 import org.uddi.api_v3.ObjectFactory;
 77  
 import org.uddi.api_v3.PublisherAssertion;
 78  
 import org.uddi.api_v3.PublisherAssertions;
 79  
 import org.uddi.api_v3.PublisherAssertionsResponse;
 80  
 import org.uddi.api_v3.RegisteredInfo;
 81  
 import org.uddi.api_v3.SaveBinding;
 82  
 import org.uddi.api_v3.SaveBusiness;
 83  
 import org.uddi.api_v3.SaveService;
 84  
 import org.uddi.api_v3.SaveTModel;
 85  
 import org.uddi.api_v3.ServiceDetail;
 86  
 import org.uddi.api_v3.ServiceList;
 87  
 import org.uddi.api_v3.SetPublisherAssertions;
 88  
 import org.uddi.api_v3.TModel;
 89  
 import org.uddi.api_v3.TModelBag;
 90  
 import org.uddi.api_v3.TModelDetail;
 91  
 import org.uddi.api_v3.TModelList;
 92  
 import org.w3c.dom.Document;
 93  
 import org.w3c.dom.Element;
 94  
 import org.w3c.dom.NodeList;
 95  
 import org.xml.sax.SAXException;
 96  
 
 97  
 /**
 98  
  * RegistryImpl is the implementation of IRegistry.
 99  
  * 
 100  
  * <p>The execute() function signature has been changed slightly from the jUDDI
 101  
  * version, since the URL can no longer be decided dynamically (in an easy
 102  
  * enough manner) as we don't use jUDDI data types anymore.</p>
 103  
  * 
 104  
  * <i>The function code is borrowed from jUDDI, with appropriate modifications so
 105  
  * that xmlbeans data types are used intead of jUDDI data types.</i>
 106  
  * 
 107  
  */
 108  
 
 109  
 public class RegistryV3Impl implements IRegistryV3 {
 110  
 
 111  
         public static final String INQUIRY_ENDPOINT_PROPERTY_NAME = "scout.proxy.inquiryURL";
 112  
         public static final String PUBLISH_ENDPOINT_PROPERTY_NAME = "scout.proxy.publishURL";
 113  
         public static final String SECURITY_ENDPOINT_PROPERTY_NAME = "scout.proxy.securityURL";
 114  
         public static final String ADMIN_ENDPOINT_PROPERTY_NAME = "scout.proxy.adminURL";
 115  
         public static final String TRANSPORT_CLASS_PROPERTY_NAME = "scout.proxy.transportClass";
 116  
         public static final String SECURITY_PROVIDER_PROPERTY_NAME = "scout.proxy.securityProvider";
 117  
         public static final String PROTOCOL_HANDLER_PROPERTY_NAME = "scout.proxy.protocolHandler";
 118  
         public static final String UDDI_VERSION_PROPERTY_NAME = "scout.proxy.uddiVersion";
 119  
         public static final String UDDI_NAMESPACE_PROPERTY_NAME = "scout.proxy.uddiNamespace";
 120  
 
 121  
         public static final String DEFAULT_INQUIRY_ENDPOINT = "http://localhost/juddi/inquiry";
 122  
         public static final String DEFAULT_PUBLISH_ENDPOINT = "http://localhost/juddi/publish";
 123  
         public static final String DEFAULT_SECURITY_ENDPOINT = "http://localhost/juddi/security";
 124  
         public static final String DEFAULT_ADMIN_ENDPOINT = "http://localhost/juddi/admin";
 125  
         public static final String DEFAULT_TRANSPORT_CLASS = "org.apache.ws.scout.transport.AxisTransport";
 126  
         public static final String DEFAULT_SECURITY_PROVIDER = "com.sun.net.ssl.internal.ssl.Provider";
 127  
         public static final String DEFAULT_PROTOCOL_HANDLER = "com.sun.net.ssl.internal.www.protocol";
 128  
         public static final String DEFAULT_UDDI_VERSION = "2.0";
 129  
         public static final String DEFAULT_UDDI_NAMESPACE = "urn:uddi-org:api_v2";
 130  
 
 131  
         private URI adminURI;
 132  
         private URI inquiryURI;
 133  
         private URI publishURI;
 134  
         private URI securityURI;
 135  
 
 136  
         private Transport transport;
 137  
 
 138  
         private String securityProvider;
 139  
         private String protocolHandler;
 140  
         private String uddiVersion;
 141  
         private String uddiNamespace;
 142  
         
 143  0
         private ObjectFactory objectFactory = new ObjectFactory();
 144  
         
 145  0
         private Marshaller marshaller = null;
 146  0
         private Unmarshaller unmarshaller = null;
 147  
         
 148  0
         private static Log log = LogFactory.getLog(RegistryV3Impl.class);
 149  
 
 150  
         /**
 151  
          * Creates a new instance of RegistryImpl.
 152  
          */
 153  
         public RegistryV3Impl(Properties props) {
 154  0
                 super();
 155  
 
 156  0
                 this.init(props);
 157  0
         }
 158  
 
 159  
         /**
 160  
          * 
 161  
          */
 162  
         private void init(Properties props) {
 163  
                 // We need to have a non-null Properties
 164  
                 // instance so initialization takes place.
 165  0
                 if (props == null)
 166  0
                         props = new Properties();
 167  
 
 168  
                 // Override defaults with specific specific values
 169  
                 try {
 170  0
                         String iURL = props.getProperty(INQUIRY_ENDPOINT_PROPERTY_NAME);
 171  0
                         if (iURL != null)
 172  0
                                 this.setInquiryURI(new URI(iURL));
 173  
                         else
 174  0
                                 this.setInquiryURI(new URI(DEFAULT_INQUIRY_ENDPOINT));
 175  
 
 176  0
                         String pURL = props.getProperty(PUBLISH_ENDPOINT_PROPERTY_NAME);
 177  0
                         if (pURL != null)
 178  0
                                 this.setPublishURI(new URI(pURL));
 179  
                         else
 180  0
                                 this.setPublishURI(new URI(DEFAULT_PUBLISH_ENDPOINT));
 181  
 
 182  0
                         String sURL = props.getProperty(SECURITY_ENDPOINT_PROPERTY_NAME);
 183  0
                         if (sURL != null)
 184  0
                                 this.setSecurityURI(new URI(sURL));
 185  
                         else
 186  0
                                 this.setSecurityURI(new URI(DEFAULT_SECURITY_ENDPOINT));
 187  
                         
 188  0
                         String aURL = props.getProperty(ADMIN_ENDPOINT_PROPERTY_NAME);
 189  0
                         if (aURL != null)
 190  0
                                 this.setAdminURI(new URI(aURL));
 191  
                         else
 192  0
                                 this.setAdminURI(new URI(DEFAULT_ADMIN_ENDPOINT));
 193  0
                 } catch (URISyntaxException muex) {
 194  0
                         throw new RuntimeException(muex);
 195  0
                 }
 196  
 
 197  0
                 String secProvider = props.getProperty(SECURITY_PROVIDER_PROPERTY_NAME);
 198  0
                 if (secProvider != null)
 199  0
                         this.setSecurityProvider(secProvider);
 200  
                 else
 201  0
                         this.setSecurityProvider(DEFAULT_SECURITY_PROVIDER);
 202  
 
 203  0
                 String protoHandler = props.getProperty(PROTOCOL_HANDLER_PROPERTY_NAME);
 204  0
                 if (protoHandler != null)
 205  0
                         this.setProtocolHandler(protoHandler);
 206  
                 else
 207  0
                         this.setProtocolHandler(DEFAULT_PROTOCOL_HANDLER);
 208  
 
 209  0
                 String uddiVer = props.getProperty(UDDI_VERSION_PROPERTY_NAME);
 210  0
                 if (uddiVer != null)
 211  0
                         this.setUddiVersion(uddiVer);
 212  
                 else
 213  0
                         this.setUddiVersion(DEFAULT_UDDI_VERSION);
 214  
 
 215  0
                 String uddiNS = props.getProperty(UDDI_NAMESPACE_PROPERTY_NAME);
 216  0
                 if (uddiNS != null)
 217  0
                         this.setUddiNamespace(uddiNS);
 218  
                 else
 219  0
                         this.setUddiNamespace(DEFAULT_UDDI_NAMESPACE);
 220  
 
 221  0
                 String transClass = props.getProperty(TRANSPORT_CLASS_PROPERTY_NAME);
 222  0
                 if (transClass != null)
 223  0
                         this.setTransport(this.getTransport(transClass));
 224  
                 else
 225  0
                         this.setTransport(this.getTransport(DEFAULT_TRANSPORT_CLASS));
 226  
                 
 227  
                 try
 228  
                 {
 229  0
                         JAXBContext v3context = JAXBContextUtil.getContext(JAXBContextUtil.UDDI_V3_VERSION);
 230  0
                         this.unmarshaller = v3context.createUnmarshaller(); 
 231  0
                         this.marshaller = v3context.createMarshaller();
 232  
 
 233  
                 }
 234  0
                 catch(JAXBException e)
 235  
                 {
 236  0
                         throw new RuntimeException(e);
 237  0
                 }
 238  0
         }
 239  
 
 240  
         /**
 241  
          * 
 242  
          * @param uddiRequest
 243  
          * @return String
 244  
          * @throws RegistryV3Exception
 245  
          */
 246  
         public String execute(String uddiRequest, String urltype)
 247  
                         throws TransportException {
 248  0
                 URI endPointURL = null;
 249  0
                 if (urltype.equalsIgnoreCase("INQUIRY"))
 250  0
                         endPointURL = this.getInquiryURI();
 251  
                 else
 252  0
                         endPointURL = this.getPublishURI();
 253  
 
 254  
                 // A SOAP request is made and a SOAP response
 255  
                 // is returned.
 256  
 
 257  0
                 return transport.send(uddiRequest, endPointURL);
 258  
         }
 259  
 
 260  
         /**
 261  
          * 
 262  
          */
 263  
         public JAXBElement<?> execute(JAXBElement<?> uddiRequest, URI endPointURI)
 264  
                         throws RegistryV3Exception {
 265  
 
 266  0
                 ByteArrayOutputStream baos = new ByteArrayOutputStream();
 267  
                 
 268  
         Document doc;
 269  
         try {
 270  0
             DocumentBuilderFactory docBuilderFactory = DocumentBuilderFactory.newInstance();
 271  0
             docBuilderFactory.setNamespaceAware(true);
 272  0
             DocumentBuilder docBuilder= docBuilderFactory.newDocumentBuilder();
 273  0
             this.marshaller.marshal(uddiRequest, baos);
 274  0
             doc = docBuilder.parse(new ByteArrayInputStream(baos.toByteArray()));
 275  0
         } catch (SAXException saxe) {
 276  0
             throw (new RegistryV3Exception(saxe));
 277  0
         } catch (ParserConfigurationException pce) {
 278  0
             throw (new RegistryV3Exception(pce));
 279  0
         } catch (IOException ioe) {
 280  0
             throw (new RegistryV3Exception(ioe));
 281  0
         } catch (JAXBException ioe) {
 282  0
             throw (new RegistryV3Exception(ioe));
 283  0
         }
 284  0
                 Element request = doc.getDocumentElement();
 285  
 
 286  0
             request.setAttribute("xmlns", this.getUddiNamespace());
 287  0
             if (!"3.0".equals(this.getUddiVersion())) {
 288  0
                     request.setAttribute("generic", this.getUddiVersion());
 289  
             }
 290  
             //request.setAttributeNS("http://www.w3.org/2000/xmlns/","xmlns", this.getUddiNamespace());
 291  
             // A SOAP request is made and a SOAP response
 292  
             // is returned.
 293  
 
 294  
             Element response;
 295  
             try {
 296  0
                     response = transport.send(request, endPointURI);
 297  0
             } catch (TransportException te) {
 298  0
                     throw new RegistryV3Exception(te);
 299  0
             }
 300  
             /* if (response.hasAttributes()) {
 301  
                     NamedNodeMap am = response.getAttributes();
 302  
                     ArrayList<String> al = new ArrayList<String>();
 303  
                     for (int i = 0; i < am.getLength(); i++) {
 304  
                             Node n = am.item(i);
 305  
                             String attribute = n.getNodeName();
 306  
                             if (attribute!= null && attribute.startsWith("xmlns")) {
 307  
                                     al.add(attribute);
 308  
                             }
 309  
                     }
 310  
                     for (String attr : al) {
 311  
                             response.removeAttribute(attr);
 312  
                     }
 313  
             }*/
 314  
 
 315  0
             if (response.getNamespaceURI()==null) {
 316  0
             response.setAttributeNS("http://www.w3.org/2000/xmlns/","xmlns", this.getUddiNamespace());
 317  
         }
 318  
             
 319  
             // If we are getting responses from a UDDI v3, remove the xmlns
 320  
             
 321  
             // First, let's make sure that a response
 322  
             // (any response) is found in the SOAP Body.
 323  
 
 324  0
             String responseName = response.getLocalName();
 325  0
             if (responseName == null) {
 326  0
                 throw new RegistryV3Exception("Unsupported response "
 327  
                         + "from registry. A value was not present.");
 328  
                 } 
 329  
             
 330  
         // Let's now try to determine which UDDI response
 331  
         // we received and unmarshal it appropriately or
 332  
         // throw a RegistryV3Exception if it's unknown.
 333  
         // Well, we have now determined that something was
 334  
         // returned and it is "a something" that we know
 335  
         // about so let's unmarshal it into a RegistryObject
 336  
         // Next, let's make sure we didn't recieve a SOAP
 337  
         // Fault. If it is a SOAP Fault then throw it
 338  
         // immediately.
 339  
 
 340  0
         JAXBElement<?> uddiResponse = null;
 341  
             try {
 342  0
                     String xml = XMLUtils.convertNodeToXMLString(response);
 343  0
                 log.debug("Response is: " + xml);
 344  
                     
 345  0
                 StringReader reader = new StringReader(xml);
 346  0
                 uddiResponse = (JAXBElement<?>) unmarshaller.unmarshal(new StreamSource(reader));
 347  
                     //It is probably faster not to go to a String, but JAXB has issues with this
 348  
                 //uddiResponse = (JAXBElement<?>) unmarshaller.unmarshal(response);
 349  
 
 350  0
             } catch (JAXBException xmle) {
 351  0
                 throw (new RegistryV3Exception(xmle));
 352  0
             }
 353  
 
 354  0
                 if (responseName.toLowerCase().equals("fault")) {
 355  0
                         NodeList nodeList = null;
 356  
                         
 357  
                         // Child Elements
 358  0
                         String fCode = null;
 359  0
                         nodeList = response.getElementsByTagName("faultcode");
 360  0
                         if (nodeList.getLength() > 0)
 361  0
                                 fCode = nodeList.item(0).getNodeValue();
 362  
 
 363  0
                         String fString = null;
 364  0
                         nodeList = response.getElementsByTagName("faultstring");
 365  0
                         if (nodeList.getLength() > 0)
 366  0
                                 fString = nodeList.item(0).getNodeValue();
 367  
 
 368  0
                         String fActor = null;
 369  0
                         nodeList = response.getElementsByTagName("faultactor");
 370  0
                         if (nodeList.getLength() > 0)
 371  0
                                 fActor = nodeList.item(0).getNodeValue();
 372  
 
 373  0
                         DispositionReport dispRpt = null;
 374  
 
 375  0
                         nodeList = response.getElementsByTagName("detail");
 376  0
                         if (nodeList.getLength() > 0) {
 377  0
                                 nodeList = ((Element) nodeList.item(0))
 378  
                                                 .getElementsByTagName("dispositionReport");
 379  0
                                 if (nodeList.getLength() > 0) {
 380  0
                                         JAXBElement<DispositionReport> dispRptObj = null;
 381  
                                         try {
 382  0
                                                 dispRptObj = (JAXBElement<DispositionReport>) unmarshaller.unmarshal((Element) nodeList
 383  
                                                                 .item(0));
 384  0
                                         } catch (JAXBException xmle) {
 385  0
                                                 throw (new RegistryV3Exception(xmle));
 386  0
                                         }
 387  0
                     dispRpt = dispRptObj.getValue();
 388  
                 }
 389  
                         }
 390  
 
 391  0
                         RegistryV3Exception e = new RegistryV3Exception(fCode, fString, fActor, dispRpt);
 392  
                 
 393  
                         // Create RegistryV3Exception instance and return
 394  0
                         throw e;
 395  
                 }
 396  
 
 397  0
                 return uddiResponse;
 398  
         }
 399  
  
 400  
         /**
 401  
          * @return Returns the adminURL.
 402  
          */
 403  
         public URI getAdminURI() {
 404  0
                 return this.adminURI;
 405  
         }
 406  
 
 407  
         /**
 408  
          * @param url
 409  
          *            The adminURL to set.
 410  
          */
 411  
         public void setAdminURI(URI url) {
 412  0
                 this.adminURI = url;
 413  0
         }
 414  
 
 415  
         /**
 416  
          * @return Returns the inquiryURL.
 417  
          */
 418  
         public URI getInquiryURI() {
 419  0
                 return this.inquiryURI;
 420  
         }
 421  
 
 422  
         /**
 423  
          * @param inquiryURI
 424  
          *            The inquiryURI to set.
 425  
          */
 426  
         public void setInquiryURI(URI inquiryURI) {
 427  0
                 this.inquiryURI = inquiryURI;
 428  0
         }
 429  
 
 430  
         /**
 431  
          * @return Returns the protocolHandler.
 432  
          */
 433  
         public String getProtocolHandler() {
 434  0
                 return this.protocolHandler;
 435  
         }
 436  
 
 437  
         /**
 438  
          * @param protocolHandler
 439  
          *            The protocolHandler to set.
 440  
          */
 441  
         public void setProtocolHandler(String protocolHandler) {
 442  0
                 this.protocolHandler = protocolHandler;
 443  0
         }
 444  
 
 445  
         /**
 446  
          * @return Returns the publishURL.
 447  
          */
 448  
         public URI getPublishURI() {
 449  0
                 return this.publishURI;
 450  
         }
 451  
         
 452  
         /**
 453  
          * @return Returns the publishURL.
 454  
          */
 455  
         public URI getSecurityURI() {
 456  0
                 return this.securityURI;
 457  
         }
 458  
 
 459  
         /**
 460  
          * @param publishURI
 461  
          *            The publishURI to set.
 462  
          */
 463  
         public void setPublishURI(URI publishURI) {
 464  0
                 this.publishURI = publishURI;
 465  0
         }
 466  
         
 467  
         /**
 468  
          * @param publishURI
 469  
          *            The publishURI to set.
 470  
          */
 471  
         public void setSecurityURI(URI securityURI) {
 472  0
                 this.securityURI = securityURI;
 473  0
         }
 474  
 
 475  
         /**
 476  
          * @return Returns the securityProvider.
 477  
          */
 478  
         public String getSecurityProvider() {
 479  0
                 return this.securityProvider;
 480  
         }
 481  
 
 482  
         /**
 483  
          * @param securityProvider
 484  
          *            The securityProvider to set.
 485  
          */
 486  
         public void setSecurityProvider(String securityProvider) {
 487  0
                 this.securityProvider = securityProvider;
 488  0
         }
 489  
 
 490  
         /**
 491  
          * @return Returns the transport.
 492  
          */
 493  
         public Transport getTransport() {
 494  0
                 return transport;
 495  
         }
 496  
 
 497  
         /**
 498  
          * @param transport
 499  
          *            The transport to set.
 500  
          */
 501  
         public void setTransport(Transport transport) {
 502  0
                 this.transport = transport;
 503  0
         }
 504  
 
 505  
         /**
 506  
          * @return Returns the uddiNS.
 507  
          */
 508  
         public String getUddiNamespace() {
 509  0
                 return this.uddiNamespace;
 510  
         }
 511  
 
 512  
         /**
 513  
          * @param uddiNS
 514  
          *            The uddiNS to set.
 515  
          */
 516  
         public void setUddiNamespace(String uddiNS) {
 517  0
                 this.uddiNamespace = uddiNS;
 518  0
         }
 519  
 
 520  
         /**
 521  
          * @return Returns the uddiVersion.
 522  
          */
 523  
         public String getUddiVersion() {
 524  0
                 return this.uddiVersion;
 525  
         }
 526  
 
 527  
         /**
 528  
          * @param uddiVersion
 529  
          *            The uddiVersion to set.
 530  
          */
 531  
         public void setUddiVersion(String uddiVersion) {
 532  0
                 this.uddiVersion = uddiVersion;
 533  0
         }
 534  
 
 535  
         /**
 536  
          * "Used to remove an existing bindingTemplate from the bindingTemplates
 537  
          * collection that is part of a specified businessService structure."
 538  
          * 
 539  
          * @exception RegistryV3Exception;
 540  
          */
 541  
         public DispositionReport deleteBinding(String authInfo,
 542  
                         String[] bindingKeyArray) throws RegistryV3Exception {
 543  0
                 DeleteBinding request = this.objectFactory.createDeleteBinding();
 544  
 
 545  0
                 if (authInfo != null) {
 546  0
                         request.setAuthInfo(authInfo);
 547  
                 }
 548  
 
 549  0
                 if (bindingKeyArray != null) {
 550  0
                         request.getBindingKey().addAll(Arrays.asList(bindingKeyArray));
 551  
                 }
 552  
 
 553  
         DispositionReport dr;
 554  0
         JAXBElement<?> o = execute(this.objectFactory.createDeleteBinding(request), this.getPublishURI());
 555  0
         dr = (DispositionReport) o.getValue();
 556  
 
 557  0
         return dr;
 558  
         }
 559  
 
 560  
         /**
 561  
          * "Used to delete registered businessEntity information from the registry."
 562  
          * 
 563  
          * @exception RegistryV3Exception;
 564  
          */
 565  
         public DispositionReport deleteBusiness(String authInfo,
 566  
                         String[] businessKeyArray) throws RegistryV3Exception {
 567  0
                 DeleteBusiness request = this.objectFactory.createDeleteBusiness();
 568  
                 
 569  0
                 if (authInfo != null) {
 570  0
                         request.setAuthInfo(authInfo);
 571  
                 }
 572  
 
 573  0
                 if (businessKeyArray != null) {
 574  0
                         request.getBusinessKey().addAll(Arrays.asList(businessKeyArray));
 575  
                 }
 576  
 
 577  
         DispositionReport dr;
 578  0
         JAXBElement<?> o = execute(this.objectFactory.createDeleteBusiness(request), this.getPublishURI());
 579  0
         dr = (DispositionReport) o.getValue();
 580  
 
 581  0
         return dr;
 582  
         }
 583  
 
 584  
         /**
 585  
          * @exception RegistryV3Exception;
 586  
          */
 587  
         public DispositionReport deletePublisherAssertions(String authInfo,
 588  
                         PublisherAssertion[] assertionArray) throws RegistryV3Exception {
 589  0
                 DeletePublisherAssertions request = this.objectFactory.createDeletePublisherAssertions();
 590  
 
 591  0
                 if (authInfo != null) {
 592  0
                         request.setAuthInfo(authInfo);
 593  
                 }
 594  
 
 595  0
                 if (assertionArray != null) {
 596  0
                         request.getPublisherAssertion().addAll(Arrays.asList(assertionArray));
 597  
                 }
 598  
 
 599  
         DispositionReport dr;
 600  0
         JAXBElement<?> o = execute(this.objectFactory.createDeletePublisherAssertions(request), 
 601  
                         this.getPublishURI());
 602  0
         dr = (DispositionReport) o.getValue();
 603  
 
 604  0
         return dr;
 605  
         }
 606  
 
 607  
         /**
 608  
          * "Used to delete an existing businessService from the businessServices
 609  
          * collection that is part of a specified businessEntity."
 610  
          * 
 611  
          * @exception RegistryV3Exception;
 612  
          */
 613  
         public DispositionReport deleteService(String authInfo,
 614  
                         String[] serviceKeyArray) throws RegistryV3Exception {
 615  0
                 DeleteService request = this.objectFactory.createDeleteService();
 616  
                 
 617  0
                 if (authInfo != null) {
 618  0
                         request.setAuthInfo(authInfo);
 619  
                 }
 620  
 
 621  0
                 if (serviceKeyArray != null) {
 622  0
                         request.getServiceKey().addAll(Arrays.asList(serviceKeyArray));
 623  
                 }
 624  
 
 625  
         DispositionReport dr;
 626  0
         JAXBElement<?> o = execute(this.objectFactory.createDeleteService(request), 
 627  
                         this.getPublishURI());
 628  0
         dr = (DispositionReport) o.getValue();
 629  
 
 630  0
         return dr;
 631  
         }
 632  
 
 633  
         /**
 634  
          * "Used to delete registered information about a tModel. If there are any
 635  
          * references to a tModel when this call is made, the tModel will be marked
 636  
          * deleted instead of being physically removed."
 637  
          * 
 638  
          * @exception RegistryV3Exception;
 639  
          */
 640  
         public DispositionReport deleteTModel(String authInfo,
 641  
                         String[] tModelKeyArray) throws RegistryV3Exception {
 642  0
                 DeleteTModel request = this.objectFactory.createDeleteTModel();
 643  
 
 644  0
                 if (authInfo != null) {
 645  0
                         request.setAuthInfo(authInfo);
 646  
                 }
 647  
 
 648  0
                 if (tModelKeyArray != null) {
 649  0
                         request.getTModelKey().addAll(Arrays.asList(tModelKeyArray));
 650  
                 }
 651  
 
 652  
         DispositionReport dr;
 653  0
         JAXBElement<?> o = execute(this.objectFactory.createDeleteTModel(request), 
 654  
                         this.getPublishURI());
 655  0
         dr = (DispositionReport) o.getValue();
 656  
 
 657  0
         return dr;
 658  
         }
 659  
 
 660  
         /**
 661  
          * Used to locate information about one or more businesses. Returns a
 662  
          * businessList message that matches the conditions specified.
 663  
          * 
 664  
          * @exception RegistryV3Exception;
 665  
          */
 666  
         public BusinessList findBusiness(Name[] nameArray,
 667  
                         DiscoveryURLs discoveryURLs, IdentifierBag identifierBag,
 668  
                         CategoryBag categoryBag, TModelBag tModelBag,
 669  
                         FindQualifiers findQualifiers, int maxRows)
 670  
                         throws RegistryV3Exception {
 671  0
                 FindBusiness request = this.objectFactory.createFindBusiness();
 672  
 
 673  0
                 if (nameArray != null) {
 674  0
                         request.getName().addAll(Arrays.asList(nameArray));
 675  
                 }
 676  
 
 677  0
                 if (discoveryURLs != null) {
 678  0
                         request.setDiscoveryURLs(discoveryURLs);
 679  
                 }
 680  
 
 681  0
                 if (identifierBag != null) {
 682  0
                         request.setIdentifierBag(identifierBag);
 683  
                 }
 684  
 
 685  0
                 if (categoryBag != null) {
 686  0
                         request.setCategoryBag(categoryBag);
 687  
                 }
 688  
 
 689  0
                 if (tModelBag != null) {
 690  0
                         request.setTModelBag(tModelBag);
 691  
                 } 
 692  
 
 693  0
                 if (findQualifiers != null) {
 694  0
                         request.setFindQualifiers(findQualifiers);
 695  
                 }
 696  
 
 697  0
                 request.setMaxRows(maxRows);
 698  
 
 699  
         BusinessList bl;
 700  0
         JAXBElement<?> o = execute(this.objectFactory.createFindBusiness(request),
 701  
                         this.getInquiryURI());
 702  0
         bl = (BusinessList) o.getValue();
 703  
 
 704  0
         return bl;
 705  
         }
 706  
 
 707  
         /**
 708  
          * "Used to locate specific bindings within a registered businessService.
 709  
          * Returns a bindingDetail message."
 710  
          * 
 711  
          * @exception RegistryV3Exception
 712  
          */
 713  
         public BindingDetail findBinding(String serviceKey,
 714  
                         CategoryBag categoryBag, TModelBag tModelBag,
 715  
                         FindQualifiers findQualifiers, int maxRows)
 716  
                         throws RegistryV3Exception {
 717  
                 // FIXME: Juddi's methods also set category bag (per uddi spec v3).
 718  
                 // However, we are sticking to v2 for now, so categorybag doesn't
 719  
                 // exist under FindBinding. It is fine for now, since the incoming
 720  
                 // parameter value is always null anyways -- but this may change
 721  
                 // in the future.
 722  
 
 723  0
                 FindBinding request = this.objectFactory.createFindBinding();
 724  
 
 725  0
                 if (serviceKey != null) {
 726  0
                         request.setServiceKey(serviceKey);
 727  
                 }
 728  
 
 729  0
                 if (categoryBag != null) {
 730  0
                         request.setCategoryBag(categoryBag);
 731  
                 }
 732  
                 
 733  0
                 if (tModelBag != null) {
 734  0
                         request.setTModelBag(tModelBag);
 735  
                 }
 736  
 
 737  0
                 if (findQualifiers != null) {
 738  0
                         request.setFindQualifiers(findQualifiers);
 739  
                 }
 740  0
                 request.setMaxRows(maxRows);
 741  
 
 742  
         BindingDetail bd;
 743  0
         JAXBElement<?> o = execute(this.objectFactory.createFindBinding(request), 
 744  
                         this.getInquiryURI());
 745  0
         bd = (BindingDetail) o.getValue();
 746  
 
 747  0
         return bd;
 748  
         }
 749  
 
 750  
         /**
 751  
          * "Used to locate specific services within a registered businessEntity.
 752  
          * Return a serviceList message." From the XML spec (API, p18) it appears
 753  
          * that the name, categoryBag, and tModelBag arguments are mutually
 754  
          * exclusive.
 755  
          * 
 756  
          * @exception RegistryV3Exception;
 757  
          */
 758  
         public ServiceList findService(String businessKey, Name[] nameArray,
 759  
                         CategoryBag categoryBag, TModelBag tModelBag,
 760  
                         FindQualifiers findQualifiers, int maxRows)
 761  
                         throws RegistryV3Exception {
 762  0
                 FindService request = this.objectFactory.createFindService();
 763  
 
 764  0
                 if (businessKey != null) {
 765  0
                         request.setBusinessKey(businessKey);
 766  
                 }
 767  
 
 768  0
                 if (nameArray != null) {
 769  0
                         request.getName().addAll(Arrays.asList(nameArray));
 770  
                 }
 771  
 
 772  0
                 if (categoryBag != null) {
 773  0
                         request.setCategoryBag(categoryBag);
 774  
                 }
 775  
 
 776  0
                 if (tModelBag != null) {
 777  0
                         request.setTModelBag(tModelBag);
 778  
                 }
 779  
 
 780  0
                 if (findQualifiers != null) {
 781  0
                         request.setFindQualifiers(findQualifiers);
 782  
                 }
 783  
 
 784  0
                 request.setMaxRows(maxRows);
 785  
 
 786  
         ServiceList sl;
 787  0
         JAXBElement<?> o = execute(this.objectFactory.createFindService(request), 
 788  
                         this.getInquiryURI());
 789  0
         sl = (ServiceList) o.getValue();
 790  
 
 791  0
         return sl;
 792  
         }
 793  
 
 794  
         /**
 795  
          * "Used to locate one or more tModel information structures. Returns a
 796  
          * tModelList structure."
 797  
          * 
 798  
          * @exception RegistryV3Exception;
 799  
          */
 800  
         public TModelList findTModel(String name, CategoryBag categoryBag,
 801  
                         IdentifierBag identifierBag, FindQualifiers findQualifiers,
 802  
                         int maxRows) throws RegistryV3Exception {
 803  0
                 FindTModel request = this.objectFactory.createFindTModel();
 804  
 
 805  0
                 Name jaxbName = this.objectFactory.createName();
 806  
 
 807  0
                 if (name != null) {
 808  0
                         jaxbName.setValue(name);
 809  
                 }
 810  
 
 811  0
                 request.setName(jaxbName);
 812  
 
 813  0
                 if (categoryBag != null) {
 814  0
                         request.setCategoryBag(categoryBag);
 815  
                 }
 816  
 
 817  0
                 if (identifierBag != null) {
 818  0
                         request.setIdentifierBag(identifierBag);
 819  
                 }
 820  
 
 821  0
                 if (findQualifiers != null) {
 822  0
                         request.setFindQualifiers(findQualifiers);
 823  
                 }
 824  
 
 825  0
                 request.setMaxRows(maxRows);
 826  
 
 827  
         TModelList tml;
 828  0
         JAXBElement<?> o = execute(this.objectFactory.createFindTModel(request), 
 829  
                         this.getInquiryURI());
 830  0
         tml = (TModelList) o.getValue();
 831  
 
 832  0
         return tml;
 833  
         }
 834  
 
 835  
         /**
 836  
          * @exception RegistryV3Exception;
 837  
          */
 838  
         public AssertionStatusReport getAssertionStatusReport(String authInfo,
 839  
                         String completionStatus) throws RegistryV3Exception {
 840  0
                 GetAssertionStatusReport request = this.objectFactory.createGetAssertionStatusReport();
 841  
 
 842  0
                 if (authInfo != null) {
 843  0
                         request.setAuthInfo(authInfo);
 844  
                 }
 845  
 
 846  0
                 if (completionStatus != null) {
 847  0
                         CompletionStatus cs = CompletionStatus.fromValue(completionStatus);
 848  0
                         request.setCompletionStatus(cs);
 849  
                 }
 850  
 
 851  
         AssertionStatusReport asr;
 852  0
         JAXBElement<?> o = execute(this.objectFactory.createGetAssertionStatusReport(request), 
 853  
                         this.getPublishURI());
 854  0
         asr = (AssertionStatusReport) o.getValue();
 855  
 
 856  0
         return asr;
 857  
         }
 858  
 
 859  
         /**
 860  
          * "Used to request an authentication token from an Operator Site.
 861  
          * Authentication tokens are required to use all other APIs defined in the
 862  
          * publishers API. This server serves as the program's equivalent of a login
 863  
          * request."
 864  
          * 
 865  
          * @exception RegistryV3Exception;
 866  
          */
 867  
         public AuthToken getAuthToken(String userID, String cred)
 868  
                         throws RegistryV3Exception {
 869  0
                 GetAuthToken request = this.objectFactory.createGetAuthToken();
 870  
 
 871  0
                 if (userID != null) {
 872  0
                         request.setUserID(userID);
 873  
                 }
 874  
 
 875  0
                 if (cred != null) {
 876  0
                         request.setCred(cred);
 877  
                 }
 878  
 
 879  0
                 URI getAuthTokenURI = null;
 880  0
                 if ("3.0".equals(uddiVersion)) {
 881  0
                         getAuthTokenURI = this.getSecurityURI();
 882  
                 } else {
 883  0
                         getAuthTokenURI = this.getPublishURI();
 884  
                 }
 885  
                 
 886  
         AuthToken at;
 887  0
         JAXBElement<?> o = execute(this.objectFactory.createGetAuthToken(request), 
 888  
                         getAuthTokenURI);
 889  0
         at = (AuthToken) o.getValue();
 890  
 
 891  0
         return at;
 892  
         }
 893  
 
 894  
         /**
 895  
          * Used to get the full businessEntity information for a particular business
 896  
          * entity. Returns a businessDetail message.
 897  
          * 
 898  
          * @exception RegistryV3Exception;
 899  
          */
 900  
         public BusinessDetail getBusinessDetail(String businessKey)
 901  
                         throws RegistryV3Exception {
 902  0
                 String[] keys = new String[1];
 903  0
                 keys[0] = businessKey;
 904  
 
 905  0
                 return getBusinessDetail(keys);
 906  
         }
 907  
 
 908  
         /**
 909  
          * "Used to get the full businessEntity information for one or more
 910  
          * businesses. Returns a businessDetail message."
 911  
          * 
 912  
          * @exception RegistryV3Exception;
 913  
          */
 914  
         public BusinessDetail getBusinessDetail(String[] businessKeyArray)
 915  
                         throws RegistryV3Exception {
 916  0
                 GetBusinessDetail request = this.objectFactory.createGetBusinessDetail();
 917  
 
 918  0
                 if (businessKeyArray != null) {
 919  0
                         request.getBusinessKey().addAll(Arrays.asList(businessKeyArray));
 920  
                 }
 921  
 
 922  
         BusinessDetail bd;
 923  0
         JAXBElement<?> o = execute(this.objectFactory.createGetBusinessDetail(request), 
 924  
                         this.getInquiryURI());
 925  0
         bd = (BusinessDetail) o.getValue(); 
 926  0
         return bd;
 927  
         }
 928  
 
 929  
         /**
 930  
          * @exception RegistryV3Exception;
 931  
          */
 932  
         public PublisherAssertions getPublisherAssertions(String authInfo)
 933  
                         throws RegistryV3Exception {
 934  0
                 GetPublisherAssertions request = this.objectFactory.createGetPublisherAssertions();
 935  
 
 936  0
                 if (authInfo != null) {
 937  0
                         request.setAuthInfo(authInfo);
 938  
                 }
 939  
 
 940  0
         PublisherAssertions pa = new PublisherAssertions();
 941  0
         JAXBElement<?> o = execute(this.objectFactory.createGetPublisherAssertions(request),
 942  
                         this.getPublishURI());
 943  0
         PublisherAssertionsResponse par = (PublisherAssertionsResponse) o.getValue();
 944  0
         List<PublisherAssertion> assertions = par.getPublisherAssertion();
 945  0
         for (int i = 0; i < assertions.size(); i++ ) {
 946  0
                 pa.getPublisherAssertion().add((PublisherAssertion)assertions.get(i));
 947  
         }
 948  
 
 949  0
         return pa;
 950  
         }
 951  
 
 952  
         /**
 953  
          * @exception RegistryV3Exception;
 954  
          */
 955  
         public RegisteredInfo getRegisteredInfo(String authInfo)
 956  
                         throws RegistryV3Exception {
 957  0
                 GetRegisteredInfo request = this.objectFactory.createGetRegisteredInfo();
 958  
 
 959  0
                 if (authInfo != null) {
 960  0
                         request.setAuthInfo(authInfo);
 961  
                 }
 962  
 
 963  
         RegisteredInfo ri;
 964  0
         JAXBElement<?> o = execute(this.objectFactory.createGetRegisteredInfo(request), 
 965  
                         this.getPublishURI());
 966  0
         ri = (RegisteredInfo) o.getValue();
 967  
 
 968  0
         return ri;
 969  
         }
 970  
         
 971  
         /**
 972  
          * "Used to get full details for a particular registered businessService.
 973  
          * Returns a serviceDetail message."
 974  
          * 
 975  
          * @exception RegistryV3Exception;
 976  
          */
 977  
         public ServiceDetail getServiceDetail(String serviceKey)
 978  
                         throws RegistryV3Exception {
 979  0
                 String[] keys = new String[1];
 980  0
                 keys[0] = serviceKey;
 981  
 
 982  0
                 return getServiceDetail(keys);
 983  
         }
 984  
 
 985  
         /**
 986  
          * "Used to get full details for a given set of registered businessService
 987  
          * data. Returns a serviceDetail message."
 988  
          * 
 989  
          * @exception RegistryV3Exception;
 990  
          */
 991  
         public ServiceDetail getServiceDetail(String[] serviceKeyArray)
 992  
                         throws RegistryV3Exception {
 993  0
                 GetServiceDetail request = this.objectFactory.createGetServiceDetail();
 994  
 
 995  0
                 if (serviceKeyArray != null) {
 996  0
                         request.getServiceKey().addAll(Arrays.asList(serviceKeyArray));
 997  
                 }
 998  
 
 999  
         ServiceDetail sd;
 1000  0
         JAXBElement<?> o = execute(this.objectFactory.createGetServiceDetail(request), 
 1001  
                         this.getInquiryURI());
 1002  0
         sd = (ServiceDetail) o.getValue();
 1003  
 
 1004  0
         return sd;
 1005  
         }
 1006  
 
 1007  
         /**
 1008  
          * "Used to get full details for a particular registered TModel. Returns a
 1009  
          * tModelDetail message."
 1010  
          * 
 1011  
          * @exception RegistryV3Exception;
 1012  
          */
 1013  
         public TModelDetail getTModelDetail(String tModelKey)
 1014  
                         throws RegistryV3Exception {
 1015  0
                 String[] keys = new String[1];
 1016  0
                 keys[0] = tModelKey;
 1017  
 
 1018  0
                 return getTModelDetail(keys);
 1019  
         }
 1020  
 
 1021  
         /**
 1022  
          * "Used to get full details for a given set of registered tModel data.
 1023  
          * Returns a tModelDetail message."
 1024  
          * 
 1025  
          * @exception RegistryV3Exception;
 1026  
          */
 1027  
         public TModelDetail getTModelDetail(String[] tModelKeyArray)
 1028  
                         throws RegistryV3Exception {
 1029  0
                 GetTModelDetail request = this.objectFactory.createGetTModelDetail();
 1030  
 
 1031  0
                 if (tModelKeyArray != null) {
 1032  0
                         request.getTModelKey().addAll(Arrays.asList(tModelKeyArray));
 1033  
                 }
 1034  
 
 1035  
         TModelDetail tmd;
 1036  0
         JAXBElement<?> o = execute(this.objectFactory.createGetTModelDetail(request), 
 1037  
                         this.getInquiryURI());
 1038  0
         tmd = (TModelDetail) o.getValue();
 1039  
 
 1040  0
         return tmd;
 1041  
         }
 1042  
 
 1043  
         /**
 1044  
          * @exception RegistryV3Exception;
 1045  
          */
 1046  
         public PublisherAssertions setPublisherAssertions(String authInfo,
 1047  
                         PublisherAssertion[] assertionArray) throws RegistryV3Exception {
 1048  0
                 SetPublisherAssertions request = this.objectFactory.createSetPublisherAssertions();
 1049  
 
 1050  0
                 if (authInfo != null) {
 1051  0
                         request.setAuthInfo(authInfo);
 1052  
                 }
 1053  
 
 1054  0
                 if (assertionArray != null) {
 1055  0
                         request.getPublisherAssertion().addAll(Arrays.asList(assertionArray));
 1056  
                 }
 1057  
 
 1058  
         PublisherAssertions pa;
 1059  0
         JAXBElement<?> o = execute(this.objectFactory.createSetPublisherAssertions(request), 
 1060  
                         this.getPublishURI());
 1061  0
         pa = (PublisherAssertions) o.getValue();
 1062  
 
 1063  0
         return pa;
 1064  
         }
 1065  
 
 1066  
         /**
 1067  
          * "Used to register new bindingTemplate information or update existing
 1068  
          * bindingTemplate information. Use this to control information about
 1069  
          * technical capabilities exposed by a registered business."
 1070  
          * 
 1071  
          * @exception RegistryV3Exception;
 1072  
          */
 1073  
         public BindingDetail saveBinding(String authInfo,
 1074  
                         BindingTemplate[] bindingArray) throws RegistryV3Exception {
 1075  0
                 SaveBinding request = this.objectFactory.createSaveBinding();
 1076  
 
 1077  0
                 if (authInfo != null) {
 1078  0
                         request.setAuthInfo(authInfo);
 1079  
                 }
 1080  
 
 1081  0
                 if (bindingArray != null) {
 1082  0
                         request.getBindingTemplate().addAll(Arrays.asList(bindingArray));
 1083  
                 }
 1084  
                 
 1085  
         BindingDetail bd;
 1086  0
         JAXBElement<?> o = execute(this.objectFactory.createSaveBinding(request), 
 1087  
                         this.getPublishURI());
 1088  0
         bd = (BindingDetail) o.getValue();
 1089  
 
 1090  0
         return bd;
 1091  
         }
 1092  
 
 1093  
         /**
 1094  
          * "Used to register new businessEntity information or update existing
 1095  
          * businessEntity information. Use this to control the overall information
 1096  
          * about the entire business. Of the save_x APIs this one has the broadest
 1097  
          * effect."
 1098  
          * 
 1099  
          * @exception RegistryV3Exception;
 1100  
          */
 1101  
         public BusinessDetail saveBusiness(String authInfo,
 1102  
                         BusinessEntity[] businessArray) throws RegistryV3Exception {
 1103  0
                 SaveBusiness request = this.objectFactory.createSaveBusiness();
 1104  
 
 1105  0
                 if (authInfo != null) {
 1106  0
                         request.setAuthInfo(authInfo);
 1107  
                 }
 1108  
                         
 1109  0
                 if (businessArray != null) {
 1110  0
                         for (int i = 0; i < businessArray.length; i++) {
 1111  0
                                 BusinessEntity be = businessArray[i];
 1112  0
                                 if (be.getBusinessServices().getBusinessService().size() == 0) {
 1113  0
                                         be.setBusinessServices(null);
 1114  
                                 }
 1115  
                         }
 1116  
 
 1117  0
                         request.getBusinessEntity().addAll(Arrays.asList(businessArray));
 1118  
                 }
 1119  
                 
 1120  
         BusinessDetail bd;
 1121  0
         JAXBElement<?> o = execute(this.objectFactory.createSaveBusiness(request), 
 1122  
                         this.getPublishURI());
 1123  0
         bd = (BusinessDetail) o.getValue();
 1124  
 
 1125  0
         return bd;
 1126  
         }
 1127  
 
 1128  
         /**
 1129  
          * "Used to register or update complete information about a businessService
 1130  
          * exposed by a specified businessEntity."
 1131  
          * 
 1132  
          * @exception RegistryV3Exception;
 1133  
          */
 1134  
         public ServiceDetail saveService(String authInfo,
 1135  
                         BusinessService[] serviceArray) throws RegistryV3Exception {
 1136  0
                 SaveService request = this.objectFactory.createSaveService();
 1137  
 
 1138  0
                 if (authInfo != null) {
 1139  0
                         request.setAuthInfo(authInfo);
 1140  
                 }
 1141  
 
 1142  0
                 if (serviceArray != null) {
 1143  0
                         request.getBusinessService().addAll(Arrays.asList(serviceArray));
 1144  
                 }
 1145  
 
 1146  
         ServiceDetail sd;
 1147  0
         JAXBElement<?> o = execute(this.objectFactory.createSaveService(request), 
 1148  
                         this.getPublishURI());
 1149  0
         sd = (ServiceDetail) o.getValue();
 1150  
 
 1151  0
         return sd;
 1152  
         }
 1153  
 
 1154  
         /**
 1155  
          * "Used to register or update complete information about a tModel."
 1156  
          * 
 1157  
          * @exception RegistryV3Exception;
 1158  
          */
 1159  
         public TModelDetail saveTModel(String authInfo, TModel[] tModelArray)
 1160  
                         throws RegistryV3Exception {
 1161  0
                 SaveTModel request = this.objectFactory.createSaveTModel();
 1162  
 
 1163  0
                 if (authInfo != null) {
 1164  0
                         request.setAuthInfo(authInfo);
 1165  
                 }
 1166  
 
 1167  0
                 if (tModelArray != null) {
 1168  0
                         request.getTModel().addAll(Arrays.asList(tModelArray));
 1169  
                 }
 1170  
 
 1171  
         TModelDetail tmd;
 1172  0
         JAXBElement<?> o = execute(this.objectFactory.createSaveTModel(request), 
 1173  
                         this.getPublishURI());
 1174  0
         tmd = (TModelDetail) o.getValue();
 1175  0
         return tmd;
 1176  
         }
 1177  
 
 1178  
         /**
 1179  
          * Returns an implementation of Transport based on the className passed in.
 1180  
          * If a null value is passed then the default Transport implementation
 1181  
          * "org.apache.ws.scout.transport.AxisTransport" is created and returned.
 1182  
          * 
 1183  
          * @return Transport
 1184  
          */
 1185  
         public Transport getTransport(String className) {
 1186  0
                 Transport transport = null;
 1187  0
                 Class transportClass = null;
 1188  
 
 1189  
                 // If a Transport class name isn't supplied use
 1190  
                 // the default Transport implementation.
 1191  0
                 if (className == null)
 1192  0
                         className = DEFAULT_TRANSPORT_CLASS;
 1193  
 
 1194  
                 try {
 1195  
                         // instruct class loader to load the TransportFactory
 1196  0
                         transportClass = getClassForName(className);
 1197  0
                 } catch (ClassNotFoundException cnfex) {
 1198  0
                         throw new RuntimeException(cnfex);
 1199  0
                 }
 1200  
 
 1201  
                 try {
 1202  
                         // try to instantiate the TransportFactory
 1203  0
                         transport = (Transport) transportClass.newInstance();
 1204  0
                 } catch (Exception ex) {
 1205  0
                         throw new RuntimeException(ex);
 1206  0
                 }
 1207  
 
 1208  0
                 return transport;
 1209  
         }
 1210  
 
 1211  
         /**
 1212  
          * 
 1213  
          * @param name
 1214  
          * @return The class object for the name given
 1215  
          * @throws ClassNotFoundException
 1216  
          * @throws NoClassDefFoundError
 1217  
          */
 1218  
         public static Class getClassForName(String name)
 1219  
                         throws ClassNotFoundException, NoClassDefFoundError {
 1220  0
                 Class clazz = null;
 1221  
 
 1222  
                 try {
 1223  
                         // log.info("Using the Context ClassLoader");
 1224  0
                         ClassLoader ccl = AccessController.doPrivileged(new PrivilegedAction<ClassLoader>() 
 1225  
                     {
 1226  0
                                 public ClassLoader run() {
 1227  0
                                         return Thread.currentThread().getContextClassLoader();
 1228  
                         }
 1229  
                         });
 1230  
                         
 1231  0
                         clazz = Class.forName(name, true, ccl);
 1232  0
                 } catch (Exception e) {
 1233  0
                          log.debug("Failed to load the class " + name + " with context class loader " + e);
 1234  0
                 }
 1235  
 
 1236  0
                 if (null == clazz) {
 1237  0
                         ClassLoader scl = AccessController.doPrivileged(new PrivilegedAction<ClassLoader>()
 1238  
                         { 
 1239  0
                                 public ClassLoader run() {
 1240  0
                                         return ClassLoader.getSystemClassLoader();
 1241  
                                 }
 1242  
                         });
 1243  
 
 1244  
                         try {
 1245  0
                                 clazz = Class.forName(name, true, scl);
 1246  0
                         } catch (Exception e) {
 1247  0
                           throw new RuntimeException(e);
 1248  0
                         }
 1249  
                 }
 1250  
 
 1251  0
                 return clazz;
 1252  
         }
 1253  
 }