Return-Path: X-Original-To: apmail-airavata-commits-archive@www.apache.org Delivered-To: apmail-airavata-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 04453F2E3 for ; Fri, 22 Mar 2013 16:01:54 +0000 (UTC) Received: (qmail 63956 invoked by uid 500); 22 Mar 2013 16:01:53 -0000 Delivered-To: apmail-airavata-commits-archive@airavata.apache.org Received: (qmail 63918 invoked by uid 500); 22 Mar 2013 16:01:53 -0000 Mailing-List: contact commits-help@airavata.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@airavata.apache.org Delivered-To: mailing list commits@airavata.apache.org Received: (qmail 63910 invoked by uid 99); 22 Mar 2013 16:01:53 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 22 Mar 2013 16:01:53 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 22 Mar 2013 16:01:52 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id 824A12388847; Fri, 22 Mar 2013 16:01:32 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1459864 - /airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/menues/AmazonEC2MenuItem.java Date: Fri, 22 Mar 2013 16:01:32 -0000 To: commits@airavata.apache.org From: heshan@apache.org X-Mailer: svnmailer-1.0.8-patched Message-Id: <20130322160132.824A12388847@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: heshan Date: Fri Mar 22 16:01:32 2013 New Revision: 1459864 URL: http://svn.apache.org/r1459864 Log: AIRAVATA-775 Adding ec2 menu to XBaya. Added: airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/menues/AmazonEC2MenuItem.java Added: airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/menues/AmazonEC2MenuItem.java URL: http://svn.apache.org/viewvc/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/menues/AmazonEC2MenuItem.java?rev=1459864&view=auto ============================================================================== --- airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/menues/AmazonEC2MenuItem.java (added) +++ airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/menues/AmazonEC2MenuItem.java Fri Mar 22 16:01:32 2013 @@ -0,0 +1,139 @@ +package org.apache.airavata.xbaya.ui.menues; + +import org.apache.airavata.xbaya.XBayaEngine; +import org.apache.airavata.xbaya.ui.dialogs.amazon.AmazonEC2InvokerWindow; +import org.apache.airavata.xbaya.ui.dialogs.amazon.AmazonS3UtilsWindow; +import org.apache.airavata.xbaya.ui.dialogs.amazon.ChangeCredentialWindow; +import org.apache.airavata.xbaya.ui.dialogs.amazon.EC2InstancesManagementWindow; + +import javax.swing.*; +import java.awt.event.ActionEvent; + +public class AmazonEC2MenuItem { + + private JMenu amazonEC2Menu; + + private JMenuItem amazonAuthenticationItem; + + private JMenuItem amazonEC2ToolItem; + + private JMenuItem amazonS3ToolItem; + + private JMenuItem configAndDeploy; + + private XBayaEngine engine; + + /** + * Constructs a AmazonEC2MenuItem. + * + * @param engine XBaya engine + */ + public AmazonEC2MenuItem(XBayaEngine engine) { + this.engine = engine; + + createAmazonEC2Menu(); + } + + /** + * create menu + */ + private void createAmazonEC2Menu() { + createAmazonAuthenticationItem(); + createAmazonEC2ToolItem(); + createAmazonS3ToolItem(); + createConfigAndRunItem(); + + this.amazonEC2Menu = new JMenu("Amazon"); + + this.amazonEC2Menu.add(this.amazonAuthenticationItem); + this.amazonEC2Menu.addSeparator(); + this.amazonEC2Menu.add(this.amazonEC2ToolItem); + this.amazonEC2Menu.add(this.amazonS3ToolItem); + this.amazonEC2Menu.addSeparator(); + this.amazonEC2Menu.add(this.configAndDeploy); + } + + private void createAmazonAuthenticationItem() { + this.amazonAuthenticationItem = new JMenuItem("Security Credentials"); + this.amazonAuthenticationItem.addActionListener(new AbstractAction() { + private ChangeCredentialWindow window; + + @Override + public void actionPerformed(ActionEvent e) { + if (this.window == null) { + this.window = new ChangeCredentialWindow(AmazonEC2MenuItem.this.engine); + } + try { + this.window.show(); + } catch (Exception e1) { + AmazonEC2MenuItem.this.engine.getGUI().getErrorWindow().error(e1); + } + } + }); + } + + private void createAmazonEC2ToolItem(){ + this.amazonEC2ToolItem = new JMenuItem("EC2 Instances Management"); + this.amazonEC2ToolItem.addActionListener(new AbstractAction() { + private EC2InstancesManagementWindow window; + + @Override + public void actionPerformed(ActionEvent e) { + if (this.window == null) { + this.window = new EC2InstancesManagementWindow(AmazonEC2MenuItem.this.engine); + } + try { + this.window.show(); + } catch (Exception e1) { + AmazonEC2MenuItem.this.engine.getGUI().getErrorWindow().error(e1); + } + } + }); + } + + private void createAmazonS3ToolItem() { + this.amazonS3ToolItem = new JMenuItem("S3 Upload/Download Tool"); + this.amazonS3ToolItem.addActionListener(new AbstractAction() { + private AmazonS3UtilsWindow window; + + @Override + public void actionPerformed(ActionEvent e) { + if (this.window == null) { + this.window = AmazonS3UtilsWindow.getInstance(AmazonEC2MenuItem.this.engine); + } + try { + this.window.show(); + } catch (Exception e1) { + AmazonEC2MenuItem.this.engine.getGUI().getErrorWindow().error(e1); + } + } + }); + } + + private void createConfigAndRunItem() { + this.configAndDeploy = new JMenuItem("Config and Deploy Job Flow"); + this.configAndDeploy.addActionListener(new AbstractAction() { + private AmazonEC2InvokerWindow window; + + @Override + public void actionPerformed(ActionEvent e) { + if (this.window == null) { + this.window = new AmazonEC2InvokerWindow(AmazonEC2MenuItem.this.engine); + } + try { + this.window.show(); + } catch (Exception e1) { + AmazonEC2MenuItem.this.engine.getGUI().getErrorWindow().error(e1); + } + + } + }); + + } + + public JMenu getMenu() { + return this.amazonEC2Menu; + } + +} +