Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to get value of environment variable in Java Collaboration Rul

Status
Not open for further replies.

meenasar

Programmer
Jun 6, 2003
8
0
0
IN
Hello

I want to get the value of an environment variable in my Java
Collaboration rule.

any idea???

meenasar.
 
Hi Meenasar,

It may be useful to consider using a configuration file, more commonly called a properties file -- using Properties class.

System.getEnv() method is deprecated in Java 1.3.1

Also, since you seem to be using eGate, consider the limitation of using environment variables. Since eWay processes are child processes of the control broker, the environment is inherited in the same way. Therefore, changing enviroment variable will require you shut all components from JMS Servers (IQ Managers) to e*Way all the way to the Control broker.

To use the properties file you may want to enter the following in the collabroation rule "initialization string"

-def <key_value>=&quot;D:\eGate\client\tmif01\configs\tmi\BndSvc\Properties\CNX.properties&quot;

In the collaboration rule code:

String propertyFile = System.getProperty(<key_value>);

Then with the location of the property file (in this case CNX.properties) you can use the Properties class to get a the values you need.

It is most common to use this feature within the userInitialize() method of the collaboration rule -- but rememeber that exceptions in this method do not prevent the executeBusinessRule() method from executing -- althgouth workaround exist for that too.

This forum has good help on using the Properties class.

If you need more help, just ask.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top