|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.jrobin.core.RrdBackendFactory
public abstract class RrdBackendFactory
Base (abstract) backend factory class which holds references to all concrete backend factories and defines abstract methods which must be implemented in all concrete factory implementations.
Factory classes are used to create concrete RrdBackend
implementations.
Each factory creates unlimited number of specific backend objects.
JRobin supports three different backend types (backend factories) out of the box:
RrdFileBackend
: objects of this class are created from the
RrdFileBackendFactory
class. This was the default backend used in all
JRobin releases before 1.4.0 release. It uses java.io.* package and RandomAccessFile class to store
RRD data in files on the disk.
RrdNioBackend
: objects of this class are created from the
RrdNioBackendFactory
class. The backend uses java.io.* and java.nio.*
classes (mapped ByteBuffer) to store RRD data in files on the disk. This is the default backend
since 1.4.0 release.
RrdMemoryBackend
: objects of this class are created from the
RrdMemoryBackendFactory
class. This backend stores all data in memory. Once
JVM exits, all data gets lost. The backend is extremely fast and memory hungry.
name
. Constructors
are provided in the RrdDb
class to create RrdDb objects (RRD databases)
backed with a specific backend.
See javadoc for RrdBackend
to find out how to create your custom backends.
Constructor Summary | |
---|---|
RrdBackendFactory()
|
Method Summary | |
---|---|
protected abstract boolean |
exists(java.lang.String path)
Method to determine if a storage with the given path already exists. |
static RrdBackendFactory |
getDefaultFactory()
Returns the defaul backend factory. |
static RrdBackendFactory |
getFactory(java.lang.String name)
Returns backend factory for the given backend factory name. |
abstract java.lang.String |
getFactoryName()
Returns the name (primary ID) for the factory. |
protected abstract RrdBackend |
open(java.lang.String path,
boolean readOnly,
int lockMode)
Creates RrdBackend object for the given storage path. |
static void |
registerAndSetAsDefaultFactory(RrdBackendFactory factory)
Registers new (custom) backend factory within the JRobin framework and sets this factory as the default. |
static void |
registerFactory(RrdBackendFactory factory)
Registers new (custom) backend factory within the JRobin framework. |
static void |
setDefaultFactory(java.lang.String factoryName)
Replaces the default backend factory with a new one. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public RrdBackendFactory()
Method Detail |
---|
public static RrdBackendFactory getFactory(java.lang.String name) throws RrdException
name
- Backend factory name. Initially supported names are:
RrdException
- Thrown if no factory with the given name
is available.public static void registerFactory(RrdBackendFactory factory) throws RrdException
factory
- Factory to be registered
RrdException
- Thrown if the name of the specified factory is already
used.public static void registerAndSetAsDefaultFactory(RrdBackendFactory factory) throws RrdException
factory
- Factory to be registered and set as default
RrdException
- Thrown if the name of the specified factory is already
used.public static RrdBackendFactory getDefaultFactory()
RrdDb
objects if no factory is specified in the RrdDb constructor.
public static void setDefaultFactory(java.lang.String factoryName) throws RrdException
factoryName
- Name of the default factory. Out of the box, JRobin supports three
different RRD backends: "FILE" (java.io.* based), "NIO" (java.nio.* based) and "MEMORY"
(byte[] based).
RrdException
- Thrown if invalid factory name is supplied or not called before
the first RRD is created.protected abstract RrdBackend open(java.lang.String path, boolean readOnly, int lockMode) throws java.io.IOException
path
- Storage pathreadOnly
- True, if the storage should be accessed in read/only mode.
False otherwise.lockMode
- One of the following constants: RrdDb.NO_LOCKS
,
RrdDb.EXCEPTION_IF_LOCKED
or RrdDb.WAIT_IF_LOCKED
.
java.io.IOException
- Thrown in case of I/O error.protected abstract boolean exists(java.lang.String path) throws java.io.IOException
path
- Storage path
java.io.IOException
public abstract java.lang.String getFactoryName()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |