diff options
author | jsdelfino <jsdelfino@13f79535-47bb-0310-9956-ffa450edef68> | 2008-10-06 08:32:38 +0000 |
---|---|---|
committer | jsdelfino <jsdelfino@13f79535-47bb-0310-9956-ffa450edef68> | 2008-10-06 08:32:38 +0000 |
commit | 9fb2fb275d3f69a287ac4f1c7d55190fb7a7bb3b (patch) | |
tree | 40a3b6e43c677e8e9321921b95668eba4c75163a /branches/sca-equinox/samples | |
parent | 4f6fd64d654fec9afb231dd41af9c7d6e41d382f (diff) |
Work in progress. Started to clean up cross-bundle dependencies on ContributionService implementation class, the various CompositeBuilder implementation classes and the ContributionDependencyBuilder implementation class. Added extension points for ContributionBuilders and CompositeBuilders to have them discovered and loaded by the Equinox ServiceDiscovery like other extension points. Moved injection of monitors and SCA definitions to the build methods instead of the constructors to remove references to these implementation constructors. Simplified NodeImpl a bit to remove references to other runtime implementation classes.
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@702000 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to '')
10 files changed, 94 insertions, 130 deletions
diff --git a/branches/sca-equinox/samples/binding-echo-extension/src/main/java/echo/provider/EchoBindingProviderFactory.java b/branches/sca-equinox/samples/binding-echo-extension/src/main/java/echo/provider/EchoBindingProviderFactory.java index ba74d8f99a..04e6b42dc1 100644 --- a/branches/sca-equinox/samples/binding-echo-extension/src/main/java/echo/provider/EchoBindingProviderFactory.java +++ b/branches/sca-equinox/samples/binding-echo-extension/src/main/java/echo/provider/EchoBindingProviderFactory.java @@ -19,8 +19,8 @@ package echo.provider; -import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint; import org.apache.tuscany.sca.core.ExtensionPointRegistry; +import org.apache.tuscany.sca.core.FactoryExtensionPoint; import org.apache.tuscany.sca.invocation.MessageFactory; import org.apache.tuscany.sca.provider.BindingProviderFactory; import org.apache.tuscany.sca.provider.ReferenceBindingProvider; @@ -40,7 +40,7 @@ public class EchoBindingProviderFactory implements BindingProviderFactory<EchoBi private MessageFactory messageFactory; public EchoBindingProviderFactory(ExtensionPointRegistry extensionPoints) { - ModelFactoryExtensionPoint factories = extensionPoints.getExtensionPoint(ModelFactoryExtensionPoint.class); + FactoryExtensionPoint factories = extensionPoints.getExtensionPoint(FactoryExtensionPoint.class); this.messageFactory = factories.getFactory(MessageFactory.class); } diff --git a/branches/sca-equinox/samples/binding-echo-extension/src/main/java/echo/provider/policy/EchoBindingEncryptionPolicyProcessor.java b/branches/sca-equinox/samples/binding-echo-extension/src/main/java/echo/provider/policy/EchoBindingEncryptionPolicyProcessor.java index c847d088a6..2c2f93514d 100644 --- a/branches/sca-equinox/samples/binding-echo-extension/src/main/java/echo/provider/policy/EchoBindingEncryptionPolicyProcessor.java +++ b/branches/sca-equinox/samples/binding-echo-extension/src/main/java/echo/provider/policy/EchoBindingEncryptionPolicyProcessor.java @@ -18,7 +18,7 @@ */
package echo.provider.policy;
-import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
+import org.apache.tuscany.sca.core.FactoryExtensionPoint;
import org.apache.tuscany.sca.monitor.Monitor;
@@ -27,7 +27,7 @@ import org.apache.tuscany.sca.monitor.Monitor; */
public class EchoBindingEncryptionPolicyProcessor extends EchoBindingPolicyProcessor<EchoBindingEncryptionPolicy> {
- public EchoBindingEncryptionPolicyProcessor(ModelFactoryExtensionPoint modelFactories, Monitor monitor) {
+ public EchoBindingEncryptionPolicyProcessor(FactoryExtensionPoint modelFactories, Monitor monitor) {
}
public Class<EchoBindingEncryptionPolicy> getModelType() {
diff --git a/branches/sca-equinox/samples/domain-management/src/main/java/manager/DistributeAndRunComponents.java b/branches/sca-equinox/samples/domain-management/src/main/java/manager/DistributeAndRunComponents.java index 28eede693d..8d33f55228 100644 --- a/branches/sca-equinox/samples/domain-management/src/main/java/manager/DistributeAndRunComponents.java +++ b/branches/sca-equinox/samples/domain-management/src/main/java/manager/DistributeAndRunComponents.java @@ -40,19 +40,16 @@ import javax.xml.stream.XMLInputFactory; import javax.xml.stream.XMLOutputFactory; import javax.xml.stream.XMLStreamException; import javax.xml.stream.XMLStreamWriter; -import javax.xml.transform.TransformerFactory; import org.apache.tuscany.sca.assembly.AssemblyFactory; import org.apache.tuscany.sca.assembly.Binding; import org.apache.tuscany.sca.assembly.Component; import org.apache.tuscany.sca.assembly.ComponentService; 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.impl.CompositeBuilderImpl; +import org.apache.tuscany.sca.assembly.builder.CompositeBuilderExtensionPoint; import org.apache.tuscany.sca.binding.atom.AtomBindingFactory; import org.apache.tuscany.sca.contribution.Contribution; -import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint; import org.apache.tuscany.sca.contribution.processor.ExtensibleStAXArtifactProcessor; import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor; import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessorExtensionPoint; @@ -63,22 +60,20 @@ import org.apache.tuscany.sca.contribution.resolver.ModelResolverExtensionPoint; import org.apache.tuscany.sca.contribution.service.ContributionWriteException; import org.apache.tuscany.sca.core.DefaultExtensionPointRegistry; import org.apache.tuscany.sca.core.ExtensionPointRegistry; +import org.apache.tuscany.sca.core.FactoryExtensionPoint; import org.apache.tuscany.sca.core.ModuleActivator; import org.apache.tuscany.sca.core.ModuleActivatorExtensionPoint; import org.apache.tuscany.sca.core.UtilityExtensionPoint; import org.apache.tuscany.sca.implementation.node.NodeImplementation; import org.apache.tuscany.sca.implementation.node.NodeImplementationFactory; -import org.apache.tuscany.sca.implementation.node.builder.impl.NodeCompositeBuilderImpl; -import org.apache.tuscany.sca.interfacedef.InterfaceContractMapper; import org.apache.tuscany.sca.monitor.Monitor; import org.apache.tuscany.sca.monitor.MonitorFactory; import org.apache.tuscany.sca.node.SCANode; import org.apache.tuscany.sca.node.launcher.NodeLauncher; -import org.apache.tuscany.sca.policy.IntentAttachPointTypeFactory; import org.apache.tuscany.sca.workspace.Workspace; import org.apache.tuscany.sca.workspace.WorkspaceFactory; -import org.apache.tuscany.sca.workspace.builder.ContributionDependencyBuilder; -import org.apache.tuscany.sca.workspace.builder.impl.ContributionDependencyBuilderImpl; +import org.apache.tuscany.sca.workspace.builder.ContributionBuilder; +import org.apache.tuscany.sca.workspace.builder.ContributionBuilderExtensionPoint; import org.apache.xml.serialize.OutputFormat; import org.apache.xml.serialize.XMLSerializer; import org.w3c.dom.Document; @@ -97,14 +92,13 @@ public class DistributeAndRunComponents { private static URLArtifactProcessor<Contribution> contributionProcessor; private static ModelResolverExtensionPoint modelResolvers; - private static ModelFactoryExtensionPoint modelFactories; + private static FactoryExtensionPoint modelFactories; private static WorkspaceFactory workspaceFactory; private static AssemblyFactory assemblyFactory; private static XMLOutputFactory outputFactory; - private static DocumentBuilderFactory documentBuilderFactory; - private static TransformerFactory transformerFactory; private static StAXArtifactProcessor<Object> xmlProcessor; - private static ContributionDependencyBuilder contributionDependencyBuilder; + private static Monitor monitor; + private static ContributionBuilder contributionDependencyBuilder; private static CompositeBuilder domainCompositeBuilder; private static CompositeBuilder nodeCompositeBuilder; private static NodeImplementationFactory nodeFactory; @@ -118,7 +112,7 @@ public class DistributeAndRunComponents { // Create a monitor UtilityExtensionPoint utilities = extensionPoints.getExtensionPoint(UtilityExtensionPoint.class); MonitorFactory monitorFactory = utilities.getUtility(MonitorFactory.class); - Monitor monitor = monitorFactory.createMonitor(); + monitor = monitorFactory.createMonitor(); // Initialize the Tuscany module activators ModuleActivatorExtensionPoint moduleActivators = extensionPoints.getExtensionPoint(ModuleActivatorExtensionPoint.class); @@ -127,11 +121,9 @@ public class DistributeAndRunComponents { } // Get XML input/output factories - modelFactories = extensionPoints.getExtensionPoint(ModelFactoryExtensionPoint.class); + modelFactories = extensionPoints.getExtensionPoint(FactoryExtensionPoint.class); XMLInputFactory inputFactory = modelFactories.getFactory(XMLInputFactory.class); outputFactory = modelFactories.getFactory(XMLOutputFactory.class); - documentBuilderFactory = modelFactories.getFactory(DocumentBuilderFactory.class); - transformerFactory = modelFactories.getFactory(TransformerFactory.class); // Get contribution workspace and assembly model factories workspaceFactory = modelFactories.getFactory(WorkspaceFactory.class); @@ -150,19 +142,14 @@ public class DistributeAndRunComponents { // Get the model resolvers modelResolvers = extensionPoints.getExtensionPoint(ModelResolverExtensionPoint.class); - // Create a contribution dependency builder - contributionDependencyBuilder = new ContributionDependencyBuilderImpl(monitor); + // Get a contribution dependency builder + ContributionBuilderExtensionPoint contributionBuilders = extensionPoints.getExtensionPoint(ContributionBuilderExtensionPoint.class); + contributionDependencyBuilder = contributionBuilders.getContributionBuilder("org.apache.tuscany.sca.workspace.builder.ContributionDependencyBuilder"); - // Create a composite builder - SCABindingFactory scaBindingFactory = modelFactories.getFactory(SCABindingFactory.class); - IntentAttachPointTypeFactory attachPointTypeFactory = modelFactories.getFactory(IntentAttachPointTypeFactory.class); - InterfaceContractMapper contractMapper = utilities.getUtility(InterfaceContractMapper.class); - domainCompositeBuilder = new CompositeBuilderImpl(assemblyFactory, scaBindingFactory, attachPointTypeFactory, - documentBuilderFactory, transformerFactory, contractMapper, monitor); - - // Create a node composite builder - nodeCompositeBuilder = new NodeCompositeBuilderImpl(assemblyFactory, scaBindingFactory, - documentBuilderFactory, transformerFactory, contractMapper, null, monitor); + // Get composite builders + CompositeBuilderExtensionPoint compositeBuilders = extensionPoints.getExtensionPoint(CompositeBuilderExtensionPoint.class); + domainCompositeBuilder = compositeBuilders.getCompositeBuilder("org.apache.tuscany.sca.assembly.builder.CompositeBuilder"); + nodeCompositeBuilder = compositeBuilders.getCompositeBuilder("org.apache.tuscany.sca.implementation.node.builder.NodeCompositeBuilder"); } @@ -192,20 +179,17 @@ public class DistributeAndRunComponents { workspace.getContributions().add(clientContribution); // Build the contribution dependencies - Map<Contribution, List<Contribution>> contributionDependencies = new HashMap<Contribution, List<Contribution>>(); Set<Contribution> resolved = new HashSet<Contribution>(); for (Contribution contribution: workspace.getContributions()) { - List<Contribution> dependencies = contributionDependencyBuilder.buildContributionDependencies(contribution, workspace); + contributionDependencyBuilder.build(contribution, workspace, monitor); // Resolve contributions - for (Contribution dependency: dependencies) { + for (Contribution dependency: contribution.getDependencies()) { if (!resolved.contains(dependency)) { resolved.add(dependency); contributionProcessor.resolve(dependency, workspace.getModelResolver()); } } - - contributionDependencies.put(contribution, dependencies); } // Create a set of nodes, and assign the sample deployables to them @@ -237,7 +221,7 @@ public class DistributeAndRunComponents { node.setImplementation(nodeImplementation); // Keep track of what contributions will be needed by the node - nodeDependencies.put(node, contributionDependencies.get(contribution)); + nodeDependencies.put(node, contribution.getDependencies()); nodeID++; } @@ -249,7 +233,7 @@ public class DistributeAndRunComponents { // Build the nodes, this will apply their default binding configuration to the // composites assigned to them - nodeCompositeBuilder.build(cloudComposite); + nodeCompositeBuilder.build(cloudComposite, null, monitor); // Create a composite model for the domain Composite domainComposite = assemblyFactory.createComposite(); @@ -260,7 +244,7 @@ public class DistributeAndRunComponents { domainComposite.getIncludes().addAll(workspace.getDeployables()); // Build the domain composite and wire the components included in it - domainCompositeBuilder.build(domainComposite); + domainCompositeBuilder.build(domainComposite, null, monitor); // Print out the resulting domain composite System.out.println("domain.composite"); diff --git a/branches/sca-equinox/samples/domain-management/src/main/java/manager/DistributeComponents.java b/branches/sca-equinox/samples/domain-management/src/main/java/manager/DistributeComponents.java index def0a1894f..899ca1f24a 100644 --- a/branches/sca-equinox/samples/domain-management/src/main/java/manager/DistributeComponents.java +++ b/branches/sca-equinox/samples/domain-management/src/main/java/manager/DistributeComponents.java @@ -26,7 +26,6 @@ import java.io.IOException; import java.net.URI; import java.net.URL; import java.util.HashSet; -import java.util.List; import java.util.Set; import javax.xml.namespace.QName; @@ -37,20 +36,16 @@ import javax.xml.stream.XMLInputFactory; import javax.xml.stream.XMLOutputFactory; import javax.xml.stream.XMLStreamException; import javax.xml.stream.XMLStreamWriter; -import javax.xml.transform.TransformerFactory; import org.apache.tuscany.sca.assembly.AssemblyFactory; import org.apache.tuscany.sca.assembly.Binding; import org.apache.tuscany.sca.assembly.Component; import org.apache.tuscany.sca.assembly.ComponentService; 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.impl.CompositeBuilderImpl; +import org.apache.tuscany.sca.assembly.builder.CompositeBuilderExtensionPoint; import org.apache.tuscany.sca.binding.atom.AtomBindingFactory; import org.apache.tuscany.sca.contribution.Contribution; -import org.apache.tuscany.sca.contribution.ContributionFactory; -import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint; import org.apache.tuscany.sca.contribution.processor.ExtensibleStAXArtifactProcessor; import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor; import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessorExtensionPoint; @@ -61,21 +56,18 @@ import org.apache.tuscany.sca.contribution.resolver.ModelResolverExtensionPoint; import org.apache.tuscany.sca.contribution.service.ContributionWriteException; import org.apache.tuscany.sca.core.DefaultExtensionPointRegistry; import org.apache.tuscany.sca.core.ExtensionPointRegistry; +import org.apache.tuscany.sca.core.FactoryExtensionPoint; import org.apache.tuscany.sca.core.ModuleActivator; import org.apache.tuscany.sca.core.ModuleActivatorExtensionPoint; import org.apache.tuscany.sca.core.UtilityExtensionPoint; import org.apache.tuscany.sca.implementation.node.NodeImplementation; import org.apache.tuscany.sca.implementation.node.NodeImplementationFactory; -import org.apache.tuscany.sca.implementation.node.builder.impl.NodeCompositeBuilderImpl; -import org.apache.tuscany.sca.interfacedef.InterfaceContractMapper; 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.workspace.Workspace; import org.apache.tuscany.sca.workspace.WorkspaceFactory; -import org.apache.tuscany.sca.workspace.builder.ContributionDependencyBuilder; -import org.apache.tuscany.sca.workspace.builder.impl.ContributionDependencyBuilderImpl; +import org.apache.tuscany.sca.workspace.builder.ContributionBuilder; +import org.apache.tuscany.sca.workspace.builder.ContributionBuilderExtensionPoint; import org.apache.xml.serialize.OutputFormat; import org.apache.xml.serialize.XMLSerializer; import org.w3c.dom.Document; @@ -109,15 +101,14 @@ import org.xml.sax.SAXException; public class DistributeComponents { private static URLArtifactProcessor<Contribution> contributionProcessor; + private static Monitor monitor; private static ModelResolverExtensionPoint modelResolvers; - private static ModelFactoryExtensionPoint modelFactories; + private static FactoryExtensionPoint modelFactories; private static WorkspaceFactory workspaceFactory; private static AssemblyFactory assemblyFactory; private static XMLOutputFactory outputFactory; - private static DocumentBuilderFactory documentBuilderFactory; - private static TransformerFactory transformerFactory; private static StAXArtifactProcessor<Object> xmlProcessor; - private static ContributionDependencyBuilder contributionDependencyBuilder; + private static ContributionBuilder contributionDependencyBuilder; private static CompositeBuilder domainCompositeBuilder; private static CompositeBuilder nodeCompositeBuilder; private static NodeImplementationFactory nodeFactory; @@ -131,7 +122,7 @@ public class DistributeComponents { // Create a monitor UtilityExtensionPoint utilities = extensionPoints.getExtensionPoint(UtilityExtensionPoint.class); MonitorFactory monitorFactory = utilities.getUtility(MonitorFactory.class); - Monitor monitor = monitorFactory.createMonitor(); + monitor = monitorFactory.createMonitor(); // Initialize the Tuscany module activators ModuleActivatorExtensionPoint moduleActivators = extensionPoints.getExtensionPoint(ModuleActivatorExtensionPoint.class); @@ -140,11 +131,9 @@ public class DistributeComponents { } // Get XML input/output factories - modelFactories = extensionPoints.getExtensionPoint(ModelFactoryExtensionPoint.class); + modelFactories = extensionPoints.getExtensionPoint(FactoryExtensionPoint.class); XMLInputFactory inputFactory = modelFactories.getFactory(XMLInputFactory.class); outputFactory = modelFactories.getFactory(XMLOutputFactory.class); - documentBuilderFactory = modelFactories.getFactory(DocumentBuilderFactory.class); - transformerFactory = modelFactories.getFactory(TransformerFactory.class); // Get contribution workspace and assembly model factories workspaceFactory = modelFactories.getFactory(WorkspaceFactory.class); @@ -163,19 +152,15 @@ public class DistributeComponents { // Get the model resolvers modelResolvers = extensionPoints.getExtensionPoint(ModelResolverExtensionPoint.class); - // Create a contribution dependency builder - contributionDependencyBuilder = new ContributionDependencyBuilderImpl(monitor); + // Get a contribution dependency builder + ContributionBuilderExtensionPoint contributionBuilders = extensionPoints.getExtensionPoint(ContributionBuilderExtensionPoint.class); + contributionDependencyBuilder = contributionBuilders.getContributionBuilder("org.apache.tuscany.sca.workspace.builder.ContributionDependencyBuilder"); - // Create a composite builder - SCABindingFactory scaBindingFactory = modelFactories.getFactory(SCABindingFactory.class); - IntentAttachPointTypeFactory attachPointTypeFactory = modelFactories.getFactory(IntentAttachPointTypeFactory.class); - InterfaceContractMapper contractMapper = utilities.getUtility(InterfaceContractMapper.class); - domainCompositeBuilder = new CompositeBuilderImpl(assemblyFactory, scaBindingFactory, attachPointTypeFactory, - documentBuilderFactory, transformerFactory, contractMapper, monitor); + // Get composite builders + CompositeBuilderExtensionPoint compositeBuilders = extensionPoints.getExtensionPoint(CompositeBuilderExtensionPoint.class); + domainCompositeBuilder = compositeBuilders.getCompositeBuilder("org.apache.tuscany.sca.assembly.builder.CompositeBuilder"); + nodeCompositeBuilder = compositeBuilders.getCompositeBuilder("org.apache.tuscany.sca.implementation.node.builder.NodeCompositeBuilder"); - // Create a node composite builder - nodeCompositeBuilder = new NodeCompositeBuilderImpl(assemblyFactory, scaBindingFactory, - documentBuilderFactory, transformerFactory, contractMapper, null, monitor); } @@ -207,10 +192,10 @@ public class DistributeComponents { // Build the contribution dependencies Set<Contribution> resolved = new HashSet<Contribution>(); for (Contribution contribution: workspace.getContributions()) { - List<Contribution> dependencies = contributionDependencyBuilder.buildContributionDependencies(contribution, workspace); + contributionDependencyBuilder.build(contribution, workspace, monitor); // Resolve contributions - for (Contribution dependency: dependencies) { + for (Contribution dependency: contribution.getDependencies()) { if (!resolved.contains(dependency)) { resolved.add(dependency); contributionProcessor.resolve(dependency, workspace.getModelResolver()); @@ -252,7 +237,7 @@ public class DistributeComponents { // Build the nodes, this will apply their default binding configuration to the // composites assigned to them - nodeCompositeBuilder.build(cloudComposite); + nodeCompositeBuilder.build(cloudComposite, null, monitor); // Create a composite model for the domain Composite domainComposite = assemblyFactory.createComposite(); @@ -263,7 +248,7 @@ public class DistributeComponents { domainComposite.getIncludes().addAll(workspace.getDeployables()); // Build the domain composite and wire the components included in it - domainCompositeBuilder.build(domainComposite); + domainCompositeBuilder.build(domainComposite, null, monitor); // Print out the resulting domain composite System.out.println("domain.composite"); diff --git a/branches/sca-equinox/samples/domain-management/src/main/java/manager/ListComponents.java b/branches/sca-equinox/samples/domain-management/src/main/java/manager/ListComponents.java index 27cb31d57f..b8dee12962 100644 --- a/branches/sca-equinox/samples/domain-management/src/main/java/manager/ListComponents.java +++ b/branches/sca-equinox/samples/domain-management/src/main/java/manager/ListComponents.java @@ -22,7 +22,6 @@ package manager; import java.io.File; import java.net.URI; import java.net.URL; -import java.util.List; import org.apache.tuscany.sca.assembly.Binding; import org.apache.tuscany.sca.assembly.Component; @@ -31,13 +30,13 @@ import org.apache.tuscany.sca.assembly.Composite; import org.apache.tuscany.sca.assembly.Implementation; import org.apache.tuscany.sca.assembly.Service; import org.apache.tuscany.sca.contribution.Contribution; -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.ExtensibleModelResolver; import org.apache.tuscany.sca.contribution.resolver.ModelResolverExtensionPoint; import org.apache.tuscany.sca.core.DefaultExtensionPointRegistry; import org.apache.tuscany.sca.core.ExtensionPointRegistry; +import org.apache.tuscany.sca.core.FactoryExtensionPoint; import org.apache.tuscany.sca.core.ModuleActivator; import org.apache.tuscany.sca.core.ModuleActivatorExtensionPoint; import org.apache.tuscany.sca.core.UtilityExtensionPoint; @@ -46,8 +45,8 @@ import org.apache.tuscany.sca.monitor.Monitor; import org.apache.tuscany.sca.monitor.MonitorFactory; import org.apache.tuscany.sca.workspace.Workspace; import org.apache.tuscany.sca.workspace.WorkspaceFactory; -import org.apache.tuscany.sca.workspace.builder.ContributionDependencyBuilder; -import org.apache.tuscany.sca.workspace.builder.impl.ContributionDependencyBuilderImpl; +import org.apache.tuscany.sca.workspace.builder.ContributionBuilder; +import org.apache.tuscany.sca.workspace.builder.ContributionBuilderExtensionPoint; /** * Sample ListComponents task. @@ -68,10 +67,11 @@ import org.apache.tuscany.sca.workspace.builder.impl.ContributionDependencyBuild public class ListComponents { private static URLArtifactProcessor<Contribution> contributionProcessor; + private static Monitor monitor; private static ModelResolverExtensionPoint modelResolvers; - private static ModelFactoryExtensionPoint modelFactories; + private static FactoryExtensionPoint modelFactories; private static WorkspaceFactory workspaceFactory; - private static ContributionDependencyBuilder contributionDependencyBuilder; + private static ContributionBuilder contributionDependencyBuilder; private static void init() { @@ -85,7 +85,7 @@ public class ListComponents { } // Get workspace contribution factory - modelFactories = extensionPoints.getExtensionPoint(ModelFactoryExtensionPoint.class); + modelFactories = extensionPoints.getExtensionPoint(FactoryExtensionPoint.class); workspaceFactory = modelFactories.getFactory(WorkspaceFactory.class); // Create contribution content processor @@ -98,10 +98,11 @@ public class ListComponents { // Create a monitor UtilityExtensionPoint utilities = extensionPoints.getExtensionPoint(UtilityExtensionPoint.class); MonitorFactory monitorFactory = utilities.getUtility(MonitorFactory.class); - Monitor monitor = monitorFactory.createMonitor(); + monitor = monitorFactory.createMonitor(); - // Create a contribution dependency builder - contributionDependencyBuilder = new ContributionDependencyBuilderImpl(monitor); + // Get a contribution dependency builder + ContributionBuilderExtensionPoint contributionBuilders = extensionPoints.getExtensionPoint(ContributionBuilderExtensionPoint.class); + contributionDependencyBuilder = contributionBuilders.getContributionBuilder("org.apache.tuscany.sca.workspace.builder.ContributionDependencyBuilder"); } @@ -125,10 +126,10 @@ public class ListComponents { workspace.getContributions().add(assetsContribution); // Build the store contribution dependencies - List<Contribution> dependencies = contributionDependencyBuilder.buildContributionDependencies(storeContribution, workspace); + contributionDependencyBuilder.build(storeContribution, workspace, monitor); // Resolve the contributions - for (Contribution contribution: dependencies) { + for (Contribution contribution: storeContribution.getDependencies()) { contributionProcessor.resolve(contribution, workspace.getModelResolver()); } diff --git a/branches/sca-equinox/samples/domain-management/src/main/java/manager/ListDependencies.java b/branches/sca-equinox/samples/domain-management/src/main/java/manager/ListDependencies.java index 1bf8124682..9e57afbee3 100644 --- a/branches/sca-equinox/samples/domain-management/src/main/java/manager/ListDependencies.java +++ b/branches/sca-equinox/samples/domain-management/src/main/java/manager/ListDependencies.java @@ -24,18 +24,18 @@ import java.net.URI; import java.net.URL; import org.apache.tuscany.sca.contribution.Contribution; -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.core.DefaultExtensionPointRegistry; import org.apache.tuscany.sca.core.ExtensionPointRegistry; +import org.apache.tuscany.sca.core.FactoryExtensionPoint; import org.apache.tuscany.sca.core.UtilityExtensionPoint; import org.apache.tuscany.sca.monitor.Monitor; import org.apache.tuscany.sca.monitor.MonitorFactory; import org.apache.tuscany.sca.workspace.Workspace; import org.apache.tuscany.sca.workspace.WorkspaceFactory; -import org.apache.tuscany.sca.workspace.builder.ContributionDependencyBuilder; -import org.apache.tuscany.sca.workspace.builder.impl.ContributionDependencyBuilderImpl; +import org.apache.tuscany.sca.workspace.builder.ContributionBuilder; +import org.apache.tuscany.sca.workspace.builder.ContributionBuilderExtensionPoint; /** * Sample ListDependencies task. @@ -52,8 +52,9 @@ import org.apache.tuscany.sca.workspace.builder.impl.ContributionDependencyBuild public class ListDependencies { private static URLArtifactProcessor<Contribution> contributionProcessor; + private static Monitor monitor; private static WorkspaceFactory workspaceFactory; - private static ContributionDependencyBuilder contributionDependencyBuilder; + private static ContributionBuilder contributionDependencyBuilder; private static void init() throws Exception { @@ -61,7 +62,7 @@ public class ListDependencies { ExtensionPointRegistry extensionPoints = new DefaultExtensionPointRegistry(); // Get contribution, workspace and assembly model factories - ModelFactoryExtensionPoint modelFactories = extensionPoints.getExtensionPoint(ModelFactoryExtensionPoint.class); + FactoryExtensionPoint modelFactories = extensionPoints.getExtensionPoint(FactoryExtensionPoint.class); workspaceFactory = modelFactories.getFactory(WorkspaceFactory.class); // Create contribution info processor @@ -71,10 +72,11 @@ public class ListDependencies { // Create a monitor UtilityExtensionPoint services = extensionPoints.getExtensionPoint(UtilityExtensionPoint.class); MonitorFactory monitorFactory = services.getUtility(MonitorFactory.class); - Monitor monitor = monitorFactory.createMonitor(); + monitor = monitorFactory.createMonitor(); - // Create a contribution dependency builder - contributionDependencyBuilder = new ContributionDependencyBuilderImpl(monitor); + // Get a contribution dependency builder + ContributionBuilderExtensionPoint contributionBuilders = extensionPoints.getExtensionPoint(ContributionBuilderExtensionPoint.class); + contributionDependencyBuilder = contributionBuilders.getContributionBuilder("org.apache.tuscany.sca.workspace.builder.ContributionDependencyBuilder"); } @@ -99,7 +101,8 @@ public class ListDependencies { // List the contribution dependencies of each contribution for (Contribution contribution: workspace.getContributions()) { System.out.println("Contribution: " + contribution.getURI()); - for (Contribution dependency: contributionDependencyBuilder.buildContributionDependencies(contribution, workspace)) { + contributionDependencyBuilder.build(contribution, workspace, monitor); + for (Contribution dependency: contribution.getDependencies()) { System.out.println(" dependency: " + dependency.getURI()); } } diff --git a/branches/sca-equinox/samples/domain-management/src/main/java/manager/WireComponents.java b/branches/sca-equinox/samples/domain-management/src/main/java/manager/WireComponents.java index d24d5c67c9..acc18a6293 100644 --- a/branches/sca-equinox/samples/domain-management/src/main/java/manager/WireComponents.java +++ b/branches/sca-equinox/samples/domain-management/src/main/java/manager/WireComponents.java @@ -25,7 +25,6 @@ import java.io.File; import java.net.URI; import java.net.URL; import java.util.HashSet; -import java.util.List; import java.util.Set; import javax.xml.namespace.QName; @@ -38,11 +37,9 @@ import javax.xml.transform.TransformerFactory; 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.impl.CompositeBuilderImpl; +import org.apache.tuscany.sca.assembly.builder.CompositeBuilderExtensionPoint; import org.apache.tuscany.sca.contribution.Contribution; -import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint; import org.apache.tuscany.sca.contribution.processor.ExtensibleStAXArtifactProcessor; import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor; import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessorExtensionPoint; @@ -52,17 +49,16 @@ import org.apache.tuscany.sca.contribution.resolver.ExtensibleModelResolver; import org.apache.tuscany.sca.contribution.resolver.ModelResolverExtensionPoint; import org.apache.tuscany.sca.core.DefaultExtensionPointRegistry; import org.apache.tuscany.sca.core.ExtensionPointRegistry; +import org.apache.tuscany.sca.core.FactoryExtensionPoint; import org.apache.tuscany.sca.core.ModuleActivator; import org.apache.tuscany.sca.core.ModuleActivatorExtensionPoint; import org.apache.tuscany.sca.core.UtilityExtensionPoint; -import org.apache.tuscany.sca.interfacedef.InterfaceContractMapper; 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.workspace.Workspace; import org.apache.tuscany.sca.workspace.WorkspaceFactory; -import org.apache.tuscany.sca.workspace.builder.ContributionDependencyBuilder; -import org.apache.tuscany.sca.workspace.builder.impl.ContributionDependencyBuilderImpl; +import org.apache.tuscany.sca.workspace.builder.ContributionBuilder; +import org.apache.tuscany.sca.workspace.builder.ContributionBuilderExtensionPoint; import org.apache.xml.serialize.OutputFormat; import org.apache.xml.serialize.XMLSerializer; import org.w3c.dom.Document; @@ -88,15 +84,14 @@ import org.w3c.dom.Document; public class WireComponents { private static URLArtifactProcessor<Contribution> contributionProcessor; + private static Monitor monitor; private static ModelResolverExtensionPoint modelResolvers; - private static ModelFactoryExtensionPoint modelFactories; + private static FactoryExtensionPoint modelFactories; private static WorkspaceFactory workspaceFactory; private static AssemblyFactory assemblyFactory; private static XMLOutputFactory outputFactory; - private static DocumentBuilderFactory documentBuilderFactory; - private static TransformerFactory transformerFactory; private static StAXArtifactProcessor<Object> xmlProcessor; - private static ContributionDependencyBuilder contributionDependencyBuilder; + private static ContributionBuilder contributionDependencyBuilder; private static CompositeBuilder domainCompositeBuilder; private static void init() { @@ -107,7 +102,7 @@ public class WireComponents { // Create a monitor UtilityExtensionPoint utilities = extensionPoints.getExtensionPoint(UtilityExtensionPoint.class); MonitorFactory monitorFactory = utilities.getUtility(MonitorFactory.class); - Monitor monitor = monitorFactory.createMonitor(); + monitor = monitorFactory.createMonitor(); // Initialize the Tuscany module activators ModuleActivatorExtensionPoint moduleActivators = extensionPoints.getExtensionPoint(ModuleActivatorExtensionPoint.class); @@ -116,11 +111,9 @@ public class WireComponents { } // Get XML input/output factories - modelFactories = extensionPoints.getExtensionPoint(ModelFactoryExtensionPoint.class); + modelFactories = extensionPoints.getExtensionPoint(FactoryExtensionPoint.class); XMLInputFactory inputFactory = modelFactories.getFactory(XMLInputFactory.class); outputFactory = modelFactories.getFactory(XMLOutputFactory.class); - documentBuilderFactory = modelFactories.getFactory(DocumentBuilderFactory.class); - transformerFactory = modelFactories.getFactory(TransformerFactory.class); // Get contribution workspace and assembly model factories workspaceFactory = modelFactories.getFactory(WorkspaceFactory.class); @@ -137,15 +130,13 @@ public class WireComponents { // Get the model resolvers modelResolvers = extensionPoints.getExtensionPoint(ModelResolverExtensionPoint.class); - // Create a contribution dependency builder - contributionDependencyBuilder = new ContributionDependencyBuilderImpl(monitor); + // Get a contribution dependency builder + ContributionBuilderExtensionPoint contributionBuilders = extensionPoints.getExtensionPoint(ContributionBuilderExtensionPoint.class); + contributionDependencyBuilder = contributionBuilders.getContributionBuilder("org.apache.tuscany.sca.workspace.builder.ContributionDependencyBuilder"); - // Create a composite builder - SCABindingFactory scaBindingFactory = modelFactories.getFactory(SCABindingFactory.class); - IntentAttachPointTypeFactory attachPointTypeFactory = modelFactories.getFactory(IntentAttachPointTypeFactory.class); - InterfaceContractMapper contractMapper = utilities.getUtility(InterfaceContractMapper.class); - domainCompositeBuilder = new CompositeBuilderImpl(assemblyFactory, scaBindingFactory, attachPointTypeFactory, - documentBuilderFactory, transformerFactory, contractMapper, monitor); + // Get composite builder + CompositeBuilderExtensionPoint compositeBuilders = extensionPoints.getExtensionPoint(CompositeBuilderExtensionPoint.class); + domainCompositeBuilder = compositeBuilders.getCompositeBuilder("org.apache.tuscany.sca.assembly.builder.CompositeBuilder"); } @@ -178,10 +169,10 @@ public class WireComponents { // Build the contribution dependencies Set<Contribution> resolved = new HashSet<Contribution>(); for (Contribution contribution: workspace.getContributions()) { - List<Contribution> dependencies = contributionDependencyBuilder.buildContributionDependencies(contribution, workspace); + contributionDependencyBuilder.build(contribution, workspace, monitor); // Resolve contributions - for (Contribution dependency: dependencies) { + for (Contribution dependency: contribution.getDependencies()) { if (!resolved.contains(dependency)) { resolved.add(dependency); contributionProcessor.resolve(contribution, workspace.getModelResolver()); @@ -198,7 +189,7 @@ public class WireComponents { domainComposite.getIncludes().addAll(workspace.getDeployables()); // Build the domain composite and wire the components included in it - domainCompositeBuilder.build(domainComposite); + domainCompositeBuilder.build(domainComposite, null, monitor); // Print out the resulting domain composite ByteArrayOutputStream bos = new ByteArrayOutputStream(); diff --git a/branches/sca-equinox/samples/implementation-crud-extension/src/main/java/crud/impl/CRUDImplementationFactoryImpl.java b/branches/sca-equinox/samples/implementation-crud-extension/src/main/java/crud/impl/CRUDImplementationFactoryImpl.java index 2f1e5fcba8..a7908501a1 100644 --- a/branches/sca-equinox/samples/implementation-crud-extension/src/main/java/crud/impl/CRUDImplementationFactoryImpl.java +++ b/branches/sca-equinox/samples/implementation-crud-extension/src/main/java/crud/impl/CRUDImplementationFactoryImpl.java @@ -20,7 +20,7 @@ package crud.impl; import org.apache.tuscany.sca.assembly.AssemblyFactory; -import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint; +import org.apache.tuscany.sca.core.FactoryExtensionPoint; import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory; import crud.CRUDImplementation; @@ -35,7 +35,7 @@ public class CRUDImplementationFactoryImpl implements CRUDImplementationFactory private AssemblyFactory assemblyFactory; private JavaInterfaceFactory javaFactory; - public CRUDImplementationFactoryImpl(ModelFactoryExtensionPoint modelFactories) { + public CRUDImplementationFactoryImpl(FactoryExtensionPoint modelFactories) { this.assemblyFactory = modelFactories.getFactory(AssemblyFactory.class); this.javaFactory = modelFactories.getFactory(JavaInterfaceFactory.class); } diff --git a/branches/sca-equinox/samples/implementation-pojo-extension/src/main/java/pojo/impl/POJOImplementationProcessor.java b/branches/sca-equinox/samples/implementation-pojo-extension/src/main/java/pojo/impl/POJOImplementationProcessor.java index 44a2cc0aa8..8ba343d3ef 100644 --- a/branches/sca-equinox/samples/implementation-pojo-extension/src/main/java/pojo/impl/POJOImplementationProcessor.java +++ b/branches/sca-equinox/samples/implementation-pojo-extension/src/main/java/pojo/impl/POJOImplementationProcessor.java @@ -29,13 +29,13 @@ import org.apache.tuscany.sca.assembly.AssemblyFactory; import org.apache.tuscany.sca.assembly.ComponentType; import org.apache.tuscany.sca.assembly.Service; import org.apache.tuscany.sca.assembly.xml.PolicyAttachPointProcessor; -import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint; import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor; import org.apache.tuscany.sca.contribution.resolver.ClassReference; import org.apache.tuscany.sca.contribution.resolver.ModelResolver; import org.apache.tuscany.sca.contribution.service.ContributionReadException; import org.apache.tuscany.sca.contribution.service.ContributionResolveException; import org.apache.tuscany.sca.contribution.service.ContributionWriteException; +import org.apache.tuscany.sca.core.FactoryExtensionPoint; import org.apache.tuscany.sca.interfacedef.InvalidInterfaceException; import org.apache.tuscany.sca.interfacedef.java.JavaInterface; import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceContract; @@ -63,7 +63,7 @@ public class POJOImplementationProcessor implements StAXArtifactProcessor<POJOIm private PolicyFactory policyFactory; private PolicyAttachPointProcessor policyProcessor; - public POJOImplementationProcessor(ModelFactoryExtensionPoint modelFactories, Monitor monitor) { + public POJOImplementationProcessor(FactoryExtensionPoint modelFactories, Monitor monitor) { // Get the assembly and Java interface factories as we'll need them to // create model objects diff --git a/branches/sca-equinox/samples/spring-bigbank-checkaccount/src/main/java/bigbank/account/security/CheckingsDeptAuthorizationPolicyProcessor.java b/branches/sca-equinox/samples/spring-bigbank-checkaccount/src/main/java/bigbank/account/security/CheckingsDeptAuthorizationPolicyProcessor.java index 96a5b2ca1f..5d7ce4be8e 100644 --- a/branches/sca-equinox/samples/spring-bigbank-checkaccount/src/main/java/bigbank/account/security/CheckingsDeptAuthorizationPolicyProcessor.java +++ b/branches/sca-equinox/samples/spring-bigbank-checkaccount/src/main/java/bigbank/account/security/CheckingsDeptAuthorizationPolicyProcessor.java @@ -23,12 +23,12 @@ import javax.xml.stream.XMLStreamException; import javax.xml.stream.XMLStreamReader;
import javax.xml.stream.XMLStreamWriter;
-import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
import org.apache.tuscany.sca.contribution.service.ContributionReadException;
import org.apache.tuscany.sca.contribution.service.ContributionResolveException;
import org.apache.tuscany.sca.contribution.service.ContributionWriteException;
+import org.apache.tuscany.sca.core.FactoryExtensionPoint;
/**
* Implementation of a Policy Processor
@@ -40,7 +40,7 @@ public class CheckingsDeptAuthorizationPolicyProcessor implements StAXArtifactPr return CHECKINGS_DEPT_AUTHORIZATION_POLICY_QNAME;
}
- public CheckingsDeptAuthorizationPolicyProcessor(ModelFactoryExtensionPoint modelFactories) {
+ public CheckingsDeptAuthorizationPolicyProcessor(FactoryExtensionPoint modelFactories) {
}
|