org.jdiameter.client.impl.app.ro
Class ClientRoSessionImpl

java.lang.Object
  extended by org.jdiameter.common.impl.app.AppSessionImpl
      extended by org.jdiameter.common.impl.app.ro.AppRoSessionImpl
          extended by org.jdiameter.client.impl.app.ro.ClientRoSessionImpl
All Implemented Interfaces:
AppSession, StateMachine, BaseSession, EventListener<Request,Answer>, NetworkReqListener, ClientRoSession

public class ClientRoSessionImpl
extends AppRoSessionImpl
implements ClientRoSession, NetworkReqListener, EventListener<Request,Answer>

Client Credit-Control Application session implementation

Author:
Alexandre Mendonca , Bartosz Baranowski

Field Summary
protected  long[] authAppIds
           
protected static int CCFH_CONTINUE
           
protected static int CCFH_RETRY_AND_TERMINATE
           
protected static int CCFH_TERMINATE
           
protected  IClientRoSessionContext context
           
protected  java.util.ArrayList<Event> eventQueue
           
protected  IRoMessageFactory factory
           
protected  ClientRoSessionListener listener
           
protected  IMessageParser parser
           
protected  java.util.concurrent.locks.Lock sendAndStateLock
           
protected  IClientRoSessionData sessionData
           
protected static java.util.Set<java.lang.Long> temporaryErrorCodes
           
protected static long TX_TIMER_DEFAULT_VALUE
           
protected static java.lang.String TX_TIMER_NAME
           
 
Fields inherited from class org.jdiameter.common.impl.app.ro.AppRoSessionImpl
stateListeners
 
Fields inherited from class org.jdiameter.common.impl.app.AppSessionImpl
appSessionData, scheduler, session, sessions, sf, timerFacility
 
Constructor Summary
ClientRoSessionImpl(IClientRoSessionData sessionData, IRoMessageFactory fct, ISessionFactory sf, ClientRoSessionListener lst, IClientRoSessionContext ctx, StateChangeListener<AppSession> stLst)
           
 
Method Summary
protected  void deliverRAR(ReAuthRequest request)
           
protected  void deliverRoAnswer(RoCreditControlRequest request, RoCreditControlAnswer answer)
           
protected  void dispatch()
          This makes checks on queue, moves it to proper state if event there is present on Open state ;]
protected  void dispatchEvent(AppEvent event)
           
protected  void extractFHAVPs(RoCreditControlRequest request, RoCreditControlAnswer answer)
           
protected  int getLocalCCFH()
           
protected  int getLocalDDFH()
           
<E> E
getState(java.lang.Class<E> stateType)
           
 boolean handleEvent(StateEvent event)
           
protected  boolean handleEventForEventBased(StateEvent event)
           
protected  boolean handleEventForSessionBased(StateEvent event)
           
protected  void handleFailureMessage(RoCreditControlAnswer event, RoCreditControlRequest request, Event.Type eventType)
           
protected  void handleSendFailure(java.lang.Exception e, Event.Type eventType, Message request)
           
protected  void handleTxExpires(Message message)
           
 boolean isEventBased()
           
protected  boolean isFailure(long code)
           
protected  boolean isProvisional(long resultCode)
           
 boolean isReplicable()
           
 boolean isStateless()
           
protected  boolean isSuccess(long resultCode)
           
 void onTimer(java.lang.String timerName)
           
 Answer processRequest(Request request)
           
 void receivedSuccessMessage(Request request, Answer answer)
           
 void release()
           
 void sendCreditControlRequest(RoCreditControlRequest request)
           
 void sendReAuthAnswer(ReAuthAnswer answer)
           
protected  void setState(ClientRoSessionState newState)
           
protected  void setState(ClientRoSessionState newState, boolean release)
           
protected  void startTx(RoCreditControlRequest request)
           
protected  void stopTx()
           
 void timeoutExpired(Request request)
           
 
Methods inherited from class org.jdiameter.common.impl.app.ro.AppRoSessionImpl
addStateChangeNotification, removeStateChangeNotification
 
Methods inherited from class org.jdiameter.common.impl.app.AppSessionImpl
equals, getCreationTime, getLastAccessedTime, getSessionAppId, getSessionId, getSessions, hashCode, isAppSession, isValid
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.jdiameter.api.app.AppSession
getSessionAppId, getSessions
 
Methods inherited from interface org.jdiameter.api.BaseSession
getCreationTime, getLastAccessedTime, getSessionId, isAppSession, isValid
 
Methods inherited from interface org.jdiameter.api.app.StateMachine
addStateChangeNotification, removeStateChangeNotification
 

Field Detail

sessionData

protected IClientRoSessionData sessionData

sendAndStateLock

protected java.util.concurrent.locks.Lock sendAndStateLock

factory

protected transient IRoMessageFactory factory

listener

protected transient ClientRoSessionListener listener

context

protected transient IClientRoSessionContext context

parser

protected transient IMessageParser parser

TX_TIMER_NAME

protected static final java.lang.String TX_TIMER_NAME
See Also:
Constant Field Values

