|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
The interface that plugins must implement to perform initialization. Generally, a plugin should perform one-time initialization of the plugin itself in the initialize() method, and initialize the individual API implementations on request in the getAPIImplementation() method. For some plugins, however, the various API implementations may be so intertwined that it makes more sense to initialize them all at once in the initialize() method, and merely return the appropriate already-created object in getAPIImplementation(). In either case, the plugin's PluginInfo should reflect which APIs the initialize() and getAPIImplementation() methods expect to have available in the PluginLinker.
Each plugin has a single PluginLinker object assigned to it, so the same linker object will be passed to initialize() and each invocation of getAPIImplementation().
The methods in this interface should only be called from within a Framework's plug() and unplug() methods. Because those methods are defined to be synchronized and non-reentrant, there should be no need to synchronize implementations of PluginInitializer. However, note that there is no guarantee which thread these methods will be running in.
Method Summary | |
Object |
getAPIImplementation(Class apiClass,
PluginLinker linker)
A plugin must implement this method to provide the implementations of the APIs that it provides. |
void |
initialize(PluginLinker linker)
Perform first initialization of the plugin. |
boolean |
preShutDown(PluginLinker linker)
Perform any pre-shutdown tasks. |
void |
shutDown(PluginLinker linker)
Perform finalization and shutdown of the plugin. |
Method Detail |
public void initialize(PluginLinker linker) throws PluginInitializerException
Plugins should perform any time-consuming initialization in this method, rather than in the constructor or static initializers, and should use this method to report any fatal errors during initialization.
linker
- the linker for this plugin.
PluginInitializerException
- thrown if the plugin could not
initialize itself.public Object getAPIImplementation(Class apiClass, PluginLinker linker) throws PluginInitializerException
Plugins should perform any time-consuming initialization in this method, rather than in the constructor or static initializers, and should use this method to report any fatal errors during initialization.
apiClass
- the class of the API to implementlinker
- the linker for this plugin.
PluginInitializerException
- thrown if the plugin could not implement the API.public boolean preShutDown(PluginLinker linker)
linker
- the linker for this plugin.
public void shutDown(PluginLinker linker) throws PluginInitializerException
linker
- the linker for this plugin.
PluginInitializerException
- thrown if the plugin could not shut down.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |