org.jdiameter.client.impl.app.rx
Class ClientRxSessionImpl

java.lang.Object
  extended by org.jdiameter.common.impl.app.AppSessionImpl
      extended by org.jdiameter.common.impl.app.rx.AppRxSessionImpl
          extended by org.jdiameter.client.impl.app.rx.ClientRxSessionImpl
All Implemented Interfaces:
AppSession, StateMachine, BaseSession, EventListener<Request,Answer>, NetworkReqListener, ClientRxSession

public class ClientRxSessionImpl
extends AppRxSessionImpl
implements ClientRxSession, NetworkReqListener, EventListener<Request,Answer>

3GPP IMS Rx Reference Point Client Session implementation

Author:
Richard Good , Alexandre Mendonca , Bartosz Baranowski

Field Summary
protected  long[] authAppIds
           
protected  byte[] buffer
           
protected  IClientRxSessionContext context
           
protected  java.util.ArrayList<Event> eventQueue
           
protected  IRxMessageFactory factory
           
protected  boolean isEventBased
           
protected  ClientRxSessionListener listener
           
protected  java.lang.String originHost
           
protected  java.lang.String originRealm
           
protected  IMessageParser parser
           
protected  java.util.concurrent.locks.Lock sendAndStateLock
           
protected  IClientRxSessionData sessionData
           
protected static java.util.Set<java.lang.Long> temporaryErrorCodes
           
 
Fields inherited from class org.jdiameter.common.impl.app.rx.AppRxSessionImpl
stateListeners
 
Fields inherited from class org.jdiameter.common.impl.app.AppSessionImpl
appSessionData, scheduler, session, sessions, sf, timerFacility
 
Constructor Summary
ClientRxSessionImpl(IClientRxSessionData sessionData, IRxMessageFactory fct, ISessionFactory sf, ClientRxSessionListener lst, IClientRxSessionContext ctx, StateChangeListener<AppSession> stLst)
           
 
Method Summary
protected  void deliverAbortSessionRequest(RxAbortSessionRequest request)
           
protected  void deliverReAuthRequest(RxReAuthRequest request)
           
protected  void deliverRxAAAnswer(RxAARequest request, RxAAAnswer answer)
           
protected  void deliverRxSessionTermAnswer(RxSessionTermRequest request, RxSessionTermAnswer 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)
           
 boolean equals(java.lang.Object obj)
           
<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(AppAnswerEvent event, AppRequestEvent request, Event.Type eventType)
           
protected  void handleSendFailure(java.lang.Exception e, Event.Type eventType, Message request)
           
 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 sendAARequest(RxAARequest request)
           
 void sendAbortSessionAnswer(RxAbortSessionAnswer answer)
           
 void sendReAuthAnswer(RxReAuthAnswer answer)
           
 void sendSessionTermRequest(RxSessionTermRequest request)
           
protected  void setState(ClientRxSessionState newState)
           
protected  void setState(ClientRxSessionState newState, boolean release)
           
 void timeoutExpired(Request request)
           
 
Methods inherited from class org.jdiameter.common.impl.app.rx.AppRxSessionImpl
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

sendAndStateLock

protected java.util.concurrent.locks.Lock sendAndStateLock

factory

protected transient IRxMessageFactory factory

listener

protected transient ClientRxSessionListener listener

context

protected transient IClientRxSessionContext context

parser

protected transient IMessageParser parser

sessionData

protected IClientRxSessionData sessionData

authAppIds

protected long[] authAppIds

isEventBased

protected boolean isEventBased

buffer

protected byte[] buffer

originHost

protected java.lang.String originHost

originRealm

protected java.lang.String originRealm

temporaryErrorCodes

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

eventQueue

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

ClientRxSessionImpl

public ClientRxSessionImpl(IClientRxSessionData sessionData,
                           IRxMessageFactory fct,
                           ISessionFactory sf,
                           ClientRxSessionListener lst,
                           IClientRxSessionContext ctx,
                           StateChangeListener<AppSession> stLst)
Method Detail

sendAARequest

public void sendAARequest(RxAARequest request)
                   throws InternalException,
                          IllegalDiameterStateException,
                          RouteException,
                          OverloadException
Specified by:
sendAARequest in interface ClientRxSession
Throws:
InternalException
IllegalDiameterStateException
RouteException
OverloadException

sendSessionTermRequest

public void sendSessionTermRequest(RxSessionTermRequest request)
                            throws InternalException,
                                   IllegalDiameterStateException,
                                   RouteException,
                                   OverloadException
Specified by:
sendSessionTermRequest in interface ClientRxSession
Throws:
InternalException
IllegalDiameterStateException
RouteException
OverloadException

sendReAuthAnswer

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

sendAbortSessionAnswer

public void sendAbortSessionAnswer(RxAbortSessionAnswer answer)
                            throws InternalException,
                                   IllegalDiameterStateException,
                                   RouteException,
                                   OverloadException
Specified by:
sendAbortSessionAnswer in interface ClientRxSession
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>

setState

protected void setState(ClientRxSessionState newState)

setState

protected void setState(ClientRxSessionState newState,
                        boolean release)

release

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

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(AppAnswerEvent event,
                                    AppRequestEvent request,
                                    Event.Type eventType)

dispatch

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


deliverRxAAAnswer

protected void deliverRxAAAnswer(RxAARequest request,
                                 RxAAAnswer answer)

deliverRxSessionTermAnswer

protected void deliverRxSessionTermAnswer(RxSessionTermRequest request,
                                          RxSessionTermAnswer answer)

deliverReAuthRequest

protected void deliverReAuthRequest(RxReAuthRequest request)

deliverAbortSessionRequest

protected void deliverAbortSessionRequest(RxAbortSessionRequest 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

onTimer

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


Copyright © 2014. All Rights Reserved.