DynAny
The DynAny example illustrates some basic facilities associated with Dynamic
Any's. The Client application program will illustrate how to create
and initialize a DynStruct type. The Client will then create an any
type from the DynStruct which can then be passed to the Server application
program for evaluation. The Server application will illustrate how
to traverse, extract, and display the primitive constituents of the data
value associated with an any at run-time. It should
be pointed out that the Server application was written such that it does
not have any static information for the type of the any.
From this example, you will learn how to:
-
Create and initialize a dynamic any type
-
How to create an any type from a dynamic any type.
-
How to traverse and extract the primitive constituents of the data contained
within a dynamic any type.
Directory Contents
-
Printer.idl
IDL interface for the PrinterManager object and associated type
values.
-
Server.java
PrinterManager server. Creates an instance of the PrinterManager and
calls org.omg.CORBA.BOA.impl_is_ready() to make this object available
to client programs. The PrinterManager Server implementation implements
two methods: printAny, which displays the StructType info contained
within a dynamic any type, and shutdown, which deactivates the PrinterManager
instance and then shuts down the PrinterManager server process.
-
PrinterManagerImpl.java
PrinterManager Implementation. This program contains the implementation
of the PrinterManager object and is part of the PrinterManager Server described
above.
-
Client.java
This is the PrinterManager client. It binds to the PrinterManager
object and invokes printAny() passing an any value
which contains the struct StructType. It then invokes shutdown()
on the PrinterManager object which will then unregister and deactivate
the PrinterManager object and shutdown the PrinterManager Server.
-
Makefile (vbmake.bat on Windows): Used to build all the test targets.
Building this example
Typing make (or vbmake on Windows) in the DynAny subdirectory
will cause the Printer.idl to be run through
the idl2java compiler. It will also build the following classes for the
examples described above:
-
Server.class
-
Client.class
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 PrinterManager Server
using the command:
prompt> vbj Server &
(start vbj Server on Windows)
// make the server run in the background
Next, display the AccountInfo value by typing:
prompt> vbj Client
Return to the top-level examples page.