org.mobicents.servlet.sip.message
Class MobicentsSipSessionFacade

java.lang.Object
  extended by org.mobicents.servlet.sip.message.MobicentsSipSessionFacade
All Implemented Interfaces:
java.io.Serializable, SipSession, MobicentsSipSession

public class MobicentsSipSessionFacade
extends java.lang.Object
implements MobicentsSipSession, java.io.Serializable

The purpose of this class is to be a facade to the real sip session as well as a serializable session class that can be put as a session attribute in other sessions or even its own session. Basically instead of replicating the whole attribute map, we will replicate the id, then on the remote side we will read the ID and look it up in the remote session manager.

Author:
vralev, jean.deruelle@gmail.com
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from interface javax.servlet.sip.SipSession
SipSession.State
 
Constructor Summary
MobicentsSipSessionFacade(MobicentsSipSession sipSession)
           
 
Method Summary
 void access()
           
 void addDerivedSipSessions(MobicentsSipSession derivedSession)
          Add the derived sip session it will be identified by the To tag from its key
 void addOngoingTransaction(javax.sip.Transaction transaction)
           
 void addSubscription(SipServletMessageImpl sipServletMessage)
           
 SipServletRequest createRequest(java.lang.String arg0)
           
 boolean equals(java.lang.Object obj)
           
 MobicentsSipSession findDerivedSipSession(java.lang.String toTag)
          Find the derived sip session identified by its to tag
 SipApplicationSession getApplicationSession()
           
 java.lang.Object getAttribute(java.lang.String arg0)
           
 java.util.Enumeration<java.lang.String> getAttributeNames()
           
 B2buaHelperImpl getB2buaHelper()
           
 java.lang.String getCallId()
           
 long getCreationTime()
           
 long getCseq()
           
 java.util.Iterator<MobicentsSipSession> getDerivedSipSessions()
           
 java.lang.String getHandler()
           
 java.lang.String getId()
           
 boolean getInvalidateWhenReady()
           
 SipSessionKey getKey()
          get the internal Mobicents Sip Session Key
 long getLastAccessedTime()
           
 Address getLocalParty()
           
 MobicentsSipSession getMobicentsSipSession()
           
 SipApplicationRouterInfo getNextSipApplicationRouterInfo()
           
 java.util.Set<javax.sip.Transaction> getOngoingTransactions()
           
 java.lang.String getOutboundInterface()
           
 ProxyImpl getProxy()
          Retieves the proxy of the sip session if any
 SipApplicationRoutingRegion getRegion()
           
 SipApplicationRoutingRegion getRegionInternal()
           
 Address getRemoteParty()
           
 java.util.concurrent.Semaphore getSemaphore()
           
 javax.servlet.ServletContext getServletContext()
           
 MobicentsSipSessionFacade getSession()
           
 javax.sip.Dialog getSessionCreatingDialog()
           
 SipServletMessageImpl getSessionCreatingTransactionRequest()
           
 MobicentsSipApplicationSession getSipApplicationSession()
           
 java.util.Map<java.lang.String,java.lang.Object> getSipSessionAttributeMap()
           
 java.lang.String getSipSubscriberURI()
           
 SipSession.State getState()
           
 java.io.Serializable getStateInfo()
           
 URI getSubscriberURI()
           
 java.lang.String getTransport()
           
 java.security.Principal getUserPrincipal()
           
 int hashCode()
           
 void invalidate()
           
 boolean isAckReceived()
           
 boolean isReadyToInvalidate()
           
 boolean isValid()
           
 boolean isValidInternal()
           
 void onReadyToInvalidate()
           
 void onTerminatedState()
           
 void removeAttribute(java.lang.String arg0)
           
 MobicentsSipSession removeDerivedSipSession(java.lang.String toTag)
          Removes the derived sip session identified by the To tag in parameter
 void removeOngoingTransaction(javax.sip.Transaction transaction)
           
 void removeSubscription(SipServletMessageImpl sipServletMessage)
           
 void setAckReceived(boolean ackReceived)
           
 void setAttribute(java.lang.String arg0, java.lang.Object arg1)
           
 void setB2buaHelper(B2buaHelperImpl helperImpl)
           
 void setCseq(long cseq)
           
 void setHandler(java.lang.String arg0)
           
 void setInvalidateWhenReady(boolean arg0)
           
 void setLocalParty(Address addressImpl)
           
 void setNextSipApplicationRouterInfo(SipApplicationRouterInfo routerInfo)
           
 void setOutboundInterface(java.net.InetAddress arg0)
           
 void setOutboundInterface(java.net.InetSocketAddress arg0)
           
 void setParentSession(MobicentsSipSession mobicentsSipSession)
           
 void setProxy(ProxyImpl proxy)
           
 void setRemoteParty(Address addressImpl)
           
 void setRoutingRegion(SipApplicationRoutingRegion routingRegion)
           
 void setSessionCreatingDialog(javax.sip.Dialog dialog)
           
 void setSessionCreatingTransactionRequest(SipServletMessageImpl message)
           
 void setSipSessionAttributeMap(java.util.Map<java.lang.String,java.lang.Object> sipSessionAttributeMap)
           
 void setSipSubscriberURI(java.lang.String subscriberURI)
           
 void setState(SipSession.State state)
           
 void setStateInfo(java.io.Serializable stateInfo)
           
 void setTransport(java.lang.String transport)
           
 void setUserPrincipal(java.security.Principal principal)
           
 java.lang.String toString()
           
 void updateStateOnResponse(SipServletResponseImpl sipServletResponseImpl, boolean receive)
           
 void updateStateOnSubsequentRequest(SipServletRequestImpl sipServletRequestImpl, boolean receive)
           
 boolean validateCSeq(SipServletRequestImpl request)
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

