Smack

org.jivesoftware.smackx.pubsub
Class Subscription

java.lang.Object
  extended by org.jivesoftware.smackx.pubsub.NodeExtension
      extended by org.jivesoftware.smackx.pubsub.Subscription
All Implemented Interfaces:
PacketExtension

public class Subscription
extends NodeExtension

Represents a subscription to node for both requests and replies.

Author:
Robin Collier

Nested Class Summary
static class Subscription.State
           
 
Field Summary
protected  boolean configRequired
           
protected  java.lang.String id
           
protected  java.lang.String jid
           
protected  Subscription.State state
           
 
Constructor Summary
Subscription(java.lang.String subscriptionJid)
          Used to constructs a subscription request to the root node with the specified JID.
Subscription(java.lang.String subscriptionJid, java.lang.String nodeId)
          Used to constructs a subscription request to the specified node with the specified JID.
Subscription(java.lang.String 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(java.lang.String 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.
 
Method Summary
 java.lang.String getId()
          Gets the subscription id
 java.lang.String getJid()
          Gets the JID the subscription is created for
 Subscription.State getState()
          Gets the current subscription state.
 boolean isConfigRequired()
          This value is only relevant when the getState() is Subscription.State.unconfigured
 java.lang.String toXML()
          Returns the XML representation of the PacketExtension.
 
Methods inherited from class org.jivesoftware.smackx.pubsub.NodeExtension
getElementName, getNamespace, getNode, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

jid

protected java.lang.String jid

id

protected java.lang.String id

state

protected Subscription.State state

configRequired

protected boolean configRequired
Constructor Detail

Subscription

public Subscription(java.lang.String subscriptionJid)
Used to constructs a subscription request to the root node with the specified JID.

Parameters:
subscriptionJid - The subscriber JID

Subscription

public Subscription(java.lang.String 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(java.lang.String 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(java.lang.String 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 java.lang.String 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

isConfigRequired

public boolean isConfigRequired()
This value is only relevant when the getState() is Subscription.State.unconfigured

Returns:
true if configuration is required, false otherwise

toXML

public java.lang.String toXML()
Description copied from interface: PacketExtension
Returns the XML representation of the PacketExtension.

Specified by:
toXML in interface PacketExtension
Overrides:
toXML in class NodeExtension
Returns:
the packet extension as XML.

Smack

Copyright © 2003-2007 Jive Software.