You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by na...@apache.org on 2008/06/11 01:03:42 UTC

svn commit: r666390 - in /incubator/tuscany/java/sca/modules: binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/ binding-ws-xml/src/main/java/org/apache/tuscany/sca/binding/ws/xml/ interface-wsdl-java2wsdl/src/main/java/org/apache/...

Author: nash
Date: Tue Jun 10 16:03:41 2008
New Revision: 666390

URL: http://svn.apache.org/viewvc?rev=666390&view=rev
Log:
Fix TUSCANY-2323 by generating a new WSDL document that imports an existing portType and binding

Modified:
    incubator/tuscany/java/sca/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2ServiceClient.java
    incubator/tuscany/java/sca/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2ServiceProvider.java
    incubator/tuscany/java/sca/modules/binding-ws-xml/src/main/java/org/apache/tuscany/sca/binding/ws/xml/WebServiceBindingProcessor.java
    incubator/tuscany/java/sca/modules/interface-wsdl-java2wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/interface2wsdl/WSDLDefinitionGenerator.java
    incubator/tuscany/java/sca/modules/interface-wsdl-xml/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/xml/WSDLDocumentProcessor.java
    incubator/tuscany/java/sca/modules/interface-wsdl-xml/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/xml/WSDLInterfaceProcessor.java
    incubator/tuscany/java/sca/modules/interface-wsdl-xml/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/xml/WSDLModelResolver.java
    incubator/tuscany/java/sca/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/WSDLDefinition.java
    incubator/tuscany/java/sca/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/impl/WSDLDefinitionImpl.java

Modified: incubator/tuscany/java/sca/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2ServiceClient.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2ServiceClient.java?rev=666390&r1=666389&r2=666390&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2ServiceClient.java (original)
+++ incubator/tuscany/java/sca/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2ServiceClient.java Tue Jun 10 16:03:41 2008
@@ -22,6 +22,8 @@
 import static org.apache.tuscany.sca.binding.ws.axis2.AxisPolicyHelper.isIntentRequired;
 
 import java.io.IOException;
+import java.net.URI;
+import java.net.URISyntaxException;
 import java.net.URL;
 import java.security.AccessController;
 import java.security.PrivilegedAction;
@@ -38,10 +40,14 @@
 import javax.wsdl.Port;
 import javax.wsdl.PortType;
 import javax.wsdl.Service;
+import javax.wsdl.WSDLException;
 import javax.wsdl.extensions.ExtensibilityElement;
 import javax.wsdl.extensions.soap.SOAPAddress;
+import javax.wsdl.extensions.soap.SOAPBinding;
 import javax.wsdl.extensions.soap.SOAPOperation;
 import javax.wsdl.extensions.soap12.SOAP12Address;
+import javax.wsdl.extensions.soap12.SOAP12Binding;
+import javax.wsdl.factory.WSDLFactory;
 import javax.xml.namespace.QName;
 import javax.xml.stream.FactoryConfigurationError;
 import javax.xml.stream.XMLInputFactory;
@@ -74,6 +80,7 @@
 import org.apache.tuscany.sca.host.http.ServletHost;
 import org.apache.tuscany.sca.interfacedef.InterfaceContract;
 import org.apache.tuscany.sca.interfacedef.Operation;
+import org.apache.tuscany.sca.interfacedef.wsdl.WSDLDefinition;
 import org.apache.tuscany.sca.interfacedef.wsdl.WSDLInterface;
 import org.apache.tuscany.sca.interfacedef.wsdl.interface2wsdl.WSDLDefinitionGenerator;
 import org.apache.tuscany.sca.invocation.Invoker;
@@ -91,6 +98,8 @@
 
 public class Axis2ServiceClient {
 
+    private RuntimeComponent component;
+    private AbstractContract contract;
     private WebServiceBinding wsBinding;
     private ServiceClient serviceClient;
     Map<ClassLoader, List<PolicyHandlerTuple>> policyHandlerClassnames = null;
@@ -103,6 +112,8 @@
                               MessageFactory messageFactory,
                               Map<ClassLoader, List<PolicyHandlerTuple>> policyHandlerClassnames) {
 
+        this.component = component;
+        this.contract = contract;
         this.wsBinding = wsBinding;
         this.policyHandlerClassnames = policyHandlerClassnames;
     }
