com.alee.managers.plugin
Class Plugin<T extends Plugin<T>>

java.lang.Object
  extended by com.alee.managers.plugin.Plugin<T>

public abstract class Plugin<T extends Plugin<T>>
extends java.lang.Object

Base class for any plugin. You still might want to use AbstractPlugin instead as it has some basic plugin methods.

Author:
Mikle Garin
See Also:
How to use PluginManager, PluginManager

Field Summary
protected  DetectedPlugin<T> detectedPlugin
          Detected plugin information.
protected  boolean enabled
          Whether this plugin is enabled or not.
protected  InitializationStrategy initializationStrategy
          Cached plugin initialization strategy.
protected  PluginManager<T> pluginManager
          Plugin manager which loaded this plugin.
 
Constructor Summary
Plugin()
           
 
Method Summary
protected  InitializationStrategy createInitializationStrategy()
          Creates and returns plugin initialization strategy.
 void disable()
          Disables plugin runtime actions.
protected  void disabled()
          This method called when plugin is disabled.
 void enable()
          Enables plugin runtime actions.
protected  void enabled()
          This method called when plugin is re-enabled.
 java.lang.String getDescription()
          Returns plugin description.
 DetectedPlugin<T> getDetectedPlugin()
          Returns additional information about this plugin.
 java.lang.String getId()
          Returns plugin ID.
 InitializationStrategy getInitializationStrategy()
          Returns plugin initialization strategy.
 java.util.List<PluginLibrary> getLibraries()
          Returns plugin libraries list.
 java.lang.String getMainClass()
          Returns plugin main class.
 PluginInformation getPluginInformation()
          Returns information about this plugin.
 javax.swing.ImageIcon getPluginLogo()
          Returns plugin logo.
 PluginManager<T> getPluginManager()
          Returns plugin manager which loaded this plugin.
 java.lang.String getTitle()
          Returns plugin title.
 java.lang.String getType()
          Returns plugin type.
 java.lang.String getTypes()
          Returns plugin types.
 PluginVersion getVersion()
          Returns plugin version information.
 boolean isDisableable()
          Says whether plugin can be disabled in runtime or not.
 boolean isEnabled()
          Returns whether this plugin is enabled or not.
protected  void setDetectedPlugin(DetectedPlugin<T> detectedPlugin)
          Sets additional information about this plugin.
 void setEnabled(boolean enabled)
          Sets whether this plugin should be enabled or not.
protected  void setPluginManager(PluginManager<T> pluginManager)
          Sets plugin manager which loaded this plugin.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

pluginManager

protected PluginManager<T extends Plugin<T>> pluginManager
Plugin manager which loaded this plugin.


detectedPlugin

protected DetectedPlugin<T extends Plugin<T>> detectedPlugin
Detected plugin information.


initializationStrategy

protected InitializationStrategy initializationStrategy
Cached plugin initialization strategy.


enabled

protected boolean enabled
Whether this plugin is enabled or not.

Constructor Detail

Plugin

public Plugin()
Method Detail

getPluginManager

public PluginManager<T> getPluginManager()
Returns plugin manager which loaded this plugin.

Returns:
plugin manager which loaded this plugin

setPluginManager

protected void setPluginManager(PluginManager<T> pluginManager)
Sets plugin manager which loaded this plugin.

Parameters:
pluginManager - plugin manager which loaded this plugin

getDetectedPlugin

public DetectedPlugin<T> getDetectedPlugin()
Returns additional information about this plugin.

Returns:
additional information about this plugin

setDetectedPlugin

protected void setDetectedPlugin(DetectedPlugin<T> detectedPlugin)
Sets additional information about this plugin.

Parameters:
detectedPlugin - additional information about this plugin

getPluginInformation

public PluginInformation getPluginInformation()
Returns information about this plugin.

Returns:
information about this plugin

getPluginLogo

public javax.swing.ImageIcon getPluginLogo()
Returns plugin logo.

Returns:
plugin logo

getId

public java.lang.String getId()
Returns plugin ID.

Returns:
plugin ID

getType

public java.lang.String getType()
Returns plugin type.

Returns:
plugin type

getTypes

public java.lang.String getTypes()
Returns plugin types.

Returns:
plugin types

isDisableable

public boolean isDisableable()
Says whether plugin can be disabled in runtime or not. In some cases you don't want plugin to be disabled in runtime, for example if it is vital for system runtime. Note that if plugin is disableable but cannot be hot-loaded you won't be able to enable it after disabling.

Returns:
true if plugin can be disabled in runtime, false otherwise

getMainClass

public java.lang.String getMainClass()
Returns plugin main class.

Returns:
plugin main class

getTitle

public java.lang.String getTitle()
Returns plugin title.

Returns:
plugin title

getDescription

public java.lang.String getDescription()
Returns plugin description.

Returns:
plugin description

getVersion

public PluginVersion getVersion()
Returns plugin version information.

Returns:
plugin version information

getLibraries

public java.util.List<PluginLibrary> getLibraries()
Returns plugin libraries list.

Returns:
plugin libraries list

getInitializationStrategy

public InitializationStrategy getInitializationStrategy()
Returns plugin initialization strategy. It will determine sequence in which plugins are initialized.

Returns:
plugin initialization strategy

createInitializationStrategy

protected InitializationStrategy createInitializationStrategy()
Creates and returns plugin initialization strategy.

Returns:
plugin initialization strategy

disable

public final void disable()
Disables plugin runtime actions. It is up to developer to do the actual work, but base method still checks whether action is available or not.


disabled

protected void disabled()
This method called when plugin is disabled. Plugin should stop all its services and wait till re-enable or application exit.


enable

public final void enable()
Enables plugin runtime actions. It is up to developer to the actual work, but base method still checks whether action is available or not.


enabled

protected void enabled()
This method called when plugin is re-enabled. Plugin should restart all its services.


isEnabled

public boolean isEnabled()
Returns whether this plugin is enabled or not.

Returns:
true if this plugin is enabled, false otherwise

setEnabled

public void setEnabled(boolean enabled)
Sets whether this plugin should be enabled or not.

Parameters:
enabled - whether this plugin should be enabled or not