org.jdiameter.common.impl.app.ro
Class RoSessionFactoryImpl

java.lang.Object
  extended by org.jdiameter.common.impl.app.ro.RoSessionFactoryImpl
All Implemented Interfaces:
StateChangeListener<AppSession>, ClientRoSessionListener, ServerRoSessionListener, IAppSessionFactory, IClientRoSessionContext, IRoMessageFactory, IRoSessionFactory, IServerRoSessionContext

public class RoSessionFactoryImpl
extends java.lang.Object
implements IRoSessionFactory, ClientRoSessionListener, ServerRoSessionListener, StateChangeListener<AppSession>, IRoMessageFactory, IServerRoSessionContext, IClientRoSessionContext

Default Diameter Ro Session Factory implementation

Author:
Alexandre Mendonca , Bartosz Baranowski

Field Summary
protected  IClientRoSessionContext clientContextListener
           
protected  ClientRoSessionListener clientSessionListener
           
protected  int defaultCreditControlFailureHandling
           
protected  int defaultDirectDebitingFailureHandling
           
protected  long defaultTxTimerValue
           
protected  long defaultValidityTime
           
protected  ISessionDatasource iss
           
protected  org.slf4j.Logger logger
           
protected  IRoMessageFactory messageFactory
           
protected  IServerRoSessionContext serverContextListener
           
protected  ServerRoSessionListener serverSessionListener
           
protected  IAppSessionDataFactory<IRoSessionData> sessionDataFactory
           
protected  ISessionFactory sessionFactory
           
protected  StateChangeListener<AppSession> stateListener
           
 
Constructor Summary
RoSessionFactoryImpl(SessionFactory sessionFactory)
           
RoSessionFactoryImpl(SessionFactory sessionFactory, int defaultDirectDebitingFailureHandling, int defaultCreditControlFailureHandling, long defaultValidityTime, long defaultTxTimerValue)
           
 
Method Summary
 RoCreditControlAnswer createCreditControlAnswer(Answer answer)
           
 RoCreditControlRequest createCreditControlRequest(Request req)
           
 ReAuthAnswer createReAuthAnswer(Answer answer)
           
 ReAuthRequest createReAuthRequest(Request req)
           
 void denyAccessOnDeliverFailure(ClientRoSession clientRoSessionImpl, Message request)
           
 void denyAccessOnFailureMessage(ClientRoSession clientRoSessionImpl)
           
 void denyAccessOnTxExpire(ClientRoSession clientRoSessionImpl)
           
 void doCreditControlAnswer(ClientRoSession session, RoCreditControlRequest request, RoCreditControlAnswer answer)
           
 void doCreditControlRequest(ServerRoSession session, RoCreditControlRequest request)
           
 void doOtherEvent(AppSession session, AppRequestEvent request, AppAnswerEvent answer)
           
 void doReAuthAnswer(ServerRoSession session, ReAuthRequest request, ReAuthAnswer answer)
           
 void doReAuthRequest(ClientRoSession session, ReAuthRequest request)
           
 long[] getApplicationIds()
           
 IClientRoSessionContext getClientContextListener()
           
 ClientRoSessionListener getClientSessionListener()
          Get stack wide listener for sessions.
 int getDefaultCCFHValue()
           
 int getDefaultDDFHValue()
           
 long getDefaultTxTimerValue()
           
 long getDefaultValidityTime()
          Returns seconds value representing default validity time, App session uses 2x for Tcc timer
 IRoMessageFactory getMessageFactory()
           
 AppSession getNewSession(java.lang.String sessionId, java.lang.Class<? extends AppSession> aClass, ApplicationId applicationId, java.lang.Object[] args)
           
 IServerRoSessionContext getServerContextListener()
           
 ServerRoSessionListener getServerSessionListener()
          Get stack wide listener for sessions.
 AppSession getSession(java.lang.String sessionId, java.lang.Class<? extends AppSession> aClass)
           
 SessionFactory getSessionFactory()
           
 StateChangeListener<AppSession> getStateListener()
           
 void grantAccessOnDeliverFailure(ClientRoSession clientRoSessionImpl, Message request)
           
 void grantAccessOnFailureMessage(ClientRoSession clientRoSessionImpl)
           
 void grantAccessOnTxExpire(ClientRoSession clientRoSessionImpl)
           
 void indicateServiceError(ClientRoSession clientRoSessionImpl)
           
 void sessionSupervisionTimerExpired(ServerRoSession session)
           
 void sessionSupervisionTimerReStarted(ServerRoSession session, java.util.concurrent.ScheduledFuture future)
           
 void sessionSupervisionTimerStarted(ServerRoSession session, java.util.concurrent.ScheduledFuture future)
          This is called always when Tcc starts
 void sessionSupervisionTimerStopped(ServerRoSession session, java.util.concurrent.ScheduledFuture future)
           
 void setClientContextListener(IClientRoSessionContext clientContextListener)
           
 void setClientSessionListener(ClientRoSessionListener clientSessionListener)
          Set stack wide listener for sessions.
 void setMessageFactory(IRoMessageFactory messageFactory)
           
 void setServerContextListener(IServerRoSessionContext serverContextListener)
           
 void setServerSessionListener(ServerRoSessionListener serverSessionListener)
          Set stack wide listener for sessions.
 void setSessionFactory(SessionFactory sessionFactory)
           
 void setStateListener(StateChangeListener<AppSession> stateListener)
           
 void stateChanged(AppSession source, java.lang.Enum oldState, java.lang.Enum newState)
           
 void stateChanged(java.lang.Enum oldState, java.lang.Enum newState)
           
 void timeoutExpired(Request request)
           
 void txTimerExpired(ClientRoSession session)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

