org.mobicents.slee.resource.diameter.base
Class DiameterBaseResourceAdaptor

java.lang.Object
  extended by org.mobicents.slee.resource.diameter.base.DiameterBaseResourceAdaptor
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, RADiameterListener

public class DiameterBaseResourceAdaptor
extends java.lang.Object
implements javax.slee.resource.ResourceAdaptor, RADiameterListener

Diameter Resource Adaptor
Super project: mobicents
1:20:00 AM May 9, 2008

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

Field Summary
 
Fields inherited from interface javax.slee.resource.ResourceAdaptor
SBB_PROCESSED_EVENT
 
Constructor Summary
DiameterBaseResourceAdaptor()
           
 
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.
 java.lang.Object getActivity(javax.slee.resource.ActivityHandle handle)
          implements javax.slee.resource.ResourceAdaptor Please refer to JSLEE v1.1 Specification Page 301 for further information.
 javax.slee.resource.ActivityHandle getActivityHandle(java.lang.Object activity)
          implements javax.slee.resource.ResourceAdaptor Please refer to JSLEE v1.1 Specification Page 301 for further information.
 net.java.slee.resource.diameter.base.events.avp.DiameterIdentityAvp[] getConnectedPeers()
          Method for obtaining the Peers the RA is currently conneceted to.
 javax.slee.resource.Marshaler getMarshaler()
          implements javax.slee.resource.ResourceAdaptor Please refer to JSLEE v1.1 Specification Page 302 for further information.
 java.lang.Object getSBBResourceAdaptorInterface(java.lang.String className)
          implements javax.slee.resource.ResourceAdaptor Please refer to JSLEE v1.1 Specification Page 302 for further information.
 org.jdiameter.api.Answer processRequest(org.jdiameter.api.Request request)
          RA Entry Point
 void queryLiveness(javax.slee.resource.ActivityHandle handle)
          implements javax.slee.resource.ResourceAdaptor Please refer to JSLEE v1.1 Specification Page 301 for further information.
 void receivedSuccessMessage(org.jdiameter.api.Request req, org.jdiameter.api.Answer ans)
           
 void serviceActivated(java.lang.String serviceKey)
          implements javax.slee.resource.ResourceAdaptor Please refer to JSLEE v1.1 Specification Page 303 for further information.
 void serviceDeactivated(java.lang.String serviceKey)
          implements javax.slee.resource.ResourceAdaptor Please refer to JSLEE v1.1 Specification Page 304 for further information.
 void serviceInstalled(java.lang.String serviceKey, int[] eventIDs, java.lang.String[] resourceOptions)
          implements javax.slee.resource.ResourceAdaptor Please refer to JSLEE v1.1 Specification Page 302 for further information.
 void serviceUninstalled(java.lang.String serviceKey)
          implements javax.slee.resource.ResourceAdaptor Please refer to JSLEE v1.1 Specification Page 303 for further information.
 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
 

Constructor Detail

DiameterBaseResourceAdaptor

public DiameterBaseResourceAdaptor()
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)
implements javax.slee.resource.ResourceAdaptor Please refer to JSLEE v1.1 Specification Page 301 for further information.
The SLEE calls this method to get access to the underlying activity for an activity handle. The resource adaptor is expected to pass back a non-null object.

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

getActivityHandle

public javax.slee.resource.ActivityHandle getActivityHandle(java.lang.Object activity)
implements javax.slee.resource.ResourceAdaptor Please refer to JSLEE v1.1 Specification Page 301 for further information.
The SLEE calls this method to get an activity handle for an activity created by the underlying resource. This method is invoked by the SLEE when it needs to construct an activity context for an activity via an activity context interface factory method invoked by an SBB.

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

getMarshaler

public javax.slee.resource.Marshaler getMarshaler()
implements javax.slee.resource.ResourceAdaptor Please refer to JSLEE v1.1 Specification Page 302 for further information.
The SLEE calls this method to get reference to the Marshaler object. The resource adaptor implements the Marshaler interface. The Marshaler is used by the SLEE to convert between object and distributable forms of events and event handles.

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

getSBBResourceAdaptorInterface

public java.lang.Object getSBBResourceAdaptorInterface(java.lang.String className)
implements javax.slee.resource.ResourceAdaptor Please refer to JSLEE v1.1 Specification Page 302 for further information.
The SLEE calls this method to get access to the underlying resource adaptor interface that enables the SBB to invoke the resource adaptor, to send messages for example.

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

queryLiveness

public void queryLiveness(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 query if a specific activity belonging to this resource adaptor object is alive.

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

serviceActivated

public void serviceActivated(java.lang.String serviceKey)
implements javax.slee.resource.ResourceAdaptor Please refer to JSLEE v1.1 Specification Page 303 for further information.
The SLEE calls this method to inform the resource adaptor that a service has been activated and is interested in the event types associated to the service key. The service must be installed with the resource adaptor via the serviceInstalled method before it can be activated.

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

serviceDeactivated

public void serviceDeactivated(java.lang.String serviceKey)
implements javax.slee.resource.ResourceAdaptor Please refer to JSLEE v1.1 Specification Page 304 for further information.
The SLEE calls this method to inform the SLEE that a service has been deactivated and is no longer interested in the event types associated to the service key.

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

serviceInstalled

public void serviceInstalled(java.lang.String serviceKey,
                             int[] eventIDs,
                             java.lang.String[] resourceOptions)
implements javax.slee.resource.ResourceAdaptor Please refer to JSLEE v1.1 Specification Page 302 for further information.
The SLEE calls this method to signify to the resource adaptor that a service has been installed and is interested in a specific set of events. The SLEE passes an event filter which identifies a set of event types that services in the SLEE are interested in. The SLEE calls this method once a service is installed.

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

serviceUninstalled

public void serviceUninstalled(java.lang.String serviceKey)
implements javax.slee.resource.ResourceAdaptor Please refer to JSLEE v1.1 Specification Page 303 for further information.
The SLEE calls this method to signify that a service has been un-installed in the SLEE. The event types associated to the service key are no longer of interest to a particular application.

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

processRequest

public org.jdiameter.api.Answer processRequest(org.jdiameter.api.Request request)
RA Entry Point

Specified by:
processRequest in interface org.jdiameter.api.NetworkReqListener

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

getConnectedPeers

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

Returns:
an array of DiameterIdentity AVPs representing the peers.

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>


Copyright © 2008. All Rights Reserved.