com.virtuosotechnologies.lib.plugin
Interface Framework

All Known Implementing Classes:
SimpleFramework

public interface Framework

A plugin framework. Implementations of this interface provide a framework for the plugin system. They must manage a set of plugins and provide the implementations of PluginLinker and APIProvider allowing plugins to communicate with one another. A Framework must also provide itself as an API within its own context, with the version specified by CURRENT_FRAMEWORK_VERSION.

All implementations must be thread-safe.


Field Summary
static ConstrainedKey CONTINUE_ON_DUPLICATE_PLUGINS_PROPERTY
          Property key for continuing on duplicate plugins.
static ConstrainedKey CONTINUE_ON_SUPPRESSED_PLUGINS_PROPERTY
          Property key for continuing on suppressed plugins.
static APIVersion CURRENT_FRAMEWORK_APIVERSION
          The version of the Framework API.
 
Method Summary
 void addFrameworkProgressListener(FrameworkProgressListener listener)
          Register a listener on the Framework.
 ObjectSet getAvailableAPINames()
          Get the names of the currently available APIs as an ObjectSet of Strings.
 ObjectSet getAvailableAPIVersions(String name)
          Get the names of the currently available versions of the given API as an ObjectSet of APIVersions.
 ObjectSet getPluginIDSet()
          Get the ids of the currently available plugins as an ObjectSet of PluginIDs.
 PluginInfo getPluginInfo(PluginID plugin)
          Get the PluginInfo object for the given plugin.
 RequestablePropertySet getProperties()
          Get properties of this Framework.
 PluginID getProvidingPluginFor(String name, APIVersion version)
          Get the PluginID of the plugin that provides the given API and version.
 void plug(PluginInfo[] infoArray)
          Attempt to plug in the given Plugins.
 APIProvider provideAPI(Class cls, APIVersion version, String description, Object impl)
          Register an API with no providing plugin.
 void removeFrameworkProgressListener(FrameworkProgressListener listener)
          Remove a listener on the Framework.
 void unplug(PluginID[] idArray)
          Attempt to unplug in the given Plugins.
 

Field Detail

CURRENT_FRAMEWORK_APIVERSION

public static final APIVersion CURRENT_FRAMEWORK_APIVERSION
The version of the Framework API. (Currently 1.0.0)


CONTINUE_ON_DUPLICATE_PLUGINS_PROPERTY

public static final ConstrainedKey CONTINUE_ON_DUPLICATE_PLUGINS_PROPERTY
Property key for continuing on duplicate plugins. Class is Boolean. Default is false.


CONTINUE_ON_SUPPRESSED_PLUGINS_PROPERTY

public static final ConstrainedKey CONTINUE_ON_SUPPRESSED_PLUGINS_PROPERTY
Property key for continuing on suppressed plugins. Class is Boolean. Default is false.

Method Detail

getProperties

public RequestablePropertySet getProperties()
Get properties of this Framework.

Returns:
RequestablePropertySet containing properties, some of which may be editable

getPluginIDSet

public ObjectSet getPluginIDSet()
Get the ids of the currently available plugins as an ObjectSet of PluginIDs. The ObjectSet tracks changes to the installed plugins.

Returns:
ObjectSet of Strings

getPluginInfo

public PluginInfo getPluginInfo(PluginID plugin)
Get the PluginInfo object for the given plugin. Returns null if the plugin id is not present.

Parameters:
plugin - plugin id
Returns:
PluginInfo

getAvailableAPINames

public ObjectSet getAvailableAPINames()
Get the names of the currently available APIs as an ObjectSet of Strings. The ObjectSet tracks changes to the available APIs.

Returns:
ObjectSet of Strings

getAvailableAPIVersions

public ObjectSet getAvailableAPIVersions(String name)
Get the names of the currently available versions of the given API as an ObjectSet of APIVersions. The ObjectSet tracks changes to the available APIs.

Parameters:
name - name of API to query
Returns:
ObjectSet of APIVersions, or null if the given API is not found.

getProvidingPluginFor

public PluginID getProvidingPluginFor(String name,
                                      APIVersion version)
                               throws APINotAvailableException
Get the PluginID of the plugin that provides the given API and version. You need to specify the exact API version.

Parameters:
name - name of API to query
version - version of API to query
Returns:
PluginID of the plugin providing the API, or null if it's being provided directly through the framework.
Throws:
APINotAvailableException - the given api and version not provided.

plug

public void plug(PluginInfo[] infoArray)
          throws PluginException
Attempt to plug in the given Plugins. Note that this method is not re-entrant. For example, it cannot be called from within a plugin's initialization or cleanup code.

Parameters:
infoArray - array of PluginInfo objects
Throws:
PluginException - couldn't start up the plugins
IllegalStateException - a plug or unplug job is already in progress

unplug

public void unplug(PluginID[] idArray)
            throws PluginException
Attempt to unplug in the given Plugins. Note that this method is not re-entrant. For example, it cannot be called from within a plugin's initialization or cleanup code.

Parameters:
idArray - array of PluginIDs
Throws:
PluginException - couldn't shut down the plugins
IllegalStateException - a plug or unplug job is already in progress

provideAPI

public APIProvider provideAPI(Class cls,
                              APIVersion version,
                              String description,
                              Object impl)
                       throws DuplicateAPIException
Register an API with no providing plugin.

Parameters:
cls - interface class
version - API version
description - description String
impl - implementation object
Returns:
the newly-created APIProvider
Throws:
DuplicateAPIException - the given API version already exists.

addFrameworkProgressListener

public void addFrameworkProgressListener(FrameworkProgressListener listener)
Register a listener on the Framework.

Parameters:
listener - the listener

removeFrameworkProgressListener

public void removeFrameworkProgressListener(FrameworkProgressListener listener)
Remove a listener on the Framework.

Parameters:
listener - the listener