@@ -161,9 +172,9 @@
             createPolicyHandlers();
             setupPolicyHandlers(policyHandlerList, configContext);
 
+            configureWSDLDefinition(wsBinding, component, contract);
+            // The service, port and WSDL definition can be set by the above call
             Definition wsdlDefinition = wsBinding.getWSDLDefinition().getDefinition();
-            setServiceAndPort(wsBinding);
-            // The service and port can be set by the above call
             QName serviceQName =
                 wsBinding.getService() != null ? wsBinding.getService().getQName() : wsBinding.getServiceName();
             String portName = wsBinding.getPort() != null ? wsBinding.getPort().getName() : wsBinding.getPortName();
@@ -307,10 +318,115 @@
     }
 
     /**
-     * Ensure the WSDL definition contains a suitable service and port
+     * Generate a suitably configured WSDL definition
      */
-    protected static void setServiceAndPort(WebServiceBinding wsBinding) {
-        Definition wsdlDefinition = wsBinding.getWSDLDefinition().getDefinition();
+    protected static void configureWSDLDefinition(WebServiceBinding wsBinding,
+                                                  RuntimeComponent component,
+                                                  AbstractContract contract) {
+        WSDLDefinition wsdlDefinition = wsBinding.getWSDLDefinition();
+        Definition def = wsdlDefinition.getDefinition();
+        if (wsBinding.getWSDLDefinition().getURI() != null) {
+            // The WSDL document was provided by the user.  Generate a new
+            // WSDL document with imports from the user-provided document.
+            WSDLFactory factory = null;
+            try {
+                factory = WSDLFactory.newInstance();
+            } catch (WSDLException e) {
+                throw new RuntimeException(e);
+            }
+            Definition definition = factory.newDefinition();
+
+            // Construct a target namespace from the base URI of the user's
+            // WSDL document (is this what we should be using?) and a path
+            // computed according to the SCA Web Service binding spec.
+            String nsName = component.getName() + "/" + contract.getName();
+            String namespaceURI = null;
+            try {
+                URI userTNS = new URI(def.getTargetNamespace());
+                namespaceURI = userTNS.resolve("/" + nsName).toString();
+            } catch (URISyntaxException e1) {
+            } catch (IllegalArgumentException e2) {
+            }
+
+            // set name and targetNamespace attributes on the definition
+            String defsName = component.getName() + "." + contract.getName();
+            definition.setQName(new QName(namespaceURI, defsName));
+            definition.setTargetNamespace(namespaceURI);
+            definition.addNamespace("tns", namespaceURI);
+
+            // add soap11 or soap12 prefix as required
+            boolean requiresSOAP11 = false;
+            boolean requiresSOAP12 = false;
+            for (Object binding : def.getAllBindings().values()) {
+                List bindingExtensions = ((Binding)binding).getExtensibilityElements();
+                for (final Object extension : bindingExtensions) {
+                    if (extension instanceof SOAPBinding) {
+                        requiresSOAP11 = true;
+                    }
+                    if (extension instanceof SOAP12Binding) {
+                        requiresSOAP12 = true;
+                    }
+                }
+            }
+            if (requiresSOAP11 || wsBinding.getBinding() == null) {
+                definition.addNamespace("soap11", "http://schemas.xmlsoap.org/wsdl/soap/");
+            }
+            if (requiresSOAP12) {
+                definition.addNamespace("soap12", "http://schemas.xmlsoap.org/wsdl/soap12/");
+            }
+
+            // set wsdl namespace prefix on the definition
+            definition.addNamespace("wsdl", "http://schemas.xmlsoap.org/wsdl/");
+
+            // import the existing portType
+            int index = 0;
+            List<WSDLDefinition> imports = new ArrayList<WSDLDefinition>();
+            InterfaceContract ic = wsBinding.getBindingInterfaceContract();
+            WSDLInterface wi = (WSDLInterface)ic.getInterface();
+            PortType portType = wi.getPortType();
+            WSDLDefinition ptDef = getPortTypeDefinition(wsdlDefinition, portType.getQName());
+            if (ptDef != null) {
+                Import imp = definition.createImport();
+                String ptNamespace = portType.getQName().getNamespaceURI();
+                imp.setNamespaceURI(ptNamespace);
+                imp.setLocationURI(ptDef.getURI().toString());
+                imp.setDefinition(ptDef.getDefinition());
+                imports.add(ptDef);
+                definition.addNamespace("ns" + index++, ptNamespace);
+                definition.addImport(imp);
+            } else {
+                throw new RuntimeException("Unable to find portType " + portType.getQName());
+            }
+
+            // import an existing binding if specified
+            Binding binding = wsBinding.getBinding();
+            if (binding != null) {
+                String biNamespace = binding.getQName().getNamespaceURI();
+                if (definition.getImports(biNamespace) == null) {
+                    WSDLDefinition biDef = getBindingDefinition(wsdlDefinition, binding.getQName());
+                    if (biDef != null) {
+                        Import imp = definition.createImport();
+                        imp.setNamespaceURI(biNamespace);
+                        imp.setLocationURI(biDef.getURI().toString());
+                        imp.setDefinition(biDef.getDefinition());
+                        imports.add(biDef);
+                        definition.addNamespace("ns" + index++, biNamespace);
+                        definition.addImport(imp);
+                    } else {
+                        throw new RuntimeException("Unable to find binding " + binding.getQName());
+                    }
+                }
+            }
+
+            // replace original WSDL definition by the generated definition
+            def = definition;
+            wsdlDefinition.setDefinition(definition);
+            wsdlDefinition.setLocation(null);
+            wsdlDefinition.setURI(null);
+            wsdlDefinition.getImportedDefinitions().clear();
+            wsdlDefinition.getImportedDefinitions().addAll(imports);
+        }
+
         QName serviceQName = wsBinding.getServiceName();
         String portName = wsBinding.getPortName();
 
@@ -326,25 +442,61 @@
             InterfaceContract ic = wsBinding.getBindingInterfaceContract();
             WSDLInterface wi = (WSDLInterface)ic.getInterface();
             PortType portType = wi.getPortType();
-            Service service = helper.createService(wsdlDefinition, portType);
-            Binding binding = helper.createBinding(wsdlDefinition, portType);
-            helper.createBindingOperations(wsdlDefinition, binding, portType);
+            Service service = helper.createService(def, portType);
+            Binding binding = helper.createBinding(def, portType);
+            helper.createBindingOperations(def, binding, portType);
             binding.setUndefined(false);
-            wsdlDefinition.addBinding(binding);
+            def.addBinding(binding);
             
-            Port port = helper.createPort(wsdlDefinition, binding, service, wsBinding.getURI());
+            Port port = helper.createPort(def, binding, service, wsBinding.getURI());
             wsBinding.setService(service);
             wsBinding.setPort(port);
             wsBinding.setBinding(port.getBinding());
         } else {
-            Service service = helper.createService(wsdlDefinition, wsBinding.getBinding());
-            Port port = helper.createPort(wsdlDefinition, wsBinding.getBinding(), service, wsBinding.getURI());
+            Service service = helper.createService(def, wsBinding.getBinding());
+            Port port = helper.createPort(def, wsBinding.getBinding(), service, wsBinding.getURI());
             wsBinding.setService(service);
             wsBinding.setPort(port);
         }
 
     }
 
