org.jdiameter.server.impl.app.sh
Class ShServerSessionImpl

java.lang.Object
  extended by org.jdiameter.common.impl.app.AppSessionImpl
      extended by org.jdiameter.common.impl.app.sh.ShSession
          extended by org.jdiameter.server.impl.app.sh.ShServerSessionImpl
All Implemented Interfaces:
AppSession, StateMachine, BaseSession, EventListener<Request,Answer>, NetworkReqListener, ServerShSession

public class ShServerSessionImpl
extends ShSession
implements ServerShSession, EventListener<Request,Answer>, NetworkReqListener

Basic implementation of ShServerSession - can be one time - for UDR, PUR and constant for SNR-PNR pair, in case when SNA contains response code from range different than 2001-2004(success codes) user is responsible for maintaing state - releasing etc, same goes if result code is contained Experimental-Result AVP
If ShSession moves to ShSessionState.TERMINATED - it means that no further messages can be received via it and it should be discarded.

Author:
Bartosz Baranowski , Alexandre Mendonca

Field Summary
protected  long appId
           
protected  IShMessageFactory factory
           
protected  ServerShSessionListener listener
           
protected  java.util.concurrent.locks.Lock sendAndStateLock
           
protected  IShServerSessionData sessionData
           
 
Fields inherited from class org.jdiameter.common.impl.app.sh.ShSession
stateListeners
 
Fields inherited from class org.jdiameter.common.impl.app.AppSessionImpl
appSessionData, scheduler, session, sessions, sf, timerFacility
 
Constructor Summary
ShServerSessionImpl(IShServerSessionData sessionData, IShMessageFactory fct, ISessionFactory sf, ServerShSessionListener lst)
           
 
Method Summary
protected  void dispatchEvent(AppEvent event)
           
 boolean equals(java.lang.Object obj)
           
protected  long extractExpiryTime(Message answer)
           
<E> E
getState(java.lang.Class<E> stateType)
           
 boolean handleEvent(StateEvent event)
           
 int hashCode()
           
 boolean isReplicable()
           
 boolean isStateless()
           
 void onTimer(java.lang.String timerName)
           
 Answer processRequest(Request request)
           
 void receivedSuccessMessage(Request request, Answer answer)
           
 void release()
           
protected  void send(org.jdiameter.server.impl.app.sh.Event.Type type, AppEvent request, AppEvent answer)
           
 void sendProfileUpdateAnswer(ProfileUpdateAnswer answer)
           
 void sendPushNotificationRequest(PushNotificationRequest request)
           
 void sendSubscribeNotificationsAnswer(SubscribeNotificationsAnswer answer)
           
 void sendUserDataAnswer(UserDataAnswer answer)
           
 void timeoutExpired(Request request)
           
 
Methods inherited from class org.jdiameter.common.impl.app.sh.ShSession
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 IShMessageFactory factory

listener

protected transient ServerShSessionListener listener

sessionData

protected IShServerSessionData sessionData

appId

protected long appId
Constructor Detail

ShServerSessionImpl

public ShServerSessionImpl(IShServerSessionData sessionData,
                           IShMessageFactory fct,
                           ISessionFactory sf,
                           ServerShSessionListener lst)
Method Detail

sendProfileUpdateAnswer

public void sendProfileUpdateAnswer(ProfileUpdateAnswer answer)
                             throws InternalException,
                                    IllegalDiameterStateException,
                                    RouteException,
                                    OverloadException
Specified by:
sendProfileUpdateAnswer in interface ServerShSession
Throws:
InternalException
IllegalDiameterStateException
RouteException
OverloadException

sendPushNotificationRequest

public void sendPushNotificationRequest(PushNotificationRequest request)
                                 throws InternalException,
                                        IllegalDiameterStateException,
                                        RouteException,
                                        OverloadException
Specified by:
sendPushNotificationRequest in interface ServerShSession
Throws:
InternalException
IllegalDiameterStateException
RouteException
OverloadException

sendSubscribeNotificationsAnswer

public void sendSubscribeNotificationsAnswer(SubscribeNotificationsAnswer answer)
                                      throws InternalException,
                                             IllegalDiameterStateException,
                                             RouteException,
                                             OverloadException
Specified by:
sendSubscribeNotificationsAnswer in interface ServerShSession
Throws:
InternalException
IllegalDiameterStateException
RouteException
OverloadException

sendUserDataAnswer

public void sendUserDataAnswer(UserDataAnswer answer)
                        throws InternalException,
                               IllegalDiameterStateException,
                               RouteException,
                               OverloadException
Specified by:
sendUserDataAnswer in interface ServerShSession
Throws:
InternalException
IllegalDiameterStateException
RouteException
OverloadException

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>

processRequest

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

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

isStateless

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

send

protected void send(org.jdiameter.server.impl.app.sh.Event.Type type,
                    AppEvent request,
                    AppEvent answer)
             throws InternalException
Throws:
InternalException

dispatchEvent

protected void dispatchEvent(AppEvent event)
                      throws InternalException
Throws:
InternalException

release

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

extractExpiryTime

protected long extractExpiryTime(Message answer)

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.