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