Event listener

An event listener plugin module is an object which is notified when certain internal Crucible or Fisheye events occur.To include an event listener module add a listener element to your atlassian-plugins.xml file:

1
2
<listener key="example-listener" class="com.atlassian.crucible.example.plugin.spring.ExampleListener"/>

and create a class which implements com.atlassian.event.EventListener. See the Fisheye event and Crucible event javadoc for specific event types. See the javadoc for EventListener to understand the general details regarding events.

For example, if we want to listen for all events, and print a message to standard output we would write:

1
2
public class ExampleListener implements EventListener {
    public void handleEvent(Event event) {
        System.out.println("Got event: " + event);
    }

    public Class[] getHandledEventClasses() {
        return new Class[0];
    }
}

Event listeners may implement StateAware if they need to be notified when the module is enabled or disabled.

Rate this page: