Class HashFileSystemHelper
- java.lang.Object
-
- fr.gouv.vitam.common.storage.filesystem.v2.HashFileSystemHelper
-
public class HashFileSystemHelper extends java.lang.Object
Helper for the FileSystem offer
-
-
Constructor Summary
Constructors Constructor Description HashFileSystemHelper(java.lang.String rootPath)
Constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
checkContainerPathTraversal(java.lang.String containerName)
void
createContainer(java.lang.String container)
Create a directory recursively in the sub treevoid
createDirectories(java.nio.file.Path path)
Create recursively the directoriesjava.nio.file.Path
getPathContainer(java.lang.String containerName)
Get the path of a containerjava.nio.file.Path
getPathObject(java.lang.String container, java.lang.String objectId)
Get the path of an object based on its container and the objectIdboolean
isContainer(java.lang.String subpath)
java.util.List<java.lang.String>
splitObjectId(java.lang.String objectId)
Split objectId without extension
-
-
-
Method Detail
-
getPathContainer
public java.nio.file.Path getPathContainer(java.lang.String containerName)
Get the path of a container- Parameters:
containerName
-- Returns:
- the Path Object representing the container directory
-
splitObjectId
public java.util.List<java.lang.String> splitObjectId(java.lang.String objectId) throws ContentAddressableStorageServerException
Split objectId without extension- Parameters:
objectId
-- Returns:
- a list of tokens that will represent the directory structure
- Throws:
ContentAddressableStorageServerException
-
getPathObject
public java.nio.file.Path getPathObject(java.lang.String container, java.lang.String objectId) throws ContentAddressableStorageNotFoundException, ContentAddressableStorageServerException
Get the path of an object based on its container and the objectId- Parameters:
container
-objectId
-- Returns:
- Path of the object
- Throws:
ContentAddressableStorageNotFoundException
- : container not foundContentAddressableStorageServerException
- : The objectId contains Separator character
-
createContainer
public void createContainer(java.lang.String container) throws ContentAddressableStorageServerException
Create a directory recursively in the sub tree- Parameters:
container
- : relative path that will be appended at the end of the rootPath- Throws:
ContentAddressableStorageServerException
- : on I/O Errors
-
isContainer
public boolean isContainer(java.lang.String subpath)
- Parameters:
subpath
- : relative path that will be appended at the end of the rootPath- Returns:
- true if the subpath is a directory
-
createDirectories
public void createDirectories(java.nio.file.Path path) throws ContentAddressableStorageServerException
Create recursively the directories- Parameters:
path
-- Throws:
ContentAddressableStorageServerException
-
checkContainerPathTraversal
public void checkContainerPathTraversal(java.lang.String containerName) throws ContentAddressableStorageServerException
-
-