tuscany-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jsdelf...@apache.org
Subject svn commit: r652983 [3/5] - in /incubator/tuscany/java/sca/modules: assembly-java-dsl/src/test/java/org/apache/tuscany/sca/assembly/dsl/ assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/ assembly-xml/src/main/resources/META-INF/services/ ...
Date Sat, 03 May 2008 02:52:41 GMT
Modified: incubator/tuscany/java/sca/modules/contribution-resource/src/test/java/org/apache/tuscany/sca/contribution/resource/impl/ResourceImportProcessorTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/contribution-resource/src/test/java/org/apache/tuscany/sca/contribution/resource/impl/ResourceImportProcessorTestCase.java?rev=652983&r1=652982&r2=652983&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/contribution-resource/src/test/java/org/apache/tuscany/sca/contribution/resource/impl/ResourceImportProcessorTestCase.java (original)
+++ incubator/tuscany/java/sca/modules/contribution-resource/src/test/java/org/apache/tuscany/sca/contribution/resource/impl/ResourceImportProcessorTestCase.java Fri May  2 19:52:39 2008
@@ -28,10 +28,13 @@
 
 import junit.framework.TestCase;
 
-import org.apache.tuscany.sca.contribution.DefaultModelFactoryExtensionPoint;
-import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
+import org.apache.tuscany.sca.contribution.processor.ExtensibleStAXArtifactProcessor;
+import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
+import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessorExtensionPoint;
 import org.apache.tuscany.sca.contribution.resource.ResourceImport;
 import org.apache.tuscany.sca.contribution.service.ContributionReadException;
+import org.apache.tuscany.sca.core.DefaultExtensionPointRegistry;
+import org.apache.tuscany.sca.core.ExtensionPointRegistry;
 
 /**
  * Test NamespaceImportProcessorTestCase
@@ -42,21 +45,21 @@
 
     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.resource uri=\"helloworld/HelloWorldService.componentType\" location=\"sca://contributions/001\"/>"
-            + "</contribution>";
+            + "<import.resource xmlns=\"http://www.osoa.org/xmlns/sca/1.0\" xmlns:ns=\"http://ns\" uri=\"helloworld/HelloWorldService.componentType\" location=\"sca://contributions/001\"/>";
 
     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.resource location=\"sca://contributions/001\"/>"
-            + "</contribution>";
+            + "<import.resource xmlns=\"http://www.osoa.org/xmlns/sca/1.0\" xmlns:ns=\"http://ns\" location=\"sca://contributions/001\"/>";
 
-    private XMLInputFactory xmlFactory;
+    private XMLInputFactory inputFactory;
+    private StAXArtifactProcessor<Object> staxProcessor;
 
     @Override
     protected void setUp() throws Exception {
-        xmlFactory = XMLInputFactory.newInstance();
+        ExtensionPointRegistry extensionPoints = new DefaultExtensionPointRegistry();
+        inputFactory = XMLInputFactory.newInstance();
+        StAXArtifactProcessorExtensionPoint staxProcessors = extensionPoints.getExtensionPoint(StAXArtifactProcessorExtensionPoint.class);
+        staxProcessor = new ExtensibleStAXArtifactProcessor(staxProcessors, inputFactory, null);
     }
 
     /**
@@ -64,13 +67,8 @@
      * @throws Exception
      */
     public void testLoad() throws Exception {
-        XMLStreamReader reader = xmlFactory.createXMLStreamReader(new StringReader(VALID_XML));
-
-        ModelFactoryExtensionPoint factories = new DefaultModelFactoryExtensionPoint();
-        factories.addFactory(new ResourceImportExportFactoryImpl());
-        ResourceImportProcessor importProcessor = new ResourceImportProcessor(factories);
-        ResourceImport namespaceImport = importProcessor.read(reader);
-        
+        XMLStreamReader reader = inputFactory.createXMLStreamReader(new StringReader(VALID_XML));
+        ResourceImport namespaceImport = (ResourceImport)staxProcessor.read(reader);
         assertEquals("helloworld/HelloWorldService.componentType", namespaceImport.getURI());
         assertEquals("sca://contributions/001", namespaceImport.getLocation());
     }
