tuscany-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jboy...@apache.org
Subject svn commit: r392307 - in /incubator/tuscany/java/sca: core/src/main/java/org/apache/tuscany/core/loader/ core/src/main/java/org/apache/tuscany/core/loader/assembly/ core/src/main/java/org/apache/tuscany/core/loader/impl/ core/src/main/resources/ model/...
Date Fri, 07 Apr 2006 14:38:58 GMT
Author: jboynes
Date: Fri Apr  7 07:38:55 2006
New Revision: 392307

URL: http://svn.apache.org/viewcvs?rev=392307&view=rev
Log:
add a registry for imported WSDL definitions
add a AssemblyModelObject for <import.wsdl>

Added:
    incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/loader/WSDLDefinitionRegistry.java
  (with props)
    incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/loader/assembly/ImportWSDLLoader.java
  (with props)
    incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/loader/impl/WSDLDefinitionRegistryImpl.java
  (with props)
    incubator/tuscany/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/ImportWSDL.java
  (with props)
    incubator/tuscany/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ImportWSDLImpl.java
  (with props)
Modified:
    incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/loader/StAXUtil.java
    incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/loader/assembly/AggregateLoader.java
    incubator/tuscany/java/sca/core/src/main/resources/system.module
    incubator/tuscany/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/Aggregate.java
    incubator/tuscany/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/AssemblyFactory.java
    incubator/tuscany/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/AggregateImpl.java
    incubator/tuscany/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/AssemblyFactoryImpl.java
    incubator/tuscany/java/sca/model/src/main/java/org/apache/tuscany/model/scdl/loader/impl/SCDLModelContentHandlerImpl.java

Modified: incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/loader/StAXUtil.java
URL: http://svn.apache.org/viewcvs/incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/loader/StAXUtil.java?rev=392307&r1=392306&r2=392307&view=diff
==============================================================================
--- incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/loader/StAXUtil.java
(original)
+++ incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/loader/StAXUtil.java
Fri Apr  7 07:38:55 2006
@@ -16,24 +16,41 @@
  */
 package org.apache.tuscany.core.loader;
 
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import javax.xml.stream.XMLStreamConstants;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+
 import org.apache.tuscany.core.config.ComponentTypeIntrospector;
 import org.apache.tuscany.core.config.ConfigurationException;
 import org.apache.tuscany.core.config.impl.Java5ComponentTypeIntrospector;
-import org.apache.tuscany.core.loader.assembly.*;
+import org.apache.tuscany.core.loader.assembly.ComponentLoader;
+import org.apache.tuscany.core.loader.assembly.ComponentTypeLoader;
+import org.apache.tuscany.core.loader.assembly.EntryPointLoader;
+import org.apache.tuscany.core.loader.assembly.ExternalServiceLoader;
+import org.apache.tuscany.core.loader.assembly.InterfaceJavaLoader;
+import org.apache.tuscany.core.loader.assembly.InterfaceWSDLLoader;
+import org.apache.tuscany.core.loader.assembly.ModuleFragmentLoader;
+import org.apache.tuscany.core.loader.assembly.ModuleLoader;
+import org.apache.tuscany.core.loader.assembly.PropertyLoader;
+import org.apache.tuscany.core.loader.assembly.ReferenceLoader;
+import org.apache.tuscany.core.loader.assembly.ServiceLoader;
 import org.apache.tuscany.core.loader.impl.StAXLoaderRegistryImpl;
 import org.apache.tuscany.core.loader.system.SystemBindingLoader;
 import org.apache.tuscany.core.loader.system.SystemImplementationLoader;
 import org.apache.tuscany.core.system.assembly.SystemAssemblyFactory;
 import org.apache.tuscany.core.system.assembly.SystemImplementation;
 import org.apache.tuscany.core.system.assembly.impl.SystemAssemblyFactoryImpl;
