DESY ACOP Beans Home

com.cosylab.application
Interface PlugInManager

All Known Implementing Classes:
DefaultPlugInManager

public interface PlugInManager

Interface defining an object capable of managing simple plugins. The methods of this interface allow the user to install a plug in, register plugin listener (for receiving containment and state changes regarding the plugins) and browse the list of installed plugins. Note that in principle the plugin manager can be an object completely separate from the CosyPanel instance, which is affected by installed plugins. Moreover, there could be one manager per a large number of CosyPanels (e.g. one manager per application), which could reduce the memory footprint of the application.

All methods except for the installPlugIn have straightforward behavior. The implementation must be thread safe, especially the combination of install and browse methods.

A plugin is added to the manager after it has been installed successfully. A plugin is removed from the manager after a destroy has been attempted. Adding and destroying the plugin are the responsibilities of the manager.

Listeners wanting to receive the updates about the plugin state should listen primarily to PlugInEvents and not CosyPanelEvents; in case of failed plugin installation, the plugin (in the role of cosy component) will first be added and then removed from the cosy panel (two event notifications). However, PlugInEvent will be raised by the plugin manager only if the installation of the plugin completes successfully.

Calling destroy() on manager also destroys all contained plugins. Plugins GUI components are first removed from CosyApplicationPanel, then destroyed is called on plugin and finally they are removed from cosy containment tree- parent is set to null.


Method Summary
 PlugIn acquirePlugIn(java.lang.Class plugType)
          Returns a plugin with plugType type.
 void addPlugInListener(PlugInListener l)
          Adds a plugin listener.
 ApplicationPanel getOwnerPanel()
          Returns the owner panel.
 PlugIn getPlugIn(java.lang.Class plugType)
          Returns a plugin installed with plugType type or null if such plugin has not been installed.
 PlugInListener[] getPlugInListeners()
          Returns all plugin listeners as per Java 1.4 beans specifications.
 PlugIn[] getPlugIns()
          Returns a list of all plugins installed by this plugin manager.
 void installPlugIn(java.lang.Class plugType)
          Installs a new plugin into this manager.
 void removePlugIn(java.lang.Class plugType)
          Removes plugin with provided type, if installed.
 void removePlugInListener(PlugInListener l)
          Remove a plugin listener.
 void setOwnerPanel(ApplicationPanel owner)
          Sets the panel which is the owner of the plugin.
 

Method Detail

installPlugIn

void installPlugIn(java.lang.Class plugType)
                   throws PlugInException
Installs a new plugin into this manager. Installing a plugin involves, in the order prescribed below:

The method must actively guard against the cyclic references among plugins. Therefore, if, during installation of plug A, plug B is being installed, which requests plug A installation (cycle), the plugin manager must raise a PlugInException.

Parameters:
plugType - the Class type marking the plug to be installed. The plug must implement the PlugIn interface, otherwise a PlugInException must be raised.
Throws:
PlugInException

removePlugIn

void removePlugIn(java.lang.Class plugType)
Removes plugin with provided type, if installed. First destroy() is called, plugin must remove itself from CosyApplicationPanel.

Parameters:
plugType - to be removed
Throws:
PlugInException

getPlugIns

PlugIn[] getPlugIns()
Returns a list of all plugins installed by this plugin manager.

Returns:
PlugIn[] plugins

getPlugIn

PlugIn getPlugIn(java.lang.Class plugType)
Returns a plugin installed with plugType type or null if such plugin has not been installed.

Returns:
PlugIn the plugin of type plugType or null

acquirePlugIn

PlugIn acquirePlugIn(java.lang.Class plugType)
                     throws PlugInException
Returns a plugin with plugType type. If manager does not have recquired plugub, trys to install it first.

Returns:
PlugIn the plugin of type plugType or null
Throws:
PlugInException

addPlugInListener

void addPlugInListener(PlugInListener l)
Adds a plugin listener.

Parameters:
l - listener object.

removePlugInListener

void removePlugInListener(PlugInListener l)
Remove a plugin listener.

Parameters:
l - listener object

getPlugInListeners

PlugInListener[] getPlugInListeners()
Returns all plugin listeners as per Java 1.4 beans specifications.

Returns:
PlugInListener[] array of currently registered listeners

setOwnerPanel

void setOwnerPanel(ApplicationPanel owner)
Sets the panel which is the owner of the plugin.

Parameters:
owner -

getOwnerPanel

ApplicationPanel getOwnerPanel()
Returns the owner panel.

Returns:


Copyright © 2010. All Rights Reserved.