DESY ACOP Beans Home

com.cosylab.application
Interface PlugIn

All Known Subinterfaces:
VisiblePlugIn
All Known Implementing Classes:
VitragePlugIn

public interface PlugIn

A specialization of the CosyComponent interface that declares additional functionality for installing this component into the manager and container. Plugins must:

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

installPlugIn

void installPlugIn(PlugInManager manager)
                   throws PlugInException
Installs the plugin. It is the responsibility of the manager to detect the cyclic references, add this plugin to the parent cosy panel and its containment list. Implement this method to provide installation for the plugin; it can reference the getCosyPanelParent.

Parameters:
manager - the reference to the manager installing this plugin
Throws:
PlugInException - when the installation fails for whatever reason (invalid preconditions, cyclic reference etc).

destroy

void destroy()
Destroys the plugin and all resources associated with this plugin should be released.



Copyright © 2010. All Rights Reserved.