Package org.moeaframework.analysis.store
Interface DataStore
- All Known Implementing Classes:
FileSystemDataStore
public interface DataStore
Interface for storing data or objects to some persistent backend.
The data store organizes related data, called Blob
s, in collections called Container
s. A container
is referenced by a Reference
, and each blob is referenced by a name. A data store is itself an abstract
representation of the underlying storage, as the content could be stored on a local file system, cloud storage, or
a database.
In addition to the container associated with each reference, there also exists a top-level or "root" container that can store data applicable to the entire data store. This is useful, for example, to store the parameter samplings used to generate the data.
-
Method Summary
Modifier and TypeMethodDescriptionboolean
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 reference) Returns the container for the given reference.default Container
getContainer
(Referenceable reference) Returns the container for the givenReferenceable
object.Returns the application intent that specifies what operations are valid against a data store.default Container
Returns the root container for this data store.getURI()
Returns the URI for this data store, which can be used withDataStoreFactory.getDataStore(java.net.URI)
.Returns a list of all containers, excluding the root container, in this data store.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.default String
toJSON()
Returns the contents of this data store formatted as JSON.default String
Returns the contents of this data store formatted as JSON.default String
Returns the contents of this data store formatted as JSON.
-
Method Details
-
getContainer
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.- Parameters:
reference
- the data reference- Returns:
- the container
-
streamContainers
Returns a stream of all containers, excluding the root container, in this data store. The caller must close the stream when finished.- Returns:
- a stream of containers
- Throws:
DataStoreException
- if an error occurred accessing the data store
-
listContainers
Returns a list of all containers, excluding the root container, in this data store.- Returns:
- a list of containers
- Throws:
DataStoreException
- if an error occurred accessing the data store
-
getURI
URI getURI()Returns the URI for this data store, which can be used withDataStoreFactory.getDataStore(java.net.URI)
.- Returns:
- the URI
-
getIntent
Returns the application intent that specifies what operations are valid against a data store.- Returns:
- the application intent
- Throws:
DataStoreException
- if an error occurred accessing the data store
-
setIntent
Sets the application intent that specifies what operations are valid against a data store.- Parameters:
intent
- the application intent- Throws:
DataStoreException
- if an error occurred accessing the data store
-
exists
Returnstrue
if the underlying, physical data store exists.- Returns:
true
if the data store exists;false
otherwise- Throws:
DataStoreException
- if an error occurred accessing the data store
-
delete
Deletes this data store if it exists, including all containers and blobs contained within.- Returns:
true
if the data store was deleted;false
otherwise- Throws:
DataStoreException
- if an error occurred accessing the data store
-
getRootContainer
Returns the root container for this data store. This container is useful for storing general information or data about the experiment or data store.- Returns:
- the root container
-
getContainer
Returns the container for the givenReferenceable
object.- Parameters:
reference
- the data reference- Returns:
- the container
- See Also:
-
toJSON
Returns the contents of this data store formatted as JSON.- Returns:
- the JSON string
-
toJSON
Returns the contents of this data store formatted as JSON.- Parameters:
baseURI
- the base URI, which is used to produce URLs- Returns:
- the JSON string
-
toJSON
Returns the contents of this data store formatted as JSON.- Parameters:
baseURI
- the base URI, which is used to produce URLsfull
- iftrue
, output the full data (can produce large output)- Returns:
- the JSON string
-