MobicentsSipSessionFacade

public MobicentsSipSessionFacade(MobicentsSipSession sipSession)
Method Detail

createRequest

public SipServletRequest createRequest(java.lang.String arg0)
Specified by:
createRequest in interface SipSession

getApplicationSession

public SipApplicationSession getApplicationSession()
Specified by:
getApplicationSession in interface SipSession

getAttribute

public java.lang.Object getAttribute(java.lang.String arg0)
Specified by:
getAttribute in interface SipSession

getAttributeNames

public java.util.Enumeration<java.lang.String> getAttributeNames()
Specified by:
getAttributeNames in interface SipSession

getCallId

public java.lang.String getCallId()
Specified by:
getCallId in interface SipSession

getCreationTime

public long getCreationTime()
Specified by:
getCreationTime in interface SipSession

getId

public java.lang.String getId()
Specified by:
getId in interface SipSession

getInvalidateWhenReady

public boolean getInvalidateWhenReady()
Specified by:
getInvalidateWhenReady in interface SipSession

getLastAccessedTime

public long getLastAccessedTime()
Specified by:
getLastAccessedTime in interface SipSession

getLocalParty

public Address getLocalParty()
Specified by:
getLocalParty in interface SipSession

getRegion

public SipApplicationRoutingRegion getRegion()
Specified by:
getRegion in interface SipSession

getRemoteParty

public Address getRemoteParty()
Specified by:
getRemoteParty in interface SipSession

getServletContext

public javax.servlet.ServletContext getServletContext()
Specified by:
getServletContext in interface SipSession

getState

public SipSession.State getState()
Specified by:
getState in interface SipSession

getSubscriberURI

public URI getSubscriberURI()
Specified by:
getSubscriberURI in interface SipSession

invalidate

public void invalidate()
Specified by:
invalidate in interface SipSession

isReadyToInvalidate

public boolean isReadyToInvalidate()
Specified by:
isReadyToInvalidate in interface SipSession

isValid

public boolean isValid()
Specified by:
isValid in interface SipSession

isValidInternal

public boolean isValidInternal()
Specified by:
isValidInternal in interface MobicentsSipSession

removeAttribute

public void removeAttribute(java.lang.String arg0)
Specified by:
removeAttribute in interface SipSession

setAttribute

public void setAttribute(java.lang.String arg0,
                         java.lang.Object arg1)
Specified by:
setAttribute in interface SipSession

setHandler

public void setHandler(java.lang.String arg0)
                throws javax.servlet.ServletException
Specified by:
setHandler in interface SipSession
Throws:
javax.servlet.ServletException

setInvalidateWhenReady

public void setInvalidateWhenReady(boolean arg0)
Specified by:
setInvalidateWhenReady in interface SipSession

setOutboundInterface

public void setOutboundInterface(java.net.InetAddress arg0)
Specified by:
setOutboundInterface in interface SipSession

setOutboundInterface

