org.mobicents.slee.resource.diameter.sh.server
Class DiameterShServerResourceAdaptor

java.lang.Object
  extended by org.mobicents.slee.resource.diameter.sh.server.DiameterShServerResourceAdaptor
All Implemented Interfaces:
java.io.Serializable, javax.slee.resource.ResourceAdaptor, org.jdiameter.api.EventListener<org.jdiameter.api.Request,org.jdiameter.api.Answer>, org.jdiameter.api.NetworkReqListener, org.mobicents.diameter.stack.DiameterListener, ShServerSessionListener

public class DiameterShServerResourceAdaptor
extends java.lang.Object
implements javax.slee.resource.ResourceAdaptor, org.mobicents.diameter.stack.DiameterListener, ShServerSessionListener

Start time:17:53:55 2009-01-06
Project: mobicents-diameter-parent

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

Field Summary
static java.util.Map<java.lang.Integer,java.lang.String> events
           
 
Fields inherited from interface javax.slee.resource.ResourceAdaptor
SBB_PROCESSED_EVENT
 
Fields inherited from interface org.mobicents.slee.resource.diameter.sh.server.handlers.ShServerSessionListener
_ErrorAnswer, _ExtensionDiameterMessage, _ProfileUpdateRequest, _PushNotificationAnswer, _SubscribeNotificationsRequest, _UserDataRequest
 
Constructor Summary
DiameterShServerResourceAdaptor()
           
 
Method Summary
 void activityEnded(javax.slee.resource.ActivityHandle handle)
          implements javax.slee.resource.ResourceAdaptor Please refer to JSLEE v1.1 Specification Page 301 for further information.
 void activityUnreferenced(javax.slee.resource.ActivityHandle handle)
          implements javax.slee.resource.ResourceAdaptor Please refer to JSLEE v1.1 Specification Page 301 for further information.
 net.java.slee.resource.diameter.base.events.DiameterMessage createEvent(org.jdiameter.api.Request request, org.jdiameter.api.Answer answer)
          Create Event object from request/answer
 void entityActivated()
          implements javax.slee.resource.ResourceAdaptor The JSLEE v1.1 Specification does not include entityActivated().
 void entityCreated(javax.slee.resource.BootstrapContext bootstrapContext)
          implements javax.slee.resource.ResourceAdaptor Please refer to JSLEE v1.1 Specification Page 298 for further information.
 void entityDeactivated()
          implements javax.slee.resource.ResourceAdaptor The JSLEE v1.1 Specification does not include entityDeactivated().
 void entityDeactivating()
          This method is called in context of project Mobicents in context of resource adaptor deactivation.
 void entityRemoved()
          implements javax.slee.resource.ResourceAdaptor Please refer to JSLEE v1.1 Specification Page 299 for further information.
 void eventProcessingFailed(javax.slee.resource.ActivityHandle handle, java.lang.Object event, int eventID, javax.slee.Address address, int flags, javax.slee.resource.FailureReason reason)
          implements javax.slee.resource.ResourceAdaptor Please refer to JSLEE v1.1 Specification Page 300 for further information.
 void eventProcessingSuccessful(javax.slee.resource.ActivityHandle handle, java.lang.Object event, int eventID, javax.slee.Address address, int flags)
          implements javax.slee.resource.ResourceAdaptor Please refer to JSLEE v1.1 Specification Page 300 for further information.
 void fireEvent(javax.slee.resource.ActivityHandle handle, java.lang.String name, org.jdiameter.api.Request request, org.jdiameter.api.Answer answer)
          Method for firing event to SLEE
 void fireEvent(java.lang.String sessionId, java.lang.String name, org.jdiameter.api.Request request, org.jdiameter.api.Answer answer)
          Helper method to fire events to SLEE.
 java.lang.Object getActivity(javax.slee.resource.ActivityHandle handle)
           
 javax.slee.resource.ActivityHandle getActivityHandle(java.lang.Object activity)
           
