You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by rf...@apache.org on 2007/10/24 06:31:01 UTC

svn commit: r587778 [10/13] - in /incubator/tuscany/branches/sca-java-1.0.1: ./ distribution/ distribution/bundle/ distribution/manifest/ distribution/webapp/src/main/java/org/apache/tuscany/sca/webapp/ distribution/webapp/src/main/resources/_node/ dis...

Modified: incubator/tuscany/branches/sca-java-1.0.1/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/impl/JavaInterfaceIntrospectorImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/branches/sca-java-1.0.1/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/impl/JavaInterfaceIntrospectorImpl.java?rev=587778&r1=587777&r2=587778&view=diff
==============================================================================
--- incubator/tuscany/branches/sca-java-1.0.1/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/impl/JavaInterfaceIntrospectorImpl.java (original)
+++ incubator/tuscany/branches/sca-java-1.0.1/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/impl/JavaInterfaceIntrospectorImpl.java Tue Oct 23 21:30:02 2007
@@ -24,6 +24,8 @@
 import java.util.List;
 import java.util.Set;
 
+import javax.xml.namespace.QName;
+
 import org.apache.tuscany.sca.interfacedef.ConversationSequence;
 import org.apache.tuscany.sca.interfacedef.DataType;
 import org.apache.tuscany.sca.interfacedef.InvalidCallbackException;
@@ -36,6 +38,7 @@
 import org.apache.tuscany.sca.interfacedef.java.JavaInterface;
 import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory;
 import org.apache.tuscany.sca.interfacedef.java.introspect.JavaInterfaceVisitor;
+import org.apache.tuscany.sca.interfacedef.util.XMLType;
 import org.osoa.sca.annotations.Conversational;
 import org.osoa.sca.annotations.EndsConversation;
 import org.osoa.sca.annotations.OneWay;
@@ -62,10 +65,10 @@
 
         boolean remotable = type.isAnnotationPresent(Remotable.class);
         javaInterface.setRemotable(remotable);
-        
+
         boolean conversational = type.isAnnotationPresent(Conversational.class);
         javaInterface.setConversational(conversational);
-        
+
         Class<?> callbackClass = null;
         org.osoa.sca.annotations.Callback callback = type.getAnnotation(org.osoa.sca.annotations.Callback.class);
         if (callback != null && !Void.class.equals(callback.value())) {
@@ -74,19 +77,20 @@
             throw new InvalidCallbackException("No callback interface specified on annotation");
         }
         javaInterface.setCallbackClass(callbackClass);
-        
-        javaInterface.getOperations().addAll(getOperations(type, remotable, conversational));
+
+        String ns = JavaInterfaceUtil.getNamespace(type);
+        javaInterface.getOperations().addAll(getOperations(type, remotable, conversational, ns));
 
         for (JavaInterfaceVisitor extension : visitors) {
             extension.visitInterface(javaInterface);
         }
     }
 
