summaryrefslogtreecommitdiffstats
path: root/sca-java-2.x/trunk/modules/domain-node/src/main/java/org/apache/tuscany/sca/impl/ServiceHelper.java
diff options
context:
space:
mode:
Diffstat (limited to 'sca-java-2.x/trunk/modules/domain-node/src/main/java/org/apache/tuscany/sca/impl/ServiceHelper.java')
-rw-r--r--sca-java-2.x/trunk/modules/domain-node/src/main/java/org/apache/tuscany/sca/impl/ServiceHelper.java26
1 files changed, 26 insertions, 0 deletions
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 3ada1bbbb1..274b15d063 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
@@ -45,10 +45,12 @@ 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.ContributionDescription;
+import org.apache.tuscany.sca.runtime.DOMInvoker;
import org.apache.tuscany.sca.runtime.DomainRegistry;
import org.apache.tuscany.sca.runtime.RuntimeComponent;
import org.apache.tuscany.sca.runtime.RuntimeComponentReference;
import org.apache.tuscany.sca.runtime.RuntimeEndpointReference;
+import org.apache.tuscany.sca.runtime.TuscanyServiceReference;
import org.oasisopen.sca.NoSuchServiceException;
import org.oasisopen.sca.ServiceRuntimeException;
import org.oasisopen.sca.annotation.Remotable;
@@ -85,6 +87,30 @@ public class ServiceHelper {
}
}
+ public static DOMInvoker getDOMInvoker(String serviceURI, DomainRegistry domainRegistry, ExtensionPointRegistry extensionPointRegistry, Deployer deployer) throws NoSuchServiceException {
+
+ List<Endpoint> endpoints = domainRegistry.findEndpoint(serviceURI);
+ if (endpoints.size() < 1) {
+ throw new NoSuchServiceException(serviceURI);
+ }
+
+ String serviceName = null;
+ if (serviceURI.contains("/")) {
+ int i = serviceURI.indexOf("/");
+ if (i < serviceURI.length() - 1) {
+ serviceName = serviceURI.substring(i + 1);
+ }
+ }
+
+ Endpoint ep = endpoints.get(0);
+ if (((RuntimeComponent)ep.getComponent()).getComponentContext() != null) {
+ return ((TuscanyServiceReference<?>)((RuntimeComponent)ep.getComponent()).getServiceReference(null, serviceName)).getDOMInvoker();
+ } else {
+ throw new NoSuchServiceException(serviceURI);
+// return getRemoteProxy(interfaze, ep, domainRegistry, extensionPointRegistry, deployer);
+ }
+ }
+
private static <T> T getRemoteProxy(Class<T> serviceInterface, Endpoint endpoint, DomainRegistry domainRegistry, ExtensionPointRegistry extensionPointRegistry, Deployer deployer) throws NoSuchServiceException {
FactoryExtensionPoint factories = extensionPointRegistry.getExtensionPoint(FactoryExtensionPoint.class);
AssemblyFactory assemblyFactory = factories.getFactory(AssemblyFactory.class);