Class JingleNegotiator
java.lang.Object
org.jivesoftware.smackx.jingleold.JingleNegotiator
- Direct Known Subclasses:
ContentNegotiator
,JingleSession
,MediaNegotiator
,TransportNegotiator
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
-
Constructor Summary
ConstructorDescriptionDefault constructor.JingleNegotiator
(JingleSession session) Default constructor with a Connection. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addExpectedId
(String id) Add expected ID.void
Add a Jingle session listener to listen to incoming session requests.void
close()
Close the negotiation.dispatchIncomingPacket
(IQ iq, String id) Dispatch an incoming packet.protected abstract void
doStart()
Each of the negotiators has their individual behavior when they start.protected List<JingleListener>
Get a copy of the listenersGet the XMPP connection associated with this negotiation.boolean
isExpectedId
(String id) Check if the passed ID is the expected ID.boolean
void
Remove and expected ID.void
Removes a Jingle session listener.void
setNegotiatorState
(JingleNegotiatorState stateIs) void
setSession
(JingleSession session) Set the XMPP connection associated.void
start()
-
Field Details
-
session
-
-
Constructor Details
-
JingleNegotiator
public JingleNegotiator()Default constructor. -
JingleNegotiator
Default constructor with a Connection.- Parameters:
session
- the jingle session
-
-
Method Details
-
getNegotiatorState
-
setNegotiatorState
-
getConnection
-
getSession
Get the XMPP connection associated with this negotiation.- Returns:
- the connection
-
setSession
Set the XMPP connection associated.- Parameters:
session
- the jingle session
-
addExpectedId
Add expected ID.- Parameters:
id
- TODO javadoc me please
-
isExpectedId
Check if the passed ID is the expected ID.- Parameters:
id
- TODO javadoc me please- Returns:
- true if is expected id
-
removeExpectedId
Remove and expected ID.- Parameters:
id
- TODO javadoc me please
-
addListener
Add a Jingle session listener to listen to incoming session requests.- Parameters:
li
- The listener- See Also:
-
removeListener
Removes a Jingle session listener.- Parameters:
li
- The jingle session listener to be removed- See Also:
-
getListenersList
Get a copy of the listeners- Returns:
- a copy of the listeners
-
dispatchIncomingPacket
public abstract List<IQ> dispatchIncomingPacket(IQ iq, String id) throws XMPPException, SmackException, 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 arbitrary 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.InterruptedException
- if the calling thread was interrupted.
-
start
-
isStarted
-
doStart
Each of the negotiators has their individual behavior when they start. -
close
Close the negotiation.
-