tigase.xmpp

## Class XMPPProcessor

- java.lang.Object
- - tigase.xmpp.XMPPProcessor

- All Implemented Interfaces:
    Comparable<XMPPImplIfc>, XMPPImplIfc, XMPPProcessorConcurrencyAwareIfc
  Direct Known Subclasses:
    AbstractAuthPreprocessor, AnnotatedXMPPProcessor, BindResource, CAPS, DomainFilter, InvisibleCommand, JabberIqCommand, JabberIqIq, JabberIqPrivacy, JabberIqPrivate, JabberIqRegister, JabberIqRoster, JabberIqStats, Jingle, MessageAll, MessageAmp, MessageCarbons, MessageForwarding, MobileV1, MobileV2, OfflineMessages, RosterPresence, SessionManager.DefaultHandlerProc, SessionManager.SessionCloseProc, SessionManager.SessionOpenProc, SimpleForwarder, StartTLS, StartZLib

      public abstract class XMPPProcessor
      extends Object
      implements XMPPImplIfc, XMPPProcessorConcurrencyAwareIfc

  `XMPPProcessor` abstract class contains basic definition for XMPP processor. To create new processor implementing particular XMPP functionality it is enough to extend this class and implement one abstract method.
  Additionally to allow system properly recognise this processor you need also to implement own constructor which sets proper values to parent constructor. You must implement exactly one constructor with zero parameters which calls parent constructor with proper values. Refer to constructor documentation for information about required parameters.
  To fully interact with entity connected to the session or with other entities in XMPP network you should be also familiar with `addReply(...)`, `addMessage(...)` and `addBroadcast(...)` methods.
  There is also partially implemented functionality to send messages to entities in other networks like SMTP or other implemented by the server. Once this implementation is finished there will be more information available. If you, however, are interested in this particular feature send a question to author.

  Created: Tue Oct 5 20:31:23 2004

  Version:
    $Rev$
  Author:
    Artur Hefczyc

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected static String` | `ALL_NAMES`
    `protected static String[][]` | `ALL_PATHS`
    `protected static ComponentInfo` | `cmpInfo`

    - ### Fields inherited from interface tigase.xmpp.XMPPImplIfc

      `CLIENT_XMLNS`

  - ### Constructor Summary

    Constructors
    Modifier | Constructor and Description
    --- | ---
    `protected` | `XMPPProcessor()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods Deprecated Methods
    Modifier and Type | Method and Description
    --- | ---
    `Authorization` | `canHandle(Packet packet, XMPPResourceConnection conn)` By default the method uses `XMPPImplIfc.supElementNamePaths()` and `XMPPImplIfc.supTypes()` method results to determine whether the plugin would process given packet.
    `int` | `compareTo(XMPPImplIfc proc)`
    `int` | `concurrentThreadsPerQueue()` Deprecated.
    `ComponentInfo` | `getComponentInfo()` Allows to obtain various informations about components
    `XMPPProcessor` | `getInstance()`
    `Integer` | `getQueueSize()`
    `void` | `getStatistics(StatisticsList list)` The method allows to retrieve plugin own statistics if it generates any.
    `int` | `getThreadsNo()`
    `void` | `init(Map<String,Object> settings)` Deprecated.
    `boolean` | `isSupporting(String element, String ns)` Deprecated.
    `Element[]` | `supDiscoFeatures(XMPPResourceConnection session)` Method `supDiscoFeatures` returns an array of XML `Element`s with service discovery features which have to be returned to the client uppon request.
    `String[][]` | `supElementNamePaths()` Method `supElementNamePaths` returns an array of element names in form of a full path to the XML element for stanzas which can be processed by this plugin.
    `String[]` | `supElements()` Deprecated.
    `String[]` | `supNamespaces()` Method `supNamespaces` returns an array of name-spaces for stanzas which can be processed by this plugin.
    `Element[]` | `supStreamFeatures(XMPPResourceConnection session)` Method `supStreamFeatures` returns an array of XML `Element`s with stream features which have to be returned to the client uppon request.
    `Set<StanzaType>` | `supTypes()` Method returns an array of all stanza types which the plugin is able to handle.
    `String` | `toString()`

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

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

    - ### Methods inherited from interface tigase.xmpp.XMPPImplIfc

      `concurrentQueuesNo, id`

