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 ...... ?
3 answers
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
}
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.
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.