KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > jonas > stests > appli > OrderPlacementClient


1 // OrderPlacementClient.java
2
// mini Client for accessing bean OrderPlacement
3

4 package org.objectweb.jonas.stests.appli;
5
6 import javax.naming.Context JavaDoc;
7 import javax.naming.InitialContext JavaDoc;
8 import javax.naming.NamingException JavaDoc;
9 import javax.rmi.PortableRemoteObject JavaDoc;
10
11 /**
12  *
13  */

14 public class OrderPlacementClient {
15
16     static Context JavaDoc ctx = null;
17     static OrderPlacementHome home = null;
18
19     public static void main(String JavaDoc[] arg) {
20
21     // Get InitialContext
22
try {
23         ctx = new InitialContext JavaDoc();
24     } catch (NamingException JavaDoc e) {
25         e.printStackTrace();
26         System.exit(2);
27     }
28
29     // Lookup bean home
30
String JavaDoc bName = "OrderPlacementHome";
31     try {
32         home = (OrderPlacementHome) PortableRemoteObject.narrow(ctx.lookup(bName), OrderPlacementHome.class);
33         OrderPlacement bean = home.create();
34  
35     } catch(Exception JavaDoc e) {
36         e.printStackTrace();
37         System.exit(2);
38     }
39
40     // ...
41
}
42 }
43
Popular Tags