protected  org.mobicents.slee.resource.diameter.base.DiameterActivityHandle getActivityHandle(java.lang.String sessionId)
           
 net.java.slee.resource.diameter.base.events.avp.DiameterIdentity[] getConnectedPeers()
          Method for obtaining the Peers the RA is currently conneceted to.
 javax.slee.resource.Marshaler getMarshaler()
           
 java.lang.Object getSBBResourceAdaptorInterface(java.lang.String className)
           
 org.jdiameter.api.Answer processRequest(org.jdiameter.api.Request request)
           
 void queryLiveness(javax.slee.resource.ActivityHandle handle)
           
 void receivedSuccessMessage(org.jdiameter.api.Request req, org.jdiameter.api.Answer ans)
           
 void serviceActivated(java.lang.String serviceKey)
           
 void serviceDeactivated(java.lang.String serviceKey)
           
 void serviceInstalled(java.lang.String serviceKey, int[] eventIDs, java.lang.String[] resourceOptions)
           
 void serviceUninstalled(java.lang.String serviceKey)
           
 void sessionCreated(org.jdiameter.api.sh.ServerShSession session, boolean isSubscription)
          Listener for Server Session creation.
 void sessionDestroyed(java.lang.String sessionId, org.jdiameter.api.sh.ClientShSession session)
           
 void sessionDestroyed(java.lang.String sessionId, java.lang.Object appSession)
           
 void sessionDestroyed(java.lang.String sessionId, org.jdiameter.api.sh.ServerShSession session)
           
 boolean sessionExists(java.lang.String sessionId)
           
 void timeoutExpired(org.jdiameter.api.Request req)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

events

public static final java.util.Map<java.lang.Integer,java.lang.String> events
Constructor Detail

DiameterShServerResourceAdaptor

public DiameterShServerResourceAdaptor()
Method Detail

activityEnded

public void activityEnded(javax.slee.resource.ActivityHandle handle)
implements javax.slee.resource.ResourceAdaptor Please refer to JSLEE v1.1 Specification Page 301 for further information.
The SLEE calls this method to inform the resource adaptor that the SLEE has completed activity end processing for the activity represented by the activity handle. The resource adaptor should release any resource related to this activity as the SLEE will not ask for it again.

Specified by:
activityEnded in interface javax.slee.resource.ResourceAdaptor

activityUnreferenced

public void activityUnreferenced(javax.slee.resource.ActivityHandle handle)
implements javax.slee.resource.ResourceAdaptor Please refer to JSLEE v1.1 Specification Page 301 for further information.
The SLEE calls this method to inform the resource adaptor that the activity’s Activity Context object is no longer attached to any SBB entities and is no longer referenced by any SLEE Facilities. This enables the resource adaptor to implicitly end the Activity object.

Specified by:
activityUnreferenced in interface javax.slee.resource.ResourceAdaptor

entityActivated

public void entityActivated()
                     throws javax.slee.resource.ResourceException
implements javax.slee.resource.ResourceAdaptor The JSLEE v1.1 Specification does not include entityActivated(). However, the API description of JSLEE v1.1 does include this method already. So, the documentation follows the code.
This method is called in context of project Mobicents in context of resource adaptor activation. More precisely, org.mobicents.slee.resource.ResourceAdaptorEntity.activate() calls this method entityActivated(). This method signals the resource adaptor the transition from state "INACTIVE" to state "ACTIVE".

Specified by:
entityActivated in interface javax.slee.resource.ResourceAdaptor
Throws:
javax.slee.resource.ResourceException

entityCreated

public void entityCreated(javax.slee.resource.BootstrapContext bootstrapContext)
                   throws javax.slee.resource.ResourceException
implements javax.slee.resource.ResourceAdaptor Please refer to JSLEE v1.1 Specification Page 298 for further information.
This method is called by the SLEE when a resource adaptor object instance is bootstrapped, either when a resource adaptor entity is created or during SLEE startup. The SLEE implementation will construct the resource adaptor object and then invoke the entityCreated method before any other operations can be invoked on the resource adaptor object.

