Interface Repository(IR) example
The ir example illustrates the mechanism used to query the Interface Repository
(IR), to traverse the IR and to print its contents.
From this example, you will learn how to:
-
Bind to the IR and query the IR for its contents
-
Traverse the IR as a container and print its contents
-
Understand TypeCodes and create them
Directory Contents
-
PrintIDL.java
This program binds to the IRObject, looks up a given interface name in the IR and prints the names of methods and attributes of the interface associated with the interface. Particularly, it illustrates the use of the lookup() and describe_interface() methods.
-
PrintIR.java
This program binds to the IR object, queries the IR for its contents (treating the IR as a container), traverses the container recursively to print its
contents.
-
ir.idl
IDL file used as an example to load into the IR.
-
Makefile (vbmake.bat on Windows)
Used to build all the test targets.
Building this example
Typing make(vbmake on Windows) in the ir subdirectory will cause the following executable to be built:
Compilation Warnings
You will see the following compilation warning when you type make(vbmake on Windows) in the ir subdirectory or when you explicitly compile PrintIR.java using:
prompt>javac PrintIR.java
Note: PrintIR.java uses a deprecated API. Recompile with
"-deprecation" for details.
1 warning
This warning occurs because the example uses a Java API that has been deprecated
since JDK1.1. The calls to the deprecated Java API have not been changed for
the sake of JDK1.0.2 users.
Running this example
To run the examples, first make sure that the VisiBroker Smart Agent (osagent
executable) is running on your network. Then start the Interface Repository
server process (irep). A graphical interface will popup from which you can
load the file ir.idl into the IR. Alternatively you
can start the Interface Repository server process (irep) in the console
mode using the command:
prompt> irep -console my_irep_server
(start irep -console my_irep_server on Windows)
Next, load ir.idl into the ir.
irep_prompt> rir.idl // Note: There is no space between the "r" and
// the ir.idl filename
Do not quit from the shell started by the irep process.
Next, run the PrintIDL program.
prompt> vbj PrintIDL CORBA::IRObject (or another interface)
The PrintIDL program binds to the IR, looks up the interface requested by the
user and prints the names of methods and attributes of the interface stored
in the IR associated with it.
Next, run the PrintIR program.
prompt> vbj PrintIR
The PrintIR program binds to the IR, queries the interface repository for all of its contents, traverses the IR recursively and prints the contents in an IDL like output. You can match the output against the information in the IDL file ir.idl
Return to the top-level examples page.