org.jdiameter.common.impl.app.gx
Class GxSessionFactoryImpl

java.lang.Object
  extended by org.jdiameter.common.impl.app.gx.GxSessionFactoryImpl
All Implemented Interfaces:
StateChangeListener<AppSession>, ClientGxSessionListener, ServerGxSessionListener, IClientGxSessionContext, IGxMessageFactory, IGxSessionFactory, IServerGxSessionContext, IAppSessionFactory

public class GxSessionFactoryImpl
extends java.lang.Object
implements IGxSessionFactory, ClientGxSessionListener, ServerGxSessionListener, StateChangeListener<AppSession>, IGxMessageFactory, IServerGxSessionContext, IClientGxSessionContext

Default Diameter Gx Session Factory implementation.

Author:
Alexandre Mendonca , Bartosz Baranowski , Carl-Magnus Björkell

Field Summary
protected  IClientGxSessionContext clientContextListener
           
protected  ClientGxSessionListener clientSessionListener
           
protected  int defaultCreditControlFailureHandling
           
protected  int defaultDirectDebitingFailureHandling
           
protected  long defaultTxTimerValue
           
protected  long defaultValidityTime
           
protected  ISessionDatasource iss
           
protected  org.slf4j.Logger logger
           
protected  IGxMessageFactory messageFactory
           
protected  IServerGxSessionContext serverContextListener
           
protected  ServerGxSessionListener serverSessionListener
           
protected  IAppSessionDataFactory<IGxSessionData> sessionDataFactory
           
protected  ISessionFactory sessionFactory
           
protected  StateChangeListener<AppSession> stateListener
           
 
Constructor Summary
GxSessionFactoryImpl(SessionFactory sessionFactory)
           