defaultDirectDebitingFailureHandling

protected int defaultDirectDebitingFailureHandling

defaultCreditControlFailureHandling

protected int defaultCreditControlFailureHandling

defaultValidityTime

protected long defaultValidityTime

defaultTxTimerValue

protected long defaultTxTimerValue

clientSessionListener

protected ClientRoSessionListener clientSessionListener

serverSessionListener

protected ServerRoSessionListener serverSessionListener

stateListener

protected StateChangeListener<AppSession> stateListener

serverContextListener

protected IServerRoSessionContext serverContextListener

clientContextListener

protected IClientRoSessionContext clientContextListener

messageFactory

protected IRoMessageFactory messageFactory

logger

protected org.slf4j.Logger logger

iss

protected ISessionDatasource iss

sessionDataFactory

protected IAppSessionDataFactory<IRoSessionData> sessionDataFactory

sessionFactory

protected ISessionFactory sessionFactory
Constructor Detail

RoSessionFactoryImpl

public RoSessionFactoryImpl(SessionFactory sessionFactory)

RoSessionFactoryImpl

public RoSessionFactoryImpl(SessionFactory sessionFactory,
                            int defaultDirectDebitingFailureHandling,
                            int defaultCreditControlFailureHandling,
                            long defaultValidityTime,
                            long defaultTxTimerValue)
Method Detail

getClientSessionListener

public ClientRoSessionListener getClientSessionListener()
Description copied from interface: IRoSessionFactory
Get stack wide listener for sessions. In local mode it has similar effect as setting this directly in app session. However clustered session use this value when recreated!

Specified by:
getClientSessionListener in interface IRoSessionFactory
Returns:
the clientSessionListener

setClientSessionListener

public void setClientSessionListener(ClientRoSessionListener clientSessionListener)
Description copied from interface: IRoSessionFactory
Set stack wide listener for sessions. In local mode it has similar effect as setting this directly in app session. However clustered session use this value when recreated!

Specified by:
setClientSessionListener in interface IRoSessionFactory
Parameters:
clientSessionListener - the clientSessionListener to set

getServerSessionListener

public ServerRoSessionListener getServerSessionListener()
Description copied from interface: IRoSessionFactory
Get stack wide listener for sessions. In local mode it has similar effect as setting this directly in app session. However clustered session use this value when recreated!

Specified by:
getServerSessionListener in interface IRoSessionFactory
Returns:
the serverSessionListener

setServerSessionListener

public void setServerSessionListener(ServerRoSessionListener serverSessionListener)
Description copied from interface: IRoSessionFactory
Set stack wide listener for sessions. In local mode it has similar effect as setting this directly in app session. However clustered session use this value when recreated!

