org.jdiameter.common.impl.app.acc
Class AccSessionFactoryImpl

java.lang.Object
  extended by org.jdiameter.common.impl.app.acc.AccSessionFactoryImpl
All Implemented Interfaces:
ClientAccSessionListener, ServerAccSessionListener, StateChangeListener<AppSession>, IAccMessageFactory, IAccSessionFactory, IClientAccActionContext, IServerAccActionContext, IAppSessionFactory

public class AccSessionFactoryImpl
extends java.lang.Object
implements IAccSessionFactory, IAccMessageFactory, ServerAccSessionListener, ClientAccSessionListener, IClientAccActionContext, IServerAccActionContext, StateChangeListener<AppSession>

Default Diameter Account Session Factory implementation

Author:
Bartosz Baranowski , Alexandre Mendonca

Field Summary
protected  ApplicationId applicationId
           
protected  IClientAccActionContext clientContextListener
           
protected  ClientAccSessionListener clientSessionListener
           
protected  ISessionDatasource iss
           
protected  org.slf4j.Logger logger
           
protected  IAccMessageFactory messageFactory
           
protected  IServerAccActionContext serverContextListener
           
protected  ServerAccSessionListener serverSessionListener
           
protected  IAppSessionDataFactory<IAccSessionData> sessionDataFactory
           
protected  ISessionFactory sessionFactory
           
protected  StateChangeListener<AppSession> stateListener
           
 
Constructor Summary
protected AccSessionFactoryImpl()
           
  AccSessionFactoryImpl(SessionFactory sessionFactory)
           
 
Method Summary
 AccountAnswer createAccAnswer(Answer answer)
           
 AccountRequest createAccRequest(Request request)
           
 void disconnectUserOrDev(ClientAccSession appSession, Request sessionTermRequest)
          Filling nested avp into STR
 void doAccAnswerEvent(ClientAccSession appSession, AccountRequest acr, AccountAnswer aca)
           
 void doAccRequestEvent(ServerAccSession appSession, AccountRequest acr)
           
 void doOtherEvent(AppSession appSession, AppRequestEvent request, AppAnswerEvent answer)
           
 boolean failedSendRecord(ClientAccSession appSession, Request accRequest)
          Call back for failed_send_record event
 int getAccMessageCommandCode()
           
 ApplicationId getApplicationId()
           
 IClientAccActionContext getClientContextListener()
           
 ClientAccSessionListener getClientSessionListener()
           
 IAccMessageFactory getMessageFactory()
           
 AppSession getNewSession(java.lang.String sessionId, java.lang.Class<? extends AppSession> aClass, ApplicationId applicationId, java.lang.Object[] args)
           
 IServerAccActionContext getServerContextListener()
           
 ServerAccSessionListener getServerSessionListener()
           
 AppSession getSession(java.lang.String sessionId, java.lang.Class<? extends AppSession> aClass)
           
 ISessionFactory getSessionFactory()
           
 StateChangeListener<AppSession> getStateListener()
           
 void interimIntervalElapses(ClientAccSession appSession, Request interimRequest)
          Filling nested avp into interim message
 void sessionTimeoutElapses(ServerAccSession appSession)
           
 void sessionTimerCanceled(ServerAccSession appSession, java.util.concurrent.ScheduledFuture timer)
           
 void sessionTimerStarted(ServerAccSession appSession, java.util.concurrent.ScheduledFuture timer)
           
 void setApplicationId(ApplicationId id)
           
 void setClientContextListener(IClientAccActionContext clientContextListener)
           
 void setClientSessionListener(ClientAccSessionListener clientSessionListener)
           
 void setMessageFactory(IAccMessageFactory messageFactory)
           
 void setServerContextListener(IServerAccActionContext serverContextListener)
           
 void setServerSessionListener(ServerAccSessionListener serverSessionListener)
           
 void setSessionFactory(ISessionFactory 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)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

protected org.slf4j.Logger logger

serverSessionListener

protected ServerAccSessionListener serverSessionListener

stateListener

protected StateChangeListener<AppSession> stateListener

clientSessionListener

protected ClientAccSessionListener clientSessionListener

clientContextListener

protected IClientAccActionContext clientContextListener

serverContextListener

protected IServerAccActionContext serverContextListener

iss

protected ISessionDatasource iss

sessionFactory

protected ISessionFactory sessionFactory

applicationId

protected ApplicationId applicationId

messageFactory

protected IAccMessageFactory messageFactory

sessionDataFactory

protected IAppSessionDataFactory<IAccSessionData> sessionDataFactory
Constructor Detail

AccSessionFactoryImpl

protected AccSessionFactoryImpl()

AccSessionFactoryImpl

public AccSessionFactoryImpl(SessionFactory sessionFactory)
Method Detail

getServerSessionListener

public ServerAccSessionListener getServerSessionListener()
Specified by:
getServerSessionListener in interface IAccSessionFactory
Returns:
the serverSessionListener

setServerSessionListener

public void setServerSessionListener(ServerAccSessionListener serverSessionListener)
Specified by:
setServerSessionListener in interface IAccSessionFactory
Parameters:
serverSessionListener - the serverSessionListener to set

