Jitsi: the OpenSource Java VoIP and Instant Messaging client.

net.java.sip.communicator.impl.protocol.jabber.extensions.jingle
Class JinglePacketFactory

java.lang.Object
  extended by net.java.sip.communicator.impl.protocol.jabber.extensions.jingle.JinglePacketFactory

public class JinglePacketFactory
extends Object

A utility class containing methods for creating JingleIQ instances for various situations.

Author:
Emil Ivov

Constructor Summary
JinglePacketFactory()
           
 
Method Summary
static JingleIQ createBusy(String from, String to, String sid)
          Creates a JingleIQ session-terminate packet carrying a Reason.BUSY payload.
static JingleIQ createBye(String from, String to, String sid)
          Creates a JingleIQ session-terminate packet that is meant to terminate an on-going, well established session (similar to a SIP BYE request).
static JingleIQ createCancel(String from, String to, String sid)
          Creates a JingleIQ session-terminate packet that is meant to terminate a not yet established session.
static JingleIQ createContentAccept(String from, String to, String sid, Iterable<ContentPacketExtension> contentList)
          Creates a new JingleIQ with the content-accept action.
static JingleIQ createContentAdd(String from, String to, String sid, List<ContentPacketExtension> contentList)
          Creates a new JingleIQ with the content-add action.
static JingleIQ createContentModify(String from, String to, String sid, ContentPacketExtension content)
          Creates a new JingleIQ with the content-modify action.
static JingleIQ createContentReject(String from, String to, String sid, Iterable<ContentPacketExtension> contentList)
          Creates a new JingleIQ with the content-reject action.
static JingleIQ createContentRemove(String from, String to, String sid, Iterable<ContentPacketExtension> contentList)
          Creates a new JingleIQ with the content-remove action.
static JingleIQ createRinging(JingleIQ sessionInitiate)
          Creates a JingleIQ session-info packet carrying a ringing payload.
static JingleIQ createSessionAccept(String from, String to, String sid, Iterable<ContentPacketExtension> contentList)
          Creates a JingleIQ session-accept packet with the specified from, to, sid, and content.
static JingleIQ createSessionInfo(String from, String to, String sid)
          Creates a JingleIQ session-info packet carrying a the specified payload type.
static JingleIQ createSessionInfo(String from, String to, String sid, SessionInfoType type)
          Creates a JingleIQ session-info packet carrying a the specified payload type.
static JingleIQ createSessionInitiate(String from, String to, String sid, List<ContentPacketExtension> contentList)
          Creates a new JingleIQ with the session-initiate action.
static JingleIQ createSessionTerminate(String from, String to, String sid, Reason reason, String reasonText)
          Creates a JingleIQ session-terminate packet with the specified src, dst, sid, and reason.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JinglePacketFactory

public JinglePacketFactory()
Method Detail

createRinging

public static JingleIQ createRinging(JingleIQ sessionInitiate)
Creates a JingleIQ session-info packet carrying a ringing payload.

Parameters:
sessionInitiate - the JingleIQ that established the session which the response is going to belong to.
Returns:
a JingleIQ session-info packet carrying a ringing payload.

createSessionInfo

public static JingleIQ createSessionInfo(String from,
                                         String to,
                                         String sid)
Creates a JingleIQ session-info packet carrying a the specified payload type.

Parameters:
from - our full jid
to - their full jid
sid - the ID of the Jingle session this IQ will belong to.
Returns:
a JingleIQ session-info packet carrying a the specified payload type.

createSessionInfo

public static JingleIQ createSessionInfo(String from,
                                         String to,
                                         String sid,
                                         SessionInfoType type)
Creates a JingleIQ session-info packet carrying a the specified payload type.

Parameters:
from - our full jid
to - their full jid
sid - the ID of the Jingle session this IQ will belong to.
type - the exact type (e.g. ringing, hold, mute) of the session info IQ.
Returns:
a JingleIQ session-info packet carrying a the specified payload type.

createBusy

public static JingleIQ createBusy(String from,
                                  String to,
                                  String sid)
Creates a JingleIQ session-terminate packet carrying a Reason.BUSY payload.

Parameters:
from - our JID
to - the destination JID
sid - the ID of the Jingle session that this message will be terminating.
Returns:
a JingleIQ session-terminate packet.

createBye

public static JingleIQ createBye(String from,
                                 String to,
                                 String sid)
