java.lang.Object
org.rrd4j.core.RrdBackendFactory
org.rrd4j.core.RrdFileBackendFactory
org.rrd4j.core.RrdRandomAccessFileBackendFactory
- All Implemented Interfaces:
Closeable, AutoCloseable
- Direct Known Subclasses:
RrdSafeFileBackendFactory
@RrdBackendAnnotation(name="FILE", shouldValidateHeader=true) public class RrdRandomAccessFileBackendFactoryextends RrdFileBackendFactory
Factory class which creates actual
RrdRandomAccessFileBackend objects. This was the default backend factory in Rrd4j before 1.4.0 release.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
ConstructorsConstructorDescriptionA stateless factory:open(String, boolean)builds a fresh RrdRandomAccessFileBackend per call, so a bare instance is ready to use.Method Summary
All MethodsMethods inherited from class RrdFileBackendFactory
canStore, exists, getCanonicalUri, getPath, getUriModifier 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, 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 RrdBackendFactoryReturns 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 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
RrdRandomAccessFileBackendFactory
public RrdRandomAccessFileBackendFactory()A stateless factory:open(String, boolean)builds a fresh RrdRandomAccessFileBackend per call, so a bare instance is ready to use.
Method Details
open
Opens the backend serving a storage path.Creates RrdFileBackend object for the given file path.
- Specified by:
openin classRrdBackendFactory- Parameters:
path- the storage path, relative to this factory's root URIreadOnly- true to open the storage for reading only, false to allow writes- Returns:
- the backend that performs all I/O for the given storage path
- Throws:
IOException- if the storage cannot be opened