You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by jm...@apache.org on 2007/01/05 11:37:01 UTC
svn commit: r492968 - in
/incubator/tuscany/java/sca/services/bindings/binding.rmi/src:
main/java/org/apache/tuscany/binding/rmi/host/RMIHostImpl.java
test/java/org/apache/tuscany/binding/rmi/host/RMIHostImplTestCase.java
Author: jmarino
Date: Fri Jan 5 02:37:00 2007
New Revision: 492968
URL: http://svn.apache.org/viewvc?view=rev&rev=492968
Log:
change rmi binding to use to @EagerInit
Modified:
incubator/tuscany/java/sca/services/bindings/binding.rmi/src/main/java/org/apache/tuscany/binding/rmi/host/RMIHostImpl.java
incubator/tuscany/java/sca/services/bindings/binding.rmi/src/test/java/org/apache/tuscany/binding/rmi/host/RMIHostImplTestCase.java
Modified: incubator/tuscany/java/sca/services/bindings/binding.rmi/src/main/java/org/apache/tuscany/binding/rmi/host/RMIHostImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/services/bindings/binding.rmi/src/main/java/org/apache/tuscany/binding/rmi/host/RMIHostImpl.java?view=diff&rev=492968&r1=492967&r2=492968
==============================================================================
--- incubator/tuscany/java/sca/services/bindings/binding.rmi/src/main/java/org/apache/tuscany/binding/rmi/host/RMIHostImpl.java (original)
+++ incubator/tuscany/java/sca/services/bindings/binding.rmi/src/main/java/org/apache/tuscany/binding/rmi/host/RMIHostImpl.java Fri Jan 5 02:37:00 2007
@@ -25,16 +25,20 @@
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
+import org.osoa.sca.annotations.EagerInit;
+import org.osoa.sca.annotations.Scope;
+
import org.apache.tuscany.host.rmi.RMIHost;
import org.apache.tuscany.host.rmi.RMIHostException;
import org.apache.tuscany.host.rmi.RMIHostRuntimeException;
-import org.osoa.sca.annotations.Init;
-import org.osoa.sca.annotations.Scope;
/**
* This class provides an implementation for the RMI Host SPIs
+ *
+ * @version $Rev$ $Date$
*/
@Scope("COMPOSITE")
+@EagerInit
public class RMIHostImpl implements RMIHost {
// map of RMI registries started and running
@@ -47,22 +51,18 @@
*/
}
- @Init(eager = true)
- public void init() {
- }
-
public void registerService(String serviceName, int port, Remote serviceObject) throws RMIHostException,
- RMIHostRuntimeException {
+ RMIHostRuntimeException {
Registry registry;
try {
registry = rmiRegistries.get(Integer.toString(port));
if (registry == null) {
registry = LocateRegistry.createRegistry(port);
rmiRegistries.put(Integer.toString(port),
- registry);
+ registry);
}
registry.bind(serviceName,
- serviceObject);
+ serviceObject);
} catch (AlreadyBoundException e) {
throw new RMIHostException(e.getMessage());
} catch (RemoteException e) {
@@ -74,14 +74,14 @@
}
public void registerService(String serviceName, Remote serviceObject) throws RMIHostException,
- RMIHostRuntimeException {
+ RMIHostRuntimeException {
registerService(serviceName,
- RMI_DEFAULT_PORT,
- serviceObject);
+ RMI_DEFAULT_PORT,
+ serviceObject);
}
public void unregisterService(String serviceName, int port) throws RMIHostException,
- RMIHostRuntimeException {
+ RMIHostRuntimeException {
Registry registry;
try {
@@ -89,7 +89,7 @@
if (registry == null) {
registry = LocateRegistry.createRegistry(port);
rmiRegistries.put(Integer.toString(port),
- registry);
+ registry);
}
registry.unbind(serviceName);
} catch (RemoteException e) {
@@ -102,23 +102,23 @@
}
public void unregisterService(String serviceName) throws RMIHostException,
- RMIHostRuntimeException {
+ RMIHostRuntimeException {
unregisterService(serviceName,
- RMI_DEFAULT_PORT);
+ RMI_DEFAULT_PORT);
}
public Remote findService(String host, String port, String svcName) throws RMIHostException,
- RMIHostRuntimeException {
+ RMIHostRuntimeException {
Registry registry;
Remote remoteService = null;
host = (host == null || host.length() <= 0) ? "localhost" : host;
int portNumber = (port == null || port.length() <= 0) ? RMI_DEFAULT_PORT : Integer
- .decode(port);
+ .decode(port);
try {
registry = LocateRegistry.getRegistry(host,
- portNumber);
+ portNumber);
if (registry != null) {
remoteService = registry.lookup(svcName);
Modified: incubator/tuscany/java/sca/services/bindings/binding.rmi/src/test/java/org/apache/tuscany/binding/rmi/host/RMIHostImplTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/services/bindings/binding.rmi/src/test/java/org/apache/tuscany/binding/rmi/host/RMIHostImplTestCase.java?view=diff&rev=492968&r1=492967&r2=492968
==============================================================================
--- incubator/tuscany/java/sca/services/bindings/binding.rmi/src/test/java/org/apache/tuscany/binding/rmi/host/RMIHostImplTestCase.java (original)
+++ incubator/tuscany/java/sca/services/bindings/binding.rmi/src/test/java/org/apache/tuscany/binding/rmi/host/RMIHostImplTestCase.java Fri Jan 5 02:37:00 2007
@@ -26,7 +26,7 @@
public class RMIHostImplTestCase extends TestCase {
public void testInit() {
- new RMIHostImpl().init();
+ new RMIHostImpl();
}
public void testFindServiceBadHost() throws RMIHostRuntimeException, RMIHostException {
---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-commits-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-commits-help@ws.apache.org