/home/kosta/dev/java/ria_test/web/java/KGIRiaTest/tester/CorbaImplTest.java

1    /* 
2     * Copyright (c) 2004 Your Corporation. All Rights Reserved. 
3     */ 
4    package KGIRiaTest.tester; 
5     
6    import org.omg.CosNaming.NamingContextExtHelper; 
7    import org.omg.CosNaming.NamingContextExt; 
8    import org.omg.CORBA.ORB; 
9    import KGIRiaTest.RiaServer; 
10   import KGIRiaTest.RiaServerHelper; 
11    
12   /** 
13    * Created by 
14    * User: kosta 
15    * Date: Oct 5, 2004 
16    * Time: 5:42:06 PM 
17    */ 
18   public class CorbaImplTest { 
19    
20     public static void main(String[] args) { 
21    
22        try{ 
23           // create and initialize the ORB 
24           ORB orb = ORB.init(args, null); 
25    
26           // get the root naming context 
27           org.omg.CORBA.Object objRef = 
28         orb.resolve_initial_references("NameService"); 
29           // Use NamingContextExt instead of NamingContext. This is 
30           // part of the Interoperable naming Service. 
31           NamingContextExt ncRef = NamingContextExtHelper.narrow(objRef); 
32    
33           // resolve the Object Reference in Naming 
34           RiaServer ria  = RiaServerHelper.narrow(ncRef.resolve_str(RiaServer.SERVER_NAME)); 
35    
36           System.out.println("Obtained a handle on server object: " + ria); 
37          KGIRiaTest.UserVO user = ria.getUser( "uuu"); 
38          System.out.println( user.fullName ); 
39          System.out.println( user.contacts ); 
40          TestingTimer.timeListUsers( "CORBA", ria ); 
41    
42    
43     } catch (Exception e) { 
44             System.out.println("ERROR : " + e) ; 
45       e.printStackTrace(System.out); 
46       } 
47    
48     } 
49    
50   } 
51