You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airavata.apache.org by ch...@apache.org on 2012/03/26 20:32:33 UTC

svn commit: r1305483 [1/2] - in /incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya: component/registry/ graph/ graph/system/gui/ interpretor/ util/

Author: chathura
Date: Mon Mar 26 18:32:32 2012
New Revision: 1305483

URL: http://svn.apache.org/viewvc?rev=1305483&view=rev
Log:
AIRAVATA-298

Adding the ability to have differed inputs to the workflow interpreter. Adding a new component Differed input component which will trigger a input dialog box only when a component has all but this particular input is satisfied. This inputs shall now be prompted at the begining of the workflow execution dialog.

Added:
    incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/graph/system/gui/DifferedInputComponent.java
    incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/graph/system/gui/DifferedInputConfigurationDialog.java
    incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/graph/system/gui/DifferedInputHandler.java
    incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/graph/system/gui/DifferedInputNode.java
    incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/graph/system/gui/DifferedInputNodeGUI.java
Modified:
    incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/component/registry/SystemComponentRegistry.java
    incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/graph/GraphSchema.java
    incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/interpretor/WorkflowInterpreter.java
    incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/util/InterpreterUtil.java

Modified: incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/component/registry/SystemComponentRegistry.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/component/registry/SystemComponentRegistry.java?rev=1305483&r1=1305482&r2=1305483&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/component/registry/SystemComponentRegistry.java (original)
+++ incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/component/registry/SystemComponentRegistry.java Mon Mar 26 18:32:32 2012
@@ -41,6 +41,7 @@ import org.apache.airavata.xbaya.compone
 import org.apache.airavata.xbaya.component.system.OutputComponent;
 import org.apache.airavata.xbaya.component.system.ReceiveComponent;
 import org.apache.airavata.xbaya.component.system.S3InputComponent;
