Package org.opennms.netmgt.dao.api
Interface ResourceStorageDao
-
- All Known Implementing Classes:
EmptyResourceStorageDao
,FilesystemResourceStorageDao
,NewtsResourceStorageDao
,TimeseriesResourceStorageDao
public interface ResourceStorageDao
This interface is used to abstract the I/O operations used to walk the resource tree and retrieve or manipulate resource details.- Author:
- jwhite
- See Also:
ResourceDao
,ResourcePath
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description Set<ResourcePath>
children(ResourcePath path, int depth)
Retrieves the set of child paths one level bellow the given path which contain one or more metrics at the given depth.boolean
delete(ResourcePath path)
Deletes all of the resources and metric bellow the given path.boolean
exists(ResourcePath path, int depth)
Verifies if a path contains one or more metrics at the given depth.boolean
existsWithin(ResourcePath path, int depth)
Verifies if a path contains one or more metrics within the given depth.Set<OnmsAttribute>
getAttributes(ResourcePath path)
Retrieves the set of (resource-level) attributes stored at the given path.Map<String,String>
getMetaData(ResourcePath path)
Retrieves the meta-data stored at the given path.String
getStringAttribute(ResourcePath path, String key)
Returns the value for the given (resource-level) attribute, or null if it does not exist.Map<String,String>
getStringAttributes(ResourcePath path)
Returns the value for the given (resource-level) attribute, or null if it does not exist.void
setStringAttribute(ResourcePath path, String key, String value)
Sets the specified (resource-level) attribute at the given path.void
updateMetricToResourceMappings(ResourcePath path, Map<String,String> metricsNameToResourceNames)
Maps the given metric names to the their associated resources names.
-
-
-
Method Detail
-
exists
boolean exists(ResourcePath path, int depth)
Verifies if a path contains one or more metrics at the given depth.For example, assume we are working with file-system paths, and we have the following file on disk /a/b/c/some.metric. The function should behave as follows:
- exists('/a/b/c', 0) -> true
- exists('/a/b', 1) -> true
- exists('/a/b', 2) -> false
- Parameters:
path
- resource path used as the root of the checkdepth
- a non-negative integer- Returns:
- true if one or more metrics exist, false otherwise
-
existsWithin
boolean existsWithin(ResourcePath path, int depth)
Verifies if a path contains one or more metrics within the given depth.For example, assume we are working with file-system paths, and we have the following file on disk /a/b/c/some.metric. The function should behave as follows:
- exists('/a/b/c', 0) -> true
- exists('/a/b', 1) -> true
- exists('/a/b', 2) -> true
- exists('/a', 1) -> false
- Parameters:
path
- resource path used as the root of the checkdepth
- a non-negative integer- Returns:
- true if one or more metrics exist, false otherwise
-
children
Set<ResourcePath> children(ResourcePath path, int depth)
Retrieves the set of child paths one level bellow the given path which contain one or more metrics at the given depth.For example, assume we are working with file-system paths, and we have the following file on disk /a/b/c/some.metric. The function should behave as follows:
- children('/a/b', 1) -> {'/a/b/c'}
- children('/a/b', 2) -> {}
- children('/a', 2) -> {'b'}
- Parameters:
path
- resource path used as the root of the checkdepth
- a positive integer- Returns:
- the set of child paths containing metrics
-
delete
boolean delete(ResourcePath path)
Deletes all of the resources and metric bellow the given path. Returns true if the operation succeeded.
-
getAttributes
Set<OnmsAttribute> getAttributes(ResourcePath path)
Retrieves the set of (resource-level) attributes stored at the given path.
-
setStringAttribute
void setStringAttribute(ResourcePath path, String key, String value)
Sets the specified (resource-level) attribute at the given path. Should not be called directly but only through the BasePersister.
-
getStringAttribute
String getStringAttribute(ResourcePath path, String key)
Returns the value for the given (resource-level) attribute, or null if it does not exist.
-
getStringAttributes
Map<String,String> getStringAttributes(ResourcePath path)
Returns the value for the given (resource-level) attribute, or null if it does not exist.
-
updateMetricToResourceMappings
void updateMetricToResourceMappings(ResourcePath path, Map<String,String> metricsNameToResourceNames)
Maps the given metric names to the their associated resources names. The resource names are relative to the given path. When persisting to .rrd of .jrb files with storeByGroup enabled, this is used to map the data sources names (metrics) to associated .rrd files (resource names). Other strategies that can infer this information at runtime may chose to ignore calls to this method.- Parameters:
path
- parent resource pathmetricsNameToResourceNames
- metric to resource mappings
-
getMetaData
Map<String,String> getMetaData(ResourcePath path)
Retrieves the meta-data stored at the given path.
-
-