airavata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lah...@apache.org
Subject svn commit: r1384544 - /incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/dialogs/descriptors/DeploymentDescriptionDialog.java
Date Thu, 13 Sep 2012 21:24:31 GMT
Author: lahiru
Date: Thu Sep 13 21:24:31 2012
New Revision: 1384544

URL: http://svn.apache.org/viewvc?rev=1384544&view=rev
Log:
fixing gui issues when updating descriptors.

Modified:
    incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/dialogs/descriptors/DeploymentDescriptionDialog.java

Modified: incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/dialogs/descriptors/DeploymentDescriptionDialog.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/dialogs/descriptors/DeploymentDescriptionDialog.java?rev=1384544&r1=1384543&r2=1384544&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/dialogs/descriptors/DeploymentDescriptionDialog.java
(original)
+++ incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/dialogs/descriptors/DeploymentDescriptionDialog.java
Thu Sep 13 21:24:31 2012
@@ -243,7 +243,11 @@ public class DeploymentDescriptionDialog
                 okButton.addActionListener(new ActionListener() {
                     public void actionPerformed(ActionEvent e) {
                         try {
-							saveServiceDescription();
+                            if ("Register".equals(okButton.getText())) {
+                                saveServiceDescription(false);
+                            } else {
+                                saveServiceDescription(true);
+                            }
 							close();
 						} catch (RegistryException e1) {
 							e1.printStackTrace();
@@ -621,6 +625,56 @@ public class DeploymentDescriptionDialog
         }
     }
 
+    public void saveServiceDescription(boolean update) throws RegistryException {
+        List<InputParameterType> inputParameters = new ArrayList<InputParameterType>();
+        List<OutputParameterType> outputParameters = new ArrayList<OutputParameterType>();
+
+        for (int i = 0; i < defaultTableModel.getRowCount(); i++) {
+            String parameterName = (String) defaultTableModel.getValueAt(i, 1);
+            String paramType = (String) defaultTableModel.getValueAt(i, 2);
+            String parameterDescription = (String) defaultTableModel.getValueAt(i, 3);
+            if (parameterName != null && !parameterName.trim().equals("")) {
+                // todo how to handle Enum
+                if (getIOStringList()[0].equals(defaultTableModel.getValueAt(i, 0))) {
+                    InputParameterType parameter = InputParameterType.Factory.newInstance();
+                    parameter.setParameterName(parameterName);
+                    parameter.setParameterDescription(parameterDescription);
+                    ParameterType parameterType = parameter.addNewParameterType();
+                    parameterType.setType(DataType.Enum.forString(paramType));
+                    parameterType.setName(paramType);
+                    inputParameters.add(parameter);
+
+                } else {
+                    OutputParameterType parameter = OutputParameterType.Factory.newInstance();
+                    parameter.setParameterName(parameterName);
+                    parameter.setParameterDescription(parameterDescription);
+                    ParameterType parameterType = parameter.addNewParameterType();
+                    parameterType.setType(DataType.Enum.forString(paramType));
+                    parameterType.setName(paramType);
+                    outputParameters.add(parameter);
+                }
+            }
+        }
+        getServiceDescriptionType().setInputParametersArray(inputParameters.toArray(new InputParameterType[]
{}));
+        getServiceDescriptionType().setOutputParametersArray(outputParameters.toArray(new
OutputParameterType[] {}));
+        if (update) {
+            getRegistry().updateServiceDescriptor(getServiceDescription());
+        } else {
+            getRegistry().addServiceDescriptor(getServiceDescription());
+        }
+        if (!isNewDescription()) {
+            Map<String, ApplicationDeploymentDescription> descs = getRegistry().getApplicationDescriptors(getServiceName());
+            for (String hostDescName : descs.keySet()) {
+                getRegistry().removeApplicationDescriptor(getServiceName(), hostDescName,
descs.get(hostDescName).getType().getApplicationName().getStringValue());
+            }
+        }
+        for (String hostName : getDeployments().keySet()) {
+            getRegistry().addApplicationDescriptor(getServiceName(), hostName, getDeployments().get(hostName).getApplicationDescription());
+        }
+        setServiceCreated(true);
+        JOptionPane.showMessageDialog(this, "Application '" + getServiceName() + "' is registered
Successfully !");
+    }
+
     public void saveServiceDescription() throws RegistryException {
         List<InputParameterType> inputParameters = new ArrayList<InputParameterType>();
         List<OutputParameterType> outputParameters = new ArrayList<OutputParameterType>();
@@ -666,7 +720,6 @@ public class DeploymentDescriptionDialog
         setServiceCreated(true);
         JOptionPane.showMessageDialog(this, "Application '" + getServiceName() + "' is registered
Successfully !");
     }
-
     public void close() {
         getDialog().setVisible(false);
     }



Mime
View raw message