+    private static WSDLDefinition getPortTypeDefinition(WSDLDefinition def, QName portTypeName) {
+        
+        if (def == null || portTypeName == null) {
+            return def;
+        }
+        Object portType = def.getDefinition().getPortTypes().get(portTypeName);
+        if (portType != null) {
+            return def;
+        }
+        for (WSDLDefinition impDef : def.getImportedDefinitions()) {
+            WSDLDefinition d = getPortTypeDefinition(impDef, portTypeName);
+            if (d != null) {
+                return d;
+            }
+        }
+        return null;
+    }
+
+    private static WSDLDefinition getBindingDefinition(WSDLDefinition def, QName bindingName) {
+        
+        if (def == null || bindingName == null) {
+            return def;
+        }
+        Object binding = def.getDefinition().getBindings().get(bindingName);
+        if (binding != null) {
+            return def;
+        }
+        for (WSDLDefinition impDef : def.getImportedDefinitions()) {
+            WSDLDefinition d = getBindingDefinition(impDef, bindingName);
+            if (d != null) {
+                return d;
+            }
+        }
+        return null;
+    }
+
     protected void stop() {
         if (serviceClient != null) {
             // close all connections that we have initiated, so that the jetty server

Modified: incubator/tuscany/java/sca/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2ServiceProvider.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2ServiceProvider.java?rev=666390&r1=666389&r2=666390&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2ServiceProvider.java (original)
+++ incubator/tuscany/java/sca/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2ServiceProvider.java Tue Jun 10 16:03:41 2008
@@ -105,6 +105,7 @@
     
     private static final Logger logger = Logger.getLogger(Axis2ServiceProvider.class.getName());    
 
+    private RuntimeComponent component;
     private AbstractContract contract;
     private WebServiceBinding wsBinding;
     private ServletHost servletHost;
@@ -135,6 +136,7 @@
                                 MessageFactory messageFactory,
                                 Map<ClassLoader, List<PolicyHandlerTuple>> policyHandlerClassnames) {
 
+        this.component = component; 
         this.contract = contract; 
         this.wsBinding = wsBinding;
         this.servletHost = servletHost;
@@ -476,14 +478,10 @@
      * Create an AxisService from the WSDL doc used by ws binding
      */
     protected AxisService createWSDLAxisService() throws AxisFault {
-        Definition definition = wsBinding.getWSDLDefinition().getDefinition();
-
-        // WSDLToAxisServiceBuilder only uses the service and port to find the wsdl4J Binding
-        // An SCA service with binding.ws does not require a service or port so we may not have
-        // these but ...
 
-        Axis2ServiceClient.setServiceAndPort(wsBinding);
-        // The service and port can be set by the above call
+        Axis2ServiceClient.configureWSDLDefinition(wsBinding, component, contract);
+        // The service, port and WSDL definition can be set by the above call
+        Definition definition = wsBinding.getWSDLDefinition().getDefinition();
         QName serviceQName =
             wsBinding.getService() != null ? wsBinding.getService().getQName() : wsBinding.getServiceName();
         String portName = wsBinding.getPort() != null ? wsBinding.getPort().getName() : wsBinding.getPortName();

Modified: incubator/tuscany/java/sca/modules/binding-ws-xml/src/main/java/org/apache/tuscany/sca/binding/ws/xml/WebServiceBindingProcessor.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/binding-ws-xml/src/main/java/org/apache/tuscany/sca/binding/ws/xml/WebServiceBindingProcessor.java?rev=666390&r1=666389&r2=666390&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/binding-ws-xml/src/main/java/org/apache/tuscany/sca/binding/ws/xml/WebServiceBindingProcessor.java (original)
+++ incubator/tuscany/java/sca/modules/binding-ws-xml/src/main/java/org/apache/tuscany/sca/binding/ws/xml/WebServiceBindingProcessor.java Tue Jun 10 16:03:41 2008
@@ -316,6 +316,7 @@
         if (!resolved.isUnresolved()) {
             wsdlDefinition.setDefinition(resolved.getDefinition());
             wsdlDefinition.setLocation(resolved.getLocation());
+            wsdlDefinition.setURI(resolved.getURI());
             wsdlDefinition.getXmlSchemas().addAll(resolved.getXmlSchemas());
             wsdlDefinition.setUnresolved(false);
             model.setDefinition(wsdlDefinition);

Modified: incubator/tuscany/java/sca/modules/interface-wsdl-java2wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/interface2wsdl/WSDLDefinitionGenerator.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/interface-wsdl-java2wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/interface2wsdl/WSDLDefinitionGenerator.java?rev=666390&r1=666389&r2=666390&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/interface-wsdl-java2wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/interface2wsdl/WSDLDefinitionGenerator.java (original)
+++ incubator/tuscany/java/sca/modules/interface-wsdl-java2wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/interface2wsdl/WSDLDefinitionGenerator.java Tue Jun 10 16:03:41 2008
@@ -132,7 +132,7 @@
             // Choose <porttype>Binding if available.  If this name is in use, insert
             // separating underscores until there is no clash.
             for (String suffix = BINDING_SUFFIX; ; suffix = "_" + suffix) { 
-                QName name = new QName(portTypeName.getNamespaceURI(), portTypeName.getLocalPart() + suffix);
+                QName name = new QName(definition.getTargetNamespace(), portTypeName.getLocalPart() + suffix);
                 if (definition.getBinding(name) == null) {
                     binding.setQName(name);
                     break;
@@ -264,10 +264,10 @@
             // Choose <porttype>Service if available.  If this name is in use, insert
             // separating underscores until there is no clash.
             for (String suffix = SERVICE_SUFFIX; ; suffix = "_" + suffix) {
-                QName name = new QName(portTypeName.getNamespaceURI(), portTypeName.getLocalPart() + suffix);
+                QName name = new QName(definition.getTargetNamespace(), portTypeName.getLocalPart() + suffix);
                 if (definition.getService(name) == null) {
                     service.setQName(name);
-                     break;
+                    break;
                 }
             }
         }

Modified: incubator/tuscany/java/sca/modules/interface-wsdl-xml/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/xml/WSDLDocumentProcessor.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/interface-wsdl-xml/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/xml/WSDLDocumentProcessor.java?rev=666390&r1=666389&r2=666390&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/interface-wsdl-xml/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/xml/WSDLDocumentProcessor.java (original)
+++ incubator/tuscany/java/sca/modules/interface-wsdl-xml/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/xml/WSDLDocumentProcessor.java Tue Jun 10 16:03:41 2008
@@ -86,7 +86,9 @@
 
     public WSDLDefinition read(URL contributionURL, URI artifactURI, URL artifactURL) throws ContributionReadException {
         try {
-            return indexRead(artifactURL);
+            WSDLDefinition definition = indexRead(artifactURL);
+            definition.setURI(artifactURI);
+            return definition;
         } catch (Exception e) {
         	ContributionReadException ce = new ContributionReadException(e);
         	error("ContributionReadException", artifactURL, ce);
@@ -113,6 +115,9 @@
                         WSDLDefinition resolved = resolver.resolveModel(WSDLDefinition.class, proxy);
                         if (resolved != null && !resolved.isUnresolved()) {
                             imp.setDefinition(resolved.getDefinition());
+                            if (!model.getImportedDefinitions().contains(resolved)) {
+                                model.getImportedDefinitions().add(resolved);
+                            }
                         }
                     } else {
                         String location = imp.getLocationURI();
@@ -122,6 +127,9 @@
                             try {
                                 resolved = read(null, uri, uri.toURL());
                                 imp.setDefinition(resolved.getDefinition());
+                                if (!model.getImportedDefinitions().contains(resolved)) {
+                                    model.getImportedDefinitions().add(resolved);
+                                }
                             } catch (Exception e) {
                             	ContributionResolveException ce = new ContributionResolveException(e);
                             	error("ContributionResolveException", resolver, ce);
@@ -140,6 +148,9 @@
                                 try {
                                     resolved = read(null, locationURI, locationURI.toURL());
                                     imp.setDefinition(resolved.getDefinition());
+                                    if (!model.getImportedDefinitions().contains(resolved)) {
+                                        model.getImportedDefinitions().add(resolved);
+                                    }
                                 } catch (Exception e) {
                                 	ContributionResolveException ce = new ContributionResolveException(e);
                                 	error("ContributionResolveException", resolver, ce);

Modified: incubator/tuscany/java/sca/modules/interface-wsdl-xml/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/xml/WSDLInterfaceProcessor.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/interface-wsdl-xml/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/xml/WSDLInterfaceProcessor.java?rev=666390&r1=666389&r2=666390&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/interface-wsdl-xml/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/xml/WSDLInterfaceProcessor.java (original)
+++ incubator/tuscany/java/sca/modules/interface-wsdl-xml/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/xml/WSDLInterfaceProcessor.java Tue Jun 10 16:03:41 2008
@@ -199,6 +199,7 @@
                 if (!resolved.isUnresolved()) {
                     wsdlDefinition.setDefinition(resolved.getDefinition());
                     wsdlDefinition.setLocation(resolved.getLocation());
+                    wsdlDefinition.setURI(resolved.getURI());
                     wsdlDefinition.getXmlSchemas().addAll(resolved.getXmlSchemas());
                     wsdlDefinition.setUnresolved(false);
                     WSDLObject<PortType> portType = wsdlDefinition.getWSDLObject(PortType.class, wsdlInterface.getName());

Modified: incubator/tuscany/java/sca/modules/interface-wsdl-xml/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/xml/WSDLModelResolver.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/interface-wsdl-xml/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/xml/WSDLModelResolver.java?rev=666390&r1=666389&r2=666390&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/interface-wsdl-xml/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/xml/WSDLModelResolver.java (original)
+++ incubator/tuscany/java/sca/modules/interface-wsdl-xml/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/xml/WSDLModelResolver.java Tue Jun 10 16:03:41 2008
@@ -269,6 +269,7 @@
                 imp.setLocationURI(d.getDefinition().getDocumentBaseURI());
                 facade.addImport(imp);
                 aggregated.getXmlSchemas().addAll(d.getXmlSchemas());
+                aggregated.getImportedDefinitions().add(d);
             }
         }
         aggregated.setDefinition(facade);

Modified: incubator/tuscany/java/sca/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/WSDLDefinition.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/WSDLDefinition.java?rev=666390&r1=666389&r2=666390&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/WSDLDefinition.java (original)
+++ incubator/tuscany/java/sca/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/WSDLDefinition.java Tue Jun 10 16:03:41 2008
@@ -86,6 +86,24 @@
     void setLocation(URI url);
 
     /**
+     * Get the contribution artifact URI of the WSDL document
+     * @return The URI of the WSDL document
+     */
+    URI getURI();
+
+    /**
+     * Set the contribution artifact URI of the WSDL document
+     * @param uri
+     */
+    void setURI(URI uri);
+
+    /**
+     * Get the WSDL definitions imported by this definition
+     * @return A list of imported WSDL definitions
+     */
+    List<WSDLDefinition> getImportedDefinitions();
+
+    /**
      * Get an XSD element by QName
      * @param name
      * @return

Modified: incubator/tuscany/java/sca/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/impl/WSDLDefinitionImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/impl/WSDLDefinitionImpl.java?rev=666390&r1=666389&r2=666390&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/impl/WSDLDefinitionImpl.java (original)
+++ incubator/tuscany/java/sca/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/impl/WSDLDefinitionImpl.java Tue Jun 10 16:03:41 2008
@@ -53,6 +53,8 @@
     private Definition definition;
     private String namespace;
     private URI location;
+    private URI uri;
+    private List<WSDLDefinition> imported = new ArrayList<WSDLDefinition>();
     private List<XSDefinition> schemas = new ArrayList<XSDefinition>();
     private boolean unresolved;
     private Binding binding;
@@ -139,6 +141,27 @@
     }
 
     /**
+     * @see org.apache.tuscany.sca.interfacedef.wsdl.WSDLDefinition#getURI()
+     */
+    public URI getURI() {
+        return uri;
+    }
+
+    /**
+     * @see org.apache.tuscany.sca.interfacedef.wsdl.WSDLDefinition#setURI(java.net.URI)
+     */
+    public void setURI(URI uri) {
+        this.uri = uri;
+    }
+
+    /**
+     * @see org.apache.tuscany.sca.interfacedef.wsdl.WSDLDefinition#getImportedDefinitions()
+     */
+    public List<WSDLDefinition> getImportedDefinitions() {
+        return imported;
+    }
+
+    /**
      * @see java.lang.Object#hashCode()
      */
     @Override