airavata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hes...@apache.org
Subject svn commit: r1462400 - /airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/dialogs/amazon/
Date Fri, 29 Mar 2013 04:58:39 GMT
Author: heshan
Date: Fri Mar 29 04:58:38 2013
New Revision: 1462400

URL: http://svn.apache.org/r1462400
Log:
AIRAVATA-803 Minor refactoring.

Modified:
    airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/dialogs/amazon/AmazonEC2InvokerWindow.java
    airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/dialogs/amazon/AmazonS3UtilsWindow.java
    airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/dialogs/amazon/BucketsLoader.java
    airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/dialogs/amazon/ChangeCredentialWindow.java
    airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/dialogs/amazon/EC2InstancesManagementWindow.java
    airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/dialogs/amazon/EC2LaunchWindow.java
    airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/dialogs/amazon/InstancesLoader.java
    airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/dialogs/amazon/S3Downloader.java
    airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/dialogs/amazon/S3Uploader.java

Modified: airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/dialogs/amazon/AmazonEC2InvokerWindow.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/dialogs/amazon/AmazonEC2InvokerWindow.java?rev=1462400&r1=1462399&r2=1462400&view=diff
==============================================================================
--- airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/dialogs/amazon/AmazonEC2InvokerWindow.java
(original)
+++ airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/dialogs/amazon/AmazonEC2InvokerWindow.java
Fri Mar 29 04:58:38 2013
@@ -21,14 +21,11 @@
 
 package org.apache.airavata.xbaya.ui.dialogs.amazon;
 
-import java.awt.event.ActionEvent;
-import java.rmi.RemoteException;
-
-import javax.swing.AbstractAction;
-import javax.swing.JButton;
-import javax.swing.JOptionPane;
-import javax.swing.JPanel;
-
+import edu.indiana.extreme.amazonec2webservice.AmazonEC2WebserviceCallbackHandler;
+import edu.indiana.extreme.amazonec2webservice.AmazonEC2WebserviceStub;
+import edu.indiana.extreme.amazonec2webservice.AmazonEC2WebserviceStub.JobStatusResponse;
+import edu.indiana.extreme.amazonec2webservice.AmazonEC2WebserviceStub.JobSubmissionReceipt;
+import edu.indiana.extreme.amazonec2webservice.AmazonEC2WebserviceStub.JobSubmitOperation;
 import org.apache.airavata.workflow.model.exceptions.WorkflowRuntimeException;
 import org.apache.airavata.xbaya.XBayaEngine;
 import org.apache.airavata.xbaya.ui.dialogs.XBayaDialog;
@@ -37,14 +34,11 @@ import org.apache.airavata.xbaya.ui.widg
 import org.apache.airavata.xbaya.ui.widgets.XBayaTextField;
 import org.apache.axis2.AxisFault;
 
