Class JingleSession

    • Constructor Detail

      • JingleSession

        public JingleSession​(XMPPConnection conn,
                             Jid initiator,
                             Jid responder,
                             java.lang.String sessionid,
                             java.util.List<JingleMediaManager> jingleMediaManagers)
        Full featured JingleSession constructor.
        Parameters:
        conn - TODO javadoc me please the XMPPConnection which is used
        initiator - TODO javadoc me please the initiator JID
        responder - TODO javadoc me please the responder JID
        sessionid - TODO javadoc me please the session ID
        jingleMediaManagers - TODO javadoc me please the jingleMediaManager
      • JingleSession

        public JingleSession​(XMPPConnection conn,
                             JingleSessionRequest request,
                             Jid initiator,
                             Jid responder,
                             java.util.List<JingleMediaManager> jingleMediaManagers)
        JingleSession constructor (for an outgoing Jingle session).
        Parameters:
        conn - Connection
        request - the request.
        initiator - the initiator JID
        responder - the responder JID
        jingleMediaManagers - the jingleMediaManager
    • Method Detail

      • getInitiator

        public Jid getInitiator()
        Get the session initiator.
        Returns:
        the initiator
      • setInitiator

        public void setInitiator​(Jid initiator)
        Set the session initiator.
        Parameters:
        initiator - TODO javadoc me please the initiator to set
      • setMediaManagers

        public void setMediaManagers​(java.util.List<JingleMediaManager> jingleMediaManagers)
        Set the Media Manager of this Jingle Session.
        Parameters:
        jingleMediaManagers - TODO javadoc me please
      • getResponder

        public Jid getResponder()
        Get the session responder.
        Returns:
        the responder
      • setResponder

        public void setResponder​(Jid responder)
        Set the session responder.
        Parameters:
        responder - TODO javadoc me please the receptor to set
      • getSid

        public java.lang.String getSid()
        Get the session ID.
        Returns:
        the sid
      • setSid

        protected void setSid​(java.lang.String sessionId)
        Set the session ID
        Parameters:
        sessionId - TODO javadoc me please the sid to set
      • generateSessionId

        protected static java.lang.String generateSessionId()
        Generate a unique session ID.
        Returns:
        the generated session ID.
      • isFullyEstablished

        public boolean isFullyEstablished()
        Return true if all of the media managers have finished.
        Returns:
        true if fully established.
      • receivePacketAndRespond

        public void receivePacketAndRespond​(IQ iq)
                                     throws XMPPException,
                                            SmackException,
                                            java.lang.InterruptedException
        Process and respond to an incoming packet. This method is called from the stanza listener dispatcher when a new stanza has arrived. The method is responsible for recognizing the stanza type and, depending on the current state, delivering it to the right event handler and wait for a response. The response will be another Jingle stanza that will be sent to the other end point.
        Parameters:
        iq - TODO javadoc me please the stanza received
        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.
      • dispatchIncomingPacket

        public java.util.List<IQdispatchIncomingPacket​(IQ iq,
                                                         java.lang.String id)
                                                  throws XMPPException,
                                                         SmackException,
                                                         java.lang.InterruptedException
        Dispatch an incoming packet. The method is responsible for recognizing the stanza type and, depending on the current state, delivering the stanza to the right event handler and wait for a response.
        Specified by:
        dispatchIncomingPacket in class JingleNegotiator
        Parameters:
        iq - TODO javadoc me please the stanza received
        id - the ID of the response that will be sent
        Returns:
        the new Jingle stanza to send.
        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.
      • addContentNegotiator

        public void addContentNegotiator​(ContentNegotiator inContentNegotiator)
        Add a new content negotiator on behalf of a <content/> section received.
        Parameters:
        inContentNegotiator - the content negotiator.
      • sendFormattedJingle

        public Jingle sendFormattedJingle​(Jingle jout)
                                   throws SmackException.NotConnectedException,
                                          java.lang.InterruptedException
        Complete and send a packet. Complete all the null fields in a Jingle reponse, using the session information we have.
        Parameters:
        jout - the Jingle stanza we want to complete and send
        Returns:
        the Jingle stanza.
        Throws:
        SmackException.NotConnectedException - if the XMPP connection is not connected.
        java.lang.InterruptedException - if the calling thread was interrupted.
      • sendFormattedJingle

        public Jingle sendFormattedJingle​(IQ iq,
                                          Jingle jout)
                                   throws SmackException.NotConnectedException,
                                          java.lang.InterruptedException
        Complete and send a packet. Complete all the null fields in a Jingle reponse, using the session information we have or some info from the incoming packet.
        Parameters:
        iq - The Jingle stanza we are responding to
        jout - the Jingle stanza we want to complete and send
        Returns:
        the Jingle stanza.
        Throws:
        SmackException.NotConnectedException - if the XMPP connection is not connected.
        java.lang.InterruptedException - if the calling thread was interrupted.
      • createAck

        public IQ createAck​(IQ iq)
        Acknowledge a IQ packet.
        Parameters:
        iq - The IQ to acknowledge.
        Returns:
        the ack IQ.
      • hashCode

        public int hashCode()
        Send a content info message.
        Overrides:
        hashCode in class java.lang.Object
      • equals

        public boolean equals​(java.lang.Object obj)
        Overrides:
        equals in class java.lang.Object
      • getInstanceFor

        public static JingleSession getInstanceFor​(XMPPConnection con)
        Returns the JingleSession related to a particular connection.
        Parameters:
        con - TODO javadoc me please A XMPP connection
        Returns:
        a Jingle session
      • removeAsyncPacketListener

        protected void removeAsyncPacketListener()
        Remove the stanza listener used for processing packet.
      • updatePacketListener

        protected void updatePacketListener()
        Install the stanza listener. The listener is responsible for responding to any stanza that we receive...
      • setupListeners

        public void setupListeners()
        Setup the listeners that act on events coming from the lower level negotiators.
      • triggerSessionClosed

        protected void triggerSessionClosed​(java.lang.String reason)
        Trigger a session closed event.
        Parameters:
        reason - the reason.
      • triggerMediaReceived

        protected void triggerMediaReceived​(java.lang.String participant)
        Trigger a media received event.
        Parameters:
        participant - the participant.
      • createJingleError

        public IQ createJingleError​(IQ iq,
                                    JingleError jingleError)
        Complete and send an error. Complete all the null fields in an IQ error response, using the session information we have or some info from the incoming packet.
        Parameters:
        iq - The Jingle stanza we are responding to
        jingleError - the IQ stanza we want to complete and send
        Returns:
        the jingle error IQ.
      • startOutgoing

        public void startOutgoing()
                           throws java.lang.IllegalStateException,
                                  SmackException,
                                  java.lang.InterruptedException
        This is the starting point for intitiating a new session.
        Throws:
        java.lang.IllegalStateException - if an illegal state was encountered
        SmackException - if Smack detected an exceptional situation.
        java.lang.InterruptedException - if the calling thread was interrupted.
      • startIncoming

        public void startIncoming()
        This is the starting point for responding to a new session.
      • addJingleMediaSession

        public 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. When the media manager succeeds in creating a media session is registers it with the session by the media manager's static name. This routine is where the media manager does the registering.
        Parameters:
        mediaManagerName - the name of the media manager.
        mediaSession - the jingle media session.
      • getMediaSession

        public JingleMediaSession getMediaSession​(java.lang.String mediaManagerName)
        The jingle session may have one or more media managers that are trying to establish media sessions. When the media manager succeeds in creating a media session is registers it with the session by the media manager's static name. This routine is where other objects can access the registered media sessions. NB: If the media manager has not succeeded in establishing a media session then this could return null.
        Parameters:
        mediaManagerName - the name of the media manager.
        Returns:
        the jingle media session.