ThreadedStorageService
instead.@Deprecated
public class S3ServiceMulti
extends java.lang.Object
S3Service
implementation.
This service is designed to be run in non-blocking threads that therefore communicates
information about its progress by firing ServiceEvent
events. It is the responsibility
of applications using this service to correctly handle these events - see the JetS3t application
Synchronize
for examples of how an application can use these
events.
For cases where the full power, and complexity, of the event notification mechanism is not required
the simplified multi-threaded service S3ServiceSimpleMulti
can be used.
This class uses properties obtained through Jets3tProperties
. For more information on
these properties please refer to
JetS3t Configuration
Constructor and Description |
---|
S3ServiceMulti(S3Service s3Service,
S3ServiceEventListener listener)
Deprecated.
Construct a multi-threaded service based on an S3Service and which sends event notifications
to an event listening class.
|
S3ServiceMulti(S3Service s3Service,
S3ServiceEventListener listener,
long threadSleepTimeMS)
Deprecated.
Construct a multi-threaded service based on an S3Service and which sends event notifications
to an event listening class, and which will send EVENT_IN_PROGRESS events at the specified
time interval.
|
Modifier and Type | Method and Description |
---|---|
void |
addServiceEventListener(S3ServiceEventListener listener)
Deprecated.
Adds a service event listener to the set of listeners that will be notified of events.
|
boolean |
copyObjects(java.lang.String sourceBucketName,
java.lang.String destinationBucketName,
java.lang.String[] sourceObjectKeys,
S3Object[] destinationObjects,
boolean replaceMetadata)
Deprecated.
Copies multiple objects within or between buckets, while sending
CopyObjectsEvent notification events. |
boolean |
createBuckets(S3Bucket[] buckets)
Deprecated.
Creates multiple buckets, and sends
CreateBucketsEvent notification events. |
boolean |
deleteObjects(S3Bucket bucket,
S3Object[] objects)
Deprecated.
Deletes multiple objects from a bucket, and sends
DeleteObjectsEvent notification events. |
boolean |
deleteObjects(S3Bucket bucket,
java.lang.String[] objectKeys)
Deprecated.
Deletes multiple objects from a bucket, and sends
DeleteObjectsEvent notification events. |
boolean |
deleteObjects(java.lang.String[] signedDeleteUrls)
Deprecated.
Deletes multiple objects from a bucket using signed DELETE URLs corresponding to those objects.
|
boolean |
deleteVersionsOfObject(java.lang.String[] versionIds,
java.lang.String bucketName,
java.lang.String objectKey)
Deprecated.
Delete multiple object versions from a bucket in S3, and sends
DeleteVersionedObjectsEvent notification events. |
boolean |
deleteVersionsOfObjectWithMFA(java.lang.String[] versionIds,
java.lang.String multiFactorSerialNumber,
java.lang.String multiFactorAuthCode,
java.lang.String bucketName,
java.lang.String objectKey)
Deprecated.
Delete multiple object versions from a bucket in S3, and sends
DeleteVersionedObjectsEvent notification events. |
boolean |
downloadObjects(DownloadPackage[] downloadPackages)
Deprecated.
A convenience method to download multiple objects from S3 to pre-existing
output streams, which is particularly useful for downloading objects to files.
|
boolean |
downloadObjects(S3Bucket bucket,
DownloadPackage[] downloadPackages)
Deprecated.
A convenience method to download multiple objects from S3 to pre-existing
output streams, which is particularly useful for downloading objects to files.
|
protected void |
fireServiceEvent(ServiceEvent event)
Deprecated.
Sends a service event to each of the listeners registered with this service.
|
ProviderCredentials |
getAWSCredentials()
Deprecated.
|
boolean |
getObjectACLs(S3Bucket bucket,
S3Object[] objects)
Deprecated.
Retrieves Access Control List (ACL) information for multiple objects from a bucket, and sends
LookupACLEvent notification events. |
boolean |
getObjects(S3Bucket bucket,
S3Object[] objects)
Deprecated.
Retrieves multiple objects (details and data) from a bucket, and sends
GetObjectsEvent notification events. |
boolean |
getObjects(S3Bucket bucket,
java.lang.String[] objectKeys)
Deprecated.
Retrieves multiple objects (details and data) from a bucket, and sends
GetObjectsEvent notification events. |
boolean |
getObjects(java.lang.String[] signedGetURLs)
Deprecated.
Retrieves multiple objects (details and data) from a bucket using signed GET URLs corresponding
to those objects.
|
boolean |
getObjectsACLs(java.lang.String[] signedAclURLs)
Deprecated.
Retrieves ACL information about multiple objects from a bucket using signed GET ACL URLs
corresponding to those objects.
|
boolean |
getObjectsHeads(S3Bucket bucket,
S3Object[] objects)
Deprecated.
Retrieves details (but no data) about multiple objects from a bucket, and sends
GetObjectHeadsEvent notification events. |
boolean |
getObjectsHeads(S3Bucket bucket,
java.lang.String[] objectKeys)
Deprecated.
Retrieves details (but no data) about multiple objects from a bucket, and sends
GetObjectHeadsEvent notification events. |
boolean |
getObjectsHeads(java.lang.String[] signedHeadURLs)
Deprecated.
Retrieves details (but no data) about multiple objects using signed HEAD URLs corresponding
to those objects.
|
S3Service |
getS3Service()
Deprecated.
|
boolean |
isAuthenticatedConnection()
Deprecated.
|
boolean |
isShutdown()
Deprecated.
|
boolean |
listObjects(java.lang.String bucketName,
java.lang.String[] prefixes,
java.lang.String delimiter,
long maxListingLength)
Deprecated.
Lists the objects in a bucket based on an array of prefix strings, and
sends
ListObjectsEvent notification events. |
boolean |
putACLs(S3Bucket bucket,
S3Object[] objects)
Deprecated.
Updates/sets Access Control List (ACL) information for multiple objects in a bucket, and sends
UpdateACLEvent notification events. |
boolean |
putObjects(S3Bucket bucket,
S3Object[] objects)
Deprecated.
Creates multiple objects in a bucket, and sends
CreateObjectsEvent notification events. |
boolean |
putObjects(SignedUrlAndObject[] signedPutUrlAndObjects)
Deprecated.
Creates multiple objects in a bucket using a pre-signed PUT URL for each object.
|
boolean |
putObjectsACLs(java.lang.String[] signedURLs,
AccessControlList acl)
Deprecated.
Updates/sets Access Control List (ACL) information for multiple objects in
a bucket, and sends
UpdateACLEvent notification events. |
void |
removeServiceEventListener(S3ServiceEventListener listener)
Deprecated.
Removes a service event listener from the set of listeners that will be notified of events.
|
void |
shutdown()
Deprecated.
Make a best-possible effort to shutdown and clean up any resources used by this
service such as HTTP connections, connection pools, threads etc.
|
public S3ServiceMulti(S3Service s3Service, S3ServiceEventListener listener)
s3Service
- an S3Service implementation that will be used to perform S3 requests. This implementation
must be thread-safe.listener
- the event listener which will handle event notifications.public S3ServiceMulti(S3Service s3Service, S3ServiceEventListener listener, long threadSleepTimeMS)
s3Service
- an S3Service implementation that will be used to perform S3 requests. This implementation
must be thread-safe.listener
- the event listener which will handle event notifications.threadSleepTimeMS
- how many milliseconds to wait before sending each EVENT_IN_PROGRESS notification event.public void shutdown() throws S3ServiceException
S3ServiceException
public boolean isShutdown()
shutdown()
method has been used to shut down and
clean up this service. If this function returns true this service instance
can no longer be used to do work.public S3Service getS3Service()
public void addServiceEventListener(S3ServiceEventListener listener)
listener
- an event listener to add to the event notification chain.public void removeServiceEventListener(S3ServiceEventListener listener)
listener
- an event listener to remove from the event notification chain.protected void fireServiceEvent(ServiceEvent event)
event
- the event to send to this service's registered event listeners.public boolean isAuthenticatedConnection()
public ProviderCredentials getAWSCredentials()
public boolean listObjects(java.lang.String bucketName, java.lang.String[] prefixes, java.lang.String delimiter, long maxListingLength)
ListObjectsEvent
notification events.
The objects that match each prefix are listed in a separate background
thread, potentially allowing you to list the contents of large buckets more
quickly than if you had to list all the objects in sequence.
Objects in the bucket that do not match one of the prefixes will not be listed.
bucketName
- the name of the bucket in which the objects are stored.prefixes
- an array of prefix strings. A separate listing thread will be run for
each of these prefix strings, and the method will only complete once
the entire object listing for each prefix has been obtained (unless the
operation is cancelled, or an error occurs)delimiter
- an optional delimiter string to apply to each listing operation. This
parameter should be null if you do not wish to apply a delimiter.maxListingLength
- the maximum number of objects to list in each iteration. This should be a
value between 1 and 1000, where 1000 will be the best choice in almost all
circumstances. Regardless of this value, all the objects in the bucket that
match the criteria will be returned.
The maximum number of threads is controlled by the JetS3t configuration property s3service.admin-max-thread-count.
public boolean createBuckets(S3Bucket[] buckets)
CreateBucketsEvent
notification events.
The maximum number of threads is controlled by the JetS3t configuration property s3service.admin-max-thread-count.
buckets
- the buckets to create.public boolean copyObjects(java.lang.String sourceBucketName, java.lang.String destinationBucketName, java.lang.String[] sourceObjectKeys, S3Object[] destinationObjects, boolean replaceMetadata)
CopyObjectsEvent
notification events.
The maximum number of threads is controlled by the JetS3t configuration property s3service.admin-max-thread-count.
sourceBucketName
- the name of the bucket containing the objects that will be copied.destinationBucketName
- the name of the bucket to which the objects will be copied. The destination
bucket may be the same as the source bucket.sourceObjectKeys
- the key names of the objects that will be copied.destinationObjects
- objects that will be created by the copy operation. The AccessControlList
setting of each object will determine the access permissions of the
resultant object, and if the replaceMetadata flag is true the metadata
items in each object will also be applied to the resultant object.replaceMetadata
- if true, the metadata items in the destination objects will be stored
in S3 by using the REPLACE metadata copying option. If false, the metadata
items will be copied unchanged from the original objects using the COPY
metadata copying option.spublic boolean putObjects(S3Bucket bucket, S3Object[] objects)
CreateObjectsEvent
notification events.
The maximum number of threads is controlled by the JetS3t configuration property s3service.max-admin-thread-count.
bucket
- the bucket to create the objects inobjects
- the objects to create/upload.public boolean deleteObjects(S3Bucket bucket, java.lang.String[] objectKeys)
DeleteObjectsEvent
notification events.
The maximum number of threads is controlled by the JetS3t configuration property s3service.admin-max-thread-count.
bucket
- the bucket containing the objects to be deletedobjectKeys
- key names of objects to deletepublic boolean deleteObjects(S3Bucket bucket, S3Object[] objects)
DeleteObjectsEvent
notification events.
The maximum number of threads is controlled by the JetS3t configuration property s3service.admin-max-thread-count.
bucket
- the bucket containing the objects to be deletedobjects
- the objects to deletepublic boolean deleteVersionsOfObjectWithMFA(java.lang.String[] versionIds, java.lang.String multiFactorSerialNumber, java.lang.String multiFactorAuthCode, java.lang.String bucketName, java.lang.String objectKey)
DeleteVersionedObjectsEvent
notification events. This will delete only the specific
version identified and will not affect any other Version or DeleteMarkers related to
the object.
The maximum number of threads is controlled by the JetS3t configuration property s3service.admin-max-thread-count.
versionIds
- the identifiers of the object versions that will be deleted.multiFactorSerialNumber
- the serial number for a multi-factor authentication device.multiFactorAuthCode
- a multi-factor authentication code generated by a device.bucketName
- the name of the versioned bucket containing the object to be deleted.objectKey
- the key representing the object in S3.public boolean deleteVersionsOfObject(java.lang.String[] versionIds, java.lang.String bucketName, java.lang.String objectKey)
DeleteVersionedObjectsEvent
notification events. This will delete only the specific
version identified and will not affect any other Version or DeleteMarkers related to
the object.
The maximum number of threads is controlled by the JetS3t configuration property s3service.admin-max-thread-count.
versionIds
- the identifiers of the object versions that will be deleted.bucketName
- the name of the versioned bucket containing the object to be deleted.objectKey
- the key representing the object in S3.public boolean getObjects(S3Bucket bucket, S3Object[] objects)
GetObjectsEvent
notification events.bucket
- the bucket containing the objects to retrieve.objects
- the objects to retrieve.public boolean getObjects(S3Bucket bucket, java.lang.String[] objectKeys)
GetObjectsEvent
notification events.
The maximum number of threads is controlled by the JetS3t configuration property s3service.max-thread-count.
bucket
- the bucket containing the objects to retrieve.objectKeys
- the key names of the objects to retrieve.public boolean getObjectsHeads(S3Bucket bucket, S3Object[] objects)
GetObjectHeadsEvent
notification events.bucket
- the bucket containing the objects whose details will be retrieved.objects
- the objects with details to retrieve.public boolean getObjectsHeads(S3Bucket bucket, java.lang.String[] objectKeys)
GetObjectHeadsEvent
notification events.
The maximum number of threads is controlled by the JetS3t configuration property s3service.admin-max-thread-count.
bucket
- the bucket containing the objects whose details will be retrieved.objectKeys
- the key names of the objects with details to retrieve.public boolean getObjectACLs(S3Bucket bucket, S3Object[] objects)
LookupACLEvent
notification events.
The maximum number of threads is controlled by the JetS3t configuration property s3service.admin-max-thread-count.
bucket
- the bucket containing the objectsobjects
- the objects to retrieve ACL details for.public boolean putACLs(S3Bucket bucket, S3Object[] objects)
UpdateACLEvent
notification events.
The maximum number of threads is controlled by the JetS3t configuration property s3service.admin-max-thread-count.
bucket
- the bucket containing the objectsobjects
- the objects to update/set ACL details for.public boolean downloadObjects(S3Bucket bucket, DownloadPackage[] downloadPackages) throws S3ServiceException
DownloadPackage
package. This method sends
DownloadObjectsEvent
notification events.
The maximum number of threads is controlled by the JetS3t configuration property s3service.max-thread-count.
If the JetS3t configuration property downloads.restoreLastModifiedDate is set
to true, any files created by this method will have their last modified date set according
to the value of the S3 object's Constants.METADATA_JETS3T_LOCAL_FILE_DATE
metadata
item.
bucket
- the bucket containing the objectsdownloadPackages
- an array of download packages containing the object to be downloaded, and able to build
an output stream where the object's contents will be written to.S3ServiceException
public boolean downloadObjects(DownloadPackage[] downloadPackages) throws S3ServiceException
DownloadObjectsEvent
notification events.
This method can only download S3 objects represented by DownloadPackage
packages based on signed URL. To download objects when you don't have
signed URLs, you must use the method
downloadObjects(S3Bucket, DownloadPackage[])
The maximum number of threads is controlled by the JetS3t configuration property s3service.max-thread-count.
If the JetS3t configuration property downloads.restoreLastModifiedDate is set
to true, any files created by this method will have their last modified date set according
to the value of the S3 object's Constants.METADATA_JETS3T_LOCAL_FILE_DATE
metadata
item.
downloadPackages
- an array of download packages containing the object to be downloaded, represented
with signed URL strings.S3ServiceException
public boolean getObjects(java.lang.String[] signedGetURLs) throws java.net.MalformedURLException, java.io.UnsupportedEncodingException
Object retrieval using signed GET URLs can be performed without the underlying S3Service knowing
the AWSCredentials for the target S3 account, however the underlying service must implement
the SignedUrlHandler
interface.
This method sends GetObjectHeadsEvent
notification events.
The maximum number of threads is controlled by the JetS3t configuration property s3service.max-thread-count.
signedGetURLs
- signed GET URL strings corresponding to the objects to be deleted.java.lang.IllegalStateException
- if the underlying S3Service does not implement SignedUrlHandler
java.net.MalformedURLException
java.io.UnsupportedEncodingException
public boolean getObjectsHeads(java.lang.String[] signedHeadURLs) throws java.net.MalformedURLException, java.io.UnsupportedEncodingException
Detail retrieval using signed HEAD URLs can be performed without the underlying S3Service knowing
the AWSCredentials for the target S3 account, however the underlying service must implement
the SignedUrlHandler
interface.
This method sends GetObjectHeadsEvent
notification events.
The maximum number of threads is controlled by the JetS3t configuration property s3service.admin-max-thread-count.
signedHeadURLs
- signed HEAD URL strings corresponding to the objects to be deleted.java.lang.IllegalStateException
- if the underlying S3Service does not implement SignedUrlHandler
java.net.MalformedURLException
java.io.UnsupportedEncodingException
public boolean putObjectsACLs(java.lang.String[] signedURLs, AccessControlList acl) throws java.net.MalformedURLException, java.io.UnsupportedEncodingException
UpdateACLEvent
notification events.
The S3 objects are represented as signed URLs.
The maximum number of threads is controlled by the JetS3t configuration property s3service.admin-max-thread-count.
signedURLs
- URL strings that are authenticated and signed to allow a PUT request to
be performed for the referenced object.acl
- the access control list settings to apply to the objects.java.net.MalformedURLException
java.io.UnsupportedEncodingException
public boolean deleteObjects(java.lang.String[] signedDeleteUrls) throws java.net.MalformedURLException, java.io.UnsupportedEncodingException
Deletes using signed DELETE URLs can be performed without the underlying S3Service knowing
the AWSCredentials for the target S3 account, however the underlying service must implement
the SignedUrlHandler
interface.
This method sends DeleteObjectsEvent
notification events.
The maximum number of threads is controlled by the JetS3t configuration property s3service.admin-max-thread-count.
signedDeleteUrls
- signed DELETE URL strings corresponding to the objects to be deleted.java.lang.IllegalStateException
- if the underlying S3Service does not implement SignedUrlHandler
java.net.MalformedURLException
java.io.UnsupportedEncodingException
public boolean putObjects(SignedUrlAndObject[] signedPutUrlAndObjects)
Uploads using signed PUT URLs can be performed without the underlying S3Service knowing
the AWSCredentials for the target S3 account, however the underlying service must implement
the SignedUrlHandler
interface.
This method sends CreateObjectsEvent
notification events.
The maximum number of threads is controlled by the JetS3t configuration property s3service.max-thread-count.
signedPutUrlAndObjects
- packages containing the S3Object to upload and the corresponding signed PUT URL.java.lang.IllegalStateException
- if the underlying S3Service does not implement SignedUrlHandler
public boolean getObjectsACLs(java.lang.String[] signedAclURLs) throws java.net.MalformedURLException, java.io.UnsupportedEncodingException
Object retrieval using signed GET URLs can be performed without the underlying S3Service knowing
the AWSCredentials for the target S3 account, however the underlying service must implement
the SignedUrlHandler
interface.
This method sends LookupACLEvent
notification events.
The maximum number of threads is controlled by the JetS3t configuration property s3service.max-thread-count.
signedAclURLs
- signed GET URL strings corresponding to the objects to be queried.java.lang.IllegalStateException
- if the underlying S3Service does not implement SignedUrlHandler
java.net.MalformedURLException
java.io.UnsupportedEncodingException