diff options
Diffstat (limited to '')
4 files changed, 43 insertions, 21 deletions
diff --git a/sca-java-2.x/trunk/modules/domain-node/src/main/java/org/apache/tuscany/sca/Node.java b/sca-java-2.x/trunk/modules/domain-node/src/main/java/org/apache/tuscany/sca/Node.java index efe4c2d27b..046ce4ac83 100644 --- a/sca-java-2.x/trunk/modules/domain-node/src/main/java/org/apache/tuscany/sca/Node.java +++ b/sca-java-2.x/trunk/modules/domain-node/src/main/java/org/apache/tuscany/sca/Node.java @@ -32,6 +32,10 @@ import org.apache.tuscany.sca.monitor.ValidationException; import org.apache.tuscany.sca.runtime.ActivationException; import org.oasisopen.sca.NoSuchServiceException; +/** + * A Node is a collection of contributions and started composites which are part + * of an SCA Domain. + */ public interface Node { /** @@ -108,6 +112,29 @@ public interface Node { * @throws ValidationException */ String start(String contributionURI, Reader compositeXML) throws ContributionReadException, XMLStreamException, ActivationException, ValidationException; + + /** + * 4599 10.5.2 add Deployment Composite & update Deployment Composite + * 4600 Adds or updates a deployment composite using a supplied composite ("composite by value" - a data + * 4601 structure, not an existing resource in the Domain) to the contribution identified by a supplied contribution + * 4602 URI. The added or updated deployment composite is given a relative URI that matches the @name + * 4603 attribute of the composite, with a ".composite" suffix. Since all composites run within the context of a + * 4604 installed contribution (any component implementations or other definitions are resolved within that + * 4605 contribution), this functionality makes it possible for the deployer to create a composite with final + * 4606 configuration and wiring decisions and add it to an installed contribution without having to modify the + * 4607 contents of the root contribution. + * 4608 Also, in some use cases, a contribution might include only implementation code (e.g. PHP scripts). It is + * 4609 then possible for those to be given component names by a (possibly generated) composite that is added + * 4610 into the installed contribution, without having to modify the packaging. * + * + * @param contributionURI the URI of the installed contribution to add the composite to + * @param composite the Composite to add to the contribution + * @return + * @throws XMLStreamException + * @throws ContributionReadException + * @throws ActivationException + * @throws ValidationException + */ String start(String contributionURI, Composite composite) throws ActivationException, ValidationException; /** diff --git a/sca-java-2.x/trunk/modules/domain-node/src/main/java/org/apache/tuscany/sca/impl/DeployedComposite.java b/sca-java-2.x/trunk/modules/domain-node/src/main/java/org/apache/tuscany/sca/impl/DeployedComposite.java index c82fc3a81c..923a12c9b1 100644 --- a/sca-java-2.x/trunk/modules/domain-node/src/main/java/org/apache/tuscany/sca/impl/DeployedComposite.java +++ b/sca-java-2.x/trunk/modules/domain-node/src/main/java/org/apache/tuscany/sca/impl/DeployedComposite.java @@ -45,14 +45,13 @@ public class DeployedComposite { private Composite composite; private InstalledContribution installedContribution; private List<Contribution> dependedOnContributions; - private Composite domainComposite; // TODO: this is misleadingly named + private Composite builtComposite; private CompositeActivator compositeActivator; private CompositeContext compositeContext; private Deployer deployer; private EndpointRegistry endpointRegistry; private ExtensionPointRegistry extensionPointRegistry; - private Contribution systemContribution; public DeployedComposite(Composite composite, InstalledContribution ic, @@ -83,35 +82,29 @@ public class DeployedComposite { contribution.add(installedContribution.getContribution()); contribution.get(0).getDeployables().clear(); contribution.get(0).getDeployables().add(composite); - - + Monitor monitor = deployer.createMonitor(); - if (systemContribution == null) { - this.systemContribution = deployer.cloneSystemContribution(monitor); - } - domainComposite = deployer.build(contribution, dependedOnContributions, systemContribution, new HashMap<QName, List<String>>(), monitor); + builtComposite = deployer.build(contribution, dependedOnContributions, new HashMap<QName, List<String>>(), monitor); monitor.analyzeProblems(); compositeContext = new CompositeContext(extensionPointRegistry, endpointRegistry, - domainComposite, + builtComposite, null, // nothing appears to use the domain name in CompositeContext null, // don't need node uri deployer.getSystemDefinitions()); - start(); - this.uri = getCompositeURI(composite, installedContribution); } public void start() throws ActivationException { - compositeActivator.activate(compositeContext, domainComposite); - compositeActivator.start(compositeContext, domainComposite); + compositeActivator.activate(compositeContext, builtComposite); + compositeActivator.start(compositeContext, builtComposite); } public void stop() throws ActivationException { - compositeActivator.stop(compositeContext, domainComposite); - compositeActivator.deactivate(domainComposite); + compositeActivator.stop(compositeContext, builtComposite); + compositeActivator.deactivate(builtComposite); } public String getURI() { diff --git a/sca-java-2.x/trunk/modules/domain-node/src/main/java/org/apache/tuscany/sca/impl/InstalledContribution.java b/sca-java-2.x/trunk/modules/domain-node/src/main/java/org/apache/tuscany/sca/impl/InstalledContribution.java index d3a2526ab9..d781fc0c77 100644 --- a/sca-java-2.x/trunk/modules/domain-node/src/main/java/org/apache/tuscany/sca/impl/InstalledContribution.java +++ b/sca-java-2.x/trunk/modules/domain-node/src/main/java/org/apache/tuscany/sca/impl/InstalledContribution.java @@ -66,6 +66,12 @@ public class InstalledContribution { public List<String> getDependentContributionURIs() { return dependentContributionURIs; } + + public void start(DeployedComposite composite) throws ActivationException { + composite.start(); + startedComposites.put(composite.getURI(), composite); + } + public void stop(String compositeURI) throws ActivationException { DeployedComposite dc = startedComposites.remove(compositeURI); if (dc == null) { @@ -75,15 +81,11 @@ public class InstalledContribution { stoppedComposites.put(compositeURI, dc); } - public void start(DeployedComposite composite) { - startedComposites.put(composite.getURI(), composite); - } - public boolean restart(String compositeURI) throws ActivationException { DeployedComposite dc = stoppedComposites.remove(compositeURI); if (dc != null) { dc.start(); - startedComposites.put(dc.getURI(), dc); + startedComposites.put(compositeURI, dc); } return dc != null; } diff --git a/sca-java-2.x/trunk/modules/domain-node/src/main/java/org/apache/tuscany/sca/impl/NodeImpl.java b/sca-java-2.x/trunk/modules/domain-node/src/main/java/org/apache/tuscany/sca/impl/NodeImpl.java index 19e05f9408..b1d1c97e61 100644 --- a/sca-java-2.x/trunk/modules/domain-node/src/main/java/org/apache/tuscany/sca/impl/NodeImpl.java +++ b/sca-java-2.x/trunk/modules/domain-node/src/main/java/org/apache/tuscany/sca/impl/NodeImpl.java @@ -74,11 +74,11 @@ public class NodeImpl implements Node { private String domainName; private Deployer deployer; - private Map<String, InstalledContribution> installedContributions = new HashMap<String, InstalledContribution>(); private CompositeActivator compositeActivator; private EndpointRegistry endpointRegistry; private ExtensionPointRegistry extensionPointRegistry; private TuscanyRuntime tuscanyRuntime; + private Map<String, InstalledContribution> installedContributions = new HashMap<String, InstalledContribution>(); private static Map<String, Node> allNodes = new HashMap<String, Node>(); |