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