diff options
Diffstat (limited to '')
2 files changed, 33 insertions, 6 deletions
diff --git a/branches/sca-java-1.x/modules/workspace-impl/src/main/java/org/apache/tuscany/sca/workspace/processor/impl/ContributionContentProcessor.java b/branches/sca-java-1.x/modules/workspace-impl/src/main/java/org/apache/tuscany/sca/workspace/processor/impl/ContributionContentProcessor.java index d0f769c9d1..e3f0844e35 100644 --- a/branches/sca-java-1.x/modules/workspace-impl/src/main/java/org/apache/tuscany/sca/workspace/processor/impl/ContributionContentProcessor.java +++ b/branches/sca-java-1.x/modules/workspace-impl/src/main/java/org/apache/tuscany/sca/workspace/processor/impl/ContributionContentProcessor.java @@ -23,6 +23,9 @@ import java.net.URI; import java.net.URL; import java.util.List; +import javax.xml.stream.XMLInputFactory; +import javax.xml.stream.XMLOutputFactory; + import org.apache.tuscany.sca.assembly.Composite; import org.apache.tuscany.sca.contribution.Artifact; import org.apache.tuscany.sca.contribution.Contribution; @@ -33,8 +36,10 @@ import org.apache.tuscany.sca.contribution.DefaultImport; 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.ExtensibleStAXArtifactProcessor; import org.apache.tuscany.sca.contribution.processor.ExtensibleURLArtifactProcessor; 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.ClassReference; @@ -58,6 +63,7 @@ import org.apache.tuscany.sca.workspace.scanner.impl.JarContributionScanner; * @version $Rev$ $Date$ */ public class ContributionContentProcessor implements URLArtifactProcessor<Contribution>{ + private ExtensionPointRegistry extensionPoints; private ContributionFactory contributionFactory; private ModelResolverExtensionPoint modelResolvers; private ModelFactoryExtensionPoint modelFactories; @@ -66,17 +72,24 @@ public class ContributionContentProcessor implements URLArtifactProcessor<Contri private UtilityExtensionPoint utilities; private Monitor monitor = null; - public ContributionContentProcessor(ExtensionPointRegistry extensionPoints, StAXArtifactProcessor<Object> extensionProcessor, Monitor monitor) { + public ContributionContentProcessor(ExtensionPointRegistry extensionPoints, Monitor monitor) { + this.extensionPoints = extensionPoints; this.modelFactories = extensionPoints.getExtensionPoint(ModelFactoryExtensionPoint.class); this.modelResolvers = extensionPoints.getExtensionPoint(ModelResolverExtensionPoint.class); hackResolvers(modelResolvers); this.monitor = monitor; URLArtifactProcessorExtensionPoint artifactProcessors = extensionPoints.getExtensionPoint(URLArtifactProcessorExtensionPoint.class); this.artifactProcessor = new ExtensibleURLArtifactProcessor(artifactProcessors, this.monitor); - this.extensionProcessor = extensionProcessor; + + // Get and initialize artifact processors + StAXArtifactProcessorExtensionPoint staxProcessors = extensionPoints.getExtensionPoint(StAXArtifactProcessorExtensionPoint.class); + XMLInputFactory inputFactory = modelFactories.getFactory(XMLInputFactory.class); + XMLOutputFactory outputFactory = modelFactories.getFactory(XMLOutputFactory.class); + this.extensionProcessor = new ExtensibleStAXArtifactProcessor(staxProcessors, inputFactory, outputFactory, monitor); this.contributionFactory = modelFactories.getFactory(ContributionFactory.class); } + /* public ContributionContentProcessor(ModelFactoryExtensionPoint modelFactories, ModelResolverExtensionPoint modelResolvers, URLArtifactProcessor<Object> artifactProcessor, StAXArtifactProcessor<Object> extensionProcessor, Monitor monitor) { this.modelFactories = modelFactories; @@ -87,6 +100,7 @@ public class ContributionContentProcessor implements URLArtifactProcessor<Contri this.contributionFactory = modelFactories.getFactory(ContributionFactory.class); this.monitor = monitor; } + */ public String getArtifactType() { return ".contribution/content"; @@ -102,7 +116,7 @@ public class ContributionContentProcessor implements URLArtifactProcessor<Contri Contribution contribution = contributionFactory.createContribution(); contribution.setURI(contributionURI.toString()); contribution.setLocation(contributionURL.toString()); - ModelResolver modelResolver = new ExtensibleModelResolver(contribution, modelResolvers, modelFactories); + ModelResolver modelResolver = new ExtensibleModelResolver(contribution, extensionPoints); contribution.setModelResolver(modelResolver); contribution.setUnresolved(true); diff --git a/branches/sca-java-1.x/modules/workspace-impl/src/main/java/org/apache/tuscany/sca/workspace/processor/impl/ContributionInfoProcessor.java b/branches/sca-java-1.x/modules/workspace-impl/src/main/java/org/apache/tuscany/sca/workspace/processor/impl/ContributionInfoProcessor.java index 6ef0fa753d..40e377604c 100644 --- a/branches/sca-java-1.x/modules/workspace-impl/src/main/java/org/apache/tuscany/sca/workspace/processor/impl/ContributionInfoProcessor.java +++ b/branches/sca-java-1.x/modules/workspace-impl/src/main/java/org/apache/tuscany/sca/workspace/processor/impl/ContributionInfoProcessor.java @@ -26,6 +26,9 @@ import java.net.URL; import java.net.URLConnection; import java.util.List; +import javax.xml.stream.XMLInputFactory; +import javax.xml.stream.XMLOutputFactory; + import org.apache.tuscany.sca.assembly.Composite; import org.apache.tuscany.sca.contribution.Contribution; import org.apache.tuscany.sca.contribution.ContributionFactory; @@ -35,8 +38,10 @@ import org.apache.tuscany.sca.contribution.DefaultImport; 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.ExtensibleStAXArtifactProcessor; import org.apache.tuscany.sca.contribution.processor.ExtensibleURLArtifactProcessor; 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.ClassReference; @@ -59,6 +64,7 @@ import org.apache.tuscany.sca.workspace.scanner.impl.JarContributionScanner; * @version $Rev$ $Date$ */ public class ContributionInfoProcessor implements URLArtifactProcessor<Contribution>{ + private ExtensionPointRegistry extensionPoints; private ContributionFactory contributionFactory; private ModelResolverExtensionPoint modelResolvers; private ModelFactoryExtensionPoint modelFactories; @@ -66,17 +72,23 @@ public class ContributionInfoProcessor implements URLArtifactProcessor<Contribut private URLArtifactProcessor<Object> artifactProcessor; private StAXArtifactProcessor<Object> extensionProcessor; - public ContributionInfoProcessor(ExtensionPointRegistry extensionPoints, StAXArtifactProcessor<Object> extensionProcessor, Monitor monitor) { + public ContributionInfoProcessor(ExtensionPointRegistry extensionPoints, Monitor monitor) { + this.extensionPoints = extensionPoints; this.modelFactories = extensionPoints.getExtensionPoint(ModelFactoryExtensionPoint.class); this.modelResolvers = extensionPoints.getExtensionPoint(ModelResolverExtensionPoint.class); hackResolvers(modelResolvers); URLArtifactProcessorExtensionPoint artifactProcessors = extensionPoints.getExtensionPoint(URLArtifactProcessorExtensionPoint.class); this.artifactProcessors = artifactProcessors; this.artifactProcessor = new ExtensibleURLArtifactProcessor(artifactProcessors, monitor); - this.extensionProcessor = extensionProcessor; + // Get and initialize artifact processors + StAXArtifactProcessorExtensionPoint staxProcessors = extensionPoints.getExtensionPoint(StAXArtifactProcessorExtensionPoint.class); + XMLInputFactory inputFactory = modelFactories.getFactory(XMLInputFactory.class); + XMLOutputFactory outputFactory = modelFactories.getFactory(XMLOutputFactory.class); + this.extensionProcessor = new ExtensibleStAXArtifactProcessor(staxProcessors, inputFactory, outputFactory, monitor); this.contributionFactory = modelFactories.getFactory(ContributionFactory.class); } + /* public ContributionInfoProcessor(ModelFactoryExtensionPoint modelFactories, ModelResolverExtensionPoint modelResolvers, URLArtifactProcessor<Object> artifactProcessor) { this.modelFactories = modelFactories; this.modelResolvers = modelResolvers; @@ -84,6 +96,7 @@ public class ContributionInfoProcessor implements URLArtifactProcessor<Contribut this.artifactProcessor = artifactProcessor; this.contributionFactory = modelFactories.getFactory(ContributionFactory.class); } + */ public String getArtifactType() { return ".contribution/info"; @@ -99,7 +112,7 @@ public class ContributionInfoProcessor implements URLArtifactProcessor<Contribut Contribution contribution = contributionFactory.createContribution(); contribution.setURI(contributionURI.toString()); contribution.setLocation(contributionURL.toString()); - ModelResolver modelResolver = new ExtensibleModelResolver(contribution, modelResolvers, modelFactories); + ModelResolver modelResolver = new ExtensibleModelResolver(contribution, extensionPoints); contribution.setModelResolver(modelResolver); contribution.setUnresolved(true); |