GxSessionFactoryImpl(SessionFactory sessionFactory, int defaultDirectDebitingFailureHandling, int defaultCreditControlFailureHandling, long defaultValidityTime, long defaultTxTimerValue)
           
 
Method Summary
 GxCreditControlAnswer createCreditControlAnswer(Answer answer)
           
 GxCreditControlRequest createCreditControlRequest(Request req)
           
 GxReAuthAnswer createGxReAuthAnswer(Answer answer)
           
 GxReAuthRequest createGxReAuthRequest(Request req)
           
 void denyAccessOnDeliverFailure(ClientGxSession clientGxSessionImpl, Message request)
           
 void denyAccessOnFailureMessage(ClientGxSession clientGxSessionImpl)
           
 void denyAccessOnTxExpire(ClientGxSession clientGxSessionImpl)
           
 void doCreditControlAnswer(ClientGxSession session, GxCreditControlRequest request, GxCreditControlAnswer answer)
           
 void doCreditControlRequest(ServerGxSession session, GxCreditControlRequest request)
           
 void doGxReAuthAnswer(ServerGxSession session, GxReAuthRequest request, GxReAuthAnswer answer)
           
 void doGxReAuthRequest(ClientGxSession session, GxReAuthRequest request)
           
 void doOtherEvent(AppSession session, AppRequestEvent request, AppAnswerEvent answer)
           
 long[] getApplicationIds()
           
 IClientGxSessionContext getClientContextListener()
           
 ClientGxSessionListener 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
 IGxMessageFactory getMessageFactory()
           
 AppSession getNewSession(java.lang.String sessionId, java.lang.Class<? extends AppSession> aClass, ApplicationId applicationId, java.lang.Object[] args)
           
 IServerGxSessionContext getServerContextListener()
           
 ServerGxSessionListener 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(ClientGxSession clientGxSessionImpl, Message request)
           
 void grantAccessOnFailureMessage(ClientGxSession clientGxSessionImpl)
           
 void grantAccessOnTxExpire(ClientGxSession clientGxSessionImpl)
           
 void indicateServiceError(ClientGxSession clientGxSessionImpl)
           
 void sessionSupervisionTimerExpired(ServerGxSession session)
           
 void sessionSupervisionTimerReStarted(ServerGxSession session, java.util.concurrent.ScheduledFuture future)
           
 void sessionSupervisionTimerStarted(ServerGxSession session, java.util.concurrent.ScheduledFuture future)
          This is called always when Tcc starts
 void sessionSupervisionTimerStopped(ServerGxSession session, java.util.concurrent.ScheduledFuture future)
           
 void setClientContextListener(IClientGxSessionContext clientContextListener)
           
 void setClientSessionListener(ClientGxSessionListener clientSessionListener)
          Set stack wide listener for sessions.
 void setMessageFactory(IGxMessageFactory messageFactory)
           
 void setServerContextListener(IServerGxSessionContext serverContextListener)
           
 void setServerSessionListener(ServerGxSessionListener 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(ClientGxSession 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 ClientGxSessionListener clientSessionListener

serverSessionListener

protected ServerGxSessionListener serverSessionListener

stateListener

protected StateChangeListener<AppSession> stateListener

serverContextListener

protected IServerGxSessionContext serverContextListener

clientContextListener

protected IClientGxSessionContext clientContextListener

messageFactory

protected IGxMessageFactory messageFactory

logger

protected org.slf4j.Logger logger

iss

protected ISessionDatasource iss

sessionFactory

protected ISessionFactory sessionFactory

sessionDataFactory

protected IAppSessionDataFactory<IGxSessionData> sessionDataFactory
Constructor Detail

GxSessionFactoryImpl

public GxSessionFactoryImpl(SessionFactory sessionFactory)

GxSessionFactoryImpl

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

getClientSessionListener

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

setClientSessionListener

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

getServerSessionListener

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

setServerSessionListener

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

getServerContextListener

public IServerGxSessionContext getServerContextListener()
Specified by:
getServerContextListener in interface IGxSessionFactory
Returns:
the serverContextListener

setServerContextListener

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

getClientContextListener

public IClientGxSessionContext getClientContextListener()
Specified by:
getClientContextListener in interface IGxSessionFactory
Returns:
the clientContextListener

getMessageFactory

public IGxMessageFactory getMessageFactory()
Specified by:
getMessageFactory in interface IGxSessionFactory
Returns:
the messageFactory

setMessageFactory

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

setClientContextListener

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

setStateListener

public void setStateListener(StateChangeListener<AppSession> stateListener)
Specified by:
setStateListener in interface IGxSessionFactory
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(ServerGxSession session,
                                   GxCreditControlRequest request)
                            throws InternalException
Specified by:
doCreditControlRequest in interface ServerGxSessionListener
Throws:
InternalException

doCreditControlAnswer

public void doCreditControlAnswer(ClientGxSession session,
                                  GxCreditControlRequest request,
                                  GxCreditControlAnswer answer)
                           throws InternalException
Specified by:
doCreditControlAnswer in interface ClientGxSessionListener
Throws:
InternalException

doGxReAuthRequest

public void doGxReAuthRequest(ClientGxSession session,
                              GxReAuthRequest request)
                       throws InternalException
Specified by:
doGxReAuthRequest in interface ClientGxSessionListener
Throws:
InternalException

doGxReAuthAnswer

public void doGxReAuthAnswer(ServerGxSession session,
                             GxReAuthRequest request,
                             GxReAuthAnswer answer)
                      throws InternalException
Specified by:
doGxReAuthAnswer in interface ServerGxSessionListener
Throws:
InternalException

doOtherEvent

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

createCreditControlAnswer

public GxCreditControlAnswer createCreditControlAnswer(Answer answer)
Specified by:
createCreditControlAnswer in interface IGxMessageFactory

createCreditControlRequest

public GxCreditControlRequest createCreditControlRequest(Request req)
Specified by:
createCreditControlRequest in interface IGxMessageFactory

createGxReAuthAnswer

public GxReAuthAnswer createGxReAuthAnswer(Answer answer)
Specified by:
createGxReAuthAnswer in interface IGxMessageFactory

createGxReAuthRequest

public GxReAuthRequest createGxReAuthRequest(Request req)
Specified by:
createGxReAuthRequest in interface IGxMessageFactory

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

sessionSupervisionTimerReStarted

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

sessionSupervisionTimerStarted

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

Specified by:
sessionSupervisionTimerStarted in interface IServerGxSessionContext

sessionSupervisionTimerStopped

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

timeoutExpired

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

denyAccessOnDeliverFailure

public void denyAccessOnDeliverFailure(ClientGxSession clientGxSessionImpl,
                                       Message request)
Specified by:
denyAccessOnDeliverFailure in interface IClientGxSessionContext

denyAccessOnFailureMessage

public void denyAccessOnFailureMessage(ClientGxSession clientGxSessionImpl)
Specified by:
denyAccessOnFailureMessage in interface IClientGxSessionContext

denyAccessOnTxExpire

public void denyAccessOnTxExpire(ClientGxSession clientGxSessionImpl)
Specified by:
denyAccessOnTxExpire in interface IClientGxSessionContext

getDefaultCCFHValue

public int getDefaultCCFHValue()
Specified by:
getDefaultCCFHValue in interface ClientGxSessionListener
Specified by:
getDefaultCCFHValue in interface IClientGxSessionContext

getDefaultDDFHValue

public int getDefaultDDFHValue()
Specified by:
getDefaultDDFHValue in interface ClientGxSessionListener
Specified by:
getDefaultDDFHValue in interface IClientGxSessionContext

getDefaultTxTimerValue

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

grantAccessOnDeliverFailure

public void grantAccessOnDeliverFailure(ClientGxSession clientGxSessionImpl,
                                        Message request)
Specified by:
grantAccessOnDeliverFailure in interface IClientGxSessionContext

grantAccessOnFailureMessage

public void grantAccessOnFailureMessage(ClientGxSession clientGxSessionImpl)
Specified by:
grantAccessOnFailureMessage in interface IClientGxSessionContext

grantAccessOnTxExpire

public void grantAccessOnTxExpire(ClientGxSession clientGxSessionImpl)
Specified by:
grantAccessOnTxExpire in interface IClientGxSessionContext

indicateServiceError

public void indicateServiceError(ClientGxSession clientGxSessionImpl)
Specified by:
indicateServiceError in interface IClientGxSessionContext

txTimerExpired

public void txTimerExpired(ClientGxSession session)
Specified by:
txTimerExpired in interface IClientGxSessionContext

getApplicationIds

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

getDefaultValidityTime

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

Specified by:
getDefaultValidityTime in interface IServerGxSessionContext
Returns:


Copyright © 2014. All Rights Reserved.