tuscany-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lrese...@apache.org
Subject svn commit: r562620 [2/2] - in /incubator/tuscany/java/sca/modules: ./ assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/ contribution-impl/ contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/impl/ contribution-impl/src/ma...
Date Fri, 03 Aug 2007 23:55:39 GMT
Added: incubator/tuscany/java/sca/modules/contribution-namespace/src/main/java/org/apache/tuscany/sca/contribution/namespace/NamespaceImportExportFactory.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/contribution-namespace/src/main/java/org/apache/tuscany/sca/contribution/namespace/NamespaceImportExportFactory.java?view=auto&rev=562620
==============================================================================
--- incubator/tuscany/java/sca/modules/contribution-namespace/src/main/java/org/apache/tuscany/sca/contribution/namespace/NamespaceImportExportFactory.java (added)
+++ incubator/tuscany/java/sca/modules/contribution-namespace/src/main/java/org/apache/tuscany/sca/contribution/namespace/NamespaceImportExportFactory.java Fri Aug  3 16:55:35 2007
@@ -0,0 +1,42 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.sca.contribution.namespace;
+
+/**
+ * Base Namespace import/export model factory
+ * 
+ * @version $Rev$ $Date$
+ */
+public interface NamespaceImportExportFactory {
+
+    /**
+     * Create a namespace import model object
+     * 
+     * @return The new NamespaceImport model object
+     */
+    NamespaceImport createNamespaceImport();
+    
+    /**
+     * Create a namespace export model object
+     * 
+     * @return The new NamespaceExport model object
+     */
+    NamespaceExport createNamespaceExport();
+}