+import org.apache.airavata.xbaya.graph.system.gui.DifferedInputComponent;
 
 public class SystemComponentRegistry extends ComponentRegistry {
 
@@ -55,6 +56,7 @@ public class SystemComponentRegistry ext
         // Use LinkedHashMap to preserve the order.
         this.componentMap = new LinkedHashMap<String, Component>();
         this.componentMap.put(InputComponent.NAME, new InputComponent());
+        this.componentMap.put(DifferedInputComponent.NAME, new DifferedInputComponent());
         this.componentMap.put(S3InputComponent.NAME, new S3InputComponent());
         this.componentMap.put(OutputComponent.NAME, new OutputComponent());
         this.componentMap.put(ConstantComponent.NAME, new ConstantComponent());

Modified: incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/graph/GraphSchema.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/graph/GraphSchema.java?rev=1305483&r1=1305482&r2=1305483&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/graph/GraphSchema.java (original)
+++ incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/graph/GraphSchema.java Mon Mar 26 18:32:32 2012
@@ -373,4 +373,6 @@ public class GraphSchema {
 
     public static final String NODE_STREAM_LABEL_TAG = "streamlabel";
 
+	public static final String NODE_TYPE_DIFFERED_INPUT = "Differed Input";
+
 }
\ No newline at end of file

Added: incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/graph/system/gui/DifferedInputComponent.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/graph/system/gui/DifferedInputComponent.java?rev=1305483&view=auto
==============================================================================
--- incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/graph/system/gui/DifferedInputComponent.java (added)
+++ incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/graph/system/gui/DifferedInputComponent.java Mon Mar 26 18:32:32 2012
@@ -0,0 +1,116 @@
+/*
+ * Copyright (c) 2012 Extreme! Lab, Indiana University. All rights reserved.
+ *
+ * This software is open source. See the bottom of this file for the license.
+ *
+ * $Id: $
+ */
+package org.apache.airavata.xbaya.graph.system.gui;
+
+import org.apache.airavata.xbaya.component.system.SystemComponent;
+import org.apache.airavata.xbaya.component.system.SystemComponentDataPort;
+import org.apache.airavata.xbaya.graph.Graph;
+
+/**
+ * @author Chathura Herath
+ */
+public class DifferedInputComponent extends SystemComponent {
+
+    /**
+     * The name of the input component
+     */
+    public static final String NAME = "DifferedInput";
+
+    private static final String DESCRIPTION = "A system component that represents an differred input parameter of a workflow.";
+
+    private static final String PORT_NAME = "Parameter";
+
+    /**
+     * The description.
+     */
+    private static final String PORT_DESCRIPTION = "This port can be connected to any type.";
+
+    /**
+     * Creates an InputComponent.
+     */
+    public DifferedInputComponent() {
+        super();
+        setName(NAME);
+        setDescription(DESCRIPTION);
+
+        SystemComponentDataPort port = new SystemComponentDataPort(PORT_NAME);
+        port.setDescription(PORT_DESCRIPTION);
+        this.outputs.add(port);
+    }
+
+    /**
+     * @see edu.indiana.extreme.xbaya.component.Component#createNode(edu.indiana.extreme.xbaya.graph.Graph)
+     */
+    @Override
+    public DifferedInputNode createNode(Graph graph) {
+    	DifferedInputNode node = new DifferedInputNode(graph);
+        node.setName(NAME);
+        node.setComponent(this);
+
+        // Creates a unique ID for the node. This has to be after setName().
+        node.createID();
+
+        // Creates a output port
+        createPorts(node);
+
+        return node;
+    }
+
+}
+
+
+/*
+ * Indiana University Extreme! Lab Software License, Version 1.2
+ * 
+ * Copyright (c) 2012 The Trustees of Indiana University. All rights reserved.
+ * 
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * 
+ * 1) All redistributions of source code must retain the above copyright notice,
+ * the list of authors in the original source code, this list of conditions and
+ * the disclaimer listed in this license;
+ * 
+ * 2) All redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the disclaimer listed in this license in
+ * the documentation and/or other materials provided with the distribution;
+ * 
+ * 3) Any documentation included with all redistributions must include the
+ * following acknowledgement:
+ * 
+ * "This product includes software developed by the Indiana University Extreme!
+ * Lab. For further information please visit http://www.extreme.indiana.edu/"
+ * 
+ * Alternatively, this acknowledgment may appear in the software itself, and
+ * wherever such third-party acknowledgments normally appear.
+ * 
+ * 4) The name "Indiana University" or "Indiana University Extreme! Lab" shall
+ * not be used to endorse or promote products derived from this software without
+ * prior written permission from Indiana University. For written permission,
+ * please contact http://www.extreme.indiana.edu/.
+ * 
+ * 5) Products derived from this software may not use "Indiana University" name
+ * nor may "Indiana University" appear in their name, without prior written
+ * permission of the Indiana University.
+ * 
+ * Indiana University provides no reassurances that the source code provided
+ * does not infringe the patent or any other intellectual property rights of any
+ * other entity. Indiana University disclaims any liability to any recipient for
+ * claims brought by any other entity based on infringement of intellectual
+ * property rights or otherwise.
+ * 
+ * LICENSEE UNDERSTANDS THAT SOFTWARE IS PROVIDED "AS IS" FOR WHICH NO
+ * WARRANTIES AS TO CAPABILITIES OR ACCURACY ARE MADE. INDIANA UNIVERSITY GIVES
+ * NO WARRANTIES AND MAKES NO REPRESENTATION THAT SOFTWARE IS FREE OF
+ * INFRINGEMENT OF THIRD PARTY PATENT, COPYRIGHT, OR OTHER PROPRIETARY RIGHTS.
+ * INDIANA UNIVERSITY MAKES NO WARRANTIES THAT SOFTWARE IS FREE FROM "BUGS",
+ * "VIRUSES", "TROJAN HORSES", "TRAP DOORS", "WORMS", OR OTHER HARMFUL CODE.
+ * LICENSEE ASSUMES THE ENTIRE RISK AS TO THE PERFORMANCE OF SOFTWARE AND/OR
+ * ASSOCIATED MATERIALS, AND TO THE PERFORMANCE AND VALIDITY OF INFORMATION
+ * GENERATED USING SOFTWARE.
+ */

Added: incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/graph/system/gui/DifferedInputConfigurationDialog.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/graph/system/gui/DifferedInputConfigurationDialog.java?rev=1305483&view=auto
==============================================================================
--- incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/graph/system/gui/DifferedInputConfigurationDialog.java (added)
+++ incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/graph/system/gui/DifferedInputConfigurationDialog.java Mon Mar 26 18:32:32 2012
@@ -0,0 +1,301 @@
+/*
+ * Copyright (c) 2012 Extreme! Lab, Indiana University. All rights reserved.
+ *
+ * This software is open source. See the bottom of this file for the license.
+ *
+ * $Id: $
+ */
+package org.apache.airavata.xbaya.graph.system.gui;
+
+import java.awt.event.ActionEvent;
+
+import javax.swing.AbstractAction;
+import javax.swing.JButton;
+import javax.swing.JPanel;
+import javax.xml.namespace.QName;
+
+import org.apache.airavata.common.utils.WSConstants;
+import org.apache.airavata.common.utils.XMLUtil;
+import org.apache.airavata.xbaya.XBayaEngine;
+import org.apache.airavata.xbaya.gui.GridPanel;
+import org.apache.airavata.xbaya.gui.XBayaDialog;
+import org.apache.airavata.xbaya.gui.XBayaLabel;
+import org.apache.airavata.xbaya.gui.XBayaTextArea;
+import org.apache.airavata.xbaya.gui.XBayaTextComponent;
+import org.apache.airavata.xbaya.gui.XBayaTextField;
+import org.apache.airavata.xbaya.lead.LEADTypes;
+import org.apache.airavata.xbaya.monitor.gui.MonitorEventHandler.NodeState;
+import org.xmlpull.infoset.XmlElement;
+
+/**
+ * @author Chathura Herath
+ */
+public class DifferedInputConfigurationDialog {
+    private XBayaEngine engine;
+
+    private DifferedInputNode node;
+
+    private XBayaDialog dialog;
+
+    private GridPanel gridPanel;
+
+    private XBayaTextField nameTextField;
+
+    private XBayaTextArea descriptionTextArea;
+
+    private XBayaLabel valueLabel;
+
+    private XBayaTextField valueTextField;
+
+    private XBayaTextArea valueTextArea;
+
+    private XBayaTextArea metadataTextArea;
+
+    /**
+     * Constructs an InputConfigurationWindow.
+     * 
+     * @param node
+     * @param engine
+     */
+    public DifferedInputConfigurationDialog(DifferedInputNode node, XBayaEngine engine) {
+        this.engine = engine;
+        this.node = node;
+        initGui();
+    }
+
+    /**
+     * Shows the dialog.
+     */
+    public void show() {
+        QName type = this.node.getParameterType();
+        XBayaTextComponent textComponent;
+        boolean knownType = LEADTypes.isKnownType(type);
+        if (knownType) {
+            textComponent = this.valueTextField;
+            this.valueLabel.setText("Default value");
+        } else {
+            textComponent = this.valueTextArea;
+            this.valueLabel.setText("Default value (in XML)");
+        }
+        this.valueLabel.setLabelFor(textComponent);
+        final int index = 5;
+        this.gridPanel.remove(index);
+        this.gridPanel.add(textComponent, index);
+        if (knownType) {
+            this.gridPanel.layout(new double[] { 0, 1.0 / 2, 0, 1.0 / 2 },
+                    new double[] { 0, 1 });
+        } else {
+            this.gridPanel.layout(
+                    new double[] { 0, 1.0 / 3, 1.0 / 3, 1.0 / 3 },
+                    new double[] { 0, 1 });
+        }
+
+        // String name = this.node.getConfiguredName();
+        // if (name == null) {
+        // name = this.node.getName();
+        // }
+        String name = this.node.getID(); // Show ID.
+        this.nameTextField.setText(name);
+
+        this.descriptionTextArea.setText(this.node.getDescription());
+        Object value = this.node.getDefaultValue();
+        String valueString;
+        if (value == null) {
+            valueString = "";
+        } else if (value instanceof XmlElement) {
+            valueString = XMLUtil.xmlElementToString((XmlElement) value);
+        } else {
+            valueString = value.toString();
+        }
+        textComponent.setText(valueString);
+        XmlElement metadata = this.node.getMetadata();
+        String metadataText;
+        if (metadata == null) {
+            metadataText = WSConstants.EMPTY_APPINFO;
+        } else {
+            metadataText = XMLUtil.xmlElementToString(metadata);
+        }
+        this.metadataTextArea.setText(metadataText);
+
+        this.dialog.show();
+    }
+
+    /**
+     * Hides the dialog.
+     */
+    private void hide() {
+    	
+        this.dialog.hide();
+        this.node.getGUI().closingDisplay();
+    }
+
+    private void setInput() {
+        QName type = this.node.getParameterType();
+        XBayaTextComponent textComponent;
+        if (LEADTypes.isKnownType(type)) {
+            textComponent = this.valueTextField;
+        } else {
+            textComponent = this.valueTextArea;
+        }
+
+        String name = this.nameTextField.getText();
+        String description = this.descriptionTextArea.getText();
+        String valueString = textComponent.getText();
+        String metadataText = this.metadataTextArea.getText();
+
+        if (name.length() == 0) {
+            String warning = "The name cannot be empty.";
+            this.engine.getErrorWindow().error(warning);
+            return;
+        }
+        Object value = null;
+        if (valueString.length() > 0) {
+            if (LEADTypes.isKnownType(type)) {
+                if (!this.node.isInputValid(valueString)) {
+                    String warning = "The defalut value is not valid for "
+                            + this.node.getParameterType() + ".";
+                    this.engine.getErrorWindow().error(warning);
+                }
+                value = valueString;
+            } else {
+                try {
+                    value = XMLUtil.stringToXmlElement(valueString);
+                } catch (RuntimeException e) {
+                    String warning = "The XML for the default value is not valid.";
+                    this.engine.getErrorWindow().error(warning, e);
+                }
+            }
+        }
+        XmlElement metadata;
+        if (metadataText.length() == 0) {
+            metadata = null;
+        } else {
+            try {
+                metadata = XMLUtil.stringToXmlElement(metadataText);
+            } catch (RuntimeException e) {
+                String warning = "The metadata is ill-formed.";
+                this.engine.getErrorWindow().error(warning, e);
+                return;
+            }
+        }
+
+        this.node.setConfigured(true);
+        this.node.setConfiguredName(name);
+        this.node.setDescription(description);
+        this.node.setDefaultValue(value);
+        this.node.setMetadata(metadata);
+        this.node.getGUI().setBodyColor(NodeState.FINISHED.color);
+        
+        hide();
+        this.engine.getGUI().getGraphCanvas().repaint();
+    }
+
+    /**
+     * Initializes the GUI.
+     */
+    private void initGui() {
+        this.nameTextField = new XBayaTextField();
+        XBayaLabel nameLabel = new XBayaLabel("Name", this.nameTextField);
+
+        this.descriptionTextArea = new XBayaTextArea();
+        XBayaLabel descriptionLabel = new XBayaLabel("Description",
+                this.descriptionTextArea);
+
+        this.valueTextField = new XBayaTextField(); // for string
+        this.valueTextArea = new XBayaTextArea(); // for XML
+        // temporaly set text field.
+        this.valueLabel = new XBayaLabel("", this.valueTextField);
+
+        this.metadataTextArea = new XBayaTextArea();
+        XBayaLabel metadataLabel = new XBayaLabel("Metadata",
+                this.metadataTextArea);
+
+        this.gridPanel = new GridPanel();
+        this.gridPanel.add(nameLabel);
+        this.gridPanel.add(this.nameTextField);
+        this.gridPanel.add(descriptionLabel);
+        this.gridPanel.add(this.descriptionTextArea);
+        this.gridPanel.add(this.valueLabel);
+        this.gridPanel.add(this.valueTextField);
+        this.gridPanel.add(metadataLabel);
+        this.gridPanel.add(this.metadataTextArea);
+        this.gridPanel.layout(4, 2, 3, 1);
+
+        JButton okButton = new JButton("OK");
+        okButton.addActionListener(new AbstractAction() {
+            @Override
+			public void actionPerformed(ActionEvent e) {
+                setInput();
+            }
+        });
+
+        JButton cancelButton = new JButton("Cancel");
+        cancelButton.addActionListener(new AbstractAction() {
+            @Override
+			public void actionPerformed(ActionEvent e) {
+                hide();
+            }
+        });
+
+        JPanel buttonPanel = new JPanel();
+        buttonPanel.add(okButton);
+        buttonPanel.add(cancelButton);
+
+        this.dialog = new XBayaDialog(this.engine,
+                "Input Parameter Configuration", this.gridPanel, buttonPanel);
+        this.dialog.setDefaultButton(okButton);
+    }
+
+}
+
+
+/*
+ * Indiana University Extreme! Lab Software License, Version 1.2
+ * 
+ * Copyright (c) 2012 The Trustees of Indiana University. All rights reserved.
+ * 
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * 
+ * 1) All redistributions of source code must retain the above copyright notice,
+ * the list of authors in the original source code, this list of conditions and
+ * the disclaimer listed in this license;
+ * 
+ * 2) All redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the disclaimer listed in this license in
+ * the documentation and/or other materials provided with the distribution;
+ * 
+ * 3) Any documentation included with all redistributions must include the
+ * following acknowledgement:
+ * 
+ * "This product includes software developed by the Indiana University Extreme!
+ * Lab. For further information please visit http://www.extreme.indiana.edu/"
+ * 
+ * Alternatively, this acknowledgment may appear in the software itself, and
+ * wherever such third-party acknowledgments normally appear.
+ * 
+ * 4) The name "Indiana University" or "Indiana University Extreme! Lab" shall
+ * not be used to endorse or promote products derived from this software without
+ * prior written permission from Indiana University. For written permission,
+ * please contact http://www.extreme.indiana.edu/.
+ * 
+ * 5) Products derived from this software may not use "Indiana University" name
+ * nor may "Indiana University" appear in their name, without prior written
+ * permission of the Indiana University.
+ * 
+ * Indiana University provides no reassurances that the source code provided
+ * does not infringe the patent or any other intellectual property rights of any
+ * other entity. Indiana University disclaims any liability to any recipient for
+ * claims brought by any other entity based on infringement of intellectual
+ * property rights or otherwise.
+ * 
+ * LICENSEE UNDERSTANDS THAT SOFTWARE IS PROVIDED "AS IS" FOR WHICH NO
+ * WARRANTIES AS TO CAPABILITIES OR ACCURACY ARE MADE. INDIANA UNIVERSITY GIVES
+ * NO WARRANTIES AND MAKES NO REPRESENTATION THAT SOFTWARE IS FREE OF
+ * INFRINGEMENT OF THIRD PARTY PATENT, COPYRIGHT, OR OTHER PROPRIETARY RIGHTS.
+ * INDIANA UNIVERSITY MAKES NO WARRANTIES THAT SOFTWARE IS FREE FROM "BUGS",
+ * "VIRUSES", "TROJAN HORSES", "TRAP DOORS", "WORMS", OR OTHER HARMFUL CODE.
+ * LICENSEE ASSUMES THE ENTIRE RISK AS TO THE PERFORMANCE OF SOFTWARE AND/OR
+ * ASSOCIATED MATERIALS, AND TO THE PERFORMANCE AND VALIDITY OF INFORMATION
+ * GENERATED USING SOFTWARE.
+ */

Added: incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/graph/system/gui/DifferedInputHandler.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/graph/system/gui/DifferedInputHandler.java?rev=1305483&view=auto
==============================================================================
--- incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/graph/system/gui/DifferedInputHandler.java (added)
+++ incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/graph/system/gui/DifferedInputHandler.java Mon Mar 26 18:32:32 2012
@@ -0,0 +1,127 @@
+/*
+ * Copyright (c) 2012 Extreme! Lab, Indiana University. All rights reserved.
+ *
+ * This software is open source. See the bottom of this file for the license.
+ *
+ * $Id: $
+ */
+package org.apache.airavata.xbaya.graph.system.gui;
+
+import java.util.List;
+
+import org.apache.airavata.xbaya.XBayaEngine;
+import org.apache.airavata.xbaya.graph.DataPort;
+import org.apache.airavata.xbaya.graph.Node;
+
+/**
+ * @author Chathura Herath
+ */
+public class DifferedInputHandler {
+	
+	
+	public static void handleDifferredInputsofDependentNodes(Node node, final XBayaEngine engine){
+		List<DataPort> inputPorts = node.getInputPorts();
+		for (DataPort dataPort : inputPorts) {
+			Node fromNode = dataPort.getFromNode();
+			if(isDifferedInputNode(fromNode)){
+				final DifferedInputNode differedInputNode = (DifferedInputNode)fromNode;
+				if(!differedInputNode.isConfigured()){
+					//not configured differed node this is what we are looking for
+					//set the flag and ensure all the rest is finished
+					Runnable task = new Runnable() {
+						
+						@Override
+						public void run() {
+							differedInputNode.getGUI().showConfigurationDialog(engine );
+						}
+					};
+					new Thread(task).start();
+					
+					
+					
+				}
+			}
+		}
+	}
+	
+	
+	
+	public static boolean onlyWaitingOnIncompleteDifferedInputNode(Node node){
+		List<DataPort> inputPorts = node.getInputPorts();
+		boolean atleadOneDifferedInputNodeIsIncomplete = false; 
+		for (DataPort dataPort : inputPorts) {
+			Node fromNode = dataPort.getFromNode();
+			if(fromNode.isFinished()){
+				//no op
+			}else if(isDifferedInputNode(fromNode)){
+				//not finished
+				if(!((DifferedInputNode)node).isConfigured()){
+					//not configured differed node this is what we are looking for
+					//set the flag and ensure all the rest is finished
+					atleadOneDifferedInputNodeIsIncomplete = true;
+				}
+			}else{
+				//there is a not finished non differed input node
+				return false;
+			}
+		}
+		//if not finished nodes were found we wil not be here so
+		return atleadOneDifferedInputNodeIsIncomplete;
+	}
+	public static boolean isDifferedInputNode(Node node){
+		return node instanceof DifferedInputNode;
+	}
+
+}
+
+
+/*
+ * Indiana University Extreme! Lab Software License, Version 1.2
+ * 
+ * Copyright (c) 2012 The Trustees of Indiana University. All rights reserved.
+ * 
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * 
+ * 1) All redistributions of source code must retain the above copyright notice,
+ * the list of authors in the original source code, this list of conditions and
+ * the disclaimer listed in this license;
+ * 
+ * 2) All redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the disclaimer listed in this license in
+ * the documentation and/or other materials provided with the distribution;
+ * 
+ * 3) Any documentation included with all redistributions must include the
+ * following acknowledgement:
+ * 
+ * "This product includes software developed by the Indiana University Extreme!
+ * Lab. For further information please visit http://www.extreme.indiana.edu/"
+ * 
+ * Alternatively, this acknowledgment may appear in the software itself, and
+ * wherever such third-party acknowledgments normally appear.
+ * 
+ * 4) The name "Indiana University" or "Indiana University Extreme! Lab" shall
+ * not be used to endorse or promote products derived from this software without
+ * prior written permission from Indiana University. For written permission,
+ * please contact http://www.extreme.indiana.edu/.
+ * 
+ * 5) Products derived from this software may not use "Indiana University" name
+ * nor may "Indiana University" appear in their name, without prior written
+ * permission of the Indiana University.
+ * 
+ * Indiana University provides no reassurances that the source code provided
+ * does not infringe the patent or any other intellectual property rights of any
+ * other entity. Indiana University disclaims any liability to any recipient for
+ * claims brought by any other entity based on infringement of intellectual
+ * property rights or otherwise.
+ * 
+ * LICENSEE UNDERSTANDS THAT SOFTWARE IS PROVIDED "AS IS" FOR WHICH NO
+ * WARRANTIES AS TO CAPABILITIES OR ACCURACY ARE MADE. INDIANA UNIVERSITY GIVES
+ * NO WARRANTIES AND MAKES NO REPRESENTATION THAT SOFTWARE IS FREE OF
+ * INFRINGEMENT OF THIRD PARTY PATENT, COPYRIGHT, OR OTHER PROPRIETARY RIGHTS.
+ * INDIANA UNIVERSITY MAKES NO WARRANTIES THAT SOFTWARE IS FREE FROM "BUGS",
+ * "VIRUSES", "TROJAN HORSES", "TRAP DOORS", "WORMS", OR OTHER HARMFUL CODE.
+ * LICENSEE ASSUMES THE ENTIRE RISK AS TO THE PERFORMANCE OF SOFTWARE AND/OR
+ * ASSOCIATED MATERIALS, AND TO THE PERFORMANCE AND VALIDITY OF INFORMATION
+ * GENERATED USING SOFTWARE.
+ */

Added: incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/graph/system/gui/DifferedInputNode.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/graph/system/gui/DifferedInputNode.java?rev=1305483&view=auto
==============================================================================
--- incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/graph/system/gui/DifferedInputNode.java (added)
+++ incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/graph/system/gui/DifferedInputNode.java Mon Mar 26 18:32:32 2012
@@ -0,0 +1,360 @@
+/*
+ * Copyright (c) 2012 Extreme! Lab, Indiana University. All rights reserved.
+ *
+ * This software is open source. See the bottom of this file for the license.
+ *
+ * $Id: $
+ */
+package org.apache.airavata.xbaya.graph.system.gui;
+
+import java.util.List;
+
+import javax.xml.namespace.QName;
+
+import org.apache.airavata.common.utils.WSConstants;
+import org.apache.airavata.xbaya.XBayaRuntimeException;
+import org.apache.airavata.xbaya.component.Component;
+import org.apache.airavata.xbaya.component.system.InputComponent;
+import org.apache.airavata.xbaya.component.ws.WSComponentPort;
+import org.apache.airavata.xbaya.graph.DataEdge;
+import org.apache.airavata.xbaya.graph.DataPort;
+import org.apache.airavata.xbaya.graph.Edge;
+import org.apache.airavata.xbaya.graph.Graph;
+import org.apache.airavata.xbaya.graph.GraphException;
+import org.apache.airavata.xbaya.graph.GraphSchema;
+import org.apache.airavata.xbaya.graph.Port;
+import org.apache.airavata.xbaya.graph.system.ParameterNode;
+import org.apache.airavata.xbaya.graph.system.SystemDataPort;
+import org.apache.airavata.xbaya.graph.ws.WSPort;
+import org.xmlpull.infoset.XmlElement;
+
+import xsul5.MLogger;
+
+/**
+ * @author Chathura Herath
+ */
+public class DifferedInputNode extends ParameterNode {
+
+	private static final String VALUE_TAG_NAME = "value";
+
+    private static final MLogger logger = MLogger.getLogger();
+
+    private Object defaultValue;
+
+    private DifferedInputNodeGUI gui;
+
+    /**
+     * Creates an InputNode.
+     * 
+     * @param graph
+     */
+    public DifferedInputNode(Graph graph) {
+        super(graph);
+    }
+
+    /**
+     * Constructs an InputNode.
+     * 
+     * @param nodeElement
+     * @throws GraphException
+     */
+    public DifferedInputNode(XmlElement nodeElement) throws GraphException {
+        super(nodeElement);
+    }
+
+    /**
+     * @see edu.indiana.extreme.xbaya.graph.Node#getGUI()
+     */
+    @Override
+	public DifferedInputNodeGUI getGUI() {
+        if (this.gui == null) {
+            this.gui = new DifferedInputNodeGUI(this);
+        }
+        return this.gui;
+    }
+
+    /**
+     * @see edu.indiana.extreme.xbaya.graph.impl.NodeImpl#getComponent()
+     */
+    @Override
+    public Component getComponent() {
+        Component component = super.getComponent();
+        if (component == null) {
+            // The component is null when read from the graph XML.
+            component = new DifferedInputComponent();
+            setComponent(component);
+        }
+        return component;
+    }
+
+    /**
+     * Returns the type of the parameter
+     * 
+     * @return The type of the parameter (e.g. string, int)
+     */
+    @Override
+    public QName getParameterType() {
+        List<DataEdge> edges = getEdges();
+        QName parameterType = super.getParameterType();
+        if (parameterType == null && getEdges().size() > 0) {
+            // This happens when the graph XML doesn't have parameterType.
+            DataEdge edge = edges.get(0);
+            DataPort toPort = edge.getToPort();
+            parameterType = toPort.getType();
+        }
+        return parameterType;
+    }
+
+    /**
+     * Returns the default value.
+     * 
+     * @return The defaultValue.
+     */
+    public Object getDefaultValue() {
+        return this.defaultValue;
+    }
+
+    /**
+     * Sets the default value.
+     * 
+     * @param defaultValue
+     *            The default value to set.
+     */
+    public void setDefaultValue(Object defaultValue) {
+        this.defaultValue = defaultValue;
+    }
+
+    /**
+     * Returns the port of this InputNode.
+     * 
+     * Note that an InputNode always has only one output port.
+     * 
+     * @return The port
+     */
+    @Override
+    public SystemDataPort getPort() {
+        return (SystemDataPort) getOutputPorts().get(0);
+    }
+
+    /**
+     * Returns the first port that this input node is connected to.
+     * 
+     * @return The first port that this input node is connected to
+     */
+    @Override
+    public Port getConnectedPort() {
+        return getPort().getEdge(0).getToPort();
+    }
+
+    /**
+     * Checks if the user input is valid.
+     * 
+     * @param input
+     *            The user input
+     * @return true if the user input is valid against the parameter type; false
+     *         otherwise
+     */
+    public boolean isInputValid(String input) {
+        logger.entering(new Object[] { input });
+        // TODO type checks
+        return true;
+    }
+
+    /**
+     * Called whan an Edge was added to the parameter port. Change the name of
+     * this node.
+     * 
+     * @throws GraphException
+     * 
+     * @see edu.indiana.extreme.xbaya.graph.impl.NodeImpl#edgeWasAdded(edu.indiana.extreme.xbaya.graph.impl.EdgeImpl)
+     */
+    @Override
+    protected void edgeWasAdded(Edge edge) throws GraphException {
+        super.edgeWasAdded(edge);
+
+        // TODO organize this.
+        if (edge instanceof DataEdge) {
+            DataEdge dataEdge = (DataEdge) edge;
+            DataPort toPort = dataEdge.getToPort();
+            QName toType = toPort.getType();
+
+            List<DataEdge> edges = getEdges();
+            if (edges.size() == 1) {
+                // The first edge.
+                setParameterType(toType);
+
+                if (!isConfigured() && toPort instanceof WSPort) {
+                    // Copy
+                    copyDefaultConfiguration((WSPort) toPort);
+                }
+            } else if (edges.size() > 1) {
+                // Not the first edge.
+                QName parameterType = getParameterType();
+                if (!toType.equals(WSConstants.XSD_ANY_TYPE)
+                        && !parameterType.equals(toType)) {
+                    throw new GraphException(
+                            "Cannot connect ports with different types.");
+                }
+
+            } else {
+                // Should not happen.
+                throw new XBayaRuntimeException("edges.size(): " + edges.size());
+            }
+        }
+    }
+
+    /**
+     * Called whan an Edge was removed from the parameter port. Change the name
+     * of the node.
+     * 
+     * @see edu.indiana.extreme.xbaya.graph.impl.NodeImpl#edgeWasRemoved(edu.indiana.extreme.xbaya.graph.impl.EdgeImpl)
+     */
+    @Override
+    protected void edgeWasRemoved(Edge removedEdge) {
+        super.edgeWasRemoved(removedEdge);
+        // TODO organize this.
+        List<DataEdge> edges = getEdges();
+        if (edges.size() == 0) {
+            setParameterType(null);
+
+            if (!isConfigured()) {
+                // Reset
+                setName(getComponent().getName());
+                setDescription("");
+                setDefaultValue(null);
+                setMetadata(null);
+            }
+
+        } else {
+            Edge edge = edges.get(0);
+            Port toPort = edge.getToPort();
+            WSPort toWsPort = (WSPort) toPort;
+            QName toType = toWsPort.getType();
+            setParameterType(toType);
+
+            if (!isConfigured()) {
+                // Copy
+                copyDefaultConfiguration(toWsPort);
+            }
+        }
+    }
+
+    /**
+     * @see edu.indiana.extreme.xbaya.graph.system.SystemNode#portTypeChanged(edu.indiana.extreme.xbaya.graph.system.SystemDataPort)
+     */
+    @Override
+    protected void portTypeChanged(SystemDataPort port) throws GraphException {
+        super.portTypeChanged(port);
+        setParameterType(port.getType());
+    }
+
+    @Override
+    protected void parseComponent(XmlElement componentElement) {
+        // No need to parse the XML.
+        setComponent(new InputComponent());
+    }
+
+    @Override
+    protected void parseConfiguration(XmlElement configElement) {
+        super.parseConfiguration(configElement);
+        XmlElement element = configElement.element(null, VALUE_TAG_NAME);
+        if (element != null) {
+            // It might be a String or XmlElement
+            for (Object child : element.children()) {
+                if (child instanceof String) {
+                    if (((String) child).trim().length() == 0) {
+                        // Skip white space before xml element.
+                        continue;
+                    }
+                }
+                this.defaultValue = child;
+                break;
+            }
+            // this.defaultValue = element.requiredText();
+        }
+    }
+
+    @Override
+    public XmlElement toXML() {
+        XmlElement nodeElement = super.toXML();
+        nodeElement.setAttributeValue(GraphSchema.NS,
+                GraphSchema.NODE_TYPE_ATTRIBUTE, GraphSchema.NODE_TYPE_DIFFERED_INPUT);
+        return nodeElement;
+    }
+
+    @Override
+    protected XmlElement addConfigurationElement(XmlElement nodeElement) {
+        XmlElement configElement = super.addConfigurationElement(nodeElement);
+        if (this.defaultValue != null) {
+            XmlElement element = configElement.addElement(GraphSchema.NS,
+                    VALUE_TAG_NAME);
+            element.addChild(this.defaultValue);
+        }
+        return configElement;
+    }
+
+    /**
+     * @param toWSPort
+     */
+    private void copyDefaultConfiguration(WSPort toWSPort) {
+        // TODO support recursive search for WSPort in case the input is
+        // connected to special nodes.
+        setName(toWSPort.getName());
+        WSComponentPort componentPort = toWSPort.getComponentPort();
+        setDescription(componentPort.getDescription());
+        setDefaultValue(componentPort.getDefaultValue());
+        setMetadata(componentPort.getAppinfo());
+    }
+}
+
+
+/*
+ * Indiana University Extreme! Lab Software License, Version 1.2
+ * 
+ * Copyright (c) 2012 The Trustees of Indiana University. All rights reserved.
+ * 
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * 
+ * 1) All redistributions of source code must retain the above copyright notice,
+ * the list of authors in the original source code, this list of conditions and
+ * the disclaimer listed in this license;
+ * 
+ * 2) All redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the disclaimer listed in this license in
+ * the documentation and/or other materials provided with the distribution;
+ * 
+ * 3) Any documentation included with all redistributions must include the
+ * following acknowledgement:
+ * 
+ * "This product includes software developed by the Indiana University Extreme!
+ * Lab. For further information please visit http://www.extreme.indiana.edu/"
+ * 
+ * Alternatively, this acknowledgment may appear in the software itself, and
+ * wherever such third-party acknowledgments normally appear.
+ * 
+ * 4) The name "Indiana University" or "Indiana University Extreme! Lab" shall
+ * not be used to endorse or promote products derived from this software without
+ * prior written permission from Indiana University. For written permission,
+ * please contact http://www.extreme.indiana.edu/.
+ * 
+ * 5) Products derived from this software may not use "Indiana University" name
+ * nor may "Indiana University" appear in their name, without prior written
+ * permission of the Indiana University.
+ * 
+ * Indiana University provides no reassurances that the source code provided
+ * does not infringe the patent or any other intellectual property rights of any
+ * other entity. Indiana University disclaims any liability to any recipient for
+ * claims brought by any other entity based on infringement of intellectual
+ * property rights or otherwise.
+ * 
+ * LICENSEE UNDERSTANDS THAT SOFTWARE IS PROVIDED "AS IS" FOR WHICH NO
+ * WARRANTIES AS TO CAPABILITIES OR ACCURACY ARE MADE. INDIANA UNIVERSITY GIVES
+ * NO WARRANTIES AND MAKES NO REPRESENTATION THAT SOFTWARE IS FREE OF
+ * INFRINGEMENT OF THIRD PARTY PATENT, COPYRIGHT, OR OTHER PROPRIETARY RIGHTS.
+ * INDIANA UNIVERSITY MAKES NO WARRANTIES THAT SOFTWARE IS FREE FROM "BUGS",
+ * "VIRUSES", "TROJAN HORSES", "TRAP DOORS", "WORMS", OR OTHER HARMFUL CODE.
+ * LICENSEE ASSUMES THE ENTIRE RISK AS TO THE PERFORMANCE OF SOFTWARE AND/OR
+ * ASSOCIATED MATERIALS, AND TO THE PERFORMANCE AND VALIDITY OF INFORMATION
+ * GENERATED USING SOFTWARE.
+ */

Added: incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/graph/system/gui/DifferedInputNodeGUI.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/graph/system/gui/DifferedInputNodeGUI.java?rev=1305483&view=auto
==============================================================================
--- incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/graph/system/gui/DifferedInputNodeGUI.java (added)
+++ incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/graph/system/gui/DifferedInputNodeGUI.java Mon Mar 26 18:32:32 2012
@@ -0,0 +1,140 @@
+/*
+ * Copyright (c) 2012 Extreme! Lab, Indiana University. All rights reserved.
+ *
+ * This software is open source. See the bottom of this file for the license.
+ *
+ * $Id: $
+ */
+package org.apache.airavata.xbaya.graph.system.gui;
+
+import java.awt.Color;
+
+import org.apache.airavata.xbaya.XBayaEngine;
+import org.apache.airavata.xbaya.gui.ErrorMessages;
+
+/**
+ * @author Chathura Herath
+ */
+public class DifferedInputNodeGUI extends ConfigurableNodeGUI {
+
+	// private static final MLogger logger = MLogger.getLogger();
+
+	private static final String CONFIG_AREA_STRING = "Config";
+
+	private static final Color HEAD_COLOR = new Color(153, 204, 255);
+
+	private DifferedInputNode inputNode;
+
+	private DifferedInputConfigurationDialog configurationWindow;
+
+	private volatile boolean configCanBeDisplayed = true;
+
+	/**
+	 * @param node
+	 */
+	public DifferedInputNodeGUI(DifferedInputNode node) {
+		super(node);
+		this.inputNode = node;
+		setConfigurationText(CONFIG_AREA_STRING);
+		this.headColor = HEAD_COLOR;
+	}
+
+	/**
+	 * Shows a configuration window when a user click the configuration area.
+	 * 
+	 * @param engine
+	 */
+	@Override
+	public void showConfigurationDialog(XBayaEngine engine) {
+		if (testAndSetConfigDisplay()) {
+			if (this.inputNode.isConnected()) {
+				if (this.configurationWindow == null) {
+					this.configurationWindow = new DifferedInputConfigurationDialog(
+							this.inputNode, engine);
+				}
+				this.configurationWindow.show();
+
+			} else {
+				engine.getErrorWindow().info(
+						ErrorMessages.INPUT_NOT_CONNECTED_WARNING);
+			}
+		}
+	}
+
+	protected synchronized boolean testAndSetConfigDisplay() {
+		if (this.configCanBeDisplayed) {
+			this.configCanBeDisplayed = false;
+			return true;
+		}
+		return false;
+	}
+
+	protected synchronized void closingDisplay() {
+		this.configCanBeDisplayed = true;
+	}
+
+	public DifferedInputNode getInputNode() {
+		return this.inputNode;
+	}
+
+	@Override
+	protected void setSelectedFlag(boolean flag) {
+		this.selected = flag;
+		if (this.selected) {
+			this.headColor = SELECTED_HEAD_COLOR;
+		} else {
+			this.headColor = HEAD_COLOR;
+		}
+	}
+}
+
+/*
+ * Indiana University Extreme! Lab Software License, Version 1.2
+ * 
+ * Copyright (c) 2012 The Trustees of Indiana University. All rights reserved.
+ * 
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * 
+ * 1) All redistributions of source code must retain the above copyright notice,
+ * the list of authors in the original source code, this list of conditions and
+ * the disclaimer listed in this license;
+ * 
+ * 2) All redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the disclaimer listed in this license in
+ * the documentation and/or other materials provided with the distribution;
+ * 
+ * 3) Any documentation included with all redistributions must include the
+ * following acknowledgement:
+ * 
+ * "This product includes software developed by the Indiana University Extreme!
+ * Lab. For further information please visit http://www.extreme.indiana.edu/"
+ * 
+ * Alternatively, this acknowledgment may appear in the software itself, and
+ * wherever such third-party acknowledgments normally appear.
+ * 
+ * 4) The name "Indiana University" or "Indiana University Extreme! Lab" shall
+ * not be used to endorse or promote products derived from this software without
+ * prior written permission from Indiana University. For written permission,
+ * please contact http://www.extreme.indiana.edu/.
+ * 
+ * 5) Products derived from this software may not use "Indiana University" name
+ * nor may "Indiana University" appear in their name, without prior written
+ * permission of the Indiana University.
+ * 
+ * Indiana University provides no reassurances that the source code provided
+ * does not infringe the patent or any other intellectual property rights of any
+ * other entity. Indiana University disclaims any liability to any recipient for
+ * claims brought by any other entity based on infringement of intellectual
+ * property rights or otherwise.
+ * 
+ * LICENSEE UNDERSTANDS THAT SOFTWARE IS PROVIDED "AS IS" FOR WHICH NO
+ * WARRANTIES AS TO CAPABILITIES OR ACCURACY ARE MADE. INDIANA UNIVERSITY GIVES
+ * NO WARRANTIES AND MAKES NO REPRESENTATION THAT SOFTWARE IS FREE OF
+ * INFRINGEMENT OF THIRD PARTY PATENT, COPYRIGHT, OR OTHER PROPRIETARY RIGHTS.
+ * INDIANA UNIVERSITY MAKES NO WARRANTIES THAT SOFTWARE IS FREE FROM "BUGS",
+ * "VIRUSES", "TROJAN HORSES", "TRAP DOORS", "WORMS", OR OTHER HARMFUL CODE.
+ * LICENSEE ASSUMES THE ENTIRE RISK AS TO THE PERFORMANCE OF SOFTWARE AND/OR
+ * ASSOCIATED MATERIALS, AND TO THE PERFORMANCE AND VALIDITY OF INFORMATION
+ * GENERATED USING SOFTWARE.
+ */

Modified: incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/interpretor/WorkflowInterpreter.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/interpretor/WorkflowInterpreter.java?rev=1305483&r1=1305482&r2=1305483&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/interpretor/WorkflowInterpreter.java (original)
+++ incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/interpretor/WorkflowInterpreter.java Mon Mar 26 18:32:32 2012
@@ -86,6 +86,8 @@ import org.apache.airavata.xbaya.graph.s
 import org.apache.airavata.xbaya.graph.system.IfNode;
 import org.apache.airavata.xbaya.graph.system.InputNode;
 import org.apache.airavata.xbaya.graph.system.OutputNode;
+import org.apache.airavata.xbaya.graph.system.gui.DifferedInputComponent;
+import org.apache.airavata.xbaya.graph.system.gui.DifferedInputHandler;
 import org.apache.airavata.xbaya.graph.ws.WSNode;
 import org.apache.airavata.xbaya.graph.ws.WSPort;
 import org.apache.airavata.xbaya.gui.Cancelable;
@@ -126,12 +128,12 @@ public class WorkflowInterpreter {
 
 	private static final int SERVER_MODE = 2;
 
-    private static final int MAXIMUM_RETRY_TIME = 2;
+	private static final int MAXIMUM_RETRY_TIME = 2;
 
-    public static final String WORKFLOW_STARTED = "Workflow Running";
-    public static final String WORKFLOW_FINISHED = "Workflow Finished";
+	public static final String WORKFLOW_STARTED = "Workflow Running";
+	public static final String WORKFLOW_FINISHED = "Workflow Finished";
 
-    private XBayaEngine engine;
+	private XBayaEngine engine;
 
 	private Map<Node, Integer> retryCounter = new HashMap<Node, Integer>();
 
@@ -165,8 +167,7 @@ public class WorkflowInterpreter {
 
 	private boolean runWithCrossProduct = false;
 
-    private boolean isoffline = false;
-
+	private boolean isoffline = false;
 
 	/**
 	 * 
@@ -193,33 +194,33 @@ public class WorkflowInterpreter {
 		this.runWithCrossProduct = this.configuration.isRunWithCrossProduct();
 	}
 
-
-/**
-         *
-         * Constructs a WorkflowInterpreter.
-         *
-         * @param configuration
-         * @param topic
-         * @param workflow
-         * @param username
-         * @param password
-         */
-        public WorkflowInterpreter(XBayaConfiguration configuration, String topic,
-                        Workflow workflow, String username, String password, boolean offline){
-                this.isoffline = offline;
-                this.configuration = configuration;
-                this.username = username;
-                this.password = password;
-                this.topic = topic;
-                this.workflow = workflow;
-                if (this.isoffline) {
-                        this.notifier = new StandaloneNotificationSender(topic, this.workflow);
-                } else {
-                        throw new Error("Cannot Initialize workflow with offline false");
-                }
-                this.mode = SERVER_MODE;
-                this.retryFailed = false;
-        }
+	/**
+	 * 
+	 * Constructs a WorkflowInterpreter.
+	 * 
+	 * @param configuration
+	 * @param topic
+	 * @param workflow
+	 * @param username
+	 * @param password
+	 */
+	public WorkflowInterpreter(XBayaConfiguration configuration, String topic,
+			Workflow workflow, String username, String password, boolean offline) {
+		this.isoffline = offline;
+		this.configuration = configuration;
+		this.username = username;
+		this.password = password;
+		this.topic = topic;
+		this.workflow = workflow;
+		if (this.isoffline) {
+			this.notifier = new StandaloneNotificationSender(topic,
+					this.workflow);
+		} else {
+			throw new Error("Cannot Initialize workflow with offline false");
+		}
+		this.mode = SERVER_MODE;
+		this.retryFailed = false;
+	}
 
 	/**
 	 * 
@@ -229,7 +230,8 @@ public class WorkflowInterpreter {
 	 * @param topic
 	 */
 	public WorkflowInterpreter(XBayaEngine engine, String topic) {
-		this(engine, topic, engine.getWorkflow(), false, engine.getConfiguration().isCollectProvenance());
+		this(engine, topic, engine.getWorkflow(), false, engine
+				.getConfiguration().isCollectProvenance());
 	}
 
 	/**
@@ -274,13 +276,17 @@ public class WorkflowInterpreter {
 			}
 
 			this.getWorkflow().setExecutionState(XBayaExecutionState.RUNNING);
-            if(actOnProvenance){
-                try {
-					this.configuration.getJcrComponentRegistry().getRegistry().saveWorkflowExecutionStatus(this.topic, ExecutionStatus.STARTED);
+			if (actOnProvenance) {
+				try {
+					this.configuration
+							.getJcrComponentRegistry()
+							.getRegistry()
+							.saveWorkflowExecutionStatus(this.topic,
+									ExecutionStatus.STARTED);
 				} catch (RegistryException e) {
 					throw new XBayaException(e);
 				}
-            }
+			}
 			ArrayList<Node> inputNodes = this.getInputNodesDynamically();
 			Object[] values = new Object[inputNodes.size()];
 			String[] keywords = new String[inputNodes.size()];
@@ -326,15 +332,16 @@ public class WorkflowInterpreter {
 						// recalculate the execution stack
 					}
 
-//					boolean nodeOutputLoadedFromProvenance = false;
+					// boolean nodeOutputLoadedFromProvenance = false;
 					if (this.actOnProvenance) {
-//					    nodeOutputLoadedFromProvenance = readProvenance(node);
-//					} else {
-					    writeProvenanceLater(node);
-					}
-//					if (!nodeOutputLoadedFromProvenance) {
-					    executeDynamically(node);
-//					}
+						// nodeOutputLoadedFromProvenance =
+						// readProvenance(node);
+						// } else {
+						writeProvenanceLater(node);
+					}
+					// if (!nodeOutputLoadedFromProvenance) {
+					executeDynamically(node);
+					// }
 					if (this.getWorkflow().getExecutionState() == XBayaExecutionState.STEP) {
 						this.getWorkflow().setExecutionState(
 								XBayaExecutionState.PAUSED);
@@ -352,42 +359,50 @@ public class WorkflowInterpreter {
 					if (getRunningNodeCountDynamically() == 0
 							&& getFailedNodeCountDynamically() != 0) {
 						this.getWorkflow().setExecutionState(
-                                XBayaExecutionState.PAUSED);
+								XBayaExecutionState.PAUSED);
 					}
 
 					try {
-                        Thread.sleep(400);
-                    } catch (InterruptedException e) {
-                        e.printStackTrace();
-                    }
-                }
-            }
-
-            if (getFailedNodeCountDynamically() == 0) {
-                if (actOnProvenance) {
-                    try {
+						Thread.sleep(400);
+					} catch (InterruptedException e) {
+						e.printStackTrace();
+					}
+				}
+			}
+
+			if (getFailedNodeCountDynamically() == 0) {
+				if (actOnProvenance) {
+					try {
 						try {
-							this.configuration.getJcrComponentRegistry().getRegistry().saveWorkflowExecutionStatus(this.topic, ExecutionStatus.FINISHED);
+							this.configuration
+									.getJcrComponentRegistry()
+									.getRegistry()
+									.saveWorkflowExecutionStatus(this.topic,
+											ExecutionStatus.FINISHED);
 						} catch (Exception e) {
 							throw new XBayaException(e);
 						}
 					} catch (Exception e) {
 						throw new XBayaException(e);
 					}
-//                    System.out.println(this.configuration.getJcrComponentRegistry().getRegistry().getWorkflowStatus(this.topic));
-                }
-            }else {
-                if(actOnProvenance){
-                try {
-					this.configuration.getJcrComponentRegistry().getRegistry().saveWorkflowExecutionStatus(this.topic, ExecutionStatus.FAILED);
-				} catch (RegistryException e) {
-					throw new XBayaException(e);
+					// System.out.println(this.configuration.getJcrComponentRegistry().getRegistry().getWorkflowStatus(this.topic));
+				}
+			} else {
+				if (actOnProvenance) {
+					try {
+						this.configuration
+								.getJcrComponentRegistry()
+								.getRegistry()
+								.saveWorkflowExecutionStatus(this.topic,
+										ExecutionStatus.FAILED);
+					} catch (RegistryException e) {
+						throw new XBayaException(e);
+					}
 				}
-            }
-            }
-            this.notifier.workflowTerminated();
-            if (this.mode == GUI_MODE) {
-                final WaitDialog waitDialog = new WaitDialog(new Cancelable() {
+			}
+			this.notifier.workflowTerminated();
+			if (this.mode == GUI_MODE) {
+				final WaitDialog waitDialog = new WaitDialog(new Cancelable() {
 					@Override
 					public void cancel() {
 						// Do nothing
@@ -409,19 +424,19 @@ public class WorkflowInterpreter {
 					e.printStackTrace();
 				}
 				cleanup();
-                this.notifier.cleanup();
+				this.notifier.cleanup();
 				waitDialog.hide();
 			} else {
 				finish();
 			}
-            this.workflow.setExecutionState(XBayaExecutionState.NONE);
+			this.workflow.setExecutionState(XBayaExecutionState.NONE);
 		} catch (RuntimeException e) {
 			// we reset all the state
 			cleanup();
-            this.notifier.cleanup();
-            this.workflow.setExecutionState(XBayaExecutionState.NONE);
-            raiseException(e);
-        }
+			this.notifier.cleanup();
+			this.workflow.setExecutionState(XBayaExecutionState.NONE);
+			raiseException(e);
+		}
 	}
 
 	/**
@@ -488,9 +503,9 @@ public class WorkflowInterpreter {
 		if (node instanceof ForEachNode) {
 			node = InterpreterUtil.findEndForEachFor((ForEachNode) node);
 		}
-        if(this.provenanceWriter == null){
-           this.provenanceWriter = new PredicatedTaskRunner(1);
-        }
+		if (this.provenanceWriter == null) {
+			this.provenanceWriter = new PredicatedTaskRunner(1);
+		}
 		this.provenanceWriter.scedule(new ProvenanceWrite(node, this
 				.getWorkflow().getName(), invokerMap, this.topic,
 				this.configuration.getJcrComponentRegistry().getRegistry()));
@@ -524,11 +539,11 @@ public class WorkflowInterpreter {
 		}
 	}
 
-    /**
-     * @throws MonitorException
-     */
-    public void cleanup() throws MonitorException {
-            this.workflow.setExecutionState(XBayaExecutionState.STOPPED);
+	/**
+	 * @throws MonitorException
+	 */
+	public void cleanup() throws MonitorException {
+		this.workflow.setExecutionState(XBayaExecutionState.STOPPED);
 		if (this.mode == GUI_MODE) {
 			this.engine.resetWorkflowInterpreter();
 			try {
@@ -556,34 +571,49 @@ public class WorkflowInterpreter {
 				for (DataPort dataPort : inputPorts) {
 					Object val = InterpreterUtil.findInputFromPort(dataPort,
 							this.invokerMap);
-								if (null == val) {
+					if (null == val) {
 						throw new WorkFlowInterpreterException(
 								"Unable to find output for the node:"
 										+ node.getID());
 					}
 					// This is ok because the outputnodes always got only one
-                    // input
-                    if (val instanceof org.xmlpull.v1.builder.XmlElement) {
-                        ((OutputNode) node).setDescription(XMLUtil.xmlElementToString((org.xmlpull.v1.builder.XmlElement) val));
-                    } else {
-                        ((OutputNode) node).setDescription(val.toString());
-                    }
-
-                     if(actOnProvenance){
-                        try {
-                            if (val instanceof String) {
-                                this.configuration.getJcrComponentRegistry().getRegistry().saveWorkflowExecutionOutput(this.topic, node.getName(), val.toString());
-                            } else if (val instanceof org.xmlpull.v1.builder.XmlElement) {
-                                this.configuration.getJcrComponentRegistry().getRegistry().saveWorkflowExecutionOutput(this.topic,
-                                        node.getName(), XMLUtil.xmlElementToString((org.xmlpull.v1.builder.XmlElement) val));
-                            }
-                        } catch (RegistryException e) {
-                            e.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.
-                        }
-                    }
+					// input
+					if (val instanceof org.xmlpull.v1.builder.XmlElement) {
+						((OutputNode) node)
+								.setDescription(XMLUtil
+										.xmlElementToString((org.xmlpull.v1.builder.XmlElement) val));
+					} else {
+						((OutputNode) node).setDescription(val.toString());
+					}
+
+					if (actOnProvenance) {
+						try {
+							if (val instanceof String) {
+								this.configuration
+										.getJcrComponentRegistry()
+										.getRegistry()
+										.saveWorkflowExecutionOutput(
+												this.topic, node.getName(),
+												val.toString());
+							} else if (val instanceof org.xmlpull.v1.builder.XmlElement) {
+								this.configuration
+										.getJcrComponentRegistry()
+										.getRegistry()
+										.saveWorkflowExecutionOutput(
+												this.topic,
+												node.getName(),
+												XMLUtil.xmlElementToString((org.xmlpull.v1.builder.XmlElement) val));
+							}
+						} catch (RegistryException e) {
+							e.printStackTrace(); // To change body of catch
+													// statement use File |
+													// Settings | File
+													// Templates.
+						}
+					}
 					node.getGUI().setBodyColor(NodeState.FINISHED.color);
 				}
-                System.out.println("Looping");
+				System.out.println("Looping");
 			}
 			this.notifier.sendingPartialResults(outputValues.toArray(),
 					outputKeywords.toArray(new String[outputKeywords.size()]));
@@ -622,25 +652,38 @@ public class WorkflowInterpreter {
 				}
 				// Some node not yet updated
 				if (node.getGUI().getBodyColor() != NodeState.FINISHED.color) {
-                    if(actOnProvenance){
-                        try {
-                            if(val instanceof String){
-                                this.configuration.getJcrComponentRegistry().getRegistry().saveWorkflowExecutionOutput(this.topic,
-                                        node.getName(), val.toString());
-                            } else if (val instanceof org.xmlpull.v1.builder.XmlElement) {
-                                this.configuration.getJcrComponentRegistry().getRegistry().saveWorkflowExecutionOutput(this.topic,
-                                        node.getName(), XMLUtil.xmlElementToString((org.xmlpull.v1.builder.XmlElement) val));
-                            }
-
-                        } catch (RegistryException e) {
-                            e.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.
-                        }
-                    }
-                    if (val instanceof XmlElement) {
-                        ((OutputNode) node).setDescription(XMLUtil.xmlElementToString((XmlElement) val));
-                    } else {
-                        ((OutputNode) node).setDescription(val.toString());
-                    }
+					if (actOnProvenance) {
+						try {
+							if (val instanceof String) {
+								this.configuration
+										.getJcrComponentRegistry()
+										.getRegistry()
+										.saveWorkflowExecutionOutput(
+												this.topic, node.getName(),
+												val.toString());
+							} else if (val instanceof org.xmlpull.v1.builder.XmlElement) {
+								this.configuration
+										.getJcrComponentRegistry()
+										.getRegistry()
+										.saveWorkflowExecutionOutput(
+												this.topic,
+												node.getName(),
+												XMLUtil.xmlElementToString((org.xmlpull.v1.builder.XmlElement) val));
+							}
+
+						} catch (RegistryException e) {
+							e.printStackTrace(); // To change body of catch
+													// statement use File |
+													// Settings | File
+													// Templates.
+						}
+					}
+					if (val instanceof XmlElement) {
+						((OutputNode) node).setDescription(XMLUtil
+								.xmlElementToString((XmlElement) val));
+					} else {
+						((OutputNode) node).setDescription(val.toString());
+					}
 					node.getGUI().setBodyColor(NodeState.FINISHED.color);
 				}
 			}
@@ -648,8 +691,8 @@ public class WorkflowInterpreter {
 		}
 		this.notifier.sendingPartialResults(outputValues.toArray(),
 				outputKeywords.toArray(new String[outputKeywords.size()]));
-        cleanup();
-        this.notifier.cleanup();
+		cleanup();
+		this.notifier.cleanup();
 
 	}
 
@@ -850,27 +893,31 @@ public class WorkflowInterpreter {
 				}
 
 				invoker = new WorkflowInvokerWrapperForGFacInvoker(
-						portTypeQName, gfacURLString,
-                        this.engine.getMonitor().getConfiguration().getMessageBoxURL().toString(), leadCtxHeader,
+						portTypeQName, gfacURLString, this.engine.getMonitor()
+								.getConfiguration().getMessageBoxURL()
+								.toString(), leadCtxHeader,
 						this.notifier.createServiceNotificationSender(node
 								.getID()));
 
 			} else {
-                if(this.mode == GUI_MODE){
-                    //if user configure the msgBox url using the UI we have to pick the latest one which
-                    //set by the UI
-				    invoker = new GenericInvoker(portTypeQName,
-						WSDLUtil.wsdlDefinitions5ToWsdlDefintions3(wsNode
-								.getComponent().getWSDL()), node.getID(),
-						this.engine.getMonitor().getConfiguration().getMessageBoxURL().toASCIIString(),
-						gfacURLString, this.notifier);
-                }else{
-                    invoker = new GenericInvoker(portTypeQName,
-						WSDLUtil.wsdlDefinitions5ToWsdlDefintions3(wsNode
-								.getComponent().getWSDL()), node.getID(),
-						this.configuration.getMessageBoxURL().toASCIIString(),
-						gfacURLString, this.notifier);
-                }
+				if (this.mode == GUI_MODE) {
+					// if user configure the msgBox url using the UI we have to
+					// pick the latest one which
+					// set by the UI
+					invoker = new GenericInvoker(portTypeQName,
+							WSDLUtil.wsdlDefinitions5ToWsdlDefintions3(wsNode
+									.getComponent().getWSDL()), node.getID(),
+							this.engine.getMonitor().getConfiguration()
+									.getMessageBoxURL().toASCIIString(),
+							gfacURLString, this.notifier);
+				} else {
+					invoker = new GenericInvoker(portTypeQName,
+							WSDLUtil.wsdlDefinitions5ToWsdlDefintions3(wsNode
+									.getComponent().getWSDL()), node.getID(),
+							this.configuration.getMessageBoxURL()
+									.toASCIIString(), gfacURLString,
+							this.notifier);
+				}
 			}
 
 		} else {
@@ -901,8 +948,8 @@ public class WorkflowInterpreter {
 			 */
 			if (port.getFromNode() instanceof InputNode) {
 				inputVal = ODEClientUtil.parseValue(
-                        (WSComponentPort) port.getComponentPort(),
-                        (String) inputVal);
+						(WSComponentPort) port.getComponentPort(),
+						(String) inputVal);
 			}
 
 			if (null == inputVal) {
@@ -1029,33 +1076,34 @@ public class WorkflowInterpreter {
 
 				for (int i = 0; i < wsNodes.size(); i++) {
 					final WSNode node1 = (WSNode) wsNodes.get(i);
-                    SystemComponentInvoker systemInvoker = null;
-                    List<DataPort> outputPorts1 = node1.getOutputPorts();
-                    List<Node> endForEachNodes = new ArrayList<Node>();
-                    for (DataPort port : outputPorts1) {
-                        Iterator<Node> endForEachNodeItr1 = port.getToNodes().iterator();
-                        while (endForEachNodeItr1.hasNext()) {
-                            Node node2 = endForEachNodeItr1.next();
-                            if (node2 instanceof EndForEachNode) {
-                                endForEachNodes.add(node2);
-                            } else if (node2 instanceof OutputNode) {
-                                // intentionally left noop
-                            } else {
-                                throw new WorkFlowInterpreterException(
-                                        "Found More than one node inside foreach");
-                            }
-
-                        }
-                    }
-                    final List<Node> finalEndForEachNodes = endForEachNodes;
+					SystemComponentInvoker systemInvoker = null;
+					List<DataPort> outputPorts1 = node1.getOutputPorts();
+					List<Node> endForEachNodes = new ArrayList<Node>();
+					for (DataPort port : outputPorts1) {
+						Iterator<Node> endForEachNodeItr1 = port.getToNodes()
+								.iterator();
+						while (endForEachNodeItr1.hasNext()) {
+							Node node2 = endForEachNodeItr1.next();
+							if (node2 instanceof EndForEachNode) {
+								endForEachNodes.add(node2);
+							} else if (node2 instanceof OutputNode) {
+								// intentionally left noop
+							} else {
+								throw new WorkFlowInterpreterException(
+										"Found More than one node inside foreach");
+							}
 
+						}
+					}
+					final List<Node> finalEndForEachNodes = endForEachNodes;
 
 					Iterator<Node> endForEachNodeItr1 = node1.getOutputPort(0)
 							.getToNodes().iterator();
 					while (endForEachNodeItr1.hasNext()) {
 						Node node2 = endForEachNodeItr1.next();
 						// Start reading input came for foreach node
-						int parallelRuns = listOfValues.size() * node1.getOutputPorts().size();
+						int parallelRuns = listOfValues.size()
+								* node1.getOutputPorts().size();
 						if (listOfValues.size() > 0) {
 							forEachNode.getGUI().setBodyColor(
 									NodeState.EXECUTING.color);
@@ -1063,30 +1111,26 @@ public class WorkflowInterpreter {
 									NodeState.EXECUTING.color);
 							List<DataPort> outputPorts = node1.getOutputPorts();
 							final AtomicInteger counter = new AtomicInteger();
-                            for (Node endFor : endForEachNodes) {
-                                systemInvoker = new SystemComponentInvoker();
-                                this.invokerMap.put(endFor, systemInvoker);
-                            }
-                            final Map<Node,Invoker> finalMap = this.invokerMap;
-									new Thread() {
-										@Override
-										public void run() {
-											try {
-												runInThread(listOfValues,
-														forEachNode, node1,
-														finalEndForEachNodes,
-														finalMap, counter,
-														inputNumbers);
-											} catch (XBayaException e) {
-
-
-												WorkflowInterpreter.this.engine
-														.getErrorWindow()
-														.error(e);
-											}
-										}
+							for (Node endFor : endForEachNodes) {
+								systemInvoker = new SystemComponentInvoker();
+								this.invokerMap.put(endFor, systemInvoker);
+							}
+							final Map<Node, Invoker> finalMap = this.invokerMap;
+							new Thread() {
+								@Override
+								public void run() {
+									try {
+										runInThread(listOfValues, forEachNode,
+												node1, finalEndForEachNodes,
+												finalMap, counter, inputNumbers);
+									} catch (XBayaException e) {
+
+										WorkflowInterpreter.this.engine
+												.getErrorWindow().error(e);
+									}
+								}
 
-									}.start();
+							}.start();
 
 							while (counter.intValue() < parallelRuns) {
 								try {
@@ -1128,24 +1172,25 @@ public class WorkflowInterpreter {
 			} else {
 
 				// First node after foreach should end with EndForEachNode
-                List<DataPort> outputPorts1 = middleNode.getOutputPorts();
-                List<Node> endForEachNodes = new ArrayList<Node>();
-                for(DataPort port:outputPorts1){
-                    Iterator<Node> endForEachNodeItr1 = port.getToNodes().iterator();
-				while (endForEachNodeItr1.hasNext()) {
-					Node node2 = endForEachNodeItr1.next();
-					if (node2 instanceof EndForEachNode) {
-						endForEachNodes.add(node2);
-					} else if (node2 instanceof OutputNode) {
-						// intentionally left noop
-					} else {
-						throw new WorkFlowInterpreterException(
-								"Found More than one node inside foreach");
-					}
+				List<DataPort> outputPorts1 = middleNode.getOutputPorts();
+				List<Node> endForEachNodes = new ArrayList<Node>();
+				for (DataPort port : outputPorts1) {
+					Iterator<Node> endForEachNodeItr1 = port.getToNodes()
+							.iterator();
+					while (endForEachNodeItr1.hasNext()) {
+						Node node2 = endForEachNodeItr1.next();
+						if (node2 instanceof EndForEachNode) {
+							endForEachNodes.add(node2);
+						} else if (node2 instanceof OutputNode) {
+							// intentionally left noop
+						} else {
+							throw new WorkFlowInterpreterException(
+									"Found More than one node inside foreach");
+						}
 
+					}
 				}
-                }
-                final List<Node> finalEndForEachNodes = endForEachNodes;
+				final List<Node> finalEndForEachNodes = endForEachNodes;
 				final Node foreachWSNode = middleNode;
 				final LinkedList<String> listOfValues = new LinkedList<String>();
 
@@ -1157,7 +1202,7 @@ public class WorkflowInterpreter {
 								this.invokerMap);
 
 				int parallelRuns = createInputValues(listOfValues, inputNumbers)
-						.size()  * outputPorts1.size();
+						.size() * outputPorts1.size();
 				if (listOfValues.size() > 0) {
 
 					forEachNode.getGUI()
@@ -1166,29 +1211,26 @@ public class WorkflowInterpreter {
 							NodeState.EXECUTING.color);
 					List<DataPort> outputPorts = middleNode.getOutputPorts();
 					final AtomicInteger counter = new AtomicInteger();
-                        for(Node endFor:endForEachNodes){
-                                final SystemComponentInvoker systemInvoker = new SystemComponentInvoker();
-                                this.invokerMap.put(endFor,
-                                        systemInvoker);
-                            }
-                        final Map<Node,Invoker> finalInvokerMap = this.invokerMap;
-
-								new Thread() {
-									@Override
-									public void run() {
-										try {
-											runInThread(listOfValues,
-													forEachNode, foreachWSNode,
-													finalEndForEachNodes,
-													finalInvokerMap, counter,
-													inputNumbers);
-										} catch (XBayaException e) {
-											WorkflowInterpreter.this.engine
-													.getErrorWindow().error(e);
-										}
-									}
+					for (Node endFor : endForEachNodes) {
+						final SystemComponentInvoker systemInvoker = new SystemComponentInvoker();
+						this.invokerMap.put(endFor, systemInvoker);
+					}
+					final Map<Node, Invoker> finalInvokerMap = this.invokerMap;
+
+					new Thread() {
+						@Override
+						public void run() {
+							try {
+								runInThread(listOfValues, forEachNode,
+										foreachWSNode, finalEndForEachNodes,
+										finalInvokerMap, counter, inputNumbers);
+							} catch (XBayaException e) {
+								WorkflowInterpreter.this.engine
+										.getErrorWindow().error(e);
+							}
+						}
 
-								}.start();
+					}.start();
 					while (counter.intValue() < parallelRuns) {
 						try {
 							Thread.sleep(100);
@@ -1201,9 +1243,9 @@ public class WorkflowInterpreter {
 					// todo this has to be done in a separate thread
 					middleNode.getGUI().setBodyColor(NodeState.FINISHED.color);
 					for (Node endForEach : endForEachNodes) {
-                        endForEach.getGUI().setBodyColor(
-                                NodeState.FINISHED.color);
-                    }
+						endForEach.getGUI().setBodyColor(
+								NodeState.FINISHED.color);
+					}
 				} else {
 					throw new WorkFlowInterpreterException(
 							"No array values found for foreach");
@@ -1373,181 +1415,193 @@ public class WorkflowInterpreter {
 		return invoker;
 	}
 
-    private void runInThread(final LinkedList<String> listOfValues,
-                             ForEachNode forEachNode, final Node middleNode,
-                              List<Node> endForEachNodes,
-			                Map<Node,Invoker> tempInvoker,
-                             AtomicInteger counter, final Integer[] inputNumber) throws XBayaException {
-
-        final LinkedList<Invoker> invokerList = new LinkedList<Invoker>();
-
-        if(inputNumber.length > 1){
-            List<String> inputValues = createInputValues(listOfValues,inputNumber);
-            for (final Iterator<String> iterator = inputValues.iterator(); iterator.hasNext();) {
-                final String gfacURLString = this.configuration.getGFacURL().toString();
-                final String input = iterator.next();
-                WSComponent wsComponent = (WSComponent) middleNode.getComponent();
-                final Invoker invoker2 = createInvokerForEachSingleWSNode(middleNode, gfacURLString, wsComponent);
-                invokerList.add(invoker2);
-
-                new Thread() {
-                    @Override
-                    public void run() {
-                        try {
-                            getInvoker(middleNode, invoker2);
-                            invokeGFacService(listOfValues, middleNode, inputNumber, input, invoker2);
-
-                        } catch (XBayaException e) {
-                            WorkflowInterpreter.this.engine.getErrorWindow().error(e);
-                        }
-                    }
-
-                }.start();
-
-                try {
-                    Thread.sleep(3000);
-                } catch (InterruptedException e) {
-                    WorkflowInterpreter.this.engine.getErrorWindow().error(e);
-                }
-            }
-        }else{
-            Invoker invoker = null;
-            for (Iterator<String> iterator = listOfValues.iterator(); iterator
-                    .hasNext();) {
-                String input = iterator.next();
-                final String gfacURLString = this.configuration
-                        .getGFacURL().toString();
-
-                WSComponent wsComponent = (WSComponent) middleNode.getComponent();
-                invoker = createInvokerForEachSingleWSNode(middleNode, gfacURLString, wsComponent);
-                invokerList.add(invoker);
-                getInvoker(middleNode, invoker);
-
-                // find inputs
-                List<DataPort> inputPorts = middleNode.getInputPorts();
-                for (DataPort port : inputPorts) {
-                    Object inputVal = InterpreterUtil.findInputFromPort(port,
-                            this.invokerMap);
-
-                    /*
-                    * Handle ForEachNode
-                    */
-                    Node fromNode = port.getFromNode();
-//                if (fromNode instanceof ForEachNode) {
-                    inputVal = ODEClientUtil.parseValue((WSComponentPort) port.getComponentPort(),
-                                                    input);
-//                }
-
-                    if (null == inputVal) {
-                        throw new WorkFlowInterpreterException(
-                                "Unable to find inputs for the node:"
-                                        + middleNode.getID());
-                    }
-                    invoker.setInput(port.getName(), inputVal);
-                }
-                invoker.invoke();
-            }
-        }
-
-        // String arrayElementName = foreachWSNode.getOperationName() +
-        // "ArrayResponse";
-        // String outputStr = "<" + arrayElementName + ">";
-        //invokerMap size and endForEachNodes size can be difference
-        //because we can create endForEachNode with n number of input/output ports so always have to use
-        //middleNode.getOutputPorts when iterate
-         String[] outputStr = new String[middleNode.getOutputPorts().size()];
-        int i = 0;
-        for(DataPort port:middleNode.getOutputPorts()){
-            String outputString = "";
-            for (Iterator<Invoker> iterator = invokerList.iterator(); iterator
-                    .hasNext(); ) {
-                Invoker workflowInvoker = iterator.next();
-
-                // /
-                Object output = workflowInvoker.getOutput(port.getName());
-                if(output instanceof org.xmlpull.v1.builder.XmlElement){
-                    org.xmlpull.v1.builder.XmlElement element =
-                            (org.xmlpull.v1.builder.XmlElement)((org.xmlpull.v1.builder.XmlElement) output).children().next();
-                    outputString += "\n" + XMLUtil.xmlElementToString(element);
-                }else{
-                    outputString += "\n<value>" + output + "</value>";
-                }
-                counter.incrementAndGet();
-            }
-            outputStr[i] = outputString;
-            System.out.println(outputStr[i]);
-            i++;
-        }
-        i=0;
-        // outputStr += "\n</" + arrayElementName + ">";
-        int outputPortIndex = 0;
-        for (DataPort port : middleNode.getOutputPorts()) {
-            for (Node endForEachNode : endForEachNodes) {
-                if (tempInvoker.get(endForEachNode) != null) {
-                    if (!(endForEachNode instanceof OutputNode)) {
-                        ((SystemComponentInvoker) tempInvoker.get(endForEachNode)).addOutput(port.getName(),
-                                outputStr[i]);
-                    }
-                }
-                outputPortIndex++;
-            }
-            i++;
-        }
-        forEachNode.getGUI().setBodyColor(NodeState.FINISHED.color);
-    }
-
-    private void invokeGFacService(LinkedList<String> listOfValues, Node middleNode,
-                                   Integer[] inputNumber, String input,
-                                   Invoker invoker) throws XBayaException {
-
-
-        // find inputs
-        List<DataPort> inputPorts = middleNode.getInputPorts();
-        String[] inputArray = null;
-        if(inputNumber.length == 1){
-            inputArray = listOfValues.toArray(new String[listOfValues.size()]);
-        }else{
-            inputArray = input.split(",");
-        }
-        int index = 0;
-        for (DataPort port : inputPorts) {
-            Object inputVal = InterpreterUtil.findInputFromPort(port,
-                    this.invokerMap);
-            /*
-            * Handle ForEachNode
-            */
-            Node fromNode = port.getFromNode();
-            if (fromNode instanceof ForEachNode) {
-                inputVal = inputArray[index++];
-            }
-
-
-            if (null == inputVal) {
-                throw new WorkFlowInterpreterException(
-                        "Unable to find inputs for the node:"
-                                + middleNode.getID());
-            }
-            invoker.setInput(port.getName(), inputVal);
-        }
-        invoker.invoke();
-
-    }
-
-    private Invoker getInvoker(Node middleNode, Invoker invoker) throws XBayaException {
-        if(middleNode instanceof WSNode) {
-            WSComponent wsComponent = (WSComponent) middleNode.getComponent();
-            invoker.setup();
-            invoker.setOperation(wsComponent.getOperationName());
-        } else if (middleNode instanceof SubWorkflowNode){
-            //((SubWorkflowNode) middleNode).getWorkflow();
-            //this.configuration;
-            // TODO : Need to create a invoker!
-            //new WorkflowInterpreter()
-        } else {
-            throw new XBayaRuntimeException("Only Web services and subworkflows are supported for For-Each : Found : " + middleNode);
-        }
-        return invoker;
-    }
+	private void runInThread(final LinkedList<String> listOfValues,
+			ForEachNode forEachNode, final Node middleNode,
+			List<Node> endForEachNodes, Map<Node, Invoker> tempInvoker,
+			AtomicInteger counter, final Integer[] inputNumber)
+			throws XBayaException {
+
+		final LinkedList<Invoker> invokerList = new LinkedList<Invoker>();
+
+		if (inputNumber.length > 1) {
+			List<String> inputValues = createInputValues(listOfValues,
+					inputNumber);
+			for (final Iterator<String> iterator = inputValues.iterator(); iterator
+					.hasNext();) {
+				final String gfacURLString = this.configuration.getGFacURL()
+						.toString();
+				final String input = iterator.next();
+				WSComponent wsComponent = (WSComponent) middleNode
+						.getComponent();
+				final Invoker invoker2 = createInvokerForEachSingleWSNode(
+						middleNode, gfacURLString, wsComponent);
+				invokerList.add(invoker2);
+
+				new Thread() {
+					@Override
+					public void run() {
+						try {
+							getInvoker(middleNode, invoker2);
+							invokeGFacService(listOfValues, middleNode,
+									inputNumber, input, invoker2);
+
+						} catch (XBayaException e) {
+							WorkflowInterpreter.this.engine.getErrorWindow()
+									.error(e);
+						}
+					}
+
+				}.start();
+
+				try {
+					Thread.sleep(3000);
+				} catch (InterruptedException e) {
+					WorkflowInterpreter.this.engine.getErrorWindow().error(e);
+				}
+			}
+		} else {
+			Invoker invoker = null;
+			for (Iterator<String> iterator = listOfValues.iterator(); iterator
+					.hasNext();) {
+				String input = iterator.next();
+				final String gfacURLString = this.configuration.getGFacURL()
+						.toString();
+
+				WSComponent wsComponent = (WSComponent) middleNode
+						.getComponent();
+				invoker = createInvokerForEachSingleWSNode(middleNode,
+						gfacURLString, wsComponent);
+				invokerList.add(invoker);
+				getInvoker(middleNode, invoker);
+
+				// find inputs
+				List<DataPort> inputPorts = middleNode.getInputPorts();
+				for (DataPort port : inputPorts) {
+					Object inputVal = InterpreterUtil.findInputFromPort(port,
+							this.invokerMap);
+
+					/*
+					 * Handle ForEachNode
+					 */
+					Node fromNode = port.getFromNode();
+					// if (fromNode instanceof ForEachNode) {
+					inputVal = ODEClientUtil.parseValue(
+							(WSComponentPort) port.getComponentPort(), input);
+					// }
+
+					if (null == inputVal) {
+						throw new WorkFlowInterpreterException(
+								"Unable to find inputs for the node:"
+										+ middleNode.getID());
+					}
+					invoker.setInput(port.getName(), inputVal);
+				}
+				invoker.invoke();
+			}
+		}
+
+		// String arrayElementName = foreachWSNode.getOperationName() +
+		// "ArrayResponse";
+		// String outputStr = "<" + arrayElementName + ">";
+		// invokerMap size and endForEachNodes size can be difference
+		// because we can create endForEachNode with n number of input/output
+		// ports so always have to use
+		// middleNode.getOutputPorts when iterate
+		String[] outputStr = new String[middleNode.getOutputPorts().size()];
+		int i = 0;
+		for (DataPort port : middleNode.getOutputPorts()) {
+			String outputString = "";
+			for (Iterator<Invoker> iterator = invokerList.iterator(); iterator
+					.hasNext();) {
+				Invoker workflowInvoker = iterator.next();
+
+				// /
+				Object output = workflowInvoker.getOutput(port.getName());
+				if (output instanceof org.xmlpull.v1.builder.XmlElement) {
+					org.xmlpull.v1.builder.XmlElement element = (org.xmlpull.v1.builder.XmlElement) ((org.xmlpull.v1.builder.XmlElement) output)
+							.children().next();
+					outputString += "\n" + XMLUtil.xmlElementToString(element);
+				} else {
+					outputString += "\n<value>" + output + "</value>";
+				}
+				counter.incrementAndGet();
+			}
+			outputStr[i] = outputString;
+			System.out.println(outputStr[i]);
+			i++;
+		}
+		i = 0;
+		// outputStr += "\n</" + arrayElementName + ">";
+		int outputPortIndex = 0;
+		for (DataPort port : middleNode.getOutputPorts()) {
+			for (Node endForEachNode : endForEachNodes) {
+				if (tempInvoker.get(endForEachNode) != null) {
+					if (!(endForEachNode instanceof OutputNode)) {
+						((SystemComponentInvoker) tempInvoker
+								.get(endForEachNode)).addOutput(port.getName(),
+								outputStr[i]);
+					}
+				}
+				outputPortIndex++;
+			}
+			i++;
+		}
+		forEachNode.getGUI().setBodyColor(NodeState.FINISHED.color);
+	}
+
+	private void invokeGFacService(LinkedList<String> listOfValues,
+			Node middleNode, Integer[] inputNumber, String input,
+			Invoker invoker) throws XBayaException {
+
+		// find inputs
+		List<DataPort> inputPorts = middleNode.getInputPorts();
+		String[] inputArray = null;
+		if (inputNumber.length == 1) {
+			inputArray = listOfValues.toArray(new String[listOfValues.size()]);
+		} else {
+			inputArray = input.split(",");
+		}
+		int index = 0;
+		for (DataPort port : inputPorts) {
+			Object inputVal = InterpreterUtil.findInputFromPort(port,
+					this.invokerMap);
+			/*
+			 * Handle ForEachNode
+			 */
+			Node fromNode = port.getFromNode();
+			if (fromNode instanceof ForEachNode) {
+				inputVal = inputArray[index++];
+			}
+
+			if (null == inputVal) {
+				throw new WorkFlowInterpreterException(
+						"Unable to find inputs for the node:"
+								+ middleNode.getID());
+			}
+			invoker.setInput(port.getName(), inputVal);
+		}
+		invoker.invoke();
+
+	}
+
+	private Invoker getInvoker(Node middleNode, Invoker invoker)
+			throws XBayaException {
+		if (middleNode instanceof WSNode) {
+			WSComponent wsComponent = (WSComponent) middleNode.getComponent();
+			invoker.setup();
+			invoker.setOperation(wsComponent.getOperationName());
+		} else if (middleNode instanceof SubWorkflowNode) {
+			// ((SubWorkflowNode) middleNode).getWorkflow();
+			// this.configuration;
+			// TODO : Need to create a invoker!
+			// new WorkflowInterpreter()
+		} else {
+			throw new XBayaRuntimeException(
+					"Only Web services and subworkflows are supported for For-Each : Found : "
+							+ middleNode);
+		}
+		return invoker;
+	}
 
 	private void setInputValuesForForEach(Node middleNode,
 			LinkedList<String> listOfValues, Integer[] inputNumbers,
@@ -1766,6 +1820,7 @@ public class WorkflowInterpreter {
 				}
 
 			} else if (InputComponent.NAME.equals(component.getName())
+					|| DifferedInputComponent.NAME.equals(component.getName())
 					|| S3InputComponent.NAME.equals(component.getName())
 					|| OutputComponent.NAME.equals(component.getName())
 					|| MemoComponent.NAME.equals(component.getName())) {
@@ -1804,6 +1859,14 @@ public class WorkflowInterpreter {
 			}
 		}
 
+		if (this.mode == GUI_MODE) {
+			ArrayList<Node> waitingNodes = this.getWaitingNodesDynamically();
+			for (Node readyNode : waitingNodes) {
+				DifferedInputHandler.handleDifferredInputsofDependentNodes(
+						readyNode, engine);
+			}
+		}
+
 		return list;
 
 	}
@@ -1916,7 +1979,6 @@ public class WorkflowInterpreter {
 		return null;
 	}
 
-	
 	public boolean isRunWithCrossProduct() {
 		return runWithCrossProduct;
 	}
@@ -1929,11 +1991,11 @@ public class WorkflowInterpreter {
 		return workflow;
 	}
 
-    public void setActOnProvenance(boolean actOnProvenance) {
-        this.actOnProvenance = actOnProvenance;
-    }
-
-    public void setProvenanceWriter(PredicatedTaskRunner provenanceWriter) {
-        this.provenanceWriter = provenanceWriter;
-    }
+	public void setActOnProvenance(boolean actOnProvenance) {
+		this.actOnProvenance = actOnProvenance;
+	}
+
+	public void setProvenanceWriter(PredicatedTaskRunner provenanceWriter) {
+		this.provenanceWriter = provenanceWriter;
+	}
 }
\ No newline at end of file