|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface PlugIn
A specialization of the CosyComponent
interface that declares
additional functionality for installing this component into the manager and
container. Plugins must:
installPlugIn
method declared in this interface.
The PlugInManager
design contract guarantees, that the plugin
will be added to the CosyPanel
container before this
method is invoked. Therefore, the plugin can use its getCosyPanelParent
reference in this method.
Plugins are identified by their class type, i.e. the Class
object
used during the installPlugIn
call on the manager is used to
instantiate as well as lookup the plugin (after it has been installed). Therefore,
the class object must not represent an abstract class, an interface or any
other non-instantiable object.
The manager must, when it is destroying, destroy the plugin before it removes it from its cosy panel parent. During destruction, the plugin must release its resources, but handle all subsequent invocations of its methods gracefully (either by doing NOP, or by returning uninitialized values). This is intended to prevent other plugins that depend on this one to receive exceptions when they invoke methods on this as part of their destroy.
During installation, this plugin may request the plugin manager to install other plugins. The manager will throw an exception if cyclic referencing is discovered. The manager may keep the list of dependencies, but does not need to.
If this plugin depends on other plugins, it should, before calling their methods,
check if the plugins are still valid (not destroyed). Even better, instad of
holding fixed references to the plugins, this plugin should invoke
getPlugIn
on the manager each time it wants to invoke a method, always
checking for null
return value. Another option is for the plugin to
become a CosyPanelListener
of its panel and stop executing methods
on other plugins after it receives destroying
event.
Method Summary | |
---|---|
void |
destroy()
Destroys the plugin and all resources associated with this plugin should be released. |
void |
installPlugIn(PlugInManager manager)
Installs the plugin. |
Method Detail |
---|
void installPlugIn(PlugInManager manager) throws PlugInException
getCosyPanelParent
.
manager
- the reference to the manager installing this plugin
PlugInException
- when the installation fails for whatever reason
(invalid preconditions, cyclic reference etc).void destroy()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |