It's all about the answers!

Ask a question

custom properties for an advisor in WAS

Martina Riedel (20323241) | asked Jan 25 '16, 12:25 p.m.

RTC 4.0.5

We have developed a custom advisor that requires its own property file.

We have put the property file at INSTALLDIR/server/conf (ideally it would be at INSTALLDIR/server/conf/jazz).

In our advisor dev env with tomcat, finding that file via

String propFile = System.getProperty("user.dir")+ File.separatorChar + "conf" + File.separatorChar + envFileName;

works just fine, but when we deploy it to the "real" RTC dev env that runs on WAS, we get an error that /somedir/configs/WebSphereD01/AppServer/conf/ cannot be found.

Is there some default or standard property that we can read to find the server/conf/jazz (or server/conf/ccm) directory from an advisor or do we need to get the WAS admin to create a custom property for us or ...... ?

3 answers

permanent link
Tiago Moura (8387) | answered Jan 25 '16, 12:40 p.m.
edited Jan 25 '16, 12:42 p.m.
It isn't the best pratice to pass configuration parameter to an custom precondition or followup action.

Instead using properties files you can add such configurations inside the process configuration xml. So you have an easy way to access throught the "participantConfig" parameter on the "run" method.

    public void run(AdvisableOperation operation, IProcessConfigurationElement participantConfig, IParticipantInfoCollector collector,
            IProgressMonitor monitor) throws TeamRepositoryException {

//.... your code here

Tiago Moura commented Jan 25 '16, 12:48 p.m.

Complementing... An example of xml with such configurations:

<followup-action id="com.acme.followup" name="My custom follow up action" optional="false">

Martina Riedel commented Jan 25 '16, 3:14 p.m.

The problem with doing it this way is that we have to put it in every project we activate this advisor for. The content of that property file is a server-wide setting. The content of the property file will be different for the RTC dev, RTC test and RTC prod server.

So we want it to be at a standardized location, the server/conf (ideally server/conf/jazz), but I'd prefer to not hard code it to the current install-path of server.

Although that will definitely be the lesser evil than hard-coding it in umpteen projects.

Tiago Moura commented Jan 25 '16, 3:18 p.m.

But you can configure the filepath to the property file beside the properties.

The advisor's configuration is exported with the template, so you do not need to configure all projects, one by one.

permanent link
Ralph Schoon (61.8k33643) | answered Jan 25 '16, 1:08 p.m.
Follow and do the Extensions Workshop to see how that works.

Martina Riedel commented Jan 25 '16, 3:15 p.m.

done that already .... this q gores beyond what is in there.

permanent link
Donald Nong (14.5k314) | answered Jan 25 '16, 6:12 p.m.
Java property "user.dir" returns the path where Java runs from, which apparently varies across deployments. If you are concerned about "installation path", why not use the "JAZZ_HOME" property - this is the first thing came to mind when I read your post.

Martina Riedel commented Jan 25 '16, 7:14 p.m.

yes, that is pretty much what I was looking for.

When I just tried it, I got and error though. file:\C%3a\RTC40Dev\installs\JAZZTE~1\server\conf\

I see the file:\C%3a\ all over the provisioning log and there it works.

Any hints on what to look at there?

Donald Nong commented Jan 25 '16, 8:05 p.m.

You may have to convert %3a to colon (:) in your code before trying to open the file.

Your answer

Register or to post your answer.