com.ibm.wbi
Class Plugin

java.lang.Object
  |
  +--com.ibm.wbi.Plugin
Direct Known Subclasses:
HttpPlugin

public abstract class Plugin
extends java.lang.Object

A Plugin is a component that can be added to the Proxy to do content tailoring. The Plugin is used as a wrapper around a set of megs that all do related tailoring. There are four state methods of a Plugin signaled by these four method calls: initialize(String) enable() disable() terminate(String). Megs should be added to the Plugin by using the addMeg(Meg) method usually in the initialize() call.


Constructor Summary
Plugin()
          Constructs a new empty Plugin.
 
Method Summary
 void addMeg(Meg meg)
          Add a Meg to the Plugin.
 void addMeg(Monitor monitor, Editor editor)
          Add a Monitor to the Plugin that will be run after the specified Editor.
 void disable()
          Called when the Plugin is disabled after being enabled.
 void enable()
          Called when the Plugin is enabled after being disabled.
 java.lang.String getClassName()
          Get the class name for this plugin.
 java.lang.String getDescription()
          Get the description of the Plugin.
 java.lang.String getDescriptiveName()
          Get the descriptive name of the Plugin.
 Section getHomeSection()
          Get this plugin's home Section
 java.lang.String getInstallName()
          Get the install name which is just the name of the plugin.
 int getMajorVersion()
          Get the major version number of the Plugin.
 int getMinorVersion()
          Get the minor version number of the Plugin.
 java.lang.String getName()
           
 java.lang.String getPluginName()
          Get the fully-qualified class name of the Plugin.
 java.lang.String getRegistrationData()
          Get the extra data specified in the registration file associated with this instance of the plugin.
 java.lang.String getSetupUrl()
          Get the setup URL for this plugin.
 SystemContext getSystemContext()
          Get the SystemContext object that was set at initialization time.
 void initialize()
          Called when the Plugin is initialized.
 void initialize(java.lang.String initString)
          Deprecated. Override initialize() instead and use getSystemContext()
 void initialize(SystemContext systemContext)
          Deprecated. Override initialize() instead and use getSystemContext()
 boolean isEnabled()
          Is the Plugin enabled?
 boolean isLoaded()
          Determines if this Plugin is loaded by the Proxy.
 java.util.Enumeration megs()
          Get all the Megs added to this Plugin.
 boolean removeMeg(Meg meg)
          Remove a Meg from the Plugin.
 void setEnabled(boolean status)
          Once a Plugin is loaded with the Proxy, this method can be used to set it's enabled state (and all it's associated Megs).
 void setSetupUrl(java.lang.String setupUrl)
          Set the setup URL for this plugin.
 void setSystemContext(SystemContext systemContext)
          Set the SystemContext object for this Plugin.
 void terminate()
          Called when Plugin is terminated.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Plugin

public Plugin()
Constructs a new empty Plugin.
Method Detail

initialize

public void initialize()
                throws com.ibm.wbi.PluginException

Called when the Plugin is initialized. Plugin subclasses should override this method and do any Plugin-specific initialization that needs to be done. In many cases this includes instantiating Megs and adding them to the system by calling addMeg(...). The SystemContext variable is available through getSystemContext().

See Also:
addMeg(com.ibm.wbi.Meg), getSystemContext()

initialize

public void initialize(SystemContext systemContext)
                throws com.ibm.wbi.PluginException
Deprecated. Override initialize() instead and use getSystemContext()

See Also:
initialize(), getSystemContext()

initialize

public void initialize(java.lang.String initString)
Deprecated. Override initialize() instead and use getSystemContext()

See Also:
initialize(), getSystemContext()

setSystemContext

public void setSystemContext(SystemContext systemContext)
Set the SystemContext object for this Plugin. This method should only be called by the object administrating the plugins.
Parameters:
systemContext - Holds "static" information that pertains to the engine that the Meg is running under. Implementations are encouraged to not store this object put instead obtain it from the getSystemContext() method.

