Icon
Join thousands of Atlassian users for an unforgettable week of knowledge sharing, product training, networking, and fun. Atlassian Summit is Oct 10 - 13 in San Jose, CA – Register soon before tickets sell out.
Icon
Maintenance Notice: answers.atlassian.com will undergo maintenance on 24 Sep 2016, from 22:00 - 07:00 UTC. During this maintenance window, the service may be intermittently unavailable. See our status page for details.
 
3
2
1

Is there an interface equivalent to com.atlassian.jira.extension.Startable in Confluence?

This interface allows Components to be notified of when the JIRA application has started. (After the plugin system is initialised and components added to the dependency injection framework)

    CommentAdd your comment...

    3 answers

    1.  
      6
      5
      4

      InitializingBean may not be what you want. Your plugin will be initialised on system startup with the rest of the plugins, but there's no guarantee that Confluence is entirely ready to serve at that point.

      To be notified when Confluence is started, create an event listener plugin module that listens for the ConfluenceReadyEvent.

      1. Julien Hoarau

        ConfluenceReadyEvent seems to be the one but I can't manage to catch it within my plugin using an EventListener annotation.

      2. Charles Miller [Atlassian]

        Have you tried writing an event listener module rather than using annotations?

        http://confluence.atlassian.com/display/CONFDEV/Event+Listener+Module

      3. Julien Hoarau

        I'll try that thanks.

      4. Julien Hoarau

        It doesn't work either with an event listener module. too bad...

      5. Julien Hoarau

        Yes I did register my class with the EventPublisher in a afterPropertiesSet method.

      CommentAdd your comment...
    2.  
      5
      4
      3

      Your best bet is probably the Shared Access Layers LifecycleAware interface[1]. onStart() is called when the application has been correctly started and this works for all products.

      To use it implement it on a new object and register your object as a component [2] in your atlassian-plugin.xml. To make it visiable to the application you need to add <interface>com.atlassian.sal.api.lifecycle.LifecycleAware</interface> between the <component> tags.

      [1] http://docs.atlassian.com/sal-api/2.2.1/sal-api/apidocs/com/atlassian/sal/api/lifecycle/LifecycleAware.html

      [2] http://confluence.atlassian.com/display/JIRA/Component+Plugin+Module

        CommentAdd your comment...
      1.  
        3
        2
        1

        You can implement Spring's InitializingBean interface. While this interface isn't Confluence's specific (it will work for JIRA plugins as well), it's afterPropertiesSet() method will be called after initialization.

        1. Julien Hoarau

          As Charles said it, if I use InitializingBean there's no guarantee that Confluence is entirely ready.

        CommentAdd your comment...