/** * Returns an object representing the details of an item in S3 without the object's data, and * without applying any preconditions. * * @deprecated 0.8.0 * * <p> * This method can be performed by anonymous services. Anonymous services * can get a publicly-readable object's details. * * @param bucket * the bucket containing the object. * This must be a valid S3Bucket object that is non-null and contains a name. * @param objectKey * the key identifying the object. * @return * the object with the given key in S3, including only general details and metadata (not the data * input stream) * @throws S3ServiceException */ @Deprecated public S3Object getObjectDetails(S3Bucket bucket, String objectKey) throws S3ServiceException { try { assertValidBucket(bucket, "getObjectDetails"); return getObjectDetails(bucket, objectKey, null, null, null, null); } catch (ServiceException se) { throw new S3ServiceException(se); } }
/** * Lists the objects in a bucket. * * @deprecated 0.8.0 * * <p> * The objects returned by this method contain only minimal information * such as the object's size, ETag, and LastModified timestamp. To retrieve * the objects' metadata you must perform follow-up <code>getObject</code> * or <code>getObjectDetails</code> operations. * <p> * This method can be performed by anonymous services. Anonymous services * can only list the objects in a publicly-readable bucket. * * @param bucket * the bucket whose contents will be listed. * This must be a valid S3Bucket object that is non-null and contains a name. * @return * the set of objects contained in a bucket. * @throws S3ServiceException */ @Deprecated public S3Object[] listObjects(S3Bucket bucket) throws S3ServiceException { try { assertValidBucket(bucket, "listObjects"); return listObjects(bucket, null, null, Constants.DEFAULT_OBJECT_LIST_CHUNK_SIZE); } catch (ServiceException se) { throw new S3ServiceException(se); } }
/** * Returns an object representing the details of an item in S3 without the object's data, and * without applying any preconditions. * * @deprecated 0.8.0 * * <p> * This method can be performed by anonymous services. Anonymous services * can get a publicly-readable object's details. * * @param bucket * the bucket containing the object. * This must be a valid S3Bucket object that is non-null and contains a name. * @param objectKey * the key identifying the object. * @return * the object with the given key in S3, including only general details and metadata (not the data * input stream) * @throws S3ServiceException */ @Deprecated public S3Object getObjectDetails(S3Bucket bucket, String objectKey) throws S3ServiceException { try { assertValidBucket(bucket, "getObjectDetails"); return getObjectDetails(bucket, objectKey, null, null, null, null); } catch (ServiceException se) { throw new S3ServiceException(se); } }
/** * Lists the objects in a bucket. * * @deprecated 0.8.0 * * <p> * The objects returned by this method contain only minimal information * such as the object's size, ETag, and LastModified timestamp. To retrieve * the objects' metadata you must perform follow-up <code>getObject</code> * or <code>getObjectDetails</code> operations. * <p> * This method can be performed by anonymous services. Anonymous services * can only list the objects in a publicly-readable bucket. * * @param bucket * the bucket whose contents will be listed. * This must be a valid S3Bucket object that is non-null and contains a name. * @return * the set of objects contained in a bucket. * @throws S3ServiceException */ @Deprecated public S3Object[] listObjects(S3Bucket bucket) throws S3ServiceException { try { assertValidBucket(bucket, "listObjects"); return listObjects(bucket, null, null, Constants.DEFAULT_OBJECT_LIST_CHUNK_SIZE); } catch (ServiceException se) { throw new S3ServiceException(se); } }
/** * Deletes an S3 bucket. Only the owner of a bucket may delete it. * * @deprecated 0.8.0 * * <p> * This method cannot be performed by anonymous services. * * * @param bucket * the bucket to delete. * @throws S3ServiceException */ @Deprecated public void deleteBucket(S3Bucket bucket) throws S3ServiceException { try { assertValidBucket(bucket, "Delete bucket"); deleteBucketImpl(bucket.getName()); } catch (ServiceException se) { throw new S3ServiceException(se); } }
/** * Deletes an S3 bucket. Only the owner of a bucket may delete it. * * @deprecated 0.8.0 * * <p> * This method cannot be performed by anonymous services. * * * @param bucket * the bucket to delete. * @throws S3ServiceException */ @Deprecated public void deleteBucket(S3Bucket bucket) throws S3ServiceException { try { assertValidBucket(bucket, "Delete bucket"); deleteBucketImpl(bucket.getName()); } catch (ServiceException se) { throw new S3ServiceException(se); } }
/** * Retrieves the access control settings of a bucket. * * This method can be performed by anonymous services, but can only succeed if the * bucket's existing ACL already allows write access by the anonymous user. * In general, you can only access the ACL of a bucket if the ACL already in place * for that bucket (in S3) allows you to do so. See * <a href="http://docs.amazonwebservices.com/AmazonS3/2006-03-01/index.html?S3_ACLs.html"> * the S3 documentation on ACLs</a> for more details on access to ACLs. * * @param bucket * the bucket whose access control settings will be returned. * This must be a valid S3Bucket object that is non-null and contains a name. * @return * the ACL settings of the bucket. * @throws S3ServiceException */ public AccessControlList getBucketAcl(S3Bucket bucket) throws S3ServiceException { try { assertValidBucket(bucket, "Get Bucket Access Control List"); return getBucketAclImpl(bucket.getName()); } catch (ServiceException se) { throw new S3ServiceException(se); } }
/** * Puts an object inside an existing bucket in S3, creating a new object or overwriting * an existing one with the same key. * <p> * This method can be performed by anonymous services. Anonymous services * can put objects into a publicly-writable bucket. * * @param bucket * the bucket inside which the object will be put, which must be valid. * @param object * the object containing all information that will be written to S3. At very least this object must * be valid. Beyond that it may contain: an input stream with the object's data content, metadata, * and access control settings.<p> * <b>Note:</b> It is very important to set the object's Content-Length to match the size of the * data input stream when possible, as this can remove the need to read data into memory to * determine its size. * * @return * the object populated with any metadata information made available by S3. * @throws S3ServiceException */ public S3Object putObject(S3Bucket bucket, S3Object object) throws S3ServiceException { try { assertValidBucket(bucket, "Create Object in bucket"); return putObject(bucket.getName(), object); } catch (ServiceException se) { throw new S3ServiceException(se); } }
/** * Retrieves the access control settings of a bucket. * * This method can be performed by anonymous services, but can only succeed if the * bucket's existing ACL already allows write access by the anonymous user. * In general, you can only access the ACL of a bucket if the ACL already in place * for that bucket (in S3) allows you to do so. See * <a href="http://docs.amazonwebservices.com/AmazonS3/2006-03-01/index.html?S3_ACLs.html"> * the S3 documentation on ACLs</a> for more details on access to ACLs. * * @param bucket * the bucket whose access control settings will be returned. * This must be a valid S3Bucket object that is non-null and contains a name. * @return * the ACL settings of the bucket. * @throws S3ServiceException */ public AccessControlList getBucketAcl(S3Bucket bucket) throws S3ServiceException { try { assertValidBucket(bucket, "Get Bucket Access Control List"); return getBucketAclImpl(bucket.getName()); } catch (ServiceException se) { throw new S3ServiceException(se); } }
assertValidBucket(bucket, "Get versioned Object Access Control List"); return getObjectAclImpl(bucket.getName(), objectKey, versionId); } catch (ServiceException se) {
assertValidBucket(bucket, "Get versioned Object Access Control List"); return getObjectAclImpl(bucket.getName(), objectKey, versionId); } catch (ServiceException se) {
/** * Puts an object inside an existing bucket in S3, creating a new object or overwriting * an existing one with the same key. * <p> * This method can be performed by anonymous services. Anonymous services * can put objects into a publicly-writable bucket. * * @param bucket * the bucket inside which the object will be put, which must be valid. * @param object * the object containing all information that will be written to S3. At very least this object must * be valid. Beyond that it may contain: an input stream with the object's data content, metadata, * and access control settings.<p> * <b>Note:</b> It is very important to set the object's Content-Length to match the size of the * data input stream when possible, as this can remove the need to read data into memory to * determine its size. * * @return * the object populated with any metadata information made available by S3. * @throws S3ServiceException */ public S3Object putObject(S3Bucket bucket, S3Object object) throws S3ServiceException { try { assertValidBucket(bucket, "Create Object in bucket"); return putObject(bucket.getName(), object); } catch (ServiceException se) { throw new S3ServiceException(se); } }
/** * Retrieves the access control settings of an object. * * This method can be performed by anonymous services, but can only succeed if the * object's existing ACL already allows read access by the anonymous user. * In general, you can only access the ACL of an object if the ACL already in place * for that object (in S3) allows you to do so. See * <a href="http://docs.amazonwebservices.com/AmazonS3/2006-03-01/index.html?S3_ACLs.html"> * the S3 documentation on ACLs</a> for more details on access to ACLs. * * @param bucket * the bucket whose ACL settings will be retrieved (if objectKey is null) or the bucket containing the * object whose ACL settings will be retrieved (if objectKey is non-null). * @param objectKey * if non-null, the key of the object whose ACL settings will be retrieved. Ignored if null. * @return * the ACL settings of the bucket or object. * @throws S3ServiceException */ public AccessControlList getObjectAcl(S3Bucket bucket, String objectKey) throws S3ServiceException { try { assertValidBucket(bucket, "Get Object Access Control List"); return getObjectAclImpl(bucket.getName(), objectKey, null); } catch (ServiceException se) { throw new S3ServiceException(se); } }
/** * Deletes an object from a bucket in S3. * <p> * This method can be performed by anonymous services. Anonymous services * can delete objects from publicly-writable buckets. * * @param bucket * the bucket containing the object to be deleted. * @param objectKey * the key representing the object in S3. * @throws S3ServiceException */ public void deleteObject(S3Bucket bucket, String objectKey) throws S3ServiceException { try { assertValidBucket(bucket, "deleteObject"); assertValidObject(objectKey, "deleteObject"); deleteObject(bucket.getName(), objectKey); } catch (ServiceException se) { throw new S3ServiceException(se); } }
/** * Deletes an object from a bucket in S3. * <p> * This method can be performed by anonymous services. Anonymous services * can delete objects from publicly-writable buckets. * * @param bucket * the bucket containing the object to be deleted. * @param objectKey * the key representing the object in S3. * @throws S3ServiceException */ public void deleteObject(S3Bucket bucket, String objectKey) throws S3ServiceException { try { assertValidBucket(bucket, "deleteObject"); assertValidObject(objectKey, "deleteObject"); deleteObject(bucket.getName(), objectKey); } catch (ServiceException se) { throw new S3ServiceException(se); } }
/** * Applies access control settings to an object. The ACL settings must be included * with the object. * * This method can be performed by anonymous services, but can only succeed if the * object's existing ACL already allows write access by the anonymous user. * In general, you can only access the ACL of an object if the ACL already in place * for that object (in S3) allows you to do so. See * <a href="http://docs.amazonwebservices.com/AmazonS3/2006-03-01/index.html?S3_ACLs.html"> * the S3 documentation on ACLs</a> for more details on access to ACLs. * * @param bucket * the bucket containing the object to modify. * @param object * the object with ACL settings that will be applied. * @throws S3ServiceException */ public void putObjectAcl(S3Bucket bucket, S3Object object) throws S3ServiceException { try { assertValidBucket(bucket, "Put Object Access Control List"); assertValidObject(object, "Put Object Access Control List"); putObjectAcl(bucket.getName(), object.getKey(), object.getAcl()); } catch (ServiceException se) { throw new S3ServiceException(se); } }
/** * Applies access control settings to an object. The ACL settings must be included * with the object. * * This method can be performed by anonymous services, but can only succeed if the * object's existing ACL already allows write access by the anonymous user. * In general, you can only access the ACL of an object if the ACL already in place * for that object (in S3) allows you to do so. See * <a href="http://docs.amazonwebservices.com/AmazonS3/2006-03-01/index.html?S3_ACLs.html"> * the S3 documentation on ACLs</a> for more details on access to ACLs. * * @param bucket * the bucket containing the object to modify. * @param object * the object with ACL settings that will be applied. * @throws S3ServiceException */ public void putObjectAcl(S3Bucket bucket, S3Object object) throws S3ServiceException { try { assertValidBucket(bucket, "Put Object Access Control List"); assertValidObject(object, "Put Object Access Control List"); putObjectAcl(bucket.getName(), object.getKey(), object.getAcl()); } catch (ServiceException se) { throw new S3ServiceException(se); } }
/** * 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); } }
/** * 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); } }
assertValidBucket(bucket, "Put Versioned Object Access Control List"); assertValidObject(object, "Put Versioned Object Access Control List"); String objectKey = object.getKey();