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:08 UTC

[66/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/amazon/ChangeCredentialWindow.java
----------------------------------------------------------------------
diff --git a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/dialogs/amazon/ChangeCredentialWindow.java b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/dialogs/amazon/ChangeCredentialWindow.java
new file mode 100644
index 0000000..d67caad
--- /dev/null
+++ b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/dialogs/amazon/ChangeCredentialWindow.java
@@ -0,0 +1,204 @@
+/*
+ *
+ * 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.amazon;
+
+import com.amazonaws.auth.AWSCredentials;
+import com.amazonaws.auth.BasicAWSCredentials;
+import com.amazonaws.services.ec2.AmazonEC2Client;
+import org.apache.airavata.gfac.ec2.EC2Provider;
+import org.apache.airavata.gfac.ec2.util.EC2ProviderUtil;
+import org.apache.airavata.xbaya.XBayaEngine;
+import org.apache.airavata.xbaya.core.amazon.AmazonCredential;
+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.XBayaTextField;
+
+import javax.swing.*;
+import java.awt.event.ActionEvent;
+import java.io.File;
+import java.io.IOException;
+import java.security.NoSuchAlgorithmException;
+import java.security.spec.InvalidKeySpecException;
+
+public class ChangeCredentialWindow {
+    private XBayaEngine engine;
+    private XBayaDialog dialog;
+    private XBayaTextField accessKeyIDTextField;
+    private XBayaTextField secretAccessKeyTextField;
+
+    private JDialog owner;
+
+    /**
+     * Constructs a ChangeCredentialWindow.
+     *
+     * @param engine XBayaEngine
+     */
+    public ChangeCredentialWindow(XBayaEngine engine) {
+        this.engine = engine;
+        initGUI();
+    }
+
+    public ChangeCredentialWindow(JDialog owner) {
+        this.owner = owner;
+        initGUI();
+    }
+
+    protected void initGUI() {
+        this.accessKeyIDTextField = new XBayaTextField();
+        XBayaLabel accessKeyIDLabel = new XBayaLabel("Access Key", this.accessKeyIDTextField);
+
+        this.secretAccessKeyTextField = new XBayaTextField();
+        XBayaLabel secretAccessKeyLabel = new XBayaLabel("Secret Key", this.secretAccessKeyTextField);
+
+        GridPanel infoPanel = new GridPanel();
+        infoPanel.add(accessKeyIDLabel);
+        infoPanel.add(this.accessKeyIDTextField);
+        infoPanel.add(secretAccessKeyLabel);
+        infoPanel.add(this.secretAccessKeyTextField);
+
+        infoPanel.layout(2, 2, GridPanel.WEIGHT_NONE, 1);
+
+        GridPanel mainPanel = new GridPanel();
+        mainPanel.add(infoPanel);
+        mainPanel.layout(1, 1, GridPanel.WEIGHT_EQUALLY, GridPanel.WEIGHT_EQUALLY);
+
+        JButton okButton = new JButton("Ok");
+        okButton.addActionListener(new AbstractAction() {
+
+            @Override
+            public void actionPerformed(ActionEvent e) {
+                String accessID = ChangeCredentialWindow.this.accessKeyIDTextField.getText();
+                if (!"".equals(accessID)) {
+                    String secretID = ChangeCredentialWindow.this.secretAccessKeyTextField.getText();
+
+                    if (!"".equals(secretID)) {
+                        AmazonCredential.getInstance().setAwsAccessKeyId(accessID);
+                        AmazonCredential.getInstance().setAwsSecretAccessKey(secretID);
+                        hide();
+                        return;
+                    }
+                }
+
+                JOptionPane.showMessageDialog(dialog.getDialog(),"SecretKey and AccessKey can not be empty!");
+            }
+
+        });
+
+        JButton generateButton = new JButton("Generate Key Pair");
+        generateButton.addActionListener(new AbstractAction() {
+
+            @Override
+            public void actionPerformed(ActionEvent e) {
+                String accessID = ChangeCredentialWindow.this.accessKeyIDTextField.getText();
+                if (!"".equals(accessID)) {
+                    String secretID = ChangeCredentialWindow.this.secretAccessKeyTextField.getText();
+
+                    if (!"".equals(secretID)) {
+                        AmazonCredential.getInstance().setAwsAccessKeyId(accessID);
+                        AmazonCredential.getInstance().setAwsSecretAccessKey(secretID);
+
+                        File file = new File(System.getProperty("user.home") + "/.ssh/" + EC2Provider.KEY_PAIR_NAME);
+
+                        if (file.exists()) {
+                            ChangeCredentialWindow.this.engine.getGUI().getErrorWindow().
+                                    info(ChangeCredentialWindow.this.dialog.getDialog(),
+                                    "Warning", "The file " + file.getAbsolutePath() + " exists.");
+
+                        } else {
+                            AWSCredentials credential =
+                                    new BasicAWSCredentials(accessID, secretID);
+                            AmazonEC2Client ec2client = new AmazonEC2Client(credential);
+
+                            try {
+                                EC2ProviderUtil.buildKeyPair(ec2client, EC2Provider.KEY_PAIR_NAME);
+                            } catch (NoSuchAlgorithmException e1) {
+                                ChangeCredentialWindow.this.engine.getGUI().getErrorWindow().
+                                        info(ChangeCredentialWindow.this.dialog.getDialog(),
+                                        "Warning", e1.getMessage());
+                            } catch (InvalidKeySpecException e1) {
+                                ChangeCredentialWindow.this.engine.getGUI().getErrorWindow().
+                                        info(ChangeCredentialWindow.this.dialog.getDialog(),
+                                        "Warning", e1.getMessage());
+                            } catch (IOException e1) {
+                                ChangeCredentialWindow.this.engine.getGUI().getErrorWindow().
+                                        info(ChangeCredentialWindow.this.dialog.getDialog(),
+                                        "Warning", e1.getMessage());
+                            }
+
+                            JOptionPane.showMessageDialog(dialog.getDialog(),"The key " +
+                                    file.getAbsolutePath() + " generated.");
+                        }
+
+                        hide();
+                        return;
+                    }
+                }
+
+                JOptionPane.showMessageDialog(dialog.getDialog(),"SecretKey and AccessKey can not be empty!");
+            }
+
+        });
+
+        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(generateButton);
+        buttonPanel.add(cancelButton);
+
+        if (this.owner == null) {
+            this.dialog = new XBayaDialog(this.engine.getGUI(), "Security Credentials", mainPanel, buttonPanel);
+        } else {
+            this.dialog = new XBayaDialog(this.owner, "Security Credentials", mainPanel, buttonPanel);
+        }
+    }
+
+    /**
+     * hide the dialog (when user clicked on cancel)
+     */
+    public void hide() {
+        this.dialog.hide();
+    }
+
+    /**
+     * show the dialog
+     */
+    public void show() {
+        if (!"".equals(AmazonCredential.getInstance().getAwsAccessKeyId())) {
+            ChangeCredentialWindow.this.accessKeyIDTextField
+                    .setText(AmazonCredential.getInstance().getAwsAccessKeyId());
+        }
+        if (!"".equals(AmazonCredential.getInstance().getAwsSecretAccessKey())) {
+            ChangeCredentialWindow.this.secretAccessKeyTextField.setText(AmazonCredential.getInstance()
+                    .getAwsSecretAccessKey());
+        }
+        this.dialog.show();
+    }
+}
\ 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/amazon/EC2InstancesManagementWindow.java
----------------------------------------------------------------------
diff --git a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/dialogs/amazon/EC2InstancesManagementWindow.java b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/dialogs/amazon/EC2InstancesManagementWindow.java
new file mode 100644
index 0000000..de40180
--- /dev/null
+++ b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/dialogs/amazon/EC2InstancesManagementWindow.java
@@ -0,0 +1,183 @@
+/*
+ *
+ * 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.amazon;
+
+import org.apache.airavata.xbaya.XBayaEngine;
+import org.apache.airavata.xbaya.core.amazon.AmazonCredential;
+import org.apache.airavata.xbaya.core.amazon.EC2InstanceResult;
+import org.apache.airavata.xbaya.ui.dialogs.XBayaDialog;
+import org.apache.airavata.xbaya.ui.widgets.GridPanel;
+import org.apache.airavata.xbaya.ui.widgets.XbayaEnhancedList;
+import org.apache.airavata.xbaya.util.AmazonUtil;
+
+import javax.swing.*;
+import javax.swing.border.EtchedBorder;
+import javax.swing.border.TitledBorder;
+import java.awt.*;
+import java.awt.event.ActionEvent;
+import java.util.ArrayList;
+import java.util.List;
+
+public class EC2InstancesManagementWindow {
+    private XBayaEngine engine;
+    private XBayaDialog dialog;
+    private XbayaEnhancedList<EC2InstanceResult> list;
+    private ChangeCredentialWindow credentialWindow;
+
+    /**
+     * Constructs a EC2InstancesManagementWindow.
+     * 
+     * @param engine XBayaEngine
+     */
+    public EC2InstancesManagementWindow(XBayaEngine engine) {
+        this.engine = engine;
+        initGUI();
+    }
+
+    public void show() {
+        this.dialog.show();
+    }
+
+    public void hide() {
+        this.dialog.hide();
+    }
+
+    private void initGUI() {
+        this.list = new XbayaEnhancedList<EC2InstanceResult>();
+
+        GridPanel mainPanel = new GridPanel();
+        TitledBorder border = new TitledBorder(new EtchedBorder(), "My Instances");
+        mainPanel.getSwingComponent().setBorder(border);
+        mainPanel.add(this.list);
+        mainPanel.layout(1, 1, 0, 0);
+
+        /* Connect/Refresh Button */
+        JButton refreshButton = new JButton("Refresh");
+        refreshButton.addActionListener(new AbstractAction() {
+
+            @Override
+            public void actionPerformed(ActionEvent e) {
+
+                /* Check if Credential is already set or not */
+                if (credentialSet()) {
+                    InstancesLoader instancesLoader = new InstancesLoader(EC2InstancesManagementWindow.this.engine,
+                            EC2InstancesManagementWindow.this.dialog.getDialog());
+                    instancesLoader.load(EC2InstancesManagementWindow.this.list);
+                }
+            }
+        });
+
+        /* Launch Instance Button */
+        JButton launchButton = new JButton("Launch");
+        launchButton.addActionListener(new AbstractAction() {
+
+            @Override
+            public void actionPerformed(ActionEvent e) {
+                if (credentialSet()) {
+                    EC2LaunchWindow ec2LaunchWindow = new EC2LaunchWindow(EC2InstancesManagementWindow.this.engine);
+                    ec2LaunchWindow.show();
+                }
+            }
+        });
+
+        /* Terminate Instance */
+        JButton terminateButton = new JButton("Terminate");
+        terminateButton.addActionListener(new AbstractAction() {
+
+            @Override
+            public void actionPerformed(ActionEvent e) {
+                List<EC2InstanceResult> selected = EC2InstancesManagementWindow.this.list.getSelectedValues();
+
+                if (selected.size() == 0) {
+                    EC2InstancesManagementWindow.this.engine.getGUI().getErrorWindow().info(
+                            EC2InstancesManagementWindow.this.dialog.getDialog(), "Warning", "No instances selected");
+                    return;
+                }
+
+                String text = "";
+                List<String> requestIds = new ArrayList<String>();
+
+                for (EC2InstanceResult ec2InstancesResult : selected) {
+                    requestIds.add(ec2InstancesResult.getInstance().getInstanceId());
+                    text += ec2InstancesResult.getInstance().getInstanceId() + ",";
+                }
+
+                // confirm from user
+                int n = JOptionPane.showConfirmDialog(EC2InstancesManagementWindow.this.dialog.getDialog(),
+                        "Are you want to terminate instances:\n" + text, "Terminate Instances",
+                        JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE);
+
+                if (n == JOptionPane.YES_OPTION) {
+                    // terminate
+                    AmazonUtil.terminateInstances(requestIds);
+
+                    // reload
+                    InstancesLoader instancesLoader = new InstancesLoader(EC2InstancesManagementWindow.this.engine,
+                            EC2InstancesManagementWindow.this.dialog.getDialog());
+                    instancesLoader.load(EC2InstancesManagementWindow.this.list);
+                }
+            }
+        });
+
+        /* Close Button */
+        JButton closeButton = new JButton("Close");
+        closeButton.addActionListener(new AbstractAction() {
+
+            @Override
+            public void actionPerformed(ActionEvent e) {
+                EC2InstancesManagementWindow.this.hide();
+            }
+        });
+
+        JPanel buttonPanel = new JPanel();
+        buttonPanel.add(refreshButton);
+        buttonPanel.add(launchButton);
+        buttonPanel.add(terminateButton);
+        buttonPanel.add(closeButton);
+
+        this.dialog = new XBayaDialog(this.engine.getGUI(), "Amazon EC2 Management Console", mainPanel, buttonPanel);
+        int width = 800;
+        int height = 500;
+        this.dialog.getDialog().setPreferredSize(new Dimension(width, height));
+        this.dialog.setDefaultButton(closeButton);
+
+    }
+
+    private boolean credentialSet() {
+        if (AmazonCredential.getInstance().getAwsAccessKeyId().isEmpty()
+                || AmazonCredential.getInstance().getAwsSecretAccessKey().isEmpty()) {
+            EC2InstancesManagementWindow.this.engine.getGUI().getErrorWindow().warning(
+                    EC2InstancesManagementWindow.this.dialog.getDialog(), "Error", "Aws Access Key not set!");
+
+            if (this.credentialWindow == null) {
+                this.credentialWindow = new ChangeCredentialWindow(EC2InstancesManagementWindow.this.dialog.getDialog());
+            }
+            try {
+                this.credentialWindow.show();
+                return false;
+            } catch (Exception e1) {
+                EC2InstancesManagementWindow.this.engine.getGUI().getErrorWindow().error(e1);
+            }
+        }
+        return true;
+    }
+}
\ 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/amazon/EC2LaunchWindow.java
----------------------------------------------------------------------
diff --git a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/dialogs/amazon/EC2LaunchWindow.java b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/dialogs/amazon/EC2LaunchWindow.java
new file mode 100644
index 0000000..a62be69
--- /dev/null
+++ b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/dialogs/amazon/EC2LaunchWindow.java
@@ -0,0 +1,181 @@
+/*
+ *
+ * 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.amazon;
+
+import org.apache.airavata.xbaya.XBayaEngine;
+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;
+
+import javax.swing.*;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+
+public class EC2LaunchWindow {
+    private XBayaEngine engine;
+    private XBayaDialog dialog;
+    private XBayaTextField amiTextField;
+    private JSpinner numberOfInstanceSpinner;
+    private XBayaComboBox instanceTypeComboBox;
+    private XBayaComboBox keyComboBox;
+    private JRadioButton existKeyButton;
+    private ComboBoxModel keyComboBoxModel;
+
+    /**
+     * Constructs a EC2LaunchWindow.
+     * 
+     * @param engine XBayaEngine
+     */
+    public EC2LaunchWindow(XBayaEngine engine) {
+        this.engine = engine;
+        initGUI();
+    }
+
+    private void initGUI() {
+        /* Main Panel */
+        this.amiTextField = new XBayaTextField();
+        XBayaLabel amiLabel = new XBayaLabel("AMI ID", this.amiTextField);
+
+        this.numberOfInstanceSpinner = new JSpinner(new SpinnerNumberModel(1, 1, Integer.MAX_VALUE, 1));
+        XBayaLabel nInstanceLabel = new XBayaLabel("Number Of Instances", this.numberOfInstanceSpinner);
+
+        this.instanceTypeComboBox = new XBayaComboBox(new DefaultComboBoxModel(AmazonUtil.INSTANCE_TYPE));
+        this.instanceTypeComboBox.setSelectedItem(AmazonUtil.INSTANCE_TYPE[1]);
+        XBayaLabel instanceTypeLabel = new XBayaLabel("Instance Type", this.instanceTypeComboBox);
+
+        JRadioButton noKeyButton = new JRadioButton("No Key Pair");
+        noKeyButton.setSelected(true);
+        noKeyButton.addActionListener(new ActionListener() {
+            @Override
+            public void actionPerformed(ActionEvent paramActionEvent) {
+                EC2LaunchWindow.this.keyComboBox.getJComboBox().setEnabled(false);
+            }
+        });
+
+        this.existKeyButton = new JRadioButton("Exist Key Pairs");
+        this.existKeyButton.addActionListener(new ActionListener() {
+
+            @Override
+            public void actionPerformed(ActionEvent paramActionEvent) {
+                if (EC2LaunchWindow.this.keyComboBoxModel == null) {
+                    EC2LaunchWindow.this.keyComboBoxModel = new DefaultComboBoxModel(AmazonUtil.loadKeypairs()
+                            .toArray());
+                    EC2LaunchWindow.this.keyComboBox.setModel(EC2LaunchWindow.this.keyComboBoxModel);
+                }
+                EC2LaunchWindow.this.keyComboBox.getJComboBox().setEnabled(true);
+            }
+        });
+
+        ButtonGroup serviceTypeButtonGroup = new ButtonGroup();
+        serviceTypeButtonGroup.add(noKeyButton);
+        serviceTypeButtonGroup.add(this.existKeyButton);
+
+        this.keyComboBox = new XBayaComboBox(new DefaultComboBoxModel());
+        this.keyComboBox.getJComboBox().setEnabled(false);
+
+        GridPanel radioPanel = new GridPanel();
+        radioPanel.add(noKeyButton);
+        radioPanel.add(new JPanel());
+        radioPanel.add(this.existKeyButton);
+        radioPanel.add(this.keyComboBox);
+        radioPanel.layout(2, 2, 0, 1);
+
+        XBayaLabel keyLabel = new XBayaLabel("Key Pair", radioPanel);
+
+        GridPanel mainPanel = new GridPanel(true);
+        mainPanel.add(amiLabel);
+        mainPanel.add(this.amiTextField);
+        mainPanel.add(nInstanceLabel);
+        mainPanel.add(this.numberOfInstanceSpinner);
+        mainPanel.add(instanceTypeLabel);
+        mainPanel.add(this.instanceTypeComboBox);
+        mainPanel.add(keyLabel);
+        mainPanel.add(radioPanel);
+        mainPanel.layout(4, 2, 0, GridPanel.WEIGHT_EQUALLY);
+
+        /* Button Panel */
+        JButton lunchButton = new JButton("Launch");
+        lunchButton.addActionListener(new AbstractAction() {
+
+            @Override
+            public void actionPerformed(ActionEvent e) {
+                // validation
+                if (EC2LaunchWindow.this.amiTextField.getText() == null
+                        || EC2LaunchWindow.this.amiTextField.getText().isEmpty()
+                        || (Integer) EC2LaunchWindow.this.numberOfInstanceSpinner.getValue() <= 0) {
+                    EC2LaunchWindow.this.engine.getGUI().getErrorWindow().info(EC2LaunchWindow.this.dialog.getDialog(),
+                            "Warning", "Please input all fields");
+                    return;
+                }
+
+                try {
+                    // get all data
+                    String ami = EC2LaunchWindow.this.amiTextField.getText();
+                    String instanceType = EC2LaunchWindow.this.instanceTypeComboBox.getText();
+                    Integer n = (Integer) EC2LaunchWindow.this.numberOfInstanceSpinner.getValue();
+
+                    // use exist key pair
+                    if (EC2LaunchWindow.this.existKeyButton.isSelected()) {
+                        String keyname = EC2LaunchWindow.this.keyComboBox.getText();
+                        AmazonUtil.launchInstance(ami, instanceType, n, keyname);
+                    } else {
+                        AmazonUtil.launchInstance(ami, instanceType, n);
+                    }
+
+                    EC2LaunchWindow.this.hide();
+
+                } catch (NumberFormatException nfe) {
+                    EC2LaunchWindow.this.engine.getGUI().getErrorWindow().info(EC2LaunchWindow.this.dialog.getDialog(),
+                            "Warning", "Number of Instances is not numeric");
+                } catch (Exception ex) {
+                    EC2LaunchWindow.this.engine.getGUI().getErrorWindow().error(EC2LaunchWindow.this.dialog.getDialog(),
+                            "Cannot start EC2 instances: " + ex.getMessage(), ex);
+                }
+            }
+        });
+
+        JButton closeButton = new JButton("Close");
+        closeButton.addActionListener(new AbstractAction() {
+            @Override
+            public void actionPerformed(ActionEvent e) {
+                EC2LaunchWindow.this.hide();
+            }
+        });
+
+        JPanel buttonPanel = new JPanel();
+        buttonPanel.add(lunchButton);
+        buttonPanel.add(closeButton);
+
+        this.dialog = new XBayaDialog(this.engine.getGUI(), "Amazon EC2 Launcher", mainPanel, buttonPanel);
+    }
+
+    public void hide() {
+        this.dialog.hide();
+    }
+
+    public void show() {
+        this.dialog.show();
+    }
+}
\ 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/amazon/InstancesLoader.java
----------------------------------------------------------------------
diff --git a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/dialogs/amazon/InstancesLoader.java b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/dialogs/amazon/InstancesLoader.java
new file mode 100644
index 0000000..72ffd84
--- /dev/null
+++ b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/dialogs/amazon/InstancesLoader.java
@@ -0,0 +1,105 @@
+/*
+ *
+ * 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.amazon;
+
+import com.amazonaws.AmazonClientException;
+import com.amazonaws.AmazonServiceException;
+import com.amazonaws.services.ec2.model.Instance;
+import org.apache.airavata.xbaya.XBayaEngine;
+import org.apache.airavata.xbaya.core.amazon.EC2InstanceResult;
+import org.apache.airavata.xbaya.ui.dialogs.WaitDialog;
+import org.apache.airavata.xbaya.ui.utils.Cancelable;
+import org.apache.airavata.xbaya.ui.widgets.XbayaEnhancedList;
+import org.apache.airavata.xbaya.util.AmazonUtil;
+
+import javax.swing.*;
+import java.util.ArrayList;
+import java.util.List;
+
+public class InstancesLoader implements Cancelable {
+    private XBayaEngine engine;
+    private JDialog parent;
+
+    private boolean canceled;
+
+    private WaitDialog loadingDialog;
+
+    /**
+     * Constructs a InstancesLoader.
+     * 
+     * @param engine XBayaEngine
+     * @param parent JDialog
+     */
+    public InstancesLoader(XBayaEngine engine, JDialog parent) {
+        this.engine = engine;
+        this.parent = parent;
+        this.loadingDialog = new WaitDialog(this, "Loading EC2 Instances.", "Loading EC2 Instances.\n"
+                + "Please wait for a moment.", this.engine.getGUI());
+    }
+
+    /**
+     * @see org.apache.airavata.xbaya.ui.utils.Cancelable#cancel()
+     */
+    @Override
+    public void cancel() {
+        this.canceled = true;
+    }
+
+    /**
+     * Load instance list.
+     *
+     * @param list instance list
+     */
+    public void load(final XbayaEnhancedList<EC2InstanceResult> list) {
+
+        new Thread(new Runnable() {
+
+            @Override
+            public void run() {
+                try {
+
+                    List<EC2InstanceResult> tmpList = new ArrayList<EC2InstanceResult>();
+
+                    List<Instance> instances = AmazonUtil.loadInstances();
+                    for (Instance instance : instances) {
+                        tmpList.add(new EC2InstanceResult(instance));
+                    }
+
+                    if (!InstancesLoader.this.canceled) {
+                        list.setListData(tmpList);
+                    }
+
+                } catch (AmazonServiceException ex) {
+                    InstancesLoader.this.engine.getGUI().getErrorWindow().error(InstancesLoader.this.parent,
+                            "Cannot load EC2 instances", ex);
+                } catch (AmazonClientException ex) {
+                    InstancesLoader.this.engine.getGUI().getErrorWindow().error(InstancesLoader.this.parent,
+                            "Cannot load EC2 instances", ex);
+                } finally {
+                    InstancesLoader.this.loadingDialog.hide();
+                }
+            }
+        }).start();
+
+        this.loadingDialog.show();
+    }
+}
\ 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/amazon/S3Downloader.java
----------------------------------------------------------------------
diff --git a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/dialogs/amazon/S3Downloader.java b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/dialogs/amazon/S3Downloader.java
new file mode 100644
index 0000000..acbdfd5
--- /dev/null
+++ b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/dialogs/amazon/S3Downloader.java
@@ -0,0 +1,137 @@
+/*
+ *
+ * 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.amazon;
+
+import org.apache.airavata.xbaya.XBayaEngine;
+import org.apache.airavata.xbaya.ui.dialogs.WaitDialog;
+import org.apache.airavata.xbaya.ui.utils.Cancelable;
+import org.jets3t.service.S3Service;
+import org.jets3t.service.model.S3Object;
+
+import javax.swing.*;
+import java.io.*;
+
+public class S3Downloader implements Cancelable {
+
+    private XBayaEngine engine;
+    private JDialog parent;
+
+    private boolean canceled;
+
+    private WaitDialog loadingDialog;
+
+    /**
+     * Constructs a S3Downloader.
+     * 
+     * @param engine XBayaEngine
+     * @param parent JDialog
+     */
+    public S3Downloader(XBayaEngine engine, JDialog parent) {
+        this.engine = engine;
+        this.parent = parent;
+        this.loadingDialog = new WaitDialog(this, "Downloading file from S3.", "Downloading file from S3.\n"
+                + "Please wait for a moment.", this.engine.getGUI());
+    }
+
+    /**
+     * @see org.apache.airavata.xbaya.ui.utils.Cancelable#cancel()
+     */
+    @Override
+    public void cancel() {
+        this.canceled = true;
+    }
+
+    /**
+     * Download bucket.
+     *
+     * @param s3 S3Service
+     * @param bucket bucket
+     * @param key Key
+     * @param directory directory
+     */
+    public void download(final S3Service s3, final String bucket, final String key, final String directory) {
+
+        new Thread(new Runnable() {
+
+            @Override
+            public void run() {
+
+                BufferedWriter out = null;
+                BufferedReader in = null;
+                try {
+                    S3Object s3Object = s3.getObject(bucket, key);
+
+                    File fileOut = new File(directory + File.separator + s3Object.getKey());
+                    if (!fileOut.getParentFile().exists()) {
+                        fileOut.getParentFile().mkdirs();
+                    }
+                    if (!fileOut.exists()) {
+                        fileOut.createNewFile();
+                    }
+
+                    out = new BufferedWriter(new FileWriter(fileOut));
+                    in = new BufferedReader(new InputStreamReader(s3Object.getDataInputStream()));
+                    String data = null;
+                    while ((data = in.readLine()) != null) {
+
+                        // stop download and delete file
+                        if (S3Downloader.this.canceled) {
+                            out.close();
+                            fileOut.delete();
+                            return;
+                        }
+
+                        out.write(data);
+                        out.newLine();
+                    }
+
+                    S3Downloader.this.engine.getGUI().getErrorWindow().info(S3Downloader.this.parent, "",
+                            "Downloaded successfully!");
+                } catch (Exception ex) {
+                    S3Downloader.this.engine.getGUI().getErrorWindow().error(S3Downloader.this.parent,
+                            "Download failed! Please ensure every fields are filled correctly", ex);
+                } finally {
+                    if (in != null) {
+                        try {
+                            in.close();
+                        } catch (IOException io) {
+                            // do nothing
+                        }
+                    }
+                    if (out != null) {
+                        try {
+                            out.close();
+                        } catch (IOException io) {
+                            // do nothing
+                        }
+                    }
+
+                    // close loading dialog
+                    S3Downloader.this.loadingDialog.hide();
+                }
+            }
+
+        }).start();
+
+        this.loadingDialog.show();
+    }
+}
\ 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/amazon/S3Uploader.java
----------------------------------------------------------------------
diff --git a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/dialogs/amazon/S3Uploader.java b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/dialogs/amazon/S3Uploader.java
new file mode 100644
index 0000000..5178ce3
--- /dev/null
+++ b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/dialogs/amazon/S3Uploader.java
@@ -0,0 +1,127 @@
+/*
+ *
+ * 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.amazon;
+
+import org.apache.airavata.xbaya.XBayaEngine;
+import org.apache.airavata.xbaya.ui.dialogs.WaitDialog;
+import org.apache.airavata.xbaya.ui.utils.Cancelable;
+import org.apache.airavata.xbaya.ui.widgets.amazon.S3Tree;
+import org.jets3t.service.S3Service;
+import org.jets3t.service.model.S3Object;
+
+import javax.swing.*;
+import java.io.File;
+
+public class S3Uploader implements Cancelable {
+    private XBayaEngine engine;
+    private JDialog parent;
+
+    private boolean canceled;
+
+    private WaitDialog loadingDialog;
+
+    /**
+     * Constructs a S3Uploader.
+     * 
+     * @param engine XBayaEngine
+     * @param parent JDialog
+     */
+    public S3Uploader(XBayaEngine engine, JDialog parent) {
+        this.engine = engine;
+        this.parent = parent;
+        this.loadingDialog = new WaitDialog(this, "Uploading file to S3.", "Uploading file to S3.\n"
+                + "Please wait for a moment.", this.engine.getGUI());
+    }
+
+    /**
+     * @see org.apache.airavata.xbaya.ui.utils.Cancelable#cancel()
+     */
+    @Override
+    public void cancel() {
+        this.canceled = true;
+    }
+
+    /**
+     * Upload bucket.
+     *
+     * @param s3 S3Service
+     * @param s3tree S3Tree
+     * @param bucket bucket
+     * @param filePath file path
+     */
+    public void upload(final S3Service s3, final S3Tree s3tree, final String bucket, final String filePath) {
+
+        new Thread(new Runnable() {
+
+            @Override
+            public void run() {
+
+                int index;
+                index = filePath.lastIndexOf('/');
+                String fileName;
+                if (index == -1) {
+                    index = filePath.lastIndexOf('\\');
+                }
+                fileName = filePath.substring(index + 1, filePath.length());
+                try {
+                    S3Object s3Object = new S3Object(new File(filePath));
+                    s3.putObject(bucket, s3Object);
+
+                    /*
+                     * We cannot cancel during upload, so delete file instead
+                     */
+                    if (S3Uploader.this.canceled) {
+                        s3.deleteObject(bucket, s3Object.getKey());
+                    } else {
+
+                        S3Uploader.this.engine.getGUI().getErrorWindow().info(S3Uploader.this.parent, "",
+                                "Uploaded successfully!");
+
+                        // add key to S3Tree
+                        int startIndex = bucket.lastIndexOf('/');
+                        startIndex = startIndex >= 0 ? startIndex : 0;
+                        if (startIndex != 0) {
+                            fileName = bucket.substring(startIndex) + '/' + fileName;
+                        }
+
+                        if (fileName.startsWith("/")) {
+                            fileName = fileName.substring(1, fileName.length());
+                        }
+
+                        s3tree.addObject(bucket, fileName);
+                    }
+
+                } catch (Exception ex) {
+                    S3Uploader.this.engine.getGUI().getErrorWindow().error(S3Uploader.this.parent,
+                            "Upload failed! Please ensure every fields are filled correctly", ex);
+                } finally {
+                    // close loading dialog
+                    S3Uploader.this.loadingDialog.hide();
+                }
+            }
+
+        }).start();
+
+        this.loadingDialog.show();
+    }
+
+}
\ 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/component/URLRegistryWindow.java
----------------------------------------------------------------------
diff --git a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/dialogs/component/URLRegistryWindow.java b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/dialogs/component/URLRegistryWindow.java
new file mode 100644
index 0000000..7aac6e3
--- /dev/null
+++ b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/dialogs/component/URLRegistryWindow.java
@@ -0,0 +1,132 @@
+/*
+ *
+ * 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.component;
+
+import java.awt.event.ActionEvent;
+import java.net.URI;
+import java.net.URISyntaxException;
+
+import javax.swing.AbstractAction;
+import javax.swing.JButton;
+import javax.swing.JPanel;
+
+import org.apache.airavata.workflow.model.component.url.URLComponentRegistry;
+import org.apache.airavata.xbaya.XBayaEngine;
+import org.apache.airavata.xbaya.component.registry.ComponentRegistryLoader;
+import org.apache.airavata.xbaya.ui.dialogs.XBayaDialog;
+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.RegistryConstants;
+
+/**
+ * 
+ * Adds components to the component browser through a URL (eg: add service from a WSDL) 
+ *
+ */
+public class URLRegistryWindow {
+
+    private XBayaEngine engine;
+
+    private ComponentRegistryLoader loader;
+
+    private XBayaDialog dialog;
+
+    private XBayaTextField urlTextField;
+
+    /**
+     * @param engine
+     */
+    public URLRegistryWindow(XBayaEngine engine) {
+        this.engine = engine;
+        this.loader = ComponentRegistryLoader.getLoader(this.engine, RegistryConstants.REGISTRY_TYPE_URL);
+        initGUI();
+    }
+
+    /**
+     * Displays the dialog.
+     */
+    public void show() {
+        this.dialog.show();
+    }
+
+    private void hide() {
+        this.dialog.hide();
+    }
+
+    private void ok() {
+        String urlString = this.urlTextField.getText();
+
+        if (urlString.length() == 0) {
+            this.engine.getGUI().getErrorWindow().error(ErrorMessages.URL_EMPTY);
+            return;
+        }
+        URI url;
+        try {
+            url = new URI(urlString);
+        } catch (URISyntaxException e) {
+            this.engine.getGUI().getErrorWindow().error(ErrorMessages.URL_WRONG, e);
+            return;
+        }
+
+        URLComponentRegistry registry = new URLComponentRegistry(url);
+
+        hide();
+
+        this.loader.load(registry);
+    }
+
+    /**
+     * Initializes the GUI.
+     */
+    private void initGUI() {
+        this.urlTextField = new XBayaTextField();
+        XBayaLabel urlLabel = new XBayaLabel("URL", this.urlTextField);
+
+        GridPanel infoPanel = new GridPanel();
+        infoPanel.add(urlLabel);
+        infoPanel.add(this.urlTextField);
+        infoPanel.layout(1, 2, GridPanel.WEIGHT_NONE, 1);
+
+        JButton okButton = new JButton("OK");
+        okButton.addActionListener(new AbstractAction() {
+            public void actionPerformed(ActionEvent e) {
+                ok();
+            }
+        });
+
+        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(), "Web Registry", infoPanel, 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/component/WebResigtryWindow.java
----------------------------------------------------------------------
diff --git a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/dialogs/component/WebResigtryWindow.java b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/dialogs/component/WebResigtryWindow.java
new file mode 100644
index 0000000..aae1652
--- /dev/null
+++ b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/dialogs/component/WebResigtryWindow.java
@@ -0,0 +1,131 @@
+/*
+ *
+ * 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.component;
+
+import java.awt.event.ActionEvent;
+import java.net.MalformedURLException;
+import java.net.URL;
+
+import javax.swing.AbstractAction;
+import javax.swing.JButton;
+import javax.swing.JPanel;
+
+import org.apache.airavata.workflow.model.component.web.WebComponentRegistry;
+import org.apache.airavata.xbaya.XBayaConstants;
+import org.apache.airavata.xbaya.XBayaEngine;
+import org.apache.airavata.xbaya.component.registry.ComponentRegistryLoader;
+import org.apache.airavata.xbaya.ui.dialogs.XBayaDialog;
+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.RegistryConstants;
+
+public class WebResigtryWindow {
+
+    private XBayaEngine engine;
+
+    private ComponentRegistryLoader loader;
+
+    private XBayaDialog dialog;
+
+    private XBayaTextField urlTextField;
+
+    /**
+     * @param engine
+     */
+    public WebResigtryWindow(XBayaEngine engine) {
+        this.engine = engine;
+        this.loader = ComponentRegistryLoader.getLoader(this.engine, RegistryConstants.REGISTRY_TYPE_WEB);
+        initGUI();
+    }
+
+    /**
+     * Displays the dialog.
+     */
+    public void show() {
+        if (this.urlTextField.getText().length() == 0) {
+            this.urlTextField.setText(XBayaConstants.DEFAULT_WEB_REGISTRY.toString());
+        }
+        this.dialog.show();
+    }
+
+    private void hide() {
+        this.dialog.hide();
+    }
+
+    private void ok() {
+        String urlString = this.urlTextField.getText();
+
+        if (urlString.length() == 0) {
+            this.engine.getGUI().getErrorWindow().error(ErrorMessages.URL_EMPTY);
+            return;
+        }
+        URL url;
+        try {
+            url = new URL(urlString);
+        } catch (MalformedURLException e) {
+            this.engine.getGUI().getErrorWindow().error(ErrorMessages.URL_WRONG, e);
+            return;
+        }
+
+        WebComponentRegistry registry = new WebComponentRegistry(url);
+
+        hide();
+
+        this.loader.load(registry);
+    }
+
+    /**
+     * Initializes the GUI.
+     */
+    private void initGUI() {
+        this.urlTextField = new XBayaTextField();
+        XBayaLabel urlLabel = new XBayaLabel("URL", this.urlTextField);
+
+        GridPanel infoPanel = new GridPanel();
+        infoPanel.add(urlLabel);
+        infoPanel.add(this.urlTextField);
+        infoPanel.layout(1, 2, GridPanel.WEIGHT_NONE, 1);
+
+        JButton okButton = new JButton("OK");
+        okButton.addActionListener(new AbstractAction() {
+            public void actionPerformed(ActionEvent e) {
+                ok();
+            }
+        });
+
+        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(), "Web Registry", infoPanel, 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/descriptors/ApplicationDescriptionAdvancedOptionDialog.java
----------------------------------------------------------------------
diff --git a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/dialogs/descriptors/ApplicationDescriptionAdvancedOptionDialog.java b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/dialogs/descriptors/ApplicationDescriptionAdvancedOptionDialog.java
new file mode 100644
index 0000000..fe72516
--- /dev/null
+++ b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/dialogs/descriptors/ApplicationDescriptionAdvancedOptionDialog.java
@@ -0,0 +1,358 @@
+/*
+ *
+ * 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.Font;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.awt.event.WindowAdapter;
+import java.awt.event.WindowEvent;
+
+import javax.swing.BorderFactory;
+import javax.swing.JButton;
+import javax.swing.JDialog;
+import javax.swing.JLabel;
+import javax.swing.JScrollPane;
+import javax.swing.JSeparator;
+import javax.swing.JTable;
+import javax.swing.ListSelectionModel;
+import javax.swing.SwingConstants;
+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 org.apache.airavata.client.api.AiravataAPI;
+import org.apache.airavata.common.utils.SwingUtil;
+import org.apache.airavata.commons.gfac.type.ApplicationDescription;
+//import org.apache.airavata.registry.api.AiravataRegistry2;
+import org.apache.airavata.schemas.gfac.ApplicationDeploymentDescriptionType;
+import org.apache.airavata.schemas.gfac.NameValuePairType;
+import org.apache.airavata.xbaya.ui.widgets.GridPanel;
+import org.apache.airavata.xbaya.ui.widgets.XBayaLabel;
+import org.apache.airavata.xbaya.ui.widgets.XBayaTextField;
+
+public class ApplicationDescriptionAdvancedOptionDialog extends JDialog {
+    private static final long serialVersionUID = 3920479739097405014L;
+    private XBayaTextField txtInputDir;
+    private XBayaTextField txtOutputDir;
+    private XBayaTextField txtSTDIN;
+    private XBayaTextField txtSTDOUT;
+    private XBayaTextField txtSTDERR;
+    private JTable tblEnv;
+    private ApplicationDescription shellApplicationDescription;
+    private DefaultTableModel defaultTableModel;
+    private boolean tableModelChanging = false;
+    private JButton btnDeleteVariable;
+    private JButton okButton;
+    private AiravataAPI registry;
+	private XBayaTextField txtWorkingDir;
+
+    /**
+     * Launch the application.
+     */
+    public static void main(String[] args) {
+        try {
+            ApplicationDescriptionAdvancedOptionDialog dialog = new ApplicationDescriptionAdvancedOptionDialog(null,
+                    null);
+            dialog.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
+            dialog.setVisible(true);
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
+
+    /**
+     * Create the dialog.
+     */
+    public ApplicationDescriptionAdvancedOptionDialog(AiravataAPI registry, ApplicationDescription descriptor) {
+        addWindowListener(new WindowAdapter() {
+            @Override
+            public void windowOpened(WindowEvent arg0) {
+                loadApplicationDescriptionAdvancedOptions();
+            }
+        });
+        setRegistry(registry);
+        setShellApplicationDescription(descriptor);
+        initGUI();
+    }
+
+    public void open() {
+        setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
+        setVisible(true);
+    }
+
+    protected ApplicationDescriptionAdvancedOptionDialog getDialog() {
+        return this;
+    }
+
+    public void close() {
+        getDialog().setVisible(false);
+    }
+
+    @SuppressWarnings("serial")
+	private void initGUI() {
+        setTitle("Application Description Advance Options");
+        setModal(true);
+        setBounds(100, 100, 600, 400);
+        setLocationRelativeTo(null);
+        GridPanel buttonPane = new GridPanel();
+        okButton = new JButton("Update");
+        okButton.setActionCommand("OK");
+        okButton.addActionListener(new ActionListener() {
+            public void actionPerformed(ActionEvent e) {
+                saveApplicationDescriptionAdvancedOptions();
+                close();
+            }
+        });
+        getRootPane().setDefaultButton(okButton);
+    
+    
+        JButton cancelButton = new JButton("Cancel");
+        cancelButton.setActionCommand("Cancel");
+        cancelButton.addActionListener(new ActionListener() {
+            public void actionPerformed(ActionEvent e) {
+                close();
+            }
+        });
+            
+        
+        
+    	GridPanel panel = new GridPanel();
+        
+        txtInputDir = new XBayaTextField();
+        
+        XBayaLabel lblInputDirectory = new XBayaLabel("Input directory",txtInputDir);
+
+        JLabel lblLocations = new JLabel("Locations");
+        lblLocations.setFont(new Font("Tahoma", Font.BOLD, 11));
+
+        txtOutputDir = new XBayaTextField();
+        XBayaLabel lblOutputDirectory = new XBayaLabel("Output directory",txtOutputDir);
+
+        txtWorkingDir = new XBayaTextField();
+        XBayaLabel lblWorkingDir = new XBayaLabel("Static Working directory",txtWorkingDir);
+        
+        JLabel lblProgramData = new JLabel("Program data");
+        lblProgramData.setFont(new Font("Tahoma", Font.BOLD, 11));
+
+
+        txtSTDIN = new XBayaTextField();
+        XBayaLabel lblStdin = new XBayaLabel("STDIN",txtSTDIN);
+
+
+        txtSTDOUT = new XBayaTextField();
+        XBayaLabel lblStdout = new XBayaLabel("STDOUT",txtSTDOUT);
+
+
+        txtSTDERR = new XBayaTextField();
+        XBayaLabel lblStderr = new XBayaLabel("STDERR",txtSTDERR);
+
+        JLabel other = new JLabel("Other");
+        other.setFont(new Font("Tahoma", Font.BOLD, 11));
+
+        JSeparator separator_1 = new JSeparator();
+        separator_1.setOrientation(SwingConstants.VERTICAL);
+
+        JLabel lblEnvironmentalVariables = new JLabel("Environmental Variables");
+        lblEnvironmentalVariables.setFont(new Font("Tahoma", Font.BOLD, 11));
+
+        JScrollPane scrollPane = new JScrollPane();
+
+        btnDeleteVariable = new JButton("Delete variable");
+        btnDeleteVariable.addActionListener(new ActionListener() {
+            public void actionPerformed(ActionEvent e) {
+                deleteSelectedRows();
+            }
+        });
+        btnDeleteVariable.setEnabled(false);
+        tblEnv = new JTable();
+        tblEnv.setFillsViewportHeight(true);
+        scrollPane.setViewportView(tblEnv);
+        tblEnv.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
+        defaultTableModel = new DefaultTableModel(new Object[][] { { null, null }, }, new String[] { "Name",
+                "Value" }) {
+            @SuppressWarnings("rawtypes")
+			Class[] columnTypes = new Class[] { String.class, String.class };
+
+            @SuppressWarnings({ "rawtypes", "unchecked" })
+			public Class getColumnClass(int columnIndex) {
+                return columnTypes[columnIndex];
+            }
+        };
+        tblEnv.setModel(defaultTableModel);
+        defaultTableModel.addTableModelListener(new TableModelListener() {
+            public void tableChanged(TableModelEvent arg0) {
+                if (!tableModelChanging) {
+                    addNewRowIfLastIsNotEmpty();
+                }
+            }
+
+        });
+        tblEnv.getColumnModel().getColumn(0).setPreferredWidth(67);
+        tblEnv.getColumnModel().getColumn(1).setPreferredWidth(158);
+        ListSelectionModel selectionModel = tblEnv.getSelectionModel();
+        selectionModel.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
+
+        selectionModel.addListSelectionListener(new ListSelectionListener() {
+            public void valueChanged(ListSelectionEvent e) {
+                btnDeleteVariable.setEnabled(tblEnv.getSelectedRows().length > 0);
+            }
+
+        });
+        
+        GridPanel leftPanel = new GridPanel();
+        leftPanel.add(lblLocations);
+        leftPanel.add(new JLabel());
+        leftPanel.add(lblInputDirectory);
+        leftPanel.add(txtInputDir);
+        leftPanel.add(lblOutputDirectory);
+        leftPanel.add(txtOutputDir);
+        leftPanel.add(lblWorkingDir);
+        leftPanel.add(txtWorkingDir);
+        leftPanel.add(lblProgramData);
+        
+        leftPanel.add(new JLabel());
+        leftPanel.add(lblStdin);
+        leftPanel.add(txtSTDIN);
+        leftPanel.add(lblStdout);
+        leftPanel.add(txtSTDOUT);
+        leftPanel.add(lblStderr);
+        leftPanel.add(txtSTDERR);
+        
+        SwingUtil.layoutToGrid(leftPanel.getSwingComponent(), 8, 2, SwingUtil.WEIGHT_NONE, 1);
+        
+        GridPanel rightPanel = new GridPanel();
+        rightPanel.add(lblEnvironmentalVariables);
+        rightPanel.add(scrollPane);
+        rightPanel.add(btnDeleteVariable);
+        rightPanel.getSwingComponent().setSize(150, -1);
+        leftPanel.getSwingComponent().setSize(150, -1);
+        SwingUtil.layoutToGrid(rightPanel.getSwingComponent(), 3, 1, 1, 0);
+        
+        GridPanel p=new GridPanel();
+        p.add(leftPanel);
+        p.add(new JSeparator(JSeparator.VERTICAL));
+        p.layout(1,2, 0,0);
+        panel.add(p);
+        panel.add(rightPanel);
+        panel.getSwingComponent().setBorder(BorderFactory.createEtchedBorder());
+
+        SwingUtil.layoutToGrid(panel.getSwingComponent(), 1, 2, SwingUtil.WEIGHT_NONE, SwingUtil.WEIGHT_EQUALLY);
+        
+        buttonPane.add(okButton);
+        buttonPane.add(cancelButton);
+        buttonPane.getSwingComponent().setBorder(BorderFactory.createEtchedBorder());
+
+        getContentPane().add(panel.getSwingComponent());
+        getContentPane().add(buttonPane.getSwingComponent());
+        SwingUtil.layoutToGrid(getContentPane(), 2, 1, 0, 0);
+        setResizable(true);
+        getRootPane().setDefaultButton(okButton);
+    }
+
+    private void deleteSelectedRows() {
+        // TODO confirm deletion of selected rows
+        int selectedRow = tblEnv.getSelectedRow();
+        while (selectedRow >= 0) {
+            defaultTableModel.removeRow(selectedRow);
+            selectedRow = tblEnv.getSelectedRow();
+        }
+        addNewRowIfLastIsNotEmpty();
+    }
+
+    public ApplicationDescription getApplicationDescription() {
+        return shellApplicationDescription;
+    }
+
+    public ApplicationDeploymentDescriptionType getShellApplicationDescriptionType() {
+        return (ApplicationDeploymentDescriptionType)shellApplicationDescription.getType();
+    }
+    
+    public void setShellApplicationDescription(ApplicationDescription shellApplicationDescription) {
+        this.shellApplicationDescription = shellApplicationDescription;
+    }
+
+    private void addNewRowIfLastIsNotEmpty() {
+        Object varName = null;
+        if (defaultTableModel.getRowCount() > 0) {
+            varName = defaultTableModel.getValueAt(defaultTableModel.getRowCount() - 1, 0);
+        }
+        if (defaultTableModel.getRowCount() == 0 || (varName != null && !varName.equals(""))) {
+            defaultTableModel.addRow(new Object[] { null, null });
+        }
+    }
+
+    private void saveApplicationDescriptionAdvancedOptions() {
+    	getShellApplicationDescriptionType().setInputDataDirectory(txtInputDir.getText());
+    	getShellApplicationDescriptionType().setOutputDataDirectory(txtOutputDir.getText());
+    	getShellApplicationDescriptionType().setStaticWorkingDirectory(txtWorkingDir.getText());
+    	getShellApplicationDescriptionType().setStandardInput(txtSTDIN.getText());
+    	getShellApplicationDescriptionType().setStandardOutput(txtSTDOUT.getText());
+    	getShellApplicationDescriptionType().setStandardError(txtSTDERR.getText());
+    	
+    	while(getShellApplicationDescriptionType().getApplicationEnvironmentArray().length>0){
+    		getShellApplicationDescriptionType().removeApplicationEnvironment(0);
+    	}
+    	for (int i = 0; i < defaultTableModel.getRowCount(); i++) {
+            String parameterName = (String) defaultTableModel.getValueAt(i, 0);
+            String paramValue = (String) defaultTableModel.getValueAt(i, 1);
+            if (parameterName != null && !parameterName.trim().equals("")) {
+            	NameValuePairType envType = getShellApplicationDescriptionType().addNewApplicationEnvironment();
+        		envType.setName(parameterName);
+                envType.setValue(paramValue);
+            }
+        }
+    }
+
+    private void loadApplicationDescriptionAdvancedOptions() {
+        txtInputDir.setText(getShellApplicationDescriptionType().getInputDataDirectory());
+        txtOutputDir.setText(getShellApplicationDescriptionType().getOutputDataDirectory());
+        txtWorkingDir.setText(getShellApplicationDescriptionType().getStaticWorkingDirectory());
+        txtSTDIN.setText(getShellApplicationDescriptionType().getStandardInput());
+        txtSTDOUT.setText(getShellApplicationDescriptionType().getStandardOutput());
+        txtSTDERR.setText(getShellApplicationDescriptionType().getStandardError());
+        tableModelChanging = true;
+        while(defaultTableModel.getRowCount()>0){
+    		defaultTableModel.removeRow(0);
+    	}
+        NameValuePairType[] envParams = getShellApplicationDescriptionType().getApplicationEnvironmentArray();
+    	for (NameValuePairType envParam : envParams) {
+    		defaultTableModel.addRow(new Object[] { envParam.getName(),envParam.getValue()});
+		}
+    	addNewRowIfLastIsNotEmpty();
+        tableModelChanging = false;
+    }
+
+
+
+    public AiravataAPI getRegistry() {
+        return registry;
+    }
+
+    public void setRegistry(AiravataAPI registry) {
+        this.registry = registry;
+    }
+
+
+}