1 package org.sapia.ubik.rmi.examples; 2 3 import org.sapia.ubik.rmi.naming.remote.RemoteInitialContextFactory; 4 5 import java.util.Properties ; 6 7 import javax.naming.InitialContext ; 8 9 10 19 public class PrimitiveServer implements PrimitiveService { 20 public static void main(String [] args) { 21 try { 22 Properties props = new Properties (); 24 props.setProperty(InitialContext.PROVIDER_URL, "ubik://localhost:1099"); 25 props.setProperty(InitialContext.INITIAL_CONTEXT_FACTORY, 26 RemoteInitialContextFactory.class.getName()); 27 28 InitialContext ctx = new InitialContext (props); 29 30 ctx.rebind("PrimitiveService", new PrimitiveServer()); 31 32 System.out.println("Primitive server started..."); 33 34 while (true) { 35 Thread.sleep(10000); 36 } 37 } catch (Throwable t) { 38 t.printStackTrace(); 39 } 40 } 41 42 public boolean getBoolean() { 43 return false; 44 } 45 46 public byte getByte() { 47 return 0; 48 } 49 50 public char getChar() { 51 return 0; 52 } 53 54 public double getDouble() { 55 return 0; 56 } 57 58 public float getFloat() { 59 return 0; 60 } 61 62 public int getInt() { 63 return 0; 64 } 65 66 public long getLong() { 67 return 0; 68 } 69 70 public short getShort() { 71 return 0; 72 } 73 74 public void setBoolean(boolean bool) { 75 } 76 77 public void setByte(byte b) { 78 } 79 80 public void setChar(char c) { 81 } 82 83 public void setDouble(double d) { 84 } 85 86 public void setFloat(float f) { 87 } 88 89 public void setInt(int i) { 90 } 91 92 public void setLong(long l) { 93 } 94 95 public void setShort(short s) { 96 } 97 98 public void setBytes(byte[] b) { 99 for (int i = 0; i < b.length; i++) { 100 System.out.print(b[i]); 101 } 102 103 System.out.println(); 104 System.out.println(new String (b)); 105 } 106 } 107 | Popular Tags |