You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scout-dev@ws.apache.org by tc...@apache.org on 2009/09/07 01:21:24 UTC
svn commit: r811951 [3/4] - in /webservices/scout/trunk: ./
src/main/java/org/apache/ws/scout/registry/
src/main/java/org/apache/ws/scout/transport/
src/main/java/org/apache/ws/scout/util/ src/test/java/org/apache/ws/scout/
src/test/java/org/apache/ws/...
Added: webservices/scout/trunk/src/main/java/org/apache/ws/scout/registry/RegistryV3Exception.java
URL: http://svn.apache.org/viewvc/webservices/scout/trunk/src/main/java/org/apache/ws/scout/registry/RegistryV3Exception.java?rev=811951&view=auto
==============================================================================
--- webservices/scout/trunk/src/main/java/org/apache/ws/scout/registry/RegistryV3Exception.java (added)
+++ webservices/scout/trunk/src/main/java/org/apache/ws/scout/registry/RegistryV3Exception.java Sun Sep 6 23:21:23 2009
@@ -0,0 +1,351 @@
+/*
+ * Copyright 2001-2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.ws.scout.registry;
+
+import org.uddi.api_v3.*;
+
+/**
+ * Thrown to indicate that a UDDI Exception was encountered.
+ *
+ * <i>Borrowed from jUDDI project.</i>
+ *
+ * @author Steve Viens (sviens@apache.org)
+ */
+public class RegistryV3Exception extends Exception
+{
+ private static final long serialVersionUID = 1L;
+ public static final int E_ASSERTION_NOT_FOUND = 30000;
+ public static final int E_AUTH_TOKEN_EXPIRED = 10110;
+ public static final int E_AUTH_TOKEN_REQUIRED = 10120;
+ public static final int E_ACCOUNT_LIMIT_EXCEEDED = 10160;
+ public static final int E_BUSY = 10400;
+ public static final int E_CATEGORIZATION_NOT_ALLOWED = 20100;
+ public static final int E_FATAL_ERROR = 10500;
+ public static final int E_INVALID_KEY_PASSED = 10210;
+ public static final int E_INVALID_PROJECTION = 20230;
+ public static final int E_INVALID_CATEGORY = 20000;
+ public static final int E_INVALID_COMPLETION_STATUS = 30100;
+ public static final int E_INVALID_URL_PASSED = 10220;
+ public static final int E_INVALID_VALUE = 20200;
+ public static final int E_KEY_RETIRED = 10310;
+ public static final int E_LANGUAGE_ERROR = 10060;
+ public static final int E_MESSAGE_TOO_LARGE = 30110;
+ public static final int E_NAME_TOO_LONG = 10020;
+ public static final int E_OPERATOR_MISMATCH = 10130;
+ public static final int E_PUBLISHER_CANCELLED = 30220;
+ public static final int E_REQUEST_DENIED = 30210;
+ public static final int E_SECRET_UNKNOWN = 30230;
+ public static final int E_SUCCESS = 0;
+ public static final int E_TOO_MANY_OPTIONS = 10030;
+ public static final int E_TRANSFER_ABORTED = 30200;
+ public static final int E_UNRECOGNIZED_VERSION = 10040;
+ public static final int E_UNKNOWN_USER = 10150;
+ public static final int E_UNSUPPORTED = 10050;
+ public static final int E_USER_MISMATCH = 10140;
+ public static final int E_VALUE_NOT_ALLOWED = 20210;
+ public static final int E_UNVALIDATABLE = 20220;
+ public static final int E_REQUEST_TIMEOUT = 20240;
+ public static final int E_INVALID_TIME = 40030;
+ public static final int E_RESULT_SET_TOO_LARGE = 40300;
+
+ // SOAP SOAPFault Actor
+ private String faultActor;
+
+ // SOAP SOAPFault Code
+ private String faultCode;
+
+ // SOAP SOAPFault SOAPMessage
+ private String faultString;
+
+ // UDDI DispositionReport
+ private DispositionReport dispReport;
+
+ private ObjectFactory objectFactory = new ObjectFactory();
+
+ /**
+ * Constructs a RegistryException instance.
+ * @param msg additional error information
+ */
+ public RegistryV3Exception(String msg)
+ {
+ super(msg);
+
+ setFaultCode(null);
+ setFaultString(msg);
+ setFaultActor(null);
+ }
+
+ /**
+ * Constructs a RegistryException instance.
+ * @param ex the original exception
+ */
+ public RegistryV3Exception(Exception ex)
+ {
+ super(ex);
+
+ if (ex != null)
+ {
+ // Not sure why this would ever happen but
+ // just in case we are asked to create a new
+ // RegistryException using values from another
+ // let's be sure to grab all relevant values.
+ //
+ if (ex instanceof RegistryV3Exception)
+ {
+ RegistryV3Exception regex = (RegistryV3Exception)ex;
+ setFaultCode(regex.getFaultCode());
+ setFaultString(regex.getFaultString());
+ setFaultActor(regex.getFaultActor());
+ setDispositionReport(regex.getDispositionReport());
+ }
+ else // Not a RegistryException (or subclass)
+ {
+ setFaultString(ex.getMessage());
+ }
+ }
+ }
+
+ /**
+ * Constructs a RegistryException instance.
+ *
+ * @param fCode
+ * @param fString
+ * @param fActor
+ * @param dispRpt
+ */
+ public RegistryV3Exception(String fCode,String fString,String fActor,DispositionReport dispRpt)
+ {
+ super(fString);
+
+ setFaultCode(fCode);
+ setFaultString(fString);
+ setFaultActor(fActor);
+ setDispositionReport(dispRpt);
+ }
+
+ /**
+ * Constructs a RegistryException instance.
+ * @param ex the original exception
+ */
+ RegistryV3Exception(String fCode,int errno,String msg)
+ {
+ super(buildMessage(errno,msg));
+
+ String errCode = lookupErrCode(errno);
+
+ if (fCode != null) {
+ setFaultCode(fCode);
+ }
+
+ setFaultString(getMessage());
+
+ Result r = this.objectFactory.createResult();
+ ErrInfo ei = this.objectFactory.createErrInfo();
+
+ if (errCode != null) {
+ ei.setErrCode(errCode);
+ }
+
+ ei.setValue(getMessage());
+
+ r.setErrno(errno);
+
+ if (ei != null) {
+ r.setErrInfo(ei);
+ }
+
+ addResult(r);
+ }
+
+ /**
+ * Sets the fault actor of this SOAP SOAPFault to the given value.
+ * @param actor The new actor value for this SOAP SOAPFault.
+ */
+ public void setFaultActor(String actor)
+ {
+ this.faultActor = actor;
+ }
+
+ /**
+ * Returns the fault actor of this SOAP SOAPFault.
+ * @return The fault actor of this SOAP SOAPFault.
+ */
+ public String getFaultActor()
+ {
+ return this.faultActor;
+ }
+
+ /**
+ * Sets the fault code of this SOAP SOAPFault to the given value.
+ * @param code The new code number for this SOAP SOAPFault.
+ */
+ public void setFaultCode(String code)
+ {
+ this.faultCode = code;
+ }
+
+ /**
+ * Returns the fault code of this SOAP SOAPFault.
+ * @return The fault code of this SOAP SOAPFault.
+ */
+ public String getFaultCode()
+ {
+ return this.faultCode;
+ }
+
+ /**
+ * Sets the fault string of this SOAP SOAPFault to the given value.
+ * @param value The new fault string for this SOAP SOAPFault.
+ */
+ public void setFaultString(String value)
+ {
+ this.faultString = value;
+ }
+
+ /**
+ * Returns the fault string of this SOAP SOAPFault.
+ * @return The fault string of this SOAP SOAPFault.
+ */
+ public String getFaultString()
+ {
+ return this.faultString;
+ }
+
+ /**
+ * Sets the UDDI DispositionReport value to the instance
+ * specified
+ * @param dispRpt The new UDDI DispositionReport instance for
+ * this SOAP Fault.
+ */
+ public void setDispositionReport(DispositionReport dispRpt)
+ {
+ this.dispReport = dispRpt;
+ }
+
+ /**
+ * Returns the disposition report associated with this jUDDI exception. It
+ * uses the results Vector to determine if a disposition report is present
+ * and should be returned.
+ * @return The disposition report associated with this jUDDI exception.
+ */
+ public DispositionReport getDispositionReport()
+ {
+ return this.dispReport;
+ }
+
+ /**
+ * Adds a result instance to this Exception. Multiple result objects
+ * may exist within a DispositionReport
+ */
+ public void addResult(Result result)
+ {
+ if (this.dispReport==null) {
+ this.dispReport = this.objectFactory.createDispositionReport();
+ }
+
+ Result jaxbResult = this.objectFactory.createResult();
+ this.dispReport.getResult().add(jaxbResult);
+
+ if (result.getErrInfo() != null) jaxbResult.setErrInfo(result.getErrInfo());
+ if (result.getKeyType() != null) jaxbResult.setKeyType(result.getKeyType());
+ jaxbResult.setErrno(result.getErrno());
+ }
+
+ /**
+ *
+ */
+ public String toString()
+ {
+ String msg = getMessage();
+ if (msg == null)
+ return "";
+ else
+ return getMessage();
+ }
+
+ private static final String buildMessage(int errno,String msg)
+ {
+ StringBuffer buffer = new StringBuffer();
+
+ String errCode = lookupErrCode(errno);
+ if (errCode != null)
+ {
+ buffer.append(errCode);
+ buffer.append(" ");
+ }
+
+ buffer.append("(");
+ buffer.append(errno);
+ buffer.append(") ");
+
+ //String errText = lookupErrText(errno);
+ // FIXME: What should error text be?
+ String errText = "";
+ if (errText != null)
+ {
+ buffer.append(errText);
+ buffer.append(" ");
+ }
+
+ if ((msg != null) && (msg.trim().length() > 0))
+ {
+ buffer.append(msg);
+ }
+
+ return buffer.toString();
+ }
+
+ public static final String lookupErrCode(int errno)
+ {
+ switch (errno)
+ {
+ case E_ACCOUNT_LIMIT_EXCEEDED : return "E_accountLimitExceeded";
+ case E_ASSERTION_NOT_FOUND : return "E_assertionNotFound";
+ case E_AUTH_TOKEN_EXPIRED : return "E_authTokenExpired";
+ case E_AUTH_TOKEN_REQUIRED : return "E_authTokenRequired";
+ case E_BUSY : return "E_busy";
+ case E_CATEGORIZATION_NOT_ALLOWED : return "E_categorizationNotAllowed";
+ case E_FATAL_ERROR : return "E_fatalError";
+ case E_INVALID_CATEGORY : return "E_invalidCategory";
+ case E_INVALID_COMPLETION_STATUS : return "E_invalidCompletionStatus";
+ case E_INVALID_KEY_PASSED : return "E_invalidKeyPassed";
+ case E_INVALID_PROJECTION : return "E_invalidProjection";
+ case E_INVALID_TIME : return "E_invalidTime";
+ case E_INVALID_URL_PASSED : return "E_invalidURLPassed";
+ case E_INVALID_VALUE : return "E_invalidValue";
+ case E_KEY_RETIRED : return "E_keyRetired";
+ case E_LANGUAGE_ERROR : return "E_languageError";
+ case E_MESSAGE_TOO_LARGE : return "E_messageTooLarge";
+ case E_NAME_TOO_LONG : return "E_nameTooLong";
+ case E_OPERATOR_MISMATCH : return "E_operatorMismatch";
+ case E_PUBLISHER_CANCELLED : return "E_publisherCancelled";
+ case E_REQUEST_DENIED : return "E_requestDenied";
+ case E_REQUEST_TIMEOUT : return "E_requestTimeout";
+ case E_RESULT_SET_TOO_LARGE : return "E_resultSetTooLarge";
+ case E_SECRET_UNKNOWN : return "E_secretUnknown";
+ case E_SUCCESS : return "E_success";
+ case E_TOO_MANY_OPTIONS : return "E_tooManyOptions";
+ case E_TRANSFER_ABORTED : return "E_transferAborted";
+ case E_UNKNOWN_USER : return "E_unknownUser";
+ case E_UNRECOGNIZED_VERSION : return "E_unrecognizedVersion";
+ case E_UNSUPPORTED : return "E_unsupported";
+ case E_UNVALIDATABLE : return "E_unvalidatable";
+ case E_USER_MISMATCH : return "E_userMismatch";
+ case E_VALUE_NOT_ALLOWED : return "E_valueNotAllowed";
+ default : return null;
+ }
+ }
+}
\ No newline at end of file
Added: webservices/scout/trunk/src/main/java/org/apache/ws/scout/registry/RegistryV3Impl.java
URL: http://svn.apache.org/viewvc/webservices/scout/trunk/src/main/java/org/apache/ws/scout/registry/RegistryV3Impl.java?rev=811951&view=auto
==============================================================================
--- webservices/scout/trunk/src/main/java/org/apache/ws/scout/registry/RegistryV3Impl.java (added)
+++ webservices/scout/trunk/src/main/java/org/apache/ws/scout/registry/RegistryV3Impl.java Sun Sep 6 23:21:23 2009
@@ -0,0 +1,1206 @@
+/*
+ * Copyright 2001-2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.ws.scout.registry;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Properties;
+
+import javax.xml.bind.JAXBContext;
+import javax.xml.bind.JAXBElement;
+import javax.xml.bind.JAXBException;
+import javax.xml.bind.Marshaller;
+import javax.xml.bind.Unmarshaller;
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import org.uddi.api_v3.*;
+import org.apache.ws.scout.transport.Transport;
+import org.apache.ws.scout.transport.TransportException;
+
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.NamedNodeMap;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+import org.xml.sax.SAXException;
+
+/**
+ * RegistryImpl is the implementation of IRegistry.
+ *
+ * <p>The execute() function signature has been changed slightly from the jUDDI
+ * version, since the URL can no longer be decided dynamically (in an easy
+ * enough manner) as we don't use jUDDI data types anymore.</p>
+ *
+ * <i>The function code is borrowed from jUDDI, with appropriate modifications so
+ * that xmlbeans data types are used intead of jUDDI data types.</i>
+ *
+ */
+
+public class RegistryV3Impl implements IRegistryV3 {
+
+ public static final String INQUIRY_ENDPOINT_PROPERTY_NAME = "scout.proxy.inquiryURL";
+ public static final String PUBLISH_ENDPOINT_PROPERTY_NAME = "scout.proxy.publishURL";
+ public static final String SECURITY_ENDPOINT_PROPERTY_NAME = "scout.proxy.securityURL";
+ public static final String ADMIN_ENDPOINT_PROPERTY_NAME = "scout.proxy.adminURL";
+ public static final String TRANSPORT_CLASS_PROPERTY_NAME = "scout.proxy.transportClass";
+ public static final String SECURITY_PROVIDER_PROPERTY_NAME = "scout.proxy.securityProvider";
+ public static final String PROTOCOL_HANDLER_PROPERTY_NAME = "scout.proxy.protocolHandler";
+ public static final String UDDI_VERSION_PROPERTY_NAME = "scout.proxy.uddiVersion";
+ public static final String UDDI_NAMESPACE_PROPERTY_NAME = "scout.proxy.uddiNamespace";
+
+ public static final String DEFAULT_INQUIRY_ENDPOINT = "http://localhost/juddi/inquiry";
+ public static final String DEFAULT_PUBLISH_ENDPOINT = "http://localhost/juddi/publish";
+ public static final String DEFAULT_SECURITY_ENDPOINT = "http://localhost/juddi/security";
+ public static final String DEFAULT_ADMIN_ENDPOINT = "http://localhost/juddi/admin";
+ public static final String DEFAULT_TRANSPORT_CLASS = "org.apache.ws.scout.transport.AxisTransport";
+ public static final String DEFAULT_SECURITY_PROVIDER = "com.sun.net.ssl.internal.ssl.Provider";
+ public static final String DEFAULT_PROTOCOL_HANDLER = "com.sun.net.ssl.internal.www.protocol";
+ public static final String DEFAULT_UDDI_VERSION = "2.0";
+ public static final String DEFAULT_UDDI_NAMESPACE = "urn:uddi-org:api_v2";
+
+ private URI adminURI;
+ private URI inquiryURI;
+ private URI publishURI;
+ private URI securityURI;
+
+ private Transport transport;
+
+ private String securityProvider;
+ private String protocolHandler;
+ private String uddiVersion;
+ private String uddiNamespace;
+
+ private ObjectFactory objectFactory = new ObjectFactory();
+
+ private Marshaller marshaller = null;
+ private Unmarshaller unmarshaller = null;
+
+ private static Log log = LogFactory.getLog(RegistryV3Impl.class);
+
+ /**
+ * Creates a new instance of RegistryImpl.
+ */
+ public RegistryV3Impl(Properties props) {
+ super();
+
+ this.init(props);
+ }
+
+ /**
+ *
+ */
+ private void init(Properties props) {
+ // We need to have a non-null Properties
+ // instance so initialization takes place.
+ if (props == null)
+ props = new Properties();
+
+ // Override defaults with specific specific values
+ try {
+ String iURL = props.getProperty(INQUIRY_ENDPOINT_PROPERTY_NAME);
+ if (iURL != null)
+ this.setInquiryURI(new URI(iURL));
+ else
+ this.setInquiryURI(new URI(DEFAULT_INQUIRY_ENDPOINT));
+
+ String pURL = props.getProperty(PUBLISH_ENDPOINT_PROPERTY_NAME);
+ if (pURL != null)
+ this.setPublishURI(new URI(pURL));
+ else
+ this.setPublishURI(new URI(DEFAULT_PUBLISH_ENDPOINT));
+
+ String sURL = props.getProperty(SECURITY_ENDPOINT_PROPERTY_NAME);
+ if (sURL != null)
+ this.setSecurityURI(new URI(sURL));
+ else
+ this.setSecurityURI(new URI(DEFAULT_SECURITY_ENDPOINT));
+
+ String aURL = props.getProperty(ADMIN_ENDPOINT_PROPERTY_NAME);
+ if (aURL != null)
+ this.setAdminURI(new URI(aURL));
+ else
+ this.setAdminURI(new URI(DEFAULT_ADMIN_ENDPOINT));
+ } catch (URISyntaxException muex) {
+ throw new RuntimeException(muex);
+ }
+
+ String secProvider = props.getProperty(SECURITY_PROVIDER_PROPERTY_NAME);
+ if (secProvider != null)
+ this.setSecurityProvider(secProvider);
+ else
+ this.setSecurityProvider(DEFAULT_SECURITY_PROVIDER);
+
+ String protoHandler = props.getProperty(PROTOCOL_HANDLER_PROPERTY_NAME);
+ if (protoHandler != null)
+ this.setProtocolHandler(protoHandler);
+ else
+ this.setProtocolHandler(DEFAULT_PROTOCOL_HANDLER);
+
+ String uddiVer = props.getProperty(UDDI_VERSION_PROPERTY_NAME);
+ if (uddiVer != null)
+ this.setUddiVersion(uddiVer);
+ else
+ this.setUddiVersion(DEFAULT_UDDI_VERSION);
+
+ String uddiNS = props.getProperty(UDDI_NAMESPACE_PROPERTY_NAME);
+ if (uddiNS != null)
+ this.setUddiNamespace(uddiNS);
+ else
+ this.setUddiNamespace(DEFAULT_UDDI_NAMESPACE);
+
+ String transClass = props.getProperty(TRANSPORT_CLASS_PROPERTY_NAME);
+ if (transClass != null)
+ this.setTransport(this.getTransport(transClass));
+ else
+ this.setTransport(this.getTransport(DEFAULT_TRANSPORT_CLASS));
+
+ try
+ {
+ JAXBContext context = JAXBContext.newInstance(new Class[] {ObjectFactory.class});
+ JAXBContext v3context = JAXBContext.newInstance(new Class[] {org.uddi.api_v3.ObjectFactory.class});
+ if ("3.0".equals(uddiVer)) {
+ this.unmarshaller = v3context.createUnmarshaller();
+ } else {
+ this.unmarshaller = context.createUnmarshaller();
+ }
+ this.marshaller = context.createMarshaller();
+ }
+ catch(JAXBException e)
+ {
+ throw new RuntimeException(e);
+ }
+ }
+
+ /**
+ *
+ * @param uddiRequest
+ * @return String
+ * @throws RegistryV3Exception
+ */
+ public String execute(String uddiRequest, String urltype)
+ throws TransportException {
+ URI endPointURL = null;
+ if (urltype.equalsIgnoreCase("INQUIRY"))
+ endPointURL = this.getInquiryURI();
+ else
+ endPointURL = this.getPublishURI();
+
+ // A SOAP request is made and a SOAP response
+ // is returned.
+
+ return transport.send(uddiRequest, endPointURL);
+ }
+
+ /**
+ *
+ */
+ public JAXBElement<?> execute(JAXBElement<?> uddiRequest, URI endPointURI)
+ throws RegistryV3Exception {
+
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
+
+ Document doc;
+ try {
+ DocumentBuilderFactory docBuilderFactory = DocumentBuilderFactory.newInstance();
+ docBuilderFactory.setNamespaceAware(true);
+ DocumentBuilder docBuilder= docBuilderFactory.newDocumentBuilder();
+ this.marshaller.marshal(uddiRequest, baos);
+ doc = docBuilder.parse(new ByteArrayInputStream(baos.toByteArray()));
+ } catch (SAXException saxe) {
+ throw (new RegistryV3Exception(saxe));
+ } catch (ParserConfigurationException pce) {
+ throw (new RegistryV3Exception(pce));
+ } catch (IOException ioe) {
+ throw (new RegistryV3Exception(ioe));
+ } catch (JAXBException ioe) {
+ throw (new RegistryV3Exception(ioe));
+ }
+ Element request = doc.getDocumentElement();
+
+ request.setAttribute("xmlns", this.getUddiNamespace());
+ if (!"3.0".equals(this.getUddiVersion())) {
+ request.setAttribute("generic", this.getUddiVersion());
+ }
+ //request.setAttributeNS("http://www.w3.org/2000/xmlns/","xmlns", this.getUddiNamespace());
+ // A SOAP request is made and a SOAP response
+ // is returned.
+
+ Element response;
+ try {
+ response = transport.send(request, endPointURI);
+ } catch (TransportException te) {
+ throw new RegistryV3Exception(te);
+ }
+ /* if (response.hasAttributes()) {
+ NamedNodeMap am = response.getAttributes();
+ ArrayList<String> al = new ArrayList<String>();
+ for (int i = 0; i < am.getLength(); i++) {
+ Node n = am.item(i);
+ String attribute = n.getNodeName();
+ if (attribute!= null && attribute.startsWith("xmlns")) {
+ al.add(attribute);
+ }
+ }
+ for (String attr : al) {
+ response.removeAttribute(attr);
+ }
+ }*/
+
+ if (response.getNamespaceURI()==null) {
+ response.setAttributeNS("http://www.w3.org/2000/xmlns/","xmlns", this.getUddiNamespace());
+ }
+
+ // If we are getting responses from a UDDI v3, remove the xmlns
+
+ // First, let's make sure that a response
+ // (any response) is found in the SOAP Body.
+
+ String responseName = response.getLocalName();
+ if (responseName == null) {
+ throw new RegistryV3Exception("Unsupported response "
+ + "from registry. A value was not present.");
+ }
+
+ // Let's now try to determine which UDDI response
+ // we received and unmarshal it appropriately or
+ // throw a RegistryV3Exception if it's unknown.
+ // Well, we have now determined that something was
+ // returned and it is "a something" that we know
+ // about so let's unmarshal it into a RegistryObject
+ // Next, let's make sure we didn't recieve a SOAP
+ // Fault. If it is a SOAP Fault then throw it
+ // immediately.
+
+ JAXBElement<?> uddiResponse = null;
+ try {
+ uddiResponse = (JAXBElement<?>) unmarshaller.unmarshal(response);
+ } catch (JAXBException xmle) {
+ throw (new RegistryV3Exception(xmle));
+ }
+
+ if (responseName.toLowerCase().equals("fault")) {
+ NodeList nodeList = null;
+
+ // Child Elements
+ String fCode = null;
+ nodeList = response.getElementsByTagName("faultcode");
+ if (nodeList.getLength() > 0)
+ fCode = nodeList.item(0).getNodeValue();
+
+ String fString = null;
+ nodeList = response.getElementsByTagName("faultstring");
+ if (nodeList.getLength() > 0)
+ fString = nodeList.item(0).getNodeValue();
+
+ String fActor = null;
+ nodeList = response.getElementsByTagName("faultactor");
+ if (nodeList.getLength() > 0)
+ fActor = nodeList.item(0).getNodeValue();
+
+ DispositionReport dispRpt = null;
+
+ nodeList = response.getElementsByTagName("detail");
+ if (nodeList.getLength() > 0) {
+ nodeList = ((Element) nodeList.item(0))
+ .getElementsByTagName("dispositionReport");
+ if (nodeList.getLength() > 0) {
+ JAXBElement<DispositionReport> dispRptObj = null;
+ try {
+ dispRptObj = (JAXBElement<DispositionReport>) unmarshaller.unmarshal((Element) nodeList
+ .item(0));
+ } catch (JAXBException xmle) {
+ throw (new RegistryV3Exception(xmle));
+ }
+ dispRpt = dispRptObj.getValue();
+ }
+ }
+
+ RegistryV3Exception e = new RegistryV3Exception(fCode, fString, fActor, dispRpt);
+
+ // Create RegistryV3Exception instance and return
+ throw e;
+ }
+
+ return uddiResponse;
+ }
+
+ /**
+ * @return Returns the adminURL.
+ */
+ public URI getAdminURI() {
+ return this.adminURI;
+ }
+
+ /**
+ * @param url
+ * The adminURL to set.
+ */
+ public void setAdminURI(URI url) {
+ this.adminURI = url;
+ }
+
+ /**
+ * @return Returns the inquiryURL.
+ */
+ public URI getInquiryURI() {
+ return this.inquiryURI;
+ }
+
+ /**
+ * @param inquiryURI
+ * The inquiryURI to set.
+ */
+ public void setInquiryURI(URI inquiryURI) {
+ this.inquiryURI = inquiryURI;
+ }
+
+ /**
+ * @return Returns the protocolHandler.
+ */
+ public String getProtocolHandler() {
+ return this.protocolHandler;
+ }
+
+ /**
+ * @param protocolHandler
+ * The protocolHandler to set.
+ */
+ public void setProtocolHandler(String protocolHandler) {
+ this.protocolHandler = protocolHandler;
+ }
+
+ /**
+ * @return Returns the publishURL.
+ */
+ public URI getPublishURI() {
+ return this.publishURI;
+ }
+
+ /**
+ * @return Returns the publishURL.
+ */
+ public URI getSecurityURI() {
+ return this.securityURI;
+ }
+
+ /**
+ * @param publishURI
+ * The publishURI to set.
+ */
+ public void setPublishURI(URI publishURI) {
+ this.publishURI = publishURI;
+ }
+
+ /**
+ * @param publishURI
+ * The publishURI to set.
+ */
+ public void setSecurityURI(URI securityURI) {
+ this.securityURI = securityURI;
+ }
+
+ /**
+ * @return Returns the securityProvider.
+ */
+ public String getSecurityProvider() {
+ return this.securityProvider;
+ }
+
+ /**
+ * @param securityProvider
+ * The securityProvider to set.
+ */
+ public void setSecurityProvider(String securityProvider) {
+ this.securityProvider = securityProvider;
+ }
+
+ /**
+ * @return Returns the transport.
+ */
+ public Transport getTransport() {
+ return transport;
+ }
+
+ /**
+ * @param transport
+ * The transport to set.
+ */
+ public void setTransport(Transport transport) {
+ this.transport = transport;
+ }
+
+ /**
+ * @return Returns the uddiNS.
+ */
+ public String getUddiNamespace() {
+ return this.uddiNamespace;
+ }
+
+ /**
+ * @param uddiNS
+ * The uddiNS to set.
+ */
+ public void setUddiNamespace(String uddiNS) {
+ this.uddiNamespace = uddiNS;
+ }
+
+ /**
+ * @return Returns the uddiVersion.
+ */
+ public String getUddiVersion() {
+ return this.uddiVersion;
+ }
+
+ /**
+ * @param uddiVersion
+ * The uddiVersion to set.
+ */
+ public void setUddiVersion(String uddiVersion) {
+ this.uddiVersion = uddiVersion;
+ }
+
+ /**
+ * "Used to remove an existing bindingTemplate from the bindingTemplates
+ * collection that is part of a specified businessService structure."
+ *
+ * @exception RegistryV3Exception;
+ */
+ public DispositionReport deleteBinding(String authInfo,
+ String[] bindingKeyArray) throws RegistryV3Exception {
+ DeleteBinding request = this.objectFactory.createDeleteBinding();
+
+ if (authInfo != null) {
+ request.setAuthInfo(authInfo);
+ }
+
+ if (bindingKeyArray != null) {
+ request.getBindingKey().addAll(Arrays.asList(bindingKeyArray));
+ }
+
+ DispositionReport dr;
+ JAXBElement<?> o = execute(this.objectFactory.createDeleteBinding(request), this.getPublishURI());
+ dr = (DispositionReport) o.getValue();
+
+ return dr;
+ }
+
+ /**
+ * "Used to delete registered businessEntity information from the registry."
+ *
+ * @exception RegistryV3Exception;
+ */
+ public DispositionReport deleteBusiness(String authInfo,
+ String[] businessKeyArray) throws RegistryV3Exception {
+ DeleteBusiness request = this.objectFactory.createDeleteBusiness();
+
+ if (authInfo != null) {
+ request.setAuthInfo(authInfo);
+ }
+
+ if (businessKeyArray != null) {
+ request.getBusinessKey().addAll(Arrays.asList(businessKeyArray));
+ }
+
+ DispositionReport dr;
+ JAXBElement<?> o = execute(this.objectFactory.createDeleteBusiness(request), this.getPublishURI());
+ dr = (DispositionReport) o.getValue();
+
+ return dr;
+ }
+
+ /**
+ * @exception RegistryV3Exception;
+ */
+ public DispositionReport deletePublisherAssertions(String authInfo,
+ PublisherAssertion[] assertionArray) throws RegistryV3Exception {
+ DeletePublisherAssertions request = this.objectFactory.createDeletePublisherAssertions();
+
+ if (authInfo != null) {
+ request.setAuthInfo(authInfo);
+ }
+
+ if (assertionArray != null) {
+ request.getPublisherAssertion().addAll(Arrays.asList(assertionArray));
+ }
+
+ DispositionReport dr;
+ JAXBElement<?> o = execute(this.objectFactory.createDeletePublisherAssertions(request),
+ this.getPublishURI());
+ dr = (DispositionReport) o.getValue();
+
+ return dr;
+ }
+
+ /**
+ * "Used to delete an existing businessService from the businessServices
+ * collection that is part of a specified businessEntity."
+ *
+ * @exception RegistryV3Exception;
+ */
+ public DispositionReport deleteService(String authInfo,
+ String[] serviceKeyArray) throws RegistryV3Exception {
+ DeleteService request = this.objectFactory.createDeleteService();
+
+ if (authInfo != null) {
+ request.setAuthInfo(authInfo);
+ }
+
+ if (serviceKeyArray != null) {
+ request.getServiceKey().addAll(Arrays.asList(serviceKeyArray));
+ }
+
+ DispositionReport dr;
+ JAXBElement<?> o = execute(this.objectFactory.createDeleteService(request),
+ this.getPublishURI());
+ dr = (DispositionReport) o.getValue();
+
+ return dr;
+ }
+
+ /**
+ * "Used to delete registered information about a tModel. If there are any
+ * references to a tModel when this call is made, the tModel will be marked
+ * deleted instead of being physically removed."
+ *
+ * @exception RegistryV3Exception;
+ */
+ public DispositionReport deleteTModel(String authInfo,
+ String[] tModelKeyArray) throws RegistryV3Exception {
+ DeleteTModel request = this.objectFactory.createDeleteTModel();
+
+ if (authInfo != null) {
+ request.setAuthInfo(authInfo);
+ }
+
+ if (tModelKeyArray != null) {
+ request.getTModelKey().addAll(Arrays.asList(tModelKeyArray));
+ }
+
+ DispositionReport dr;
+ JAXBElement<?> o = execute(this.objectFactory.createDeleteTModel(request),
+ this.getPublishURI());
+ dr = (DispositionReport) o.getValue();
+
+ return dr;
+ }
+
+ /**
+ * Used to locate information about one or more businesses. Returns a
+ * businessList message that matches the conditions specified.
+ *
+ * @exception RegistryV3Exception;
+ */
+ public BusinessList findBusiness(Name[] nameArray,
+ DiscoveryURLs discoveryURLs, IdentifierBag identifierBag,
+ CategoryBag categoryBag, TModelBag tModelBag,
+ FindQualifiers findQualifiers, int maxRows)
+ throws RegistryV3Exception {
+ FindBusiness request = this.objectFactory.createFindBusiness();
+
+ if (nameArray != null) {
+ request.getName().addAll(Arrays.asList(nameArray));
+ }
+
+ if (discoveryURLs != null) {
+ request.setDiscoveryURLs(discoveryURLs);
+ }
+
+ if (identifierBag != null) {
+ request.setIdentifierBag(identifierBag);
+ }
+
+ if (categoryBag != null) {
+ request.setCategoryBag(categoryBag);
+ }
+
+ if (tModelBag != null) {
+ request.setTModelBag(tModelBag);
+ }
+
+ if (findQualifiers != null) {
+ request.setFindQualifiers(findQualifiers);
+ }
+
+ request.setMaxRows(maxRows);
+
+ BusinessList bl;
+ JAXBElement<?> o = execute(this.objectFactory.createFindBusiness(request),
+ this.getInquiryURI());
+ bl = (BusinessList) o.getValue();
+
+ return bl;
+ }
+
+ /**
+ * "Used to locate specific bindings within a registered businessService.
+ * Returns a bindingDetail message."
+ *
+ * @exception RegistryV3Exception
+ */
+ public BindingDetail findBinding(String serviceKey,
+ CategoryBag categoryBag, TModelBag tModelBag,
+ FindQualifiers findQualifiers, int maxRows)
+ throws RegistryV3Exception {
+ // FIXME: Juddi's methods also set category bag (per uddi spec v3).
+ // However, we are sticking to v2 for now, so categorybag doesn't
+ // exist under FindBinding. It is fine for now, since the incoming
+ // parameter value is always null anyways -- but this may change
+ // in the future.
+
+ FindBinding request = this.objectFactory.createFindBinding();
+
+ if (serviceKey != null) {
+ request.setServiceKey(serviceKey);
+ }
+
+ if (categoryBag != null) {
+ request.setCategoryBag(categoryBag);
+ }
+
+ if (tModelBag != null) {
+ request.setTModelBag(tModelBag);
+ }
+
+ if (findQualifiers != null) {
+ request.setFindQualifiers(findQualifiers);
+ }
+ request.setMaxRows(maxRows);
+
+ BindingDetail bd;
+ JAXBElement<?> o = execute(this.objectFactory.createFindBinding(request),
+ this.getInquiryURI());
+ bd = (BindingDetail) o.getValue();
+
+ return bd;
+ }
+
+ /**
+ * "Used to locate specific services within a registered businessEntity.
+ * Return a serviceList message." From the XML spec (API, p18) it appears
+ * that the name, categoryBag, and tModelBag arguments are mutually
+ * exclusive.
+ *
+ * @exception RegistryV3Exception;
+ */
+ public ServiceList findService(String businessKey, Name[] nameArray,
+ CategoryBag categoryBag, TModelBag tModelBag,
+ FindQualifiers findQualifiers, int maxRows)
+ throws RegistryV3Exception {
+ FindService request = this.objectFactory.createFindService();
+
+ if (businessKey != null) {
+ request.setBusinessKey(businessKey);
+ }
+
+ if (nameArray != null) {
+ request.getName().addAll(Arrays.asList(nameArray));
+ }
+
+ if (categoryBag != null) {
+ request.setCategoryBag(categoryBag);
+ }
+
+ if (tModelBag != null) {
+ request.setTModelBag(tModelBag);
+ }
+
+ if (findQualifiers != null) {
+ request.setFindQualifiers(findQualifiers);
+ }
+
+ request.setMaxRows(maxRows);
+
+ ServiceList sl;
+ JAXBElement<?> o = execute(this.objectFactory.createFindService(request),
+ this.getInquiryURI());
+ sl = (ServiceList) o.getValue();
+
+ return sl;
+ }
+
+ /**
+ * "Used to locate one or more tModel information structures. Returns a
+ * tModelList structure."
+ *
+ * @exception RegistryV3Exception;
+ */
+ public TModelList findTModel(String name, CategoryBag categoryBag,
+ IdentifierBag identifierBag, FindQualifiers findQualifiers,
+ int maxRows) throws RegistryV3Exception {
+ FindTModel request = this.objectFactory.createFindTModel();
+
+ Name jaxbName = this.objectFactory.createName();
+
+ if (name != null) {
+ jaxbName.setValue(name);
+ }
+
+ request.setName(jaxbName);
+
+ if (categoryBag != null) {
+ request.setCategoryBag(categoryBag);
+ }
+
+ if (identifierBag != null) {
+ request.setIdentifierBag(identifierBag);
+ }
+
+ if (findQualifiers != null) {
+ request.setFindQualifiers(findQualifiers);
+ }
+
+ request.setMaxRows(maxRows);
+
+ TModelList tml;
+ JAXBElement<?> o = execute(this.objectFactory.createFindTModel(request),
+ this.getInquiryURI());
+ tml = (TModelList) o.getValue();
+
+ return tml;
+ }
+
+ /**
+ * @exception RegistryV3Exception;
+ */
+ public AssertionStatusReport getAssertionStatusReport(String authInfo,
+ String completionStatus) throws RegistryV3Exception {
+ GetAssertionStatusReport request = this.objectFactory.createGetAssertionStatusReport();
+
+ if (authInfo != null) {
+ request.setAuthInfo(authInfo);
+ }
+
+ if (completionStatus != null) {
+ CompletionStatus cs = CompletionStatus.fromValue(completionStatus);
+ request.setCompletionStatus(cs);
+ }
+
+ AssertionStatusReport asr;
+ JAXBElement<?> o = execute(this.objectFactory.createGetAssertionStatusReport(request),
+ this.getPublishURI());
+ asr = (AssertionStatusReport) o.getValue();
+
+ return asr;
+ }
+
+ /**
+ * "Used to request an authentication token from an Operator Site.
+ * Authentication tokens are required to use all other APIs defined in the
+ * publishers API. This server serves as the program's equivalent of a login
+ * request."
+ *
+ * @exception RegistryV3Exception;
+ */
+ public AuthToken getAuthToken(String userID, String cred)
+ throws RegistryV3Exception {
+ GetAuthToken request = this.objectFactory.createGetAuthToken();
+
+ if (userID != null) {
+ request.setUserID(userID);
+ }
+
+ if (cred != null) {
+ request.setCred(cred);
+ }
+
+ URI getAuthTokenURI = null;
+ if ("3.0".equals(uddiVersion)) {
+ getAuthTokenURI = this.getSecurityURI();
+ } else {
+ getAuthTokenURI = this.getPublishURI();
+ }
+
+ AuthToken at;
+ JAXBElement<?> o = execute(this.objectFactory.createGetAuthToken(request),
+ getAuthTokenURI);
+ at = (AuthToken) o.getValue();
+
+ return at;
+ }
+
+ /**
+ * Used to get the full businessEntity information for a particular business
+ * entity. Returns a businessDetail message.
+ *
+ * @exception RegistryV3Exception;
+ */
+ public BusinessDetail getBusinessDetail(String businessKey)
+ throws RegistryV3Exception {
+ String[] keys = new String[1];
+ keys[0] = businessKey;
+
+ return getBusinessDetail(keys);
+ }
+
+ /**
+ * "Used to get the full businessEntity information for one or more
+ * businesses. Returns a businessDetail message."
+ *
+ * @exception RegistryV3Exception;
+ */
+ public BusinessDetail getBusinessDetail(String[] businessKeyArray)
+ throws RegistryV3Exception {
+ GetBusinessDetail request = this.objectFactory.createGetBusinessDetail();
+
+ if (businessKeyArray != null) {
+ request.getBusinessKey().addAll(Arrays.asList(businessKeyArray));
+ }
+
+ BusinessDetail bd;
+ JAXBElement<?> o = execute(this.objectFactory.createGetBusinessDetail(request),
+ this.getInquiryURI());
+ bd = (BusinessDetail) o.getValue();
+ return bd;
+ }
+
+ /**
+ * @exception RegistryV3Exception;
+ */
+ public PublisherAssertions getPublisherAssertions(String authInfo)
+ throws RegistryV3Exception {
+ GetPublisherAssertions request = this.objectFactory.createGetPublisherAssertions();
+
+ if (authInfo != null) {
+ request.setAuthInfo(authInfo);
+ }
+
+ PublisherAssertions pa = new PublisherAssertions();
+ JAXBElement<?> o = execute(this.objectFactory.createGetPublisherAssertions(request),
+ this.getPublishURI());
+ PublisherAssertionsResponse par = (PublisherAssertionsResponse) o.getValue();
+ List<PublisherAssertion> assertions = par.getPublisherAssertion();
+ for (int i = 0; i < assertions.size(); i++ ) {
+ pa.getPublisherAssertion().add((PublisherAssertion)assertions.get(i));
+ }
+
+ return pa;
+ }
+
+ /**
+ * @exception RegistryV3Exception;
+ */
+ public RegisteredInfo getRegisteredInfo(String authInfo)
+ throws RegistryV3Exception {
+ GetRegisteredInfo request = this.objectFactory.createGetRegisteredInfo();
+
+ if (authInfo != null) {
+ request.setAuthInfo(authInfo);
+ }
+
+ RegisteredInfo ri;
+ JAXBElement<?> o = execute(this.objectFactory.createGetRegisteredInfo(request),
+ this.getPublishURI());
+ ri = (RegisteredInfo) o.getValue();
+
+ return ri;
+ }
+
+ /**
+ * "Used to get full details for a particular registered businessService.
+ * Returns a serviceDetail message."
+ *
+ * @exception RegistryV3Exception;
+ */
+ public ServiceDetail getServiceDetail(String serviceKey)
+ throws RegistryV3Exception {
+ String[] keys = new String[1];
+ keys[0] = serviceKey;
+
+ return getServiceDetail(keys);
+ }
+
+ /**
+ * "Used to get full details for a given set of registered businessService
+ * data. Returns a serviceDetail message."
+ *
+ * @exception RegistryV3Exception;
+ */
+ public ServiceDetail getServiceDetail(String[] serviceKeyArray)
+ throws RegistryV3Exception {
+ GetServiceDetail request = this.objectFactory.createGetServiceDetail();
+
+ if (serviceKeyArray != null) {
+ request.getServiceKey().addAll(Arrays.asList(serviceKeyArray));
+ }
+
+ ServiceDetail sd;
+ JAXBElement<?> o = execute(this.objectFactory.createGetServiceDetail(request),
+ this.getInquiryURI());
+ sd = (ServiceDetail) o.getValue();
+
+ return sd;
+ }
+
+ /**
+ * "Used to get full details for a particular registered TModel. Returns a
+ * tModelDetail message."
+ *
+ * @exception RegistryV3Exception;
+ */
+ public TModelDetail getTModelDetail(String tModelKey)
+ throws RegistryV3Exception {
+ String[] keys = new String[1];
+ keys[0] = tModelKey;
+
+ return getTModelDetail(keys);
+ }
+
+ /**
+ * "Used to get full details for a given set of registered tModel data.
+ * Returns a tModelDetail message."
+ *
+ * @exception RegistryV3Exception;
+ */
+ public TModelDetail getTModelDetail(String[] tModelKeyArray)
+ throws RegistryV3Exception {
+ GetTModelDetail request = this.objectFactory.createGetTModelDetail();
+
+ if (tModelKeyArray != null) {
+ request.getTModelKey().addAll(Arrays.asList(tModelKeyArray));
+ }
+
+ TModelDetail tmd;
+ JAXBElement<?> o = execute(this.objectFactory.createGetTModelDetail(request),
+ this.getInquiryURI());
+ tmd = (TModelDetail) o.getValue();
+
+ return tmd;
+ }
+
+ /**
+ * @exception RegistryV3Exception;
+ */
+ public PublisherAssertions setPublisherAssertions(String authInfo,
+ PublisherAssertion[] assertionArray) throws RegistryV3Exception {
+ SetPublisherAssertions request = this.objectFactory.createSetPublisherAssertions();
+
+ if (authInfo != null) {
+ request.setAuthInfo(authInfo);
+ }
+
+ if (assertionArray != null) {
+ request.getPublisherAssertion().addAll(Arrays.asList(assertionArray));
+ }
+
+ PublisherAssertions pa;
+ JAXBElement<?> o = execute(this.objectFactory.createSetPublisherAssertions(request),
+ this.getPublishURI());
+ pa = (PublisherAssertions) o.getValue();
+
+ return pa;
+ }
+
+ /**
+ * "Used to register new bindingTemplate information or update existing
+ * bindingTemplate information. Use this to control information about
+ * technical capabilities exposed by a registered business."
+ *
+ * @exception RegistryV3Exception;
+ */
+ public BindingDetail saveBinding(String authInfo,
+ BindingTemplate[] bindingArray) throws RegistryV3Exception {
+ SaveBinding request = this.objectFactory.createSaveBinding();
+
+ if (authInfo != null) {
+ request.setAuthInfo(authInfo);
+ }
+
+ if (bindingArray != null) {
+ request.getBindingTemplate().addAll(Arrays.asList(bindingArray));
+ }
+
+ BindingDetail bd;
+ JAXBElement<?> o = execute(this.objectFactory.createSaveBinding(request),
+ this.getPublishURI());
+ bd = (BindingDetail) o.getValue();
+
+ return bd;
+ }
+
+ /**
+ * "Used to register new businessEntity information or update existing
+ * businessEntity information. Use this to control the overall information
+ * about the entire business. Of the save_x APIs this one has the broadest
+ * effect."
+ *
+ * @exception RegistryV3Exception;
+ */
+ public BusinessDetail saveBusiness(String authInfo,
+ BusinessEntity[] businessArray) throws RegistryV3Exception {
+ SaveBusiness request = this.objectFactory.createSaveBusiness();
+
+ if (authInfo != null) {
+ request.setAuthInfo(authInfo);
+ }
+
+ if (businessArray != null) {
+ for (int i = 0; i < businessArray.length; i++) {
+ BusinessEntity be = businessArray[i];
+ if (be.getBusinessServices().getBusinessService().size() == 0) {
+ be.setBusinessServices(null);
+ }
+ }
+
+ request.getBusinessEntity().addAll(Arrays.asList(businessArray));
+ }
+
+ BusinessDetail bd;
+ JAXBElement<?> o = execute(this.objectFactory.createSaveBusiness(request),
+ this.getPublishURI());
+ bd = (BusinessDetail) o.getValue();
+
+ return bd;
+ }
+
+ /**
+ * "Used to register or update complete information about a businessService
+ * exposed by a specified businessEntity."
+ *
+ * @exception RegistryV3Exception;
+ */
+ public ServiceDetail saveService(String authInfo,
+ BusinessService[] serviceArray) throws RegistryV3Exception {
+ SaveService request = this.objectFactory.createSaveService();
+
+ if (authInfo != null) {
+ request.setAuthInfo(authInfo);
+ }
+
+ if (serviceArray != null) {
+ request.getBusinessService().addAll(Arrays.asList(serviceArray));
+ }
+
+ ServiceDetail sd;
+ JAXBElement<?> o = execute(this.objectFactory.createSaveService(request),
+ this.getPublishURI());
+ sd = (ServiceDetail) o.getValue();
+
+ return sd;
+ }
+
+ /**
+ * "Used to register or update complete information about a tModel."
+ *
+ * @exception RegistryV3Exception;
+ */
+ public TModelDetail saveTModel(String authInfo, TModel[] tModelArray)
+ throws RegistryV3Exception {
+ SaveTModel request = this.objectFactory.createSaveTModel();
+
+ if (authInfo != null) {
+ request.setAuthInfo(authInfo);
+ }
+
+ if (tModelArray != null) {
+ request.getTModel().addAll(Arrays.asList(tModelArray));
+ }
+
+ TModelDetail tmd;
+ JAXBElement<?> o = execute(this.objectFactory.createSaveTModel(request),
+ this.getPublishURI());
+ tmd = (TModelDetail) o.getValue();
+ return tmd;
+ }
+
+ /**
+ * Returns an implementation of Transport based on the className passed in.
+ * If a null value is passed then the default Transport implementation
+ * "org.apache.ws.scout.transport.AxisTransport" is created and returned.
+ *
+ * @return Transport
+ */
+ public Transport getTransport(String className) {
+ Transport transport = null;
+ Class transportClass = null;
+
+ // If a Transport class name isn't supplied use
+ // the default Transport implementation.
+ if (className == null)
+ className = DEFAULT_TRANSPORT_CLASS;
+
+ try {
+ // instruct class loader to load the TransportFactory
+ transportClass = getClassForName(className);
+ } catch (ClassNotFoundException cnfex) {
+ throw new RuntimeException(cnfex);
+ }
+
+ try {
+ // try to instantiate the TransportFactory
+ transport = (Transport) transportClass.newInstance();
+ } catch (Exception ex) {
+ throw new RuntimeException(ex);
+ }
+
+ return transport;
+ }
+
+ /**
+ *
+ * @param name
+ * @return The class object for the name given
+ * @throws ClassNotFoundException
+ * @throws NoClassDefFoundError
+ */
+ public static Class getClassForName(String name)
+ throws ClassNotFoundException, NoClassDefFoundError {
+ Class clazz = null;
+
+ try {
+ // log.info("Using the Context ClassLoader");
+ ClassLoader ccl = AccessController.doPrivileged(new PrivilegedAction<ClassLoader>()
+ {
+ public ClassLoader run() {
+ return Thread.currentThread().getContextClassLoader();
+ }
+ });
+
+ clazz = Class.forName(name, true, ccl);
+ } catch (Exception e) {
+ log.debug("Failed to load the class " + name + " with context class loader " + e);
+ }
+
+ if (null == clazz) {
+ ClassLoader scl = AccessController.doPrivileged(new PrivilegedAction<ClassLoader>()
+ {
+ public ClassLoader run() {
+ return ClassLoader.getSystemClassLoader();
+ }
+ });
+
+ try {
+ clazz = Class.forName(name, true, scl);
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ return clazz;
+ }
+}
Modified: webservices/scout/trunk/src/main/java/org/apache/ws/scout/transport/AxisTransport.java
URL: http://svn.apache.org/viewvc/webservices/scout/trunk/src/main/java/org/apache/ws/scout/transport/AxisTransport.java?rev=811951&r1=811950&r2=811951&view=diff
==============================================================================
--- webservices/scout/trunk/src/main/java/org/apache/ws/scout/transport/AxisTransport.java (original)
+++ webservices/scout/trunk/src/main/java/org/apache/ws/scout/transport/AxisTransport.java Sun Sep 6 23:21:23 2009
@@ -19,6 +19,9 @@
import java.net.URI;
import java.util.Vector;
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+
import org.apache.axis.AxisFault;
import org.apache.axis.Message;
import org.apache.axis.client.Call;
@@ -28,6 +31,7 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.ws.scout.registry.RegistryException;
+import org.w3c.dom.Document;
import org.w3c.dom.Element;
/**
@@ -43,7 +47,7 @@
private static Log log = LogFactory.getLog(AxisTransport.class);
public Element send(Element request,URI endpointURL)
- throws RegistryException
+ throws TransportException
{
Service service = null;
Call call = null;
@@ -73,11 +77,11 @@
response = msg.getSOAPEnvelope().getFirstBody().getAsDOM();
}
catch (Exception ex) {
- throw new RegistryException(ex);
+ throw new TransportException(ex);
}
}
catch (Exception ex) {
- throw new RegistryException(ex);
+ throw new TransportException(ex);
}
if (log.isDebugEnabled()) {
@@ -89,7 +93,7 @@
}
public String send(String request,URI endpointURL)
- throws RegistryException
+ throws TransportException
{
Service service = null;
Call call = null;
@@ -116,11 +120,11 @@
response = msg.getSOAPEnvelope().getFirstBody().getAsString();
}
catch (Exception ex) {
- throw new RegistryException(ex);
+ throw new TransportException(ex);
}
}
catch (Exception ex) {
- throw new RegistryException(ex);
+ throw new TransportException(ex);
}
log.debug("\nResponse message:\n" + response);
Added: webservices/scout/trunk/src/main/java/org/apache/ws/scout/transport/JAXRTransportException.java
URL: http://svn.apache.org/viewvc/webservices/scout/trunk/src/main/java/org/apache/ws/scout/transport/JAXRTransportException.java?rev=811951&view=auto
==============================================================================
--- webservices/scout/trunk/src/main/java/org/apache/ws/scout/transport/JAXRTransportException.java (added)
+++ webservices/scout/trunk/src/main/java/org/apache/ws/scout/transport/JAXRTransportException.java Sun Sep 6 23:21:23 2009
@@ -0,0 +1,4 @@
+package org.apache.ws.scout.transport;
+
+public class JAXRTransportException extends Exception {
+}
Modified: webservices/scout/trunk/src/main/java/org/apache/ws/scout/transport/LocalTransport.java
URL: http://svn.apache.org/viewvc/webservices/scout/trunk/src/main/java/org/apache/ws/scout/transport/LocalTransport.java?rev=811951&r1=811950&r2=811951&view=diff
==============================================================================
--- webservices/scout/trunk/src/main/java/org/apache/ws/scout/transport/LocalTransport.java (original)
+++ webservices/scout/trunk/src/main/java/org/apache/ws/scout/transport/LocalTransport.java Sun Sep 6 23:21:23 2009
@@ -44,7 +44,7 @@
* Sends an element and returns an element.
*/
public Element send(Element request,URI endpointURI)
- throws RegistryException
+ throws TransportException
{
Element response = null;
@@ -64,7 +64,7 @@
response = (Element) node.getFirstChild();
}
catch (Exception ex) {
- throw new RegistryException(ex);
+ throw new TransportException(ex);
}
if (log.isDebugEnabled()) {
log.debug("\nResponse message:\n" + XMLUtils.convertNodeToXMLString(response));
@@ -76,7 +76,7 @@
* Sends an XML, responds with an XML.
*/
public String send(String request,URI endpointURI)
- throws RegistryException
+ throws TransportException
{
String response = null;
log.debug("\nRequest message:\n" + request);
@@ -87,7 +87,7 @@
Element element = document.getDocumentElement();
response= XMLUtils.convertNodeToXMLString(send(element, endpointURI));
} catch (Exception ex) {
- throw new RegistryException(ex);
+ throw new TransportException(ex);
}
log.debug("\nResponse message:\n" + response);
return response;
Modified: webservices/scout/trunk/src/main/java/org/apache/ws/scout/transport/RMITransport.java
URL: http://svn.apache.org/viewvc/webservices/scout/trunk/src/main/java/org/apache/ws/scout/transport/RMITransport.java?rev=811951&r1=811950&r2=811951&view=diff
==============================================================================
--- webservices/scout/trunk/src/main/java/org/apache/ws/scout/transport/RMITransport.java (original)
+++ webservices/scout/trunk/src/main/java/org/apache/ws/scout/transport/RMITransport.java Sun Sep 6 23:21:23 2009
@@ -47,7 +47,7 @@
* Sends an element and returns an element.
*/
public Element send(Element request,URI endpointURI)
- throws RegistryException
+ throws TransportException
{
Element response = null;
@@ -88,7 +88,7 @@
response = (Element) node.getFirstChild();
}
catch (Exception ex) {
- throw new RegistryException(ex);
+ throw new TransportException(ex);
}
if (log.isDebugEnabled()) {
log.debug("\nResponse message:\n" + XMLUtils.convertNodeToXMLString(response));
@@ -100,7 +100,7 @@
* Sends an XML, responds with an XML.
*/
public String send(String request,URI endpointURI)
- throws RegistryException
+ throws TransportException
{
String response = null;
log.debug("\nRequest message:\n" + request);
@@ -111,7 +111,7 @@
Element element = document.getDocumentElement();
response= XMLUtils.convertNodeToXMLString(send(element, endpointURI));
} catch (Exception ex) {
- throw new RegistryException(ex);
+ throw new TransportException(ex);
}
log.debug("\nResponse message:\n" + response);
return response;
Modified: webservices/scout/trunk/src/main/java/org/apache/ws/scout/transport/Transport.java
URL: http://svn.apache.org/viewvc/webservices/scout/trunk/src/main/java/org/apache/ws/scout/transport/Transport.java?rev=811951&r1=811950&r2=811951&view=diff
==============================================================================
--- webservices/scout/trunk/src/main/java/org/apache/ws/scout/transport/Transport.java (original)
+++ webservices/scout/trunk/src/main/java/org/apache/ws/scout/transport/Transport.java Sun Sep 6 23:21:23 2009
@@ -30,8 +30,8 @@
public interface Transport
{
Element send(Element request,URI endPointURI)
- throws RegistryException;
+ throws TransportException;
String send(String request,URI endpointURI)
- throws RegistryException;
+ throws TransportException;
}
Added: webservices/scout/trunk/src/main/java/org/apache/ws/scout/transport/TransportException.java
URL: http://svn.apache.org/viewvc/webservices/scout/trunk/src/main/java/org/apache/ws/scout/transport/TransportException.java?rev=811951&view=auto
==============================================================================
--- webservices/scout/trunk/src/main/java/org/apache/ws/scout/transport/TransportException.java (added)
+++ webservices/scout/trunk/src/main/java/org/apache/ws/scout/transport/TransportException.java Sun Sep 6 23:21:23 2009
@@ -0,0 +1,7 @@
+package org.apache.ws.scout.transport;
+
+public class TransportException extends Exception {
+ public TransportException(Exception e) {
+ super(e);
+ }
+}
---------------------------------------------------------------------
To unsubscribe, e-mail: scout-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: scout-dev-help@ws.apache.org