net.kano.joscar.snac
Class CmdFactoryMgr

java.lang.Object
  extended bySnacCmdFactoryList
      extended byCmdFactoryMgr

public final class CmdFactoryMgr
extends SnacCmdFactoryList

Provides a central means of producing SnacCommands from SnacPackets by merging a "default factory list" with the factories registered by the user of SNAC processor in a logical manner.

This class effectively handles several different "levels" of SNAC factories, digging deeper and deeper until an appropriate factory for a given command type is found. When attempting to find a SNAC command factory for a given command type, the following takes place:

  1. If a command factory has been registered for this exact command type, that factory is returned
  2. Otherwise, if a command factory has been registered for the entire family (using a command type of CmdType.CMDTYPE_ALL), that factory is returned
  3. Otherwise, if a command factory has been registered for all command types (using family and command types of CmdType.CMDTYPE_ALL), that factory is returned
  4. Otherwise, a similar three-step process occurs using the default factory list specified by setDefaultFactoryList
For more details on how this class is used, see ClientSnacProcessor.


Method Summary
 SnacCmdFactoryList getDefaultFactoryList()
          Returns this command factory manager's the default SNAC command factory list.
 void setDefaultFactoryList(SnacCmdFactoryList list)
          Sets the default factory list for this factory manager.
 
Methods inherited from class SnacCmdFactoryList
getFactory, register, registerAll, unregister, unregisterAll, unregisterAll
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

setDefaultFactoryList

public final void setDefaultFactoryList(SnacCmdFactoryList list)
Sets the default factory list for this factory manager. See above for details.

Parameters:
list - the new default factory list

getDefaultFactoryList

public final SnacCmdFactoryList getDefaultFactoryList()
Returns this command factory manager's the default SNAC command factory list.

Returns:
this object's default factory list