Class FilesystemStorageStrategyImpl
java.lang.Object
org.jclouds.filesystem.strategy.internal.FilesystemStorageStrategyImpl
- All Implemented Interfaces:
LocalStorageStrategy
FilesystemStorageStrategyImpl implements a blob store that stores objects
on the file system. Content metadata and user attributes are stored in
extended attributes if the file system supports them. Directory blobs
(blobs that end with a /) cannot have content, but otherwise appear in
LIST like normal blobs.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final boolean
protected final String
protected final jakarta.inject.Provider
<BlobBuilder> protected final FilesystemBlobKeyValidator
protected final FilesystemContainerNameValidator
protected Logger
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
FilesystemStorageStrategyImpl
(jakarta.inject.Provider<BlobBuilder> blobBuilders, String baseDir, boolean autoDetectContentType, FilesystemContainerNameValidator filesystemContainerNameValidator, FilesystemBlobKeyValidator filesystemBlobKeyValidator, com.google.common.base.Supplier<Location> defaultLocation) -
Method Summary
Modifier and TypeMethodDescriptionboolean
blobExists
(String container, String key) Return true if a blob named by key existsprotected String
buildPathStartingFromBaseDir
(String... pathTokens) Facility method used to concatenate path tokens normalizing separatorsvoid
clearContainer
(String container) Empty the container of its content (files and subdirectories), but doesn't delete the container itselfvoid
clearContainer
(String container, ListContainerOptions options) LikeLocalStorageStrategy.clearContainer(String)
except you can use options to do things like recursive deletes, or clear at a different path than root.boolean
containerExists
(String container) Checks if a container existslong
countBlobs
(String container, ListContainerOptions options) boolean
createContainer
(String container) boolean
createContainerInLocation
(String container, Location location, CreateContainerOptions options) Creates a new containervoid
createDirectory
(String container, String directory) protected boolean
createDirectoryWithResult
(String container, String directory) Creates a directory and returns the resultvoid
deleteContainer
(String container) Deletes a container and all its contentvoid
deleteDirectory
(String container, String directory) boolean
directoryExists
(String container, String directory) Return an iterator that reports all the containers under base pathLoad the blob with the given key belonging to the container with the given name.getBlobAccess
(String containerName, String blobName) getBlobKeysInsideContainer
(String container, String prefix, String delimiter) Returns all the blobs key inside a containergetContainerAccess
(String container) getContainerMetadata
(String container) getFileForBlobKey
(String container, String blobKey) Returns aFile
object that links to the blobgetLocation
(String containerName) protected UserDefinedFileAttributeView
putBlob
(String containerName, Blob blob, BlobAccess access) Write aBlob
into a filevoid
removeBlob
(String container, String blobKey) Remove blob named by the given keyvoid
setBlobAccess
(String container, String name, BlobAccess access) void
setContainerAccess
(String container, ContainerAccess access)
-
Field Details
-
logger
-
blobBuilders
-
baseDirectory
-
autoDetectContentType
protected final boolean autoDetectContentType -
filesystemContainerNameValidator
-
filesystemBlobKeyValidator
-
-
Constructor Details
-
FilesystemStorageStrategyImpl
@Inject protected FilesystemStorageStrategyImpl(jakarta.inject.Provider<BlobBuilder> blobBuilders, @Named("jclouds.filesystem.basedir") String baseDir, @Named("jclouds.filesystem.auto-detect-content-type") boolean autoDetectContentType, FilesystemContainerNameValidator filesystemContainerNameValidator, FilesystemBlobKeyValidator filesystemBlobKeyValidator, com.google.common.base.Supplier<Location> defaultLocation)
-
-
Method Details
-
containerExists
Description copied from interface:LocalStorageStrategy
Checks if a container exists- Specified by:
containerExists
in interfaceLocalStorageStrategy
- Parameters:
container
-- Returns:
-
getAllContainerNames
Description copied from interface:LocalStorageStrategy
Return an iterator that reports all the containers under base path- Specified by:
getAllContainerNames
in interfaceLocalStorageStrategy
- Returns:
-
createContainerInLocation
public boolean createContainerInLocation(String container, Location location, CreateContainerOptions options) Description copied from interface:LocalStorageStrategy
Creates a new container- Specified by:
createContainerInLocation
in interfaceLocalStorageStrategy
- Parameters:
container
-- Returns:
-
getContainerAccess
- Specified by:
getContainerAccess
in interfaceLocalStorageStrategy
-
setContainerAccess
- Specified by:
setContainerAccess
in interfaceLocalStorageStrategy
-
deleteContainer
Description copied from interface:LocalStorageStrategy
Deletes a container and all its content- Specified by:
deleteContainer
in interfaceLocalStorageStrategy
- Parameters:
container
-
-
clearContainer
Description copied from interface:LocalStorageStrategy
Empty the container of its content (files and subdirectories), but doesn't delete the container itself- Specified by:
clearContainer
in interfaceLocalStorageStrategy
- Parameters:
container
-
-
clearContainer
Description copied from interface:LocalStorageStrategy
LikeLocalStorageStrategy.clearContainer(String)
except you can use options to do things like recursive deletes, or clear at a different path than root.- Specified by:
clearContainer
in interfaceLocalStorageStrategy
- Parameters:
container
- what to clearoptions
- recursion and path to clear
-
getContainerMetadata
- Specified by:
getContainerMetadata
in interfaceLocalStorageStrategy
- Returns:
- StorageMetadata associated with a container name, e.g., creation date and location, or null if container does not exist
-
blobExists
Description copied from interface:LocalStorageStrategy
Return true if a blob named by key exists- Specified by:
blobExists
in interfaceLocalStorageStrategy
- Parameters:
container
-key
-- Returns:
-
getBlobKeysInsideContainer
public Iterable<String> getBlobKeysInsideContainer(String container, String prefix, String delimiter) throws IOException Returns all the blobs key inside a container- Specified by:
getBlobKeysInsideContainer
in interfaceLocalStorageStrategy
- Parameters:
container
-- Returns:
- Throws:
IOException
-
getBlob
Description copied from interface:LocalStorageStrategy
Load the blob with the given key belonging to the container with the given name. There must exist a resource on the file system whose complete name is given concatenating the container name and the key- Specified by:
getBlob
in interfaceLocalStorageStrategy
- Returns:
- the blob belonging to the given container with the given key
-
putBlob
- Specified by:
putBlob
in interfaceLocalStorageStrategy
- Throws:
IOException
-
putBlob
Description copied from interface:LocalStorageStrategy
Write aBlob
into a file- Specified by:
putBlob
in interfaceLocalStorageStrategy
- Parameters:
blob
-access
-- Returns:
- etag of blob
- Throws:
IOException
-
removeBlob
Description copied from interface:LocalStorageStrategy
Remove blob named by the given key- Specified by:
removeBlob
in interfaceLocalStorageStrategy
- Parameters:
container
-blobKey
-
-
getBlobAccess
- Specified by:
getBlobAccess
in interfaceLocalStorageStrategy
-
setBlobAccess
- Specified by:
setBlobAccess
in interfaceLocalStorageStrategy
-
getLocation
- Specified by:
getLocation
in interfaceLocalStorageStrategy
- Parameters:
containerName
- name of container- Returns:
- Location of container or null
-
getSeparator
- Specified by:
getSeparator
in interfaceLocalStorageStrategy
- Returns:
- path separator, either / or \
-
createContainer
-
newBlob
-
getFileForBlobKey
Returns aFile
object that links to the blob- Parameters:
container
-blobKey
-- Returns:
-
directoryExists
-
createDirectory
-
deleteDirectory
-
countBlobs
-
getUserDefinedFileAttributeView
protected UserDefinedFileAttributeView getUserDefinedFileAttributeView(Path path) throws IOException - Throws:
IOException
-
buildPathStartingFromBaseDir
Facility method used to concatenate path tokens normalizing separators- Parameters:
pathTokens
- all the string in the proper order that must be concatenated in order to obtain the filename- Returns:
- the resulting string
-
createDirectoryWithResult
Creates a directory and returns the result- Parameters:
container
-directory
-- Returns:
- true if the directory was created, otherwise false
-