Class FileSystemDataStore
java.lang.Object
org.moeaframework.analysis.store.fs.FileSystemDataStore
- All Implemented Interfaces:
DataStore
Data store backed by the local file system. If the data store already exists, the settings are loaded from a
manifest file and arguments passed to the constructor are ignored.
The layout of containers and blobs on the file system are managed by a FileMap
, which defaults to
HierarchicalFileMap
if not specified.
-
Constructor Summary
ConstructorsConstructorDescriptionFileSystemDataStore
(File root) Constructs a default file system data store at the specified directory.FileSystemDataStore
(File root, FileMap fileMap) Constructs a default file system data store at the specified directory.FileSystemDataStore
(Path root) Constructs a default file system data store at the specified directory.FileSystemDataStore
(Path root, FileMap fileMap) Constructs a hierarchical file system data store at the specified directory. -
Method Summary
Modifier and TypeMethodDescriptionvoid
create()
Creates the underlying, physical data store.boolean
delete()
Deletes this data store if it exists, including all containers and blobs contained within.boolean
exists()
Returnstrue
if the underlying, physical data store exists.getContainer
(Reference key) Returns the container for the given reference.Returns the application intent that specifies what operations are valid against a data store.getURI()
Returns the URI for this data store, which can be used withDataStoreFactory.getDataStore(java.net.URI)
.void
Sets the application intent that specifies what operations are valid against a data store.Returns a stream of all containers, excluding the root container, in this data store.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.moeaframework.analysis.store.DataStore
getContainer, getRootContainer, listContainers, toJSON, toJSON, toJSON
-
Constructor Details
-
FileSystemDataStore
Constructs a default file system data store at the specified directory.- Parameters:
root
- the root directory- Throws:
DataStoreException
- if an error occurred accessing the data store
-
FileSystemDataStore
Constructs a default file system data store at the specified directory.- Parameters:
root
- the root directory- Throws:
DataStoreException
- if an error occurred accessing the data store
-
FileSystemDataStore
Constructs a default file system data store at the specified directory.- Parameters:
root
- the root directoryfileMap
- the file map used when creating a new data store; otherwise the map is read from the manifest- Throws:
DataStoreException
- if an error occurred accessing the data store
-
FileSystemDataStore
Constructs a hierarchical file system data store at the specified directory.- Parameters:
root
- the root directoryfileMap
- the file map used when creating a new data store; otherwise the map is read from the manifest- Throws:
DataStoreException
- if an error occurred accessing the data store
-
-
Method Details
-
getContainer
Description copied from interface:DataStore
Returns the container for the given reference. A container is always returned, though this does not imply the underlying storage exists or has been provisioned.- Specified by:
getContainer
in interfaceDataStore
- Parameters:
key
- the data reference- Returns:
- the container
-
streamContainers
Description copied from interface:DataStore
Returns a stream of all containers, excluding the root container, in this data store. The caller must close the stream when finished.- Specified by:
streamContainers
in interfaceDataStore
- Returns:
- a stream of containers
- Throws:
DataStoreException
- if an error occurred accessing the data store
-
getURI
Description copied from interface:DataStore
Returns the URI for this data store, which can be used withDataStoreFactory.getDataStore(java.net.URI)
. -
getIntent
Description copied from interface:DataStore
Returns the application intent that specifies what operations are valid against a data store.- Specified by:
getIntent
in interfaceDataStore
- Returns:
- the application intent
- Throws:
DataStoreException
- if an error occurred accessing the data store
-
setIntent
Description copied from interface:DataStore
Sets the application intent that specifies what operations are valid against a data store.- Specified by:
setIntent
in interfaceDataStore
- Parameters:
intent
- the application intent- Throws:
DataStoreException
- if an error occurred accessing the data store
-
exists
Description copied from interface:DataStore
Returnstrue
if the underlying, physical data store exists.- Specified by:
exists
in interfaceDataStore
- Returns:
true
if the data store exists;false
otherwise- Throws:
DataStoreException
- if an error occurred accessing the data store
-
delete
Description copied from interface:DataStore
Deletes this data store if it exists, including all containers and blobs contained within.- Specified by:
delete
in interfaceDataStore
- Returns:
true
if the data store was deleted;false
otherwise- Throws:
DataStoreException
- if an error occurred accessing the data store
-
create
Creates the underlying, physical data store. Data stores are automatically created when writing a blob, so an explicit call to create is not required.- Throws:
DataStoreException
- if an error occurred accessing the data store
-