Skip to main content

 

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:

  1. static ORB init ()
  2. static ORB init (Applet app, Properties props)
  3. 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:

  1. Setting the first parameter of ORB.init(args, props);
  2. Setting the properties as system properties. (i.e. using JVM's -D option)
  3. Properties set from file specified by "ORBpropStorage" property
  4. Setting the second parameter of ORB.init(args, props);
  5. Default ORB properties

 


#Security
#arguments
#ORB.Init
#VisiBroker
#properties