org.jdiameter.common.impl.app.rx
Class RxSessionFactoryImpl

java.lang.Object
  extended by org.jdiameter.common.impl.app.rx.RxSessionFactoryImpl
All Implemented Interfaces:
StateChangeListener<AppSession>, ClientRxSessionListener, ServerRxSessionListener, IAppSessionFactory, IClientRxSessionContext, IRxMessageFactory, IRxSessionFactory, IServerRxSessionContext

public class RxSessionFactoryImpl
extends java.lang.Object
implements IRxSessionFactory, ClientRxSessionListener, ServerRxSessionListener, StateChangeListener<AppSession>, IRxMessageFactory, IServerRxSessionContext, IClientRxSessionContext

Default Diameter Rx Session Factory implementation.

Author:
Richard Good , Alexandre Mendonca , Bartosz Baranowski

Field Summary
protected  IClientRxSessionContext clientContextListener
           
protected  ClientRxSessionListener clientSessionListener
           
protected  int defaultAAFailureHandling
           
protected  int defaultDirectDebitingFailureHandling
           
protected  long defaultTxTimerValue
           
protected  long defaultValidityTime
           
protected  ISessionDatasource iss
           
protected  org.slf4j.Logger logger
           
protected  IRxMessageFactory messageFactory
           
protected  IServerRxSessionContext serverContextListener
           
protected  ServerRxSessionListener serverSessionListener
           
protected  IAppSessionDataFactory<IRxSessionData> sessionDataFactory
           
protected  ISessionFactory sessionFactory
           
protected  StateChangeListener<AppSession> stateListener
           
 
Constructor Summary
RxSessionFactoryImpl(SessionFactory sessionFactory)
           
RxSessionFactoryImpl(SessionFactory sessionFactory, int defaultDirectDebitingFailureHandling, int defaultAAFailureHandling, long defaultValidityTime, long defaultTxTimerValue)
           
 
Method Summary
 RxAAAnswer createAAAnswer(Answer answer)
           
 RxAARequest createAARequest(Request req)
           
 RxAbortSessionAnswer createAbortSessionAnswer(Answer answer)
           
 RxAbortSessionRequest createAbortSessionRequest(Request req)
           
 RxReAuthAnswer createReAuthAnswer(Answer answer)
           
 RxReAuthRequest createReAuthRequest(Request req)
           
 RxSessionTermAnswer createSessionTermAnswer(Answer answer)
           
 RxSessionTermRequest createSessionTermRequest(Request req)
           
 void denyAccessOnDeliverFailure(ClientRxSession clientRxSessionImpl, Message request)
           
 void denyAccessOnFailureMessage(ClientRxSession clientRxSessionImpl)
           
 void denyAccessOnTxExpire(ClientRxSession clientRxSessionImpl)
           
 void doAAAnswer(ClientRxSession session, RxAARequest request, RxAAAnswer answer)
           
 void doAARequest(ServerRxSession session, RxAARequest request)
           
 void doAbortSessionAnswer(ServerRxSession session, RxAbortSessionRequest request, RxAbortSessionAnswer answer)
           
 void doAbortSessionRequest(ClientRxSession session, RxAbortSessionRequest request)
           
 void doOtherEvent(AppSession session, AppRequestEvent request, AppAnswerEvent answer)
           
 void doReAuthAnswer(ServerRxSession session, RxReAuthRequest request, RxReAuthAnswer answer)
           
 void doReAuthRequest(ClientRxSession session, RxReAuthRequest request)
           
 void doSessionTermAnswer(ClientRxSession session, RxSessionTermRequest request, RxSessionTermAnswer answer)
           
 void doSessionTermRequest(ServerRxSession session, RxSessionTermRequest request)
           
 long[] getApplicationIds()
           
 IClientRxSessionContext getClientContextListener()
           
 ClientRxSessionListener getClientSessionListener()
          Get stack wide listener for sessions.
 IRxMessageFactory getMessageFactory()
           
 AppSession getNewSession(java.lang.String sessionId, java.lang.Class<? extends AppSession> aClass, ApplicationId applicationId, java.lang.Object[] args)
           
 IServerRxSessionContext getServerContextListener()
           
 ServerRxSessionListener 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(ClientRxSession clientRxSessionImpl, Message request)
           
 void grantAccessOnFailureMessage(ClientRxSession clientRxSessionImpl)
           
 void grantAccessOnTxExpire(ClientRxSession clientRxSessionImpl)
           
 void indicateServiceError(ClientRxSession clientRxSessionImpl)
           
 void sessionSupervisionTimerExpired(ServerRxSession session)
           
 void sessionSupervisionTimerReStarted(ServerRxSession session, java.util.concurrent.ScheduledFuture future)
           
 void sessionSupervisionTimerStarted(ServerRxSession session, java.util.concurrent.ScheduledFuture future)
          This is called always when Tcc starts
 void sessionSupervisionTimerStopped(ServerRxSession session, java.util.concurrent.ScheduledFuture future)
           
 void setClientContextListener(IClientRxSessionContext clientContextListener)
           
 void setClientSessionListener(ClientRxSessionListener clientSessionListener)
          Set stack wide listener for sessions.
 void setMessageFactory(IRxMessageFactory messageFactory)
           
 void setServerContextListener(IServerRxSessionContext serverContextListener)
           
 void setServerSessionListener(ServerRxSessionListener 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)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

