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.");
}
}
Aggregations