help, access to configuration parameters across services
I am working on enhancement 176360, email templates
https://jazz.net/jazz/resource/itemName/com.ibm.team.workitem.WorkItem/176360 I added config parameters to the jts.mailer service plugin to define the location of the templates, and which template to be used for each function (mention, change, approval).. I now need to access those parms from the code generating the mail text, but that code is running in a different 'service' (plugin) context.. is there any way to do this across plugins? getStringConfigProperty("notification.mail.template.directory") thanks for any guidance. |
5 answers
I think the best approach would be to define accessor methods on the service that "owns" the configuration properties. Then other services can get a handle to the owning service (via AbstractService.getService()) and call the accessor methods to get property values.
I am working on enhancement 176360, email templates |
thanks.. I was 'hoping' that functionality already existed.
the message builder already does a getService() for the mailer, but accesses the Interface level class private IMailerService getMailerService() { course iMailerService doesn't have these accessor methods.. worried about changing the interface definition and having to recompile all those classes. easy for the dev team on a full release. this should really be an AbstractService function. |
so, continuing on..
I added a method to the IInternalMailerService in com.ibm.team.repository.service.jts.mailer and implemented in MailerService. the IInternalmailerService was already exported in the plugin, and this is where the config parms are defined. <serviceProvider In the ChangeEventMailNotifier class I added an import for the interface and this code to connect and get the parm. (added the service as a required service to plugin.xml) String templatePath="/jts/templates"; the connect works, and the call to the service works.. BUT.. I get back the DEFAULT config parm value, not its CURRENT value. <configurationProperty I have done this config parm service on another plugin which works correctly, both inside the server and from a client.. in the server admin panel it shows like this Mail template directory /jts/templates my getConfigProperty method hides the parm type details public Object getConfigProperty(String id) what subtle difference did I miss? |
Ok, the problem with the wrong config property value is caused by the fact that the *jts* plugins are also deployed in the CCM application, so getService(classname) is finding the one nearest to the caller.
com.ibm.team.repository.service.jts.mailer_3.0.1.v20110524_1821 is in ...../server/conf/ccm/sites/update-site/plugins altho its only used in Jts hmmmm Sam |
bump.. anyone have any ideas?
my direct mail is the same userid, on gmail Sam |
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.