org.mobicents.slee.resource.mgcp.ra
Class MgcpResourceAdaptor

java.lang.Object
  extended by org.mobicents.slee.resource.mgcp.ra.MgcpResourceAdaptor
All Implemented Interfaces:
java.io.Serializable, javax.slee.resource.ResourceAdaptor

public class MgcpResourceAdaptor
extends java.lang.Object
implements javax.slee.resource.ResourceAdaptor, java.io.Serializable

Author:
Oleg Kulikov, eduardomartins
See Also:
Serialized Form

Field Summary
 
Fields inherited from interface javax.slee.resource.ResourceAdaptor
SBB_PROCESSED_EVENT
 
Constructor Summary
MgcpResourceAdaptor()
          Creates a new instance of MgcpResourceAdaptor
 
Method Summary
 void activityEnded(javax.slee.resource.ActivityHandle handle)
          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.
 void activityUnreferenced(javax.slee.resource.ActivityHandle handle)
          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.
protected  void endActivity(javax.slee.resource.ActivityHandle handle)
           
 void entityActivated()
          This method is called by the SLEE to notify a resource adaptor object that the resource adaptor entity is being activated.
 void entityCreated(javax.slee.resource.BootstrapContext bootstrapContext)
          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.
 void entityDeactivated()
          This method is called by the SLEE to notify the resource adaptor object that the SLEE is not aware of any activities owned by the resource adaptor entity and thus is transitioning the resource adaptor entity from the Stopping state to the Inactive state.
 void entityDeactivating()
          The method is called by the SLEE to notify the resource adaptor object that the resource adaptor entity is deactivating.
 void entityRemoved()
          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.
 void eventProcessingFailed(javax.slee.resource.ActivityHandle handle, java.lang.Object event, int eventID, javax.slee.Address address, int flags, javax.slee.resource.FailureReason reason)
          The SLEE calls this method to inform the resource adaptor object that the specified event was processed unsuccessfully by the SLEE.
 void eventProcessingSuccessful(javax.slee.resource.ActivityHandle handle, java.lang.Object event, int eventID, javax.slee.Address address, int flags)
          The SLEE calls this method to inform the resource adaptor object that the specified event was processed successfully by the SLEE.
 java.lang.Object getActivity(javax.slee.resource.ActivityHandle handle)
          The SLEE calls this method to get access to the underlying activity for an activity handle.
 javax.slee.resource.ActivityHandle getActivityHandle(java.lang.Object activity)
          The SLEE calls this method to get an activity handle for an activity created by the underlying resource.
 javax.slee.resource.Marshaler getMarshaler()
          The SLEE calls this method to get reference to the Marshaler object.
 MgcpActivityManager getMgcpActivityManager()
           
 java.lang.Integer getPort()
           
 java.lang.Object getSBBResourceAdaptorInterface(java.lang.String string)
          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.
 javax.slee.resource.SleeEndpoint getSleeEndpoint()
           
 org.mobicents.mgcp.stack.JainMgcpStackImpl getStack()
           
 void processMgcpCommandEvent(jain.protocol.ip.mgcp.JainMgcpCommandEvent event)
          Processes a Command Event object received from a JainMgcpProvider.
 void processMgcpResponseEvent(jain.protocol.ip.mgcp.JainMgcpResponseEvent response, jain.protocol.ip.mgcp.JainMgcpEvent command)
          Processes a Response Event object (acknowledgment to a Command Event object) received from a JainMgcpProvider.
 void processRxTimeout(jain.protocol.ip.mgcp.JainMgcpCommandEvent event)
          Processes a timeout on a received JainMgcpCommandEvent event transaction, to prevent further failures the activity will end.
 void processTxTimeout(jain.protocol.ip.mgcp.JainMgcpCommandEvent event)
          Processes a timeout occurred in a sent JainMgcpCommandEvent event transaction, to prevent further failures the activity will end after the RA fires the TransactionTimeout event.
 void queryLiveness(javax.slee.resource.ActivityHandle handle)
          The SLEE calls this method to query if a specific activity belonging to this resource adaptor object is alive.
 void sendingCreateConnectionResponse(jain.protocol.ip.mgcp.message.CreateConnectionResponse event)
          Indicates the provider will send the specified CreateConnectionResponse event, which contains the ConnectionIdentifier to update the MgcpConnectionActivity related with the Mgcp transaction.
 void serviceActivated(java.lang.String serviceKey)
          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.
 void serviceDeactivated(java.lang.String serviceKey)
          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.
 void serviceInstalled(java.lang.String serviceKey, int[] eventIDs, java.lang.String[] resourceOptions)
          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.
 void serviceUninstalled(java.lang.String serviceKey)
          The SLEE calls this method to signify that a service has been uninstalled in the SLEE.
 void setPort(java.lang.Integer port)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MgcpResourceAdaptor

