public class FilesystemStorageStrategyImpl extends Object implements LocalStorageStrategy
Modifier and Type | Field and Description |
---|---|
protected boolean |
autoDetectContentType |
protected String |
baseDirectory |
protected javax.inject.Provider<BlobBuilder> |
blobBuilders |
protected FilesystemBlobKeyValidator |
filesystemBlobKeyValidator |
protected FilesystemContainerNameValidator |
filesystemContainerNameValidator |
protected Logger |
logger |
Modifier | Constructor and Description |
---|---|
protected |
FilesystemStorageStrategyImpl(javax.inject.Provider<BlobBuilder> blobBuilders,
String baseDir,
boolean autoDetectContentType,
FilesystemContainerNameValidator filesystemContainerNameValidator,
FilesystemBlobKeyValidator filesystemBlobKeyValidator,
com.google.common.base.Supplier<Location> defaultLocation) |
Modifier and Type | Method and Description |
---|---|
boolean |
blobExists(String container,
String key)
Return true if a blob named by key exists
|
protected String |
buildPathStartingFromBaseDir(String... pathTokens)
Facility method used to concatenate path tokens normalizing separators
|
void |
clearContainer(String container)
Empty the container of its content (files and subdirectories), but doesn't
delete the container itself
|
void |
clearContainer(String container,
ListContainerOptions options)
Like
LocalStorageStrategy.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 exists
|
long |
countBlobs(String container,
ListContainerOptions options) |
boolean |
createContainer(String container) |
boolean |
createContainerInLocation(String container,
Location location,
CreateContainerOptions options)
Creates a new container
|
void |
createDirectory(String container,
String directory) |
protected boolean |
createDirectoryWithResult(String container,
String directory)
Creates a directory and returns the result
|
void |
deleteContainer(String container)
Deletes a container and all its content
|
void |
deleteDirectory(String container,
String directory) |
boolean |
directoryExists(String container,
String directory) |
Collection<String> |
getAllContainerNames()
Return an iterator that reports all the containers under base path
|
Blob |
getBlob(String container,
String key)
Load the blob with the given key belonging to the container with the given
name.
|
BlobAccess |
getBlobAccess(String containerName,
String blobName) |
Iterable<String> |
getBlobKeysInsideContainer(String container)
Returns all the blobs key inside a container
|
ContainerAccess |
getContainerAccess(String container) |
StorageMetadata |
getContainerMetadata(String container) |
File |
getFileForBlobKey(String container,
String blobKey)
Returns a
File object that links to the blob |
Location |
getLocation(String containerName) |
String |
getSeparator() |
protected java.nio.file.attribute.UserDefinedFileAttributeView |
getUserDefinedFileAttributeView(java.nio.file.Path path) |
Blob |
newBlob(String name) |
String |
putBlob(String containerName,
Blob blob)
Write a
Blob into a file |
void |
removeBlob(String container,
String blobKey)
Remove blob named by the given key
|
void |
setBlobAccess(String container,
String name,
BlobAccess access) |
void |
setContainerAccess(String container,
ContainerAccess access) |
protected Logger logger
protected final javax.inject.Provider<BlobBuilder> blobBuilders
protected final String baseDirectory
protected final boolean autoDetectContentType
protected final FilesystemContainerNameValidator filesystemContainerNameValidator
protected final FilesystemBlobKeyValidator filesystemBlobKeyValidator
@Inject protected FilesystemStorageStrategyImpl(javax.inject.Provider<BlobBuilder> blobBuilders, @Named(value="jclouds.filesystem.basedir") String baseDir, @Named(value="jclouds.filesystem.auto-detect-content-type") boolean autoDetectContentType, FilesystemContainerNameValidator filesystemContainerNameValidator, FilesystemBlobKeyValidator filesystemBlobKeyValidator, com.google.common.base.Supplier<Location> defaultLocation)
public boolean containerExists(String container)
LocalStorageStrategy
containerExists
in interface LocalStorageStrategy
public Collection<String> getAllContainerNames()
LocalStorageStrategy
getAllContainerNames
in interface LocalStorageStrategy
public boolean createContainerInLocation(String container, Location location, CreateContainerOptions options)
LocalStorageStrategy
createContainerInLocation
in interface LocalStorageStrategy
public ContainerAccess getContainerAccess(String container)
getContainerAccess
in interface LocalStorageStrategy
public void setContainerAccess(String container, ContainerAccess access)
setContainerAccess
in interface LocalStorageStrategy
public void deleteContainer(String container)
LocalStorageStrategy
deleteContainer
in interface LocalStorageStrategy
public void clearContainer(String container)
LocalStorageStrategy
clearContainer
in interface LocalStorageStrategy
public void clearContainer(String container, ListContainerOptions options)
LocalStorageStrategy
LocalStorageStrategy.clearContainer(String)
except you can use options to do things like recursive
deletes, or clear at a different path than root.clearContainer
in interface LocalStorageStrategy
container
- what to clearoptions
- recursion and path to clearpublic StorageMetadata getContainerMetadata(String container)
getContainerMetadata
in interface LocalStorageStrategy
public boolean blobExists(String container, String key)
LocalStorageStrategy
blobExists
in interface LocalStorageStrategy
public Iterable<String> getBlobKeysInsideContainer(String container) throws IOException
getBlobKeysInsideContainer
in interface LocalStorageStrategy
container
- IOException
public Blob getBlob(String container, String key)
LocalStorageStrategy
getBlob
in interface LocalStorageStrategy
public String putBlob(String containerName, Blob blob) throws IOException
LocalStorageStrategy
Blob
into a fileputBlob
in interface LocalStorageStrategy
IOException
public void removeBlob(String container, String blobKey)
LocalStorageStrategy
removeBlob
in interface LocalStorageStrategy
public BlobAccess getBlobAccess(String containerName, String blobName)
getBlobAccess
in interface LocalStorageStrategy
public void setBlobAccess(String container, String name, BlobAccess access)
setBlobAccess
in interface LocalStorageStrategy
public Location getLocation(String containerName)
getLocation
in interface LocalStorageStrategy
containerName
- name of containerpublic String getSeparator()
getSeparator
in interface LocalStorageStrategy
public boolean createContainer(String container)
public File getFileForBlobKey(String container, String blobKey)
File
object that links to the blobcontainer
- blobKey
- public long countBlobs(String container, ListContainerOptions options)
protected java.nio.file.attribute.UserDefinedFileAttributeView getUserDefinedFileAttributeView(java.nio.file.Path path) throws IOException
IOException
protected String buildPathStartingFromBaseDir(String... pathTokens)
pathTokens
- all the string in the proper order that must be concatenated in order to obtain the
filenameCopyright © 2009-2016 The Apache Software Foundation. All Rights Reserved.