Specified by:
entityCreated in interface javax.slee.resource.ResourceAdaptor
Throws:
javax.slee.resource.ResourceException

entityDeactivated

public void entityDeactivated()
implements javax.slee.resource.ResourceAdaptor The JSLEE v1.1 Specification does not include entityDeactivated(). However, the API description of JSLEE v1.1 does include this method already. So, the documentation follows the code.
This method is called in context of project Mobicents in context of resource adaptor deactivation. More precisely, org.mobicents.slee.resource.ResourceAdaptorEntity.deactivate() calls this method entityDeactivated(). The method call is done AFTER the call to entityDeactivating(). This method signals the resource adaptor the transition from state "STOPPING" to state "INACTIVE".

Specified by:
entityDeactivated in interface javax.slee.resource.ResourceAdaptor

entityDeactivating

public void entityDeactivating()
This method is called in context of project Mobicents in context of resource adaptor deactivation. More precisely, org.mobicents.slee.resource.ResourceAdaptorEntity.deactivate() calls this method entityDeactivating() PRIOR to invoking entityDeactivated(). This method signals the resource adaptor the transition from state "ACTIVE" to state "STOPPING".

Specified by:
entityDeactivating in interface javax.slee.resource.ResourceAdaptor

entityRemoved

public void entityRemoved()
implements javax.slee.resource.ResourceAdaptor Please refer to JSLEE v1.1 Specification Page 299 for further information.
This method is called by the SLEE when a resource adaptor object instance is being removed, either when a resource adaptor entity is deleted or during SLEE shutdown. When receiving this invocation the resource adaptor object is expected to close any system resources it has allocated.

Specified by:
entityRemoved in interface javax.slee.resource.ResourceAdaptor

eventProcessingFailed

public void eventProcessingFailed(javax.slee.resource.ActivityHandle handle,
                                  java.lang.Object event,
                                  int eventID,
                                  javax.slee.Address address,
                                  int flags,
                                  javax.slee.resource.FailureReason reason)
implements javax.slee.resource.ResourceAdaptor Please refer to JSLEE v1.1 Specification Page 300 for further information.
The SLEE calls this method to inform the resource adaptor object that the specified event was processed unsuccessfully by the SLEE. Event processing can fail if, for example, the SLEE doesn’t have enough resource to process the event, a SLEE node fails during event processing or a system level failure prevents the SLEE from committing transactions.

Specified by:
eventProcessingFailed in interface javax.slee.resource.ResourceAdaptor

eventProcessingSuccessful

public void eventProcessingSuccessful(javax.slee.resource.ActivityHandle handle,
                                      java.lang.Object event,
                                      int eventID,
                                      javax.slee.Address address,
                                      int flags)
implements javax.slee.resource.ResourceAdaptor Please refer to JSLEE v1.1 Specification Page 300 for further information.
The SLEE calls this method to inform the resource adaptor object that the specified event was processed successfully by the SLEE. An event is considered to be processed successfully if the SLEE has attempted to deliver the event to all interested SBBs.

Specified by:
eventProcessingSuccessful in interface javax.slee.resource.ResourceAdaptor

getActivity

public java.lang.Object getActivity(javax.slee.resource.ActivityHandle handle)
Specified by:
getActivity in interface javax.slee.resource.ResourceAdaptor

getActivityHandle

public javax.slee.resource.ActivityHandle getActivityHandle(java.lang.Object activity)
Specified by:
getActivityHandle in interface javax.slee.resource.ResourceAdaptor

getMarshaler

public javax.slee.resource.Marshaler getMarshaler()
Specified by:
getMarshaler in interface javax.slee.resource.ResourceAdaptor

getSBBResourceAdaptorInterface

public java.lang.Object getSBBResourceAdaptorInterface(java.lang.String className)
Specified by:
getSBBResourceAdaptorInterface in interface javax.slee.resource.ResourceAdaptor

