Java Reference
In-Depth Information
public static void main (String[] args) {
...
try {
// All six server steps
}
catch (Exception e) {
System.err.println ("ERROR: " + e);
e.printStackTrace (System.err);
}
} // main
This main() method appears in the Cor19Server class, where we have
assumed the following package and import statements:
package javatech.cor19.server.impl;
import javatech.cor19.server.*;
import org.omg.CORBA.*;
import org.omg.CosNaming.*;
import org.omg.CosNaming.NamingContextPackage.*;
import org.omg.PortableServer.*;
19.4.2.1 Create and initialize the ORB
The ORB is created and initialized with the static ORB.init() call in the
org.omg.CORBA package. For a Java application (as opposed to an applet),
the init() method takes two parameters - a String array and a Properties
object. Either parameter may be null. The idea for the String array is that
ORB.init() is typically called from an application's main() method, and
since main() receives a String array of command line arguments, these can be
passed directly to the ORB. The init() method uses any of these command line
arguments that it can interpret and ignores the rest. An example is the argument
-ORBInitialHost ,which identifies the host on which to find the naming
service.
The Properties parameter provides an alternate way to deliver cer-
tain values to the ORB. For example, the initial naming service host can
be specified with a org.omg.CORBA.ORBInitialHost property instead of
-ORBInitialHost command line argument. The Properties object passed
to the ORB can be created and populated within the main() program, or you
can use the system properties object and load the desired property names and
values from the command line with the -Dprop = value syntax.
Yo u are free to use either the args method or the Properties object method,
or both. A code snippet showing ORB initialization utilizing both methods is
ORB orb = ORB.init (args, System.getProperties ());
Search WWH ::




Custom Search