org.kuali.rice.kew.plugin
Class PluginEnvironment

java.lang.Object
  extended by org.kuali.rice.kew.plugin.PluginEnvironment
All Implemented Interfaces:
Reloadable

public class PluginEnvironment
extends Object
implements Reloadable

A PluginEnvironment represents a Plugin and the PluginLoader from which it was loaded. Grouping these together allows us to execute a reload of the Plugin since the Plugin itself is not responsible for handling how it's own loading or reloading.

The PluginEnvironment also keeps a reference to the PluginRegistry because this allows it to add and remove Plugins as child resource loaders of the registry.

Author:
Kuali Rice Team (rice.collab@kuali.org)

Constructor Summary
PluginEnvironment(PluginLoader loader, PluginRegistry registry)
          Constructs an unloaded PluginEnvironment from the given PluginLoader and PluginRegistry.
PluginEnvironment(Plugin plugin, PluginLoader loader, PluginRegistry registry)
          Constructs a PluginEnvironment representing the given loaded Plugin.
 
Method Summary
 PluginLoader getLoader()
          Gets the PluginLoader which loaded the Plugin in this environment.
 Plugin getPlugin()
          Gets the Plugin represented by this environment.
 String getPluginName()
           
 boolean isLoaded()
          Returns true if this environment has been loaded, false otherwise.
 boolean isReloadable()
          Returns a boolean indicating whether or not this PluginEnvironment is truly reloadable.
 boolean isReloadNeeded()
          Indicates whether or not a reload of this environment is needed.
 void load()
          Loads the plugin from the PluginLoader.
 void reload()
          Reloads the environment by effectively executing an unload() followed by a load().
 void setSupressStartupFailure(boolean supressStartupFailure)
          By default, startup failure is supressed.
 void unload()
          Unloads the plugin.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PluginEnvironment

public PluginEnvironment(PluginLoader loader,
                         PluginRegistry registry)
Constructs an unloaded PluginEnvironment from the given PluginLoader and PluginRegistry. The environment will not be loaded until the first time that load() is executed.


PluginEnvironment

public PluginEnvironment(Plugin plugin,
                         PluginLoader loader,
                         PluginRegistry registry)
Constructs a PluginEnvironment representing the given loaded Plugin. Environments created in this manner will indicate that they are loaded from the moment they are constructed.

Method Detail

isLoaded

public boolean isLoaded()
Returns true if this environment has been loaded, false otherwise. If this method returns false then getPlugin() may return null if the environment was never loaded after construction.


isReloadable

public boolean isReloadable()
Returns a boolean indicating whether or not this PluginEnvironment is truly reloadable. This will return false if the Plugin represents a plugin which can not be reloaded.

Specified by:
isReloadable in interface Reloadable
Returns:
true if this Reloadable can be reloaded, false otherwise

isReloadNeeded

public boolean isReloadNeeded()
Indicates whether or not a reload of this environment is needed. If this method returns true, it should continue to return true until a reload() is executed.

Specified by:
isReloadNeeded in interface Reloadable

reload

public void reload()
            throws Exception
Reloads the environment by effectively executing an unload() followed by a load().

Specified by:
reload in interface Reloadable
Throws:
Exception

load

public void load()
          throws Exception
Loads the plugin from the PluginLoader. This will also start the Plugin and add it to the PluginRegistry's resoure loaders.

Throws:
Exception

unload

public void unload()
            throws Exception
Unloads the plugin. The effectively shuts the plugin down and removes it from the PluginRegistry's resource loaders.

Throws:
Exception

getPluginName

public String getPluginName()

getPlugin

public Plugin getPlugin()
Gets the Plugin represented by this environment. May be null if this environment has not yet been loaded.


getLoader

public PluginLoader getLoader()
Gets the PluginLoader which loaded the Plugin in this environment.


setSupressStartupFailure

public void setSupressStartupFailure(boolean supressStartupFailure)
By default, startup failure is supressed. If it is indicated that startup failure supression is not desired, then startup errors will be thrown directly from calls to load().



Copyright © 2005-2012 The Kuali Foundation. All Rights Reserved.