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:
java.io.Serializable, org.jdiameter.api.app.AppSession, org.jdiameter.api.app.StateMachine, org.jdiameter.api.EventListener<org.jdiameter.api.Request,org.jdiameter.api.Answer>, org.jdiameter.api.NetworkReqListener, org.jdiameter.api.sh.ServerShSession

public class ShServerSessionImpl
extends ShSession
implements org.jdiameter.api.sh.ServerShSession, org.jdiameter.api.EventListener<org.jdiameter.api.Request,org.jdiameter.api.Answer>, org.jdiameter.api.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.

Super project: mobicents-jainslee-server
10:53:02 2008-09-05

Author:
baranowb - Bartosz Baranowski , Alexandre Mendonca
See Also:
Serialized Form

Field Summary
protected  long appId
           
protected  java.lang.String destHost
           
protected  java.lang.String destRealm
           
protected  IShMessageFactory factory
           
protected  org.jdiameter.api.sh.ServerShSessionListener listener
           
protected  java.util.concurrent.locks.Lock sendAndStateLock
           
protected  java.util.concurrent.ScheduledFuture sft
           
protected  ShSessionState state
           
protected  boolean stateless
           
 
Fields inherited from class org.jdiameter.common.impl.app.sh.ShSession
scheduler, stateListeners
 
Fields inherited from class org.jdiameter.common.impl.app.AppSessionImpl
logger, session
 
Constructor Summary
ShServerSessionImpl(IShMessageFactory fct, org.jdiameter.api.SessionFactory sf, org.jdiameter.api.sh.ServerShSessionListener lst)
           
ShServerSessionImpl(java.lang.String sessionId, IShMessageFactory fct, org.jdiameter.api.SessionFactory sf, org.jdiameter.api.sh.ServerShSessionListener lst)
           
 
Method Summary
protected  ShSessionState doSNX(org.jdiameter.api.app.AppEvent answer)
           
protected  long extractExpirationTime(org.jdiameter.api.Message answer)
           
<E> E
getState(java.lang.Class<E> stateType)
           
 boolean handleEvent(org.jdiameter.api.app.StateEvent event)
           
 boolean isStateless()
           
 org.jdiameter.api.Answer processRequest(org.jdiameter.api.Request request)
           
 void receivedSuccessMessage(org.jdiameter.api.Request request, org.jdiameter.api.Answer answer)
           
 void release()
           
protected  void send(org.jdiameter.server.impl.app.sh.Event.Type type, org.jdiameter.api.app.AppEvent request, org.jdiameter.api.app.AppEvent answer)
           
 void sendProfileUpdateAnswer(org.jdiameter.api.sh.events.ProfileUpdateAnswer answer)
           
 void sendPushNotificationRequest(org.jdiameter.api.sh.events.PushNotificationRequest request)
           
 void sendSubscribeNotificationsAnswer(org.jdiameter.api.sh.events.SubscribeNotificationsAnswer answer)
           
 void sendUserDataAnswer(org.jdiameter.api.sh.events.UserDataAnswer answer)
           
protected  void setState(ShSessionState newState)
           
protected  void setState(ShSessionState newState, boolean release)
           
 void timeoutExpired(org.jdiameter.api.Request request)
           
 
Methods inherited from class org.jdiameter.common.impl.app.sh.ShSession
addStateChangeNotification, createAccountAnswer, createAccountRequest, removeStateChangeNotification
 
Methods inherited from class org.jdiameter.common.impl.app.AppSessionImpl
getCreationTime, getLastAccessedTime, getSessionAppId, getSessions, isValid
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.jdiameter.api.app.AppSession
getCreationTime, getLastAccessedTime, getSessionAppId, getSessions, isValid
 
Methods inherited from interface org.jdiameter.api.app.StateMachine
addStateChangeNotification, removeStateChangeNotification
 

Field Detail

state

protected ShSessionState state

stateless

protected boolean stateless

factory

protected IShMessageFactory factory

destHost

protected java.lang.String destHost

destRealm

protected java.lang.String destRealm

sendAndStateLock

protected java.util.concurrent.locks.Lock sendAndStateLock

listener

protected org.jdiameter.api.sh.ServerShSessionListener listener

appId

protected long appId

sft

protected java.util.concurrent.ScheduledFuture sft
Constructor Detail

ShServerSessionImpl

