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

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

Introduction

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

Prototype

@Override
public String toString() 

Source Link

Document

Returns a string representation of this object.

Usage

From source file:com.brianmcmichael.sagu.ui.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 ava2s.  c o  m

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

                //TODO Limit to valid chars

                // Add the archive.

                CreateVaultRequest cvreq = new CreateVaultRequest(vaultToAdd);

                CreateVaultResult cvres = addClient.createVault(cvreq);

                JOptionPane.showMessageDialog(null, "Added vault " + cvres.toString() + " 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 added.", "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.");
    }

}