PluginRegistry

public class PluginRegistry

A PluginRegistry is a registry which stores all the plugin configurations. It has a fixed registry location and the plugin configurations are specified in plugin descriptors.

Author:Hugo Y. K. Lam

See also: Plugin

Constructors

PluginRegistry

public PluginRegistry(String registry)

Creates a new instance of PluginRegistry.

Parameters:
  • registry – the registry location.
Throws:
  • PluginException – if the registry is invalid.

PluginRegistry

public PluginRegistry(File registry)

Creates a new instance of PluginRegistry.

Parameters:
  • registry – the registry location.
Throws:
  • PluginException – if the registry is invalid.

PluginRegistry

public PluginRegistry(String registry, String descriptor)

Creates a new instance of PluginRegistry.

Parameters:
  • registry – the registry location.
  • descriptor – the plugin descriptor name.
Throws:
  • PluginException – if the registry is invalid.

PluginRegistry

public PluginRegistry(File registry, String descriptor)

Creates a new instance of PluginRegistry.

Parameters:
  • registry – the registry location.
  • descriptor – the plugin descriptor name.
Throws:
  • PluginException – if the registry is invalid.

Methods

activate

public synchronized void activate()

Activates the plugin registry if it is not yet activated.

deactivate

public synchronized void deactivate()

Deactivates the plugin registry if it is activated.

deploy

public String deploy(InputStream spa)

Deploys a plugin to the plugin registry.

Parameters:
  • spa – the SPA file input stream.
Throws:
Returns:

the plugin ID of the deployed plugin.

getAllExtensions

public Collection getAllExtensions(String point)

Gets all extensions corresponding to the specified extension point.

Parameters:
  • point – the extension point.
Returns:

all extensions corresponding to the specified extension point.

getLocation

public String getLocation()

Gets the plugin registry location.

Returns:the plugin registry location.

getPlugin

public Plugin getPlugin(String id)

Gets a plugin from this plugin registry.

Parameters:
  • id – the plugin ID.
Returns:

the plugin corresponding to the specified plugin ID.

getPlugins

public Collection getPlugins()

Gets all plugins in this plugin registry.

Returns:all plugins in this plugin registry.

hasErrors

public boolean hasErrors()

Checks if there is any error occurred during the initialization or activation of this plugin registry.

Returns:true if there is any error occurred during the activation of this plugin registry.

isActivated

public boolean isActivated()

Checks if this plugin registry has already been activated.

Returns:true if this plugin registry has already been activated.

toString

public String toString()

Returns a string representation of this plugin registry.

Returns:a string representation of this plugin registry.

See also: java.lang.Object.toString()

undeploy

public void undeploy(String pluginID)

Undeploys a plugin from the plugin registry.

Parameters:
  • pluginID – the plugin ID to undeploy.
Throws: