Find Questions…

Close ×
First time here? Check out the FAQ!

Is there an interface equivalent to Startable in Confluence?

Julien Hoarau asked this question · 1,141 karma ·

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)

573 views

3 Answers:

Charles Miller [Atlassian] · 1,081 karma ·

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.

Julien Hoarau · 1,141 karma ·

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

Charles Miller [Atlassian] · 1,081 karma ·

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

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

Julien Hoarau · 1,141 karma ·

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

Ben Woskow [Atlassian] · 1,567 karma ·

Julien Hoarau · 1,141 karma ·

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

James Dumay [Atlassian] · 4,614 karma ·

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

Ben Woskow [Atlassian] · 1,567 karma ·

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.

Julien Hoarau · 1,141 karma ·

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

Looking for something else?

Find Questions…

or Browse other questions tagged:

or Ask a Question