A class providing APIs for the CORBA Object Request Broker
features. The ORB class also provides
"pluggable ORB implementation" APIs that allow another vendor's ORB
implementation to be used.
An ORB makes it possible for CORBA objects to communicate
with each other by connecting objects making requests (clients) with
objects servicing requests (servers).
The ORB class, which
encapsulates generic CORBA functionality, does the following:
(Note that items 5 and 6, which include most of the methods in
the class ORB, are typically used with the Dynamic Invocation
Interface (DII) and the Dynamic Skeleton Interface
(DSI).
These interfaces may be used by a developer directly, but
most commonly they are used by the ORB internally and are
not seen by the general programmer.)
initializes the ORB implementation by supplying values for
predefined properties and environmental parameters
obtains initial object references to services such as
the NameService using the method resolve_initial_references
converts object references to strings and back
connects the ORB to a servant (an instance of a CORBA object
implementation) and disconnects the ORB from a servant
creates objects such as
TypeCode
Any
NamedValue
Context
Environment
lists (such as NVList) containing these objects
sends multiple messages in the DII
The ORB class can be used to obtain references to objects
implemented anywhere on the network.
An application or applet gains access to the CORBA environment
by initializing itself into an ORB using one of
three init methods. Two of the three methods use the properties
(associations of a name with a value) shown in the
table below.
Property Name
Property Value
Standard Java CORBA Properties:
org.omg.CORBA.ORBClass
class name of an ORB implementation
org.omg.CORBA.ORBSingletonClass
class name of the ORB returned by init()
These properties allow a different vendor's ORB
implementation to be "plugged in."
When an ORB instance is being created, the class name of the ORB
implementation is located using
the following standard search order:
check in Applet parameter or application string array, if any
check in properties parameter, if any
check in the System properties
check in the orb.properties file located in the user.home
directory (if any)
check in the orb.properties file located in the java.home/lib
directory (if any)
fall back on a hardcoded default behavior (use the Java IDL
implementation)
Note that Java IDL provides a default implementation for the
fully-functional ORB and for the Singleton ORB. When the method
init is given no parameters, the default Singleton
ORB is returned. When the method init is given parameters
but no ORB class is specified, the Java IDL ORB implementation
is returned.
The following code fragment creates an ORB object
initialized with the default ORB Singleton.
This ORB has a
restricted implementation to prevent malicious applets from doing
anything beyond creating typecodes.
It is called a singleton
because there is only one instance for an entire virtual machine.
ORB orb = ORB.init();
The following code fragment creates an ORB object
for an application. The parameter args
represents the arguments supplied to the application's main
method. Since the property specifies the ORB class to be
"SomeORBImplementation", the new ORB will be initialized with
that ORB implementation. If p had been null,
and the arguments had not specified an ORB class,
the new ORB would have been
initialized with the default Java IDL implementation.
Properties p = new Properties();
p.put("org.omg.CORBA.ORBClass", "SomeORBImplementation");
ORB orb = ORB.init(args, p);
The following code fragment creates an ORB object
for the applet supplied as the first parameter. If the given
applet does not specify an ORB class, the new ORB will be
initialized with the default Java IDL implementation.
ORB orb = ORB.init(myApplet, null);
An application or applet can be initialized in one or more ORBs.
ORB initialization is a bootstrap call into the CORBA world.
ORBclass also provides "pluggable ORB implementation" APIs that allow another vendor's ORB implementation to be used.An ORB makes it possible for CORBA objects to communicate with each other by connecting objects making requests (clients) with objects servicing requests (servers).
The
ORBclass, which encapsulates generic CORBA functionality, does the following: (Note that items 5 and 6, which include most of the methods in the classORB, are typically used with theDynamic Invocation Interface(DII) and theDynamic Skeleton Interface(DSI). These interfaces may be used by a developer directly, but most commonly they are used by the ORB internally and are not seen by the general programmer.)resolve_initial_referencesTypeCodeAnyNamedValueContextEnvironmentNVList) containing these objectsThe
ORBclass can be used to obtain references to objects implemented anywhere on the network.An application or applet gains access to the CORBA environment by initializing itself into an
ORBusing one of threeinitmethods. Two of the three methods use the properties (associations of a name with a value) shown in the table below.init()These properties allow a different vendor's
ORBimplementation to be "plugged in."When an ORB instance is being created, the class name of the ORB implementation is located using the following standard search order:
Note that Java IDL provides a default implementation for the fully-functional ORB and for the Singleton ORB. When the method
initis given no parameters, the default Singleton ORB is returned. When the methodinitis given parameters but no ORB class is specified, the Java IDL ORB implementation is returned.The following code fragment creates an
ORBobject initialized with the default ORB Singleton. This ORB has a restricted implementation to prevent malicious applets from doing anything beyond creating typecodes. It is called a singleton because there is only one instance for an entire virtual machine.ORB orb = ORB.init();The following code fragment creates an
ORBobject for an application. The parameterargsrepresents the arguments supplied to the application'smainmethod. Since the property specifies the ORB class to be "SomeORBImplementation", the new ORB will be initialized with that ORB implementation. If p had been null, and the arguments had not specified an ORB class, the new ORB would have been initialized with the default Java IDL implementation.Properties p = new Properties(); p.put("org.omg.CORBA.ORBClass", "SomeORBImplementation"); ORB orb = ORB.init(args, p);The following code fragment creates an
ORBobject for the applet supplied as the first parameter. If the given applet does not specify an ORB class, the new ORB will be initialized with the default Java IDL implementation.ORB orb = ORB.init(myApplet, null);An application or applet can be initialized in one or more ORBs. ORB initialization is a bootstrap call into the CORBA world.