tuscany-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jsdelf...@apache.org
Subject svn commit: r652983 [4/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/host-embedded/src/main/java/org/apache/tuscany/sca/host/embedded/impl/ReallySmallRuntime.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/host-embedded/src/main/java/org/apache/tuscany/sca/host/embedded/impl/ReallySmallRuntime.java?rev=652983&r1=652982&r2=652983&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/host-embedded/src/main/java/org/apache/tuscany/sca/host/embedded/impl/ReallySmallRuntime.java (original)
+++ incubator/tuscany/java/sca/modules/host-embedded/src/main/java/org/apache/tuscany/sca/host/embedded/impl/ReallySmallRuntime.java Fri May  2 19:52:39 2008
@@ -37,7 +37,10 @@
 import org.apache.tuscany.sca.context.DefaultContextFactoryExtensionPoint;
 import org.apache.tuscany.sca.contribution.ContributionFactory;
 import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
+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.contribution.service.ContributionService;
 import org.apache.tuscany.sca.core.DefaultExtensionPointRegistry;
 import org.apache.tuscany.sca.core.ExtensionPointRegistry;
@@ -85,7 +88,8 @@
     private WorkScheduler workScheduler;
     private ScopeRegistry scopeRegistry;
     private ProxyFactory proxyFactory;
-    private List scaDefnsSink = new ArrayList();
+    private List<SCADefinitions> policyDefinitions;
+    private ModelResolver policyDefinitionsResolver;
     private Monitor monitor;
 
     public ReallySmallRuntime(ClassLoader classLoader) {
@@ -147,13 +151,16 @@
 
         
         // Create a contribution service
+        policyDefinitions = new ArrayList<SCADefinitions>();
+        policyDefinitionsResolver = new DefaultModelResolver();
         contributionService = ReallySmallRuntimeBuilder.createContributionService(classLoader,
                                                                                   registry,
                                                                                   contributionFactory,
                                                                                   assemblyFactory,
                                                                                   policyFactory,
                                                                                   mapper,
-                                                                                  scaDefnsSink,
+                                                                                  policyDefinitions,
+                                                                                  policyDefinitionsResolver,
                                                                                   monitor);
         
         // Create the ScopeRegistry
@@ -170,7 +177,7 @@
                                                                                 workScheduler);
 
         // Load the definitions.xml
-        loadSCADefinitions(registry);
+        loadSCADefinitions();
         
         if (logger.isLoggable(Level.FINE)) {
             long end = System.currentTimeMillis();
@@ -211,16 +218,16 @@
         
         
         //Create a composite builder
-        SCADefinitions scaDefns = new SCADefinitionsImpl();
-        for ( SCADefinitions aDef : ((List<SCADefinitions>)scaDefnsSink) ) {
-            SCADefinitionsUtil.aggregateSCADefinitions(aDef, scaDefns);
+        SCADefinitions aggregatedDefinitions = new SCADefinitionsImpl();
+        for ( SCADefinitions definition : ((List<SCADefinitions>)policyDefinitions) ) {
+            SCADefinitionsUtil.aggregateSCADefinitions(definition, aggregatedDefinitions);
         }
         compositeBuilder = ReallySmallRuntimeBuilder.createCompositeBuilder(monitor,
                                                                             assemblyFactory,
                                                                             scaBindingFactory,
                                                                             intentAttachPointTypeFactory,
                                                                             mapper, 
-                                                                            scaDefns);
+                                                                            aggregatedDefinitions);
         compositeBuilder.build(composite);
         
     }
@@ -257,10 +264,10 @@
         return domainBuilder;
     }
     
-    private void  loadSCADefinitions(ExtensionPointRegistry registry) throws ActivationException {
+    private void  loadSCADefinitions() throws ActivationException {
         try {
             URLArtifactProcessorExtensionPoint documentProcessors = registry.getExtensionPoint(URLArtifactProcessorExtensionPoint.class);
-            SCADefinitionsDocumentProcessor definitionsProcessor = (SCADefinitionsDocumentProcessor)documentProcessors.getProcessor(SCADefinitions.class);
+            URLArtifactProcessor<SCADefinitions> definitionsProcessor = documentProcessors.getProcessor(SCADefinitions.class);
             SCADefinitionsProviderExtensionPoint scaDefnProviders = registry.getExtensionPoint(SCADefinitionsProviderExtensionPoint.class);
             
             SCADefinitions systemSCADefinitions = new SCADefinitionsImpl();
@@ -270,28 +277,29 @@
                SCADefinitionsUtil.aggregateSCADefinitions(aSCADefn, systemSCADefinitions);
             }
             
-            scaDefnsSink.add(systemSCADefinitions);
+            policyDefinitions.add(systemSCADefinitions);
+            
             //we cannot expect that providers will add the intents and policysets into the resolver
             //so we do this here explicitly
             for ( Intent intent : systemSCADefinitions.getPolicyIntents() ) {
-                definitionsProcessor.getSCADefinitionsResolver().addModel(intent);
+                policyDefinitionsResolver.addModel(intent);
             }
             
             for ( PolicySet policySet : systemSCADefinitions.getPolicySets() ) {
-                definitionsProcessor.getSCADefinitionsResolver().addModel(policySet);
+                policyDefinitionsResolver.addModel(policySet);
             }
             
             for ( IntentAttachPointType attachPoinType : systemSCADefinitions.getBindingTypes() ) {
-                definitionsProcessor.getSCADefinitionsResolver().addModel(attachPoinType);
+                policyDefinitionsResolver.addModel(attachPoinType);
             }
             
             for ( IntentAttachPointType attachPoinType : systemSCADefinitions.getImplementationTypes() ) {
-                definitionsProcessor.getSCADefinitionsResolver().addModel(attachPoinType);
+                policyDefinitionsResolver.addModel(attachPoinType);
             }
             
             //now that all system sca definitions have been read, lets resolve them right away
             definitionsProcessor.resolve(systemSCADefinitions, 
-                                         definitionsProcessor.getSCADefinitionsResolver());
+                                         policyDefinitionsResolver);
         } catch ( Exception e ) {
             throw new ActivationException(e);
         }

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?rev=652983&r1=652982&r2=652983&view=diff
==============================================================================
--- 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 May  2 19:52:39 2008
@@ -30,17 +30,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.SCABindingFactory;
 import org.apache.tuscany.sca.assembly.builder.CompositeBuilder;
 import org.apache.tuscany.sca.assembly.builder.DomainBuilder;
 import org.apache.tuscany.sca.assembly.builder.impl.CompositeBuilderImpl;
 import org.apache.tuscany.sca.assembly.builder.impl.DomainWireBuilderImpl;
 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.CompositeProcessor;
 import org.apache.tuscany.sca.assembly.xml.ConstrainingTypeDocumentProcessor;
-import org.apache.tuscany.sca.assembly.xml.ConstrainingTypeProcessor;
 import org.apache.tuscany.sca.context.ContextFactoryExtensionPoint;
 import org.apache.tuscany.sca.context.RequestContextFactory;
 import org.apache.tuscany.sca.contribution.ContributionFactory;
@@ -64,7 +62,6 @@
 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.contribution.xml.ContributionMetadataProcessor;
 import org.apache.tuscany.sca.core.ExtensionPointRegistry;
 import org.apache.tuscany.sca.core.assembly.ActivationException;
 import org.apache.tuscany.sca.core.assembly.CompositeActivator;
@@ -87,7 +84,6 @@
 import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory;
 import org.apache.tuscany.sca.invocation.MessageFactory;
 import org.apache.tuscany.sca.monitor.Monitor;
-import org.apache.tuscany.sca.monitor.MonitorFactory;
 import org.apache.tuscany.sca.policy.IntentAttachPointTypeFactory;
 import org.apache.tuscany.sca.policy.PolicyFactory;
 import org.apache.tuscany.sca.provider.ProviderFactoryExtensionPoint;
@@ -97,7 +93,7 @@
 
 public class ReallySmallRuntimeBuilder {
     
-	private final static Logger logger = Logger.getLogger(ReallySmallRuntimeBuilder.class.getName());
+    private final static Logger logger = Logger.getLogger(ReallySmallRuntimeBuilder.class.getName());
 	
     public static ProxyFactory createProxyFactory(ExtensionPointRegistry registry,
                                                   InterfaceContractMapper mapper,
@@ -156,14 +152,14 @@
                                                           SCABindingFactory scaBindingFactory,
                                                           IntentAttachPointTypeFactory intentAttachPointTypeFactory,
                                                           InterfaceContractMapper interfaceContractMapper,
-                                                          SCADefinitions scaDefns) {
+                                                          SCADefinitions policyDefinitions) {
       
         
         return new CompositeBuilderImpl(assemblyFactory, 
                                         scaBindingFactory, 
                                         intentAttachPointTypeFactory, 
                                         interfaceContractMapper,
-                                        scaDefns,
+                                        policyDefinitions,
                                         monitor);
     }
     
@@ -185,17 +181,22 @@
                                                                 AssemblyFactory assemblyFactory,
                                                                 PolicyFactory policyFactory,
                                                                 InterfaceContractMapper mapper,
-                                                                List scaDefinitionsSink,
+                                                                List<SCADefinitions> policyDefinitions,
+                                                                ModelResolver policyDefinitionResolver,
                                                                 Monitor monitor)
         throws ActivationException {
 
+        // Get the model factory extension point
+        ModelFactoryExtensionPoint modelFactories = registry.getExtensionPoint(ModelFactoryExtensionPoint.class);
+
         // Create a new XML input factory
         // Allow privileged access to factory. Requires RuntimePermission in security policy file.
         XMLInputFactory inputFactory = AccessController.doPrivileged(new PrivilegedAction<XMLInputFactory>() {
             public XMLInputFactory run() {
                 return XMLInputFactory.newInstance();
             }
-        });           
+        });
+        modelFactories.addFactory(inputFactory);
         
         // Create a validation XML schema extension point
         ValidationSchemaExtensionPoint schemas = registry.getExtensionPoint(ValidationSchemaExtensionPoint.class);
@@ -207,10 +208,10 @@
             }
         });           
         schemas.addSchema(schemaURL.toString());
-        
        
         // Create a validating XML input factory
         XMLInputFactory validatingInputFactory = new DefaultValidatingXMLInputFactory(inputFactory, schemas, monitor);