Propchange: incubator/tuscany/java/sca/modules/contribution-namespace/src/main/java/org/apache/tuscany/sca/contribution/namespace/NamespaceImportExportFactory.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/java/sca/modules/contribution-namespace/src/main/java/org/apache/tuscany/sca/contribution/namespace/NamespaceImportExportFactory.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Copied: incubator/tuscany/java/sca/modules/contribution-namespace/src/main/java/org/apache/tuscany/sca/contribution/namespace/impl/CompositeModelResolver.java (from r561942, incubator/tuscany/java/sca/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/CompositeModelResolver.java)
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/contribution-namespace/src/main/java/org/apache/tuscany/sca/contribution/namespace/impl/CompositeModelResolver.java?view=diff&rev=562620&p1=incubator/tuscany/java/sca/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/CompositeModelResolver.java&r1=561942&p2=incubator/tuscany/java/sca/modules/contribution-namespace/src/main/java/org/apache/tuscany/sca/contribution/namespace/impl/CompositeModelResolver.java&r2=562620
==============================================================================
--- incubator/tuscany/java/sca/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/CompositeModelResolver.java (original)
+++ incubator/tuscany/java/sca/modules/contribution-namespace/src/main/java/org/apache/tuscany/sca/contribution/namespace/impl/CompositeModelResolver.java Fri Aug  3 16:55:35 2007
@@ -1,82 +1,82 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you 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.sca.assembly.xml;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import javax.xml.namespace.QName;
-
-import org.apache.tuscany.sca.assembly.Composite;
-import org.apache.tuscany.sca.contribution.Contribution;
-import org.apache.tuscany.sca.contribution.Import;
-import org.apache.tuscany.sca.contribution.NamespaceImport;
-import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
-
-/**
- * A Model Resolver for Composite models.
- *
- * @version $Rev: 557916 $ $Date: 2007-07-20 01:04:40 -0700 (Fri, 20 Jul 2007) $
- */
-public class CompositeModelResolver implements ModelResolver {
-
-    private Contribution contribution;
-    private Map<QName, Composite> map = new HashMap<QName, Composite>();
-    
-    public CompositeModelResolver(Contribution contribution) {
-        this.contribution = contribution;
-    }
-
-    public void addModel(Object resolved) {
-        Composite composite = (Composite)resolved;
-        map.put(composite.getName(), composite);
-    }
-    
-    public Object removeModel(Object resolved) {
-        return map.remove(((Composite)resolved).getName());
-    }
-    
-    public <T> T resolveModel(Class<T> modelClass, T unresolved) {
-        
-        // Lookup a definition for the given namespace
-        QName qname = ((Composite)unresolved).getName();
-        Composite resolved = (Composite) map.get(qname);
-        if (resolved != null) {
-            return (T)resolved;
-        }
-        
-        // No definition found, delegate the resolution to the imports
-        for (Import import_ : this.contribution.getImports()) {
-            if (import_ instanceof NamespaceImport) {
-                NamespaceImport namespaceImport = (NamespaceImport)import_;
-                if (namespaceImport.getNamespace().equals(qname.getNamespaceURI())) {
-                    
-                    // Delegate the resolution to the import resolver
-                    resolved = namespaceImport.getModelResolver().resolveModel(Composite.class, (Composite)unresolved);
-                    if (!resolved.isUnresolved()) {
-                        return (T)resolved;
-                    }
-                }
-            }
-        }
-        return (T)unresolved;
-    }
-    
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.sca.contribution.namespace.impl;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.sca.assembly.Composite;
+import org.apache.tuscany.sca.contribution.Contribution;
+import org.apache.tuscany.sca.contribution.Import;
+import org.apache.tuscany.sca.contribution.namespace.NamespaceImport;
+import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
+
+/**
+ * A Model Resolver for Composite models.
+ *
+ * @version $Rev$ $Date$
+ */
+public class CompositeModelResolver implements ModelResolver {
+
+    private Contribution contribution;
+    private Map<QName, Composite> map = new HashMap<QName, Composite>();
+    
+    public CompositeModelResolver(Contribution contribution) {
+        this.contribution = contribution;
+    }
+
+    public void addModel(Object resolved) {
+        Composite composite = (Composite)resolved;
+        map.put(composite.getName(), composite);
+    }
+    
+    public Object removeModel(Object resolved) {
+        return map.remove(((Composite)resolved).getName());
+    }
+    
+    public <T> T resolveModel(Class<T> modelClass, T unresolved) {
+        
+        // Lookup a definition for the given namespace
+        QName qname = ((Composite)unresolved).getName();
+        Composite resolved = (Composite) map.get(qname);
+        if (resolved != null) {
+            return (T)resolved;
+        }
+        
+        // No definition found, delegate the resolution to the imports
+        for (Import import_ : this.contribution.getImports()) {
+            if (import_ instanceof NamespaceImport) {
+                NamespaceImport namespaceImport = (NamespaceImport)import_;
+                if (namespaceImport.getNamespace().equals(qname.getNamespaceURI())) {
+                    
+                    // Delegate the resolution to the import resolver
+                    resolved = namespaceImport.getModelResolver().resolveModel(Composite.class, (Composite)unresolved);
+                    if (!resolved.isUnresolved()) {
+                        return (T)resolved;
+                    }
+                }
+            }
+        }
+        return (T)unresolved;
+    }
+    
+}

Propchange: incubator/tuscany/java/sca/modules/contribution-namespace/src/main/java/org/apache/tuscany/sca/contribution/namespace/impl/CompositeModelResolver.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/java/sca/modules/contribution-namespace/src/main/java/org/apache/tuscany/sca/contribution/namespace/impl/CompositeModelResolver.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Copied: incubator/tuscany/java/sca/modules/contribution-namespace/src/main/java/org/apache/tuscany/sca/contribution/namespace/impl/ConstrainingTypeModelResolver.java (from r561942, incubator/tuscany/java/sca/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/ConstrainingTypeModelResolver.java)
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/contribution-namespace/src/main/java/org/apache/tuscany/sca/contribution/namespace/impl/ConstrainingTypeModelResolver.java?view=diff&rev=562620&p1=incubator/tuscany/java/sca/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/ConstrainingTypeModelResolver.java&r1=561942&p2=incubator/tuscany/java/sca/modules/contribution-namespace/src/main/java/org/apache/tuscany/sca/contribution/namespace/impl/ConstrainingTypeModelResolver.java&r2=562620
==============================================================================
--- incubator/tuscany/java/sca/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/ConstrainingTypeModelResolver.java (original)
+++ incubator/tuscany/java/sca/modules/contribution-namespace/src/main/java/org/apache/tuscany/sca/contribution/namespace/impl/ConstrainingTypeModelResolver.java Fri Aug  3 16:55:35 2007
@@ -1,82 +1,82 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you 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.sca.assembly.xml;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import javax.xml.namespace.QName;
-
-import org.apache.tuscany.sca.assembly.ConstrainingType;
-import org.apache.tuscany.sca.contribution.Contribution;
-import org.apache.tuscany.sca.contribution.Import;
-import org.apache.tuscany.sca.contribution.NamespaceImport;
-import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
-
-/**
- * A Model Resolver for ConstrainingType models.
- *
- * @version $Rev: 557916 $ $Date: 2007-07-20 01:04:40 -0700 (Fri, 20 Jul 2007) $
- */
-public class ConstrainingTypeModelResolver implements ModelResolver {
-
-    private Contribution contribution;
-    private Map<QName, ConstrainingType> map = new HashMap<QName, ConstrainingType>();
-    
-    public ConstrainingTypeModelResolver(Contribution contribution) {
-        this.contribution = contribution;
-    }
-
-    public void addModel(Object resolved) {
-        ConstrainingType composite = (ConstrainingType)resolved;
-        map.put(composite.getName(), composite);
-    }
-    
-    public Object removeModel(Object resolved) {
-        return map.remove(((ConstrainingType)resolved).getName());
-    }
-    
-    public <T> T resolveModel(Class<T> modelClass, T unresolved) {
-        
-        // Lookup a definition for the given namespace
-        QName qname = ((ConstrainingType)unresolved).getName();
-        ConstrainingType resolved = (ConstrainingType) map.get(qname);
-        if (resolved != null) {
-            return (T)resolved;
-        }
-        
-        // No definition found, delegate the resolution to the imports
-        for (Import import_ : this.contribution.getImports()) {
-            if (import_ instanceof NamespaceImport) {
-                NamespaceImport namespaceImport = (NamespaceImport)import_;
-                if (namespaceImport.getNamespace().equals(qname.getNamespaceURI())) {
-                    
-                    // Delegate the resolution to the import resolver
-                    resolved = namespaceImport.getModelResolver().resolveModel(ConstrainingType.class, (ConstrainingType)unresolved);
-                    if (!resolved.isUnresolved()) {
-                        return (T)resolved;
-                    }
-                }
-            }
-        }
-        return (T)unresolved;
-    }
-    
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.sca.contribution.namespace.impl;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.sca.assembly.ConstrainingType;
+import org.apache.tuscany.sca.contribution.Contribution;
+import org.apache.tuscany.sca.contribution.Import;
+import org.apache.tuscany.sca.contribution.namespace.NamespaceImport;
+import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
+
+/**
+ * A Model Resolver for ConstrainingType models.
+ *
+ * @version $Rev$ $Date$
+ */
+public class ConstrainingTypeModelResolver implements ModelResolver {
+
+    private Contribution contribution;
+    private Map<QName, ConstrainingType> map = new HashMap<QName, ConstrainingType>();
+    
+    public ConstrainingTypeModelResolver(Contribution contribution) {
+        this.contribution = contribution;
+    }
+
+    public void addModel(Object resolved) {
+        ConstrainingType composite = (ConstrainingType)resolved;
+        map.put(composite.getName(), composite);
+    }
+    
+    public Object removeModel(Object resolved) {
+        return map.remove(((ConstrainingType)resolved).getName());
+    }
+    
+    public <T> T resolveModel(Class<T> modelClass, T unresolved) {
+        
+        // Lookup a definition for the given namespace
+        QName qname = ((ConstrainingType)unresolved).getName();
+        ConstrainingType resolved = (ConstrainingType) map.get(qname);
+        if (resolved != null) {
+            return (T)resolved;
+        }
+        
+        // No definition found, delegate the resolution to the imports
+        for (Import import_ : this.contribution.getImports()) {
+            if (import_ instanceof NamespaceImport) {
+                NamespaceImport namespaceImport = (NamespaceImport)import_;
+                if (namespaceImport.getNamespace().equals(qname.getNamespaceURI())) {
+                    
+                    // Delegate the resolution to the import resolver
+                    resolved = namespaceImport.getModelResolver().resolveModel(ConstrainingType.class, (ConstrainingType)unresolved);
+                    if (!resolved.isUnresolved()) {
+                        return (T)resolved;
+                    }
+                }
+            }
+        }
+        return (T)unresolved;
+    }
+    
+}

Propchange: incubator/tuscany/java/sca/modules/contribution-namespace/src/main/java/org/apache/tuscany/sca/contribution/namespace/impl/ConstrainingTypeModelResolver.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/java/sca/modules/contribution-namespace/src/main/java/org/apache/tuscany/sca/contribution/namespace/impl/ConstrainingTypeModelResolver.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Copied: incubator/tuscany/java/sca/modules/contribution-namespace/src/main/java/org/apache/tuscany/sca/contribution/namespace/impl/NamespaceExportImpl.java (from r561942, incubator/tuscany/java/sca/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/impl/NamespaceExportImpl.java)
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/contribution-namespace/src/main/java/org/apache/tuscany/sca/contribution/namespace/impl/NamespaceExportImpl.java?view=diff&rev=562620&p1=incubator/tuscany/java/sca/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/impl/NamespaceExportImpl.java&r1=561942&p2=incubator/tuscany/java/sca/modules/contribution-namespace/src/main/java/org/apache/tuscany/sca/contribution/namespace/impl/NamespaceExportImpl.java&r2=562620
==============================================================================
--- incubator/tuscany/java/sca/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/impl/NamespaceExportImpl.java (original)
+++ incubator/tuscany/java/sca/modules/contribution-namespace/src/main/java/org/apache/tuscany/sca/contribution/namespace/impl/NamespaceExportImpl.java Fri Aug  3 16:55:35 2007
@@ -17,10 +17,9 @@
  * under the License.    
  */
 
-package org.apache.tuscany.sca.contribution.impl;
+package org.apache.tuscany.sca.contribution.namespace.impl;
 
-import org.apache.tuscany.sca.contribution.ContributionExport;
-import org.apache.tuscany.sca.contribution.NamespaceExport;
+import org.apache.tuscany.sca.contribution.namespace.NamespaceExport;
 import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
 
 /**
@@ -28,11 +27,15 @@
  * 
  * @version $Rev$ $Date$
  */
-public class NamespaceExportImpl implements NamespaceExport, ContributionExport {
-    private String namespace; // The namespace to be imported
+public class NamespaceExportImpl implements NamespaceExport {
+    /**
+     * The namespace to be exported
+     */
+    private String namespace; 
     private ModelResolver modelResolver;
     
     protected NamespaceExportImpl() {
+        super();
     }
     
     public String getNamespace() {

Added: incubator/tuscany/java/sca/modules/contribution-namespace/src/main/java/org/apache/tuscany/sca/contribution/namespace/impl/NamespaceExportProcessor.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/contribution-namespace/src/main/java/org/apache/tuscany/sca/contribution/namespace/impl/NamespaceExportProcessor.java?view=auto&rev=562620
==============================================================================
--- incubator/tuscany/java/sca/modules/contribution-namespace/src/main/java/org/apache/tuscany/sca/contribution/namespace/impl/NamespaceExportProcessor.java (added)
+++ incubator/tuscany/java/sca/modules/contribution-namespace/src/main/java/org/apache/tuscany/sca/contribution/namespace/impl/NamespaceExportProcessor.java Fri Aug  3 16:55:35 2007
@@ -0,0 +1,111 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.sca.contribution.namespace.impl;
+
+import static javax.xml.stream.XMLStreamConstants.START_ELEMENT;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamConstants;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.XMLStreamWriter;
+
+import org.apache.tuscany.sca.contribution.namespace.NamespaceExport;
+import org.apache.tuscany.sca.contribution.namespace.NamespaceImportExportFactory;
+import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
+import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
+import org.apache.tuscany.sca.contribution.service.ContributionReadException;
+import org.apache.tuscany.sca.contribution.service.ContributionResolveException;
+import org.apache.tuscany.sca.contribution.service.ContributionWriteException;
+
+/**
+ * Artifact processor for Namespace export
+ * 
+ * @version $Rev$ $Date$
+ */
+public class NamespaceExportProcessor implements StAXArtifactProcessor<NamespaceExport> {
+    private static final String SCA10_NS = "http://www.osoa.org/xmlns/sca/1.0";
+    
+    private static final QName EXPORT = new QName(SCA10_NS, "export");
+    
+    private static final String NAMESPACE = "namespace";
+    
+    private final NamespaceImportExportFactory factory;
+    
+    public NamespaceExportProcessor(NamespaceImportExportFactory factory) {
+        super();
+        this.factory = factory;
+    }
+
+    public QName getArtifactType() {
+        return EXPORT;
+    }
+    
+    public Class<NamespaceExport> getModelType() {
+        return NamespaceExport.class;
+    }
+    
+    /**
+     * Process <export namespace=""/>
+     */
+    public NamespaceExport read(XMLStreamReader reader) throws ContributionReadException, XMLStreamException {
+        NamespaceExport namespaceExport = this.factory.createNamespaceExport();
+        QName element = null;
+
+        
+        while (reader.hasNext()) {
+            int event = reader.getEventType();
+            switch (event) {
+                case START_ELEMENT:
+                    element = reader.getName();
+                    
+                    if (EXPORT.equals(element)) {
+                        String ns = reader.getAttributeValue(null, NAMESPACE);
+                        if (ns == null) {
+                            throw new ContributionReadException("Attribute 'namespace' is missing");
+                        }
+                        namespaceExport.setNamespace(ns);
+                    } 
+                    
+                    break;
+                case XMLStreamConstants.END_ELEMENT:
+                    if (EXPORT.equals(reader.getName())) {
+                        return namespaceExport;
+                    }
+                    break;        
+            }
+            
+            //Read the next element
+            if (reader.hasNext()) {
+                reader.next();
+            }
+        }
+        
+        return namespaceExport;
+    }
+
+    public void write(NamespaceExport model, XMLStreamWriter outputSource) throws ContributionWriteException, XMLStreamException {
+        
+    }
+
+    public void resolve(NamespaceExport model, ModelResolver resolver) throws ContributionResolveException {
+        
+    }
+}

Propchange: incubator/tuscany/java/sca/modules/contribution-namespace/src/main/java/org/apache/tuscany/sca/contribution/namespace/impl/NamespaceExportProcessor.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/java/sca/modules/contribution-namespace/src/main/java/org/apache/tuscany/sca/contribution/namespace/impl/NamespaceExportProcessor.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/tuscany/java/sca/modules/contribution-namespace/src/main/java/org/apache/tuscany/sca/contribution/namespace/impl/NamespaceImportExportFactoryImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/contribution-namespace/src/main/java/org/apache/tuscany/sca/contribution/namespace/impl/NamespaceImportExportFactoryImpl.java?view=auto&rev=562620
==============================================================================
--- incubator/tuscany/java/sca/modules/contribution-namespace/src/main/java/org/apache/tuscany/sca/contribution/namespace/impl/NamespaceImportExportFactoryImpl.java (added)
+++ incubator/tuscany/java/sca/modules/contribution-namespace/src/main/java/org/apache/tuscany/sca/contribution/namespace/impl/NamespaceImportExportFactoryImpl.java Fri Aug  3 16:55:35 2007
@@ -0,0 +1,41 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.sca.contribution.namespace.impl;
+
+import org.apache.tuscany.sca.contribution.namespace.NamespaceExport;
+import org.apache.tuscany.sca.contribution.namespace.NamespaceImport;
+import org.apache.tuscany.sca.contribution.namespace.NamespaceImportExportFactory;
+
+/**
+ * Namespace Import/Export model factory implementation
+ * 
+ * @version $Rev$ $Date$
+ */
+public class NamespaceImportExportFactoryImpl implements NamespaceImportExportFactory {
+
+    public NamespaceImport createNamespaceImport() {
+        return new NamespaceImportImpl();
+    }
+    
+    public NamespaceExport createNamespaceExport() {
+        return new NamespaceExportImpl();
+    }
+
+}

Propchange: incubator/tuscany/java/sca/modules/contribution-namespace/src/main/java/org/apache/tuscany/sca/contribution/namespace/impl/NamespaceImportExportFactoryImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/java/sca/modules/contribution-namespace/src/main/java/org/apache/tuscany/sca/contribution/namespace/impl/NamespaceImportExportFactoryImpl.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/tuscany/java/sca/modules/contribution-namespace/src/main/java/org/apache/tuscany/sca/contribution/namespace/impl/NamespaceImportExportListener.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/contribution-namespace/src/main/java/org/apache/tuscany/sca/contribution/namespace/impl/NamespaceImportExportListener.java?view=auto&rev=562620
==============================================================================
--- incubator/tuscany/java/sca/modules/contribution-namespace/src/main/java/org/apache/tuscany/sca/contribution/namespace/impl/NamespaceImportExportListener.java (added)
+++ incubator/tuscany/java/sca/modules/contribution-namespace/src/main/java/org/apache/tuscany/sca/contribution/namespace/impl/NamespaceImportExportListener.java Fri Aug  3 16:55:35 2007
@@ -0,0 +1,97 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.sca.contribution.namespace.impl;
+
+import org.apache.tuscany.sca.contribution.Contribution;
+import org.apache.tuscany.sca.contribution.Export;
+import org.apache.tuscany.sca.contribution.Import;
+import org.apache.tuscany.sca.contribution.namespace.NamespaceExport;
+import org.apache.tuscany.sca.contribution.namespace.NamespaceImport;
+import org.apache.tuscany.sca.contribution.resolver.DefaultImportAllModelResolver;
+import org.apache.tuscany.sca.contribution.service.ContributionListener;
+import org.apache.tuscany.sca.contribution.service.ContributionRepository;
+
+/**
+ * Namespace Import/Export contribution listener
+ * The listener would process all import/export from a given contribution 
+ * and initialize the model resolvers properly
+ * 
+ * @version $Rev$ $Date$
+ */
+public class NamespaceImportExportListener implements ContributionListener {
+
+    /**
+     * Initialize the import/export model resolvers
+     * Export model resolvers are same as Contribution model resolver
+     * Import model resolvers are matched to a specific contribution if a location uri is specified, 
+     *    otherwise it try to resolve agains all the other contributions
+     */    
+    public void contributionAdded(ContributionRepository repository, Contribution contribution) {
+        // Initialize the contribution exports
+        for (Export export: contribution.getExports()) {
+            export.setModelResolver(contribution.getModelResolver());
+        }
+        
+        // Initialize the contribution imports
+        for (Import import_: contribution.getImports()) {
+            boolean initialized = false;
+            
+            if (import_ instanceof NamespaceImport) {
+                NamespaceImport namespaceImport = (NamespaceImport)import_;
+                
+                // Find a matching contribution
+                if (namespaceImport.getLocation() != null) {
+                    Contribution targetContribution = repository.getContribution(namespaceImport.getLocation());
+                    if (targetContribution != null) {
+                    
+                        // Find a matching contribution export
+                        for (Export export: targetContribution.getExports()) {
+                            if (export instanceof NamespaceExport) {
+                                NamespaceExport namespaceExport = (NamespaceExport)export;
+                                if (namespaceImport.getNamespace().equals(namespaceExport.getNamespace())) {
+                                    namespaceImport.setModelResolver(namespaceExport.getModelResolver());
+                                    initialized = true;
+                                    break;
+                                }
+                            }
+                        }
+                    }
+                } 
+            } 
+            
+            //if no location was specified, try to resolve with any contribution            
+            if( !initialized ) {
+                // Use a resolver that will consider all contributions
+                import_.setModelResolver(new DefaultImportAllModelResolver(import_, repository.getContributions()));
+            }
+            
+        }
+
+    }
+
+    public void contributionRemoved(ContributionRepository repository, Contribution contribution) {
+
+    }
+
+    public void contributionUpdated(ContributionRepository repository, Contribution oldContribution, Contribution contribution) {
+
+    }
+
+}

Propchange: incubator/tuscany/java/sca/modules/contribution-namespace/src/main/java/org/apache/tuscany/sca/contribution/namespace/impl/NamespaceImportExportListener.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/java/sca/modules/contribution-namespace/src/main/java/org/apache/tuscany/sca/contribution/namespace/impl/NamespaceImportExportListener.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/tuscany/java/sca/modules/contribution-namespace/src/main/java/org/apache/tuscany/sca/contribution/namespace/impl/NamespaceImportExportModuleActivator.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/contribution-namespace/src/main/java/org/apache/tuscany/sca/contribution/namespace/impl/NamespaceImportExportModuleActivator.java?view=auto&rev=562620
==============================================================================
--- incubator/tuscany/java/sca/modules/contribution-namespace/src/main/java/org/apache/tuscany/sca/contribution/namespace/impl/NamespaceImportExportModuleActivator.java (added)
+++ incubator/tuscany/java/sca/modules/contribution-namespace/src/main/java/org/apache/tuscany/sca/contribution/namespace/impl/NamespaceImportExportModuleActivator.java Fri Aug  3 16:55:35 2007
@@ -0,0 +1,98 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.sca.contribution.namespace.impl;
+
+import org.apache.tuscany.sca.assembly.Composite;
+import org.apache.tuscany.sca.assembly.ConstrainingType;
+import org.apache.tuscany.sca.contribution.namespace.NamespaceImportExportFactory;
+import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessorExtensionPoint;
+import org.apache.tuscany.sca.contribution.resolver.ModelResolverExtensionPoint;
+import org.apache.tuscany.sca.contribution.service.ContributionListenerExtensionPoint;
+import org.apache.tuscany.sca.core.ExtensionPointRegistry;
+import org.apache.tuscany.sca.core.ModuleActivator;
+
+/**
+ * Namespace Import/Export module activator
+ * Responsible for registering all extension points provide by the module such as :
+ *    - Import/Export processors
+ *    - Composite and ConstrainingType model resolvers
+ *    - Import/Export listeners
+ * 
+ * @version $Rev$ $Date$
+ */
+public class NamespaceImportExportModuleActivator implements ModuleActivator {
+    private static final NamespaceImportExportFactory factory = new NamespaceImportExportFactoryImpl();
+    
+    /**
+     * Artifact processors for <import.java>
+     */
+    private NamespaceImportProcessor importProcessor;
+
+    /**
+     * Artifact processors for <export.java>
+     */
+    private NamespaceExportProcessor exportProcessor;
+        
+    /**
+     * Java Import/Export listener
+     */
+    private NamespaceImportExportListener listener;
+
+    public Object[] getExtensionPoints() {
+        return null;
+    }
+
+    public void start(ExtensionPointRegistry registry) {
+        importProcessor = new NamespaceImportProcessor(factory);
+        exportProcessor = new NamespaceExportProcessor(factory);
+
+        //register artifact processors for java import/export
+        StAXArtifactProcessorExtensionPoint processors = registry.getExtensionPoint(StAXArtifactProcessorExtensionPoint.class);
+        processors.addArtifactProcessor(importProcessor);
+        processors.addArtifactProcessor(exportProcessor);
+        
+        //register artifact model resolvers for composites and constraining types supporting import/export
+        ModelResolverExtensionPoint resolvers = registry.getExtensionPoint(ModelResolverExtensionPoint.class);
+        resolvers.addResolver(Composite.class, CompositeModelResolver.class);
+        resolvers.addResolver(ConstrainingType.class, ConstrainingTypeModelResolver.class);
+
+        
+        //register contribution listener responsible for initializing import/export model resolvers
+        ContributionListenerExtensionPoint listeners = registry.getExtensionPoint(ContributionListenerExtensionPoint.class);
+        listeners.addContributionListener(new NamespaceImportExportListener());
+    }
+
+    public void stop(ExtensionPointRegistry registry) {
+        //unregister artifact processors
+        StAXArtifactProcessorExtensionPoint processors = registry.getExtensionPoint(StAXArtifactProcessorExtensionPoint.class);
+        processors.removeArtifactProcessor(importProcessor);
+        processors.removeArtifactProcessor(exportProcessor);
+        
+        //unregister artifact model resolvers
+        ModelResolverExtensionPoint resolvers = registry.getExtensionPoint(ModelResolverExtensionPoint.class);
+        resolvers.removeResolver(Composite.class);
+        resolvers.removeResolver(ConstrainingType.class);
+        
+        //unregister contribution listener
+        ContributionListenerExtensionPoint listeners = registry.getExtensionPoint(ContributionListenerExtensionPoint.class);
+        listeners.removeContributionListener(listener);
+    }
+
+}

Propchange: incubator/tuscany/java/sca/modules/contribution-namespace/src/main/java/org/apache/tuscany/sca/contribution/namespace/impl/NamespaceImportExportModuleActivator.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/java/sca/modules/contribution-namespace/src/main/java/org/apache/tuscany/sca/contribution/namespace/impl/NamespaceImportExportModuleActivator.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Copied: incubator/tuscany/java/sca/modules/contribution-namespace/src/main/java/org/apache/tuscany/sca/contribution/namespace/impl/NamespaceImportImpl.java (from r561942, incubator/tuscany/java/sca/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/impl/NamespaceImportImpl.java)
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/contribution-namespace/src/main/java/org/apache/tuscany/sca/contribution/namespace/impl/NamespaceImportImpl.java?view=diff&rev=562620&p1=incubator/tuscany/java/sca/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/impl/NamespaceImportImpl.java&r1=561942&p2=incubator/tuscany/java/sca/modules/contribution-namespace/src/main/java/org/apache/tuscany/sca/contribution/namespace/impl/NamespaceImportImpl.java&r2=562620
==============================================================================
--- incubator/tuscany/java/sca/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/impl/NamespaceImportImpl.java (original)
+++ incubator/tuscany/java/sca/modules/contribution-namespace/src/main/java/org/apache/tuscany/sca/contribution/namespace/impl/NamespaceImportImpl.java Fri Aug  3 16:55:35 2007
@@ -17,12 +17,11 @@
  * under the License.    
  */
 
-package org.apache.tuscany.sca.contribution.impl;
+package org.apache.tuscany.sca.contribution.namespace.impl;
 
-import org.apache.tuscany.sca.contribution.ContributionImport;
 import org.apache.tuscany.sca.contribution.Export;
-import org.apache.tuscany.sca.contribution.NamespaceExport;
-import org.apache.tuscany.sca.contribution.NamespaceImport;
+import org.apache.tuscany.sca.contribution.namespace.NamespaceExport;
+import org.apache.tuscany.sca.contribution.namespace.NamespaceImport;
 import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
 
 /**
@@ -30,12 +29,20 @@
  * 
  * @version $Rev$ $Date$
  */
-public class NamespaceImportImpl implements NamespaceImport, ContributionImport {
-    private String namespace; // The namespace to be imported
-    private String location; // Optional location to hint the where it should be imported
+public class NamespaceImportImpl implements NamespaceImport {
     private ModelResolver modelResolver;
+    /**
+     * The namespace to be imported
+     */
+    private String namespace; 
+    /**
+     * Optional location URI pointing to a Contribution that exports the namespace
+     */
+    private String location;
+
     
     protected NamespaceImportImpl() {
+        super();
     }
     
     public String getLocation() {
@@ -61,7 +68,12 @@
     public void setModelResolver(ModelResolver modelResolver) {
         this.modelResolver = modelResolver;
     }
-    
+
+    /**
+     * Match a NamespaceImport to a given NamespaceExport based on :
+     *    location is not provided
+     *    import and export namespaces match
+     */
     public boolean match(Export export) {
         if (export instanceof NamespaceExport) {
             if (this.getLocation() == null || this.getLocation().length() == 0) {

Added: incubator/tuscany/java/sca/modules/contribution-namespace/src/main/java/org/apache/tuscany/sca/contribution/namespace/impl/NamespaceImportProcessor.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/contribution-namespace/src/main/java/org/apache/tuscany/sca/contribution/namespace/impl/NamespaceImportProcessor.java?view=auto&rev=562620
==============================================================================
--- incubator/tuscany/java/sca/modules/contribution-namespace/src/main/java/org/apache/tuscany/sca/contribution/namespace/impl/NamespaceImportProcessor.java (added)
+++ incubator/tuscany/java/sca/modules/contribution-namespace/src/main/java/org/apache/tuscany/sca/contribution/namespace/impl/NamespaceImportProcessor.java Fri Aug  3 16:55:35 2007
@@ -0,0 +1,115 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.sca.contribution.namespace.impl;
+
+import static javax.xml.stream.XMLStreamConstants.START_ELEMENT;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamConstants;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.XMLStreamWriter;
+
+import org.apache.tuscany.sca.contribution.namespace.NamespaceImport;
+import org.apache.tuscany.sca.contribution.namespace.NamespaceImportExportFactory;
+import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
+import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
+import org.apache.tuscany.sca.contribution.service.ContributionReadException;
+import org.apache.tuscany.sca.contribution.service.ContributionResolveException;
+import org.apache.tuscany.sca.contribution.service.ContributionWriteException;
+
+/**
+ * Artifact processor for Namespace import
+ * 
+ * @version $Rev$ $Date$
+ */
+public class NamespaceImportProcessor  implements StAXArtifactProcessor<NamespaceImport> {
+    private static final String SCA10_NS = "http://www.osoa.org/xmlns/sca/1.0";
+    
+    private static final QName IMPORT = new QName(SCA10_NS, "import");
+
+    private static final String NAMESPACE = "namespace";
+    private static final String LOCATION = "location";
+    
+    private final NamespaceImportExportFactory factory;
+    
+    public NamespaceImportProcessor(NamespaceImportExportFactory factory) {
+        super();
+        this.factory = factory;
+    }
+    
+    public QName getArtifactType() {
+        return IMPORT;
+    }
+    
+    public Class<NamespaceImport> getModelType() {
+        return NamespaceImport.class;
+    }
+
+    /**
+     * Process <import namespace="" location=""/>
+     */
+    public NamespaceImport read(XMLStreamReader reader) throws ContributionReadException, XMLStreamException {
+        NamespaceImport namespaceImport = this.factory.createNamespaceImport();
+        QName element = null;
+        
+        while (reader.hasNext()) {
+            int event = reader.getEventType();
+            switch (event) {
+                case START_ELEMENT:
+                    element = reader.getName();
+                    
+                    if (IMPORT.equals(element)) {
+                        String ns = reader.getAttributeValue(null, NAMESPACE);
+                        if (ns == null) {
+                            throw new ContributionReadException("Attribute 'namespace' is missing");
+                        }
+                        String location = reader.getAttributeValue(null, LOCATION);
+                        if (location != null) {
+                            namespaceImport.setLocation(location);
+                        }
+                        namespaceImport.setNamespace(ns);
+                    }
+                    break;
+                case XMLStreamConstants.END_ELEMENT:
+                    if (IMPORT.equals(reader.getName())) {
+                        return namespaceImport;
+                    }
+                    break;        
+            }
+            
+            //Read the next element
+            if (reader.hasNext()) {
+                reader.next();
+            }
+        }
+        
+        return namespaceImport;
+    }
+
+    public void write(NamespaceImport model, XMLStreamWriter outputSource) throws ContributionWriteException, XMLStreamException {
+        
+    }
+
+
+    public void resolve(NamespaceImport model, ModelResolver resolver) throws ContributionResolveException {
+        
+    }
+}

Propchange: incubator/tuscany/java/sca/modules/contribution-namespace/src/main/java/org/apache/tuscany/sca/contribution/namespace/impl/NamespaceImportProcessor.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/java/sca/modules/contribution-namespace/src/main/java/org/apache/tuscany/sca/contribution/namespace/impl/NamespaceImportProcessor.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/tuscany/java/sca/modules/contribution-namespace/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.ModuleActivator
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/contribution-namespace/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.ModuleActivator?view=auto&rev=562620
==============================================================================
--- incubator/tuscany/java/sca/modules/contribution-namespace/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.ModuleActivator (added)
+++ incubator/tuscany/java/sca/modules/contribution-namespace/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.ModuleActivator Fri Aug  3 16:55:35 2007
@@ -0,0 +1,20 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you 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. 
+#
+# Implementation class for the ExtensionActivator
+#
+org.apache.tuscany.sca.contribution.namespace.impl.NamespaceImportExportModuleActivator

Added: incubator/tuscany/java/sca/modules/contribution-namespace/src/test/java/org/apache/tuscany/sca/contribution/namespace/impl/NamespaceExportProcessorTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/contribution-namespace/src/test/java/org/apache/tuscany/sca/contribution/namespace/impl/NamespaceExportProcessorTestCase.java?view=auto&rev=562620
==============================================================================
--- incubator/tuscany/java/sca/modules/contribution-namespace/src/test/java/org/apache/tuscany/sca/contribution/namespace/impl/NamespaceExportProcessorTestCase.java (added)
+++ incubator/tuscany/java/sca/modules/contribution-namespace/src/test/java/org/apache/tuscany/sca/contribution/namespace/impl/NamespaceExportProcessorTestCase.java Fri Aug  3 16:55:35 2007
@@ -0,0 +1,69 @@
+package org.apache.tuscany.sca.contribution.namespace.impl;
+
+
+
+import java.io.StringReader;
+
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLStreamReader;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.contribution.namespace.NamespaceExport;
+import org.apache.tuscany.sca.contribution.service.ContributionReadException;
+
+/**
+ * Test NamespaceExportProcessorTestCase
+ *  
+ * @version $Rev$ $Date$
+ */
+public class NamespaceExportProcessorTestCase extends TestCase {
+
+    private static final String VALID_XML =
+        "<?xml version=\"1.0\" encoding=\"ASCII\"?>" 
+            + "<contribution xmlns=\"http://www.osoa.org/xmlns/sca/1.0\" xmlns:ns=\"http://ns\">"
+            + "<export namespace=\"http://foo\"/>"
+            + "</contribution>";
+
+    private static final String INVALID_XML =
+        "<?xml version=\"1.0\" encoding=\"ASCII\"?>" 
+            + "<contribution xmlns=\"http://www.osoa.org/xmlns/sca/1.0\" xmlns:ns=\"http://ns\">"
+            + "<export/>"
+            + "</contribution>";
+
+    private XMLInputFactory xmlFactory;
+
+    protected void setUp() throws Exception {
+        super.setUp();
+        xmlFactory = XMLInputFactory.newInstance();
+    }
+
+    /**
+     * Test loading a valid export element from a contribution metadata stream
+     * @throws Exception
+     */
+    public void testLoad() throws Exception {
+        XMLStreamReader reader = xmlFactory.createXMLStreamReader(new StringReader(VALID_XML));
+
+        NamespaceExportProcessor exportProcessor = new NamespaceExportProcessor(new NamespaceImportExportFactoryImpl());
+        NamespaceExport namespaceExport = exportProcessor.read(reader);
+        
+        assertEquals("http://foo", namespaceExport.getNamespace());
+    }
+
+    /**
+     * Test loading an INVALID export element from a contribution metadata stream
+     * @throws Exception
+     */
+    public void testLoadInvalid() throws Exception {
+        XMLStreamReader reader = xmlFactory.createXMLStreamReader(new StringReader(INVALID_XML));
+
+        NamespaceExportProcessor exportProcessor = new NamespaceExportProcessor(new NamespaceImportExportFactoryImpl());
+        try {
+            exportProcessor.read(reader);
+            fail("readerException should have been thrown");
+        } catch (ContributionReadException e) {
+            assertTrue(true);
+        }
+    }    
+}

Propchange: incubator/tuscany/java/sca/modules/contribution-namespace/src/test/java/org/apache/tuscany/sca/contribution/namespace/impl/NamespaceExportProcessorTestCase.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/java/sca/modules/contribution-namespace/src/test/java/org/apache/tuscany/sca/contribution/namespace/impl/NamespaceExportProcessorTestCase.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/tuscany/java/sca/modules/contribution-namespace/src/test/java/org/apache/tuscany/sca/contribution/namespace/impl/NamespaceImportProcessorTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/contribution-namespace/src/test/java/org/apache/tuscany/sca/contribution/namespace/impl/NamespaceImportProcessorTestCase.java?view=auto&rev=562620
==============================================================================
--- incubator/tuscany/java/sca/modules/contribution-namespace/src/test/java/org/apache/tuscany/sca/contribution/namespace/impl/NamespaceImportProcessorTestCase.java (added)
+++ incubator/tuscany/java/sca/modules/contribution-namespace/src/test/java/org/apache/tuscany/sca/contribution/namespace/impl/NamespaceImportProcessorTestCase.java Fri Aug  3 16:55:35 2007
@@ -0,0 +1,70 @@
+package org.apache.tuscany.sca.contribution.namespace.impl;
+
+
+
+import java.io.StringReader;
+
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLStreamReader;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.contribution.namespace.NamespaceImport;
+import org.apache.tuscany.sca.contribution.service.ContributionReadException;
+
+/**
+ * Test NamespaceImportProcessorTestCase
+ * 
+ * @version $Rev$ $Date$
+ */
+public class NamespaceImportProcessorTestCase extends TestCase {
+
+    private static final String VALID_XML =
+        "<?xml version=\"1.0\" encoding=\"ASCII\"?>" 
+            + "<contribution xmlns=\"http://www.osoa.org/xmlns/sca/1.0\" xmlns:ns=\"http://ns\">"
+            + "<import namespace=\"http://foo\" location=\"sca://contributions/001\"/>"
+            + "</contribution>";
+
+    private static final String INVALID_XML =
+        "<?xml version=\"1.0\" encoding=\"ASCII\"?>" 
+            + "<contribution xmlns=\"http://www.osoa.org/xmlns/sca/1.0\" xmlns:ns=\"http://ns\">"
+            + "<import location=\"sca://contributions/001\"/>"
+            + "</contribution>";
+
+    private XMLInputFactory xmlFactory;
+
+    protected void setUp() throws Exception {
+        super.setUp();
+        xmlFactory = XMLInputFactory.newInstance();
+    }
+
+    /**
+     * Test loading a valid import element from a contribution metadata stream
+     * @throws Exception
+     */
+    public void testLoad() throws Exception {
+        XMLStreamReader reader = xmlFactory.createXMLStreamReader(new StringReader(VALID_XML));
+
+        NamespaceImportProcessor importProcessor = new NamespaceImportProcessor(new NamespaceImportExportFactoryImpl());
+        NamespaceImport namespaceImport = importProcessor.read(reader);
+        
+        assertEquals("http://foo", namespaceImport.getNamespace());
+        assertEquals("sca://contributions/001", namespaceImport.getLocation());
+    }
+
+    /**
+     * Test loading a INVALID import element from a contribution metadata stream
+     * @throws Exception
+     */
+    public void testLoadInvalid() throws Exception {
+        XMLStreamReader reader = xmlFactory.createXMLStreamReader(new StringReader(INVALID_XML));
+
+        NamespaceImportProcessor importProcessor = new NamespaceImportProcessor(new NamespaceImportExportFactoryImpl());
+        try {
+            importProcessor.read(reader);
+            fail("readerException should have been thrown");
+        } catch (ContributionReadException e) {
+            assertTrue(true);
+        }
+    }    
+}

Propchange: incubator/tuscany/java/sca/modules/contribution-namespace/src/test/java/org/apache/tuscany/sca/contribution/namespace/impl/NamespaceImportProcessorTestCase.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/java/sca/modules/contribution-namespace/src/test/java/org/apache/tuscany/sca/contribution/namespace/impl/NamespaceImportProcessorTestCase.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Modified: incubator/tuscany/java/sca/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/ContributionFactory.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/ContributionFactory.java?view=diff&rev=562620&r1=562619&r2=562620
==============================================================================
--- incubator/tuscany/java/sca/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/ContributionFactory.java (original)
+++ incubator/tuscany/java/sca/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/ContributionFactory.java Fri Aug  3 16:55:35 2007
@@ -19,6 +19,7 @@
 
 package org.apache.tuscany.sca.contribution;
 
+
 /**
  * Contribution model object factory
  * 
@@ -37,34 +38,5 @@
      * 
      * @return The new deployedArtifact model object
      */
-    DeployedArtifact createDeployedArtifact();
-    
-    /**
-     * Create a contribution import model
-     * @deprecated 
-     * @return The new ContributionImport model object
-     */
-    ContributionImport createContributionImport();
-    
-    /**
-     * Create a contribution import model
-     * @deprecated
-     * @return The new ContributoinExport object
-     */
-    ContributionExport createContributionExport();
-
-    /**
-     * Create a namespace import model object
-     * 
-     * @return The new NamespaceImport model object
-     */
-    NamespaceImport createNamespaceImport();
-    
-    /**
-     * Create a namespace export model object
-     * 
-     * @return The new NamespaceExport model object
-     */
-    NamespaceExport createNamespaceExport();
-    
+    DeployedArtifact createDeployedArtifact();   
 }

Added: incubator/tuscany/java/sca/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/resolver/DefaultImportAllModelResolver.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/resolver/DefaultImportAllModelResolver.java?view=auto&rev=562620
==============================================================================
--- incubator/tuscany/java/sca/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/resolver/DefaultImportAllModelResolver.java (added)
+++ incubator/tuscany/java/sca/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/resolver/DefaultImportAllModelResolver.java Fri Aug  3 16:55:35 2007
@@ -0,0 +1,83 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.sca.contribution.resolver;
+
+import java.util.List;
+
+import org.apache.tuscany.sca.contribution.Contribution;
+import org.apache.tuscany.sca.contribution.Export;
+import org.apache.tuscany.sca.contribution.Import;
+
+/**
+ * A model resolver implementation that considers Exports in any available contribution
+ *
+ * @version $Rev: 560435 $ $Date: 2007-07-27 18:26:55 -0700 (Fri, 27 Jul 2007) $
+ */
+public class DefaultImportAllModelResolver implements ModelResolver {
+    
+    private Import import_;
+    private List<Contribution> contributions;
+    
+    public DefaultImportAllModelResolver(Import import_, List<Contribution> contributions) {
+        this.import_ = import_;
+        this.contributions = contributions;
+    }
+
+    public void addModel(Object resolved) {
+        throw new IllegalStateException();
+    }
+
+    public Object removeModel(Object resolved) {
+        throw new IllegalStateException();
+    }
+
+    public <T> T resolveModel(Class<T> modelClass, T unresolved) {
+        
+        //TODO optimize and cache results of the resolution later
+        
+        // Go over all available contributions
+        for (Contribution contribution : contributions) {
+            
+            // Go over all exports in the contribution
+            for (Export export : contribution.getExports()) {
+                    // If the export matches our namespace, try to the resolve the model object
+                    if (import_.match(export)) {
+                        Object resolved = export.getModelResolver().resolveModel(modelClass, unresolved);
+                        
+                        // Return the resolved model object
+                        if (resolved instanceof org.apache.tuscany.sca.interfacedef.Base) {
+                            if (!((org.apache.tuscany.sca.interfacedef.Base)resolved).isUnresolved()) {
+                                return modelClass.cast(resolved);
+                            }
+                        }
+                        else if (resolved instanceof org.apache.tuscany.sca.assembly.Base) {
+                            if (!((org.apache.tuscany.sca.assembly.Base)resolved).isUnresolved()) {
+                                return modelClass.cast(resolved);
+                            }
+                        }
+                    }
+            }
+        }
+
+        // Model object was not resolved
+        return unresolved;
+    }
+
+}

Added: incubator/tuscany/java/sca/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/service/ExtensibleContributionListener.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/service/ExtensibleContributionListener.java?view=auto&rev=562620
==============================================================================
--- incubator/tuscany/java/sca/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/service/ExtensibleContributionListener.java (added)
+++ incubator/tuscany/java/sca/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/service/ExtensibleContributionListener.java Fri Aug  3 16:55:35 2007
@@ -0,0 +1,77 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.sca.contribution.service;
+
+import org.apache.tuscany.sca.contribution.Contribution;
+
+public class ExtensibleContributionListener implements ContributionListener {
+    private final ContributionListenerExtensionPoint listeners;
+
+    /**
+     * Default constructor receiving the listener extension point
+     * 
+     * @param listeners
+     */
+    public ExtensibleContributionListener(ContributionListenerExtensionPoint listeners) {
+        this.listeners = listeners;
+    }
+
+    /**
+     * Process "contributionAdded" event to all resigtered listeners
+     */
+    public void contributionAdded(ContributionRepository repository, Contribution contribution) {
+        for (ContributionListener listener : listeners.getContributionListeners()) {
+            try {
+                listener.contributionAdded(repository, contribution);
+            } catch (Exception e) {
+                // ignore, contiue to the next listener
+            }
+        }
+    }
+
+    /**
+     * Process "contributionRemoved" event to all registered listeners
+     */
+    public void contributionRemoved(ContributionRepository repository, Contribution contribution) {
+        for (ContributionListener listener : listeners.getContributionListeners()) {
+            try {
+                listener.contributionRemoved(repository, contribution);
+            } catch (Exception e) {
+                // ignore, contiue to the next listener
+            }
+
+        }
+    }
+
+    /**
+     * Process "contributionUpdated" event to all registered listeners
+     */
+    public void contributionUpdated(ContributionRepository repository, Contribution oldContribution, Contribution contribution) {
+        for (ContributionListener listener : listeners.getContributionListeners()) {
+            try {
+                listener.contributionUpdated(repository, oldContribution, contribution);
+            } catch (Exception e) {
+                // ignore, contiue to the next listener
+            }
+
+        }
+    }
+
+}

Propchange: incubator/tuscany/java/sca/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/service/ExtensibleContributionListener.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/java/sca/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/service/ExtensibleContributionListener.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Modified: incubator/tuscany/java/sca/modules/distributed/src/main/java/org/apache/tuscany/sca/distributed/host/impl/NodeRuntimeBuilder.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/distributed/src/main/java/org/apache/tuscany/sca/distributed/host/impl/NodeRuntimeBuilder.java?view=diff&rev=562620&r1=562619&r2=562620
==============================================================================
--- incubator/tuscany/java/sca/modules/distributed/src/main/java/org/apache/tuscany/sca/distributed/host/impl/NodeRuntimeBuilder.java (original)
+++ incubator/tuscany/java/sca/modules/distributed/src/main/java/org/apache/tuscany/sca/distributed/host/impl/NodeRuntimeBuilder.java Fri Aug  3 16:55:35 2007
@@ -25,19 +25,12 @@
 import javax.xml.stream.XMLOutputFactory;
 
 import org.apache.tuscany.sca.assembly.AssemblyFactory;
-import org.apache.tuscany.sca.assembly.Composite;
-import org.apache.tuscany.sca.assembly.ConstrainingType;
 import org.apache.tuscany.sca.assembly.xml.ComponentTypeDocumentProcessor;
 import org.apache.tuscany.sca.assembly.xml.ComponentTypeProcessor;
-import org.apache.tuscany.sca.assembly.xml.CompositeModelResolver;
 import org.apache.tuscany.sca.assembly.xml.CompositeProcessor;
 import org.apache.tuscany.sca.assembly.xml.ConstrainingTypeDocumentProcessor;
-import org.apache.tuscany.sca.assembly.xml.ConstrainingTypeModelResolver;
 import org.apache.tuscany.sca.assembly.xml.ConstrainingTypeProcessor;
 import org.apache.tuscany.sca.contribution.ContributionFactory;
-import org.apache.tuscany.sca.contribution.java.impl.ClassReferenceModelResolver;
-import org.apache.tuscany.sca.contribution.java.impl.JavaExportProcessor;
-import org.apache.tuscany.sca.contribution.java.impl.JavaImportProcessor;
 import org.apache.tuscany.sca.contribution.processor.ContributionPostProcessor;
 import org.apache.tuscany.sca.contribution.processor.DefaultContributionPostProcessorExtensionPoint;
 import org.apache.tuscany.sca.contribution.processor.DefaultPackageProcessorExtensionPoint;
@@ -51,13 +44,13 @@
 import org.apache.tuscany.sca.contribution.processor.PackageProcessorExtensionPoint;
 import org.apache.tuscany.sca.contribution.processor.impl.FolderContributionProcessor;
 import org.apache.tuscany.sca.contribution.processor.impl.JarContributionProcessor;
-import org.apache.tuscany.sca.contribution.resolver.ClassReference;
 import org.apache.tuscany.sca.contribution.resolver.DefaultModelResolverExtensionPoint;
 import org.apache.tuscany.sca.contribution.resolver.ModelResolverExtensionPoint;
 import org.apache.tuscany.sca.contribution.service.ContributionListenerExtensionPoint;
 import org.apache.tuscany.sca.contribution.service.ContributionRepository;
 import org.apache.tuscany.sca.contribution.service.ContributionService;
 import org.apache.tuscany.sca.contribution.service.DefaultContributionListenerExtensionPoint;
+import org.apache.tuscany.sca.contribution.service.ExtensibleContributionListener;
 import org.apache.tuscany.sca.contribution.service.impl.ContributionMetadataProcessor;
 import org.apache.tuscany.sca.contribution.service.impl.ContributionRepositoryImpl;
 import org.apache.tuscany.sca.contribution.service.impl.ContributionServiceImpl;
@@ -105,9 +98,6 @@
         staxProcessors.addArtifactProcessor(new ConstrainingTypeProcessor(assemblyFactory, policyFactory, staxProcessor));
         //Register STAX processors for Contribution Metadata 
         staxProcessors.addArtifactProcessor(new ContributionMetadataProcessor(assemblyFactory,contributionFactory, staxProcessor));
-        staxProcessors.addArtifactProcessor(new JavaImportProcessor());
-        staxProcessors.addArtifactProcessor(new JavaExportProcessor());        
-
 
         // Create URL artifact processor extension point
         // FIXME use the interface instead of the class
@@ -136,10 +126,6 @@
         ModelResolverExtensionPoint modelResolverExtensionPoint = new DefaultModelResolverExtensionPoint();
         registry.addExtensionPoint(modelResolverExtensionPoint);
         
-        modelResolverExtensionPoint.addResolver(Composite.class, CompositeModelResolver.class);
-        modelResolverExtensionPoint.addResolver(ConstrainingType.class, ConstrainingTypeModelResolver.class);
-        modelResolverExtensionPoint.addResolver(ClassReference.class, ClassReferenceModelResolver.class);
-
         //FIXME Deprecate and remove this
         //Create contribution postProcessor extension point
         DefaultContributionPostProcessorExtensionPoint contributionPostProcessors = new DefaultContributionPostProcessorExtensionPoint();
@@ -149,11 +135,14 @@
         // Create contribution listener extension point
         ContributionListenerExtensionPoint contributionListeners = new DefaultContributionListenerExtensionPoint();
         registry.addExtensionPoint(contributionListeners);
+        
+        ExtensibleContributionListener contributionListener = new ExtensibleContributionListener(contributionListeners);
+        
 
         // Create a contribution repository
         ContributionRepository repository;
         try {
-            repository = new ContributionRepositoryImpl(contributionListeners, "target");
+            repository = new ContributionRepositoryImpl("target");
         } catch (IOException e) {
             throw new ActivationException(e);
         }
@@ -163,6 +152,7 @@
                                                                               packageProcessor,
                                                                               documentProcessor, 
                                                                               staxProcessor,
+                                                                              contributionListener,
                                                                               postProcessor,
                                                                               modelResolverExtensionPoint,
                                                                               assemblyFactory,

Modified: incubator/tuscany/java/sca/modules/host-embedded/src/main/java/org/apache/tuscany/sca/host/embedded/impl/ReallySmallRuntimeBuilder.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/host-embedded/src/main/java/org/apache/tuscany/sca/host/embedded/impl/ReallySmallRuntimeBuilder.java?view=diff&rev=562620&r1=562619&r2=562620
==============================================================================
--- incubator/tuscany/java/sca/modules/host-embedded/src/main/java/org/apache/tuscany/sca/host/embedded/impl/ReallySmallRuntimeBuilder.java (original)
+++ incubator/tuscany/java/sca/modules/host-embedded/src/main/java/org/apache/tuscany/sca/host/embedded/impl/ReallySmallRuntimeBuilder.java Fri Aug  3 16:55:35 2007
@@ -37,22 +37,15 @@
 import javax.xml.stream.XMLOutputFactory;
 
 import org.apache.tuscany.sca.assembly.AssemblyFactory;
-import org.apache.tuscany.sca.assembly.Composite;
-import org.apache.tuscany.sca.assembly.ConstrainingType;
 import org.apache.tuscany.sca.assembly.SCABindingFactory;
 import org.apache.tuscany.sca.assembly.xml.ComponentTypeDocumentProcessor;
 import org.apache.tuscany.sca.assembly.xml.ComponentTypeProcessor;
 import org.apache.tuscany.sca.assembly.xml.CompositeDocumentProcessor;
-import org.apache.tuscany.sca.assembly.xml.CompositeModelResolver;
 import org.apache.tuscany.sca.assembly.xml.CompositeProcessor;
 import org.apache.tuscany.sca.assembly.xml.ConstrainingTypeDocumentProcessor;
-import org.apache.tuscany.sca.assembly.xml.ConstrainingTypeModelResolver;
 import org.apache.tuscany.sca.assembly.xml.ConstrainingTypeProcessor;
 import org.apache.tuscany.sca.assembly.xml.SCABindingProcessor;
 import org.apache.tuscany.sca.contribution.ContributionFactory;
-import org.apache.tuscany.sca.contribution.java.impl.ClassReferenceModelResolver;
-import org.apache.tuscany.sca.contribution.java.impl.JavaExportProcessor;
-import org.apache.tuscany.sca.contribution.java.impl.JavaImportProcessor;
 import org.apache.tuscany.sca.contribution.processor.ContributionPostProcessor;
 import org.apache.tuscany.sca.contribution.processor.DefaultContributionPostProcessorExtensionPoint;
 import org.apache.tuscany.sca.contribution.processor.DefaultPackageProcessorExtensionPoint;
@@ -68,22 +61,22 @@
 import org.apache.tuscany.sca.contribution.processor.URLArtifactProcessorExtensionPoint;
 import org.apache.tuscany.sca.contribution.processor.impl.FolderContributionProcessor;
 import org.apache.tuscany.sca.contribution.processor.impl.JarContributionProcessor;
-import org.apache.tuscany.sca.contribution.resolver.ClassReference;
 import org.apache.tuscany.sca.contribution.resolver.DefaultModelResolverExtensionPoint;
 import org.apache.tuscany.sca.contribution.resolver.ModelResolverExtensionPoint;
 import org.apache.tuscany.sca.contribution.service.ContributionListenerExtensionPoint;
 import org.apache.tuscany.sca.contribution.service.ContributionRepository;
 import org.apache.tuscany.sca.contribution.service.ContributionService;
 import org.apache.tuscany.sca.contribution.service.DefaultContributionListenerExtensionPoint;
+import org.apache.tuscany.sca.contribution.service.ExtensibleContributionListener;
 import org.apache.tuscany.sca.contribution.service.TypeDescriber;
 import org.apache.tuscany.sca.contribution.service.impl.ContributionMetadataProcessor;
 import org.apache.tuscany.sca.contribution.service.impl.ContributionRepositoryImpl;
 import org.apache.tuscany.sca.contribution.service.impl.ContributionServiceImpl;
 import org.apache.tuscany.sca.contribution.service.impl.PackageTypeDescriberImpl;
 import org.apache.tuscany.sca.core.ExtensionPointRegistry;
+import org.apache.tuscany.sca.core.invocation.DefaultProxyFactoryExtensionPoint;
 import org.apache.tuscany.sca.core.invocation.ExtensibleWireProcessor;
 import org.apache.tuscany.sca.core.invocation.ProxyFactory;
-import org.apache.tuscany.sca.core.invocation.DefaultProxyFactoryExtensionPoint;
 import org.apache.tuscany.sca.core.runtime.ActivationException;
 import org.apache.tuscany.sca.core.runtime.CompositeActivator;
 import org.apache.tuscany.sca.core.runtime.CompositeActivatorImpl;
@@ -181,18 +174,13 @@
         registry.addExtensionPoint(staxProcessors);
 
         // Create and register STAX processors for SCA assembly XML
-        ExtensibleStAXArtifactProcessor staxProcessor =
+        ExtensibleStAXArtifactProcessor staxProcessor = 
             new ExtensibleStAXArtifactProcessor(staxProcessors, xmlFactory, XMLOutputFactory.newInstance());
-        staxProcessors.addArtifactProcessor(new CompositeProcessor(contributionFactory, assemblyFactory, policyFactory,
-                                                                   mapper, staxProcessor));
+        staxProcessors.addArtifactProcessor(new CompositeProcessor(contributionFactory, assemblyFactory, policyFactory, mapper, staxProcessor));
         staxProcessors.addArtifactProcessor(new ComponentTypeProcessor(assemblyFactory, policyFactory, staxProcessor));
-        staxProcessors
-            .addArtifactProcessor(new ConstrainingTypeProcessor(assemblyFactory, policyFactory, staxProcessor));
-        //Register STAX processors for Contribution Metadata 
-        staxProcessors.addArtifactProcessor(new ContributionMetadataProcessor(assemblyFactory, contributionFactory,
-                                                                              staxProcessor));
-        staxProcessors.addArtifactProcessor(new JavaImportProcessor());
-        staxProcessors.addArtifactProcessor(new JavaExportProcessor());
+        staxProcessors.addArtifactProcessor(new ConstrainingTypeProcessor(assemblyFactory, policyFactory, staxProcessor));
+        // Register STAX processors for Contribution Metadata
+        staxProcessors.addArtifactProcessor(new ContributionMetadataProcessor(assemblyFactory, contributionFactory, staxProcessor));
 
         // Create URL artifact processor extension point
         URLArtifactProcessorExtensionPoint documentProcessors = new DefaultURLArtifactProcessorExtensionPoint();
@@ -219,10 +207,6 @@
         ModelResolverExtensionPoint modelResolverExtensionPoint = new DefaultModelResolverExtensionPoint();
         registry.addExtensionPoint(modelResolverExtensionPoint);
 
-        modelResolverExtensionPoint.addResolver(Composite.class, CompositeModelResolver.class);
-        modelResolverExtensionPoint.addResolver(ConstrainingType.class, ConstrainingTypeModelResolver.class);
-        modelResolverExtensionPoint.addResolver(ClassReference.class, ClassReferenceModelResolver.class);
-
         //FIXME Deprecate and remove this
         //Create contribution postProcessor extension point
         DefaultContributionPostProcessorExtensionPoint contributionPostProcessors =
@@ -234,10 +218,12 @@
         ContributionListenerExtensionPoint contributionListeners = new DefaultContributionListenerExtensionPoint();
         registry.addExtensionPoint(contributionListeners);
 
+        ExtensibleContributionListener contributionListener = new ExtensibleContributionListener(contributionListeners);
+        
         // Create a contribution repository
         ContributionRepository repository;
         try {
-            repository = new ContributionRepositoryImpl(contributionListeners, "target");
+            repository = new ContributionRepositoryImpl("target");
         } catch (IOException e) {
             throw new ActivationException(e);
         }
@@ -245,8 +231,8 @@
         ExtensibleURLArtifactProcessor documentProcessor = new ExtensibleURLArtifactProcessor(documentProcessors);
 
         ContributionService contributionService =
-            new ContributionServiceImpl(repository, packageProcessor, documentProcessor, staxProcessor, postProcessor,
-                                        modelResolverExtensionPoint, assemblyFactory, contributionFactory, xmlFactory);
+            new ContributionServiceImpl(repository, packageProcessor, documentProcessor, staxProcessor, contributionListener,
+                    postProcessor, modelResolverExtensionPoint, assemblyFactory, contributionFactory, xmlFactory);
         return contributionService;
     }
 

Modified: incubator/tuscany/java/sca/modules/host-webapp/pom.xml
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/host-webapp/pom.xml?view=diff&rev=562620&r1=562619&r2=562620
==============================================================================
--- incubator/tuscany/java/sca/modules/host-webapp/pom.xml (original)
+++ incubator/tuscany/java/sca/modules/host-webapp/pom.xml Fri Aug  3 16:55:35 2007
@@ -30,12 +30,18 @@
     <name>Apache Tuscany webapp host</name>
 
     <dependencies>
-
+        <dependency>
+            <groupId>org.apache.tuscany.sca</groupId>
+            <artifactId>tuscany-contribution-impl</artifactId>
+            <version>1.0-incubating-SNAPSHOT</version>
+        </dependency>
+        
         <dependency>
             <groupId>org.apache.tuscany.sca</groupId>
             <artifactId>tuscany-host-http</artifactId>
 	        <version>1.0-incubating-SNAPSHOT</version>
         </dependency>
+        
         <dependency>
             <groupId>org.apache.tuscany.sca</groupId>
             <artifactId>tuscany-host-embedded</artifactId>

Modified: incubator/tuscany/java/sca/modules/interface-wsdl-xml/pom.xml
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/interface-wsdl-xml/pom.xml?view=diff&rev=562620&r1=562619&r2=562620
==============================================================================
--- incubator/tuscany/java/sca/modules/interface-wsdl-xml/pom.xml (original)
+++ incubator/tuscany/java/sca/modules/interface-wsdl-xml/pom.xml Fri Aug  3 16:55:35 2007
@@ -34,6 +34,12 @@
             <artifactId>tuscany-contribution</artifactId>
             <version>1.0-incubating-SNAPSHOT</version>
         </dependency>
+
+        <dependency>
+            <groupId>org.apache.tuscany.sca</groupId>
+            <artifactId>tuscany-contribution-namespace</artifactId>
+            <version>1.0-incubating-SNAPSHOT</version>
+        </dependency>
         
         <dependency>
             <groupId>org.apache.tuscany.sca</groupId>

Modified: incubator/tuscany/java/sca/modules/interface-wsdl-xml/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/xml/WSDLModelResolver.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/interface-wsdl-xml/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/xml/WSDLModelResolver.java?view=diff&rev=562620&r1=562619&r2=562620
==============================================================================
--- incubator/tuscany/java/sca/modules/interface-wsdl-xml/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/xml/WSDLModelResolver.java (original)
+++ incubator/tuscany/java/sca/modules/interface-wsdl-xml/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/xml/WSDLModelResolver.java Fri Aug  3 16:55:35 2007
@@ -43,7 +43,7 @@
 import org.apache.tuscany.sca.contribution.Contribution;
 import org.apache.tuscany.sca.contribution.DeployedArtifact;
 import org.apache.tuscany.sca.contribution.Import;
-import org.apache.tuscany.sca.contribution.NamespaceImport;
+import org.apache.tuscany.sca.contribution.namespace.NamespaceImport;
 import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
 import org.apache.tuscany.sca.contribution.service.ContributionReadException;
 import org.apache.tuscany.sca.contribution.service.ContributionRuntimeException;

Modified: incubator/tuscany/java/sca/modules/interface-wsdl-xml/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/xml/XSDModelResolver.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/interface-wsdl-xml/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/xml/XSDModelResolver.java?view=diff&rev=562620&r1=562619&r2=562620
==============================================================================
--- incubator/tuscany/java/sca/modules/interface-wsdl-xml/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/xml/XSDModelResolver.java (original)
+++ incubator/tuscany/java/sca/modules/interface-wsdl-xml/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/xml/XSDModelResolver.java Fri Aug  3 16:55:35 2007
@@ -29,7 +29,7 @@
 import org.apache.tuscany.sca.contribution.Contribution;
 import org.apache.tuscany.sca.contribution.DeployedArtifact;
 import org.apache.tuscany.sca.contribution.Import;
-import org.apache.tuscany.sca.contribution.NamespaceImport;
+import org.apache.tuscany.sca.contribution.namespace.NamespaceImport;
 import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
 import org.apache.tuscany.sca.contribution.service.ContributionRuntimeException;
 import org.apache.tuscany.sca.interfacedef.wsdl.DefaultWSDLFactory;

Modified: incubator/tuscany/java/sca/modules/pom.xml
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/pom.xml?view=diff&rev=562620&r1=562619&r2=562620
==============================================================================
--- incubator/tuscany/java/sca/modules/pom.xml (original)
+++ incubator/tuscany/java/sca/modules/pom.xml Fri Aug  3 16:55:35 2007
@@ -53,6 +53,7 @@
                 <module>commonj-api</module>
                 <module>contribution</module>
                 <module>contribution-impl</module>
+                <module>contribution-namespace</module>
                 <module>contribution-java</module>
                 <module>core</module>
                 <module>core-databinding</module>



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


Mime
View raw message