getStateListener

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

setStateListener

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

getClientSessionListener

public ClientAccSessionListener getClientSessionListener()
Specified by:
getClientSessionListener in interface IAccSessionFactory
Returns:
the clientSessionListener

setClientSessionListener

public void setClientSessionListener(ClientAccSessionListener clientSessionListener)
Specified by:
setClientSessionListener in interface IAccSessionFactory
Parameters:
clientSessionListener - the clientSessionListener to set

getClientContextListener

public IClientAccActionContext getClientContextListener()
Specified by:
getClientContextListener in interface IAccSessionFactory
Returns:
the clientContextListener

setClientContextListener

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

getServerContextListener

public IServerAccActionContext getServerContextListener()
Specified by:
getServerContextListener in interface IAccSessionFactory
Returns:
the serverContextListener

setServerContextListener

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

setMessageFactory

public void setMessageFactory(IAccMessageFactory messageFactory)
Specified by:
setMessageFactory in interface IAccSessionFactory

getMessageFactory

public IAccMessageFactory getMessageFactory()
Specified by:
getMessageFactory in interface IAccSessionFactory

getSessionFactory

public ISessionFactory getSessionFactory()
Returns:
the sessionFactory

setSessionFactory

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

getApplicationId

public ApplicationId getApplicationId()
Specified by:
getApplicationId in interface IAccMessageFactory
Specified by:
getApplicationId in interface IAccSessionFactory

setApplicationId

public void setApplicationId(ApplicationId id)
Specified by:
setApplicationId in interface IAccSessionFactory

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

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>

doAccRequestEvent

public void doAccRequestEvent(ServerAccSession appSession,
                              AccountRequest acr)
                       throws InternalException,
                              IllegalDiameterStateException,
                              RouteException,
                              OverloadException
Specified by:
doAccRequestEvent in interface ServerAccSessionListener
Throws:
InternalException
IllegalDiameterStateException
RouteException
OverloadException

doAccAnswerEvent

public void doAccAnswerEvent(ClientAccSession appSession,
                             AccountRequest acr,
                             AccountAnswer aca)
                      throws InternalException,
                             IllegalDiameterStateException,
                             RouteException,
                             OverloadException
Specified by:
doAccAnswerEvent in interface ClientAccSessionListener
Throws:
InternalException
IllegalDiameterStateException
RouteException
OverloadException

doOtherEvent

public void doOtherEvent(AppSession appSession,
                         AppRequestEvent request,
                         AppAnswerEvent answer)
                  throws InternalException,
                         IllegalDiameterStateException,
                         RouteException,
                         OverloadException
Specified by:
doOtherEvent in interface ClientAccSessionListener
Specified by:
doOtherEvent in interface ServerAccSessionListener
Throws:
InternalException
IllegalDiameterStateException
RouteException
OverloadException

disconnectUserOrDev

public void disconnectUserOrDev(ClientAccSession appSession,
                                Request sessionTermRequest)
                         throws InternalException
Description copied from interface: IClientAccActionContext
Filling nested avp into STR

Specified by:
disconnectUserOrDev in interface IClientAccActionContext
sessionTermRequest - instance of STR which will be sent to server
Throws:
InternalException

failedSendRecord

public boolean failedSendRecord(ClientAccSession appSession,
                                Request accRequest)
                         throws InternalException
Description copied from interface: IClientAccActionContext
Call back for failed_send_record event

Specified by:
failedSendRecord in interface IClientAccActionContext
accRequest - accounting request record
Returns:
true if you want put message to buffer and false if you want to stop processing
Throws:
InternalException

interimIntervalElapses

public void interimIntervalElapses(ClientAccSession appSession,
                                   Request interimRequest)
                            throws InternalException
Description copied from interface: IClientAccActionContext
Filling nested avp into interim message

Specified by:
interimIntervalElapses in interface IClientAccActionContext
interimRequest - instance of interim message which will be sent to server
Throws:
InternalException

sessionTimeoutElapses

public void sessionTimeoutElapses(ServerAccSession appSession)
                           throws InternalException
Specified by:
sessionTimeoutElapses in interface IServerAccActionContext
Throws:
InternalException

sessionTimerStarted

public void sessionTimerStarted(ServerAccSession appSession,
                                java.util.concurrent.ScheduledFuture timer)
                         throws InternalException
Specified by:
sessionTimerStarted in interface IServerAccActionContext
Throws:
InternalException

sessionTimerCanceled

public void sessionTimerCanceled(ServerAccSession appSession,
                                 java.util.concurrent.ScheduledFuture timer)
                          throws InternalException
Specified by:
sessionTimerCanceled in interface IServerAccActionContext
Throws:
InternalException

getAccMessageCommandCode

public int getAccMessageCommandCode()
Specified by:
getAccMessageCommandCode in interface IAccMessageFactory

createAccRequest

public AccountRequest createAccRequest(Request request)
Specified by:
createAccRequest in interface IAccMessageFactory

createAccAnswer

public AccountAnswer createAccAnswer(Answer answer)
Specified by:
createAccAnswer in interface IAccMessageFactory


Copyright © 2014. All Rights Reserved.