diff options
author | antelder <antelder@13f79535-47bb-0310-9956-ffa450edef68> | 2011-06-28 07:02:58 +0000 |
---|---|---|
committer | antelder <antelder@13f79535-47bb-0310-9956-ffa450edef68> | 2011-06-28 07:02:58 +0000 |
commit | 303c0a330f1413beb1e980b3b999e96e625e3620 (patch) | |
tree | b3aebc0f40dde379bae075d9295739489a190973 /sca-java-2.x/trunk/modules/domain-node/src/main/java | |
parent | 12589a56d3e6b13592231d75c2fa26ccfa06977a (diff) |
Add some guards around setting the contribution classloader
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@1140455 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'sca-java-2.x/trunk/modules/domain-node/src/main/java')
-rw-r--r-- | sca-java-2.x/trunk/modules/domain-node/src/main/java/org/apache/tuscany/sca/impl/DeployedComposite.java | 10 |
1 files changed, 8 insertions, 2 deletions
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 871c2fef06..ade7284628 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 @@ -36,6 +36,7 @@ import org.apache.tuscany.sca.contribution.Contribution; import org.apache.tuscany.sca.contribution.processor.ContributionResolveException; import org.apache.tuscany.sca.contribution.resolver.ClassReference; import org.apache.tuscany.sca.contribution.resolver.ExtensibleModelResolver; +import org.apache.tuscany.sca.contribution.resolver.ModelResolver; import org.apache.tuscany.sca.core.ExtensionPointRegistry; import org.apache.tuscany.sca.deployment.Deployer; import org.apache.tuscany.sca.monitor.Monitor; @@ -106,8 +107,13 @@ public class DeployedComposite { builtComposite.setURI(composite.getURI()); builtComposite.setContributionURI(composite.getContributionURI()); - if (contribution.getClassLoader() == null) { - contribution.setClassLoader((ClassLoader)((ExtensibleModelResolver)contribution.getModelResolver()).getModelResolverInstance(ClassReference.class)); + // attempt to ensure the contribution classloader is set + // TODO: ideally the runtime would do this itself + if (contribution.getClassLoader() == null && contribution.getModelResolver() instanceof ExtensibleModelResolver) { + ModelResolver o = ((ExtensibleModelResolver)contribution.getModelResolver()).getModelResolverInstance(ClassReference.class); + if (o instanceof ClassLoader) { + contribution.setClassLoader((ClassLoader)o); + } } compositeContext = new CompositeContext(extensionPointRegistry, |