summaryrefslogtreecommitdiffstats
path: root/java/sca/modules
diff options
context:
space:
mode:
authorrfeng <rfeng@13f79535-47bb-0310-9956-ffa450edef68>2008-07-07 23:51:06 +0000
committerrfeng <rfeng@13f79535-47bb-0310-9956-ffa450edef68>2008-07-07 23:51:06 +0000
commitdd12ee8541124f96a3b28868b65c6b2711300c1f (patch)
treefcb6c7d7c4cfd90b9815385901aa5e4be7e16315 /java/sca/modules
parent27b4bbd53cac91a2797de96685912fbf788ad967 (diff)
Apply the patApply the patch from Wojtek for TUSCANY-2397. Thanks. (corbaname.patch)
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@674676 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'java/sca/modules')
-rw-r--r--java/sca/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/CorbaReferenceBindingProvider.java16
-rw-r--r--java/sca/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/CorbaServiceBindingProvider.java16
-rw-r--r--java/sca/modules/host-corba-jdk/src/main/java/org/apache/tuscany/sca/host/corba/jdk/DefaultCorbaHost.java94
-rw-r--r--java/sca/modules/host-corba-jdk/src/test/java/org/apache/tuscany/sca/host/corba/testing/DefaultCorbaHostTestCase.java126
-rw-r--r--java/sca/modules/host-corba/src/main/java/org/apache/tuscany/sca/host/corba/CorbaHost.java29
-rw-r--r--java/sca/modules/host-corba/src/main/java/org/apache/tuscany/sca/host/corba/CorbaHostException.java2
-rw-r--r--java/sca/modules/host-corba/src/main/java/org/apache/tuscany/sca/host/corba/CorbanameDetails.java66
-rw-r--r--java/sca/modules/host-corba/src/main/java/org/apache/tuscany/sca/host/corba/ExtensibleCorbaHost.java17
8 files changed, 315 insertions, 51 deletions
diff --git a/java/sca/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/CorbaReferenceBindingProvider.java b/java/sca/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/CorbaReferenceBindingProvider.java
index 50247de0db..cc78cacdbb 100644
--- a/java/sca/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/CorbaReferenceBindingProvider.java
+++ b/java/sca/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/CorbaReferenceBindingProvider.java
@@ -21,15 +21,13 @@ package org.apache.tuscany.sca.binding.corba.impl;
import org.apache.tuscany.sca.binding.corba.CorbaBinding;
import org.apache.tuscany.sca.host.corba.CorbaHost;
-import org.apache.tuscany.sca.host.corba.CorbaHostException;
+import org.apache.tuscany.sca.host.corba.CorbaHostUtils;
import org.apache.tuscany.sca.interfacedef.InterfaceContract;
import org.apache.tuscany.sca.interfacedef.Operation;
import org.apache.tuscany.sca.invocation.Invoker;
import org.apache.tuscany.sca.provider.ReferenceBindingProvider;
import org.apache.tuscany.sca.runtime.RuntimeComponentReference;
-import org.omg.CORBA.ORB;
import org.omg.CORBA.Object;
-import org.osoa.sca.ServiceRuntimeException;
/**
* @version $Rev$ $Date$
@@ -40,17 +38,11 @@ public class CorbaReferenceBindingProvider implements ReferenceBindingProvider {
private CorbaHost host;
private RuntimeComponentReference reference;
private Object remoteObject;
- private ORB orb;
public CorbaReferenceBindingProvider(CorbaBinding binding, CorbaHost host, RuntimeComponentReference reference) {
this.binding = binding;
this.host = host;
this.reference = reference;
- try {
- this.orb = host.createORB(binding.getHost(), binding.getPort(), false);
- } catch (CorbaHostException e) {
- throw new ServiceRuntimeException(e);
- }
}
/**
@@ -59,7 +51,11 @@ public class CorbaReferenceBindingProvider implements ReferenceBindingProvider {
public Invoker createInvoker(Operation operation) {
try {
if (remoteObject == null) {
- remoteObject = host.lookup(orb, binding.getName());
+ if (CorbaHostUtils.isValidCorbanameURI(binding.getURI())) {
+ remoteObject = host.lookup(binding.getURI());
+ } else {
+ remoteObject = host.lookup(binding.getName(), binding.getHost(), binding.getPort());
+ }
}
return new CorbaInvoker(remoteObject);
} catch (Exception e) {
diff --git a/java/sca/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/CorbaServiceBindingProvider.java b/java/sca/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/CorbaServiceBindingProvider.java
index ec752a1638..1d21fe1e25 100644
--- a/java/sca/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/CorbaServiceBindingProvider.java
+++ b/java/sca/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/CorbaServiceBindingProvider.java
@@ -22,6 +22,7 @@ package org.apache.tuscany.sca.binding.corba.impl;
import org.apache.tuscany.sca.binding.corba.CorbaBinding;
import org.apache.tuscany.sca.binding.corba.impl.service.DynaCorbaServant;
import org.apache.tuscany.sca.host.corba.CorbaHost;
+import org.apache.tuscany.sca.host.corba.CorbaHostUtils;
import org.apache.tuscany.sca.interfacedef.InterfaceContract;
import org.apache.tuscany.sca.provider.ServiceBindingProvider;
import org.apache.tuscany.sca.runtime.RuntimeComponentService;
@@ -57,10 +58,15 @@ public class CorbaServiceBindingProvider implements ServiceBindingProvider {
*/
public void start() {
try {
- this.orb = host.createORB(binding.getHost(), binding.getPort(), false);
+
servant = new DynaCorbaServant(service, binding);
servant.setIds(new String[] {binding.getId()});
- host.registerServant(orb, binding.getName(), servant);
+ if (CorbaHostUtils.isValidCorbanameURI(binding.getURI())) {
+ host.registerServant(binding.getURI(), servant);
+ } else {
+ orb = host.createORB(binding.getHost(), binding.getPort(), false);
+ host.registerServant(orb, binding.getName(), servant);
+ }
} catch (Exception e) {
throw new ServiceRuntimeException(e);
}
@@ -72,7 +78,11 @@ public class CorbaServiceBindingProvider implements ServiceBindingProvider {
*/
public void stop() {
try {
- host.unregisterServant(orb, binding.getName());
+ if (CorbaHostUtils.isValidCorbanameURI(binding.getURI())) {
+ host.unregisterServant(binding.getURI());
+ } else if (orb != null) {
+ host.unregisterServant(orb, binding.getName());
+ }
} catch (Exception e) {
throw new ServiceRuntimeException(e);
}
diff --git a/java/sca/modules/host-corba-jdk/src/main/java/org/apache/tuscany/sca/host/corba/jdk/DefaultCorbaHost.java b/java/sca/modules/host-corba-jdk/src/main/java/org/apache/tuscany/sca/host/corba/jdk/DefaultCorbaHost.java
index 2e6d319810..d772a066f3 100644
--- a/java/sca/modules/host-corba-jdk/src/main/java/org/apache/tuscany/sca/host/corba/jdk/DefaultCorbaHost.java
+++ b/java/sca/modules/host-corba-jdk/src/main/java/org/apache/tuscany/sca/host/corba/jdk/DefaultCorbaHost.java
@@ -19,19 +19,26 @@
package org.apache.tuscany.sca.host.corba.jdk;
+import java.util.ArrayList;
+import java.util.List;
import java.util.Map;
import java.util.Properties;
+import java.util.StringTokenizer;
import java.util.concurrent.ConcurrentHashMap;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.apache.tuscany.sca.host.corba.CorbaHost;
import org.apache.tuscany.sca.host.corba.CorbaHostException;
+import org.apache.tuscany.sca.host.corba.CorbaHostUtils;
+import org.apache.tuscany.sca.host.corba.CorbanameDetails;
import org.omg.CORBA.ORB;
import org.omg.CORBA.Object;
import org.omg.CosNaming.NameComponent;
+import org.omg.CosNaming.NamingContext;
import org.omg.CosNaming.NamingContextExt;
import org.omg.CosNaming.NamingContextExtHelper;
+import org.omg.CosNaming.NamingContextHelper;
import org.omg.CosNaming.NamingContextPackage.InvalidName;
import org.omg.CosNaming.NamingContextPackage.NotFound;
@@ -55,8 +62,8 @@ public class DefaultCorbaHost implements CorbaHost {
}
}
- private NamingContextExt getNamingContext(ORB orb) throws Exception {
- org.omg.CORBA.Object objRef = orb.resolve_initial_references("NameService");
+ private NamingContextExt getNamingContext(ORB orb, String nameService) throws Exception {
+ org.omg.CORBA.Object objRef = orb.resolve_initial_references(nameService);
return NamingContextExtHelper.narrow(objRef);
}
@@ -71,18 +78,49 @@ public class DefaultCorbaHost implements CorbaHost {
}
}
+ private List<String> tokenizeNamePath(String name) {
+ List<String> namePath = new ArrayList<String>();
+ StringTokenizer path = new StringTokenizer(name, "/");
+ while (path.hasMoreTokens()) {
+ namePath.add(path.nextToken());
+ }
+ return namePath;
+ }
+
+ public void registerServant(String uri, Object servantObject) throws CorbaHostException {
+ CorbanameDetails details = CorbaHostUtils.getServiceDetails(uri);
+ ORB orb = createORB(details.getHost(), details.getPort(), false);
+ registerServantCommon(orb, details.getNameService(), details.getNamePath(), servantObject);
+ }
+
public void registerServant(ORB orb, String name, Object servantObject) throws CorbaHostException {
validateName(name);
+ List<String> namePath = tokenizeNamePath(name);
+ registerServantCommon(orb, CorbaHostUtils.DEFAULT_NAME_SERVICE, namePath, servantObject);
+ }
+
+ private void registerServantCommon(ORB orb, String nameService, List<String> namePath, Object servantObject)
+ throws CorbaHostException {
+
try {
- NamingContextExt ncRef = getNamingContext(orb);
- NameComponent[] path = ncRef.to_name(name);
+ NamingContext namingCtx = getNamingContext(orb, nameService);
+ for (int i = 0; i < namePath.size() - 1; i++) {
+ NameComponent nc = new NameComponent(namePath.get(i), "");
+ NameComponent[] path = new NameComponent[] {nc};
+ try {
+ namingCtx = NamingContextHelper.narrow(namingCtx.resolve(path));
+ } catch (Exception e) {
+ namingCtx = namingCtx.bind_new_context(path);
+ }
+ }
+ NameComponent finalName = new NameComponent(namePath.get(namePath.size() - 1), "");
try {
- ncRef.resolve(path);
+ namingCtx.resolve(new NameComponent[] {finalName});
// no exception means that some object is already registered
// under this name, we need to crash here
throw new CorbaHostException(CorbaHostException.BINDING_IN_USE);
} catch (NotFound e) {
- ncRef.bind(path, servantObject);
+ namingCtx.bind(new NameComponent[] {finalName}, servantObject);
}
} catch (CorbaHostException e) {
throw e;
@@ -91,27 +129,49 @@ public class DefaultCorbaHost implements CorbaHost {
}
}
+ public void unregisterServant(String uri) throws CorbaHostException {
+ CorbanameDetails details = CorbaHostUtils.getServiceDetails(uri);
+ ORB orb = createORB(details.getHost(), details.getPort(), false);
+ unregisterServantCommon(orb, details.getNamePath());
+ }
+
public void unregisterServant(ORB orb, String name) throws CorbaHostException {
validateName(name);
+ List<String> namePath = tokenizeNamePath(name);
+ unregisterServantCommon(orb, namePath);
+ }
+
+ private void unregisterServantCommon(ORB orb, List<String> namePath) throws CorbaHostException {
try {
- NamingContextExt ncRef = getNamingContext(orb);
- NameComponent[] path = ncRef.to_name(name);
- ncRef.unbind(path);
+ NamingContext namingCtx = getNamingContext(orb, CorbaHostUtils.DEFAULT_NAME_SERVICE);
+ for (int i = 0; i < namePath.size() - 1; i++) {
+ NameComponent nc = new NameComponent(namePath.get(i), "");
+ namingCtx = NamingContextHelper.narrow(namingCtx.resolve(new NameComponent[] {nc}));
+ }
+ NameComponent finalName = new NameComponent(namePath.get(namePath.size() - 1), "");
+ namingCtx.unbind(new NameComponent[] {finalName});
} catch (Exception e) {
handleException(e);
}
}
- public Object lookup(ORB orb, String name) throws CorbaHostException {
+ public Object lookup(String name, String host, int port) throws CorbaHostException {
validateName(name);
+ return lookup(CorbaHostUtils.createCorbanameURI(name, host, port));
+ }
+
+ public Object lookup(String uri) throws CorbaHostException {
Object result = null;
try {
- NamingContextExt ncRef = getNamingContext(orb);
- NameComponent[] path = ncRef.to_name(name);
- result = ncRef.resolve(path);
+ ORB orb = ORB.init(new String[0], null);
+ result = orb.string_to_object(uri);
} catch (Exception e) {
+ e.printStackTrace();
handleException(e);
}
+ if (result == null) {
+ throw new CorbaHostException(CorbaHostException.NO_SUCH_OBJECT);
+ }
return result;
}
@@ -134,14 +194,16 @@ public class DefaultCorbaHost implements CorbaHost {
// STEP 1: Set ORBPeristentServerPort property
// Set the proprietary property to open up a port to listen to
- // INS requests.
+ // INS requests.
if (server) {
props.put("com.sun.CORBA.POA.ORBPersistentServerPort", portStr);
props.put("com.ibm.CORBA.ListenerPort", portStr);
props.put("gnu.CORBA.ListenerPort", portStr);
- // props.put("org.omg.CORBA.ORBClass", "org.apache.yoko.orb.CORBA.ORB");
- // props.put("org.omg.CORBA.ORBSingletonClass", "org.apache.yoko.orb.CORBA.ORBSingleton");
+ // props.put("org.omg.CORBA.ORBClass",
+ // "org.apache.yoko.orb.CORBA.ORB");
+ // props.put("org.omg.CORBA.ORBSingletonClass",
+ // "org.apache.yoko.orb.CORBA.ORBSingleton");
props.put("yoko.orb.oa.endpoint", "iiop --host " + host + " --port " + port);
props.put("yoko.orb.poamanager.TNameService.endpoint", "iiop --host " + host);
}
diff --git a/java/sca/modules/host-corba-jdk/src/test/java/org/apache/tuscany/sca/host/corba/testing/DefaultCorbaHostTestCase.java b/java/sca/modules/host-corba-jdk/src/test/java/org/apache/tuscany/sca/host/corba/testing/DefaultCorbaHostTestCase.java
index c78c81ba70..df804a526b 100644
--- a/java/sca/modules/host-corba-jdk/src/test/java/org/apache/tuscany/sca/host/corba/testing/DefaultCorbaHostTestCase.java
+++ b/java/sca/modules/host-corba-jdk/src/test/java/org/apache/tuscany/sca/host/corba/testing/DefaultCorbaHostTestCase.java
@@ -28,6 +28,7 @@ import java.net.Socket;
import org.apache.tuscany.sca.host.corba.CorbaHost;
import org.apache.tuscany.sca.host.corba.CorbaHostException;
+import org.apache.tuscany.sca.host.corba.CorbaHostUtils;
import org.apache.tuscany.sca.host.corba.jdk.DefaultCorbaHost;
import org.apache.tuscany.sca.host.corba.naming.TransientNameServer;
import org.apache.tuscany.sca.host.corba.naming.TransientNameService;
@@ -46,8 +47,8 @@ import org.omg.CORBA.ORB;
public class DefaultCorbaHostTestCase {
private static final String LOCALHOST = "localhost";
- private static final int DEFAULT_PORT = 11100; //1050;
-
+ private static final int DEFAULT_PORT = 11100; // 1050;
+
private static CorbaHost host;
private static TransientNameServer server;
@@ -72,23 +73,32 @@ public class DefaultCorbaHostTestCase {
server.stop();
}
+ private static String getURI(String name, String host, int port) {
+ return "corbaname::" + host + ":" + port + "#" + name;
+ }
+
/**
- * Tests registering, getting and unregistering CORBA object
+ * Tests registering and lookup CORBA services
*/
@Test
public void test_registerServant() {
try {
+ /**
+ * Tests using servant registered with name, host, port
+ */
ORB orb = host.createORB(LOCALHOST, DEFAULT_PORT, false);
TestInterface servant = new TestInterfaceServant();
- host.registerServant(orb, "Test", servant);
+ String objName = "Nested/Test";
+ String uri = CorbaHostUtils.createCorbanameURI(objName, LOCALHOST, DEFAULT_PORT);
+ host.registerServant(orb, objName, servant);
- TestInterface ref = TestInterfaceHelper.narrow(host.lookup(orb, "Test"));
+ // lookup using name, host and port
+ TestInterface ref = TestInterfaceHelper.narrow(host.lookup(objName, LOCALHOST, DEFAULT_PORT));
assertEquals(2, ref.getInt(2));
- host.unregisterServant(orb, "Test");
-
- //register servant once again to check if previous name was released
- host.registerServant(orb, "Test", servant);
+ // lookup using corbaname URI
+ ref = TestInterfaceHelper.narrow(host.lookup(uri));
+ assertEquals(2, ref.getInt(2));
} catch (Exception e) {
e.printStackTrace();
fail();
@@ -96,15 +106,69 @@ public class DefaultCorbaHostTestCase {
}
/**
+ * Tests unregistering servants
+ */
+ @Test
+ public void test_unregisterServant() {
+ try {
+ String objName = "Unregistering/Test";
+ ORB orb = host.createORB(LOCALHOST, DEFAULT_PORT, false);
+ String uri = CorbaHostUtils.createCorbanameURI(objName, LOCALHOST, DEFAULT_PORT);
+ TestInterface servant = new TestInterfaceServant();
+
+ // creating and releasing using name, host, port
+ host.registerServant(orb, objName, servant);
+ host.unregisterServant(orb, objName);
+ host.registerServant(orb, objName, servant);
+ host.unregisterServant(orb, objName);
+
+ // creating and releasing using corbaname URI
+ host.registerServant(uri, servant);
+ host.unregisterServant(uri);
+ host.registerServant(uri, servant);
+ host.unregisterServant(uri);
+
+ // creating using name, host, port, releasing using corbaname URI
+ host.registerServant(orb, objName, servant);
+ host.unregisterServant(uri);
+ host.registerServant(uri, servant);
+ host.unregisterServant(uri);
+
+ // creating using corbaname URI, releasing using name, host, port
+ host.registerServant(uri, servant);
+ host.unregisterServant(orb, objName);
+ host.registerServant(orb, objName, servant);
+ host.unregisterServant(orb, objName);
+ } catch (Exception e) {
+ fail();
+ }
+ }
+
+ /**
* Tests situation when name is already registered
*/
@Test
public void test_nameAlreadyRegistered() {
+ // test using name, host, port
try {
ORB orb = host.createORB(LOCALHOST, DEFAULT_PORT, false);
TestInterface servant = new TestInterfaceServant();
- host.registerServant(orb, "Test", servant);
- host.registerServant(orb, "Test", servant);
+ host.registerServant(orb, "AlreadyRegisteredTest1", servant);
+ host.registerServant(orb, "AlreadyRegisteredTest1", servant);
+ fail();
+ } catch (CorbaHostException e) {
+ assertTrue(e.getMessage().equals(CorbaHostException.BINDING_IN_USE));
+ } catch (Exception e) {
+ e.printStackTrace();
+ fail();
+ }
+
+ // test using URI
+ try {
+ TestInterface servant = new TestInterfaceServant();
+ String uri = CorbaHostUtils.createCorbanameURI("AlreadyRegisteredTest2", LOCALHOST, DEFAULT_PORT);
+ host.registerServant(uri, servant);
+ host.registerServant(uri, servant);
fail();
} catch (CorbaHostException e) {
assertTrue(e.getMessage().equals(CorbaHostException.BINDING_IN_USE));
@@ -119,9 +183,20 @@ public class DefaultCorbaHostTestCase {
*/
@Test
public void test_getNonExistingObject() {
+ // try to fetch object with corbaname URI
try {
- ORB orb = host.createORB(LOCALHOST, DEFAULT_PORT, false);
- host.lookup(orb, "NonExistingReference");
+ host.lookup(getURI("NonExistingOne", LOCALHOST, DEFAULT_PORT));
+ fail();
+ } catch (CorbaHostException e) {
+ assertTrue(e.getMessage().equals(CorbaHostException.NO_SUCH_OBJECT));
+ } catch (Exception e) {
+ e.printStackTrace();
+ fail();
+ }
+
+ // try to fetch object with name, host, port params
+ try {
+ host.lookup("NonExistingOne", LOCALHOST, DEFAULT_PORT);
fail();
} catch (CorbaHostException e) {
assertTrue(e.getMessage().equals(CorbaHostException.NO_SUCH_OBJECT));
@@ -136,6 +211,7 @@ public class DefaultCorbaHostTestCase {
*/
@Test
public void test_unregisterNonExistentObject() {
+ // test using name, host, port
try {
ORB orb = host.createORB(LOCALHOST, DEFAULT_PORT, false);
host.unregisterServant(orb, "NonExistingReference2");
@@ -146,6 +222,18 @@ public class DefaultCorbaHostTestCase {
e.printStackTrace();
fail();
}
+
+ // test using URI
+ try {
+ String uri = CorbaHostUtils.createCorbanameURI("NonExistingReference1", LOCALHOST, DEFAULT_PORT);
+ host.unregisterServant(uri);
+ fail();
+ } catch (CorbaHostException e) {
+ assertTrue(e.getMessage().equals(CorbaHostException.NO_SUCH_OBJECT));
+ } catch (Exception e) {
+ e.printStackTrace();
+ fail();
+ }
}
/**
@@ -202,20 +290,24 @@ public class DefaultCorbaHostTestCase {
fail();
}
}
-
+
@Test
- // @Ignore("Fix stopping ORB")
public void test_ensureORBStopped() {
try {
int innerORBPort = 11102;
- TransientNameServer innerServer = new TransientNameServer(LOCALHOST, innerORBPort, TransientNameService.DEFAULT_SERVICE_NAME);
+ TransientNameServer innerServer =
+ new TransientNameServer(LOCALHOST, innerORBPort, TransientNameService.DEFAULT_SERVICE_NAME);
innerServer.start();
innerServer.stop();
+ try {
+ Thread.sleep(500);
+ } catch (Exception e) {
+ }
new Socket(LOCALHOST, innerORBPort);
fail();
} catch (Exception e) {
if (e instanceof ConnectException) {
- assertTrue(true);
+ assertTrue(true);
} else {
e.printStackTrace();
}
diff --git a/java/sca/modules/host-corba/src/main/java/org/apache/tuscany/sca/host/corba/CorbaHost.java b/java/sca/modules/host-corba/src/main/java/org/apache/tuscany/sca/host/corba/CorbaHost.java
index 1ff0e79cbd..edba92d190 100644
--- a/java/sca/modules/host-corba/src/main/java/org/apache/tuscany/sca/host/corba/CorbaHost.java
+++ b/java/sca/modules/host-corba/src/main/java/org/apache/tuscany/sca/host/corba/CorbaHost.java
@@ -44,6 +44,14 @@ public interface CorbaHost {
void registerServant(ORB orb, String name, Object serviceObject) throws CorbaHostException;
/**
+ * Registers servant in name server.
+ * @param uri corbaname URI
+ * @param serviceObject
+ * @throws CorbaHostException
+ */
+ void registerServant(String uri, Object serviceObject) throws CorbaHostException;
+
+ /**
* Removes servant from name server
* @param orb The ORB instance
* @param name binding name
@@ -52,12 +60,29 @@ public interface CorbaHost {
void unregisterServant(ORB orb, String name) throws CorbaHostException;
/**
- * Gets reference to object
+ * Removes servant from name server
* @param orb The ORB instance
* @param name binding name
+ * @throws CorbaHostException
+ */
+ void unregisterServant(String uri) throws CorbaHostException;
+
+ /**
+ * Gets reference to object
+ * @param name binding name
+ * @param host ORB host name
+ * @param port ORB port
+ * @return
+ * @throws CorbaHostException
+ */
+ Object lookup(String name, String host, int port) throws CorbaHostException;
+
+ /**
+ * Gets reference to object
+ * @param name binding name
* @return objects reference
* @throws CorbaHostException
*/
- Object lookup(ORB orb, String name) throws CorbaHostException;
+ Object lookup(String uri) throws CorbaHostException;
}
diff --git a/java/sca/modules/host-corba/src/main/java/org/apache/tuscany/sca/host/corba/CorbaHostException.java b/java/sca/modules/host-corba/src/main/java/org/apache/tuscany/sca/host/corba/CorbaHostException.java
index 47037a01fc..78e888c8d1 100644
--- a/java/sca/modules/host-corba/src/main/java/org/apache/tuscany/sca/host/corba/CorbaHostException.java
+++ b/java/sca/modules/host-corba/src/main/java/org/apache/tuscany/sca/host/corba/CorbaHostException.java
@@ -27,7 +27,7 @@ public class CorbaHostException extends Exception {
private static final long serialVersionUID = 1L;
public static final String BINDING_IN_USE = "Binding name is already in use";
- public static final String NO_SUCH_OBJECT = "There is no object under given binding name";
+ public static final String NO_SUCH_OBJECT = "There is no object under given location";
public static final String NO_SUCH_HOST = "Couldn't find specified host";
public static final String NO_SUCH_PORT = "Couldn't connect to specified port";
public static final String WRONG_NAME = "Characters used in binding name are illegal";
diff --git a/java/sca/modules/host-corba/src/main/java/org/apache/tuscany/sca/host/corba/CorbanameDetails.java b/java/sca/modules/host-corba/src/main/java/org/apache/tuscany/sca/host/corba/CorbanameDetails.java
new file mode 100644
index 0000000000..ba95c31e5f
--- /dev/null
+++ b/java/sca/modules/host-corba/src/main/java/org/apache/tuscany/sca/host/corba/CorbanameDetails.java
@@ -0,0 +1,66 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.sca.host.corba;
+
+import java.util.List;
+
+/**
+ * Holds corbaname URI details
+ */
+public class CorbanameDetails {
+
+ private String host;
+ private int port;
+ private String nameService;
+ private List<String> namePath;
+
+ public String getHost() {
+ return host;
+ }
+
+ public void setHost(String host) {
+ this.host = host;
+ }
+
+ public int getPort() {
+ return port;
+ }
+
+ public void setPort(int port) {
+ this.port = port;
+ }
+
+ public String getNameService() {
+ return nameService;
+ }
+
+ public void setNameService(String nameService) {
+ this.nameService = nameService;
+ }
+
+ public List<String> getNamePath() {
+ return namePath;
+ }
+
+ public void setNamePath(List<String> namePath) {
+ this.namePath = namePath;
+ }
+
+}
diff --git a/java/sca/modules/host-corba/src/main/java/org/apache/tuscany/sca/host/corba/ExtensibleCorbaHost.java b/java/sca/modules/host-corba/src/main/java/org/apache/tuscany/sca/host/corba/ExtensibleCorbaHost.java
index 630a42ece5..f4196bf401 100644
--- a/java/sca/modules/host-corba/src/main/java/org/apache/tuscany/sca/host/corba/ExtensibleCorbaHost.java
+++ b/java/sca/modules/host-corba/src/main/java/org/apache/tuscany/sca/host/corba/ExtensibleCorbaHost.java
@@ -33,17 +33,30 @@ public class ExtensibleCorbaHost implements CorbaHost {
this.hosts = chep;
}
- public Object lookup(ORB orb, String name) throws CorbaHostException {
- return getCorbaHost().lookup(orb, name);
+ public Object lookup(String uri) throws CorbaHostException {
+ return getCorbaHost().lookup(uri);
+ }
+
+ public Object lookup(String name, String host, int port) throws CorbaHostException {
+ return getCorbaHost().lookup(name, host, port);
}
public void registerServant(ORB orb, String name, Object serviceObject) throws CorbaHostException {
getCorbaHost().registerServant(orb, name, serviceObject);
}
+ public void registerServant(String uri, Object serviceObject) throws CorbaHostException {
+ getCorbaHost().registerServant(uri, serviceObject);
+ }
+
public void unregisterServant(ORB orb, String name) throws CorbaHostException {
getCorbaHost().unregisterServant(orb, name);
}
+
+
+ public void unregisterServant(String uri) throws CorbaHostException {
+ getCorbaHost().unregisterServant(uri);
+ }
protected CorbaHost getCorbaHost() throws CorbaHostException {
if (hosts.getCorbaHosts().isEmpty()) {