Creates a JingleIQ session-terminate packet that is meant to terminate an on-going, well established session (similar to a SIP BYE request).

Parameters:
from - our JID
to - the destination JID
sid - the ID of the Jingle session that this message will be terminating.
Returns:
a JingleIQ session-terminate packet .

createCancel

public static JingleIQ createCancel(String from,
                                    String to,
                                    String sid)
Creates a JingleIQ session-terminate packet that is meant to terminate a not yet established session.

Parameters:
from - our JID
to - the destination JID
sid - the ID of the Jingle session that this message will be terminating.
Returns:
a JingleIQ session-terminate packet .

createSessionTerminate

public static JingleIQ createSessionTerminate(String from,
                                              String to,
                                              String sid,
                                              Reason reason,
                                              String reasonText)
Creates a JingleIQ session-terminate packet with the specified src, dst, sid, and reason.

Parameters:
from - our JID
to - the destination JID
sid - the ID of the Jingle session that this message will be terminating.
reason - the reason for the termination
reasonText - a human readable reason for the termination or null for none.
Returns:
the newly constructed JingleIQ session-terminate packet. .

createSessionAccept

public static JingleIQ createSessionAccept(String from,
                                           String to,
                                           String sid,
                                           Iterable<ContentPacketExtension> contentList)
Creates a JingleIQ session-accept packet with the specified from, to, sid, and content. Given our role in a conversation, we would assume that the from value should also be used for the value of the Jingle responder.

Parameters:
from - our JID
to - the destination JID
sid - the ID of the Jingle session that this message will be terminating.
contentList - the content elements containing media and transport descriptions.
Returns:
the newly constructed JingleIQ session-accept packet.

createSessionInitiate

public static JingleIQ createSessionInitiate(String from,
                                             String to,
                                             String sid,
                                             List<ContentPacketExtension> contentList)
Creates a new JingleIQ with the session-initiate action.

Parameters:
from - our JID
to - the destination JID
sid - the ID of the Jingle session that this message will be terminating.
contentList - the content elements containing media and transport descriptions.
Returns:
the newly constructed JingleIQ session-initiate packet.

createContentAdd

public static JingleIQ createContentAdd(String from,
                                        String to,
                                        String sid,
                                        List<ContentPacketExtension> contentList)
Creates a new JingleIQ with the content-add action.

Parameters:
from - our JID
to - the destination JID
sid - the ID of the Jingle session that this message will be terminating.
contentList - the content elements containing media and transport descriptions.
Returns:
the newly constructed JingleIQ content-add packet.

createContentAccept

public static JingleIQ createContentAccept(String from,
                                           String to,
                                           String sid,
                                           Iterable<ContentPacketExtension> contentList)
Creates a new JingleIQ with the content-accept action.

Parameters:
from - our JID
to - the destination JID
sid - the ID of the Jingle session that this message will be terminating.
contentList - the content elements containing media and transport descriptions.
Returns:
the newly constructed JingleIQ content-accept packet.

createContentReject

public static JingleIQ createContentReject(String from,
                                           String to,
                                           String sid,
                                           Iterable<ContentPacketExtension> contentList)
Creates a new JingleIQ with the content-reject action.

Parameters:
from - our JID
to - the destination JID
sid - the ID of the Jingle session that this message will be terminating.
contentList - the content elements containing media and transport descriptions.
Returns:
the newly constructed JingleIQ content-reject packet.

createContentModify

public static JingleIQ createContentModify(String from,
                                           String to,
                                           String sid,
                                           ContentPacketExtension content)
Creates a new JingleIQ with the content-modify action.

Parameters:
from - our JID
to - the destination JID
sid - the ID of the Jingle session that this message will be terminating.
content - the content element containing media and transport description.
Returns:
the newly constructed JingleIQ content-modify packet.

createContentRemove

public static JingleIQ createContentRemove(String from,
                                           String to,
                                           String sid,
                                           Iterable<ContentPacketExtension> contentList)
Creates a new JingleIQ with the content-remove action.

Parameters:
from - our JID
to - the destination JID
sid - the ID of the Jingle session that this message will be terminating.
contentList - the content elements containing media and transport descriptions.
Returns:
the newly constructed JingleIQ content-remove packet.

Jitsi: the OpenSource Java VoIP and Instant Messaging client.

Jitsi, the OpenSource Java VoIP and Instant Messaging client.
Distributable under LGPL license.