Package fr.gouv.vitam.common.storage.s3
Class AmazonS3V1
java.lang.Object
fr.gouv.vitam.common.storage.cas.container.api.ContentAddressableStorageAbstract
fr.gouv.vitam.common.storage.s3.AmazonS3V1
- All Implemented Interfaces:
VitamAutoCloseable,ContentAddressableStorage,AutoCloseable
Amazon SDK S3 V1 abstract implementation Manage with all common amazon sdk s3
v1 methods.
-
Field Summary
Fields inherited from class fr.gouv.vitam.common.storage.cas.container.api.ContentAddressableStorageAbstract
LISTING_MAX_RESULTS -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidcheckObjectDigestAndStoreDigest(String containerName, String objectName, String objectDigest, DigestType digestType, long size) Checks objet digest & update persist its digest in object metadatavoidclose()voidcreateContainer(String containerName) Creates a containervoiddeleteObject(String containerName, String objectName) Deletes a object representing the data at location containerName/objectNamegenerateBucketName(String containerName) Generate a valid bucket name from the container name : replace non-alphanumeric values by '.', lowercase every alphabetic value and remove '.' at start and end.getContainerInformation(String containerName) Get container information like capacityRetrieves an object representing the data at location containerName/objectNamegetObjectDigest(String containerName, String objectName, DigestType digestType, boolean noCache) compute Object Digest using a defined algorithmgetObjectMetadata(String containerName, String objectId, boolean noCache) get metadata of the objectbooleanisExistingContainer(String containerName) Determines if a container existsbooleanisExistingObject(String containerName, String objectName) Determines if an object existsvoidlistContainer(String containerName, ObjectListingListener objectListingListener) List container objectsvoidwriteObject(String containerName, String objectName, InputStream inputStream, DigestType digestType, long size) Adds an object representing the data at location containerName/objectNameMethods inherited from class fr.gouv.vitam.common.storage.cas.container.api.ContentAddressableStorageAbstract
cacheExistsContainer, computeObjectDigest, computeObjectDigestAndSize, disableContainerCaching, getConfiguration, isExistingContainerInCacheMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface fr.gouv.vitam.common.storage.cas.container.api.ContentAddressableStorage
checkAccessRequestStatuses, checkObjectAvailability, createAccessRequest, putObject, removeAccessRequest
-
Constructor Details
-
AmazonS3V1
public AmazonS3V1(StorageConfiguration configuration) throws KeyManagementException, NoSuchAlgorithmException, KeyStoreException, CertificateException, IOException
-
-
Method Details
-
createContainer
Description copied from interface:ContentAddressableStorageCreates a container- Parameters:
containerName- name of container to create- Throws:
ContentAddressableStorageServerException- Thrown when internal server error happens
-
isExistingContainer
public boolean isExistingContainer(String containerName) throws ContentAddressableStorageServerException Description copied from interface:ContentAddressableStorageDetermines if a container exists- Parameters:
containerName- name of container- Returns:
- boolean type
- Throws:
ContentAddressableStorageServerException- Thrown when internal server error happens
-
writeObject
public void writeObject(String containerName, String objectName, InputStream inputStream, DigestType digestType, long size) throws ContentAddressableStorageException Description copied from interface:ContentAddressableStorageAdds an object representing the data at location containerName/objectName- Parameters:
containerName- container to place the object.objectName- fully qualified object name relative to the container.inputStream- the datadigestType- parameter to compute an hash.size- size off the input stream- Throws:
ContentAddressableStorageNotFoundException- Thrown when the container cannot be located.ContentAddressableStorageException- Thrown when put action failed due some other failureContentAddressableStorageAlreadyExistException- Thrown when object creating exists
-
checkObjectDigestAndStoreDigest
public void checkObjectDigestAndStoreDigest(String containerName, String objectName, String objectDigest, DigestType digestType, long size) throws ContentAddressableStorageException Description copied from interface:ContentAddressableStorageChecks objet digest & update persist its digest in object metadata- Parameters:
containerName- container to place the object.objectName- fully qualified object name relative to the container.objectDigest- object digest valuedigestType- object digest typesize- size off the input stream- Throws:
ContentAddressableStorageException
-
getObject
public ObjectContent getObject(String containerName, String objectName) throws ContentAddressableStorageException Description copied from interface:ContentAddressableStorageRetrieves an object representing the data at location containerName/objectName- Parameters:
containerName- container where this exists.objectName- fully qualified name relative to the container.- Returns:
- the object you intended to receive
- Throws:
ContentAddressableStorageNotFoundException- Thrown when the container cannot be located.ContentAddressableStorageUnavailableDataFromAsyncOfferException- Thrown when object cannot be read due to missing access request on AsyncRead ContentAddressableStorageContentAddressableStorageException- Thrown when get action failed due some other failure
-
deleteObject
public void deleteObject(String containerName, String objectName) throws ContentAddressableStorageException Description copied from interface:ContentAddressableStorageDeletes a object representing the data at location containerName/objectName- Parameters:
containerName- container where this exists.objectName- fully qualified name relative to the container.- Throws:
ContentAddressableStorageNotFoundException- Thrown when the container cannot be located or the blob cannot be located in the container.ContentAddressableStorageException- Thrown when delete action failed due some other failure
-
isExistingObject
public boolean isExistingObject(String containerName, String objectName) throws ContentAddressableStorageServerException Description copied from interface:ContentAddressableStorageDetermines if an object exists- Parameters:
containerName- container where the object residesobjectName- fully qualified name relative to the container.- Returns:
- boolean type
- Throws:
ContentAddressableStorageServerException- Thrown when internal server error happens
-
getObjectDigest
public String getObjectDigest(String containerName, String objectName, DigestType digestType, boolean noCache) throws ContentAddressableStorageException Description copied from interface:ContentAddressableStoragecompute Object Digest using a defined algorithm- Parameters:
containerName- container where this exists.objectName- fully qualified name relative to the container.digestType- Digest algonoCache- forces full digest computation- Returns:
- the digest object as String
- Throws:
ContentAddressableStorageNotFoundException- Thrown when the container or the object cannot be locatedContentAddressableStorageServerException- Thrown when internal server error happensContentAddressableStorageException- Thrown when put action failed due some other failure
-
getContainerInformation
public ContainerInformation getContainerInformation(String containerName) throws ContentAddressableStorageNotFoundException, ContentAddressableStorageServerException Description copied from interface:ContentAddressableStorageGet container information like capacity- Parameters:
containerName- the container name- Returns:
- container information like usableSpace
- Throws:
ContentAddressableStorageNotFoundException- Thrown when the container cannot be located.ContentAddressableStorageServerException- Thrown when internal server error happens
-
getObjectMetadata
public MetadatasObject getObjectMetadata(String containerName, String objectId, boolean noCache) throws ContentAddressableStorageException Description copied from interface:ContentAddressableStorageget metadata of the object- Parameters:
containerName- the container nameobjectId- the objectId to check- Returns:
- MetadatasObjectResult
- Throws:
ContentAddressableStorageException- Thrown when get action failed due some other failure
-
listContainer
public void listContainer(String containerName, ObjectListingListener objectListingListener) throws ContentAddressableStorageNotFoundException, ContentAddressableStorageServerException, IOException Description copied from interface:ContentAddressableStorageList container objects- Parameters:
containerName- the container name- Throws:
ContentAddressableStorageNotFoundException- Thrown when the container cannot be located.ContentAddressableStorageServerException- Thrown when internal server error happensIOException
-
close
public void close() -
generateBucketName
Generate a valid bucket name from the container name : replace non-alphanumeric values by '.', lowercase every alphabetic value and remove '.' at start and end.- Parameters:
containerName- vitam container name- Returns:
- bucket name valid according to s3 API specification
- See Also:
-