public class GooseWorkflowManager
extends java.lang.Object
The GooseWorkflowManager class is a helper class for Gaggle Geese to carry out workflow related actions. It wraps the most common actions so that Goose does not have to implement them individually.
Here is how it works. When a goose receives a WorkflowAction
from Boss, it should call
addSession(org.systemsbiology.gaggle.core.datatypes.WorkflowAction)
, which stores
the request in the processing queue. addSession generates an ID for each workflowAction received. The ID should
be passed to getWorkflowAction(String)
to retrieve the workflowAction stored in the processing queue.
Some goose (such as Firegoose) employes a polling mechanism and thus needs to call getCurrentRequest()
to retrieve a workflowAction.
User can interact with the goose and generate data to be sent to the next component in the workflow.
Once the data is generated, the goose should call addSessionTargetData(String, int, org.systemsbiology.gaggle.core.datatypes.GaggleData)
to add the data for the component. Note there could be multiple components in
the next step. Therefore, the goose needs to call addSessionTargetData multiple times until each component is
associated with data. Finally, the goose should call CompleteWorkflowAction(Boss, String)
to complete the processing of the
workflowAction. CompleteWorkflowAction passes the data to to the Boss, which triggers the subsequent geese
of the workflow to process the data.
Constructor and Description |
---|
GooseWorkflowManager() |
Modifier and Type | Method and Description |
---|---|
java.lang.String |
addSession(WorkflowAction request)
When a Goose receives a workflowAction from the Boss,
it should call this function to save the workflowAction in the processing queue.
|
void |
addSessionTargetData(java.lang.String requestID,
int targetIndex,
org.systemsbiology.gaggle.core.datatypes.GaggleData data)
Attach data to a goose in the next step of a workflow.
|
boolean |
CompleteWorkflowAction(org.systemsbiology.gaggle.core.Boss boss,
java.lang.String requestID)
All the data are ready, we submit the response to the boss.
|
int |
dataSubmittedForSession(java.lang.String requestID)
Retrieve the number of data elements that have been added for the geese in the next step of the workflow.
|
void |
downloadFileFromUrl(java.lang.String filename,
java.lang.String urlString) |
boolean |
finalizeSessionAction(java.lang.String requestID) |
java.lang.String |
getCurrentRequest()
Retrieve a workflowAction that has not been processed yet.
|
org.systemsbiology.gaggle.core.datatypes.GaggleGooseInfo |
getGooseInfo() |
java.lang.String[] |
getNameList(java.lang.String requestID) |
WorkflowAction |
getSessionResponse(java.lang.String requestID) |
java.lang.String |
getSize(java.lang.String requestID) |
java.lang.String |
getSpecies(java.lang.String requestID) |
java.lang.String |
getSubAction(java.lang.String requestID) |
java.lang.ThreadGroup |
getThreadGroup(java.lang.String name)
Starting from Java 7 update 25, the Java Runtime is using a different
threadgroup (i.e., javawsApplicationThreadGroup) to run web starts.
|
java.lang.String |
getType(java.lang.String requestID) |
WorkflowAction |
getWorkflowAction(java.lang.String requestID)
Get the workflowAction given the requestID
|
java.lang.Object[] |
getWorkflowActionData(java.lang.String requestID) |
void |
invokeLater2(java.lang.ThreadGroup javawsApplicationThreadGroup,
sun.awt.AppContext appContext,
java.lang.Runnable rn)
Starting from Java 7 update 25, the Java Runtime is using a different
threadgroup (i.e., javawsApplicationThreadGroup) to run web starts.
|
org.systemsbiology.gaggle.core.datatypes.GaggleData |
ProcessTextFile(java.lang.String fileurl)
First download a text file from the server, then parse it and output a GaggleData object.
|
void |
removeRequest(java.lang.String requestID)
Remove a workflowAction from the processing queue.
|
void |
RemoveSessionData(java.lang.String requestID)
Remove the workflowAction after finishing handling it.
|
public java.lang.Object[] getWorkflowActionData(java.lang.String requestID)
public java.lang.String getSpecies(java.lang.String requestID)
public java.lang.String[] getNameList(java.lang.String requestID)
public java.lang.String getSize(java.lang.String requestID)
public java.lang.String getType(java.lang.String requestID)
public java.lang.String getSubAction(java.lang.String requestID)
public org.systemsbiology.gaggle.core.datatypes.GaggleGooseInfo getGooseInfo()
public java.lang.String addSession(WorkflowAction request)
When a Goose receives a workflowAction from the Boss, it should call this function to save the workflowAction in the processing queue.
request
- workflowAction received from the Bosspublic WorkflowAction getWorkflowAction(java.lang.String requestID)
Get the workflowAction given the requestID
requestID
- the ID genmerated by addSession.public java.lang.String getCurrentRequest()
public void removeRequest(java.lang.String requestID)
Remove a workflowAction from the processing queue.
requestID
- the ID generated by addSessionpublic void addSessionTargetData(java.lang.String requestID, int targetIndex, org.systemsbiology.gaggle.core.datatypes.GaggleData data)
Attach data to a goose in the next step of a workflow.
requestID
- requestID generated by addSessiontargetIndex
- the index of the target goose in the workflowActiondata
- data to be associated with the target Goosepublic boolean finalizeSessionAction(java.lang.String requestID)
public int dataSubmittedForSession(java.lang.String requestID)
Retrieve the number of data elements that have been added for the geese in the next step of the workflow.
requestID
- the ID generated by addSessionpublic WorkflowAction getSessionResponse(java.lang.String requestID)
public void RemoveSessionData(java.lang.String requestID)
Remove the workflowAction after finishing handling it.
requestID
- the ID generated by addSessionpublic boolean CompleteWorkflowAction(org.systemsbiology.gaggle.core.Boss boss, java.lang.String requestID)
All the data are ready, we submit the response to the boss.
boss
- Boss that supports the Boss3 interfacerequestID
- requestID generated by addSessionpublic void downloadFileFromUrl(java.lang.String filename, java.lang.String urlString) throws java.lang.Exception
java.lang.Exception
public org.systemsbiology.gaggle.core.datatypes.GaggleData ProcessTextFile(java.lang.String fileurl)
fileurl
- the url of the file to be parsed.public java.lang.ThreadGroup getThreadGroup(java.lang.String name)
name
- public void invokeLater2(java.lang.ThreadGroup javawsApplicationThreadGroup, sun.awt.AppContext appContext, java.lang.Runnable rn)
javawsApplicationThreadGroup
- appContext
- rn
-