public MgcpResourceAdaptor()
Creates a new instance of MgcpResourceAdaptor

Method Detail

getPort

public java.lang.Integer getPort()

setPort

public void setPort(java.lang.Integer port)

getMgcpActivityManager

public MgcpActivityManager getMgcpActivityManager()

getStack

public org.mobicents.mgcp.stack.JainMgcpStackImpl getStack()

entityCreated

public void entityCreated(javax.slee.resource.BootstrapContext bootstrapContext)
                   throws javax.slee.resource.ResourceException
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 configuration properties of the resource adaptor entity are set before this method is invoked. The SLEE implementation will construct the resource

Specified by:
entityCreated in interface javax.slee.resource.ResourceAdaptor
Parameters:
bootstrapContext - contains references to the SLEE endpoint and the facilities that may be used by the resource adaptor instance.
Throws:
javax.slee.resource.ResourceException

entityRemoved

public void entityRemoved()
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. The SLEE may garbage collect the resource adaptor object at this time.

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

entityActivated

public void entityActivated()
                     throws javax.slee.resource.ResourceException
This method is called by the SLEE to notify a resource adaptor object that the resource adaptor entity is being activated. Before this method is invoked the SLEE transitions the SleeEndpoint associated with the resource adaptor object to the Active state. This allows the resource adaptor object to fire events to the SLEE for new activities during the entityActivated method invocation. If this method returns successfully, the resource adaptor entity transitions to the Active state.

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

entityDeactivating

public void entityDeactivating()
The method is called by the SLEE to notify the resource adaptor object that the resource adaptor entity is deactivating. On receipt of this invocation the resource adaptor object is expected to perform any internal transitions necessary such that it does not create any new activities. Remove this resource adaptor entity from provider's listeners.

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

entityDeactivated

public void entityDeactivated()
This method is called by the SLEE to notify the resource adaptor object that the SLEE is not aware of any activities owned by the resource adaptor entity and thus is transitioning the resource adaptor entity from the Stopping state to the Inactive state.

Specified by:
entityDeactivated 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)
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. It is not required that the SBB event handler or SBB rolled back transactions commit for event processing to still be successful, unless failure to commit is caused by a system level failure. This method need not be called by the same thread that invoked the fireEvent method for this event.

Specified by:
eventProcessingSuccessful in interface javax.slee.resource.ResourceAdaptor
Parameters:
handle - the activity handle of the activity upon which the event was fired.
event - is the event fired on the activity. This value may be null if no actual event was fired.
eventID - the unique identifier of the event type fired to the SLEE. If the event argument is null, the value of this parameter is undefined.
address - the default address on which the event was fired. If a null default address was specified, this value is also null. If the event argument is null, the value of this parameter is undefined.
flags - the necessary information that enables any post-event processing required by the resource adaptor.

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)
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. This method need not be called by the same thread that invoked the fireEvent method for this event.

Specified by:
eventProcessingFailed in interface javax.slee.resource.ResourceAdaptor
Parameters:
handle - the activity handle of the activity upon which the event was fired.
event - is the event fired on the activity. This value may be null if no actual event was fired.
eventID - the unique identifier of the event type fired to the SLEE. If the event argument is null, the value of this parameter is undefined.
address - the default address on which the event was fired. If a null default address was specified, this value is also null. If the event argument is null, the value of this parameter is undefined.
flags - the necessary information that enables any post-event processing required by the resource adaptor.
reason - informs the resource adaptor why the event processing failed.

activityEnded

public void activityEnded(javax.slee.resource.ActivityHandle handle)
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
Parameters:
handle - the activity handle of the activity which has ended.

activityUnreferenced

public void activityUnreferenced(javax.slee.resource.ActivityHandle handle)
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
Parameters:
handle - the activity handle of the activity which has been unreferenced.

queryLiveness

public void queryLiveness(javax.slee.resource.ActivityHandle handle)
The SLEE calls this method to query if a specific activity belonging to this resource adaptor object is alive. This implies that the resource adaptor will check the underlying resource to see if the activity is still active. In this case the SLEE would retain the activity context of the activity and SBB attached to the activity context. If the activity is not alive the resource adaptor should call the appropriate activityEnding method on the SleeEndpoint, if the activity is still alive the resource adaptor is not expected to do anything. The resource adaptor object should not block on this method, for example if the resource adaptor object needs to query an external system to determine of an activity is alive, it should not block this method until a response is received.

