org.jivesoftware.smackx.packet
Class Jingle

java.lang.Object
  extended by IQ
      extended by org.jivesoftware.smackx.packet.Jingle

public class Jingle
extends IQ

An Jingle sub-packet, which is used by XMPP clients to exchange info like descriptions and transports.

The following link summarizes the requirements of Jingle IM: Valid tags.

Warning: this is an non-standard protocol documented by JEP-166. Because this is a non-standard protocol, it is subject to change.

Author:
Alvaro Saurin

Field Summary
static java.lang.String NAMESPACE
           
static java.lang.String NODENAME
           
 
Constructor Summary
Jingle()
          The default constructor
Jingle(JingleActionEnum action)
          A constructor where the action can be specified.
Jingle(JingleContent content)
          Constructor with a contents.
Jingle(JingleContentInfo info)
          Constructor with a content info.
Jingle(java.util.List<JingleContent> contents, JingleContentInfo mi, java.lang.String sid)
          A constructor where the main components can be initialized.
Jingle(java.lang.String sid)
          A constructor where the session ID can be specified.
 
Method Summary
 void addContent(JingleContent content)
          Add a new content.
 void addContents(java.util.List<JingleContent> contentList)
          Add a list of JingleContent elements
 JingleActionEnum getAction()
          Get the action specified in the packet
 java.lang.String getChildElementXML()
          Return the XML representation of the packet.
 JingleContentInfo getContentInfo()
           
 java.util.Iterator<JingleContent> getContents()
          Get an iterator for the contents
 java.util.List<JingleContent> getContentsList()
          Get an iterator for the content
static java.lang.String getElementName()
          Returns the XML element name of the extension sub-packet root element.
 java.lang.String getInitiator()
          Get the initiator.
static java.lang.String getNamespace()
          Returns the XML namespace of the extension sub-packet root element.
 java.lang.String getResponder()
          Get the responder.
static int getSessionHash(java.lang.String sid, java.lang.String initiator)
          Get a hash key for the session this packet belongs to.
 java.lang.String getSid()
          Returns the session ID related to the session.
 void setAction(JingleActionEnum action)
          Set the action in the packet
 void setContentInfo(JingleContentInfo contentInfo)
           
 void setInitiator(java.lang.String initiator)
          Set the initiator.
 void setResponder(java.lang.String resp)
          Set the responder.
 void setSid(java.lang.String sid)
          Set the session ID related to this session.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NAMESPACE

public static final java.lang.String NAMESPACE
See Also:
Constant Field Values

NODENAME

public static final java.lang.String NODENAME
See Also:
Constant Field Values
Constructor Detail

Jingle

public Jingle(java.util.List<JingleContent> contents,
              JingleContentInfo mi,
              java.lang.String sid)
A constructor where the main components can be initialized.


Jingle

public Jingle(JingleContent content)
Constructor with a contents.

Parameters:
content - a content

Jingle

public Jingle(JingleContentInfo info)
Constructor with a content info.

Parameters:
info - The content info

Jingle

public Jingle(JingleActionEnum action)
A constructor where the action can be specified.

Parameters:
action - The action.

Jingle

public Jingle(java.lang.String sid)
A constructor where the session ID can be specified.

Parameters:
sid - The session ID related to the negotiation.
See Also:
setSid(String)

Jingle

public Jingle()
The default constructor

Method Detail

setSid

public final void setSid(java.lang.String sid)
Set the session ID related to this session. The session ID is a unique identifier generated by the initiator. This should match the XML Nmtoken production so that XML character escaping is not needed for characters such as &.

Parameters:
sid - the session ID

getSid

public java.lang.String getSid()
Returns the session ID related to the session. The session ID is a unique identifier generated by the initiator. This should match the XML Nmtoken production so that XML character escaping is not needed for characters such as &.

Returns:
Returns the session ID related to the session.
See Also:
setSid(String)

getElementName

public static java.lang.String getElementName()
Returns the XML element name of the extension sub-packet root element. Always returns "jingle"

Returns:
the XML element name of the packet extension.

getNamespace

public static java.lang.String getNamespace()
Returns the XML namespace of the extension sub-packet root element.

Returns:
the XML namespace of the packet extension.

getContentInfo

public JingleContentInfo getContentInfo()
Returns:
the audioInfo

setContentInfo

public void setContentInfo(JingleContentInfo contentInfo)
Parameters:
contentInfo - the audioInfo to set

getContents

public java.util.Iterator<JingleContent> getContents()
Get an iterator for the contents

Returns:
the contents

getContentsList

public java.util.List<JingleContent> getContentsList()
Get an iterator for the content

Returns:
the contents

addContent

public void addContent(JingleContent content)
Add a new content.

Parameters:
content - the content to add

addContents

public void addContents(java.util.List<JingleContent> contentList)
Add a list of JingleContent elements

Parameters:
contentList - the list of contents to add

getAction

public JingleActionEnum getAction()
Get the action specified in the packet

Returns:
the action

setAction

public void setAction(JingleActionEnum action)
Set the action in the packet

Parameters:
action - the action to set

getInitiator

public java.lang.String getInitiator()
Get the initiator. The initiator will be the full JID of the entity that has initiated the flow (which may be different to the "from" address in the IQ)

Returns:
the initiator

setInitiator

public void setInitiator(java.lang.String initiator)
Set the initiator. The initiator must be the full JID of the entity that has initiated the flow (which may be different to the "from" address in the IQ)

Parameters:
initiator - the initiator to set

getResponder

public java.lang.String getResponder()
Get the responder. The responder is the full JID of the entity that has replied to the initiation (which may be different to the "to" addresss in the IQ).

Returns:
the responder

setResponder

public void setResponder(java.lang.String resp)
Set the responder. The responder must be the full JID of the entity that has replied to the initiation (which may be different to the "to" addresss in the IQ).

Parameters:
resp - the responder to set

getSessionHash

public static int getSessionHash(java.lang.String sid,
                                 java.lang.String initiator)
Get a hash key for the session this packet belongs to.

Parameters:
sid - The session id
initiator - The initiator
Returns:
A hash key

getChildElementXML

public java.lang.String getChildElementXML()
Return the XML representation of the packet.

Returns:
the XML string