Problem:
- Product Name: VisiBroker for Java
- Product Version: All
- Product Component: Core ORB
- Platform/OS: All
- JDK/Compiler Version: All
How to pass first parameter of ORB.init() method programmatically? As well as from command line parameter?
Solution:
orb init functions are defined in OMG as:
- static ORB init ()
- static ORB init (Applet app, Properties props)
- static ORB init (String [] args, Properties props)
This article will guide you on how to use the 3rd one -- basically how to construct the first parameter for the method.
Sample code segment is shown as following:
String[] arguments = new String[2];
arguments[0] = "-vbroker.agent.port";
arguments[1] = "14910";
org.omg.CORBA.ORB orb = org.omg.CORBA.ORB.init(arguments, null);
Basically one construct the String Array and set each value one-by-one as required.
The same can be achieved in command line as well. It is as following:
vbj Server -vbroker.agent.port 14910 -vbroker.agent.addr 127.0.0.1
When entering the command-line arguments, do NOT include the D after the dash (-) or use an equal sign (=) when setting a value.
By default, setting the first parameter of ORB.init() takes the highest precedence over the other ways of setting VisiBroker properties. The default order of precedence is:
- Setting the first parameter of ORB.init(args, props);
- Setting the properties as system properties. (i.e. using JVM's -D option)
- Properties set from file specified by "ORBpropStorage" property
- Setting the second parameter of ORB.init(args, props);
- Default ORB properties
#Security
#arguments
#ORB.Init
#VisiBroker
#properties