home *** CD-ROM | disk | FTP | other *** search
Java Source | 1998-05-08 | 2.9 KB | 78 lines |
- /*
- * Copyright (c) 1997-1998 Borland International, Inc. All Rights Reserved.
- *
- * This SOURCE CODE FILE, which has been provided by Borland as part
- * of a Borland product for use ONLY by licensed users of the product,
- * includes CONFIDENTIAL and PROPRIETARY information of Borland.
- *
- * USE OF THIS SOFTWARE IS GOVERNED BY THE TERMS AND CONDITIONS
- * OF THE LICENSE STATEMENT AND LIMITED WARRANTY FURNISHED WITH
- * THE PRODUCT.
- *
- * IN PARTICULAR, YOU WILL INDEMNIFY AND HOLD BORLAND, ITS RELATED
- * COMPANIES AND ITS SUPPLIERS, HARMLESS FROM AND AGAINST ANY CLAIMS
- * OR LIABILITIES ARISING OUT OF THE USE, REPRODUCTION, OR DISTRIBUTION
- * OF YOUR PROGRAMS, INCLUDING ANY CLAIMS OR LIABILITIES ARISING OUT OF
- * OR RESULTING FROM THE USE, MODIFICATION, OR DISTRIBUTION OF PROGRAMS
- * OR FILES CREATED FROM, BASED ON, AND/OR DERIVED FROM THIS SOURCE
- * CODE FILE.
- */
- package visibroker.samples.ir;
-
- /**
- This is a simple client program that does the following:
-
- 0. Before this program can be tested, the following conditions should
- exist.
- a) The OSAgent should be up and running
- b) An interface Repository should be started using
- irep "irep-name"
- c) The Interface Repository should be loaded with an IDL file
- either by using the graphical interface that comes up, or,
- by using
- idl2ir -ir "irep-name" IDLfile_name
-
- 1. It binds to the interface Repository started by the user and known to
- the OSAgent.
- 2. The client then takes as a command line argument, the IDL name for
- an interface, such as module::interface
- 3. The method lookup(idlname) is invoked on the Repository which is then
- narrowed down to an interface description. Following this,
- describe_interface() is called on this interface description.
- 4. The methods and attributes are retrieved from the interface description
- and printed to the user.
-
- */
-
-
- public class PrintIDL {
-
- public static void main(String[] args) {
-
- if ( args.length == 0 ) {
- System.out.println("Usage: vbj PrintIDL idlName");
- System.exit(1);
- }
- String idlName = args[0];
-
- org.omg.CORBA.ORB orb = org.omg.CORBA.ORB.init(args,null);
- org.omg.CORBA.Repository rep = org.omg.CORBA.RepositoryHelper.bind(orb);
- org.omg.CORBA.InterfaceDef idef =
- org.omg.CORBA.InterfaceDefHelper.narrow(rep.lookup(idlName));
- if (idef == null)
- throw new org.omg.CORBA.INTF_REPOS("The idlName is not an interface: "
- + idlName);
- org.omg.CORBA.InterfaceDefPackage.FullInterfaceDescription intDesc =
- idef.describe_interface();
-
- System.out.println("Operations:");
- for(int i = 0; i < intDesc.operations.length; i++)
- System.out.println(" " + intDesc.operations[i].name);
-
- System.out.println("Attributes:");
- for(int i = 0; i < intDesc.attributes.length; i++)
- System.out.println(" " + intDesc.attributes[i].name);
- }
-
- }
-