getSystemContext

public SystemContext getSystemContext()
Get the SystemContext object that was set at initialization time.
Returns:
The system context.

enable

public void enable()
            throws com.ibm.wbi.PluginException
Called when the Plugin is enabled after being disabled.
Throws:
com.ibm.wbi.PluginException - Thrown if an error occurs.

disable

public void disable()
             throws com.ibm.wbi.PluginException
Called when the Plugin is disabled after being enabled.
Throws:
com.ibm.wbi.PluginException - Thrown if an error occurs.

terminate

public void terminate()
               throws com.ibm.wbi.PluginException
Called when Plugin is terminated.
Throws:
com.ibm.wbi.PluginException - Thrown if an error occurs.

megs

public final java.util.Enumeration megs()
Get all the Megs added to this Plugin.
Returns:
An Enumeration of the added Megs.

addMeg

public final void addMeg(Meg meg)
                  throws PluginError
Add a Meg to the Plugin. This is usually done in the initialize(String) method.

This method is synchronized to make sure that the initialization state of the Plugin changes atomically with respect to adding Megs.

Parameters:
meg - The Meg to add.
Throws:
PluginError - If any error occurs.

removeMeg

public final boolean removeMeg(Meg meg)
                        throws PluginError
Remove a Meg from the Plugin.

This method is synchronized to make sure that the initialization state of the Plugin changes atomically with respect to adding/removing Megs.

Parameters:
meg - The Meg to remove.

addMeg

public final void addMeg(Monitor monitor,
                         Editor editor)
                  throws PluginError
Add a Monitor to the Plugin that will be run after the specified Editor.
Parameters:
monitor - The Monitor to add.
editor - The Editor to run Monitor after.
Throws:
PluginError - If any error occurs.

getMajorVersion

public final int getMajorVersion()
Get the major version number of the Plugin.
Returns:
The major version number.

getMinorVersion

public final int getMinorVersion()
Get the minor version number of the Plugin.
Returns:
The minor version number.

getPluginName

public final java.lang.String getPluginName()
Get the fully-qualified class name of the Plugin.
Returns:
The Plugin class name.

getDescriptiveName

public final java.lang.String getDescriptiveName()
Get the descriptive name of the Plugin.
Returns:
The descriptive name.

getDescription

public final java.lang.String getDescription()
Get the description of the Plugin.
Returns:
The description.

isEnabled

public final boolean isEnabled()
Is the Plugin enabled?
Returns:
Enabled state.

setEnabled

public final void setEnabled(boolean status)
Once a Plugin is loaded with the Proxy, this method can be used to set it's enabled state (and all it's associated Megs). If the Plugin is not currently registered with the Proxy, this method does nothing.
Parameters:
status - The enabled status of the Plugin.

getInstallName

public java.lang.String getInstallName()
Get the install name which is just the name of the plugin. This is used as a unique identifier of the Plugin in the Proxy.
Returns:
The plugin install name.

getName

public java.lang.String getName()

getClassName

public java.lang.String getClassName()
Get the class name for this plugin.

isLoaded

public boolean isLoaded()
Determines if this Plugin is loaded by the Proxy.
Returns:
true if Plugin loaded normally; false if there were problems loading the Plugin.

getSetupUrl

public final java.lang.String getSetupUrl()
Get the setup URL for this plugin.
Returns:
the URL for configuring this plugin

setSetupUrl

public final void setSetupUrl(java.lang.String setupUrl)
Set the setup URL for this plugin.
Parameters:
setupUrl - the URL for configuring this plugin

getRegistrationData

public java.lang.String getRegistrationData()
Get the extra data specified in the registration file associated with this instance of the plugin.
Returns:
data specified in reg file.

getHomeSection

public Section getHomeSection()
Get this plugin's home Section
Returns:
The plugin home Section