com.tivoli.twg.engine
Class TWGTaskActivator

java.lang.Object
  extended bycom.tivoli.twg.engine.TWGTaskActivator
All Implemented Interfaces:
RemoteTaskActivatorListener

public class TWGTaskActivator
extends java.lang.Object
implements RemoteTaskActivatorListener

This class handles coordinating the steps of performing a console task activation. The following steps take place:

  1. If a server task is required or if clients are required to be started, a task activation command is sent to the server via the service node. Otherwise, this step is skipped.
  2. In parallel with step 1, if the subtask being activated is interactive, the GUI class for the task is loaded and an instance is created. A thread is created using this GUI instance.
  3. Once steps 1 and 2 are complete, if there is a GUI thread, it is started.
  4. If a server task was activated in step 1, it is deactivated when the GUI thread terminates.


Constructor Summary
TWGTaskActivator(TWGSubtask subtask, LongValueSet moid, LongValueSet foid, com.tivoli.twg.console.TWGMainGUI source, java.lang.Object data)
          Constructor specifying all the data needed for a task activation.
TWGTaskActivator(TWGSubtask subtask, LongValueSet moid, LongValueSet foid, com.tivoli.twg.console.TWGMainGUI source, java.lang.Object data, byte[] bdata)
          Constructor specifying all the data needed for a task activation.
 
Method Summary
 byte[] getDataBuffer()
          Get the application binary data that was passed to this activation.
 long getEngActID()
          Get the activation ID that the engine assigns.
 LongValueSet getFoid()
          Get the filter ID LongValueSet for this activation.
 com.tivoli.twg.console.TWGMainGUI getMainConsole()
          Get the main console that originated this activation.
 LongValueSet getMoid()
          Get the managed object ID LongValueSet for this activation.
static java.util.Vector getRunningGUIs()
          Get the static list of guis which are running.
 TWGSubtask getSubtask()
          Get the TWGSubtask for this activation
 java.lang.Object getTAParameters()
          Get the application parameter that was passed to this activation.
 java.lang.String getTargetTitle()
          Get a string that helps identify the target of the task activation that is occurring.
 TWGConTask getTask()
          Get the TWGConTask for this activation.
 java.lang.String getUserID()
          Get the user ID for this activation.
 void guiExiting()
           
static void handleServerCommand(Command cmd)
          Handle a task command received from the server.
 void resetGuiStatus()
          Stops the GUI status indicator on the main panel if it has not yet been stopped for this task activation.
 void taskActivationComplete(long rc, long localID, long remoteID, java.lang.String taskID, long toid, java.lang.String subtaskID, LongValueSet moid, LongValueSet foid)
          Method called by TWGRemoteTaskManager when subtask activation is complete
 void taskActivationEnded(int rc, long localID)
          Method called by TWGRemoteTaskManager when a subtask activation has ended
 void uncaughtException(java.lang.Thread thrd, java.lang.Throwable excpt)
          Implement UncaughtExceptionListener interface called by ProtectedThreadGroup uncaught exception handler when gui runner thread thow an uncaught exception.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TWGTaskActivator

public TWGTaskActivator(TWGSubtask subtask,
                        LongValueSet moid,
                        LongValueSet foid,
                        com.tivoli.twg.console.TWGMainGUI source,
                        java.lang.Object data)
                 throws TWGTaskActivationException
Constructor specifying all the data needed for a task activation. The object is constructed and the activation processing is started. Calls ctor below with a null binary data buffer.


TWGTaskActivator

public TWGTaskActivator(TWGSubtask subtask,
                        LongValueSet moid,
                        LongValueSet foid,
                        com.tivoli.twg.console.TWGMainGUI source,
                        java.lang.Object data,
                        byte[] bdata)
                 throws TWGTaskActivationException
Constructor specifying all the data needed for a task activation. The object is constructed and the activation processing is started.

Parameters:
subtask - the subtask being started
moid - a LongValueSet containing the object IDs of the managed objects that are the target of this activation. This parameter should be null if there are no managed object targets for this activation.
foid - a LongValueSet containing the object IDs of the filters that are the target of this activation. This parameter should be null if there are no filter targets for this activation.
source - the originating console that created this task activator
data - optional object data parameter
bdata - optional binary data parameter
Method Detail

