Class PubSubEngine

java.lang.Object
org.jivesoftware.openfire.pubsub.PubSubEngine

public class PubSubEngine extends Object
A PubSubEngine is responsible for handling packets sent to a pub-sub service.
Author:
Matt Tucker
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static class 
    Response Object returned by createNodeHelper method
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    createNodeHelper(PubSubService service, org.xmpp.packet.JID requester, org.dom4j.Element configuration, String nodeID, org.xmpp.forms.DataForm publishOptions)
    Checks if the following conditions are satisfied and creates a node - Requester can create nodes - Instant node creation is enabled - Node does not already exist - New node configuration is valid
    NOTE 1: This method should not reply to the client
    NOTE 2: This method calls UserManager::isRegisteredUser(JID) which can block waiting for a response - so do not call this method in the same thread in which a response might arrive
    static org.xmpp.forms.DataForm
    getPublishOptions(org.xmpp.packet.IQ iq)
    Get the dataform that describes the publish options from the request, or null if no such form was included.
    getShowPresences(PubSubService service, org.xmpp.packet.JID subscriber)
    Returns the show values of the last know presence of all connected resources of the specified subscriber.
    static void
    presenceSubscriptionNotRequired(PubSubService service, Node node, org.xmpp.packet.JID user)
    Requests the pubsub service to subscribe to the presence of the user.
    static void
    presenceSubscriptionRequired(PubSubService service, Node node, org.xmpp.packet.JID user)
    Requests the pubsub service to unsubscribe from the presence of the user.
    process(PubSubService service, org.xmpp.packet.IQ iq)
    Handles IQ packets sent to the pubsub service.
    void
    process(PubSubService service, org.xmpp.packet.Message message)
    Handles Message packets sent to the pubsub service.
    void
    process(PubSubService service, org.xmpp.packet.Presence presence)
    Handles Presence packets sent to the pubsub service.
    void
     
    void
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

  • Method Details

    • process

      public Future<?> process(PubSubService service, org.xmpp.packet.IQ iq)
      Handles IQ packets sent to the pubsub service. Requests of disco#info and disco#items are not being handled by the engine. Instead the service itself should handle disco packets.
      Parameters:
      service - the PubSub service this action is to be performed for.
      iq - the IQ packet sent to the pubsub service.
      Returns:
      null if the IQ packet was not handled by the engine, otherwise a Future that indicates when processing is complete. Processing will be carried out asynchronously if there is the possibility of sending a disco#info to a remote server, which could block for up to 60 seconds. If processing is carried out synchronously, the returned future completes immediately. Note that the returned future will only return null when it completes.
    • process

      public void process(PubSubService service, org.xmpp.packet.Presence presence)
      Handles Presence packets sent to the pubsub service. Only process available and not available presences.
      Parameters:
      service - the PubSub service this action is to be performed for.
      presence - the Presence packet sent to the pubsub service.
    • process

      public void process(PubSubService service, org.xmpp.packet.Message message)
      Handles Message packets sent to the pubsub service. Messages may be of type error when an event notification was sent to a susbcriber whose address is no longer available.

      Answers to authorization requests sent to node owners to approve pending subscriptions will also be processed by this method.

      Parameters:
      service - the PubSub service this action is to be performed for.
      message - the Message packet sent to the pubsub service.
    • getPublishOptions

      public static org.xmpp.forms.DataForm getPublishOptions(org.xmpp.packet.IQ iq)
      Get the dataform that describes the publish options from the request, or null if no such form was included.
      Parameters:
      iq - The publish request (cannot be null).
      Returns:
      A publish options data form (possibly null).
    • createNodeHelper

      public static PubSubEngine.CreateNodeResponse createNodeHelper(PubSubService service, org.xmpp.packet.JID requester, org.dom4j.Element configuration, String nodeID, org.xmpp.forms.DataForm publishOptions)
      Checks if the following conditions are satisfied and creates a node - Requester can create nodes - Instant node creation is enabled - Node does not already exist - New node configuration is valid
      NOTE 1: This method should not reply to the client
      NOTE 2: This method calls UserManager::isRegisteredUser(JID) which can block waiting for a response - so do not call this method in the same thread in which a response might arrive
      Parameters:
      service - The service instance that's responsible for processing (cannot be null)
      requester - The (full) JID of the entity that performs the action (cannot be null)
      configuration - Optional Configuration dataform, if user requested to configure the node (can be null)
      nodeID - The ID of the node to be created, or null when an instant node is to be created.
      publishOptions - Optional Publishing Options, which are either preconditions or configuration overrides (can be null)
      Returns:
      PubSubEngine.CreateNodeResponse
    • start

      public void start(PubSubService service)
    • shutdown

      public void shutdown(PubSubService service)
    • getShowPresences

      public static Collection<String> getShowPresences(PubSubService service, org.xmpp.packet.JID subscriber)
      Returns the show values of the last know presence of all connected resources of the specified subscriber. When the subscriber JID is a bare JID then the answered collection will have many entries one for each connected resource. Moreover, if the user is offline then an empty collectin is returned. Available show status is represented by a online value. The rest of the possible show values as defined in RFC 3921.
      Parameters:
      service - the PubSub service this action is to be performed for.
      subscriber - the JID of the subscriber. This is not the JID of the affiliate.
      Returns:
      an empty collection when offline. Otherwise, a collection with the show value of each connected resource.
    • presenceSubscriptionNotRequired

      public static void presenceSubscriptionNotRequired(PubSubService service, Node node, org.xmpp.packet.JID user)
      Requests the pubsub service to subscribe to the presence of the user. If the service has already subscribed to the user's presence then do nothing.
      Parameters:
      service - the PubSub service this action is to be performed for.
      node - the node that originated the subscription request.
      user - the JID of the affiliate to subscribe to his presence.
    • presenceSubscriptionRequired

      public static void presenceSubscriptionRequired(PubSubService service, Node node, org.xmpp.packet.JID user)
      Requests the pubsub service to unsubscribe from the presence of the user. If the service was not subscribed to the user's presence or any node still requires to be subscribed to the user presence then do nothing.
      Parameters:
      service - the PubSub service this action is to be performed for.
      node - the node that originated the unsubscription request.
      user - the JID of the affiliate to unsubscribe from his presence.