Class Subscription

  • All Implemented Interfaces:
    org.jivesoftware.smack.packet.Element, org.jivesoftware.smack.packet.NamedElement, org.jivesoftware.smack.packet.XmlElement, org.jivesoftware.smack.packet.XmlLangElement

    public class Subscription
    extends NodeExtension
    Represents a subscription to node for both requests and replies.
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static class  Subscription.State  
    • Constructor Summary

      Constructors 
      Constructor Description
      Subscription​(org.jxmpp.jid.Jid subscriptionJid)
      Used to constructs a subscription request to the root node with the specified JID.
      Subscription​(org.jxmpp.jid.Jid subscriptionJid, java.lang.String nodeId)
      Used to constructs a subscription request to the specified node with the specified JID.
      Subscription​(org.jxmpp.jid.Jid jid, java.lang.String nodeId, java.lang.String subscriptionId, Subscription.State state)
      Constructs a representation of a subscription reply to the specified node and JID.
      Subscription​(org.jxmpp.jid.Jid jid, java.lang.String nodeId, java.lang.String subscriptionId, Subscription.State state, boolean configRequired)
      Constructs a representation of a subscription reply to the specified node and JID.
      Subscription​(org.jxmpp.jid.Jid subscriptionJid, Subscription.State state)
      Construct a subscription change request to the specified state.
    • Field Detail

      • jid

        protected org.jxmpp.jid.Jid jid
      • id

        protected java.lang.String id
      • configRequired

        protected boolean configRequired
    • Constructor Detail

      • Subscription

        public Subscription​(org.jxmpp.jid.Jid subscriptionJid)
        Used to constructs a subscription request to the root node with the specified JID.
        Parameters:
        subscriptionJid - The subscriber JID
      • Subscription

        public Subscription​(org.jxmpp.jid.Jid subscriptionJid,
                            java.lang.String nodeId)
        Used to constructs a subscription request to the specified node with the specified JID.
        Parameters:
        subscriptionJid - The subscriber JID
        nodeId - The node id
      • Subscription

        public Subscription​(org.jxmpp.jid.Jid subscriptionJid,
                            Subscription.State state)
        Construct a subscription change request to the specified state.
        Parameters:
        subscriptionJid - The subscriber JID
        state - The requested new state
      • Subscription

        public Subscription​(org.jxmpp.jid.Jid jid,
                            java.lang.String nodeId,
                            java.lang.String subscriptionId,
                            Subscription.State state)
        Constructs a representation of a subscription reply to the specified node and JID. The server will have supplied the subscription id and current state.
        Parameters:
        jid - The JID the request was made under
        nodeId - The node subscribed to
        subscriptionId - The id of this subscription
        state - The current state of the subscription
      • Subscription

        public Subscription​(org.jxmpp.jid.Jid jid,
                            java.lang.String nodeId,
                            java.lang.String subscriptionId,
                            Subscription.State state,
                            boolean configRequired)
        Constructs a representation of a subscription reply to the specified node and JID. The server will have supplied the subscription id and current state and whether the subscription need to be configured.
        Parameters:
        jid - The JID the request was made under
        nodeId - The node subscribed to
        subscriptionId - The id of this subscription
        state - The current state of the subscription
        configRequired - Is configuration required to complete the subscription
    • Method Detail

      • getJid

        public org.jxmpp.jid.Jid getJid()
        Gets the JID the subscription is created for.
        Returns:
        The JID
      • getId

        public java.lang.String getId()
        Gets the subscription id.
        Returns:
        The subscription id
      • getState

        public Subscription.State getState()
        Gets the current subscription state.
        Returns:
        Current subscription state
      • addXml

        protected void addXml​(org.jivesoftware.smack.util.XmlStringBuilder xml)
        Overrides:
        addXml in class NodeExtension