You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airavata.apache.org by sa...@apache.org on 2014/04/14 20:31:05 UTC

[63/90] [abbrv] AIRAVATA-1124

http://git-wip-us.apache.org/repos/asf/airavata/blob/9c47eec8/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/dialogs/descriptors/ServiceDescriptionDialog.java
----------------------------------------------------------------------
diff --git a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/dialogs/descriptors/ServiceDescriptionDialog.java b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/dialogs/descriptors/ServiceDescriptionDialog.java
new file mode 100644
index 0000000..98277ce
--- /dev/null
+++ b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/dialogs/descriptors/ServiceDescriptionDialog.java
@@ -0,0 +1,727 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+package org.apache.airavata.xbaya.ui.dialogs.descriptors;
+
+import java.awt.BorderLayout;
+import java.awt.Color;
+import java.awt.Font;
+import java.awt.GridBagConstraints;
+import java.awt.GridBagLayout;
+import java.awt.Insets;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.awt.event.KeyAdapter;
+import java.awt.event.KeyEvent;
+import java.awt.event.MouseAdapter;
+import java.awt.event.MouseEvent;
+import java.awt.event.WindowAdapter;
+import java.awt.event.WindowEvent;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.jcr.PathNotFoundException;
+import javax.swing.BorderFactory;
+import javax.swing.DefaultCellEditor;
+import javax.swing.JButton;
+import javax.swing.JCheckBox;
+import javax.swing.JComboBox;
+import javax.swing.JDialog;
+import javax.swing.JLabel;
+import javax.swing.JMenuItem;
+import javax.swing.JPanel;
+import javax.swing.JPopupMenu;
+import javax.swing.JScrollPane;
+import javax.swing.JTable;
+import javax.swing.ListSelectionModel;
+import javax.swing.WindowConstants;
+import javax.swing.event.ListSelectionEvent;
+import javax.swing.event.ListSelectionListener;
+import javax.swing.event.TableModelEvent;
+import javax.swing.event.TableModelListener;
+import javax.swing.table.DefaultTableModel;
+import javax.swing.table.TableColumn;
+import javax.xml.namespace.QName;
+
+import org.apache.airavata.client.api.AiravataAPI;
+import org.apache.airavata.client.api.exception.AiravataAPIInvocationException;
+import org.apache.airavata.registry.api.exception.RegistryException;
+import org.apache.airavata.common.utils.SwingUtil;
+import org.apache.airavata.commons.gfac.type.ServiceDescription;
+//import org.apache.airavata.registry.api.AiravataRegistry2;
+import org.apache.airavata.schemas.gfac.DataType;
+import org.apache.airavata.schemas.gfac.InputParameterType;
+import org.apache.airavata.schemas.gfac.OutputParameterType;
+import org.apache.airavata.schemas.gfac.ParameterType;
+import org.apache.airavata.schemas.gfac.ServiceDescriptionType;
+import org.apache.airavata.xbaya.ui.dialogs.descriptors.DescriptorListDialog.DescriptorType;
+import org.apache.airavata.xbaya.ui.widgets.GridPanel;
+import org.apache.airavata.xbaya.ui.widgets.XBayaLabel;
+import org.apache.airavata.xbaya.ui.widgets.XBayaTextField;
+import org.apache.xmlbeans.XmlCursor;
+
+public class ServiceDescriptionDialog extends JDialog {
+
+    private static final long serialVersionUID = 2705760838264284423L;
+    private final GridPanel contentPanel = new GridPanel();
+    private XBayaLabel lblServiceName;
+    private XBayaTextField txtServiceName;
+    private JTable tblParameters;
+    private boolean serviceCreated = false;
+    private JLabel lblError;
+    private ServiceDescription serviceDescription;
+    private ServiceDescription orginalServiceDescription;
+    private JButton okButton;
+    private JButton btnDeleteParameter;
+    private DefaultTableModel defaultTableModel;
+    private AiravataAPI registry;
+    private boolean newDescription;
+    private boolean ignoreTableChanges=false;
+	private JCheckBox chkForceFileStagingToWorkDir;
+	private boolean serviceDescriptionMode;
+	private String suggestedNamePrefix;
+	private String titlePrefix;
+	
+    /**
+     * Launch the application.
+     */
+    public static void main(String[] args) {
+        try {
+            ServiceDescriptionDialog dialog = new ServiceDescriptionDialog(null,true,null);
+            dialog.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
+            dialog.setVisible(true);
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
+
+    public ServiceDescriptionDialog(AiravataAPI registry) {
+    	this(registry,true,null);
+    }
+    
+    public ServiceDescriptionDialog(AiravataAPI registry, boolean newDescription, ServiceDescription serviceDescription) {
+    	this(registry, newDescription, serviceDescription, true, null);
+    }
+    
+    /**
+     * Create the dialog.
+     */
+    public ServiceDescriptionDialog(AiravataAPI registry, boolean newDescription, ServiceDescription serviceDescription, boolean serviceDescriptionMode, String suggestedNamePrefix) {
+    	setNewDescription(newDescription);
+    	this.setOrginalServiceDescription(serviceDescription);
+    	setServiceDescriptionMode(serviceDescriptionMode);
+    	setSuggestedNamePrefix(suggestedNamePrefix);
+    	if (isNewDescription()) {
+			setTitlePrefix(isServiceDescriptionMode()? "New Service Description":"Input/Output parameters for "+getSuggestedNamePrefix());
+		}else{
+			setTitlePrefix(isServiceDescriptionMode()? "Update Service Description: "+getOrginalServiceDescription().getType().getName():"Update Input/Output parameters for "+getSuggestedNamePrefix());
+		}
+        addWindowListener(new WindowAdapter() {
+            @Override
+            public void windowOpened(WindowEvent arg0) {
+                if (isNewDescription() && !isServiceDescriptionMode()) {
+					String baseName = isServiceDescriptionMode()? "Service":getSuggestedNamePrefix()+"_Service";
+					int i;
+					String defaultName;
+					if (isServiceDescriptionMode()) {
+						i = 1;
+						defaultName = baseName+i;
+					}else{
+						i = 0;
+						defaultName = baseName;
+					}
+					try {
+						while (getRegistry().getApplicationManager().isServiceDescriptorExists(defaultName)) {
+							defaultName = baseName + (++i);
+						}
+					} catch (Exception e) {
+					}
+					txtServiceName.setText(defaultName);
+					setServiceName(txtServiceName.getText());
+				}
+            }
+        });
+        setRegistry(registry);
+        initGUI();
+
+    }
+
+    public void open() {
+        setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
+        setVisible(true);
+    }
+
+    protected ServiceDescriptionDialog getDialog() {
+        return this;
+    }
+
+    private void initGUI() {
+    	setTitle(getTitlePrefix());
+//        if (isNewDescription()) {
+//			setTitle("New Service Description");
+//		}else{
+//			setTitle("Update Service Description: "+getOrginalServiceDescription().getType().getName());
+//		}
+		setBounds(100, 100, 463, 459);
+        setModal(true);
+        setLocationRelativeTo(null);
+        BorderLayout borderLayout = new BorderLayout();
+        borderLayout.setVgap(5);
+        borderLayout.setHgap(5);
+        getContentPane().setLayout(borderLayout);
+
+        txtServiceName = new XBayaTextField();
+        txtServiceName.getSwingComponent().addKeyListener(new KeyAdapter() {
+            @Override
+            public void keyReleased(KeyEvent e) {
+                setServiceName(txtServiceName.getText());
+            }
+        });
+        txtServiceName.setColumns(10);
+        lblServiceName = new XBayaLabel(isServiceDescriptionMode()? "Service name":"Bind parameters to service",txtServiceName);
+        if (!isServiceDescriptionMode()){
+        	lblServiceName.getSwingComponent().setFont(new Font("Tahoma", Font.ITALIC, 11));
+        }
+        JLabel lblInputParameters = new JLabel(isServiceDescriptionMode()? "Service Parameters":"Input/Output Parameters");
+        lblInputParameters.setFont(new Font("Tahoma", Font.BOLD, 11));
+
+        JScrollPane scrollPane = new JScrollPane();
+
+        btnDeleteParameter = new JButton("Delete parameter");
+        btnDeleteParameter.addActionListener(new ActionListener() {
+            @Override
+            public void actionPerformed(ActionEvent arg0) {
+                deleteSelectedRows();
+            }
+        });
+        btnDeleteParameter.setEnabled(false);
+
+        tblParameters = new JTable();
+        tblParameters.putClientProperty("terminateEditOnFocusLost", Boolean.TRUE);
+        tblParameters.setFillsViewportHeight(true);
+        defaultTableModel = new DefaultTableModel(new Object[][] { { null, null, null, null }, }, new String[] { "I/O",
+                "Parameter Name", "Type", "Description" });
+        tblParameters.setModel(defaultTableModel);
+        defaultTableModel.addTableModelListener(new TableModelListener() {
+
+            @Override
+            public void tableChanged(TableModelEvent arg0) {
+                if (!ignoreTableChanges) {
+					int selectedRow = tblParameters.getSelectedRow();
+					if (selectedRow != -1
+							&& defaultTableModel.getRowCount() > 0) {
+						Object parameterIOType = defaultTableModel.getValueAt(
+								selectedRow, 0);
+						Object parameterDataType = defaultTableModel
+								.getValueAt(selectedRow, 2);
+						if (parameterIOType == null
+								|| parameterIOType.equals("")) {
+							defaultTableModel.setValueAt(getIOStringList()[0],
+									selectedRow, 0);
+						}
+						if (parameterDataType == null
+								|| parameterDataType.equals("")) {
+							defaultTableModel.setValueAt(getDataTypes()[0],
+									selectedRow, 2);
+						}
+					}
+					addNewRowIfLastIsNotEmpty();
+				}
+            }
+
+        });
+        TableColumn ioColumn = tblParameters.getColumnModel().getColumn(0);
+        String[] ioStringList = getIOStringList();
+        ioColumn.setCellEditor(new StringArrayComboBoxEditor(ioStringList));
+
+        TableColumn datatypeColumn = tblParameters.getColumnModel().getColumn(2);
+        String[] dataTypeStringList = getDataTypes();
+        datatypeColumn.setCellEditor(new StringArrayComboBoxEditor(dataTypeStringList));
+
+        TableColumn parameterNameCol = tblParameters.getColumnModel().getColumn(1);
+        parameterNameCol.setPreferredWidth(190);
+        scrollPane.setViewportView(tblParameters);
+        ListSelectionModel selectionModel = tblParameters.getSelectionModel();
+        selectionModel.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
+
+        selectionModel.addListSelectionListener(new ListSelectionListener() {
+            @Override
+            public void valueChanged(ListSelectionEvent e) {
+                btnDeleteParameter.setEnabled(tblParameters.getSelectedRows().length > 0);
+            }
+
+        });
+        JLabel lblTableParameterNote=null;
+        if (!isServiceDescriptionMode()) {
+			final JPopupMenu popup = new JPopupMenu();
+			JMenuItem menuItem = new JMenuItem(
+					"Bind to parameters in existing service...");
+			menuItem.addActionListener(new ActionListener() {
+				@Override
+				public void actionPerformed(ActionEvent arg0) {
+					bindExistingServiceDescriptionAsParameters();
+				}
+
+			});
+			popup.add(menuItem);
+			tblParameters.addMouseListener(new MouseAdapter() {
+				@Override
+				public void mouseClicked(MouseEvent e) {
+					showPopup(e);
+				}
+
+				public void mousePressed(MouseEvent e) {
+					showPopup(e);
+				}
+
+				public void mouseReleased(MouseEvent e) {
+					showPopup(e);
+				}
+
+				private void showPopup(MouseEvent e) {
+					if (e.isPopupTrigger()) {
+						popup.show(tblParameters, e.getX(), e.getY());
+					}
+				}
+			});
+			lblTableParameterNote = new JLabel("*Note: Right click on the table to bind an existing service");
+			lblTableParameterNote.setFont(new Font("Tahoma", Font.ITALIC, 11));
+		}
+		chkForceFileStagingToWorkDir=new JCheckBox("Advanced: Force input file staging to working directory");
+        chkForceFileStagingToWorkDir.addActionListener(new ActionListener(){
+
+			@Override
+			public void actionPerformed(ActionEvent arg0) {
+				setForceFileStagingToWorkDir(chkForceFileStagingToWorkDir.isSelected());
+			}
+        	
+        });
+        GridPanel buttonPane = new GridPanel();
+        {
+            GridBagLayout gbl_buttonPane = new GridBagLayout();
+            gbl_buttonPane.columnWidths = new int[] { 307, 136, 0 };
+            gbl_buttonPane.rowHeights = new int[] { 33, 0 };
+            gbl_buttonPane.columnWeights = new double[] { 0.0, 0.0, Double.MIN_VALUE };
+            gbl_buttonPane.rowWeights = new double[] { 0.0, Double.MIN_VALUE };
+            
+
+            lblError = new JLabel("");
+            lblError.setForeground(Color.RED);
+            GridBagConstraints gbc_lblError = new GridBagConstraints();
+            gbc_lblError.insets = new Insets(0, 0, 0, 5);
+            gbc_lblError.gridx = 0;
+            gbc_lblError.gridy = 0;
+            buttonPane.add(lblError);
+            JPanel panel = new JPanel();
+            GridBagConstraints gbc_panel = new GridBagConstraints();
+            gbc_panel.anchor = GridBagConstraints.NORTHWEST;
+            gbc_panel.gridx = 1;
+            gbc_panel.gridy = 0;
+            buttonPane.add(panel);
+            {
+            	JButton resetButton = new JButton("Reset");
+                resetButton.addActionListener(new ActionListener() {
+                    @Override
+                    public void actionPerformed(ActionEvent e) {
+                    	loadData();
+                    }
+                });
+                panel.add(resetButton);
+            }
+            {
+                okButton = new JButton("Save");
+                if (!isNewDescription()){
+                	okButton.setText("Update");
+                }
+                okButton.setEnabled(false);
+                okButton.addActionListener(new ActionListener() {
+                    @Override
+                    public void actionPerformed(ActionEvent e) {
+                        saveServiceDescription();
+                        close();
+                    }
+                });
+                panel.add(okButton);
+                okButton.setActionCommand("OK");
+                getRootPane().setDefaultButton(okButton);
+            }
+            {
+                JButton cancelButton = new JButton("Cancel");
+                cancelButton.addActionListener(new ActionListener() {
+                    @Override
+                    public void actionPerformed(ActionEvent e) {
+                        setServiceCreated(false);
+                        close();
+                    }
+                });
+                panel.add(cancelButton);
+                cancelButton.setActionCommand("Cancel");
+            }
+        }
+        
+        contentPanel.add(lblServiceName);
+        contentPanel.add(txtServiceName);
+        GridPanel parameterPanel=new GridPanel();
+        if (isServiceDescriptionMode()) {
+			parameterPanel.add(lblInputParameters);
+		}
+		if (lblTableParameterNote!=null) {
+			parameterPanel.add(lblTableParameterNote);
+		}
+        parameterPanel.add(scrollPane);
+			//        if (isServiceDescriptionMode()){
+    	parameterPanel.add(btnDeleteParameter);
+//        }else{
+//            GridPanel parameterOptionPanel=new GridPanel();
+//        	JButton btnLoadExistingServiceData = new JButton("Bind to parameters in existing service description...");
+//        	btnLoadExistingServiceData.addActionListener(new ActionListener(){
+//				@Override
+//				public void actionPerformed(ActionEvent arg0) {
+//					bindExistingServiceDescriptionAsParameters();
+//				}
+//        	});
+//        	parameterOptionPanel.add(btnLoadExistingServiceData);
+//        	parameterOptionPanel.add(btnDeleteParameter);
+//        	parameterPanel.add(parameterOptionPanel);
+//        }
+        
+        SwingUtil.layoutToGrid(contentPanel.getSwingComponent(), 1, 2, SwingUtil.WEIGHT_NONE, 1);
+//        if (lblTableParameterNote==null){
+        	SwingUtil.layoutToGrid(parameterPanel.getSwingComponent(), 3, 1, 1, 0);
+//        }else{
+//        	SwingUtil.layoutToGrid(parameterPanel.getSwingComponent(), 4, 1, 2, 0);
+//        }
+        GridPanel infoPanel = new GridPanel();
+        if (isServiceDescriptionMode()) {
+			infoPanel.add(contentPanel);
+		}
+		infoPanel.add(parameterPanel);
+        infoPanel.add(chkForceFileStagingToWorkDir);
+        if (!isServiceDescriptionMode()) {
+			infoPanel.add(contentPanel);
+		}
+        infoPanel.getSwingComponent().setBorder(BorderFactory.createEtchedBorder());
+        if (isServiceDescriptionMode()) {
+			infoPanel.layout(3, 1, 1, 0);
+		}else{
+			infoPanel.layout(3, 1, 0, 0);
+		}
+		getContentPane().add(infoPanel.getSwingComponent());
+        getContentPane().add(buttonPane.getSwingComponent());
+        buttonPane.getSwingComponent().setBorder(BorderFactory.createEtchedBorder());
+        SwingUtil.layoutToGrid(getContentPane(), 2, 1, 0, 0);
+        setResizable(true);
+        getRootPane().setDefaultButton(okButton);
+        if (!isNewDescription()){
+        	loadData();
+        }
+    }
+
+    private void loadData() {
+    	ServiceDescriptionType descType = getOrginalServiceDescription().getType();
+		txtServiceName.setText(descType.getName());
+		setServiceName(txtServiceName.getText());
+
+		txtServiceName.setEditable(!isServiceDescriptionMode() || isNewDescription());
+    	ignoreTableChanges=true;
+    	while(defaultTableModel.getRowCount()>0){
+    		defaultTableModel.removeRow(0);
+    	}
+    	InputParameterType[] iparameters = descType.getInputParametersArray();
+    	for (InputParameterType parameter : iparameters) {
+    		defaultTableModel.addRow(new Object[] { getIOStringList()[0], parameter.getParameterName(),parameter.getParameterType().getName(),parameter.getParameterDescription()});	
+		}
+    	OutputParameterType[] oparameters = descType.getOutputParametersArray();
+    	for (OutputParameterType parameter : oparameters) {
+    		defaultTableModel.addRow(new Object[] { getIOStringList()[1], parameter.getParameterName(), parameter.getParameterType().getName(),parameter.getParameterDescription()});	
+		}
+    	addNewRowIfLastIsNotEmpty();
+    	Boolean selected = false;
+    	if (descType.getPortType()!=null && descType.getPortType().getMethod()!=null) {
+			XmlCursor cursor = descType.getPortType().getMethod().newCursor();
+//			cursor.toNextToken();
+			String value = cursor.getAttributeText(new QName("forceFileStagingToWorkDir"));
+			cursor.dispose();
+			selected = false;
+			if (value != null) {
+				selected = Boolean.parseBoolean(value);
+			}
+		}
+		chkForceFileStagingToWorkDir.setSelected(selected);
+    	setForceFileStagingToWorkDir(selected);
+    	ignoreTableChanges=false;
+	}
+
+    private String[] getIOStringList() {
+        String[] ioStringList = new String[] { "Input", "Output" };
+        return ioStringList;
+    }
+
+    private String[] getDataTypes() {
+        String[] type = new String[DataType.Enum.table.lastInt()];
+        for (int i = 1; i <= DataType.Enum.table.lastInt(); i++) {
+            type[i - 1] = DataType.Enum.forInt(i).toString();
+        }
+        return type;
+    }
+
+    public boolean isServiceCreated() {
+        return serviceCreated;
+    }
+
+    public void setServiceCreated(boolean serviceCreated) {
+        this.serviceCreated = serviceCreated;
+    }
+
+    public ServiceDescription getServiceDescription() {
+        if (serviceDescription == null) {
+            serviceDescription = new ServiceDescription();
+        }
+        return serviceDescription;
+    }
+
+    public ServiceDescriptionType getServiceDescriptionType() {
+        return getServiceDescription().getType();
+    }
+
+    public String getServiceName() {
+        return getServiceDescription().getType().getName();
+    }
+
+    public void setServiceName(String serviceName) {
+        getServiceDescription().getType().setName(serviceName);
+        updateDialogStatus();
+    }
+
+    private void setupMethod(){
+    	if (getServiceDescriptionType().getPortType()==null){
+    		getServiceDescriptionType().setPortType(getServiceDescriptionType().addNewPortType());
+    	}
+    	if (getServiceDescriptionType().getPortType().getMethod()==null){
+    		getServiceDescriptionType().getPortType().setMethod(getServiceDescriptionType().getPortType().addNewMethod());
+    	}
+    }
+    public void setForceFileStagingToWorkDir(Boolean force){
+    	setupMethod();
+    	XmlCursor cursor = getServiceDescriptionType().getPortType().getMethod().newCursor();
+    	cursor.toNextToken();
+		if (!cursor.setAttributeText(new QName("http://airavata.apache.org/schemas/gfac/2012/12","forceFileStagingToWorkDir"),force.toString())){
+			cursor.insertAttributeWithValue("forceFileStagingToWorkDir",force.toString());
+		}
+		cursor.dispose();
+    }
+    
+    public Boolean getForceFileStagingToWorkDir(){
+    	setupMethod();
+    	XmlCursor cursor = getServiceDescriptionType().getPortType().getMethod().newCursor();    	
+    	cursor.toNextToken();
+		String value = cursor.getAttributeText(new QName("forceFileStagingToWorkDir"));
+		cursor.dispose();
+		if (value==null){
+			return false;
+		}else{
+			return Boolean.parseBoolean(value);
+		}
+		
+    }
+    
+    private void updateDialogStatus() {
+        String message = null;
+        try {
+            validateDialog();
+        } catch (Exception e) {
+            message = e.getLocalizedMessage();
+        }
+        okButton.setEnabled(message == null);
+        setError(message);
+    }
+
+    private void validateDialog() throws Exception {
+        if (getServiceName() == null || getServiceName().trim().equals("")) {
+            throw new Exception("Name of the service cannot be empty!!!");
+        }
+
+        ServiceDescription serviceDescription2 = null;
+        try {
+            serviceDescription2 = getRegistry().getApplicationManager().getServiceDescription(getServiceName());
+        } catch (AiravataAPIInvocationException e) {
+            if (e.getCause() instanceof PathNotFoundException) {
+                // non-existant name. just want we want
+            } else {
+                throw e;
+            }
+        }
+        if (isNewDescription() && serviceDescription2 != null) {
+            throw new Exception("Service descriptor with the given name already exists!!!");
+        }
+    }
+
+    public void saveServiceDescription() {
+        List<InputParameterType> inputParameters = new ArrayList<InputParameterType>();
+        List<OutputParameterType> outputParameters = new ArrayList<OutputParameterType>();
+
+        for (int i = 0; i < defaultTableModel.getRowCount(); i++) {
+            String parameterName = (String) defaultTableModel.getValueAt(i, 1);
+            String paramType = (String) defaultTableModel.getValueAt(i, 2);
+            String parameterDescription = (String) defaultTableModel.getValueAt(i, 3);
+            if (parameterName != null && !parameterName.trim().equals("")) {
+                // todo how to handle Enum
+                if (getIOStringList()[0].equals(defaultTableModel.getValueAt(i, 0))) {
+                    InputParameterType parameter = InputParameterType.Factory.newInstance();
+                    parameter.setParameterName(parameterName);
+                    parameter.setParameterDescription(parameterDescription);
+                    ParameterType parameterType = parameter.addNewParameterType();
+                    parameterType.setType(DataType.Enum.forString(paramType));
+                    parameterType.setName(paramType);
+                    inputParameters.add(parameter);
+
+                } else {
+                    OutputParameterType parameter = OutputParameterType.Factory.newInstance();
+                    parameter.setParameterName(parameterName);
+                    parameter.setParameterDescription(parameterDescription);
+                    ParameterType parameterType = parameter.addNewParameterType();
+                    parameterType.setType(DataType.Enum.forString(paramType));
+                    parameterType.setName(paramType);
+                    outputParameters.add(parameter);
+                }
+            }
+        }
+        getServiceDescriptionType().setInputParametersArray(inputParameters.toArray(new InputParameterType[] {}));
+        getServiceDescriptionType().setOutputParametersArray(outputParameters.toArray(new OutputParameterType[] {}));
+
+        try {
+			if (getRegistry().getApplicationManager().isServiceDescriptorExists(getServiceDescription().getType().getName())) {
+				getRegistry().getApplicationManager().updateServiceDescriptor(getServiceDescription());
+			}else{
+				getRegistry().getApplicationManager().saveServiceDescription(getServiceDescription());
+			}
+			setServiceCreated(true);
+		} catch (AiravataAPIInvocationException e) {
+			e.printStackTrace();
+			setError(e.getMessage());
+		}
+    }
+
+    public void close() {
+        getDialog().setVisible(false);
+    }
+
+    private void setError(String errorMessage) {
+        if (errorMessage == null || errorMessage.trim().equals("")) {
+            lblError.setText("");
+        } else {
+            lblError.setText(errorMessage.trim());
+        }
+    }
+
+    private void deleteSelectedRows() {
+        // TODO confirm deletion of selected rows
+        int selectedRow = tblParameters.getSelectedRow();
+        while (selectedRow >= 0 && tblParameters.getRowCount()>0) {
+            defaultTableModel.removeRow(selectedRow);
+            selectedRow = tblParameters.getSelectedRow();
+        }
+        addNewRowIfLastIsNotEmpty();
+    }
+
+    private void addNewRowIfLastIsNotEmpty() {
+    	
+        if (defaultTableModel.getRowCount()>0) {
+			Object parameterName = defaultTableModel.getValueAt(
+					defaultTableModel.getRowCount() - 1, 1);
+			if (parameterName != null && !parameterName.equals("")) {
+				defaultTableModel
+						.addRow(new Object[] { null, null, null, null });
+			}
+		}else{
+			if (tblParameters.getSelectedRow()==-1){
+				defaultTableModel.addRow(new Object[] { null, null, null, null });
+			}
+			
+		}
+    }
+
+    public AiravataAPI getRegistry() {
+        return registry;
+    }
+
+    public void setRegistry(AiravataAPI registry) {
+        this.registry = registry;
+    }
+
+    public boolean isNewDescription() {
+		return newDescription;
+	}
+
+	public void setNewDescription(boolean newDescription) {
+		this.newDescription = newDescription;
+	}
+
+	public ServiceDescription getOrginalServiceDescription() {
+		return orginalServiceDescription;
+	}
+
+	public void setOrginalServiceDescription(ServiceDescription orginalServiceDescription) {
+		this.orginalServiceDescription = orginalServiceDescription;
+	}
+
+	public boolean isServiceDescriptionMode() {
+		return serviceDescriptionMode;
+	}
+
+	public void setServiceDescriptionMode(boolean serviceDescriptionMode) {
+		this.serviceDescriptionMode = serviceDescriptionMode;
+	}
+
+	public String getSuggestedNamePrefix() {
+		return suggestedNamePrefix;
+	}
+
+	public void setSuggestedNamePrefix(String suggestedNamePrefix) {
+		this.suggestedNamePrefix = suggestedNamePrefix;
+	}
+
+	public String getTitlePrefix() {
+		return titlePrefix;
+	}
+
+	public void setTitlePrefix(String titlePrefix) {
+		this.titlePrefix = titlePrefix;
+	}
+
+	private void bindExistingServiceDescriptionAsParameters() {
+		DescriptorListDialog descriptorListDialog = new DescriptorListDialog(getRegistry(),DescriptorType.SERVICE);
+		descriptorListDialog.open();
+		if (descriptorListDialog.isServiceSelected()){
+			setOrginalServiceDescription((ServiceDescription) descriptorListDialog.getSelected());
+			setNewDescription(false);
+			loadData();
+		}
+	}
+
+	private class StringArrayComboBoxEditor extends DefaultCellEditor {
+        private static final long serialVersionUID = -304464739219209395L;
+
+        public StringArrayComboBoxEditor(Object[] items) {
+            super(new JComboBox(items));
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/airavata/blob/9c47eec8/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/dialogs/graph/amazon/InstanceConfigurationDialog.java
----------------------------------------------------------------------
diff --git a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/dialogs/graph/amazon/InstanceConfigurationDialog.java b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/dialogs/graph/amazon/InstanceConfigurationDialog.java
new file mode 100644
index 0000000..9c519c6
--- /dev/null
+++ b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/dialogs/graph/amazon/InstanceConfigurationDialog.java
@@ -0,0 +1,224 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+package org.apache.airavata.xbaya.ui.dialogs.graph.amazon;
+
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+
+import javax.swing.AbstractAction;
+import javax.swing.ButtonGroup;
+import javax.swing.DefaultComboBoxModel;
+import javax.swing.JButton;
+import javax.swing.JPanel;
+import javax.swing.JRadioButton;
+
+import org.apache.airavata.workflow.model.graph.amazon.InstanceNode;
+import org.apache.airavata.xbaya.ui.XBayaGUI;
+import org.apache.airavata.xbaya.ui.dialogs.XBayaDialog;
+import org.apache.airavata.xbaya.ui.widgets.GridPanel;
+import org.apache.airavata.xbaya.ui.widgets.XBayaComboBox;
+import org.apache.airavata.xbaya.ui.widgets.XBayaLabel;
+import org.apache.airavata.xbaya.ui.widgets.XBayaTextField;
+import org.apache.airavata.xbaya.util.AmazonUtil;
+
+public class InstanceConfigurationDialog {
+    private XBayaGUI xbayaGUI;
+
+    private InstanceNode node;
+
+    private XBayaDialog dialog;
+
+    private XBayaTextField nameTextField;
+    private XBayaTextField idTextField;
+    private XBayaTextField usernameTextField;
+    private XBayaComboBox instanceTypeComboBox;
+
+    private JRadioButton amiButton;
+
+    private JRadioButton idButton;
+
+    /**
+     * Constructs an InputConfigurationWindow.
+     * 
+     * @param node
+     * @param engine
+     */
+    public InstanceConfigurationDialog(InstanceNode node, XBayaGUI xbayaGUI) {
+        this.xbayaGUI=xbayaGUI;
+        this.node = node;
+        initGui();
+    }
+
+    /**
+     * Shows the dialog.
+     */
+    public void show() {
+
+        // set name
+        String name = this.node.getName();
+        this.nameTextField.setText(name);
+
+        // set Selected
+        this.amiButton.setSelected(this.node.isStartNewInstance());
+        this.idButton.setSelected(!this.node.isStartNewInstance());
+
+        // instance type
+        if (this.node.isStartNewInstance())
+            this.instanceTypeComboBox.getJComboBox().setEnabled(true);
+        else
+            this.instanceTypeComboBox.getJComboBox().setEnabled(false);
+
+        // set Value
+        this.idTextField.setText(this.node.getIdAsValue());
+        this.usernameTextField.setText(this.node.getUsername());
+        if (this.node.getInstanceType() != null)
+            this.instanceTypeComboBox.setSelectedItem(this.node.getInstanceType());
+        else
+            this.instanceTypeComboBox.setSelectedItem(AmazonUtil.INSTANCE_TYPE[1]);
+
+        // show
+        this.dialog.show();
+    }
+
+    /**
+     * Hides the dialog.
+     */
+    private void hide() {
+        this.dialog.hide();
+    }
+
+    /**
+     * Initializes the GUI.
+     */
+    private void initGui() {
+
+        /*
+         * Name
+         */
+        this.nameTextField = new XBayaTextField();
+        XBayaLabel nameLabel = new XBayaLabel("Name", this.nameTextField);
+        this.nameTextField.setEditable(false);
+
+        /*
+         * Radio button
+         */
+        this.amiButton = new JRadioButton("Start new instance");
+        this.amiButton.setSelected(true);
+        this.amiButton.addActionListener(new ActionListener() {
+            @Override
+            public void actionPerformed(ActionEvent paramActionEvent) {
+                InstanceConfigurationDialog.this.instanceTypeComboBox.getJComboBox().setEnabled(true);
+            }
+        });
+        this.instanceTypeComboBox = new XBayaComboBox(new DefaultComboBoxModel(AmazonUtil.INSTANCE_TYPE));
+        this.instanceTypeComboBox.setSelectedItem(AmazonUtil.INSTANCE_TYPE[1]);
+        GridPanel amiPanel = new GridPanel();
+        amiPanel.add(this.amiButton);
+        amiPanel.add(this.instanceTypeComboBox);
+        amiPanel.layout(1, 2, GridPanel.WEIGHT_NONE, 1);
+
+        this.idButton = new JRadioButton("Use existing instance");
+        this.idButton.addActionListener(new ActionListener() {
+            @Override
+            public void actionPerformed(ActionEvent paramActionEvent) {
+                InstanceConfigurationDialog.this.instanceTypeComboBox.getJComboBox().setEnabled(false);
+            }
+        });
+        ButtonGroup serviceTypeButtonGroup = new ButtonGroup();
+        serviceTypeButtonGroup.add(this.amiButton);
+        serviceTypeButtonGroup.add(this.idButton);
+        XBayaLabel radioLabel = new XBayaLabel("Options", this.amiButton);
+
+        /*
+         * AMI/Instance ID
+         */
+        this.idTextField = new XBayaTextField();
+        XBayaLabel idLabel = new XBayaLabel("AMI/Instance ID", this.amiButton);
+
+        /*
+         * Username
+         */
+        this.usernameTextField = new XBayaTextField();
+        XBayaLabel usernameLabel = new XBayaLabel("Username", this.amiButton);
+
+        GridPanel gridPanel = new GridPanel();
+        gridPanel.add(nameLabel);
+        gridPanel.add(this.nameTextField);
+        gridPanel.add(radioLabel);
+        gridPanel.add(amiPanel);
+        gridPanel.add(new JPanel());
+        gridPanel.add(this.idButton);
+        gridPanel.add(idLabel);
+        gridPanel.add(this.idTextField);
+        gridPanel.add(usernameLabel);
+        gridPanel.add(this.usernameTextField);
+        gridPanel.layout(5, 2, GridPanel.WEIGHT_NONE, 1);
+
+        JButton okButton = new JButton("OK");
+        okButton.addActionListener(new AbstractAction() {
+            public void actionPerformed(ActionEvent e) {
+                if (InstanceConfigurationDialog.this.idTextField.getText() == null
+                        || InstanceConfigurationDialog.this.idTextField.getText().isEmpty()) {
+                    InstanceConfigurationDialog.this.xbayaGUI.getErrorWindow()
+                            .error("Please input AMI ID or Instance ID");
+                    return;
+                }
+                if (InstanceConfigurationDialog.this.usernameTextField.getText() == null
+                        || InstanceConfigurationDialog.this.usernameTextField.getText().isEmpty()) {
+                    InstanceConfigurationDialog.this.xbayaGUI.getErrorWindow().error(
+                            "Please input username to access instance");
+                    return;
+                }
+
+                InstanceConfigurationDialog.this.node.setStartNewInstance(InstanceConfigurationDialog.this.amiButton
+                        .isSelected());
+                if (InstanceConfigurationDialog.this.amiButton.isSelected()) {
+                    InstanceConfigurationDialog.this.node.setAmiId(InstanceConfigurationDialog.this.idTextField
+                            .getText());
+                    InstanceConfigurationDialog.this.node
+                            .setInstanceType(InstanceConfigurationDialog.this.instanceTypeComboBox.getText());
+                } else {
+                    InstanceConfigurationDialog.this.node.setInstanceId(InstanceConfigurationDialog.this.idTextField
+                            .getText());
+                    InstanceConfigurationDialog.this.node.setInstanceType(null);
+                }
+                InstanceConfigurationDialog.this.node.setUsername(InstanceConfigurationDialog.this.usernameTextField
+                        .getText());
+                hide();
+            }
+        });
+
+        JButton cancelButton = new JButton("Cancel");
+        cancelButton.addActionListener(new AbstractAction() {
+            public void actionPerformed(ActionEvent e) {
+                hide();
+            }
+        });
+
+        JPanel buttonPanel = new JPanel();
+        buttonPanel.add(okButton);
+        buttonPanel.add(cancelButton);
+
+        this.dialog = new XBayaDialog(this.xbayaGUI, "Instance Configuration", gridPanel, buttonPanel);
+        this.dialog.setDefaultButton(okButton);
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/airavata/blob/9c47eec8/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/dialogs/graph/dynamic/DynamicNodeWindow.java
----------------------------------------------------------------------
diff --git a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/dialogs/graph/dynamic/DynamicNodeWindow.java b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/dialogs/graph/dynamic/DynamicNodeWindow.java
new file mode 100644
index 0000000..724b091
--- /dev/null
+++ b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/dialogs/graph/dynamic/DynamicNodeWindow.java
@@ -0,0 +1,472 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+package org.apache.airavata.xbaya.ui.dialogs.graph.dynamic;
+
+import java.awt.event.ActionEvent;
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.net.URI;
+import java.util.Iterator;
+import java.util.List;
+
+import javax.swing.AbstractAction;
+import javax.swing.JButton;
+import javax.swing.JCheckBox;
+import javax.swing.JFileChooser;
+import javax.swing.JPanel;
+import javax.xml.namespace.QName;
+
+import org.apache.airavata.workflow.model.component.url.URLComponentRegistry;
+import org.apache.airavata.workflow.model.exceptions.WorkflowRuntimeException;
+import org.apache.airavata.workflow.model.graph.DataPort;
+import org.apache.airavata.workflow.model.graph.Graph;
+import org.apache.airavata.workflow.model.graph.Node;
+import org.apache.airavata.workflow.model.graph.Port;
+import org.apache.airavata.workflow.model.graph.dynamic.BasicTypeMapping;
+import org.apache.airavata.workflow.model.graph.dynamic.DynamicNode;
+import org.apache.airavata.workflow.model.graph.dynamic.SchemaCompilerUtil;
+import org.apache.airavata.workflow.model.graph.ws.WSNode;
+import org.apache.airavata.workflow.model.graph.ws.WSPort;
+import org.apache.airavata.xbaya.XBayaEngine;
+import org.apache.airavata.xbaya.component.registry.ComponentController;
+import org.apache.airavata.xbaya.component.registry.ComponentRegistryLoader;
+import org.apache.airavata.xbaya.invoker.DynamicServiceCreator;
+import org.apache.airavata.xbaya.ui.dialogs.XBayaDialog;
+import org.apache.airavata.xbaya.ui.widgets.GridPanel;
+import org.apache.airavata.xbaya.ui.widgets.XBayaLabel;
+import org.apache.airavata.xbaya.ui.widgets.XBayaTextArea;
+import org.apache.airavata.xbaya.ui.widgets.component.ComponentTreeNode;
+import org.apache.airavata.xbaya.util.RegistryConstants;
+import org.xmlpull.infoset.XmlElement;
+import org.xmlpull.infoset.XmlNamespace;
+import org.xmlpull.v1.builder.XmlBuilderException;
+
+import xsul5.wsdl.WsdlDefinitions;
+
+public class DynamicNodeWindow {
+
+    /**
+     * CLASSES_DIR
+     */
+    private static final String CLASSES_DIR = "classes";
+
+    /**
+     * SRC_DIR
+     */
+    private static final String SRC_DIR = "src";
+
+
+    /**
+     * CLASS
+     */
+    private static final String CLASS = "class";
+
+    /**
+     * PACKAGE
+     */
+    private static final String PACKAGE = "package";
+
+    /**
+     * LINE
+     */
+    private static final String LINE = "\n";
+
+    /**
+     * TAB
+     */
+    private static final String TAB = "\t";
+
+    /**
+     * SPACE
+     */
+    private static final String SPACE = " ";
+
+    private XBayaEngine engine;
+
+    private DynamicNode node;
+
+    private XBayaDialog dialog;
+
+    private XBayaTextArea javaCodeTxtArea;
+
+    private String typesPath;
+
+    private String functionStr;
+
+    private JCheckBox checkBox;
+
+    /**
+     * Constructs a WSNodeWindow.
+     * 
+     * @param engine
+     *            The XBayaEngine
+     * @param node
+     */
+    public DynamicNodeWindow(XBayaEngine engine, DynamicNode node) {
+        this.engine = engine;
+        this.node = node;
+        initGUI();
+
+    }
+
+    /**
+     * Shows the notification.
+     * 
+     * @param event
+     *            The notification to show
+     */
+    public void show() {
+
+        JFileChooser fileChooser = new JFileChooser();
+        fileChooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
+        int ret = fileChooser.showOpenDialog(this.engine.getGUI().getFrame());
+        if (JFileChooser.APPROVE_OPTION != ret) {
+            throw new WorkflowRuntimeException("Cannot proceed without valid directory");
+        }
+        File selectedDir = fileChooser.getSelectedFile();
+        File rootDir = new File(selectedDir, "xbaya");
+        deleteDir(rootDir);
+        rootDir.mkdir();
+        File srcDir = new File(rootDir, SRC_DIR);
+        srcDir.mkdir();
+        File classesDir = new File(rootDir, CLASSES_DIR);
+        classesDir.mkdir();
+        initSchema(rootDir, srcDir, srcDir);
+
+        this.javaCodeTxtArea.setText(generateClass());
+
+        this.dialog.show();
+        if (this.checkBox.isSelected()) {
+            deployWebservice();
+        } else {
+            this.compileAndRegisterJar(rootDir, srcDir, srcDir);
+        }
+
+    }
+
+    private void deployWebservice() {
+        try {
+            DynamicServiceCreator factory = new DynamicServiceCreator(
+                    "http://129.79.246.108:8080/axis2/services/ServiceCreator?wsdl");
+            String code = this.javaCodeTxtArea.getText();
+            factory.createService(code);
+            URLComponentRegistry registry = null;
+            Thread.sleep(10000);
+            registry = new URLComponentRegistry(new URI("http://129.79.246.108:8080/axis2/services/"
+                    + getClassName(code) + "?wsdl"));
+            ComponentRegistryLoader.getLoader(this.engine, RegistryConstants.REGISTRY_TYPE_URL).load(registry);
+
+            Node newNode = this.engine
+                    .getGUI()
+                    .getGraphCanvas()
+                    .addNode(
+                            ((ComponentTreeNode) ComponentController.getComponentTree(registry).getFirstLeaf()).getComponentReference()
+                                    .getComponent(), this.node.getPosition());
+            List<DataPort> inputPorts = newNode.getInputPorts();
+            Graph graph = this.engine.getGUI().getGraphCanvas().getGraph();
+            for (int i = 0; i < inputPorts.size(); ++i) {
+                graph.addEdge(this.node.getInputPort(i).getFromPort(), inputPorts.get(i));
+            }
+            List<DataPort> outputPorts = newNode.getOutputPorts();
+
+            for (int i = 0; i < outputPorts.size(); ++i) {
+                List<Port> toPorts = this.node.getOutputPort(i).getToPorts();
+                for (Port port : toPorts) {
+                    graph.removeEdge(this.node.getOutputPort(i), port);
+                    graph.addEdge(outputPorts.get(i), port);
+                }
+
+            }
+
+            this.engine.getGUI().getWorkflow().removeNode(this.node);
+
+        } catch (Exception e) {
+            this.engine.getGUI().getErrorWindow().error(e);
+        }
+
+    }
+
+    private void hide() {
+        this.dialog.hide();
+    }
+
+    private void initGUI() {
+        BasicTypeMapping.reset();
+
+        this.javaCodeTxtArea = new XBayaTextArea();
+        XBayaLabel operationLabel = new XBayaLabel("Operation", this.javaCodeTxtArea);
+
+        GridPanel infoPanel = new GridPanel();
+        infoPanel.add(operationLabel);
+        infoPanel.add(this.javaCodeTxtArea);
+        checkBox = new JCheckBox("Export as webservice");
+        infoPanel.add(new XBayaLabel("", checkBox));
+
+        infoPanel.add(checkBox);
+        infoPanel.layout(2, 2, 0, 0);
+
+        JButton okButton = new JButton("OK");
+        okButton.addActionListener(new AbstractAction() {
+            public void actionPerformed(ActionEvent e) {
+
+                hide();
+            }
+        });
+        JPanel buttonPanel = new JPanel();
+        buttonPanel.add(okButton);
+
+        this.dialog = new XBayaDialog(this.engine.getGUI(), this.node.getName(), infoPanel, buttonPanel);
+        this.dialog.setDefaultButton(okButton);
+    }
+
+    private String generateClass() {
+
+        String ret = "package org.apache.airavata.xbaya;";
+        ret += LINE + LINE;
+        ret += "public class DefaultClassName{";
+        ret += LINE + LINE + TAB + "public";
+        String function = "";
+        List<Port> toNodes = this.node.getOutputPort(0).getToPorts();
+        XmlElement returnElement = null;
+        QName returnType = null;
+        if (toNodes.size() == 0) {
+            function += SPACE + "void";
+        } else {
+
+            if (toNodes.size() == 1 && toNodes.get(0) instanceof WSPort) {
+                WSPort outPort = (WSPort) toNodes.get(0);
+                returnElement = outPort.getComponentPort().getElement();
+                returnType = outPort.getType();
+            } else {
+                throw new WorkflowRuntimeException("Unhandled  port type for Dynamic component or to many outputs");
+            }
+            for (Port port : toNodes) {
+                if (toNodes.get(0) instanceof DataPort) {
+                    if (!returnType.equals(((DataPort) toNodes.get(0)).getType())) {
+                        throw new WorkflowRuntimeException(
+                                "Dynamic output port connected to input ports of different types.");
+                    }
+                } else {
+                    throw new WorkflowRuntimeException("Unhandled  port type for Dynamic component");
+                }
+            }
+            int index = BasicTypeMapping.getSimpleTypeIndex(returnElement);
+            if (-1 != index) {
+                function += SPACE + BasicTypeMapping.getTypeName(index);
+            } else {
+                throw new WorkflowRuntimeException("WIll be fixed with complex type mappign");
+            }
+        }
+
+        function += SPACE + "operationName(";
+        List<DataPort> inputPorts = this.node.getInputPorts();
+        boolean first = true;
+
+        // variable list in function prototype
+        for (DataPort inPort : inputPorts) {
+            Port fromPort = inPort.getFromPort();
+            if (fromPort instanceof WSPort) {
+                WSPort wsPort = (WSPort) fromPort;
+                XmlElement element = wsPort.getComponentPort().getElement();
+
+                // QName inType = ((DataPort) fromPort).getType();
+                int typeIndex = BasicTypeMapping.getSimpleTypeIndex(element);
+                if (-1 != typeIndex) {
+                    if (first) {
+                        first = false;
+                    } else {
+                        function += SPACE + ",";
+                    }
+                    function += BasicTypeMapping.getTypeName(typeIndex) + SPACE
+                            + BasicTypeMapping.getTypeVariableName(typeIndex);
+                } else {
+                    throw new WorkflowRuntimeException("Complex Type occured:This will be fixed!!!!!");
+                }
+            } else {
+                throw new WorkflowRuntimeException("Dynamic Node connected to non data port");
+            }
+        }
+
+        function += ")";
+        ret += function;
+        this.functionStr = function;
+        // body
+        ret += "{" + LINE + LINE;
+        if (null != returnElement) {
+            ret += TAB + TAB + "return" + SPACE
+                    + BasicTypeMapping.getTypeDefault(BasicTypeMapping.getSimpleTypeIndex(returnElement)) + ";";
+        }
+        ret += LINE;
+        ret += TAB + "}";
+        ret += LINE + "}";
+        return ret;
+
+    }
+
+    private void initSchema(File rootDir, File srcDir, File classesDir) {
+
+        List<DataPort> inputPorts = node.getInputPorts();
+        for (DataPort inPort : inputPorts) {
+            Port fromPort = inPort.getFromPort();
+            Node fromNode = inPort.getFromNode();
+            if (fromNode instanceof WSNode) {
+                WSNode fromWsNode = (WSNode) fromNode;
+                if (null != fromPort && fromPort instanceof DataPort) {
+                    DataPort fromDataPort = (DataPort) fromPort;
+                    WsdlDefinitions wsdl = engine.getGUI().getWorkflow().getWSDLs().get(fromWsNode.getWSDLID());
+                    Iterator<XmlNamespace> itr = wsdl.xml().namespaces().iterator();
+                    try {
+                        XmlElement schema = wsdl.getTypes().element("schema").clone();
+                        // do not change the following ordering of setting
+                        // namespaces.
+                        schema.setNamespace(xsul5.XmlConstants.BUILDER.newNamespace("http://www.w3.org/2001/XMLSchema"));
+                        while (itr.hasNext()) {
+                            XmlNamespace next = itr.next();
+                            if (!"".equals(next.getPrefix()) && null != next.getPrefix()) {
+                                schema.setAttributeValue("xmlns:" + next.getPrefix(), next.getName());
+                            }
+
+                        }
+
+                        try {
+                            xsul5.XmlConstants.BUILDER
+                                    .serializeToOutputStream(schema, new FileOutputStream(rootDir.getCanonicalPath()
+                                            + File.separatorChar + "types.xsd"));
+                        } catch (Exception e) {
+                            // TODO Auto-generated catch block
+                            e.printStackTrace();
+                        }
+
+                        typesPath = rootDir.getCanonicalPath() + File.separatorChar + "mytype.jar";
+                        String[] args = new String[] { "-d", classesDir.getCanonicalPath(), "-src",
+                                srcDir.getCanonicalPath(), "-out", typesPath,
+                                rootDir.getCanonicalPath() + File.separatorChar + "types.xsd" };
+                        SchemaCompilerUtil.compile(args);
+
+                    } catch (XmlBuilderException e) {
+                        this.engine.getGUI().getErrorWindow().error(e);
+                    } catch (CloneNotSupportedException e) {
+                        this.engine.getGUI().getErrorWindow().error(e);
+                    } catch (IOException e) {
+                        // TODO Auto-generated catch block
+                        e.printStackTrace();
+                    }
+
+                } else {
+                    throw new WorkflowRuntimeException("Unknown port for code generation" + fromPort);
+                }
+            } else {
+                throw new WorkflowRuntimeException("Unknown from node for code generation" + fromNode);
+            }
+        }
+    }
+
+    private void compileAndRegisterJar(File rootDir, File srcDir, File classesDir) {
+        // String code = this.javaCodeTxtArea.getText();
+        // String packageName = getPackageName(code);
+        // String className = getClassName(code);
+        // try {
+        // File classFile = new File(srcDir.getCanonicalPath()+ File.separator
+        // + packageName.replace('.', File.separatorChar)
+        // + File.separator + className+".java");
+        // classFile.getParentFile().mkdirs();
+        //
+        // FileWriter out = new FileWriter(classFile);
+        // out.write(code);
+        // out.flush();
+        // out.close();
+        //
+        // JarHelper jarHelper = new JarHelper();
+        // jarHelper.unjarDir(new File(this.typesPath), classesDir);
+        //
+        // Main.compile(new String[]{classFile.getCanonicalPath(), "-d", classesDir.getCanonicalPath()});
+        // File implJar = new File(rootDir, "impl.jar");
+        // jarHelper.jarDir( classesDir, implJar);
+        // node.setImplURL(implJar.toURL());
+        // node.setOperationName(getOperationName(code));
+        // node.setClassName(getPackageName(code)+"."+getClassName(code));
+        // } catch (IOException e) {
+        // this.engine.getGUI().getErrorWindow().error(e);
+        // }
+
+    }
+
+    private String getOperationName(String code) {
+        String[] publicSplit = code.split("public");
+        String searchStr = this.functionStr.substring(this.functionStr.indexOf("("), this.functionStr.indexOf(")"));
+        int index = -1;
+        for (int i = 0; i < publicSplit.length; ++i) {
+            if (publicSplit[i].indexOf(searchStr) != -1) {
+                index = i;
+                break;
+            }
+        }
+        if (index == -1) {
+            throw new WorkflowRuntimeException("Operation name not found");
+        }
+        return publicSplit[index].substring(0, publicSplit[index].indexOf(searchStr)).trim().split(" ")[1];
+    }
+
+    private String getPackageName(String code) {
+        return code.substring(code.indexOf(PACKAGE) + PACKAGE.length(), code.indexOf(";")).trim();
+    }
+
+    private String getClassName(String code) {
+        return code.substring(code.indexOf(CLASS) + CLASS.length(), code.indexOf("{")).trim().split(" ")[0].trim();
+
+    }
+
+    private boolean hasComplexTypes() {
+        List<DataPort> inputPorts = node.getInputPorts();
+        for (DataPort inPort : inputPorts) {
+            Port fromPort = inPort.getFromPort();
+            Node fromNode = inPort.getFromNode();
+            if (fromNode instanceof WSNode) {
+                if (null != fromPort && fromPort instanceof DataPort) {
+
+                } else {
+                    return false;
+                }
+            } else {
+                return false;
+            }
+        }
+        return false;
+    }
+
+    public static boolean deleteDir(File dir) {
+        if (dir.isDirectory()) {
+            String[] children = dir.list();
+            for (int i = 0; i < children.length; i++) {
+                boolean success = deleteDir(new File(dir, children[i]));
+                if (!success) {
+                    return false;
+                }
+            }
+        }
+
+        // The directory is now empty so delete it
+        return dir.delete();
+    }
+
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/airavata/blob/9c47eec8/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/dialogs/graph/dynamic/DynamicWorkflowRunnerWindow.java
----------------------------------------------------------------------
diff --git a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/dialogs/graph/dynamic/DynamicWorkflowRunnerWindow.java b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/dialogs/graph/dynamic/DynamicWorkflowRunnerWindow.java
new file mode 100644
index 0000000..0b18de4
--- /dev/null
+++ b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/dialogs/graph/dynamic/DynamicWorkflowRunnerWindow.java
@@ -0,0 +1,394 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+package org.apache.airavata.xbaya.ui.dialogs.graph.dynamic;
+
+import java.awt.event.ActionEvent;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.UUID;
+
+import javax.swing.AbstractAction;
+import javax.swing.JButton;
+import javax.swing.JCheckBox;
+import javax.swing.JComboBox;
+import javax.swing.JLabel;
+import javax.swing.JOptionPane;
+import javax.swing.JPanel;
+import javax.xml.namespace.QName;
+
+import org.apache.airavata.client.api.exception.AiravataAPIInvocationException;
+import org.apache.airavata.common.utils.StringUtil;
+import org.apache.airavata.common.utils.XMLUtil;
+import org.apache.airavata.workflow.model.exceptions.WorkflowException;
+import org.apache.airavata.workflow.model.graph.system.InputNode;
+import org.apache.airavata.workflow.model.graph.util.GraphUtil;
+import org.apache.airavata.workflow.model.graph.ws.WSNode;
+import org.apache.airavata.workflow.model.ode.ODEClient;
+import org.apache.airavata.workflow.model.wf.Workflow;
+import org.apache.airavata.ws.monitor.MonitorConfiguration;
+import org.apache.airavata.ws.monitor.MonitorException;
+import org.apache.airavata.xbaya.XBayaConfiguration;
+import org.apache.airavata.xbaya.XBayaEngine;
+import org.apache.airavata.xbaya.graph.controller.NodeController;
+import org.apache.airavata.xbaya.interpretor.GUIWorkflowInterpreterInteractorImpl;
+import org.apache.airavata.xbaya.interpretor.WorkflowInterpreter;
+import org.apache.airavata.xbaya.interpretor.WorkflowInterpreterConfiguration;
+import org.apache.airavata.xbaya.jython.script.JythonScript;
+import org.apache.airavata.xbaya.ui.dialogs.XBayaDialog;
+import org.apache.airavata.xbaya.ui.graph.ws.WSNodeGUI;
+import org.apache.airavata.xbaya.ui.utils.ErrorMessages;
+import org.apache.airavata.xbaya.ui.widgets.GridPanel;
+import org.apache.airavata.xbaya.ui.widgets.XBayaLabel;
+import org.apache.airavata.xbaya.ui.widgets.XBayaTextField;
+import org.apache.airavata.xbaya.util.XBayaUtil;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.xmlpull.infoset.XmlElement;
+import org.xmlpull.v1.builder.XmlInfosetBuilder;
+
+import xsul.XmlConstants;
+import xsul.lead.LeadResourceMapping;
+
+public class DynamicWorkflowRunnerWindow {
+
+    private static final Logger logger = LoggerFactory.getLogger(DynamicWorkflowRunnerWindow.class);
+
+    private XBayaEngine engine;
+
+    private Workflow workflow;
+
+    private XBayaDialog dialog;
+
+    private GridPanel parameterPanel;
+
+    private XBayaTextField topicTextField;
+
+    private List<XBayaTextField> parameterTextFields = new ArrayList<XBayaTextField>();
+
+    private XBayaLabel resourceSelectionLabel;
+
+    // private XBayaComboBox resourceSelectionComboBox;
+
+//    private JComboBox gfacUrlListField;
+
+    private JCheckBox interactChkBox;
+
+	private JCheckBox chkRunWithCrossProduct;
+
+	private XBayaTextField instanceNameTextField;
+
+    protected final static XmlInfosetBuilder builder = XmlConstants.BUILDER;
+
+    /**
+     * Constructs a TavernaRunnerWindow.
+     * 
+     * @param engine
+     * 
+     */
+    public DynamicWorkflowRunnerWindow(XBayaEngine engine) {
+        this.engine = engine;
+        if (XBayaUtil.acquireJCRRegistry(this.engine)) {
+            initGUI();
+        }
+    }
+
+    /**
+     * Shows the dialog.
+     */
+    public void show() {
+        this.workflow = this.engine.getGUI().getWorkflow();
+//        List<URI> urlList=null;
+//        try {
+//            urlList = this.engine.getConfiguration().getAiravataAPI().getAiravataManager().getGFaCURLs();
+//        } catch (AiravataAPIInvocationException e) {
+//            e.printStackTrace();
+//        }
+        // When run xbaya continously urls can be repeating, so first remove everything and then add
+//        this.gfacUrlListField.removeAllItems();
+//        for (URI gfacUrl : urlList) {
+//            if (XBayaUtil.isURLExists(gfacUrl + "?wsdl")) {
+//                this.gfacUrlListField.addItem(gfacUrl);
+//            }
+//        }
+//        this.gfacUrlListField.setEditable(true);
+        MonitorConfiguration notifConfig = this.engine.getMonitor().getConfiguration();
+        if (notifConfig.getBrokerURL() == null) {
+            this.engine.getGUI().getErrorWindow().error(ErrorMessages.BROKER_URL_NOT_SET_ERROR);
+            return;
+        }
+
+        // Create input fields
+        List<InputNode> inputNodes = GraphUtil.getInputNodes(this.workflow.getGraph());
+        for (Iterator<InputNode> iterator = inputNodes.iterator(); iterator.hasNext();) {
+            InputNode node = iterator.next();
+            String id = node.getID();
+            QName parameterType = node.getParameterType();
+
+            /*
+             * If input node has no connection, skip it
+             */
+            if (parameterType == null) {
+                iterator.remove();
+                continue;
+            }
+
+            JLabel nameLabel = new JLabel(id);
+            JLabel typeField = new JLabel(parameterType.getLocalPart());
+            XBayaTextField paramField = new XBayaTextField();
+            Object value = node.getDefaultValue();
+
+            String valueString;
+            if (value == null) {
+                valueString = "";
+            } else {
+                if (value instanceof XmlElement) {
+                    XmlElement valueElement = (XmlElement) value;
+                    valueString = XMLUtil.xmlElementToString(valueElement);
+                } else {
+                    // Only string comes here for now.
+                    valueString = value.toString();
+                }
+            }
+
+            if (!node.isVisibility()) {
+                paramField.setEditable(false);
+            }
+            paramField.setText(valueString);
+            this.parameterPanel.add(nameLabel);
+            this.parameterPanel.add(typeField);
+            this.parameterPanel.add(paramField);
+            this.parameterTextFields.add(paramField);
+        }
+        this.parameterPanel.layout(inputNodes.size(), 3, GridPanel.WEIGHT_NONE, 2);
+
+//        this.instanceNameTextField.setText(workflow.getName()+"_"+Calendar.getInstance().getTime().toString());
+
+        this.topicTextField.setText(UUID.randomUUID().toString());
+
+        this.dialog.show();
+    }
+
+    /**
+     * Hides the dialog.
+     */
+    public void hide() {
+        this.dialog.hide();
+
+        this.parameterPanel.resetPanel();
+        this.parameterTextFields.clear();
+    }
+
+    /**
+     * ReInit Host Name ComboBox
+     */
+    // public void reinitHostComboBox() {
+    // if (this.resourceSelectionComboBox == null)
+    // this.resourceSelectionComboBox = new XBayaComboBox(new DefaultComboBoxModel(initHostNameList()));
+    // else
+    // this.resourceSelectionComboBox.setModel(new DefaultComboBoxModel(initHostNameList()));
+    // }
+
+    private void initGUI() {
+        this.parameterPanel = new GridPanel(true);
+
+        // reinitHostComboBox();
+        // this.resourceSelectionLabel = new XBayaLabel("Select a Compute Resource", this.resourceSelectionComboBox);
+        this.instanceNameTextField = new XBayaTextField();
+        XBayaLabel instanceNameLabel = new XBayaLabel("Experiment name", this.instanceNameTextField);
+
+        this.topicTextField = new XBayaTextField();
+        XBayaLabel topicLabel = new XBayaLabel("Notification topic", this.topicTextField);
+//        this.gfacUrlListField = new JComboBox();
+//        XBayaLabel gfacURLLabel = new XBayaLabel("GFac URL", this.gfacUrlListField);
+        this.interactChkBox = new JCheckBox();
+        this.interactChkBox.setSelected(false);
+        XBayaLabel interactLabel = new XBayaLabel("Enable Service Interactions", this.interactChkBox);
+
+    	chkRunWithCrossProduct=new JCheckBox();
+    	XBayaLabel crossProductLabel = new XBayaLabel("Execute in cross product", chkRunWithCrossProduct);
+
+        GridPanel infoPanel = new GridPanel();
+        // infoPanel.add(this.resourceSelectionLabel);
+        // infoPanel.add(this.resourceSelectionComboBox);
+        infoPanel.add(instanceNameLabel);
+        infoPanel.add(this.instanceNameTextField);
+        infoPanel.add(topicLabel);
+        infoPanel.add(this.topicTextField);
+//        infoPanel.add(gfacURLLabel);
+//        infoPanel.add(this.gfacUrlListField);
+        infoPanel.add(interactLabel);
+        infoPanel.add(this.interactChkBox);
+        infoPanel.add(crossProductLabel);
+        infoPanel.add(chkRunWithCrossProduct);
+        
+        infoPanel.layout(5, 2, GridPanel.WEIGHT_NONE, 1);
+
+        GridPanel mainPanel = new GridPanel();
+        mainPanel.add(this.parameterPanel);
+        mainPanel.add(infoPanel);
+        mainPanel.layout(2, 1, 0, 0);
+
+        JButton okButton = new JButton("Run");
+        okButton.addActionListener(new AbstractAction() {
+            public void actionPerformed(ActionEvent e) {
+                execute();
+            }
+        });
+
+        JButton cancelButton = new JButton("Cancel");
+        cancelButton.addActionListener(new AbstractAction() {
+            public void actionPerformed(ActionEvent e) {
+                hide();
+            }
+        });
+
+        JPanel buttonPanel = new JPanel();
+        buttonPanel.add(okButton);
+        buttonPanel.add(cancelButton);
+
+        this.dialog = new XBayaDialog(this.engine.getGUI(), "Invoke workflow", mainPanel, buttonPanel);
+        this.dialog.setDefaultButton(okButton);
+    }
+
+    private void execute() {
+        final List<String> arguments = new ArrayList<String>();
+        String instanceName = this.instanceNameTextField.getText();
+        if (instanceName.trim().equals("")){
+        	JOptionPane.showMessageDialog(engine.getGUI().getFrame(),
+        		    "Experiment name cannot be empty",
+        		    "Experiment Name",
+        		    JOptionPane.ERROR_MESSAGE);
+        	return;
+        }
+//        if (instanceName.equals("")){
+//        	instanceName=workflow.getName();
+//        }
+        final String instanceNameFinal=instanceName;
+        String topic = this.topicTextField.getText();
+        if (topic.length() == 0) {
+            this.engine.getGUI().getErrorWindow().error(ErrorMessages.TOPIC_EMPTY_ERROR);
+            return;
+        }
+
+        // Use topic as a base of workflow instance ID so that the monitor can
+        // find it.
+        URI workfowInstanceID = URI.create(StringUtil.convertToJavaIdentifier(topic));
+        this.workflow.setGPELInstanceID(workfowInstanceID);
+
+        MonitorConfiguration notifConfig = this.engine.getMonitor().getConfiguration();
+        notifConfig.setTopic(topic);
+        arguments.add("-" + JythonScript.TOPIC_VARIABLE);
+        arguments.add(topic);
+        Collection<WSNode> wsNodes = GraphUtil.getWSNodes(this.engine.getGUI().getWorkflow().getGraph());
+        // This is to enable service interaction with the back end
+        if (this.interactChkBox.isSelected()) {
+            LinkedList<String> nodeIDs = new LinkedList<String>();
+            for (WSNode node : wsNodes) {
+                nodeIDs.add(node.getID());
+                ((WSNodeGUI) NodeController.getGUI(node)).setInteractiveMode(true);
+            }
+            notifConfig.setInteractiveNodeIDs(nodeIDs);
+        } else {
+            for (WSNode node : wsNodes) {
+                ((WSNodeGUI) NodeController.getGUI(node)).setInteractiveMode(false);
+            }
+        }
+
+        final boolean isRunCrossProduct=chkRunWithCrossProduct.isSelected();
+        // TODO error check for user inputs
+
+        final List<InputNode> inputNodes = GraphUtil.getInputNodes(this.workflow.getGraph());
+        builder.newFragment("inputs");
+        new ODEClient();
+        for (int i = 0; i < inputNodes.size(); i++) {
+            InputNode inputNode = inputNodes.get(i);
+            XBayaTextField parameterTextField = this.parameterTextFields.get(i);
+            inputNode.getID();
+            String value = parameterTextField.getText();
+            inputNode.setDefaultValue(value);
+        }
+
+//        final String gFacUrl = ((URI) this.gfacUrlListField.getSelectedItem()).toASCIIString();
+//        if (null != gFacUrl && !"".equals(gFacUrl)) {
+//            try {
+//                this.engine.getConfiguration().setGFacURL(new URI(gFacUrl));
+//            } catch (URISyntaxException e) {
+//                this.engine.getGUI().getErrorWindow().error(e);
+//            }
+//        }
+        this.engine.getConfiguration().setTopic(topic);
+
+        /*
+         * Load host description from xregistry and add to interpreter
+         */
+        LeadResourceMapping mapping = null;
+        
+        final LeadResourceMapping resourceMapping = mapping;
+        final String topicString = topic;
+        new Thread() {
+            /**
+             * @see java.lang.Thread#run()
+             */
+            @Override
+            public void run() {
+                XBayaConfiguration conf = DynamicWorkflowRunnerWindow.this.engine.getConfiguration();
+                WorkflowInterpreterConfiguration workflowInterpreterConfiguration = new WorkflowInterpreterConfiguration(engine.getGUI().getWorkflow(),topicString,conf.getMessageBoxURL(), conf.getBrokerURL(), conf.getAiravataAPI(), conf, DynamicWorkflowRunnerWindow.this.engine.getGUI(), DynamicWorkflowRunnerWindow.this.engine.getMonitor());
+                workflowInterpreterConfiguration.setRunWithCrossProduct(isRunCrossProduct);
+
+                WorkflowInterpreter workflowInterpreter = new WorkflowInterpreter(
+                		workflowInterpreterConfiguration, new GUIWorkflowInterpreterInteractorImpl(engine, engine.getGUI().getWorkflow()));
+                DynamicWorkflowRunnerWindow.this.engine.registerWorkflowInterpreter(workflowInterpreter);
+                try {
+                    MonitorConfiguration notifConfig = DynamicWorkflowRunnerWindow.this.engine.getMonitor()
+                            .getConfiguration();
+                    notifConfig.setTopic(topicString);
+                    DynamicWorkflowRunnerWindow.this.engine.getMonitor().start();
+
+                    if (resourceMapping != null)
+                        workflowInterpreter.setResourceMapping(resourceMapping);
+
+                    workflowInterpreter.scheduleDynamically();
+//                    try {
+//						engine.getConfiguration().getJcrComponentRegistry().getRegistry().saveWorkflowExecutionName(topicString, instanceNameFinal);
+//					} catch (RegistryException e) {
+//						e.printStackTrace();
+//					}
+                } catch (WorkflowException e) {
+                    try {
+                        workflowInterpreter.cleanup();
+                    } catch (MonitorException e1) {
+                        DynamicWorkflowRunnerWindow.this.engine.getGUI().getErrorWindow().error(e1);
+                    }
+                    DynamicWorkflowRunnerWindow.this.engine.getGUI().getErrorWindow().error(e);
+                }
+
+            }
+        }.start();
+
+        hide();
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/airavata/blob/9c47eec8/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/dialogs/graph/system/ConstantConfigurationDialog.java
----------------------------------------------------------------------
diff --git a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/dialogs/graph/system/ConstantConfigurationDialog.java b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/dialogs/graph/system/ConstantConfigurationDialog.java
new file mode 100644
index 0000000..52b89a7
--- /dev/null
+++ b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/dialogs/graph/system/ConstantConfigurationDialog.java
@@ -0,0 +1,213 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+package org.apache.airavata.xbaya.ui.dialogs.graph.system;
+
+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.XMLUtil;
+import org.apache.airavata.workflow.model.graph.system.ConstantNode;
+import org.apache.airavata.xbaya.lead.LEADTypes;
+import org.apache.airavata.xbaya.ui.XBayaGUI;
+import org.apache.airavata.xbaya.ui.dialogs.XBayaDialog;
+import org.apache.airavata.xbaya.ui.widgets.GridPanel;
+import org.apache.airavata.xbaya.ui.widgets.XBayaLabel;
+import org.apache.airavata.xbaya.ui.widgets.XBayaTextArea;
+import org.apache.airavata.xbaya.ui.widgets.XBayaTextComponent;
+import org.apache.airavata.xbaya.ui.widgets.XBayaTextField;
+import org.xmlpull.infoset.XmlElement;
+
+public class ConstantConfigurationDialog {
+
+    private XBayaGUI xbayaGUI;
+
+    private ConstantNode node;
+
+    private XBayaDialog dialog;
+
+    private GridPanel gridPanel;
+
+    private XBayaTextField nameTextField;
+
+    private XBayaTextField idTextField;
+
+    private XBayaTextField typeTextField;
+
+    private XBayaLabel valueLabel;
+
+    private XBayaTextField valueTextField;
+
+    private XBayaTextArea valueTextArea;
+
+    /**
+     * Constructs an InputConfigurationWindow.
+     * 
+     * @param node
+     * @param engine
+     */
+    public ConstantConfigurationDialog(ConstantNode node, XBayaGUI xbayaGUI) {
+        this.xbayaGUI=xbayaGUI;
+        this.node = node;
+        initGui();
+    }
+
+    /**
+     * Shows the dialog.
+     */
+    public void show() {
+        QName type = this.node.getType();
+        XBayaTextComponent textComponent;
+        if (LEADTypes.isKnownType(type)) {
+            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 = 7;
+        this.gridPanel.remove(index);
+        this.gridPanel.add(textComponent, index);
+        this.gridPanel.layout(4, 2, 3, 1);
+
+        String name = this.node.getName();
+        this.nameTextField.setText(name);
+        this.idTextField.setText(this.node.getID());
+        this.typeTextField.setText(type.toString());
+        Object value = this.node.getValue();
+        String valueString;
+        if (value == null) {
+            valueString = "";
+        } else if (value instanceof XmlElement) {
+            valueString = XMLUtil.xmlElementToString((XmlElement) value);
+        } else {
+            valueString = value.toString();
+        }
+        textComponent.setText(valueString);
+
+        this.dialog.show();
+    }
+
+    /**
+     * Hides the dialog.
+     */
+    private void hide() {
+        this.dialog.hide();
+    }
+
+    private void setInput() {
+        String name = this.nameTextField.getText();
+        QName type = this.node.getType();
+        String valueString;
+        if (LEADTypes.isKnownType(type)) {
+            valueString = this.valueTextField.getText();
+        } else {
+            valueString = this.valueTextArea.getText();
+        }
+
+        if (name.length() == 0) {
+            String warning = "The name cannot be empty.";
+            this.xbayaGUI.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.getType() + ".";
+                    this.xbayaGUI.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.xbayaGUI.getErrorWindow().error(warning, e);
+                }
+            }
+        }
+
+        this.node.setName(name);
+        this.node.setValue(value);
+        hide();
+        this.xbayaGUI.getGraphCanvas().repaint();
+    }
+
+    /**
+     * Initializes the GUI.
+     */
+    private void initGui() {
+        this.nameTextField = new XBayaTextField();
+        XBayaLabel nameLabel = new XBayaLabel("Name", this.nameTextField);
+
+        this.idTextField = new XBayaTextField();
+        this.idTextField.setEditable(false);
+        XBayaLabel idLabel = new XBayaLabel("ID", this.idTextField);
+
+        this.typeTextField = new XBayaTextField();
+        this.typeTextField.setEditable(false);
+        XBayaLabel typeLabel = new XBayaLabel("Type", this.typeTextField);
+
+        this.valueTextField = new XBayaTextField(); // for string
+        this.valueTextArea = new XBayaTextArea(); // for XML
+        // temporaly set text field.
+        this.valueLabel = new XBayaLabel("", this.valueTextField);
+
+        this.gridPanel = new GridPanel();
+        this.gridPanel.add(nameLabel);
+        this.gridPanel.add(this.nameTextField);
+        this.gridPanel.add(idLabel);
+        this.gridPanel.add(this.idTextField);
+        this.gridPanel.add(typeLabel);
+        this.gridPanel.add(this.typeTextField);
+        this.gridPanel.add(this.valueLabel);
+        this.gridPanel.add(this.valueTextField);
+        this.gridPanel.layout(4, 2, 3, 1);
+
+        JButton okButton = new JButton("OK");
+        okButton.addActionListener(new AbstractAction() {
+            public void actionPerformed(ActionEvent e) {
+                setInput();
+            }
+        });
+
+        JButton cancelButton = new JButton("Cancel");
+        cancelButton.addActionListener(new AbstractAction() {
+            public void actionPerformed(ActionEvent e) {
+                hide();
+            }
+        });
+
+        JPanel buttonPanel = new JPanel();
+        buttonPanel.add(okButton);
+        buttonPanel.add(cancelButton);
+
+        this.dialog = new XBayaDialog(this.xbayaGUI, "Constant Configuration", this.gridPanel, buttonPanel);
+        this.dialog.setDefaultButton(okButton);
+    }
+
+}
\ No newline at end of file