public void setOutboundInterface(java.net.InetSocketAddress arg0)
Specified by:
setOutboundInterface in interface SipSession

access

public void access()
Specified by:
access in interface MobicentsSipSession

addDerivedSipSessions

public void addDerivedSipSessions(MobicentsSipSession derivedSession)
Description copied from interface: MobicentsSipSession
Add the derived sip session it will be identified by the To tag from its key

Specified by:
addDerivedSipSessions in interface MobicentsSipSession
Parameters:
derivedSession - the derived session to add

addOngoingTransaction

public void addOngoingTransaction(javax.sip.Transaction transaction)
Specified by:
addOngoingTransaction in interface MobicentsSipSession

addSubscription

public void addSubscription(SipServletMessageImpl sipServletMessage)
                     throws javax.sip.SipException
Specified by:
addSubscription in interface MobicentsSipSession
Throws:
javax.sip.SipException

findDerivedSipSession

public MobicentsSipSession findDerivedSipSession(java.lang.String toTag)
Description copied from interface: MobicentsSipSession
Find the derived sip session identified by its to tag

Specified by:
findDerivedSipSession in interface MobicentsSipSession
Parameters:
toTag - the to Tag identifying the sip session to remove
Returns:
the derived sip session identified by its to tag or null if none has been found

getB2buaHelper

public B2buaHelperImpl getB2buaHelper()
Specified by:
getB2buaHelper in interface MobicentsSipSession

getDerivedSipSessions

public java.util.Iterator<MobicentsSipSession> getDerivedSipSessions()
Specified by:
getDerivedSipSessions in interface MobicentsSipSession

getHandler

public java.lang.String getHandler()
Specified by:
getHandler in interface MobicentsSipSession

getKey

public SipSessionKey getKey()
Description copied from interface: MobicentsSipSession
get the internal Mobicents Sip Session Key

Specified by:
getKey in interface MobicentsSipSession
Returns:
the internal Mobicents Sip Session Key

getOngoingTransactions

public java.util.Set<javax.sip.Transaction> getOngoingTransactions()
Specified by:
getOngoingTransactions in interface MobicentsSipSession

getOutboundInterface

public java.lang.String getOutboundInterface()
Specified by:
getOutboundInterface in interface MobicentsSipSession

getProxy

public ProxyImpl getProxy()
Description copied from interface: MobicentsSipSession
Retieves the proxy of the sip session if any

Specified by:
getProxy in interface MobicentsSipSession
Returns:

getRegionInternal

public SipApplicationRoutingRegion getRegionInternal()
Specified by:
getRegionInternal in interface MobicentsSipSession

getSemaphore

public java.util.concurrent.Semaphore getSemaphore()
Specified by:
getSemaphore in interface MobicentsSipSession

getSessionCreatingDialog

public javax.sip.Dialog getSessionCreatingDialog()
Specified by:
getSessionCreatingDialog in interface MobicentsSipSession

getSessionCreatingTransactionRequest

public SipServletMessageImpl getSessionCreatingTransactionRequest()
Specified by:
getSessionCreatingTransactionRequest in interface MobicentsSipSession

getSipApplicationSession

public MobicentsSipApplicationSession getSipApplicationSession()
Specified by:
getSipApplicationSession in interface MobicentsSipSession

getSipSessionAttributeMap

public java.util.Map<java.lang.String,java.lang.Object> getSipSessionAttributeMap()
Specified by:
getSipSessionAttributeMap in interface MobicentsSipSession

getSipSubscriberURI

public java.lang.String getSipSubscriberURI()
Specified by:
getSipSubscriberURI in interface MobicentsSipSession

getStateInfo

public java.io.Serializable getStateInfo()
Specified by:
getStateInfo in interface MobicentsSipSession

getUserPrincipal

public java.security.Principal getUserPrincipal()
Specified by:
getUserPrincipal in interface MobicentsSipSession

onReadyToInvalidate

public void onReadyToInvalidate()
Specified by:
onReadyToInvalidate in interface MobicentsSipSession

onTerminatedState

public void onTerminatedState()
Specified by:
onTerminatedState in interface MobicentsSipSession

removeDerivedSipSession

public MobicentsSipSession removeDerivedSipSession(java.lang.String toTag)
Description copied from interface: MobicentsSipSession
Removes the derived sip session identified by the To tag in parameter

