org.rrd4j.core
Class RrdMongoDBBackendFactory

java.lang.Object
  extended by org.rrd4j.core.RrdBackendFactory
      extended by org.rrd4j.core.RrdMongoDBBackendFactory

public class RrdMongoDBBackendFactory
extends RrdBackendFactory

RrdBackendFactory that uses MongoDB for data storage. Construct a MongoDB DBCollection and pass it via the constructor.

Author:
Mathias Bogaert

Constructor Summary
RrdMongoDBBackendFactory(com.mongodb.DBCollection rrdCollection)
          Creates a RrdMongoDBBackendFactory.
 
Method Summary
protected  boolean exists(String path)
          Determines if a storage with the given path already exists.
 String getName()
          Returns the name (primary ID) for the factory.
protected  RrdBackend open(String path, boolean readOnly)
          Creates RrdBackend object for the given storage path.
protected  boolean shouldValidateHeader(String path)
          Determines if the header should be validated.
 
Methods inherited from class org.rrd4j.core.RrdBackendFactory
getDefaultFactory, getFactory, registerAndSetAsDefaultFactory, registerFactory, setDefaultFactory
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RrdMongoDBBackendFactory

public RrdMongoDBBackendFactory(com.mongodb.DBCollection rrdCollection)
Creates a RrdMongoDBBackendFactory. Make sure that the passed DBCollection has a safe write concern, is capped (if needed) and slaveOk() called if applicable.

Parameters:
rrdCollection - the collection to use for storing RRD byte data
Method Detail

open

protected RrdBackend open(String path,
                          boolean readOnly)
                   throws IOException
Description copied from class: RrdBackendFactory
Creates RrdBackend object for the given storage path.

Specified by:
open in class RrdBackendFactory
Parameters:
path - Storage path
readOnly - True, if the storage should be accessed in read/only mode. False otherwise.
Returns:
Backend object which handles all I/O operations for the given storage path
Throws:
IOException - Thrown in case of I/O error.

exists

protected boolean exists(String path)
                  throws IOException
Description copied from class: RrdBackendFactory
Determines if a storage with the given path already exists.

Specified by:
exists in class RrdBackendFactory
Parameters:
path - Storage path
Returns:
True, if such storage exists, false otherwise.
Throws:
IOException

shouldValidateHeader

protected boolean shouldValidateHeader(String path)
                                throws IOException
Description copied from class: RrdBackendFactory
Determines if the header should be validated.

Specified by:
shouldValidateHeader in class RrdBackendFactory
Parameters:
path - Storage path
Returns:
True, if the header should be validated for this factory
Throws:
IOException - if header validation fails

getName

public String getName()
Description copied from class: RrdBackendFactory
Returns the name (primary ID) for the factory.

Specified by:
getName in class RrdBackendFactory
Returns:
Name of the factory.


Copyright © 2011. All Rights Reserved.