Package com.powsybl.afs.storage
Class ForwardingAppStorage
- java.lang.Object
-
- com.powsybl.afs.storage.ForwardingAppStorage
-
- All Implemented Interfaces:
AppStorage
,AutoCloseable
public class ForwardingAppStorage extends Object implements AppStorage
A storage implementation which simply delegates calls to another underlying AppStorage implementation.- Author:
- Geoffroy Jamgotchian
-
-
Constructor Summary
Constructors Constructor Description ForwardingAppStorage(AppStorage storage)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addDependency(String nodeId, String name, String toNodeId)
Adds a dependency from node with IDnodeId
to node with IDtoNodeId
.void
addDoubleTimeSeriesData(String nodeId, int version, String timeSeriesName, List<com.powsybl.timeseries.DoubleDataChunk> chunks)
Adds data (double) to the time series with namestimeSeriesNames
associated with node with IDnodeId
.void
addStringTimeSeriesData(String nodeId, int version, String timeSeriesName, List<com.powsybl.timeseries.StringDataChunk> chunks)
Adds data (string) to the time series with namestimeSeriesNames
associated with node with IDnodeId
.List<FileSystemCheckIssue>
checkFileSystem(FileSystemCheckOptions options)
Check file system for consistency issues.void
clearTimeSeries(String nodeId)
Deletes time series associated with node with IDnodeId
void
close()
Closes any resource associated with this storage.NodeInfo
createNode(String parentNodeId, String name, String nodePseudoClass, String description, int version, NodeGenericMetadata genericMetadata)
Creates a new node in the tree under a parent node.NodeInfo
createRootNodeIfNotExists(String name, String nodePseudoClass)
Returns the root node of the tree, creating it if it does not exist.void
createTimeSeries(String nodeId, com.powsybl.timeseries.TimeSeriesMetadata metadata)
Creates a time series associated with node with IDnodeId
.boolean
dataExists(String nodeId, String name)
Returnstrue
if data namedname
associated with the node with IDnodeId
exists.String
deleteNode(String nodeId)
Deletes the node with IDnodeId
.void
flush()
Flush any changes to underlying storage.Set<NodeInfo>
getBackwardDependencies(String nodeId)
GetsNodeInfo
objects of nodes which depend on the node with IDnodeId
.Optional<NodeInfo>
getChildNode(String nodeId, String name)
GetsNodeInfo
for child node with namename
of the node with IDnodeId
, empty if such a node does not exist or node is inconsistent.List<NodeInfo>
getChildNodes(String nodeId)
GetsNodeInfo
for consistent child nodes of the node with IDnodeId
.Set<String>
getDataNames(String nodeId)
Returns the lists of names of data associated to the node with IDnodeId
.Set<NodeDependency>
getDependencies(String nodeId)
Gets all dependencies (NodeDependency
objects) of node with IDnodeId
.Set<NodeInfo>
getDependencies(String nodeId, String name)
GetsNodeInfo
objects for dependencies of node with IDnodeId
, and associated to the dependency namename
.Map<String,List<com.powsybl.timeseries.DoubleDataChunk>>
getDoubleTimeSeriesData(String nodeId, Set<String> timeSeriesNames, int version)
Gets data (double) for the time series with namestimeSeriesNames
associated with node with IDnodeId
.EventsBus
getEventsBus()
Get the events store.String
getFileSystemName()
List<NodeInfo>
getInconsistentNodes()
GetsNodeInfo
for all inconsistent nodes.NodeInfo
getNodeInfo(String nodeId)
Gets NodeInfo object for the node with IDnodeId
.Optional<NodeInfo>
getParentNode(String nodeId)
GetsNodeInfo
for parent node of the node with IDnodeId
, empty if such a node does not exist or inconsistent.Map<String,List<com.powsybl.timeseries.StringDataChunk>>
getStringTimeSeriesData(String nodeId, Set<String> timeSeriesNames, int version)
Gets data (string) for the time series with namestimeSeriesNames
associated with node with IDnodeId
.List<String>
getSupportedFileSystemChecks()
The list of supported file system checks.Set<Integer>
getTimeSeriesDataVersions(String nodeId)
Gets versions of time series data associated with node with IDnodeId
.Set<Integer>
getTimeSeriesDataVersions(String nodeId, String timeSeriesName)
Gets versions of data for the time series with nametimeSeriesName
associated with node with IDnodeId
.List<com.powsybl.timeseries.TimeSeriesMetadata>
getTimeSeriesMetadata(String nodeId, Set<String> timeSeriesNames)
Returns metadata of time series associated with node with IDnodeId
and with name intimeSeriesNames
.Set<String>
getTimeSeriesNames(String nodeId)
Returns names of all time series associated with node with IDnodeId
.boolean
isClosed()
Check if storage is closed.boolean
isConsistent(String nodeId)
Return true if the node with IDnodeId
is consistent, otherwise it returns false .boolean
isRemote()
boolean
isWritable(String nodeId)
Optional<InputStream>
readBinaryData(String nodeId, String name)
Reads data associated to the node with IDnodeId
.boolean
removeData(String nodeId, String name)
Removes the data blob namedname
associated with the node with IDnodeId
.void
removeDependency(String nodeId, String name, String toNodeId)
Removes a dependency namedname
from node with IDnodeId
to node with IDtoNodeId
.void
renameNode(String nodeId, String name)
Rename the node with IDnodeId
void
setConsistent(String nodeId)
mark the node with IDnodeId
as consistent node.void
setDescription(String nodeId, String description)
void
setMetadata(String nodeId, NodeGenericMetadata genericMetadata)
Update a node metadatavoid
setParentNode(String nodeId, String newParentNodeId)
Sets new parent node for the node with IDnodeId
.boolean
timeSeriesExists(String nodeId, String timeSeriesName)
Returnstrue
if a time series namedtimeSeriesName
associated with the node with IDnodeId
exists.void
updateModificationTime(String nodeId)
OutputStream
writeBinaryData(String nodeId, String name)
Returns anOutputStream
to write data associated to the node with IDnodeId
.
-
-
-
Constructor Detail
-
ForwardingAppStorage
public ForwardingAppStorage(AppStorage storage)
-
-
Method Detail
-
getFileSystemName
public String getFileSystemName()
- Specified by:
getFileSystemName
in interfaceAppStorage
-
isRemote
public boolean isRemote()
- Specified by:
isRemote
in interfaceAppStorage
-
createRootNodeIfNotExists
public NodeInfo createRootNodeIfNotExists(String name, String nodePseudoClass)
Description copied from interface:AppStorage
Returns the root node of the tree, creating it if it does not exist.- Specified by:
createRootNodeIfNotExists
in interfaceAppStorage
-
createNode
public NodeInfo createNode(String parentNodeId, String name, String nodePseudoClass, String description, int version, NodeGenericMetadata genericMetadata)
Description copied from interface:AppStorage
Creates a new node in the tree under a parent node. ReturnsNodeInfo
corresponding to the newly created node. The new node is by default inconsistent,AppStorage.setConsistent(String nodeId)
method should explicitly be called to set it consistent.- Specified by:
createNode
in interfaceAppStorage
-
setMetadata
public void setMetadata(String nodeId, NodeGenericMetadata genericMetadata)
Description copied from interface:AppStorage
Update a node metadata- Specified by:
setMetadata
in interfaceAppStorage
- Parameters:
nodeId
- id of the nodegenericMetadata
- new metadata that will override previous ones
-
isWritable
public boolean isWritable(String nodeId)
- Specified by:
isWritable
in interfaceAppStorage
-
getNodeInfo
public NodeInfo getNodeInfo(String nodeId)
Description copied from interface:AppStorage
Gets NodeInfo object for the node with IDnodeId
.- Specified by:
getNodeInfo
in interfaceAppStorage
-
setDescription
public void setDescription(String nodeId, String description)
- Specified by:
setDescription
in interfaceAppStorage
-
setConsistent
public void setConsistent(String nodeId)
Description copied from interface:AppStorage
mark the node with IDnodeId
as consistent node.- Specified by:
setConsistent
in interfaceAppStorage
-
isConsistent
public boolean isConsistent(String nodeId)
Description copied from interface:AppStorage
Return true if the node with IDnodeId
is consistent, otherwise it returns false .- Specified by:
isConsistent
in interfaceAppStorage
-
updateModificationTime
public void updateModificationTime(String nodeId)
- Specified by:
updateModificationTime
in interfaceAppStorage
-
getChildNodes
public List<NodeInfo> getChildNodes(String nodeId)
Description copied from interface:AppStorage
GetsNodeInfo
for consistent child nodes of the node with IDnodeId
.- Specified by:
getChildNodes
in interfaceAppStorage
-
getInconsistentNodes
public List<NodeInfo> getInconsistentNodes()
Description copied from interface:AppStorage
GetsNodeInfo
for all inconsistent nodes.- Specified by:
getInconsistentNodes
in interfaceAppStorage
-
getChildNode
public Optional<NodeInfo> getChildNode(String nodeId, String name)
Description copied from interface:AppStorage
GetsNodeInfo
for child node with namename
of the node with IDnodeId
, empty if such a node does not exist or node is inconsistent.- Specified by:
getChildNode
in interfaceAppStorage
-
getParentNode
public Optional<NodeInfo> getParentNode(String nodeId)
Description copied from interface:AppStorage
GetsNodeInfo
for parent node of the node with IDnodeId
, empty if such a node does not exist or inconsistent.- Specified by:
getParentNode
in interfaceAppStorage
-
setParentNode
public void setParentNode(String nodeId, String newParentNodeId)
Description copied from interface:AppStorage
Sets new parent node for the node with IDnodeId
.- Specified by:
setParentNode
in interfaceAppStorage
-
deleteNode
public String deleteNode(String nodeId)
Description copied from interface:AppStorage
Deletes the node with IDnodeId
.- Specified by:
deleteNode
in interfaceAppStorage
-
renameNode
public void renameNode(String nodeId, String name)
Description copied from interface:AppStorage
Rename the node with IDnodeId
- Specified by:
renameNode
in interfaceAppStorage
-
readBinaryData
public Optional<InputStream> readBinaryData(String nodeId, String name)
Description copied from interface:AppStorage
Reads data associated to the node with IDnodeId
. A node may have several data blobs associated to it, with different names. The parametersname
specifies which of those data is requested.- Specified by:
readBinaryData
in interfaceAppStorage
-
writeBinaryData
public OutputStream writeBinaryData(String nodeId, String name)
Description copied from interface:AppStorage
Returns anOutputStream
to write data associated to the node with IDnodeId
. A node may have several data blobs associated to it, with different names.- Specified by:
writeBinaryData
in interfaceAppStorage
-
dataExists
public boolean dataExists(String nodeId, String name)
Description copied from interface:AppStorage
Returnstrue
if data namedname
associated with the node with IDnodeId
exists.- Specified by:
dataExists
in interfaceAppStorage
-
getDataNames
public Set<String> getDataNames(String nodeId)
Description copied from interface:AppStorage
Returns the lists of names of data associated to the node with IDnodeId
.- Specified by:
getDataNames
in interfaceAppStorage
-
removeData
public boolean removeData(String nodeId, String name)
Description copied from interface:AppStorage
Removes the data blob namedname
associated with the node with IDnodeId
.- Specified by:
removeData
in interfaceAppStorage
-
createTimeSeries
public void createTimeSeries(String nodeId, com.powsybl.timeseries.TimeSeriesMetadata metadata)
Description copied from interface:AppStorage
Creates a time series associated with node with IDnodeId
.- Specified by:
createTimeSeries
in interfaceAppStorage
-
getTimeSeriesNames
public Set<String> getTimeSeriesNames(String nodeId)
Description copied from interface:AppStorage
Returns names of all time series associated with node with IDnodeId
.- Specified by:
getTimeSeriesNames
in interfaceAppStorage
-
timeSeriesExists
public boolean timeSeriesExists(String nodeId, String timeSeriesName)
Description copied from interface:AppStorage
Returnstrue
if a time series namedtimeSeriesName
associated with the node with IDnodeId
exists.- Specified by:
timeSeriesExists
in interfaceAppStorage
-
getTimeSeriesMetadata
public List<com.powsybl.timeseries.TimeSeriesMetadata> getTimeSeriesMetadata(String nodeId, Set<String> timeSeriesNames)
Description copied from interface:AppStorage
Returns metadata of time series associated with node with IDnodeId
and with name intimeSeriesNames
.- Specified by:
getTimeSeriesMetadata
in interfaceAppStorage
-
getTimeSeriesDataVersions
public Set<Integer> getTimeSeriesDataVersions(String nodeId)
Description copied from interface:AppStorage
Gets versions of time series data associated with node with IDnodeId
.- Specified by:
getTimeSeriesDataVersions
in interfaceAppStorage
-
getTimeSeriesDataVersions
public Set<Integer> getTimeSeriesDataVersions(String nodeId, String timeSeriesName)
Description copied from interface:AppStorage
Gets versions of data for the time series with nametimeSeriesName
associated with node with IDnodeId
.- Specified by:
getTimeSeriesDataVersions
in interfaceAppStorage
-
getDoubleTimeSeriesData
public Map<String,List<com.powsybl.timeseries.DoubleDataChunk>> getDoubleTimeSeriesData(String nodeId, Set<String> timeSeriesNames, int version)
Description copied from interface:AppStorage
Gets data (double) for the time series with namestimeSeriesNames
associated with node with IDnodeId
.- Specified by:
getDoubleTimeSeriesData
in interfaceAppStorage
-
addDoubleTimeSeriesData
public void addDoubleTimeSeriesData(String nodeId, int version, String timeSeriesName, List<com.powsybl.timeseries.DoubleDataChunk> chunks)
Description copied from interface:AppStorage
Adds data (double) to the time series with namestimeSeriesNames
associated with node with IDnodeId
.- Specified by:
addDoubleTimeSeriesData
in interfaceAppStorage
-
getStringTimeSeriesData
public Map<String,List<com.powsybl.timeseries.StringDataChunk>> getStringTimeSeriesData(String nodeId, Set<String> timeSeriesNames, int version)
Description copied from interface:AppStorage
Gets data (string) for the time series with namestimeSeriesNames
associated with node with IDnodeId
.- Specified by:
getStringTimeSeriesData
in interfaceAppStorage
-
addStringTimeSeriesData
public void addStringTimeSeriesData(String nodeId, int version, String timeSeriesName, List<com.powsybl.timeseries.StringDataChunk> chunks)
Description copied from interface:AppStorage
Adds data (string) to the time series with namestimeSeriesNames
associated with node with IDnodeId
.- Specified by:
addStringTimeSeriesData
in interfaceAppStorage
-
clearTimeSeries
public void clearTimeSeries(String nodeId)
Description copied from interface:AppStorage
Deletes time series associated with node with IDnodeId
- Specified by:
clearTimeSeries
in interfaceAppStorage
-
addDependency
public void addDependency(String nodeId, String name, String toNodeId)
Description copied from interface:AppStorage
Adds a dependency from node with IDnodeId
to node with IDtoNodeId
. The dependency will be associated with the specifiedname
.- Specified by:
addDependency
in interfaceAppStorage
-
getDependencies
public Set<NodeInfo> getDependencies(String nodeId, String name)
Description copied from interface:AppStorage
GetsNodeInfo
objects for dependencies of node with IDnodeId
, and associated to the dependency namename
.- Specified by:
getDependencies
in interfaceAppStorage
-
getDependencies
public Set<NodeDependency> getDependencies(String nodeId)
Description copied from interface:AppStorage
Gets all dependencies (NodeDependency
objects) of node with IDnodeId
.- Specified by:
getDependencies
in interfaceAppStorage
-
getBackwardDependencies
public Set<NodeInfo> getBackwardDependencies(String nodeId)
Description copied from interface:AppStorage
GetsNodeInfo
objects of nodes which depend on the node with IDnodeId
.- Specified by:
getBackwardDependencies
in interfaceAppStorage
-
removeDependency
public void removeDependency(String nodeId, String name, String toNodeId)
Description copied from interface:AppStorage
Removes a dependency namedname
from node with IDnodeId
to node with IDtoNodeId
.- Specified by:
removeDependency
in interfaceAppStorage
-
flush
public void flush()
Description copied from interface:AppStorage
Flush any changes to underlying storage.- Specified by:
flush
in interfaceAppStorage
-
isClosed
public boolean isClosed()
Description copied from interface:AppStorage
Check if storage is closed.- Specified by:
isClosed
in interfaceAppStorage
-
close
public void close()
Description copied from interface:AppStorage
Closes any resource associated with this storage.- Specified by:
close
in interfaceAppStorage
- Specified by:
close
in interfaceAutoCloseable
-
getEventsBus
public EventsBus getEventsBus()
Description copied from interface:AppStorage
Get the events store.- Specified by:
getEventsBus
in interfaceAppStorage
-
checkFileSystem
public List<FileSystemCheckIssue> checkFileSystem(FileSystemCheckOptions options)
Description copied from interface:AppStorage
Check file system for consistency issues.- Specified by:
checkFileSystem
in interfaceAppStorage
-
getSupportedFileSystemChecks
public List<String> getSupportedFileSystemChecks()
Description copied from interface:AppStorage
The list of supported file system checks.- Specified by:
getSupportedFileSystemChecks
in interfaceAppStorage
-
-