ch.agent.crnickl.mongodb
Class MongoDB

java.lang.Object
  extended by ch.agent.crnickl.mongodb.MongoDB

public class MongoDB
extends Object

MongoDB is a singleton encapsulating the MongoDB connection and the base collections used by CrNiCKL.

Author:
Jean-Paul Vetterli

Field Summary
static String MONGODB_DB
           
static String MONGODB_HOST
           
static String MONGODB_PASSWORD
           
static String MONGODB_PORT
           
static String MONGODB_USER
           
static String MONGODB_WRITE_CONCERN
           
 
Constructor Summary
MongoDB(ch.agent.crnickl.api.Database database, ch.agent.crnickl.api.DatabaseConfiguration configuration)
          Construct a MongoDB session.
 
Method Summary
 void close(boolean ignoreException)
          Close the MongoDB connection if it is open.
 void commit()
          Operation not supported by MongoDB.
 com.mongodb.DBCollection getAttributes()
           
 com.mongodb.DBCollection getChronicles()
           
 com.mongodb.DBCollection getCollection(ch.agent.crnickl.api.Surrogate s)
           
static MongoDB getInstance()
          Return the MongoDB connection.
 com.mongodb.DBCollection getProperties()
           
 com.mongodb.DBCollection getSchemas()
           
 com.mongodb.DBCollection getSeries()
           
 String getUser()
           
 com.mongodb.DBCollection getValueTypes()
           
 void rollback()
          Operation not supported by MongoDB.
 String toString()
          Return a string displaying the session with the connection and the user id.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

MONGODB_HOST

public static final String MONGODB_HOST
See Also:
Constant Field Values

MONGODB_PORT

public static final String MONGODB_PORT
See Also:
Constant Field Values

MONGODB_DB

public static final String MONGODB_DB
See Also:
Constant Field Values

MONGODB_WRITE_CONCERN

public static final String MONGODB_WRITE_CONCERN
See Also:
Constant Field Values

MONGODB_USER

public static final String MONGODB_USER
See Also:
Constant Field Values

MONGODB_PASSWORD

public static final String MONGODB_PASSWORD
See Also:
Constant Field Values
Constructor Detail

MongoDB

public MongoDB(ch.agent.crnickl.api.Database database,
               ch.agent.crnickl.api.DatabaseConfiguration configuration)
        throws ch.agent.crnickl.T2DBException
Construct a MongoDB session. This constructor can be invoked only once.

Parameters:
configuration - a database configuration
Throws:
ch.agent.crnickl.T2DBException
Method Detail

getInstance

public static MongoDB getInstance()
Return the MongoDB connection.

Returns:
the MongoDB connection

close

public void close(boolean ignoreException)
           throws ch.agent.crnickl.T2DBException
Close the MongoDB connection if it is open.

Throws:
ch.agent.crnickl.T2DBException

commit

public void commit()
            throws ch.agent.crnickl.T2DBException
Operation not supported by MongoDB. Always throws an exception.

Throws:
ch.agent.crnickl.T2DBException

rollback

public void rollback()
              throws ch.agent.crnickl.T2DBException
Operation not supported by MongoDB. Always throws an exception.

Throws:
ch.agent.crnickl.T2DBException

getUser

public String getUser()

getValueTypes

public com.mongodb.DBCollection getValueTypes()

getProperties

public com.mongodb.DBCollection getProperties()

getSchemas

public com.mongodb.DBCollection getSchemas()

getChronicles

public com.mongodb.DBCollection getChronicles()

getSeries

public com.mongodb.DBCollection getSeries()

getAttributes

public com.mongodb.DBCollection getAttributes()

getCollection

public com.mongodb.DBCollection getCollection(ch.agent.crnickl.api.Surrogate s)
                                       throws ch.agent.crnickl.T2DBException
Throws:
ch.agent.crnickl.T2DBException

toString

public String toString()
Return a string displaying the session with the connection and the user id.

Overrides:
toString in class Object
Returns:
a string displaying the session


Copyright © 2013. All Rights Reserved.