|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.rmi.server.RemoteObject
java.rmi.server.RemoteServer
net.sbbi.upnp.remote.UnicastRemoteObject
This class can be used for remote objects that need to work behind
an NAT firewall compatible with IGD UPNP specifications.
The following system properties let you setup this class :
net.sbbi.upnp.remote.deviceUDN=someUPNPDeviceUDN, the device identifier to
be used when multiple IGD upnp devices are on the network
net.sbbi.upnp.remote.failWhenNoDeviceFound=true|false, Property to throw an
exception when the object is exported and no UPNP device is found, default to false
net.sbbi.upnp.remote.failWhenDeviceCommEx=true|false, Property to throw an
exception when the object is exported and an error occurs during com with device, default to false
net.sbbi.upnp.remote.discoveryTimeout=4000, timeout in ms to discover upnp devices
default to 1500, try to increase this timeout if you can't find a present device
on the network
Each instance of this class can create a shutdown hook trigered during JVM shutdown
to make sure that the port opened with UPNP is closed.
The hook is created as soon as the port is opened on the UPNP device.
Migration for distributed objects is quite simple :
change the standard java.rmi.server.UnicastRemoteObject class extends to
this class and you're done.
If you have trouble to make the objects available from behind your router/firewall
make sure that you have correctly set the java.rmi.server.hostname system property with
an hostname matching your router/firewall IP.
Make also sure that your RMI Registry port is opened on the router
otherwise nothing will work. You can use a urn:schemas-upnp-org:device:InternetGatewayDevice:1
device just like this class to automate the job.
Method Summary | |
java.lang.Object |
clone()
Returns a clone of the remote object that is distinct from the original. |
void |
closePort()
Closes the port on the UPNP router |
static java.rmi.server.RemoteStub |
exportObject(java.rmi.Remote obj)
Exports the remote object to make it available to receive incoming calls using an anonymous port. |
static java.rmi.Remote |
exportObject(java.rmi.Remote obj,
int port)
Exports the remote object to make it available to receive incoming calls, using the particular supplied port. |
static java.rmi.Remote |
exportObject(java.rmi.Remote obj,
int port,
java.rmi.server.RMIClientSocketFactory csf,
java.rmi.server.RMIServerSocketFactory ssf)
Exports the remote object to make it available to receive incoming calls, using a transport specified by the given socket factory. |
Methods inherited from class java.rmi.server.RemoteServer |
getClientHost, getLog, setLog |
Methods inherited from class java.rmi.server.RemoteObject |
equals, getRef, hashCode, toString, toStub |
Methods inherited from class java.lang.Object |
getClass, notify, notifyAll, wait, wait, wait |
Method Detail |
public java.lang.Object clone() throws java.lang.CloneNotSupportedException
java.lang.CloneNotSupportedException
- if clone failed due to
a RemoteException.public static java.rmi.server.RemoteStub exportObject(java.rmi.Remote obj) throws java.rmi.RemoteException
obj
- the remote object to be exported
java.rmi.RemoteException
- if export failspublic static java.rmi.Remote exportObject(java.rmi.Remote obj, int port) throws java.rmi.RemoteException
obj
- the remote object to be exportedport
- the port to export the object on
java.rmi.RemoteException
- if export failspublic static java.rmi.Remote exportObject(java.rmi.Remote obj, int port, java.rmi.server.RMIClientSocketFactory csf, java.rmi.server.RMIServerSocketFactory ssf) throws java.rmi.RemoteException
obj
- the remote object to be exportedport
- the port to export the object oncsf
- the client-side socket factory for making calls to the
remote objectssf
- the server-side socket factory for receiving remote calls
java.rmi.RemoteException
- if export failspublic void closePort()
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |