org.jdiameter.common.impl.app.cca
Class CCASessionFactoryImpl

java.lang.Object
  extended by org.jdiameter.common.impl.app.cca.CCASessionFactoryImpl
All Implemented Interfaces:
StateChangeListener<AppSession>, ClientCCASessionListener, ServerCCASessionListener, ICCAMessageFactory, ICCASessionFactory, IClientCCASessionContext, IServerCCASessionContext, IAppSessionFactory

public class CCASessionFactoryImpl
extends java.lang.Object
implements ICCASessionFactory, ClientCCASessionListener, ServerCCASessionListener, StateChangeListener<AppSession>, ICCAMessageFactory, IServerCCASessionContext, IClientCCASessionContext

Author:
Alexandre Mendonca , Bartosz Baranowski

Field Summary
protected  IClientCCASessionContext clientContextListener
           
protected  ClientCCASessionListener clientSessionListener
           
protected  int defaultCreditControlFailureHandling
           
protected  int defaultDirectDebitingFailureHandling
           
protected  long defaultTxTimerValue
           
protected  long defaultValidityTime
           
protected  ISessionDatasource iss
           
protected  org.slf4j.Logger logger
           
protected  ICCAMessageFactory messageFactory
           
protected  IServerCCASessionContext serverContextListener
           
protected  ServerCCASessionListener serverSessionListener
           
protected  IAppSessionDataFactory<ICCASessionData> sessionDataFactory
           
protected  ISessionFactory sessionFactory
           
protected  StateChangeListener<AppSession> stateListener
           
 
Constructor Summary
CCASessionFactoryImpl()
           
CCASessionFactoryImpl(SessionFactory sessionFactory)
           
CCASessionFactoryImpl(SessionFactory sessionFactory, int defaultDirectDebitingFailureHandling, int defaultCreditControlFailureHandling, long defaultValidityTime, long defaultTxTimerValue)
           
 
Method Summary
 JCreditControlAnswer createCreditControlAnswer(Answer answer)
           
 JCreditControlRequest createCreditControlRequest(Request req)
           
 ReAuthAnswer createReAuthAnswer(Answer answer)
           
 ReAuthRequest createReAuthRequest(Request req)
           
 void denyAccessOnDeliverFailure(ClientCCASession clientCCASessionImpl, Message request)
           
 void denyAccessOnFailureMessage(ClientCCASession clientCCASessionImpl)
           
 void denyAccessOnTxExpire(ClientCCASession clientCCASessionImpl)
           
 void doCreditControlAnswer(ClientCCASession session, JCreditControlRequest request, JCreditControlAnswer answer)
           
 void doCreditControlRequest(ServerCCASession session, JCreditControlRequest request)
           
 void doOtherEvent(AppSession session, AppRequestEvent request, AppAnswerEvent answer)
           
 void doReAuthAnswer(ServerCCASession session, ReAuthRequest request, ReAuthAnswer answer)
           
 void doReAuthRequest(ClientCCASession session, ReAuthRequest request)
           
 long[] getApplicationIds()
           
 IClientCCASessionContext getClientContextListener()
           
 ClientCCASessionListener 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
 ICCAMessageFactory getMessageFactory()
           
 AppSession getNewSession(java.lang.String sessionId, java.lang.Class<? extends AppSession> aClass, ApplicationId applicationId, java.lang.Object[] args)
           
 IServerCCASessionContext getServerContextListener()
           
 ServerCCASessionListener 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(ClientCCASession clientCCASessionImpl, Message request)
           
 void grantAccessOnFailureMessage(ClientCCASession clientCCASessionImpl)
           
 void grantAccessOnTxExpire(ClientCCASession clientCCASessionImpl)
           
 void indicateServiceError(ClientCCASession clientCCASessionImpl)
           
 void init(SessionFactory sessionFactory)
           
 void sessionSupervisionTimerExpired(ServerCCASession session)
           
 void sessionSupervisionTimerReStarted(ServerCCASession session, java.util.concurrent.ScheduledFuture future)
           
 void sessionSupervisionTimerStarted(ServerCCASession session, java.util.concurrent.ScheduledFuture future)
          This is called always when Tcc starts
 void sessionSupervisionTimerStopped(ServerCCASession session, java.util.concurrent.ScheduledFuture future)
           
 void setClientContextListener(IClientCCASessionContext clientContextListener)
           
 void setClientSessionListener(ClientCCASessionListener clientSessionListener)
          Set stack wide listener for sessions.
 void setMessageFactory(ICCAMessageFactory messageFactory)
           
 void setServerContextListener(IServerCCASessionContext serverContextListener)
           
 void setServerSessionListener(ServerCCASessionListener 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(ClientCCASession 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 ClientCCASessionListener clientSessionListener

serverSessionListener

protected ServerCCASessionListener serverSessionListener

stateListener

protected StateChangeListener<AppSession> stateListener

serverContextListener

protected IServerCCASessionContext serverContextListener

clientContextListener

protected IClientCCASessionContext clientContextListener

messageFactory

protected ICCAMessageFactory messageFactory

logger

protected org.slf4j.Logger logger

iss

protected ISessionDatasource iss

sessionFactory

protected ISessionFactory sessionFactory

sessionDataFactory

protected IAppSessionDataFactory<ICCASessionData> sessionDataFactory
Constructor Detail

CCASessionFactoryImpl

public CCASessionFactoryImpl()

CCASessionFactoryImpl

public CCASessionFactoryImpl(SessionFactory sessionFactory)

CCASessionFactoryImpl

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

init

public void init(SessionFactory sessionFactory)
Parameters:
sessionFactory2 -

getClientSessionListener

public ClientCCASessionListener getClientSessionListener()
Description copied from interface: ICCASessionFactory
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 ICCASessionFactory
Returns:
the clientSessionListener

setClientSessionListener

public void setClientSessionListener(ClientCCASessionListener clientSessionListener)
Description copied from interface: ICCASessionFactory
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 ICCASessionFactory
Parameters:
clientSessionListener - the clientSessionListener to set

getServerSessionListener

public ServerCCASessionListener getServerSessionListener()
Description copied from interface: ICCASessionFactory
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 ICCASessionFactory
Returns:
the serverSessionListener

setServerSessionListener

public void setServerSessionListener(ServerCCASessionListener serverSessionListener)
Description copied from interface: ICCASessionFactory
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 ICCASessionFactory
Parameters:
serverSessionListener - the serverSessionListener to set

getServerContextListener

public IServerCCASessionContext getServerContextListener()
Specified by:
getServerContextListener in interface ICCASessionFactory
Returns:
the serverContextListener

setServerContextListener

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

getClientContextListener

public IClientCCASessionContext getClientContextListener()
Specified by:
getClientContextListener in interface ICCASessionFactory
Returns:
the clientContextListener

getMessageFactory

public ICCAMessageFactory getMessageFactory()
Specified by:
getMessageFactory in interface ICCASessionFactory
Returns:
the messageFactory

setMessageFactory

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

setClientContextListener

public void setClientContextListener(IClientCCASessionContext clientContextListener)
Specified by:
setClientContextListener in interface ICCASessionFactory
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 ICCASessionFactory
Returns:
the stateListener

setStateListener

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

getSession

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

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

doCreditControlRequest

public void doCreditControlRequest(ServerCCASession session,
                                   JCreditControlRequest request)
                            throws InternalException
Specified by:
doCreditControlRequest in interface ServerCCASessionListener
Throws:
InternalException

doCreditControlAnswer

public void doCreditControlAnswer(ClientCCASession session,
                                  JCreditControlRequest request,
                                  JCreditControlAnswer answer)
                           throws InternalException
Specified by:
doCreditControlAnswer in interface ClientCCASessionListener
Throws:
InternalException

doReAuthRequest

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

doReAuthAnswer

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

doOtherEvent

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

createCreditControlAnswer

public JCreditControlAnswer createCreditControlAnswer(Answer answer)
Specified by:
createCreditControlAnswer in interface ICCAMessageFactory

createCreditControlRequest

public JCreditControlRequest createCreditControlRequest(Request req)
Specified by:
createCreditControlRequest in interface ICCAMessageFactory

createReAuthAnswer

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

createReAuthRequest

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

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(ServerCCASession session)
Specified by:
sessionSupervisionTimerExpired in interface IServerCCASessionContext

sessionSupervisionTimerReStarted

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

sessionSupervisionTimerStarted

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

Specified by:
sessionSupervisionTimerStarted in interface IServerCCASessionContext

sessionSupervisionTimerStopped

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

timeoutExpired

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

denyAccessOnDeliverFailure

public void denyAccessOnDeliverFailure(ClientCCASession clientCCASessionImpl,
                                       Message request)
Specified by:
denyAccessOnDeliverFailure in interface IClientCCASessionContext

denyAccessOnFailureMessage

public void denyAccessOnFailureMessage(ClientCCASession clientCCASessionImpl)
Specified by:
denyAccessOnFailureMessage in interface IClientCCASessionContext

denyAccessOnTxExpire

public void denyAccessOnTxExpire(ClientCCASession clientCCASessionImpl)
Specified by:
denyAccessOnTxExpire in interface IClientCCASessionContext

getDefaultCCFHValue

public int getDefaultCCFHValue()
Specified by:
getDefaultCCFHValue in interface ClientCCASessionListener
Specified by:
getDefaultCCFHValue in interface IClientCCASessionContext

getDefaultDDFHValue

public int getDefaultDDFHValue()
Specified by:
getDefaultDDFHValue in interface ClientCCASessionListener
Specified by:
getDefaultDDFHValue in interface IClientCCASessionContext

getDefaultTxTimerValue

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

grantAccessOnDeliverFailure

public void grantAccessOnDeliverFailure(ClientCCASession clientCCASessionImpl,
                                        Message request)
Specified by:
grantAccessOnDeliverFailure in interface IClientCCASessionContext

grantAccessOnFailureMessage

public void grantAccessOnFailureMessage(ClientCCASession clientCCASessionImpl)
Specified by:
grantAccessOnFailureMessage in interface IClientCCASessionContext

grantAccessOnTxExpire

public void grantAccessOnTxExpire(ClientCCASession clientCCASessionImpl)
Specified by:
grantAccessOnTxExpire in interface IClientCCASessionContext

indicateServiceError

public void indicateServiceError(ClientCCASession clientCCASessionImpl)
Specified by:
indicateServiceError in interface IClientCCASessionContext

txTimerExpired

public void txTimerExpired(ClientCCASession session)
Specified by:
txTimerExpired in interface IClientCCASessionContext

getApplicationIds

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

getDefaultValidityTime

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

Specified by:
getDefaultValidityTime in interface IServerCCASessionContext
Returns:


Copyright © 2014. All Rights Reserved.