defaultDirectDebitingFailureHandling

protected int defaultDirectDebitingFailureHandling

defaultAAFailureHandling

protected int defaultAAFailureHandling

defaultValidityTime

protected long defaultValidityTime

defaultTxTimerValue

protected long defaultTxTimerValue

clientSessionListener

protected ClientRxSessionListener clientSessionListener

serverSessionListener

protected ServerRxSessionListener serverSessionListener

stateListener

protected StateChangeListener<AppSession> stateListener

serverContextListener

protected IServerRxSessionContext serverContextListener

clientContextListener

protected IClientRxSessionContext clientContextListener

messageFactory

protected IRxMessageFactory messageFactory

logger

protected org.slf4j.Logger logger

iss

protected ISessionDatasource iss

sessionFactory

protected ISessionFactory sessionFactory

sessionDataFactory

protected IAppSessionDataFactory<IRxSessionData> sessionDataFactory
Constructor Detail

RxSessionFactoryImpl

public RxSessionFactoryImpl(SessionFactory sessionFactory)

RxSessionFactoryImpl

public RxSessionFactoryImpl(SessionFactory sessionFactory,
                            int defaultDirectDebitingFailureHandling,
                            int defaultAAFailureHandling,
                            long defaultValidityTime,
                            long defaultTxTimerValue)
Method Detail

getClientSessionListener

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

setClientSessionListener

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

getServerSessionListener

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

setServerSessionListener

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

getServerContextListener

public IServerRxSessionContext getServerContextListener()
Specified by:
getServerContextListener in interface IRxSessionFactory
Returns:
the serverContextListener

setServerContextListener

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

getClientContextListener

public IClientRxSessionContext getClientContextListener()
Specified by:
getClientContextListener in interface IRxSessionFactory
Returns:
the clientContextListener

getMessageFactory

public IRxMessageFactory getMessageFactory()
Specified by:
getMessageFactory in interface IRxSessionFactory
Returns:
the messageFactory

setMessageFactory

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

setClientContextListener

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

setStateListener

public void setStateListener(StateChangeListener<AppSession> stateListener)
Specified by:
setStateListener in interface IRxSessionFactory
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

doAARequest

public void doAARequest(ServerRxSession session,
                        RxAARequest request)
                 throws InternalException
Specified by:
doAARequest in interface ServerRxSessionListener
Throws:
InternalException

doAAAnswer

public void doAAAnswer(ClientRxSession session,
                       RxAARequest request,
                       RxAAAnswer answer)
                throws InternalException
Specified by:
doAAAnswer in interface ClientRxSessionListener
Throws:
InternalException

doReAuthRequest

public void doReAuthRequest(ClientRxSession session,
                            RxReAuthRequest request)
                     throws InternalException
Specified by:
doReAuthRequest in interface ClientRxSessionListener
Throws:
InternalException

doReAuthAnswer

public void doReAuthAnswer(ServerRxSession session,
                           RxReAuthRequest request,
                           RxReAuthAnswer answer)
                    throws InternalException
