org.jdiameter.client.impl.app.gx
Class ClientGxSessionImpl

java.lang.Object
  extended by org.jdiameter.common.impl.app.AppSessionImpl
      extended by org.jdiameter.common.impl.app.gx.AppGxSessionImpl
          extended by org.jdiameter.client.impl.app.gx.ClientGxSessionImpl
All Implemented Interfaces:
AppSession, StateMachine, BaseSession, EventListener<Request,Answer>, ClientGxSession, NetworkReqListener

public class ClientGxSessionImpl
extends AppGxSessionImpl
implements ClientGxSession, NetworkReqListener, EventListener<Request,Answer>

Client Credit-Control Application session implementation

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

Field Summary
protected  long[] authAppIds
           
protected static int CCFH_CONTINUE
           
protected static int CCFH_RETRY_AND_TERMINATE
           
protected static int CCFH_TERMINATE
           
protected  IClientGxSessionContext context
           
protected  java.util.ArrayList<Event> eventQueue
           
protected  IGxMessageFactory factory
           
protected  ClientGxSessionListener listener
           
protected  IMessageParser parser
           
protected  java.util.concurrent.locks.Lock sendAndStateLock
           
protected  IClientGxSessionData 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.gx.AppGxSessionImpl
stateListeners
 
Fields inherited from class org.jdiameter.common.impl.app.AppSessionImpl
appSessionData, scheduler, session, sessions, sf, timerFacility
 
Constructor Summary
ClientGxSessionImpl(IClientGxSessionData sessionData, IGxMessageFactory fct, ISessionFactory sf, ClientGxSessionListener lst, IClientGxSessionContext ctx, StateChangeListener<AppSession> stLst)
           
 
Method Summary
protected  void deliverGxAnswer(GxCreditControlRequest request, GxCreditControlAnswer answer)
           
protected  void deliverRAR(GxReAuthRequest request)
           
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)
           
 boolean equals(java.lang.Object obj)
           
protected  void extractFHAVPs(GxCreditControlRequest request, GxCreditControlAnswer 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(GxCreditControlAnswer event, GxCreditControlRequest request, Event.Type eventType)
           
protected  void handleSendFailure(java.lang.Exception e, Event.Type eventType, Message request)
           
protected  void handleTxExpires(Message message)
           
 int hashCode()
           
 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(GxCreditControlRequest request)
           
 void sendGxReAuthAnswer(GxReAuthAnswer answer)
           
protected  void setState(ClientGxSessionState newState)
           
protected  void setState(ClientGxSessionState newState, boolean release)
           
protected  void startTx(GxCreditControlRequest request)
           
protected  void stopTx()
           
 void timeoutExpired(Request request)
           
 
Methods inherited from class org.jdiameter.common.impl.app.gx.AppGxSessionImpl
addStateChangeNotification, removeStateChangeNotification
 
Methods inherited from class org.jdiameter.common.impl.app.AppSessionImpl
getCreationTime, getLastAccessedTime, getSessionAppId, getSessionId, getSessions, 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 IClientGxSessionData sessionData

sendAndStateLock

protected java.util.concurrent.locks.Lock sendAndStateLock

factory

protected IGxMessageFactory factory

listener

protected ClientGxSessionListener listener

context

protected IClientGxSessionContext context

parser

protected 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

ClientGxSessionImpl

public ClientGxSessionImpl(IClientGxSessionData sessionData,
                           IGxMessageFactory fct,
                           ISessionFactory sf,
                           ClientGxSessionListener lst,
                           IClientGxSessionContext ctx,
                           StateChangeListener<AppSession> stLst)
Method Detail

getLocalCCFH

protected int getLocalCCFH()

getLocalDDFH

protected int getLocalDDFH()

sendCreditControlRequest

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

sendGxReAuthAnswer

public void sendGxReAuthAnswer(GxReAuthAnswer answer)
                        throws InternalException,
                               IllegalDiameterStateException,
                               RouteException,
                               OverloadException
Specified by:
sendGxReAuthAnswer in interface ClientGxSession
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(GxCreditControlRequest request)

stopTx

protected void stopTx()

onTimer

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

setState

protected void setState(ClientGxSessionState newState)

setState

protected void setState(ClientGxSessionState newState,
                        boolean release)

release

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

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(GxCreditControlAnswer event,
                                    GxCreditControlRequest 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 ;]


deliverGxAnswer

protected void deliverGxAnswer(GxCreditControlRequest request,
                               GxCreditControlAnswer answer)

extractFHAVPs

protected void extractFHAVPs(GxCreditControlRequest request,
                             GxCreditControlAnswer answer)
                      throws AvpDataException
Throws:
AvpDataException

deliverRAR

protected void deliverRAR(GxReAuthRequest 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

hashCode

public int hashCode()
Overrides:
hashCode in class AppSessionImpl

equals

public boolean equals(java.lang.Object obj)
Overrides:
equals in class AppSessionImpl


Copyright © 2014. All Rights Reserved.