airavata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From samin...@apache.org
Subject [64/90] [abbrv] AIRAVATA-1124
Date Mon, 14 Apr 2014 18:31:06 GMT
http://git-wip-us.apache.org/repos/asf/airavata/blob/9c47eec8/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/dialogs/descriptors/DescriptorEditorDialog.java
----------------------------------------------------------------------
diff --git a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/dialogs/descriptors/DescriptorEditorDialog.java b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/dialogs/descriptors/DescriptorEditorDialog.java
new file mode 100644
index 0000000..340ab65
--- /dev/null
+++ b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/dialogs/descriptors/DescriptorEditorDialog.java
@@ -0,0 +1,424 @@
+/*
+ *
+ * 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.Component;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.awt.event.MouseAdapter;
+import java.awt.event.MouseEvent;
+import java.awt.event.WindowAdapter;
+import java.awt.event.WindowEvent;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Map;
+
+import javax.swing.AbstractButton;
+import javax.swing.BorderFactory;
+import javax.swing.DefaultListCellRenderer;
+import javax.swing.DefaultListModel;
+import javax.swing.JButton;
+import javax.swing.JDialog;
+import javax.swing.JLabel;
+import javax.swing.JList;
+import javax.swing.JOptionPane;
+import javax.swing.JScrollPane;
+import javax.swing.event.ListSelectionEvent;
+import javax.swing.event.ListSelectionListener;
+
+import org.apache.airavata.client.api.AiravataAPI;
+import org.apache.airavata.client.api.exception.AiravataAPIInvocationException;
+import org.apache.airavata.common.utils.SwingUtil;
+import org.apache.airavata.commons.gfac.type.ApplicationDescription;
+import org.apache.airavata.commons.gfac.type.HostDescription;
+import org.apache.airavata.commons.gfac.type.ServiceDescription;
+import org.apache.airavata.xbaya.XBayaEngine;
+import org.apache.airavata.xbaya.component.registry.ComponentRegistryLoader;
+import org.apache.airavata.xbaya.registrybrowser.nodes.JCRBrowserIcons;
+import org.apache.airavata.xbaya.ui.dialogs.XBayaDialog;
+import org.apache.airavata.xbaya.ui.widgets.GridPanel;
+import org.apache.airavata.xbaya.util.RegistryConstants;
+//import org.apache.airavata.registry.api.AiravataRegistry2;
+
+public class DescriptorEditorDialog extends JDialog {
+
+	private static final long serialVersionUID = 478151437279682576L;
+
+	private XBayaEngine engine;
+
+    private XBayaDialog dialog;
+
+    private AiravataAPI registry;
+
+	private JList descriptorList;
+
+	private Map<ApplicationDescription,String> dlist;
+
+	private JButton editButton;
+
+	private AbstractButton removeButton;
+	
+	private boolean descriptorChanged=false;
+	
+	public enum DescriptorType{
+		HOST,
+		SERVICE,
+		APPLICATION
+	};
+
+	public DescriptorType descriptorType;
+	
+    /**
+     * @param engine XBaya workflow engine
+     */
+    public DescriptorEditorDialog(XBayaEngine engine, DescriptorType descriptorType) {
+        this.engine = engine;
+        this.descriptorType=descriptorType;
+        setRegistry(engine.getConfiguration().getAiravataAPI());
+        initGUI();
+    }
+
+    /**
+     * Displays the dialog.
+     */
+    public void show() {
+        this.dialog.show();
+    }
+
+    public void hide() {
+        this.dialog.hide();
+    }
+
+    /**
+     * Initializes the GUI.
+     */
+    private void initGUI() {
+    	descriptorList= new JList(new DefaultListModel());
+    	descriptorList.setCellRenderer(new DescriptorListCellRenderer(descriptorType));
+    	JScrollPane pane = new JScrollPane(descriptorList);
+    	
+    	descriptorList.addMouseListener(new MouseAdapter(){
+    		@Override
+    		public void mouseClicked(MouseEvent e) {
+    			if (e.getClickCount()==2){
+    				try {
+						editDescriptor();
+    				} catch (AiravataAPIInvocationException e1) {
+    					engine.getGUI().getErrorWindow().error("Error while editing descriptor", e1);
+    					e1.printStackTrace();
+    				}
+				}
+    		}
+    	});
+    	GridPanel infoPanel=new GridPanel();
+        infoPanel.add(pane);
+        infoPanel.getSwingComponent().setBorder(BorderFactory.createEtchedBorder());
+        SwingUtil.layoutToGrid(infoPanel.getSwingComponent(), 1, 1, 0, 0);
+
+        JButton newButton = new JButton("New...");
+        newButton.addActionListener(new ActionListener() {
+            public void actionPerformed(ActionEvent e) {
+            	try {
+					newDescriptor();
+        		} catch (AiravataAPIInvocationException e1) {
+        			engine.getGUI().getErrorWindow().error("Error while creating descriptors", e1);
+        			e1.printStackTrace();
+        		}
+            }
+        });
+        descriptorList.addListSelectionListener(new ListSelectionListener(){
+			public void valueChanged(ListSelectionEvent e) {
+				boolean isSelected=descriptorList.getSelectedIndex()!=-1;
+				editButton.setEnabled(isSelected);
+				removeButton.setEnabled(isSelected);
+			}
+        	
+        });
+        editButton = new JButton("Edit...");
+        editButton.addActionListener(new ActionListener() {
+            public void actionPerformed(ActionEvent e) {
+            	try {
+					editDescriptor();
+        		} catch (AiravataAPIInvocationException e1) {
+        			engine.getGUI().getErrorWindow().error("Error while editing descriptor", e1);
+        			e1.printStackTrace();
+        		}
+            }
+
+        });
+        removeButton = new JButton("Remove");
+        removeButton.addActionListener(new ActionListener() {
+            public void actionPerformed(ActionEvent e) {
+            	try {
+					deleteDescriptor();
+        		} catch (AiravataAPIInvocationException e1) {
+        			engine.getGUI().getErrorWindow().error("Error while removing descriptor", e1);
+        			e1.printStackTrace();
+        		}
+            }
+        });
+        JButton closeButton = new JButton("Close");
+        closeButton.addActionListener(new ActionListener() {
+            public void actionPerformed(ActionEvent e) {
+                hide();
+            }
+        });
+        
+
+        GridPanel buttonPanel = new GridPanel();
+        buttonPanel.add(newButton);
+        buttonPanel.add(editButton);
+        buttonPanel.add(removeButton);
+        buttonPanel.add(closeButton);
+        buttonPanel.getSwingComponent().setBorder(BorderFactory.createEtchedBorder());
+        String title=null; 
+        switch (descriptorType){
+        	case HOST:
+        		title="Host Descriptions";
+        		break;
+        	case SERVICE:
+        		title="Applications";
+        		break;
+        	case APPLICATION:
+        		title="Application Descriptions";
+        		break;
+        }
+		this.dialog = new XBayaDialog(this.engine.getGUI(), title, infoPanel, buttonPanel);
+        this.dialog.setDefaultButton(editButton);
+        editButton.setEnabled(false);
+        removeButton.setEnabled(false);
+        try {
+			loadDescriptors();
+		} catch (AiravataAPIInvocationException e1) {
+			engine.getGUI().getErrorWindow().error("Error while loading descriptors", e1);
+			e1.printStackTrace();
+		}
+    }
+    
+    private void editDescriptor() throws AiravataAPIInvocationException {
+    	switch (descriptorType){
+	    	case HOST:
+	    		HostDescription h = (HostDescription) getSelected();
+	    		HostDescriptionDialog hostDescriptionDialog = new HostDescriptionDialog(engine.getConfiguration().getAiravataAPI(),false,h, null);
+	    		hostDescriptionDialog.setLocationRelativeTo(this.engine.getGUI().getFrame());
+	    		hostDescriptionDialog.open();
+	    		if (hostDescriptionDialog.isHostCreated()) {
+					loadDescriptors();
+					setAsChanged();
+				}
+	    		break;
+	    	case SERVICE:
+	    		ServiceDescription d = (ServiceDescription) getSelected();
+	    		DeploymentDescriptionDialog serviceDescriptionDialog = new DeploymentDescriptionDialog(getAPI(),false,d, null);
+	        	serviceDescriptionDialog.open();
+//	    		ServiceDescriptionDialog serviceDescriptionDialog = new ServiceDescriptionDialog(getRegistry(),false,d);
+//	    		serviceDescriptionDialog.open();
+	    		if (serviceDescriptionDialog.isServiceCreated()) {
+					loadDescriptors();
+					setAsChanged();
+				}
+	    		break;
+	    	case APPLICATION:
+                ApplicationDescription a = (ApplicationDescription) getSelected();
+                String[] s = dlist.get(a).split("\\$");
+                ApplicationDescriptionDialog aDescriptionDialog = new ApplicationDescriptionDialog(engine, false, a, s[1], s[0]);
+                aDescriptionDialog.setLocationRelativeTo(this.engine.getGUI().getFrame());
+                aDescriptionDialog.open();
+                if (aDescriptionDialog.isApplicationDescCreated()) {
+                    loadDescriptors();
+					setAsChanged();
+                }
+			break;
+    	}
+	}
+
+	private void setAsChanged() {
+		descriptorChanged=true;
+    	if (DescriptorEditorDialog.this.descriptorType==DescriptorType.SERVICE){
+			reloadComponentRegistry();
+		}
+	}
+
+    private void newDescriptor() throws AiravataAPIInvocationException {
+    	switch (descriptorType){
+	    	case HOST:
+	    		HostDescriptionDialog hostDescriptionDialog = new HostDescriptionDialog(engine.getConfiguration().getAiravataAPI(), null);
+	    		hostDescriptionDialog.open();
+	    		if (hostDescriptionDialog.isHostCreated()){
+	    			loadDescriptors();
+					setAsChanged();
+	    		}
+	    		break;
+	    	case SERVICE:
+	    		DeploymentDescriptionDialog serviceDescriptionDialog = new DeploymentDescriptionDialog(null, getAPI());
+	        	serviceDescriptionDialog.open();
+//	    		ServiceDescriptionDialog serviceDescriptionDialog = new ServiceDescriptionDialog(getRegistry());
+//	    		serviceDescriptionDialog.open();
+	    		if (serviceDescriptionDialog.isServiceCreated()){
+	    			loadDescriptors();
+					setAsChanged();
+	    		}
+	    		break;
+	    	case APPLICATION:
+	    		ApplicationDescriptionDialog applicationDescriptionDialog = new ApplicationDescriptionDialog(engine);
+	    		applicationDescriptionDialog.setLocationRelativeTo(this.engine.getGUI().getFrame());
+	    		applicationDescriptionDialog.open();
+	    		if (applicationDescriptionDialog.isApplicationDescCreated()){
+	    			loadDescriptors();
+					setAsChanged();
+	    		}
+	    		break;
+    	}
+		
+	}
+    
+	private Object getSelected() {
+		return descriptorList.getModel().getElementAt(descriptorList.getSelectedIndex());
+	}
+	protected boolean askQuestion(String title, String question) {
+        return JOptionPane.showConfirmDialog(this, question, title, JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION;
+    }
+    private boolean deleteDescriptor() throws AiravataAPIInvocationException{
+    	String title=null;
+    	String question=null;
+    	switch (descriptorType){
+	    	case HOST:
+	    		HostDescription h = (HostDescription) getSelected();
+	    		title = "Host description";
+	    		question = "Are you sure that you want to remove the service description \""
+	                    + h.getType().getHostName() + "\"?";
+	    		break;
+	    	case SERVICE:
+	        	ServiceDescription d = (ServiceDescription) getSelected();
+	    		title = "Service description";
+	    		question = "Are you sure that you want to remove the applications associated with \""
+	                    + d.getType().getName() + "\"?";
+	    		break;
+	    	case APPLICATION:
+	    		ApplicationDescription a = (ApplicationDescription) getSelected();
+	    		title = "Service description";
+	    		question = "Are you sure that you want to remove the service description \""
+	                    + a.getType().getApplicationName().getStringValue() + "\"?";
+	    		break;
+    	}
+    	
+        
+		if (askQuestion(title, question)) {
+            	switch (descriptorType){
+	    	    	case HOST:
+	    	    		HostDescription h = (HostDescription) getSelected();
+	    	        	getAPI().getApplicationManager().deleteHostDescription(h.getType().getHostName());
+                        loadDescriptors();
+    					setAsChanged();
+	    	    		break;
+	    	    	case SERVICE:
+	    	        	ServiceDescription d = (ServiceDescription) getSelected();
+	    	        	getAPI().getApplicationManager().deleteServiceDescription(d.getType().getName());
+                        loadDescriptors();
+    					setAsChanged();
+	    	    		break;
+	    	    	case APPLICATION:
+	    	    		ApplicationDescription a = (ApplicationDescription) getSelected();
+	    	    		String[] s = dlist.get(a).split("\\$");
+	    	        	getAPI().getApplicationManager().deleteApplicationDescription(s[0], s[1], a.getType().getApplicationName().getStringValue());
+	    	    		loadDescriptors();
+						setAsChanged();
+                        break;
+            	}
+//				loadDescriptors();
+        }
+        return true;
+    }
+
+	private void reloadComponentRegistry() {
+		ComponentRegistryLoader loader = ComponentRegistryLoader.getLoader(engine, RegistryConstants.REGISTRY_TYPE_JCR);
+		loader.load(engine.getConfiguration().getJcrComponentRegistry());
+	}
+    
+    private void loadDescriptors() throws AiravataAPIInvocationException {
+    	try {
+    		//allow the registry cache to update
+			Thread.sleep(500);
+		} catch (InterruptedException e1) {
+			e1.printStackTrace();
+		}
+    	((DefaultListModel)descriptorList.getModel()).removeAllElements();
+    		List<?> descriptors=null;
+			switch (descriptorType){
+	    	case HOST:
+	    		descriptors = getAPI().getApplicationManager().getAllHostDescriptions();
+	    		break;
+	    	case SERVICE:
+	    		descriptors = getAPI().getApplicationManager().getAllServiceDescriptions();
+	    		break;
+	    	case APPLICATION:
+	    		Map<String,ApplicationDescription> temp =getAPI().getApplicationManager().getApplicationDescriptors(null);
+                for(String value:temp.keySet()) {
+                    dlist.put(temp.get(value), value);
+
+                }
+	    		descriptors =Arrays.asList(dlist.keySet().toArray(new ApplicationDescription[]{}));
+	    		break;
+    		}
+    		for (Object d : descriptors) {
+				((DefaultListModel)descriptorList.getModel()).addElement(d);
+			}
+	}
+    
+    private static class DescriptorListCellRenderer extends DefaultListCellRenderer{
+		private static final long serialVersionUID = -1019715929291926180L;
+		private DescriptorType descriptorType;
+		public DescriptorListCellRenderer(DescriptorType descriptorType) {
+			this.descriptorType=descriptorType;
+		}
+		public Component getListCellRendererComponent(JList list, Object value,
+				int index, boolean isSelected, boolean cellHasFocus) {
+			Component c = super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
+			if (c instanceof JLabel){
+				switch (descriptorType){
+		    	case HOST:
+		    		((JLabel) c).setText(((HostDescription)value).getType().getHostName());
+					((JLabel) c).setIcon(JCRBrowserIcons.HOST_ICON);
+		    		break;
+		    	case SERVICE:
+		    		((JLabel) c).setText(((ServiceDescription)value).getType().getName());
+					((JLabel) c).setIcon(JCRBrowserIcons.SERVICE_ICON);
+		    		break;
+		    	case APPLICATION:
+		    		((JLabel) c).setText(((ApplicationDescription)value).getType().getApplicationName().getStringValue());
+					((JLabel) c).setIcon(JCRBrowserIcons.APPLICATION_ICON);
+		    		break;
+				}
+				
+			}
+			return c;
+		}
+    	
+    }
+    public AiravataAPI getAPI() {
+        return registry;
+    }
+
+    public void setRegistry(AiravataAPI registry) {
+        this.registry = registry;
+    }
+}
\ 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/DescriptorListDialog.java
----------------------------------------------------------------------
diff --git a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/dialogs/descriptors/DescriptorListDialog.java b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/dialogs/descriptors/DescriptorListDialog.java
new file mode 100644
index 0000000..fa4d03a
--- /dev/null
+++ b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/dialogs/descriptors/DescriptorListDialog.java
@@ -0,0 +1,261 @@
+/*
+ *
+ * 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.Component;
+import java.awt.Dimension;
+import java.awt.Toolkit;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Map;
+
+import javax.swing.BorderFactory;
+import javax.swing.DefaultListCellRenderer;
+import javax.swing.DefaultListModel;
+import javax.swing.JButton;
+import javax.swing.JDialog;
+import javax.swing.JLabel;
+import javax.swing.JList;
+import javax.swing.JOptionPane;
+import javax.swing.JScrollPane;
+import javax.swing.event.ListSelectionEvent;
+import javax.swing.event.ListSelectionListener;
+
+import org.apache.airavata.client.api.AiravataAPI;
+import org.apache.airavata.client.api.exception.AiravataAPIInvocationException;
+import org.apache.airavata.commons.gfac.type.ApplicationDescription;
+import org.apache.airavata.common.utils.SwingUtil;
+import org.apache.airavata.commons.gfac.type.HostDescription;
+import org.apache.airavata.commons.gfac.type.ServiceDescription;
+//import org.apache.airavata.registry.api.AiravataRegistry2;
+import org.apache.airavata.xbaya.registrybrowser.nodes.JCRBrowserIcons;
+import org.apache.airavata.xbaya.ui.XBayaGUI;
+import org.apache.airavata.xbaya.ui.dialogs.XBayaDialog;
+import org.apache.airavata.xbaya.ui.widgets.GridPanel;
+
+public class DescriptorListDialog extends JDialog {
+
+	private static final long serialVersionUID = 478151437279682576L;
+
+	private XBayaGUI xbayaGUI;
+
+    private XBayaDialog dialog;
+
+    private AiravataAPI registry;
+
+	private JList descriptorList;
+
+	private Map<String[],ApplicationDescription> dlist;
+
+	private JButton okButton;
+	
+	private boolean serviceSelected=false;
+
+	public enum DescriptorType{
+		HOST,
+		SERVICE,
+		APPLICATION
+	};
+
+	public DescriptorType descriptorType;
+
+    /**
+     *
+     * @param registry
+     * @param descriptorType
+     */
+    public DescriptorListDialog(AiravataAPI registry, DescriptorType descriptorType) {
+        setRegistry(registry);
+        this.descriptorType=descriptorType;
+        initGUI();
+        
+    }
+
+    /**
+     * Displays the dialog.
+     */
+    public void open() {
+    	pack();
+    	setModal(true);
+        // Adjust the size if it's bigger than the screen.
+        Dimension size = getSize();
+        Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
+        final int inset = 100;
+        int width = size.width;
+        if (width > screenSize.width) {
+            width = screenSize.width - inset;
+        }
+        int height = size.height;
+        if (height > screenSize.height) {
+            height = screenSize.height - inset;
+        }
+        setSize(width, height);
+
+        setLocationRelativeTo(null);
+        setVisible(true);
+    }
+
+    public void close() {
+        setVisible(false);
+    }
+
+    /**
+     * Initializes the GUI.
+     */
+    private void initGUI() {
+    	descriptorList= new JList(new DefaultListModel());
+    	descriptorList.setCellRenderer(new DescriptorListCellRenderer(descriptorType));
+    	JScrollPane pane = new JScrollPane(descriptorList);
+
+    	GridPanel infoPanel=new GridPanel();
+        infoPanel.add(pane);
+        infoPanel.getSwingComponent().setBorder(BorderFactory.createEtchedBorder());
+        SwingUtil.layoutToGrid(infoPanel.getSwingComponent(), 1, 1, 0, 0);
+
+        descriptorList.addListSelectionListener(new ListSelectionListener(){
+			@Override
+			public void valueChanged(ListSelectionEvent e) {
+				boolean isSelected=descriptorList.getSelectedIndex()!=-1;
+				okButton.setEnabled(isSelected);
+			}
+        	
+        });
+        okButton = new JButton("OK");
+        okButton.addActionListener(new ActionListener() {
+            public void actionPerformed(ActionEvent e) {
+            	serviceSelected=true;
+            	close();
+            }
+
+        });
+        JButton closeButton = new JButton("Cancel");
+        closeButton.addActionListener(new ActionListener() {
+            public void actionPerformed(ActionEvent e) {
+                close();
+            }
+        });
+        
+
+        GridPanel buttonPanel = new GridPanel();
+        buttonPanel.add(okButton);
+        buttonPanel.add(closeButton);
+        buttonPanel.getSwingComponent().setBorder(BorderFactory.createEtchedBorder());
+        String title=null; 
+        switch (descriptorType){
+        	case HOST:
+        		title="Host Descriptions";
+        		break;
+        	case SERVICE:
+        		title="Service Descriptions";
+        		break;
+        	case APPLICATION:
+        		title="Application Descriptions";
+        		break;
+        }
+        getContentPane().add(infoPanel.getSwingComponent());
+        getContentPane().add(buttonPanel.getSwingComponent());
+        SwingUtil.layoutToGrid(getContentPane(), 2, 1, 0, 0);
+        getRootPane().setDefaultButton(okButton);
+        okButton.setEnabled(false);
+        loadDescriptors();
+    }
+    
+	public Object getSelected() {
+		return descriptorList.getModel().getElementAt(descriptorList.getSelectedIndex());
+	}
+
+	protected boolean askQuestion(String title, String question) {
+        return JOptionPane.showConfirmDialog(null, question, title, JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION;
+    }
+    
+    private void loadDescriptors() {
+    	((DefaultListModel)descriptorList.getModel()).removeAllElements();
+    	try {
+    		List<?> descriptors=null;
+			switch (descriptorType){
+	    	case HOST:
+	    		descriptors = getRegistry().getApplicationManager().getAllHostDescriptions();
+	    		break;
+	    	case SERVICE:
+	    		descriptors = getRegistry().getApplicationManager().getAllServiceDescriptions();
+	    		break;
+	    	case APPLICATION:
+	    		dlist=getRegistry().getApplicationManager().getAllApplicationDescriptions();
+	    		descriptors =Arrays.asList(dlist.values().toArray(new ApplicationDescription[]{}));
+	    		break;
+    		}
+    		for (Object d : descriptors) {
+				((DefaultListModel)descriptorList.getModel()).addElement(d);
+			}
+		} catch (AiravataAPIInvocationException e) {
+			xbayaGUI.getErrorWindow().error(e);
+		}
+	}
+    
+    private static class DescriptorListCellRenderer extends DefaultListCellRenderer{
+		private static final long serialVersionUID = -1019715929291926180L;
+		private DescriptorType descriptorType;
+		public DescriptorListCellRenderer(DescriptorType descriptorType) {
+			this.descriptorType=descriptorType;
+		}
+		public Component getListCellRendererComponent(JList list, Object value,
+				int index, boolean isSelected, boolean cellHasFocus) {
+			Component c = super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
+			if (c instanceof JLabel){
+				switch (descriptorType){
+		    	case HOST:
+		    		((JLabel) c).setText(((HostDescription)value).getType().getHostName());
+					((JLabel) c).setIcon(JCRBrowserIcons.HOST_ICON);
+		    		break;
+		    	case SERVICE:
+		    		((JLabel) c).setText(((ServiceDescription)value).getType().getName());
+					((JLabel) c).setIcon(JCRBrowserIcons.SERVICE_ICON);
+		    		break;
+		    	case APPLICATION:
+		    		((JLabel) c).setText(((ApplicationDescription)value).getType().getApplicationName().getStringValue());
+					((JLabel) c).setIcon(JCRBrowserIcons.APPLICATION_ICON);
+		    		break;
+				}
+				
+			}
+			return c;
+		}
+    	
+    }
+    public AiravataAPI getRegistry() {
+        return registry;
+    }
+
+    public void setRegistry(AiravataAPI registry) {
+        this.registry = registry;
+    }
+
+	public boolean isServiceSelected() {
+		return serviceSelected;
+	}
+
+	public void setServiceSelected(boolean serviceSelected) {
+		this.serviceSelected = serviceSelected;
+	}
+}
\ 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/HostDeploymentDialog.java
----------------------------------------------------------------------
diff --git a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/dialogs/descriptors/HostDeploymentDialog.java b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/dialogs/descriptors/HostDeploymentDialog.java
new file mode 100644
index 0000000..d544e16
--- /dev/null
+++ b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/dialogs/descriptors/HostDeploymentDialog.java
@@ -0,0 +1,617 @@
+/*
+ *
+ * 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.Color;
+import java.awt.GridBagConstraints;
+import java.awt.GridBagLayout;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.awt.event.FocusAdapter;
+import java.awt.event.FocusEvent;
+import java.awt.event.KeyAdapter;
+import java.awt.event.KeyEvent;
+import java.util.List;
+
+import javax.swing.BorderFactory;
+import javax.swing.JButton;
+import javax.swing.JComboBox;
+import javax.swing.JDialog;
+import javax.swing.JFileChooser;
+import javax.swing.JLabel;
+import javax.swing.JOptionPane;
+import javax.swing.JPanel;
+import javax.swing.JSeparator;
+import javax.swing.JTextField;
+import javax.swing.ProgressMonitor;
+import javax.swing.SwingConstants;
+
+import org.apache.airavata.client.api.AiravataAPI;
+import org.apache.airavata.client.api.exception.AiravataAPIInvocationException;
+import org.apache.airavata.commons.gfac.type.ApplicationDescription;
+import org.apache.airavata.common.utils.SwingUtil;
+import org.apache.airavata.commons.gfac.type.HostDescription;
+//import org.apache.airavata.registry.api.AiravataRegistry2;
+import org.apache.airavata.schemas.gfac.*;
+import org.apache.airavata.xbaya.ui.menues.MenuIcons;
+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.xmlbeans.XmlException;
+
+public class HostDeploymentDialog extends JDialog implements ActionListener {
+    /**
+	 * 
+	 */
+    private static final long serialVersionUID = -2745085755585610025L;
+    private XBayaTextField txtExecPath;
+    private XBayaTextField txtTempDir;
+
+    private AiravataAPI registry;
+    private ApplicationDescription shellApplicationDescription;
+    private JLabel lblError;
+    private boolean applcationDescCreated = false;
+    private JButton okButton;
+
+    private String hostName;
+    private JComboBox cmbHostName;
+
+    private JButton btnHostAdvanceOptions;
+    private boolean newDescriptor;
+    private ApplicationDescription originalDescription;
+    private String originalHost;
+    private JButton btnTmpDirBrowse;
+    private JButton btnExecBrowse;
+    private List<String> existingHostList;
+
+    /**
+     * Create the dialog.
+     */
+    public HostDeploymentDialog(AiravataAPI registry, boolean newDescriptor,
+            ApplicationDescription originalDescription, String originalHost, List<String> existingHostList) {
+        setNewDescriptor(newDescriptor);
+        setOriginalDescription(originalDescription);
+        setOriginalHost(originalHost);
+        setRegistry(registry);
+        setExistingHostList(existingHostList);
+        iniGUI();
+    }
+
+    public void open() {
+        setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
+        setVisible(true);
+    }
+
+    protected HostDeploymentDialog getDialog() {
+        return this;
+    }
+
+    private void iniGUI() {
+        if (isNewDescriptor()) {
+            setTitle("New Application Deployment");
+        } else {
+            setTitle("Update Application Deployment: "
+                    + getOriginalDescription().getType().getApplicationName().getStringValue());
+        }
+        setBounds(100, 100, 600, 620);
+        setModal(true);
+        setLocationRelativeTo(null);
+        GridPanel buttonPane = new GridPanel();
+        {
+            lblError = new JLabel("");
+            lblError.setForeground(Color.RED);
+            buttonPane.add(lblError);
+            if (!isNewDescriptor()) {
+                JButton resetButton = new JButton("Reset");
+                resetButton.addActionListener(new ActionListener() {
+                    public void actionPerformed(ActionEvent e) {
+                        loadData();
+                    }
+                });
+                buttonPane.add(resetButton);
+            }
+            {
+                okButton = new JButton("Add");
+                if (!isNewDescriptor()) {
+                    okButton.setText("Update");
+                }
+                okButton.addActionListener(new ActionListener() {
+                    public void actionPerformed(ActionEvent e) {
+                        saveApplicationDescription();
+                        close();
+                    }
+                });
+                okButton.setEnabled(false);
+                okButton.setActionCommand("OK");
+                buttonPane.add(okButton);
+                getRootPane().setDefaultButton(okButton);
+            }
+            {
+                JButton cancelButton = new JButton("Cancel");
+                cancelButton.addActionListener(new ActionListener() {
+                    public void actionPerformed(ActionEvent e) {
+                        setApplicationDescCreated(false);
+                        close();
+                    }
+                });
+                cancelButton.setActionCommand("Cancel");
+                buttonPane.add(cancelButton);
+            }
+        }
+        {
+            JPanel execPath = new JPanel();
+            txtExecPath = new XBayaTextField();
+            txtExecPath.getTextField().addKeyListener(new KeyAdapter() {
+                @Override
+                public void keyReleased(KeyEvent e) {
+                    setExecutablePath(txtExecPath.getText());
+                }
+            });
+            txtExecPath.getTextField().addFocusListener(new FocusAdapter() {
+                @Override
+                public void focusLost(FocusEvent e) {
+                    super.focusLost(e);
+                    updateTempDirWithExecPath(txtExecPath.getText());
+                }
+            });
+            txtExecPath.setColumns(10);
+            btnExecBrowse = new JButton(MenuIcons.OPEN_ICON);
+            btnExecBrowse.addActionListener(new ActionListener() {
+                public void actionPerformed(ActionEvent arg0) {
+                    JFileChooser c = new JFileChooser();
+                    int rVal = c.showOpenDialog(null);
+                    if (rVal == JFileChooser.APPROVE_OPTION) {
+                        txtExecPath.setText(c.getSelectedFile().toString());
+                        setExecutablePath(txtExecPath.getText());
+                    }
+                }
+            });
+            execPath.add(txtExecPath.getSwingComponent());
+            execPath.add(btnExecBrowse);
+
+            setupLayoutForBrowse(execPath, txtExecPath.getSwingComponent());
+
+            JLabel lblExecutablePath = new JLabel("Executable path");
+            JPanel tmpDirPath = new JPanel();
+
+            txtTempDir = new XBayaTextField();
+            txtTempDir.getTextField().addKeyListener(new KeyAdapter() {
+                @Override
+                public void keyReleased(KeyEvent e) {
+                    setTempDir(txtTempDir.getText());
+                }
+            });
+            txtTempDir.setColumns(10);
+            btnTmpDirBrowse = new JButton(MenuIcons.OPEN_DIR_ICON);
+            btnTmpDirBrowse.addActionListener(new ActionListener() {
+                public void actionPerformed(ActionEvent arg0) {
+                    JFileChooser c = new JFileChooser();
+                    c.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
+                    int rVal = c.showOpenDialog(null);
+                    if (rVal == JFileChooser.APPROVE_OPTION) {
+                        txtTempDir.setText(c.getSelectedFile().toString());
+                        setTempDir(txtTempDir.getText());
+                    }
+                }
+            });
+            JTextField component = txtTempDir.getSwingComponent();
+            tmpDirPath.add(component);
+            tmpDirPath.add(btnTmpDirBrowse);
+
+            setupLayoutForBrowse(tmpDirPath, component);
+
+            JLabel lblTemporaryDirectory = new JLabel("Scratch working directory");
+
+            JButton btnAdvance = new JButton("Advanced application configurations...");
+            btnAdvance.addActionListener(new ActionListener() {
+                public void actionPerformed(ActionEvent e) {
+                    try {
+                        ApplicationDescriptionAdvancedOptionDialog serviceDescriptionDialog = new ApplicationDescriptionAdvancedOptionDialog(
+                                getRegistry(), getShellApplicationDescription());
+                        serviceDescriptionDialog.open();
+                    } catch (Exception e1) {
+                        e1.printStackTrace();
+                        JOptionPane.showMessageDialog(null, e1.getLocalizedMessage());
+                    }
+                }
+            });
+
+            cmbHostName = new JComboBox();
+            cmbHostName.addActionListener(this);
+
+            XBayaLabel lblHostName = new XBayaLabel("Application host", cmbHostName);
+            XBayaLinkButton lnkNewHost = new XBayaLinkButton("New button");
+            lnkNewHost.addActionListener(new ActionListener() {
+                public void actionPerformed(ActionEvent e) {
+                    try {
+                        HostDescriptionDialog hostDescriptionDialog = new HostDescriptionDialog(getRegistry(), null);
+                        hostDescriptionDialog.setLocationRelativeTo(getContentPane());
+                        hostDescriptionDialog.open();
+
+                        if (hostDescriptionDialog.isHostCreated()) {
+                            ProgressMonitor progressMonitor = new ProgressMonitor(getContentPane(),
+                                    "Host Descriptions", "Refreshing host list..", 0, 200);
+                            int progress = 1;
+                            progressMonitor.setProgress(progress++);
+                            while (cmbHostName.getSelectedIndex() == -1
+                                    || !cmbHostName.getSelectedItem().toString()
+                                            .equals(hostDescriptionDialog.getHostLocation())) {
+                                loadHostDescriptions();
+                                cmbHostName.setSelectedItem(hostDescriptionDialog.getHostLocation());
+                                progressMonitor.setProgress(progress++);
+                                Thread.sleep(50);
+                            }
+                            progressMonitor.setProgress(200);
+                        }
+                    } catch (Exception e1) {
+                        e1.printStackTrace();
+                        JOptionPane.showMessageDialog(null, e1.getLocalizedMessage());
+                    }
+                }
+            });
+            lnkNewHost.setText("Create new host...");
+            lnkNewHost.setHorizontalAlignment(SwingConstants.TRAILING);
+
+            btnHostAdvanceOptions = new JButton("HPC Configuration...");
+            btnHostAdvanceOptions.addActionListener(new ActionListener() {
+                public void actionPerformed(ActionEvent arg0) {
+                    try {
+                        ApplicationDescriptionHostAdvancedOptionDialog hostAdvancedOptionsDialog = new ApplicationDescriptionHostAdvancedOptionDialog(
+                                getRegistry(), getShellApplicationDescription());
+                        hostAdvancedOptionsDialog.open();
+                    } catch (Exception e1) {
+                        e1.printStackTrace();
+                        JOptionPane.showMessageDialog(null, e1.getLocalizedMessage());
+                    }
+                }
+            });
+            btnHostAdvanceOptions.setVisible(false);
+            GridPanel hostPanel = new GridPanel();
+            hostPanel.add(cmbHostName);
+            // hostPanel.add(btnHostAdvanceOptions);
+            hostPanel.add(new JLabel());
+
+            SwingUtil.layoutToGrid(hostPanel.getSwingComponent(), 1, 2, 0, 0);
+
+            GridPanel infoPanel1 = new GridPanel();
+
+            infoPanel1.add(lblExecutablePath);
+            infoPanel1.add(execPath);
+            infoPanel1.add(lblTemporaryDirectory);
+            infoPanel1.add(tmpDirPath);
+
+            GridPanel infoPanel3 = new GridPanel();
+
+            infoPanel3.add(lblHostName);
+            infoPanel3.add(hostPanel);
+            infoPanel3.add(new JLabel());
+            infoPanel3.add(lnkNewHost);
+
+            GridPanel infoPanel4 = new GridPanel();
+            // infoPanel4.add(new JLabel());
+            infoPanel4.add(btnHostAdvanceOptions);
+            infoPanel4.add(btnAdvance);
+            infoPanel4.layout(1, 2, 0, 0);
+
+            SwingUtil.layoutToGrid(infoPanel1.getSwingComponent(), 4, 1, SwingUtil.WEIGHT_NONE, 0);
+            SwingUtil.layoutToGrid(infoPanel3.getSwingComponent(), 2, 2, SwingUtil.WEIGHT_NONE, 1);
+
+            GridPanel infoPanel = new GridPanel();
+            infoPanel.add(new JSeparator());
+            infoPanel.add(infoPanel3);
+            infoPanel.add(new JSeparator());
+            infoPanel.add(infoPanel1);
+
+            infoPanel.add(new JSeparator());
+            infoPanel.add(infoPanel4);
+
+            SwingUtil.layoutToGrid(infoPanel.getSwingComponent(), 6, 1, SwingUtil.WEIGHT_NONE, 0);
+            SwingUtil.layoutToGrid(buttonPane.getSwingComponent(), 1, buttonPane.getContentPanel().getComponentCount(),
+                    SwingUtil.WEIGHT_NONE, 0);
+            getContentPane().add(infoPanel.getSwingComponent());
+            getContentPane().add(buttonPane.getSwingComponent());
+
+            buttonPane.getSwingComponent().setBorder(BorderFactory.createEtchedBorder());
+            infoPanel.getSwingComponent().setBorder(BorderFactory.createEtchedBorder());
+
+            SwingUtil.layoutToGrid(getContentPane(), 2, 1, -1, 0);
+            loadHostDescriptions();
+        }
+        setResizable(true);
+        getRootPane().setDefaultButton(okButton);
+        if (!isNewDescriptor()) {
+            loadData();
+        }
+        pack();
+        if (getSize().getWidth() < 500) {
+            setSize(500, getSize().height);
+        }
+    }
+
+    private void setupLayoutForBrowse(JPanel tmpDirPath, JTextField component) {
+        GridBagLayout layout;
+        GridBagConstraints constraints;
+        layout = new GridBagLayout();
+        constraints = new GridBagConstraints();
+        constraints.fill = GridBagConstraints.BOTH;
+        constraints.weightx = 1;
+        layout.setConstraints(component, constraints);
+        tmpDirPath.setLayout(layout);
+    }
+
+    private void loadData() {
+        txtExecPath.setText(getOriginalDescription().getType().getExecutableLocation());
+        setExecutablePath(txtExecPath.getText());
+        txtTempDir.setText(getOriginalDescription().getType().getScratchWorkingDirectory());
+        setTempDir(txtTempDir.getText());
+
+        cmbHostName.setSelectedItem(getOriginalHost());
+        setHostName(cmbHostName.getSelectedItem().toString());
+        cmbHostName.setEnabled(isNewDescriptor());
+    }
+
+    private void loadHostDescriptions() {
+        cmbHostName.removeAllItems();
+        setHostName(null);
+        try {
+            List<HostDescription> hostDescriptions = getRegistry().getApplicationManager().getAllHostDescriptions();
+            for (HostDescription hostDescription : hostDescriptions) {
+                if (!isNewDescriptor() || !getExistingHostList().contains(hostDescription.getType().getHostName())) {
+                    cmbHostName.addItem(hostDescription.getType().getHostName());
+                }
+            }
+        } catch (Exception e) {
+            setError(e.getLocalizedMessage());
+        }
+        updateHostName();
+    }
+
+    public ApplicationDescription getShellApplicationDescription() {
+        if (shellApplicationDescription == null) {
+            if (isNewDescriptor()) {
+                shellApplicationDescription = new ApplicationDescription();
+            } else {
+                try {
+                    shellApplicationDescription = ApplicationDescription.fromXML(getOriginalDescription().toXML());
+                } catch (XmlException e) {
+                    // shouldn't happen (hopefully)
+                }
+            }
+        }
+        return shellApplicationDescription;
+    }
+
+    public ApplicationDeploymentDescriptionType getApplicationDescriptionType() {
+        return getShellApplicationDescription().getType();
+    }
+
+    public String getExecutablePath() {
+        return getApplicationDescriptionType().getExecutableLocation();
+    }
+
+    public void setExecutablePath(String executablePath) {
+        getApplicationDescriptionType().setExecutableLocation(executablePath);
+        updateTempDirWithExecPath(executablePath);
+        updateDialogStatus();
+    }
+
+    private void updateTempDirWithExecPath(String executablePath) {
+        // if (!executablePath.trim().equals("") && (!txtExecPath.getSwingComponent().isFocusOwner()) &&
+        // (getApplicationDescriptionType().getScratchWorkingDirectory()==null ||
+        // getApplicationDescriptionType().getScratchWorkingDirectory().trim().equalsIgnoreCase(""))){
+        // String temp_location = "workflow_runs";
+        // String tempDir = new File(new File(executablePath).getParentFile(),temp_location).toString();
+        // txtTempDir.setText(tempDir);
+        // txtTempDir.getSwingComponent().setSelectionStart(tempDir.length()-temp_location.length());
+        // txtTempDir.getSwingComponent().setSelectionEnd(tempDir.length());
+        // setTempDir(txtTempDir.getText());
+        // txtTempDir.getSwingComponent().requestFocus();
+        // }
+    }
+
+    public String getTempDir() {
+        return getApplicationDescriptionType().getScratchWorkingDirectory();
+    }
+
+    public void setTempDir(String tempDir) {
+        getApplicationDescriptionType().setScratchWorkingDirectory(tempDir);
+        updateDialogStatus();
+    }
+
+    public void close() {
+        getDialog().setVisible(false);
+    }
+
+    public void saveApplicationDescription() {
+        setApplicationDescCreated(true);
+    }
+
+    public boolean isApplicationDescCreated() {
+        return applcationDescCreated;
+    }
+
+    public void setApplicationDescCreated(boolean applicationDescCreated) {
+        this.applcationDescCreated = applicationDescCreated;
+    }
+
+    private void setError(String errorMessage) {
+        if (errorMessage == null || errorMessage.trim().equals("")) {
+            lblError.setText("");
+        } else {
+            lblError.setText(errorMessage.trim());
+        }
+    }
+
+    private void updateDialogStatus() {
+        String message = null;
+        try {
+            validateDialog();
+        } catch (Exception e) {
+            message = e.getLocalizedMessage();
+        }
+        okButton.setEnabled(message == null);
+        setError(message);
+    }
+
+    private void validateDialog() throws Exception {
+        if (getExecutablePath() == null || getExecutablePath().trim().equals("")) {
+            throw new Exception("Executable path cannot be empty!!!");
+        }
+
+        if (getTempDir() == null || getTempDir().trim().equals("")) {
+            throw new Exception("Temporary directory location cannot be empty!!!");
+        }
+
+        if (getHostName() == null || getHostName().trim().equals("")) {
+            throw new Exception("Please select/create host to bind to this deployment description");
+        }
+
+    }
+
+    public String getHostName() {
+        return hostName;
+    }
+
+    public void setHostName(String hostName) {
+        this.hostName = hostName;
+        if (hostName != null) {
+            HostDescription hostDescription;
+            try {
+                hostDescription = registry.getApplicationManager().getHostDescription(hostName);
+                if (hostDescription.getType() instanceof GlobusHostType || hostDescription.getType() instanceof UnicoreHostType || hostDescription.getType() instanceof GsisshHostType) {
+                    getShellApplicationDescription().getType().changeType(HpcApplicationDeploymentType.type);
+                }else if (hostDescription.getType() instanceof SSHHostType && ((SSHHostType)hostDescription.getType()).getHpcResource()) {
+                    getShellApplicationDescription().getType().changeType(HpcApplicationDeploymentType.type);
+                } else {
+                    getShellApplicationDescription().getType().changeType(ApplicationDeploymentDescriptionType.type);
+                }
+                btnHostAdvanceOptions.setVisible(getShellApplicationDescription().getType() instanceof HpcApplicationDeploymentType);
+                String hostAddress = hostDescription.getType().getHostAddress();
+                boolean isLocal = isLocalAddress(hostAddress);
+                btnExecBrowse.setVisible(isLocal);
+                btnTmpDirBrowse.setVisible(isLocal);
+            } catch (AiravataAPIInvocationException e) {
+                e.printStackTrace();
+            }
+        }
+        updateDialogStatus();
+    }
+
+    private boolean isLocalAddress(String hostAddress) {
+        return hostAddress.equalsIgnoreCase("localhost") || hostAddress.equalsIgnoreCase("127.0.0.1");
+    }
+
+    private void updateHostName() {
+        if (cmbHostName.getSelectedItem() != null) {
+            setHostName(cmbHostName.getSelectedItem().toString());
+        }
+    }
+
+    public void actionPerformed(ActionEvent e) {
+        if (e.getSource() == cmbHostName) {
+            updateHostName();
+        }
+        if (e.getSource() == txtExecPath) {
+            setExecutablePath(txtExecPath.getText());
+        }
+        if (e.getSource() == txtTempDir) {
+            setTempDir(txtTempDir.getText());
+        }
+    }
+
+    public AiravataAPI getRegistry() {
+        return registry;
+    }
+
+    public void setRegistry(AiravataAPI registry) {
+        this.registry = registry;
+    }
+
+    public boolean isNewDescriptor() {
+        return newDescriptor;
+    }
+
+    public void setNewDescriptor(boolean newDescriptor) {
+        this.newDescriptor = newDescriptor;
+    }
+
+    public ApplicationDescription getOriginalDescription() {
+        return originalDescription;
+    }
+
+    public void setOriginalDescription(ApplicationDescription originalDescription) {
+        this.originalDescription = originalDescription;
+    }
+
+    public String getOriginalHost() {
+        return originalHost;
+    }
+
+    public void setOriginalHost(String originalHost) {
+        this.originalHost = originalHost;
+    }
+
+    public HostDeployment execute() throws AiravataAPIInvocationException {
+        open();
+        if (isApplicationDescCreated()) {
+            return new HostDeployment(getRegistry().getApplicationManager().getHostDescription(getHostName()),
+                    getShellApplicationDescription());
+        }
+        return null;
+    }
+
+    public List<String> getExistingHostList() {
+        return existingHostList;
+    }
+
+    public void setExistingHostList(List<String> existingHostList) {
+        this.existingHostList = existingHostList;
+    }
+
+    public static class HostDeployment {
+        private HostDescription hostDescription;
+        private ApplicationDescription applicationDescription;
+
+        public HostDeployment(HostDescription hostDescription, ApplicationDescription applicationDescription) {
+            setHostDescription(hostDescription);
+            setApplicationDescription(applicationDescription);
+        }
+
+        public ApplicationDescription getApplicationDescription() {
+            return applicationDescription;
+        }
+
+        public void setApplicationDescription(ApplicationDescription applicationDescription) {
+            this.applicationDescription = applicationDescription;
+        }
+
+        public HostDescription getHostDescription() {
+            return hostDescription;
+        }
+
+        public void setHostDescription(HostDescription hostDescription) {
+            this.hostDescription = hostDescription;
+        }
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/airavata/blob/9c47eec8/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/dialogs/descriptors/HostDescriptionDialog.java
----------------------------------------------------------------------
diff --git a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/dialogs/descriptors/HostDescriptionDialog.java b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/dialogs/descriptors/HostDescriptionDialog.java
new file mode 100644
index 0000000..5dece7b
--- /dev/null
+++ b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/dialogs/descriptors/HostDescriptionDialog.java
@@ -0,0 +1,592 @@
+/*
+ *
+ * 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.Color;
+import java.awt.Font;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.awt.event.KeyAdapter;
+import java.awt.event.KeyEvent;
+import java.awt.event.WindowAdapter;
+import java.awt.event.WindowEvent;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.swing.BorderFactory;
+import javax.swing.JButton;
+import javax.swing.JCheckBox;
+import javax.swing.JComboBox;
+import javax.swing.JDialog;
+import javax.swing.JFrame;
+import javax.swing.JLabel;
+import javax.swing.SwingConstants;
+
+import org.apache.airavata.client.api.AiravataAPI;
+import org.apache.airavata.client.api.exception.AiravataAPIInvocationException;
+import org.apache.airavata.client.api.exception.DescriptorAlreadyExistsException;
+import org.apache.airavata.common.utils.StringUtil;
+import org.apache.airavata.common.utils.SwingUtil;
+import org.apache.airavata.commons.gfac.type.HostDescription;
+import org.apache.airavata.schemas.gfac.Ec2HostType;
+import org.apache.airavata.schemas.gfac.ExportProperties;
+import org.apache.airavata.schemas.gfac.ExportProperties.Name;
+import org.apache.airavata.schemas.gfac.GlobusHostType;
+import org.apache.airavata.schemas.gfac.GsisshHostType;
+import org.apache.airavata.schemas.gfac.HostDescriptionType;
+import org.apache.airavata.schemas.gfac.SSHHostType;
+import org.apache.airavata.schemas.gfac.UnicoreHostType;
+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 HostDescriptionDialog extends JDialog {
+
+	private static final long serialVersionUID = -2910634296292034085L;
+
+    private XBayaTextField hostIdTextField;
+
+    private XBayaTextField hostAddressTextField;
+
+    private XBayaTextField gateKeeperTextField;
+
+    private XBayaTextField gridFTPTextField;
+
+    private HostDescription hostDescription;
+
+    private boolean hostCreated = false;
+
+    private AiravataAPI registry;
+
+	private XBayaLabel gateKeeperLabel;
+
+	private XBayaLabel gridFTPLabel;
+
+    private JLabel lblError;
+
+    private String hostId;
+
+    private JButton okButton;
+
+    private boolean newHost;
+
+    private HostDescription originalHostDescription;
+
+//    private XBayaEngine engine;
+
+	private JComboBox cmbResourceProtocol;
+
+	private GridPanel infoPanel2;
+
+	private XBayaTextField exportsTextField;
+
+	private XBayaTextField preJobCommandsTextField;
+
+	private XBayaTextField postJobCommandsTextField;
+
+	private XBayaLabel postJobCommandsTextFieldLabel;
+
+	private XBayaLabel preJobCommandsLabel;
+
+	private XBayaLabel exportsLabel;
+
+	private XBayaTextField fileEndPointPrefixTextField;
+
+	private XBayaLabel fileEndPointPrefixLabel;
+
+	private JCheckBox hpcResourceCheckBoxField;
+
+	private JLabel emptyLabel;
+
+	private static final String REMOTE_PROTOCOL_STR_LOCAL="Local";
+	private static final String REMOTE_PROTOCOL_STR_SSH="SSH";
+	private static final String REMOTE_PROTOCOL_STR_GLOBUS="Globus";
+	private static final String REMOTE_PROTOCOL_STR_UNICORE="Unicore";
+	private static final String REMOTE_PROTOCOL_STR_AMAZON_EC2="Amazon EC2";
+	private static final String REMOTE_PROTOCOL_STR_HADOOP="Hadoop";
+	private static final String REMOTE_PROTOCOL_GSI_SSH="GSI-SSH";
+
+
+    public HostDescriptionDialog(AiravataAPI registry, JFrame parent) {
+    	this(registry,true,null, parent);
+    }
+
+    /**
+     *
+     * @param registry
+     * @param newHost
+     * @param originalHostDescription
+     */
+    public HostDescriptionDialog(AiravataAPI registry, boolean newHost, HostDescription originalHostDescription, JFrame parent) {
+        super(parent);
+        setNewHost(newHost);
+        setOriginalHostDescription(originalHostDescription);
+        addWindowListener(new WindowAdapter() {
+            @Override
+            public void windowOpened(WindowEvent arg0) {
+//                if (isNewHost()) {
+//					String baseName = "Host";
+//					int i = 1;
+//					String defaultName = baseName + i;
+//					try {
+//						while (getRegistry().getServiceDescription(defaultName) != null) {
+//							defaultName = baseName + (++i);
+//						}
+//					} catch (Exception e) {
+//						e.printStackTrace();
+//					}
+//					hostIdTextField.setText(defaultName);
+//				}
+            }
+        });
+        setRegistry(registry);
+        initGUI();
+    }
+
+    /**
+     * Displays the dialog.
+     */
+    public void open() {
+        setModal(true);
+        setLocationRelativeTo(getOwner());
+		setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
+		setVisible(true);
+    }
+
+    public void close() {
+    	setVisible(false);
+    }
+
+    private void ok() {
+        hostId = this.hostIdTextField.getText();
+        String hostAddress = this.hostAddressTextField.getText();
+
+        setHostId(hostId);
+        setHostLocation(hostAddress);
+        HostDescriptionType host = getHostDescription().getType();
+        if(host instanceof GlobusHostType) {
+        	((GlobusHostType)hostDescription.getType()).addGlobusGateKeeperEndPoint(this.gateKeeperTextField.getText());
+            ((GlobusHostType)hostDescription.getType()).addGridFTPEndPoint(this.gridFTPTextField.getText());
+        }else if (host instanceof UnicoreHostType){
+        	((UnicoreHostType)hostDescription.getType()).addUnicoreBESEndPoint(this.gateKeeperTextField.getText());
+            ((UnicoreHostType)hostDescription.getType()).addGridFTPEndPoint(this.gridFTPTextField.getText());
+        }else if (host instanceof SSHHostType){
+        	while(((SSHHostType)hostDescription.getType()).getFileEndPointPrefixArray().length>0){
+        		((SSHHostType)hostDescription.getType()).removeFileEndPointPrefix(0);
+        	}
+        	String[] prefixes = StringUtil.getElementsFromString(this.fileEndPointPrefixTextField.getText());
+        	for (String prefix : prefixes) {
+        		((SSHHostType)hostDescription.getType()).addNewFileEndPointPrefix().setStringValue(prefix);
+			}
+            ((SSHHostType)hostDescription.getType()).setHpcResource(hpcResourceCheckBoxField.isSelected());
+        }else if (host instanceof GsisshHostType){
+        	String[] exports = StringUtil.getElementsFromString(exportsTextField.getText());
+        	ExportProperties exportsElement = ((GsisshHostType)hostDescription.getType()).addNewExports();
+        	for (String export : exports) {
+        		String[] nameVal = StringUtil.getElementsFromString(export,"=",StringUtil.QUOTE);
+        		if (nameVal.length>0){
+            		Name name = exportsElement.addNewName();
+        			name.setStringValue(nameVal[0]);
+        			if (nameVal.length>1){
+        				name.setValue(nameVal[1]);
+        			}
+        		}
+			}
+            ((GsisshHostType)hostDescription.getType()).setPreJobCommandsArray(StringUtil.getElementsFromString(this.preJobCommandsTextField.getText()));
+            ((GsisshHostType)hostDescription.getType()).setPostJobCommandsArray(StringUtil.getElementsFromString(this.postJobCommandsTextField.getText()));
+        }
+        saveHostDescription();
+        close();
+    }
+
+    private GridPanel createPanelWithMessage(String message){
+    	GridPanel gridPanel = new GridPanel();
+    	JLabel lblMessage = new JLabel(message, SwingConstants.CENTER);
+		gridPanel.add(lblMessage);
+		lblMessage.setFont(new Font("Tahoma", Font.ITALIC, 11));
+    	gridPanel.layout(1,1, 0,0);
+    	return gridPanel;
+    }
+
+    /**
+     * Initializes the GUI.
+     */
+    private void initGUI() {
+    	setBounds(100, 100, 400, 350);
+    	setModal(true);
+        setLocationRelativeTo(null);
+        if (isNewHost()) {
+			setTitle("Register Host");
+		}else{
+			setTitle("Update Host: "+getOriginalHostDescription().getType().getHostName());
+		}
+		this.hostIdTextField = new XBayaTextField();
+        this.hostAddressTextField = new XBayaTextField();
+
+        XBayaLabel hostIdLabel = new XBayaLabel("Host ID", this.hostIdTextField);
+        XBayaLabel hostAddressLabel = new XBayaLabel("Host Address", this.hostAddressTextField);
+        cmbResourceProtocol = new JComboBox(new String[]{REMOTE_PROTOCOL_STR_LOCAL,REMOTE_PROTOCOL_STR_SSH,REMOTE_PROTOCOL_STR_GLOBUS,REMOTE_PROTOCOL_STR_UNICORE,REMOTE_PROTOCOL_STR_AMAZON_EC2, REMOTE_PROTOCOL_STR_HADOOP, REMOTE_PROTOCOL_GSI_SSH});
+        JLabel lblResourceProtocol = new JLabel("Resource Protocol");
+        GridPanel pnlResourceProtocolSelection=new GridPanel();
+        pnlResourceProtocolSelection.add(lblResourceProtocol);
+        pnlResourceProtocolSelection.add(cmbResourceProtocol);
+        pnlResourceProtocolSelection.layout(1, 2, 0, 1);
+        cmbResourceProtocol.addActionListener(new ActionListener() {
+            public void actionPerformed(ActionEvent arg0) {
+                updateRemoteProtocolTypeAndControls();
+            }
+        });
+        hostIdTextField.getSwingComponent().addKeyListener(new KeyAdapter() {
+            @Override
+            public void keyReleased(KeyEvent e) {
+            	updateDialogStatus();
+            }
+        });
+        hostAddressTextField.getSwingComponent().addKeyListener(new KeyAdapter() {
+            @Override
+            public void keyReleased(KeyEvent e) {
+            	updateDialogStatus();
+            }
+        });
+        GridPanel infoPanel1 = new GridPanel();
+        infoPanel1.add(hostIdLabel);
+        infoPanel1.add(this.hostIdTextField);
+        infoPanel1.add(hostAddressLabel);
+        infoPanel1.add(this.hostAddressTextField);
+//        infoPanel1.add(chkGobusHost);
+        infoPanel2 = new GridPanel();
+        infoPanel2.add(createPanelWithMessage("Initializing..."));
+        SwingUtil.layoutToGrid(infoPanel1.getSwingComponent(), 2, 2, SwingUtil.WEIGHT_NONE, 1);
+        SwingUtil.layoutToGrid(infoPanel2.getSwingComponent(), 1, 1, SwingUtil.WEIGHT_NONE, 1);
+
+        GridPanel infoPanel = new GridPanel();
+
+        infoPanel.add(infoPanel1);
+        infoPanel.add(pnlResourceProtocolSelection);
+        infoPanel.add(infoPanel2);
+        infoPanel.getSwingComponent().setBorder(BorderFactory.createEtchedBorder());
+        SwingUtil.layoutToGrid(infoPanel.getSwingComponent(), 3, 1, SwingUtil.WEIGHT_NONE, 0);
+
+        GridPanel buttonPanel = new GridPanel();
+        lblError = new JLabel();
+        lblError.setForeground(Color.RED);
+        buttonPanel.add(lblError);
+        okButton = new JButton("Save");
+        if (!isNewHost()) {
+			okButton.setText("Update");
+		}
+		okButton.addActionListener(new ActionListener() {
+            public void actionPerformed(ActionEvent e) {
+                ok();
+            }
+        });
+
+        buttonPanel.add(okButton);
+
+        JButton cancelButton = new JButton("Cancel");
+        cancelButton.addActionListener(new ActionListener() {
+            public void actionPerformed(ActionEvent e) {
+                close();
+            }
+        });
+
+        buttonPanel.add(cancelButton);
+        buttonPanel.layout(1,3,SwingUtil.WEIGHT_NONE,0);
+        buttonPanel.getSwingComponent().setBorder(BorderFactory.createEtchedBorder());
+
+        getContentPane().add(infoPanel.getSwingComponent());
+        getContentPane().add(buttonPanel.getSwingComponent());
+
+        SwingUtil.layoutToGrid(getContentPane(), 2, 1, 0, 0);
+
+        getRootPane().setDefaultButton(okButton);
+        cmbResourceProtocol.setSelectedIndex(0);
+        updateRemoteProtocolTypeAndControls();
+        if (!isNewHost()) {
+			loadData();
+		}
+//        SwingUtil.addPlaceHolder(hostIdTextField.getSwingComponent(), "[unique name for the host]");
+//        SwingUtil.addPlaceHolder(hostAddressTextField.getSwingComponent(), "[a valid host address, eg: myhost.com, 127.0.0.1]");
+//        SwingUtil.addPlaceHolder(GridFTPTextField.getSwingComponent(), "[List of grid ftp endpoints]");
+//        SwingUtil.addPlaceHolder(globusGateKeeperTextField.getSwingComponent(), "[List of globus gate keeper endpoints]");
+        updateDialogStatus();
+    }
+
+	private GridPanel createGlobusRemoteProtocolPanel() {
+		GridPanel globusPanel = new GridPanel();
+        if (gridFTPTextField==null) {
+			this.gridFTPTextField = new XBayaTextField();
+			this.gateKeeperTextField = new XBayaTextField();
+			gateKeeperLabel = new XBayaLabel("GRAM Endpoint", this.gateKeeperTextField);
+	        gridFTPLabel = new XBayaLabel("Grid FTP Endpoint", this.gridFTPTextField);
+		}
+        globusPanel.add(gateKeeperLabel);
+        globusPanel.add(gateKeeperTextField);
+        globusPanel.add(gridFTPLabel);
+        globusPanel.add(gridFTPTextField);
+        SwingUtil.layoutToGrid(globusPanel.getSwingComponent(), 2, 2, SwingUtil.WEIGHT_NONE, 1);
+        return globusPanel;
+	}
+	
+	private GridPanel createSSHRemoteProtocolPanel() {
+		GridPanel globusPanel = new GridPanel();
+        if (fileEndPointPrefixTextField==null) {
+			this.fileEndPointPrefixTextField = new XBayaTextField();
+			this.hpcResourceCheckBoxField = new JCheckBox("HPC Resource");
+			fileEndPointPrefixLabel = new XBayaLabel("File Endpoint Prefix", this.fileEndPointPrefixTextField);
+			this.emptyLabel=new JLabel();
+		}
+        globusPanel.add(hpcResourceCheckBoxField);
+        globusPanel.add(emptyLabel);
+        globusPanel.add(fileEndPointPrefixLabel);
+        globusPanel.add(fileEndPointPrefixTextField);
+        SwingUtil.layoutToGrid(globusPanel.getSwingComponent(), 2, 2, SwingUtil.WEIGHT_NONE, 1);
+        return globusPanel;
+	}
+	
+	private GridPanel createGSISSHRemoteProtocolPanel() {
+		GridPanel globusPanel = new GridPanel();
+        if (exportsTextField==null) {
+			this.exportsTextField = new XBayaTextField();
+			this.preJobCommandsTextField = new XBayaTextField();
+			this.postJobCommandsTextField = new XBayaTextField();
+			exportsLabel = new XBayaLabel("Exports", this.exportsTextField);
+			preJobCommandsLabel = new XBayaLabel("Pre-job Commands", this.preJobCommandsTextField);
+			postJobCommandsTextFieldLabel = new XBayaLabel("Post-job Commands", this.postJobCommandsTextField);
+		}
+        globusPanel.add(exportsLabel);
+        globusPanel.add(exportsTextField);
+        globusPanel.add(preJobCommandsLabel);
+        globusPanel.add(preJobCommandsTextField);
+        globusPanel.add(postJobCommandsTextFieldLabel);
+        globusPanel.add(postJobCommandsTextField);
+        SwingUtil.layoutToGrid(globusPanel.getSwingComponent(), 3, 2, SwingUtil.WEIGHT_NONE, 1);
+        return globusPanel;
+	}
+
+	private GridPanel createUnicoreRemoteProtocolPanel() {
+		GridPanel globusPanel = new GridPanel();
+        if (gridFTPTextField==null) {
+			this.gridFTPTextField = new XBayaTextField();
+			this.gateKeeperTextField = new XBayaTextField();
+			gateKeeperLabel = new XBayaLabel("Unicore Endpoint", this.gateKeeperTextField);
+	        gridFTPLabel = new XBayaLabel("GridFTP Endpoint", this.gridFTPTextField);
+		}
+        globusPanel.add(gateKeeperLabel);
+        globusPanel.add(gateKeeperTextField);
+        globusPanel.add(gridFTPLabel);
+        globusPanel.add(gridFTPTextField);
+        SwingUtil.layoutToGrid(globusPanel.getSwingComponent(), 2, 2, SwingUtil.WEIGHT_NONE, 1);
+        return globusPanel;
+	}
+    private void loadData() {
+    	HostDescriptionType t = getOriginalHostDescription().getType();
+    	hostIdTextField.setText(t.getHostName());
+		hostAddressTextField.setText(t.getHostAddress());
+		if (t instanceof GlobusHostType){
+			cmbResourceProtocol.setSelectedItem(REMOTE_PROTOCOL_STR_GLOBUS);
+			gateKeeperTextField.setText(StringUtil.createDelimiteredString(((GlobusHostType) t).getGlobusGateKeeperEndPointArray()));
+			gridFTPTextField.setText(StringUtil.createDelimiteredString(((GlobusHostType) t).getGridFTPEndPointArray()));
+		}else if (t instanceof SSHHostType){
+			cmbResourceProtocol.setSelectedItem(REMOTE_PROTOCOL_STR_SSH);
+			fileEndPointPrefixTextField.setText(StringUtil.createDelimiteredString(((SSHHostType)t).getFileEndPointPrefixArray()));
+			hpcResourceCheckBoxField.setSelected(((SSHHostType)t).getHpcResource());
+		}else if (t instanceof UnicoreHostType){
+			cmbResourceProtocol.setSelectedItem(REMOTE_PROTOCOL_STR_UNICORE);
+			gateKeeperTextField.setText(StringUtil.createDelimiteredString(((UnicoreHostType) t).getUnicoreBESEndPointArray()));
+			gridFTPTextField.setText(StringUtil.createDelimiteredString(((UnicoreHostType) t).getGridFTPEndPointArray()));
+		}else if (t instanceof Ec2HostType){
+			cmbResourceProtocol.setSelectedItem(REMOTE_PROTOCOL_STR_AMAZON_EC2);
+		}else if (t instanceof GsisshHostType){
+			cmbResourceProtocol.setSelectedItem(REMOTE_PROTOCOL_GSI_SSH);
+			List<String> arr=new ArrayList<String>();
+			ExportProperties exports = ((GsisshHostType) t).getExports();
+			if (exports!=null) {
+				Name[] nameArray = exports.getNameArray();
+				for (Name name : nameArray) {
+					arr.add(name.getStringValue() + "="
+							+ StringUtil.quoteString(name.getValue(), "="));
+				}
+			}
+			exportsTextField.setText(StringUtil.createDelimiteredString(arr.toArray(new String[]{})));
+			preJobCommandsTextField.setText(StringUtil.createDelimiteredString(((GsisshHostType) t).getPreJobCommandsArray()));
+			postJobCommandsTextField.setText(StringUtil.createDelimiteredString(((GsisshHostType) t).getPostJobCommandsArray()));
+		}
+		hostIdTextField.setEditable(isNewHost());
+		updateRemoteProtocolTypeAndControls();
+	}
+
+    public String getHostId() {
+        return getHostDescription().getType().getHostName();
+    }
+
+    public void setHostId(String hostId) {
+        getHostDescription().getType().setHostName(hostId);
+        updateDialogStatus();
+    }
+
+    public String getHostLocation() {
+        return getHostDescription().getType().getHostName();
+    }
+
+    public void setHostLocation(String hostLocation) {
+        getHostDescription().getType().setHostAddress(hostLocation);
+        updateDialogStatus();
+    }
+
+    private void validateDialog() throws Exception {
+        if (isNewHost()) {
+			String hostName = this.hostIdTextField.getText();
+			if (hostName == null
+					|| hostName.trim().equals("")) {
+				throw new Exception("Id of the host cannot be empty!!!");
+			}
+			HostDescription hostDescription2 = null;
+		    hostDescription2 = getRegistry().getApplicationManager().getHostDescription(hostName);
+			if (hostDescription2 != null) {
+				throw new Exception(
+						"Host descriptor with the given id already exists!!!");
+			}
+		}
+        String hostAddress = this.hostAddressTextField.getText();
+		if (hostAddress == null || hostAddress.trim().equals("")) {
+            throw new Exception("Host location/ip cannot be empty!!!");
+        }
+    }
+
+    private void updateDialogStatus() {
+        String message = null;
+        try {
+            validateDialog();
+        } catch (Exception e) {
+            message = e.getLocalizedMessage();
+        }
+        okButton.setEnabled(message == null);
+        setError(message);
+    }
+
+    private void setError(String errorMessage) {
+        if (errorMessage == null || errorMessage.trim().equals("")) {
+            lblError.setText("");
+        } else {
+            lblError.setText(errorMessage.trim());
+        }
+
+    }
+
+    public boolean isHostCreated() {
+        return hostCreated;
+    }
+
+    public void setHostCreated(boolean hostCreated) {
+        this.hostCreated = hostCreated;
+    }
+
+    public HostDescription getHostDescription() {
+        if (hostDescription == null) {
+            hostDescription = new HostDescription(GlobusHostType.type);
+        }
+        return hostDescription;
+    }
+
+    public void saveHostDescription() {
+        HostDescription desc = getHostDescription();
+        try {
+        	if (getRegistry().getApplicationManager().isHostDescriptorExists(desc.getType().getHostName())){
+        		getRegistry().getApplicationManager().updateHostDescriptor(desc);
+        	}else{
+        		getRegistry().getApplicationManager().addHostDescription(desc);
+        	}
+			setHostCreated(true);
+		}catch (DescriptorAlreadyExistsException e) {
+			// TODO Auto-generated catch block
+			e.printStackTrace();
+		}  catch (AiravataAPIInvocationException e) {
+			// TODO Auto-generated catch block
+			e.printStackTrace();
+
+		}
+    }
+
+    public AiravataAPI getRegistry() {
+        return registry;
+    }
+
+    public void setRegistry(AiravataAPI registry) {
+        this.registry = registry;
+    }
+    String previousProtocol=null;
+	private void updateRemoteProtocolTypeAndControls() {
+		String selectedProtocol=cmbResourceProtocol.getSelectedItem().toString();
+		if (previousProtocol==null || !previousProtocol.equals(selectedProtocol)){
+			infoPanel2.getContentPanel().removeAll();
+			if (selectedProtocol.equals(REMOTE_PROTOCOL_STR_LOCAL)){
+				getHostDescription().getType().changeType(HostDescriptionType.type);
+				infoPanel2.add(createPanelWithMessage("No configurations needed."));
+			}else if (selectedProtocol.equals(REMOTE_PROTOCOL_STR_SSH)){
+				getHostDescription().getType().changeType(SSHHostType.type);
+				infoPanel2.add(createSSHRemoteProtocolPanel());
+			}else if (selectedProtocol.equals(REMOTE_PROTOCOL_STR_GLOBUS)){
+				getHostDescription().getType().changeType(GlobusHostType.type);
+				infoPanel2.add(createGlobusRemoteProtocolPanel());
+			}else if (selectedProtocol.equals(REMOTE_PROTOCOL_STR_UNICORE)){
+				getHostDescription().getType().changeType(UnicoreHostType.type);
+				infoPanel2.add(createUnicoreRemoteProtocolPanel());
+			}else if (selectedProtocol.equals(REMOTE_PROTOCOL_STR_AMAZON_EC2)){
+				getHostDescription().getType().changeType(Ec2HostType.type);
+				infoPanel2.add(createPanelWithMessage("No configurations needed."));
+			}else if (selectedProtocol.equals(REMOTE_PROTOCOL_GSI_SSH)){
+				getHostDescription().getType().changeType(GsisshHostType.type);
+				infoPanel2.add(createGSISSHRemoteProtocolPanel());
+			}else{
+				infoPanel2.add(createPanelWithMessage("Not supported."));
+			}
+			infoPanel2.getContentPanel().setBorder(BorderFactory.createEtchedBorder());
+			infoPanel2.getContentPanel().updateUI();
+			infoPanel2.layout(1, 1,0,0);
+		}
+	}
+
+	public boolean isNewHost() {
+		return newHost;
+	}
+
+	public void setNewHost(boolean newHost) {
+		this.newHost = newHost;
+	}
+
+	public HostDescription getOriginalHostDescription() {
+		return originalHostDescription;
+	}
+
+	public void setOriginalHostDescription(HostDescription originalHostDescription) {
+		this.originalHostDescription = originalHostDescription;
+	}
+
+//	public XBayaEngine getEngine() {
+//		return engine;
+//	}
+//
+//	public void setEngine(XBayaEngine engine) {
+//		this.engine = engine;
+//	}
+}
\ No newline at end of file


Mime
View raw message