TX_TIMER_DEFAULT_VALUE

protected static final long TX_TIMER_DEFAULT_VALUE
See Also:
Constant Field Values

authAppIds

protected long[] authAppIds

CCFH_TERMINATE

protected static final int CCFH_TERMINATE
See Also:
Constant Field Values

CCFH_CONTINUE

protected static final int CCFH_CONTINUE
See Also:
Constant Field Values

CCFH_RETRY_AND_TERMINATE

protected static final int CCFH_RETRY_AND_TERMINATE
See Also:
Constant Field Values

temporaryErrorCodes

protected static final java.util.Set<java.lang.Long> temporaryErrorCodes

eventQueue

protected java.util.ArrayList<Event> eventQueue
Constructor Detail

ClientRoSessionImpl

public ClientRoSessionImpl(IClientRoSessionData sessionData,
                           IRoMessageFactory fct,
                           ISessionFactory sf,
                           ClientRoSessionListener lst,
                           IClientRoSessionContext ctx,
                           StateChangeListener<AppSession> stLst)
Method Detail

getLocalCCFH

protected int getLocalCCFH()

getLocalDDFH

protected int getLocalDDFH()

sendCreditControlRequest

public void sendCreditControlRequest(RoCreditControlRequest request)
                              throws InternalException,
                                     IllegalDiameterStateException,
                                     RouteException,
                                     OverloadException
Specified by:
sendCreditControlRequest in interface ClientRoSession
Throws:
InternalException
IllegalDiameterStateException
RouteException
OverloadException

sendReAuthAnswer

public void sendReAuthAnswer(ReAuthAnswer answer)
                      throws InternalException,
                             IllegalDiameterStateException,
                             RouteException,
                             OverloadException
Specified by:
sendReAuthAnswer in interface ClientRoSession
Throws:
InternalException
IllegalDiameterStateException
RouteException
OverloadException

isStateless

public boolean isStateless()
Specified by:
isStateless in interface AppSession

isEventBased

public boolean isEventBased()

getState

public <E> E getState(java.lang.Class<E> stateType)
Specified by:
getState in interface StateMachine

handleEvent

public boolean handleEvent(StateEvent event)
                    throws InternalException,
                           OverloadException
Specified by:
handleEvent in interface StateMachine
Throws:
InternalException
OverloadException

handleEventForEventBased

protected boolean handleEventForEventBased(StateEvent event)
                                    throws InternalException,
                                           OverloadException
Throws:
InternalException
OverloadException

handleEventForSessionBased

protected boolean handleEventForSessionBased(StateEvent event)
                                      throws InternalException,
                                             OverloadException
Throws:
InternalException
OverloadException

processRequest

public Answer processRequest(Request request)
Specified by:
processRequest in interface NetworkReqListener

receivedSuccessMessage

public void receivedSuccessMessage(Request request,
                                   Answer answer)
Specified by:
receivedSuccessMessage in interface EventListener<Request,Answer>

timeoutExpired

public void timeoutExpired(Request request)
Specified by:
timeoutExpired in interface EventListener<Request,Answer>

startTx

protected void startTx(RoCreditControlRequest request)

stopTx

protected void stopTx()

onTimer

public void onTimer(java.lang.String timerName)
Specified by:
onTimer in class AppSessionImpl

setState

protected void setState(ClientRoSessionState newState)

setState

protected void setState(ClientRoSessionState newState,
                        boolean release)

release

public void release()
Specified by:
release in interface BaseSession
Overrides:
release in class AppRoSessionImpl

handleSendFailure

protected void handleSendFailure(java.lang.Exception e,
                                 Event.Type eventType,
                                 Message request)
                          throws java.lang.Exception
Throws:
java.lang.Exception

handleFailureMessage

protected void handleFailureMessage(RoCreditControlAnswer event,
                                    RoCreditControlRequest request,
                                    Event.Type eventType)

handleTxExpires

protected void handleTxExpires(Message message)

dispatch

protected void dispatch()
This makes checks on queue, moves it to proper state if event there is present on Open state ;]


deliverRoAnswer

protected void deliverRoAnswer(RoCreditControlRequest request,
                               RoCreditControlAnswer answer)

extractFHAVPs

protected void extractFHAVPs(RoCreditControlRequest request,
                             RoCreditControlAnswer answer)
                      throws AvpDataException
Throws:
AvpDataException

deliverRAR

protected void deliverRAR(ReAuthRequest request)

dispatchEvent

protected void dispatchEvent(AppEvent event)
                      throws InternalException,
                             IllegalDiameterStateException,
                             RouteException,
                             OverloadException
Throws:
InternalException
IllegalDiameterStateException
RouteException
OverloadException

isProvisional

protected boolean isProvisional(long resultCode)

isSuccess

protected boolean isSuccess(long resultCode)

isFailure

protected boolean isFailure(long code)

isReplicable

public boolean isReplicable()
Specified by:
isReplicable in interface BaseSession
Overrides:
isReplicable in class AppSessionImpl


Copyright © 2014. All Rights Reserved.