1 package org.sapia.ubik.rmi.examples; 2 3 import org.sapia.ubik.rmi.naming.remote.RemoteInitialContextFactory; 4 import org.sapia.ubik.rmi.server.Log; 5 6 import java.rmi.RemoteException ; 7 8 import java.util.Properties ; 9 10 import javax.naming.*; 11 12 13 21 public class UbikFoo implements Foo { 22 public UbikFoo() throws java.rmi.RemoteException { 23 } 24 25 28 public Bar getBar() throws RemoteException { 29 return new UbikBar(); 30 } 31 32 public static void main(String [] args) { 33 try { 34 Log.setWarning(); 35 36 Properties props = new Properties (); 38 props.setProperty(InitialContext.PROVIDER_URL, "ubik://localhost:1099"); 39 props.setProperty(InitialContext.INITIAL_CONTEXT_FACTORY, 40 RemoteInitialContextFactory.class.getName()); 41 42 InitialContext ctx = new InitialContext(props); 43 44 ctx.rebind("Foo", new UbikFoo()); 45 46 System.out.println("UbikFoo started..."); 47 48 while (true) { 49 Thread.sleep(10000); 50 } 51 } catch (Throwable t) { 52 t.printStackTrace(); 53 } 54 } 55 } 56 | Popular Tags |