public class FilesystemStorageStrategyImpl extends Object implements LocalStorageStrategy
Modifier and Type | Field and Description |
---|---|
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,
FilesystemContainerNameValidator filesystemContainerNameValidator,
FilesystemBlobKeyValidator filesystemBlobKeyValidator) |
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)
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) |
Iterable<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.
|
Iterable<String> |
getBlobKeysInsideContainer(String container)
Returns all the blobs key inside a container
|
File |
getFileForBlobKey(String container,
String blobKey)
Returns a
File object that links to the blob |
Location |
getLocation(String containerName) |
String |
getSeparator() |
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
|
protected Logger logger
protected final javax.inject.Provider<BlobBuilder> blobBuilders
protected final String baseDirectory
protected final FilesystemContainerNameValidator filesystemContainerNameValidator
protected final FilesystemBlobKeyValidator filesystemBlobKeyValidator
@Inject protected FilesystemStorageStrategyImpl(javax.inject.Provider<BlobBuilder> blobBuilders, @Named(value="jclouds.filesystem.basedir") String baseDir, FilesystemContainerNameValidator filesystemContainerNameValidator, FilesystemBlobKeyValidator filesystemBlobKeyValidator)
public boolean containerExists(String container)
LocalStorageStrategy
containerExists
in interface LocalStorageStrategy
public Iterable<String> getAllContainerNames()
LocalStorageStrategy
getAllContainerNames
in interface LocalStorageStrategy
public boolean createContainerInLocation(String container, Location location)
LocalStorageStrategy
createContainerInLocation
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 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 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 String buildPathStartingFromBaseDir(String... pathTokens)
pathTokens
- all the string in the proper order that must be concatenated in order to obtain the
filenameCopyright © 2009-2014 The Apache Software Foundation. All Rights Reserved.