public class HashFileSystemHelper extends Object
Constructor and Description |
---|
HashFileSystemHelper(String rootPath)
Constructor
|
Modifier and Type | Method and Description |
---|---|
void |
createContainer(String container)
Create a directory recursively in the sub tree
|
void |
createDirectories(Path path)
Create recursively the directories
|
List<String> |
getListContainers() |
Path |
getPathContainer(String containerName)
Get the path of a container
|
Path |
getPathObject(String container,
String objectId)
Get the path of an object based on its container and the objectId
|
boolean |
isContainer(String subpath) |
List<String> |
splitObjectId(String objectId)
Split objectId without extension
|
FileVisitResult |
walkFileTreeOrdered(Path directory,
FileVisitor<Path> fv)
A walkFile where we goes in the child in the lexicographic order
|
public HashFileSystemHelper(String rootPath)
rootPath
- : the base path of the storage . Will be appended to all requestsIllegalArgumentException
- : if rootPath is equals to / (to prevent error)public Path getPathContainer(String containerName)
containerName
- public List<String> splitObjectId(String objectId) throws ContentAddressableStorageServerException
objectId
- ContentAddressableStorageServerException
public Path getPathObject(String container, String objectId) throws ContentAddressableStorageNotFoundException, ContentAddressableStorageServerException
container
- objectId
- ContentAddressableStorageNotFoundException
- : container not foundContentAddressableStorageServerException
- : The objectId contains Separator characterpublic void createContainer(String container) throws ContentAddressableStorageAlreadyExistException, ContentAddressableStorageServerException
container
- : relative path that will be appended at the end of the rootPathContentAddressableStorageAlreadyExistException
- : if the directory already existsContentAddressableStorageServerException
- : on I/O Errorspublic boolean isContainer(String subpath)
subpath
- : relative path that will be appended at the end of the rootPathpublic void createDirectories(Path path) throws ContentAddressableStorageServerException, ContentAddressableStorageAlreadyExistException
path
- ContentAddressableStorageServerException
ContentAddressableStorageAlreadyExistException
public FileVisitResult walkFileTreeOrdered(Path directory, FileVisitor<Path> fv) throws IOException
directory
- : root of the tree that will be visitedfv
- : FileVisitor which will be used for the actionIOException
Copyright © 2018 Vitam. All rights reserved.