Class JingleNegotiator

  • Direct Known Subclasses:
    ContentNegotiator, JingleSession, MediaNegotiator, TransportNegotiator

    public abstract class JingleNegotiator
    extends java.lang.Object
    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...

    • Constructor Detail

      • JingleNegotiator

        public JingleNegotiator()
        Default constructor.
      • JingleNegotiator

        public JingleNegotiator​(JingleSession session)
        Default constructor with a Connection.
        Parameters:
        session - the jingle session
    • Method Detail

      • getConnection

        public org.jivesoftware.smack.XMPPConnection getConnection()
      • getSession

        public JingleSession getSession()
        Get the XMPP connection associated with this negotiation.
        Returns:
        the connection
      • setSession

        public void setSession​(JingleSession session)
        Set the XMPP connection associated.
        Parameters:
        session - the jingle session
      • addExpectedId

        public void addExpectedId​(java.lang.String id)
        Add expected ID.
        Parameters:
        id - TODO javadoc me please
      • isExpectedId

        public boolean isExpectedId​(java.lang.String id)
        Check if the passed ID is the expected ID.
        Parameters:
        id - TODO javadoc me please
        Returns:
        true if is expected id
      • removeExpectedId

        public void removeExpectedId​(java.lang.String id)
        Remove and expected ID.
        Parameters:
        id - TODO javadoc me please
      • addListener

        public void addListener​(JingleListener li)
        Add a Jingle session listener to listen to incoming session requests.
        Parameters:
        li - The listener
        See Also:
        JingleListener
      • removeListener

        public void removeListener​(JingleListener li)
        Removes a Jingle session listener.
        Parameters:
        li - The jingle session listener to be removed
        See Also:
        JingleListener
      • getListenersList

        protected java.util.List<JingleListener> getListenersList()
        Get a copy of the listeners
        Returns:
        a copy of the listeners
      • dispatchIncomingPacket

        public abstract java.util.List<org.jivesoftware.smack.packet.IQ> dispatchIncomingPacket​(org.jivesoftware.smack.packet.IQ iq,
                                                                                                java.lang.String id)
                                                                                         throws org.jivesoftware.smack.XMPPException,
                                                                                                org.jivesoftware.smack.SmackException,
                                                                                                java.lang.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 arbitraty 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 received
        id - the ID of the response that will be sent
        Returns:
        the new stanza to send (either a Jingle or an IQ error).
        Throws:
        org.jivesoftware.smack.XMPPException - if an XMPP protocol error was received.
        org.jivesoftware.smack.SmackException - if Smack detected an exceptional situation.
        java.lang.InterruptedException - if the calling thread was interrupted.
      • start

        public void start()
      • isStarted

        public boolean isStarted()
      • doStart

        protected abstract void doStart()
        Each of the negotiators has their individual behavior when they start.
      • close

        public void close()
        Close the negotiation.