KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jacorb > ir > QueryIR


1 package org.jacorb.ir;
2
3 /*
4  * JacORB - a free Java ORB
5  *
6  * Copyright (C) 1997-2004 Gerald Brose.
7  *
8  * This library is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU Library General Public
10  * License as published by the Free Software Foundation; either
11  * version 2 of the License, or (at your option) any later version.
12  *
13  * This library is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16  * Library General Public License for more details.
17  *
18  * You should have received a copy of the GNU Library General Public
19  * License along with this library; if not, write to the Free
20  * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21  */

22
23 import java.io.*;
24
25 public class QueryIR
26 {
27     public static void main( String JavaDoc[] args )
28     {
29         if( args.length != 1 )
30         {
31             System.err.println("Usage: qir <RepositoryID>");
32             System.exit(1);
33         }
34
35         try
36         {
37             org.omg.CORBA.ORB JavaDoc orb = org.omg.CORBA.ORB.init( args, null );
38             org.omg.CORBA.Repository JavaDoc ir =
39                 org.omg.CORBA.RepositoryHelper.narrow( orb.resolve_initial_references( "InterfaceRepository"));
40                 
41             if( ir == null )
42             {
43                 System.out.println( "Could not find IR.");
44                 System.exit(1);
45             }
46                          
47             org.omg.CORBA.Contained JavaDoc c = ir.lookup_id( args[0] );
48             
49             if( c != null )
50             {
51                 IdlWriter idlw = new IdlWriter(System.out);
52                 idlw.printContained( c, 2 );
53             }
54             else
55                 System.out.println( args[0] + " not found in IR.");
56         }
57         catch ( Exception JavaDoc e)
58         {
59             e.printStackTrace();
60         }
61     }
62 }
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
Popular Tags