Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.objectweb.jass.as
Class ActivityImpl

    java.lang.Object
      org.objectweb.jass.as.ActivityImpl

All Implemented Interfaces:
  javax.activity.ActivityCoordinator, java.io.Serializable, org.jboss.util.timeout.TimeoutTarget

public class ActivityImpl
extends java.lang.Object
implements javax.activity.ActivityCoordinator, org.jboss.util.timeout.TimeoutTarget, java.io.Serializable

Each object of this class represents an activity and its coordinator. Implements the ASActivityCoordinator interface in order to be able to broadcast signals to registered actions. TimeoutTarget is implemented in order to be warned of timeout.

Author:
  fran Date: Feb 16, 2004 org.objectweb.jass.asActivityImpl.java
See Also:
  Serialized Form

Constructor Summary
`ActivityImpl(UserActivityImpl userActivityImpl, ActivityIdImpl activityId, ActivityImpl superior, int timeout)`

Method Summary
`void` | `addAction(javax.activity.coordination.Action action, java.lang.String signalSetName, int priority)` Establishes an interest relationship between the specified Action and SignalSet for the Activity represented by the target ActivityCoordinator.
`void` | `addGlobalAction(javax.activity.coordination.Action action, int priority)` Repasar Establishes an interest relationship between the specified Action and all SignalSets used by the Activity represented by the target ActivityCoordinator.
`void` | `associateCurrentThread()` Associates the calling thread with this activity.
`javax.activity.Outcome` | `completeActivity(int completionStatus)` Causes the Activity associated with the target ActivityCoordinator to complete with the specified CompletionStatus.
`void` | `disassociateCurrentThread()` Disassociates the calling thread from this activity.
`javax.activity.coordination.Action[]` | `getActions(java.lang.String signalSetName)` Returns all the Actions that have been registered with an interest in the specified signalSetName.
`java.lang.String` | `getCompletionSignalSetName()` Returns the name of the SignalSet, if any, that will be used for the distribution of completion signals when the current Activity completes.
`javax.activity.GlobalId` | `getGlobalId()` Returns the GlobalId of the Activity represented by the target ActivityCoordinator.
`java.lang.String` | `getName()` Returns a printable string describing the Activity represented by the target ActivityCoordinator.
`int` | `getNumberRegisteredActions(java.lang.String signalSetName)` OK Returns the number of Actions, including global Actions, registered with the target ActivityCoordinator with an interest in the specified SignalSet.
`javax.activity.ActivityCoordinator` | `getParent()` Returns the parent ActivityCoordinator or null if the target ActivityCoordinator represents a top-level Activity.
`int` | `getParentStatus()` Returns the Status of the Activity represented by the target ActivityCoordinator's parent.
`int` | `getStatus()` Returns the Status of the Activity represented by the target ActivityCoordinator.
`java.lang.String` | `getStringCompletionStatus(int completionStatus)` Return the string representation of the activity CompletionStatus.
`java.lang.String` | `getStringStatus(int status)` Return the string representation of the activity status.
`javax.activity.Outcome` | `heuristicComplete(int completionStatus)`
`boolean` | `isSameActivity(javax.activity.ActivityCoordinator coord)` Returns true if the specified coord represents the same Activity as the target ActivityCoordinator.
`javax.activity.Outcome` | `processSignalSet(java.lang.String signalSetName, int completionStatus)` Causes the SignalSet specified by signalSetName to start producing signals for all registered Actions at times other than during completion.
`void` | `removeAction(javax.activity.coordination.Action action, java.lang.String signalSetName)` Removes the interest relationship between the specified Action and SignalSet for the Activity represented by the target ActivityCoordinator.
`void` | `removeGlobalAction(javax.activity.coordination.Action action)`
`void` | `setCompletionSignalSetName(java.lang.String signalSetName)` Sets the name of the SignalSet that should be used for the distribution of completion signals when the current Activity completes.
`void` | `timedOut(org.jboss.util.timeout.Timeout timeout)` Called when our timeout expires.