Specified by:
setServerSessionListener in interface IRoSessionFactory
Parameters:
serverSessionListener - the serverSessionListener to set

getServerContextListener

public IServerRoSessionContext getServerContextListener()
Specified by:
getServerContextListener in interface IRoSessionFactory
Returns:
the serverContextListener

setServerContextListener

public void setServerContextListener(IServerRoSessionContext serverContextListener)
Specified by:
setServerContextListener in interface IRoSessionFactory
Parameters:
serverContextListener - the serverContextListener to set

getClientContextListener

public IClientRoSessionContext getClientContextListener()
Specified by:
getClientContextListener in interface IRoSessionFactory
Returns:
the clientContextListener

getMessageFactory

public IRoMessageFactory getMessageFactory()
Specified by:
getMessageFactory in interface IRoSessionFactory
Returns:
the messageFactory

setMessageFactory

public void setMessageFactory(IRoMessageFactory messageFactory)
Specified by:
setMessageFactory in interface IRoSessionFactory
Parameters:
messageFactory - the messageFactory to set

setClientContextListener

public void setClientContextListener(IClientRoSessionContext clientContextListener)
Specified by:
setClientContextListener in interface IRoSessionFactory
Parameters:
clientContextListener - the clientContextListener to set

getSessionFactory

public SessionFactory getSessionFactory()
Returns:
the sessionFactory

setSessionFactory

public void setSessionFactory(SessionFactory sessionFactory)
Parameters:
sessionFactory - the sessionFactory to set

getStateListener

public StateChangeListener<AppSession> getStateListener()
Specified by:
getStateListener in interface IRoSessionFactory
Returns:
the stateListener

setStateListener

public void setStateListener(StateChangeListener<AppSession> stateListener)
Specified by:
setStateListener in interface IRoSessionFactory
Parameters:
stateListener - the stateListener to set

getNewSession

public AppSession getNewSession(java.lang.String sessionId,
                                java.lang.Class<? extends AppSession> aClass,
                                ApplicationId applicationId,
                                java.lang.Object[] args)
Specified by:
getNewSession in interface IAppSessionFactory

getSession

public AppSession getSession(java.lang.String sessionId,
                             java.lang.Class<? extends AppSession> aClass)
Specified by:
getSession in interface IAppSessionFactory

doCreditControlRequest

public void doCreditControlRequest(ServerRoSession session,
                                   RoCreditControlRequest request)
                            throws InternalException
Specified by:
doCreditControlRequest in interface ServerRoSessionListener
Throws:
InternalException

doCreditControlAnswer

public void doCreditControlAnswer(ClientRoSession session,
                                  RoCreditControlRequest request,
                                  RoCreditControlAnswer answer)
                           throws InternalException
Specified by:
doCreditControlAnswer in interface ClientRoSessionListener
Throws:
InternalException

doReAuthRequest

public void doReAuthRequest(ClientRoSession session,
                            ReAuthRequest request)
                     throws InternalException
Specified by:
doReAuthRequest in interface ClientRoSessionListener
Throws:
InternalException

doReAuthAnswer

public void doReAuthAnswer(ServerRoSession session,
                           ReAuthRequest request,
                           ReAuthAnswer answer)
                    throws InternalException
Specified by:
doReAuthAnswer in interface ServerRoSessionListener
Throws:
InternalException

doOtherEvent

public void doOtherEvent(AppSession session,
                         AppRequestEvent request,
                         AppAnswerEvent answer)
                  throws InternalException
Specified by:
doOtherEvent in interface ClientRoSessionListener
Specified by:
doOtherEvent in interface ServerRoSessionListener
Throws:
InternalException

createCreditControlAnswer

public RoCreditControlAnswer createCreditControlAnswer(Answer answer)
Specified by:
createCreditControlAnswer in interface IRoMessageFactory

createCreditControlRequest

public RoCreditControlRequest createCreditControlRequest(Request req)
Specified by:
createCreditControlRequest in interface IRoMessageFactory

createReAuthAnswer

public ReAuthAnswer createReAuthAnswer(Answer answer)
Specified by:
createReAuthAnswer in interface IRoMessageFactory

createReAuthRequest

