Package fr.gouv.vitam.workspace.common
Interface WorkspaceContentAddressableStorage
-
- All Known Implementing Classes:
WorkspaceFileSystem
public interface WorkspaceContentAddressableStorage
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description java.lang.String
computeObjectDigest(java.lang.String containerName, java.lang.String objectName, DigestType algo)
compute Object Digest using a defined algorithmlong
countObjects(java.lang.String containerName)
Determines if a container existsvoid
createContainer(java.lang.String containerName)
Creates a containervoid
createFolder(java.lang.String containerName, java.lang.String folderName)
Creates a folder (or a directory) marker depending on the servicevoid
deleteContainer(java.lang.String containerName, boolean recursive)
Deletes everything inside a container recursively.void
deleteFolder(java.lang.String containerName, java.lang.String folderName)
Deletes a folder (or a directory) marker depending on the servicevoid
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 capacityjava.util.Map<java.lang.String,FileParams>
getFilesWithParamsFromFolder(java.lang.String containerName, java.lang.String folderName)
java.util.List<java.net.URI>
getListUriDigitalObjectFromFolder(java.lang.String containerName, java.lang.String folderName)
Retrieves recursively the uri list of object inside a folder rootFolder/subfolder/javax.ws.rs.core.Response
getObject(java.lang.String containerName, java.lang.String objectName, java.lang.Long chunkOffset, java.lang.Long maxChunkSize)
Retrieves an object representing the data at location containerName/objectNamecom.fasterxml.jackson.databind.JsonNode
getObjectInformation(java.lang.String containerName, java.lang.String objectName)
Retrieves information about an object at location containerName/objectNameboolean
isExistingContainer(java.lang.String containerName)
Determines if a container existsboolean
isExistingFolder(java.lang.String containerName, java.lang.String folderName)
Determines if a folder (or a directory) existsboolean
isExistingObject(java.lang.String containerName, java.lang.String objectName)
Determines if an object existsvoid
purgeContainer(java.lang.String containerName)
Deletes the contents of a container at its root path without deleting the containervoid
purgeOldFilesInContainer(java.lang.String containerName, TimeToLive timeToLive)
void
putAtomicObject(java.lang.String containerName, java.lang.String objectName, java.io.InputStream stream, long size)
void
putObject(java.lang.String containerName, java.lang.String objectName, java.io.InputStream stream)
Adds an object representing the data at location containerName/objectNamevoid
uncompressObject(java.lang.String containerName, java.lang.String folderName, java.lang.String archiveMimeType, java.io.InputStream inputStreamObject)
create container: will be identified by GUID and extract objects and push it on the container
-
-
-
Method Detail
-
createContainer
void createContainer(java.lang.String containerName) throws ContentAddressableStorageAlreadyExistException, ContentAddressableStorageServerException
Creates a container- Parameters:
containerName
- name of container to create- Throws:
ContentAddressableStorageAlreadyExistException
- Thrown when creating a container while it (containerName) already existsContentAddressableStorageServerException
- Thrown when internal server error happens
-
purgeContainer
void purgeContainer(java.lang.String containerName) throws ContentAddressableStorageNotFoundException, ContentAddressableStorageServerException
Deletes the contents of a container at its root path without deleting the containerNote: this function will delete everything inside a container recursively.
- Parameters:
containerName
- name of container to purge- Throws:
ContentAddressableStorageNotFoundException
- Thrown when the container cannot be located.ContentAddressableStorageServerException
- Thrown when internal server error happens
-
deleteContainer
void deleteContainer(java.lang.String containerName, boolean recursive) throws ContentAddressableStorageNotFoundException, ContentAddressableStorageServerException
Deletes everything inside a container recursively.- Parameters:
containerName
- name of the container to deleterecursive
- false : deletes a container if it is empty, true : deletes everything recursively- Throws:
ContentAddressableStorageNotFoundException
- Thrown when the container cannot be located.ContentAddressableStorageServerException
- Thrown when internal server error happens
-
isExistingContainer
boolean isExistingContainer(java.lang.String containerName)
Determines if a container exists- Parameters:
containerName
- name of container- Returns:
- boolean type
- Throws:
ContentAddressableStorageServerException
-
createFolder
void createFolder(java.lang.String containerName, java.lang.String folderName) throws ContentAddressableStorageNotFoundException, ContentAddressableStorageAlreadyExistException, ContentAddressableStorageServerException
Creates a folder (or a directory) marker depending on the service- Parameters:
containerName
- container to create the directory infolderName
- full path to the folder (or directory)- Throws:
ContentAddressableStorageAlreadyExistException
- Thrown when creating a directory while it already existsContentAddressableStorageNotFoundException
- Thrown when the container cannot be located.ContentAddressableStorageServerException
- Thrown when internal server error happens
-
deleteFolder
void deleteFolder(java.lang.String containerName, java.lang.String folderName) throws ContentAddressableStorageNotFoundException, ContentAddressableStorageServerException
Deletes a folder (or a directory) marker depending on the service- Parameters:
containerName
- container to delete the folder fromfolderName
- full path to the folder to delete- Throws:
ContentAddressableStorageNotFoundException
- Thrown when the directory cannot be located.ContentAddressableStorageServerException
- Thrown when internal server error happens
-
isExistingFolder
boolean isExistingFolder(java.lang.String containerName, java.lang.String folderName)
Determines if a folder (or a directory) exists- Parameters:
containerName
- container where the folder residesfolderName
- full path to the folder- Returns:
- boolean type
-
getListUriDigitalObjectFromFolder
java.util.List<java.net.URI> getListUriDigitalObjectFromFolder(java.lang.String containerName, java.lang.String folderName) throws ContentAddressableStorageException
Retrieves recursively the uri list of object inside a folder rootFolder/subfolder/- Parameters:
containerName
- not null allowed container where this exists.folderName
- not null allowed fully qualified folder name relative to the container.- Returns:
- a list of URI
- Throws:
ContentAddressableStorageNotFoundException
- Thrown when the container cannot be located.ContentAddressableStorageException
- Thrown when get action failed due some other failure
-
uncompressObject
void uncompressObject(java.lang.String containerName, java.lang.String folderName, java.lang.String archiveMimeType, java.io.InputStream inputStreamObject) throws ContentAddressableStorageException
create container: will be identified by GUID and extract objects and push it on the container- Parameters:
containerName
- : the container name (will be Guid created in ingest module)folderName
- : the folder namearchiveMimeType
- : the archive type (zip, tar, tar.gz, tar.bz2)inputStreamObject
- : SIP input stream- Throws:
ContentAddressableStorageNotFoundException
- Thrown when the container cannot be locatedContentAddressableStorageAlreadyExistException
- Thrown when folder existsContentAddressableStorageServerException
- Thrown when internal server error happensContentAddressableStorageException
- Thrown when get action failed due some other failureContentAddressableStorageCompressedFileException
- Thrown when the file is not a zip or an empty zip
-
putObject
void putObject(java.lang.String containerName, java.lang.String objectName, java.io.InputStream stream) throws ContentAddressableStorageException
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.stream
- the data- Throws:
ContentAddressableStorageNotFoundException
- Thrown when the container cannot be located.ContentAddressableStorageException
- Thrown when put action failed due some other failureContentAddressableStorageAlreadyExistException
- Thrown when object creating exists
-
putAtomicObject
void putAtomicObject(java.lang.String containerName, java.lang.String objectName, java.io.InputStream stream, long size) throws ContentAddressableStorageException
-
getObject
javax.ws.rs.core.Response getObject(java.lang.String containerName, java.lang.String objectName, java.lang.Long chunkOffset, java.lang.Long maxChunkSize) throws ContentAddressableStorageException
Retrieves an object representing the data at location containerName/objectNameWARNING : use this method only if the response has to be consumed right away.
- 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.ContentAddressableStorageException
- Thrown when get action failed due some other failureContentAddressableStorageAlreadyExistException
- Thrown when object creating exists
-
deleteObject
void deleteObject(java.lang.String containerName, java.lang.String objectName) throws ContentAddressableStorageException
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 get action failed due some other failure
-
isExistingObject
boolean isExistingObject(java.lang.String containerName, java.lang.String objectName)
Determines if an object exists- Parameters:
containerName
- container where the object residesobjectName
- fully qualified name relative to the container.- Returns:
- boolean type
-
computeObjectDigest
java.lang.String computeObjectDigest(java.lang.String containerName, java.lang.String objectName, DigestType algo) throws ContentAddressableStorageException
compute Object Digest using a defined algorithm- Parameters:
containerName
- container where this exists.objectName
- fully qualified name relative to the container.algo
- Digest algo- 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
ContainerInformation getContainerInformation(java.lang.String containerName) throws ContentAddressableStorageNotFoundException, ContentAddressableStorageServerException
Get container information like capacity- Parameters:
containerName
- the container name- Returns:
- container information like usableSpace
- Throws:
ContentAddressableStorageNotFoundException
- thrown when storage is not available or container does not existContentAddressableStorageServerException
-
getObjectInformation
com.fasterxml.jackson.databind.JsonNode getObjectInformation(java.lang.String containerName, java.lang.String objectName) throws ContentAddressableStorageException
Retrieves information about an object at location containerName/objectName- Parameters:
containerName
- container where the object is.objectName
- fully qualified name relative to the container.- Returns:
- the object informations as a JsonNode object
- Throws:
ContentAddressableStorageNotFoundException
- Thrown when the container cannot be located.ContentAddressableStorageException
- Thrown when get action failed due some other failure
-
countObjects
long countObjects(java.lang.String containerName) throws ContentAddressableStorageException
Determines if a container exists- Parameters:
containerName
- name of container- Returns:
- long number of binary objects (excluding directory markers)
- Throws:
ContentAddressableStorageNotFoundException
- Thrown when the container cannot be located.ContentAddressableStorageException
- Thrown when get action failed due some other failure
-
purgeOldFilesInContainer
void purgeOldFilesInContainer(java.lang.String containerName, TimeToLive timeToLive) throws ContentAddressableStorageException
-
getFilesWithParamsFromFolder
java.util.Map<java.lang.String,FileParams> getFilesWithParamsFromFolder(java.lang.String containerName, java.lang.String folderName) throws ContentAddressableStorageException
-
-