Specified by:
doReAuthAnswer in interface ServerRxSessionListener
Throws:
InternalException

doAbortSessionRequest

public void doAbortSessionRequest(ClientRxSession session,
                                  RxAbortSessionRequest request)
                           throws InternalException
Specified by:
doAbortSessionRequest in interface ClientRxSessionListener
Throws:
InternalException

doAbortSessionAnswer

public void doAbortSessionAnswer(ServerRxSession session,
                                 RxAbortSessionRequest request,
                                 RxAbortSessionAnswer answer)
                          throws InternalException
Specified by:
doAbortSessionAnswer in interface ServerRxSessionListener
Throws:
InternalException

doSessionTermRequest

public void doSessionTermRequest(ServerRxSession session,
                                 RxSessionTermRequest request)
                          throws InternalException
Specified by:
doSessionTermRequest in interface ServerRxSessionListener
Throws:
InternalException

doSessionTermAnswer

public void doSessionTermAnswer(ClientRxSession session,
                                RxSessionTermRequest request,
                                RxSessionTermAnswer answer)
                         throws InternalException
Specified by:
doSessionTermAnswer in interface ClientRxSessionListener
Throws:
InternalException

doOtherEvent

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

createAAAnswer

public RxAAAnswer createAAAnswer(Answer answer)
Specified by:
createAAAnswer in interface IRxMessageFactory

createAARequest

public RxAARequest createAARequest(Request req)
Specified by:
createAARequest in interface IRxMessageFactory

createReAuthAnswer

public RxReAuthAnswer createReAuthAnswer(Answer answer)
Specified by:
createReAuthAnswer in interface IRxMessageFactory

createReAuthRequest

public RxReAuthRequest createReAuthRequest(Request req)
Specified by:
createReAuthRequest in interface IRxMessageFactory

createSessionTermAnswer

public RxSessionTermAnswer createSessionTermAnswer(Answer answer)
Specified by:
createSessionTermAnswer in interface IRxMessageFactory

createSessionTermRequest

public RxSessionTermRequest createSessionTermRequest(Request req)
Specified by:
createSessionTermRequest in interface IRxMessageFactory

createAbortSessionAnswer

public RxAbortSessionAnswer createAbortSessionAnswer(Answer answer)
Specified by:
createAbortSessionAnswer in interface IRxMessageFactory

createAbortSessionRequest

public RxAbortSessionRequest createAbortSessionRequest(Request req)
Specified by:
createAbortSessionRequest in interface IRxMessageFactory

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

sessionSupervisionTimerReStarted

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

sessionSupervisionTimerStarted

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

Specified by:
sessionSupervisionTimerStarted in interface IServerRxSessionContext

sessionSupervisionTimerStopped

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

timeoutExpired

public void timeoutExpired(Request request)

denyAccessOnDeliverFailure

public void denyAccessOnDeliverFailure(ClientRxSession clientRxSessionImpl,
                                       Message request)
Specified by:
denyAccessOnDeliverFailure in interface IClientRxSessionContext

denyAccessOnFailureMessage

public void denyAccessOnFailureMessage(ClientRxSession clientRxSessionImpl)
Specified by:
denyAccessOnFailureMessage in interface IClientRxSessionContext

denyAccessOnTxExpire

public void denyAccessOnTxExpire(ClientRxSession clientRxSessionImpl)

grantAccessOnDeliverFailure

public void grantAccessOnDeliverFailure(ClientRxSession clientRxSessionImpl,
                                        Message request)
Specified by:
grantAccessOnDeliverFailure in interface IClientRxSessionContext

grantAccessOnFailureMessage

public void grantAccessOnFailureMessage(ClientRxSession clientRxSessionImpl)
Specified by:
grantAccessOnFailureMessage in interface IClientRxSessionContext

grantAccessOnTxExpire

public void grantAccessOnTxExpire(ClientRxSession clientRxSessionImpl)

indicateServiceError

public void indicateServiceError(ClientRxSession clientRxSessionImpl)
Specified by:
indicateServiceError in interface IClientRxSessionContext

getApplicationIds

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


Copyright © 2014. All Rights Reserved.