+        modelFactories.addFactory(validatingInputFactory);
         
         // Create StAX artifact processor extension point
         StAXArtifactProcessorExtensionPoint staxProcessors =
@@ -225,31 +226,14 @@
         });           
         ExtensibleStAXArtifactProcessor staxProcessor =
             new ExtensibleStAXArtifactProcessor(staxProcessors, inputFactory, outputFactory);
-        staxProcessors.addArtifactProcessor(new CompositeProcessor(contributionFactory, assemblyFactory, policyFactory, staxProcessor, monitor));
-        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));
 
         // Create URL artifact processor extension point
         URLArtifactProcessorExtensionPoint documentProcessors =
             registry.getExtensionPoint(URLArtifactProcessorExtensionPoint.class);
 
         // Create and register document processors for SCA assembly XML
-        documentProcessors.addArtifactProcessor(new CompositeDocumentProcessor(staxProcessor, validatingInputFactory, scaDefinitionsSink));
-        documentProcessors.addArtifactProcessor(new ComponentTypeDocumentProcessor(staxProcessor, validatingInputFactory));
-        documentProcessors.addArtifactProcessor(new ConstrainingTypeDocumentProcessor(staxProcessor, validatingInputFactory));
-
-        // Create and register document processor for definitions.xml
-        //TODO No XMLSchema validation for definitions.xml for now
-        // as the XSD for it is not quite right yet
-        SCADefinitionsDocumentProcessor definitionsDocumentProcessor =
-            new SCADefinitionsDocumentProcessor(staxProcessors, staxProcessor, inputFactory, policyFactory);
-        documentProcessors.addArtifactProcessor(definitionsDocumentProcessor);
-        ModelResolver domainModelResolver = definitionsDocumentProcessor.getSCADefinitionsResolver();
+        documentProcessors.getProcessor(Composite.class);
+        documentProcessors.addArtifactProcessor(new CompositeDocumentProcessor(staxProcessor, validatingInputFactory, policyDefinitions));
 
         // Create Model Resolver extension point
         ModelResolverExtensionPoint modelResolvers = registry.getExtensionPoint(ModelResolverExtensionPoint.class);
@@ -259,9 +243,6 @@
         PackageProcessor packageProcessor =
             new ExtensiblePackageProcessor(registry.getExtensionPoint(PackageProcessorExtensionPoint.class), describer);
 
-        // Get the model factory extension point
-        ModelFactoryExtensionPoint modelFactories = registry.getExtensionPoint(ModelFactoryExtensionPoint.class);
-
         // Create contribution listener
         ExtensibleContributionListener contributionListener =
             new ExtensibleContributionListener(registry.getExtensionPoint(ContributionListenerExtensionPoint.class));
@@ -279,8 +260,8 @@
         // Create the contribution service
         ContributionService contributionService =
             new ContributionServiceImpl(repository, packageProcessor, documentProcessor, staxProcessor,
-                                        contributionListener, domainModelResolver, modelResolvers, modelFactories,
-                                        assemblyFactory, contributionFactory, inputFactory, scaDefinitionsSink);
+                                        contributionListener, policyDefinitionResolver, modelResolvers, modelFactories,
+                                        assemblyFactory, contributionFactory, inputFactory, policyDefinitions);
         return contributionService;
     }
 

Modified: incubator/tuscany/java/sca/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/test/extension/module/TestModuleActivator.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/test/extension/module/TestModuleActivator.java?rev=652983&r1=652982&r2=652983&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/test/extension/module/TestModuleActivator.java (original)
+++ incubator/tuscany/java/sca/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/test/extension/module/TestModuleActivator.java Fri May  2 19:52:39 2008
@@ -24,11 +24,10 @@
 import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessorExtensionPoint;
 import org.apache.tuscany.sca.core.ExtensionPointRegistry;
 import org.apache.tuscany.sca.core.ModuleActivator;
-import org.apache.tuscany.sca.host.embedded.test.extension.TestImplementationFactory;
 import org.apache.tuscany.sca.host.embedded.test.extension.DefaultTestImplementationFactory;
+import org.apache.tuscany.sca.host.embedded.test.extension.TestImplementationFactory;
 import org.apache.tuscany.sca.host.embedded.test.extension.impl.TestImplementationProcessor;
 import org.apache.tuscany.sca.host.embedded.test.extension.provider.TestImplementationProviderFactory;
-import org.apache.tuscany.sca.interfacedef.java.DefaultJavaInterfaceFactory;
 import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory;
 import org.apache.tuscany.sca.provider.ProviderFactoryExtensionPoint;
 
