Is there an interface equivalent to Startable in Confluence?

Julien Hoarau
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 24, 2011

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)

3 answers

1 accepted

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

5 votes
Answer accepted
CharlesA
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 24, 2011

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
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 24, 2011

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

CharlesA
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 24, 2011

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

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

Julien Hoarau
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 24, 2011

I'll try that thanks.

Julien Hoarau
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 24, 2011

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

BenW
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
May 24, 2011
Julien Hoarau
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 24, 2011

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

4 votes
James Dumay
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
May 25, 2011

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

2 votes
BenW
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
May 24, 2011

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
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 24, 2011

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

TAGS
AUG Leaders

Atlassian Community Events