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

## oracle.ifs.utils.action
Class ActionQueue

    java.lang.Object
      oracle.ifs.utils.action.ActionQueue

All Implemented Interfaces:
  java.lang.Runnable

    public class ActionQueue

extends java.lang.Object
implements java.lang.Runnable

The ActionQueue class allows clients to queue a list of Action instances for execution in a background thread. ActionQueue supports a listener-style interface for observing such events as an Action having started or the ActionQueue having failed.

Modified:
  lsaenz 08/02/2000 Changed to invoke the Action.failed method., lsaenz 04/02/2000 Updated comments; changed method names., lsaenz 02/16/2000 Changed name of class to ActionQueue; removed ability to undo (never used)., lsaenz 02/11/2000 Fixed some concurrency issues; now uses EventListenerList., lsaenz 02/09/2000 Added method getActions., lsaenz 02/06/2000 Decoupled Action from Settings, added actionStarting and actionFinished events., lsaenz 12/21/1999 Now makes use of Observer pattern to notify registered objects that the configuration process has finished or failed because of an error., lsaenz 12/10/1999 Catches Throwable instead of just Exception so that Errors are caught., lsaenz 11/15/1999 Created.

Constructor Summary
`ActionQueue()` Creates a new ActionQueue.

Method Summary
`void` | `addAction(Action action)` Adds an Action to the end of this ActionQueue.
`void` | `addActionQueueListener(ActionQueueListener listener)` Adds an ActionQueueListener to the list of objects that are interested in observing events from this ActionQueue.
`protected void` | `fireActionFinished(Action action)` Reports that an Action has completed successfully.
`protected void` | `fireActionQueueFailed(java.lang.Throwable error)` Reports that the ActionQueue failed.
`protected void` | `fireActionQueueFinished()` Reports that the ActionQueue has finished successfully.
`protected void` | `fireActionStarting(Action action)` Reports that an Action is about to be performed.
`int` | `getActionCount()` Returns the number of Actions in this ActionQueue.
`java.util.Enumeration` | `getActions()` Returns the Actions in this ActionQueue.
`void` | `insertActionAt(Action action, int index)` Inserts an Action into this ActionQueue at a specified index.
`boolean` | `isRunning()` Returns true if this ActionQueue is currently executing.
`void` | `removeActionAt(int index)` Removes an Action occuring at a specified index from this ActionQueue.
`void` | `removeActionQueueListener(ActionQueueListener listener)` Removes an ActionQueueListener such that it no longer receives ActionQueue event notifications.
`void` | `run()` Executes this ActionQueue.
`void` | `start()` Performs all the Actions in this ActionQueue.
`void` | `stop()` Attempts to stop this ActionQueue.
`void` | `waitUntilDone()` Blocks the invoking Thread until the ActionQueue has completed.

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

Constructor Detail

### ActionQueue

    public ActionQueue()

  Creates a new ActionQueue.

Method Detail

### addAction

    public void addAction(Action action)

  Description copied from class: `ActionQueue`
  Adds an Action to the end of this ActionQueue.

  Parameters:
    `action` - the Action to add.

### getActions

    public java.util.Enumeration getActions()

  Description copied from class: `ActionQueue`
  Returns the Actions in this ActionQueue.

  Returns:
    an Enumeration of Actions in this ActionQueue.

### addActionQueueListener

    public void addActionQueueListener(ActionQueueListener listener)

  Description copied from class: `ActionQueue`
  Adds an ActionQueueListener to the list of objects that are interested in observing events from this ActionQueue.

  Parameters:
    `listener` - the ActionQueueListener to add.

### removeActionQueueListener

    public void removeActionQueueListener(ActionQueueListener listener)

  Description copied from class: `ActionQueue`
  Removes an ActionQueueListener such that it no longer receives ActionQueue event notifications.

  Parameters:
    `listener` - the ActionQueueListener to remove.

### insertActionAt

    public void insertActionAt(Action action,
                               int index)

  Description copied from class: `ActionQueue`
  Inserts an Action into this ActionQueue at a specified index.

  Parameters:
    `action` - the Action to add.
    `index` - the index that specifies the order when the action should occur.
  Throws:
    `java.lang.ArrayIndexOutOfBoundsException` - if the index is invalid.

### removeActionAt

    public void removeActionAt(int index)

  Description copied from class: `ActionQueue`
  Removes an Action occuring at a specified index from this ActionQueue.

  Parameters:
    `index` - the index that specifies the Action to be removed.
  Throws:
    `java.lang.ArrayIndexOutOfBoundsException` - if the index is invalid.

### getActionCount

    public int getActionCount()

  Description copied from class: `ActionQueue`
  Returns the number of Actions in this ActionQueue.

### start

    public void start()

  Description copied from class: `ActionQueue`
  Performs all the Actions in this ActionQueue.
  (The ActionQueue will invoke the perform method on every Action that has been added to its queue.)

  Note: This method starts a separate Thread. It can be invoked only when the ActionQueue is idle. That is, while actions are being performed (the background Thread is still alive), this method will do nothing.

### stop

    public void stop()

  Description copied from class: `ActionQueue`
  Attempts to stop this ActionQueue. If this ActionQueue is idle, this method will do nothing. Otherwise, it will invoke the stop method on the currently executing Action. Once this Action has stopped, no other Action will be performed and the ActionQueue will stop.

  Invoking this method should stop this ActionQueue in a reasonable amount of time, as long as the currently executing Action implements the stop method correctly, according to the contract defined by the Action interface. Clients can use the `isRunning` to find out if the ActionQueue has stopped.

  Note: Once this method has been invoked, the ActionQueue will no longer report that it has completed or failed. The ActionQueue will also no longer report that the currently executing Action has finished. It is up to the client to wait for the ActionQueue to finish because there can be no guarantee that the currently executing Action will stop. Clients can use the `waitUntilDone` method immediately after invoking this method to block until the ActionQueue has stopped.

### isRunning

    public boolean isRunning()

  Description copied from class: `ActionQueue`
  Returns true if this ActionQueue is currently executing. A return value of true implies that this ActionQueue's background thread is still alive.

  Returns:
    true if this ActionQueue is currently running.

### waitUntilDone

    public void waitUntilDone()
                       throws java.lang.InterruptedException

  Description copied from class: `ActionQueue`
  Blocks the invoking Thread until the ActionQueue has completed. This could be when the ActionQueue has finished successfully, failed, or has been stopped.

  Throws:
    `java.lang.InterruptedException` - if the Thread is interrupted.

### run

    public void run()

  Description copied from class: `ActionQueue`
  Executes this ActionQueue. Invokes the `perform` method for every Action. Also notifies registered listeners of Action events.

  Specified by:
    `run` in interface `java.lang.Runnable`

### fireActionQueueFinished

    protected void fireActionQueueFinished()

  Description copied from class: `ActionQueue`
  Reports that the ActionQueue has finished successfully.

### fireActionQueueFailed

    protected void fireActionQueueFailed(java.lang.Throwable error)

  Description copied from class: `ActionQueue`
  Reports that the ActionQueue failed.

  Parameters:
    `error` - the Exception or Error that caused the failure.

### fireActionStarting

    protected void fireActionStarting(Action action)

  Description copied from class: `ActionQueue`
  Reports that an Action is about to be performed.

  Parameters:
    `action` - the Action that is about to begin.

### fireActionFinished

    protected void fireActionFinished(Action action)

  Description copied from class: `ActionQueue`
  Reports that an Action has completed successfully.

  Parameters:
    `action` - the Action that has finished.

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