Package org.cdlib.mrt.s3.pairtree
Class PairtreeCloud
java.lang.Object
org.cdlib.mrt.s3.service.CloudStoreAbs
org.cdlib.mrt.s3.pairtree.PairtreeCloud
- All Implemented Interfaces:
CloudStoreInf
Specific SDSC Storage Cloud handling
- Author:
- dloy
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.cdlib.mrt.s3.service.CloudStoreInf
CloudStoreInf.CloudAPI
-
Field Summary
Fields inherited from class org.cdlib.mrt.s3.service.CloudStoreAbs
cloudProp, endpointHostname, log4j, logger, MESSAGE, NAME
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
PairtreeCloud
(boolean pairPath, org.cdlib.mrt.utility.LoggerInf logger) -
Method Summary
Modifier and TypeMethodDescriptionstatic File
buildPairDirectoryRetry
(File baseDir, String pairKey, int retryCnt) deleteManifest
(String bucketName, org.cdlib.mrt.core.Identifier objectID) Delete cloud manifestdeleteObject
(String bucketName, String key) Delete objectdeleteObject
(String bucketName, org.cdlib.mrt.core.Identifier objectID, int versionID, String fileID) Delete cloud objectprotected File
protected File
protected File
getDirRead
(File baseDir, String key) getManifest
(String bucketName, org.cdlib.mrt.core.Identifier objectID) Retrieve cloud manifestgetManifest
(String bucketName, org.cdlib.mrt.core.Identifier objectID, CloudResponse response) Retrieve cloud manifestvoid
getObject
(String bucketName, String key, File outFile, CloudResponse response) Retrieve content into a filegetObject
(String bucketName, String key, CloudResponse response) Retrieve cloud objectgetObject
(String bucketName, 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 container, String key, CloudResponse response) Retrieve cloud object in streaming modestatic PairtreeCloud
getPairtreeCloud
(boolean pairPath, org.cdlib.mrt.utility.LoggerInf logger) getPreSigned
(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 streamReturn state of cloud store managergetType()
Return the API typeDetermine if host:port is availableboolean
Because 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 cloudProperties) 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 cloudProperties) protected CloudResponse
putObject
(CloudResponse response, File inputFile) protected CloudResponse
putObjectSave
(CloudResponse response, File inputFile) void
restoreObject
(String container, String key, File outFile, CloudResponse response) Restore nearline contentvalidateMd5
(String bucketName, String key, String inMd5) Validate that the md5 digest matches cloud object digestMethods inherited from class org.cdlib.mrt.s3.service.CloudStoreAbs
dumpException, getCloudProp, handleException, isAliveTest, isValidFile, validateDigest
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.cdlib.mrt.s3.service.CloudStoreInf
getCloudProp, validateDigest
-
Constructor Details
-
PairtreeCloud
protected PairtreeCloud(boolean pairPath, org.cdlib.mrt.utility.LoggerInf logger) throws org.cdlib.mrt.utility.TException - Throws:
org.cdlib.mrt.utility.TException
-
-
Method Details
-
getPairtreeCloud
public static PairtreeCloud getPairtreeCloud(boolean pairPath, org.cdlib.mrt.utility.LoggerInf logger) throws org.cdlib.mrt.utility.TException - Throws:
org.cdlib.mrt.utility.TException
-
getBase
- Throws:
org.cdlib.mrt.utility.TException
-
getDir
- Throws:
org.cdlib.mrt.utility.TException
-
getDirRead
- Throws:
org.cdlib.mrt.utility.TException
-
buildPairDirectoryRetry
public static File buildPairDirectoryRetry(File baseDir, String pairKey, int retryCnt) throws org.cdlib.mrt.utility.TException - Throws:
org.cdlib.mrt.utility.TException
-
putObject
protected CloudResponse putObject(CloudResponse response, File inputFile) throws org.cdlib.mrt.utility.TException - Throws:
org.cdlib.mrt.utility.TException
-
putObjectSave
protected CloudResponse putObjectSave(CloudResponse response, File inputFile) throws org.cdlib.mrt.utility.TException - Throws:
org.cdlib.mrt.utility.TException
-
putObject
public CloudResponse putObject(String bucketName, String key, File inputFile) throws org.cdlib.mrt.utility.TException Description copied from interface:CloudStoreInf
Upload cloud object- Specified by:
putObject
in interfaceCloudStoreInf
- Parameters:
bucketName
- 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:CloudStoreInf
Upload cloud object- Specified by:
putObject
in 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 cloudProperties) 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 cloudProperties) 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:CloudStoreInf
Upload cloud manifest- Specified by:
putManifest
in interfaceCloudStoreInf
- Parameters:
bucketName
- s3 bucket - rackspace containerobjectID
- Object identifierinputFile
- manifest file to be uploaded- Returns:
- information about upload
- Throws:
org.cdlib.mrt.utility.TException
-
deleteObject
public CloudResponse deleteObject(String bucketName, String key) throws org.cdlib.mrt.utility.TException Description copied from interface:CloudStoreInf
Delete object- Specified by:
deleteObject
in interfaceCloudStoreInf
- Parameters:
bucketName
- 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:CloudStoreInf
Delete cloud object- Specified by:
deleteObject
in 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:CloudStoreInf
Delete cloud manifest- Specified by:
deleteManifest
in interfaceCloudStoreInf
- Parameters:
bucketName
- s3 bucket - rackspace containerobjectID
- Object identifier- Returns:
- Throws:
org.cdlib.mrt.utility.TException
-
getObject
public InputStream getObject(String bucketName, org.cdlib.mrt.core.Identifier objectID, int versionID, String fileID, CloudResponse response) throws org.cdlib.mrt.utility.TException Description copied from interface:CloudStoreInf
Retrieve cloud Object- Specified by:
getObject
in interfaceCloudStoreInf
- Parameters:
bucketName
- 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:CloudStoreInf
Retrieve cloud object- Specified by:
getObject
in interfaceCloudStoreInf
- Specified by:
getObject
in classCloudStoreAbs
- Parameters:
bucketName
- s3 bucket - rackspace containerkey
- cloud object key for object to be returned- Returns:
- input stream of retrieved object
- Throws:
org.cdlib.mrt.utility.TException
-
getObjectStreaming
public InputStream getObjectStreaming(String container, String key, CloudResponse response) throws org.cdlib.mrt.utility.TException Description copied from interface:CloudStoreInf
Retrieve cloud object in streaming mode- Specified by:
getObjectStreaming
in interfaceCloudStoreInf
- Parameters:
container
- s3 bucket - rackspace containerkey
- cloud object key for object to be returned- Returns:
- input stream of retrieved object
- Throws:
org.cdlib.mrt.utility.TException
-
getObject
public void getObject(String bucketName, String key, File outFile, CloudResponse response) throws org.cdlib.mrt.utility.TException Description copied from interface:CloudStoreInf
Retrieve content into a file- Specified by:
getObject
in interfaceCloudStoreInf
- Parameters:
bucketName
- s3 bucket - rackspace containerkey
- cloud object key for object to be returnedoutFile
- file to receive content- 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:CloudStoreInf
Restore nearline content- Specified by:
restoreObject
in interfaceCloudStoreInf
key
- cloud keyoutFile
- target file of response- Throws:
org.cdlib.mrt.utility.TException
-
getObjectMeta
public Properties getObjectMeta(String bucketName, String key) throws org.cdlib.mrt.utility.TException Description copied from interface:CloudStoreInf
Retrieve metadata for file- Specified by:
getObjectMeta
in interfaceCloudStoreInf
- Parameters:
bucketName
- s3 bucket - rackspace containerkey
- cloud object key for object to be returned- Returns:
- exists: named properties; does not exist: null
- Throws:
org.cdlib.mrt.utility.TException
-
getManifest
public InputStream getManifest(String bucketName, org.cdlib.mrt.core.Identifier objectID) throws org.cdlib.mrt.utility.TException Description copied from interface:CloudStoreInf
Retrieve cloud manifest- Specified by:
getManifest
in interfaceCloudStoreInf
- Parameters:
bucketName
- s3 bucket - rackspace containerobjectID
- Object identifier- Returns:
- input stream of retrieved manifest
- Throws:
org.cdlib.mrt.utility.TException
-
getManifest
public InputStream getManifest(String bucketName, org.cdlib.mrt.core.Identifier objectID, CloudResponse response) throws org.cdlib.mrt.utility.TException Description copied from interface:CloudStoreInf
Retrieve cloud manifest- Specified by:
getManifest
in interfaceCloudStoreInf
- Parameters:
bucketName
- s3 bucket - rackspace containerobjectID
- Object identifier- Returns:
- input stream of retrieved object
- Throws:
org.cdlib.mrt.utility.TException
-
getObject
public InputStream getObject(String bucketName, org.cdlib.mrt.core.Identifier objectID, int versionID, String fileID) 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:CloudStoreInf
Return content that matches for the length of the key- Specified by:
getObjectList
in interfaceCloudStoreInf
- Specified by:
getObjectList
in 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:CloudStoreInf
Return a set number of entry metadata based on start key- Specified by:
getObjectList
in 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
-
getObjectList
Description copied from interface:CloudStoreInf
Return info on bucket/container- Specified by:
getObjectList
in interfaceCloudStoreInf
- Parameters:
bucketName
- s3 bucket - rackspace container- Returns:
- 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:CloudStoreInf
Return list of S3 keys after a start key- Specified by:
getObjectListAfter
in 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
-
getState
Description copied from interface:CloudStoreInf
Return state of cloud store manager- Specified by:
getState
in interfaceCloudStoreInf
- Parameters:
bucketName
- bucket container- Returns:
- Throws:
org.cdlib.mrt.utility.TException
-
validateMd5
public CloudResponse validateMd5(String bucketName, String key, String inMd5) throws org.cdlib.mrt.utility.TException Description copied from interface:CloudStoreInf
Validate that the md5 digest matches cloud object digest- Specified by:
validateMd5
in interfaceCloudStoreInf
- Overrides:
validateMd5
in classCloudStoreAbs
- Parameters:
bucketName
- s3 bucket - rackspace containerkey
- cloud object keyinMd5
- md5 digest value- Returns:
- Throws:
org.cdlib.mrt.utility.TException
-
isAlive
Description copied from interface:CloudStoreInf
Determine if host:port is available- Specified by:
isAlive
in 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:CloudStoreInf
Returns an S3 presigned URL- Specified by:
getPreSigned
in 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:CloudStoreInf
Return part of a cloud object as stream- Specified by:
getRangeStream
in 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:CloudStoreInf
Return the API type- Specified by:
getType
in interfaceCloudStoreInf
- Returns:
- AWS-S3, SDSC-Swift, Cloudhost, Pairtree
-
isAlphaNumericKey
public boolean isAlphaNumericKey()Description copied from interface:CloudStoreInf
Because of earlier SDSC bug only alpha-numerics could be used in a key. true=alpha-numeric key, false=ASCII (current default)- Specified by:
isAlphaNumericKey
in interfaceCloudStoreInf
- Returns:
-