public ShServerSessionImpl(IShMessageFactory fct,
                           org.jdiameter.api.SessionFactory sf,
                           org.jdiameter.api.sh.ServerShSessionListener lst)

ShServerSessionImpl

public ShServerSessionImpl(java.lang.String sessionId,
                           IShMessageFactory fct,
                           org.jdiameter.api.SessionFactory sf,
                           org.jdiameter.api.sh.ServerShSessionListener lst)
Method Detail

sendProfileUpdateAnswer

public void sendProfileUpdateAnswer(org.jdiameter.api.sh.events.ProfileUpdateAnswer answer)
                             throws org.jdiameter.api.InternalException,
                                    org.jdiameter.api.IllegalDiameterStateException,
                                    org.jdiameter.api.RouteException,
                                    org.jdiameter.api.OverloadException
Specified by:
sendProfileUpdateAnswer in interface org.jdiameter.api.sh.ServerShSession
Throws:
org.jdiameter.api.InternalException
org.jdiameter.api.IllegalDiameterStateException
org.jdiameter.api.RouteException
org.jdiameter.api.OverloadException

sendPushNotificationRequest

public void sendPushNotificationRequest(org.jdiameter.api.sh.events.PushNotificationRequest request)
                                 throws org.jdiameter.api.InternalException,
                                        org.jdiameter.api.IllegalDiameterStateException,
                                        org.jdiameter.api.RouteException,
                                        org.jdiameter.api.OverloadException
Specified by:
sendPushNotificationRequest in interface org.jdiameter.api.sh.ServerShSession
Throws:
org.jdiameter.api.InternalException
org.jdiameter.api.IllegalDiameterStateException
org.jdiameter.api.RouteException
org.jdiameter.api.OverloadException

sendSubscribeNotificationsAnswer

public void sendSubscribeNotificationsAnswer(org.jdiameter.api.sh.events.SubscribeNotificationsAnswer answer)
                                      throws org.jdiameter.api.InternalException,
                                             org.jdiameter.api.IllegalDiameterStateException,
                                             org.jdiameter.api.RouteException,
                                             org.jdiameter.api.OverloadException
Specified by:
sendSubscribeNotificationsAnswer in interface org.jdiameter.api.sh.ServerShSession
Throws:
org.jdiameter.api.InternalException
org.jdiameter.api.IllegalDiameterStateException
org.jdiameter.api.RouteException
org.jdiameter.api.OverloadException

sendUserDataAnswer

public void sendUserDataAnswer(org.jdiameter.api.sh.events.UserDataAnswer answer)
                        throws org.jdiameter.api.InternalException,
                               org.jdiameter.api.IllegalDiameterStateException,
                               org.jdiameter.api.RouteException,
                               org.jdiameter.api.OverloadException
Specified by:
sendUserDataAnswer in interface org.jdiameter.api.sh.ServerShSession
Throws:
org.jdiameter.api.InternalException
org.jdiameter.api.IllegalDiameterStateException
org.jdiameter.api.RouteException
org.jdiameter.api.OverloadException

receivedSuccessMessage

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

timeoutExpired

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

processRequest

public org.jdiameter.api.Answer processRequest(org.jdiameter.api.Request request)
Specified by:
processRequest in interface org.jdiameter.api.NetworkReqListener

getState

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

handleEvent

public boolean handleEvent(org.jdiameter.api.app.StateEvent event)
                    throws org.jdiameter.api.InternalException,
                           org.jdiameter.api.OverloadException
Specified by:
handleEvent in interface org.jdiameter.api.app.StateMachine
Throws:
org.jdiameter.api.InternalException
org.jdiameter.api.OverloadException

isStateless

public boolean isStateless()
Specified by:
isStateless in interface org.jdiameter.api.app.AppSession

send

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

setState

protected void setState(ShSessionState newState)

setState

protected void setState(ShSessionState newState,
                        boolean release)

release

public void release()
Specified by:
release in interface org.jdiameter.api.app.AppSession
Overrides:
release in class ShSession

extractExpirationTime

protected long extractExpirationTime(org.jdiameter.api.Message answer)

doSNX

protected ShSessionState doSNX(org.jdiameter.api.app.AppEvent answer)
                        throws org.jdiameter.api.InternalException
Throws:
org.jdiameter.api.InternalException


Copyright © 2008. All Rights Reserved.