Package org.cdlib.mrt.s3.openstack
Class OpenstackCloud
java.lang.Object
org.cdlib.mrt.s3.service.CloudStoreAbs
org.cdlib.mrt.s3.openstack.OpenstackCloud
- 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
FieldsFields inherited from class org.cdlib.mrt.s3.service.CloudStoreAbs
cloudProp, endpointHostname, log4j, logger, MESSAGE, NAME -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedOpenstackCloud(InputStream propStream, org.cdlib.mrt.utility.LoggerInf logger) protectedOpenstackCloud(Properties prop, org.cdlib.mrt.utility.LoggerInf logger) -
Method Summary
Modifier and TypeMethodDescriptionprotected voidaddListEntries(org.cdlib.mrt.cloud.CloudList totalList, org.cdlib.mrt.cloud.CloudList list) deleteManifest(String container, org.cdlib.mrt.core.Identifier objectID) Delete cloud manifestdeleteObject(String container, String key) Delete objectdeleteObject(String container, org.cdlib.mrt.core.Identifier objectID, int versionID, String fileID) Delete cloud objectgetManifest(String container, org.cdlib.mrt.core.Identifier objectID) Retrieve cloud manifestgetManifest(String container, org.cdlib.mrt.core.Identifier objectID, CloudResponse response) Retrieve cloud manifestvoidgetObject(String container, String key, File outFile, CloudResponse response) Retrieve content into a filegetObject(String container, String key, CloudResponse response) Retrieve cloud objectgetObject(String container, org.cdlib.mrt.core.Identifier objectID, int versionID, String fileID, CloudResponse response) Retrieve cloud ObjectgetObjectList(String container) Return info on bucket/containergetObjectList(String container, String prefix) Return content that matches for the length of the keygetObjectList(String container, String marker, int limit) Return a set number of entry metadata based on start keygetObjectList(String container, 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 keygetObjectListOriginal(String container, String prefix) getObjectMeta(String bucketName, String key) Retrieve metadata for filegetObjectStreaming(String container, String key, CloudResponse response) Retrieve cloud object in streaming modestatic OpenstackCloudgetOpenstack(InputStream propStream, org.cdlib.mrt.utility.LoggerInf logger) static OpenstackCloudgetOpenstackCloud(Properties prop, 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 availablebooleanBecause of earlier SDSC bug only alpha-numerics could be used in a key.static booleanisDistributedContainer(String container) Is this a distributed container?putManifest(String container, org.cdlib.mrt.core.Identifier objectID, File inputFile) Upload cloud manifestUpload cloud objectputObject(String container, String key, File inputFile, Properties fileMeta) putObject(String container, org.cdlib.mrt.core.Identifier objectID, int versionID, String fileID, File inputFile) Upload cloud objectputObject(String container, 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 contentsetContainer(String container, String key, boolean addNewContainer) setContainer determines if the passed container is distributed and will automatically append digest characters to generate physical containerprotected voidvalidateMd5(String container, 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, validateDigestMethods 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
-
Field Details
-
cmd
protected org.cdlib.mrt.openstack.utility.OpenStackCmdAbs cmd
-
-
Constructor Details
-
OpenstackCloud
protected OpenstackCloud(InputStream propStream, org.cdlib.mrt.utility.LoggerInf logger) throws org.cdlib.mrt.utility.TException - Throws:
org.cdlib.mrt.utility.TException
-
OpenstackCloud
protected OpenstackCloud(Properties prop, org.cdlib.mrt.utility.LoggerInf logger) throws org.cdlib.mrt.utility.TException - Throws:
org.cdlib.mrt.utility.TException
-
-
Method Details
-
getOpenstack
public static OpenstackCloud getOpenstack(InputStream propStream, org.cdlib.mrt.utility.LoggerInf logger) throws org.cdlib.mrt.utility.TException - Throws:
org.cdlib.mrt.utility.TException
-
getOpenstackCloud
public static OpenstackCloud getOpenstackCloud(Properties prop, org.cdlib.mrt.utility.LoggerInf logger) throws org.cdlib.mrt.utility.TException - Throws:
org.cdlib.mrt.utility.TException
-
setStorageService
protected void setStorageService() 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 container, String key, File inputFile) throws org.cdlib.mrt.utility.TException Description copied from interface:CloudStoreInfUpload cloud object- Specified by:
putObjectin interfaceCloudStoreInf- Parameters:
container- 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 container, 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:
container- 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 container, String key, File inputFile, Properties fileMeta) throws org.cdlib.mrt.utility.TException - Throws:
org.cdlib.mrt.utility.TException
-
putObject
public CloudResponse putObject(String container, 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 container, 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:
container- 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 container, String key) throws org.cdlib.mrt.utility.TException Description copied from interface:CloudStoreInfDelete object- Specified by:
deleteObjectin interfaceCloudStoreInf- Parameters:
container- s3 bucket - rackspace containerkey- cloud object key- Returns:
- Throws:
org.cdlib.mrt.utility.TException
-
deleteObject
public CloudResponse deleteObject(String container, 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:
container- 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 container, org.cdlib.mrt.core.Identifier objectID) throws org.cdlib.mrt.utility.TException Description copied from interface:CloudStoreInfDelete cloud manifest- Specified by:
deleteManifestin interfaceCloudStoreInf- Parameters:
container- s3 bucket - rackspace containerobjectID- Object identifier- Returns:
- Throws:
org.cdlib.mrt.utility.TException
-
getObject
public InputStream getObject(String container, 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:
container- 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 container, 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:
container- 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 container, 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:
container- 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
-
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
-
getObjectMeta
public Properties getObjectMeta(String bucketName, String key) throws org.cdlib.mrt.utility.TException 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
- Throws:
org.cdlib.mrt.utility.TException
-
getManifest
public InputStream getManifest(String container, org.cdlib.mrt.core.Identifier objectID) throws org.cdlib.mrt.utility.TException Description copied from interface:CloudStoreInfRetrieve cloud manifest- Specified by:
getManifestin interfaceCloudStoreInf- Parameters:
container- s3 bucket - rackspace containerobjectID- Object identifier- Returns:
- input stream of retrieved manifest
- Throws:
org.cdlib.mrt.utility.TException
-
getManifest
public InputStream getManifest(String container, 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:
container- s3 bucket - rackspace containerobjectID- Object identifierresponse-- Returns:
- input stream of retrieved object
- Throws:
org.cdlib.mrt.utility.TException
-
getObject
public InputStream getObject(String container, 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 container, org.cdlib.mrt.core.Identifier objectID, Integer versionID, String fileID) throws org.cdlib.mrt.utility.TException - Throws:
org.cdlib.mrt.utility.TException
-
getObjectListOriginal
public CloudResponse getObjectListOriginal(String container, String prefix) throws org.cdlib.mrt.utility.TException - Throws:
org.cdlib.mrt.utility.TException
-
getObjectList
public CloudResponse getObjectList(String container, String prefix) 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:
container- s3 bucket - rackspace containerprefix- prefix of content to be returned- Returns:
- CloudResponse with list of matching entries
- Throws:
org.cdlib.mrt.utility.TException
-
addListEntries
protected void addListEntries(org.cdlib.mrt.cloud.CloudList totalList, org.cdlib.mrt.cloud.CloudList list) throws org.cdlib.mrt.utility.TException - Throws:
org.cdlib.mrt.utility.TException
-
getObjectList
public CloudResponse getObjectList(String container, String marker, 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:
container- s3 bucket - rackspace containermarker- 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:CloudStoreInfReturn info on bucket/container- Specified by:
getObjectListin interfaceCloudStoreInf- Parameters:
container- 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: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
-
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
-
validateMd5
public CloudResponse validateMd5(String container, String key, String inMd5) throws org.cdlib.mrt.utility.TException Description copied from interface:CloudStoreInfValidate that the md5 digest matches cloud object digest- Specified by:
validateMd5in interfaceCloudStoreInf- Overrides:
validateMd5in classCloudStoreAbs- Parameters:
container- s3 bucket - rackspace containerkey- cloud object keyinMd5- md5 digest value- Returns:
- Throws:
org.cdlib.mrt.utility.TException
-
setContainer
public String setContainer(String container, String key, boolean addNewContainer) throws org.cdlib.mrt.utility.TException setContainer determines if the passed container is distributed and will automatically append digest characters to generate physical container- Parameters:
container- physical or distributed containerkey- delimited component key - distributed extension ins built off first element of keyaddNewContainer- true=add new container if not present, false=ignore add- Returns:
- physical key
- Throws:
org.cdlib.mrt.utility.TException
-
isDistributedContainer
public static boolean isDistributedContainer(String container) throws org.cdlib.mrt.utility.TException Is this a distributed container? Distributed container has a common prefix with trailing trigger- Parameters:
container-- Returns:
- true=distributed container, false=physical container
- 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
-
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:
-