org.jivesoftware.smackx.jingle.nat
Class TransportResolver

java.lang.Object
  extended by org.jivesoftware.smackx.jingle.nat.TransportResolver
Direct Known Subclasses:
BasicResolver, BridgedResolver, FixedResolver, ICEResolver, STUNResolver

public abstract class TransportResolver
extends java.lang.Object

A TransportResolver is used for obtaining a list of valid transport candidates. A transport candidate is composed by an IP address and a port number. It is called candidate, because it can be elected or not.

Author:
Thiago Camargo, Alvaro Saurin

Nested Class Summary
static class TransportResolver.Type
           
 
Field Summary
static int CHECK_TIMEOUT
           
 TransportResolver.Type type
           
 
Method Summary
 void addListener(TransportResolverListener li)
          Add a transport resolver listener.
abstract  void cancel()
          Cancel any asynchronous resolution operation.
 void clear()
          Clear the list of candidates and start a new resolution process.
 TransportCandidate getCandidate(int i)
          Get the n-th candidate
 int getCandidateCount()
          Get the numer of transport candidates.
 java.util.Iterator getCandidates()
          Get an iterator for the list of candidates
 java.util.List<TransportCandidate> getCandidatesList()
          Get the list of candidates
 java.util.ArrayList getListenersList()
          Get the list of listeners
 TransportCandidate getPreferredCandidate()
          Get the candididate with the highest preference.
 TransportResolver.Type getType()
           
abstract  void initialize()
          Initialize the Resolver
 void initializeAndWait()
          Initialize Transport Resolver and wait until it is complete unitialized.
 boolean isInitialized()
          Chack if the Transport Resolver is initialized
 boolean isResolved()
          Return true if the resolver has finished the search for transport candidates.
 boolean isResolving()
          Return true if the resolver is working.
 void removeListener(TransportResolverListener li)
          Removes a transport resolver listener.
abstract  void resolve(JingleSession session)
          Start a the resolution.
 void setInitialized()
          Set the Transport Resolver as initialized.
 void setType(TransportResolver.Type type)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

type

public TransportResolver.Type type

CHECK_TIMEOUT

public static final int CHECK_TIMEOUT
See Also:
Constant Field Values
Method Detail

getType

public TransportResolver.Type getType()

setType

public void setType(TransportResolver.Type type)

initialize

public abstract void initialize()
                         throws XMPPException
Initialize the Resolver

Throws:
XMPPException

resolve

public abstract void resolve(JingleSession session)
                      throws XMPPException
Start a the resolution.

Throws:
XMPPException

clear

public void clear()
           throws XMPPException
Clear the list of candidates and start a new resolution process.

Throws:
XMPPException

cancel

public abstract void cancel()
                     throws XMPPException
Cancel any asynchronous resolution operation.

Throws:
XMPPException

isResolving

public boolean isResolving()
Return true if the resolver is working.

Returns:
true if the resolver is working.

isResolved

public boolean isResolved()
Return true if the resolver has finished the search for transport candidates.

Returns:
true if the search has finished

setInitialized

public void setInitialized()
Set the Transport Resolver as initialized.


isInitialized

public boolean isInitialized()
Chack if the Transport Resolver is initialized

Returns:

addListener

public void addListener(TransportResolverListener li)
Add a transport resolver listener.

Parameters:
li - The transport resolver listener to be added.

removeListener

public void removeListener(TransportResolverListener li)
Removes a transport resolver listener.

Parameters:
li - The transport resolver listener to be removed

getListenersList

public java.util.ArrayList getListenersList()
Get the list of listeners

Returns:
the list of listeners

getCandidates

public java.util.Iterator getCandidates()
Get an iterator for the list of candidates

Returns:
an iterator

getPreferredCandidate

public TransportCandidate getPreferredCandidate()
Get the candididate with the highest preference.

Returns:
The best candidate, according to the preference order.

getCandidateCount

public int getCandidateCount()
Get the numer of transport candidates.

Returns:
The length of the transport candidates list.

getCandidatesList

public java.util.List<TransportCandidate> getCandidatesList()
Get the list of candidates

Returns:
the list of transport candidates

getCandidate

public TransportCandidate getCandidate(int i)
Get the n-th candidate

Returns:
a transport candidate

initializeAndWait

public void initializeAndWait()
                       throws XMPPException
Initialize Transport Resolver and wait until it is complete unitialized.

Throws:
XMPPException