KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > SOFA > SOFAnode > Run > DeplDockRegistry > RgRMIDockImpl


1 package SOFA.SOFAnode.Run.DeplDockRegistry;
2
3 import java.rmi.Naming JavaDoc;
4 import java.rmi.Remote JavaDoc;
5 import java.rmi.RemoteException JavaDoc;
6 import java.rmi.server.UnicastRemoteObject JavaDoc;
7
8 public class RgRMIDockImpl extends UnicastRemoteObject JavaDoc implements RgRMIDock {
9   String JavaDoc rmiport;
10   String JavaDoc rmihost;
11   
12   public RgRMIDockImpl() throws RemoteException JavaDoc {
13     rmiport = System.getProperty("sofa.rmiport","1099");
14     rmihost = System.getProperty("sofa.rmihost","localhost");
15   }
16   
17   public void rebind(String JavaDoc name, Remote JavaDoc object) throws RemoteException JavaDoc, java.net.MalformedURLException JavaDoc, java.rmi.AccessException JavaDoc {
18     Naming.rebind("//"+rmihost+":"+rmiport+""+name, object);
19 // System.out.println("Registering: //"+rmihost+":"+rmiport+""+name);
20
}
21
22   public static void main(String JavaDoc[] argv) throws Exception JavaDoc {
23     if (System.getSecurityManager() == null) {
24       System.setSecurityManager(new java.rmi.RMISecurityManager JavaDoc());
25     }
26
27     String JavaDoc rmiport = System.getProperty("sofa.rmiport","1099");
28     String JavaDoc rmihost = System.getProperty("sofa.rmihost","localhost");
29     System.out.print("Registering...");
30     Naming.rebind("//"+rmihost+":"+rmiport+"/RgRMIDock", new RgRMIDockImpl() );
31     System.out.print("OK");
32   }
33 }
34
Popular Tags