Jazz Forum Welcome to the Jazz Community Forum Connect and collaborate with IBM Engineering experts and users

custom properties for an advisor in WAS

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/ourf.properties 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 ...... ?

0 votes



3 answers

Permanent link
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
}

0 votes

Comments

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

<followup-action id="com.acme.followup" name="My custom follow up action" optional="false">
<user-dir>/somedir/configs/WebSphereD01/AppServer/</user-dir>
<enviFileName>
ourf.properties</enviFileName>
</followup-action>

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.

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
Follow https://rsjazz.wordpress.com/2015/09/30/learning-to-fly-getting-started-with-the-rtc-java-apis/ and do the Extensions Workshop to see how that works.

0 votes

Comments

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


Permanent link
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.

0 votes

Comments

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

When I just tried it, I got and error though.

java.io.FileNotFoundException: file:\C%3a\RTC40Dev\installs\JAZZTE~1\server\conf\myFile.properties

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

Any hints on what to look at there?

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

Your answer

Register or log in to post your answer.

Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.

Search context
Follow this question

By Email: 

Once you sign in you will be able to subscribe for any updates here.

By RSS:

Answers
Answers and Comments
Question details
× 10,943

Question asked: Jan 25 '16, 12:25 p.m.

Question was seen: 2,604 times

Last updated: Jan 25 '16, 8:05 p.m.

Confirmation Cancel Confirm