org.mobicents.media.server.connection
Class BaseConnection

java.lang.Object
  extended by org.mobicents.media.server.connection.BaseConnection
All Implemented Interfaces:
Connection
Direct Known Subclasses:
LocalConnectionImpl, RtpConnectionImpl

public abstract class BaseConnection
extends Object
implements Connection

Implements connection's FSM.

Author:
kulikov

Field Summary
protected  Channel audioChannel
           
protected  Connections connections
           
protected  Channel videoChannel
           
 
Constructor Summary
BaseConnection(String id, Connections connections, Boolean isLocalToRemote)
          Creates basic connection implementation.
 
Method Summary
 void addListener(ConnectionListener listener)
          (Non Java-doc).
 void bind()
          Initiates transition from NULL to HALF_OPEN state.
 void close()
          Initiates transition from any state to state NULL.
 CheckPoint getCheckPoint(int i)
           
 CheckPoint getCheckPoint(MediaType mediaType, int i)
           
 String getDescriptor()
          (Non Java-doc).
 Endpoint getEndpoint()
          (Non Java-doc).
 String getId()
          (Non Java-doc).
 boolean getIsLocal()
          Gets whether connection should be bound to local or remote interface , supported only for rtp connections.
 ConnectionMode getMode(MediaType mediaType)
          (Non Java-doc).
 ConnectionState getState()
          (Non Java-doc).
 void join()
          Initiates transition from HALF_OPEN to OPEN state.
protected abstract  void onClosed()
          Called when connection is moving from OPEN state to NULL state.
protected abstract  void onCreated()
          Called when connection created.
protected abstract  void onFailed()
          Called if failure has bean detected during transition.
protected abstract  void onOpened()
          Called when connected moved to OPEN state.
 void removeListener(ConnectionListener listener)
          (Non Java-doc).
abstract  void setConnectionFailureListener(ConnectionFailureListener connectionFailureListener)
          Sets connection failure listener.
 void setDtmfClamp(boolean dtmfClamp)
          (Non Java-doc.)
 void setGain(double gain)
          (Non Java-doc.)
 void setIsLocal(boolean isLocal)
          Gets whether connection should be bound to local or remote interface , supported only for rtp connections.
 void setMode(ConnectionMode mode)
          (Non Java-doc).
 void setMode(ConnectionMode mode, MediaType mediaType)
          (Non Java-doc).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.mobicents.media.server.spi.Connection
getBytesReceived, getBytesReceived, getBytesTransmitted, getBytesTransmitted, getJitter, getJitter, getPacketsReceived, getPacketsTransmitted, setOtherParty, setOtherParty, setOtherParty
 

Field Detail

connections

protected final Connections connections

audioChannel

protected Channel audioChannel

videoChannel

protected Channel videoChannel
Constructor Detail

BaseConnection

public BaseConnection(String id,
                      Connections connections,
                      Boolean isLocalToRemote)
               throws Exception
Creates basic connection implementation.

Parameters:
id - the unique identifier of this connection within endpoint.
endpoint - the endpoint owner of this connection.
Throws:
Exception
Method Detail

getId

public String getId()
(Non Java-doc).

Specified by:
getId in interface Connection
See Also:
Connection.getId()

getState

public ConnectionState getState()
(Non Java-doc).

Specified by:
getState in interface Connection
See Also:
Connection.getState()

getDescriptor

public String getDescriptor()
(Non Java-doc).

Specified by:
getDescriptor in interface Connection
See Also:
Connection.getDescriptor()

getEndpoint

public Endpoint getEndpoint()
(Non Java-doc).

Specified by:
getEndpoint in interface Connection
See Also:
Connection.getEndpoint()

getMode

public ConnectionMode getMode(MediaType mediaType)
(Non Java-doc).

Specified by:
getMode in interface Connection
See Also:
Connection.getMode(org.mobicents.media.server.spi.MediaType)

setGain

public void setGain(double gain)
(Non Java-doc.)

Specified by:
setGain in interface Connection
See Also:
Connection.setGain(double)

setDtmfClamp

public void setDtmfClamp(boolean dtmfClamp)
(Non Java-doc.)

Specified by:
setDtmfClamp in interface Connection
See Also:
Connection.setDtmfClamp(boolean)

setMode

public void setMode(ConnectionMode mode,
                    MediaType mediaType)
             throws ModeNotSupportedException
(Non Java-doc).

Specified by:
setMode in interface Connection
Throws:
ModeNotSupportedException
See Also:
Connection.setMode(org.mobicents.media.server.spi.ConnectionMode, org.mobicents.media.server.spi.MediaType)

setMode

public void setMode(ConnectionMode mode)
             throws ModeNotSupportedException
(Non Java-doc).

Specified by:
setMode in interface Connection
Throws:
ModeNotSupportedException
See Also:
Connection.setMode(org.mobicents.media.server.spi.ConnectionMode)

getCheckPoint

public CheckPoint getCheckPoint(int i)

getCheckPoint

public CheckPoint getCheckPoint(MediaType mediaType,
                                int i)

addListener

public void addListener(ConnectionListener listener)
(Non Java-doc).

Specified by:
addListener in interface Connection
See Also:
Connection.addListener(org.mobicents.media.server.spi.ConnectionListener)

removeListener

public void removeListener(ConnectionListener listener)
(Non Java-doc).

Specified by:
removeListener in interface Connection
See Also:
Connection.removeListener(org.mobicents.media.server.spi.ConnectionListener)

bind

public void bind()
          throws Exception
Initiates transition from NULL to HALF_OPEN state.

Throws:
Exception

join

public void join()
          throws Exception
Initiates transition from HALF_OPEN to OPEN state.

Throws:
Exception

close

public void close()
Initiates transition from any state to state NULL.


setConnectionFailureListener

public abstract void setConnectionFailureListener(ConnectionFailureListener connectionFailureListener)
Sets connection failure listener.

Specified by:
setConnectionFailureListener in interface Connection

onCreated

protected abstract void onCreated()
                           throws Exception
Called when connection created.

Throws:
Exception

onOpened

protected abstract void onOpened()
                          throws Exception
Called when connected moved to OPEN state.

Throws:
Exception

onClosed

protected abstract void onClosed()
Called when connection is moving from OPEN state to NULL state.


onFailed

protected abstract void onFailed()
Called if failure has bean detected during transition.


getIsLocal

public boolean getIsLocal()
Gets whether connection should be bound to local or remote interface , supported only for rtp connections.

Specified by:
getIsLocal in interface Connection
Returns:
boolean value

setIsLocal

public void setIsLocal(boolean isLocal)
Gets whether connection should be bound to local or remote interface , supported only for rtp connections.

Specified by:
setIsLocal in interface Connection


Copyright © 2012 TeleStax, Inc.. All Rights Reserved.