com.tibbo.aggregate.common.plugin

## Class BasePlugin

- java.lang.Object
- - org.java.plugin.Plugin
  - - com.tibbo.aggregate.common.plugin.BasePlugin

- All Implemented Interfaces:
    AggreGatePlugin, java.lang.Comparable<AggreGatePlugin>
  Direct Known Subclasses:
    AbstractAuthenticationPlugin, AbstractContextPlugin, AbstractDeviceDriver, ExtensionsPlugin

      public abstract class BasePlugin
      extends org.java.plugin.Plugin
      implements AggreGatePlugin, java.lang.Comparable<AggreGatePlugin>

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static int` | `INDEX_HIGH`
    `static int` | `INDEX_HIGHER`
    `static int` | `INDEX_HIGHEST`
    `static int` | `INDEX_LOW`
    `static int` | `INDEX_LOWER`
    `static int` | `INDEX_LOWEST`
    `static int` | `INDEX_NORMAL`
    `static int` | `INDEX_VERY_HIGH`
    `static int` | `INDEX_VERY_LOW`

    - ### Fields inherited from class org.java.plugin.Plugin

      `log`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `BasePlugin()`
    `BasePlugin(java.lang.String description)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `int` | `compareTo(AggreGatePlugin other)`
    `Context` | `createGlobalConfigContext(Context rootContext, boolean requestReboot, Permissions permissions, VariableDefinition... properties)`
    `Context` | `createGlobalConfigContext(Context rootContext, boolean requestReboot, VariableDefinition... properties)` This method creates and returns context containing plugin's global configuration.
    `Context` | `createUserConfigContext(Context userContext, boolean requestReboot, VariableDefinition... properties)` This method creates and returns context containing plugin's user-level configuration.
    `protected void` | `doStart()`
    `protected void` | `doStop()`
    `java.lang.String` | `getDescription()` Returns plugin description
    `Context` | `getGlobalConfigContext()` Returns plugin's global configuration context
    `java.lang.String` | `getId()` Returns plugin ID
    `PluginDirector` | `getPluginDirector()`
    `java.lang.String` | `getShortId()` Returns plugin short ID (last "segment" of full ID).
    `int` | `getSortIndex()` Returns sort index used to sort plugins in the list.
    `Context` | `getUserConfigContext(java.lang.String username)` Returns plugin's user-level configuration context or NULL if user-level configuration is disabled for the user.
    `void` | `globalDeinit(Context rootContext)` This method is called once during server shutdown.
    `void` | `globalInit(Context rootContext)` This method is called once during server startup.
    `void` | `globalStart()` This method is called once for every plugin at the moment when server context tree is fully initialized and all contexts are available.
    `void` | `globalStop()` This method is called once for every plugin upon server shutdown.
    `void` | `setDescription(java.lang.String description)`
    `void` | `setId(java.lang.String id)`
    `protected void` | `setIndex(int index)`
    `void` | `setPluginDirector(PluginDirector pluginDirector)`
    `void` | `userDeinit(Context userContext)` This method is called once for every system user upon its deletion or server shutdown.
    `void` | `userInit(Context userContext)` This method is called once for every system user upon its creation or server startup.

    - ### Methods inherited from class org.java.plugin.Plugin

      `getDescriptor, getManager, isActive, toString`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### Field Detail

    - #### INDEX_HIGHEST

          public static final int INDEX_HIGHEST

      See Also:
        Constant Field Values

    - #### INDEX_VERY_HIGH

          public static final int INDEX_VERY_HIGH

      See Also:
        Constant Field Values

    - #### INDEX_HIGH

          public static final int INDEX_HIGH

      See Also:
        Constant Field Values

    - #### INDEX_HIGHER

          public static final int INDEX_HIGHER

      See Also:
        Constant Field Values

    - #### INDEX_NORMAL

          public static final int INDEX_NORMAL

      See Also:
        Constant Field Values

    - #### INDEX_LOWER

          public static final int INDEX_LOWER

      See Also:
        Constant Field Values

    - #### INDEX_LOW

          public static final int INDEX_LOW

      See Also:
        Constant Field Values

    - #### INDEX_VERY_LOW

          public static final int INDEX_VERY_LOW

      See Also:
        Constant Field Values

    - #### INDEX_LOWEST

          public static final int INDEX_LOWEST

      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### BasePlugin

          public BasePlugin()

    - #### BasePlugin

          public BasePlugin(java.lang.String description)

  - ### Method Detail

    - #### getId

          public java.lang.String getId()

      Description copied from interface: `AggreGatePlugin`
      Returns plugin ID
      Specified by:
        `getId` in interface `AggreGatePlugin`
      Returns:
        Plugin ID

    - #### setId

          public void setId(java.lang.String id)

    - #### getShortId

          public java.lang.String getShortId()

      Description copied from interface: `AggreGatePlugin`
      Returns plugin short ID (last "segment" of full ID).
      Specified by:
        `getShortId` in interface `AggreGatePlugin`
      Returns:
        Plugin short ID

    - #### getDescription

          public java.lang.String getDescription()

      Description copied from interface: `AggreGatePlugin`
      Returns plugin description
      Specified by:
        `getDescription` in interface `AggreGatePlugin`
      Returns:
        Plugin description

    - #### setDescription

          public void setDescription(java.lang.String description)

    - #### getPluginDirector

          public PluginDirector getPluginDirector()

    - #### setPluginDirector

          public void setPluginDirector(PluginDirector pluginDirector)

    - #### createGlobalConfigContext

          public Context createGlobalConfigContext(Context rootContext,
                                                   boolean requestReboot,
                                                   VariableDefinition... properties)

      Description copied from interface: `AggreGatePlugin`
      This method creates and returns context containing plugin's global configuration. There is no need to keep reference to this context for future use as it may be accessed via getGlobalConfigContext() method.
      Specified by:
        `createGlobalConfigContext` in interface `AggreGatePlugin`
      Parameters:
        `rootContext` - Server root context
        `requestReboot` - Prompt an operator to reboot server after a global plugin property change
        `properties` - List of global plugin properties
      Returns:
        Plugin global config context

    - #### createGlobalConfigContext

          public Context createGlobalConfigContext(Context rootContext,
                                                   boolean requestReboot,
                                                   Permissions permissions,
                                                   VariableDefinition... properties)

    - #### createUserConfigContext

          public Context createUserConfigContext(Context userContext,
                                                 boolean requestReboot,
                                                 VariableDefinition... properties)

      Description copied from interface: `AggreGatePlugin`
      This method creates and returns context containing plugin's user-level configuration. There is no need to keep reference to this context for future use as it may be accessed via getUserConfigContext() method.
      Specified by:
        `createUserConfigContext` in interface `AggreGatePlugin`
      Parameters:
        `userContext` - Context of user to associate the configuration with
        `requestReboot` - Prompt an operator to reboot server after a global plugin property change
        `properties` - List of user-level plugin properties
      Returns:
        Plugin user-level config context

    - #### getGlobalConfigContext

          public Context getGlobalConfigContext()

      Description copied from interface: `AggreGatePlugin`
      Returns plugin's global configuration context
      Specified by:
        `getGlobalConfigContext` in interface `AggreGatePlugin`
      Returns:
        Global configuration context

    - #### getUserConfigContext

          public Context getUserConfigContext(java.lang.String username)

      Description copied from interface: `AggreGatePlugin`
      Returns plugin's user-level configuration context or NULL if user-level configuration is disabled for the user.
      Specified by:
        `getUserConfigContext` in interface `AggreGatePlugin`
      Returns:
        User-level configuration context

    - #### getSortIndex

          public int getSortIndex()

      Description copied from interface: `AggreGatePlugin`
      Returns sort index used to sort plugins in the list. Plugins with zero sort index are used according to their descriptions.
      Specified by:
        `getSortIndex` in interface `AggreGatePlugin`
      Returns:
        Plugin sort index

    - #### setIndex

          protected void setIndex(int index)

    - #### compareTo

          public int compareTo(AggreGatePlugin other)

      Specified by:
        `compareTo` in interface `java.lang.Comparable<AggreGatePlugin>`

    - #### doStart

          protected void doStart()
                          throws java.lang.Exception

      Specified by:
        `doStart` in class `org.java.plugin.Plugin`
      Throws:
        `java.lang.Exception`

    - #### doStop

          protected void doStop()
                         throws java.lang.Exception

      Specified by:
        `doStop` in class `org.java.plugin.Plugin`
      Throws:
        `java.lang.Exception`

    - #### globalInit

          public void globalInit(Context rootContext)
                          throws PluginException

      Description copied from interface: `AggreGatePlugin`
      This method is called once during server startup. Its implementation will in most cases call createGlobalConfigContext() to create plugin global configuration. Another typical use is opening some listening server socket to accept connections or receive network datagrams. Note, that this method is called during server context tree initialization. Not all server contexts may be available at the time of its call. To access any server context during plugin startup, override globalStart() method.
      Specified by:
        `globalInit` in interface `AggreGatePlugin`
      Throws:
        `PluginException` - If an error occurred during initialization

    - #### globalDeinit

          public void globalDeinit(Context rootContext)
                            throws PluginException

      Description copied from interface: `AggreGatePlugin`
      This method is called once during server shutdown. It's usually used to terminate any threads created by the plugin and close all server sockets opened by it.
      Specified by:
        `globalDeinit` in interface `AggreGatePlugin`
      Throws:
        `PluginException` - If an error occurred during de-initialization

    - #### userInit

          public void userInit(Context userContext)
                        throws PluginException

      Description copied from interface: `AggreGatePlugin`
      This method is called once for every system user upon its creation or server startup. Its implementation will in most cases call createUserConfigContext() to create plugin user-level configuration. This method won't be called if user-level configuration is disabled for the user.
      Specified by:
        `userInit` in interface `AggreGatePlugin`
      Throws:
        `PluginException` - If an error occurred during initialization

    - #### userDeinit

          public void userDeinit(Context userContext)
                          throws PluginException

      Description copied from interface: `AggreGatePlugin`
      This method is called once for every system user upon its deletion or server shutdown. The method will be called even if user-level configuration is disabled for the user.
      Specified by:
        `userDeinit` in interface `AggreGatePlugin`
      Throws:
        `PluginException` - If an error occurred during de-initialization

    - #### globalStart

          public void globalStart()
                           throws PluginException

      Description copied from interface: `AggreGatePlugin`
      This method is called once for every plugin at the moment when server context tree is fully initialized and all contexts are available.
      Specified by:
        `globalStart` in interface `AggreGatePlugin`
      Throws:
        `PluginException` - If an error occurred during plugin startup

    - #### globalStop

          public void globalStop()
                          throws PluginException

      Description copied from interface: `AggreGatePlugin`
      This method is called once for every plugin upon server shutdown.
      Specified by:
        `globalStop` in interface `AggreGatePlugin`
      Throws:
        `PluginException` - If an error occurred during plugin shutdown