public class RestS3Service extends S3Service
This class uses properties obtained through Jets3tProperties
. For more information on
these properties please refer to
JetS3t Configuration
RestStorageService.HTTP_METHOD
credentialsProvider, defaultServerSideEncryptionAlgorithm, defaultStorageClass, httpClient, regionEndpointCache, shuttingDown
BUCKET_STATUS__ALREADY_CLAIMED, BUCKET_STATUS__DOES_NOT_EXIST, BUCKET_STATUS__MY_BUCKET, timeOffset
Constructor and Description |
---|
RestS3Service(ProviderCredentials credentials)
Constructs the service and initialises the properties.
|
RestS3Service(ProviderCredentials credentials,
java.lang.String invokingApplicationDescription,
org.apache.http.client.CredentialsProvider credentialsProvider)
Constructs the service and initialises the properties.
|
RestS3Service(ProviderCredentials credentials,
java.lang.String invokingApplicationDescription,
org.apache.http.client.CredentialsProvider credentialsProvider,
Jets3tProperties jets3tProperties)
Constructs the service and initialises the properties.
|
Modifier and Type | Method and Description |
---|---|
protected void |
deleteBucketPolicyImpl(java.lang.String bucketName) |
void |
deleteLifecycleConfigImpl(java.lang.String bucketName) |
MultipleDeleteResult |
deleteMultipleObjectsWithMFAImpl(java.lang.String bucketName,
ObjectKeyAndVersion[] objectNameAndVersions,
java.lang.String multiFactorSerialNumber,
java.lang.String multiFactorAuthCode,
boolean isQuiet) |
protected java.lang.String |
getBucketLocationImpl(java.lang.String bucketName) |
protected java.lang.String |
getBucketPolicyImpl(java.lang.String bucketName) |
protected S3BucketVersioningStatus |
getBucketVersioningStatusImpl(java.lang.String bucketName) |
java.lang.String |
getDevPayProductToken() |
java.lang.String |
getDevPayUserToken() |
protected boolean |
getDisableDnsBuckets() |
protected boolean |
getEnableServerSideEncryption() |
protected boolean |
getEnableStorageClasses() |
java.lang.String |
getEndpoint() |
protected int |
getHttpPort() |
protected boolean |
getHttpsOnly() |
protected int |
getHttpsPort() |
LifecycleConfig |
getLifecycleConfigImpl(java.lang.String bucketName) |
protected NotificationConfig |
getNotificationConfigImpl(java.lang.String bucketName) |
java.util.List<java.lang.String> |
getResourceParameterNames() |
java.lang.String |
getRestHeaderPrefix() |
java.lang.String |
getRestMetadataPrefix() |
protected java.lang.String |
getSignatureIdentifier() |
protected java.lang.String |
getVirtualPath() |
protected XmlResponsesSaxParser |
getXmlResponseSaxParser() |
protected boolean |
isRequesterPaysBucketImpl(java.lang.String bucketName) |
boolean |
isRequesterPaysEnabled()
Is this service configured to generate Requester Pays requests when
uploading data to S3, or retrieving data from the service.
|
protected boolean |
isTargettingGoogleStorageService() |
protected VersionOrDeleteMarkersChunk |
listVersionedObjectsChunkedImpl(java.lang.String bucketName,
java.lang.String prefix,
java.lang.String delimiter,
long maxListingLength,
java.lang.String priorLastKey,
java.lang.String priorLastVersion,
boolean completeListing)
Lists version or delete markers in a versioned bucket, up to the maximum listing
length specified.
|
protected BaseVersionOrDeleteMarker[] |
listVersionedObjectsImpl(java.lang.String bucketName,
java.lang.String prefix,
java.lang.String delimiter,
java.lang.String keyMarker,
java.lang.String versionMarker,
long maxListingLength) |
protected VersionOrDeleteMarkersChunk |
listVersionedObjectsInternal(java.lang.String bucketName,
java.lang.String prefix,
java.lang.String delimiter,
long maxListingLength,
boolean automaticallyMergeChunks,
java.lang.String nextKeyMarker,
java.lang.String nextVersionIdMarker) |
protected void |
multipartAbortUploadImpl(java.lang.String uploadId,
java.lang.String bucketName,
java.lang.String objectKey) |
protected MultipartCompleted |
multipartCompleteUploadImpl(java.lang.String uploadId,
java.lang.String bucketName,
java.lang.String objectKey,
java.util.List<MultipartPart> parts) |
protected java.util.List<MultipartPart> |
multipartListPartsImpl(java.lang.String uploadId,
java.lang.String bucketName,
java.lang.String objectKey) |
protected MultipartUploadChunk |
multipartListUploadsChunkedImpl(java.lang.String bucketName,
java.lang.String prefix,
java.lang.String delimiter,
java.lang.String keyMarker,
java.lang.String uploadIdMarker,
java.lang.Integer maxUploads,
boolean autoMergeChunks) |
protected MultipartUpload |
multipartStartUploadImpl(java.lang.String bucketName,
java.lang.String objectKey,
java.util.Map<java.lang.String,java.lang.Object> metadataProvided,
AccessControlList acl,
java.lang.String storageClass) |
protected MultipartUpload |
multipartStartUploadImpl(java.lang.String bucketName,
java.lang.String objectKey,
java.util.Map<java.lang.String,java.lang.Object> metadataProvided,
AccessControlList acl,
java.lang.String storageClass,
java.lang.String serverSideEncryptionAlgorithm) |
protected MultipartPart |
multipartUploadPartCopyImpl(java.lang.String uploadId,
java.lang.String targetBucketName,
java.lang.String targetObjectKey,
java.lang.Integer partNumber,
java.lang.String sourceBucketName,
java.lang.String sourceObjectKey,
java.util.Calendar ifModifiedSince,
java.util.Calendar ifUnmodifiedSince,
java.lang.String[] ifMatchTags,
java.lang.String[] ifNoneMatchTags,
java.lang.Long byteRangeStart,
java.lang.Long byteRangeEnd,
java.lang.String versionId) |
protected MultipartPart |
multipartUploadPartImpl(java.lang.String uploadId,
java.lang.String bucketName,
java.lang.Integer partNumber,
S3Object object) |
protected StorageBucket |
newBucket() |
protected StorageObject |
newObject() |
protected void |
setBucketPolicyImpl(java.lang.String bucketName,
java.lang.String policyDocument) |
void |
setDevPayProductToken(java.lang.String productToken)
Set the Product Token value to use for requests to a DevPay S3 account.
|
void |
setDevPayUserToken(java.lang.String userToken)
Set the User Token value to use for requests to a DevPay S3 account.
|
void |
setLifecycleConfigImpl(java.lang.String bucketName,
LifecycleConfig config) |
protected void |
setNotificationConfigImpl(java.lang.String bucketName,
NotificationConfig config) |
protected void |
setRequesterPaysBucketImpl(java.lang.String bucketName,
boolean requesterPays) |
void |
setRequesterPaysEnabled(boolean isRequesterPays)
Instruct the service whether to generate Requester Pays requests when
uploading data to S3, or retrieving data from the service.
|
protected org.apache.http.client.methods.HttpUriRequest |
setupConnection(RestStorageService.HTTP_METHOD method,
java.lang.String bucketName,
java.lang.String objectKey,
java.util.Map<java.lang.String,java.lang.String> requestParameters)
Creates an
HttpUriRequest object to handle a particular connection method. |
protected void |
updateBucketVersioningStatusImpl(java.lang.String bucketName,
boolean enabled,
boolean multiFactorAuthDeleteEnabled,
java.lang.String multiFactorSerialNumber,
java.lang.String multiFactorAuthCode) |
buildPostForm, buildPostForm, buildPostForm, copyVersionedObject, copyVersionedObject, createBucket, createBucket, createBucket, createBucket, createSignedDeleteUrl, createSignedDeleteUrl, createSignedDeleteUrl, createSignedDeleteUrl, createSignedGetUrl, createSignedGetUrl, createSignedGetUrl, createSignedGetUrl, createSignedHeadUrl, createSignedHeadUrl, createSignedHeadUrl, createSignedHeadUrl, createSignedPutUrl, createSignedPutUrl, createSignedPutUrl, createSignedPutUrl, createSignedUrl, createSignedUrl, createSignedUrl, createSignedUrl, createSignedUrl, createSignedUrl, createSignedUrlUsingSignatureVersion, createTorrentUrl, createUnsignedObjectUrl, deleteBucket, deleteBucketPolicy, deleteLifecycleConfig, deleteMultipleObjects, deleteMultipleObjects, deleteMultipleObjects, deleteMultipleObjectsWithMFA, deleteObject, deleteVersionedObject, deleteVersionedObjectWithMFA, deleteWebsiteConfig, disableMFAForVersionedBucket, enableBucketVersioning, enableBucketVersioningAndMFA, enableBucketVersioningWithMFA, generatePostPolicyCondition_AllowAnyValue, generatePostPolicyCondition_Equality, generatePostPolicyCondition_Equality, generatePostPolicyCondition_Equality, generatePostPolicyCondition_Range, generatePostPolicyCondition, getBucket, getBucketAcl, getBucketLocation, getBucketLoggingStatus, getBucketPolicy, getBucketVersioningStatus, getLifecycleConfig, getNotificationConfig, getObject, getObject, getObject, getObject, getObjectAcl, getObjectDetails, getObjectDetails, getObjectVersions, getOrCreateBucket, getOrCreateBucket, getVersionedObject, getVersionedObject, getVersionedObject, getVersionedObjectAcl, getVersionedObjectAcl, getVersionedObjectDetails, getVersionedObjectDetails, getVersionedObjectDetails, getWebsiteConfig, isRequesterPaysBucket, listAllBuckets, listObjects, listObjects, listObjects, listObjects, listObjects, listObjects, listVersionedObjects, listVersionedObjectsChunked, multipartAbortUpload, multipartCompleteUpload, multipartCompleteUpload, multipartListParts, multipartListUploads, multipartListUploads, multipartListUploads, multipartListUploadsChunked, multipartStartUpload, multipartStartUpload, multipartStartUpload, multipartUploadPart, multipartUploadPartCopy, multipartUploadPartCopy, multipartUploadPartCopy, putObject, putObject, putObjectAcl, putObjectAcl, putObjectMaybeAsMultipart, putVersionedObjectAcl, putVersionedObjectAcl, setBucketLoggingStatus, setBucketPolicy, setLifecycleConfig, setNotificationConfig, setRequesterPaysBucket, setWebsiteConfig, suspendBucketVersioning, suspendBucketVersioningWithMFA, unsetNotificationConfig
addMetadataToHeaders, addRequestHeadersToConnection, addRequestParametersToUrlPath, authorizeHttpRequest, checkBucketStatus, copyObjectImpl, createBucketImpl, createObjectImpl, deleteBucketImpl, deleteObjectImpl, deleteObjectWithSignedUrl, deleteWebsiteConfigImpl, getAccountOwnerImpl, getBucketAclImpl, getBucketLoggingStatusImpl, getCredentialsProvider, getHttpClient, getHttpConnectionManager, getObjectAclImpl, getObjectAclImpl, getObjectAclWithSignedUrl, getObjectDetailsImpl, getObjectDetailsWithSignedUrl, getObjectImpl, getObjectWithSignedUrl, getRegionEndpointCache, getWebsiteConfigImpl, initHttpConnection, initializeDefaults, initializeProxy, isBucketAccessible, isLiveMD5HashingRequired, isRecoverable403, isXmlContentType, listAllBucketsImpl, listObjectsChunkedImpl, listObjectsImpl, listObjectsInternal, performRequest, performRequest, performRestDelete, performRestGet, performRestGet, performRestHead, performRestPost, performRestPostWithXmlBuilder, performRestPut, performRestPutWithXmlBuilder, prepareRESTHeaderAcl, prepareServerSideEncryption, prepareStorageClass, putAclImpl, putBucketAclImpl, putObjectAclImpl, putObjectAclWithSignedUrl, putObjectImpl, putObjectWithRequestEntityImpl, putObjectWithSignedUrl, setBucketLoggingStatusImpl, setCredentialsProvider, setHttpClient, setRegionEndpointCache, setWebsiteConfigImpl, shutdownImpl, verifyExpectedAndActualETagValues
assertAuthenticatedConnection, assertValidBucket, assertValidObject, assertValidObject, copyObject, copyObject, createBucket, createBucketImpl, deleteBucket, deleteBucket, deleteObject, getAccountOwner, getBucketAcl, getCurrentTimeWithOffset, getInternalErrorRetryMax, getInvokingApplicationDescription, getJetS3tProperties, getObjectAcl, getObjectDetails, getObjectDetails, getProviderCredentials, isAuthenticatedConnection, isHttpsOnly, isObjectInBucket, isShutdown, listAllBucketsImpl, listObjectsChunked, listObjectsChunked, moveObject, putBucketAcl, putBucketAcl, putObject, putObjectAcl, putObjectAcl, renameMetadataKeys, renameObject, setProviderCredentials, shutdown, sleepOnInternalError, updateObjectMetadata
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
deleteObjectWithSignedUrl, getObjectAclWithSignedUrl, getObjectDetailsWithSignedUrl, getObjectWithSignedUrl, putObjectAclWithSignedUrl, putObjectWithSignedUrl
public RestS3Service(ProviderCredentials credentials)
credentials
- the user credentials to use when communicating with S3, may be null in which case the
communication is done as an anonymous user.public RestS3Service(ProviderCredentials credentials, java.lang.String invokingApplicationDescription, org.apache.http.client.CredentialsProvider credentialsProvider)
credentials
- the S3 user credentials to use when communicating with S3, may be null in which case the
communication is done as an anonymous user.invokingApplicationDescription
- a short description of the application using the service, suitable for inclusion in a
user agent string for REST/HTTP requests. Ideally this would include the application's
version number, for example: Cockpit/0.7.3
or My App Name/1.0
credentialsProvider
- an implementation of the HttpClient CredentialsProvider interface, to provide a means for
prompting for credentials when necessary.public RestS3Service(ProviderCredentials credentials, java.lang.String invokingApplicationDescription, org.apache.http.client.CredentialsProvider credentialsProvider, Jets3tProperties jets3tProperties)
credentials
- the S3 user credentials to use when communicating with S3, may be null in which case the
communication is done as an anonymous user.invokingApplicationDescription
- a short description of the application using the service, suitable for inclusion in a
user agent string for REST/HTTP requests. Ideally this would include the application's
version number, for example: Cockpit/0.7.3
or My App Name/1.0
credentialsProvider
- an implementation of the HttpClient CredentialsProvider interface, to provide a means for
prompting for credentials when necessary.jets3tProperties
- JetS3t properties that will be applied within this service.protected boolean isTargettingGoogleStorageService()
isTargettingGoogleStorageService
in class RestStorageService
protected XmlResponsesSaxParser getXmlResponseSaxParser() throws ServiceException
getXmlResponseSaxParser
in class StorageService
ServiceException
protected StorageBucket newBucket()
newBucket
in class StorageService
StorageBucket
implementation.protected StorageObject newObject()
newObject
in class StorageService
StorageObject
implementation.public void setDevPayUserToken(java.lang.String userToken)
userToken
- the user token value provided by the AWS DevPay activation service.public java.lang.String getDevPayUserToken()
public void setDevPayProductToken(java.lang.String productToken)
productToken
- the token that identifies your DevPay product.public java.lang.String getDevPayProductToken()
public void setRequesterPaysEnabled(boolean isRequesterPays)
httpclient.requester-pays-buckets-enabled
.isRequesterPays
- if true, all subsequent S3 service requests will include the Requester
Pays flag.public boolean isRequesterPaysEnabled()
httpclient.requester-pays-buckets-enabled
.protected org.apache.http.client.methods.HttpUriRequest setupConnection(RestStorageService.HTTP_METHOD method, java.lang.String bucketName, java.lang.String objectKey, java.util.Map<java.lang.String,java.lang.String> requestParameters) throws S3ServiceException
HttpUriRequest
object to handle a particular connection method.setupConnection
in class RestStorageService
method
- the HTTP method/connection-type to use, must be one of: PUT, HEAD, GET, DELETEbucketName
- the bucket's nameobjectKey
- the object's key name, may be null if the operation is on a bucket only.S3ServiceException
public java.lang.String getEndpoint()
getEndpoint
in class StorageService
protected java.lang.String getVirtualPath()
getVirtualPath
in class StorageService
protected java.lang.String getSignatureIdentifier()
getSignatureIdentifier
in class StorageService
public java.lang.String getRestHeaderPrefix()
getRestHeaderPrefix
in class StorageService
public java.util.List<java.lang.String> getResourceParameterNames()
getResourceParameterNames
in class StorageService
public java.lang.String getRestMetadataPrefix()
getRestMetadataPrefix
in class StorageService
protected int getHttpPort()
getHttpPort
in class StorageService
protected int getHttpsPort()
getHttpsPort
in class StorageService
protected boolean getHttpsOnly()
getHttpsOnly
in class StorageService
protected boolean getDisableDnsBuckets()
getDisableDnsBuckets
in class StorageService
protected boolean getEnableStorageClasses()
getEnableStorageClasses
in class StorageService
protected boolean getEnableServerSideEncryption()
getEnableServerSideEncryption
in class StorageService
protected BaseVersionOrDeleteMarker[] listVersionedObjectsImpl(java.lang.String bucketName, java.lang.String prefix, java.lang.String delimiter, java.lang.String keyMarker, java.lang.String versionMarker, long maxListingLength) throws S3ServiceException
listVersionedObjectsImpl
in class S3Service
S3ServiceException
protected void updateBucketVersioningStatusImpl(java.lang.String bucketName, boolean enabled, boolean multiFactorAuthDeleteEnabled, java.lang.String multiFactorSerialNumber, java.lang.String multiFactorAuthCode) throws S3ServiceException
updateBucketVersioningStatusImpl
in class S3Service
S3ServiceException
protected S3BucketVersioningStatus getBucketVersioningStatusImpl(java.lang.String bucketName) throws S3ServiceException
getBucketVersioningStatusImpl
in class S3Service
S3ServiceException
protected VersionOrDeleteMarkersChunk listVersionedObjectsInternal(java.lang.String bucketName, java.lang.String prefix, java.lang.String delimiter, long maxListingLength, boolean automaticallyMergeChunks, java.lang.String nextKeyMarker, java.lang.String nextVersionIdMarker) throws S3ServiceException
S3ServiceException
protected VersionOrDeleteMarkersChunk listVersionedObjectsChunkedImpl(java.lang.String bucketName, java.lang.String prefix, java.lang.String delimiter, long maxListingLength, java.lang.String priorLastKey, java.lang.String priorLastVersion, boolean completeListing) throws S3ServiceException
S3Service
Implementation notes The implementation of this method returns only as many items as requested in the chunk size. It is the responsibility of the caller to build a complete object listing from multiple chunks, should this be necessary.
listVersionedObjectsChunkedImpl
in class S3Service
delimiter
- only list objects with key names up to this delimiter, may be null.S3ServiceException
protected java.lang.String getBucketLocationImpl(java.lang.String bucketName) throws S3ServiceException
getBucketLocationImpl
in class RestStorageService
S3ServiceException
protected java.lang.String getBucketPolicyImpl(java.lang.String bucketName) throws S3ServiceException
getBucketPolicyImpl
in class S3Service
S3ServiceException
protected void setBucketPolicyImpl(java.lang.String bucketName, java.lang.String policyDocument) throws S3ServiceException
setBucketPolicyImpl
in class S3Service
S3ServiceException
protected void deleteBucketPolicyImpl(java.lang.String bucketName) throws S3ServiceException
deleteBucketPolicyImpl
in class S3Service
S3ServiceException
protected boolean isRequesterPaysBucketImpl(java.lang.String bucketName) throws S3ServiceException
isRequesterPaysBucketImpl
in class S3Service
S3ServiceException
protected void setRequesterPaysBucketImpl(java.lang.String bucketName, boolean requesterPays) throws S3ServiceException
setRequesterPaysBucketImpl
in class S3Service
S3ServiceException
protected MultipartUpload multipartStartUploadImpl(java.lang.String bucketName, java.lang.String objectKey, java.util.Map<java.lang.String,java.lang.Object> metadataProvided, AccessControlList acl, java.lang.String storageClass) throws S3ServiceException
S3ServiceException
protected MultipartUpload multipartStartUploadImpl(java.lang.String bucketName, java.lang.String objectKey, java.util.Map<java.lang.String,java.lang.Object> metadataProvided, AccessControlList acl, java.lang.String storageClass, java.lang.String serverSideEncryptionAlgorithm) throws S3ServiceException
multipartStartUploadImpl
in class S3Service
S3ServiceException
protected MultipartPart multipartUploadPartImpl(java.lang.String uploadId, java.lang.String bucketName, java.lang.Integer partNumber, S3Object object) throws S3ServiceException
multipartUploadPartImpl
in class S3Service
S3ServiceException
protected MultipartPart multipartUploadPartCopyImpl(java.lang.String uploadId, java.lang.String targetBucketName, java.lang.String targetObjectKey, java.lang.Integer partNumber, java.lang.String sourceBucketName, java.lang.String sourceObjectKey, java.util.Calendar ifModifiedSince, java.util.Calendar ifUnmodifiedSince, java.lang.String[] ifMatchTags, java.lang.String[] ifNoneMatchTags, java.lang.Long byteRangeStart, java.lang.Long byteRangeEnd, java.lang.String versionId) throws S3ServiceException
multipartUploadPartCopyImpl
in class S3Service
S3ServiceException
protected void multipartAbortUploadImpl(java.lang.String uploadId, java.lang.String bucketName, java.lang.String objectKey) throws S3ServiceException
multipartAbortUploadImpl
in class S3Service
S3ServiceException
protected MultipartCompleted multipartCompleteUploadImpl(java.lang.String uploadId, java.lang.String bucketName, java.lang.String objectKey, java.util.List<MultipartPart> parts) throws S3ServiceException
multipartCompleteUploadImpl
in class S3Service
S3ServiceException
protected MultipartUploadChunk multipartListUploadsChunkedImpl(java.lang.String bucketName, java.lang.String prefix, java.lang.String delimiter, java.lang.String keyMarker, java.lang.String uploadIdMarker, java.lang.Integer maxUploads, boolean autoMergeChunks) throws S3ServiceException
multipartListUploadsChunkedImpl
in class S3Service
S3ServiceException
protected java.util.List<MultipartPart> multipartListPartsImpl(java.lang.String uploadId, java.lang.String bucketName, java.lang.String objectKey) throws S3ServiceException
multipartListPartsImpl
in class S3Service
S3ServiceException
protected NotificationConfig getNotificationConfigImpl(java.lang.String bucketName) throws S3ServiceException
getNotificationConfigImpl
in class S3Service
S3ServiceException
protected void setNotificationConfigImpl(java.lang.String bucketName, NotificationConfig config) throws S3ServiceException
setNotificationConfigImpl
in class S3Service
S3ServiceException
public LifecycleConfig getLifecycleConfigImpl(java.lang.String bucketName) throws S3ServiceException
getLifecycleConfigImpl
in class S3Service
S3ServiceException
public void setLifecycleConfigImpl(java.lang.String bucketName, LifecycleConfig config) throws S3ServiceException
setLifecycleConfigImpl
in class S3Service
S3ServiceException
public void deleteLifecycleConfigImpl(java.lang.String bucketName) throws S3ServiceException
deleteLifecycleConfigImpl
in class S3Service
S3ServiceException
public MultipleDeleteResult deleteMultipleObjectsWithMFAImpl(java.lang.String bucketName, ObjectKeyAndVersion[] objectNameAndVersions, java.lang.String multiFactorSerialNumber, java.lang.String multiFactorAuthCode, boolean isQuiet) throws S3ServiceException
deleteMultipleObjectsWithMFAImpl
in class S3Service
S3ServiceException