Class Swift
- java.lang.Object
-
- fr.gouv.vitam.common.storage.cas.container.api.ContentAddressableStorageAbstract
-
- fr.gouv.vitam.common.storage.swift.Swift
-
- All Implemented Interfaces:
VitamAutoCloseable
,ContentAddressableStorage
,java.lang.AutoCloseable
public class Swift extends ContentAddressableStorageAbstract
Swift abstract implementation Manage with all common swift methods
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
X_OBJECT_MANIFEST
static java.lang.String
X_OBJECT_META_DIGEST
static java.lang.String
X_OBJECT_META_DIGEST_TYPE
-
Fields inherited from class fr.gouv.vitam.common.storage.cas.container.api.ContentAddressableStorageAbstract
LISTING_MAX_RESULTS
-
-
Constructor Summary
Constructors Constructor Description Swift(java.util.function.Supplier<org.openstack4j.api.OSClient> osClient, StorageConfiguration configuration)
ConstructorSwift(java.util.function.Supplier<org.openstack4j.api.OSClient> osClient, StorageConfiguration configuration, java.lang.Long swiftLimit)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
checkObjectDigestAndStoreDigest(java.lang.String containerName, java.lang.String objectName, java.lang.String objectDigest, DigestType digestType, long size)
Checks objet digest & update persist its digest in object metadatavoid
close()
void
createContainer(java.lang.String containerName)
Abstract method to get authenticated openstack client, allow to switch between Keystone V2 and Keystone V3void
deleteObject(java.lang.String containerName, java.lang.String objectName)
Deletes a object representing the data at location containerName/objectNameContainerInformation
getContainerInformation(java.lang.String containerName)
Get container information like capacityObjectContent
getObject(java.lang.String containerName, java.lang.String objectName)
Retrieves an object representing the data at location containerName/objectNamejava.lang.String
getObjectDigest(java.lang.String containerName, java.lang.String objectName, DigestType digestType, boolean noCache)
compute Object Digest using a defined algorithmMetadatasObject
getObjectMetadata(java.lang.String containerName, java.lang.String objectId, boolean noCache)
get metadata of the objectjava.util.function.Supplier<org.openstack4j.api.OSClient>
getOsClient()
boolean
isExistingContainer(java.lang.String containerName)
Determines if a container existsboolean
isExistingObject(java.lang.String containerName, java.lang.String objectName)
Determines if an object existsvoid
listContainer(java.lang.String containerName, ObjectListingListener objectListingListener)
List container objectsvoid
writeObject(java.lang.String containerName, java.lang.String objectName, java.io.InputStream inputStream, DigestType digestType, long size)
Adds an object representing the data at location containerName/objectName-
Methods inherited from class fr.gouv.vitam.common.storage.cas.container.api.ContentAddressableStorageAbstract
cacheExistsContainer, computeObjectDigest, disableContainerCaching, getConfiguration, isExistingContainerInCache
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface fr.gouv.vitam.common.storage.cas.container.api.ContentAddressableStorage
checkAccessRequestStatuses, checkObjectAvailability, createAccessRequest, putObject, removeAccessRequest
-
-
-
-
Field Detail
-
X_OBJECT_META_DIGEST
public static final java.lang.String X_OBJECT_META_DIGEST
- See Also:
- Constant Field Values
-
X_OBJECT_META_DIGEST_TYPE
public static final java.lang.String X_OBJECT_META_DIGEST_TYPE
- See Also:
- Constant Field Values
-
X_OBJECT_MANIFEST
public static final java.lang.String X_OBJECT_MANIFEST
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
Swift
public Swift(java.util.function.Supplier<org.openstack4j.api.OSClient> osClient, StorageConfiguration configuration)
Constructor- Parameters:
osClient
- the given type of osClient can be OSClientV2, OSClientV3configuration
- StorageConfiguration
-
Swift
public Swift(java.util.function.Supplier<org.openstack4j.api.OSClient> osClient, StorageConfiguration configuration, java.lang.Long swiftLimit)
-
-
Method Detail
-
createContainer
public void createContainer(java.lang.String containerName) throws ContentAddressableStorageServerException
Abstract method to get authenticated openstack client, allow to switch between Keystone V2 and Keystone V3- Parameters:
containerName
- name of container to create- Throws:
ContentAddressableStorageServerException
- Thrown when internal server error happens
-
isExistingContainer
public boolean isExistingContainer(java.lang.String containerName)
Description copied from interface:ContentAddressableStorage
Determines if a container exists- Parameters:
containerName
- name of container- Returns:
- boolean type
-
writeObject
public void writeObject(java.lang.String containerName, java.lang.String objectName, java.io.InputStream inputStream, DigestType digestType, long size) throws ContentAddressableStorageException
Description copied from interface:ContentAddressableStorage
Adds 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(java.lang.String containerName, java.lang.String objectName, java.lang.String objectDigest, DigestType digestType, long size) throws ContentAddressableStorageException
Description copied from interface:ContentAddressableStorage
Checks 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
-
getObjectDigest
public java.lang.String getObjectDigest(java.lang.String containerName, java.lang.String objectName, DigestType digestType, boolean noCache) throws ContentAddressableStorageException
Description copied from interface:ContentAddressableStorage
compute 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
-
getObject
public ObjectContent getObject(java.lang.String containerName, java.lang.String objectName) throws ContentAddressableStorageException
Description copied from interface:ContentAddressableStorage
Retrieves 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(java.lang.String containerName, java.lang.String objectName) throws ContentAddressableStorageException
Description copied from interface:ContentAddressableStorage
Deletes 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(java.lang.String containerName, java.lang.String objectName) throws ContentAddressableStorageException
Description copied from interface:ContentAddressableStorage
Determines 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 happensContentAddressableStorageException
-
getContainerInformation
public ContainerInformation getContainerInformation(java.lang.String containerName) throws ContentAddressableStorageNotFoundException
Description copied from interface:ContentAddressableStorage
Get container information like capacity- Parameters:
containerName
- the container name- Returns:
- container information like usableSpace
- Throws:
ContentAddressableStorageNotFoundException
- Thrown when the container cannot be located.
-
getObjectMetadata
public MetadatasObject getObjectMetadata(java.lang.String containerName, java.lang.String objectId, boolean noCache) throws ContentAddressableStorageException
Description copied from interface:ContentAddressableStorage
get 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(java.lang.String containerName, ObjectListingListener objectListingListener) throws ContentAddressableStorageException, java.io.IOException
Description copied from interface:ContentAddressableStorage
List container objects- Parameters:
containerName
- the container name- Throws:
ContentAddressableStorageNotFoundException
- Thrown when the container cannot be located.ContentAddressableStorageServerException
- Thrown when internal server error happensContentAddressableStorageException
java.io.IOException
-
close
public void close()
-
getOsClient
public java.util.function.Supplier<org.openstack4j.api.OSClient> getOsClient()
-
-