org.jets3t.service.multithread
Class S3ServiceMulti

java.lang.Object
  extended by org.jets3t.service.multithread.S3ServiceMulti

Deprecated. 0.8.0 use ThreadedStorageService instead.

@Deprecated
public class S3ServiceMulti
extends Object

S3 service wrapper that performs multiple S3 requests at a time using multi-threading and an underlying thread-safe 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

Author:
James Murty

Constructor Summary
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.
 
Method Summary
 void addServiceEventListener(S3ServiceEventListener listener)
          Deprecated. Adds a service event listener to the set of listeners that will be notified of events.
 boolean copyObjects(String sourceBucketName, String destinationBucketName, 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, String[] objectKeys)
          Deprecated. Deletes multiple objects from a bucket, and sends DeleteObjectsEvent notification events.
 boolean deleteObjects(String[] signedDeleteUrls)
          Deprecated. Deletes multiple objects from a bucket using signed DELETE URLs corresponding to those objects.
 boolean deleteVersionsOfObject(String[] versionIds, String bucketName, String objectKey)
          Deprecated. Delete multiple object versions from a bucket in S3, and sends DeleteVersionedObjectsEvent notification events.
 boolean deleteVersionsOfObjectWithMFA(String[] versionIds, String multiFactorSerialNumber, String multiFactorAuthCode, String bucketName, 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.
 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, String[] objectKeys)
          Deprecated. Retrieves multiple objects (details and data) from a bucket, and sends GetObjectsEvent notification events.
 boolean getObjects(String[] signedGetURLs)
          Deprecated. Retrieves multiple objects (details and data) from a bucket using signed GET URLs corresponding to those objects.
 boolean getObjectsACLs(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, String[] objectKeys)
          Deprecated. Retrieves details (but no data) about multiple objects from a bucket, and sends GetObjectHeadsEvent notification events.
 boolean getObjectsHeads(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(String bucketName, String[] prefixes, 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(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.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

S3ServiceMulti

public 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. EVENT_IN_PROGRESS events are sent at the default time interval of 500ms.

Parameters:
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.

S3ServiceMulti

public 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.

Parameters:
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.
Method Detail

shutdown

public void shutdown()
              throws S3ServiceException
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. After calling this method the service instance will no longer be usable -- a new instance must be created to do more work.

Throws:
S3ServiceException

isShutdown

public boolean isShutdown()
Deprecated. 
Returns:
true if the 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.

getS3Service

public S3Service getS3Service()
Deprecated. 
Returns:
the underlying S3 service implementation.

addServiceEventListener

public void addServiceEventListener(S3ServiceEventListener listener)
Deprecated. 
Adds a service event listener to the set of listeners that will be notified of events.

Parameters:
listener - an event listener to add to the event notification chain.

removeServiceEventListener

public void removeServiceEventListener(S3ServiceEventListener listener)
Deprecated. 
Removes a service event listener from the set of listeners that will be notified of events.

Parameters:
listener - an event listener to remove from the event notification chain.

isAuthenticatedConnection

public boolean isAuthenticatedConnection()
Deprecated. 
Returns:
true if the underlying S3Service implementation is authenticated.

getAWSCredentials

public ProviderCredentials getAWSCredentials()
Deprecated. 
Returns:
the AWS credentials in the underlying S3Service.

listObjects

public boolean listObjects(String bucketName,
                           String[] prefixes,
                           String delimiter,
                           long maxListingLength)
Deprecated. 
Lists the objects in a bucket based on an array of prefix strings, and sends 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.

Parameters:
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.

Returns:
true if all the threaded tasks completed successfully, false otherwise.

createBuckets

public boolean createBuckets(S3Bucket[] buckets)
Deprecated. 
Creates multiple buckets, and sends CreateBucketsEvent notification events.

The maximum number of threads is controlled by the JetS3t configuration property s3service.admin-max-thread-count.

Parameters:
buckets - the buckets to create.
Returns:
true if all the threaded tasks completed successfully, false otherwise.

copyObjects

public boolean copyObjects(String sourceBucketName,
                           String destinationBucketName,
                           String[] sourceObjectKeys,
                           S3Object[] destinationObjects,
                           boolean replaceMetadata)
Deprecated. 
Copies multiple objects within or between buckets, while sending CopyObjectsEvent notification events.

The maximum number of threads is controlled by the JetS3t configuration property s3service.admin-max-thread-count.

Parameters:
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.s
Returns:
true if all the threaded tasks completed successfully, false otherwise.

putObjects

public boolean putObjects(S3Bucket bucket,
                          S3Object[] objects)
Deprecated. 
Creates multiple objects in a bucket, and sends CreateObjectsEvent notification events.

The maximum number of threads is controlled by the JetS3t configuration property s3service.max-admin-thread-count.

Parameters:
bucket - the bucket to create the objects in
objects - the objects to create/upload.
Returns:
true if all the threaded tasks completed successfully, false otherwise.

deleteObjects

public boolean deleteObjects(S3Bucket bucket,
                             String[] objectKeys)
Deprecated. 
Deletes multiple objects from a bucket, and sends DeleteObjectsEvent notification events.

The maximum number of threads is controlled by the JetS3t configuration property s3service.admin-max-thread-count.

Parameters:
bucket - the bucket containing the objects to be deleted
objectKeys - key names of objects to delete
Returns:
true if all the threaded tasks completed successfully, false otherwise.

deleteObjects

public boolean deleteObjects(S3Bucket bucket,
                             S3Object[] objects)
Deprecated. 
Deletes multiple objects from a bucket, and sends DeleteObjectsEvent notification events.

The maximum number of threads is controlled by the JetS3t configuration property s3service.admin-max-thread-count.

Parameters:
bucket - the bucket containing the objects to be deleted
objects - the objects to delete
Returns:
true if all the threaded tasks completed successfully, false otherwise.

deleteVersionsOfObjectWithMFA

public boolean deleteVersionsOfObjectWithMFA(String[] versionIds,
                                             String multiFactorSerialNumber,
                                             String multiFactorAuthCode,
                                             String bucketName,
                                             String objectKey)
Deprecated. 
Delete multiple object versions from a bucket in S3, and sends 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.

Parameters:
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.
Returns:
true if all the threaded tasks completed successfully, false otherwise.

deleteVersionsOfObject

public boolean deleteVersionsOfObject(String[] versionIds,
                                      String bucketName,
                                      String objectKey)
Deprecated. 
Delete multiple object versions from a bucket in S3, and sends 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.

Parameters:
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.
Returns:
true if all the threaded tasks completed successfully, false otherwise.

getObjects

public boolean getObjects(S3Bucket bucket,
                          S3Object[] objects)
Deprecated. 
Retrieves multiple objects (details and data) from a bucket, and sends GetObjectsEvent notification events.

Parameters:
bucket - the bucket containing the objects to retrieve.
objects - the objects to retrieve.
Returns:
true if all the threaded tasks completed successfully, false otherwise.

getObjects

public boolean getObjects(S3Bucket bucket,
                          String[] objectKeys)
Deprecated. 
Retrieves multiple objects (details and data) from a bucket, and sends GetObjectsEvent notification events.

The maximum number of threads is controlled by the JetS3t configuration property s3service.max-thread-count.

Parameters:
bucket - the bucket containing the objects to retrieve.
objectKeys - the key names of the objects to retrieve.
Returns:
true if all the threaded tasks completed successfully, false otherwise.

getObjectsHeads

public boolean getObjectsHeads(S3Bucket bucket,
                               S3Object[] objects)
Deprecated. 
Retrieves details (but no data) about multiple objects from a bucket, and sends GetObjectHeadsEvent notification events.

Parameters:
bucket - the bucket containing the objects whose details will be retrieved.
objects - the objects with details to retrieve.
Returns:
true if all the threaded tasks completed successfully, false otherwise.

getObjectsHeads

public boolean getObjectsHeads(S3Bucket bucket,
                               String[] objectKeys)
Deprecated. 
Retrieves details (but no data) about multiple objects from a bucket, and sends GetObjectHeadsEvent notification events.

The maximum number of threads is controlled by the JetS3t configuration property s3service.admin-max-thread-count.

Parameters:
bucket - the bucket containing the objects whose details will be retrieved.
objectKeys - the key names of the objects with details to retrieve.
Returns:
true if all the threaded tasks completed successfully, false otherwise.

getObjectACLs

public boolean getObjectACLs(S3Bucket bucket,
                             S3Object[] objects)
Deprecated. 
Retrieves Access Control List (ACL) information for multiple objects from a bucket, and sends LookupACLEvent notification events.

The maximum number of threads is controlled by the JetS3t configuration property s3service.admin-max-thread-count.

Parameters:
bucket - the bucket containing the objects
objects - the objects to retrieve ACL details for.
Returns:
true if all the threaded tasks completed successfully, false otherwise.

putACLs

public 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.

The maximum number of threads is controlled by the JetS3t configuration property s3service.admin-max-thread-count.

Parameters:
bucket - the bucket containing the objects
objects - the objects to update/set ACL details for.
Returns:
true if all the threaded tasks completed successfully, false otherwise.

downloadObjects

public boolean downloadObjects(S3Bucket bucket,
                               DownloadPackage[] downloadPackages)
                        throws S3ServiceException
Deprecated. 
A convenience method to download multiple objects from S3 to pre-existing output streams, which is particularly useful for downloading objects to files. The S3 objects can be represented as S3Objects or as signed URLs in a 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.

Parameters:
bucket - the bucket containing the objects
downloadPackages - 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.
Returns:
true if all the threaded tasks completed successfully, false otherwise.
Throws:
S3ServiceException

downloadObjects

public boolean downloadObjects(DownloadPackage[] downloadPackages)
                        throws S3ServiceException
Deprecated. 
A convenience method to download multiple objects from S3 to pre-existing output streams, which is particularly useful for downloading objects to files. This method sends 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.

Parameters:
downloadPackages - an array of download packages containing the object to be downloaded, represented with signed URL strings.
Returns:
true if all the threaded tasks completed successfully, false otherwise.
Throws:
S3ServiceException

getObjects

public boolean getObjects(String[] signedGetURLs)
                   throws MalformedURLException,
                          UnsupportedEncodingException
Deprecated. 
Retrieves multiple objects (details and data) from a bucket using signed GET URLs corresponding to those objects.

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.

Parameters:
signedGetURLs - signed GET URL strings corresponding to the objects to be deleted.
Returns:
true if all the threaded tasks completed successfully, false otherwise.
Throws:
IllegalStateException - if the underlying S3Service does not implement SignedUrlHandler
MalformedURLException
UnsupportedEncodingException

getObjectsHeads

public boolean getObjectsHeads(String[] signedHeadURLs)
                        throws MalformedURLException,
                               UnsupportedEncodingException
Deprecated. 
Retrieves details (but no data) about multiple objects using signed HEAD URLs corresponding to those objects.

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.

Parameters:
signedHeadURLs - signed HEAD URL strings corresponding to the objects to be deleted.
Returns:
true if all the threaded tasks completed successfully, false otherwise.
Throws:
IllegalStateException - if the underlying S3Service does not implement SignedUrlHandler
MalformedURLException
UnsupportedEncodingException

putObjectsACLs

public boolean putObjectsACLs(String[] signedURLs,
                              AccessControlList acl)
                       throws MalformedURLException,
                              UnsupportedEncodingException
Deprecated. 
Updates/sets Access Control List (ACL) information for multiple objects in a bucket, and sends 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.

Parameters:
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.
Returns:
true if all the threaded tasks completed successfully, false otherwise.
Throws:
MalformedURLException
UnsupportedEncodingException

deleteObjects

public boolean deleteObjects(String[] signedDeleteUrls)
                      throws MalformedURLException,
                             UnsupportedEncodingException
Deprecated. 
Deletes multiple objects from a bucket using signed DELETE URLs corresponding to those objects.

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.

Parameters:
signedDeleteUrls - signed DELETE URL strings corresponding to the objects to be deleted.
Returns:
true if all the threaded tasks completed successfully, false otherwise.
Throws:
IllegalStateException - if the underlying S3Service does not implement SignedUrlHandler
MalformedURLException
UnsupportedEncodingException

putObjects

public boolean putObjects(SignedUrlAndObject[] signedPutUrlAndObjects)
Deprecated. 
Creates multiple objects in a bucket using a pre-signed PUT URL for each object.

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.

Parameters:
signedPutUrlAndObjects - packages containing the S3Object to upload and the corresponding signed PUT URL.
Returns:
true if all the threaded tasks completed successfully, false otherwise.
Throws:
IllegalStateException - if the underlying S3Service does not implement SignedUrlHandler

getObjectsACLs

public boolean getObjectsACLs(String[] signedAclURLs)
                       throws MalformedURLException,
                              UnsupportedEncodingException
Deprecated. 
Retrieves ACL information about multiple objects from a bucket using signed GET ACL URLs corresponding to those objects. The S3 objects are represented as signed URLs.

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.

Parameters:
signedAclURLs - signed GET URL strings corresponding to the objects to be queried.
Returns:
true if all the threaded tasks completed successfully, false otherwise.
Throws:
IllegalStateException - if the underlying S3Service does not implement SignedUrlHandler
MalformedURLException
UnsupportedEncodingException