@@ -44,11 +43,11 @@
     public void start(ExtensionPointRegistry registry) {
 
         // Create the test  implementation factory
-        ModelFactoryExtensionPoint factories = registry.getExtensionPoint(ModelFactoryExtensionPoint.class);
-        AssemblyFactory assemblyFactory = factories.getFactory(AssemblyFactory.class);
-        JavaInterfaceFactory javaFactory = new DefaultJavaInterfaceFactory();
+        ModelFactoryExtensionPoint modelFactories = registry.getExtensionPoint(ModelFactoryExtensionPoint.class);
+        AssemblyFactory assemblyFactory = modelFactories.getFactory(AssemblyFactory.class);
+        JavaInterfaceFactory javaFactory = modelFactories.getFactory(JavaInterfaceFactory.class);
         TestImplementationFactory testFactory = new DefaultTestImplementationFactory(assemblyFactory, javaFactory);
-        factories.addFactory(testFactory);
+        modelFactories.addFactory(testFactory);
 
         // Add the test implementation extension to the StAXArtifactProcessor
         // extension point

Modified: incubator/tuscany/java/sca/modules/implementation-bpel/src/test/java/org/apache/tuscany/sca/implementation/bpel/BPELImplementationProcessorTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/implementation-bpel/src/test/java/org/apache/tuscany/sca/implementation/bpel/BPELImplementationProcessorTestCase.java?rev=652983&r1=652982&r2=652983&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/implementation-bpel/src/test/java/org/apache/tuscany/sca/implementation/bpel/BPELImplementationProcessorTestCase.java (original)
+++ incubator/tuscany/java/sca/modules/implementation-bpel/src/test/java/org/apache/tuscany/sca/implementation/bpel/BPELImplementationProcessorTestCase.java Fri May  2 19:52:39 2008
@@ -28,14 +28,11 @@
 
 import junit.framework.TestCase;
 
-import org.apache.tuscany.sca.assembly.AssemblyFactory;
-import org.apache.tuscany.sca.assembly.DefaultAssemblyFactory;
 import org.apache.tuscany.sca.assembly.xml.Constants;
-import org.apache.tuscany.sca.contribution.DefaultModelFactoryExtensionPoint;
-import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
-import org.apache.tuscany.sca.implementation.bpel.impl.BPELImplementationProcessor;
-import org.apache.tuscany.sca.interfacedef.java.DefaultJavaInterfaceFactory;
-import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory;
+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;
 
 /**
  * @version $Rev$ $Date$
@@ -58,19 +55,14 @@
             + "   <implementation.bpel/>"
             + "</component>";
 
+    private StAXArtifactProcessorExtensionPoint staxProcessors;
     private XMLInputFactory xmlFactory;
-    private ModelFactoryExtensionPoint modelFactories;
 
     @Override
     protected void setUp() throws Exception {
-        super.setUp();
+        ExtensionPointRegistry extensionPoints = new DefaultExtensionPointRegistry();
+        staxProcessors = extensionPoints.getExtensionPoint(StAXArtifactProcessorExtensionPoint.class);
         xmlFactory = XMLInputFactory.newInstance();
-        
-        modelFactories = new DefaultModelFactoryExtensionPoint();
-        AssemblyFactory assemblyFactory = new DefaultAssemblyFactory();
-        modelFactories.addFactory(assemblyFactory);
-        JavaInterfaceFactory javaFactory = new DefaultJavaInterfaceFactory();
-        modelFactories.addFactory(javaFactory);
     }
 
     /**
@@ -80,7 +72,7 @@
     public void testLoadValidComposite() throws Exception {
         XMLStreamReader reader = xmlFactory.createXMLStreamReader(new StringReader(COMPOSITE));
         
-        BPELImplementationProcessor bpelProcessor = new BPELImplementationProcessor(modelFactories);
+        StAXArtifactProcessor<BPELImplementation> bpelProcessor = staxProcessors.getProcessor(BPELImplementation.class);
         
         while(true) {
             int event = reader.next();
@@ -102,7 +94,7 @@
     public void testLoadInvalidComposite() throws Exception {
         XMLStreamReader reader = xmlFactory.createXMLStreamReader(new StringReader(COMPOSITE_INVALID));
 
-        BPELImplementationProcessor bpelProcessor = new BPELImplementationProcessor(modelFactories);
+        StAXArtifactProcessor<BPELImplementation> bpelProcessor = staxProcessors.getProcessor(BPELImplementation.class);
         
         while(true) {
             int event = reader.next();

Modified: incubator/tuscany/java/sca/modules/implementation-ejb-xml/src/test/java/org/apache/tuscany/sca/implementation/ejb/xml/ReadTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/implementation-ejb-xml/src/test/java/org/apache/tuscany/sca/implementation/ejb/xml/ReadTestCase.java?rev=652983&r1=652982&r2=652983&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/implementation-ejb-xml/src/test/java/org/apache/tuscany/sca/implementation/ejb/xml/ReadTestCase.java (original)
+++ incubator/tuscany/java/sca/modules/implementation-ejb-xml/src/test/java/org/apache/tuscany/sca/implementation/ejb/xml/ReadTestCase.java Fri May  2 19:52:39 2008
@@ -39,6 +39,8 @@
 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.core.DefaultExtensionPointRegistry;
 import org.apache.tuscany.sca.implementation.ejb.EJBImplementation;
 import org.apache.tuscany.sca.implementation.ejb.EJBImplementationFactory;
 import org.apache.tuscany.sca.implementation.ejb.impl.EJBImplementationFactoryImpl;
@@ -65,6 +67,7 @@
 
     @Override
     public void setUp() throws Exception {
+        DefaultExtensionPointRegistry extensionPoints = new DefaultExtensionPointRegistry();
         ModelFactoryExtensionPoint factories = new DefaultModelFactoryExtensionPoint();
         assemblyFactory = new DefaultAssemblyFactory();
         factories.addFactory(assemblyFactory);
@@ -74,7 +77,7 @@
         factories.addFactory(policyFactory);
         mapper = new InterfaceContractMapperImpl();
         inputFactory = XMLInputFactory.newInstance();
-        staxProcessors = new DefaultStAXArtifactProcessorExtensionPoint(new DefaultModelFactoryExtensionPoint());
+        staxProcessors = new DefaultStAXArtifactProcessorExtensionPoint(extensionPoints);
         staxProcessor = new ExtensibleStAXArtifactProcessor(staxProcessors, XMLInputFactory.newInstance(), XMLOutputFactory.newInstance());
         
         EJBImplementationFactory nodeFactory = new EJBImplementationFactoryImpl();
@@ -89,7 +92,7 @@
     }
 
     public void testReadComposite() throws Exception {
-        CompositeProcessor compositeProcessor = new CompositeProcessor(new DefaultContributionFactory(), assemblyFactory, policyFactory, staxProcessor);
+        StAXArtifactProcessor<Composite> compositeProcessor = staxProcessors.getProcessor(Composite.class);
         InputStream is = getClass().getResourceAsStream("TestEJB.composite");
         XMLStreamReader reader = inputFactory.createXMLStreamReader(is);
         Composite composite = compositeProcessor.read(reader);

Modified: incubator/tuscany/java/sca/modules/implementation-ejb-xml/src/test/java/org/apache/tuscany/sca/implementation/ejb/xml/WriteTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/implementation-ejb-xml/src/test/java/org/apache/tuscany/sca/implementation/ejb/xml/WriteTestCase.java?rev=652983&r1=652982&r2=652983&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/implementation-ejb-xml/src/test/java/org/apache/tuscany/sca/implementation/ejb/xml/WriteTestCase.java (original)
+++ incubator/tuscany/java/sca/modules/implementation-ejb-xml/src/test/java/org/apache/tuscany/sca/implementation/ejb/xml/WriteTestCase.java Fri May  2 19:52:39 2008
@@ -38,6 +38,7 @@
 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.core.DefaultExtensionPointRegistry;
 import org.apache.tuscany.sca.implementation.ejb.EJBImplementationFactory;
 import org.apache.tuscany.sca.implementation.ejb.impl.EJBImplementationFactoryImpl;
 import org.apache.tuscany.sca.policy.DefaultPolicyFactory;
@@ -57,22 +58,19 @@
 
     @Override
     public void setUp() throws Exception {
+        DefaultExtensionPointRegistry extensionPoints = new DefaultExtensionPointRegistry();
         ModelFactoryExtensionPoint factories = new DefaultModelFactoryExtensionPoint();
         factory = new DefaultAssemblyFactory();
         factories.addFactory(factory);
         policyFactory = new DefaultPolicyFactory();
         factories.addFactory(policyFactory);
         
-        staxProcessors = new DefaultStAXArtifactProcessorExtensionPoint(new DefaultModelFactoryExtensionPoint());
+        staxProcessors = new DefaultStAXArtifactProcessorExtensionPoint(extensionPoints);
         staxProcessor = new ExtensibleStAXArtifactProcessor(staxProcessors, XMLInputFactory.newInstance(), XMLOutputFactory.newInstance());
         
         EJBImplementationFactory nodeFactory = new EJBImplementationFactoryImpl();
         factories.addFactory(nodeFactory);
         
-        staxProcessors.addArtifactProcessor(new CompositeProcessor(new DefaultContributionFactory(), factory, policyFactory, staxProcessor));
-        staxProcessors.addArtifactProcessor(new ComponentTypeProcessor(factory, policyFactory, staxProcessor));
-        staxProcessors.addArtifactProcessor(new ConstrainingTypeProcessor(factory, policyFactory, staxProcessor));
-
         EJBImplementationProcessor ejbProcessor = new EJBImplementationProcessor(factories);
         staxProcessors.addArtifactProcessor(ejbProcessor);
 

Modified: incubator/tuscany/java/sca/modules/implementation-java-xml/src/test/java/org/apache/tuscany/sca/implementation/java/xml/ReadTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/implementation-java-xml/src/test/java/org/apache/tuscany/sca/implementation/java/xml/ReadTestCase.java?rev=652983&r1=652982&r2=652983&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/implementation-java-xml/src/test/java/org/apache/tuscany/sca/implementation/java/xml/ReadTestCase.java (original)
+++ incubator/tuscany/java/sca/modules/implementation-java-xml/src/test/java/org/apache/tuscany/sca/implementation/java/xml/ReadTestCase.java Fri May  2 19:52:39 2008
@@ -24,7 +24,6 @@
 import java.net.URL;
 
 import javax.xml.stream.XMLInputFactory;
-import javax.xml.stream.XMLOutputFactory;
 import javax.xml.stream.XMLStreamReader;
 
 import junit.framework.TestCase;
@@ -32,32 +31,25 @@
 import org.apache.tuscany.sca.assembly.AssemblyFactory;
 import org.apache.tuscany.sca.assembly.Component;
 import org.apache.tuscany.sca.assembly.Composite;
-import org.apache.tuscany.sca.assembly.DefaultAssemblyFactory;
 import org.apache.tuscany.sca.assembly.OperationsConfigurator;
 import org.apache.tuscany.sca.assembly.SCABindingFactory;
+import org.apache.tuscany.sca.assembly.builder.CompositeBuilder;
 import org.apache.tuscany.sca.assembly.builder.impl.CompositeBuilderImpl;
-import org.apache.tuscany.sca.assembly.xml.CompositeProcessor;
-import org.apache.tuscany.sca.binding.sca.impl.SCABindingFactoryImpl;
-import org.apache.tuscany.sca.contribution.DefaultContributionFactory;
-import org.apache.tuscany.sca.contribution.DefaultModelFactoryExtensionPoint;
 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.processor.URLArtifactProcessor;
+import org.apache.tuscany.sca.contribution.processor.URLArtifactProcessorExtensionPoint;
 import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
+import org.apache.tuscany.sca.core.DefaultExtensionPointRegistry;
 import org.apache.tuscany.sca.definitions.SCADefinitions;
-import org.apache.tuscany.sca.definitions.xml.SCADefinitionsDocumentProcessor;
-import org.apache.tuscany.sca.implementation.java.DefaultJavaImplementationFactory;
-import org.apache.tuscany.sca.implementation.java.JavaImplementationFactory;
 import org.apache.tuscany.sca.interfacedef.InterfaceContractMapper;
 import org.apache.tuscany.sca.interfacedef.impl.InterfaceContractMapperImpl;
-import org.apache.tuscany.sca.policy.DefaultIntentAttachPointTypeFactory;
-import org.apache.tuscany.sca.policy.DefaultPolicyFactory;
 import org.apache.tuscany.sca.policy.Intent;
 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.PolicySetAttachPoint;
-import org.apache.tuscany.sca.policy.xml.WSPolicyProcessor;
 
 /**
  * Test reading Java implementations.
@@ -67,82 +59,54 @@
 public class ReadTestCase extends TestCase {
 
     private XMLInputFactory inputFactory;
-    private DefaultStAXArtifactProcessorExtensionPoint staxProcessors;
-    private ExtensibleStAXArtifactProcessor staxProcessor;
-    private AssemblyFactory assemblyFactory;
-    private SCABindingFactory scaBindingFactory;
-    private PolicyFactory policyFactory;
-    private InterfaceContractMapper mapper;
-    private SCADefinitionsDocumentProcessor scaDefnDocProcessor;
-    private IntentAttachPointTypeFactory  intentAttachPointTypeFactory;
+    private StAXArtifactProcessor<Object> staxProcessor;
+    private URLArtifactProcessor<SCADefinitions> policyDefinitionsProcessor;
+    private CompositeBuilder compositeBuilder;
     
     @Override
     public void setUp() throws Exception {
-        ModelFactoryExtensionPoint modelFactories = new DefaultModelFactoryExtensionPoint();
-        assemblyFactory = new DefaultAssemblyFactory();
-        modelFactories.addFactory(assemblyFactory);
-        scaBindingFactory = new SCABindingFactoryImpl();
-        policyFactory = new DefaultPolicyFactory();
-        modelFactories.addFactory(policyFactory);
-        mapper = new InterfaceContractMapperImpl();
+        DefaultExtensionPointRegistry extensionPoints = new DefaultExtensionPointRegistry();
         inputFactory = XMLInputFactory.newInstance();
-        staxProcessors = new DefaultStAXArtifactProcessorExtensionPoint(modelFactories);
-        staxProcessors.addArtifactProcessor(new WSPolicyProcessor());
-        staxProcessor = new ExtensibleStAXArtifactProcessor(staxProcessors, XMLInputFactory.newInstance(), XMLOutputFactory.newInstance());
-        intentAttachPointTypeFactory = new DefaultIntentAttachPointTypeFactory();
-        
-        JavaImplementationFactory javaImplementationFactory = new DefaultJavaImplementationFactory();
-        modelFactories.addFactory(javaImplementationFactory);
-        
-        CompositeProcessor compositeProcessor = new CompositeProcessor(new DefaultContributionFactory(), assemblyFactory, policyFactory, staxProcessor);
-        staxProcessors.addArtifactProcessor(compositeProcessor);
+        StAXArtifactProcessorExtensionPoint staxProcessors = extensionPoints.getExtensionPoint(StAXArtifactProcessorExtensionPoint.class);
+        staxProcessor = new ExtensibleStAXArtifactProcessor(staxProcessors, inputFactory, null);
 
-        JavaImplementationProcessor javaProcessor = new JavaImplementationProcessor(modelFactories);
-        staxProcessors.addArtifactProcessor(javaProcessor);  
+        ModelFactoryExtensionPoint modelFactories = extensionPoints.getExtensionPoint(ModelFactoryExtensionPoint.class);
+        AssemblyFactory assemblyFactory = modelFactories.getFactory(AssemblyFactory.class);
+        SCABindingFactory scaBindingFactory = modelFactories.getFactory(SCABindingFactory.class);
+        InterfaceContractMapper mapper = new InterfaceContractMapperImpl();
+        IntentAttachPointTypeFactory attachPointTypeFactory = modelFactories.getFactory(IntentAttachPointTypeFactory.class);
+        compositeBuilder = new CompositeBuilderImpl(assemblyFactory, scaBindingFactory, attachPointTypeFactory, mapper, null);
         
-        scaDefnDocProcessor = new SCADefinitionsDocumentProcessor(staxProcessors, staxProcessor, inputFactory, policyFactory);
-    }
-
-    @Override
-    public void tearDown() throws Exception {
-        inputFactory = null;
-        staxProcessors = null;
-        policyFactory = null;
-        assemblyFactory = null;
-        mapper = null;
+        URLArtifactProcessorExtensionPoint documentProcessors = extensionPoints.getExtensionPoint(URLArtifactProcessorExtensionPoint.class); 
+        policyDefinitionsProcessor = documentProcessors.getProcessor(SCADefinitions.class);
     }
 
     public void testReadComposite() throws Exception {
-        CompositeProcessor compositeProcessor = new CompositeProcessor(new DefaultContributionFactory(), assemblyFactory, policyFactory, staxProcessor);
         InputStream is = getClass().getResourceAsStream("Calculator.composite");
         XMLStreamReader reader = inputFactory.createXMLStreamReader(is);
-        Composite composite = compositeProcessor.read(reader);
+        Composite composite = (Composite)staxProcessor.read(reader);
         assertNotNull(composite);
 
-        CompositeBuilderImpl compositeUtil = new CompositeBuilderImpl(assemblyFactory, scaBindingFactory, intentAttachPointTypeFactory, mapper, null);
-        compositeUtil.build(composite);
+        compositeBuilder.build(composite);
 
     }
 
-    public void stestPolicyIntents() throws Exception {
+    public void fixmeTestPolicyIntents() throws Exception {
         ModelResolver resolver = new TestModelResolver(getClass().getClassLoader());
         
         URL url = getClass().getResource("definitions.xml");
         URI uri = URI.create("definitions.xml");
-        scaDefnDocProcessor.setDomainModelResolver(resolver);
-        SCADefinitions scaDefns = scaDefnDocProcessor.read(null, uri, url);
+        SCADefinitions scaDefns = policyDefinitionsProcessor.read(null, uri, url);
                 
-        CompositeProcessor compositeProcessor = new CompositeProcessor(new DefaultContributionFactory(), assemblyFactory, policyFactory, staxProcessor);
         InputStream is = getClass().getResourceAsStream("Calculator.composite");
         XMLStreamReader reader = inputFactory.createXMLStreamReader(is);
-        Composite composite = compositeProcessor.read(reader);
+        Composite composite = (Composite)staxProcessor.read(reader);
         assertNotNull(composite);
         
         staxProcessor.resolve(scaDefns, resolver);
         staxProcessor.resolve(composite, resolver);
 
-        CompositeBuilderImpl compositeUtil = new CompositeBuilderImpl(assemblyFactory, scaBindingFactory, intentAttachPointTypeFactory, mapper, null);
-        compositeUtil.build(composite);
+        compositeBuilder.build(composite);
         
         //intents are computed and aggregate intents from ancestor elements
         assertEquals(((PolicySetAttachPoint)composite.getComponents().get(0)).getRequiredIntents().size(), 3);
@@ -189,8 +153,6 @@
                 fail();
             }
         }
-        
-        //new PrintUtil(System.out).print(composite);
     }
     
     public void testPolicySets() throws Exception {
@@ -198,26 +160,23 @@
         
         URL url = getClass().getResource("definitions_with_policysets.xml");
         URI uri = URI.create("definitions_with_policysets.xml");
-        scaDefnDocProcessor.setDomainModelResolver(resolver);
-        SCADefinitions scaDefns = scaDefnDocProcessor.read(null, uri, url);
+        SCADefinitions policyDefinitions = policyDefinitionsProcessor.read(null, uri, url);
                 
-        CompositeProcessor compositeProcessor = new CompositeProcessor(new DefaultContributionFactory(), assemblyFactory, policyFactory, staxProcessor);
         InputStream is = getClass().getResourceAsStream("Calculator.composite");
         XMLStreamReader reader = inputFactory.createXMLStreamReader(is);
-        Composite composite = compositeProcessor.read(reader);
+        Composite composite = (Composite)staxProcessor.read(reader);
         assertNotNull(composite);
         
         for ( Component component : composite.getComponents() ) {
-            for ( PolicySet policySet : scaDefns.getPolicySets() ) {
+            for ( PolicySet policySet : policyDefinitions.getPolicySets() ) {
                 component.getApplicablePolicySets().add(policySet);
             }
         }
         
-        staxProcessor.resolve(scaDefns, resolver);
+        staxProcessor.resolve(policyDefinitions, resolver);
         staxProcessor.resolve(composite, resolver);
 
-        CompositeBuilderImpl compositeUtil = new CompositeBuilderImpl(assemblyFactory, scaBindingFactory, intentAttachPointTypeFactory, mapper, null);
-        compositeUtil.build(composite);
+        compositeBuilder.build(composite);
         
         //test for determination of policysets for implementation
         assertEquals(((PolicySetAttachPoint)composite.getComponents().get(0)).getPolicySets().size(), 1);

Modified: incubator/tuscany/java/sca/modules/implementation-java-xml/src/test/java/org/apache/tuscany/sca/implementation/java/xml/WriteTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/implementation-java-xml/src/test/java/org/apache/tuscany/sca/implementation/java/xml/WriteTestCase.java?rev=652983&r1=652982&r2=652983&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/implementation-java-xml/src/test/java/org/apache/tuscany/sca/implementation/java/xml/WriteTestCase.java (original)
+++ incubator/tuscany/java/sca/modules/implementation-java-xml/src/test/java/org/apache/tuscany/sca/implementation/java/xml/WriteTestCase.java Fri May  2 19:52:39 2008
@@ -27,20 +27,11 @@
 
 import junit.framework.TestCase;
 
-import org.apache.tuscany.sca.assembly.AssemblyFactory;
 import org.apache.tuscany.sca.assembly.Composite;
-import org.apache.tuscany.sca.assembly.DefaultAssemblyFactory;
-import org.apache.tuscany.sca.assembly.xml.ComponentTypeProcessor;
-import org.apache.tuscany.sca.assembly.xml.CompositeProcessor;
-import org.apache.tuscany.sca.assembly.xml.ConstrainingTypeProcessor;
-import org.apache.tuscany.sca.contribution.DefaultModelFactoryExtensionPoint;
-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.implementation.java.DefaultJavaImplementationFactory;
-import org.apache.tuscany.sca.implementation.java.JavaImplementationFactory;
-import org.apache.tuscany.sca.policy.DefaultPolicyFactory;
-import org.apache.tuscany.sca.policy.PolicyFactory;
+import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
+import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessorExtensionPoint;
+import org.apache.tuscany.sca.core.DefaultExtensionPointRegistry;
 
 /**
  * Test writing Java implementations.
@@ -49,38 +40,25 @@
  */
 public class WriteTestCase extends TestCase {
 
-    private DefaultStAXArtifactProcessorExtensionPoint staxProcessors;
-    private ExtensibleStAXArtifactProcessor staxProcessor;
-    private AssemblyFactory factory;
-    private PolicyFactory policyFactory;
+    private StAXArtifactProcessor<Object> staxProcessor;
+    private XMLInputFactory inputFactory;
+    private XMLOutputFactory outputFactory;
     
     @Override
     public void setUp() throws Exception {
-        ModelFactoryExtensionPoint modelFactories = new DefaultModelFactoryExtensionPoint();
-        factory = new DefaultAssemblyFactory();
-        modelFactories.addFactory(factory);
-        policyFactory = new DefaultPolicyFactory();
-        modelFactories.addFactory(policyFactory);
-        staxProcessors = new DefaultStAXArtifactProcessorExtensionPoint(modelFactories);
-        staxProcessor = new ExtensibleStAXArtifactProcessor(staxProcessors, XMLInputFactory.newInstance(), XMLOutputFactory.newInstance());
-        
-        JavaImplementationFactory javaImplementationFactory = new DefaultJavaImplementationFactory();
-        modelFactories.addFactory(javaImplementationFactory);
-
-        staxProcessors.addArtifactProcessor(new CompositeProcessor(null, factory, policyFactory, staxProcessor));
-        staxProcessors.addArtifactProcessor(new ComponentTypeProcessor(factory, policyFactory, staxProcessor));
-        staxProcessors.addArtifactProcessor(new ConstrainingTypeProcessor(factory, policyFactory, staxProcessor));
-
-        JavaImplementationProcessor javaProcessor = new JavaImplementationProcessor(modelFactories);
-        staxProcessors.addArtifactProcessor(javaProcessor);
+        DefaultExtensionPointRegistry extensionPoints = new DefaultExtensionPointRegistry();
+        inputFactory = XMLInputFactory.newInstance();
+        outputFactory = XMLOutputFactory.newInstance();
+        StAXArtifactProcessorExtensionPoint staxProcessors = extensionPoints.getExtensionPoint(StAXArtifactProcessorExtensionPoint.class);
+        staxProcessor = new ExtensibleStAXArtifactProcessor(staxProcessors, inputFactory, outputFactory);
     }
 
     public void testReadWriteComposite() throws Exception {
         InputStream is = getClass().getResourceAsStream("Calculator.composite");
-        Composite composite = staxProcessor.read(is, Composite.class);
+        Composite composite = (Composite)staxProcessor.read(inputFactory.createXMLStreamReader(is));
         assertNotNull(composite);
         ByteArrayOutputStream bos = new ByteArrayOutputStream();
-        staxProcessor.write(composite, bos);
+        staxProcessor.write(composite, outputFactory.createXMLStreamWriter(bos));
     }
 
 }

Modified: incubator/tuscany/java/sca/modules/implementation-node-xml/src/test/java/org/apache/tuscany/sca/implementation/node/xml/ReadTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/implementation-node-xml/src/test/java/org/apache/tuscany/sca/implementation/node/xml/ReadTestCase.java?rev=652983&r1=652982&r2=652983&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/implementation-node-xml/src/test/java/org/apache/tuscany/sca/implementation/node/xml/ReadTestCase.java (original)
+++ incubator/tuscany/java/sca/modules/implementation-node-xml/src/test/java/org/apache/tuscany/sca/implementation/node/xml/ReadTestCase.java Fri May  2 19:52:39 2008
@@ -40,6 +40,8 @@
 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.core.DefaultExtensionPointRegistry;
 import org.apache.tuscany.sca.implementation.node.NodeImplementationFactory;
 import org.apache.tuscany.sca.implementation.node.impl.NodeImplementationFactoryImpl;
 import org.apache.tuscany.sca.interfacedef.InterfaceContractMapper;
@@ -65,6 +67,7 @@
 
     @Override
     public void setUp() throws Exception {
+        DefaultExtensionPointRegistry extensionPoints = new DefaultExtensionPointRegistry();
         ModelFactoryExtensionPoint factories = new DefaultModelFactoryExtensionPoint();
         ContributionFactory contributionFactory = new DefaultContributionFactory();
         factories.addFactory(contributionFactory);
@@ -76,7 +79,7 @@
         factories.addFactory(policyFactory);
         mapper = new InterfaceContractMapperImpl();
         inputFactory = XMLInputFactory.newInstance();
-        staxProcessors = new DefaultStAXArtifactProcessorExtensionPoint(new DefaultModelFactoryExtensionPoint());
+        staxProcessors = new DefaultStAXArtifactProcessorExtensionPoint(extensionPoints);
         staxProcessor = new ExtensibleStAXArtifactProcessor(staxProcessors, XMLInputFactory.newInstance(), XMLOutputFactory.newInstance());
         
         NodeImplementationFactory nodeFactory = new NodeImplementationFactoryImpl();
@@ -93,7 +96,7 @@
     }
 
     public void testReadComposite() throws Exception {
-        CompositeProcessor compositeProcessor = new CompositeProcessor(new DefaultContributionFactory(), assemblyFactory, policyFactory, staxProcessor);
+        StAXArtifactProcessor<Composite> compositeProcessor = staxProcessors.getProcessor(Composite.class);
         InputStream is = getClass().getResourceAsStream("TestNode.composite");
         XMLStreamReader reader = inputFactory.createXMLStreamReader(is);
         Composite composite = compositeProcessor.read(reader);

Modified: incubator/tuscany/java/sca/modules/implementation-node-xml/src/test/java/org/apache/tuscany/sca/implementation/node/xml/WriteTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/implementation-node-xml/src/test/java/org/apache/tuscany/sca/implementation/node/xml/WriteTestCase.java?rev=652983&r1=652982&r2=652983&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/implementation-node-xml/src/test/java/org/apache/tuscany/sca/implementation/node/xml/WriteTestCase.java (original)
+++ incubator/tuscany/java/sca/modules/implementation-node-xml/src/test/java/org/apache/tuscany/sca/implementation/node/xml/WriteTestCase.java Fri May  2 19:52:39 2008
@@ -38,6 +38,7 @@
 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.core.DefaultExtensionPointRegistry;
 import org.apache.tuscany.sca.implementation.node.NodeImplementationFactory;
 import org.apache.tuscany.sca.implementation.node.impl.NodeImplementationFactoryImpl;
 import org.apache.tuscany.sca.policy.DefaultPolicyFactory;
@@ -57,22 +58,19 @@
 
     @Override
     public void setUp() throws Exception {
+        DefaultExtensionPointRegistry extensionPoints = new DefaultExtensionPointRegistry();
         ModelFactoryExtensionPoint factories = new DefaultModelFactoryExtensionPoint();
         factory = new DefaultAssemblyFactory();
         factories.addFactory(factory);
         policyFactory = new DefaultPolicyFactory();
         factories.addFactory(policyFactory);
         
-        staxProcessors = new DefaultStAXArtifactProcessorExtensionPoint(new DefaultModelFactoryExtensionPoint());
+        staxProcessors = new DefaultStAXArtifactProcessorExtensionPoint(extensionPoints);
         staxProcessor = new ExtensibleStAXArtifactProcessor(staxProcessors, XMLInputFactory.newInstance(), XMLOutputFactory.newInstance());
         
         NodeImplementationFactory nodeFactory = new NodeImplementationFactoryImpl();
         factories.addFactory(nodeFactory);
         
-        staxProcessors.addArtifactProcessor(new CompositeProcessor(new DefaultContributionFactory(), factory, policyFactory, staxProcessor));
-        staxProcessors.addArtifactProcessor(new ComponentTypeProcessor(factory, policyFactory, staxProcessor));
-        staxProcessors.addArtifactProcessor(new ConstrainingTypeProcessor(factory, policyFactory, staxProcessor));
-
         NodeImplementationProcessor nodeProcessor = new NodeImplementationProcessor(factories);
         staxProcessors.addArtifactProcessor(nodeProcessor);
 

Modified: incubator/tuscany/java/sca/modules/implementation-osgi/src/test/java/org/apache/tuscany/sca/implementation/osgi/xml/OSGiReadImplTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/implementation-osgi/src/test/java/org/apache/tuscany/sca/implementation/osgi/xml/OSGiReadImplTestCase.java?rev=652983&r1=652982&r2=652983&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/implementation-osgi/src/test/java/org/apache/tuscany/sca/implementation/osgi/xml/OSGiReadImplTestCase.java (original)
+++ incubator/tuscany/java/sca/modules/implementation-osgi/src/test/java/org/apache/tuscany/sca/implementation/osgi/xml/OSGiReadImplTestCase.java Fri May  2 19:52:39 2008
@@ -42,7 +42,9 @@
 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.resolver.ModelResolver;
+import org.apache.tuscany.sca.core.DefaultExtensionPointRegistry;
 import org.apache.tuscany.sca.implementation.osgi.test.OSGiTestBundles;
 import org.apache.tuscany.sca.implementation.osgi.test.OSGiTestImpl;
 import org.apache.tuscany.sca.implementation.osgi.test.OSGiTestInterface;
@@ -71,6 +73,7 @@
 
     @Override
     public void setUp() throws Exception {
+        DefaultExtensionPointRegistry extensionPoints = new DefaultExtensionPointRegistry();
         ModelFactoryExtensionPoint modelFactories = new DefaultModelFactoryExtensionPoint();
         assemblyFactory = new DefaultAssemblyFactory();
         modelFactories.addFactory(assemblyFactory);
@@ -78,7 +81,7 @@
         policyFactory = new DefaultPolicyFactory();
         mapper = new InterfaceContractMapperImpl();
         inputFactory = XMLInputFactory.newInstance();
-        staxProcessors = new DefaultStAXArtifactProcessorExtensionPoint(new DefaultModelFactoryExtensionPoint());
+        staxProcessors = new DefaultStAXArtifactProcessorExtensionPoint(extensionPoints);
         staxProcessor = new ExtensibleStAXArtifactProcessor(staxProcessors, XMLInputFactory.newInstance(), XMLOutputFactory.newInstance());
         JavaInterfaceFactory javaInterfaceFactory = new DefaultJavaInterfaceFactory();
         modelFactories.addFactory(javaInterfaceFactory);
@@ -100,7 +103,7 @@
     }
 
     public void testReadComposite() throws Exception {
-        CompositeProcessor compositeProcessor = new CompositeProcessor(new DefaultContributionFactory(), assemblyFactory, policyFactory, staxProcessor);
+        StAXArtifactProcessor<Composite> compositeProcessor = staxProcessors.getProcessor(Composite.class);
         InputStream is = getClass().getClassLoader().getResourceAsStream("osgitest.composite");
         XMLStreamReader reader = inputFactory.createXMLStreamReader(is);
         Composite composite = compositeProcessor.read(reader);
@@ -112,20 +115,20 @@
     }
 
     public void testReadAndResolveComposite() throws Exception {
-        CompositeProcessor compositeProcessor = new CompositeProcessor(new DefaultContributionFactory(), assemblyFactory, policyFactory, staxProcessor);
+        StAXArtifactProcessor<Composite> compositeProcessor = staxProcessors.getProcessor(Composite.class);
         InputStream is = getClass().getClassLoader().getResourceAsStream("osgitest.composite");
         XMLStreamReader reader = inputFactory.createXMLStreamReader(is);
         Composite composite = compositeProcessor.read(reader);
         assertNotNull(composite);
         
-        ComponentTypeProcessor ctProcessor = new ComponentTypeProcessor(assemblyFactory, policyFactory, staxProcessor);
+        StAXArtifactProcessor<ComponentType> componentTypeProcessor = staxProcessors.getProcessor(ComponentType.class);
         is = getClass().getClassLoader().getResourceAsStream("OSGiTestService.componentType");
         reader = inputFactory.createXMLStreamReader(is);
-        ComponentType ct = ctProcessor.read(reader);
+        ComponentType componentType = componentTypeProcessor.read(reader);
 
         ModelResolver resolver = new TestModelResolver(getClass().getClassLoader());
-        ctProcessor.resolve(ct, resolver);
-        resolver.addModel(ct);
+        componentTypeProcessor.resolve(componentType, resolver);
+        resolver.addModel(componentType);
         
         compositeProcessor.resolve(composite, resolver);
 

Modified: incubator/tuscany/java/sca/modules/interface-java-xml/src/test/java/org/apache/tuscany/sca/interfacedef/java/xml/ReadTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/interface-java-xml/src/test/java/org/apache/tuscany/sca/interfacedef/java/xml/ReadTestCase.java?rev=652983&r1=652982&r2=652983&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/interface-java-xml/src/test/java/org/apache/tuscany/sca/interfacedef/java/xml/ReadTestCase.java (original)
+++ incubator/tuscany/java/sca/modules/interface-java-xml/src/test/java/org/apache/tuscany/sca/interfacedef/java/xml/ReadTestCase.java Fri May  2 19:52:39 2008
@@ -22,7 +22,6 @@
 import java.io.InputStream;
 
 import javax.xml.stream.XMLInputFactory;
-import javax.xml.stream.XMLOutputFactory;
 import javax.xml.stream.XMLStreamReader;
 
 import junit.framework.TestCase;
@@ -31,25 +30,18 @@
 import org.apache.tuscany.sca.assembly.ComponentType;
 import org.apache.tuscany.sca.assembly.Composite;
 import org.apache.tuscany.sca.assembly.ConstrainingType;
-import org.apache.tuscany.sca.assembly.DefaultAssemblyFactory;
 import org.apache.tuscany.sca.assembly.SCABindingFactory;
+import org.apache.tuscany.sca.assembly.builder.CompositeBuilder;
 import org.apache.tuscany.sca.assembly.builder.impl.CompositeBuilderImpl;
-import org.apache.tuscany.sca.assembly.xml.ComponentTypeProcessor;
-import org.apache.tuscany.sca.assembly.xml.CompositeProcessor;
-import org.apache.tuscany.sca.assembly.xml.ConstrainingTypeProcessor;
-import org.apache.tuscany.sca.binding.sca.impl.SCABindingFactoryImpl;
-import org.apache.tuscany.sca.contribution.DefaultContributionFactory;
-import org.apache.tuscany.sca.contribution.DefaultModelFactoryExtensionPoint;
 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.core.DefaultExtensionPointRegistry;
 import org.apache.tuscany.sca.interfacedef.InterfaceContractMapper;
 import org.apache.tuscany.sca.interfacedef.impl.InterfaceContractMapperImpl;
-import org.apache.tuscany.sca.interfacedef.java.DefaultJavaInterfaceFactory;
-import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory;
-import org.apache.tuscany.sca.policy.DefaultIntentAttachPointTypeFactory;
-import org.apache.tuscany.sca.policy.DefaultPolicyFactory;
-import org.apache.tuscany.sca.policy.PolicyFactory;
+import org.apache.tuscany.sca.policy.IntentAttachPointTypeFactory;
 
 /**
  * Test reading Java interfaces.
@@ -59,70 +51,45 @@
 public class ReadTestCase extends TestCase {
 
     private XMLInputFactory inputFactory;
-    private DefaultStAXArtifactProcessorExtensionPoint staxProcessors;
-    private ExtensibleStAXArtifactProcessor staxProcessor;
-    private AssemblyFactory assemblyFactory;
-    private SCABindingFactory scaBindingFactory;
-    private PolicyFactory policyFactory;
-    private InterfaceContractMapper mapper;
-    private JavaInterfaceFactory javaFactory;
+    private StAXArtifactProcessor<Object> staxProcessor;
+    private CompositeBuilder compositeBuilder;
 
     @Override
     public void setUp() throws Exception {
-        ModelFactoryExtensionPoint modelFactories = new DefaultModelFactoryExtensionPoint();
-        assemblyFactory = new DefaultAssemblyFactory();
-        scaBindingFactory = new SCABindingFactoryImpl();
-        policyFactory = new DefaultPolicyFactory();
-        mapper = new InterfaceContractMapperImpl();
+        DefaultExtensionPointRegistry extensionPoints = new DefaultExtensionPointRegistry();
         inputFactory = XMLInputFactory.newInstance();
-        staxProcessors = new DefaultStAXArtifactProcessorExtensionPoint(modelFactories);
-        staxProcessor = new ExtensibleStAXArtifactProcessor(staxProcessors, XMLInputFactory.newInstance(), XMLOutputFactory.newInstance());
-        javaFactory = new DefaultJavaInterfaceFactory();
-        modelFactories.addFactory(javaFactory);
-
-        JavaInterfaceProcessor javaProcessor = new JavaInterfaceProcessor(modelFactories);
-        staxProcessors.addArtifactProcessor(javaProcessor);
-    }
-
-    @Override
-    public void tearDown() throws Exception {
-        inputFactory = null;
-        staxProcessors = null;
-        policyFactory = null;
-        assemblyFactory = null;
-        mapper = null;
+        StAXArtifactProcessorExtensionPoint staxProcessors = new DefaultStAXArtifactProcessorExtensionPoint(extensionPoints);
+        staxProcessor = new ExtensibleStAXArtifactProcessor(staxProcessors, inputFactory, null);
+        
+        ModelFactoryExtensionPoint modelFactories = extensionPoints.getExtensionPoint(ModelFactoryExtensionPoint.class);
+        AssemblyFactory assemblyFactory = modelFactories.getFactory(AssemblyFactory.class);
+        SCABindingFactory scaBindingFactory = modelFactories.getFactory(SCABindingFactory.class);
+        InterfaceContractMapper mapper = new InterfaceContractMapperImpl();
+        IntentAttachPointTypeFactory attachPointTypeFactory = modelFactories.getFactory(IntentAttachPointTypeFactory.class);
+        compositeBuilder = new CompositeBuilderImpl(assemblyFactory, scaBindingFactory, attachPointTypeFactory, mapper, null);
     }
 
     public void testReadComponentType() throws Exception {
-        ComponentTypeProcessor componentTypeReader = new ComponentTypeProcessor(assemblyFactory, policyFactory, staxProcessor);
         InputStream is = getClass().getResourceAsStream("CalculatorImpl.componentType");
         XMLStreamReader reader = inputFactory.createXMLStreamReader(is);
-        ComponentType componentType = componentTypeReader.read(reader);
+        ComponentType componentType = (ComponentType)staxProcessor.read(reader);
         assertNotNull(componentType);
-
-        //new PrintUtil(System.out).print(componentType);
     }
 
     public void testReadConstrainingType() throws Exception {
-        ConstrainingTypeProcessor constrainingTypeProcessor = new ConstrainingTypeProcessor(assemblyFactory, policyFactory, staxProcessor);
         InputStream is = getClass().getResourceAsStream("CalculatorComponent.constrainingType");
         XMLStreamReader reader = inputFactory.createXMLStreamReader(is);
-        ConstrainingType constrainingType = constrainingTypeProcessor.read(reader);
+        ConstrainingType constrainingType = (ConstrainingType)staxProcessor.read(reader);
         assertNotNull(constrainingType);
-
-        //new PrintUtil(System.out).print(constrainingType);
     }
 
     public void testReadComposite() throws Exception {
-        CompositeProcessor compositeProcessor = new CompositeProcessor(new DefaultContributionFactory(), assemblyFactory, policyFactory, staxProcessor);
         InputStream is = getClass().getResourceAsStream("Calculator.composite");
         XMLStreamReader reader = inputFactory.createXMLStreamReader(is);
-        Composite composite = compositeProcessor.read(reader);
+        Composite composite = (Composite)staxProcessor.read(reader);
         assertNotNull(composite);
 
-        CompositeBuilderImpl compositeUtil = new CompositeBuilderImpl(assemblyFactory, scaBindingFactory, new DefaultIntentAttachPointTypeFactory(), mapper, null);
-        compositeUtil.build(composite);
-
+        compositeBuilder.build(composite);
     }
 
 }

Modified: incubator/tuscany/java/sca/modules/interface-java-xml/src/test/java/org/apache/tuscany/sca/interfacedef/java/xml/WriteTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/interface-java-xml/src/test/java/org/apache/tuscany/sca/interfacedef/java/xml/WriteTestCase.java?rev=652983&r1=652982&r2=652983&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/interface-java-xml/src/test/java/org/apache/tuscany/sca/interfacedef/java/xml/WriteTestCase.java (original)
+++ incubator/tuscany/java/sca/modules/interface-java-xml/src/test/java/org/apache/tuscany/sca/interfacedef/java/xml/WriteTestCase.java Fri May  2 19:52:39 2008
@@ -27,23 +27,14 @@
 
 import junit.framework.TestCase;
 
-import org.apache.tuscany.sca.assembly.AssemblyFactory;
 import org.apache.tuscany.sca.assembly.ComponentType;
 import org.apache.tuscany.sca.assembly.Composite;
 import org.apache.tuscany.sca.assembly.ConstrainingType;
-import org.apache.tuscany.sca.assembly.DefaultAssemblyFactory;
-import org.apache.tuscany.sca.assembly.xml.ComponentTypeProcessor;
-import org.apache.tuscany.sca.assembly.xml.CompositeProcessor;
-import org.apache.tuscany.sca.assembly.xml.ConstrainingTypeProcessor;
-import org.apache.tuscany.sca.contribution.DefaultContributionFactory;
-import org.apache.tuscany.sca.contribution.DefaultModelFactoryExtensionPoint;
-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.interfacedef.java.DefaultJavaInterfaceFactory;
-import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory;
-import org.apache.tuscany.sca.policy.DefaultPolicyFactory;
-import org.apache.tuscany.sca.policy.PolicyFactory;
+import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
+import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessorExtensionPoint;
+import org.apache.tuscany.sca.core.DefaultExtensionPointRegistry;
 
 /**
  * Test writing Java interfaces.
@@ -52,52 +43,41 @@
  */
 public class WriteTestCase extends TestCase {
 
-    private DefaultStAXArtifactProcessorExtensionPoint staxProcessors;
-    private ExtensibleStAXArtifactProcessor staxProcessor;
-    private AssemblyFactory factory;
-    private PolicyFactory policyFactory;
-    private JavaInterfaceFactory javaFactory;
+    private XMLInputFactory inputFactory;
+    private XMLOutputFactory outputFactory;
+    private StAXArtifactProcessor<Object> staxProcessor;
 
     @Override
     public void setUp() throws Exception {
-        ModelFactoryExtensionPoint modelFactories = new DefaultModelFactoryExtensionPoint();
-        factory = new DefaultAssemblyFactory();
-        policyFactory = new DefaultPolicyFactory();
-        staxProcessors = new DefaultStAXArtifactProcessorExtensionPoint(modelFactories);
-        staxProcessor = new ExtensibleStAXArtifactProcessor(staxProcessors, XMLInputFactory.newInstance(), XMLOutputFactory.newInstance());
-        javaFactory = new DefaultJavaInterfaceFactory();
-        modelFactories.addFactory(javaFactory);
-
-        staxProcessors.addArtifactProcessor(new CompositeProcessor(new DefaultContributionFactory(), factory, policyFactory, staxProcessor));
-        staxProcessors.addArtifactProcessor(new ComponentTypeProcessor(factory, policyFactory, staxProcessor));
-        staxProcessors.addArtifactProcessor(new ConstrainingTypeProcessor(factory, policyFactory, staxProcessor));
-
-        JavaInterfaceProcessor javaProcessor = new JavaInterfaceProcessor(modelFactories);
-        staxProcessors.addArtifactProcessor(javaProcessor);
+        DefaultExtensionPointRegistry extensionPoints = new DefaultExtensionPointRegistry();
+        inputFactory = XMLInputFactory.newInstance();
+        outputFactory = XMLOutputFactory.newInstance();
+        StAXArtifactProcessorExtensionPoint staxProcessors = new DefaultStAXArtifactProcessorExtensionPoint(extensionPoints);
+        staxProcessor = new ExtensibleStAXArtifactProcessor(staxProcessors, inputFactory, outputFactory);
     }
 
     public void testReadWriteComponentType() throws Exception {
         InputStream is = getClass().getResourceAsStream("CalculatorImpl.componentType");
-        ComponentType componentType = staxProcessor.read(is, ComponentType.class);
+        ComponentType componentType = (ComponentType)staxProcessor.read(inputFactory.createXMLStreamReader(is));
         assertNotNull(componentType);
         ByteArrayOutputStream bos = new ByteArrayOutputStream();
-        staxProcessor.write(componentType, bos);
+        staxProcessor.write(componentType, outputFactory.createXMLStreamWriter(bos));
     }
 
     public void testReadWriteConstrainingType() throws Exception {
         InputStream is = getClass().getResourceAsStream("CalculatorComponent.constrainingType");
-        ConstrainingType constrainingType = staxProcessor.read(is, ConstrainingType.class);
+        ConstrainingType constrainingType = (ConstrainingType)staxProcessor.read(inputFactory.createXMLStreamReader(is));
         assertNotNull(constrainingType);
         ByteArrayOutputStream bos = new ByteArrayOutputStream();
-        staxProcessor.write(constrainingType, bos);
+        staxProcessor.write(constrainingType, outputFactory.createXMLStreamWriter(bos));
     }
 
     public void testReadWriteComposite() throws Exception {
         InputStream is = getClass().getResourceAsStream("Calculator.composite");
-        Composite composite = staxProcessor.read(is, Composite.class);
+        Composite composite = (Composite)staxProcessor.read(inputFactory.createXMLStreamReader(is));
         assertNotNull(composite);
         ByteArrayOutputStream bos = new ByteArrayOutputStream();
-        staxProcessor.write(composite, bos);
+        staxProcessor.write(composite, outputFactory.createXMLStreamWriter(bos));
     }
 
 }

Modified: incubator/tuscany/java/sca/modules/interface-wsdl-xml/src/test/java/org/apache/tuscany/sca/interfacedef/wsdl/AbstractWSDLTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/interface-wsdl-xml/src/test/java/org/apache/tuscany/sca/interfacedef/wsdl/AbstractWSDLTestCase.java?rev=652983&r1=652982&r2=652983&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/interface-wsdl-xml/src/test/java/org/apache/tuscany/sca/interfacedef/wsdl/AbstractWSDLTestCase.java (original)
+++ incubator/tuscany/java/sca/modules/interface-wsdl-xml/src/test/java/org/apache/tuscany/sca/interfacedef/wsdl/AbstractWSDLTestCase.java Fri May  2 19:52:39 2008
@@ -23,22 +23,21 @@
 
 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.DefaultModelFactoryExtensionPoint;
 import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
-import org.apache.tuscany.sca.contribution.resolver.DefaultModelResolverExtensionPoint;
+import org.apache.tuscany.sca.contribution.processor.ExtensibleURLArtifactProcessor;
+import org.apache.tuscany.sca.contribution.processor.URLArtifactProcessor;
+import org.apache.tuscany.sca.contribution.processor.URLArtifactProcessorExtensionPoint;
 import org.apache.tuscany.sca.contribution.resolver.ExtensibleModelResolver;
 import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
 import org.apache.tuscany.sca.contribution.resolver.ModelResolverExtensionPoint;
-import org.apache.tuscany.sca.interfacedef.wsdl.xml.WSDLDocumentProcessor;
-import org.apache.tuscany.sca.interfacedef.wsdl.xml.WSDLModelResolver;
-import org.apache.tuscany.sca.interfacedef.wsdl.xml.XSDModelResolver;
+import org.apache.tuscany.sca.core.DefaultExtensionPointRegistry;
+import org.apache.tuscany.sca.core.ExtensionPointRegistry;
 
 /**
  * Test case for WSDLOperation
  */
 public abstract class AbstractWSDLTestCase extends TestCase {
-    protected WSDLDocumentProcessor processor;
+    protected URLArtifactProcessor<Object> documentProcessor;
     protected ModelResolver resolver;
     protected WSDLFactory wsdlFactory;
 
@@ -47,22 +46,18 @@
      */
     @Override
     protected void setUp() throws Exception {
-        super.setUp();
-        ContributionFactory contributionFactory = new DefaultContributionFactory();
+        ExtensionPointRegistry extensionPoints = new DefaultExtensionPointRegistry();
+        ModelFactoryExtensionPoint modelFactories = extensionPoints.getExtensionPoint(ModelFactoryExtensionPoint.class);
+        wsdlFactory = modelFactories.getFactory(WSDLFactory.class);
+        
+        ContributionFactory contributionFactory = modelFactories.getFactory(ContributionFactory.class);
         Contribution contribution = contributionFactory.createContribution();
-        ModelResolverExtensionPoint modelResolvers = new DefaultModelResolverExtensionPoint();
-        ModelFactoryExtensionPoint factories = new DefaultModelFactoryExtensionPoint();
-        wsdlFactory = new DefaultWSDLFactory();
-        factories.addFactory(wsdlFactory); 
-        javax.wsdl.factory.WSDLFactory wsdl4jFactory = javax.wsdl.factory.WSDLFactory.newInstance();
-        factories.addFactory(wsdlFactory);
-        factories.addFactory(wsdl4jFactory);
-        resolver = new ExtensibleModelResolver(contribution, modelResolvers, factories, null);
+        ModelResolverExtensionPoint modelResolvers = extensionPoints.getExtensionPoint(ModelResolverExtensionPoint.class);
+        resolver = new ExtensibleModelResolver(contribution, modelResolvers, modelFactories);
         contribution.setModelResolver(resolver);
-        modelResolvers.addResolver(WSDLDefinition.class, WSDLModelResolver.class);
-        modelResolvers.addResolver(XSDefinition.class, XSDModelResolver.class);
         
-        processor = new WSDLDocumentProcessor(factories);
+        URLArtifactProcessorExtensionPoint documentProcessors = extensionPoints.getExtensionPoint(URLArtifactProcessorExtensionPoint.class);
+        documentProcessor = new ExtensibleURLArtifactProcessor(documentProcessors);
     }
 
 }

Modified: incubator/tuscany/java/sca/modules/interface-wsdl-xml/src/test/java/org/apache/tuscany/sca/interfacedef/wsdl/introspect/WSDLInterfaceIntrospectorTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/interface-wsdl-xml/src/test/java/org/apache/tuscany/sca/interfacedef/wsdl/introspect/WSDLInterfaceIntrospectorTestCase.java?rev=652983&r1=652982&r2=652983&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/interface-wsdl-xml/src/test/java/org/apache/tuscany/sca/interfacedef/wsdl/introspect/WSDLInterfaceIntrospectorTestCase.java (original)
+++ incubator/tuscany/java/sca/modules/interface-wsdl-xml/src/test/java/org/apache/tuscany/sca/interfacedef/wsdl/introspect/WSDLInterfaceIntrospectorTestCase.java Fri May  2 19:52:39 2008
@@ -53,7 +53,7 @@
         super.setUp();
 
         URL url = getClass().getResource("../xml/stockquote.wsdl");
-        definition = processor.read(null, new URI("stockquote.wsdl"), url);
+        definition = (WSDLDefinition)documentProcessor.read(null, new URI("stockquote.wsdl"), url);
         resolver.addModel(definition);
         definition = resolver.resolveModel(WSDLDefinition.class, definition);
         portType = definition.getDefinition().getPortType(PORTTYPE_NAME);

Modified: incubator/tuscany/java/sca/modules/interface-wsdl-xml/src/test/java/org/apache/tuscany/sca/interfacedef/wsdl/introspect/WSDLOperationIntrospectorTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/interface-wsdl-xml/src/test/java/org/apache/tuscany/sca/interfacedef/wsdl/introspect/WSDLOperationIntrospectorTestCase.java?rev=652983&r1=652982&r2=652983&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/interface-wsdl-xml/src/test/java/org/apache/tuscany/sca/interfacedef/wsdl/introspect/WSDLOperationIntrospectorTestCase.java (original)
+++ incubator/tuscany/java/sca/modules/interface-wsdl-xml/src/test/java/org/apache/tuscany/sca/interfacedef/wsdl/introspect/WSDLOperationIntrospectorTestCase.java Fri May  2 19:52:39 2008
@@ -47,7 +47,7 @@
     @SuppressWarnings("unchecked")
     public final void testWrappedOperation() throws Exception {
         URL url = getClass().getResource("../xml/stockquote.wsdl");
-        WSDLDefinition definition = processor.read(null, new URI("stockquote.wsdl"), url);
+        WSDLDefinition definition = (WSDLDefinition)documentProcessor.read(null, new URI("stockquote.wsdl"), url);
         resolver.addModel(definition);
         definition = resolver.resolveModel(WSDLDefinition.class, definition);
         PortType portType = definition.getDefinition().getPortType(PORTTYPE_NAME);
@@ -77,7 +77,7 @@
 
     public final void testUnwrappedOperation() throws Exception {
         URL url = getClass().getResource("../xml/unwrapped-stockquote.wsdl");
-        WSDLDefinition definition = processor.read(null, new URI("unwrapped-stockquote.wsdl"), url);
+        WSDLDefinition definition = (WSDLDefinition)documentProcessor.read(null, new URI("unwrapped-stockquote.wsdl"), url);
         resolver.addModel(definition);
         definition = resolver.resolveModel(WSDLDefinition.class, definition);
         PortType portType = definition.getDefinition().getPortType(PORTTYPE_NAME);
@@ -95,7 +95,7 @@
 
     public final void testInvalidWSDL() throws Exception {
         URL url = getClass().getResource("../xml/invalid-stockquote.wsdl");
-        WSDLDefinition definition = processor.read(null, new URI("invalid-stockquote.wsdl"), url);
+        WSDLDefinition definition = (WSDLDefinition)documentProcessor.read(null, new URI("invalid-stockquote.wsdl"), url);
         resolver.addModel(definition);
         definition = resolver.resolveModel(WSDLDefinition.class, definition);
         PortType portType = definition.getDefinition().getPortType(PORTTYPE_NAME);

Modified: incubator/tuscany/java/sca/modules/interface-wsdl-xml/src/test/java/org/apache/tuscany/sca/interfacedef/wsdl/introspect/WrapperStyleOperationTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/interface-wsdl-xml/src/test/java/org/apache/tuscany/sca/interfacedef/wsdl/introspect/WrapperStyleOperationTestCase.java?rev=652983&r1=652982&r2=652983&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/interface-wsdl-xml/src/test/java/org/apache/tuscany/sca/interfacedef/wsdl/introspect/WrapperStyleOperationTestCase.java (original)
+++ incubator/tuscany/java/sca/modules/interface-wsdl-xml/src/test/java/org/apache/tuscany/sca/interfacedef/wsdl/introspect/WrapperStyleOperationTestCase.java Fri May  2 19:52:39 2008
@@ -40,7 +40,7 @@
 
     public final void testWrappedOperation() throws Exception {
         URL url = getClass().getResource("../xml/stockquote.wsdl");
-        WSDLDefinition definition = processor.read(null, new URI("stockquote.wsdl"), url);
+        WSDLDefinition definition = (WSDLDefinition)documentProcessor.read(null, new URI("stockquote.wsdl"), url);
         resolver.addModel(definition);
         definition = resolver.resolveModel(WSDLDefinition.class, definition);
         PortType portType = definition.getDefinition().getPortType(PORTTYPE_NAME);
@@ -53,7 +53,7 @@
 
     public final void testUnwrappedOperation() throws Exception {
         URL url = getClass().getResource("../xml/unwrapped-stockquote.wsdl");
-        WSDLDefinition definition = processor.read(null, new URI("unwrapped-stockquote.wsdl"), url);
+        WSDLDefinition definition = (WSDLDefinition)documentProcessor.read(null, new URI("unwrapped-stockquote.wsdl"), url);
         resolver.addModel(definition);
         definition = resolver.resolveModel(WSDLDefinition.class, definition);
         PortType portType = definition.getDefinition().getPortType(PORTTYPE_NAME);

Modified: incubator/tuscany/java/sca/modules/interface-wsdl-xml/src/test/java/org/apache/tuscany/sca/interfacedef/wsdl/xml/ReadTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/interface-wsdl-xml/src/test/java/org/apache/tuscany/sca/interfacedef/wsdl/xml/ReadTestCase.java?rev=652983&r1=652982&r2=652983&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/interface-wsdl-xml/src/test/java/org/apache/tuscany/sca/interfacedef/wsdl/xml/ReadTestCase.java (original)
+++ incubator/tuscany/java/sca/modules/interface-wsdl-xml/src/test/java/org/apache/tuscany/sca/interfacedef/wsdl/xml/ReadTestCase.java Fri May  2 19:52:39 2008
@@ -22,7 +22,6 @@
 import java.io.InputStream;
 
 import javax.xml.stream.XMLInputFactory;
-import javax.xml.stream.XMLOutputFactory;
 import javax.xml.stream.XMLStreamReader;
 
 import junit.framework.TestCase;
@@ -31,25 +30,18 @@
 import org.apache.tuscany.sca.assembly.ComponentType;
 import org.apache.tuscany.sca.assembly.Composite;
 import org.apache.tuscany.sca.assembly.ConstrainingType;
-import org.apache.tuscany.sca.assembly.DefaultAssemblyFactory;
 import org.apache.tuscany.sca.assembly.SCABindingFactory;
+import org.apache.tuscany.sca.assembly.builder.CompositeBuilder;
 import org.apache.tuscany.sca.assembly.builder.impl.CompositeBuilderImpl;
-import org.apache.tuscany.sca.assembly.xml.ComponentTypeProcessor;
-import org.apache.tuscany.sca.assembly.xml.CompositeProcessor;
-import org.apache.tuscany.sca.assembly.xml.ConstrainingTypeProcessor;
-import org.apache.tuscany.sca.binding.sca.impl.SCABindingFactoryImpl;
-import org.apache.tuscany.sca.contribution.DefaultContributionFactory;
-import org.apache.tuscany.sca.contribution.DefaultModelFactoryExtensionPoint;
 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.core.DefaultExtensionPointRegistry;
 import org.apache.tuscany.sca.interfacedef.InterfaceContractMapper;
 import org.apache.tuscany.sca.interfacedef.impl.InterfaceContractMapperImpl;
-import org.apache.tuscany.sca.interfacedef.wsdl.DefaultWSDLFactory;
-import org.apache.tuscany.sca.interfacedef.wsdl.WSDLFactory;
-import org.apache.tuscany.sca.policy.DefaultIntentAttachPointTypeFactory;
-import org.apache.tuscany.sca.policy.DefaultPolicyFactory;
-import org.apache.tuscany.sca.policy.PolicyFactory;
+import org.apache.tuscany.sca.policy.IntentAttachPointTypeFactory;
 
 /**
  * Test reading WSDL interfaces.
@@ -59,70 +51,45 @@
 public class ReadTestCase extends TestCase {
 
     private XMLInputFactory inputFactory;
-    private DefaultStAXArtifactProcessorExtensionPoint staxProcessors;
-    private ExtensibleStAXArtifactProcessor staxProcessor;
-    private AssemblyFactory assemblyFactory;
-    private SCABindingFactory scaBindingFactory;
-    private PolicyFactory policyFactory;
-    private InterfaceContractMapper mapper;
+    private StAXArtifactProcessor<Object> staxProcessor;
+    private CompositeBuilder compositeBuilder;
 
     @Override
     public void setUp() throws Exception {
-        ModelFactoryExtensionPoint modelFactories = new DefaultModelFactoryExtensionPoint();
-        assemblyFactory = new DefaultAssemblyFactory();
-        scaBindingFactory = new SCABindingFactoryImpl();
-        policyFactory = new DefaultPolicyFactory();
-        mapper = new InterfaceContractMapperImpl();
+        DefaultExtensionPointRegistry extensionPoints = new DefaultExtensionPointRegistry();
         inputFactory = XMLInputFactory.newInstance();
-        staxProcessors = new DefaultStAXArtifactProcessorExtensionPoint(modelFactories);
-        staxProcessor = new ExtensibleStAXArtifactProcessor(staxProcessors, XMLInputFactory.newInstance(), XMLOutputFactory.newInstance());
-
-        WSDLFactory wsdlFactory = new DefaultWSDLFactory();
-        modelFactories.addFactory(wsdlFactory);
-        WSDLInterfaceProcessor wsdlProcessor = new WSDLInterfaceProcessor(modelFactories);
-        staxProcessors.addArtifactProcessor(wsdlProcessor);
-    }
-
-    @Override
-    public void tearDown() throws Exception {
-        inputFactory = null;
-        staxProcessors = null;
-        policyFactory = null;
-        assemblyFactory = null;
-        mapper = null;
+        StAXArtifactProcessorExtensionPoint staxProcessors = new DefaultStAXArtifactProcessorExtensionPoint(extensionPoints);
+        staxProcessor = new ExtensibleStAXArtifactProcessor(staxProcessors, inputFactory, null);
+        
+        ModelFactoryExtensionPoint modelFactories = extensionPoints.getExtensionPoint(ModelFactoryExtensionPoint.class);
+        AssemblyFactory assemblyFactory = modelFactories.getFactory(AssemblyFactory.class);
+        SCABindingFactory scaBindingFactory = modelFactories.getFactory(SCABindingFactory.class);
+        InterfaceContractMapper mapper = new InterfaceContractMapperImpl();
+        IntentAttachPointTypeFactory attachPointTypeFactory = modelFactories.getFactory(IntentAttachPointTypeFactory.class);
+        compositeBuilder = new CompositeBuilderImpl(assemblyFactory, scaBindingFactory, attachPointTypeFactory, mapper, null);
     }
 
     public void testReadComponentType() throws Exception {
-        ComponentTypeProcessor componentTypeProcessor = new ComponentTypeProcessor(assemblyFactory, policyFactory, staxProcessor);
         InputStream is = getClass().getResourceAsStream("CalculatorImpl.componentType");
         XMLStreamReader reader = inputFactory.createXMLStreamReader(is);
-        ComponentType componentType = componentTypeProcessor.read(reader);
+        ComponentType componentType = (ComponentType)staxProcessor.read(reader);
         assertNotNull(componentType);
-
-        //new PrintUtil(System.out).print(componentType);
     }
 
     public void testReadConstrainingType() throws Exception {
-        ConstrainingTypeProcessor constrainingTypeProcessor = new ConstrainingTypeProcessor(assemblyFactory, policyFactory, staxProcessor);
         InputStream is = getClass().getResourceAsStream("CalculatorComponent.constrainingType");
         XMLStreamReader reader = inputFactory.createXMLStreamReader(is);
-        ConstrainingType constrainingType = constrainingTypeProcessor.read(reader);
+        ConstrainingType constrainingType = (ConstrainingType)staxProcessor.read(reader);
         assertNotNull(constrainingType);
-
-        //new PrintUtil(System.out).print(constrainingType);
     }
 
     public void testReadComposite() throws Exception {
-        CompositeProcessor compositeProcessor = new CompositeProcessor(new DefaultContributionFactory(), assemblyFactory, policyFactory, staxProcessor);
         InputStream is = getClass().getResourceAsStream("Calculator.composite");
         XMLStreamReader reader = inputFactory.createXMLStreamReader(is);
-        Composite composite = compositeProcessor.read(reader);
+        Composite composite = (Composite)staxProcessor.read(reader);
         assertNotNull(composite);
 
-        CompositeBuilderImpl compositeUtil = new CompositeBuilderImpl(assemblyFactory, scaBindingFactory, new DefaultIntentAttachPointTypeFactory(), mapper, null);
-        compositeUtil.build(composite);
-
-        //new PrintUtil(System.out).print(composite);
+        compositeBuilder.build(composite);
     }
 
 }



Mime
View raw message