Package org.nuiton.util.rmi
Class RemoteProxyFactory
java.lang.Object
org.nuiton.util.rmi.RemoteProxyFactory
public class RemoteProxyFactory
extends java.lang.Object
Factory to create RMI proxies to some given services.
- Author:
- Arnaud Thimel - thimel@codelutin.com
-
Field Summary
Fields Modifier and Type Field Description protected static intPORTprotected static java.lang.StringREGISTRY_IP -
Constructor Summary
Constructors Constructor Description RemoteProxyFactory() -
Method Summary
Modifier and Type Method Description static <T> TcreateProxy(java.lang.Class<T> serviceInterface)Create a RMI proxy on the wanted service interface.static <T> TcreateProxy(java.lang.String rmiName, java.lang.Class<T> serviceInterface)Create a RMI proxy on the wanted service interface.
-
Field Details
-
PORT
protected static final int PORT- See Also:
- Constant Field Values
-
REGISTRY_IP
protected static final java.lang.String REGISTRY_IP- See Also:
- Constant Field Values
-
-
Constructor Details
-
RemoteProxyFactory
public RemoteProxyFactory()
-
-
Method Details
-
createProxy
public static <T> T createProxy(java.lang.Class<T> serviceInterface) throws java.rmi.RemoteException, java.rmi.NotBoundExceptionCreate a RMI proxy on the wanted service interface. The default RMI name will be used to find this service in the Registry.- Type Parameters:
T- some interface class- Parameters:
serviceInterface- The class of the service proxy to create- Returns:
- A newly created proxy which interface is <T>
- Throws:
java.rmi.RemoteException- in case the registry is not reachablejava.rmi.NotBoundException- if the default RMI name cannot be found in the registry
-
createProxy
public static <T> T createProxy(java.lang.String rmiName, java.lang.Class<T> serviceInterface) throws java.rmi.RemoteException, java.rmi.NotBoundExceptionCreate a RMI proxy on the wanted service interface. The specific given RMI name will be used to find this service in the Registry.- Type Parameters:
T- some interface class- Parameters:
rmiName- The specific RMI name to use to find the service in the registryserviceInterface- The class of the service proxy to create- Returns:
- A newly created proxy which interface is <T>
- Throws:
java.rmi.RemoteException- in case the registry is not reachablejava.rmi.NotBoundException- if the default RMI name cannot be found in the registry
-