-import org.apache.tuscany.model.assembly.*;
-
-import javax.xml.stream.XMLStreamConstants;
-import javax.xml.stream.XMLStreamException;
-import javax.xml.stream.XMLStreamReader;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
+import org.apache.tuscany.model.assembly.AssemblyModelContext;
+import org.apache.tuscany.model.assembly.Component;
+import org.apache.tuscany.model.assembly.EntryPoint;
+import org.apache.tuscany.model.assembly.Module;
+import org.apache.tuscany.model.assembly.ModuleComponent;
+import org.apache.tuscany.model.assembly.Multiplicity;
+import org.apache.tuscany.model.assembly.OverrideOption;
+import org.apache.tuscany.model.assembly.Scope;
 
 /**
  * @version $Rev$ $Date$

Added: incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/loader/WSDLDefinitionRegistry.java
URL: http://svn.apache.org/viewcvs/incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/loader/WSDLDefinitionRegistry.java?rev=392307&view=auto
==============================================================================
--- incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/loader/WSDLDefinitionRegistry.java
(added)
+++ incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/loader/WSDLDefinitionRegistry.java
Fri Apr  7 07:38:55 2006
@@ -0,0 +1,57 @@
+/**
+ *
+ * Copyright 2006 The Apache Software Foundation
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.apache.tuscany.core.loader;
+
+import java.net.URL;
+import java.io.IOException;
+import javax.wsdl.Definition;
+import javax.wsdl.PortType;
+import javax.wsdl.Service;
+import javax.wsdl.WSDLException;
+import javax.xml.namespace.QName;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public interface WSDLDefinitionRegistry {
+    /**
+     * Loads and registers a WSDL Definition.
+     *
+     * @param namespace the expected namespace, or null if any namespace should be allowed
+     * @param location  the location to load the definition from
+     * @return the loaded Definition
+     * @throws IOException if there was a problem reading the document
+     * @throws WSDLException if there was a problem parsing the definition
+     */
+    Definition loadDefinition(String namespace, URL location) throws IOException, WSDLException;
+
+    /**
+     * Returns the PortType with the supplied qualified name, or null if no such port has
been defined.
+     *
+     * @param name the qualified name of the WSDL portType
+     * @return the PortType for the supplied name, or null if none has been defined
+     */
+    PortType getPortType(QName name);
+
+    /**
+     * Returns the Service with the supplied qualified name, or null if no such service has
been defined.
+     *
+     * @param name the qualified name of the WSDL service
+     * @return the Service for the supplied name, or null if none has been defined
+     */
+    Service getService(QName name);
+}

Propchange: incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/loader/WSDLDefinitionRegistry.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/loader/WSDLDefinitionRegistry.java
------------------------------------------------------------------------------
    svn:keywords = Rev,Date

Modified: incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/loader/assembly/AggregateLoader.java
URL: http://svn.apache.org/viewcvs/incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/loader/assembly/AggregateLoader.java?rev=392307&r1=392306&r2=392307&view=diff
==============================================================================
--- incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/loader/assembly/AggregateLoader.java
(original)
+++ incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/loader/assembly/AggregateLoader.java
Fri Apr  7 07:38:55 2006
@@ -16,54 +16,41 @@
  */
 package org.apache.tuscany.core.loader.assembly;
 
-import org.apache.tuscany.common.resource.ResourceLoader;
-import org.apache.tuscany.core.config.ConfigurationLoadException;
-import org.apache.tuscany.model.assembly.*;
-
-import javax.wsdl.Definition;
-import javax.wsdl.Import;
-import javax.wsdl.WSDLException;
-import javax.wsdl.factory.WSDLFactory;
 import static javax.xml.stream.XMLStreamConstants.END_ELEMENT;
 import static javax.xml.stream.XMLStreamConstants.START_ELEMENT;
 import javax.xml.stream.XMLStreamException;
 import javax.xml.stream.XMLStreamReader;
 
