private Matcher<S3Bucket> bucketName(final String expected) { return new FeatureMatcher<S3Bucket, String>(equalTo(expected), "bucket called", "name") { String featureValueOf(S3Bucket actual) { return actual.getName(); } }; }
@Override protected StorageBucket newBucket() { return new S3Bucket(); }
@Override public String toString() { return "S3Bucket [name=" + getName() + ",location=" + getLocation() + ",creationDate=" + getCreationDate() + ",owner=" + getOwner() + "] Metadata=" + getMetadataMap(); }
public void run() { try { s3ServiceMulti.getS3Service().setRequesterPaysBucket( selectedBucket.getName(), newRequesterPaysFlag); selectedBucket.setRequesterPays(newRequesterPaysFlag); } catch (final Exception e) { String message = "Unable to update Requester Pays status"; log.error(message, e); ErrorDialog.showDialog(ownerFrame, null, message, e); } } });
public void run() { startProgressDialog("Retrieving details for bucket " + selectedBucket.getName()); try { try { if (selectedBucket.getAcl() == null) { selectedBucket.setAcl( s3ServiceMulti.getS3Service().getBucketAcl( selectedBucket)); if (!selectedBucket.isLocationKnown()) { selectedBucket.setLocation( s3ServiceMulti.getS3Service().getBucketLocation( selectedBucket.getName())); if (!selectedBucket.isRequesterPaysKnown()) { selectedBucket.setRequesterPays( s3ServiceMulti.getS3Service().isRequesterPaysBucket( selectedBucket.getName()));
private void displayBucketProperties(S3Bucket bucket) { bucketNameTextField.setText(bucket.getName()); String location = "Unknown"; if (bucket.isLocationKnown()) { location = bucket.getLocation(); if (location == null) { location = "US"; bucketCreationDateTextField.setText(String.valueOf(bucket.getCreationDate())); if (bucket.getOwner() != null) { ownerNameLabel.setVisible(true); ownerNameTextField.setVisible(true); ownerIdLabel.setVisible(true); ownerIdTextField.setVisible(true); ownerNameTextField.setText(bucket.getOwner().getDisplayName()); ownerIdTextField.setText(bucket.getOwner().getId()); } else { ownerNameLabel.setVisible(false); if (bucket.getAcl() != null) { AccessControlList acl = bucket.getAcl(); for (GrantAndPermission gap: acl.getGrantAndPermissions()) { grantsTableModel.addRow(new Object[] { if (bucket.isRequesterPaysKnown()) { bucketIsRequesterPaysLabel.setVisible(true); bucketIsRequesterPaysCheckBox.setVisible(true); bucketIsRequesterPaysCheckBox.setSelected(bucket.isRequesterPays());
System.out.println("Created test bucket: " + testBucket.getName()); System.out.println("Bucket '" + buckets[b].getName() + "' contains:"); s3Service.deleteBucket(testBucket.getName()); } catch (S3ServiceException e) { e.printStackTrace(); s3Service.deleteBucket(testBucket.getName()); System.out.println("Deleted bucket " + testBucket.getName()); S3Bucket bucket = new S3Bucket(awsCredentials.getAccessKey() + ".TestMulti"); bucket = s3Service.createBucket(bucket); String vBucketName = versioningBucket.getName(); S3Bucket publicBucket = new S3Bucket(awsCredentials.getAccessKey() + ".publicBucket"); s3Service.createBucket(publicBucket); publicBucket.setAcl(bucketAcl); s3Service.putBucketAcl(publicBucket); System.out.println("View bucket's object listing here: http://s3.amazonaws.com/" + publicBucket.getName()); s3Service.putObject(publicBucket, publicObject); System.out.println("View public object contents here: http://s3.amazonaws.com/" + publicBucket.getName() + "/" + publicObject.getKey()); String bucketNameForPolicy = publicBucket.getName();
/** * Creates a bucket in S3 based on the provided bucket object, with the Access Control List * settings and location properties of the bucket object (if any). * <p> * <b>Caution:</b> Performing this operation unnecessarily when a bucket already * exists may cause OperationAborted errors with the message "A conflicting conditional * operation is currently in progress against this resource.". To avoid this error, use the * {@link #getOrCreateBucket(String)} in situations where the bucket may already exist. * <p> * This method cannot be performed by anonymous services. * * @param bucket * an object representing the bucket to create which must be valid, and which may contain * location and ACL settings that will be applied upon creation. * @return * the created bucket object, populated with all metadata made available by the creation operation. * @throws S3ServiceException */ public S3Bucket createBucket(S3Bucket bucket) throws S3ServiceException { try { assertAuthenticatedConnection("Create Bucket"); assertValidBucket(bucket, "Create Bucket"); return (S3Bucket) createBucketImpl(bucket.getName(), bucket.getLocation(), bucket.getAcl()); } catch (ServiceException se) { throw new S3ServiceException(se); } }
public void run() { try { startProgressDialog( "Listing objects in " + currentSelectedBucket.getName(), "", 0, 0, "Cancel bucket listing", cancelListener); do { StorageObjectsChunk chunk = s3ServiceMulti.getS3Service().listObjectsChunked( currentSelectedBucket.getName(), prefix, delimiter, BUCKET_LIST_CHUNKING_SIZE, priorLastKey); objects[i].setOwner(currentSelectedBucket.getOwner()); + currentSelectedBucket.getName(), "", 0);
private void setAttributes(org.jets3t.service.model.S3Bucket bucket) { setDirectory(true); setDate(bucket.getCreationDate().getTime()); setPermissions(DEFAULT_PERMISSIONS); setOwner(bucket.getOwner().getDisplayName()); }
final S3Bucket selectedBucket = currentSelectedBucket; if (selectedBucket.getAcl() == null || !selectedBucket.isLocationKnown()) {
@Override public S3Bucket[] listAllBuckets() throws S3ServiceException { try { StorageBucket[] buckets = super.listAllBuckets(); return S3Bucket.cast(buckets); } catch (ServiceException se) { throw new S3ServiceException(se); } }
S3Bucket bucket = new S3Bucket(myBucketName); bucket.getName(), object.getKey(), false, false, false); String putUrl = s3Service.createSignedPutUrl(bucket.getName(), object.getKey(), object.getMetadataMap(), expiryDate, false); String getUrl = s3Service.createSignedGetUrl(bucket.getName(), object.getKey(), expiryDate, false); String headUrl = s3Service.createSignedHeadUrl(bucket.getName(), object.getKey(), expiryDate, false); String deleteUrl = s3Service.createSignedDeleteUrl(bucket.getName(), object.getKey(), expiryDate, false);
private void displayBucketProperties(S3Bucket bucket) { bucketNameTextField.setText(bucket.getName()); String location = "Unknown"; if (bucket.isLocationKnown()) { location = bucket.getLocation(); if (location == null) { location = "US"; bucketCreationDateTextField.setText(String.valueOf(bucket.getCreationDate())); if (bucket.getOwner() != null) { ownerNameLabel.setVisible(true); ownerNameTextField.setVisible(true); ownerIdLabel.setVisible(true); ownerIdTextField.setVisible(true); ownerNameTextField.setText(bucket.getOwner().getDisplayName()); ownerIdTextField.setText(bucket.getOwner().getId()); } else { ownerNameLabel.setVisible(false); if (bucket.getAcl() != null) { AccessControlList acl = bucket.getAcl(); for (GrantAndPermission gap: acl.getGrantAndPermissions()) { grantsTableModel.addRow(new Object[] { if (bucket.isRequesterPaysKnown()) { bucketIsRequesterPaysLabel.setVisible(true); bucketIsRequesterPaysCheckBox.setVisible(true); bucketIsRequesterPaysCheckBox.setSelected(bucket.isRequesterPays());
public void run() { startProgressDialog("Retrieving details for bucket " + selectedBucket.getName()); try { try { if (selectedBucket.getAcl() == null) { selectedBucket.setAcl( s3ServiceMulti.getS3Service().getBucketAcl( selectedBucket)); if (!selectedBucket.isLocationKnown()) { selectedBucket.setLocation( s3ServiceMulti.getS3Service().getBucketLocation( selectedBucket.getName())); if (!selectedBucket.isRequesterPaysKnown()) { selectedBucket.setRequesterPays( s3ServiceMulti.getS3Service().isRequesterPaysBucket( selectedBucket.getName()));
System.out.println("Created test bucket: " + testBucket.getName()); System.out.println("Bucket '" + buckets[b].getName() + "' contains:"); s3Service.deleteBucket(testBucket.getName()); } catch (S3ServiceException e) { e.printStackTrace(); s3Service.deleteBucket(testBucket.getName()); System.out.println("Deleted bucket " + testBucket.getName()); S3Bucket bucket = new S3Bucket(awsCredentials.getAccessKey() + ".TestMulti"); bucket = s3Service.createBucket(bucket); String vBucketName = versioningBucket.getName(); S3Bucket publicBucket = new S3Bucket(awsCredentials.getAccessKey() + ".publicBucket"); s3Service.createBucket(publicBucket); publicBucket.setAcl(bucketAcl); s3Service.putBucketAcl(publicBucket); System.out.println("View bucket's object listing here: http://s3.amazonaws.com/" + publicBucket.getName()); s3Service.putObject(publicBucket, publicObject); System.out.println("View public object contents here: http://s3.amazonaws.com/" + publicBucket.getName() + "/" + publicObject.getKey()); String bucketNameForPolicy = publicBucket.getName();
/** * Creates a bucket in S3 based on the provided bucket object, with the Access Control List * settings and location properties of the bucket object (if any). * <p> * <b>Caution:</b> Performing this operation unnecessarily when a bucket already * exists may cause OperationAborted errors with the message "A conflicting conditional * operation is currently in progress against this resource.". To avoid this error, use the * {@link #getOrCreateBucket(String)} in situations where the bucket may already exist. * <p> * This method cannot be performed by anonymous services. * * @param bucket * an object representing the bucket to create which must be valid, and which may contain * location and ACL settings that will be applied upon creation. * @return * the created bucket object, populated with all metadata made available by the creation operation. * @throws S3ServiceException */ public S3Bucket createBucket(S3Bucket bucket) throws S3ServiceException { try { assertAuthenticatedConnection("Create Bucket"); assertValidBucket(bucket, "Create Bucket"); return (S3Bucket) createBucketImpl(bucket.getName(), bucket.getLocation(), bucket.getAcl()); } catch (ServiceException se) { throw new S3ServiceException(se); } }
public void run() { try { startProgressDialog( "Listing objects in " + currentSelectedBucket.getName(), "", 0, 0, "Cancel bucket listing", cancelListener); do { StorageObjectsChunk chunk = s3ServiceMulti.getS3Service().listObjectsChunked( currentSelectedBucket.getName(), prefix, delimiter, BUCKET_LIST_CHUNKING_SIZE, priorLastKey); objects[i].setOwner(currentSelectedBucket.getOwner()); + currentSelectedBucket.getName(), "", 0);