From dd12ee8541124f96a3b28868b65c6b2711300c1f Mon Sep 17 00:00:00 2001 From: rfeng Date: Mon, 7 Jul 2008 23:51:06 +0000 Subject: 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 --- .../apache/tuscany/sca/host/corba/CorbaHost.java | 29 +++++++++- .../tuscany/sca/host/corba/CorbaHostException.java | 2 +- .../tuscany/sca/host/corba/CorbanameDetails.java | 66 ++++++++++++++++++++++ .../sca/host/corba/ExtensibleCorbaHost.java | 17 +++++- 4 files changed, 109 insertions(+), 5 deletions(-) create mode 100644 java/sca/modules/host-corba/src/main/java/org/apache/tuscany/sca/host/corba/CorbanameDetails.java (limited to 'java/sca/modules/host-corba/src') 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 @@ -43,6 +43,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 @@ -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 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 getNamePath() { + return namePath; + } + + public void setNamePath(List 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()) { -- cgit v1.2.3