tigase.server.xmppsession

## Class SessionManager

- java.lang.Object
- - tigase.server.BasicComponent
  - - tigase.server.AbstractMessageReceiver
    - - tigase.server.xmppsession.SessionManager

- All Implemented Interfaces:
    Configurable, XMPPService, MessageReceiver, ServerComponent, SessionManagerHandler, StatisticsContainer, OnlineJidsReporter, VHostListener
  Direct Known Subclasses:
    SessionManagerClustered

      public class SessionManager
      extends AbstractMessageReceiver
      implements Configurable, SessionManagerHandler, OnlineJidsReporter

  Class SessionManager Created: Tue Nov 22 07:07:11 2005
  Version:
    $Rev$
  Author:
    Artur Hefczyc

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `protected class` | `SessionManager.WriterQueue<E extends Packet>`

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected static String` | `ADMIN_COMMAND_NODE` Field description
    `protected ConcurrentHashMap<tigase.xmpp.JID,XMPPResourceConnection>` | `connectionsByFrom` A Map with connectionID as a key and an object with all the user connection data as a value
    `protected Queue<Packet>` | `packetWriterQueue`
    `protected ConcurrentHashMap<tigase.xmpp.BareJID,XMPPSession>` | `sessionsByNodeId` A Map with bare user JID as a key and a user session object as a value.

    - ### Fields inherited from class tigase.server.AbstractMessageReceiver

      `HOUR, INCOMING_FILTERS_PROP_KEY, INCOMING_FILTERS_PROP_VAL, MAX_QUEUE_SIZE_PROP_KEY, MAX_QUEUE_SIZE_PROP_VAL, maxInQueueSize, maxOutQueueSize, MINUTE, OUTGOING_FILTERS_PROP_KEY, OUTGOING_FILTERS_PROP_VAL, SCHEDULER_THREADS_PROP_KEY, SECOND`

    - ### Fields inherited from class tigase.server.BasicComponent

      `admins, ALL_PROP_KEY, COMMAND_PROP_NODE, scriptCommands, SCRIPTS_DIR_PROP_DEF, SCRIPTS_DIR_PROP_KEY, vHostManager`

    - ### Fields inherited from interface tigase.conf.Configurable

      `ADMINS_PROP_KEY, AMP_CLASS_NAME, AUTH_DOMAIN_POOL_CLASS, AUTH_REPO_DOMAINS_PROP_KEY, AUTH_REPO_PARAMS_NODE, AUTH_REPO_POOL_CLASS, AUTH_REPO_URL_PROP_KEY, BOSH_CLUST_COMP_CLASS_NAME, BOSH_COMP_CLASS_NAME, C2S_CLUST_COMP_CLASS_NAME, C2S_COMP_CLASS_NAME, CL_COMP_CLASS_NAME, CLUSTER_CONECT, CLUSTER_CONTR_CLASS_NAME, CLUSTER_LISTEN, CLUSTER_MODE, CLUSTER_NODES, CLUSTER_NODES_PROP_KEY, COMP_PROT_CLASS_NAME, COMPONENT_ID_PROP_KEY, DEF_AMP_NAME, DEF_BOSH_NAME, DEF_C2S_NAME, DEF_CL_COMP_NAME, DEF_CLUST_CONTR_NAME, DEF_COMP_PROT_NAME, DEF_EXT_COMP_NAME, DEF_HOSTNAME_PROP_KEY, DEF_MONITOR_NAME, DEF_S2S_NAME, DEF_SM_NAME, DEF_SRECV_NAME, DEF_SSEND_NAME, DEF_STATS_NAME, DEF_VHOST_MAN_NAME, DEF_WS2S_NAME, DERBY_REPO_CLASS_PROP_VAL, DERBY_REPO_URL_PROP_VAL, DRUPAL_REPO_URL_PROP_VAL, DRUPALWP_REPO_CLASS_PROP_VAL, DUMMY_REPO_CLASS_PROP_VAL, EXT_COMP_CLASS_NAME, GEN_ADMINS, GEN_AUTH_DB, GEN_AUTH_DB_URI, GEN_COMP_CLASS, GEN_COMP_NAME, GEN_CONF, GEN_CONFIG, GEN_CONFIG_ALL, GEN_CONFIG_COMP, GEN_CONFIG_CS, GEN_CONFIG_DEF, GEN_CONFIG_SM, GEN_DEBUG, GEN_DEBUG_PACKAGES, GEN_EXT_COMP, GEN_MAX_QUEUE_SIZE, GEN_SCRIPT_DIR, GEN_SM_PLUGINS, GEN_SREC_ADMINS, GEN_SREC_DB, GEN_SREC_DB_URI, GEN_TEST, GEN_TRUSTED, GEN_USER_DB, GEN_USER_DB_URI, GEN_USER_DB_URI_PROP_KEY, GEN_VIRT_HOSTS, HOSTNAMES_PROP_KEY, LIBRESOURCE_REPO_CLASS_PROP_VAL, LIBRESOURCE_REPO_URL_PROP_VAL, MONITOR_CLASS_NAME, MONITOR_CLUST_CLASS_NAME, MONITORING, MYSQL_REPO_CLASS_PROP_VAL, MYSQL_REPO_URL_PROP_VAL, PGSQL_REPO_CLASS_PROP_VAL, PGSQL_REPO_URL_PROP_VAL, ROUTER_COMP_CLASS_NAME, S2S_CLUST_COMP_CLASS_NAME, S2S_COMP_CLASS_NAME, SHARED_AUTH_REPO_PARAMS_PROP_KEY, SHARED_AUTH_REPO_PROP_KEY, SHARED_USER_REPO_PARAMS_PROP_KEY, SHARED_USER_REPO_PROP_KEY, SM_CLUST_COMP_CLASS_NAME, SM_COMP_CLASS_NAME, SRECV_COMP_CLASS_NAME, SSEND_COMP_CLASS_NAME, STANZA_WHITE_CHAR_ACK, STANZA_XMPP_ACK, STATS_CLASS_NAME, STRINGPREP_PROCESSOR, TIGASE_AUTH_REPO_CLASS_PROP_VAL, TIGASE_AUTH_REPO_URL_PROP_VAL, TIGASE_CUSTOM_AUTH_REPO_CLASS_PROP_VAL, TRUSTED_PROP_KEY, USER_DOMAIN_POOL_CLASS, USER_REPO_DOMAINS_PROP_KEY, USER_REPO_PARAMS_NODE, USER_REPO_POOL_CLASS, USER_REPO_POOL_SIZE, USER_REPO_POOL_SIZE_PROP_KEY, USER_REPO_URL_PROP_KEY, VHOST_MAN_CLASS_NAME, VHOST_MAN_CLUST_CLASS_NAME, WS2S_CLASS_NAME, WS2S_CLUST_CLASS_NAME, XML_REPO_CLASS_PROP_VAL, XML_REPO_URL_PROP_VAL, XMPP_STANZA_ACK`

    - ### Fields inherited from interface tigase.server.xmppsession.SessionManagerHandler

      `COMMIT_HANDLER_KEY`

    - ### Fields inherited from interface tigase.disco.XMPPService

      `CMD_FEATURES, DEF_FEATURES, INFO_XMLNS, ITEMS_XMLNS`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `SessionManager()`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `addOutPacket(Packet packet)` Method description
    `protected void` | `addOutPackets(Packet packet, XMPPResourceConnection conn, Queue<Packet> results)` Method description
    `XMPPImplIfc` | `addPlugin(String plug_id, Integer conc)` Method description
    `protected boolean` | `addTrusted(tigase.xmpp.JID jid)` Method description
    `protected void` | `closeConnection(tigase.xmpp.JID connectionId, String userId, boolean closeOnly)` Method description
    `protected void` | `closeSession(XMPPResourceConnection conn, boolean closeOnly)` Method description
    `boolean` | `containsJid(tigase.xmpp.BareJID jid)` Method description
    `protected XMPPResourceConnection` | `createUserSession(tigase.xmpp.JID conn_id, String domain)` Method description
    `protected boolean` | `delTrusted(tigase.xmpp.JID jid)` Method description
    `protected boolean` | `fastAddOutPacket(Packet packet)` Method description
    `tigase.xmpp.JID[]` | `getConnectionIdsForJid(tigase.xmpp.BareJID jid)` Method description
    `Map<String,Object>` | `getDefaults(Map<String,Object> params)` Method description
    `String` | `getDiscoCategoryType()` Method description
    `String` | `getDiscoDescription()` Method description
    `List<tigase.xml.Element>` | `getDiscoFeatures(tigase.xmpp.JID from)` Method description
    `tigase.xml.Element` | `getDiscoInfo(String node, tigase.xmpp.JID jid, tigase.xmpp.JID from)` Method description
    `protected Integer` | `getMaxQueueSize(int def)` Method description
    `XMPPResourceConnection` | `getResourceConnection(tigase.xmpp.JID jid)` Method description
    `protected XMPPSession` | `getSession(tigase.xmpp.BareJID jid)` Method description
    `void` | `getStatistics(StatisticsList list)` Method description
    `protected XMPPResourceConnection` | `getXMPPResourceConnection(tigase.xmpp.JID connId)` Method description
    `protected XMPPResourceConnection` | `getXMPPResourceConnection(Packet p)` Method description
    `void` | `handleLocalPacket(Packet packet, XMPPResourceConnection conn)` Method description
    `void` | `handleLogin(tigase.xmpp.BareJID userId, XMPPResourceConnection conn)` Method description
    `void` | `handleLogout(tigase.xmpp.BareJID userId, XMPPResourceConnection conn)` Method description
    `void` | `handlePresenceSet(XMPPResourceConnection conn)` Method description
    `void` | `handleResourceBind(XMPPResourceConnection conn)` Method description
    `boolean` | `handlesLocalDomains()` Method description
    `boolean` | `hasCompleteJidsInfo()` Method description
    `void` | `initBindings(Bindings binds)` Initialize a mapping of key/value pairs which can be used in scripts loaded by the server
    `protected boolean` | `isBrokenPacket(Packet p)` Method description
    `boolean` | `isLocalDomain(String domain, boolean includeComponents)` Method description
    `protected boolean` | `isTrusted(tigase.xmpp.JID jid)` Method description
    `protected boolean` | `isTrusted(String jid)` Method description
    `protected XMPPResourceConnection` | `loginUserSession(tigase.xmpp.JID conn_id, String domain, tigase.xmpp.BareJID user_id, String resource, String xmpp_sessionId)` Method description
    `protected boolean` | `processAdminsOrDomains(Packet packet)` Method description
    `protected boolean` | `processCommand(Packet pc)` Method description
    `int` | `processingInThreads()` Method description
    `int` | `processingOutThreads()` Method description
    `void` | `processPacket(Packet packet)` Method description
    `protected void` | `processPacket(Packet packet, XMPPResourceConnection conn)` Method description
    `protected void` | `processPresenceUpdate(XMPPSession session, tigase.xml.Element packet)`
    `protected void` | `registerNewSession(tigase.xmpp.BareJID userId, XMPPResourceConnection conn)` Method description
    `void` | `removePlugin(String plug_id)` Method description
    `protected void` | `sendToAdmins(Packet packet)` Method description
    `void` | `setName(String name)` Method description
    `void` | `setProperties(Map<String,Object> props)` Method description
    `boolean` | `skipPrivacy()` Method description

    - ### Methods inherited from class tigase.server.AbstractMessageReceiver

      `addOutPacketNB, addOutPackets, addOutPacketWithTimeout, addPacket, addPacketNB, addPackets, addRegexRouting, addTimerTask, addTimerTask, addTimerTask, addTimerTask, clearRegexRoutings, everyHour, everyMinute, everySecond, getRegexRoutings, hashCodeForPacket, isInRegexRoutings, newPacketId, processingThreads, processOutPacket, processPacket, release, removeRegexRouting, schedulerThreads, setMaxQueueSize, setParent, start, stop`

    - ### Methods inherited from class tigase.server.BasicComponent

      `addComponentDomain, canCallCommand, checkCommandAcl, getComponentId, getComponentInfo, getDefHostName, getDefVHostItem, getDiscoCategory, getDiscoFeatures, getDiscoInfo, getDiscoItems, getDiscoItems, getName, getScriptCommands, getScriptItems, getServiceEntity, getVHostItem, handlesNameSubdomains, handlesNonLocalDomains, initializationCompleted, isAdmin, isInitializationComplete, isLocalDomain, isLocalDomainOrComponent, isNonAdminCommands, isSubdomain, processScriptCommand, removeComponentDomain, removeServiceDiscoveryItem, setVHostManager, updateServiceDiscoveryItem, updateServiceDiscoveryItem, updateServiceDiscoveryItem, updateServiceEntity`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

    - ### Methods inherited from interface tigase.server.ServerComponent

      `getComponentId, getComponentInfo, getName, initializationCompleted, isInitializationComplete, processPacket, release`

    - ### Methods inherited from interface tigase.server.xmppsession.SessionManagerHandler

      `getComponentId`

    - ### Methods inherited from interface tigase.server.MessageReceiver

      `getDefHostName`

- - ### Field Detail

    - #### ADMIN_COMMAND_NODE

          protected static final String ADMIN_COMMAND_NODE

      Field description
      See Also:
        Constant Field Values

    - #### sessionsByNodeId

          protected ConcurrentHashMap<tigase.xmpp.BareJID,XMPPSession> sessionsByNodeId

      A Map with bare user JID as a key and a user session object as a value.

    - #### packetWriterQueue

          protected Queue<Packet> packetWriterQueue

    - #### connectionsByFrom

          protected ConcurrentHashMap<tigase.xmpp.JID,XMPPResourceConnection> connectionsByFrom

      A Map with connectionID as a key and an object with all the user connection data as a value

  - ### Constructor Detail

    - #### SessionManager

          public SessionManager()

  - ### Method Detail

    - #### addOutPacket

          public boolean addOutPacket(Packet packet)

      Method description
      Overrides:
        `addOutPacket` in class `AbstractMessageReceiver`
      Parameters:
        `packet` -
      Returns:
        a value of `boolean`

    - #### addPlugin

          public XMPPImplIfc addPlugin(String plug_id,
                              Integer conc)
                                throws ClassNotFoundException,
                                       InstantiationException,
                                       IllegalAccessException

      Method description
      Parameters:
        `plug_id` -
        `conc` -
      Throws:
        `ClassNotFoundException`
        `IllegalAccessException`
        `InstantiationException`

    - #### containsJid

          public boolean containsJid(tigase.xmpp.BareJID jid)

      Method description
      Specified by:
        `containsJid` in interface `OnlineJidsReporter`
      Parameters:
        `jid` -

    - #### handleLocalPacket

          public void handleLocalPacket(Packet packet,
                               XMPPResourceConnection conn)

      Method description
      Parameters:
        `packet` -
        `conn` -

    - #### handleLogin

          public void handleLogin(tigase.xmpp.BareJID userId,
                         XMPPResourceConnection conn)

      Method description
      Specified by:
        `handleLogin` in interface `SessionManagerHandler`
      Parameters:
        `userId` -
        `conn` -

    - #### handleLogout

          public void handleLogout(tigase.xmpp.BareJID userId,
                          XMPPResourceConnection conn)

      Method description
      Specified by:
        `handleLogout` in interface `SessionManagerHandler`
      Parameters:
        `userId` -
        `conn` -

    - #### handlePresenceSet

          public void handlePresenceSet(XMPPResourceConnection conn)

      Method description
      Specified by:
        `handlePresenceSet` in interface `SessionManagerHandler`
      Parameters:
        `conn` -

    - #### handleResourceBind

          public void handleResourceBind(XMPPResourceConnection conn)

      Method description
      Specified by:
        `handleResourceBind` in interface `SessionManagerHandler`
      Parameters:
        `conn` -

    - #### handlesLocalDomains

          public boolean handlesLocalDomains()

      Method description
      Specified by:
        `handlesLocalDomains` in interface `VHostListener`
      Overrides:
        `handlesLocalDomains` in class `BasicComponent`
      Returns:
        a value of `boolean`

    - #### initBindings

          public void initBindings(Bindings binds)

      Initialize a mapping of key/value pairs which can be used in scripts loaded by the server
      Overrides:
        `initBindings` in class `BasicComponent`
      Parameters:
        `binds` - A mapping of key/value pairs, all of whose keys are Strings.

    - #### processingInThreads

          public int processingInThreads()

      Method description
      Overrides:
        `processingInThreads` in class `AbstractMessageReceiver`
      Returns:
        a value of `int`

    - #### processingOutThreads

          public int processingOutThreads()

      Method description
      Overrides:
        `processingOutThreads` in class `AbstractMessageReceiver`
      Returns:
        a value of `int`

    - #### processPacket

          public void processPacket(Packet packet)

      Method description
      Specified by:
        `processPacket` in class `AbstractMessageReceiver`
      Parameters:
        `packet` -

    - #### removePlugin

          public void removePlugin(String plug_id)

      Method description
      Parameters:
        `plug_id` -

    - #### skipPrivacy

          public boolean skipPrivacy()

      Method description

    - #### getConnectionIdsForJid

          public tigase.xmpp.JID[] getConnectionIdsForJid(tigase.xmpp.BareJID jid)

      Method description
      Specified by:
        `getConnectionIdsForJid` in interface `OnlineJidsReporter`
      Parameters:
        `jid` -

    - #### getDefaults

          public Map<String,Object> getDefaults(Map<String,Object> params)

      Method description
      Specified by:
        `getDefaults` in interface `Configurable`
      Overrides:
        `getDefaults` in class `AbstractMessageReceiver`
      Parameters:
        `params` -
      Returns:
        a `Map` with the component default configuration.

    - #### getDiscoCategoryType

          public String getDiscoCategoryType()

      Method description
      Overrides:
        `getDiscoCategoryType` in class `BasicComponent`
      Returns:
        a value of `String`

    - #### getDiscoDescription

          public String getDiscoDescription()

      Method description
      Overrides:
        `getDiscoDescription` in class `BasicComponent`
      Returns:
        a value of `String`

    - #### getDiscoFeatures

          public List<tigase.xml.Element> getDiscoFeatures(tigase.xmpp.JID from)

      Method description
      Specified by:
        `getDiscoFeatures` in interface `XMPPService`
      Overrides:
        `getDiscoFeatures` in class `BasicComponent`
      Parameters:
        `from` -
      Returns:
        a value of `List`

    - #### getDiscoInfo

          public tigase.xml.Element getDiscoInfo(String node,
                                        tigase.xmpp.JID jid,
                                        tigase.xmpp.JID from)

      Method description
      Specified by:
        `getDiscoInfo` in interface `XMPPService`
      Overrides:
        `getDiscoInfo` in class `BasicComponent`
      Parameters:
        `node` -
        `jid` -
        `from` -
      Returns:
        a value of `Element`

    - #### getResourceConnection

          public XMPPResourceConnection getResourceConnection(tigase.xmpp.JID jid)

      Method description
      Parameters:
        `jid` -

    - #### getStatistics

          public void getStatistics(StatisticsList list)

      Method description
      Specified by:
        `getStatistics` in interface `StatisticsContainer`
      Overrides:
        `getStatistics` in class `AbstractMessageReceiver`
      Parameters:
        `list` -

    - #### hasCompleteJidsInfo

          public boolean hasCompleteJidsInfo()

      Method description
      Specified by:
        `hasCompleteJidsInfo` in interface `OnlineJidsReporter`

    - #### isLocalDomain

          public boolean isLocalDomain(String domain,
                              boolean includeComponents)

      Method description
      Specified by:
        `isLocalDomain` in interface `SessionManagerHandler`
      Parameters:
        `domain` -
        `includeComponents` -

    - #### setName

          public void setName(String name)

      Method description
      Specified by:
        `setName` in interface `ServerComponent`
      Overrides:
        `setName` in class `AbstractMessageReceiver`
      Parameters:
        `name` -

    - #### setProperties

          public void setProperties(Map<String,Object> props)

      Method description
      Specified by:
        `setProperties` in interface `Configurable`
      Overrides:
        `setProperties` in class `AbstractMessageReceiver`
      Parameters:
        `props` -

    - #### addOutPackets

          protected void addOutPackets(Packet packet,
                           XMPPResourceConnection conn,
                           Queue<Packet> results)

      Method description
      Parameters:
        `packet` -
        `conn` -
        `results` -

    - #### addTrusted

          protected boolean addTrusted(tigase.xmpp.JID jid)

      Method description
      Parameters:
        `jid` -

    - #### closeConnection

          protected void closeConnection(tigase.xmpp.JID connectionId,
                             String userId,
                             boolean closeOnly)

      Method description
      Parameters:
        `connectionId` -
        `userId` -
        `closeOnly` -

    - #### closeSession

          protected void closeSession(XMPPResourceConnection conn,
                          boolean closeOnly)

      Method description
      Parameters:
        `conn` -
        `closeOnly` -

    - #### createUserSession

          protected XMPPResourceConnection createUserSession(tigase.xmpp.JID conn_id,
                                                 String domain)
                                                      throws tigase.util.TigaseStringprepException

      Method description
      Parameters:
        `conn_id` -
        `domain` -
      Throws:
        `tigase.util.TigaseStringprepException`

    - #### delTrusted

          protected boolean delTrusted(tigase.xmpp.JID jid)

      Method description
      Parameters:
        `jid` -

    - #### fastAddOutPacket

          protected boolean fastAddOutPacket(Packet packet)

      Method description
      Parameters:
        `packet` -

    - #### loginUserSession

          protected XMPPResourceConnection loginUserSession(tigase.xmpp.JID conn_id,
                                                String domain,
                                                tigase.xmpp.BareJID user_id,
                                                String resource,
                                                String xmpp_sessionId)

      Method description
      Parameters:
        `conn_id` -
        `domain` -
        `user_id` -
        `resource` -
        `xmpp_sessionId` -

    - #### processAdminsOrDomains

          protected boolean processAdminsOrDomains(Packet packet)

      Method description
      Parameters:
        `packet` -

    - #### processCommand

          protected boolean processCommand(Packet pc)

      Method description
      Parameters:
        `pc` -

    - #### processPacket

          protected void processPacket(Packet packet,
                           XMPPResourceConnection conn)

      Method description
      Parameters:
        `packet` -
        `conn` -

    - #### processPresenceUpdate

          protected void processPresenceUpdate(XMPPSession session,
                                   tigase.xml.Element packet)

    - #### registerNewSession

          protected void registerNewSession(tigase.xmpp.BareJID userId,
                                XMPPResourceConnection conn)

      Method description
      Parameters:
        `userId` -
        `conn` -

    - #### sendToAdmins

          protected void sendToAdmins(Packet packet)

      Method description
      Parameters:
        `packet` -

    - #### getMaxQueueSize

          protected Integer getMaxQueueSize(int def)

      Method description
      Overrides:
        `getMaxQueueSize` in class `AbstractMessageReceiver`
      Parameters:
        `def` -
      Returns:
        a value of `Integer`

    - #### getSession

          protected XMPPSession getSession(tigase.xmpp.BareJID jid)

      Method description
      Parameters:
        `jid` -

    - #### getXMPPResourceConnection

          protected XMPPResourceConnection getXMPPResourceConnection(tigase.xmpp.JID connId)

      Method description
      Parameters:
        `connId` -

    - #### getXMPPResourceConnection

          protected XMPPResourceConnection getXMPPResourceConnection(Packet p)

      Method description
      Parameters:
        `p` -

    - #### isBrokenPacket

          protected boolean isBrokenPacket(Packet p)

      Method description
      Parameters:
        `p` -

    - #### isTrusted

          protected boolean isTrusted(tigase.xmpp.JID jid)

      Method description
      Parameters:
        `jid` -

    - #### isTrusted

          protected boolean isTrusted(String jid)

      Method description
      Parameters:
        `jid` -

Copyright © 2013 Tigase. All rights reserved.