XmlBlaster Logo

REQUIREMENT

util.property.env

XmlBlaster Logo


Type NEW
Priority LOW
Status INWORK
Topic The xmlBlaster.properties file and command line configuration
Des
cription

The xmlBlaster.properties file, JVM environment (system properties) and command line settings allows to customize the behavior of xmlBlaster and of xmlBlaster clients.
The option -help gives you an overview of the possibilities on server and on client side:

java org.xmlBlaster.Main -help

java HelloWorld3 -help
   

Here are some examples:

java org.xmlBlaster.Main -bootstrapPort 5600 -logging/org.xmlBlaster.util.protocol.RequestReplyExecutor FINEST

java HelloWorld3 -bootstrapHostname myServer -bootstrapPort 5600 -logging FINE
   

We force the server to listen on port 5600 and switch method call logging of the SOCKET component on. The client is configured to search for the server on host myServer on port 5600 and has switched trace logging on.

The same could be done as Java virtual machine system properties:

java -DbootstrapPort=5600 -Dlogging/org.xmlBlaster.util.protocol.RequestReplyExecutor=FINEST org.xmlBlaster.Main

java -DbootstrapHostname=myServer -DbootstrapPort=5600 -Dlogging=FINE HelloWorld3
  

Forcing for example generally the port to 5600 could be done in $HOME/xmlBlaster.properties like:

bootstrapPort=5600
   

Note that we ommit the dash - in the property file. All properties from the file are usable on command line or as JVM settings and vice versa.

Precedence

Precedence Location Example Comment
1 (highest) Code address.setBootstrapPort(6677) Setting properties explicitly in your code has highest precedence
2 Command line java HelloWorld3 -bootstrapPort 6677 Setting properties on command line
3 JVM environment java -DbootstrapPort=6677 HelloWorld3 Setting java virtual machine system properties
4 Property file bootstrapPort=6677 Setting properties in xmlBlaster.properties. For the search precedence of this file see the requirement util.property
5 Plugins Property file <attribute id='bootstrapPort'>6677</attribute> Setting properties in xmlBlasterPlugins.xml (for plugins ONLY!). For the search precedence of this file see the requirement engine.runlevel
6 (lowest) Default 3412 Every properties has a reasonable default setting

Every property can be specified more or less qualified which introduces further precedence levels in location 2, 3 and 4 of the above precedence locations:

Precedence sub-levelsLocationComment
1 (highest)/node/heron/dispatch/callback/protocolA fully qualified name
2dispatch/callback/protocolSetting it for all cluster nodes
3 (lowest)protocolSetting it generally to e.g. XMLRPC

Environment variables replacement

Any property you specify you can use as a variable in other properties, regardless of if they are from the property file or from command line or from the JVM environment. If you have recursion of properties referencing each others we give up at fifty nested levels. Examples for reuse of properties:

MyHostname=server.com.universe

bootstrapHostname=${MyHostname}

plugin/xmlrpc/hostname=${MyHostname}

plugin/socket/hostname=${MyHostname}
   

All environment variable (e.g. ${java.io.tmpdir}="/tmp", ${file.separator}="/") can be used in the properties file or on command line and are replaced on occurrence:

java org.xmlBlaster.Main -plugin/ior/iorFile '${file.separator}tmp${file.separator}Server.ior'
   

This dumps the CORBA IOR to the file /tmp/Server.ior on UNIX and to \tmp\Server.ior on Windows.

These are often helpful variables

  • ${user.dir} = The current directory
  • ${user.home} = The users home directory

user.dir and user.home are without a path separator at the end.

Note:

If a variable cannot be resolved the library throws an exception and stops execution. If you want to allow unresolved variables write them like $_{MyHostname} instead of ${MyHostname}.

Example
Java

The variables which you specify with ${...} will be replaced by their values. The variable may be from the System properties, xmlBlaster.properties or from the command line.

For example you could define a variable in xmlBlaster.properties:

        XMLBLASTER_HOME=${user.home}/xmlBlaster

and use it as a variable in this file, e.g.

        MY_XSL_DIR=${XMLBLASTER_HOME}/xsl

Note the use of the JVM property 'user.home'.

Another example could be

        java -DmyName=joe ...

and use it as a variable in this file, e.g.

        TEXT=Hello ${myName}, have a nice day.
   
Configure

NOTE: Configuration parameters are specified on command line (-someValue 17) or in the xmlBlaster.properties file (someValue=17). See requirement "util.property" for details.
Columns named Impl tells you if the feature is implemented.
Columns named Hot tells you if the configuration is changeable in hot operation.

Todo
  1. We need to port all properties to the new hierarchical syntax like 'dispatch/connection/plugin/rmi/port'
  2. We need to consolidate the naming of the properties with the XML markup in requirements admin.commands and client.configuration.
See REQ util.property
See REQ admin.commands
See REQ client.configuration
See API org.xmlBlaster.util.property.PropEntry
See TEST org.xmlBlaster.test.AllTests

This page is generated from the requirement XML file xmlBlaster/doc/requirements/util.property.env.xml

Back to overview