+import org.apache.tuscany.common.resource.ResourceLoader;
+import org.apache.tuscany.core.config.ConfigurationLoadException;
+import org.apache.tuscany.model.assembly.Aggregate;
+import org.apache.tuscany.model.assembly.AssemblyModelObject;
+import org.apache.tuscany.model.assembly.Component;
+import org.apache.tuscany.model.assembly.EntryPoint;
+import org.apache.tuscany.model.assembly.ExternalService;
+import org.apache.tuscany.model.assembly.ImportWSDL;
+import org.apache.tuscany.model.assembly.Wire;
+
 /**
  * @version $Rev$ $Date$
  */
 public abstract class AggregateLoader extends AbstractLoader {
-    private static final WSDLFactory wsdlFactory;
-    static {
-        try {
-            wsdlFactory = WSDLFactory.newInstance();
-        } catch (WSDLException e) {
-            throw new ExceptionInInitializerError(e);
-        }
-    }
-
     public void loadAggregate(XMLStreamReader reader, Aggregate aggregate, ResourceLoader
resourceLoader) throws XMLStreamException, ConfigurationLoadException {
         aggregate.setName(reader.getAttributeValue(null, "name"));
         while (true) {
             switch (reader.next()) {
             case START_ELEMENT:
-                if (AssemblyConstants.IMPORT_WSDL.equals(reader.getName())) {
-                    Definition definition = wsdlFactory.newDefinition();
-                    Import wsdlImport = definition.createImport();
-                    wsdlImport.setNamespaceURI(reader.getAttributeValue(null, "namespace"));
-                    wsdlImport.setLocationURI(reader.getAttributeValue(null, "location"));
-                    aggregate.getWSDLImports().add(wsdlImport);
-                } else {
-                    AssemblyModelObject o = registry.load(reader, resourceLoader);
-                    if (o instanceof EntryPoint) {
-                        aggregate.getEntryPoints().add((EntryPoint) o);
-                    } else if (o instanceof ExternalService) {
-                        aggregate.getExternalServices().add((ExternalService) o);
-                    } else if (o instanceof Component) {
-                        aggregate.getComponents().add((Component) o);
-                    } else if (o instanceof Wire) {
-                        aggregate.getWires().add((Wire) o);
-                    }
+                AssemblyModelObject o = registry.load(reader, resourceLoader);
+                if (o instanceof EntryPoint) {
+                    aggregate.getEntryPoints().add((EntryPoint) o);
+                } else if (o instanceof ExternalService) {
+                    aggregate.getExternalServices().add((ExternalService) o);
+                } else if (o instanceof Component) {
+                    aggregate.getComponents().add((Component) o);
+                } else if (o instanceof Wire) {
+                    aggregate.getWires().add((Wire) o);
+                } else if (o instanceof ImportWSDL) {
+                    aggregate.getWSDLImports().add((ImportWSDL) o);
                 }
                 reader.next();
                 break;

Added: incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/loader/assembly/ImportWSDLLoader.java
URL: http://svn.apache.org/viewcvs/incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/loader/assembly/ImportWSDLLoader.java?rev=392307&view=auto
==============================================================================
--- incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/loader/assembly/ImportWSDLLoader.java
(added)
+++ incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/loader/assembly/ImportWSDLLoader.java
Fri Apr  7 07:38:55 2006
@@ -0,0 +1,83 @@
+/**
+ *
+ * Copyright 2006 The Apache Software Foundation
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.apache.tuscany.core.loader.assembly;
+
+import java.io.IOException;
+import java.net.URL;
+import javax.wsdl.WSDLException;
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+
+import org.osoa.sca.annotations.Scope;
+
+import org.apache.tuscany.common.resource.ResourceLoader;
+import org.apache.tuscany.core.config.ConfigurationLoadException;
+import org.apache.tuscany.core.loader.StAXUtil;
+import org.apache.tuscany.core.loader.WSDLDefinitionRegistry;
+import static org.apache.tuscany.core.loader.assembly.AssemblyConstants.IMPORT_WSDL;
+import org.apache.tuscany.core.system.annotation.Autowire;
+import org.apache.tuscany.model.assembly.ImportWSDL;
+
+/**
+ * Loader that handles &lt;import.wsdl&gt; elements.
+ *
+ * @version $Rev$ $Date$
+ */
+@Scope("MODULE")
+public class ImportWSDLLoader extends AbstractLoader {
+    private WSDLDefinitionRegistry wsdlRegistry;
+
+    @Autowire
+    public void setWsdlRegistry(WSDLDefinitionRegistry wsdlRegistry) {
+        this.wsdlRegistry = wsdlRegistry;
+    }
+
+    public QName getXMLType() {
+        return IMPORT_WSDL;
+    }
+
+    public Class<ImportWSDL> getModelType() {
+        return ImportWSDL.class;
+    }
+
+    public ImportWSDL load(XMLStreamReader reader, ResourceLoader resourceLoader) throws
XMLStreamException, ConfigurationLoadException {
+        assert AssemblyConstants.IMPORT_WSDL.equals(reader.getName());
+        String namespace = reader.getAttributeValue(null, "namespace");
+        String location = reader.getAttributeValue(null, "location");
+
+        loadDefinition(namespace, location, resourceLoader);
+
+        StAXUtil.skipToEndElement(reader);
+        return factory.createImportWSDL(location, namespace);
+    }
+
+    protected void loadDefinition(String namespace, String location, ResourceLoader resourceLoader)
throws ConfigurationLoadException {
+        URL wsdlURL = resourceLoader.getResource(location);
+        if (wsdlURL == null) {
+            throw new ConfigurationLoadException("WSDL import not found: " + wsdlURL);
+        }
+
+        try {
+            wsdlRegistry.loadDefinition(namespace, wsdlURL);
+        } catch (IOException e) {
+            throw new ConfigurationLoadException(wsdlURL.toString(), e);
+        } catch (WSDLException e) {
+            throw (ConfigurationLoadException) new ConfigurationLoadException(wsdlURL.toString()).initCause(e);
+        }
+    }
+}

Propchange: incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/loader/assembly/ImportWSDLLoader.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/loader/assembly/ImportWSDLLoader.java
------------------------------------------------------------------------------
    svn:keywords = Rev,Date

Added: incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/loader/impl/WSDLDefinitionRegistryImpl.java
URL: http://svn.apache.org/viewcvs/incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/loader/impl/WSDLDefinitionRegistryImpl.java?rev=392307&view=auto
==============================================================================
--- incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/loader/impl/WSDLDefinitionRegistryImpl.java
(added)
+++ incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/loader/impl/WSDLDefinitionRegistryImpl.java
Fri Apr  7 07:38:55 2006
@@ -0,0 +1,102 @@
+/**
+ *
+ * Copyright 2006 The Apache Software Foundation
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.apache.tuscany.core.loader.impl;
+
+import java.io.IOException;
+import java.net.URL;
+import java.util.Map;
+import java.util.HashMap;
+import java.util.List;
+import java.util.ArrayList;
+import javax.wsdl.Definition;
+import javax.wsdl.PortType;
+import javax.wsdl.WSDLException;
+import javax.wsdl.Service;
+import javax.wsdl.xml.WSDLReader;
+import javax.wsdl.factory.WSDLFactory;
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.core.loader.WSDLDefinitionRegistry;
+
+/**
+ * @version $Rev$ $Date$
+ */
+@org.osoa.sca.annotations.Service(interfaces = {WSDLDefinitionRegistry.class})
+public class WSDLDefinitionRegistryImpl implements WSDLDefinitionRegistry {
+    private final WSDLFactory wsdlFactory;
+
+    private final Map<URL, Definition> definitionsByLocation = new HashMap<URL,
Definition>();
+    private final Map<String, List<Definition>> definitionsByNamespace = new
HashMap<String, List<Definition>>();
+
+    public WSDLDefinitionRegistryImpl() throws WSDLException {
+        wsdlFactory = WSDLFactory.newInstance();
+    }
+
+    public Definition loadDefinition(String namespace, URL location) throws IOException,
WSDLException {
+        Definition definition = definitionsByLocation.get(location);
+        if (definition != null) {
+            // return cached copy
+            return definition;
+        }
+
+        WSDLReader reader = wsdlFactory.newWSDLReader();
+        definition = reader.readWSDL(location.toString());
+        String definitionNamespace = definition.getTargetNamespace();
+        if (namespace != null && !namespace.equals(definitionNamespace)) {
+            throw new WSDLException(WSDLException.CONFIGURATION_ERROR, namespace + " != "
+ definition.getTargetNamespace());
+        }
+        definitionsByLocation.put(location, definition);
+        List<Definition> definitions = definitionsByNamespace.get(definitionNamespace);
+        if (definitions == null) {
+            definitions = new ArrayList<Definition>();
+            definitionsByNamespace.put(definitionNamespace, definitions);
+        }
+        definitions.add(definition);
+
+        return definition;
+    }
+
+    public PortType getPortType(QName name) {
+        String namespace = name.getNamespaceURI();
+        List<Definition> definitions = definitionsByNamespace.get(namespace);
+        if (definitions == null) {
+            return null;
+        }
+        for (Definition definition : definitions) {
+            PortType portType = definition.getPortType(name);
+            if (portType != null) {
+                return portType;
+            }
+        }
+        return null;
+    }
+
+    public javax.wsdl.Service getService(QName name) {
+        String namespace = name.getNamespaceURI();
+        List<Definition> definitions = definitionsByNamespace.get(namespace);
+        if (definitions == null) {
+            return null;
+        }
+        for (Definition definition : definitions) {
+            Service service = definition.getService(name);
+            if (service != null) {
+                return service;
+            }
+        }
+        return null;
+    }
+}

Propchange: incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/loader/impl/WSDLDefinitionRegistryImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/loader/impl/WSDLDefinitionRegistryImpl.java
------------------------------------------------------------------------------
    svn:keywords = Rev,Date

Modified: incubator/tuscany/java/sca/core/src/main/resources/system.module
URL: http://svn.apache.org/viewcvs/incubator/tuscany/java/sca/core/src/main/resources/system.module?rev=392307&r1=392306&r2=392307&view=diff
==============================================================================
--- incubator/tuscany/java/sca/core/src/main/resources/system.module (original)
+++ incubator/tuscany/java/sca/core/src/main/resources/system.module Fri Apr  7 07:38:55 2006
@@ -19,4 +19,15 @@
         xmlns:system="http://org.apache.tuscany/xmlns/system/0.9"
         name="org.apache.tuscany.core.system">
 
+    <component name="org.apache.tuscany.core.loader.WSDLDefinitionRegistry">
+        <system:implementation.system class="org.apache.tuscany.core.loader.impl.WSDLDefinitionRegistryImpl"/>
+    </component>
+
+    <component name="org.apache.tuscany.core.loader.assembly.ImportWSDLLoader">
+        <system:implementation.system class="org.apache.tuscany.core.loader.assembly.ImportWSDLLoader"/>
+    </component>
+
+    <component name="org.apache.tuscany.core.loader.assembly.InterfaceWSDLLoader">
+        <system:implementation.system class="org.apache.tuscany.core.loader.assembly.InterfaceWSDLLoader"/>
+    </component>
 </module>

Modified: incubator/tuscany/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/Aggregate.java
URL: http://svn.apache.org/viewcvs/incubator/tuscany/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/Aggregate.java?rev=392307&r1=392306&r2=392307&view=diff
==============================================================================
--- incubator/tuscany/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/Aggregate.java
(original)
+++ incubator/tuscany/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/Aggregate.java
Fri Apr  7 07:38:55 2006
@@ -99,14 +99,14 @@
      * Returns the WSDL imports.
      * @return
      */
-    List<Import> getWSDLImports();
+    List<ImportWSDL> getWSDLImports();
     
     /**
      * Returns the WSDL imports for the given namespace. 
      * @param namespace
      * @return
      */
-    List<Import> getWSDLImports(String namespace);
+    List<ImportWSDL> getWSDLImports(String namespace);
 
     /**
      * Returns the assembly model context used by this aggregate.

Modified: incubator/tuscany/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/AssemblyFactory.java
URL: http://svn.apache.org/viewcvs/incubator/tuscany/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/AssemblyFactory.java?rev=392307&r1=392306&r2=392307&view=diff
==============================================================================
--- incubator/tuscany/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/AssemblyFactory.java
(original)
+++ incubator/tuscany/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/AssemblyFactory.java
Fri Apr  7 07:38:55 2006
@@ -238,4 +238,18 @@
      * @return a Property with the supplied name and type
      */
     Property createProperty(String name, Class<?> type);
+
+    /**
+     * Returns a new ImportWSDL model object.
+     * @return a new ImportWSDL model object
+     */
+    ImportWSDL createImportWSDL();
+
+    /**
+     * Returns a new ImportWSDL model object initialized with the supplied values.
+     * @param location the location where the WSDL definition can be found
+     * @param namespace the namespace URI for this import
+     * @return a new ImportWSDL model object
+     */
+    ImportWSDL createImportWSDL(String location, String namespace);
 }

Added: incubator/tuscany/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/ImportWSDL.java
URL: http://svn.apache.org/viewcvs/incubator/tuscany/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/ImportWSDL.java?rev=392307&view=auto
==============================================================================
--- incubator/tuscany/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/ImportWSDL.java
(added)
+++ incubator/tuscany/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/ImportWSDL.java
Fri Apr  7 07:38:55 2006
@@ -0,0 +1,62 @@
+/**
+ *
+ * Copyright 2006 The Apache Software Foundation
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.apache.tuscany.model.assembly;
+
+import javax.wsdl.Definition;
+
+/**
+ * Model object that represents the import of an external WSDL definition.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface ImportWSDL extends AssemblyModelObject {
+    /**
+     * Returns the location where the WSDL definition can be found.
+     * @return the location where the WSDL definition can be found
+     */
+    String getLocation();
+
+    /**
+     * Set the location where the WSDL definition can be found.
+     * @param uri the location where the WSDL definition can be found
+     */
+    void setLocation(String uri);
+
+    /**
+     * Returns the namespace URI for this import.
+     * @return the namespace URI for this import
+     */
+    String getNamespace();
+
+    /**
+     * Sets the namespace URI for this import.
+     * @param uri the namespace URI for this import
+     */
+    void setNamespace(String uri);
+
+    /**
+     * Returns the WSDL Definition.
+     * @return the WSDL Definition
+     */
+    Definition getDefinition();
+
+    /**
+     * Sets the WSDL Definition.
+     * @param definition the WSDL Definition
+     */
+    void setDefinition(Definition definition);
+}

Propchange: incubator/tuscany/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/ImportWSDL.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/ImportWSDL.java
------------------------------------------------------------------------------
    svn:keywords = Rev,Date

Modified: incubator/tuscany/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/AggregateImpl.java
URL: http://svn.apache.org/viewcvs/incubator/tuscany/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/AggregateImpl.java?rev=392307&r1=392306&r2=392307&view=diff
==============================================================================
--- incubator/tuscany/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/AggregateImpl.java
(original)
+++ incubator/tuscany/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/AggregateImpl.java
Fri Apr  7 07:38:55 2006
@@ -23,9 +23,9 @@
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
-
 import javax.wsdl.Definition;
-import javax.wsdl.Import;
+
+import commonj.sdo.helper.XSDHelper;
 
 import org.apache.tuscany.common.resource.ResourceLoader;
 import org.apache.tuscany.model.assembly.Aggregate;
@@ -36,12 +36,11 @@
 import org.apache.tuscany.model.assembly.ConfiguredService;
 import org.apache.tuscany.model.assembly.EntryPoint;
 import org.apache.tuscany.model.assembly.ExternalService;
+import org.apache.tuscany.model.assembly.ImportWSDL;
 import org.apache.tuscany.model.assembly.ServiceURI;
 import org.apache.tuscany.model.assembly.Wire;
 import org.apache.tuscany.sdo.util.SDOUtil;
 
-import commonj.sdo.helper.XSDHelper;
-
 /**
  * An implementation of Aggregate.
  */
@@ -65,9 +64,9 @@
 
     private List<Wire> wires = new ArrayList<Wire>();
 
-    private List<Import> wsdlImports = new ArrayList<Import>();
+    private List<ImportWSDL> wsdlImports = new ArrayList<ImportWSDL>();
 
-    private Map<String, List<Import>> wsdlImportsMap;
+    private Map<String, List<ImportWSDL>> wsdlImportsMap;
 
     private AssemblyModelContext modelContext;
 
@@ -155,14 +154,14 @@
     /**
      * @see org.apache.tuscany.model.assembly.Aggregate#getWSDLImports()
      */
-    public List<Import> getWSDLImports() {
+    public List<ImportWSDL> getWSDLImports() {
         return wsdlImports;
     }
 
     /**
      * @see org.apache.tuscany.model.assembly.Aggregate#getWSDLImports(java.lang.String)
      */
-    public List<Import> getWSDLImports(String namespace) {
+    public List<ImportWSDL> getWSDLImports(String namespace) {
         checkInitialized();
         return wsdlImportsMap.get(namespace);
     }
@@ -216,19 +215,19 @@
 
         // Populate map of WSDL imports
         ResourceLoader resourceLoader = modelContext.getApplicationResourceLoader();
-        wsdlImportsMap = new HashMap<String, List<Import>>();
-        for (Import wsdlImport : wsdlImports) {
-            String namespace = wsdlImport.getNamespaceURI();
-            List<Import> list = wsdlImportsMap.get(namespace);
+        wsdlImportsMap = new HashMap<String, List<ImportWSDL>>();
+        for (ImportWSDL wsdlImport : wsdlImports) {
+            String namespace = wsdlImport.getNamespace();
+            List<ImportWSDL> list = wsdlImportsMap.get(namespace);
             if (list == null) {
-                list = new ArrayList<Import>();
+                list = new ArrayList<ImportWSDL>();
                 wsdlImportsMap.put(namespace, list);
             }
             list.add(wsdlImport);
 
             // Load the WSDL definition if necessary
             if (wsdlImport.getDefinition() == null) {
-                String location = wsdlImport.getLocationURI();
+                String location = wsdlImport.getLocation();
                 Definition definition;
                 ClassLoader ccl = Thread.currentThread().getContextClassLoader();
                 try {

Modified: incubator/tuscany/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/AssemblyFactoryImpl.java
URL: http://svn.apache.org/viewcvs/incubator/tuscany/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/AssemblyFactoryImpl.java?rev=392307&r1=392306&r2=392307&view=diff
==============================================================================
--- incubator/tuscany/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/AssemblyFactoryImpl.java
(original)
+++ incubator/tuscany/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/AssemblyFactoryImpl.java
Fri Apr  7 07:38:55 2006
@@ -40,6 +40,7 @@
 import org.apache.tuscany.model.assembly.Wire;
 import org.apache.tuscany.model.assembly.Binding;
 import org.apache.tuscany.model.assembly.ServiceContract;
+import org.apache.tuscany.model.assembly.ImportWSDL;
 import org.apache.tuscany.model.types.java.JavaServiceContract;
 import org.apache.tuscany.model.types.java.impl.JavaServiceContractImpl;
 import org.apache.tuscany.model.types.wsdl.WSDLServiceContract;
@@ -259,5 +260,16 @@
         property.setName(name);
         property.setType(type);
         return property;
+    }
+
+    public ImportWSDL createImportWSDL() {
+        return new ImportWSDLImpl();
+    }
+
+    public ImportWSDL createImportWSDL(String location, String namespace) {
+        ImportWSDL importWSDL = createImportWSDL();
+        importWSDL.setLocation(location);
+        importWSDL.setNamespace(namespace);
+        return importWSDL;
     }
 }

Added: incubator/tuscany/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ImportWSDLImpl.java
URL: http://svn.apache.org/viewcvs/incubator/tuscany/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ImportWSDLImpl.java?rev=392307&view=auto
==============================================================================
--- incubator/tuscany/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ImportWSDLImpl.java
(added)
+++ incubator/tuscany/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ImportWSDLImpl.java
Fri Apr  7 07:38:55 2006
@@ -0,0 +1,64 @@
+/**
+ *
+ * Copyright 2006 The Apache Software Foundation
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.apache.tuscany.model.assembly.impl;
+
+import javax.wsdl.Definition;
+
+import org.apache.tuscany.model.assembly.ImportWSDL;
+
+/**
+ * Implementation of ImportWSDL.
+ *
+ * @version $Rev$ $Date$
+ */
+public class ImportWSDLImpl extends AssemblyModelObjectImpl implements ImportWSDL {
+    private String location;
+    private String namespace;
+    private Definition definition;
+
+    /**
+     * Hide default constructor.
+     */
+    protected ImportWSDLImpl() {
+    }
+
+    public String getLocation() {
+        return location;
+    }
+
+    public void setLocation(String uri) {
+        checkNotFrozen();
+        this.location = uri;
+    }
+
+    public String getNamespace() {
+        return namespace;
+    }
+
+    public void setNamespace(String uri) {
+        checkNotFrozen();
+        this.namespace = uri;
+    }
+
+    public Definition getDefinition() {
+        return definition;
+    }
+
+    public void setDefinition(Definition definition) {
+        this.definition = definition;
+    }
+}

Propchange: incubator/tuscany/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ImportWSDLImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ImportWSDLImpl.java
------------------------------------------------------------------------------
    svn:keywords = Rev,Date

Modified: incubator/tuscany/java/sca/model/src/main/java/org/apache/tuscany/model/scdl/loader/impl/SCDLModelContentHandlerImpl.java
URL: http://svn.apache.org/viewcvs/incubator/tuscany/java/sca/model/src/main/java/org/apache/tuscany/model/scdl/loader/impl/SCDLModelContentHandlerImpl.java?rev=392307&r1=392306&r2=392307&view=diff
==============================================================================
--- incubator/tuscany/java/sca/model/src/main/java/org/apache/tuscany/model/scdl/loader/impl/SCDLModelContentHandlerImpl.java
(original)
+++ incubator/tuscany/java/sca/model/src/main/java/org/apache/tuscany/model/scdl/loader/impl/SCDLModelContentHandlerImpl.java
Fri Apr  7 07:38:55 2006
@@ -273,6 +273,8 @@
      * @see org.apache.tuscany.model.scdl.util.ScdlSwitch#caseWSDLImport(org.apache.tuscany.model.scdl.WSDLImport)
      */
     public Object caseWSDLImport(WSDLImport object) {
+        throw new UnsupportedOperationException();
+/*
         if (definition == null) {
             try {
                 WSDLFactory wsdlFactory = WSDLFactory.newInstance();
@@ -293,6 +295,7 @@
         });
 
         return wsdlImport;
+*/
     }
 
     /**



Mime
View raw message