KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > demo > outparam > Server


1 package demo.outparam;
2
3 import org.omg.CosNaming.*;
4
5 public class Server
6 {
7     public static void main( String JavaDoc[] args )
8     {
9     org.omg.CORBA.ORB JavaDoc orb = org.omg.CORBA.ORB.init(args, null);
10     try
11     {
12         org.omg.PortableServer.POA JavaDoc poa =
13         org.omg.PortableServer.POAHelper.narrow(orb.resolve_initial_references("RootPOA"));
14         poa.the_POAManager().activate();
15         org.omg.PortableServer.Servant JavaDoc servant = new serverImpl();
16         org.omg.CORBA.Object JavaDoc o = poa.servant_to_reference(servant );
17
18         // register server with naming context
19
NamingContextExt nc = NamingContextExtHelper.narrow(orb.resolve_initial_references("NameService"));
20         NameComponent [] name = new NameComponent[]{ new NameComponent( "ParamServer", "service")};
21         nc.rebind(name, o);
22     }
23     catch ( Exception JavaDoc e )
24     {
25         e.printStackTrace();
26     }
27     orb.run();
28     }
29 }
30
Popular Tags