-    private <T> List<Operation> getOperations(Class<T> type, boolean remotable, boolean conversational)
+    private <T> List<Operation> getOperations(Class<T> type, boolean remotable, boolean conversational, String ns)
         throws InvalidInterfaceException {
         Method[] methods = type.getMethods();
         List<Operation> operations = new ArrayList<Operation>(methods.length);
-        Set<String> names = remotable? new HashSet<String>() : null;
+        Set<String> names = remotable ? new HashSet<String>() : null;
         for (Method method : methods) {
             if (method.getDeclaringClass() == Object.class) {
                 // Skip the methods on the Object.class
@@ -96,7 +100,7 @@
             if (remotable && names.contains(name)) {
                 throw new OverloadedOperationException(method);
             }
-            if(remotable) {
+            if (remotable) {
                 names.add(name);
             }
 
@@ -117,23 +121,27 @@
             }
 
             // Set outputType to null for void
-            DataType<Class> returnDataType = returnType == void.class ? null
-                                                                     : new DataTypeImpl<Class>(UNKNOWN_DATABINDING,
-                                                                                               returnType, returnType);
+            XMLType xmlReturnType = new XMLType(new QName(ns, "return"), null);
+            DataType<XMLType> returnDataType =
+                returnType == void.class ? null : new DataTypeImpl<XMLType>(UNKNOWN_DATABINDING, returnType,
+                                                                            xmlReturnType);
             List<DataType> paramDataTypes = new ArrayList<DataType>(paramTypes.length);
-            for (Class paramType : paramTypes) {
-                paramDataTypes.add(new DataTypeImpl<Class>(UNKNOWN_DATABINDING, paramType, paramType));
+            for (int i = 0; i < paramTypes.length; i++) {
+                Class paramType = paramTypes[i];
+                XMLType xmlParamType = new XMLType(new QName(ns, "arg" + i), null);
+                paramDataTypes.add(new DataTypeImpl<XMLType>(UNKNOWN_DATABINDING, paramType, xmlParamType));
             }
             List<DataType> faultDataTypes = new ArrayList<DataType>(faultTypes.length);
             for (Class faultType : faultTypes) {
                 // Only add checked exceptions
                 if (Exception.class.isAssignableFrom(faultType) && (!RuntimeException.class.isAssignableFrom(faultType))) {
-                    faultDataTypes.add(new DataTypeImpl<Class>(UNKNOWN_DATABINDING, faultType, faultType));
+                    XMLType xmlFaultType = new XMLType(new QName(ns, faultType.getSimpleName()), null);
+                    faultDataTypes.add(new DataTypeImpl<XMLType>(UNKNOWN_DATABINDING, faultType, xmlFaultType));
                 }
             }
 
-            DataType<List<DataType>> inputType = new DataTypeImpl<List<DataType>>(IDL_INPUT, Object[].class,
-                                                                                  paramDataTypes);
+            DataType<List<DataType>> inputType =
+                new DataTypeImpl<List<DataType>>(IDL_INPUT, Object[].class, paramDataTypes);
             Operation operation = new OperationImpl(name);
             operation.setInputType(inputType);
             operation.setOutputType(returnDataType);

Modified: incubator/tuscany/branches/sca-java-1.0.1/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/impl/JavaInterfaceUtil.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/branches/sca-java-1.0.1/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/impl/JavaInterfaceUtil.java?rev=587778&r1=587777&r2=587778&view=diff
==============================================================================
--- incubator/tuscany/branches/sca-java-1.0.1/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/impl/JavaInterfaceUtil.java (original)
+++ incubator/tuscany/branches/sca-java-1.0.1/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/impl/JavaInterfaceUtil.java Tue Oct 23 21:30:02 2007
@@ -126,5 +126,22 @@
         return found;
 
     }
+    
+    public static String getNamespace(Class<?> cls) {
+        Package pkg = cls.getPackage();
+        if (pkg == null) {
+            return "";
+        }
+        StringBuffer ns = new StringBuffer("http://");
+        String[] names = pkg.getName().split("\\.");
+        for (int i = names.length - 1; i >= 0; i--) {
+            ns.append(names[i]);
+            if (i != 0) {
+                ns.append('.');
+            }
+        }
+        ns.append('/');
+        return ns.toString();
+    }
 
 }

Modified: incubator/tuscany/branches/sca-java-1.0.1/modules/interface-java/src/test/java/org/apache/tuscany/sca/interfacedef/java/introspection/impl/JavaInterfaceProcessorRegistryImplTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/branches/sca-java-1.0.1/modules/interface-java/src/test/java/org/apache/tuscany/sca/interfacedef/java/introspection/impl/JavaInterfaceProcessorRegistryImplTestCase.java?rev=587778&r1=587777&r2=587778&view=diff
==============================================================================
--- incubator/tuscany/branches/sca-java-1.0.1/modules/interface-java/src/test/java/org/apache/tuscany/sca/interfacedef/java/introspection/impl/JavaInterfaceProcessorRegistryImplTestCase.java (original)
+++ incubator/tuscany/branches/sca-java-1.0.1/modules/interface-java/src/test/java/org/apache/tuscany/sca/interfacedef/java/introspection/impl/JavaInterfaceProcessorRegistryImplTestCase.java Tue Oct 23 21:30:02 2007
@@ -24,9 +24,10 @@
 import static org.easymock.EasyMock.verify;
 
 import java.io.IOException;
-import java.lang.reflect.Type;
 import java.util.List;
 
+import javax.xml.namespace.QName;
+
 import junit.framework.TestCase;
 
 import org.apache.tuscany.sca.interfacedef.DataType;
@@ -36,6 +37,7 @@
 import org.apache.tuscany.sca.interfacedef.java.JavaInterface;
 import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory;
 import org.apache.tuscany.sca.interfacedef.java.introspect.JavaInterfaceVisitor;
+import org.apache.tuscany.sca.interfacedef.util.XMLType;
 import org.easymock.EasyMock;
 
 /**
@@ -54,21 +56,26 @@
         Operation baseInt = operations.get(0);
         assertEquals("baseInt", baseInt.getName());
 
-        DataType<Type> returnType = baseInt.getOutputType();
+        QName element = new QName("http://impl.introspection.java.interfacedef.sca.tuscany.apache.org/", "return");
+
+        DataType<XMLType> returnType = baseInt.getOutputType();
         assertEquals(Integer.TYPE, returnType.getPhysical());
-        assertEquals(Integer.TYPE, returnType.getLogical());
+        assertEquals(element, returnType.getLogical().getElementName());
 
         List<DataType> parameterTypes = baseInt.getInputType().getLogical();
         assertEquals(1, parameterTypes.size());
-        DataType<Type> arg0 = parameterTypes.get(0);
+        DataType<XMLType> arg0 = parameterTypes.get(0);
         assertEquals(Integer.TYPE, arg0.getPhysical());
-        assertEquals(Integer.TYPE, arg0.getLogical());
+        
+        element = new QName("http://impl.introspection.java.interfacedef.sca.tuscany.apache.org/", "arg0");
+        assertEquals(element, arg0.getLogical().getElementName());
 
         List<DataType> faultTypes = baseInt.getFaultTypes();
         assertEquals(1, faultTypes.size());
-        DataType<Type> fault0 = faultTypes.get(0);
+        DataType<XMLType> fault0 = faultTypes.get(0);
         assertEquals(IOException.class, fault0.getPhysical());
-        assertEquals(IOException.class, fault0.getLogical());
+        element = new QName("http://impl.introspection.java.interfacedef.sca.tuscany.apache.org/", "IOException");
+        assertEquals(element, fault0.getLogical().getElementName());
     }
 
     public void testUnregister() throws Exception {
@@ -82,7 +89,7 @@
         factory.createJavaInterface(Base.class);
         verify(extension);
     }
-
+    
     @Override
     protected void setUp() throws Exception {
         super.setUp();

Modified: incubator/tuscany/branches/sca-java-1.0.1/modules/interface-wsdl-xml/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/xml/WSDLDocumentProcessor.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/branches/sca-java-1.0.1/modules/interface-wsdl-xml/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/xml/WSDLDocumentProcessor.java?rev=587778&r1=587777&r2=587778&view=diff
==============================================================================
--- incubator/tuscany/branches/sca-java-1.0.1/modules/interface-wsdl-xml/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/xml/WSDLDocumentProcessor.java (original)
+++ incubator/tuscany/branches/sca-java-1.0.1/modules/interface-wsdl-xml/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/xml/WSDLDocumentProcessor.java Tue Oct 23 21:30:02 2007
@@ -148,6 +148,7 @@
         try {
             XMLStreamReader reader = inputFactory.createXMLStreamReader(is);
             int eventType = reader.getEventType();
+            int index = 0;
             while (true) {
                 if (eventType == XMLStreamConstants.START_ELEMENT) {
                     if (WSDL11.equals(reader.getName())) {
@@ -162,6 +163,8 @@
                         XSDefinition xsd = factory.createXSDefinition();
                         xsd.setUnresolved(true);
                         xsd.setNamespace(tns);
+                        xsd.setLocation(URI.create(doc.toURI() + "#" + index));
+                        index++;
                         // The definition is marked as resolved but not loaded
                         xsd.setUnresolved(false);
                         xsd.setSchema(null);

Modified: incubator/tuscany/branches/sca-java-1.0.1/modules/interface-wsdl-xml/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/xml/WSDLInterfaceProcessor.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/branches/sca-java-1.0.1/modules/interface-wsdl-xml/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/xml/WSDLInterfaceProcessor.java?rev=587778&r1=587777&r2=587778&view=diff
==============================================================================
--- incubator/tuscany/branches/sca-java-1.0.1/modules/interface-wsdl-xml/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/xml/WSDLInterfaceProcessor.java (original)
+++ incubator/tuscany/branches/sca-java-1.0.1/modules/interface-wsdl-xml/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/xml/WSDLInterfaceProcessor.java Tue Oct 23 21:30:02 2007
@@ -149,7 +149,7 @@
                         // Introspect the WSDL portType and add the resulting
                         // WSDLInterface to the resolver
                         try {
-                            wsdlInterface = wsdlFactory.createWSDLInterface(portType, wsdlDefinition.getInlinedSchemas(), resolver);
+                            wsdlInterface = wsdlFactory.createWSDLInterface(portType, wsdlDefinition, resolver);
                         } catch (InvalidInterfaceException e) {
                             throw new ContributionResolveException(e);
                         }

Modified: incubator/tuscany/branches/sca-java-1.0.1/modules/interface-wsdl-xml/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/xml/WSDLModelResolver.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/branches/sca-java-1.0.1/modules/interface-wsdl-xml/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/xml/WSDLModelResolver.java?rev=587778&r1=587777&r2=587778&view=diff
==============================================================================
--- incubator/tuscany/branches/sca-java-1.0.1/modules/interface-wsdl-xml/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/xml/WSDLModelResolver.java (original)
+++ incubator/tuscany/branches/sca-java-1.0.1/modules/interface-wsdl-xml/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/xml/WSDLModelResolver.java Tue Oct 23 21:30:02 2007
@@ -21,8 +21,10 @@
 
 import java.io.IOException;
 import java.io.InputStream;
+import java.net.URI;
 import java.net.URL;
 import java.util.ArrayList;
+import java.util.Arrays;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
@@ -30,7 +32,13 @@
 import javax.wsdl.Definition;
 import javax.wsdl.Types;
 import javax.wsdl.WSDLException;
+import javax.wsdl.extensions.ExtensibilityElement;
+import javax.wsdl.extensions.ExtensionDeserializer;
 import javax.wsdl.extensions.ExtensionRegistry;
+import javax.wsdl.extensions.ExtensionSerializer;
+import javax.wsdl.extensions.UnknownExtensibilityElement;
+import javax.wsdl.extensions.UnknownExtensionDeserializer;
+import javax.wsdl.extensions.UnknownExtensionSerializer;
 import javax.wsdl.extensions.schema.Schema;
 import javax.wsdl.xml.WSDLLocator;
 import javax.wsdl.xml.WSDLReader;
@@ -47,7 +55,7 @@
 import org.apache.tuscany.sca.contribution.service.ContributionRuntimeException;
 import org.apache.tuscany.sca.interfacedef.wsdl.WSDLDefinition;
 import org.apache.tuscany.sca.interfacedef.wsdl.WSDLFactory;
-import org.apache.ws.commons.schema.XmlSchemaCollection;
+import org.apache.tuscany.sca.interfacedef.wsdl.XSDefinition;
 import org.w3c.dom.Attr;
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
@@ -61,6 +69,21 @@
  * @version $Rev: 557916 $ $Date: 2007-07-20 01:04:40 -0700 (Fri, 20 Jul 2007) $
  */
 public class WSDLModelResolver implements ModelResolver {
+    //Schema element names
+    public static final String ELEM_SCHEMA = "schema";
+
+    //Schema uri
+    public static final String NS_URI_XSD_1999 = "http://www.w3.org/1999/XMLSchema";
+    public static final String NS_URI_XSD_2000 = "http://www.w3.org/2000/10/XMLSchema";
+    public static final String NS_URI_XSD_2001 = "http://www.w3.org/2001/XMLSchema";
+
+    //Schema qnames
+    public static final QName Q_ELEM_XSD_1999 = new QName(NS_URI_XSD_1999, ELEM_SCHEMA);
+    public static final QName Q_ELEM_XSD_2000 = new QName(NS_URI_XSD_2000, ELEM_SCHEMA);
+    public static final QName Q_ELEM_XSD_2001 = new QName(NS_URI_XSD_2001, ELEM_SCHEMA);
+    public static final List<QName> XSD_QNAME_LIST =
+        Arrays.asList(new QName[] {Q_ELEM_XSD_1999, Q_ELEM_XSD_2000, Q_ELEM_XSD_2001});
+
     private Contribution contribution;
     private Map<String, List<WSDLDefinition>> map = new HashMap<String, List<WSDLDefinition>>();
 
@@ -78,6 +101,13 @@
         this.contributionFactory = modelFactories.getFactory(ContributionFactory.class);
 
         wsdlExtensionRegistry = this.wsdl4jFactory.newPopulatedExtensionRegistry();
+        // REVIEW: [rfeng] Disable the schema extension for WSDL4J to avoid aggressive loading 
+        ExtensionDeserializer deserializer = new UnknownExtensionDeserializer();
+        ExtensionSerializer serializer = new UnknownExtensionSerializer();
+        for (QName schema : XSD_QNAME_LIST) {
+            wsdlExtensionRegistry.registerSerializer(Types.class, schema, serializer);
+            wsdlExtensionRegistry.registerDeserializer(Types.class, schema, deserializer);
+        }
     }
 
     /**
@@ -155,6 +185,11 @@
 
     public void addModel(Object resolved) {
         WSDLDefinition definition = (WSDLDefinition)resolved;
+        for (XSDefinition d : definition.getXmlSchemas()) {
+            if (contribution != null) {
+                contribution.getModelResolver().addModel(d);
+            }
+        }
         List<WSDLDefinition> list = map.get(definition.getNamespace());
         if (list == null) {
             list = new ArrayList<WSDLDefinition>();
@@ -185,12 +220,12 @@
         }
         if (definitions.size() == 1) {
             WSDLDefinition d = definitions.get(0);
-            loadOnDemand(d, d.getInlinedSchemas());
+            loadOnDemand(d);
             return d;
         }
         WSDLDefinition aggregated = wsdlFactory.createWSDLDefinition();
         for (WSDLDefinition d : definitions) {
-            loadOnDemand(d, aggregated.getInlinedSchemas());
+            loadOnDemand(d);
         }
         Definition facade = wsdl4jFactory.newDefinition();
         String ns = definitions.get(0).getNamespace();
@@ -204,6 +239,7 @@
                 imp.setDefinition(d.getDefinition());
                 imp.setLocationURI(d.getDefinition().getDocumentBaseURI());
                 facade.addImport(imp);
+                aggregated.getXmlSchemas().addAll(d.getXmlSchemas());
             }
         }
         aggregated.setDefinition(facade);
@@ -244,13 +280,12 @@
     /**
      * Load the WSDL definition on demand
      * @param def
-     * @param schemaCollection
      */
-    private void loadOnDemand(WSDLDefinition def, XmlSchemaCollection schemaCollection) {
+    private void loadOnDemand(WSDLDefinition def) {
         if (def.getDefinition() == null && def.getLocation() != null) {
             // Load the definition on-demand
             try {
-                loadDefinition(def, schemaCollection);
+                loadDefinition(def);
             } catch (ContributionReadException e) {
                 throw new RuntimeException(e);
             }
@@ -263,11 +298,9 @@
      * Load the WSDL definition and inline schemas
      * 
      * @param wsdlDef
-     * @param schemaCollection
      * @throws ContributionReadException
      */
-    private void loadDefinition(WSDLDefinition wsdlDef, XmlSchemaCollection schemaCollection)
-        throws ContributionReadException {
+    private void loadDefinition(WSDLDefinition wsdlDef) throws ContributionReadException {
         if (wsdlDef.getDefinition() != null || wsdlDef.getLocation() == null) {
             return;
         }
@@ -287,7 +320,7 @@
             wsdlDef.setDefinition(definition);
 
             //Read inline schemas 
-            readInlineSchemas(definition, schemaCollection);
+            readInlineSchemas(wsdlDef, definition);
         } catch (WSDLException e) {
             throw new ContributionReadException(e);
         } catch (IOException e) {
@@ -295,42 +328,61 @@
         }
     }
 
+    private Document promote(Element element) {
+        Document doc = (Document)element.getOwnerDocument().cloneNode(false);
+        Element schema = (Element)doc.importNode(element, true);
+        doc.appendChild(schema);
+        Node parent = element.getParentNode();
+        while (parent instanceof Element) {
+            Element root = (Element)parent;
+            NamedNodeMap nodeMap = root.getAttributes();
+            for (int i = 0; i < nodeMap.getLength(); i++) {
+                Attr attr = (Attr)nodeMap.item(i);
+                String name = attr.getName();
+                if ("xmlns".equals(name) || name.startsWith("xmlns:")) {
+                    if (schema.getAttributeNode(name) == null) {
+                        schema.setAttributeNodeNS((Attr)doc.importNode(attr, true));
+                    }
+                }
+            }
+            parent = parent.getParentNode();
+        }
+        doc.setDocumentURI(element.getOwnerDocument().getDocumentURI());
+        return doc;
+    }
+
     /**
      * Populate the inline schemas including those from the imported definitions
      * 
      * @param definition
      * @param schemaCollection
      */
-    private void readInlineSchemas(Definition definition, XmlSchemaCollection schemaCollection) {
+    private void readInlineSchemas(WSDLDefinition wsdlDefinition, Definition definition) {
+        if (contribution == null) {
+            // Check null for test cases
+            return;
+        }
         Types types = definition.getTypes();
         if (types != null) {
-            schemaCollection.setSchemaResolver(new XSDModelResolver.URIResolverImpl(contribution));
             int index = 0;
             for (Object ext : types.getExtensibilityElements()) {
-                if (ext instanceof Schema) {
-                    Element element = ((Schema)ext).getElement();
-                    Document doc = (Document) element.getOwnerDocument().cloneNode(false);
-                    Element schema = (Element)doc.importNode(element, true);
-                    doc.appendChild(schema);
-                    Node parent = element.getParentNode();
-                    while (parent instanceof Element) {
-                        Element root = (Element)parent;
-                        NamedNodeMap nodeMap = root.getAttributes();
-                        for (int i = 0; i < nodeMap.getLength(); i++) {
-                            Attr attr = (Attr)nodeMap.item(i);
-                            String name = attr.getName();
-                            if ("xmlns".equals(name) || name.startsWith("xmlns:")) {
-                                if (schema.getAttributeNode(name) == null) {
-                                    schema.setAttributeNodeNS((Attr)doc.importNode(attr, true));
-                                }
-                            }
-                        }
-                        parent = parent.getParentNode();
+                ExtensibilityElement extElement = (ExtensibilityElement)ext;
+                Element element = null;
+                if (XSD_QNAME_LIST.contains(extElement.getElementType())) {
+                    if (extElement instanceof Schema) {
+                        element = ((Schema)extElement).getElement();
+                    } else if (extElement instanceof UnknownExtensibilityElement) {
+                        element = ((UnknownExtensibilityElement)extElement).getElement();
                     }
-                    String baseURI = ((Schema)ext).getDocumentBaseURI();
-                    doc.setDocumentURI(baseURI);
-                    schemaCollection.setBaseUri(baseURI);
-                    schemaCollection.read(doc, baseURI + "#" + index, null);
+                }
+                if (element != null) {
+                    Document doc = promote(element);
+                    XSDefinition xsDefinition = wsdlFactory.createXSDefinition();
+                    xsDefinition.setUnresolved(true);
+                    xsDefinition.setNamespace(element.getAttribute("targetNamespace"));
+                    xsDefinition.setDocument(doc);
+                    xsDefinition.setLocation(URI.create(doc.getDocumentURI() + "#" + index));
+                    contribution.getModelResolver().resolveModel(XSDefinition.class, xsDefinition);
                     index++;
                 }
             }
@@ -341,7 +393,7 @@
                 javax.wsdl.Import anImport = (javax.wsdl.Import)i;
                 // Read inline schemas 
                 if (anImport.getDefinition() != null) {
-                    readInlineSchemas(anImport.getDefinition(), schemaCollection);
+                    readInlineSchemas(wsdlDefinition, anImport.getDefinition());
                 }
             }
         }

Modified: incubator/tuscany/branches/sca-java-1.0.1/modules/interface-wsdl-xml/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/xml/XSDModelResolver.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/branches/sca-java-1.0.1/modules/interface-wsdl-xml/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/xml/XSDModelResolver.java?rev=587778&r1=587777&r2=587778&view=diff
==============================================================================
--- incubator/tuscany/branches/sca-java-1.0.1/modules/interface-wsdl-xml/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/xml/XSDModelResolver.java (original)
+++ incubator/tuscany/branches/sca-java-1.0.1/modules/interface-wsdl-xml/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/xml/XSDModelResolver.java Tue Oct 23 21:30:02 2007
@@ -82,10 +82,18 @@
 
     public <T> T resolveModel(Class<T> modelClass, T unresolved) {
 
+        XSDefinition definition = (XSDefinition)unresolved;
         // Lookup a definition for the given namespace
-        String namespace = ((XSDefinition)unresolved).getNamespace();
+        String namespace = definition.getNamespace();
         List<XSDefinition> list = map.get(namespace);
-        XSDefinition resolved;
+        if (list != null && definition.getDocument() != null) {
+            // Set the document for the inline schema
+            int index = list.indexOf(definition);
+            if (index != -1) {
+                list.get(index).setDocument(definition.getDocument());
+            }
+        }
+        XSDefinition resolved = null;
         try {
             resolved = aggregate(list);
         } catch (IOException e) {
@@ -114,10 +122,26 @@
     }
 
     private void loadOnDemand(XSDefinition definition) throws IOException {
-        if (definition.getSchema() == null && definition.getLocation() != null) {
+        if (definition.getSchema() != null) {
+            return;
+        }
+        if (definition.getDocument() != null) {
+            String uri = null;
+            if (definition.getLocation() != null) {
+                uri = definition.getLocation().toString();
+            }
+            XmlSchema schema = schemaCollection.read(definition.getDocument(), uri, null);
+            definition.setSchemaCollection(schemaCollection);
+            definition.setSchema(schema);
+        } else if (definition.getLocation() != null) {
+            if (definition.getLocation().getFragment() != null) {
+                // It's an inline schema
+                return;
+            }
             // Read an XSD document
             InputSource xsd = XMLDocumentHelper.getInputSource(definition.getLocation().toURL());
             XmlSchema schema = schemaCollection.read(xsd, null);
+            definition.setSchemaCollection(schemaCollection);
             definition.setSchema(schema);
         }
     }
@@ -159,7 +183,7 @@
         aggregated.setSchema(facade);
         aggregated.setNamespace(ns);
         aggregated.setUnresolved(false);
-        
+
         // FIXME: [rfeng] This is hacky
         definitions.clear();
         definitions.add(aggregated);
@@ -171,7 +195,7 @@
      */
     public static class URIResolverImpl implements URIResolver {
         private Contribution contribution;
-        
+
         public URIResolverImpl(Contribution contribution) {
             this.contribution = contribution;
         }

Modified: incubator/tuscany/branches/sca-java-1.0.1/modules/interface-wsdl-xml/src/test/java/org/apache/tuscany/sca/interfacedef/wsdl/introspect/WSDLInterfaceIntrospectorTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/branches/sca-java-1.0.1/modules/interface-wsdl-xml/src/test/java/org/apache/tuscany/sca/interfacedef/wsdl/introspect/WSDLInterfaceIntrospectorTestCase.java?rev=587778&r1=587777&r2=587778&view=diff
==============================================================================
--- incubator/tuscany/branches/sca-java-1.0.1/modules/interface-wsdl-xml/src/test/java/org/apache/tuscany/sca/interfacedef/wsdl/introspect/WSDLInterfaceIntrospectorTestCase.java (original)
+++ incubator/tuscany/branches/sca-java-1.0.1/modules/interface-wsdl-xml/src/test/java/org/apache/tuscany/sca/interfacedef/wsdl/introspect/WSDLInterfaceIntrospectorTestCase.java Tue Oct 23 21:30:02 2007
@@ -27,32 +27,22 @@
 import javax.xml.namespace.QName;
 
 import junit.framework.Assert;
-import junit.framework.TestCase;
 
-import org.apache.tuscany.sca.contribution.DefaultModelFactoryExtensionPoint;
-import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
-import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
 import org.apache.tuscany.sca.interfacedef.DataType;
 import org.apache.tuscany.sca.interfacedef.InvalidInterfaceException;
 import org.apache.tuscany.sca.interfacedef.Operation;
 import org.apache.tuscany.sca.interfacedef.util.XMLType;
-import org.apache.tuscany.sca.interfacedef.wsdl.DefaultWSDLFactory;
+import org.apache.tuscany.sca.interfacedef.wsdl.AbstractWSDLTestCase;
 import org.apache.tuscany.sca.interfacedef.wsdl.WSDLDefinition;
-import org.apache.tuscany.sca.interfacedef.wsdl.WSDLFactory;
 import org.apache.tuscany.sca.interfacedef.wsdl.WSDLInterface;
-import org.apache.tuscany.sca.interfacedef.wsdl.xml.WSDLDocumentProcessor;
-import org.apache.tuscany.sca.interfacedef.wsdl.xml.WSDLModelResolver;
 
 /**
  * Test case for InterfaceWSDLIntrospectorImpl
  */
-public class WSDLInterfaceIntrospectorTestCase extends TestCase {
+public class WSDLInterfaceIntrospectorTestCase extends AbstractWSDLTestCase {
     private static final QName PORTTYPE_NAME = new QName("http://example.com/stockquote.wsdl", "StockQuotePortType");
 
-    private WSDLDocumentProcessor registry;
-    private WSDLFactory wsdlFactory;
     private PortType portType;
-    private ModelResolver resolver;
     private WSDLDefinition definition;
 
     /**
@@ -61,23 +51,17 @@
     @Override
     protected void setUp() throws Exception {
         super.setUp();
-        ModelFactoryExtensionPoint factories = new DefaultModelFactoryExtensionPoint();
-        wsdlFactory = new DefaultWSDLFactory();
-        factories.addFactory(wsdlFactory);
-        javax.wsdl.factory.WSDLFactory wsdl4jFactory = javax.wsdl.factory.WSDLFactory.newInstance();
-        factories.addFactory(wsdl4jFactory);
-        registry = new WSDLDocumentProcessor(factories);
-        resolver = new TestModelResolver();
+
         URL url = getClass().getResource("../xml/stockquote.wsdl");
-        definition = registry.read(null, new URI("stockquote.wsdl"), url);
-        WSDLModelResolver wsdlResolver = new WSDLModelResolver(null, factories);
-        wsdlResolver.addModel(definition);
-        definition = wsdlResolver.resolveModel(WSDLDefinition.class, definition);        portType = definition.getDefinition().getPortType(PORTTYPE_NAME);
+        definition = processor.read(null, new URI("stockquote.wsdl"), url);
+        resolver.addModel(definition);
+        definition = resolver.resolveModel(WSDLDefinition.class, definition);
+        portType = definition.getDefinition().getPortType(PORTTYPE_NAME);
     }
 
     @SuppressWarnings("unchecked")
     public final void testIntrospectPortType() throws InvalidInterfaceException {
-        WSDLInterface contract = wsdlFactory.createWSDLInterface(portType, definition.getInlinedSchemas(), resolver);
+        WSDLInterface contract = wsdlFactory.createWSDLInterface(portType, definition, resolver);
         Assert.assertEquals(contract.getName().getLocalPart(), "StockQuotePortType");
         List<Operation> operations = contract.getOperations();
         Assert.assertEquals(1, operations.size());

Modified: incubator/tuscany/branches/sca-java-1.0.1/modules/interface-wsdl-xml/src/test/java/org/apache/tuscany/sca/interfacedef/wsdl/introspect/WSDLOperationIntrospectorTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/branches/sca-java-1.0.1/modules/interface-wsdl-xml/src/test/java/org/apache/tuscany/sca/interfacedef/wsdl/introspect/WSDLOperationIntrospectorTestCase.java?rev=587778&r1=587777&r2=587778&view=diff
==============================================================================
--- incubator/tuscany/branches/sca-java-1.0.1/modules/interface-wsdl-xml/src/test/java/org/apache/tuscany/sca/interfacedef/wsdl/introspect/WSDLOperationIntrospectorTestCase.java (original)
+++ incubator/tuscany/branches/sca-java-1.0.1/modules/interface-wsdl-xml/src/test/java/org/apache/tuscany/sca/interfacedef/wsdl/introspect/WSDLOperationIntrospectorTestCase.java Tue Oct 23 21:30:02 2007
@@ -28,59 +28,32 @@
 import javax.xml.namespace.QName;
 
 import junit.framework.Assert;
-import junit.framework.TestCase;
 
-import org.apache.tuscany.sca.contribution.DefaultModelFactoryExtensionPoint;
-import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
-import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
 import org.apache.tuscany.sca.interfacedef.DataType;
 import org.apache.tuscany.sca.interfacedef.InvalidInterfaceException;
 import org.apache.tuscany.sca.interfacedef.util.XMLType;
-import org.apache.tuscany.sca.interfacedef.wsdl.DefaultWSDLFactory;
+import org.apache.tuscany.sca.interfacedef.wsdl.AbstractWSDLTestCase;
 import org.apache.tuscany.sca.interfacedef.wsdl.WSDLDefinition;
-import org.apache.tuscany.sca.interfacedef.wsdl.WSDLFactory;
 import org.apache.tuscany.sca.interfacedef.wsdl.impl.WSDLOperationIntrospectorImpl;
-import org.apache.tuscany.sca.interfacedef.wsdl.xml.WSDLDocumentProcessor;
-import org.apache.tuscany.sca.interfacedef.wsdl.xml.WSDLModelResolver;
 
 /**
  * Test case for WSDLOperation
  */
-public class WSDLOperationIntrospectorTestCase extends TestCase {
+public class WSDLOperationIntrospectorTestCase extends AbstractWSDLTestCase {
     private static final QName PORTTYPE_NAME =
         new QName("http://example.com/stockquote.wsdl", "StockQuotePortType");
 
-    private WSDLDocumentProcessor processor;
-    private WSDLModelResolver wsdlResolver;
-    private ModelResolver resolver;
-    private WSDLFactory wsdlFactory;
-
-    /**
-     * @see junit.framework.TestCase#setUp()
-     */
-    @Override
-    protected void setUp() throws Exception {
-        super.setUp();
-        wsdlFactory = new DefaultWSDLFactory();
-        ModelFactoryExtensionPoint factories = new DefaultModelFactoryExtensionPoint();
-        factories.addFactory(wsdlFactory);
-        javax.wsdl.factory.WSDLFactory wsdl4jFactory = javax.wsdl.factory.WSDLFactory.newInstance();
-        factories.addFactory(wsdl4jFactory);
-        processor = new WSDLDocumentProcessor(factories);
-        wsdlResolver = new WSDLModelResolver(null, factories);
-        resolver = new TestModelResolver();
-    }
 
     @SuppressWarnings("unchecked")
     public final void testWrappedOperation() throws Exception {
         URL url = getClass().getResource("../xml/stockquote.wsdl");
         WSDLDefinition definition = processor.read(null, new URI("stockquote.wsdl"), url);
-        wsdlResolver.addModel(definition);
-        definition = wsdlResolver.resolveModel(WSDLDefinition.class, definition);
+        resolver.addModel(definition);
+        definition = resolver.resolveModel(WSDLDefinition.class, definition);
         PortType portType = definition.getDefinition().getPortType(PORTTYPE_NAME);
         Operation operation = portType.getOperation("getLastTradePrice", null, null);
 
-        WSDLOperationIntrospectorImpl op = new WSDLOperationIntrospectorImpl(wsdlFactory, operation, definition.getInlinedSchemas(), "org.w3c.dom.Node", resolver);
+        WSDLOperationIntrospectorImpl op = new WSDLOperationIntrospectorImpl(wsdlFactory, operation, definition, "org.w3c.dom.Node", resolver);
 
         DataType<List<DataType>> inputType = op.getInputType();
         Assert.assertEquals(1, inputType.getLogical().size());
@@ -105,17 +78,17 @@
     public final void testUnwrappedOperation() throws Exception {
         URL url = getClass().getResource("../xml/unwrapped-stockquote.wsdl");
         WSDLDefinition definition = processor.read(null, new URI("unwrapped-stockquote.wsdl"), url);
-        wsdlResolver.addModel(definition);
-        definition = wsdlResolver.resolveModel(WSDLDefinition.class, definition);
+        resolver.addModel(definition);
+        definition = resolver.resolveModel(WSDLDefinition.class, definition);
         PortType portType = definition.getDefinition().getPortType(PORTTYPE_NAME);
 
         Operation operation = portType.getOperation("getLastTradePrice1", null, null);
-        WSDLOperationIntrospectorImpl op = new WSDLOperationIntrospectorImpl(wsdlFactory, operation, definition.getInlinedSchemas(), "org.w3c.dom.Node", resolver);
+        WSDLOperationIntrospectorImpl op = new WSDLOperationIntrospectorImpl(wsdlFactory, operation, definition, "org.w3c.dom.Node", resolver);
         Assert.assertFalse(op.isWrapperStyle());
         Assert.assertEquals(1, op.getInputType().getLogical().size());
 
         operation = portType.getOperation("getLastTradePrice2", null, null);
-        op = new WSDLOperationIntrospectorImpl(wsdlFactory, operation, definition.getInlinedSchemas(), "org.w3c.dom.Node", resolver);
+        op = new WSDLOperationIntrospectorImpl(wsdlFactory, operation, definition, "org.w3c.dom.Node", resolver);
         Assert.assertFalse(op.isWrapperStyle());
         Assert.assertEquals(2, op.getInputType().getLogical().size());
     }
@@ -123,12 +96,12 @@
     public final void testInvalidWSDL() throws Exception {
         URL url = getClass().getResource("../xml/invalid-stockquote.wsdl");
         WSDLDefinition definition = processor.read(null, new URI("invalid-stockquote.wsdl"), url);
-        wsdlResolver.addModel(definition);
-        definition = wsdlResolver.resolveModel(WSDLDefinition.class, definition);
+        resolver.addModel(definition);
+        definition = resolver.resolveModel(WSDLDefinition.class, definition);
         PortType portType = definition.getDefinition().getPortType(PORTTYPE_NAME);
 
         Operation operation = portType.getOperation("getLastTradePrice", null, null);
-        WSDLOperationIntrospectorImpl op = new WSDLOperationIntrospectorImpl(wsdlFactory, operation, definition.getInlinedSchemas(), "org.w3c.dom.Node", resolver);
+        WSDLOperationIntrospectorImpl op = new WSDLOperationIntrospectorImpl(wsdlFactory, operation, definition, "org.w3c.dom.Node", resolver);
 
         try {
             op.isWrapperStyle();

Modified: incubator/tuscany/branches/sca-java-1.0.1/modules/interface-wsdl-xml/src/test/java/org/apache/tuscany/sca/interfacedef/wsdl/introspect/WrapperStyleOperationTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/branches/sca-java-1.0.1/modules/interface-wsdl-xml/src/test/java/org/apache/tuscany/sca/interfacedef/wsdl/introspect/WrapperStyleOperationTestCase.java?rev=587778&r1=587777&r2=587778&view=diff
==============================================================================
--- incubator/tuscany/branches/sca-java-1.0.1/modules/interface-wsdl-xml/src/test/java/org/apache/tuscany/sca/interfacedef/wsdl/introspect/WrapperStyleOperationTestCase.java (original)
+++ incubator/tuscany/branches/sca-java-1.0.1/modules/interface-wsdl-xml/src/test/java/org/apache/tuscany/sca/interfacedef/wsdl/introspect/WrapperStyleOperationTestCase.java Tue Oct 23 21:30:02 2007
@@ -27,53 +27,25 @@
 import javax.xml.namespace.QName;
 
 import junit.framework.Assert;
-import junit.framework.TestCase;
 
-import org.apache.tuscany.sca.contribution.DefaultModelFactoryExtensionPoint;
-import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
-import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
-import org.apache.tuscany.sca.interfacedef.wsdl.DefaultWSDLFactory;
+import org.apache.tuscany.sca.interfacedef.wsdl.AbstractWSDLTestCase;
 import org.apache.tuscany.sca.interfacedef.wsdl.WSDLDefinition;
-import org.apache.tuscany.sca.interfacedef.wsdl.WSDLFactory;
 import org.apache.tuscany.sca.interfacedef.wsdl.impl.WSDLOperationIntrospectorImpl;
-import org.apache.tuscany.sca.interfacedef.wsdl.xml.WSDLDocumentProcessor;
-import org.apache.tuscany.sca.interfacedef.wsdl.xml.WSDLModelResolver;
 
 /**
  * Test case for WSDLOperation
  */
-public class WrapperStyleOperationTestCase extends TestCase {
+public class WrapperStyleOperationTestCase extends AbstractWSDLTestCase {
     private static final QName PORTTYPE_NAME = new QName("http://example.com/stockquote.wsdl", "StockQuotePortType");
 
-    private WSDLDocumentProcessor registry;
-    private ModelResolver resolver;
-    private WSDLFactory wsdlFactory;
-    private WSDLModelResolver wsdlResolver;
-
-    /**
-     * @see junit.framework.TestCase#setUp()
-     */
-    @Override
-    protected void setUp() throws Exception {
-        super.setUp();
-        ModelFactoryExtensionPoint factories = new DefaultModelFactoryExtensionPoint(); 
-        wsdlFactory = new DefaultWSDLFactory();
-        factories.addFactory(wsdlFactory); 
-        javax.wsdl.factory.WSDLFactory wsdl4jFactory = javax.wsdl.factory.WSDLFactory.newInstance();
-        factories.addFactory(wsdl4jFactory);
-        registry = new WSDLDocumentProcessor(factories);
-        resolver = new TestModelResolver();
-        wsdlResolver = new WSDLModelResolver(null, factories);
-    }
-
     public final void testWrappedOperation() throws Exception {
         URL url = getClass().getResource("../xml/stockquote.wsdl");
-        WSDLDefinition definition = registry.read(null, new URI("stockquote.wsdl"), url);
-        wsdlResolver.addModel(definition);
-        definition = wsdlResolver.resolveModel(WSDLDefinition.class, definition);
+        WSDLDefinition definition = processor.read(null, new URI("stockquote.wsdl"), url);
+        resolver.addModel(definition);
+        definition = resolver.resolveModel(WSDLDefinition.class, definition);
         PortType portType = definition.getDefinition().getPortType(PORTTYPE_NAME);
         Operation operation = portType.getOperation("getLastTradePrice", null, null);
-        WSDLOperationIntrospectorImpl op = new WSDLOperationIntrospectorImpl(wsdlFactory, operation, definition.getInlinedSchemas(), "org.w3c.dom.Node", resolver);
+        WSDLOperationIntrospectorImpl op = new WSDLOperationIntrospectorImpl(wsdlFactory, operation, definition, "org.w3c.dom.Node", resolver);
         Assert.assertTrue(op.isWrapperStyle());
         Assert.assertEquals(1, op.getWrapper().getInputChildElements().size());
         Assert.assertEquals(1, op.getWrapper().getOutputChildElements().size());
@@ -81,15 +53,15 @@
 
     public final void testUnwrappedOperation() throws Exception {
         URL url = getClass().getResource("../xml/unwrapped-stockquote.wsdl");
-        WSDLDefinition definition = registry.read(null, new URI("unwrapped-stockquote.wsdl"), url);
-        wsdlResolver.addModel(definition);
-        definition = wsdlResolver.resolveModel(WSDLDefinition.class, definition);
+        WSDLDefinition definition = processor.read(null, new URI("unwrapped-stockquote.wsdl"), url);
+        resolver.addModel(definition);
+        definition = resolver.resolveModel(WSDLDefinition.class, definition);
         PortType portType = definition.getDefinition().getPortType(PORTTYPE_NAME);
         Operation operation = portType.getOperation("getLastTradePrice1", null, null);
-        WSDLOperationIntrospectorImpl op = new WSDLOperationIntrospectorImpl(wsdlFactory, operation, definition.getInlinedSchemas(), "org.w3c.dom.Node", resolver);
+        WSDLOperationIntrospectorImpl op = new WSDLOperationIntrospectorImpl(wsdlFactory, operation, definition, "org.w3c.dom.Node", resolver);
         Assert.assertFalse(op.isWrapperStyle());
         operation = portType.getOperation("getLastTradePrice2", null, null);
-        op = new WSDLOperationIntrospectorImpl(wsdlFactory, operation, definition.getInlinedSchemas(), "org.w3c.dom.Node", resolver);
+        op = new WSDLOperationIntrospectorImpl(wsdlFactory, operation, definition, "org.w3c.dom.Node", resolver);
         Assert.assertFalse(op.isWrapperStyle());
     }
 

Modified: incubator/tuscany/branches/sca-java-1.0.1/modules/interface-wsdl-xml/src/test/java/org/apache/tuscany/sca/interfacedef/wsdl/xml/ReadTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/branches/sca-java-1.0.1/modules/interface-wsdl-xml/src/test/java/org/apache/tuscany/sca/interfacedef/wsdl/xml/ReadTestCase.java?rev=587778&r1=587777&r2=587778&view=diff
==============================================================================
--- incubator/tuscany/branches/sca-java-1.0.1/modules/interface-wsdl-xml/src/test/java/org/apache/tuscany/sca/interfacedef/wsdl/xml/ReadTestCase.java (original)
+++ incubator/tuscany/branches/sca-java-1.0.1/modules/interface-wsdl-xml/src/test/java/org/apache/tuscany/sca/interfacedef/wsdl/xml/ReadTestCase.java Tue Oct 23 21:30:02 2007
@@ -47,6 +47,7 @@
 import org.apache.tuscany.sca.interfacedef.impl.InterfaceContractMapperImpl;
 import org.apache.tuscany.sca.interfacedef.wsdl.DefaultWSDLFactory;
 import org.apache.tuscany.sca.interfacedef.wsdl.WSDLFactory;
+import org.apache.tuscany.sca.policy.DefaultIntentAttachPointTypeFactory;
 import org.apache.tuscany.sca.policy.DefaultPolicyFactory;
 import org.apache.tuscany.sca.policy.PolicyFactory;
 
@@ -118,7 +119,7 @@
         Composite composite = compositeProcessor.read(reader);
         assertNotNull(composite);
 
-        CompositeBuilderImpl compositeUtil = new CompositeBuilderImpl(assemblyFactory, scaBindingFactory, mapper, null, null);
+        CompositeBuilderImpl compositeUtil = new CompositeBuilderImpl(assemblyFactory, scaBindingFactory, new DefaultIntentAttachPointTypeFactory(), mapper, null, null);
         compositeUtil.build(composite);
 
         //new PrintUtil(System.out).print(composite);

Modified: incubator/tuscany/branches/sca-java-1.0.1/modules/interface-wsdl-xml/src/test/java/org/apache/tuscany/sca/interfacedef/wsdl/xml/WSDLDocumentProcessorTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/branches/sca-java-1.0.1/modules/interface-wsdl-xml/src/test/java/org/apache/tuscany/sca/interfacedef/wsdl/xml/WSDLDocumentProcessorTestCase.java?rev=587778&r1=587777&r2=587778&view=diff
==============================================================================
--- incubator/tuscany/branches/sca-java-1.0.1/modules/interface-wsdl-xml/src/test/java/org/apache/tuscany/sca/interfacedef/wsdl/xml/WSDLDocumentProcessorTestCase.java (original)
+++ incubator/tuscany/branches/sca-java-1.0.1/modules/interface-wsdl-xml/src/test/java/org/apache/tuscany/sca/interfacedef/wsdl/xml/WSDLDocumentProcessorTestCase.java Tue Oct 23 21:30:02 2007
@@ -28,11 +28,8 @@
 
 import junit.framework.Assert;
 
-import org.apache.tuscany.sca.contribution.DefaultModelFactoryExtensionPoint;
-import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
-import org.apache.tuscany.sca.interfacedef.wsdl.DefaultWSDLFactory;
+import org.apache.tuscany.sca.interfacedef.wsdl.AbstractWSDLTestCase;
 import org.apache.tuscany.sca.interfacedef.wsdl.WSDLDefinition;
-import org.apache.tuscany.sca.interfacedef.wsdl.WSDLFactory;
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
@@ -40,22 +37,14 @@
 /**
  * @version $Rev$ $Date$
  */
-public class WSDLDocumentProcessorTestCase {
-    private WSDLDocumentProcessor processor;
-    private WSDLFactory wsdlFactory;
-    private javax.wsdl.factory.WSDLFactory wsdl4jFactory;
+public class WSDLDocumentProcessorTestCase extends AbstractWSDLTestCase {
 
     /**
      * @throws java.lang.Exception
      */
     @Before
     public void setUp() throws Exception {
-        ModelFactoryExtensionPoint modelFactories = new DefaultModelFactoryExtensionPoint();
-        wsdlFactory = new DefaultWSDLFactory();
-        modelFactories.addFactory(wsdlFactory);
-        wsdl4jFactory = javax.wsdl.factory.WSDLFactory.newInstance();
-        modelFactories.addFactory(wsdl4jFactory);
-        processor = new WSDLDocumentProcessor(modelFactories);
+        super.setUp();
     }
 
     /**
@@ -67,26 +56,29 @@
 
     @Test
     public void testWSDL() throws Exception {
+       
         URL url = getClass().getResource("/wsdl/helloworld-service.wsdl");
         WSDLDefinition definition = processor.read(null, URI.create("wsdl/helloworld-service.wsdl"), url);
+        
         Assert.assertNull(definition.getDefinition());
         Assert.assertEquals("http://helloworld", definition.getNamespace());
         URL url1 = getClass().getResource("/wsdl/helloworld-interface.wsdl");
         WSDLDefinition definition1 = processor.read(null, URI.create("wsdl/helloworld-interface.wsdl"), url1);
         Assert.assertNull(definition1.getDefinition());
         Assert.assertEquals("http://helloworld", definition1.getNamespace());
-        ModelFactoryExtensionPoint factories = new DefaultModelFactoryExtensionPoint();
-        factories.addFactory(wsdlFactory);
-        factories.addFactory(wsdl4jFactory);
-        WSDLModelResolver resolver = new WSDLModelResolver(null, factories);
+
         resolver.addModel(definition);
         resolver.addModel(definition1);
+        resolver.resolveModel(WSDLDefinition.class, definition);
+        resolver.resolveModel(WSDLDefinition.class, definition1);
         WSDLDefinition resolved = resolver.resolveModel(WSDLDefinition.class, definition);
         List imports = (List)definition.getDefinition().getImports().get("http://helloworld");
         Assert.assertNotNull(imports);
         Assert.assertNotNull(((Import)imports.get(0)).getDefinition());
         Assert.assertNotNull(resolved.getDefinition().getPortType(new QName("http://helloworld", "HelloWorld")));
         Assert.assertNotNull(resolved.getDefinition().getService(new QName("http://helloworld", "HelloWorldService")));
+        
+        assertNotNull(resolved.getXmlSchemaType(new QName("http://greeting", "Name")));
     }
 
 }

Modified: incubator/tuscany/branches/sca-java-1.0.1/modules/interface-wsdl-xml/src/test/resources/wsdl/helloworld-interface.wsdl
URL: http://svn.apache.org/viewvc/incubator/tuscany/branches/sca-java-1.0.1/modules/interface-wsdl-xml/src/test/resources/wsdl/helloworld-interface.wsdl?rev=587778&r1=587777&r2=587778&view=diff
==============================================================================
--- incubator/tuscany/branches/sca-java-1.0.1/modules/interface-wsdl-xml/src/test/resources/wsdl/helloworld-interface.wsdl (original)
+++ incubator/tuscany/branches/sca-java-1.0.1/modules/interface-wsdl-xml/src/test/resources/wsdl/helloworld-interface.wsdl Tue Oct 23 21:30:02 2007
@@ -25,7 +25,10 @@
         <schema elementFormDefault="qualified" targetNamespace="http://helloworld"
             xmlns="http://www.w3.org/2001/XMLSchema" xmlns:g="http://greeting">
 
-            <import namespace="http://greeting" schemaLocation="../xsd/greeting.xsd" />
+            <!-- 
+                <import namespace="http://greeting" schemaLocation="../xsd/greeting.xsd" />
+            -->
+            <include schemaLocation="../xsd/helloworld.xsd" />
 
             <element name="getGreetings">
                 <complexType>

Modified: incubator/tuscany/branches/sca-java-1.0.1/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/WSDLDefinition.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/branches/sca-java-1.0.1/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/WSDLDefinition.java?rev=587778&r1=587777&r2=587778&view=diff
==============================================================================
--- incubator/tuscany/branches/sca-java-1.0.1/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/WSDLDefinition.java (original)
+++ incubator/tuscany/branches/sca-java-1.0.1/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/WSDLDefinition.java Tue Oct 23 21:30:02 2007
@@ -23,9 +23,11 @@
 import java.util.List;
 
 import javax.wsdl.Definition;
+import javax.xml.namespace.QName;
 
 import org.apache.tuscany.sca.assembly.Base;
-import org.apache.ws.commons.schema.XmlSchemaCollection;
+import org.apache.ws.commons.schema.XmlSchemaElement;
+import org.apache.ws.commons.schema.XmlSchemaType;
 
 /**
  * Represents a WSDL definition.
@@ -48,12 +50,6 @@
     void setDefinition(Definition definition);
     
     /**
-     * Returns a list of XML schemas inlined in this WSDL definition.
-     * @return
-     */
-    XmlSchemaCollection getInlinedSchemas();
-    
-    /**
      * Returns the namespace of this WSDL definition.
      * @return the namespace of this WSDL definition
      */
@@ -72,4 +68,8 @@
     
     URI getLocation();
     void setLocation(URI url);
+    
+    XmlSchemaElement getXmlSchemaElement(QName name);
+    XmlSchemaType getXmlSchemaType(QName name);
+    
 }

Modified: incubator/tuscany/branches/sca-java-1.0.1/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/WSDLFactory.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/branches/sca-java-1.0.1/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/WSDLFactory.java?rev=587778&r1=587777&r2=587778&view=diff
==============================================================================
--- incubator/tuscany/branches/sca-java-1.0.1/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/WSDLFactory.java (original)
+++ incubator/tuscany/branches/sca-java-1.0.1/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/WSDLFactory.java Tue Oct 23 21:30:02 2007
@@ -22,7 +22,6 @@
 
 import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
 import org.apache.tuscany.sca.interfacedef.InvalidInterfaceException;
-import org.apache.ws.commons.schema.XmlSchemaCollection;
 
 /**
  * Factory for the WSDL model.
@@ -44,7 +43,7 @@
      * @param portType the portType to inspect
      * @return a WSDLInterface corresponding to the WSDL portType
      */
-    WSDLInterface createWSDLInterface(PortType portType, XmlSchemaCollection inlineSchemas, ModelResolver resolver) throws InvalidInterfaceException;
+    WSDLInterface createWSDLInterface(PortType portType, WSDLDefinition wsdlDefinition, ModelResolver resolver) throws InvalidInterfaceException;
 
     /**
      * Creates the contents of a WSDL interface from a WSDL portType.
@@ -52,7 +51,7 @@
      * @param portType the portType to inspect
      * @return a WSDLInterface corresponding to the WSDL portType
      */
-    void createWSDLInterface(WSDLInterface wsdlInterface, PortType portType, XmlSchemaCollection inlineSchemas, ModelResolver resolver) throws InvalidInterfaceException;
+    void createWSDLInterface(WSDLInterface wsdlInterface, PortType portType, WSDLDefinition wsdlDefinition, ModelResolver resolver) throws InvalidInterfaceException;
 
     /**
      * Creates a new WSDL definition.

Modified: incubator/tuscany/branches/sca-java-1.0.1/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/XSDefinition.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/branches/sca-java-1.0.1/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/XSDefinition.java?rev=587778&r1=587777&r2=587778&view=diff
==============================================================================
--- incubator/tuscany/branches/sca-java-1.0.1/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/XSDefinition.java (original)
+++ incubator/tuscany/branches/sca-java-1.0.1/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/XSDefinition.java Tue Oct 23 21:30:02 2007
@@ -21,8 +21,14 @@
 
 import java.net.URI;
 
+import javax.xml.namespace.QName;
+
 import org.apache.tuscany.sca.assembly.Base;
 import org.apache.ws.commons.schema.XmlSchema;
+import org.apache.ws.commons.schema.XmlSchemaCollection;
+import org.apache.ws.commons.schema.XmlSchemaElement;
+import org.apache.ws.commons.schema.XmlSchemaType;
+import org.w3c.dom.Document;
 
 /**
  * Represents an XML Schema definition.
@@ -30,19 +36,22 @@
  * @version $Rev$ $Date$
  */
 public interface XSDefinition extends Base {
-    
+    XmlSchemaCollection getSchemaCollection();
+
+    void setSchemaCollection(XmlSchemaCollection schemaCollection);
+
     /**
      * Returns the XmlSchema definition model
      * @return the XmlSchema definition model
      */
     XmlSchema getSchema();
-    
+
     /**
      * Sets the XmlSchema definition model
      * @param definition the XmlSchema definition model
      */
     void setSchema(XmlSchema definition);
-    
+
     /**
      * Returns the namespace of this XmlSchema definition.
      * @return the namespace of this XmlSchema definition
@@ -54,7 +63,32 @@
      * @param namespace the namespace of this XmlSchema definition
      */
     void setNamespace(String namespace);
-    
+
+    /**
+     * Get the location of the XSD
+     * @return
+     */
     URI getLocation();
+
+    /**
+     * Set the location of the XSD
+     * @param uri
+     */
     void setLocation(URI uri);
+
+    /**
+     * Get the DOM representation of the XSD
+     * @return
+     */
+    Document getDocument();
+
+    /**
+     * Set the DOM representation of the XSD
+     * @param document
+     */
+    void setDocument(Document document);
+
+    XmlSchemaElement getXmlSchemaElement(QName name);
+
+    XmlSchemaType getXmlSchemaType(QName name);
 }

Modified: incubator/tuscany/branches/sca-java-1.0.1/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/impl/WSDLDefinitionImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/branches/sca-java-1.0.1/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/impl/WSDLDefinitionImpl.java?rev=587778&r1=587777&r2=587778&view=diff
==============================================================================
--- incubator/tuscany/branches/sca-java-1.0.1/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/impl/WSDLDefinitionImpl.java (original)
+++ incubator/tuscany/branches/sca-java-1.0.1/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/impl/WSDLDefinitionImpl.java Tue Oct 23 21:30:02 2007
@@ -19,15 +19,21 @@
 
 package org.apache.tuscany.sca.interfacedef.wsdl.impl;
 
+import static org.apache.tuscany.sca.interfacedef.wsdl.impl.XSDefinitionImpl.getXmlSchemaObject;
+
 import java.net.URI;
 import java.util.ArrayList;
 import java.util.List;
 
 import javax.wsdl.Definition;
+import javax.xml.namespace.QName;
 
 import org.apache.tuscany.sca.interfacedef.wsdl.WSDLDefinition;
 import org.apache.tuscany.sca.interfacedef.wsdl.XSDefinition;
+import org.apache.ws.commons.schema.XmlSchema;
 import org.apache.ws.commons.schema.XmlSchemaCollection;
+import org.apache.ws.commons.schema.XmlSchemaElement;
+import org.apache.ws.commons.schema.XmlSchemaType;
 
 /**
  * Represents a WSDL definition.
@@ -35,14 +41,13 @@
  * @version $Rev$ $Date$
  */
 public class WSDLDefinitionImpl implements WSDLDefinition {
-    
+
     private Definition definition;
     private String namespace;
     private URI location;
-    private XmlSchemaCollection inlineSchemas = new XmlSchemaCollection();
     private List<XSDefinition> schemas = new ArrayList<XSDefinition>();
     private boolean unresolved;
-    
+
     protected WSDLDefinitionImpl() {
     }
 
@@ -53,10 +58,6 @@
     public void setDefinition(Definition definition) {
         this.definition = definition;
     }
-    
-    public XmlSchemaCollection getInlinedSchemas() {
-        return inlineSchemas;
-    }
 
     public boolean isUnresolved() {
         return unresolved;
@@ -65,7 +66,7 @@
     public void setUnresolved(boolean undefined) {
         this.unresolved = undefined;
     }
-    
+
     public String getNamespace() {
         if (isUnresolved()) {
             return namespace;
@@ -75,7 +76,7 @@
             return namespace;
         }
     }
-    
+
     public void setNamespace(String namespace) {
         if (!isUnresolved()) {
             throw new IllegalStateException();
@@ -83,7 +84,7 @@
             this.namespace = namespace;
         }
     }
-    
+
     /*
     @Override
     public int hashCode() {
@@ -126,6 +127,85 @@
      */
     public void setLocation(URI url) {
         this.location = url;
+    }
+
+    /**
+     * @see java.lang.Object#hashCode()
+     */
+    @Override
+    public int hashCode() {
+        final int prime = 31;
+        int result = 1;
+        result = prime * result + ((location == null) ? 0 : location.hashCode());
+        result = prime * result + ((namespace == null) ? 0 : namespace.hashCode());
+        return result;
+    }
+
+    /**
+     * @see java.lang.Object#equals(java.lang.Object)
+     */
+    @Override
+    public boolean equals(Object obj) {
+        if (this == obj)
+            return true;
+        if (obj == null)
+            return false;
+        if (!(obj instanceof WSDLDefinitionImpl))
+            return false;
+        final WSDLDefinitionImpl other = (WSDLDefinitionImpl)obj;
+        if (location == null) {
+            if (other.location != null)
+                return false;
+        } else if (!location.equals(other.location))
+            return false;
+        if (namespace == null) {
+            if (other.namespace != null)
+                return false;
+        } else if (!namespace.equals(other.namespace))
+            return false;
+        return true;
+    }
+
+    /**
+     * @see org.apache.tuscany.sca.interfacedef.wsdl.WSDLDefinition#getXmlSchemaElement(javax.xml.namespace.QName)
+     */
+    public XmlSchemaElement getXmlSchemaElement(QName name) {
+        XmlSchemaCollection schemaCollection = null;
+        for (XSDefinition xsd : schemas) {
+            if (schemaCollection == null && xsd.getSchemaCollection() != null) {
+                schemaCollection = xsd.getSchemaCollection();
+            }
+            XmlSchema schema = xsd.getSchema();
+            XmlSchemaElement element = getXmlSchemaObject(schema, name, XmlSchemaElement.class);
+            if (element != null) {
+                return element;
+            }
+        }
+        if (schemaCollection != null) {
+            return schemaCollection.getElementByQName(name);
+        }
+        return null;
+    }
+
+    /**
+     * @see org.apache.tuscany.sca.interfacedef.wsdl.WSDLDefinition#getXmlSchemaType(javax.xml.namespace.QName)
+     */
+    public XmlSchemaType getXmlSchemaType(QName name) {
+        XmlSchemaCollection schemaCollection = null;
+        for (XSDefinition xsd : schemas) {
+            if (xsd.getSchemaCollection() != null) {
+                schemaCollection = xsd.getSchemaCollection();
+            }
+            XmlSchema schema = xsd.getSchema();
+            XmlSchemaType type = getXmlSchemaObject(schema, name, XmlSchemaType.class);
+            if (type != null) {
+                return type;
+            }
+        }
+        if (schemaCollection != null) {
+            return schemaCollection.getTypeByQName(name);
+        }
+        return null;
     }
 
 }

Modified: incubator/tuscany/branches/sca-java-1.0.1/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/impl/WSDLFactoryImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/branches/sca-java-1.0.1/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/impl/WSDLFactoryImpl.java?rev=587778&r1=587777&r2=587778&view=diff
==============================================================================
--- incubator/tuscany/branches/sca-java-1.0.1/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/impl/WSDLFactoryImpl.java (original)
+++ incubator/tuscany/branches/sca-java-1.0.1/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/impl/WSDLFactoryImpl.java Tue Oct 23 21:30:02 2007
@@ -27,7 +27,6 @@
 import org.apache.tuscany.sca.interfacedef.wsdl.WSDLInterface;
 import org.apache.tuscany.sca.interfacedef.wsdl.WSDLInterfaceContract;
 import org.apache.tuscany.sca.interfacedef.wsdl.XSDefinition;
-import org.apache.ws.commons.schema.XmlSchemaCollection;
 
 /**
  * A factory for the WSDL model.
@@ -46,14 +45,14 @@
         return new WSDLInterfaceImpl();
     }
     
-    public WSDLInterface createWSDLInterface(PortType portType, XmlSchemaCollection inlineSchemas, ModelResolver resolver) throws InvalidInterfaceException {
+    public WSDLInterface createWSDLInterface(PortType portType, WSDLDefinition wsdlDefinition, ModelResolver resolver) throws InvalidInterfaceException {
         WSDLInterface wsdlInterface = createWSDLInterface();
-        introspector.introspectPortType(wsdlInterface, portType, inlineSchemas, resolver);
+        introspector.introspectPortType(wsdlInterface, portType, wsdlDefinition, resolver);
         return wsdlInterface;
     }
     
-    public void createWSDLInterface(WSDLInterface wsdlInterface, PortType portType, XmlSchemaCollection inlineSchemas, ModelResolver resolver) throws InvalidInterfaceException {
-        introspector.introspectPortType(wsdlInterface, portType, inlineSchemas, resolver);
+    public void createWSDLInterface(WSDLInterface wsdlInterface, PortType portType, WSDLDefinition wsdlDefinition, ModelResolver resolver) throws InvalidInterfaceException {
+        introspector.introspectPortType(wsdlInterface, portType, wsdlDefinition, resolver);
     }
     
     public WSDLDefinition createWSDLDefinition() {

Modified: incubator/tuscany/branches/sca-java-1.0.1/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/impl/WSDLInterfaceIntrospectorImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/branches/sca-java-1.0.1/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/impl/WSDLInterfaceIntrospectorImpl.java?rev=587778&r1=587777&r2=587778&view=diff
==============================================================================
--- incubator/tuscany/branches/sca-java-1.0.1/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/impl/WSDLInterfaceIntrospectorImpl.java (original)
+++ incubator/tuscany/branches/sca-java-1.0.1/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/impl/WSDLInterfaceIntrospectorImpl.java Tue Oct 23 21:30:02 2007
@@ -26,9 +26,9 @@
 
 import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
 import org.apache.tuscany.sca.interfacedef.Operation;
+import org.apache.tuscany.sca.interfacedef.wsdl.WSDLDefinition;
 import org.apache.tuscany.sca.interfacedef.wsdl.WSDLFactory;
 import org.apache.tuscany.sca.interfacedef.wsdl.WSDLInterface;
-import org.apache.ws.commons.schema.XmlSchemaCollection;
 
 /**
  * Introspector for creating WSDLInterface definitions from WSDL PortTypes.
@@ -42,19 +42,19 @@
     }
 
     // FIXME: Do we want to deal with document-literal wrapped style based on the JAX-WS spec?
-    private List<Operation> introspectOperations(PortType portType, XmlSchemaCollection inlineSchemas, ModelResolver resolver) throws InvalidWSDLException {
+    private List<Operation> introspectOperations(PortType portType, WSDLDefinition wsdlDefinition, ModelResolver resolver) throws InvalidWSDLException {
         List<Operation> operations = new ArrayList<Operation>();
         for (Object o : portType.getOperations()) {
             javax.wsdl.Operation wsdlOp = (javax.wsdl.Operation)o;
-            WSDLOperationIntrospectorImpl op = new WSDLOperationIntrospectorImpl(wsdlFactory, wsdlOp, inlineSchemas, null, resolver);
+            WSDLOperationIntrospectorImpl op = new WSDLOperationIntrospectorImpl(wsdlFactory, wsdlOp, wsdlDefinition, null, resolver);
             operations.add(op.getOperation());
         }
         return operations;
     }
 
-    public void introspectPortType(WSDLInterface wsdlInterface, PortType portType, XmlSchemaCollection inlineSchemas, ModelResolver resolver) throws InvalidWSDLException {
+    public void introspectPortType(WSDLInterface wsdlInterface, PortType portType, WSDLDefinition wsdlDefinition, ModelResolver resolver) throws InvalidWSDLException {
         wsdlInterface.setPortType(portType);
-        wsdlInterface.getOperations().addAll(introspectOperations(portType, inlineSchemas, resolver));
+        wsdlInterface.getOperations().addAll(introspectOperations(portType, wsdlDefinition, resolver));
         // FIXME: set to Non-conversational for now
         wsdlInterface.setConversational(false);
     }

Modified: incubator/tuscany/branches/sca-java-1.0.1/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/impl/WSDLOperationIntrospectorImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/branches/sca-java-1.0.1/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/impl/WSDLOperationIntrospectorImpl.java?rev=587778&r1=587777&r2=587778&view=diff
==============================================================================
--- incubator/tuscany/branches/sca-java-1.0.1/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/impl/WSDLOperationIntrospectorImpl.java (original)
+++ incubator/tuscany/branches/sca-java-1.0.1/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/impl/WSDLOperationIntrospectorImpl.java Tue Oct 23 21:30:02 2007
@@ -23,6 +23,8 @@
 import java.util.Collection;
 import java.util.Collections;
 import java.util.List;
+import java.util.logging.Level;
+import java.util.logging.Logger;
 
 import javax.wsdl.Fault;
 import javax.wsdl.Input;
@@ -42,9 +44,9 @@
 import org.apache.tuscany.sca.interfacedef.util.TypeInfo;
 import org.apache.tuscany.sca.interfacedef.util.WrapperInfo;
 import org.apache.tuscany.sca.interfacedef.util.XMLType;
+import org.apache.tuscany.sca.interfacedef.wsdl.WSDLDefinition;
 import org.apache.tuscany.sca.interfacedef.wsdl.WSDLFactory;
 import org.apache.tuscany.sca.interfacedef.wsdl.XSDefinition;
-import org.apache.ws.commons.schema.XmlSchemaCollection;
 import org.apache.ws.commons.schema.XmlSchemaComplexType;
 import org.apache.ws.commons.schema.XmlSchemaElement;
 import org.apache.ws.commons.schema.XmlSchemaObject;
@@ -60,9 +62,11 @@
  * @version $Rev$ $Date$
  */
 public class WSDLOperationIntrospectorImpl {
+    private static final Logger logger = Logger.getLogger(WSDLOperationIntrospectorImpl.class.getName());
+    
     private WSDLFactory wsdlFactory;
     private ModelResolver resolver;
-    private XmlSchemaCollection inlineSchemas;
+    private WSDLDefinition wsdlDefinition;
     private javax.wsdl.Operation operation;
     private Operation operationModel;
     private DataType<List<DataType>> inputType;
@@ -78,13 +82,13 @@
     public WSDLOperationIntrospectorImpl(
                          WSDLFactory wsdlFactory,
                          javax.wsdl.Operation operation,
-                         XmlSchemaCollection inlineSchemas,
+                         WSDLDefinition wsdlDefinition,
                          String dataBinding,
                          ModelResolver resolver) {
         super();
         this.wsdlFactory = wsdlFactory;
         this.operation = operation;
-        this.inlineSchemas = inlineSchemas;
+        this.wsdlDefinition = wsdlDefinition;
         this.resolver = resolver;
         this.dataBinding = dataBinding;
         this.wrapper = new Wrapper();
@@ -145,7 +149,10 @@
             if (outputParts != null && outputParts.size() > 0) {
                 if (outputParts.size() > 1) {
                     // We don't support output with multiple parts
-                    throw new InvalidWSDLException("Multi-part output is not supported");
+                	if(logger.isLoggable(Level.WARNING)) {
+                		logger.warning("Multi-part output is not supported, please use BARE parameter style.");
+                	}
+                    // throw new InvalidWSDLException("Multi-part output is not supported");
                 }
                 Part part = (Part)outputParts.get(0);
                 outputType = new WSDLPart(part, Object.class).getDataType();
@@ -216,7 +223,8 @@
     }
     
     private XmlSchemaElement getElement(QName elementName) {
-        XmlSchemaElement element = inlineSchemas.getElementByQName(elementName);
+        
+        XmlSchemaElement element = wsdlDefinition.getXmlSchemaElement(elementName);
         if (element == null) {
             XSDefinition definition = wsdlFactory.createXSDefinition();
             definition.setUnresolved(true);
@@ -230,7 +238,7 @@
     }
     
     private XmlSchemaType getType(QName typeName) {
-        XmlSchemaType type = inlineSchemas.getTypeByQName(typeName);
+        XmlSchemaType type = wsdlDefinition.getXmlSchemaType(typeName);
         if (type == null) {
             XSDefinition definition = wsdlFactory.createXSDefinition();
             definition.setNamespace(typeName.getNamespaceURI());
@@ -378,11 +386,16 @@
                 }
                 XmlSchemaElement childElement = (XmlSchemaElement)schemaObject;
                 if (childElement.getName() == null || childElement.getRefName() != null) {
-                    return null;
+                    // FIXME: [rfeng] Not very clear if the JAX-WS spec allows element-ref
+                    // return null;
                 }
                 // TODO: Do we support maxOccurs >1 ?
                 if (childElement.getMaxOccurs() > 1) {
-                    return null;
+                    // TODO: [rfeng] To be implemented
+                	if(logger.isLoggable(Level.WARNING)) {
+                		logger.warning("Support for elements with maxOccurs>1 is not implemented.");
+                	}
+                    // return null;
                 }
                 childElements.add(childElement);
             }
@@ -454,8 +467,7 @@
                     return null;
                 }
                 outputElements = getChildElements(outputWrapperElement);
-                // FIXME: Do we support multiple child elements for the
-                // response?
+                // FIXME: Do we support multiple child elements for the response?
                 return outputElements;
             } else {
                 return null;

Modified: incubator/tuscany/branches/sca-java-1.0.1/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/impl/XSDefinitionImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/branches/sca-java-1.0.1/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/impl/XSDefinitionImpl.java?rev=587778&r1=587777&r2=587778&view=diff
==============================================================================
--- incubator/tuscany/branches/sca-java-1.0.1/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/impl/XSDefinitionImpl.java (original)
+++ incubator/tuscany/branches/sca-java-1.0.1/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/impl/XSDefinitionImpl.java Tue Oct 23 21:30:02 2007
@@ -20,9 +20,19 @@
 package org.apache.tuscany.sca.interfacedef.wsdl.impl;
 
 import java.net.URI;
+import java.util.Iterator;
+
+import javax.xml.namespace.QName;
 
 import org.apache.tuscany.sca.interfacedef.wsdl.XSDefinition;
 import org.apache.ws.commons.schema.XmlSchema;
+import org.apache.ws.commons.schema.XmlSchemaCollection;
+import org.apache.ws.commons.schema.XmlSchemaElement;
+import org.apache.ws.commons.schema.XmlSchemaImport;
+import org.apache.ws.commons.schema.XmlSchemaInclude;
+import org.apache.ws.commons.schema.XmlSchemaObject;
+import org.apache.ws.commons.schema.XmlSchemaType;
+import org.w3c.dom.Document;
 
 /**
  * Represents a XML schema definition.
@@ -30,21 +40,22 @@
  * @version $Rev$ $Date$
  */
 public class XSDefinitionImpl implements XSDefinition {
-    
-    private XmlSchema definition;
+    private XmlSchemaCollection schemaCollection = new XmlSchemaCollection();
+    private XmlSchema schema;
     private String namespace;
     private URI location;
+    private Document document;
     private boolean unresolved;
-    
+
     protected XSDefinitionImpl() {
     }
 
     public XmlSchema getSchema() {
-        return definition;
+        return schema;
     }
 
     public void setSchema(XmlSchema definition) {
-        this.definition = definition;
+        this.schema = definition;
     }
 
     public boolean isUnresolved() {
@@ -54,17 +65,17 @@
     public void setUnresolved(boolean undefined) {
         this.unresolved = undefined;
     }
-    
+
     public String getNamespace() {
         if (isUnresolved()) {
             return namespace;
-        } else if (definition != null) {
-            return definition.getTargetNamespace();
+        } else if (schema != null) {
+            return schema.getTargetNamespace();
         } else {
             return namespace;
         }
     }
-    
+
     public void setNamespace(String namespace) {
         if (!isUnresolved()) {
             throw new IllegalStateException();
@@ -72,7 +83,7 @@
             this.namespace = namespace;
         }
     }
-    
+
     /**
      * @return the location
      */
@@ -86,4 +97,126 @@
     public void setLocation(URI location) {
         this.location = location;
     }
+
+    /**
+     * @return the document
+     */
+    public Document getDocument() {
+        return document;
+    }
+
+    /**
+     * @param document the document to set
+     */
+    public void setDocument(Document document) {
+        this.document = document;
+    }
+
+    /**
+     * @return the schemaCollection
+     */
+    public XmlSchemaCollection getSchemaCollection() {
+        return schemaCollection;
+    }
+
+    /**
+     * @param schemaCollection the schemaCollection to set
+     */
+    public void setSchemaCollection(XmlSchemaCollection schemaCollection) {
+        this.schemaCollection = schemaCollection;
+    }
+
+    /**
+     * @see java.lang.Object#hashCode()
+     */
+    @Override
+    public int hashCode() {
+        final int prime = 31;
+        int result = 1;
+        result = prime * result + ((location == null) ? 0 : location.hashCode());
+        result = prime * result + ((namespace == null) ? 0 : namespace.hashCode());
+        return result;
+    }
+
+    /**
+     * @see java.lang.Object#equals(java.lang.Object)
+     */
+    @Override
+    public boolean equals(Object obj) {
+        if (this == obj)
+            return true;
+        if (obj == null)
+            return false;
+        if (!(obj instanceof XSDefinitionImpl))
+            return false;
+        final XSDefinitionImpl other = (XSDefinitionImpl)obj;
+        if (location == null) {
+            if (other.location != null)
+                return false;
+        } else if (!location.equals(other.location))
+            return false;
+        if (namespace == null) {
+            if (other.namespace != null)
+                return false;
+        } else if (!namespace.equals(other.namespace))
+            return false;
+        return true;
+    }
+
+    public static <T extends XmlSchemaObject> T getXmlSchemaObject(XmlSchema schema, QName name, Class<T> type) {
+        if (schema != null) {
+            XmlSchemaObject object = null;
+            if (type == XmlSchemaElement.class) {
+                object = schema.getElementByName(name);
+            } else if (type == XmlSchemaType.class) {
+                object = schema.getTypeByName(name);
+            }
+            if (object != null) {
+                return type.cast(object);
+            }
+            for (Iterator i = schema.getIncludes().getIterator(); i.hasNext();) {
+                XmlSchemaObject obj = (XmlSchemaObject)i.next();
+                XmlSchema ext = null;
+                if (obj instanceof XmlSchemaInclude) {
+                    ext = ((XmlSchemaInclude)obj).getSchema();
+                }
+                if (obj instanceof XmlSchemaImport) {
+                    ext = ((XmlSchemaImport)obj).getSchema();
+                }
+                object = getXmlSchemaObject(ext, name, type);
+                if (object != null) {
+                    return type.cast(object);
+                }
+            }
+        }
+        return null;
+    }
+
+    public XmlSchemaElement getXmlSchemaElement(QName name) {
+        if (schema != null) {
+            XmlSchemaElement element = getXmlSchemaObject(schema, name, XmlSchemaElement.class);
+            if (element != null) {
+                return element;
+            }
+        }
+
+        if (schemaCollection != null) {
+            return schemaCollection.getElementByQName(name);
+        }
+        return null;
+    }
+
+    public XmlSchemaType getXmlSchemaType(QName name) {
+        if (schema != null) {
+            XmlSchemaType type = getXmlSchemaObject(schema, name, XmlSchemaType.class);
+            if (type != null) {
+                return type;
+            }
+        }
+        if (schemaCollection != null) {
+            return schemaCollection.getTypeByQName(name);
+        }
+        return null;
+    }
+
 }

Modified: incubator/tuscany/branches/sca-java-1.0.1/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/Interface.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/branches/sca-java-1.0.1/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/Interface.java?rev=587778&r1=587777&r2=587778&view=diff
==============================================================================
--- incubator/tuscany/branches/sca-java-1.0.1/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/Interface.java (original)
+++ incubator/tuscany/branches/sca-java-1.0.1/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/Interface.java Tue Oct 23 21:30:02 2007
@@ -62,12 +62,19 @@
      */
     List<Operation> getOperations();
 
-    // TODO: [rfeng] We might need to have a better way
     /**
      * Set the databinding for the interface
      * @param dataBinding
+     * @deprecated Please use resetDataBinding
      */
+    @Deprecated
     void setDefaultDataBinding(String dataBinding);
+    
+    /**
+     * Reset the databinding for the interface
+     * @param dataBinding
+     */
+    void resetDataBinding(String dataBinding);
 
     /**
      * Returns true if the Interface is dynamic.

Modified: incubator/tuscany/branches/sca-java-1.0.1/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/impl/InterfaceImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/branches/sca-java-1.0.1/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/impl/InterfaceImpl.java?rev=587778&r1=587777&r2=587778&view=diff
==============================================================================
--- incubator/tuscany/branches/sca-java-1.0.1/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/impl/InterfaceImpl.java (original)
+++ incubator/tuscany/branches/sca-java-1.0.1/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/impl/InterfaceImpl.java Tue Oct 23 21:30:02 2007
@@ -112,6 +112,7 @@
 
     }
 
+    @Deprecated
     public void setDefaultDataBinding(String dataBinding) {
         for (Operation op : getOperations()) {
             if (op.getDataBinding() == null) {
@@ -157,16 +158,53 @@
         }
     }
 
+    public void resetDataBinding(String dataBinding) {
+        for (Operation op : getOperations()) {
+            op.setDataBinding(dataBinding);
+            DataType<List<DataType>> inputType = op.getInputType();
+            if (inputType != null) {
+                for (DataType d : inputType.getLogical()) {
+                    d.setDataBinding(dataBinding);
+                }
+            }
+            DataType outputType = op.getOutputType();
+            if (outputType != null) {
+                outputType.setDataBinding(dataBinding);
+            }
+            List<DataType> faultTypes = op.getFaultTypes();
+            if (faultTypes != null) {
+                for (DataType d : faultTypes) {
+                    d.setDataBinding(dataBinding);
+                }
+            }
+            if (op.isWrapperStyle()) {
+                WrapperInfo wrapper = op.getWrapper();
+                if (wrapper != null) {
+                    DataType<List<DataType>> unwrappedInputType = wrapper.getUnwrappedInputType();
+                    if (unwrappedInputType != null) {
+                        for (DataType d : unwrappedInputType.getLogical()) {
+                            d.setDataBinding(dataBinding);
+                        }
+                    }
+                    DataType unwrappedOutputType = wrapper.getUnwrappedOutputType();
+                    if (unwrappedOutputType != null) {
+                        unwrappedOutputType.setDataBinding(dataBinding);
+                    }
+                }
+            }
+        }
+    }
+
     public boolean isDynamic() {
         return false;
     }
 
     @Override
     public InterfaceImpl clone() throws CloneNotSupportedException {
-        InterfaceImpl copy = (InterfaceImpl) super.clone();
+        InterfaceImpl copy = (InterfaceImpl)super.clone();
         copy.operations = new OperationList();
         for (Operation operation : this.operations) {
-            Operation clonedOperation = (Operation) operation.clone();
+            Operation clonedOperation = (Operation)operation.clone();
             copy.operations.add(clonedOperation);
         }
         return copy;

Modified: incubator/tuscany/branches/sca-java-1.0.1/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/util/WrapperInfo.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/branches/sca-java-1.0.1/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/util/WrapperInfo.java?rev=587778&r1=587777&r2=587778&view=diff
==============================================================================
--- incubator/tuscany/branches/sca-java-1.0.1/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/util/WrapperInfo.java (original)
+++ incubator/tuscany/branches/sca-java-1.0.1/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/util/WrapperInfo.java Tue Oct 23 21:30:02 2007
@@ -128,7 +128,7 @@
             if (elements != null && elements.size() > 0) {
                 if (elements.size() > 1) {
                     // We don't support output with multiple parts
-                    throw new IllegalArgumentException("Multi-part output is not supported");
+                    // throw new IllegalArgumentException("Multi-part output is not supported");
                 }
                 ElementInfo element = elements.get(0);
 

Modified: incubator/tuscany/branches/sca-java-1.0.1/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/util/XMLType.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/branches/sca-java-1.0.1/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/util/XMLType.java?rev=587778&r1=587777&r2=587778&view=diff
==============================================================================
--- incubator/tuscany/branches/sca-java-1.0.1/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/util/XMLType.java (original)
+++ incubator/tuscany/branches/sca-java-1.0.1/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/util/XMLType.java Tue Oct 23 21:30:02 2007
@@ -67,6 +67,14 @@
     public QName getElementName() {
         return element;
     }
+    
+    public void setElementName(QName element) {
+        this.element = element;
+    }
+    
+    public void setTypeName(QName type) {
+        this.type = type;
+    }
 
     public static XMLType getType(QName type) {
         return new XMLType(null, type);



---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-commits-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-commits-help@ws.apache.org