This server will be upgraded at 3pm Sydney time on December 3rd (December 2nd, 8pm PST) and will be down for up to 30 minutes.
This documentation relates to an early version of Confluence.
View this page in the current documentation or visit the current documentation home.

StateAware

All Versions
Click for all versions
Confluence 2.0 to 2.5 Documentation

Index

Description

The StateAware interface can be implemented by plugin modules which need to know when they are enabled or disabled.

Implementation

To be notified of enablement/disablement, implement the following in your Macro Plugins, Event Listener Plugins or Component Plugins:

public class YourMacro extends BaseMacro implements com.atlassian.plugin.StateAware

This has two methods you must implement:

public void enabled()
{
    // Your enablement code goes here.
}

public void disabled()
{
    // Your disablement code goes here.
}

Call Sequence

These methods are called in the following circumstances:

enabled()

  1. At server startup, if the plugin is already installed and enabled.
  2. If the plugin is installed via uploading
  3. If the plugin is enabled after having been disabled.
  4. If the specific module is enabled after having been disabled.

disabled()

  1. At server shutdown, if the plugin is installed and enabled.
  2. If the plugin is uninstalled.
  3. If the plugin is disabled.
  4. If the specific module is disabled.

Notes

Each method is only called once at each logical enablement/disablement event. Please note that the module class's constructor is not a reliable place to put initialisation code either, as the classes are often constructed or destructed more often than they are disabled/enabled. However, once enabled, the same class will remain in memory until it is disabled.

Known Issues

Supported Module Types

Not all module types have been tested, but the following have the following status:

Module Type Confluence Version Working
Macro Plugins 2.3.3
Component Plugins 2.3.3
Event Listener Plugins 2.3.3
Lifecycle Plugins 2.3.3
Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.