diff options
author | edwardsmj <edwardsmj@13f79535-47bb-0310-9956-ffa450edef68> | 2009-05-08 12:03:37 +0000 |
---|---|---|
committer | edwardsmj <edwardsmj@13f79535-47bb-0310-9956-ffa450edef68> | 2009-05-08 12:03:37 +0000 |
commit | c9c6173caa3e219ba851ff989c96c93a8028b0bd (patch) | |
tree | 73888004c8b983d1f5bdf3cd6693d93e43795db3 /java/sca/modules/node-impl/src/main | |
parent | a05b13a7419efe5d96bb69ea2e21137e6225818a (diff) |
Updates and additions to add preResolve phase to contribution processing (See TUSCANY-3012)
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@772951 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'java/sca/modules/node-impl/src/main')
-rw-r--r-- | java/sca/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/NodeImpl.java | 43 |
1 files changed, 33 insertions, 10 deletions
diff --git a/java/sca/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/NodeImpl.java b/java/sca/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/NodeImpl.java index 47e838bad1..1195575f15 100644 --- a/java/sca/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/NodeImpl.java +++ b/java/sca/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/NodeImpl.java @@ -53,6 +53,8 @@ import org.apache.tuscany.sca.contribution.Artifact; import org.apache.tuscany.sca.contribution.Contribution; import org.apache.tuscany.sca.contribution.ContributionFactory; import org.apache.tuscany.sca.contribution.DefaultImport; +import org.apache.tuscany.sca.contribution.processor.ContributionResolveException; +import org.apache.tuscany.sca.contribution.processor.ExtendedURLArtifactProcessor; import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor; import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessorExtensionPoint; import org.apache.tuscany.sca.contribution.processor.URLArtifactProcessor; @@ -96,6 +98,7 @@ import org.apache.tuscany.sca.workspace.Workspace; import org.apache.tuscany.sca.workspace.WorkspaceFactory; import org.apache.tuscany.sca.workspace.builder.ContributionBuilder; import org.apache.tuscany.sca.workspace.builder.ContributionBuilderExtensionPoint; +import org.apache.tuscany.sca.workspace.processor.impl.ContributionContentProcessor; import org.oasisopen.sca.CallableReference; import org.oasisopen.sca.NoSuchDomainException; import org.oasisopen.sca.NoSuchServiceException; @@ -123,7 +126,7 @@ public class NodeImpl implements Node, Client, SCAClient { private ExtensionPointRegistry extensionPoints; private Monitor monitor; - private URLArtifactProcessor<Contribution> contributionProcessor; + private ExtendedURLArtifactProcessor<Contribution> contributionProcessor; private ModelResolverExtensionPoint modelResolvers; private FactoryExtensionPoint modelFactories; private WorkspaceFactory workspaceFactory; @@ -385,7 +388,7 @@ public class NodeImpl implements Node, Client, SCAClient { // Create contribution content processor URLArtifactProcessorExtensionPoint docProcessorExtensions = extensionPoints.getExtensionPoint(URLArtifactProcessorExtensionPoint.class); - contributionProcessor = docProcessorExtensions.getProcessor(Contribution.class); + contributionProcessor = (ExtendedURLArtifactProcessor<Contribution>) docProcessorExtensions.getProcessor(Contribution.class); // Added MJE 28/04/2009 // Create Composite Document processor @@ -552,6 +555,9 @@ public class NodeImpl implements Node, Client, SCAClient { workspace.getContributions().add(systemContribution); // TODO - Now we can calculate applicable policy sets for each composite + + // pre-resolve the contributions + contributionsPreresolve( workspace.getContributions(), workspace.getModelResolver() ); // Build the contribution dependencies Set<Contribution> resolved = new HashSet<Contribution>(); @@ -667,6 +673,20 @@ public class NodeImpl implements Node, Client, SCAClient { } */ } + + /** + * Pre-resolve phase for contributions, to set up handling of imports and exports prior to full resolution + * @param contributions - the contributions to preresolve + * @param resolver - the ModelResolver to use + * @throws ContributionResolveException + */ + private void contributionsPreresolve( List<Contribution> contributions, ModelResolver resolver ) + throws ContributionResolveException { + + for( Contribution contribution : contributions ) { + contributionProcessor.preResolve(contribution, resolver); + } // end for + } // end method contributionsPreresolve public void start() { logger.log(Level.INFO, "Starting node: " + configurationName); @@ -823,15 +843,18 @@ public class NodeImpl implements Node, Client, SCAClient { // just use the first deployable composite for (Contribution contribution : workspace.getContributions()) { for (Composite c : contribution.getDeployables()) { - composite = assemblyFactory.createComposite(); - composite.setURI(c.getURI()); - composite.setUnresolved(true); - configuration.setComposite(composite); + // Ensure that we pick a composite that has actually been found in its contribution!! + if( c.getURI() != null ) { + composite = assemblyFactory.createComposite(); + composite.setURI(c.getURI()); + composite.setUnresolved(true); + configuration.setComposite(composite); return; - } - } - throw new ServiceRuntimeException("no deployable composite found"); - } + } // end if + } // end for + } // end for + throw new ServiceRuntimeException("No deployable composite found"); + } // end method setDefaultComposite public ExtensionPointRegistry getExtensionPoints() { return extensionPoints; |