|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectnet.kwfgrid.gwes.Activity
public abstract class Activity
This abstract class is to be extended in order to implement a concrete activity, such as a remote procedure call. Activities are single process steps of a workflow. In order to implement your own activity class, you should override the methods
initiateActivity() startActivity() simulateActivity() suspendActivity() resumeActivity() abortActivity() restartActivity() cleanupActivity()
initiateActivity(),
startActivity(),
simulateActivity(),
suspendActivity(),
resumeActivity(),
abortActivity(),
restartActivity(),
cleanupActivity()| Nested Class Summary | |
|---|---|
static class |
Activity.Status
Valid status for activities: Status UNDEFINED. |
| Field Summary | |
|---|---|
static long |
DEFAULT_TIMEOUT_ACTIVE
Default timeoutActive for activities in state "ACTIVE" in milliseconds. |
static long |
DEFAULT_TIMEOUT_RUNNING
Default timeoutRunning for activities in state "RUNNING" or "ACTIVE" in milliseconds. |
GenericWorkflowHandler |
handler
The parent workflow handler that owns this activity |
String |
ID
Identifier of this Activity |
Integer |
lastExitCode
saves the last exitCode in call stack for SOAPFault |
static org.apache.log4j.Logger |
logger
log4j logger |
protected net.kwfgrid.gworkflowdl.structure.OperationCandidate |
op
The operation candidate contains all information about the operation and its resources. |
long |
timeoutActive
Timeout for this activity in state active in milliseconds. |
long |
timeoutRunning
Timeout for this activity in state running or active in milliseconds. |
protected TransitionOccurrence |
to
The transition occurrence contains all the workflow information needed for this activity. |
| Constructor Summary | |
|---|---|
Activity(GenericWorkflowHandler handler,
TransitionOccurrence to,
net.kwfgrid.gworkflowdl.structure.OperationCandidate op)
Constructor for Activity. |
|
| Method Summary | |
|---|---|
abstract void |
abortActivity()
Abort this activity. |
void |
appendFaultMessage(String faultMessage)
Append the human-readable fault message. |
abstract void |
cleanupActivity()
Cleans up all temporary data produced by this activity. |
void |
decreaseAttempts()
|
void |
enqueueActivity()
Enqueue this activity in order to be processed by the ActivityStarter. |
int |
getAttempts()
Get the number of pending attempts for this activity. |
long |
getDurationActive()
Get the duration of how long this activity was "ACTIVE". |
long |
getDurationInitiated()
Get the duration of how long this activity was "INITIATED" (before running). |
long |
getDurationRunning()
Get the duration of how long this activity was "RUNNING" not including the time it was "ACTIVE". |
long |
getDurationSuspended()
Get the duration of how long this activity was "SUSPENDED". |
long |
getDurationTotal()
Get the total activity duration. |
long |
getDurationUndefined()
Get the duration of how long this activity was "UNDEFINED" (before initiated). |
String |
getFaultMessage()
Gest the human-readable fault message. |
GWESLogger |
getGlog()
Get the GWESLogger for this activity. |
GenericWorkflowHandler |
getHandler()
Get the parent workflow handler that owns this activity. |
String |
getID()
Get the identifier of this activity. |
net.kwfgrid.gworkflowdl.structure.OperationCandidate |
getOperationCandidate()
Get the operation candidate. |
String |
getOperationName()
Get the operation name of this activity. |
String |
getResourceName()
Get the resource name of this activity. |
SOAPFault |
getSoapFault()
Get fault as SOAPFault. |
long |
getStartTimeTotal()
Get the start time of this activity in milliseconds since 1970. |
Activity.Status |
getStatus()
Get the current status of this activity as int. |
String[] |
getStatusArray()
Get the activity status as an array of strings. |
String |
getStatusAsString()
Get the current status of the activity as string. |
static String |
getStatusAsString(Activity.Status status)
Convert the status of a activity from an integer to a string. |
long |
getTimeoutActive()
Get the timeoutActive of this activity. |
long |
getTimeoutRunning()
Get the timeoutRunning of this activity. |
TransitionOccurrence |
getTransitionOccurrence()
Get transition occurrence object. |
abstract void |
initiateActivity()
Initiate this activity. |
boolean |
isFinalStatus()
|
static boolean |
isFinalStatus(Activity.Status status)
|
protected void |
putFaultTokenOnOutputPlaces()
Put SOAP Fault on each output token that is connected with a edge expression. |
abstract void |
restartActivity()
Restart this activity. |
abstract void |
resumeActivity()
Resume this activity. |
void |
setFaultMessage(String faultMessage)
Set the human-readable fault message. |
void |
setSoapFault(SOAPFault soapFault)
Set SOAP fault. |
void |
setStatus(Activity.Status status)
Set status of the activity and notify threads that wait for a status change. |
protected void |
setTimeoutActive(long timeoutActive)
Set the timeoutActive of this Activity. |
protected void |
setTimeoutRunning(long timeoutRunning)
Set the timeoutRunning of this Activity. |
abstract void |
simulateActivity()
Simulate this activity. |
abstract void |
startActivity()
Start this activity. |
abstract void |
suspendActivity()
Suspend this activity. |
String |
toString()
Each activity should be able to give some information about itself using the toString() method. |
void |
waitForCompleteOrTerminate()
Wait for activity to change its status to COMPLETED or TERMINATED. |
Activity.Status |
waitForStatusChangeFrom(Activity.Status oldStatus)
Wait for activity to change its status. |
void |
waitForStatusChangeTo(Activity.Status newStatus)
Wait for activity to change its status to a specified status. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final org.apache.log4j.Logger logger
public final String ID
public GenericWorkflowHandler handler
protected TransitionOccurrence to
protected net.kwfgrid.gworkflowdl.structure.OperationCandidate op
public long timeoutRunning
public long timeoutActive
public static final long DEFAULT_TIMEOUT_RUNNING
public static final long DEFAULT_TIMEOUT_ACTIVE
public Integer lastExitCode
| Constructor Detail |
|---|
public Activity(GenericWorkflowHandler handler,
TransitionOccurrence to,
net.kwfgrid.gworkflowdl.structure.OperationCandidate op)
throws net.kwfgrid.gworkflowdl.structure.WorkflowFormatException,
LoggingException
handler - The parent generic workflow handler.to - The TransitionOccurrence object with workflow data about this activity invocation.op - The OperationCandidate with information about the operation and its resources.
net.kwfgrid.gworkflowdl.structure.WorkflowFormatException
LoggingException| Method Detail |
|---|
public void setStatus(Activity.Status status)
public Activity.Status getStatus()
getStatusAsString()
public Activity.Status waitForStatusChangeFrom(Activity.Status oldStatus)
throws InterruptedException
oldStatus - The old status
InterruptedException - If the thread has been interrupted
public void waitForStatusChangeTo(Activity.Status newStatus)
throws InterruptedException
newStatus - The new status code to wait for
InterruptedException - If the thread has been interrupted
public void waitForCompleteOrTerminate()
throws InterruptedException
InterruptedException - If the thread has been interruptedpublic boolean isFinalStatus()
public static boolean isFinalStatus(Activity.Status status)
public String getStatusAsString()
getStatus(),
getStatusAsString(Status)public static String getStatusAsString(Activity.Status status)
status - The status code with should be converted into a string.
public String getID()
public GenericWorkflowHandler getHandler()
public GWESLogger getGlog()
public TransitionOccurrence getTransitionOccurrence()
public net.kwfgrid.gworkflowdl.structure.OperationCandidate getOperationCandidate()
public String getOperationName()
public String getResourceName()
public long getTimeoutRunning()
protected void setTimeoutRunning(long timeoutRunning)
timeoutRunning - The timout in milliseconds.public long getTimeoutActive()
protected void setTimeoutActive(long timeoutActive)
timeoutActive - The timout in milliseconds.public String getFaultMessage()
null if there is no fault message.
public void setFaultMessage(String faultMessage)
faultMessage - The fault message as String.public void appendFaultMessage(String faultMessage)
faultMessage - The fault message as String to append.public SOAPFault getSoapFault()
null if there is no fault.public void setSoapFault(SOAPFault soapFault)
soapFault - The fault.public long getStartTimeTotal()
public long getDurationUndefined()
public long getDurationInitiated()
public long getDurationRunning()
public long getDurationActive()
public long getDurationSuspended()
public long getDurationTotal()
public int getAttempts()
public void decreaseAttempts()
public void enqueueActivity()
throws net.kwfgrid.gworkflowdl.structure.WorkflowFormatException
null, then directly start the activity.
net.kwfgrid.gworkflowdl.structure.WorkflowFormatExceptionpublic String[] getStatusArray()
///ToDo update regarding the real output "ID=hoheisel_f2968050-1d6a-11db-bacc-ad353bc1f9b1" "status=COMPLETED" "birthdayMs=1154003111126" "durationUndefinedMs=527" "durationInitiatedMs=792" "durationRunningMs=0" "durationActiveMs=0" "durationSuspendedMs=0" "durationTotalMs=1351" "endTimeMs=1154003112477" "level=MEMORY" "description=test workflow"
public abstract void initiateActivity()
throws ActivityException
ActivityException
public abstract void startActivity()
throws ActivityException,
net.kwfgrid.gworkflowdl.structure.WorkflowFormatException
ActivityException
net.kwfgrid.gworkflowdl.structure.WorkflowFormatException
public abstract void simulateActivity()
throws ActivityException,
net.kwfgrid.gworkflowdl.structure.WorkflowFormatException
ActivityException
net.kwfgrid.gworkflowdl.structure.WorkflowFormatException
public abstract void suspendActivity()
throws ActivityException
ActivityException
public abstract void resumeActivity()
throws ActivityException
ActivityException
public abstract void abortActivity()
throws ActivityException
ActivityException
public abstract void restartActivity()
throws ActivityException
ActivityException
public abstract void cleanupActivity()
throws ActivityException
ActivityExceptionpublic String toString()
toString in class Object
protected void putFaultTokenOnOutputPlaces()
throws net.kwfgrid.gworkflowdl.structure.WorkflowFormatException
net.kwfgrid.gworkflowdl.structure.WorkflowFormatException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||