KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > test > memoryusage > Server


1 package test.memoryusage;
2
3 import org.omg.CORBA.*;
4 import org.omg.PortableServer.*;
5 import org.omg.CosNaming.*;
6
7 public class Server
8 {
9     public static void main(String JavaDoc[] args)
10     {
11         try
12         {
13             //init ORB
14
ORB orb = ORB.init( args, null );
15     
16             //init POA
17
POA rootPOA = POAHelper.narrow(orb.resolve_initial_references("RootPOA"));
18             rootPOA.the_POAManager().activate();
19             POAManager poaManager = rootPOA.the_POAManager();
20     
21             // create a IDiacosFactory object
22
SessionFactoryServant sessionFactoryServant =
23               new SessionFactoryServant(orb, rootPOA);
24     
25             // create the object reference
26
org.omg.CORBA.Object JavaDoc sessionFactory =
27               rootPOA.servant_to_reference( sessionFactoryServant );
28     
29             //register IDiacosFactory with the naming service
30
NamingContextExt nc =
31               NamingContextExtHelper.narrow(orb.resolve_initial_references("NameService"));
32
33             nc.bind(nc.to_name("SessionFactory"), sessionFactory);
34     
35             // wait for requests
36
System.out.println("CORBA Server ready");
37             orb.run();
38         }
39         catch(Exception JavaDoc e)
40         {
41             System.out.println(e);
42         }
43     }
44 }
45
Popular Tags