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