From 6dc5802b6c00157a8f3d3dd470c700ebcf7712b3 Mon Sep 17 00:00:00 2001 From: antelder Date: Fri, 13 May 2011 08:35:15 +0000 Subject: Add code to find the contribution attributes when installing a contribution git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@1102609 13f79535-47bb-0310-9956-ffa450edef68 --- .../java/org/apache/tuscany/sca/impl/NodeImpl.java | 26 ++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'sca-java-2.x/trunk/modules/domain-node/src/main') 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 41f6bc9f1a..6688a9f2d6 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 @@ -108,14 +108,40 @@ public class NodeImpl implements Node { org.apache.tuscany.sca.runtime.InstalledContribution ic = new org.apache.tuscany.sca.runtime.InstalledContribution(); ic.setURI(uri); ic.setURL(contributionURL); + peekIntoContribution(ic); endpointRegistry.installContribution(ic); if (startDeployables) { + for (String compositeURI : ic.getDeployables()) { + start(uri, compositeURI); + } // TODO: sort out metadata and dependents in distributed localInstall(uri, contributionURL, metaDataURL, dependentContributionURIs, startDeployables); } return uri; } + /** + * ASM12032 and ASM12033 say no error checking should be done during install and that should happen later, but + * we would still like to know about deployables and exports so peek into the contribution to try to get those, + * and just ignore any errors they might happen while doing that. + */ + protected void peekIntoContribution(org.apache.tuscany.sca.runtime.InstalledContribution ic) { + Contribution contribution = null; + try { + contribution = deployer.loadContribution(IOHelper.createURI(ic.getURI()), IOHelper.getLocationAsURL(ic.getURI()), deployer.createMonitor()); + } catch (Exception e) { + // ignore any errors + } + if (contribution != null) { + for (Composite composite : contribution.getDeployables()) { + ic.getDeployables().add(composite.getURI()); + } + // TODO: need to sort out if Export or xml goes in the reg +// for (Export e : contribution.getExports()) { +// } + } + } + private void localInstall(String uri, String contributionURL, String metaDataURL, List dependentContributionURIs, boolean startDeployables) throws ContributionReadException, ValidationException, ActivationException { Monitor monitor = deployer.createMonitor(); Contribution contribution = deployer.loadContribution(IOHelper.createURI(uri), IOHelper.getLocationAsURL(contributionURL), monitor); -- cgit v1.2.3