![]() |
![]() |
|
|
CORBA ORB
This chapter supplements the information in package org.omg.CORBA by providing information on the following topics:
Note: For details about the API for package org.omg.CORBA, see the Java IDL document published by the Sun Microsystems, Inc. and distributed with the JDK 1.2.
Initializing the ORB
[This section is reprinted from the package information for org.omg.CORBA, as published by Sun Microsystems, Inc. for the JDK 1.2.]
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 following table:
Property Name |
Property Value |
---|---|
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:
Note that the BEA WebLogic Enterprise ORB provides a default implementation for the fully functional ORB and for the Singleton ORB. When the init method is given no parameters, the default Singleton ORB is returned. When the init method 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 and a Singleton ORB object for an application.
Properties p = new Properties();
p.put("org.omg.CORBA.ORBClass", "com.sun.CORBA.iiop.ORB");
p.put("org.omg.CORBA.ORBSingletonClass","com.sun.CORBA.idl.ORBSingleton");
System.setProperties(p);
ORB orb = ORB.init(args, p);
In the preceding code fragment, note the following:
Note: Due to the security restrictions on applets, you will probably not be able to invoke the System.setProperties method from within an applet. Instead, you can set the org.omg.CORBA.ORBClass and org.omg.CORBA.ORBSingletonClass parameters via HTML before starting the applet.
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 BEA WebLogic Enterprise ORB 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.
Passing the Address of the IIOP Listener
When you compile BEA WebLogic Enterprise client and server applications, use the -DTOBJADDR option to specify the host and port of the IIOP Listener. This allows you, in the application code, to specify null as a host and port string in invocations to:
By keeping host and port specifications out of your client and server application code, you maximize the portability and reusability of your application code.
![]() |
![]() |
![]() |
|
Copyright © 2000 BEA Systems, Inc. All rights reserved.
|