KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > sapia > ubik > rmi > examples > PrimitiveServer


1 package org.sapia.ubik.rmi.examples;
2
3 import org.sapia.ubik.rmi.naming.remote.RemoteInitialContextFactory;
4
5 import java.util.Properties JavaDoc;
6
7 import javax.naming.InitialContext JavaDoc;
8
9
10 /**
11  * @author Yanick Duchesne
12  *
13  * <dl>
14  * <dt><b>Copyright:</b><dd>Copyright &#169; 2002-2003 <a HREF="http://www.sapia-oss.org">Sapia Open Source Software</a>. All Rights Reserved.</dd></dt>
15  * <dt><b>License:</b><dd>Read the license.txt file of the jar or visit the
16  * <a HREF="http://www.sapia-oss.org/license.html">license page</a> at the Sapia OSS web site</dd></dt>
17  * </dl>
18  */

19 public class PrimitiveServer implements PrimitiveService {
20   public static void main(String JavaDoc[] args) {
21     try {
22       //PerfAnalyzer.getInstance().setEnabled(true);
23
Properties JavaDoc props = new Properties JavaDoc();
24       props.setProperty(InitialContext.PROVIDER_URL, "ubik://localhost:1099");
25       props.setProperty(InitialContext.INITIAL_CONTEXT_FACTORY,
26         RemoteInitialContextFactory.class.getName());
27
28       InitialContext JavaDoc ctx = new InitialContext JavaDoc(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 JavaDoc 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 JavaDoc(b));
105   }
106 }
107
Popular Tags