Package org.cdlib.mrt.s3v2.aws
Class AWSS3V2Cloud
java.lang.Object
org.cdlib.mrt.s3.service.CloudStoreAbs
org.cdlib.mrt.s3v2.aws.AWSS3V2Cloud
- All Implemented Interfaces:
CloudStoreInf
Specific SDSC Storage Cloud handling
- Author:
- dloy
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from interface org.cdlib.mrt.s3.service.CloudStoreInf
CloudStoreInf.CloudAPI -
Field Summary
FieldsFields inherited from class org.cdlib.mrt.s3.service.CloudStoreAbs
cloudProp, endpointHostname, logger -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedAWSS3V2Cloud(V2Client v2Client, org.cdlib.mrt.utility.LoggerInf log) -
Method Summary
Modifier and TypeMethodDescriptionprotected static voidaddProp(Properties prop, String key, String value) booleanawsConvertStorageClass(String bucket, String key, software.amazon.awssdk.services.s3.model.StorageClass targetStorageClass, CloudResponse response) Convert from one AWS storage class to anotherawsDelete(CloudResponse response) voidawsGet(String container, String key, File outFile, CloudResponse response) awsGetInputStream(String container, String key, CloudResponse response) voidawsHandleException(CloudResponse response, Exception exception) voidawsListAfter(String bucketName, String startAfter, int maxKeys, CloudResponse response) protected voidawsListPrefix(String bucket, String listPrefix, int maxEntries, CloudResponse response) List entriesvoidawsRestore(String container, String key, File outFile, CloudResponse response) convertStorageClass(String bucket, String key, software.amazon.awssdk.services.s3.model.StorageClass targetStorageClass) booleanconvertStorageClass(String bucket, String key, software.amazon.awssdk.services.s3.model.StorageClass targetStorageClass, CloudResponse response) Convert from one AWS storage class to anotherdeleteManifest(String bucketName, org.cdlib.mrt.core.Identifier objectID) Delete cloud manifestdeleteObject(String bucket, String key) Delete objectdeleteObject(String bucketName, org.cdlib.mrt.core.Identifier objectID, int versionID, String fileID) Delete cloud objectstatic AWSS3V2CloudgetAWS(org.cdlib.mrt.utility.LoggerInf log) getCloudResponse(String bucketName, String key) org.cdlib.mrt.utility.LoggerInfgetManifest(String bucket, org.cdlib.mrt.core.Identifier objectID) Retrieve cloud manifestgetManifest(String bucket, org.cdlib.mrt.core.Identifier objectID, CloudResponse response) Retrieve cloud manifeststatic AWSS3V2CloudvoidgetObject(String container, String key, File outFile, CloudResponse response) Retrieve content into a filegetObject(String bucketName, String key, CloudResponse response) Retrieve cloud objectgetObject(String name, org.cdlib.mrt.core.Identifier objectID, int versionID, String fileID, CloudResponse response) Retrieve cloud ObjectgetObjectList(String bucketName) Return info on bucket/containergetObjectList(String bucketName, String key) Return content that matches for the length of the keygetObjectList(String bucketName, String key, int limit) Return a set number of entry metadata based on start keygetObjectList(String bucketName, org.cdlib.mrt.core.Identifier objectID, Integer versionID, String fileID) getObjectListAfter(String bucketName, String afterKey, int limit) Return list of S3 keys after a start keygetObjectMeta(String bucketName, String key) Retrieve metadata for filegetObjectStreaming(String bucketName, String key, CloudResponse response) Retrieve cloud object in streaming modegetPreSigned(long expirationMinutes, String bucketName, String key, String contentType, String contentDisp) Returns an S3 presigned URLgetRangeStream(String bucketName, String key, long start, long stop, CloudResponse response) Return part of a cloud object as streamgetRetryObjectMeta(String bucketName, String key, int retryCnt) static AWSS3V2CloudReturn state of cloud store managersoftware.amazon.awssdk.services.s3.model.StorageClasssoftware.amazon.awssdk.services.s3.model.StorageClassgetStorageClass(String bucketName, String key) getType()Return the API typestatic AWSS3V2CloudDetermine if host:port is availablebooleanBecause of earlier SDSC bug only alpha-numerics could be used in a key.putManifest(String bucketName, org.cdlib.mrt.core.Identifier objectID, File inputFile) Upload cloud manifestUpload cloud objectputObject(String bucketName, String key, File inputFile, Properties fileMeta) putObject(String bucketName, org.cdlib.mrt.core.Identifier objectID, int versionID, String fileID, File inputFile) Upload cloud objectputObject(String bucketName, org.cdlib.mrt.core.Identifier objectID, int versionID, String fileID, File inputFile, Properties fileMeta) putObject(CloudResponse response, File inputFile) voidrestoreObject(String container, String key, File outFile, CloudResponse response) Restore nearline contentvoidretryAWSConvertStorageClass(String bucket, String key, software.amazon.awssdk.services.s3.model.StorageClass targetStorageClass) voidsetS3Type(AWSS3V2Cloud.S3Type s3Type) voidsetStorageClass(String storageClassS) voidsetStorageClass(software.amazon.awssdk.services.s3.model.StorageClass storageClass) Methods inherited from class org.cdlib.mrt.s3.service.CloudStoreAbs
dumpException, getCloudProp, handleException, isAliveTest, isValidFile, validateDigest, validateMd5Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.cdlib.mrt.s3.service.CloudStoreInf
getCloudProp, validateDigest, validateMd5
-
Field Details
-
NAME
- See Also:
-
MESSAGE
- See Also:
-
-
Constructor Details
-
AWSS3V2Cloud
protected AWSS3V2Cloud(V2Client v2Client, org.cdlib.mrt.utility.LoggerInf log) throws org.cdlib.mrt.utility.TException - Throws:
org.cdlib.mrt.utility.TException
-
-
Method Details
-
getAWS
public static AWSS3V2Cloud getAWS(org.cdlib.mrt.utility.LoggerInf log) throws org.cdlib.mrt.utility.TException - Throws:
org.cdlib.mrt.utility.TException
-
getMinio
public static AWSS3V2Cloud getMinio(String accessKey, String secretKey, String endpoint, org.cdlib.mrt.utility.LoggerInf log) throws org.cdlib.mrt.utility.TException - Throws:
org.cdlib.mrt.utility.TException
-
getSDSC
public static AWSS3V2Cloud getSDSC(String accessKey, String secretKey, String endpoint, org.cdlib.mrt.utility.LoggerInf log) throws org.cdlib.mrt.utility.TException - Throws:
org.cdlib.mrt.utility.TException
-
getWasabi
public static AWSS3V2Cloud getWasabi(String accessKey, String secretKey, String endpoint, org.cdlib.mrt.utility.LoggerInf log) throws org.cdlib.mrt.utility.TException - Throws:
org.cdlib.mrt.utility.TException
-
putObject
public CloudResponse putObject(CloudResponse response, File inputFile) throws org.cdlib.mrt.utility.TException - Throws:
org.cdlib.mrt.utility.TException
-
putObject
public CloudResponse putObject(String bucket, String key, File inputFile) throws org.cdlib.mrt.utility.TException Description copied from interface:CloudStoreInfUpload cloud object- Specified by:
putObjectin interfaceCloudStoreInf- Parameters:
bucket- s3 bucket - rackspace containerkey- entry key to be addedinputFile- file to be uploaded- Returns:
- information about upload
- Throws:
org.cdlib.mrt.utility.TException
-
putObject
public CloudResponse putObject(String bucketName, org.cdlib.mrt.core.Identifier objectID, int versionID, String fileID, File inputFile) throws org.cdlib.mrt.utility.TException Description copied from interface:CloudStoreInfUpload cloud object- Specified by:
putObjectin interfaceCloudStoreInf- Parameters:
bucketName- s3 bucket - rackspace containerobjectID- Object identifierversionID- Version identifierfileID- File/component identifier that may contain a directory elementinputFile- file to be uploaded- Returns:
- information about upload
- Throws:
org.cdlib.mrt.utility.TException
-
putObject
public CloudResponse putObject(String bucketName, String key, File inputFile, Properties fileMeta) throws org.cdlib.mrt.utility.TException - Throws:
org.cdlib.mrt.utility.TException
-
putObject
public CloudResponse putObject(String bucketName, org.cdlib.mrt.core.Identifier objectID, int versionID, String fileID, File inputFile, Properties fileMeta) throws org.cdlib.mrt.utility.TException - Throws:
org.cdlib.mrt.utility.TException
-
putManifest
public CloudResponse putManifest(String bucketName, org.cdlib.mrt.core.Identifier objectID, File inputFile) throws org.cdlib.mrt.utility.TException Description copied from interface:CloudStoreInfUpload cloud manifest- Specified by:
putManifestin interfaceCloudStoreInf- Parameters:
bucketName- s3 bucket - rackspace containerobjectID- Object identifierinputFile- manifest file to be uploaded- Returns:
- information about upload
- Throws:
org.cdlib.mrt.utility.TException
-
awsDelete
- Throws:
org.cdlib.mrt.utility.TException
-
deleteObject
public CloudResponse deleteObject(String bucket, String key) throws org.cdlib.mrt.utility.TException Description copied from interface:CloudStoreInfDelete object- Specified by:
deleteObjectin interfaceCloudStoreInf- Parameters:
bucket- s3 bucket - rackspace containerkey- cloud object key- Returns:
- Throws:
org.cdlib.mrt.utility.TException
-
deleteObject
public CloudResponse deleteObject(String bucketName, org.cdlib.mrt.core.Identifier objectID, int versionID, String fileID) throws org.cdlib.mrt.utility.TException Description copied from interface:CloudStoreInfDelete cloud object- Specified by:
deleteObjectin interfaceCloudStoreInf- Parameters:
bucketName- s3 bucket - rackspace containerobjectID- Object identifierversionID- Version identifierfileID- File/component identifier that may contain a directory element- Returns:
- Throws:
org.cdlib.mrt.utility.TException
-
deleteManifest
public CloudResponse deleteManifest(String bucketName, org.cdlib.mrt.core.Identifier objectID) throws org.cdlib.mrt.utility.TException Description copied from interface:CloudStoreInfDelete cloud manifest- Specified by:
deleteManifestin interfaceCloudStoreInf- Parameters:
bucketName- s3 bucket - rackspace containerobjectID- Object identifier- Returns:
- Throws:
org.cdlib.mrt.utility.TException
-
awsGet
public void awsGet(String container, String key, File outFile, CloudResponse response) throws org.cdlib.mrt.utility.TException - Throws:
org.cdlib.mrt.utility.TException
-
awsGetInputStream
public InputStream awsGetInputStream(String container, String key, CloudResponse response) throws org.cdlib.mrt.utility.TException - Throws:
org.cdlib.mrt.utility.TException
-
awsRestore
public void awsRestore(String container, String key, File outFile, CloudResponse response) throws org.cdlib.mrt.utility.TException - Throws:
org.cdlib.mrt.utility.TException
-
convertStorageClass
public boolean convertStorageClass(String bucket, String key, software.amazon.awssdk.services.s3.model.StorageClass targetStorageClass, CloudResponse response) throws org.cdlib.mrt.utility.TException Convert from one AWS storage class to another- Parameters:
bucket- AWS bucketkey- AWS keytargetStorageClass- resulting storage class for conversionresponse- Broad response information- Returns:
- true=complete
- Throws:
org.cdlib.mrt.utility.TException
-
awsConvertStorageClass
public boolean awsConvertStorageClass(String bucket, String key, software.amazon.awssdk.services.s3.model.StorageClass targetStorageClass, CloudResponse response) throws org.cdlib.mrt.utility.TException Convert from one AWS storage class to another- Parameters:
bucket- AWS bucketkey- AWS keytargetStorageClass- resulting storage class for conversionresponse- Broad response information- Returns:
- true=complete
- Throws:
org.cdlib.mrt.utility.TException
-
retryAWSConvertStorageClass
public void retryAWSConvertStorageClass(String bucket, String key, software.amazon.awssdk.services.s3.model.StorageClass targetStorageClass) throws Exception - Throws:
Exception
-
convertStorageClass
public CloudResponse convertStorageClass(String bucket, String key, software.amazon.awssdk.services.s3.model.StorageClass targetStorageClass) throws org.cdlib.mrt.utility.TException - Throws:
org.cdlib.mrt.utility.TException
-
restoreObject
public void restoreObject(String container, String key, File outFile, CloudResponse response) throws org.cdlib.mrt.utility.TException Description copied from interface:CloudStoreInfRestore nearline content- Specified by:
restoreObjectin interfaceCloudStoreInf- Parameters:
key- cloud keyoutFile- target file of responseresponse-- Throws:
org.cdlib.mrt.utility.TException
-
getObject
public InputStream getObject(String name, org.cdlib.mrt.core.Identifier objectID, int versionID, String fileID, CloudResponse response) throws org.cdlib.mrt.utility.TException Description copied from interface:CloudStoreInfRetrieve cloud Object- Specified by:
getObjectin interfaceCloudStoreInf- Parameters:
name- s3 bucket - rackspace containerobjectID- Object identifierversionID- Version identifierfileID- File/component identifier that may contain a directory elementresponse- input stream of retrieved object- Returns:
- Throws:
org.cdlib.mrt.utility.TException
-
getObject
public InputStream getObject(String bucketName, String key, CloudResponse response) throws org.cdlib.mrt.utility.TException Description copied from interface:CloudStoreInfRetrieve cloud object- Specified by:
getObjectin interfaceCloudStoreInf- Specified by:
getObjectin classCloudStoreAbs- Parameters:
bucketName- s3 bucket - rackspace containerkey- cloud object key for object to be returnedresponse-- Returns:
- input stream of retrieved object
- Throws:
org.cdlib.mrt.utility.TException
-
getObjectStreaming
public InputStream getObjectStreaming(String bucketName, String key, CloudResponse response) throws org.cdlib.mrt.utility.TException Description copied from interface:CloudStoreInfRetrieve cloud object in streaming mode- Specified by:
getObjectStreamingin interfaceCloudStoreInf- Parameters:
bucketName- s3 bucket - rackspace containerkey- cloud object key for object to be returnedresponse-- Returns:
- input stream of retrieved object
- Throws:
org.cdlib.mrt.utility.TException
-
getObject
public void getObject(String container, String key, File outFile, CloudResponse response) throws org.cdlib.mrt.utility.TException Description copied from interface:CloudStoreInfRetrieve content into a file- Specified by:
getObjectin interfaceCloudStoreInf- Parameters:
container- s3 bucket - rackspace containerkey- cloud object key for object to be returnedoutFile- file to receive contentresponse-- Throws:
org.cdlib.mrt.utility.TException
-
getObjectMeta
Description copied from interface:CloudStoreInfRetrieve metadata for file- Specified by:
getObjectMetain interfaceCloudStoreInf- Parameters:
bucketName- s3 bucket - rackspace containerkey- cloud object key for object to be returned- Returns:
- exists: named properties; does not exist: null
-
getRetryObjectMeta
-
getStorageClass
public software.amazon.awssdk.services.s3.model.StorageClass getStorageClass(String bucketName, String key) throws org.cdlib.mrt.utility.TException - Throws:
org.cdlib.mrt.utility.TException
-
getCloudResponse
public CloudResponse getCloudResponse(String bucketName, String key) throws org.cdlib.mrt.utility.TException - Throws:
org.cdlib.mrt.utility.TException
-
addProp
-
getManifest
public InputStream getManifest(String bucket, org.cdlib.mrt.core.Identifier objectID) throws org.cdlib.mrt.utility.TException Description copied from interface:CloudStoreInfRetrieve cloud manifest- Specified by:
getManifestin interfaceCloudStoreInf- Parameters:
bucket- s3 bucket - rackspace containerobjectID- Object identifier- Returns:
- input stream of retrieved manifest
- Throws:
org.cdlib.mrt.utility.TException
-
getManifest
public InputStream getManifest(String bucket, org.cdlib.mrt.core.Identifier objectID, CloudResponse response) throws org.cdlib.mrt.utility.TException Description copied from interface:CloudStoreInfRetrieve cloud manifest- Specified by:
getManifestin interfaceCloudStoreInf- Parameters:
bucket- s3 bucket - rackspace containerobjectID- Object identifierresponse-- Returns:
- input stream of retrieved object
- Throws:
org.cdlib.mrt.utility.TException
-
awsListPrefix
protected void awsListPrefix(String bucket, String listPrefix, int maxEntries, CloudResponse response) throws org.cdlib.mrt.utility.TException List entries- Parameters:
bucket- - non AWS bucket namelistPrefix- what to truncate on as if aws prefix not theremaxEntries- maximum entries to returnresponse- filled CloudResponse- Throws:
org.cdlib.mrt.utility.TException
-
awsListAfter
public void awsListAfter(String bucketName, String startAfter, int maxKeys, CloudResponse response) throws org.cdlib.mrt.utility.TException - Throws:
org.cdlib.mrt.utility.TException
-
getObjectList
public CloudResponse getObjectList(String bucketName, org.cdlib.mrt.core.Identifier objectID, Integer versionID, String fileID) throws org.cdlib.mrt.utility.TException - Throws:
org.cdlib.mrt.utility.TException
-
getObjectList
public CloudResponse getObjectList(String bucketName, String key) throws org.cdlib.mrt.utility.TException Description copied from interface:CloudStoreInfReturn content that matches for the length of the key- Specified by:
getObjectListin interfaceCloudStoreInf- Specified by:
getObjectListin classCloudStoreAbs- Parameters:
bucketName- s3 bucket - rackspace containerkey- prefix of content to be returned- Returns:
- CloudResponse with list of matching entries
- Throws:
org.cdlib.mrt.utility.TException
-
getObjectList
public CloudResponse getObjectList(String bucketName, String key, int limit) throws org.cdlib.mrt.utility.TException Description copied from interface:CloudStoreInfReturn a set number of entry metadata based on start key- Specified by:
getObjectListin interfaceCloudStoreInf- Parameters:
bucketName- s3 bucket - rackspace containerkey- content key of the first outputlimit- number of returned entries- Returns:
- CloudResponse with list of sequential entries
- Throws:
org.cdlib.mrt.utility.TException
-
getObjectListAfter
public CloudResponse getObjectListAfter(String bucketName, String afterKey, int limit) throws org.cdlib.mrt.utility.TException Description copied from interface:CloudStoreInfReturn list of S3 keys after a start key- Specified by:
getObjectListAfterin interfaceCloudStoreInf- Parameters:
bucketName- s3 bucketafterKey- start return list after this valuelimit- number of keys to return- Returns:
- cloud response with keys
- Throws:
org.cdlib.mrt.utility.TException
-
getObjectList
Description copied from interface:CloudStoreInfReturn info on bucket/container- Specified by:
getObjectListin interfaceCloudStoreInf- Parameters:
bucketName- s3 bucket - rackspace container- Returns:
- Throws:
org.cdlib.mrt.utility.TException
-
getState
Description copied from interface:CloudStoreInfReturn state of cloud store manager- Specified by:
getStatein interfaceCloudStoreInf- Parameters:
bucketName- bucket container- Returns:
- Throws:
org.cdlib.mrt.utility.TException
-
getStorageClass
public software.amazon.awssdk.services.s3.model.StorageClass getStorageClass() -
setStorageClass
public void setStorageClass(software.amazon.awssdk.services.s3.model.StorageClass storageClass) -
setStorageClass
-
isAlphaNumericKey
public boolean isAlphaNumericKey()Description copied from interface:CloudStoreInfBecause of earlier SDSC bug only alpha-numerics could be used in a key. true=alpha-numeric key, false=ASCII (current default)- Specified by:
isAlphaNumericKeyin interfaceCloudStoreInf- Returns:
-
awsHandleException
public void awsHandleException(CloudResponse response, Exception exception) throws org.cdlib.mrt.utility.TException - Throws:
org.cdlib.mrt.utility.TException
-
isAlive
Description copied from interface:CloudStoreInfDetermine if host:port is available- Specified by:
isAlivein interfaceCloudStoreInf- Returns:
- true=alive; false=not alive; null=test not performed
-
getPreSigned
public CloudResponse getPreSigned(long expirationMinutes, String bucketName, String key, String contentType, String contentDisp) throws org.cdlib.mrt.utility.TException Description copied from interface:CloudStoreInfReturns an S3 presigned URL- Specified by:
getPreSignedin interfaceCloudStoreInf- Parameters:
expirationMinutes- minutes for the signed URL to workbucketName- cloud containerkey- cloud keycontentType- optional ContentType for this filecontentDisp- optional ContentDisposition for this file- Returns:
- CloudResponse where response.getReturnURL returns the presigned URL
- Throws:
org.cdlib.mrt.utility.TException
-
getRangeStream
public InputStream getRangeStream(String bucketName, String key, long start, long stop, CloudResponse response) throws org.cdlib.mrt.utility.TException Description copied from interface:CloudStoreInfReturn part of a cloud object as stream- Specified by:
getRangeStreamin interfaceCloudStoreInf- Parameters:
bucketName- cloud containerkey- cloud keystart- byte location to start from zerostop- byte location to stop from zeroresponse- Res[pmse tp reqiest- Returns:
- input stream for segment
- Throws:
org.cdlib.mrt.utility.TException
-
getType
Description copied from interface:CloudStoreInfReturn the API type- Specified by:
getTypein interfaceCloudStoreInf- Returns:
- AWS-S3, SDSC-Swift, Cloudhost, Pairtree
-
getLogger
public org.cdlib.mrt.utility.LoggerInf getLogger() -
getS3Type
-
setS3Type
-