diff options
Diffstat (limited to '')
3 files changed, 34 insertions, 3 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 5a72906e1e..7eba965b1a 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 @@ -86,6 +86,7 @@ public class DeployedComposite { // TODO: Ideally deployer.build would set the name and uri to what this needs builtComposite.setName(composite.getName()); builtComposite.setURI(composite.getURI()); + builtComposite.setContributionURI(composite.getContributionURI()); monitor.analyzeProblems(); compositeContext = new CompositeContext(extensionPointRegistry, 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 d1448f498d..1b4f0a103f 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 @@ -261,7 +261,10 @@ public class NodeImpl implements Node { public void stopComposite(String contributionURI, String compositeURI) throws ActivationException { String key = contributionURI+"/"+compositeURI; DeployedComposite dc = startedComposites.remove(key); - if (dc == null) { + if (dc != null) { + dc.stop(); + stoppedComposites.put(key, dc); + } else { String member = domainRegistry.getRunningMember(contributionURI, compositeURI); if (member == null) { throw new IllegalStateException("composite not started: " + compositeURI); @@ -272,8 +275,6 @@ public class NodeImpl implements Node { throw new ActivationException(response); } } - dc.stop(); - stoppedComposites.put(key, dc); } public String getDomainName() { diff --git a/sca-java-2.x/trunk/modules/domain-node/src/main/java/org/apache/tuscany/sca/impl/ServiceHelper.java b/sca-java-2.x/trunk/modules/domain-node/src/main/java/org/apache/tuscany/sca/impl/ServiceHelper.java index 42a550d543..fc46018904 100644 --- a/sca-java-2.x/trunk/modules/domain-node/src/main/java/org/apache/tuscany/sca/impl/ServiceHelper.java +++ b/sca-java-2.x/trunk/modules/domain-node/src/main/java/org/apache/tuscany/sca/impl/ServiceHelper.java @@ -19,8 +19,13 @@ package org.apache.tuscany.sca.impl;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.net.URLClassLoader;
import java.util.List;
+import javax.xml.bind.JAXBElement;
+
import org.apache.tuscany.sca.assembly.AssemblyFactory;
import org.apache.tuscany.sca.assembly.Component;
import org.apache.tuscany.sca.assembly.ComponentReference;
@@ -42,6 +47,7 @@ import org.apache.tuscany.sca.interfacedef.InvalidInterfaceException; import org.apache.tuscany.sca.interfacedef.java.JavaInterface;
import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory;
import org.apache.tuscany.sca.runtime.DomainRegistry;
+import org.apache.tuscany.sca.runtime.ContributionDescription;
import org.apache.tuscany.sca.runtime.RuntimeComponent;
import org.apache.tuscany.sca.runtime.RuntimeComponentReference;
import org.apache.tuscany.sca.runtime.RuntimeEndpointReference;
@@ -89,6 +95,14 @@ public class ServiceHelper { new CompositeContext(extensionPointRegistry, domainRegistry, null, null, null,
deployer.getSystemDefinitions());
+ if (serviceInterface == null) {
+ try {
+ serviceInterface = (Class<T>)findInterface(endpoint, domainRegistry);
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
+ }
+
RuntimeEndpointReference epr;
try {
epr =
@@ -170,6 +184,8 @@ public class ServiceHelper { // The interface is not assignable from the interface contract
interfaceContract = javaInterfaceFactory.createJavaInterfaceContract();
JavaInterface callInterface = javaInterfaceFactory.createJavaInterface(businessInterface);
+ callInterface.setRemotable(true);
+ callInterface.resetDataBinding(JAXBElement.class.getName());
interfaceContract.setInterface(callInterface);
if (callInterface.getCallbackClass() != null) {
interfaceContract.setCallbackInterface(javaInterfaceFactory.createJavaInterface(callInterface
@@ -179,4 +195,17 @@ public class ServiceHelper { return interfaceContract;
}
+
+ private static Class<?> findInterface(Endpoint endpoint, DomainRegistry domainRegistry) throws MalformedURLException, ClassNotFoundException {
+ Interface iface = endpoint.getService().getInterfaceContract().getInterface();
+ if (iface instanceof JavaInterface) {
+ String curi = domainRegistry.getContainingCompositesContributionURI(endpoint.getComponent().getName());
+ if (curi != null) {
+ ContributionDescription ic = domainRegistry.getInstalledContribution(curi);
+ ClassLoader cl = new URLClassLoader(new URL[]{new URL(ic.getURL())});
+ return cl.loadClass(((JavaInterface)iface).getName());
+ }
+ }
+ return null;
+ }
}
|