Specified by:
removeDerivedSipSession in interface MobicentsSipSession
Parameters:
toTag - the to Tag identifying the sip session to remove
Returns:
the removed derived sip session

removeOngoingTransaction

public void removeOngoingTransaction(javax.sip.Transaction transaction)
Specified by:
removeOngoingTransaction in interface MobicentsSipSession

removeSubscription

public void removeSubscription(SipServletMessageImpl sipServletMessage)
Specified by:
removeSubscription in interface MobicentsSipSession

setB2buaHelper

public void setB2buaHelper(B2buaHelperImpl helperImpl)
Specified by:
setB2buaHelper in interface MobicentsSipSession

setLocalParty

public void setLocalParty(Address addressImpl)
Specified by:
setLocalParty in interface MobicentsSipSession

setParentSession

public void setParentSession(MobicentsSipSession mobicentsSipSession)
Specified by:
setParentSession in interface MobicentsSipSession

setProxy

public void setProxy(ProxyImpl proxy)
Specified by:
setProxy in interface MobicentsSipSession

setRemoteParty

public void setRemoteParty(Address addressImpl)
Specified by:
setRemoteParty in interface MobicentsSipSession

setRoutingRegion

public void setRoutingRegion(SipApplicationRoutingRegion routingRegion)
Specified by:
setRoutingRegion in interface MobicentsSipSession

setSessionCreatingDialog

public void setSessionCreatingDialog(javax.sip.Dialog dialog)
Specified by:
setSessionCreatingDialog in interface MobicentsSipSession

setSessionCreatingTransactionRequest

public void setSessionCreatingTransactionRequest(SipServletMessageImpl message)
Specified by:
setSessionCreatingTransactionRequest in interface MobicentsSipSession

setSipSessionAttributeMap

public void setSipSessionAttributeMap(java.util.Map<java.lang.String,java.lang.Object> sipSessionAttributeMap)
Specified by:
setSipSessionAttributeMap in interface MobicentsSipSession

setSipSubscriberURI

public void setSipSubscriberURI(java.lang.String subscriberURI)
Specified by:
setSipSubscriberURI in interface MobicentsSipSession

setState

public void setState(SipSession.State state)
Specified by:
setState in interface MobicentsSipSession

setStateInfo

public void setStateInfo(java.io.Serializable stateInfo)
Specified by:
setStateInfo in interface MobicentsSipSession

setUserPrincipal

public void setUserPrincipal(java.security.Principal principal)
Specified by:
setUserPrincipal in interface MobicentsSipSession

updateStateOnResponse

public void updateStateOnResponse(SipServletResponseImpl sipServletResponseImpl,
                                  boolean receive)
Specified by:
updateStateOnResponse in interface MobicentsSipSession

updateStateOnSubsequentRequest

public void updateStateOnSubsequentRequest(SipServletRequestImpl sipServletRequestImpl,
                                           boolean receive)
Specified by:
updateStateOnSubsequentRequest in interface MobicentsSipSession

getSession

public MobicentsSipSessionFacade getSession()
Specified by:
getSession in interface MobicentsSipSession

equals

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

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

getNextSipApplicationRouterInfo

public SipApplicationRouterInfo getNextSipApplicationRouterInfo()
Specified by:
getNextSipApplicationRouterInfo in interface MobicentsSipSession

setNextSipApplicationRouterInfo

public void setNextSipApplicationRouterInfo(SipApplicationRouterInfo routerInfo)
Specified by:
setNextSipApplicationRouterInfo in interface MobicentsSipSession

setAckReceived

public void setAckReceived(boolean ackReceived)
Specified by:
setAckReceived in interface MobicentsSipSession

isAckReceived

public boolean isAckReceived()
Specified by:
isAckReceived in interface MobicentsSipSession

setCseq

public void setCseq(long cseq)
Specified by:
setCseq in interface MobicentsSipSession

getCseq

public long getCseq()
Specified by:
getCseq in interface MobicentsSipSession

validateCSeq

public boolean validateCSeq(SipServletRequestImpl request)
Specified by:
validateCSeq in interface MobicentsSipSession

getMobicentsSipSession

public MobicentsSipSession getMobicentsSipSession()

getTransport

public java.lang.String getTransport()
Specified by:
getTransport in interface MobicentsSipSession

setTransport

public void setTransport(java.lang.String transport)
Specified by:
setTransport in interface MobicentsSipSession


Copyright © 2010. All Rights Reserved.