java.lang.Object
org.rrd4j.core.RrdBackendFactory
org.rrd4j.core.RrdFileBackendFactory
- All Implemented Interfaces:
Closeable, AutoCloseable
- Direct Known Subclasses:
RrdNioBackendFactory, RrdRandomAccessFileBackendFactory
An abstract backend factory which is used to store RRD data to ordinary files on the disk.
Every backend factory storing RRD data as ordinary files should inherit from it, some check are done in the code for instanceof.
Field Summary
Fields inherited from class RrdBackendFactory
cachingAllowed, DEFAULTFACTORY, name, scheme, validateHeaderModifier and TypeFieldDescriptionprotected final booleanWhether this factory's backends may cache data in memory.static final StringDefault backend factory name.protected final StringStorage name this factory reports to RrdDb.protected final StringURI scheme this factory's storage URIs start with.protected final booleanWhether opened files must carry the RRD header.Constructor Summary
ConstructorsConstructorDescriptionConstructor for subclasses that build a backend storing RRD data in ordinary files.Method Summary
All MethodsModifier and TypeMethodDescriptionbooleanTests whether this factory recognises a storage URI.protected booleanDetermines if a storage with the given path already exists.getCanonicalUri(URI uri) Ensure that an URI is returned in a non-ambiguous way.Extract the local path from an URI.Transform an path in a valid URI for this backend.Methods inherited from class RrdBackendFactory
addActiveFactories, buildGenericUri, checkClosing, close, exists, findFactory, getActiveFactories, getBackend, getBackend, getDefaultFactory, getName, getRootUri, getScheme, open, resolve, setActiveFactories, shouldValidateHeader, shouldValidateHeaderModifier and TypeMethodDescriptionstatic voidaddActiveFactories(RrdBackendFactory... newFactories) /** Add factories to the list of active factories, i.e.static URIbuildGenericUri(String rrdpath) Try to detect an URI from a path.voidCheck that all phantom reference are indeed safely closed.voidclose()A generic close handle, default implementation does nothing.protected booleanDetermines if a storage with the given URI already exists.static RrdBackendFactoryfindFactory(URI uri) For a given URI, try to find a factory that can manage it in the list of active factories.static java.util.stream.Stream<RrdBackendFactory> Return the current active factories as a stream.(package private) RrdBackendgetBackend(RrdDb rrdDb, String path, boolean readOnly) Creates RrdBackend object for the given storage path.(package private) RrdBackendgetBackend(RrdDb rrdDb, URI uri, boolean readOnly) Creates RrdBackend object for the given storage path.static RrdBackendFactory/** /** Returns the default backend factory.getName()Returns the name (primary ID) for the factory.protected URIBuilds the root URI for this factory's scheme.The URI scheme that selects this backend, used to build every RRD URI the factory hands out.protected abstract RrdBackendOpens the backend serving a storage path.protected URITry to match an URI against a root URI using a few rules: scheme must match if they are given.static voidsetActiveFactories(RrdBackendFactory... newFactories) Set the list of active factories, i.e.protected booleanshouldValidateHeader(String path) Determines if the header should be validated.protected booleanshouldValidateHeader(URI uri) Determines if the header should be validated.
Constructor Details
RrdFileBackendFactory
public RrdFileBackendFactory()Constructor for subclasses that build a backend storing RRD data in ordinary files.
Method Details
exists
Determines if a storage with the given path already exists.Method to determine if a file with the given path already exists.
- Specified by:
existsin classRrdBackendFactory- Parameters:
path- File system path to probe for.- Returns:
- true if a storage already exists at the given path
canStore
Tests whether this factory recognises a storage URI.- Overrides:
canStorein classRrdBackendFactory- Parameters:
uri- the candidate storage URI to test against this factory- Returns:
- false unless a subclass overrides this to recognise its own URIs
getCanonicalUri
Description copied from class:RrdBackendFactoryEnsure that an URI is returned in a non-ambiguous way.- Overrides:
getCanonicalUriin classRrdBackendFactory- Parameters:
uri- a valid URI for this backend.- Returns:
- the canonized URI.
getUri
Description copied from class:RrdBackendFactoryTransform an path in a valid URI for this backend.- Overrides:
getUriin classRrdBackendFactory- Parameters:
path- a path local to the current backend.- Returns:
- an URI that the current backend can handle.
getPath
Description copied from class:RrdBackendFactoryExtract the local path from an URI.- Overrides:
getPathin classRrdBackendFactory- Parameters:
uri- The URI to parse.- Returns:
- the local path from the URI.