Specified by:
queryLiveness in interface javax.slee.resource.ResourceAdaptor
Parameters:
handle - the activity which the SLEE is querying.

getActivity

public java.lang.Object getActivity(javax.slee.resource.ActivityHandle handle)
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
Parameters:
the - activity handle of the requested activity.
Returns:
the activity object.

getActivityHandle

public javax.slee.resource.ActivityHandle getActivityHandle(java.lang.Object activity)
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
Parameters:
activity - the activity object.
Returns:
activity handle or null if there is no handlers for specified activity.

getSBBResourceAdaptorInterface

public java.lang.Object getSBBResourceAdaptorInterface(java.lang.String string)
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
Returns:
Jain MGCP provider.

getMarshaler

public javax.slee.resource.Marshaler getMarshaler()
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. This ensures the SLEE has flexibility to process events, for example in a clustered environment it is conceptually possible for the SLEE to process the event on a node other than the node the event was created on. The method takes no input parameters. All resource adaptors must implement a Marshaler object hence this method must return a non-null value.

Specified by:
getMarshaler in interface javax.slee.resource.ResourceAdaptor
Returns:
Marshaler object.

serviceInstalled

public void serviceInstalled(java.lang.String serviceKey,
                             int[] eventIDs,
                             java.lang.String[] resourceOptions)
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
Parameters:
serviceKey - is the key of the service associated to the resource adaptor.
eventIDs - the set of events the service identified by the service key is interested in.
resourceOptions - the set of resource options that map to the events that are included in this filter.

serviceUninstalled

public void serviceUninstalled(java.lang.String serviceKey)
The SLEE calls this method to signify that a service has been uninstalled in the SLEE. The event types associated to the service key are no longer of interest to a particular application. The association between the event types and the service key is deleted from the resource adaptor. This doesn't preclude that another service may be interested in these event types. The SLEE calls this method once a service is uninstalled.

Specified by:
serviceUninstalled in interface javax.slee.resource.ResourceAdaptor
Parameters:
serviceKey - the key of the service associated to the resource adaptor.

serviceActivated

public void serviceActivated(java.lang.String serviceKey)
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. The SLEE can call this method irrespective of the state of the resource adaptor.

Specified by:
serviceActivated in interface javax.slee.resource.ResourceAdaptor
Parameters:
serviceKey - the key of the service associated to the resource adaptor.

serviceDeactivated

public void serviceDeactivated(java.lang.String serviceKey)
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. The SLEE can call this method irrespective of the state of the resource adaptor.

Specified by:
serviceDeactivated in interface javax.slee.resource.ResourceAdaptor
Parameters:
the - key of the service currently active in the resource adaptor.

getSleeEndpoint

public javax.slee.resource.SleeEndpoint getSleeEndpoint()

endActivity

protected void endActivity(javax.slee.resource.ActivityHandle handle)

processMgcpCommandEvent

public void processMgcpCommandEvent(jain.protocol.ip.mgcp.JainMgcpCommandEvent event)
Processes a Command Event object received from a JainMgcpProvider.

Parameters:
event - received command event.

processMgcpResponseEvent

public void processMgcpResponseEvent(jain.protocol.ip.mgcp.JainMgcpResponseEvent response,
                                     jain.protocol.ip.mgcp.JainMgcpEvent command)
Processes a Response Event object (acknowledgment to a Command Event object) received from a JainMgcpProvider.

Parameters:
response - The JAIN MGCP Response Event Object that is to be processed.

processTxTimeout

public void processTxTimeout(jain.protocol.ip.mgcp.JainMgcpCommandEvent event)
Processes a timeout occurred in a sent JainMgcpCommandEvent event transaction, to prevent further failures the activity will end after the RA fires the TransactionTimeout event.

Parameters:
event - the command sent.

processRxTimeout

public void processRxTimeout(jain.protocol.ip.mgcp.JainMgcpCommandEvent event)
Processes a timeout on a received JainMgcpCommandEvent event transaction, to prevent further failures the activity will end.

Parameters:
event - the command sent.

sendingCreateConnectionResponse

public void sendingCreateConnectionResponse(jain.protocol.ip.mgcp.message.CreateConnectionResponse event)
Indicates the provider will send the specified CreateConnectionResponse event, which contains the ConnectionIdentifier to update the MgcpConnectionActivity related with the Mgcp transaction.

Parameters:
event -


Copyright © 2008. All Rights Reserved.