-import edu.indiana.extreme.amazonec2webservice.AmazonEC2WebserviceCallbackHandler;
-import edu.indiana.extreme.amazonec2webservice.AmazonEC2WebserviceStub;
-import edu.indiana.extreme.amazonec2webservice.AmazonEC2WebserviceStub.JobStatusResponse;
-import edu.indiana.extreme.amazonec2webservice.AmazonEC2WebserviceStub.JobSubmissionReceipt;
-import edu.indiana.extreme.amazonec2webservice.AmazonEC2WebserviceStub.JobSubmitOperation;
+import javax.swing.*;
+import java.awt.event.ActionEvent;
+import java.rmi.RemoteException;
 
 public class AmazonEC2InvokerWindow {
-
     private XBayaEngine engine;
 
     private XBayaTextField accessKeyIDTextField;
@@ -57,7 +51,6 @@ public class AmazonEC2InvokerWindow {
     private XBayaTextField outputLocationOnS3TextField;
     private XBayaTextField jarFilePathOnS3TextField;
     private XBayaTextField mainClassNameTextField;
-    private JButton invokeButton;
     private XBayaDialog dialog;
 
     /**
@@ -140,8 +133,8 @@ public class AmazonEC2InvokerWindow {
         mainPanel.add(infoPanel);
         mainPanel.layout(1, 1, 0, 0);
 
-        this.invokeButton = new JButton("Invoke");
-        this.invokeButton.addActionListener(new AbstractAction() {
+        JButton invokeButton = new JButton("Invoke");
+        invokeButton.addActionListener(new AbstractAction() {
             public void actionPerformed(ActionEvent e) {
                 execute();
             }
@@ -156,7 +149,7 @@ public class AmazonEC2InvokerWindow {
         });
 
         JPanel buttonPanel = new JPanel();
-        buttonPanel.add(this.invokeButton);
+        buttonPanel.add(invokeButton);
         buttonPanel.add(cancelButton);
 
         this.dialog = new XBayaDialog(this.engine.getGUI(), "Deploy Workflow", mainPanel,
buttonPanel);
@@ -212,7 +205,7 @@ public class AmazonEC2InvokerWindow {
 
         @Override
         public void receiveErrorjobSubmitOperation(java.lang.Exception e) {
-            JOptionPane.showMessageDialog(null, "Job Sumit Failed!", "", JOptionPane.ERROR_MESSAGE);
+            JOptionPane.showMessageDialog(null, "Job Submit Failed!", "", JOptionPane.ERROR_MESSAGE);
         }
 
         @Override

Modified: airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/dialogs/amazon/AmazonS3UtilsWindow.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/dialogs/amazon/AmazonS3UtilsWindow.java?rev=1462400&r1=1462399&r2=1462400&view=diff
==============================================================================
--- airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/dialogs/amazon/AmazonS3UtilsWindow.java
(original)
+++ airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/dialogs/amazon/AmazonS3UtilsWindow.java
Fri Mar 29 04:58:38 2013
@@ -21,20 +21,6 @@
 
 package org.apache.airavata.xbaya.ui.dialogs.amazon;
 
-import java.awt.event.ActionEvent;
-import java.io.File;
-
-import javax.swing.AbstractAction;
-import javax.swing.BorderFactory;
-import javax.swing.JButton;
-import javax.swing.JFileChooser;
-import javax.swing.JOptionPane;
-import javax.swing.JPanel;
-import javax.swing.JScrollPane;
-import javax.swing.event.TreeSelectionEvent;
-import javax.swing.event.TreeSelectionListener;
-import javax.swing.tree.DefaultMutableTreeNode;
-
 import org.apache.airavata.xbaya.XBayaEngine;
 import org.apache.airavata.xbaya.core.amazon.AmazonCredential;
 import org.apache.airavata.xbaya.ui.dialogs.XBayaDialog;
@@ -47,8 +33,14 @@ import org.jets3t.service.S3ServiceExcep
 import org.jets3t.service.impl.rest.httpclient.RestS3Service;
 import org.jets3t.service.security.AWSCredentials;
 
-public class AmazonS3UtilsWindow {
+import javax.swing.*;
+import javax.swing.event.TreeSelectionEvent;
+import javax.swing.event.TreeSelectionListener;
+import javax.swing.tree.DefaultMutableTreeNode;
+import java.awt.event.ActionEvent;
+import java.io.File;
 
+public class AmazonS3UtilsWindow {
     private XBayaDialog dialog;
 
     private static XBayaEngine xBayaEngine;
@@ -65,8 +57,8 @@ public class AmazonS3UtilsWindow {
 
     /**
      * Constructs a AmazonS3UtilsWindow.
-     * 
-     * @param engine
+     *
+     * @param engine XBayaEngine
      */
     private AmazonS3UtilsWindow(XBayaEngine engine) {
         xBayaEngine = engine;
@@ -75,9 +67,8 @@ public class AmazonS3UtilsWindow {
 
     /**
      * getErrorWindow
-     * 
-     * @param engine
-     * @return AmazonS3UtilsWindow
+     *
+     * @param engine XBayaEngine
      */
     public static AmazonS3UtilsWindow getInstance(XBayaEngine engine) {
         if (window == null) {
@@ -90,7 +81,7 @@ public class AmazonS3UtilsWindow {
 
     /**
      * Get S3 Service
-     * 
+     *
      * @return S3Service
      */
     private S3Service getS3Service() {
@@ -105,11 +96,9 @@ public class AmazonS3UtilsWindow {
     }
 
     @SuppressWarnings("serial")
-	protected void initGUI() {
+    protected void initGUI() {
 
-        /*
-         * Upload Panel
-         */
+        /* Upload Panel */
         this.fileTextField = new XBayaTextField();
         XBayaLabel fileLabel = new XBayaLabel("Upload File Path", this.fileTextField);
 
@@ -124,11 +113,9 @@ public class AmazonS3UtilsWindow {
         uploadPanel.add(this.uploadBucketTextField);
         uploadPanel.layout(2, 2, GridPanel.WEIGHT_NONE, 1);
 
-        /*
-         * Download Panel
-         */if (AmazonCredential.getInstance().getAwsAccessKeyId().equals("AKIAI3GNMQVYA5LSQNEQ"))
{ // Avoid to use
-                                                                                        
           // default Aws
-                                                                                        
           // Access Key
+        /* Download Panel */
+        if (AmazonCredential.getInstance().getAwsAccessKeyId().equals("AKIAI3GNMQVYA5LSQNEQ"))
{
+            // Avoid to use default Aws Access Key
             JOptionPane.showMessageDialog(AmazonS3UtilsWindow.this.dialog.getDialog(), "Aws
Access Key not set!",
                     "Error", JOptionPane.ERROR_MESSAGE);
             return;
@@ -152,9 +139,7 @@ public class AmazonS3UtilsWindow {
         downloadPanel.add(this.folderTextField);
         downloadPanel.layout(3, 2, GridPanel.WEIGHT_NONE, 1);
 
-        /*
-         * Button Panel
-         */
+        /* Button Panel */
         JButton refreshButton = new JButton("Connect/Refresh");
         refreshButton.addActionListener(new AbstractAction() {
 
@@ -266,9 +251,7 @@ public class AmazonS3UtilsWindow {
         buttonPanel.add(fileButton);
         buttonPanel.add(cancelButton);
 
-        /*
-         * Main Panel
-         */
+        /* Main Panel */
         GridPanel mainPanel = new GridPanel(true);
         this.s3Tree = new S3Tree();
         mainPanel.add(new JScrollPane(this.s3Tree));
@@ -285,7 +268,7 @@ public class AmazonS3UtilsWindow {
                     return;
 
                 Object nodeInfo = node.getUserObject();
-                String bucketName = "";
+                String bucketName;
                 String downloadPanelBucketName = "";
                 if (node.isLeaf() && node.getParent() != null) { // Node is probably
a key
                     DefaultMutableTreeNode parentNode = (DefaultMutableTreeNode) node.getParent();
@@ -319,16 +302,10 @@ public class AmazonS3UtilsWindow {
 
     }
 
-    /**
-	 * 
-	 */
     public void hide() {
         this.dialog.hide();
     }
 
-    /**
-	 * 
-	 */
     public void show() {
         this.dialog.show();
     }

Modified: airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/dialogs/amazon/BucketsLoader.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/dialogs/amazon/BucketsLoader.java?rev=1462400&r1=1462399&r2=1462400&view=diff
==============================================================================
--- airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/dialogs/amazon/BucketsLoader.java
(original)
+++ airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/dialogs/amazon/BucketsLoader.java
Fri Mar 29 04:58:38 2013
@@ -21,10 +21,6 @@
 
 package org.apache.airavata.xbaya.ui.dialogs.amazon;
 
-import javax.swing.JDialog;
-import javax.swing.JOptionPane;
-import javax.swing.tree.DefaultMutableTreeNode;
-
 import org.apache.airavata.xbaya.ui.XBayaGUI;
 import org.apache.airavata.xbaya.ui.dialogs.WaitDialog;
 import org.apache.airavata.xbaya.ui.utils.Cancelable;
@@ -35,8 +31,10 @@ import org.jets3t.service.S3ServiceExcep
 import org.jets3t.service.model.S3Bucket;
 import org.jets3t.service.model.S3Object;
 
-public class BucketsLoader implements Cancelable {
+import javax.swing.*;
+import javax.swing.tree.DefaultMutableTreeNode;
 
+public class BucketsLoader implements Cancelable {
     private XBayaGUI xbayaGUI;
     private JDialog parent;
 
@@ -46,9 +44,9 @@ public class BucketsLoader implements Ca
 
     /**
      * Constructs a BucketsLoader.
-     * 
-     * @param engine
-     * @param parent
+     *
+     * @param xbayaGUI XBayaGUI
+     * @param parent JDialog
      */
     public BucketsLoader(XBayaGUI xbayaGUI, JDialog parent) {
         this.xbayaGUI=xbayaGUI;
@@ -67,8 +65,8 @@ public class BucketsLoader implements Ca
 
     /**
      * 
-     * @param s3
-     * @param s3Tree
+     * @param s3 S3Service
+     * @param s3Tree S3Tree
      */
     public void load(final S3Service s3, final S3Tree s3Tree) {
 
@@ -76,7 +74,7 @@ public class BucketsLoader implements Ca
 
             @Override
             public void run() {
-                S3Bucket[] bucketArray = null;
+                S3Bucket[] bucketArray;
                 try {
                     bucketArray = s3.listAllBuckets();
                     for (S3Bucket s3Bucket : bucketArray) {
@@ -98,7 +96,7 @@ public class BucketsLoader implements Ca
 
                     s3Tree.refresh();
 
-                    if (bucketArray == null || bucketArray.length == 0) {
+                    if (bucketArray.length == 0) {
                         JOptionPane.showMessageDialog(BucketsLoader.this.parent, "Connection
Failed!", "Error",
                                 JOptionPane.ERROR_MESSAGE);
                         return;

Modified: airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/dialogs/amazon/ChangeCredentialWindow.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/dialogs/amazon/ChangeCredentialWindow.java?rev=1462400&r1=1462399&r2=1462400&view=diff
==============================================================================
--- airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/dialogs/amazon/ChangeCredentialWindow.java
(original)
+++ airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/dialogs/amazon/ChangeCredentialWindow.java
Fri Mar 29 04:58:38 2013
@@ -41,22 +41,16 @@ public class ChangeCredentialWindow {
 
     /**
      * Constructs a ChangeCredentialWindow.
-     * 
-     * @param owner
+     *
+     * @param engine XBayaEngine
      */
-    public ChangeCredentialWindow(JDialog owner) {
-        this.owner = owner;
+    public ChangeCredentialWindow(XBayaEngine engine) {
+        this.engine = engine;
         initGUI();
     }
 
-    /**
-     * 
-     * Constructs a ChangeCredentialWindow.
-     * 
-     * @param engine
-     */
-    public ChangeCredentialWindow(XBayaEngine engine) {
-        this.engine = engine;
+    public ChangeCredentialWindow(JDialog owner) {
+        this.owner = owner;
         initGUI();
     }
 
@@ -115,9 +109,9 @@ public class ChangeCredentialWindow {
         buttonPanel.add(cancelButton);
 
         if (this.owner == null) {
-            this.dialog = new XBayaDialog(this.engine.getGUI(), "S3 Toolkits", mainPanel,
buttonPanel);
+            this.dialog = new XBayaDialog(this.engine.getGUI(), "S3 Tool-kits", mainPanel,
buttonPanel);
         } else {
-            this.dialog = new XBayaDialog(this.owner, "S3 Toolkits", mainPanel, buttonPanel);
+            this.dialog = new XBayaDialog(this.owner, "S3 Tool-kits", mainPanel, buttonPanel);
         }
     }
 

Modified: airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/dialogs/amazon/EC2InstancesManagementWindow.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/dialogs/amazon/EC2InstancesManagementWindow.java?rev=1462400&r1=1462399&r2=1462400&view=diff
==============================================================================
--- airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/dialogs/amazon/EC2InstancesManagementWindow.java
(original)
+++ airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/dialogs/amazon/EC2InstancesManagementWindow.java
Fri Mar 29 04:58:38 2013
@@ -21,18 +21,6 @@
 
 package org.apache.airavata.xbaya.ui.dialogs.amazon;
 
-import java.awt.Dimension;
-import java.awt.event.ActionEvent;
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.swing.AbstractAction;
-import javax.swing.JButton;
-import javax.swing.JOptionPane;
-import javax.swing.JPanel;
-import javax.swing.border.EtchedBorder;
-import javax.swing.border.TitledBorder;
-
 import org.apache.airavata.xbaya.XBayaEngine;
 import org.apache.airavata.xbaya.core.amazon.AmazonCredential;
 import org.apache.airavata.xbaya.core.amazon.EC2InstanceResult;
@@ -41,39 +29,34 @@ import org.apache.airavata.xbaya.ui.widg
 import org.apache.airavata.xbaya.ui.widgets.XbayaEnhancedList;
 import org.apache.airavata.xbaya.util.AmazonUtil;
 
-public class EC2InstancesManagementWindow {
-
-    private static int WIDTH = 800;
-    private static int HEIGHT = 500;
+import javax.swing.*;
+import javax.swing.border.EtchedBorder;
+import javax.swing.border.TitledBorder;
+import java.awt.*;
+import java.awt.event.ActionEvent;
+import java.util.ArrayList;
+import java.util.List;
 
+public class EC2InstancesManagementWindow {
     private XBayaEngine engine;
     private XBayaDialog dialog;
-
     private XbayaEnhancedList<EC2InstanceResult> list;
-
     private ChangeCredentialWindow credentialWindow;
 
     /**
-     * 
      * Constructs a EC2InstancesManagementWindow.
      * 
-     * @param engine
+     * @param engine XBayaEngine
      */
     public EC2InstancesManagementWindow(XBayaEngine engine) {
         this.engine = engine;
         initGUI();
     }
 
-    /**
-	 * 
-	 */
     public void show() {
         this.dialog.show();
     }
 
-    /**
-	 * 
-	 */
     public void hide() {
         this.dialog.hide();
     }
@@ -87,18 +70,14 @@ public class EC2InstancesManagementWindo
         mainPanel.add(this.list);
         mainPanel.layout(1, 1, 0, 0);
 
-        /*
-         * Connect/Refresh Button
-         */
+        /* Connect/Refresh Button */
         JButton refreshButton = new JButton("Refresh");
         refreshButton.addActionListener(new AbstractAction() {
 
             @Override
             public void actionPerformed(ActionEvent e) {
 
-                /*
-                 * Check if Credential is already set or not
-                 */
+                /* Check if Credential is already set or not */
                 if (credentialSet()) {
                     InstancesLoader instancesLoader = new InstancesLoader(EC2InstancesManagementWindow.this.engine,
                             EC2InstancesManagementWindow.this.dialog.getDialog());
@@ -107,9 +86,7 @@ public class EC2InstancesManagementWindo
             }
         });
 
-        /*
-         * Launch Instance Button
-         */
+        /* Launch Instance Button */
         JButton launchButton = new JButton("Launch");
         launchButton.addActionListener(new AbstractAction() {
 
@@ -122,9 +99,7 @@ public class EC2InstancesManagementWindo
             }
         });
 
-        /*
-         * Terminate Instance
-         */
+        /* Terminate Instance */
         JButton terminateButton = new JButton("Terminate");
         terminateButton.addActionListener(new AbstractAction() {
 
@@ -163,9 +138,7 @@ public class EC2InstancesManagementWindo
             }
         });
 
-        /*
-         * Close Button
-         */
+        /* Close Button */
         JButton closeButton = new JButton("Close");
         closeButton.addActionListener(new AbstractAction() {
 
@@ -181,8 +154,10 @@ public class EC2InstancesManagementWindo
         buttonPanel.add(terminateButton);
         buttonPanel.add(closeButton);
 
-        this.dialog = new XBayaDialog(this.engine.getGUI(), "Amazon EC2 Managment Console",
mainPanel, buttonPanel);
-        this.dialog.getDialog().setPreferredSize(new Dimension(WIDTH, HEIGHT));
+        this.dialog = new XBayaDialog(this.engine.getGUI(), "Amazon EC2 Management Console",
mainPanel, buttonPanel);
+        int width = 800;
+        int height = 500;
+        this.dialog.getDialog().setPreferredSize(new Dimension(width, height));
         this.dialog.setDefaultButton(closeButton);
 
     }

Modified: airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/dialogs/amazon/EC2LaunchWindow.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/dialogs/amazon/EC2LaunchWindow.java?rev=1462400&r1=1462399&r2=1462400&view=diff
==============================================================================
--- airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/dialogs/amazon/EC2LaunchWindow.java
(original)
+++ airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/dialogs/amazon/EC2LaunchWindow.java
Fri Mar 29 04:58:38 2013
@@ -21,19 +21,6 @@
 
 package org.apache.airavata.xbaya.ui.dialogs.amazon;
 
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-
-import javax.swing.AbstractAction;
-import javax.swing.ButtonGroup;
-import javax.swing.ComboBoxModel;
-import javax.swing.DefaultComboBoxModel;
-import javax.swing.JButton;
-import javax.swing.JPanel;
-import javax.swing.JRadioButton;
-import javax.swing.JSpinner;
-import javax.swing.SpinnerNumberModel;
-
 import org.apache.airavata.xbaya.XBayaEngine;
 import org.apache.airavata.xbaya.ui.dialogs.XBayaDialog;
 import org.apache.airavata.xbaya.ui.widgets.GridPanel;
@@ -42,26 +29,24 @@ import org.apache.airavata.xbaya.ui.widg
 import org.apache.airavata.xbaya.ui.widgets.XBayaTextField;
 import org.apache.airavata.xbaya.util.AmazonUtil;
 
-public class EC2LaunchWindow {
+import javax.swing.*;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
 
+public class EC2LaunchWindow {
     private XBayaEngine engine;
     private XBayaDialog dialog;
-
     private XBayaTextField amiTextField;
     private JSpinner numberOfInstanceSpinner;
     private XBayaComboBox instanceTypeComboBox;
     private XBayaComboBox keyComboBox;
     private JRadioButton existKeyButton;
-    private JRadioButton noKeyButton;
-
     private ComboBoxModel keyComboBoxModel;
 
     /**
-     * 
      * Constructs a EC2LaunchWindow.
      * 
-     * @param engine
-     * @param ec2
+     * @param engine XBayaEngine
      */
     public EC2LaunchWindow(XBayaEngine engine) {
         this.engine = engine;
@@ -69,9 +54,7 @@ public class EC2LaunchWindow {
     }
 
     private void initGUI() {
-        /*
-         * Main Panel
-         */
+        /* Main Panel */
         this.amiTextField = new XBayaTextField();
         XBayaLabel amiLabel = new XBayaLabel("AMI ID", this.amiTextField);
 
@@ -82,9 +65,9 @@ public class EC2LaunchWindow {
         this.instanceTypeComboBox.setSelectedItem(AmazonUtil.INSTANCE_TYPE[1]);
         XBayaLabel instanceTypeLabel = new XBayaLabel("Instance Type", this.instanceTypeComboBox);
 
-        this.noKeyButton = new JRadioButton("No Key Pair");
-        this.noKeyButton.setSelected(true);
-        this.noKeyButton.addActionListener(new ActionListener() {
+        JRadioButton noKeyButton = new JRadioButton("No Key Pair");
+        noKeyButton.setSelected(true);
+        noKeyButton.addActionListener(new ActionListener() {
             @Override
             public void actionPerformed(ActionEvent paramActionEvent) {
                 EC2LaunchWindow.this.keyComboBox.getJComboBox().setEnabled(false);
@@ -106,14 +89,14 @@ public class EC2LaunchWindow {
         });
 
         ButtonGroup serviceTypeButtonGroup = new ButtonGroup();
-        serviceTypeButtonGroup.add(this.noKeyButton);
+        serviceTypeButtonGroup.add(noKeyButton);
         serviceTypeButtonGroup.add(this.existKeyButton);
 
         this.keyComboBox = new XBayaComboBox(new DefaultComboBoxModel());
         this.keyComboBox.getJComboBox().setEnabled(false);
 
         GridPanel radioPanel = new GridPanel();
-        radioPanel.add(this.noKeyButton);
+        radioPanel.add(noKeyButton);
         radioPanel.add(new JPanel());
         radioPanel.add(this.existKeyButton);
         radioPanel.add(this.keyComboBox);
@@ -132,19 +115,16 @@ public class EC2LaunchWindow {
         mainPanel.add(radioPanel);
         mainPanel.layout(4, 2, 0, GridPanel.WEIGHT_EQUALLY);
 
-        /*
-         * Button Panel
-         */
+        /* Button Panel */
         JButton lunchButton = new JButton("Launch");
         lunchButton.addActionListener(new AbstractAction() {
-            private Object numberOfInstanceSpinner;
 
             @Override
             public void actionPerformed(ActionEvent e) {
                 // validation
                 if (EC2LaunchWindow.this.amiTextField.getText() == null
                         || EC2LaunchWindow.this.amiTextField.getText().isEmpty()
-                        || ((Integer) EC2LaunchWindow.this.numberOfInstanceSpinner.getValue()).intValue()
<= 0) {
+                        || (Integer) EC2LaunchWindow.this.numberOfInstanceSpinner.getValue()
<= 0) {
                     EC2LaunchWindow.this.engine.getGUI().getErrorWindow().info(EC2LaunchWindow.this.dialog.getDialog(),
                             "Warning", "Please input all fields");
                     return;
@@ -191,16 +171,10 @@ public class EC2LaunchWindow {
         this.dialog = new XBayaDialog(this.engine.getGUI(), "Amazon EC2 Launcher", mainPanel,
buttonPanel);
     }
 
-    /**
-	 * 
-	 */
     public void hide() {
         this.dialog.hide();
     }
 
-    /**
-	 * 
-	 */
     public void show() {
         this.dialog.show();
     }

Modified: airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/dialogs/amazon/InstancesLoader.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/dialogs/amazon/InstancesLoader.java?rev=1462400&r1=1462399&r2=1462400&view=diff
==============================================================================
--- airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/dialogs/amazon/InstancesLoader.java
(original)
+++ airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/dialogs/amazon/InstancesLoader.java
Fri Mar 29 04:58:38 2013
@@ -21,11 +21,9 @@
 
 package org.apache.airavata.xbaya.ui.dialogs.amazon;
 
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.swing.JDialog;
-
+import com.amazonaws.AmazonClientException;
+import com.amazonaws.AmazonServiceException;
+import com.amazonaws.services.ec2.model.Instance;
 import org.apache.airavata.xbaya.XBayaEngine;
 import org.apache.airavata.xbaya.core.amazon.EC2InstanceResult;
 import org.apache.airavata.xbaya.ui.dialogs.WaitDialog;
@@ -33,12 +31,11 @@ import org.apache.airavata.xbaya.ui.util
 import org.apache.airavata.xbaya.ui.widgets.XbayaEnhancedList;
 import org.apache.airavata.xbaya.util.AmazonUtil;
 
-import com.amazonaws.AmazonClientException;
-import com.amazonaws.AmazonServiceException;
-import com.amazonaws.services.ec2.model.Instance;
+import javax.swing.*;
+import java.util.ArrayList;
+import java.util.List;
 
 public class InstancesLoader implements Cancelable {
-
     private XBayaEngine engine;
     private JDialog parent;
 
@@ -47,11 +44,10 @@ public class InstancesLoader implements 
     private WaitDialog loadingDialog;
 
     /**
-     * 
      * Constructs a InstancesLoader.
      * 
-     * @param engine
-     * @param parent
+     * @param engine XBayaEngine
+     * @param parent JDialog
      */
     public InstancesLoader(XBayaEngine engine, JDialog parent) {
         this.engine = engine;
@@ -69,8 +65,9 @@ public class InstancesLoader implements 
     }
 
     /**
-     * 
-     * @param list
+     * Load instance list.
+     *
+     * @param list instance list
      */
     public void load(final XbayaEnhancedList<EC2InstanceResult> list) {
 

Modified: airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/dialogs/amazon/S3Downloader.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/dialogs/amazon/S3Downloader.java?rev=1462400&r1=1462399&r2=1462400&view=diff
==============================================================================
--- airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/dialogs/amazon/S3Downloader.java
(original)
+++ airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/dialogs/amazon/S3Downloader.java
Fri Mar 29 04:58:38 2013
@@ -21,21 +21,15 @@
 
 package org.apache.airavata.xbaya.ui.dialogs.amazon;
 
-import java.io.BufferedReader;
-import java.io.BufferedWriter;
-import java.io.File;
-import java.io.FileWriter;
-import java.io.IOException;
-import java.io.InputStreamReader;
-
-import javax.swing.JDialog;
-
 import org.apache.airavata.xbaya.XBayaEngine;
 import org.apache.airavata.xbaya.ui.dialogs.WaitDialog;
 import org.apache.airavata.xbaya.ui.utils.Cancelable;
 import org.jets3t.service.S3Service;
 import org.jets3t.service.model.S3Object;
 
+import javax.swing.*;
+import java.io.*;
+
 public class S3Downloader implements Cancelable {
 
     private XBayaEngine engine;
@@ -48,8 +42,8 @@ public class S3Downloader implements Can
     /**
      * Constructs a S3Downloader.
      * 
-     * @param engine
-     * @param parent
+     * @param engine XBayaEngine
+     * @param parent JDialog
      */
     public S3Downloader(XBayaEngine engine, JDialog parent) {
         this.engine = engine;
@@ -67,11 +61,12 @@ public class S3Downloader implements Can
     }
 
     /**
-     * 
-     * @param s3
-     * @param bucket
-     * @param key
-     * @param directory
+     * Download bucket.
+     *
+     * @param s3 S3Service
+     * @param bucket bucket
+     * @param key Key
+     * @param directory directory
      */
     public void download(final S3Service s3, final String bucket, final String key, final
String directory) {
 
@@ -86,10 +81,12 @@ public class S3Downloader implements Can
                     S3Object s3Object = s3.getObject(bucket, key);
 
                     File fileOut = new File(directory + File.separator + s3Object.getKey());
-                    if (!fileOut.getParentFile().exists())
+                    if (!fileOut.getParentFile().exists()) {
                         fileOut.getParentFile().mkdirs();
-                    if (!fileOut.exists())
+                    }
+                    if (!fileOut.exists()) {
                         fileOut.createNewFile();
+                    }
 
                     out = new BufferedWriter(new FileWriter(fileOut));
                     in = new BufferedReader(new InputStreamReader(s3Object.getDataInputStream()));

Modified: airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/dialogs/amazon/S3Uploader.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/dialogs/amazon/S3Uploader.java?rev=1462400&r1=1462399&r2=1462400&view=diff
==============================================================================
--- airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/dialogs/amazon/S3Uploader.java
(original)
+++ airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/dialogs/amazon/S3Uploader.java
Fri Mar 29 04:58:38 2013
@@ -21,10 +21,6 @@
 
 package org.apache.airavata.xbaya.ui.dialogs.amazon;
 
-import java.io.File;
-
-import javax.swing.JDialog;
-
 import org.apache.airavata.xbaya.XBayaEngine;
 import org.apache.airavata.xbaya.ui.dialogs.WaitDialog;
 import org.apache.airavata.xbaya.ui.utils.Cancelable;
@@ -32,6 +28,9 @@ import org.apache.airavata.xbaya.ui.widg
 import org.jets3t.service.S3Service;
 import org.jets3t.service.model.S3Object;
 
+import javax.swing.*;
+import java.io.File;
+
 public class S3Uploader implements Cancelable {
     private XBayaEngine engine;
     private JDialog parent;
@@ -43,8 +42,8 @@ public class S3Uploader implements Cance
     /**
      * Constructs a S3Uploader.
      * 
-     * @param engine
-     * @param parent
+     * @param engine XBayaEngine
+     * @param parent JDialog
      */
     public S3Uploader(XBayaEngine engine, JDialog parent) {
         this.engine = engine;
@@ -62,11 +61,12 @@ public class S3Uploader implements Cance
     }
 
     /**
-     * 
-     * @param s3
-     * @param s3tree
-     * @param bucket
-     * @param filePath
+     * Upload bucket.
+     *
+     * @param s3 S3Service
+     * @param s3tree S3Tree
+     * @param bucket bucket
+     * @param filePath file path
      */
     public void upload(final S3Service s3, final S3Tree s3tree, final String bucket, final
String filePath) {
 
@@ -97,11 +97,10 @@ public class S3Uploader implements Cance
                                 "Uploaded successfully!");
 
                         // add key to S3Tree
-                        String uploadString = bucket;
-                        int startIndex = uploadString.lastIndexOf('/');
+                        int startIndex = bucket.lastIndexOf('/');
                         startIndex = startIndex >= 0 ? startIndex : 0;
                         if (startIndex != 0) {
-                            fileName = uploadString.substring(startIndex) + '/' + fileName;
+                            fileName = bucket.substring(startIndex) + '/' + fileName;
                         }
 
                         if (fileName.startsWith("/")) {



Mime
View raw message