- - ### Field Detail

    - #### ALL_NAMES

          protected static final String ALL_NAMES

      See Also:
        Constant Field Values

    - #### ALL_PATHS

          protected static final String[][] ALL_PATHS

    - #### cmpInfo

          protected static ComponentInfo cmpInfo

  - ### Constructor Detail

    - #### XMPPProcessor

          protected XMPPProcessor()

  - ### Method Detail

    - #### canHandle

          public Authorization canHandle(Packet packet,
                                         XMPPResourceConnection conn)

      Description copied from interface: `XMPPImplIfc`
      By default the method uses `XMPPImplIfc.supElementNamePaths()` and `XMPPImplIfc.supTypes()` method results to determine whether the plugin would process given packet. However, a plugin can implement own logic to determine packet processing capabilities or conditions. Please note, this method must be very fast and efficient. No I/O processing is recommended as it may impact performance of the whole system.
      Specified by:
        `canHandle` in interface `XMPPImplIfc`
      Parameters:
        `packet` - is a `Packet` for processing.
        `conn` - is a user session object or null.
      Returns:
        returns `Authorization` enum value or null. Null means the plugin is simply not processing the packet. `Authorization.AUTHORIZED` means the plugin can process the packet, any other `Authorization` enum value means an error which has to be returned to the sender.

    - #### compareTo

          public final int compareTo(XMPPImplIfc proc)

      Specified by:
        `compareTo` in interface `Comparable<XMPPImplIfc>`

    - #### concurrentThreadsPerQueue

          @Deprecated
          public int concurrentThreadsPerQueue()

      Deprecated.
      Description copied from interface: `XMPPImplIfc`
      Number of threads per single packets queue. Not used anymore. At the moment only one thread is always used for each queue. For a higher concurrency set more queues using `XMPPImplIfc.concurrentQueuesNo()`.
      Specified by:
        `concurrentThreadsPerQueue` in interface `XMPPImplIfc`
      Returns:
        a value of `int`

    - #### init

          @Deprecated
          public void init(Map<String,Object> settings)
                                throws TigaseDBException

      Deprecated.
      Description copied from interface: `XMPPImplIfc`
      Method `init` is called just after the plugin has been loaded into memory. The idea behind this is to allow it to initialize or check the database. This might be especially useful for plugins which want to have a database access via non-standard stored procedures or need schema upgrade.
      Specified by:
        `init` in interface `XMPPImplIfc`
      Parameters:
        `settings` - is a Map with initial processor settings from the configuration file.
      Throws:
        `TigaseDBException`

    - #### supDiscoFeatures

          public Element[] supDiscoFeatures(XMPPResourceConnection session)

      Description copied from interface: `XMPPImplIfc`
      Method `supDiscoFeatures` returns an array of XML `Element`s with service discovery features which have to be returned to the client uppon request. Service discovery features returned by this method correspond to services supported by this plugin.
      Specified by:
        `supDiscoFeatures` in interface `XMPPImplIfc`
      Parameters:
        `session` - a `XMPPResourceConnection` value
      Returns:
        an `Element[]` value

    - #### supElementNamePaths

          public String[][] supElementNamePaths()

      Description copied from interface: `XMPPImplIfc`
      Method `supElementNamePaths` returns an array of element names in form of a full path to the XML element for stanzas which can be processed by this plugin. Each element name path corresponds to XMLNS returned in array by `supNamespaces()` method. The element path itself is represented by a String array with each path element as a separate String.
      Specified by:
        `supElementNamePaths` in interface `XMPPImplIfc`
      Returns:
        a `String[][]` value is an array for element paths for which the plugin offers processing capabilities. Each path is in form of a String array in order to reduce parsing overhead.

    - #### supElements

          @Deprecated
          public String[] supElements()

      Deprecated.
      Description copied from interface: `XMPPImplIfc`
      Method `supElements` returns an array of element names for stanzas which can be processed by this plugin. Each element name corresponds to XMLNS returned in array by `supNamespaces()` method. This method has been deprecated in favor of `supElementNamePaths`.
      Specified by:
        `supElements` in interface `XMPPImplIfc`
      Returns:
        a `String[]` value
      See Also:
        `XMPPImplIfc.supElementNamePaths()`

    - #### supNamespaces

          public String[] supNamespaces()

      Description copied from interface: `XMPPImplIfc`
      Method `supNamespaces` returns an array of name-spaces for stanzas which can be processed by this plugin. Each namespace corresponds to element name returned in array by `supElemenets()` method.
      Specified by:
        `supNamespaces` in interface `XMPPImplIfc`
      Returns:
        a `String[]` value

    - #### supStreamFeatures

          public Element[] supStreamFeatures(XMPPResourceConnection session)

      Description copied from interface: `XMPPImplIfc`
      Method `supStreamFeatures` returns an array of XML `Element`s with stream features which have to be returned to the client uppon request. Stream features returned by this method correspond to features supported by this plugin.
      Specified by:
        `supStreamFeatures` in interface `XMPPImplIfc`
      Parameters:
        `session` - a `XMPPResourceConnection` value
      Returns:
        an `Element[]` value

    - #### supTypes

          public Set<StanzaType> supTypes()

      Description copied from interface: `XMPPImplIfc`
      Method returns an array of all stanza types which the plugin is able to handle. If the method returns NULL, then all stanzas of all types will be passed to the plugin for processing. Otherwise only stanzas with selected types, assuming that element names and name-spaces match as well.
      Specified by:
        `supTypes` in interface `XMPPImplIfc`
      Returns:
        a `StanzaType[]` array of supported stanza types.

    - #### getInstance

          public XMPPProcessor getInstance()

    - #### getStatistics

          public void getStatistics(StatisticsList list)

      Description copied from interface: `XMPPImplIfc`
      The method allows to retrieve plugin own statistics if it generates any.
      Specified by:
        `getStatistics` in interface `XMPPImplIfc`
      Parameters:
        `list` - is a statistics collection to which plugins own metrics can be added.

    - #### getComponentInfo

          public ComponentInfo getComponentInfo()

      Description copied from interface: `XMPPImplIfc`
      Allows to obtain various informations about components
      Specified by:
        `getComponentInfo` in interface `XMPPImplIfc`
      Returns:
        information about particular component

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `Object`

    - #### isSupporting

          @Deprecated
          public boolean isSupporting(String element,
                                                  String ns)

      Deprecated.
      Description copied from interface: `XMPPImplIfc`
      Method `isSupporting` takes element name and name-space for this element and determines whether this element can be processed by this plugin.
      Specified by:
        `isSupporting` in interface `XMPPImplIfc`
      Parameters:
        `element` - a `String` value
        `ns` - a `String` value
      Returns:
        a `boolean` value

    - #### getThreadsNo

          public int getThreadsNo()

      Specified by:
        `getThreadsNo` in interface `XMPPProcessorConcurrencyAwareIfc`

    - #### getQueueSize

          public Integer getQueueSize()

      Specified by:
        `getQueueSize` in interface `XMPPProcessorConcurrencyAwareIfc`

Copyright © 2004–2019 "Tigase, Inc.". All rights reserved.