airavata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From samin...@apache.org
Subject [61/90] [abbrv] AIRAVATA-1124
Date Mon, 14 Apr 2014 18:31:03 GMT
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/StreamSourceConfigurationDialog.java
----------------------------------------------------------------------
diff --git a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/dialogs/graph/system/StreamSourceConfigurationDialog.java b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/dialogs/graph/system/StreamSourceConfigurationDialog.java
new file mode 100644
index 0000000..1eead0c
--- /dev/null
+++ b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/dialogs/graph/system/StreamSourceConfigurationDialog.java
@@ -0,0 +1,129 @@
+/*
+ *
+ * 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 org.apache.airavata.workflow.model.graph.system.StreamSourceNode;
+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.XBayaTextField;
+
+public class StreamSourceConfigurationDialog {
+
+    private XBayaGUI xbayaGUI;
+
+    private StreamSourceNode node;
+
+    private XBayaDialog dialog;
+
+    private GridPanel gridPanel;
+
+    private XBayaLabel wsdlLabel;
+
+    private XBayaTextField wsdlTextField;
+
+    private XBayaLabel descriptionLabel;
+
+    private XBayaTextField descriptionTextField;
+
+    /**
+     * Constructs an InputConfigurationWindow.
+     * 
+     * @param node
+     * @param engine
+     */
+    public StreamSourceConfigurationDialog(StreamSourceNode node, XBayaGUI xbayaGUI) {
+        this.xbayaGUI = xbayaGUI;
+        this.node = node;
+        initGui();
+    }
+
+    /**
+     * Shows the dialog.
+     */
+    public void show() {
+
+        this.dialog.show();
+    }
+
+    /**
+     * Hides the dialog.
+     */
+    private void hide() {
+        this.dialog.hide();
+    }
+
+    private void setInput() {
+        this.node.setStreamSourceURL(this.wsdlTextField.getText());
+        this.node.setConfigured(true);
+        this.node.setDescription(this.descriptionTextField.getText());
+        hide();
+        this.xbayaGUI.getGraphCanvas().repaint();
+    }
+
+    /**
+     * Initializes the GUI.
+     */
+    private void initGui() {
+        this.wsdlTextField = new XBayaTextField();
+        this.wsdlLabel = new XBayaLabel("The EPR of the Stream Source", this.wsdlTextField);
+
+        this.descriptionTextField = new XBayaTextField();
+        this.descriptionLabel = new XBayaLabel("Description", this.descriptionTextField);
+
+        this.gridPanel = new GridPanel();
+        this.gridPanel.add(wsdlLabel);
+        this.gridPanel.add(this.wsdlTextField);
+        this.gridPanel.add(descriptionLabel);
+        this.gridPanel.add(this.descriptionTextField);
+        this.gridPanel.layout(2, 2, 1, 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, "Configure Streaming Data source", this.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/ws/ServiceInteractionWindow.java
----------------------------------------------------------------------
diff --git a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/dialogs/graph/ws/ServiceInteractionWindow.java b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/dialogs/graph/ws/ServiceInteractionWindow.java
new file mode 100644
index 0000000..bc2c594
--- /dev/null
+++ b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/dialogs/graph/ws/ServiceInteractionWindow.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.graph.ws;
+
+import java.awt.event.ActionEvent;
+
+import javax.swing.AbstractAction;
+import javax.swing.JButton;
+import javax.swing.JPanel;
+
+import org.apache.airavata.ws.monitor.Monitor;
+import org.apache.airavata.xbaya.ui.XBayaGUI;
+import org.apache.airavata.xbaya.ui.dialogs.WaitDialog;
+import org.apache.airavata.xbaya.ui.dialogs.XBayaDialog;
+import org.apache.airavata.xbaya.ui.views.MonitorPanel;
+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.XBayaTextField;
+
+public class ServiceInteractionWindow {
+
+    private XBayaGUI xbayaGUI;
+
+    private XBayaDialog dialog;
+
+    private WaitDialog invokingDialog;
+
+    private XBayaTextArea consoleTextArea;
+
+    private XBayaTextField commandField;
+
+    private String nodeID;
+
+    private Monitor monitor;
+    
+    public ServiceInteractionWindow(XBayaGUI xbayaGUI, String nodeID, Monitor monitor) {
+        this.xbayaGUI=xbayaGUI;
+        this.nodeID = nodeID;
+        this.monitor=monitor;
+        initGui();
+    }
+
+    /**
+	 * 
+	 */
+    private void initGui() {
+
+        GridPanel mainPanel = new GridPanel();
+
+        MonitorPanel monitorPanel = new MonitorPanel(this.xbayaGUI, this.nodeID, monitor);
+        this.consoleTextArea = new XBayaTextArea();
+        XBayaLabel consoleLabel = new XBayaLabel("Console", this.consoleTextArea);
+
+        this.commandField = new XBayaTextField();
+        XBayaLabel commandLabel = new XBayaLabel("Command", this.commandField);
+
+        mainPanel.add(monitorPanel);
+        mainPanel.add(consoleLabel);
+        mainPanel.add(this.consoleTextArea);
+        mainPanel.add(commandLabel);
+        mainPanel.add(this.commandField);
+
+        mainPanel.layout(5, 1, GridPanel.WEIGHT_NONE, 1);
+
+        JButton sendButton = new JButton("Send");
+        sendButton.addActionListener(new AbstractAction() {
+            /**
+             * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
+             */
+            public void actionPerformed(ActionEvent e) {
+                send();
+
+            }
+
+        });
+
+        JButton cancelButton = new JButton("Done");
+        cancelButton.addActionListener(new AbstractAction() {
+            public void actionPerformed(ActionEvent e) {
+                hide();
+            }
+
+        });
+
+        JPanel buttonPanel = new JPanel();
+        buttonPanel.add(sendButton);
+        buttonPanel.add(cancelButton);
+
+        this.dialog = new XBayaDialog(this.xbayaGUI, "Deploy workflow to ODE and Registry", mainPanel, buttonPanel);
+        this.dialog.setDefaultButton(sendButton);
+
+    }
+
+    private void hide() {
+        this.dialog.hide();
+
+    }
+
+    /**
+	 * 
+	 */
+    public void show() {
+        this.dialog.show();
+    }
+
+    private void send() {
+        String command = this.commandField.getText();
+        this.commandField.setText("");
+        this.consoleTextArea.setText(this.consoleTextArea.getText() + "\n>" + command + "\n");
+
+    }
+}
\ 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/ws/WSNodeWindow.java
----------------------------------------------------------------------
diff --git a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/dialogs/graph/ws/WSNodeWindow.java b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/dialogs/graph/ws/WSNodeWindow.java
new file mode 100644
index 0000000..56809b3
--- /dev/null
+++ b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/dialogs/graph/ws/WSNodeWindow.java
@@ -0,0 +1,140 @@
+/*
+ *
+ * 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.ws;
+
+import java.awt.event.ActionEvent;
+
+import javax.swing.AbstractAction;
+import javax.swing.JButton;
+import javax.swing.JPanel;
+
+import org.apache.airavata.common.utils.WSDLUtil;
+import org.apache.airavata.common.utils.XMLUtil;
+import org.apache.airavata.workflow.model.graph.ws.WSNode;
+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.XBayaLabel;
+import org.apache.airavata.xbaya.ui.widgets.XBayaTextArea;
+import org.apache.airavata.xbaya.ui.widgets.XBayaTextField;
+
+import xsul5.wsdl.WsdlDefinitions;
+
+public class WSNodeWindow {
+
+    private XBayaEngine engine;
+
+    private WSNode node;
+
+    private XBayaDialog dialog;
+
+    private XBayaTextField nameTextField;
+
+    private XBayaTextField idTextField;
+
+    private XBayaTextField typeTextField;
+
+    private XBayaTextArea wsdlTextArea;
+
+    /**
+     * Constructs a WSNodeWindow.
+     * 
+     * @param engine
+     *            The XBayaEngine
+     * @param node
+     */
+    public WSNodeWindow(XBayaEngine engine, WSNode node) {
+        this.engine = engine;
+        this.node = node;
+        initGUI();
+    }
+
+    /**
+     *
+     */
+    public void show() {
+
+        WsdlDefinitions wsdl = this.node.getComponent().getWSDL();
+        String type;
+        if (WSDLUtil.isAWSDL(wsdl)) {
+            type = "Abstract WSDL";
+        } else {
+            type = "Concrete WSDL";
+        }
+
+        this.nameTextField.setText(this.node.getName());
+        this.idTextField.setText(this.node.getID());
+        this.typeTextField.setText(type);
+        // wsdl.toStringPretty uses tab, which doesn't look good in the editor
+        // pane.
+        this.wsdlTextArea.setText(XMLUtil.BUILDER.serializeToStringPretty(wsdl.xml()));
+
+        this.dialog.show();
+    }
+
+    private void hide() {
+        this.dialog.hide();
+    }
+
+    private void initGUI() {
+
+        this.nameTextField = new XBayaTextField();
+        this.nameTextField.setEditable(false);
+        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.wsdlTextArea = new XBayaTextArea();
+        this.wsdlTextArea.setEditable(false);
+        XBayaLabel wsdlLabel = new XBayaLabel("WSDL", this.wsdlTextArea);
+
+        GridPanel infoPanel = new GridPanel();
+        infoPanel.add(nameLabel);
+        infoPanel.add(this.nameTextField);
+        infoPanel.add(idLabel);
+        infoPanel.add(this.idTextField);
+        infoPanel.add(typeLabel);
+        infoPanel.add(this.typeTextField);
+        infoPanel.add(wsdlLabel);
+        infoPanel.add(this.wsdlTextArea);
+        infoPanel.layout(4, 2, 3, 1);
+
+        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);
+    }
+
+}
\ 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/monitor/MonitorConfigurationWindow.java
----------------------------------------------------------------------
diff --git a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/dialogs/monitor/MonitorConfigurationWindow.java b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/dialogs/monitor/MonitorConfigurationWindow.java
new file mode 100644
index 0000000..1d1fcfa
--- /dev/null
+++ b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/dialogs/monitor/MonitorConfigurationWindow.java
@@ -0,0 +1,196 @@
+/*
+ *
+ * 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.monitor;
+
+import java.awt.event.ActionEvent;
+import java.awt.event.ItemEvent;
+import java.awt.event.ItemListener;
+import java.net.URI;
+import java.net.URISyntaxException;
+
+import javax.swing.AbstractAction;
+import javax.swing.JButton;
+import javax.swing.JCheckBox;
+import javax.swing.JLabel;
+import javax.swing.JPanel;
+
+import org.apache.airavata.common.utils.SwingUtil;
+import org.apache.airavata.ws.monitor.MonitorConfiguration;
+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.XBayaLabel;
+import org.apache.airavata.xbaya.ui.widgets.XBayaTextField;
+
+public class MonitorConfigurationWindow {
+
+    private XBayaEngine engine;
+
+    private MonitorConfiguration configuration;
+
+    private XBayaDialog dialog;
+
+    private XBayaTextField brokerTextField;
+
+    private XBayaTextField topicTextField;
+
+    private JCheckBox pullCheckBox;
+
+    private XBayaTextField messageBoxTextField;
+
+    /**
+     * @param engine
+     * 
+     */
+    public MonitorConfigurationWindow(XBayaEngine engine) {
+        this.engine = engine;
+        this.configuration = engine.getMonitor().getConfiguration();
+        initGui();
+    }
+
+    /**
+     * Shows the dialog.
+     */
+    public void show() {
+        this.brokerTextField.setText(this.configuration.getBrokerURL());
+        this.topicTextField.setText(this.configuration.getTopic());
+        this.pullCheckBox.setSelected(this.configuration.isPullMode());
+        this.messageBoxTextField.setText(this.configuration.getMessageBoxURL());
+
+        this.dialog.show();
+    }
+
+    /**
+     * Hides the dialog.
+     */
+    private void hide() {
+        this.dialog.hide();
+    }
+
+    private void setConfiguration() {
+        String broker = this.brokerTextField.getText();
+        String topic = this.topicTextField.getText();
+        String messageBox = this.messageBoxTextField.getText();
+        boolean pull = this.pullCheckBox.isSelected();
+
+        if (broker.length() == 0) {
+            this.engine.getGUI().getErrorWindow().error("Broker URL cannot be empty");
+            return;
+        }
+        URI brokerURL;
+        try {
+            brokerURL = new URI(broker).parseServerAuthority();
+        } catch (URISyntaxException e) {
+            String message = "Broker URL is in a wrong format";
+            this.engine.getGUI().getErrorWindow().error(message, e);
+            return;
+        }
+
+        if (topic.length() == 0) {
+            String message = "Topic cannot be empty";
+            this.engine.getGUI().getErrorWindow().error(message);
+            return;
+        }
+
+        URI messageBoxURL = null;
+        if (pull) {
+            if (messageBox.length() == 0) {
+                this.engine.getGUI().getErrorWindow().error("Message box URL cannot be empty");
+                return;
+            }
+            try {
+                messageBoxURL = new URI(messageBox).parseServerAuthority();
+            } catch (URISyntaxException e) {
+                String message = "Message box URL is in a wrong format";
+                this.engine.getGUI().getErrorWindow().error(message, e);
+                return;
+            }
+        } else {
+            messageBoxURL = this.configuration.getMessageBoxURL();
+        }
+
+        this.configuration.set(brokerURL, topic, pull, messageBoxURL);
+        this.engine.getConfiguration().setMessageBoxURL(messageBoxURL);
+        this.engine.getConfiguration().setBrokerURL(brokerURL);
+        this.engine.getConfiguration().setTopic(topic);
+        hide();
+    }
+
+    private void initGui() {
+
+        this.brokerTextField = new XBayaTextField();
+        XBayaLabel brokerLabel = new XBayaLabel("Broker URL", this.brokerTextField);
+
+        this.topicTextField = new XBayaTextField();
+        XBayaLabel topicLabel = new XBayaLabel("Topic", this.topicTextField);
+
+        this.pullCheckBox = new JCheckBox("Pull Mode");
+        JLabel dummyLabel = new JLabel();
+
+        this.messageBoxTextField = new XBayaTextField();
+        XBayaLabel msgBoxLabel = new XBayaLabel("Message Box URL", this.messageBoxTextField);
+
+        this.messageBoxTextField.setEnabled(false);
+        this.pullCheckBox.addItemListener(new ItemListener() {
+            public void itemStateChanged(ItemEvent event) {
+                int stateChange = event.getStateChange();
+                if (stateChange == ItemEvent.SELECTED) {
+                    MonitorConfigurationWindow.this.messageBoxTextField.setEnabled(true);
+                } else if (stateChange == ItemEvent.DESELECTED) {
+                    MonitorConfigurationWindow.this.messageBoxTextField.setEnabled(false);
+                }
+            }
+        });
+
+        GridPanel infoPanel = new GridPanel();
+        infoPanel.add(brokerLabel);
+        infoPanel.add(this.brokerTextField);
+        infoPanel.add(topicLabel);
+        infoPanel.add(this.topicTextField);
+        infoPanel.add(dummyLabel);
+        infoPanel.add(this.pullCheckBox);
+        infoPanel.add(msgBoxLabel);
+        infoPanel.add(this.messageBoxTextField);
+        infoPanel.layout(4, 2, SwingUtil.WEIGHT_NONE, 1);
+
+        JButton okButton = new JButton("OK");
+        okButton.addActionListener(new AbstractAction() {
+            public void actionPerformed(ActionEvent e) {
+                setConfiguration();
+            }
+        });
+
+        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(), "Notification Configuration", 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/monitor/MonitorWindow.java
----------------------------------------------------------------------
diff --git a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/dialogs/monitor/MonitorWindow.java b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/dialogs/monitor/MonitorWindow.java
new file mode 100644
index 0000000..389147d
--- /dev/null
+++ b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/dialogs/monitor/MonitorWindow.java
@@ -0,0 +1,178 @@
+/*
+ *
+ * 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.monitor;
+
+import java.awt.Color;
+import java.awt.Toolkit;
+import java.awt.datatransfer.Clipboard;
+import java.awt.datatransfer.StringSelection;
+import java.awt.event.ActionEvent;
+import java.net.URL;
+import java.util.Date;
+import java.util.regex.Pattern;
+
+import javax.swing.AbstractAction;
+import javax.swing.JButton;
+import javax.swing.JComponent;
+import javax.swing.JEditorPane;
+import javax.swing.JPanel;
+import javax.swing.JScrollPane;
+import javax.swing.TransferHandler;
+import javax.swing.event.HyperlinkEvent;
+import javax.swing.event.HyperlinkEvent.EventType;
+import javax.swing.event.HyperlinkListener;
+
+import org.apache.airavata.common.utils.BrowserLauncher;
+import org.apache.airavata.common.utils.StringUtil;
+import org.apache.airavata.common.utils.XMLUtil;
+import org.apache.airavata.ws.monitor.EventDataRepository;
+import org.apache.airavata.ws.monitor.MonitorUtil;
+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.XBayaTextField;
+import org.apache.commons.lang.StringEscapeUtils;
+import org.xmlpull.infoset.XmlElement;
+
+import xsul5.XmlConstants;
+
+public class MonitorWindow {
+
+    private XBayaGUI xbayaGUI;
+
+    private XBayaDialog dialog;
+
+    private XBayaTextField timeTextField;
+
+    private XBayaTextField idTextField;
+
+    private XBayaTextField statusTextField;
+
+    private JEditorPane messageTextArea;
+    private String messageText;
+    
+
+    /**
+     * Constructs a MonitorWindow.
+     * 
+     * @param engine
+     *            The XBayaEngine
+     */
+    public MonitorWindow(XBayaGUI xbayaGUI) {
+        this.xbayaGUI=xbayaGUI;
+        init();
+    }
+
+    /**
+     * Shows the notification.
+     * 
+     * @param event
+     *            The notification to show
+     */
+    public void show(XmlElement event) {
+        Date timestamp = MonitorUtil.getTimestamp(event);
+        if (timestamp != null) {
+            this.timeTextField.setText(timestamp.toString());
+        } else {
+            this.timeTextField.setText("");
+        }
+        this.idTextField.setText(MonitorUtil.getNodeID(event));
+        this.statusTextField.setText(MonitorUtil.getStatus(event));
+        
+        // Show the raw XML for now.
+        messageText = XMLUtil.BUILDER.serializeToStringPretty(event);
+		this.messageTextArea.setText(StringUtil.createHTMLUrlTaggedString2(StringEscapeUtils.escapeHtml(messageText),StringUtil.getURLS(messageText)).replaceAll(Pattern.quote(" "), "&nbsp;").replaceAll(Pattern.quote("\n"), "<br />\n"));
+
+        this.dialog.show();
+        this.dialog.getDialog().setSize(600, 800);
+    }
+
+    private void hide() {
+        this.dialog.hide();
+    }
+
+    private void init() {
+        this.timeTextField = new XBayaTextField();
+        this.timeTextField.setEditable(false);
+        XBayaLabel timeLabel = new XBayaLabel(EventDataRepository.Column.TIME.getName(), this.timeTextField);
+
+        this.idTextField = new XBayaTextField();
+        this.idTextField.setEditable(false);
+        XBayaLabel idLabel = new XBayaLabel(EventDataRepository.Column.ID.getName(), this.idTextField);
+
+        this.statusTextField = new XBayaTextField();
+        this.statusTextField.setEditable(false);
+        XBayaLabel statusLabel = new XBayaLabel(EventDataRepository.Column.STATUS.getName(), this.statusTextField);
+
+        this.messageTextArea = new JEditorPane(XmlConstants.CONTENT_TYPE_HTML, "");
+        this.messageTextArea.setSize(500, 500);
+        this.messageTextArea.setEditable(false);
+        messageTextArea.setBackground(Color.WHITE);
+        messageTextArea.addHyperlinkListener(new HyperlinkListener() {
+            public void hyperlinkUpdate(HyperlinkEvent event) {
+                if (event.getEventType() == EventType.ACTIVATED) {
+                    URL url = event.getURL();
+                    try {
+                        BrowserLauncher.openURL(url.toString());
+                    } catch (Exception e) {
+                        MonitorWindow.this.xbayaGUI.getErrorWindow().error(MonitorWindow.this.dialog.getDialog(),
+                                e.getMessage(), e);
+                    }
+                }
+            }
+        });
+        JScrollPane pane = new JScrollPane(messageTextArea);
+        pane.setSize(500, 500);
+        XBayaLabel messageLabel = new XBayaLabel(EventDataRepository.Column.MESSAGE.getName(), pane);
+
+        GridPanel infoPanel = new GridPanel();
+        infoPanel.add(timeLabel);
+        infoPanel.add(this.timeTextField);
+        infoPanel.add(idLabel);
+        infoPanel.add(this.idTextField);
+        infoPanel.add(statusLabel);
+        infoPanel.add(this.statusTextField);
+        infoPanel.add(messageLabel);
+        infoPanel.add(pane);
+        infoPanel.layout(4, 2, 3, 1);
+
+        JButton okButton = new JButton("OK");
+        okButton.addActionListener(new AbstractAction() {
+            public void actionPerformed(ActionEvent e) {
+                hide();
+            }
+        });
+        JButton copyButton = new JButton("Copy to Clipboard");
+        copyButton.addActionListener(new AbstractAction() {
+            public void actionPerformed(ActionEvent e) {
+            	Toolkit.getDefaultToolkit().getSystemClipboard().setContents(new StringSelection(messageText), null);
+            }
+        });
+        JPanel buttonPanel = new JPanel();
+        buttonPanel.add(okButton);
+        buttonPanel.add(copyButton);
+
+        this.dialog = new XBayaDialog(this.xbayaGUI, "Notification", 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/registry/NewRegistryUserDialog.java
----------------------------------------------------------------------
diff --git a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/dialogs/registry/NewRegistryUserDialog.java b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/dialogs/registry/NewRegistryUserDialog.java
new file mode 100644
index 0000000..d677ffa
--- /dev/null
+++ b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/dialogs/registry/NewRegistryUserDialog.java
@@ -0,0 +1,305 @@
+/*
+ *
+ * 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.registry;
+
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.net.URL;
+
+import javax.swing.*;
+
+import org.apache.airavata.persistance.registry.jpa.ResourceType;
+import org.apache.airavata.persistance.registry.jpa.ResourceUtils;
+import org.apache.airavata.persistance.registry.jpa.resources.GatewayResource;
+import org.apache.airavata.persistance.registry.jpa.resources.UserResource;
+import org.apache.airavata.persistance.registry.jpa.resources.WorkerResource;
+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.XBayaLabel;
+import org.apache.airavata.xbaya.ui.widgets.XBayaTextField;
+
+public class NewRegistryUserDialog {
+
+    private XBayaEngine engine;
+
+    private XBayaDialog dialog;
+
+//    private XBayaTextField urlTextField;
+
+    private XBayaTextField usernameTextField;
+
+    private JPasswordField passwordTextField;
+
+    private String gatewayName = "default";
+
+    private String username;
+
+    private URL url;
+
+    private String password;
+
+    private JPasswordField confirmPasswordTextField;
+
+    private JButton okButton;
+
+    private boolean userCreated = false;
+//    public static final String GATEWAY_ID = "default.registry.gateway";
+
+    public NewRegistryUserDialog(XBayaEngine engine) {
+        this(engine, null, null);
+    }
+
+    public NewRegistryUserDialog(XBayaEngine engine, URL url) {
+        this(engine, url, null);
+    }
+
+    public NewRegistryUserDialog(XBayaEngine engine, String username) {
+        this(engine, null, username);
+    }
+
+    /**
+     * @param engine
+     */
+    public NewRegistryUserDialog(XBayaEngine engine, URL url, String username) {
+        this.engine = engine;
+        setUrl(url);
+        setUsername(username);
+        initGUI();
+    }
+
+    /**
+     * Displays the dialog.
+     */
+    public void show() {
+        this.dialog.show();
+    }
+
+    private void hide() {
+//        setUserCreated(false);
+        this.dialog.hide();
+    }
+
+    private void setData() {
+//        updateURL();
+        updateUsername();
+        updatePassword();
+    }
+
+    private void ok() {
+        setData();
+        String status = updateStatus();
+        if (status == null) {
+            try {
+//                Properties properties = Utils.loadProperties();
+                GatewayResource gatewayResource = (GatewayResource)ResourceUtils.getGateway(getGatewayName());
+                UserResource userResource = (UserResource) gatewayResource.create(ResourceType.USER);
+                userResource.setUserName(getUsername());
+                userResource.setPassword(getPassword());
+                userResource.save();
+                WorkerResource workerResource = (WorkerResource) gatewayResource.create(ResourceType.GATEWAY_WORKER);
+                workerResource.setUser(userResource.getUserName());
+                workerResource.save();
+                setUserCreated(true);
+//                JCRComponentRegistry registry = new JCRComponentRegistry(getUsername(),getPassword());
+            } catch (Exception e) {
+                e.printStackTrace();
+                engine.getGUI().getErrorWindow().error(e.getMessage());
+            }
+        } else {
+            engine.getGUI().getErrorWindow().error(status);
+        }
+        close();
+    }
+
+    private String updateStatus() {
+        String msg = null;
+//        if (getUrl() == null) {
+//            msg = "The url cannot be empty";
+//        } else
+        if (getUsername() == null || getUsername().equals("")) {
+            msg = "Username cannot be empty";
+        } else if (getPassword() == null || getPassword().equals("")) {
+            msg = "Passwords must match or cannot be empty";
+        }
+        // okButton.setEnabled(msg==null);
+        return msg;
+    }
+
+    /**
+     * Initializes the GUI.
+     */
+    private void initGUI() {
+//        this.urlTextField = new XBayaTextField();
+        this.usernameTextField = new XBayaTextField();
+        this.passwordTextField = new JPasswordField();
+        this.confirmPasswordTextField = new JPasswordField();
+//        XBayaLabel urlLabel = new XBayaLabel("URL", this.urlTextField);
+        XBayaLabel userLabel = new XBayaLabel("Username", this.usernameTextField);
+        XBayaLabel passLabel = new XBayaLabel("Password", this.passwordTextField);
+        XBayaLabel confirmPassLabel = new XBayaLabel("Confirm Password", this.confirmPasswordTextField);
+
+        GridPanel infoPanel = new GridPanel();
+//        infoPanel.add(urlLabel);
+//        infoPanel.add(this.urlTextField);
+        infoPanel.add(userLabel);
+        infoPanel.add(this.usernameTextField);
+        infoPanel.add(passLabel);
+        infoPanel.add(this.passwordTextField);
+        infoPanel.add(confirmPassLabel);
+        infoPanel.add(this.confirmPasswordTextField);
+
+//        infoPanel.layout(4, 2, GridPanel.WEIGHT_NONE, 1);
+        infoPanel.layout(3, 2, GridPanel.WEIGHT_NONE, 1);
+
+//        urlTextField.getSwingComponent().addActionListener(new ActionListener() {
+//            public void actionPerformed(ActionEvent event) {
+//                updateURL();
+//                updateStatus();
+//            }
+//
+//        });
+
+        usernameTextField.getSwingComponent().addActionListener(new ActionListener() {
+            public void actionPerformed(ActionEvent event) {
+                updateUsername();
+                updateStatus();
+            }
+
+        });
+
+        passwordTextField.addActionListener(new ActionListener() {
+            public void actionPerformed(ActionEvent event) {
+                updatePassword();
+                updateStatus();
+            }
+        });
+
+        confirmPasswordTextField.addActionListener(new ActionListener() {
+            public void actionPerformed(ActionEvent event) {
+                updatePassword();
+                updateStatus();
+            }
+        });
+
+        okButton = new JButton("OK");
+        okButton.addActionListener(new ActionListener() {
+            public void actionPerformed(ActionEvent e) {
+                ok();
+            }
+        });
+
+        JButton cancelButton = new JButton("Cancel");
+        cancelButton.addActionListener(new ActionListener() {
+            public void actionPerformed(ActionEvent e) {
+                hide();
+            }
+        });
+
+        JPanel buttonPanel = new JPanel();
+        buttonPanel.add(okButton);
+        buttonPanel.add(cancelButton);
+
+        this.dialog = new XBayaDialog(this.engine.getGUI(), "Registry New User", infoPanel, buttonPanel);
+        this.dialog.setDefaultButton(okButton);
+        updateControlData();
+    }
+
+    public String getUsername() {
+        return username;
+    }
+
+    public void setUsername(String username) {
+        this.username = username;
+    }
+
+    public void updateControlData() {
+        if (usernameTextField != null && getUsername() != null) {
+            usernameTextField.setText(getUsername());
+        }
+//        if (urlTextField != null && getUrl() != null) {
+//            urlTextField.setText(getUrl().toString());
+//        }
+    }
+
+    public URL getUrl() {
+        return url;
+    }
+
+    public void setUrl(URL url) {
+        this.url = url;
+    }
+
+    public String getPassword() {
+        return password;
+    }
+
+    public void setPassword(String password) {
+        this.password = password;
+    }
+
+//    private void updateURL() {
+//        URL specifiedURL = null;
+//        try {
+//            specifiedURL = new URL(urlTextField.getText());
+//        } catch (MalformedURLException e) {
+//            // erroneious url, ignore it
+//        }
+//        setUrl(specifiedURL);
+//    }
+
+    private void updateUsername() {
+        setUsername(usernameTextField.getText());
+    }
+
+    private void updatePassword() {
+        String password = null;
+        String ptext = new String(passwordTextField.getPassword());
+        String ctext = new String(confirmPasswordTextField.getPassword());
+        if (ptext.equals(ctext)) {
+            password = ptext;
+        }
+        setPassword(password);
+    }
+
+    public boolean isUserCreated() {
+        return userCreated;
+    }
+
+    public void setUserCreated(boolean userCreated) {
+        this.userCreated = userCreated;
+    }
+
+    public String getGatewayName() {
+        return gatewayName;
+    }
+
+    public void setGatewayName(String gatewayName) {
+        this.gatewayName = gatewayName;
+    }
+
+    public void close() {
+        hide();
+    }
+
+
+}

http://git-wip-us.apache.org/repos/asf/airavata/blob/9c47eec8/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/dialogs/registry/RegistryWindow.java
----------------------------------------------------------------------
diff --git a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/dialogs/registry/RegistryWindow.java b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/dialogs/registry/RegistryWindow.java
new file mode 100644
index 0000000..e1c9f80
--- /dev/null
+++ b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/dialogs/registry/RegistryWindow.java
@@ -0,0 +1,313 @@
+/*
+ *
+ * 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.registry;
+
+import java.awt.event.ActionEvent;
+import java.net.MalformedURLException;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.net.URL;
+
+import javax.swing.AbstractAction;
+import javax.swing.BorderFactory;
+import javax.swing.JButton;
+import javax.swing.JLabel;
+import javax.swing.JPasswordField;
+
+import org.apache.airavata.client.AiravataAPIFactory;
+import org.apache.airavata.client.api.AiravataAPI;
+import org.apache.airavata.client.api.exception.AiravataAPIInvocationException;
+import org.apache.airavata.common.exception.ApplicationSettingsException;
+import org.apache.airavata.common.utils.ClientSettings;
+import org.apache.airavata.xbaya.XBayaConfiguration;
+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.registry.PasswordCallbackImpl;
+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.XBayaLinkButton;
+import org.apache.airavata.xbaya.ui.widgets.XBayaTextField;
+import org.apache.airavata.xbaya.util.RegistryConstants;
+
+public class RegistryWindow {
+
+    private XBayaEngine engine;
+
+    private XBayaDialog dialog;
+
+    private XBayaTextField urlTextField;
+
+    private XBayaTextField gatewayTextField;
+
+    private XBayaTextField usernameTextField;
+
+    private JPasswordField passwordTextField;
+
+    private XBayaLinkButton newUserButton;
+
+    private NewRegistryUserDialog newUserWindow;
+
+    private String userName;
+
+    private String password;
+
+    private String regURL;
+
+    private String gateway;
+
+    private static String previousRegURL;
+
+    /**
+     * @param engine
+     */
+    public RegistryWindow(XBayaEngine engine) {
+        this.engine = engine;
+        ComponentRegistryLoader.getLoader(this.engine, RegistryConstants.REGISTRY_TYPE_JCR);
+        initGUI();
+    }
+
+    /**
+     * Displays the dialog.
+     */
+    public void show() {
+        this.dialog.show();
+    }
+
+    private void hide() {
+        this.dialog.hide();
+    }
+
+    private void ok() {
+        setRegURL(this.urlTextField.getText());
+        setPreviousRegURL(this.urlTextField.getText());
+        setUserName(this.usernameTextField.getText());
+        setPassword(new String(this.passwordTextField.getPassword()));
+        setGateway(this.gatewayTextField.getText());
+
+        if (getRegURL().length() == 0) {
+            this.engine.getGUI().getErrorWindow().error(ErrorMessages.URL_EMPTY);
+            return;
+        }
+        URI url;
+        try {
+            url = new URI(regURL);
+        } catch (URISyntaxException e) {
+            this.engine.getGUI().getErrorWindow().error(ErrorMessages.URL_WRONG, e);
+            return;
+        }
+
+        AiravataAPI airavataAPI = getAiravataAPI();
+
+//        JCRComponentRegistry registry = null;
+//        try {
+//            registry = new JCRComponentRegistry(airavataAPI);
+//        } catch (Exception e) {
+//            this.engine.getGUI().getErrorWindow().error(e.getMessage());
+//            return;
+//        }
+        XBayaConfiguration configuration = this.engine.getConfiguration();
+        this.engine.setAiravataAPI(airavataAPI);
+        configuration.setAiravataAPI(airavataAPI);
+        configuration.setRegigstryUserName(userName);
+        configuration.setRegistryPassphrase(password);
+        configuration.setRegistryURL(url);
+        configuration.setDefaultGateway(gateway);
+        engine.updateXBayaConfigurationServiceURLs();
+        hide();
+
+//        this.loader.load(registry);
+    }
+
+    private void createNewUser() {
+        URL specifiedURL = null;
+        try {
+            specifiedURL = new URL(urlTextField.getText());
+        } catch (MalformedURLException e1) {
+            // the text box contains invalid url, we'll just ignore it
+        }
+        if (newUserWindow == null) {
+            newUserWindow = new NewRegistryUserDialog(engine);
+        }
+//        newUserWindow.setUrl(specifiedURL);
+        newUserWindow.setUsername(usernameTextField.getText());
+        newUserWindow.updateControlData();
+        newUserWindow.show();
+        if (newUserWindow.isUserCreated()) {
+//            urlTextField.setText(newUserWindow.getUrl().toString());
+            usernameTextField.setText(newUserWindow.getUsername());
+            passwordTextField.setText(newUserWindow.getPassword());
+        }
+    }
+
+    /**
+     * Initializes the GUI.
+     */
+    private void initGUI() {
+        this.urlTextField = new XBayaTextField();
+        this.gatewayTextField = new XBayaTextField();
+        this.usernameTextField = new XBayaTextField();
+        this.passwordTextField = new JPasswordField();
+        try {
+            if (getPreviousRegURL() != null){
+                this.urlTextField.setText(engine.getConfiguration().getRegistryURL().toASCIIString());
+            } else if (engine.getConfiguration().isRegURLSetByCMD()){
+                this.urlTextField.setText(engine.getConfiguration().getRegistryURL().toASCIIString());
+            } else if (ClientSettings.isSettingDefined(XBayaConstants.XBAYA_REGISTRY_URL)){
+                this.urlTextField.setText(ClientSettings.getSetting(XBayaConstants.XBAYA_REGISTRY_URL));
+            }  else {
+                this.urlTextField.setText(engine.getConfiguration().getRegistryURL().toASCIIString());
+            }
+            if (ClientSettings.isSettingDefined(XBayaConstants.XBAYA_REGISTRY_USER)){
+                this.usernameTextField.setText(ClientSettings.getSetting(XBayaConstants.XBAYA_REGISTRY_USER));
+            } else {
+                this.usernameTextField.setText(engine.getConfiguration().getRegistryUserName());
+            }
+            if (ClientSettings.isSettingDefined(XBayaConstants.XBAYA_DEFAULT_GATEWAY)){
+                this.gatewayTextField.setText(ClientSettings.getSetting(XBayaConstants.XBAYA_DEFAULT_GATEWAY));
+            } else {
+                this.gatewayTextField.setText(engine.getConfiguration().getDefaultGateway());
+            }
+        } catch (ApplicationSettingsException e) {
+            e.printStackTrace();
+        }
+
+        try {
+            ClientSettings.initializeTrustStore();
+        } catch (ApplicationSettingsException e) {
+            throw new RuntimeException("An error occurred while initializing client configurations");
+        }
+
+        this.passwordTextField.setText(engine.getConfiguration().getRegistryPassphrase());
+        XBayaLabel urlLabel = new XBayaLabel("Registry URL", this.urlTextField);
+        XBayaLabel gatewayLabel = new XBayaLabel("Gateway", this.gatewayTextField);
+        XBayaLabel nameLabel = new XBayaLabel("Username", this.usernameTextField);
+        XBayaLabel passLabel = new XBayaLabel("Password", this.usernameTextField);
+        this.newUserButton = new XBayaLinkButton("Create new user...");
+        newUserButton.setHorizontalAlignment(XBayaLinkButton.RIGHT);
+        JLabel emptyLabel = new JLabel("");
+
+        newUserButton.addActionListener(new AbstractAction() {
+            public void actionPerformed(ActionEvent e) {
+                createNewUser();
+            }
+        });
+
+        GridPanel infoPanel = new GridPanel();
+        infoPanel.add(urlLabel);
+        infoPanel.add(this.urlTextField);
+        infoPanel.add(gatewayLabel);
+        infoPanel.add(this.gatewayTextField);
+        infoPanel.add(nameLabel);
+        infoPanel.add(this.usernameTextField);
+        infoPanel.add(passLabel);
+        infoPanel.add(this.passwordTextField);
+        infoPanel.add(emptyLabel);
+        infoPanel.add(this.newUserButton);
+        infoPanel.layout(5, 2, GridPanel.WEIGHT_NONE, 1);
+//        infoPanel.layout(2, 2, GridPanel.WEIGHT_NONE, 1);
+
+        infoPanel.getSwingComponent().setBorder(BorderFactory.createEtchedBorder());
+
+        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();
+            }
+        });
+
+        GridPanel buttonPanel = new GridPanel();
+        buttonPanel.add(okButton);
+        buttonPanel.add(cancelButton);
+        buttonPanel.getSwingComponent().setBorder(BorderFactory.createEtchedBorder());
+
+        this.dialog = new XBayaDialog(this.engine.getGUI(), "Configure Airavata Registry", infoPanel, buttonPanel);
+        this.dialog.setDefaultButton(okButton);
+    }
+
+    public AiravataAPI getAiravataAPI(){
+        try {
+            URI regURI = new URI(getRegURL());
+            PasswordCallbackImpl passwordCallback = new PasswordCallbackImpl(userName, password);
+            AiravataAPI airavataAPI = AiravataAPIFactory.getAPI(regURI, getGateway(), userName, passwordCallback);
+            return airavataAPI;
+        } catch (URISyntaxException e) {
+            e.printStackTrace();
+        }catch (AiravataAPIInvocationException e) {
+            e.printStackTrace();
+            engine.getGUI().getErrorWindow().error("Some error has occurred while initialize. Please check whether you " +
+                    "entered correct credentials...", e);
+
+        }
+        return null;
+
+    }
+
+    public String getUserName() {
+        return userName;
+    }
+
+    public String getPassword() {
+        return password;
+    }
+
+    public String getRegURL() {
+        return regURL;
+    }
+
+    public void setRegURL(String regURL) {
+        this.regURL = regURL;
+    }
+
+    public void setUserName(String userName) {
+        this.userName = userName;
+    }
+
+    public void setPassword(String password) {
+        this.password = password;
+    }
+
+    public String getGateway() {
+        return gateway;
+    }
+
+    public void setGateway(String gateway) {
+        this.gateway = gateway;
+    }
+
+    public static String getPreviousRegURL() {
+        return previousRegURL;
+    }
+
+    public static void setPreviousRegURL(String previousRegURL) {
+        RegistryWindow.previousRegURL = previousRegURL;
+    }
+}
\ 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/registry/browser/JCRBrowserDialog.java
----------------------------------------------------------------------
diff --git a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/dialogs/registry/browser/JCRBrowserDialog.java b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/dialogs/registry/browser/JCRBrowserDialog.java
new file mode 100644
index 0000000..2268c03
--- /dev/null
+++ b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/dialogs/registry/browser/JCRBrowserDialog.java
@@ -0,0 +1,117 @@
+/*
+ *
+ * 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.registry.browser;
+
+import java.awt.BorderLayout;
+import java.awt.FlowLayout;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+
+import javax.swing.JButton;
+import javax.swing.JDialog;
+import javax.swing.JPanel;
+
+import org.apache.airavata.xbaya.XBayaEngine;
+import org.apache.airavata.xbaya.ui.views.JCRBrowserPanel;
+
+public class JCRBrowserDialog extends JDialog {
+
+    /**
+	 * 
+	 */
+    private static final long serialVersionUID = 2866874255829295553L;
+    private JPanel contentPanel = new JPanel();
+    private XBayaEngine engine;
+
+    /**
+     * Launch the application.
+     */
+    public static void main(String[] args) {
+        try {
+            JCRBrowserDialog dialog = new JCRBrowserDialog(null);
+            dialog.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
+            dialog.setVisible(true);
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
+
+    /**
+     * Create the dialog.
+     */
+    public JCRBrowserDialog(XBayaEngine engine) {
+        setEngine(engine);
+        initGUI();
+    }
+
+    private void initGUI() {
+        setModal(true);
+        setLocationRelativeTo(null);
+        setBounds(100, 100, 450, 300);
+        getContentPane().setLayout(new BorderLayout());
+        contentPanel = new JCRBrowserPanel(getEngine());
+        getContentPane().add(contentPanel, BorderLayout.CENTER);
+        // contentPanel.setLayout(new BorderLayout(0, 0));
+        // {
+        // JScrollPane scrollPane = new JScrollPane();
+        // contentPanel.add(scrollPane, BorderLayout.CENTER);
+        // {
+        // JTree tree = new JTree(AiravataTreeNodeFactory.getTreeNode(getJCRRegistry(),null));
+        // tree.setCellRenderer(new RegistryTreeCellRenderer());
+        // scrollPane.setViewportView(tree);
+        // }
+        // }
+        {
+            JPanel buttonPane = new JPanel();
+            buttonPane.setLayout(new FlowLayout(FlowLayout.RIGHT));
+            getContentPane().add(buttonPane, BorderLayout.SOUTH);
+            {
+                JButton okButton = new JButton("Close");
+                okButton.addActionListener(new ActionListener() {
+                    public void actionPerformed(ActionEvent e) {
+                        close();
+                    }
+                });
+                okButton.setActionCommand("OK");
+                buttonPane.add(okButton);
+                getRootPane().setDefaultButton(okButton);
+            }
+        }
+    }
+
+    public void close() {
+        setVisible(false);
+    }
+
+    public void open() {
+        setVisible(true);
+    }
+
+    public XBayaEngine getEngine() {
+        return engine;
+    }
+
+    public void setEngine(XBayaEngine engine) {
+        this.engine = engine;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/airavata/blob/9c47eec8/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/dialogs/workflow/ParameterPropertyWindow.java
----------------------------------------------------------------------
diff --git a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/dialogs/workflow/ParameterPropertyWindow.java b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/dialogs/workflow/ParameterPropertyWindow.java
new file mode 100644
index 0000000..4be2ed8
--- /dev/null
+++ b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/dialogs/workflow/ParameterPropertyWindow.java
@@ -0,0 +1,170 @@
+/*
+ *
+ * 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.workflow;
+
+import java.awt.GridLayout;
+import java.awt.event.ActionEvent;
+import java.util.Collections;
+import java.util.List;
+
+import javax.swing.AbstractAction;
+import javax.swing.JButton;
+import javax.swing.JPanel;
+
+import org.apache.airavata.common.utils.XMLUtil;
+import org.apache.airavata.workflow.model.graph.Node;
+import org.apache.airavata.workflow.model.graph.system.InputNode;
+import org.apache.airavata.workflow.model.graph.system.OutputNode;
+import org.apache.airavata.workflow.model.graph.util.GraphUtil;
+import org.apache.airavata.workflow.model.graph.ws.WSGraph;
+import org.apache.airavata.xbaya.XBayaEngine;
+import org.apache.airavata.xbaya.ui.dialogs.XBayaDialog;
+import org.apache.airavata.xbaya.ui.views.ParameterPropertyPanel;
+import org.xmlpull.infoset.XmlElement;
+
+public class ParameterPropertyWindow {
+
+    private XBayaEngine engine;
+
+    protected XBayaDialog dialog;
+
+    private ParameterPropertyPanel inputPanel;
+
+    private ParameterPropertyPanel outputPanel;
+
+    private JButton okButton;
+
+    private WSGraph graph;
+
+    private List<? extends Node> nodes;
+
+    private List<InputNode> inputNodes;
+
+    private List<OutputNode> outputNodes;
+
+    /**
+     * @param engine
+     */
+    public ParameterPropertyWindow(XBayaEngine engine) {
+        this.engine = engine;
+        initGui();
+    }
+
+    /**
+     * Shows the dialog.
+     */
+    public void show() {
+        this.graph = this.engine.getGUI().getWorkflow().getGraph();
+        this.nodes = this.graph.getNodes();
+        this.inputNodes = GraphUtil.getInputNodes(this.graph);
+        this.outputNodes = GraphUtil.getOutputNodes(this.graph);
+
+        this.inputPanel.setParameterNodes(this.inputNodes);
+        this.inputPanel.setMetadata(this.graph.getInputMetadata());
+        this.outputPanel.setParameterNodes(this.outputNodes);
+        this.outputPanel.setMetadata(this.graph.getOutputMetadata());
+
+        this.dialog.show();
+    }
+
+    private void hide() {
+        this.dialog.hide();
+    }
+
+    private void ok() {
+        String inputMetadataText = this.inputPanel.getMetadata();
+        XmlElement inputMetadata;
+        if (inputMetadataText.length() == 0) {
+            inputMetadata = null;
+        } else {
+            try {
+                inputMetadata = XMLUtil.stringToXmlElement(inputMetadataText);
+            } catch (RuntimeException e) {
+                String warning = "The input metadata is ill-formed.";
+                this.engine.getGUI().getErrorWindow().error(warning, e);
+                return;
+            }
+        }
+
+        String outputMetadataText = this.outputPanel.getMetadata();
+        XmlElement outputMetadata;
+        if (outputMetadataText.length() == 0) {
+            outputMetadata = null;
+        } else {
+            try {
+                outputMetadata = XMLUtil.stringToXmlElement(outputMetadataText);
+            } catch (RuntimeException e) {
+                String warning = "The output metadata is ill-formed.";
+                this.engine.getGUI().getErrorWindow().error(warning, e);
+                return;
+            }
+        }
+
+        // Check is done at this point.
+
+        this.graph.setInputMetadata(inputMetadata);
+        this.graph.setOutputMetadata(outputMetadata);
+
+        // Sort the nodes in the graph in the order of sorted inputs, sorted
+        // outputs, and the rest.
+        for (int i = 0; i < this.inputNodes.size(); i++) {
+            InputNode inputNode = this.inputNodes.get(i);
+            Collections.swap(this.nodes, i, this.nodes.indexOf(inputNode));
+        }
+        for (int i = 0; i < this.outputNodes.size(); i++) {
+            OutputNode outputNode = this.outputNodes.get(i);
+            Collections.swap(this.nodes, this.inputNodes.size() + i, this.nodes.indexOf(outputNode));
+        }
+        hide();
+    }
+
+    private void initGui() {
+        this.inputPanel = new ParameterPropertyPanel("Inputs");
+        this.outputPanel = new ParameterPropertyPanel("Outputs");
+
+        JPanel mainPanel = new JPanel();
+        mainPanel.setLayout(new GridLayout(1, 2)); // To have the same size.
+        mainPanel.add(this.inputPanel.getSwingComponent());
+        mainPanel.add(this.outputPanel.getSwingComponent());
+
+        JPanel buttonPanel = new JPanel();
+        this.okButton = new JButton("OK");
+        this.okButton.setDefaultCapable(true);
+        this.okButton.addActionListener(new AbstractAction() {
+            public void actionPerformed(ActionEvent e) {
+                ok();
+            }
+        });
+        buttonPanel.add(this.okButton);
+
+        JButton cancelButton = new JButton("Cancel");
+        cancelButton.addActionListener(new AbstractAction() {
+            public void actionPerformed(ActionEvent e) {
+                hide();
+            }
+        });
+        buttonPanel.add(cancelButton);
+
+        this.dialog = new XBayaDialog(this.engine.getGUI(), "Workflow Paremeter Properties", mainPanel, buttonPanel);
+        this.dialog.setDefaultButton(this.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/workflow/WorkflowPropertyWindow.java
----------------------------------------------------------------------
diff --git a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/dialogs/workflow/WorkflowPropertyWindow.java b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/dialogs/workflow/WorkflowPropertyWindow.java
new file mode 100644
index 0000000..9043d76
--- /dev/null
+++ b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/dialogs/workflow/WorkflowPropertyWindow.java
@@ -0,0 +1,216 @@
+/*
+ *
+ * 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.workflow;
+
+import java.awt.event.ActionEvent;
+import java.net.URI;
+import java.util.List;
+
+import javax.swing.AbstractAction;
+import javax.swing.JButton;
+import javax.swing.JOptionPane;
+import javax.swing.JPanel;
+
+import org.apache.airavata.common.utils.StringUtil;
+import org.apache.airavata.common.utils.WSConstants;
+import org.apache.airavata.common.utils.XMLUtil;
+import org.apache.airavata.workflow.model.wf.Workflow;
+import org.apache.airavata.xbaya.ui.XBayaGUI;
+import org.apache.airavata.xbaya.ui.dialogs.XBayaDialog;
+import org.apache.airavata.xbaya.ui.graph.GraphCanvas;
+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.XBayaTextField;
+import org.xmlpull.infoset.XmlElement;
+
+public class WorkflowPropertyWindow {
+
+    private XBayaGUI xbayaGUI;
+
+    private XBayaDialog dialog;
+
+    private JButton okButton;
+
+    private Workflow workflow;
+
+    private XBayaTextField nameTextField;
+
+    private XBayaTextField templateIDField;
+
+    private XBayaTextField instanceIDField;
+
+    private XBayaTextArea descriptionTextArea;
+
+    private XBayaTextArea metadataTextArea;
+
+    
+    /**
+     * @param engine
+     */
+    public WorkflowPropertyWindow(XBayaGUI xbayaGUI) {
+        this.xbayaGUI = xbayaGUI;
+        initGui();
+    }
+
+    /**
+     * Shows the dialog.
+     */
+    public void show() {
+        this.workflow = this.xbayaGUI.getWorkflow();
+
+        String name = this.workflow.getName();
+        this.nameTextField.setText(name);
+
+        String description = this.workflow.getDescription();
+        this.descriptionTextArea.setText(description);
+
+        URI templateID = this.workflow.getUniqueWorkflowName();
+        if (templateID == null) {
+            this.templateIDField.setText("");
+        } else {
+            this.templateIDField.setText(templateID.toString());
+        }
+
+        URI instanceID = this.workflow.getGPELInstanceID();
+        if (instanceID == null) {
+            this.instanceIDField.setText("");
+        } else {
+            this.instanceIDField.setText(instanceID.toString());
+        }
+
+        XmlElement metadata = this.workflow.getMetadata();
+        String metadataText;
+        if (metadata == null) {
+            metadataText = WSConstants.EMPTY_APPINFO;
+        } else {
+            metadataText = XMLUtil.xmlElementToString(metadata);
+        }
+        this.metadataTextArea.setText(metadataText);
+
+        this.dialog.show();
+    }
+
+    /**
+     * Hides the dialog.
+     */
+    private void hide() {
+        this.dialog.hide();
+    }
+
+    private boolean isWorkflowNameAlreadyPresent(String name){
+    	List<GraphCanvas> graphCanvases = xbayaGUI.getGraphCanvases();
+    	for (GraphCanvas graphCanvas : graphCanvases) {
+    		if (graphCanvas!=xbayaGUI.getGraphCanvas()){
+				String existingName = graphCanvas.getWorkflow().getGraph().getName();
+				if (name.equals(existingName)){
+					return true;
+				}
+    		}
+		}
+    	return false;
+    }
+    
+    private void setToWorkflow() {
+        String name = this.nameTextField.getText();
+        if (name != null && name.equals(StringUtil.convertToJavaIdentifier(name)) && (!isWorkflowNameAlreadyPresent(name))) {
+            String description = this.descriptionTextArea.getText();
+            String metadataText = this.metadataTextArea.getText();
+
+            XmlElement metadata;
+            if (metadataText.length() == 0) {
+                metadata = null;
+            } else {
+                try {
+                    metadata = XMLUtil.stringToXmlElement(metadataText);
+                } catch (RuntimeException e) {
+                    String warning = "The metadata is ill-formed.";
+                    this.xbayaGUI.getErrorWindow().error(warning, e);
+                    return;
+                }
+            }
+
+            GraphCanvas graphCanvas = this.xbayaGUI.getGraphCanvas();
+            graphCanvas.setNameAndDescription(name, description);
+            graphCanvas.getWorkflow().setMetadata(metadata);
+            hide();
+        } else {
+            this.nameTextField.setText(StringUtil.convertToJavaIdentifier(name));
+            JOptionPane.showMessageDialog(this.xbayaGUI.getFrame(),
+                    "Invalid Name or a Workflow under the same name already exists. Please consider the Name suggsted", "Invalid Name", JOptionPane.OK_OPTION);
+        }
+    }
+
+    private void initGui() {
+        this.nameTextField = new XBayaTextField();
+        XBayaLabel nameLabel = new XBayaLabel("Name", this.nameTextField);
+
+        this.templateIDField = new XBayaTextField();
+        this.templateIDField.setEditable(false);
+        XBayaLabel templateIDLabel = new XBayaLabel("Template ID", this.templateIDField);
+
+        this.instanceIDField = new XBayaTextField();
+        this.instanceIDField.setEditable(false);
+        XBayaLabel instanceIDLabel = new XBayaLabel("Instance ID", this.instanceIDField);
+
+        this.descriptionTextArea = new XBayaTextArea();
+        XBayaLabel descriptionLabel = new XBayaLabel("Description", this.descriptionTextArea);
+
+        this.metadataTextArea = new XBayaTextArea();
+        XBayaLabel metadataLabel = new XBayaLabel("Metadata", this.metadataTextArea);
+
+        GridPanel mainPanel = new GridPanel();
+        mainPanel.add(nameLabel);
+        mainPanel.add(this.nameTextField);
+        mainPanel.add(templateIDLabel);
+        mainPanel.add(this.templateIDField);
+        mainPanel.add(instanceIDLabel);
+        mainPanel.add(this.instanceIDField);
+        mainPanel.add(descriptionLabel);
+        mainPanel.add(this.descriptionTextArea);
+        mainPanel.add(metadataLabel);
+        mainPanel.add(this.metadataTextArea);
+        mainPanel.layout(new double[] { 0, 0, 0, 0.5, 0.5 }, new double[] { 0, 1 });
+
+        this.okButton = new JButton("OK");
+        this.okButton.addActionListener(new AbstractAction() {
+            public void actionPerformed(ActionEvent e) {
+                setToWorkflow();
+
+            }
+        });
+
+        JButton cancelButton = new JButton("Cancel");
+        cancelButton.addActionListener(new AbstractAction() {
+            public void actionPerformed(ActionEvent e) {
+                hide();
+            }
+        });
+
+        JPanel buttonPanel = new JPanel();
+        buttonPanel.add(this.okButton);
+        buttonPanel.add(cancelButton);
+
+        this.dialog = new XBayaDialog(this.xbayaGUI, "Workflow Properties", mainPanel, buttonPanel);
+        this.dialog.setDefaultButton(this.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/experiment/ExperimentMenu.java
----------------------------------------------------------------------
diff --git a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/experiment/ExperimentMenu.java b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/experiment/ExperimentMenu.java
new file mode 100644
index 0000000..a33dd49
--- /dev/null
+++ b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/experiment/ExperimentMenu.java
@@ -0,0 +1,110 @@
+/*
+ *
+ * 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.experiment;
+
+import java.awt.event.ActionEvent;
+import java.awt.event.KeyEvent;
+
+import javax.swing.AbstractAction;
+import javax.swing.JMenu;
+import javax.swing.JMenuItem;
+
+import org.apache.airavata.client.api.exception.AiravataAPIInvocationException;
+import org.apache.airavata.registry.api.exception.RegistryException;
+import org.apache.airavata.workflow.model.exceptions.WorkflowRuntimeException;
+import org.apache.airavata.xbaya.XBayaEngine;
+import org.apache.airavata.xbaya.registry.RegistryAccesser;
+import org.apache.airavata.xbaya.util.XBayaUtil;
+
+public class ExperimentMenu {
+
+    private JMenu experimentMenu;
+
+    protected RegistryAccesser registryAccesser;
+
+    private JMenuItem configureRegistryItem;
+
+    private JMenuItem deleteWorkflowfromRegistryItem;
+
+    private XBayaEngine engine;
+
+    /**
+     * Constructs a FileMenu.
+     * 
+     * @param engine
+     * 
+     */
+    public ExperimentMenu(XBayaEngine engine) {
+        this.engine = engine;
+        this.registryAccesser = new RegistryAccesser(engine);
+
+        createExperimentMenu();
+    }
+
+    private void createExperimentMenu() {
+
+        createConfigureRegistryItem();
+        createDeleteWorkflowtoRegistryItem();
+
+        this.experimentMenu = new JMenu("Experiment");
+        this.experimentMenu.setMnemonic(KeyEvent.VK_F);
+
+        this.experimentMenu.add(this.configureRegistryItem);
+        this.experimentMenu.addSeparator();
+        this.experimentMenu.add(this.deleteWorkflowfromRegistryItem);
+        this.experimentMenu.addSeparator();
+        this.experimentMenu.addSeparator();
+    }
+
+    /**
+     * @return The Experiment menu.
+     */
+    public JMenu getMenu() {
+        return this.experimentMenu;
+    }
+
+    private void createConfigureRegistryItem() {
+        this.configureRegistryItem = new JMenuItem("Configure Registry");
+        configureRegistryItem.setMnemonic(KeyEvent.VK_C);
+        configureRegistryItem.addActionListener(new AbstractAction() {
+            public void actionPerformed(ActionEvent e) {
+                XBayaEngine xbayaEngine = ExperimentMenu.this.engine;
+                XBayaUtil.updateJCRRegistryInfo(xbayaEngine);
+            }
+        });
+    }
+
+    private void createDeleteWorkflowtoRegistryItem() {
+        this.deleteWorkflowfromRegistryItem = new JMenuItem("Delete Workflows in Registry");
+        this.deleteWorkflowfromRegistryItem.addActionListener(new AbstractAction() {
+            public void actionPerformed(ActionEvent e) {
+                try {
+                    ExperimentMenu.this.registryAccesser.deleteOGCEWorkflow(ExperimentMenu.this.engine.getGUI().getWorkflow()
+                            .getQname());
+                } catch (AiravataAPIInvocationException e1) {
+                    throw new WorkflowRuntimeException(e1);
+                }
+            }
+        });
+    }
+
+}
\ 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/experiment/RegistryLoaderWindow.java
----------------------------------------------------------------------
diff --git a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/experiment/RegistryLoaderWindow.java b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/experiment/RegistryLoaderWindow.java
new file mode 100644
index 0000000..5d266ce
--- /dev/null
+++ b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/experiment/RegistryLoaderWindow.java
@@ -0,0 +1,239 @@
+/*
+ *
+ * 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.experiment;
+
+import java.awt.event.ActionEvent;
+import java.awt.event.MouseAdapter;
+import java.awt.event.MouseEvent;
+import java.util.Map;
+import java.util.Set;
+import java.util.Vector;
+
+import javax.swing.AbstractAction;
+import javax.swing.JButton;
+import javax.swing.JPanel;
+import javax.swing.SwingUtilities;
+import javax.swing.border.EtchedBorder;
+import javax.swing.border.TitledBorder;
+
+import org.apache.airavata.client.api.exception.AiravataAPIInvocationException;
+import org.apache.airavata.registry.api.exception.RegistryException;
+import org.apache.airavata.workflow.model.component.ComponentException;
+import org.apache.airavata.workflow.model.graph.GraphException;
+import org.apache.airavata.workflow.model.wf.Workflow;
+import org.apache.airavata.xbaya.XBayaEngine;
+import org.apache.airavata.xbaya.registry.RegistryAccesser;
+import org.apache.airavata.xbaya.ui.dialogs.XBayaDialog;
+import org.apache.airavata.xbaya.ui.graph.GraphCanvas;
+import org.apache.airavata.xbaya.ui.utils.ErrorMessages;
+import org.apache.airavata.xbaya.ui.widgets.GridPanel;
+import org.apache.airavata.xbaya.ui.widgets.XbayaEnhancedList;
+import org.apache.airavata.xbaya.util.XBayaUtil;
+
+public class RegistryLoaderWindow {
+
+    private XBayaEngine engine;
+
+    private XBayaDialog dialog;
+
+    private JButton okButton;
+
+    private JButton deleteButton;
+
+    private XbayaEnhancedList<RegistrySearchResult> list;
+
+    /**
+     * Constructs a RegistryLoaderWindow.
+     * 
+     * @param engine
+     */
+    public RegistryLoaderWindow(XBayaEngine engine) {
+        this.engine = engine;
+        if (XBayaUtil.acquireJCRRegistry(this.engine)) {
+            initGUI();
+        }
+    }
+
+    /**
+     * Shows the window.
+     */
+    public void show() {
+
+        /*
+         * this.list.getList().setListData( new String[]{ "Loading the workflow list from the Registry.",
+         * "Please wait for a moment."});
+         */
+        this.list.setEnabled(false);
+        this.okButton.setEnabled(false);
+        this.deleteButton.setEnabled(false);
+
+        new Thread() {
+            @Override
+            public void run() {
+                try {
+                    RegistryAccesser registryAccesser = new RegistryAccesser(RegistryLoaderWindow.this.engine);
+
+                    final Map<String, String> resultList = registryAccesser.getOGCEWorkflowTemplateList();
+                    final Set<String> keys = resultList.keySet();
+
+                    SwingUtilities.invokeLater(new Runnable() {
+                        public void run() {
+                            if (resultList == null || resultList.size() == 0) {
+                                /*
+                                 * OGCEXRegistryLoaderWindow.this.list.getList(). setListData( new
+                                 * String[]{"No workflow"});
+                                 */
+                            } else {
+                                Vector<RegistrySearchResult> results = new Vector<RegistrySearchResult>();
+                                String val = null;
+                                for (String key : keys) {
+                                    val = resultList.get(key);
+                                    try {
+										results.add(new RegistrySearchResult(new Workflow(val)));
+									} catch (GraphException e) {
+										e.printStackTrace();
+									} catch (ComponentException e) {
+										e.printStackTrace();
+									}
+                                }
+                                RegistryLoaderWindow.this.list.setListData(results);
+                                RegistryLoaderWindow.this.list.setEnabled(true);
+                            }
+                        }
+                    });
+                } catch (RuntimeException e) {
+                    RegistryLoaderWindow.this.engine.getGUI().getErrorWindow().error(
+                            ErrorMessages.REGISTRY_WORKFLOW_LIST_LOAD_ERROR, e);
+                    hide();
+                } catch (Error e) {
+                    RegistryLoaderWindow.this.engine.getGUI().getErrorWindow().error(ErrorMessages.UNEXPECTED_ERROR, e);
+                    hide();
+                } catch (AiravataAPIInvocationException e) {
+                    RegistryLoaderWindow.this.engine.getGUI().getErrorWindow().error(ErrorMessages.UNEXPECTED_ERROR, e);
+                    hide();
+                }
+            }
+        }.start();
+
+        // This has to be the last because it blocks when the dialog is modal.
+        this.dialog.show();
+    }
+
+    /**
+     * Hides the window.
+     */
+    public void hide() {
+        this.dialog.hide();
+    }
+
+    private void ok() {
+        RegistrySearchResult result = this.list.getSelectedValue();
+        hide();
+
+        try {
+            Workflow workflow = new RegistryAccesser(this.engine).getWorkflow(result.getResourceName());
+            GraphCanvas newGraphCanvas = engine.getGUI().newGraphCanvas(true);
+            newGraphCanvas.setWorkflow(workflow);
+            //this.engine.setWorkflow(workflow);
+            engine.getGUI().getGraphCanvas().setWorkflowFile(null);
+//            RegistryLoaderWindow.this.engine.setWorkflow(workflow);
+        } catch (Exception e) {
+            RegistryLoaderWindow.this.engine.getGUI().getErrorWindow().error(e);
+        }
+    }
+
+    private void delete() {
+        RegistryAccesser registryAccesser = new RegistryAccesser(RegistryLoaderWindow.this.engine);
+        for (RegistrySearchResult i : this.list.getSelectedValues()) {
+            try {
+                registryAccesser.deleteOGCEWorkflow(i.getResourceId());
+            }  catch (AiravataAPIInvocationException e) {
+                e.printStackTrace();
+            }
+        }
+        this.list.removeSelectedRows();
+        hide();
+    }
+
+    /**
+     * Initializes the GUI
+     */
+    private void initGUI() {
+
+        this.list = new XbayaEnhancedList<RegistrySearchResult>();
+
+        this.list.addMouseListener(new MouseAdapter() {
+            @Override
+            public void mouseClicked(MouseEvent e) {
+                if (e.getClickCount() >= 2) {
+                    // double click is same as cliking the OK button.
+                    RegistryLoaderWindow.this.okButton.doClick();
+                }
+
+                if (RegistryLoaderWindow.this.list.getSelectedIndex() == -2) {
+                    RegistryLoaderWindow.this.okButton.setEnabled(false);
+                    RegistryLoaderWindow.this.deleteButton.setEnabled(true);
+                } else if (RegistryLoaderWindow.this.list.getSelectedIndex() != -1) {
+                    RegistryLoaderWindow.this.okButton.setEnabled(true);
+                    RegistryLoaderWindow.this.deleteButton.setEnabled(true);
+                } else {
+                    RegistryLoaderWindow.this.okButton.setEnabled(false);
+                    RegistryLoaderWindow.this.deleteButton.setEnabled(false);
+                }
+            }
+        });
+
+        GridPanel mainPanel = new GridPanel();
+        TitledBorder border = new TitledBorder(new EtchedBorder(), "Select a workflow to load");
+        mainPanel.getSwingComponent().setBorder(border);
+        mainPanel.add(this.list);
+        mainPanel.layout(1, 1, 0, 0);
+
+        JPanel buttonPanel = new JPanel();
+        this.okButton = new JButton("Load");
+        this.okButton.addActionListener(new AbstractAction() {
+            public void actionPerformed(ActionEvent e) {
+                ok();
+            }
+        });
+        buttonPanel.add(this.okButton);
+
+        this.deleteButton = new JButton("Delete");
+        this.deleteButton.addActionListener(new AbstractAction() {
+            public void actionPerformed(ActionEvent e) {
+                delete();
+            }
+        });
+        buttonPanel.add(this.deleteButton);
+
+        JButton cancelButton = new JButton("Cancel");
+        cancelButton.addActionListener(new AbstractAction() {
+            public void actionPerformed(ActionEvent e) {
+                hide();
+            }
+        });
+        buttonPanel.add(cancelButton);
+
+        this.dialog = new XBayaDialog(this.engine.getGUI(), "Load a Workflow from the Registry", mainPanel, buttonPanel);
+        this.dialog.setDefaultButton(this.okButton);
+    }
+}


Mime
View raw message