@ -15,7 +15,7 @@
/ * *
* Keeps a list of all calls currently active and maintained by this protocol
* provider . Offers methods for finding a call by its ID , p articipant session
* provider . Offers methods for finding a call by its ID , p eer session
* and others .
*
* @author Emil Ivov
@ -39,11 +39,12 @@ public class ActiveCallsRepository
/ * *
* A table mapping call ids against call instances .
* /
private Hashtable activeCalls = new Hashtable ( ) ;
private Hashtable < String , CallJabberImpl > activeCalls
= new Hashtable < String , CallJabberImpl > ( ) ;
/ * *
* It ' s where we store all active calls
* @param opSet the < tt > OperationSetBasicTelphony < / tt > instance which has
* @param opSet the < tt > OperationSetBasicTelphony < / tt > instance which has
* been used to create calls in this repository
* /
public ActiveCallsRepository ( OperationSetBasicTelephonyJabberImpl opSet )
@ -88,14 +89,14 @@ public void callStateChanged(CallChangeEvent evt)
*
* @return an iterator over all currently active ( non - ended ) calls .
* /
public Iterator getActiveCalls ( )
public Iterator < CallJabberImpl > getActiveCalls ( )
{
return new LinkedList (activeCalls . values ( ) ) . iterator ( ) ;
return new LinkedList <CallJabberImpl > (activeCalls . values ( ) ) . iterator ( ) ;
}
/ * *
* Returns the call that contains the specified session ( i . e . it is
* established between us and one of the other call p articipant s) .
* established between us and one of the other call p eer s) .
* < p >
* @param session the < tt > jingleSession < / tt > whose containing call we ' re
* looking for .
@ -104,25 +105,25 @@ public Iterator getActiveCalls()
* /
public CallJabberImpl findCall ( JingleSession session )
{
Iterator activeCalls = getActiveCalls ( ) ;
Iterator < CallJabberImpl > activeCalls = getActiveCalls ( ) ;
if ( session = = null )
{
logger . debug ( "Cannot find a p articipant with a null session. "
logger . debug ( "Cannot find a p eer with a null session. "
+ "Returning null" ) ;
return null ;
}
if ( logger . isTraceEnabled ( ) )
{
logger . trace ( "Looking for p articipant with session: " + session
logger . trace ( "Looking for p eer with session: " + session
+ " among " + this . activeCalls . size ( ) + " calls" ) ;
}
while ( activeCalls . hasNext ( ) )
{
CallJabberImpl call = ( CallJabberImpl ) activeCalls . next ( ) ;
CallJabberImpl call = activeCalls . next ( ) ;
if ( call . contains ( session ) )
return call ;
}
@ -131,43 +132,43 @@ public CallJabberImpl findCall(JingleSession session)
}
/ * *
* Returns the call p articipant whose associated jingle session matches
* Returns the call p eer whose associated jingle session matches
* < tt > session < / tt > .
*
* @param session the jingle session whose corresponding p articipant we ' re
* @param session the jingle session whose corresponding p eer we ' re
* looking for .
* @return the call p articipant whose jingle session is the same as the
* specified or null if no such call p articipant was found .
* @return the call p eer whose jingle session is the same as the
* specified or null if no such call p eer was found .
* /
public CallPeerJabberImpl findCallPeer ( JingleSession session )
{
Iterator activeCalls = getActiveCalls ( ) ;
Iterator < CallJabberImpl > activeCalls = getActiveCalls ( ) ;
if ( session = = null )
{
logger . debug ( "Cannot find a p articipant with a null session. "
logger . debug ( "Cannot find a p eer with a null session. "
+ "Returning null" ) ;
return null ;
}
if ( logger . isTraceEnabled ( ) )
{
logger . trace ( "Looking for p articipant with session: " + session
logger . trace ( "Looking for p eer with session: " + session
+ " among " + this . activeCalls . size ( ) + " calls" ) ;
}
while ( activeCalls . hasNext ( ) )
{
CallJabberImpl call = ( CallJabberImpl ) activeCalls . next ( ) ;
CallPeerJabberImpl callP articipant
= call . findCallPeer ( session ) ;
if ( callP articipant ! = null )
CallJabberImpl call = activeCalls . next ( ) ;
CallPeerJabberImpl callP eer = call . findCallPeer ( session ) ;
if ( callP eer ! = null )
{
logger . trace ( "Returning p articipant " + callParticipant ) ;
return callP articipant ;
logger . trace ( "Returning p eer " + callPeer ) ;
return callP eer ;
}
}
return null ;
}
}
}