hamsam.protocol
Class ProtocolManager

java.lang.Object
  |
  +--hamsam.protocol.ProtocolManager
All Implemented Interfaces:
java.io.Serializable

public abstract class ProtocolManager
extends java.lang.Object
implements java.io.Serializable

Provides an interface for manipulating all available protocols. This class enables the plug-and-play behaviour of Hamsam. Users of Hamsam library may use this class to manipulate all available protocols without knowing actually what all protocols are available at compile time. This means that you can easily switch between different versions of Hamsam without changing your code. As and when new versions of the library comes up with support for new protocols, you can just remove the old version from the classpath and put the new library to the classpath. If the application is coded properly, it will start supporting the new protocols without any change of code.

See Also:
Protocol, Serialized Form

Constructor Summary
ProtocolManager()
           
 
Method Summary
static void changeStatus(java.lang.String status)
          Change your status message for all protocols which are connected.
static Protocol[] getAvailableProtocols()
          Get all available protocols.
static void setIMListener(IMListener listener)
          Set the listener which will receive all instant messaging events from all available protocols.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ProtocolManager

public ProtocolManager()
Method Detail

setIMListener

public static void setIMListener(IMListener listener)
Set the listener which will receive all instant messaging events from all available protocols.

Parameters:
listener - the listener to be registered, pass null to unregister the current listener.

getAvailableProtocols

public static Protocol[] getAvailableProtocols()
Get all available protocols.

Returns:
an array of all available protocols.

changeStatus

public static void changeStatus(java.lang.String status)
                         throws IllegalArgumentException
Change your status message for all protocols which are connected. The status passed may be null, which indicates to make the user invisible. If a protocol does not support invisible status, an IllegalArgumentException is thrown.

Parameters:
status - the new status message.
Throws:
IllegalArgumentException - if status is null and a protocol does not support invisible status.
See Also:
Protocol.isInvisibleSupported()