01: // DistrictClient.java
02: // mini Client for accessing bean District
03:
04: package org.objectweb.jonas.stests.appli;
05:
06: import javax.naming.Context;
07: import javax.naming.InitialContext;
08: import javax.naming.NamingException;
09: import javax.rmi.PortableRemoteObject;
10:
11: /**
12: *
13: */
14: public class DistrictClient {
15:
16: static Context ctx = null;
17: static DistrictHome home = null;
18:
19: public static void main(String[] arg) {
20:
21: // Get InitialContext
22: try {
23: ctx = new InitialContext();
24: } catch (NamingException e) {
25: e.printStackTrace();
26: System.exit(2);
27: }
28:
29: // Lookup bean home
30: String bName = "DistrictHome";
31: try {
32: home = (DistrictHome) PortableRemoteObject.narrow(ctx
33: .lookup(bName), DistrictHome.class);
34:
35: } catch (Exception e) {
36: e.printStackTrace();
37: System.exit(2);
38: }
39:
40: // ...
41: }
42: }
|