|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
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 PlugInEvent
s and not
CosyPanelEvent
s; 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 |
---|
void installPlugIn(java.lang.Class plugType) throws PlugInException
CosyPanel
instance, blocking on
getHierarchyLock
. Within the same guarded section invoke
setCosyPanelParent
on the plugin, passing the cosy panel
itself as a parameter.
installPlugIn(this)
on the plugin, allowing the
plugin to initialize. NOTE: if this method fails by throwing an
exception, remove the plugin as cosy component from the cosy panel.
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
.
plugType
- the Class type marking the plug to be installed. The
plug must implement the PlugIn
interface, otherwise
a PlugInException
must be raised.
PlugInException
void removePlugIn(java.lang.Class plugType)
plugType
- to be removed
PlugInException
PlugIn[] getPlugIns()
PlugIn getPlugIn(java.lang.Class plugType)
plugType
type or
null
if such plugin has not been installed.
plugType
or
null
PlugIn acquirePlugIn(java.lang.Class plugType) throws PlugInException
plugType
type. If manager does not have recquired plugub, trys to install it first.
plugType
or
null
PlugInException
void addPlugInListener(PlugInListener l)
l
- listener object.void removePlugInListener(PlugInListener l)
l
- listener objectPlugInListener[] getPlugInListeners()
void setOwnerPanel(ApplicationPanel owner)
owner
- ApplicationPanel getOwnerPanel()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |