org.jivesoftware.sparkimpl.plugin.gateways
Class GatewayPlugin

java.lang.Object
  extended by org.jivesoftware.sparkimpl.plugin.gateways.GatewayPlugin
All Implemented Interfaces:
Plugin, ContactItemHandler

public class GatewayPlugin
extends java.lang.Object
implements Plugin, ContactItemHandler

Handles Gateways/Transports in Spark.

Author:
Derek DeMoro

Field Summary
static java.lang.String GATEWAY
          Defined Static Variable for Gateways.
 
Constructor Summary
GatewayPlugin()
           
 
Method Summary
 boolean canShutDown()
          This method is invoked by the PluginManager before Spark terminates.
 javax.swing.Icon getIcon(java.lang.String jid)
          Return the icon used for particular presence.
 javax.swing.Icon getTabIcon(org.jivesoftware.smack.packet.Presence presence)
          Return the icon to use on the chat room tab.
 boolean handleDoubleClick(ContactItem item)
          The ContactItem has been double-clicked by the user.
 boolean handlePresence(ContactItem item, org.jivesoftware.smack.packet.Presence presence)
          The users presence has been changed.
 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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

GATEWAY

public static final java.lang.String GATEWAY
Defined Static Variable for Gateways. *

See Also:
Constant Field Values
Constructor Detail

GatewayPlugin

public GatewayPlugin()
Method Detail

initialize

public void initialize()
Description copied from interface: Plugin
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.

Specified by:
initialize in interface Plugin
See Also:
PluginManager

shutdown

public void shutdown()
Description copied from interface: Plugin
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.

Specified by:
shutdown in interface Plugin

canShutDown

public boolean canShutDown()
Description copied from interface: Plugin
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.

Specified by:
canShutDown in interface Plugin

uninstall

public void uninstall()
Description copied from interface: Plugin
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.

Specified by:
uninstall in interface Plugin

handlePresence

public boolean handlePresence(ContactItem item,
                              org.jivesoftware.smack.packet.Presence presence)
Description copied from interface: ContactItemHandler
The users presence has been changed.

Specified by:
handlePresence in interface ContactItemHandler
Parameters:
item - the contact item.
presence - the users new presence.
Returns:
true if the presence was handled.

handleDoubleClick

public boolean handleDoubleClick(ContactItem item)
Description copied from interface: ContactItemHandler
The ContactItem has been double-clicked by the user.

Specified by:
handleDoubleClick in interface ContactItemHandler
Parameters:
item - the ContactItem to handle.
Returns:
true if you wish to handle the double-click event.

getIcon

public javax.swing.Icon getIcon(java.lang.String jid)
Description copied from interface: ContactItemHandler
Return the icon used for particular presence.

Specified by:
getIcon in interface ContactItemHandler
Parameters:
jid - the users jid.
Returns:
the icon, if any. null may be returned.

getTabIcon

public javax.swing.Icon getTabIcon(org.jivesoftware.smack.packet.Presence presence)
Description copied from interface: ContactItemHandler
Return the icon to use on the chat room tab.

Specified by:
getTabIcon in interface ContactItemHandler
Parameters:
presence - the presence of the user.
Returns:
the icon to use.