Methods inherited from class java.lang.Object
`equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### ActivityImpl

    public ActivityImpl(UserActivityImpl userActivityImpl,
                        ActivityIdImpl activityId,
                        ActivityImpl superior,
                        int timeout)

Method Detail

### addAction

    public void addAction(javax.activity.coordination.Action action,
                          java.lang.String signalSetName,
                          int priority)
                   throws javax.activity.SignalSetUnknownException,
                          javax.activity.SystemException,
                          java.lang.IllegalStateException

  Establishes an interest relationship between the specified Action and SignalSet for the Activity represented by the target ActivityCoordinator. When a Signal which is a member of the SignalSet is sent, the processSignal method of the Action will be invoked with that Signal. If multiple Actions are registered, then priority may be used to place an order on how they will be invoked when Signals are sent: higher priority Actions will occur first in the Action list, and hence be invoked before other, lower priority, Actions. The priority value must be a positive value; a value of zero means that the Activity Service implementation is free to place the Action at any point in the Action list. If the specified Action is registered multiple times for the same SignalSet then it will be invoked multiple times with the Signals from that SignalSet.

  Specified by:
    `addAction` in interface `javax.activity.ActivityCoordinator`
  Parameters:
    `action` -
    `signalSetName` -
    `priority` -
  Throws:
    `javax.activity.SignalSetUnknownException`
    `javax.activity.SystemException`
    `java.lang.IllegalStateException`

### addGlobalAction

    public void addGlobalAction(javax.activity.coordination.Action action,
                                int priority)
                         throws javax.activity.SystemException,
                                java.lang.IllegalStateException

  Repasar Establishes an interest relationship between the specified Action and all SignalSets used by the Activity represented by the target ActivityCoordinator. When a Signal which is a member of any of the SignalSets is sent, the processSignal method of the Action will be invoked with that Signal. If multiple Actions are registered, then priority may be used to place an order on how they will be invoked when Signals are sent: higher priority Actions will occur first in the Action list, and hence be invoked before other, lower priority, Actions. The priority value must be a positive value; a value of zero means that the Activity Service implementation is free to place the Action at any point in the Action list. If the specified Action is registered multiple times with the target ActivityCoordinator then it will be invoked multiple times with each Signal.

  Specified by:
    `addGlobalAction` in interface `javax.activity.ActivityCoordinator`
  Parameters:
    `action` -
    `priority` -
  Throws:
    `javax.activity.SystemException`
    `java.lang.IllegalStateException`

### removeAction

    public void removeAction(javax.activity.coordination.Action action,
                             java.lang.String signalSetName)
                      throws javax.activity.ActionNotFoundException,
                             javax.activity.SystemException,
                             java.lang.IllegalStateException

  Removes the interest relationship between the specified Action and SignalSet for the Activity represented by the target ActivityCoordinator. If signalSetName is an empty String then the interest relationship is removed between the specified Action and all SignalSets in the target Activity. This operation has no effect on any global actions. If the specified Action was registered multiple times with the target ActivityCoordinator then only a single instance of this Action is removed by each call to this method.

  Specified by:
    `removeAction` in interface `javax.activity.ActivityCoordinator`
  Parameters:
    `action` -
    `signalSetName` -
  Throws:
    `javax.activity.ActionNotFoundException`
    `javax.activity.SystemException`
    `java.lang.IllegalStateException`

### removeGlobalAction

    public void removeGlobalAction(javax.activity.coordination.Action action)
                            throws javax.activity.ActionNotFoundException,
                                   javax.activity.SystemException,
                                   java.lang.IllegalStateException

  Specified by:
    `removeGlobalAction` in interface `javax.activity.ActivityCoordinator`
  Throws:
    `javax.activity.ActionNotFoundException`
    `javax.activity.SystemException`
    `java.lang.IllegalStateException`

### getActions

    public javax.activity.coordination.Action[] getActions(java.lang.String signalSetName)
                                                    throws javax.activity.SignalSetUnknownException,
                                                           javax.activity.SystemException

  Returns all the Actions that have been registered with an interest in the specified signalSetName. This method may be used by a HLS that has determined that an Activity needs to be persisted and needs to log the Actions registered in the Activity.

  Specified by:
    `getActions` in interface `javax.activity.ActivityCoordinator`
  Parameters:
    `signalSetName` - -the name of a SignalSet supported by the HLS. Only Actions registered with an interest in this SignalSet are returned by this operation. If this parameter is null then all global Actions are returned.
  Returns:
    The array of Actions registered with an interest in the specified SignalSet. If there are none, then a zero element array is returned.
  Throws:
    `javax.activity.SignalSetUnknownException` - - Thrown if the specified signalSetName is not recognized.
    `javax.activity.SystemException` - - Thrown if the Activity service encounters an unexpected error condition.

### getNumberRegisteredActions

    public int getNumberRegisteredActions(java.lang.String signalSetName)
                                   throws javax.activity.SignalSetUnknownException,
                                          javax.activity.SystemException

  OK Returns the number of Actions, including global Actions, registered with the target ActivityCoordinator with an interest in the specified SignalSet.

  Specified by:
    `getNumberRegisteredActions` in interface `javax.activity.ActivityCoordinator`
  Parameters:
    `signalSetName` -
  Throws:
    `javax.activity.SystemException`
    `javax.activity.SignalSetUnknownException`

### setCompletionSignalSetName

    public void setCompletionSignalSetName(java.lang.String signalSetName)
                                    throws javax.activity.SignalSetUnknownException,
                                           javax.activity.SystemException,
                                           java.lang.IllegalStateException

  Sets the name of the SignalSet that should be used for the distribution of completion signals when the current Activity completes. This method can be called multiple times during the lifetime of an Activity, before the Activity starts completion processing. The last value specified before completion processing starts is used during completion processing.

  Specified by:
    `setCompletionSignalSetName` in interface `javax.activity.ActivityCoordinator`
  Parameters:
    `signalSetName` -
  Throws:
    `javax.activity.SystemException`
    `javax.activity.SignalSetUnknownException`
    `java.lang.IllegalStateException`

### getCompletionSignalSetName

    public java.lang.String getCompletionSignalSetName()
                                                throws javax.activity.SystemException

  Returns the name of the SignalSet, if any, that will be used for the distribution of completion signals when the current Activity completes.

  Specified by:
    `getCompletionSignalSetName` in interface `javax.activity.ActivityCoordinator`
  Throws:
    `javax.activity.SystemException`

### getParent

    public javax.activity.ActivityCoordinator getParent()
                                                 throws javax.activity.SystemException

  Returns the parent ActivityCoordinator or null if the target ActivityCoordinator represents a top-level Activity.

  Specified by:
    `getParent` in interface `javax.activity.ActivityCoordinator`
  Returns:
    The parent ActivityCoordinator or null if the target ActivityCoordinator represents a top-level Activity.
  Throws:
    `javax.activity.SystemException` - - Thrown if the Activity service encounters an unexpected error condition.

### getGlobalId

    public javax.activity.GlobalId getGlobalId()
                                        throws javax.activity.SystemException

  Returns the GlobalId of the Activity represented by the target ActivityCoordinator.

  Specified by:
    `getGlobalId` in interface `javax.activity.ActivityCoordinator`
  Returns:
    The GlobalId of the Activity represented by the target ActivityCoordinator.
  Throws:
    `javax.activity.SystemException` - - Thrown if the Activity service encounters an unexpected error condition.

### getStatus

    public int getStatus()
                  throws javax.activity.SystemException

  Returns the Status of the Activity represented by the target ActivityCoordinator.

  Specified by:
    `getStatus` in interface `javax.activity.ActivityCoordinator`
  Returns:
    The Status of the Activity represented by the target ActivityCoordinator.
  Throws:
    `javax.activity.SystemException` - - Thrown if the Activity service encounters an unexpected error condition.

### getParentStatus

    public int getParentStatus()
                        throws javax.activity.SystemException

  Returns the Status of the Activity represented by the target ActivityCoordinator's parent. If the target ActivityCoordinator represents a top-level Activity, then the Status of this top-level Activity is returned.

  Specified by:
    `getParentStatus` in interface `javax.activity.ActivityCoordinator`
  Returns:
    The Status of the target ActivityCoordinator's parent Activity or the Status of the target ActivityCoordinator if the target object represents a top-level Activity.
  Throws:
    `javax.activity.SystemException` - - Thrown if the Activity service encounters an unexpected error condition.

### getName

    public java.lang.String getName()
                             throws javax.activity.SystemException

  Returns a printable string describing the Activity represented by the target ActivityCoordinator.

  Specified by:
    `getName` in interface `javax.activity.ActivityCoordinator`
  Returns:
    A printable string describing the Activity represented by the target ActivityCoordinator.
  Throws:
    `javax.activity.SystemException` - - Thrown if the Activity service encounters an unexpected error condition.

### isSameActivity

    public boolean isSameActivity(javax.activity.ActivityCoordinator coord)
                           throws javax.activity.SystemException

  Returns true if the specified coord represents the same Activity as the target ActivityCoordinator.

  Specified by:
    `isSameActivity` in interface `javax.activity.ActivityCoordinator`
  Returns:
    true if the specified coord represents the same Activity as the target ActivityCoordinator.
  Throws:
    `javax.activity.SystemException` - - Thrown if the Activity service encounters an unexpected error condition.

### completeActivity

    public javax.activity.Outcome completeActivity(int completionStatus)
                                            throws javax.activity.ActivityPendingException,
                                                   javax.activity.ContextPendingException,
                                                   javax.activity.NotOriginatorException,
                                                   javax.activity.InvalidStateException,
                                                   javax.activity.ActivityNotProcessedException,
                                                   javax.activity.SystemException

  Causes the Activity associated with the target ActivityCoordinator to complete with the specified CompletionStatus. The Activity service sets the Status to StatusCompleting before asking any completion SignalSet to start producing Signals. If there are any child active or suspended Activities or transactions and the CompletionStatus is CompletionStatusFail or CompletionStatusFailOnly then those child Activites will have their CompletionStatuses set to CompletionStatusFailOnly and any child transaction will be called to setRollbackOnly. The UserActivity interface should be used in preference to the ActivityCoordinator for completing Activities in most circumstances. This method is provided primarily for use after recovery when the Activity to be completed is not associated with the calling thread.

  Specified by:
    `completeActivity` in interface `javax.activity.ActivityCoordinator`
  Parameters:
    `completionStatus` - - the CompletionStatus with which the target Activity should end.
  Returns:
    The Outcome returned is both set by and given meaning by the SignalSet used for completion. In the absence of a CompletionSignalSet a null Outcome object reference is returned.
  Throws:
    `javax.activity.ActivityPendingException`
    `javax.activity.ContextPendingException`
    `javax.activity.NotOriginatorException`
    `javax.activity.InvalidStateException`
    `javax.activity.ActivityNotProcessedException`
    `javax.activity.SystemException`

### heuristicComplete

    public javax.activity.Outcome heuristicComplete(int completionStatus)
                                             throws javax.activity.ActivityPendingException,
                                                    javax.activity.ContextPendingException,
                                                    javax.activity.InvalidStateException,
                                                    javax.activity.ActivityNotProcessedException,
                                                    javax.activity.SystemException

  Specified by:
    `heuristicComplete` in interface `javax.activity.ActivityCoordinator`
  Throws:
    `javax.activity.ActivityPendingException`
    `javax.activity.ContextPendingException`
    `javax.activity.InvalidStateException`
    `javax.activity.ActivityNotProcessedException`
    `javax.activity.SystemException`

### processSignalSet

    public javax.activity.Outcome processSignalSet(java.lang.String signalSetName,
                                                   int completionStatus)
                                            throws javax.activity.SignalSetUnknownException,
                                                   javax.activity.ActivityNotProcessedException,
                                                   javax.activity.InvalidActivityException,
                                                   javax.activity.SystemException

  Causes the SignalSet specified by signalSetName to start producing signals for all registered Actions at times other than during completion. Pre-defined SignalSets, such as Synchronization, cannot be requested to produce signals via this method.

  Specified by:
    `processSignalSet` in interface `javax.activity.ActivityCoordinator`
  Parameters:
    `signalSetName` - - the name of the SignalSet that is to produce signals.
    `completionStatus` - - the CompletionStatus of the Activity at the time of calling. The completionStatus may influence the signals that are produced.
  Returns:
    The Outcome returned is both set by and given meaning by the specified SignalSet. It may be null.
  Throws:
    `javax.activity.SignalSetUnknownException`
    `javax.activity.ActivityNotProcessedException`
    `javax.activity.InvalidActivityException`
    `javax.activity.SystemException`

### timedOut

    public void timedOut(org.jboss.util.timeout.Timeout timeout)

  Called when our timeout expires.

  Specified by:
    `timedOut` in interface `org.jboss.util.timeout.TimeoutTarget`

### associateCurrentThread

    public void associateCurrentThread()

  Associates the calling thread with this activity.

### disassociateCurrentThread

    public void disassociateCurrentThread()

  Disassociates the calling thread from this activity.

### getStringStatus

    public java.lang.String getStringStatus(int status)

  Return the string representation of the activity status.

  Parameters:
    `status` - the integer status to convert.
  Returns:
    the string representation of the status.

### getStringCompletionStatus

    public java.lang.String getStringCompletionStatus(int completionStatus)

  Return the string representation of the activity CompletionStatus.

  Parameters:
    `completionStatus` - the integer completion status to convert.
  Returns:
    the string representation of the completion status.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD