Search in sources :

Example 1 with CreateVaultResult

use of com.amazonaws.services.glacier.model.CreateVaultResult in project SAGU by brianmcmichael.

the class AddVaultFrame method actionPerformed.

@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 {
            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.");
    }
}
Also used : CreateVaultRequest(com.amazonaws.services.glacier.model.CreateVaultRequest) AmazonClientException(com.amazonaws.AmazonClientException) AmazonServiceException(com.amazonaws.AmazonServiceException) AmazonServiceException(com.amazonaws.AmazonServiceException) AmazonClientException(com.amazonaws.AmazonClientException) CreateVaultResult(com.amazonaws.services.glacier.model.CreateVaultResult)

Aggregations

AmazonClientException (com.amazonaws.AmazonClientException)1 AmazonServiceException (com.amazonaws.AmazonServiceException)1 CreateVaultRequest (com.amazonaws.services.glacier.model.CreateVaultRequest)1 CreateVaultResult (com.amazonaws.services.glacier.model.CreateVaultResult)1