org.jivesoftware.spark.plugin
Interface Plugin

All Known Implementing Classes:
BookmarkPlugin, BroadcastPlugin, ChatArgumentsPlugin, ContactList, EmoticonPlugin, GatewayPlugin, JabberBrowser, JabberVersion, LayoutPlugin, PhonePlugin, PluginViewer, PresenceChangePlugin, ScratchPadPlugin, SoundPlugin, SparklersPlugin

public interface Plugin

The Plugin interface is the required implementation to have your Sparkplugs work within the Spark client. Users will implement this interface, register the class in their own plugin.xml and do any initialization within the initialize method. It's also a good idea to unregister any components, listeners and other resources in the #uninstall method to allow for better usability.


Method Summary
 boolean canShutDown()
          This method is invoked by the PluginManager before Spark terminates.
 void initialize()
          Invoked by the PluginManager after the instance of the Plugin is instantiated.
 void shutdown()
          This method is invoked by the PluginManager when Spark wishes you to remove any temporary resources (in memory) such as installed components, or settings.
 void uninstall()
          This method is invoked by the PluginManager when a Spark user asks that this plugin be uninstalled.
 

Method Detail

initialize

void initialize()
Invoked by the PluginManager after the instance of the Plugin is instantiated. When invoked, The Plugin should register with whatever listeners they may need to use or are required for use during this classes lifecycle. Plugin authors should take care to ensure that any extraneous initialization is not preformed on this method, and any startup code that can be delayed until a later time is delayed, as the Plugin's are synchronously initialized during the startup of Spark, and each Plugin has the potential to negatively impact the startup time of the product.

See Also:
PluginManager

shutdown

void shutdown()
This method is invoked by the PluginManager when Spark wishes you to remove any temporary resources (in memory) such as installed components, or settings. Any non java resources (file handles, database connections, etc) which are still being held by this Plugin should be released by this method immediately. This method is not guaranteed to be called, but on normal terminations of Spark, this method will be invoked.


canShutDown

boolean canShutDown()
This method is invoked by the PluginManager before Spark terminates. Plugin's should NOT use this method to release resources. They should only use this method to give users the opportunity to cancel the exit process if there is some process started by this plugin still running.

Implementations should return false to cancel the shutdown process.


uninstall

void uninstall()
This method is invoked by the PluginManager when a Spark user asks that this plugin be uninstalled. Before this method is called, you will need to release all your in-memory resources in the #shutdown method. This method should be used to remove on disk resources such as files, images, etc.