public class JingleSession extends JingleNegotiator implements MediaReceivedListener
| Modifier and Type | Field and Description |
|---|---|
protected java.util.List<JingleMediaManager> |
jingleMediaManagers |
session| Constructor and Description |
|---|
JingleSession(XMPPConnection conn,
org.jxmpp.jid.Jid initiator,
org.jxmpp.jid.Jid responder,
java.lang.String sessionid,
java.util.List<JingleMediaManager> jingleMediaManagers)
Full featured JingleSession constructor.
|
JingleSession(XMPPConnection conn,
JingleSessionRequest request,
org.jxmpp.jid.Jid initiator,
org.jxmpp.jid.Jid responder,
java.util.List<JingleMediaManager> jingleMediaManagers)
JingleSession constructor (for an outgoing Jingle session).
|
| Modifier and Type | Method and Description |
|---|---|
void |
addContentNegotiator(ContentNegotiator inContentNegotiator)
Add a new content negotiator on behalf of a <content/> section received.
|
void |
addJingleMediaSession(java.lang.String mediaManagerName,
JingleMediaSession mediaSession)
The jingle session may have one or more media managers that are trying to establish media sessions.
|
void |
addMediaListener(JingleMediaListener li)
Add a listener for jmf negotiation events.
|
void |
addTransportListener(JingleTransportListener li)
Add a listener for transport negotiation events.
|
void |
close()
Terminate negotiations.
|
IQ |
createAck(IQ iq)
Acknowledge a IQ packet.
|
IQ |
createJingleError(IQ iq,
JingleError jingleError)
Complete and send an error.
|
java.util.List<IQ> |
dispatchIncomingPacket(IQ iq,
java.lang.String id)
Dispatch an incoming packet.
|
protected void |
doStart()
Each of the negotiators has their individual behavior when they start.
|
boolean |
equals(java.lang.Object obj) |
protected static java.lang.String |
generateSessionId()
Generate a unique session ID.
|
XMPPConnection |
getConnection() |
org.jxmpp.jid.Jid |
getInitiator()
Get the session initiator.
|
static JingleSession |
getInstanceFor(XMPPConnection con)
Returns the JingleSession related to a particular connection.
|
java.util.List<JingleMediaManager> |
getMediaManagers()
Get the Media Manager of this Jingle Session.
|
JingleMediaSession |
getMediaSession(java.lang.String mediaManagerName)
The jingle session may have one or more media managers that are trying to establish media sessions.
|
org.jxmpp.jid.Jid |
getResponder()
Get the session responder.
|
JingleSessionState |
getSessionState() |
java.lang.String |
getSid()
Get the session ID.
|
int |
hashCode()
Send a content info message.
|
boolean |
isClosed() |
boolean |
isFullyEstablished()
Return true if all of the media managers have finished.
|
void |
mediaReceived(java.lang.String participant)
Called when new Media is received.
|
void |
receivePacketAndRespond(IQ iq)
Process and respond to an incoming packet.
|
protected void |
removeAsyncPacketListener()
Remove the stanza(/packet) listener used for processing packet.
|
void |
removeMediaListener(JingleMediaListener li)
Remove a listener for jmf negotiation events.
|
void |
removeTransportListener(JingleTransportListener li)
Remove a listener for transport negotiation events.
|
Jingle |
sendFormattedJingle(IQ iq,
Jingle jout)
Complete and send a packet.
|
Jingle |
sendFormattedJingle(Jingle jout)
Complete and send a packet.
|
void |
sendStanza(IQ iq) |
void |
setInitiator(org.jxmpp.jid.Jid initiator)
Set the session initiator.
|
void |
setMediaManagers(java.util.List<JingleMediaManager> jingleMediaManagers)
Set the Media Manager of this Jingle Session.
|
void |
setResponder(org.jxmpp.jid.Jid responder)
Set the session responder.
|
void |
setSessionState(JingleSessionState stateIs)
Validate the state changes.
|
protected void |
setSid(java.lang.String sessionId)
Set the session ID
|
void |
setupListeners()
Setup the listeners that act on events coming from the lower level negotiators.
|
void |
startIncoming()
This is the starting point for responding to a new session.
|
void |
startOutgoing()
This is the starting point for intitiating a new session.
|
void |
terminate()
Terminates the session with default reason.
|
void |
terminate(java.lang.String reason)
Terminates the session with a custom reason.
|
protected void |
triggerMediaReceived(java.lang.String participant)
Trigger a media received event.
|
protected void |
triggerSessionClosed(java.lang.String reason)
Trigger a session closed event.
|
protected void |
triggerSessionClosedOnError(XMPPException exc)
Trigger a session closed event due to an error.
|
protected void |
updatePacketListener()
Install the stanza(/packet) listener.
|
addExpectedId, addListener, getListenersList, getNegotiatorState, getSession, isExpectedId, isStarted, removeExpectedId, removeListener, setNegotiatorState, setSession, startprotected java.util.List<JingleMediaManager> jingleMediaManagers
public JingleSession(XMPPConnection conn, org.jxmpp.jid.Jid initiator, org.jxmpp.jid.Jid responder, java.lang.String sessionid, java.util.List<JingleMediaManager> jingleMediaManagers)
conn - the XMPPConnection which is usedinitiator - the initiator JIDresponder - the responder JIDsessionid - the session IDjingleMediaManagers - the jingleMediaManagerpublic JingleSession(XMPPConnection conn, JingleSessionRequest request, org.jxmpp.jid.Jid initiator, org.jxmpp.jid.Jid responder, java.util.List<JingleMediaManager> jingleMediaManagers)
conn - Connectioninitiator - the initiator JIDresponder - the responder JIDjingleMediaManagers - the jingleMediaManagerpublic org.jxmpp.jid.Jid getInitiator()
public XMPPConnection getConnection()
getConnection in class JingleNegotiatorpublic void setInitiator(org.jxmpp.jid.Jid initiator)
initiator - the initiator to setpublic java.util.List<JingleMediaManager> getMediaManagers()
public void setMediaManagers(java.util.List<JingleMediaManager> jingleMediaManagers)
jingleMediaManagers - public org.jxmpp.jid.Jid getResponder()
public void setResponder(org.jxmpp.jid.Jid responder)
responder - the receptor to setpublic java.lang.String getSid()
protected void setSid(java.lang.String sessionId)
sessionId - the sid to setprotected static java.lang.String generateSessionId()
public void setSessionState(JingleSessionState stateIs)
public JingleSessionState getSessionState()
public boolean isFullyEstablished()
public void receivePacketAndRespond(IQ iq) throws XMPPException, SmackException, java.lang.InterruptedException
iq - the stanza(/packet) receivedXMPPExceptionSmackExceptionjava.lang.InterruptedExceptionpublic java.util.List<IQ> dispatchIncomingPacket(IQ iq, java.lang.String id) throws XMPPException, SmackException, java.lang.InterruptedException
dispatchIncomingPacket in class JingleNegotiatoriq - the stanza(/packet) receivedid - the ID of the response that will be sentXMPPExceptionSmackExceptionjava.lang.InterruptedExceptionpublic void addContentNegotiator(ContentNegotiator inContentNegotiator)
public void sendStanza(IQ iq) throws SmackException.NotConnectedException, java.lang.InterruptedException
SmackException.NotConnectedExceptionjava.lang.InterruptedExceptionpublic Jingle sendFormattedJingle(Jingle jout) throws SmackException.NotConnectedException, java.lang.InterruptedException
jout - the Jingle stanza(/packet) we want to complete and sendSmackException.NotConnectedExceptionjava.lang.InterruptedExceptionpublic Jingle sendFormattedJingle(IQ iq, Jingle jout) throws SmackException.NotConnectedException, java.lang.InterruptedException
iq - The Jingle stanza(/packet) we are responding tojout - the Jingle stanza(/packet) we want to complete and sendSmackException.NotConnectedExceptionjava.lang.InterruptedExceptionpublic IQ createAck(IQ iq)
iq - The IQ to acknowledgepublic int hashCode()
hashCode in class java.lang.Objectpublic boolean equals(java.lang.Object obj)
equals in class java.lang.Objectpublic static JingleSession getInstanceFor(XMPPConnection con)
con - A XMPP connectionprotected void removeAsyncPacketListener()
protected void updatePacketListener()
public void addMediaListener(JingleMediaListener li)
li - The listenerpublic void removeMediaListener(JingleMediaListener li)
li - The listenerpublic void addTransportListener(JingleTransportListener li)
li - The listenerpublic void removeTransportListener(JingleTransportListener li)
li - The listenerpublic void setupListeners()
protected void triggerSessionClosed(java.lang.String reason)
protected void triggerSessionClosedOnError(XMPPException exc)
protected void triggerMediaReceived(java.lang.String participant)
public void terminate() throws XMPPException, SmackException.NotConnectedException, java.lang.InterruptedException
XMPPExceptionSmackException.NotConnectedExceptionjava.lang.InterruptedExceptionpublic void terminate(java.lang.String reason) throws XMPPException, SmackException.NotConnectedException, java.lang.InterruptedException
XMPPExceptionSmackException.NotConnectedExceptionjava.lang.InterruptedExceptionpublic void close()
close in class JingleNegotiatorpublic boolean isClosed()
public IQ createJingleError(IQ iq, JingleError jingleError)
iq - The Jingle stanza(/packet) we are responding tojingleError - the IQ stanza(/packet) we want to complete and sendpublic void mediaReceived(java.lang.String participant)
mediaReceived in interface MediaReceivedListenerpublic void startOutgoing() throws java.lang.IllegalStateException, SmackException, java.lang.InterruptedException
java.lang.IllegalStateExceptionSmackExceptionjava.lang.InterruptedExceptionpublic void startIncoming()
protected void doStart()
JingleNegotiatordoStart in class JingleNegotiatorpublic void addJingleMediaSession(java.lang.String mediaManagerName, JingleMediaSession mediaSession)
public JingleMediaSession getMediaSession(java.lang.String mediaManagerName)