Example usage for com.amazonaws.services.glacier.model CreateVaultResult CreateVaultResult

List of usage examples for com.amazonaws.services.glacier.model CreateVaultResult CreateVaultResult

Introduction

In this page you can find the example usage for com.amazonaws.services.glacier.model CreateVaultResult CreateVaultResult.

Prototype

CreateVaultResult

Source Link

Usage

From source file:com.brianmcmichael.sagu.AddVaultFrame.java

License:Open Source License

@Override
public void actionPerformed(ActionEvent e) {
    if (e.getSource() == jbtAdd) {
        if ((jtfAddField.getText().trim().equals(""))) {
            JOptionPane.showMessageDialog(null, "Enter the name of the vault to add.", "Error",
                    JOptionPane.ERROR_MESSAGE);
        } else {/*from  w  ww .  j  ava2 s.  c  om*/

            try {
                String vaultToAdd = jtfAddField.getText().trim();

                //TODO Limit to valid chars

                // Add the archive.

                CreateVaultRequest cvreq = new CreateVaultRequest(vaultToAdd);

                CreateVaultResult cvres = new CreateVaultResult();
                cvres = addClient.createVault(cvreq);

                JOptionPane.showMessageDialog(null, "Added vault successfully.", "Success",
                        JOptionPane.INFORMATION_MESSAGE);
                this.dispose();

            } catch (AmazonServiceException k) {
                JOptionPane.showMessageDialog(null, "The server returned an error.", "Error",
                        JOptionPane.ERROR_MESSAGE);
            } catch (AmazonClientException i) {
                JOptionPane.showMessageDialog(null,
                        "Client Error. Check that all fields are correct. Archive not deleted.", "Error",
                        JOptionPane.ERROR_MESSAGE);

            } catch (Exception j) {
                JOptionPane.showMessageDialog(null, "Vault not Added. Unspecified Error.", "Error",
                        JOptionPane.ERROR_MESSAGE);
            }

            jtfAddField.setText("");
            jtfAddField.requestFocus();
        }

    } else if (e.getSource() == jbtBack) {
        this.setVisible(false);
        dispose();
    } else {
        JOptionPane.showMessageDialog(this, "Please choose a valid action.");
    }

}

From source file:com.brianmcmichael.SimpleGlacierUploader.AddVaultFrame.java

License:Open Source License

@Override
public void actionPerformed(ActionEvent e) {
    if (e.getSource() == jbtAdd) {
        if ((jtfAddField.getText().trim().equals(""))) {
            JOptionPane.showMessageDialog(null, "Enter the name of the vault to add.", "Error",
                    JOptionPane.ERROR_MESSAGE);
        } else {/*from   w  w  w .j a va2s.  c o  m*/

            try {
                String vaultToAdd = jtfAddField.getText().trim();

                //TODO Limit to valid chars

                // Add the archive.                  

                CreateVaultRequest cvreq = new CreateVaultRequest(vaultToAdd);

                CreateVaultResult cvres = new CreateVaultResult();
                cvres = addClient.createVault(cvreq);

                JOptionPane.showMessageDialog(null, "Added vault successfully.", "Success",
                        JOptionPane.INFORMATION_MESSAGE);
                this.dispose();

            } catch (AmazonServiceException k) {
                JOptionPane.showMessageDialog(null, "The server returned an error.", "Error",
                        JOptionPane.ERROR_MESSAGE);
            } catch (AmazonClientException i) {
                JOptionPane.showMessageDialog(null,
                        "Client Error. Check that all fields are correct. Archive not deleted.", "Error",
                        JOptionPane.ERROR_MESSAGE);

            } catch (Exception j) {
                JOptionPane.showMessageDialog(null, "Vault not Added. Unspecified Error.", "Error",
                        JOptionPane.ERROR_MESSAGE);
            }

            jtfAddField.setText("");
            jtfAddField.requestFocus();
        }

    } else if (e.getSource() == jbtBack) {
        this.setVisible(false);
        dispose();
    } else {
        JOptionPane.showMessageDialog(this, "Please choose a valid action.");
    }

}