aschuma

ATL :: JIRA :: OSGI CM Service

Sep 27th, 2015
150
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.33 KB | None | 0 0
  1. ##
  2. ## JIRA 6.3 SETUP
  3. ##
  4.  
  5. (1) JVM Setup
  6. -Dfelix.fileinstall.dir=<...>/atlassian-jira-6.3.13-standalone/home/load -Dfelix.cm.loglevel=4 -Dfelix.fileinstall.loglevel=4
  7.  
  8. (2) Additional Bundles / JIRA Plugins
  9. org.apache.felix.fileinstall-2.0.8.jar
  10. org.apache.felix.configadmin-1.8.8.jar
  11.  
  12. (3) Activator Code
  13. -- SNIP --
  14. MyService service = new MyService();
  15. Dictionary<String,String> properties = new Hashtable<>();
  16. properties.put( Constants.SERVICE_PID, "myservice" );
  17. String[] classes = new String[] { MyService.class.getName(), ManagedService.class.getName() };
  18. final ServiceRegistration serviceRegistration = bundleContext.registerService(classes, service, properties);
  19. -- SNIP --
  20.  
  21. (4) Config Change Callback
  22. -- SNIP --
  23. public class MyService implements org.osgi.service.cm.ManagedService {
  24.  
  25. public void updated( Dictionary<String, ?> properties ) {
  26. if( properties != null ) {
  27. org.slf4j.LoggerFactory.getLogger(getClass()).error("" +properties);
  28. }
  29. }
  30. }
  31. -- SNIP --
  32.  
  33. (5) Configuration Directory "load" should contain a properties file myservice.cfg
  34.  
  35. (6) Define JIRA Component extending ManagedService with Service Property PID (+ public = true)
  36.  
  37. https://answers.atlassian.com/questions/140877/how-to-pass-a-parameter-to-a-spring-component?page=1#174536
Advertisement
Add Comment
Please, Sign In to add comment