diff options
author | jsdelfino <jsdelfino@13f79535-47bb-0310-9956-ffa450edef68> | 2008-09-29 00:50:22 +0000 |
---|---|---|
committer | jsdelfino <jsdelfino@13f79535-47bb-0310-9956-ffa450edef68> | 2008-09-29 00:50:22 +0000 |
commit | 2a7966363348acb2c6f6ad6eaa2308fd4da1f1ae (patch) | |
tree | 60890a3079724b0b7752c2997102e0b9e487ea15 /branches/sca-equinox | |
parent | 4f70240f137fdb1bfe4f5aeb26b664162310958e (diff) |
Ported from trunk and simplified. Support the rmi:// uri for binding.rmi.
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@699932 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'branches/sca-equinox')
18 files changed, 95 insertions, 178 deletions
diff --git a/branches/sca-equinox/demos/bigbank-calculator/src/main/resources/Calculator.composite b/branches/sca-equinox/demos/bigbank-calculator/src/main/resources/Calculator.composite index 851813d31f..fbf2203fae 100644 --- a/branches/sca-equinox/demos/bigbank-calculator/src/main/resources/Calculator.composite +++ b/branches/sca-equinox/demos/bigbank-calculator/src/main/resources/Calculator.composite @@ -27,7 +27,7 @@ <implementation.java class="calculator.CalculatorServiceImpl"/> <service name="CalculatorService">
- <tuscany:binding.rmi host="localhost" port="8099" serviceName="CalculatorRMIService"/>
+ <tuscany:binding.rmi uri="rmi://localhost:8099/CalculatorRMIService"/>
</service>
<reference name="addService" target="AddServiceComponent" />
diff --git a/branches/sca-equinox/demos/bigbank/src/main/resources/BigBank.composite b/branches/sca-equinox/demos/bigbank/src/main/resources/BigBank.composite index 11591308b4..9c1a575573 100644 --- a/branches/sca-equinox/demos/bigbank/src/main/resources/BigBank.composite +++ b/branches/sca-equinox/demos/bigbank/src/main/resources/BigBank.composite @@ -45,7 +45,7 @@ <reference name="stockAcService" target="StockAccountServiceComponent"/> <reference name="calculatorService"> - <tuscany:binding.rmi host="localhost" port="8099" serviceName="CalculatorRMIService"/> + <tuscany:binding.rmi uri="rmi://localhost:8099/CalculatorRMIService"/> </reference> <reference name="stockQuoteService" requires="integrity"> <binding.ws uri="http://localhost:8081/services/StockQuoteWebService"/> diff --git a/branches/sca-equinox/modules/assembly-xml/src/test/resources/org/apache/tuscany/sca/assembly/xml/RMIBindingTest.composite b/branches/sca-equinox/modules/assembly-xml/src/test/resources/org/apache/tuscany/sca/assembly/xml/RMIBindingTest.composite index d29fe85586..2a0bcf0f76 100644 --- a/branches/sca-equinox/modules/assembly-xml/src/test/resources/org/apache/tuscany/sca/assembly/xml/RMIBindingTest.composite +++ b/branches/sca-equinox/modules/assembly-xml/src/test/resources/org/apache/tuscany/sca/assembly/xml/RMIBindingTest.composite @@ -23,7 +23,7 @@ <service name="HelloWorldRmiService" promote="HelloWorldServiceComponent"> <interface.java interface="helloworld.HelloWorldService"/> - <tuscany:binding.rmi host="localhost" port="8099" serviceName="HelloWorldRemoteService" /> + <tuscany:binding.rmi uri="rmi://localhost:8099/HelloWorldRemoteService" /> </service> <component name="HelloWorldServiceComponent"> @@ -37,7 +37,7 @@ <reference name="HelloWorldRmiReference" promote="HelloWorldRmiServiceComponent/extService"> <interface.java interface="helloworld.HelloWorldService"/> - <tuscany:binding.rmi host="localhost" port="8099" serviceName="HelloWorldRemoteService" /> + <tuscany:binding.rmi uri="rmi://localhost:8099/HelloWorldRemoteService" /> </reference> </composite> diff --git a/branches/sca-equinox/modules/assembly-xsd/src/main/resources/tuscany-sca-binding-rmi.xsd b/branches/sca-equinox/modules/assembly-xsd/src/main/resources/tuscany-sca-binding-rmi.xsd index 2697a1ea98..26be6feae5 100644 --- a/branches/sca-equinox/modules/assembly-xsd/src/main/resources/tuscany-sca-binding-rmi.xsd +++ b/branches/sca-equinox/modules/assembly-xsd/src/main/resources/tuscany-sca-binding-rmi.xsd @@ -34,9 +34,6 @@ <any namespace="##targetNamespace" processContents="lax" minOccurs="0" maxOccurs="unbounded"/> </sequence> - <attribute name="host" type="anyURI" use="optional"/> - <attribute name="port" type="int" use="optional"/> - <attribute name="serviceName" type="anyURI" use="required"/> </extension> </complexContent> </complexType> diff --git a/branches/sca-equinox/modules/binding-rmi-runtime/src/main/java/org/apache/tuscany/sca/binding/rmi/provider/RMIBindingInvoker.java b/branches/sca-equinox/modules/binding-rmi-runtime/src/main/java/org/apache/tuscany/sca/binding/rmi/provider/RMIBindingInvoker.java index 62218a1d9c..7754fb5485 100644 --- a/branches/sca-equinox/modules/binding-rmi-runtime/src/main/java/org/apache/tuscany/sca/binding/rmi/provider/RMIBindingInvoker.java +++ b/branches/sca-equinox/modules/binding-rmi-runtime/src/main/java/org/apache/tuscany/sca/binding/rmi/provider/RMIBindingInvoker.java @@ -35,18 +35,14 @@ import org.apache.tuscany.sca.invocation.DataExchangeSemantics; public class RMIBindingInvoker implements Invoker, DataExchangeSemantics { private RMIHost rmiHost; - private String host; - private String port; - private String svcName; + private String uri; private Method remoteMethod; private Remote proxy; - public RMIBindingInvoker(RMIHost rmiHost, String host, String port, String svcName, Method remoteMethod) { + public RMIBindingInvoker(RMIHost rmiHost, String uri, Method remoteMethod) { this.rmiHost = rmiHost; this.remoteMethod = remoteMethod; - this.host = host; - this.port = port; - this.svcName = svcName; + this.uri = uri; } public Message invoke(Message msg) { @@ -67,8 +63,7 @@ public class RMIBindingInvoker implements Invoker, DataExchangeSemantics { public Object invokeTarget(final Object payload) throws InvocationTargetException, SecurityException, NoSuchMethodException, IllegalArgumentException, IllegalAccessException { if (proxy == null) { - proxy = rmiHost.findService(host, port, svcName); - // proxy = Naming.lookup(serviceURI); + proxy = rmiHost.findService(uri); } remoteMethod = proxy.getClass().getMethod(remoteMethod.getName(), remoteMethod.getParameterTypes()); diff --git a/branches/sca-equinox/modules/binding-rmi-runtime/src/main/java/org/apache/tuscany/sca/binding/rmi/provider/RMIReferenceBindingProvider.java b/branches/sca-equinox/modules/binding-rmi-runtime/src/main/java/org/apache/tuscany/sca/binding/rmi/provider/RMIReferenceBindingProvider.java index e5302c2a98..8a368a26c3 100644 --- a/branches/sca-equinox/modules/binding-rmi-runtime/src/main/java/org/apache/tuscany/sca/binding/rmi/provider/RMIReferenceBindingProvider.java +++ b/branches/sca-equinox/modules/binding-rmi-runtime/src/main/java/org/apache/tuscany/sca/binding/rmi/provider/RMIReferenceBindingProvider.java @@ -65,7 +65,7 @@ public class RMIReferenceBindingProvider implements ReferenceBindingProvider { throw new IllegalArgumentException(e); } - return new RMIBindingInvoker(rmiHost, binding.getHost(), binding.getPort(), binding.getServiceName(), remoteMethod); + return new RMIBindingInvoker(rmiHost, binding.getURI(), remoteMethod); } public void start() { diff --git a/branches/sca-equinox/modules/binding-rmi-runtime/src/main/java/org/apache/tuscany/sca/binding/rmi/provider/RMIServiceBindingProvider.java b/branches/sca-equinox/modules/binding-rmi-runtime/src/main/java/org/apache/tuscany/sca/binding/rmi/provider/RMIServiceBindingProvider.java index 73efb47071..4f657103d5 100644 --- a/branches/sca-equinox/modules/binding-rmi-runtime/src/main/java/org/apache/tuscany/sca/binding/rmi/provider/RMIServiceBindingProvider.java +++ b/branches/sca-equinox/modules/binding-rmi-runtime/src/main/java/org/apache/tuscany/sca/binding/rmi/provider/RMIServiceBindingProvider.java @@ -79,7 +79,7 @@ public class RMIServiceBindingProvider implements ServiceBindingProvider { try { - rmiHost.registerService(binding.getServiceName(), getPort(binding.getPort()), rmiProxy); + rmiHost.registerService(binding.getURI(), rmiProxy); } catch (RMIHostException e) { throw new ServiceRuntimeException(e); @@ -87,7 +87,7 @@ public class RMIServiceBindingProvider implements ServiceBindingProvider { } public void stop() { - rmiHost.unregisterService(binding.getServiceName(), getPort(binding.getPort())); + rmiHost.unregisterService(binding.getURI()); } private int getPort(String port) { diff --git a/branches/sca-equinox/modules/binding-rmi-runtime/src/test/resources/RMIBindingTest.composite b/branches/sca-equinox/modules/binding-rmi-runtime/src/test/resources/RMIBindingTest.composite index d29fe85586..2a0bcf0f76 100644 --- a/branches/sca-equinox/modules/binding-rmi-runtime/src/test/resources/RMIBindingTest.composite +++ b/branches/sca-equinox/modules/binding-rmi-runtime/src/test/resources/RMIBindingTest.composite @@ -23,7 +23,7 @@ <service name="HelloWorldRmiService" promote="HelloWorldServiceComponent"> <interface.java interface="helloworld.HelloWorldService"/> - <tuscany:binding.rmi host="localhost" port="8099" serviceName="HelloWorldRemoteService" /> + <tuscany:binding.rmi uri="rmi://localhost:8099/HelloWorldRemoteService" /> </service> <component name="HelloWorldServiceComponent"> @@ -37,7 +37,7 @@ <reference name="HelloWorldRmiReference" promote="HelloWorldRmiServiceComponent/extService"> <interface.java interface="helloworld.HelloWorldService"/> - <tuscany:binding.rmi host="localhost" port="8099" serviceName="HelloWorldRemoteService" /> + <tuscany:binding.rmi uri="rmi://localhost:8099/HelloWorldRemoteService" /> </reference> </composite> diff --git a/branches/sca-equinox/modules/binding-rmi/src/main/java/org/apache/tuscany/sca/binding/rmi/RMIBinding.java b/branches/sca-equinox/modules/binding-rmi/src/main/java/org/apache/tuscany/sca/binding/rmi/RMIBinding.java index fd9cc016bd..af94bc285e 100644 --- a/branches/sca-equinox/modules/binding-rmi/src/main/java/org/apache/tuscany/sca/binding/rmi/RMIBinding.java +++ b/branches/sca-equinox/modules/binding-rmi/src/main/java/org/apache/tuscany/sca/binding/rmi/RMIBinding.java @@ -27,56 +27,9 @@ import org.apache.tuscany.sca.assembly.Binding; */ public class RMIBinding implements Binding { - private String host; - private String port; - private String serviceName; private String uri; private String name; - /** - * @return the host name of the RMI Service - */ - public String getHost() { - return host; - } - - /** - * @param rmiHostName the hostname of the RMI Service - */ - public void setHost(String rmiHostName) { - this.host = rmiHostName; - } - - /** - * @return the port number for the RMI Service - */ - public String getPort() { - return port; - } - - /** - * @param rmiPort the port number for the RMI Service - */ - public void setPort(String rmiPort) { - this.port = rmiPort; - } - - /** - * @return returns the RMI Service Name - */ - public String getServiceName() { - return serviceName; - } - - /** - * Sets the service name for the RMI Server - * - * @param rmiServiceName the name of the RMI service - */ - public void setServiceName(String rmiServiceName) { - this.serviceName = rmiServiceName; - } - public String getURI() { return uri; } diff --git a/branches/sca-equinox/modules/host-rmi/src/main/java/org/apache/tuscany/sca/host/rmi/DefaultRMIHost.java b/branches/sca-equinox/modules/host-rmi/src/main/java/org/apache/tuscany/sca/host/rmi/DefaultRMIHost.java index 8985c508fc..359ef488d4 100644 --- a/branches/sca-equinox/modules/host-rmi/src/main/java/org/apache/tuscany/sca/host/rmi/DefaultRMIHost.java +++ b/branches/sca-equinox/modules/host-rmi/src/main/java/org/apache/tuscany/sca/host/rmi/DefaultRMIHost.java @@ -19,6 +19,7 @@ package org.apache.tuscany.sca.host.rmi; +import java.net.URI; import java.rmi.AlreadyBoundException; import java.rmi.NotBoundException; import java.rmi.Remote; @@ -35,7 +36,7 @@ import java.util.concurrent.ConcurrentHashMap; */ public class DefaultRMIHost implements RMIHost { - //map of RMI registries started and running + // Map of RMI registries started and running private Map<String, Registry> rmiRegistries; public DefaultRMIHost() { @@ -45,21 +46,22 @@ public class DefaultRMIHost implements RMIHost { */ } - public void registerService(String serviceName, int port, Remote serviceObject) throws RMIHostException, - RMIHostRuntimeException { + public void registerService(String uri, Remote serviceObject) throws RMIHostException, RMIHostRuntimeException { + RMIURI rmiURI = new RMIURI(uri); + Registry registry; try { - registry = rmiRegistries.get(Integer.toString(port)); + registry = rmiRegistries.get(Integer.toString(rmiURI.port)); if (registry == null) { try { - registry = LocateRegistry.getRegistry(port); + registry = LocateRegistry.getRegistry(rmiURI.port); registry.list(); } catch (RemoteException e) { - registry = LocateRegistry.createRegistry(port); + registry = LocateRegistry.createRegistry(rmiURI.port); } - rmiRegistries.put(Integer.toString(port), registry); + rmiRegistries.put(Integer.toString(rmiURI.port), registry); } - registry.bind(serviceName, serviceObject); + registry.bind(rmiURI.serviceName, serviceObject); } catch (AlreadyBoundException e) { throw new RMIHostException(e); } catch (RemoteException e) { @@ -70,21 +72,16 @@ public class DefaultRMIHost implements RMIHost { } - public void registerService(String serviceName, Remote serviceObject) throws RMIHostException, - RMIHostRuntimeException { - registerService(serviceName, RMI_DEFAULT_PORT, serviceObject); - } - - public void unregisterService(String serviceName, int port) throws RMIHostException, RMIHostRuntimeException { - Registry registry; + public void unregisterService(String uri) throws RMIHostException, RMIHostRuntimeException { + RMIURI rmiURI = new RMIURI(uri); try { - registry = rmiRegistries.get(Integer.toString(port)); + Registry registry = rmiRegistries.get(Integer.toString(rmiURI.port)); if (registry == null) { - registry = LocateRegistry.getRegistry(port); - rmiRegistries.put(Integer.toString(port), registry); + registry = LocateRegistry.getRegistry(rmiURI.port); + rmiRegistries.put(Integer.toString(rmiURI.port), registry); } - registry.unbind(serviceName); + registry.unbind(rmiURI.serviceName); } catch (RemoteException e) { RMIHostRuntimeException rmiExec = new RMIHostRuntimeException(e.getMessage()); rmiExec.setStackTrace(e.getStackTrace()); @@ -94,25 +91,17 @@ public class DefaultRMIHost implements RMIHost { } } - public void unregisterService(String serviceName) throws RMIHostException, RMIHostRuntimeException { - unregisterService(serviceName, RMI_DEFAULT_PORT); - - } - - public Remote findService(String host, String port, String svcName) throws RMIHostException, - RMIHostRuntimeException { - Registry registry; + public Remote findService(String uri) throws RMIHostException, RMIHostRuntimeException { + RMIURI rmiURI = new RMIURI(uri); + Remote remoteService = null; - host = (host == null || host.length() <= 0) ? "localhost" : host; - int portNumber = (port == null || port.length() <= 0) ? RMI_DEFAULT_PORT : Integer.decode(port); - try { // Requires permission java.net.SocketPermission "host:port", "connect,accept,resolve" // in security policy. - registry = LocateRegistry.getRegistry(host, portNumber); + Registry registry = LocateRegistry.getRegistry(rmiURI.host, rmiURI.port); if (registry != null) { - remoteService = registry.lookup(svcName); + remoteService = registry.lookup(rmiURI.serviceName); } } catch (RemoteException e) { RMIHostRuntimeException rmiExec = new RMIHostRuntimeException(e.getMessage()); @@ -124,4 +113,33 @@ public class DefaultRMIHost implements RMIHost { return remoteService; } + /** + * A representation of an RMI URI. + * + * rmi://[host][:port][/[object]] + * rmi:[/][object] + */ + private static class RMIURI { + private String host; + private int port; + private String serviceName; + + private RMIURI(String uriStr) { + URI uri = URI.create(uriStr); + host = uri.getHost(); + if (host == null) { + host = "localhost"; + } + port = uri.getPort(); + if (port <= 0) { + port = RMI_DEFAULT_PORT; + } + String path = uri.getPath(); + if (path != null && path.charAt(0) == '/') { + path = path.substring(1); + } + serviceName = path; + } + } + } diff --git a/branches/sca-equinox/modules/host-rmi/src/main/java/org/apache/tuscany/sca/host/rmi/ExtensibleRMIHost.java b/branches/sca-equinox/modules/host-rmi/src/main/java/org/apache/tuscany/sca/host/rmi/ExtensibleRMIHost.java index 32fe6c2deb..29b4e195c7 100644 --- a/branches/sca-equinox/modules/host-rmi/src/main/java/org/apache/tuscany/sca/host/rmi/ExtensibleRMIHost.java +++ b/branches/sca-equinox/modules/host-rmi/src/main/java/org/apache/tuscany/sca/host/rmi/ExtensibleRMIHost.java @@ -35,39 +35,25 @@ public class ExtensibleRMIHost implements RMIHost { this.rmiHosts = rmiHosts; } - public void registerService(String serviceName, int port, Remote serviceObject) throws RMIHostException, RMIHostRuntimeException { + public void registerService(String uri, Remote serviceObject) throws RMIHostException, RMIHostRuntimeException { if (rmiHosts.getRMIHosts().isEmpty()) { throw new RMIHostException("No RMI host available"); } - rmiHosts.getRMIHosts().get(0).registerService(serviceName, port, serviceObject); + rmiHosts.getRMIHosts().get(0).registerService(uri, serviceObject); } - public Remote findService(String host, String port, String svcName) throws RMIHostException, RMIHostRuntimeException { + public void unregisterService(String uri) throws RMIHostException, RMIHostRuntimeException { if (rmiHosts.getRMIHosts().isEmpty()) { throw new RMIHostException("No RMI host available"); } - return rmiHosts.getRMIHosts().get(0).findService(host, port, svcName); + rmiHosts.getRMIHosts().get(0).unregisterService(uri); } - public void registerService(String serviceName, Remote serviceObject) throws RMIHostException, RMIHostRuntimeException { + public Remote findService(String uri) throws RMIHostException, RMIHostRuntimeException { if (rmiHosts.getRMIHosts().isEmpty()) { throw new RMIHostException("No RMI host available"); } - rmiHosts.getRMIHosts().get(0).registerService(serviceName, serviceObject); + return rmiHosts.getRMIHosts().get(0).findService(uri); } - public void unregisterService(String serviceName) throws RMIHostException, RMIHostRuntimeException { - if (rmiHosts.getRMIHosts().isEmpty()) { - throw new RMIHostException("No RMI host available"); - } - rmiHosts.getRMIHosts().get(0).unregisterService(serviceName); - } - - public void unregisterService(String serviceName, int port) throws RMIHostException, RMIHostRuntimeException { - if (rmiHosts.getRMIHosts().isEmpty()) { - throw new RMIHostException("No RMI host available"); - } - rmiHosts.getRMIHosts().get(0).unregisterService(serviceName, port); - } - } diff --git a/branches/sca-equinox/modules/host-rmi/src/main/java/org/apache/tuscany/sca/host/rmi/RMIHost.java b/branches/sca-equinox/modules/host-rmi/src/main/java/org/apache/tuscany/sca/host/rmi/RMIHost.java index 59377de22a..b95b91f003 100644 --- a/branches/sca-equinox/modules/host-rmi/src/main/java/org/apache/tuscany/sca/host/rmi/RMIHost.java +++ b/branches/sca-equinox/modules/host-rmi/src/main/java/org/apache/tuscany/sca/host/rmi/RMIHost.java @@ -32,59 +32,30 @@ public interface RMIHost { /** * Register an RMI service with the given name and port * - * @param serviceName against which the server is to be registered - * @param port the port against which the server is to be registered + * @param uri the URI against which the server is to be registered * @param serviceObject the server object to be registered * @throws RMIHostException * @throws RMIHostRuntimeException */ - void registerService(String serviceName, int port, Remote serviceObject) throws RMIHostException, - RMIHostRuntimeException; - - /** - * Register an RMI service with the given name and default port (1099) - * - * @param serviceName serviceName against which the server is to be registered - * @param serviceObject the server object to be registered - * @throws RMIHostException - * @throws RMIHostRuntimeException - */ - void registerService(String serviceName, Remote serviceObject) throws RMIHostException, - RMIHostRuntimeException; + void registerService(String uri, Remote serviceObject) throws RMIHostException, RMIHostRuntimeException; /** * Unregister a service registered under the given service name and port number * - * @param serviceName serviceName against which the server is to be registered - * @param port the port against which the server is to be registered + * @param uri the URI of the server * @throws RMIHostException * @throws RMIHostRuntimeException */ - void unregisterService(String serviceName, int port) throws RMIHostException, - RMIHostRuntimeException; - - /** - * Unregister a service registered under the given service name and default port number (1099) - * - * @param serviceName the name of the service that has to be unregistered - * @throws RMIHostException - * @throws RMIHostRuntimeException - */ - void unregisterService(String serviceName) throws RMIHostException, - RMIHostRuntimeException; - + void unregisterService(String uri) throws RMIHostException, RMIHostRuntimeException; /** * find a remote service hosted on the given host, port and service name * - * @param host the name of the host on which the RMI service to be unregistered is running - * @param port the port against which the server is to be unregistered is running - * @param svcName serviceName against which the server is to be unregistered is running + * @param uri the URI of the service * @return the RMI server object * @throws RMIHostException * @throws RMIHostRuntimeException */ - Remote findService(String host, String port, String svcName) throws RMIHostException, - RMIHostRuntimeException; + Remote findService(String uri) throws RMIHostException, RMIHostRuntimeException; } diff --git a/branches/sca-equinox/modules/host-rmi/src/test/java/org/apache/tuscany/sca/host/rmi/RMIHostImplTestCase.java b/branches/sca-equinox/modules/host-rmi/src/test/java/org/apache/tuscany/sca/host/rmi/RMIHostImplTestCase.java index 04d4d0f3cb..88f3e89489 100644 --- a/branches/sca-equinox/modules/host-rmi/src/test/java/org/apache/tuscany/sca/host/rmi/RMIHostImplTestCase.java +++ b/branches/sca-equinox/modules/host-rmi/src/test/java/org/apache/tuscany/sca/host/rmi/RMIHostImplTestCase.java @@ -36,7 +36,7 @@ public class RMIHostImplTestCase extends TestCase { public void testFindServiceBadHost() throws RMIHostRuntimeException, RMIHostException {
try {
- new DefaultRMIHost().findService(null, "9994", "$BAD$");
+ new DefaultRMIHost().findService("rmi://locahost:9994/$BAD$");
fail();
} catch (RMIHostRuntimeException e) {
// expected
@@ -45,40 +45,40 @@ public class RMIHostImplTestCase extends TestCase { public void testRegisterService1() throws RMIHostRuntimeException, RMIHostException {
DefaultRMIHost host = new DefaultRMIHost();
- host.registerService("foo1", 9996, new MockRemote());
- host.unregisterService("foo1", 9996);
+ host.registerService("rmi://localhost:9996/foo1", new MockRemote());
+ host.unregisterService("rmi://localhost:9996/foo1");
}
public void testExistingRegistry() throws RMIHostRuntimeException, RMIHostException {
DefaultRMIHost host1 = new DefaultRMIHost();
- host1.registerService("foo1", 9995, new MockRemote());
+ host1.registerService("rmi://localhost:9995/foo1", new MockRemote());
DefaultRMIHost host2 = new DefaultRMIHost();
- host2.registerService("foo2", 9995, new MockRemote());
- host2.unregisterService("foo1", 9995);
- host2.unregisterService("foo2", 9995);
+ host2.registerService("rmi://localhost:9995/foo2", new MockRemote());
+ host2.unregisterService("rmi://localhost:9995/foo1");
+ host2.unregisterService("rmi://localhost:9995/foo2");
}
public void testRegisterService2() throws RMIHostRuntimeException, RMIHostException {
DefaultRMIHost host = new DefaultRMIHost();
- host.registerService("bar1", 9999, new MockRemote());
- host.unregisterService("bar1", 9999);
+ host.registerService("rmi://localhost:9999/bar1", new MockRemote());
+ host.unregisterService("rmi://localhost:9999/bar1");
}
public void testRegisterServiceAlreadyBound() throws RMIHostRuntimeException, RMIHostException {
DefaultRMIHost host = new DefaultRMIHost();
- host.registerService("bar2", 9997, new MockRemote());
+ host.registerService("rmi://localhost:9997/bar2", new MockRemote());
try {
- host.registerService("bar2", 9997, new MockRemote());
+ host.registerService("rmi://localhost:9997/bar2", new MockRemote());
} catch (RMIHostException e) {
// expected
- host.unregisterService("bar2", 9997);
+ host.unregisterService("rmi://localhost:9997/bar2");
}
}
public void testUnRegisterService() throws RMIHostRuntimeException, RMIHostException {
DefaultRMIHost host = new DefaultRMIHost();
try {
- host.unregisterService("bar3", 9998);
+ host.unregisterService("rmi://localhost:9998/bar3");
fail();
} catch (RMIHostRuntimeException e) {
// expected
diff --git a/branches/sca-equinox/samples/calculator-rmi-reference/src/main/resources/CalculatorRMIReference.composite b/branches/sca-equinox/samples/calculator-rmi-reference/src/main/resources/CalculatorRMIReference.composite index a5a6e1cd29..f310e5269c 100644 --- a/branches/sca-equinox/samples/calculator-rmi-reference/src/main/resources/CalculatorRMIReference.composite +++ b/branches/sca-equinox/samples/calculator-rmi-reference/src/main/resources/CalculatorRMIReference.composite @@ -26,16 +26,16 @@ <component name="CalculatorServiceComponent">
<implementation.java class="calculator.CalculatorServiceImpl"/>
<reference name="addService"> - <tuscany:binding.rmi host="localhost" port="8099" serviceName="CalculatorRMIService"/> + <tuscany:binding.rmi uri="rmi://localhost:8099/CalculatorRMIService"/> </reference>
<reference name="subtractService"> - <tuscany:binding.rmi host="localhost" port="8099" serviceName="CalculatorRMIService"/> + <tuscany:binding.rmi uri="rmi://localhost:8099/CalculatorRMIService"/> </reference>
<reference name="multiplyService"> - <tuscany:binding.rmi host="localhost" port="8099" serviceName="CalculatorRMIService"/> + <tuscany:binding.rmi uri="rmi://localhost:8099/CalculatorRMIService"/> </reference>
<reference name="divideService"> - <tuscany:binding.rmi host="localhost" port="8099" serviceName="CalculatorRMIService"/> + <tuscany:binding.rmi uri="rmi://localhost:8099/CalculatorRMIService"/> </reference>
</component>
diff --git a/branches/sca-equinox/samples/calculator-rmi-service/src/main/resources/CalculatorRMIServer.composite b/branches/sca-equinox/samples/calculator-rmi-service/src/main/resources/CalculatorRMIServer.composite index 34d90ab451..c1a15e9107 100644 --- a/branches/sca-equinox/samples/calculator-rmi-service/src/main/resources/CalculatorRMIServer.composite +++ b/branches/sca-equinox/samples/calculator-rmi-service/src/main/resources/CalculatorRMIServer.composite @@ -27,7 +27,7 @@ <implementation.java class="calculator.CalculatorServiceImpl"/> <service name="CalculatorService"> <interface.java interface="calculator.CalculatorService"/> - <tuscany:binding.rmi host="localhost" port="8099" serviceName="CalculatorRMIService"/> + <tuscany:binding.rmi uri="rmi://localhost:8099/CalculatorRMIService"/> </service> <reference name="addService" target="AddServiceComponent"></reference>
<reference name="subtractService" target="SubtractServiceComponent"></reference>
diff --git a/branches/sca-equinox/samples/simple-bigbank-spring/src/main/resources/BigBank.composite b/branches/sca-equinox/samples/simple-bigbank-spring/src/main/resources/BigBank.composite index ea2dbc7e1c..46c0ec793d 100644 --- a/branches/sca-equinox/samples/simple-bigbank-spring/src/main/resources/BigBank.composite +++ b/branches/sca-equinox/samples/simple-bigbank-spring/src/main/resources/BigBank.composite @@ -53,7 +53,7 @@ <reference name="stockAccountService" target="StockAccountServiceComponent"/> <reference name="calculatorService"> - <tuscany:binding.rmi host="localhost" port="8099" serviceName="CalculatorRMIService"/> + <tuscany:binding.rmi uri="rmi://localhost:8099/CalculatorRMIService"/> </reference> <reference name="stockQuoteService"> diff --git a/branches/sca-equinox/samples/spring-bigbank-calculator/src/main/resources/Calculator.composite b/branches/sca-equinox/samples/spring-bigbank-calculator/src/main/resources/Calculator.composite index 504a4ccfcd..0eea510512 100644 --- a/branches/sca-equinox/samples/spring-bigbank-calculator/src/main/resources/Calculator.composite +++ b/branches/sca-equinox/samples/spring-bigbank-calculator/src/main/resources/Calculator.composite @@ -25,7 +25,7 @@ <service name="CalculatorService" promote="CalculatorServiceComponent">
<interface.java interface="bigbank.calculator.CalculatorService"/>
- <tuscany:binding.rmi host="localhost" port="8099" serviceName="CalculatorRMIService"/>
+ <tuscany:binding.rmi uri="rmi://localhost:8099/CalculatorRMIService"/>
</service>
<component name="CalculatorServiceComponent">
diff --git a/branches/sca-equinox/tools/eclipse34/plugins/core/xsd/tuscany-sca-binding-rmi.xsd b/branches/sca-equinox/tools/eclipse34/plugins/core/xsd/tuscany-sca-binding-rmi.xsd index 2697a1ea98..26be6feae5 100644 --- a/branches/sca-equinox/tools/eclipse34/plugins/core/xsd/tuscany-sca-binding-rmi.xsd +++ b/branches/sca-equinox/tools/eclipse34/plugins/core/xsd/tuscany-sca-binding-rmi.xsd @@ -34,9 +34,6 @@ <any namespace="##targetNamespace" processContents="lax" minOccurs="0" maxOccurs="unbounded"/> </sequence> - <attribute name="host" type="anyURI" use="optional"/> - <attribute name="port" type="int" use="optional"/> - <attribute name="serviceName" type="anyURI" use="required"/> </extension> </complexContent> </complexType> |