public ReAuthRequest createReAuthRequest(Request req)
Specified by:
createReAuthRequest in interface IRoMessageFactory

stateChanged

public void stateChanged(java.lang.Enum oldState,
                         java.lang.Enum newState)
Specified by:
stateChanged in interface StateChangeListener<AppSession>

stateChanged

public void stateChanged(AppSession source,
                         java.lang.Enum oldState,
                         java.lang.Enum newState)
Specified by:
stateChanged in interface StateChangeListener<AppSession>

sessionSupervisionTimerExpired

public void sessionSupervisionTimerExpired(ServerRoSession session)
Specified by:
sessionSupervisionTimerExpired in interface IServerRoSessionContext

sessionSupervisionTimerReStarted

public void sessionSupervisionTimerReStarted(ServerRoSession session,
                                             java.util.concurrent.ScheduledFuture future)
Specified by:
sessionSupervisionTimerReStarted in interface IServerRoSessionContext

sessionSupervisionTimerStarted

public void sessionSupervisionTimerStarted(ServerRoSession session,
                                           java.util.concurrent.ScheduledFuture future)
Description copied from interface: IServerRoSessionContext
This is called always when Tcc starts

Specified by:
sessionSupervisionTimerStarted in interface IServerRoSessionContext

sessionSupervisionTimerStopped

public void sessionSupervisionTimerStopped(ServerRoSession session,
                                           java.util.concurrent.ScheduledFuture future)
Specified by:
sessionSupervisionTimerStopped in interface IServerRoSessionContext

timeoutExpired

public void timeoutExpired(Request request)
Specified by:
timeoutExpired in interface IServerRoSessionContext

denyAccessOnDeliverFailure

public void denyAccessOnDeliverFailure(ClientRoSession clientRoSessionImpl,
                                       Message request)
Specified by:
denyAccessOnDeliverFailure in interface IClientRoSessionContext

denyAccessOnFailureMessage

public void denyAccessOnFailureMessage(ClientRoSession clientRoSessionImpl)
Specified by:
denyAccessOnFailureMessage in interface IClientRoSessionContext

denyAccessOnTxExpire

public void denyAccessOnTxExpire(ClientRoSession clientRoSessionImpl)
Specified by:
denyAccessOnTxExpire in interface IClientRoSessionContext

getDefaultCCFHValue

public int getDefaultCCFHValue()
Specified by:
getDefaultCCFHValue in interface ClientRoSessionListener
Specified by:
getDefaultCCFHValue in interface IClientRoSessionContext

getDefaultDDFHValue

public int getDefaultDDFHValue()
Specified by:
getDefaultDDFHValue in interface ClientRoSessionListener
Specified by:
getDefaultDDFHValue in interface IClientRoSessionContext

getDefaultTxTimerValue

public long getDefaultTxTimerValue()
Specified by:
getDefaultTxTimerValue in interface IClientRoSessionContext

grantAccessOnDeliverFailure

public void grantAccessOnDeliverFailure(ClientRoSession clientRoSessionImpl,
                                        Message request)
Specified by:
grantAccessOnDeliverFailure in interface IClientRoSessionContext

grantAccessOnFailureMessage

public void grantAccessOnFailureMessage(ClientRoSession clientRoSessionImpl)
Specified by:
grantAccessOnFailureMessage in interface IClientRoSessionContext

grantAccessOnTxExpire

public void grantAccessOnTxExpire(ClientRoSession clientRoSessionImpl)
Specified by:
grantAccessOnTxExpire in interface IClientRoSessionContext

indicateServiceError

public void indicateServiceError(ClientRoSession clientRoSessionImpl)
Specified by:
indicateServiceError in interface IClientRoSessionContext

txTimerExpired

public void txTimerExpired(ClientRoSession session)
Specified by:
txTimerExpired in interface IClientRoSessionContext

getApplicationIds

public long[] getApplicationIds()
Specified by:
getApplicationIds in interface IRoMessageFactory

getDefaultValidityTime

public long getDefaultValidityTime()
Description copied from interface: IServerRoSessionContext
Returns seconds value representing default validity time, App session uses 2x for Tcc timer

Specified by:
getDefaultValidityTime in interface IServerRoSessionContext
Returns:


Copyright © 2014. All Rights Reserved.