org.jdiameter.client.impl.app.sh
Class ShClientSessionImpl

java.lang.Object
  extended by org.jdiameter.common.impl.app.AppSessionImpl
      extended by org.jdiameter.common.impl.app.sh.ShSession
          extended by org.jdiameter.client.impl.app.sh.ShClientSessionImpl
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.ClientShSession

public class ShClientSessionImpl
extends ShSession
implements org.jdiameter.api.sh.ClientShSession, org.jdiameter.api.EventListener<org.jdiameter.api.Request,org.jdiameter.api.Answer>, org.jdiameter.api.NetworkReqListener

Basic implementation of ShClientSession - 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.ClientShSessionListener 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
ShClientSessionImpl(IShMessageFactory fct, org.jdiameter.api.SessionFactory sf, org.jdiameter.api.sh.ClientShSessionListener lst)
           
ShClientSessionImpl(java.lang.String sessionId, IShMessageFactory fct, org.jdiameter.api.SessionFactory sf, org.jdiameter.api.sh.ClientShSessionListener 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.client.impl.app.sh.Event.Type type, org.jdiameter.api.app.AppEvent request, org.jdiameter.api.app.AppEvent answer)
           
 void sendProfileUpdateRequest(org.jdiameter.api.sh.events.ProfileUpdateRequest request)
           
 void sendPushNotificationAnswer(org.jdiameter.api.sh.events.PushNotificationAnswer answer)
           
 void sendSubscribeNotificationsRequest(org.jdiameter.api.sh.events.SubscribeNotificationsRequest request)
           
 void sendUserDataRequest(org.jdiameter.api.sh.events.UserDataRequest request)
           
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.ClientShSessionListener listener

appId

protected long appId

sft

protected java.util.concurrent.ScheduledFuture sft
Constructor Detail

ShClientSessionImpl

public ShClientSessionImpl(IShMessageFactory fct,
                           org.jdiameter.api.SessionFactory sf,
                           org.jdiameter.api.sh.ClientShSessionListener lst)

ShClientSessionImpl

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

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

doSNX

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

isStateless

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

sendProfileUpdateRequest

public void sendProfileUpdateRequest(org.jdiameter.api.sh.events.ProfileUpdateRequest request)
                              throws org.jdiameter.api.InternalException,
                                     org.jdiameter.api.IllegalDiameterStateException,
                                     org.jdiameter.api.RouteException,
                                     org.jdiameter.api.OverloadException
Specified by:
sendProfileUpdateRequest in interface org.jdiameter.api.sh.ClientShSession
Throws:
org.jdiameter.api.InternalException
org.jdiameter.api.IllegalDiameterStateException
org.jdiameter.api.RouteException
org.jdiameter.api.OverloadException

sendPushNotificationAnswer

public void sendPushNotificationAnswer(org.jdiameter.api.sh.events.PushNotificationAnswer answer)
                                throws org.jdiameter.api.InternalException,
                                       org.jdiameter.api.IllegalDiameterStateException,
                                       org.jdiameter.api.RouteException,
                                       org.jdiameter.api.OverloadException
Specified by:
sendPushNotificationAnswer in interface org.jdiameter.api.sh.ClientShSession
Throws:
org.jdiameter.api.InternalException
org.jdiameter.api.IllegalDiameterStateException
org.jdiameter.api.RouteException
org.jdiameter.api.OverloadException

sendSubscribeNotificationsRequest

public void sendSubscribeNotificationsRequest(org.jdiameter.api.sh.events.SubscribeNotificationsRequest request)
                                       throws org.jdiameter.api.InternalException,
                                              org.jdiameter.api.IllegalDiameterStateException,
                                              org.jdiameter.api.RouteException,
                                              org.jdiameter.api.OverloadException
Specified by:
sendSubscribeNotificationsRequest in interface org.jdiameter.api.sh.ClientShSession
Throws:
org.jdiameter.api.InternalException
org.jdiameter.api.IllegalDiameterStateException
org.jdiameter.api.RouteException
org.jdiameter.api.OverloadException

sendUserDataRequest

public void sendUserDataRequest(org.jdiameter.api.sh.events.UserDataRequest request)
                         throws org.jdiameter.api.InternalException,
                                org.jdiameter.api.IllegalDiameterStateException,
                                org.jdiameter.api.RouteException,
                                org.jdiameter.api.OverloadException
Specified by:
sendUserDataRequest in interface org.jdiameter.api.sh.ClientShSession
Throws:
org.jdiameter.api.InternalException
org.jdiameter.api.IllegalDiameterStateException
org.jdiameter.api.RouteException
org.jdiameter.api.OverloadException

send

protected void send(org.jdiameter.client.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

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>

setState

protected void setState(ShSessionState newState)

setState

protected void setState(ShSessionState newState,
                        boolean release)

extractExpirationTime

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

release

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


Copyright © 2008. All Rights Reserved.