handleServerCommand

public static void handleServerCommand(Command cmd)
Handle a task command received from the server.

Parameters:
cmd - The command sent from the server.

uncaughtException

public void uncaughtException(java.lang.Thread thrd,
                              java.lang.Throwable excpt)
Implement UncaughtExceptionListener interface called by ProtectedThreadGroup uncaught exception handler when gui runner thread thow an uncaught exception. If a server task was activated, a * deactivation command is sent to the server to deactivate it.


getTask

public TWGConTask getTask()
Get the TWGConTask for this activation.

Returns:
a TWGConTask object.

getSubtask

public TWGSubtask getSubtask()
Get the TWGSubtask for this activation

Returns:
a TWGSubtask object

getEngActID

public long getEngActID()
Get the activation ID that the engine assigns. This ID can be used to correlate GUI activations to Server activations.

Returns:
a long which is the task activation ID.

getMoid

public LongValueSet getMoid()
Get the managed object ID LongValueSet for this activation.

Returns:
a LongValueSet or null if no managed objects were targeted for this activation.

getFoid

public LongValueSet getFoid()
Get the filter ID LongValueSet for this activation.

Returns:
a LongValueSet or null if no filters were targeted for this activation.

guiExiting

public void guiExiting()

taskActivationComplete

public void taskActivationComplete(long rc,
                                   long localID,
                                   long remoteID,
                                   java.lang.String taskID,
                                   long toid,
                                   java.lang.String subtaskID,
                                   LongValueSet moid,
                                   LongValueSet foid)
Method called by TWGRemoteTaskManager when subtask activation is complete

Specified by:
taskActivationComplete in interface RemoteTaskActivatorListener
Parameters:
rc - result code (see TWGTaskConstants.RETURN_* for values
localID - the id passed into the TWGRemoteTaskManager.subtaskActivate() call
remoteID - the activation ID assigned by the server. This is the ID that you must use for subtaskDeactivate()
taskID - the string task ID of the task. This will be null if the subtaskActivate() call was made passing the toid instead of the taskID
toid - the object ID of the task that was activated
subtaskID - the string subtaskID of the subtask that was activated
moid - the moid passed on the subtaskActivate() call
foid - the foid passed on the subtaskActivate() call

taskActivationEnded

public void taskActivationEnded(int rc,
                                long localID)
Method called by TWGRemoteTaskManager when a subtask activation has ended

Specified by:
taskActivationEnded in interface RemoteTaskActivatorListener
Parameters:
rc - reason the activation ended (see TWGTaskConstants.ACT_STATUS_*)
localID - the id passed into the TWGRemoteTaskManager.subtaskActivate() call

resetGuiStatus

public void resetGuiStatus()
Stops the GUI status indicator on the main panel if it has not yet been stopped for this task activation. This is only started if the subtask is an interactive task.


getMainConsole

public com.tivoli.twg.console.TWGMainGUI getMainConsole()
Get the main console that originated this activation.

Returns:
the instance of the main console object that created this activation.

getUserID

public java.lang.String getUserID()
Get the user ID for this activation.

Returns:
a string containing the name of the user logged into the console that created this activation.

getTAParameters

public java.lang.Object getTAParameters()
Get the application parameter that was passed to this activation.

Returns:
the parameter that the user of this task activator passed at the time this activation was created.

getDataBuffer

public byte[] getDataBuffer()
Get the application binary data that was passed to this activation.

Returns:
the data buffer that the user of this task activator passed at the time this activation was created.

getTargetTitle

public java.lang.String getTargetTitle()
Get a string that helps identify the target of the task activation that is occurring. This can be used in the title of task frames to distinguish one from another.

Returns:
a string that identifies the task activation target. If task activation is untargetted, null will be returned.

getRunningGUIs

public static java.util.Vector getRunningGUIs()
Get the static list of guis which are running.

Returns:
a vector of TWGTaskFrameImplementors which are running.