public class JingleSession extends JingleNegotiator implements MediaReceivedListener
Modifier and Type | Field and Description |
---|---|
protected List<JingleMediaManager> |
jingleMediaManagers |
session
Constructor and Description |
---|
JingleSession(XMPPConnection conn,
Jid initiator,
Jid responder,
String sessionid,
List<JingleMediaManager> jingleMediaManagers)
Full featured JingleSession constructor.
|
JingleSession(XMPPConnection conn,
JingleSessionRequest request,
Jid initiator,
Jid responder,
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(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.
|
List<IQ> |
dispatchIncomingPacket(IQ iq,
String id)
Dispatch an incoming packet.
|
protected void |
doStart()
Each of the negotiators has their individual behavior when they start.
|
boolean |
equals(Object obj) |
protected static String |
generateSessionId()
Generate a unique session ID.
|
XMPPConnection |
getConnection() |
Jid |
getInitiator()
Get the session initiator.
|
static JingleSession |
getInstanceFor(XMPPConnection con)
Returns the JingleSession related to a particular connection.
|
List<JingleMediaManager> |
getMediaManagers()
Get the Media Manager of this Jingle Session.
|
JingleMediaSession |
getMediaSession(String mediaManagerName)
The jingle session may have one or more media managers that are trying to establish media sessions.
|
Jid |
getResponder()
Get the session responder.
|
JingleSessionState |
getSessionState() |
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(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 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(Jid initiator)
Set the session initiator.
|
void |
setMediaManagers(List<JingleMediaManager> jingleMediaManagers)
Set the Media Manager of this Jingle Session.
|
void |
setResponder(Jid responder)
Set the session responder.
|
void |
setSessionState(JingleSessionState stateIs)
Validate the state changes.
|
protected void |
setSid(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(String reason)
Terminates the session with a custom reason.
|
protected void |
triggerMediaReceived(String participant)
Trigger a media received event.
|
protected void |
triggerSessionClosed(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 listener.
|
addExpectedId, addListener, getListenersList, getNegotiatorState, getSession, isExpectedId, isStarted, removeExpectedId, removeListener, setNegotiatorState, setSession, start
protected List<JingleMediaManager> jingleMediaManagers
public JingleSession(XMPPConnection conn, Jid initiator, Jid responder, String sessionid, 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, Jid initiator, Jid responder, List<JingleMediaManager> jingleMediaManagers)
conn
- Connectioninitiator
- the initiator JIDresponder
- the responder JIDjingleMediaManagers
- the jingleMediaManagerpublic Jid getInitiator()
public XMPPConnection getConnection()
getConnection
in class JingleNegotiator
public void setInitiator(Jid initiator)
initiator
- the initiator to setpublic List<JingleMediaManager> getMediaManagers()
public void setMediaManagers(List<JingleMediaManager> jingleMediaManagers)
jingleMediaManagers
- public Jid getResponder()
public void setResponder(Jid responder)
responder
- the receptor to setprotected void setSid(String sessionId)
sessionId
- the sid to setprotected static String generateSessionId()
public void setSessionState(JingleSessionState stateIs)
public JingleSessionState getSessionState()
public boolean isFullyEstablished()
public void receivePacketAndRespond(IQ iq) throws XMPPException, SmackException, InterruptedException
iq
- the stanza receivedXMPPException
SmackException
InterruptedException
public List<IQ> dispatchIncomingPacket(IQ iq, String id) throws XMPPException, SmackException, InterruptedException
dispatchIncomingPacket
in class JingleNegotiator
iq
- the stanza receivedid
- the ID of the response that will be sentXMPPException
SmackException
InterruptedException
public void addContentNegotiator(ContentNegotiator inContentNegotiator)
public void sendStanza(IQ iq) throws SmackException.NotConnectedException, InterruptedException
public Jingle sendFormattedJingle(Jingle jout) throws SmackException.NotConnectedException, InterruptedException
jout
- the Jingle stanza we want to complete and sendSmackException.NotConnectedException
InterruptedException
public Jingle sendFormattedJingle(IQ iq, Jingle jout) throws SmackException.NotConnectedException, InterruptedException
iq
- The Jingle stanza we are responding tojout
- the Jingle stanza we want to complete and sendSmackException.NotConnectedException
InterruptedException
public IQ createAck(IQ iq)
iq
- The IQ to acknowledgepublic 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(String reason)
protected void triggerSessionClosedOnError(XMPPException exc)
protected void triggerMediaReceived(String participant)
public void terminate() throws XMPPException, SmackException.NotConnectedException, InterruptedException
public void terminate(String reason) throws XMPPException, SmackException.NotConnectedException, InterruptedException
public void close()
close
in class JingleNegotiator
public boolean isClosed()
public IQ createJingleError(IQ iq, JingleError jingleError)
iq
- The Jingle stanza we are responding tojingleError
- the IQ stanza we want to complete and sendpublic void mediaReceived(String participant)
mediaReceived
in interface MediaReceivedListener
public void startOutgoing() throws IllegalStateException, SmackException, InterruptedException
public void startIncoming()
protected void doStart()
JingleNegotiator
doStart
in class JingleNegotiator
public void addJingleMediaSession(String mediaManagerName, JingleMediaSession mediaSession)
public JingleMediaSession getMediaSession(String mediaManagerName)