Class JingleNegotiator
- java.lang.Object
-
- org.jivesoftware.smackx.jingleold.JingleNegotiator
-
- Direct Known Subclasses:
ContentNegotiator
,JingleSession
,MediaNegotiator
,TransportNegotiator
public abstract class JingleNegotiator extends java.lang.Object
Basic Jingle negotiator.JingleNegotiator implements some basic behavior for every Jingle negotiation. It implements a "state" pattern: each stage should process Jingle packets and act depending on the current state in the negotiation...
-
-
Field Summary
Fields Modifier and Type Field Description protected JingleSession
session
-
Constructor Summary
Constructors Constructor Description JingleNegotiator()
Default constructor.JingleNegotiator(JingleSession session)
Default constructor with a Connection.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description void
addExpectedId(java.lang.String id)
Add expected ID.void
addListener(JingleListener li)
Add a Jingle session listener to listen to incoming session requests.void
close()
Close the negotiation.abstract java.util.List<IQ>
dispatchIncomingPacket(IQ iq, java.lang.String id)
Dispatch an incoming packet.protected abstract void
doStart()
Each of the negotiators has their individual behavior when they start.XMPPConnection
getConnection()
protected java.util.List<JingleListener>
getListenersList()
Get a copy of the listenersJingleNegotiatorState
getNegotiatorState()
JingleSession
getSession()
Get the XMPP connection associated with this negotiation.boolean
isExpectedId(java.lang.String id)
Check if the passed ID is the expected ID.boolean
isStarted()
void
removeExpectedId(java.lang.String id)
Remove and expected ID.void
removeListener(JingleListener li)
Removes a Jingle session listener.void
setNegotiatorState(JingleNegotiatorState stateIs)
void
setSession(JingleSession session)
Set the XMPP connection associated.void
start()
-
-
-
Field Detail
-
session
protected JingleSession session
-
-
Constructor Detail
-
JingleNegotiator
public JingleNegotiator()
Default constructor.
-
JingleNegotiator
public JingleNegotiator(JingleSession session)
Default constructor with a Connection.- Parameters:
session
- the jingle session
-
-
Method Detail
-
getNegotiatorState
public JingleNegotiatorState getNegotiatorState()
-
setNegotiatorState
public void setNegotiatorState(JingleNegotiatorState stateIs)
-
getConnection
public XMPPConnection getConnection()
-
getSession
public JingleSession getSession()
Get the XMPP connection associated with this negotiation.- Returns:
- the connection
-
setSession
public void setSession(JingleSession session)
Set the XMPP connection associated.- Parameters:
session
- the jingle session
-
addExpectedId
public void addExpectedId(java.lang.String id)
Add expected ID.- Parameters:
id
- TODO javadoc me please
-
isExpectedId
public boolean isExpectedId(java.lang.String id)
Check if the passed ID is the expected ID.- Parameters:
id
- TODO javadoc me please- Returns:
- true if is expected id
-
removeExpectedId
public void removeExpectedId(java.lang.String id)
Remove and expected ID.- Parameters:
id
- TODO javadoc me please
-
addListener
public void addListener(JingleListener li)
Add a Jingle session listener to listen to incoming session requests.- Parameters:
li
- The listener- See Also:
JingleListener
-
removeListener
public void removeListener(JingleListener li)
Removes a Jingle session listener.- Parameters:
li
- The jingle session listener to be removed- See Also:
JingleListener
-
getListenersList
protected java.util.List<JingleListener> getListenersList()
Get a copy of the listeners- Returns:
- a copy of the listeners
-
dispatchIncomingPacket
public abstract java.util.List<IQ> dispatchIncomingPacket(IQ iq, java.lang.String id) throws XMPPException, SmackException, java.lang.InterruptedException
Dispatch an incoming packet. The negotiators form a tree relationship that roughly matches the Jingle stanza format: JingleSession Content Negotiator Media Negotiator Transport Negotiator Content Negotiator Media Negotiator Transport Negotiator <jingle> <content> <description> <transport> <content> <description> <transport> This way, each segment of a Jingle stanza has a corresponding negotiator that know how to deal with that part of the Jingle packet. It also allows us to support Jingle packets of arbitraty complexity. Each parent calls dispatchIncomingPacket for each of its children. The children then pass back a List of results that will get sent when we reach the top level negotiator (JingleSession).- Parameters:
iq
- the stanza receivedid
- the ID of the response that will be sent- Returns:
- the new stanza to send (either a Jingle or an IQ error).
- Throws:
XMPPException
- if an XMPP protocol error was received.SmackException
- if Smack detected an exceptional situation.java.lang.InterruptedException
- if the calling thread was interrupted.
-
start
public void start()
-
isStarted
public boolean isStarted()
-
doStart
protected abstract void doStart()
Each of the negotiators has their individual behavior when they start.
-
close
public void close()
Close the negotiation.
-
-