processRequest

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

receivedSuccessMessage

public void receivedSuccessMessage(org.jdiameter.api.Request req,
                                   org.jdiameter.api.Answer ans)
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 req)
Specified by:
timeoutExpired in interface org.jdiameter.api.EventListener<org.jdiameter.api.Request,org.jdiameter.api.Answer>

getConnectedPeers

public net.java.slee.resource.diameter.base.events.avp.DiameterIdentity[] getConnectedPeers()
Method for obtaining the Peers the RA is currently conneceted to.

Returns:
an array of DiameterIdentity AVPs representing the peers.

fireEvent

public void fireEvent(javax.slee.resource.ActivityHandle handle,
                      java.lang.String name,
                      org.jdiameter.api.Request request,
                      org.jdiameter.api.Answer answer)
Method for firing event to SLEE

Specified by:
fireEvent in interface ShServerSessionListener
Parameters:
handle - the handle for the activity where event will be fired on
name - the unqualified Event name
request - the request that will be wrapped in the event, if any
answer - the answer that will be wrapped in the event, if any

createEvent

public net.java.slee.resource.diameter.base.events.DiameterMessage createEvent(org.jdiameter.api.Request request,
                                                                               org.jdiameter.api.Answer answer)
                                                                        throws javax.naming.OperationNotSupportedException
Create Event object from request/answer

Parameters:
request - the request to create the event from, if any.
answer - the answer to create the event from, if any.
Returns:
a DiameterMessage object wrapping the request/answer
Throws:
javax.naming.OperationNotSupportedException

queryLiveness

public void queryLiveness(javax.slee.resource.ActivityHandle handle)
Specified by:
queryLiveness in interface javax.slee.resource.ResourceAdaptor

serviceActivated

public void serviceActivated(java.lang.String serviceKey)
Specified by:
serviceActivated in interface javax.slee.resource.ResourceAdaptor

serviceDeactivated

public void serviceDeactivated(java.lang.String serviceKey)
Specified by:
serviceDeactivated in interface javax.slee.resource.ResourceAdaptor

serviceInstalled

public void serviceInstalled(java.lang.String serviceKey,
                             int[] eventIDs,
                             java.lang.String[] resourceOptions)
Specified by:
serviceInstalled in interface javax.slee.resource.ResourceAdaptor

serviceUninstalled

public void serviceUninstalled(java.lang.String serviceKey)
Specified by:
serviceUninstalled in interface javax.slee.resource.ResourceAdaptor

sessionDestroyed

public void sessionDestroyed(java.lang.String sessionId,
                             org.jdiameter.api.sh.ClientShSession session)

getActivityHandle

protected org.mobicents.slee.resource.diameter.base.DiameterActivityHandle getActivityHandle(java.lang.String sessionId)

sessionCreated

public void sessionCreated(org.jdiameter.api.sh.ServerShSession session,
                           boolean isSubscription)
Description copied from interface: ShServerSessionListener
Listener for Server Session creation.

Specified by:
sessionCreated in interface ShServerSessionListener

sessionDestroyed

public void sessionDestroyed(java.lang.String sessionId,
                             org.jdiameter.api.sh.ServerShSession session)
Specified by:
sessionDestroyed in interface ShServerSessionListener

sessionExists

public boolean sessionExists(java.lang.String sessionId)

sessionDestroyed

public void sessionDestroyed(java.lang.String sessionId,
                             java.lang.Object appSession)

fireEvent

public void fireEvent(java.lang.String sessionId,
                      java.lang.String name,
                      org.jdiameter.api.Request request,
                      org.jdiameter.api.Answer answer)
Description copied from interface: ShServerSessionListener
Helper method to fire events to SLEE.

Specified by:
fireEvent in interface ShServerSessionListener
Parameters:
sessionId - the id of the session for this event
name - the event name (without suffix Request/Answer)
request - the request object (if it is a request)
answer - the answer object (if it is a answer)


Copyright © 2009. All Rights Reserved.