public class JingleSession extends JingleNegotiator implements MediaReceivedListener
Modifier and Type | Field and Description |
---|---|
protected List<JingleMediaManager> |
jingleMediaManagers |
session
Constructor and Description |
---|
JingleSession(XMPPConnection conn,
JingleSessionRequest request,
String initiator,
String responder,
List<JingleMediaManager> jingleMediaManagers)
JingleSession constructor (for an outgoing Jingle session)
|
JingleSession(XMPPConnection conn,
String initiator,
String responder,
String sessionid,
List<JingleMediaManager> jingleMediaManagers)
Full featured JingleSession constructor
|
Modifier and Type | Method and Description |
---|---|
void |
addContentNegotiator(ContentNegotiator inContentNegotiator)
Add a new content negotiator on behalf of a
|
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.
|
static IQ |
createError(String ID,
String to,
String from,
int errCode,
XMPPError error)
A convience method to create an error packet.
|
static IQ |
createIQ(String ID,
String to,
String from,
IQ.Type type)
A convience method to create an 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() |
String |
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.
|
String |
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.
|
void |
removeMediaListener(JingleMediaListener li)
Remove a listener for jmf negotiation events
|
protected void |
removePacketListener()
Remove the packet listener used for processing packet.
|
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 |
sendPacket(IQ iq) |
void |
setInitiator(String initiator)
Set the session initiator
|
void |
setMediaManagers(List<JingleMediaManager> jingleMediaManagers)
Set the Media Manager of this Jingle Session
|
void |
setResponder(String 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 packet listener.
|
addExpectedId, addListener, getListenersList, getNegotiatorState, getSession, isExpectedId, isStarted, removeExpectedId, removeListener, setNegotiatorState, setSession, start
protected List<JingleMediaManager> jingleMediaManagers
public JingleSession(XMPPConnection conn, String initiator, String 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, String initiator, String responder, List<JingleMediaManager> jingleMediaManagers)
conn
- Connectioninitiator
- the initiator JIDresponder
- the responder JIDjingleMediaManagers
- the jingleMediaManagerpublic String getInitiator()
public XMPPConnection getConnection()
getConnection
in class JingleNegotiator
public void setInitiator(String initiator)
initiator
- the initiator to setpublic List<JingleMediaManager> getMediaManagers()
public void setMediaManagers(List<JingleMediaManager> jingleMediaManagers)
jingleMediaManagers
- public String getResponder()
public void setResponder(String 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
iq
- the packet receivedXMPPException
SmackException
public List<IQ> dispatchIncomingPacket(IQ iq, String id) throws XMPPException, SmackException
dispatchIncomingPacket
in class JingleNegotiator
iq
- the packet receivedid
- the ID of the response that will be sentXMPPException
SmackException
public void addContentNegotiator(ContentNegotiator inContentNegotiator)
public void sendPacket(IQ iq) throws SmackException.NotConnectedException
public Jingle sendFormattedJingle(Jingle jout) throws SmackException.NotConnectedException
jout
- the Jingle packet we want to complete and sendSmackException.NotConnectedException
public Jingle sendFormattedJingle(IQ iq, Jingle jout) throws SmackException.NotConnectedException
iq
- The Jingle packet we are responing tojout
- the Jingle packet we want to complete and sendSmackException.NotConnectedException
public static JingleSession getInstanceFor(XMPPConnection con)
con
- A XMPP connectionprotected void removePacketListener()
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
public void terminate(String reason) throws XMPPException, SmackException.NotConnectedException
public void close()
close
in class JingleNegotiator
public boolean isClosed()
public static IQ createIQ(String ID, String to, String from, IQ.Type type)
ID
- The packet ID of theto
- To whom the packet is addressed.from
- From whom the packet is sent.type
- The iq type of the packet.public static IQ createError(String ID, String to, String from, int errCode, XMPPError error)
ID
- The packet ID of theto
- To whom the packet is addressed.from
- From whom the packet is sent.errCode
- The error code.error
- The XMPPError string.public IQ createJingleError(IQ iq, JingleError jingleError)
iq
- The Jingle packet we are responing tojingleError
- the IQ packet we want to complete and sendpublic void mediaReceived(String participant)
mediaReceived
in interface MediaReceivedListener
public void startOutgoing() throws IllegalStateException, SmackException
IllegalStateException
SmackException
public void startIncoming()
protected void doStart()
JingleNegotiator
doStart
in class JingleNegotiator
public void addJingleMediaSession(String mediaManagerName, JingleMediaSession mediaSession)
public JingleMediaSession getMediaSession(String mediaManagerName)