@@ -80,13 +78,9 @@
      * @throws Exception
      */
     public void testLoadInvalid() throws Exception {
-        XMLStreamReader reader = xmlFactory.createXMLStreamReader(new StringReader(INVALID_XML));
-
-        ModelFactoryExtensionPoint factories = new DefaultModelFactoryExtensionPoint();
-        factories.addFactory(new ResourceImportExportFactoryImpl());
-        ResourceImportProcessor importProcessor = new ResourceImportProcessor(factories);
+        XMLStreamReader reader = inputFactory.createXMLStreamReader(new StringReader(INVALID_XML));
         try {
-            importProcessor.read(reader);
+            staxProcessor.read(reader);
             fail("readerException should have been thrown");
         } catch (ContributionReadException e) {
             assertTrue(true);

Modified: incubator/tuscany/java/sca/modules/contribution-xml/src/main/java/org/apache/tuscany/sca/contribution/xml/ContributionGeneratedMetadataDocumentProcessor.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/contribution-xml/src/main/java/org/apache/tuscany/sca/contribution/xml/ContributionGeneratedMetadataDocumentProcessor.java?rev=652983&r1=652982&r2=652983&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/contribution-xml/src/main/java/org/apache/tuscany/sca/contribution/xml/ContributionGeneratedMetadataDocumentProcessor.java (original)
+++ incubator/tuscany/java/sca/modules/contribution-xml/src/main/java/org/apache/tuscany/sca/contribution/xml/ContributionGeneratedMetadataDocumentProcessor.java Fri May  2 19:52:39 2008
@@ -20,6 +20,7 @@
 
 import javax.xml.stream.XMLInputFactory;
 
+import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
 import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
 
 /**
@@ -29,8 +30,12 @@
  */
 public class ContributionGeneratedMetadataDocumentProcessor extends ContributionMetadataDocumentProcessor {
 
-    public ContributionGeneratedMetadataDocumentProcessor(StAXArtifactProcessor staxProcessor, XMLInputFactory inputFactory) {
-        super(staxProcessor, inputFactory);
+    public ContributionGeneratedMetadataDocumentProcessor(XMLInputFactory inputFactory, StAXArtifactProcessor staxProcessor) {
+        super(inputFactory, staxProcessor);
+    }
+    
+    public ContributionGeneratedMetadataDocumentProcessor(ModelFactoryExtensionPoint modelFactories, StAXArtifactProcessor staxProcessor) {
+        super(modelFactories, staxProcessor);
     }
     
     public String getArtifactType() {

Modified: incubator/tuscany/java/sca/modules/contribution-xml/src/main/java/org/apache/tuscany/sca/contribution/xml/ContributionMetadataDocumentProcessor.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/contribution-xml/src/main/java/org/apache/tuscany/sca/contribution/xml/ContributionMetadataDocumentProcessor.java?rev=652983&r1=652982&r2=652983&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/contribution-xml/src/main/java/org/apache/tuscany/sca/contribution/xml/ContributionMetadataDocumentProcessor.java (original)
+++ incubator/tuscany/java/sca/modules/contribution-xml/src/main/java/org/apache/tuscany/sca/contribution/xml/ContributionMetadataDocumentProcessor.java Fri May  2 19:52:39 2008
@@ -29,6 +29,7 @@
 import javax.xml.stream.XMLStreamReader;
 
 import org.apache.tuscany.sca.contribution.Contribution;
+import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
 import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
 import org.apache.tuscany.sca.contribution.processor.URLArtifactProcessor;
 import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
@@ -44,9 +45,14 @@
     private final StAXArtifactProcessor staxProcessor;
     private final XMLInputFactory inputFactory;
 
-    public ContributionMetadataDocumentProcessor(StAXArtifactProcessor staxProcessor, XMLInputFactory inputFactory) {
-        this.staxProcessor = staxProcessor; 
+    public ContributionMetadataDocumentProcessor(XMLInputFactory inputFactory, StAXArtifactProcessor staxProcessor) {
         this.inputFactory = inputFactory;
+        this.staxProcessor = staxProcessor; 
+    }
+    
+    public ContributionMetadataDocumentProcessor(ModelFactoryExtensionPoint modelFactories, StAXArtifactProcessor staxProcessor) {
+        this.inputFactory = modelFactories.getFactory(XMLInputFactory.class);
+        this.staxProcessor = staxProcessor; 
     }
     
     public String getArtifactType() {

Modified: incubator/tuscany/java/sca/modules/contribution-xml/src/main/java/org/apache/tuscany/sca/contribution/xml/ContributionMetadataProcessor.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/contribution-xml/src/main/java/org/apache/tuscany/sca/contribution/xml/ContributionMetadataProcessor.java?rev=652983&r1=652982&r2=652983&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/contribution-xml/src/main/java/org/apache/tuscany/sca/contribution/xml/ContributionMetadataProcessor.java (original)
+++ incubator/tuscany/java/sca/modules/contribution-xml/src/main/java/org/apache/tuscany/sca/contribution/xml/ContributionMetadataProcessor.java Fri May  2 19:52:39 2008
@@ -34,6 +34,7 @@
 import org.apache.tuscany.sca.contribution.ContributionFactory;
 import org.apache.tuscany.sca.contribution.Export;
 import org.apache.tuscany.sca.contribution.Import;
+import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
 import org.apache.tuscany.sca.contribution.processor.BaseStAXArtifactProcessor;
 import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
 import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
@@ -64,6 +65,12 @@
         this.extensionProcessor = extensionProcessor;
     }
     
+    public ContributionMetadataProcessor(ModelFactoryExtensionPoint modelFactories, StAXArtifactProcessor<Object> extensionProcessor) {
+        this.assemblyFactory = modelFactories.getFactory(AssemblyFactory.class);
+        this.contributionFactory = modelFactories.getFactory(ContributionFactory.class);
+        this.extensionProcessor = extensionProcessor;
+    }
+    
     
     public QName getArtifactType() {
         return CONTRIBUTION_QNAME;

Added: incubator/tuscany/java/sca/modules/contribution-xml/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/contribution-xml/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor?rev=652983&view=auto
==============================================================================
--- incubator/tuscany/java/sca/modules/contribution-xml/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor (added)
+++ incubator/tuscany/java/sca/modules/contribution-xml/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor Fri May  2 19:52:39 2008
@@ -0,0 +1,19 @@
+# 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 artifact processor extension
+org.apache.tuscany.sca.contribution.xml.ContributionMetadataProcessor;qname=http://www.osoa.org/xmlns/sca/1.0#contribution,model=org.apache.tuscany.sca.contribution.Contribution

Added: incubator/tuscany/java/sca/modules/contribution-xml/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.URLArtifactProcessor
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/contribution-xml/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.URLArtifactProcessor?rev=652983&view=auto
==============================================================================
--- incubator/tuscany/java/sca/modules/contribution-xml/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.URLArtifactProcessor (added)
+++ incubator/tuscany/java/sca/modules/contribution-xml/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.URLArtifactProcessor Fri May  2 19:52:39 2008
@@ -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 artifact processor extension
+org.apache.tuscany.sca.contribution.xml.ContributionMetadataDocumentProcessor;type=sca-contribution.xml,model=org.apache.tuscany.sca.contribution.Contribution
+org.apache.tuscany.sca.contribution.xml.ContributionGeneratedMetadataDocumentProcessor;type=sca-contribution-generated.xml,model=org.apache.tuscany.sca.contribution.Contribution

Modified: incubator/tuscany/java/sca/modules/contribution-xml/src/test/java/org/apache/tuscany/sca/contribution/xml/ContributionMetadataProcessorTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/contribution-xml/src/test/java/org/apache/tuscany/sca/contribution/xml/ContributionMetadataProcessorTestCase.java?rev=652983&r1=652982&r2=652983&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/contribution-xml/src/test/java/org/apache/tuscany/sca/contribution/xml/ContributionMetadataProcessorTestCase.java (original)
+++ incubator/tuscany/java/sca/modules/contribution-xml/src/test/java/org/apache/tuscany/sca/contribution/xml/ContributionMetadataProcessorTestCase.java Fri May  2 19:52:39 2008
@@ -30,12 +30,13 @@
 
 import junit.framework.TestCase;
 
-import org.apache.tuscany.sca.assembly.AssemblyFactory;
-import org.apache.tuscany.sca.assembly.DefaultAssemblyFactory;
 import org.apache.tuscany.sca.contribution.Contribution;
-import org.apache.tuscany.sca.contribution.ContributionFactory;
-import org.apache.tuscany.sca.contribution.DefaultContributionFactory;
+import org.apache.tuscany.sca.contribution.processor.ExtensibleStAXArtifactProcessor;
+import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
+import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessorExtensionPoint;
 import org.apache.tuscany.sca.contribution.service.ContributionReadException;
+import org.apache.tuscany.sca.core.DefaultExtensionPointRegistry;
+import org.apache.tuscany.sca.core.ExtensionPointRegistry;
 
 /**
  * Test the contribution metadata processor.
@@ -59,40 +60,32 @@
             + "<deployable/>"
             + "</contribution>";
     
-    private XMLInputFactory xmlInputFactory;
-    private XMLOutputFactory xmlOutputFactory;
+    private XMLInputFactory inputFactory;
+    private XMLOutputFactory outputFactory;
+    private StAXArtifactProcessor<Object> staxProcessor;
 
     @Override
     protected void setUp() throws Exception {
-        xmlInputFactory = XMLInputFactory.newInstance();
-        xmlOutputFactory = XMLOutputFactory.newInstance();
-        xmlOutputFactory.setProperty(XMLOutputFactory.IS_REPAIRING_NAMESPACES, true);
+        ExtensionPointRegistry extensionPoints = new DefaultExtensionPointRegistry();
+        
+        inputFactory = XMLInputFactory.newInstance();
+        outputFactory = XMLOutputFactory.newInstance();
+        
+        StAXArtifactProcessorExtensionPoint staxProcessors = extensionPoints.getExtensionPoint(StAXArtifactProcessorExtensionPoint.class);
+        staxProcessor = new ExtensibleStAXArtifactProcessor(staxProcessors, inputFactory, outputFactory);
     }
 
     public void testRead() throws Exception {
-        XMLStreamReader reader = xmlInputFactory.createXMLStreamReader(new StringReader(VALID_XML));
-
-        AssemblyFactory assemblyFactory = new DefaultAssemblyFactory();
-        ContributionFactory contributionFactory = new DefaultContributionFactory();
-        ContributionMetadataProcessor processor = 
-            new ContributionMetadataProcessor(assemblyFactory, contributionFactory, null);
-        Contribution contribution = contributionFactory.createContribution();
-        contribution.setModelResolver(new TestModelResolver(contribution, null));
-        contribution = processor.read(reader);
+        XMLStreamReader reader = inputFactory.createXMLStreamReader(new StringReader(VALID_XML));
+        Contribution contribution = (Contribution)staxProcessor.read(reader);
         assertNotNull(contribution);
         assertEquals(2, contribution.getDeployables().size());
   }
 
     public void testReadInvalid() throws Exception {
-        XMLStreamReader reader = xmlInputFactory.createXMLStreamReader(new StringReader(INVALID_XML));
-        AssemblyFactory assemblyFactory = new DefaultAssemblyFactory();
-        ContributionFactory contributionFactory = new DefaultContributionFactory();
-        ContributionMetadataProcessor processor = 
-            new ContributionMetadataProcessor(assemblyFactory, contributionFactory, null);
-        Contribution contribution = contributionFactory.createContribution();
-        contribution.setModelResolver(new TestModelResolver(contribution, null));
+        XMLStreamReader reader = inputFactory.createXMLStreamReader(new StringReader(INVALID_XML));
         try {
-            processor.read(reader);
+            staxProcessor.read(reader);
             fail("InvalidException should have been thrown");
         } catch (ContributionReadException e) {
             assertTrue(true);
@@ -100,32 +93,24 @@
     }    
 
     public void testWrite() throws Exception {
-        XMLStreamReader reader = xmlInputFactory.createXMLStreamReader(new StringReader(VALID_XML));
-
-        //read the original contribution metadata file
-        AssemblyFactory assemblyFactory = new DefaultAssemblyFactory();
-        ContributionFactory contributionFactory = new DefaultContributionFactory();
-        ContributionMetadataProcessor processor = 
-            new ContributionMetadataProcessor(assemblyFactory, contributionFactory, null);
-        Contribution contribution = contributionFactory.createContribution();
-        contribution.setModelResolver(new TestModelResolver(contribution, null));
-        contribution = processor.read(reader);
+        XMLStreamReader reader = inputFactory.createXMLStreamReader(new StringReader(VALID_XML));
+        Contribution contribution = (Contribution)staxProcessor.read(reader);
 
         validateContribution(contribution);
         
         //write the contribution metadata contents
         StringWriter stringWriter = new StringWriter();
-        XMLStreamWriter writer = xmlOutputFactory.createXMLStreamWriter(stringWriter);
-        processor.write(contribution, writer);
+        XMLStreamWriter writer = outputFactory.createXMLStreamWriter(stringWriter);
+        staxProcessor.write(contribution, writer);
         stringWriter.close();
 
-        reader = xmlInputFactory.createXMLStreamReader(new StringReader(stringWriter.toString()));
-        contribution = processor.read(reader);
+        reader = inputFactory.createXMLStreamReader(new StringReader(stringWriter.toString()));
+        contribution = (Contribution)staxProcessor.read(reader);
         
         validateContribution(contribution);
   }
     
-  public void validateContribution(Contribution contribution) {
+  private void validateContribution(Contribution contribution) {
 	  QName deployable;
 	  
 	  assertNotNull(contribution);

Modified: incubator/tuscany/java/sca/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/DefaultStAXArtifactProcessorExtensionPoint.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/DefaultStAXArtifactProcessorExtensionPoint.java?rev=652983&r1=652982&r2=652983&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/DefaultStAXArtifactProcessorExtensionPoint.java (original)
+++ incubator/tuscany/java/sca/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/DefaultStAXArtifactProcessorExtensionPoint.java Fri May  2 19:52:39 2008
@@ -24,6 +24,8 @@
 import java.util.Set;
 
 import javax.xml.namespace.QName;
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLOutputFactory;
 import javax.xml.stream.XMLStreamException;
 import javax.xml.stream.XMLStreamReader;
 import javax.xml.stream.XMLStreamWriter;
@@ -47,21 +49,20 @@
 public class DefaultStAXArtifactProcessorExtensionPoint extends
     DefaultArtifactProcessorExtensionPoint<StAXArtifactProcessor> implements StAXArtifactProcessorExtensionPoint {
 
+    private ExtensionPointRegistry extensionPoints;
     private ModelFactoryExtensionPoint modelFactories;
     private boolean loaded;
+    private StAXArtifactProcessor<Object> extensibleStAXProcessor;
 
     /**
      * Constructs a new extension point.
      */
     public DefaultStAXArtifactProcessorExtensionPoint(ExtensionPointRegistry extensionPoints) {
+        this.extensionPoints = extensionPoints;
         this.modelFactories = extensionPoints.getExtensionPoint(ModelFactoryExtensionPoint.class);
-    }
-
-    /**
-     * Constructs a new extension point.
-     */
-    public DefaultStAXArtifactProcessorExtensionPoint(ModelFactoryExtensionPoint modelFactories) {
-        this.modelFactories = modelFactories;
+        XMLInputFactory inputFactory = modelFactories.getFactory(XMLInputFactory.class);
+        XMLOutputFactory outputFactory = modelFactories.getFactory(XMLOutputFactory.class);
+        this.extensibleStAXProcessor = new ExtensibleStAXArtifactProcessor(this, inputFactory, outputFactory);
     }
 
     public void addArtifactProcessor(StAXArtifactProcessor artifactProcessor) {
@@ -143,8 +144,8 @@
 
             // Create a processor wrapper and register it
             StAXArtifactProcessor processor =
-                new LazyStAXArtifactProcessor(modelFactories, artifactType, modelTypeName, factoryName,
-                                              processorDeclaration);
+                new LazyStAXArtifactProcessor(artifactType, modelTypeName, factoryName,
+                                              processorDeclaration, extensionPoints, modelFactories, extensibleStAXProcessor);
             addArtifactProcessor(processor);
         }
 
@@ -157,25 +158,29 @@
      */
     private static class LazyStAXArtifactProcessor implements StAXArtifactProcessor {
 
-        private ModelFactoryExtensionPoint modelFactories;
+        private ExtensionPointRegistry extensionPoints;
         private QName artifactType;
         private String modelTypeName;
         private String factoryName;
         private ServiceDeclaration processorDeclaration;
         private StAXArtifactProcessor processor;
         private Class<?> modelType;
+        private StAXArtifactProcessor<Object> extensionProcessor;
 
-        LazyStAXArtifactProcessor(ModelFactoryExtensionPoint modelFactories,
-                                  QName artifactType,
+        LazyStAXArtifactProcessor(QName artifactType,
                                   String modelTypeName,
                                   String factoryName,
-                                  ServiceDeclaration processorDeclaration) {
+                                  ServiceDeclaration processorDeclaration,
+                                  ExtensionPointRegistry extensionPoints,
+                                  ModelFactoryExtensionPoint modelFactories,
+                                  StAXArtifactProcessor<Object> extensionProcessor) {
 
-            this.modelFactories = modelFactories;
+            this.extensionPoints = extensionPoints;
             this.artifactType = artifactType;
             this.modelTypeName = modelTypeName;
             this.factoryName = factoryName;
             this.processorDeclaration = processorDeclaration;
+            this.extensionProcessor = extensionProcessor;
         }
 
         public QName getArtifactType() {
@@ -190,6 +195,7 @@
                     .equals("org.apache.tuscany.sca.assembly.xml.DefaultBeanModelProcessor")) {
 
                     // Specific initialization for the DefaultBeanModelProcessor
+                    ModelFactoryExtensionPoint modelFactories = extensionPoints.getExtensionPoint(ModelFactoryExtensionPoint.class);
                     AssemblyFactory assemblyFactory = modelFactories.getFactory(AssemblyFactory.class);
                     PolicyFactory policyFactory = modelFactories.getFactory(PolicyFactory.class);
                     try {
@@ -218,14 +224,27 @@
                         throw new IllegalStateException(e);
                     }
                 } else {
+                    ModelFactoryExtensionPoint modelFactories = extensionPoints.getExtensionPoint(ModelFactoryExtensionPoint.class);
 
                     // Load and instantiate the processor class
                     try {
                         Class<StAXArtifactProcessor> processorClass =
                             (Class<StAXArtifactProcessor>)processorDeclaration.loadClass();
-                        Constructor<StAXArtifactProcessor> constructor =
-                            processorClass.getConstructor(ModelFactoryExtensionPoint.class);
-                        processor = constructor.newInstance(modelFactories);
+                        try {
+                            Constructor<StAXArtifactProcessor> constructor =
+                                processorClass.getConstructor(ModelFactoryExtensionPoint.class);
+                            processor = constructor.newInstance(modelFactories);
+                        } catch (NoSuchMethodException e) {
+                            try {
+                                Constructor<StAXArtifactProcessor> constructor =
+                                    processorClass.getConstructor(ModelFactoryExtensionPoint.class, StAXArtifactProcessor.class);
+                                processor = constructor.newInstance(modelFactories, extensionProcessor);
+                            } catch (NoSuchMethodException e2) {
+                                Constructor<StAXArtifactProcessor> constructor =
+                                    processorClass.getConstructor(ExtensionPointRegistry.class, StAXArtifactProcessor.class);
+                                processor = constructor.newInstance(extensionPoints, extensionProcessor);
+                            }
+                        }
                     } catch (Exception e) {
                         throw new IllegalStateException(e);
                     }

Modified: incubator/tuscany/java/sca/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/DefaultURLArtifactProcessorExtensionPoint.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/DefaultURLArtifactProcessorExtensionPoint.java?rev=652983&r1=652982&r2=652983&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/DefaultURLArtifactProcessorExtensionPoint.java (original)
+++ incubator/tuscany/java/sca/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/DefaultURLArtifactProcessorExtensionPoint.java Fri May  2 19:52:39 2008
@@ -25,6 +25,9 @@
 import java.util.Map;
 import java.util.Set;
 
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLOutputFactory;
+
 import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
 import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
 import org.apache.tuscany.sca.contribution.service.ContributionReadException;
@@ -42,21 +45,20 @@
     extends DefaultArtifactProcessorExtensionPoint<URLArtifactProcessor>
     implements URLArtifactProcessorExtensionPoint {
     
-    private ModelFactoryExtensionPoint modelFactories;
+    private ExtensionPointRegistry extensionPoints;
+    private StAXArtifactProcessor<?> staxProcessor;
     private boolean loaded;
 
     /**
      * Constructs a new extension point.
      */
     public DefaultURLArtifactProcessorExtensionPoint(ExtensionPointRegistry extensionPoints) {
-        this.modelFactories = extensionPoints.getExtensionPoint(ModelFactoryExtensionPoint.class);
-    }
-
-    /**
-     * Constructs a new extension point.
-     */
-    public DefaultURLArtifactProcessorExtensionPoint(ModelFactoryExtensionPoint modelFactories) {
-        this.modelFactories = modelFactories;
+        this.extensionPoints = extensionPoints;
+        ModelFactoryExtensionPoint modelFactories = this.extensionPoints.getExtensionPoint(ModelFactoryExtensionPoint.class);
+        XMLInputFactory inputFactory = modelFactories.getFactory(XMLInputFactory.class);
+        XMLOutputFactory outputFactory = modelFactories.getFactory(XMLOutputFactory.class);
+        StAXArtifactProcessorExtensionPoint staxProcessors = extensionPoints.getExtensionPoint(StAXArtifactProcessorExtensionPoint.class);
+        staxProcessor = new ExtensibleStAXArtifactProcessor(staxProcessors, inputFactory, outputFactory);
     }
 
     public void addArtifactProcessor(URLArtifactProcessor artifactProcessor) {
@@ -103,7 +105,7 @@
             String modelTypeName = attributes.get("model");
             
             // Create a processor wrapper and register it
-            URLArtifactProcessor processor = new LazyURLArtifactProcessor(modelFactories, artifactType, modelTypeName, processorDeclaration);
+            URLArtifactProcessor processor = new LazyURLArtifactProcessor(artifactType, modelTypeName, processorDeclaration, extensionPoints, staxProcessor);
             addArtifactProcessor(processor);
         }
         
@@ -116,21 +118,24 @@
      */
     private static class LazyURLArtifactProcessor implements URLArtifactProcessor {
 
-        private ModelFactoryExtensionPoint modelFactories;
+        private ExtensionPointRegistry extensionPoints;
         private String artifactType;
         private String modelTypeName;
         private ServiceDeclaration processorDeclaration;
         private URLArtifactProcessor processor;
         private Class<?> modelType;
+        private StAXArtifactProcessor<?> staxProcessor;
         
-        LazyURLArtifactProcessor(ModelFactoryExtensionPoint modelFactories, 
-        		String artifactType, 
+        LazyURLArtifactProcessor(String artifactType, 
         		String modelTypeName, 
-        		ServiceDeclaration processorDeclaration) {
-            this.modelFactories = modelFactories;
+        		ServiceDeclaration processorDeclaration,
+        		ExtensionPointRegistry extensionPoints, 
+                        StAXArtifactProcessor<?> staxProcessor) {
             this.artifactType = artifactType;
             this.modelTypeName = modelTypeName;
             this.processorDeclaration = processorDeclaration;
+            this.extensionPoints = extensionPoints;
+            this.staxProcessor = staxProcessor;
         }
 
         public String getArtifactType() {
@@ -141,9 +146,20 @@
         private URLArtifactProcessor getProcessor() {
             if (processor == null) {
                 try {
+                    ModelFactoryExtensionPoint modelFactories = extensionPoints.getExtensionPoint(ModelFactoryExtensionPoint.class);
                     Class<URLArtifactProcessor> processorClass = (Class<URLArtifactProcessor>)processorDeclaration.loadClass();
-                    Constructor<URLArtifactProcessor> constructor = processorClass.getConstructor(ModelFactoryExtensionPoint.class);
-                    processor = constructor.newInstance(modelFactories);
+                    try {
+                        Constructor<URLArtifactProcessor> constructor = processorClass.getConstructor(ModelFactoryExtensionPoint.class);
+                        processor = constructor.newInstance(modelFactories);
+                    } catch (NoSuchMethodException e) {
+                        try {
+                            Constructor<URLArtifactProcessor> constructor = processorClass.getConstructor(ModelFactoryExtensionPoint.class, StAXArtifactProcessor.class);
+                            processor = constructor.newInstance(modelFactories, staxProcessor);
+                        } catch (NoSuchMethodException e2) {
+                            Constructor<URLArtifactProcessor> constructor = processorClass.getConstructor(ExtensionPointRegistry.class, StAXArtifactProcessor.class);
+                            processor = constructor.newInstance(extensionPoints, staxProcessor);
+                        }
+                    }
                 } catch (Exception e) {
                     throw new IllegalStateException(e);
                 }

Modified: incubator/tuscany/java/sca/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/DefaultValidatingXMLInputFactory.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/DefaultValidatingXMLInputFactory.java?rev=652983&r1=652982&r2=652983&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/DefaultValidatingXMLInputFactory.java (original)
+++ incubator/tuscany/java/sca/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/DefaultValidatingXMLInputFactory.java Fri May  2 19:52:39 2008
@@ -54,7 +54,7 @@
  *
  * @version $Rev$ $Date$
  */
-public class DefaultValidatingXMLInputFactory extends XMLInputFactory {
+public class DefaultValidatingXMLInputFactory extends ValidatingXMLInputFactory {
     
     private XMLInputFactory inputFactory;
     private ValidationSchemaExtensionPoint schemas;

Modified: incubator/tuscany/java/sca/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/ExtensibleStAXArtifactProcessor.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/ExtensibleStAXArtifactProcessor.java?rev=652983&r1=652982&r2=652983&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/ExtensibleStAXArtifactProcessor.java (original)
+++ incubator/tuscany/java/sca/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/ExtensibleStAXArtifactProcessor.java Fri May  2 19:52:39 2008
@@ -28,6 +28,7 @@
 import javax.xml.stream.Location;
 import javax.xml.stream.XMLInputFactory;
 import javax.xml.stream.XMLOutputFactory;
+import javax.xml.stream.XMLStreamConstants;
 import javax.xml.stream.XMLStreamException;
 import javax.xml.stream.XMLStreamReader;
 import javax.xml.stream.XMLStreamWriter;
@@ -65,12 +66,18 @@
         this.processors = processors;
         this.inputFactory = inputFactory;
         this.outputFactory = outputFactory;
-        this.outputFactory.setProperty("javax.xml.stream.isRepairingNamespaces", Boolean.TRUE);
+        if (this.outputFactory != null) {
+            this.outputFactory.setProperty("javax.xml.stream.isRepairingNamespaces", Boolean.TRUE);
+        }
     }
 
     public Object read(XMLStreamReader source) throws ContributionReadException, XMLStreamException {
         
         // Delegate to the processor associated with the element QName
+        int event = source.getEventType();
+        if (event == XMLStreamConstants.START_DOCUMENT) {
+            source.nextTag();
+        }
         QName name = source.getName();
         StAXArtifactProcessor<?> processor = (StAXArtifactProcessor<?>)processors.getProcessor(name);
         if (processor == null) {

Added: incubator/tuscany/java/sca/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/ValidatingXMLInputFactory.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/ValidatingXMLInputFactory.java?rev=652983&view=auto
==============================================================================
--- incubator/tuscany/java/sca/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/ValidatingXMLInputFactory.java (added)
+++ incubator/tuscany/java/sca/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/ValidatingXMLInputFactory.java Fri May  2 19:52:39 2008
@@ -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.processor;
+
+import javax.xml.stream.XMLInputFactory;
+
+/**
+ * Base marker class for validating XML input factories.
+ *
+ * @version $Rev$ $Date$
+ */
+public abstract class ValidatingXMLInputFactory extends XMLInputFactory {
+
+    /**
+     * Create a new default validating XML input factory. 
+     * @return
+     */
+    public static ValidatingXMLInputFactory newInstance() {
+        return new DefaultValidatingXMLInputFactory(
+                                                    XMLInputFactory.newInstance(),
+                                                    new DefaultValidationSchemaExtensionPoint(),
+                                                    null);
+    }
+
+}

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

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

Propchange: incubator/tuscany/java/sca/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/ValidatingXMLInputFactory.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: incubator/tuscany/java/sca/modules/core-spring/src/main/java/org/apache/tuscany/sca/core/spring/context/SCADomainContext.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/core-spring/src/main/java/org/apache/tuscany/sca/core/spring/context/SCADomainContext.java?rev=652983&r1=652982&r2=652983&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/core-spring/src/main/java/org/apache/tuscany/sca/core/spring/context/SCADomainContext.java (original)
+++ incubator/tuscany/java/sca/modules/core-spring/src/main/java/org/apache/tuscany/sca/core/spring/context/SCADomainContext.java Fri May  2 19:52:39 2008
@@ -24,6 +24,8 @@
 
 import javax.xml.stream.XMLInputFactory;
 import javax.xml.stream.XMLOutputFactory;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
 
 import org.apache.tuscany.sca.assembly.AssemblyFactory;
 import org.apache.tuscany.sca.assembly.Composite;
@@ -39,7 +41,10 @@
 import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
 import org.apache.tuscany.sca.contribution.processor.DefaultStAXArtifactProcessorExtensionPoint;
 import org.apache.tuscany.sca.contribution.processor.ExtensibleStAXArtifactProcessor;
+import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
+import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessorExtensionPoint;
 import org.apache.tuscany.sca.contribution.service.ContributionException;
+import org.apache.tuscany.sca.core.DefaultExtensionPointRegistry;
 import org.apache.tuscany.sca.core.spring.assembly.impl.BeanAssemblyFactory;
 import org.apache.tuscany.sca.core.spring.implementation.java.impl.BeanJavaImplementationFactory;
 import org.apache.tuscany.sca.implementation.java.JavaImplementationFactory;
@@ -89,15 +94,14 @@
         beanFactory = new DefaultListableBeanFactory();
 
         // Create SCA assembly and SCA Java factories
-        ModelFactoryExtensionPoint modelFactories = new DefaultModelFactoryExtensionPoint();
+        DefaultExtensionPointRegistry extensionPoints = new DefaultExtensionPointRegistry();
+        ModelFactoryExtensionPoint modelFactories = extensionPoints.getExtensionPoint(ModelFactoryExtensionPoint.class);
         AssemblyFactory assemblyFactory = new BeanAssemblyFactory(new DefaultAssemblyFactory(), beanFactory);
         modelFactories.addFactory(assemblyFactory);
-        SCABindingFactory scaBindingFactory = modelFactories.getFactory(SCABindingFactory.class);
-        PolicyFactory policyFactory = new DefaultPolicyFactory();
-        modelFactories.addFactory(policyFactory);
-        ContributionFactory contributionFactory = modelFactories.getFactory(ContributionFactory.class);
         InterfaceContractMapper interfaceContractMapper = new InterfaceContractMapperImpl();
-        JavaInterfaceFactory javaFactory = new DefaultJavaInterfaceFactory(modelFactories);
+        JavaInterfaceFactory javaFactory = modelFactories.getFactory(JavaInterfaceFactory.class);
+        PolicyFactory policyFactory = modelFactories.getFactory(PolicyFactory.class);
+        SCABindingFactory scaBindingFactory = modelFactories.getFactory(SCABindingFactory.class);
         modelFactories.addFactory(javaFactory);
         JavaImplementationFactory javaImplementationFactory = new BeanJavaImplementationFactory(beanFactory);
         modelFactories.addFactory(javaImplementationFactory);
@@ -124,14 +128,8 @@
         }
 
         // Populate ArtifactProcessor registry
-        DefaultStAXArtifactProcessorExtensionPoint staxProcessors = new DefaultStAXArtifactProcessorExtensionPoint(modelFactories);
-        ExtensibleStAXArtifactProcessor staxProcessor = new ExtensibleStAXArtifactProcessor(staxProcessors, XMLInputFactory.newInstance(), XMLOutputFactory.newInstance());
-        CompositeProcessor compositeProcessor = new CompositeProcessor(contributionFactory, assemblyFactory, policyFactory, staxProcessor);
-        staxProcessors.addArtifactProcessor(compositeProcessor);
-        staxProcessors.addArtifactProcessor(new ComponentTypeProcessor(assemblyFactory, policyFactory, staxProcessor));
-        staxProcessors.addArtifactProcessor(new ConstrainingTypeProcessor(assemblyFactory, policyFactory, staxProcessor));
-        staxProcessors.addArtifactProcessor(new JavaInterfaceProcessor(modelFactories));
-        staxProcessors.addArtifactProcessor(new JavaImplementationProcessor(modelFactories));
+        StAXArtifactProcessorExtensionPoint staxProcessors = extensionPoints.getExtensionPoint(StAXArtifactProcessorExtensionPoint.class);
+        StAXArtifactProcessor<Composite> compositeProcessor = staxProcessors.getProcessor(Composite.class);
         
         // Create a resolver
         //FIXME The ClassLoader should be passed in 
@@ -139,12 +137,14 @@
         ModelResolverImpl resolver = new ModelResolverImpl(classLoader);
 
         try {
+            XMLInputFactory inputFactory = XMLInputFactory.newInstance();
             
             // Read the composite files
             List<Composite> composites = new ArrayList<Composite>();
             for (String compositeFile: compositeFiles) {
                 InputStream is = classLoader.getResourceAsStream(compositeFile);
-                Composite composite = staxProcessor.read(is, Composite.class);
+                XMLStreamReader reader = inputFactory.createXMLStreamReader(is);
+                Composite composite = compositeProcessor.read(reader);
                 resolver.addModel(composite);
                 composites.add(composite);
             }
@@ -162,7 +162,9 @@
             throw new RuntimeException(e);
         } catch (CompositeBuilderException e) {
             throw new RuntimeException(e);
-        }
+        } catch (XMLStreamException e) {
+            throw new RuntimeException(e);
+        } 
     }
     
     private void buildComposite(Composite composite, AssemblyFactory assemblyFactory,

Modified: incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/ReferenceParameterProcessor.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/ReferenceParameterProcessor.java?rev=652983&r1=652982&r2=652983&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/ReferenceParameterProcessor.java (original)
+++ incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/ReferenceParameterProcessor.java Fri May  2 19:52:39 2008
@@ -24,6 +24,7 @@
 import javax.xml.stream.XMLStreamReader;
 import javax.xml.stream.XMLStreamWriter;
 
+import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
 import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
 import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
 import org.apache.tuscany.sca.contribution.service.ContributionReadException;
@@ -32,6 +33,8 @@
 import org.apache.tuscany.sca.runtime.ReferenceParameters;
 
 /**
+ * Artifact processor for reference parameters.
+ * 
  * @version $Rev$ $Date$
  */
 public class ReferenceParameterProcessor implements StAXArtifactProcessor<ReferenceParameters> {
@@ -39,6 +42,14 @@
         new QName("http://tuscany.apache.org/xmlns/sca/1.0", "referenceParameters", "tuscany");
 
     /**
+     * Constructs a new processor.
+     * 
+     * @param modelFactories
+     */
+    public ReferenceParameterProcessor(ModelFactoryExtensionPoint modelFactories) {
+    }
+
+    /**
      * @see org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor#getArtifactType()
      */
     public QName getArtifactType() {

Modified: incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/context/ComponentContextHelper.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/context/ComponentContextHelper.java?rev=652983&r1=652982&r2=652983&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/context/ComponentContextHelper.java (original)
+++ incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/context/ComponentContextHelper.java Fri May  2 19:52:39 2008
@@ -46,7 +46,6 @@
 import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
 import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessorExtensionPoint;
 import org.apache.tuscany.sca.core.assembly.CompositeActivator;
-import org.apache.tuscany.sca.core.assembly.ReferenceParameterProcessor;
 import org.apache.tuscany.sca.core.invocation.ThreadMessageContext;
 import org.apache.tuscany.sca.interfacedef.Interface;
 import org.apache.tuscany.sca.interfacedef.InterfaceContract;
@@ -79,7 +78,6 @@
         this.assemblyFactory = assemblyFactory;
         this.javaInterfaceFactory = javaInterfaceFactory;
         this.staxProcessors = processors;
-        staxProcessors.addArtifactProcessor(new ReferenceParameterProcessor());
     }
 
     /**

Added: incubator/tuscany/java/sca/modules/core/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/core/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor?rev=652983&view=auto
==============================================================================
--- incubator/tuscany/java/sca/modules/core/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor (added)
+++ incubator/tuscany/java/sca/modules/core/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor Fri May  2 19:52:39 2008
@@ -0,0 +1,19 @@
+# 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 artifact processor extension
+org.apache.tuscany.sca.core.assembly.ReferenceParameterProcessor;qname=http://tuscany.apache.org/xmlns/sca/1.0#referenceParameters,model=org.apache.tuscany.sca.runtime.ReferenceParameters

Modified: incubator/tuscany/java/sca/modules/definitions-xml/src/main/java/org/apache/tuscany/sca/definitions/xml/SCADefinitionsDocumentProcessor.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/definitions-xml/src/main/java/org/apache/tuscany/sca/definitions/xml/SCADefinitionsDocumentProcessor.java?rev=652983&r1=652982&r2=652983&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/definitions-xml/src/main/java/org/apache/tuscany/sca/definitions/xml/SCADefinitionsDocumentProcessor.java (original)
+++ incubator/tuscany/java/sca/modules/definitions-xml/src/main/java/org/apache/tuscany/sca/definitions/xml/SCADefinitionsDocumentProcessor.java Fri May  2 19:52:39 2008
@@ -23,10 +23,10 @@
 import java.io.InputStream;
 import java.net.URI;
 import java.net.URL;
+import java.net.URLConnection;
 import java.security.AccessController;
 import java.security.PrivilegedActionException;
 import java.security.PrivilegedExceptionAction;
-import java.net.URLConnection;
 
 import javax.xml.namespace.QName;
 import javax.xml.stream.XMLInputFactory;
@@ -34,8 +34,8 @@
 import javax.xml.stream.XMLStreamException;
 import javax.xml.stream.XMLStreamReader;
 
+import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
 import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessorExtensionPoint;
 import org.apache.tuscany.sca.contribution.processor.URLArtifactProcessor;
 import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
 import org.apache.tuscany.sca.contribution.service.ContributionReadException;
@@ -43,15 +43,6 @@
 import org.apache.tuscany.sca.definitions.SCADefinitions;
 import org.apache.tuscany.sca.definitions.impl.SCADefinitionsImpl;
 import org.apache.tuscany.sca.definitions.util.SCADefinitionsUtil;
-import org.apache.tuscany.sca.policy.DefaultIntentAttachPointTypeFactory;
-import org.apache.tuscany.sca.policy.IntentAttachPointTypeFactory;
-import org.apache.tuscany.sca.policy.PolicyFactory;
-import org.apache.tuscany.sca.policy.xml.BindingTypeProcessor;
-import org.apache.tuscany.sca.policy.xml.ImplementationTypeProcessor;
-import org.apache.tuscany.sca.policy.xml.PolicySetProcessor;
-import org.apache.tuscany.sca.policy.xml.ProfileIntentProcessor;
-import org.apache.tuscany.sca.policy.xml.QualifiedIntentProcessor;
-import org.apache.tuscany.sca.policy.xml.SimpleIntentProcessor;
 
 /**
  * A SCA Definitions Document processor.
@@ -59,12 +50,10 @@
  */
 public class SCADefinitionsDocumentProcessor  implements URLArtifactProcessor<SCADefinitions> {
     private StAXArtifactProcessor<Object> extensionProcessor;
-    //private SCADefinitionsBuilder definitionsBuilder;
-    private ModelResolver scaDefinitionsResolver;
     private XMLInputFactory inputFactory;
     private static final String TUSCANY_NS = "http://tuscany.apache.org/xmlns/sca/1.0";
     private static final String DEFINITIONS = "definitions";
-    private static final QName tuscanyDefinitions = new QName(TUSCANY_NS,DEFINITIONS);
+    private static final QName DEFINITIONS_QNAME = new QName(TUSCANY_NS, DEFINITIONS);
 
     /**
      * Construct a new SCADefinitions processor
@@ -72,26 +61,21 @@
      * @param policyFactory
      * @param staxProcessor
      */
-    public SCADefinitionsDocumentProcessor(StAXArtifactProcessorExtensionPoint staxProcessors,
-                                           StAXArtifactProcessor<Object> staxProcessor,
-                                           XMLInputFactory inputFactory,
-                                           PolicyFactory policyFactory) {
+    public SCADefinitionsDocumentProcessor(StAXArtifactProcessor<Object> staxProcessor,
+                                           XMLInputFactory inputFactory) {
         this.extensionProcessor = (StAXArtifactProcessor<Object>)staxProcessor;
         this.inputFactory = inputFactory;
-        //definitionsBuilder = new SCADefinitionsBuilderImpl();
-        this.scaDefinitionsResolver = new SCADefinitionsResolver();
-        
-        IntentAttachPointTypeFactory intentAttachPointFactory = new DefaultIntentAttachPointTypeFactory();
-            
-        SCADefinitionsProcessor scaDefnProcessor = new SCADefinitionsProcessor(policyFactory, extensionProcessor, scaDefinitionsResolver);
-        staxProcessors.addArtifactProcessor(scaDefnProcessor);
-        
-        staxProcessors.addArtifactProcessor(new SimpleIntentProcessor(policyFactory, extensionProcessor));
-        staxProcessors.addArtifactProcessor(new ProfileIntentProcessor(policyFactory, extensionProcessor));
-        staxProcessors.addArtifactProcessor(new QualifiedIntentProcessor(policyFactory, extensionProcessor));
-        staxProcessors.addArtifactProcessor(new PolicySetProcessor(policyFactory, extensionProcessor));
-        staxProcessors.addArtifactProcessor(new ImplementationTypeProcessor(policyFactory, intentAttachPointFactory, extensionProcessor));
-        staxProcessors.addArtifactProcessor(new BindingTypeProcessor(policyFactory, intentAttachPointFactory, extensionProcessor));
+    }
+
+    /**
+     * Constructs a new SCADefinitions processor.
+     * 
+     * @param modelFactories
+     * @param staxProcessor
+     */
+    public SCADefinitionsDocumentProcessor(ModelFactoryExtensionPoint modelFactories, StAXArtifactProcessor<Object> staxProcessor) {
+        this.extensionProcessor = (StAXArtifactProcessor<Object>)staxProcessor;
+        this.inputFactory = modelFactories.getFactory(XMLInputFactory.class);
     }
     
 
@@ -115,7 +99,7 @@
             //urlStream = createInputStream(url);
             XMLStreamReader reader = inputFactory.createXMLStreamReader(url.toString(), urlStream);
             
-            SCADefinitions scaDefns = new SCADefinitionsImpl();
+            SCADefinitions definitions = new SCADefinitionsImpl();
             QName name = null;
             int event;
             while ( reader.hasNext() ) {
@@ -124,18 +108,18 @@
                 if ( event == XMLStreamConstants.START_ELEMENT  ||
                     event == XMLStreamConstants.END_ELEMENT ) {
                     name = reader.getName();
-                    if ( name.equals(tuscanyDefinitions) ) {
+                    if ( name.equals(DEFINITIONS_QNAME) ) {
                         if ( event == XMLStreamConstants.END_ELEMENT ) {
-                            return scaDefns;
+                            return definitions;
                         } 
                     } else {
                         SCADefinitions aDefn = (SCADefinitions)extensionProcessor.read(reader);
-                        SCADefinitionsUtil.aggregateSCADefinitions(aDefn, scaDefns);
+                        SCADefinitionsUtil.aggregateSCADefinitions(aDefn, definitions);
                     }
                 }
             }
             
-            return scaDefns;
+            return definitions;
         } catch (XMLStreamException e) {
             throw new ContributionReadException(e);
         } catch (IOException e) {
@@ -154,9 +138,6 @@
     }
     
     public void resolve(SCADefinitions scaDefinitions, ModelResolver resolver) throws ContributionResolveException {
-        if ( resolver == null ) {
-            resolver = this.scaDefinitionsResolver;
-        }
         SCADefinitionsUtil.stripDuplicates(scaDefinitions);
         extensionProcessor.resolve(scaDefinitions, resolver);
     }
@@ -169,11 +150,4 @@
         return SCADefinitions.class;
     }
 
-    public ModelResolver getSCADefinitionsResolver() {
-        return scaDefinitionsResolver;
-    }
-
-    public void setDomainModelResolver(ModelResolver scaDefnsModelResolver) {
-        this.scaDefinitionsResolver = scaDefnsModelResolver;
-    }
 }

Modified: incubator/tuscany/java/sca/modules/definitions-xml/src/main/java/org/apache/tuscany/sca/definitions/xml/SCADefinitionsProcessor.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/definitions-xml/src/main/java/org/apache/tuscany/sca/definitions/xml/SCADefinitionsProcessor.java?rev=652983&r1=652982&r2=652983&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/definitions-xml/src/main/java/org/apache/tuscany/sca/definitions/xml/SCADefinitionsProcessor.java (original)
+++ incubator/tuscany/java/sca/modules/definitions-xml/src/main/java/org/apache/tuscany/sca/definitions/xml/SCADefinitionsProcessor.java Fri May  2 19:52:39 2008
@@ -34,11 +34,11 @@
 import org.apache.tuscany.sca.contribution.service.ContributionReadException;
 import org.apache.tuscany.sca.contribution.service.ContributionResolveException;
 import org.apache.tuscany.sca.contribution.service.ContributionWriteException;
+import org.apache.tuscany.sca.core.ExtensionPointRegistry;
 import org.apache.tuscany.sca.definitions.SCADefinitions;
 import org.apache.tuscany.sca.definitions.impl.SCADefinitionsImpl;
 import org.apache.tuscany.sca.policy.Intent;
 import org.apache.tuscany.sca.policy.IntentAttachPointType;
-import org.apache.tuscany.sca.policy.PolicyFactory;
 import org.apache.tuscany.sca.policy.PolicySet;
 import org.apache.tuscany.sca.policy.QualifiedIntent;
 
@@ -49,7 +49,6 @@
 public class SCADefinitionsProcessor extends BaseStAXArtifactProcessor implements StAXArtifactProcessor<SCADefinitions> {
     
     private StAXArtifactProcessor<Object> extensionProcessor;
-    private ModelResolver definitionsResolver;
     
     public static final String BINDING = "binding";
     public static final String IMPLEMENTATION = "implementation";
@@ -60,16 +59,17 @@
     public static final String NAME = "name";
     
     /**
-     * Construct a new (sca) definitions processor
-     * @param policyFactory
+     * Construct a new definitions processor
      * @param extensionProcessor 
      * @param modelResolver 
      */
-    public SCADefinitionsProcessor(PolicyFactory policyFactory,
-                              StAXArtifactProcessor<Object> extensionProcessor,
+    public SCADefinitionsProcessor(StAXArtifactProcessor<Object> extensionProcessor,
                               ModelResolver modelResolver) {
         this.extensionProcessor = extensionProcessor;
-        this.definitionsResolver = modelResolver;
+    }
+    
+    public SCADefinitionsProcessor(ExtensionPointRegistry extensionPoints, StAXArtifactProcessor<Object> extensionProcessor) {
+        this.extensionProcessor = extensionProcessor;
     }
 
     public SCADefinitions read(XMLStreamReader reader) throws ContributionReadException, XMLStreamException {
@@ -114,7 +114,6 @@
                                     definitions.getImplementationTypes().add((IntentAttachPointType)extension);
                                 }
                             } 
-                            definitionsResolver.addModel(extension);
                         }
                         break;
                     }

Modified: incubator/tuscany/java/sca/modules/definitions-xml/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/definitions-xml/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor?rev=652983&r1=652982&r2=652983&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/definitions-xml/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor (original)
+++ incubator/tuscany/java/sca/modules/definitions-xml/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor Fri May  2 19:52:39 2008
@@ -16,4 +16,4 @@
 # under the License. 
 
 # Implementation class for the artifact processor extension
-#org.apache.tuscany.sca.definitions.xml.SCADefinitionsProcessor;qname=http://www.osoa.org/xmlns/sca/1.0#definitions,model=org.apache.tuscany.sca.definitions.SCADefinitions
+org.apache.tuscany.sca.definitions.xml.SCADefinitionsProcessor;qname=http://www.osoa.org/xmlns/sca/1.0#definitions,model=org.apache.tuscany.sca.definitions.SCADefinitions

Added: incubator/tuscany/java/sca/modules/definitions-xml/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.URLArtifactProcessor
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/definitions-xml/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.URLArtifactProcessor?rev=652983&view=auto
==============================================================================
--- incubator/tuscany/java/sca/modules/definitions-xml/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.URLArtifactProcessor (added)
+++ incubator/tuscany/java/sca/modules/definitions-xml/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.URLArtifactProcessor Fri May  2 19:52:39 2008
@@ -0,0 +1,19 @@
+# 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 artifact processor extension
+org.apache.tuscany.sca.definitions.xml.SCADefinitionsDocumentProcessor;type=definitions.xml,model=org.apache.tuscany.sca.definitions.SCADefinitions

Modified: incubator/tuscany/java/sca/modules/definitions-xml/src/test/java/org/apache/tuscany/sca/definitions/ReadDocumentTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/definitions-xml/src/test/java/org/apache/tuscany/sca/definitions/ReadDocumentTestCase.java?rev=652983&r1=652982&r2=652983&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/definitions-xml/src/test/java/org/apache/tuscany/sca/definitions/ReadDocumentTestCase.java (original)
+++ incubator/tuscany/java/sca/modules/definitions-xml/src/test/java/org/apache/tuscany/sca/definitions/ReadDocumentTestCase.java Fri May  2 19:52:39 2008
@@ -25,21 +25,17 @@
 import java.util.Map;
 
 import javax.xml.namespace.QName;
-import javax.xml.stream.XMLInputFactory;
-import javax.xml.stream.XMLOutputFactory;
 
 import junit.framework.TestCase;
 
-import org.apache.tuscany.sca.contribution.DefaultModelFactoryExtensionPoint;
-import org.apache.tuscany.sca.contribution.processor.DefaultStAXArtifactProcessorExtensionPoint;
-import org.apache.tuscany.sca.contribution.processor.ExtensibleStAXArtifactProcessor;
-import org.apache.tuscany.sca.definitions.xml.SCADefinitionsDocumentProcessor;
-import org.apache.tuscany.sca.policy.DefaultIntentAttachPointTypeFactory;
-import org.apache.tuscany.sca.policy.DefaultPolicyFactory;
+import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessorExtensionPoint;
+import org.apache.tuscany.sca.contribution.processor.URLArtifactProcessor;
+import org.apache.tuscany.sca.contribution.processor.URLArtifactProcessorExtensionPoint;
+import org.apache.tuscany.sca.contribution.resolver.DefaultModelResolver;
+import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
+import org.apache.tuscany.sca.core.DefaultExtensionPointRegistry;
 import org.apache.tuscany.sca.policy.Intent;
 import org.apache.tuscany.sca.policy.IntentAttachPointType;
-import org.apache.tuscany.sca.policy.IntentAttachPointTypeFactory;
-import org.apache.tuscany.sca.policy.PolicyFactory;
 import org.apache.tuscany.sca.policy.PolicySet;
 import org.apache.tuscany.sca.policy.ProfileIntent;
 import org.apache.tuscany.sca.policy.QualifiedIntent;
@@ -51,9 +47,8 @@
  */
 public class ReadDocumentTestCase extends TestCase {
 
-    //private ModelResolver resolver; 
-    private SCADefinitionsDocumentProcessor scaDefnDocProcessor = null;
-    private SCADefinitions scaDefinitions;
+    private URLArtifactProcessor<SCADefinitions> policyDefinitionsProcessor = null;
+    private SCADefinitions definitions;
     Map<QName, Intent> intentTable = new Hashtable<QName, Intent>();
     Map<QName, PolicySet> policySetTable = new Hashtable<QName, PolicySet>();
     Map<QName, IntentAttachPointType> bindingTypesTable = new Hashtable<QName, IntentAttachPointType>();
@@ -77,48 +72,38 @@
 
     @Override
     public void setUp() throws Exception {
-        XMLInputFactory inputFactory = XMLInputFactory.newInstance();
-        PolicyFactory policyFactory = new DefaultPolicyFactory();
-        IntentAttachPointTypeFactory intentAttachPointFactory = new DefaultIntentAttachPointTypeFactory();
+        DefaultExtensionPointRegistry extensionPoints = new DefaultExtensionPointRegistry();
         
         // Create StAX processors
-        DefaultStAXArtifactProcessorExtensionPoint staxProcessors = new DefaultStAXArtifactProcessorExtensionPoint(new DefaultModelFactoryExtensionPoint());
-        ExtensibleStAXArtifactProcessor staxProcessor = new ExtensibleStAXArtifactProcessor(staxProcessors, XMLInputFactory.newInstance(), XMLOutputFactory.newInstance());
-        staxProcessors.addArtifactProcessor(new MockPolicyProcessor());
-        
-        scaDefnDocProcessor = new SCADefinitionsDocumentProcessor(staxProcessors, 
-                                                                  staxProcessor, 
-                                                                  inputFactory, 
-                                                                  policyFactory);
+        StAXArtifactProcessorExtensionPoint staxProcessors = extensionPoints.getExtensionPoint(StAXArtifactProcessorExtensionPoint.class);
+        staxProcessors.addArtifactProcessor(new TestPolicyProcessor());
+        
+        URLArtifactProcessorExtensionPoint documentProcessors = extensionPoints.getExtensionPoint(URLArtifactProcessorExtensionPoint.class);
+        policyDefinitionsProcessor = documentProcessors.getProcessor(SCADefinitions.class); 
         
         URL url = getClass().getResource("test_definitions.xml");
         URI uri = URI.create("test_definitions.xml");
-        scaDefinitions = scaDefnDocProcessor.read(null, uri, url);
+        definitions = policyDefinitionsProcessor.read(null, uri, url);
         
-        for ( Intent intent : scaDefinitions.getPolicyIntents() ) {
+        for ( Intent intent : definitions.getPolicyIntents() ) {
             intentTable.put(intent.getName(), intent);
         }
         
-        for ( PolicySet policySet : scaDefinitions.getPolicySets() ) {
+        for ( PolicySet policySet : definitions.getPolicySets() ) {
             policySetTable.put(policySet.getName(), policySet);
         }
         
-        for ( IntentAttachPointType bindingType : scaDefinitions.getBindingTypes() ) {
+        for ( IntentAttachPointType bindingType : definitions.getBindingTypes() ) {
             bindingTypesTable.put(bindingType.getName(), bindingType);
         }
         
-        for ( IntentAttachPointType implType : scaDefinitions.getImplementationTypes() ) {
+        for ( IntentAttachPointType implType : definitions.getImplementationTypes() ) {
             implTypesTable.put(implType.getName(), implType);
         }
     }
 
-    @Override
-    public void tearDown() throws Exception {
-        scaDefnDocProcessor = null;
-    }
-
     public void testReadSCADefinitions() throws Exception {
-        assertNotNull(scaDefinitions);
+        assertNotNull(definitions);
         
         assertNotNull(intentTable.get(confidentiality));
         assertNotNull(intentTable.get(messageProtection));
@@ -171,7 +156,8 @@
         assertNull(javaImplType.getAlwaysProvidedIntents().get(0).getDescription());
         assertNull(javaImplType.getMayProvideIntents().get(0).getDescription());
         
-        scaDefnDocProcessor.resolve(scaDefinitions, null);
+        ModelResolver resolver = new DefaultModelResolver();
+        policyDefinitionsProcessor.resolve(definitions, resolver);
         //builder.build(scaDefinitions);
         
         //testing if policy intents have been linked have property been linked up 

Copied: incubator/tuscany/java/sca/modules/definitions-xml/src/test/java/org/apache/tuscany/sca/definitions/TestPolicyProcessor.java (from r651678, incubator/tuscany/java/sca/modules/definitions-xml/src/test/java/org/apache/tuscany/sca/definitions/MockPolicyProcessor.java)
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/definitions-xml/src/test/java/org/apache/tuscany/sca/definitions/TestPolicyProcessor.java?p2=incubator/tuscany/java/sca/modules/definitions-xml/src/test/java/org/apache/tuscany/sca/definitions/TestPolicyProcessor.java&p1=incubator/tuscany/java/sca/modules/definitions-xml/src/test/java/org/apache/tuscany/sca/definitions/MockPolicyProcessor.java&r1=651678&r2=652983&rev=652983&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/definitions-xml/src/test/java/org/apache/tuscany/sca/definitions/MockPolicyProcessor.java (original)
+++ incubator/tuscany/java/sca/modules/definitions-xml/src/test/java/org/apache/tuscany/sca/definitions/TestPolicyProcessor.java Fri May  2 19:52:39 2008
@@ -30,7 +30,7 @@
 import org.apache.tuscany.sca.contribution.service.ContributionWriteException;
 import org.apache.tuscany.sca.policy.Policy;
 
-public class MockPolicyProcessor implements StAXArtifactProcessor<Policy> {
+public class TestPolicyProcessor implements StAXArtifactProcessor<Policy> {
 
     public QName getArtifactType() {
         return new QName("http://schemas.xmlsoap.org/ws/2004/09/policy", "PolicyAttachment");

Propchange: incubator/tuscany/java/sca/modules/definitions-xml/src/test/java/org/apache/tuscany/sca/definitions/TestPolicyProcessor.java
------------------------------------------------------------------------------
    eol-style = native

Modified: incubator/tuscany/java/sca/modules/domain-manager/src/main/java/org/apache/tuscany/sca/domain/manager/impl/ContributionCollectionImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/domain-manager/src/main/java/org/apache/tuscany/sca/domain/manager/impl/ContributionCollectionImpl.java?rev=652983&r1=652982&r2=652983&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/domain-manager/src/main/java/org/apache/tuscany/sca/domain/manager/impl/ContributionCollectionImpl.java (original)
+++ incubator/tuscany/java/sca/modules/domain-manager/src/main/java/org/apache/tuscany/sca/domain/manager/impl/ContributionCollectionImpl.java Fri May  2 19:52:39 2008
@@ -54,8 +54,6 @@
 
 import org.apache.tuscany.sca.assembly.AssemblyFactory;
 import org.apache.tuscany.sca.assembly.Composite;
-import org.apache.tuscany.sca.assembly.xml.CompositeDocumentProcessor;
-import org.apache.tuscany.sca.assembly.xml.CompositeProcessor;
 import org.apache.tuscany.sca.contribution.Contribution;
 import org.apache.tuscany.sca.contribution.ContributionFactory;
 import org.apache.tuscany.sca.contribution.DefaultModelFactoryExtensionPoint;
@@ -70,9 +68,6 @@
 import org.apache.tuscany.sca.contribution.processor.URLArtifactProcessorExtensionPoint;
 import org.apache.tuscany.sca.contribution.resolver.DefaultModelResolverExtensionPoint;
 import org.apache.tuscany.sca.contribution.resolver.ModelResolverExtensionPoint;
-import org.apache.tuscany.sca.contribution.xml.ContributionGeneratedMetadataDocumentProcessor;
-import org.apache.tuscany.sca.contribution.xml.ContributionMetadataDocumentProcessor;
-import org.apache.tuscany.sca.contribution.xml.ContributionMetadataProcessor;
 import org.apache.tuscany.sca.core.DefaultExtensionPointRegistry;
 import org.apache.tuscany.sca.core.ExtensionPointRegistry;
 import org.apache.tuscany.sca.core.UtilityExtensionPoint;
@@ -90,7 +85,6 @@
 import org.apache.tuscany.sca.workspace.builder.ContributionDependencyBuilder;
 import org.apache.tuscany.sca.workspace.builder.impl.ContributionDependencyBuilderImpl;
 import org.apache.tuscany.sca.workspace.processor.impl.ContributionInfoProcessor;
-import org.apache.tuscany.sca.workspace.xml.WorkspaceProcessor;
 import org.apache.xml.serialize.OutputFormat;
 import org.apache.xml.serialize.XMLSerializer;
 import org.osoa.sca.ServiceRuntimeException;
@@ -158,17 +152,11 @@
 
         // Create artifact processors
         inputFactory = modelFactories.getFactory(XMLInputFactory.class);
-        StAXArtifactProcessorExtensionPoint staxProcessors = new DefaultStAXArtifactProcessorExtensionPoint(modelFactories);
+        StAXArtifactProcessorExtensionPoint staxProcessors = new DefaultStAXArtifactProcessorExtensionPoint(extensionPoints);
         staxProcessor = new ExtensibleStAXArtifactProcessor(staxProcessors, inputFactory, outputFactory);
-        staxProcessors.addArtifactProcessor(new ContributionMetadataProcessor(assemblyFactory, contributionFactory, staxProcessor));
-        staxProcessors.addArtifactProcessor(new WorkspaceProcessor(workspaceFactory, contributionFactory, staxProcessor));
-        staxProcessors.addArtifactProcessor(new CompositeProcessor(contributionFactory, assemblyFactory, policyFactory, staxProcessor));
 
-        URLArtifactProcessorExtensionPoint urlProcessors = new DefaultURLArtifactProcessorExtensionPoint(modelFactories);
+        URLArtifactProcessorExtensionPoint urlProcessors = new DefaultURLArtifactProcessorExtensionPoint(extensionPoints);
         urlProcessor = new ExtensibleURLArtifactProcessor(urlProcessors);
-        urlProcessors.addArtifactProcessor(new ContributionMetadataDocumentProcessor(staxProcessor, inputFactory));
-        urlProcessors.addArtifactProcessor(new ContributionGeneratedMetadataDocumentProcessor(staxProcessor, inputFactory));
-        urlProcessors.addArtifactProcessor(new CompositeDocumentProcessor(staxProcessor, inputFactory, null));
         
         // Create contribution info processor
         contributionInfoProcessor = new ContributionInfoProcessor(modelFactories, modelResolvers, urlProcessor);

Modified: incubator/tuscany/java/sca/modules/domain-manager/src/main/java/org/apache/tuscany/sca/domain/manager/impl/DeployableCompositeCollectionImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/domain-manager/src/main/java/org/apache/tuscany/sca/domain/manager/impl/DeployableCompositeCollectionImpl.java?rev=652983&r1=652982&r2=652983&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/domain-manager/src/main/java/org/apache/tuscany/sca/domain/manager/impl/DeployableCompositeCollectionImpl.java (original)
+++ incubator/tuscany/java/sca/modules/domain-manager/src/main/java/org/apache/tuscany/sca/domain/manager/impl/DeployableCompositeCollectionImpl.java Fri May  2 19:52:39 2008
@@ -151,22 +151,16 @@
         // Get model factories
         modelFactories = extensionPoints.getExtensionPoint(ModelFactoryExtensionPoint.class);
         assemblyFactory = modelFactories.getFactory(AssemblyFactory.class);
-        XMLInputFactory inputFactory = modelFactories.getFactory(XMLInputFactory.class);
         outputFactory = modelFactories.getFactory(XMLOutputFactory.class);
         outputFactory.setProperty(XMLOutputFactory.IS_REPAIRING_NAMESPACES, true);
-        ContributionFactory contributionFactory = modelFactories.getFactory(ContributionFactory.class);
         workspaceFactory = modelFactories.getFactory(WorkspaceFactory.class);
         
         // Get and initialize artifact processors
         StAXArtifactProcessorExtensionPoint staxProcessors = extensionPoints.getExtensionPoint(StAXArtifactProcessorExtensionPoint.class);
-        StAXArtifactProcessor<Object> staxProcessor = new ExtensibleStAXArtifactProcessor(staxProcessors, inputFactory, outputFactory);
-        staxProcessors.addArtifactProcessor(new ContributionMetadataProcessor(assemblyFactory, contributionFactory, staxProcessor));
         compositeProcessor = (StAXArtifactProcessor<Composite>)staxProcessors.getProcessor(Composite.class);
 
         URLArtifactProcessorExtensionPoint urlProcessors = extensionPoints.getExtensionPoint(URLArtifactProcessorExtensionPoint.class);
         URLArtifactProcessor<Object> urlProcessor = new ExtensibleURLArtifactProcessor(urlProcessors);
-        urlProcessors.addArtifactProcessor(new ContributionMetadataDocumentProcessor(staxProcessor, inputFactory));
-        urlProcessors.addArtifactProcessor(new ContributionGeneratedMetadataDocumentProcessor(staxProcessor, inputFactory));
         
         // Create contribution processor
         modelResolvers = extensionPoints.getExtensionPoint(ModelResolverExtensionPoint.class);

Modified: incubator/tuscany/java/sca/modules/domain-manager/src/main/java/org/apache/tuscany/sca/domain/manager/impl/DeployedCompositeCollectionImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/domain-manager/src/main/java/org/apache/tuscany/sca/domain/manager/impl/DeployedCompositeCollectionImpl.java?rev=652983&r1=652982&r2=652983&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/domain-manager/src/main/java/org/apache/tuscany/sca/domain/manager/impl/DeployedCompositeCollectionImpl.java (original)
+++ incubator/tuscany/java/sca/modules/domain-manager/src/main/java/org/apache/tuscany/sca/domain/manager/impl/DeployedCompositeCollectionImpl.java Fri May  2 19:52:39 2008
@@ -64,6 +64,10 @@
 import org.apache.tuscany.sca.contribution.ContributionFactory;
 import org.apache.tuscany.sca.contribution.DefaultModelFactoryExtensionPoint;
 import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
+import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
+import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessorExtensionPoint;
+import org.apache.tuscany.sca.core.DefaultExtensionPointRegistry;
+import org.apache.tuscany.sca.core.ExtensionPointRegistry;
 import org.apache.tuscany.sca.implementation.data.collection.Entry;
 import org.apache.tuscany.sca.implementation.data.collection.Item;
 import org.apache.tuscany.sca.implementation.data.collection.ItemCollection;
@@ -104,9 +108,10 @@
     @Reference(required=false)
     public LocalItemCollection processCollection;
 
+    private ExtensionPointRegistry extensionPoints;
     private ModelFactoryExtensionPoint modelFactories;
     private AssemblyFactory assemblyFactory;
-    private CompositeProcessor compositeProcessor;
+    private StAXArtifactProcessor<Composite> compositeProcessor;
     private XMLOutputFactory outputFactory;
     private DocumentBuilder documentBuilder;
     
@@ -117,7 +122,8 @@
     public void initialize() throws ParserConfigurationException {
         
         // Create factories
-        modelFactories = new DefaultModelFactoryExtensionPoint();
+        extensionPoints = new DefaultExtensionPointRegistry();
+        modelFactories = extensionPoints.getExtensionPoint(ModelFactoryExtensionPoint.class);
         assemblyFactory = modelFactories.getFactory(AssemblyFactory.class);
         outputFactory = modelFactories.getFactory(XMLOutputFactory.class);
         outputFactory.setProperty(XMLOutputFactory.IS_REPAIRING_NAMESPACES, true);
@@ -125,7 +131,8 @@
         // Create composite processor
         ContributionFactory contributionFactory = modelFactories.getFactory(ContributionFactory.class);
         PolicyFactory policyFactory = modelFactories.getFactory(PolicyFactory.class);
-        compositeProcessor = new CompositeProcessor(contributionFactory, assemblyFactory, policyFactory, null);
+        StAXArtifactProcessorExtensionPoint staxProcessors = extensionPoints.getExtensionPoint(StAXArtifactProcessorExtensionPoint.class);
+        compositeProcessor = staxProcessors.getProcessor(Composite.class);
 
         // Create a document builder (used to pretty print XML)
         documentBuilder = DocumentBuilderFactory.newInstance().newDocumentBuilder();



Mime
View raw message