private void handleEvent(MonitorEvent event, String instanceName, WSGraph graph) {
// TODO Auto-generated method stub
if (-1 == instanceName.indexOf("Control_")) {
EventType type = event.getType();
String nodeID = event.getNodeID();
Node node = graph.getNode(nodeID);
if (type == MonitorUtil.EventType.WORKFLOW_INVOKED) {
// workflowStarted(graph, forward);
LinkedList<InputNode> inputNodes = getInputNodes(graph);
for (InputNode inputNode : inputNodes) {
inputNode.getGUI().setToken(instanceName, NodeState.FINISHED);
}
} else if (type == MonitorUtil.EventType.WORKFLOW_INITIALIZED) {
// workflowStarted(graph, forward);
LinkedList<InputNode> inputNodes = getInputNodes(graph);
for (InputNode inputNode : inputNodes) {
inputNode.getGUI().setToken(instanceName, NodeState.FINISHED);
}
} else if (type == MonitorUtil.EventType.WORKFLOW_TERMINATED) {
LinkedList<OutputNode> outputNodes = getOutputNodes(graph);
for (OutputNode outputNode : outputNodes) {
outputNode.getGUI().setToken(instanceName, NodeState.EXECUTING);
}
} else if (type == EventType.INVOKING_SERVICE
// TODO this should be removed when GPEL sends all notification
// correctly.
|| type == EventType.SERVICE_INVOKED) {
if (node == null) {
logger.warn("There is no node that has ID, " + nodeID);
} else {
node.getGUI().setToken(instanceName, NodeState.EXECUTING);
}
} else if (type == MonitorUtil.EventType.RECEIVED_RESULT
// TODO this should be removed when GPEL sends all notification
// correctly.
|| type == EventType.SENDING_RESULT) {
if (node == null) {
logger.warn("There is no node that has ID, " + nodeID);
} else {
node.getGUI().setToken(instanceName, NodeState.FINISHED);
}
} else if (type == EventType.INVOKING_SERVICE_FAILED || type == EventType.RECEIVED_FAULT
// TODO
|| type == EventType.SENDING_FAULT || type == EventType.SENDING_RESPONSE_FAILED) {
if (node == null) {
logger.warn("There is no node that has ID, " + nodeID);
} else {
node.getGUI().setToken(instanceName, NodeState.FAILED);
}
} else if (type == MonitorUtil.EventType.RESOURCE_MAPPING) {
if (node == null) {
logger.warn("There is no node that has ID, " + nodeID);
} else {