public class MongoDatabaseMethods
extends ch.agent.crnickl.impl.DatabaseMethodsImpl
| Modifier and Type | Class and Description |
|---|---|
static class |
MongoDatabaseMethods.Operator |
| Constructor and Description |
|---|
MongoDatabaseMethods() |
| Modifier and Type | Method and Description |
|---|---|
protected void |
addOperation(com.mongodb.DBObject operation,
MongoDatabaseMethods.Operator op,
Object... arg)
Add an update operation to a DBObject.
|
protected <T> com.mongodb.DBObject |
asQuery(ch.agent.crnickl.api.DBObjectId id) |
protected String |
compositeName(String... names)
Return a composite mongodb identifier.
|
protected String |
extractRegexp(String pattern)
Remove enclosing slashes from the input pattern.
|
protected org.bson.types.ObjectId |
getId(ch.agent.crnickl.api.DBObject dBObject)
Return the internal ID of a database object.
|
org.bson.types.ObjectId |
getId(ch.agent.crnickl.api.Surrogate surrogate)
Extract the internal ID of a database object from its surrogate.
|
org.bson.types.ObjectId |
getIdOrZero(ch.agent.crnickl.api.DBObject dBObject)
Return the internal ID of a database object or 0 if the object is null or
is in construction.
|
MongoDB |
getMongoDB(ch.agent.crnickl.api.Database db) |
MongoDB |
getMongoDB(ch.agent.crnickl.api.DBObject dbObj) |
MongoDB |
getMongoDB(ch.agent.crnickl.api.Surrogate surr) |
com.mongodb.DBObject |
getObject(ch.agent.crnickl.api.Surrogate s,
boolean mustExist)
Return the MongoDB database object corresponding to a surrogate.
|
org.bson.types.ObjectId |
getObjectId(com.mongodb.BasicDBObject bdo) |
ch.agent.crnickl.api.Surrogate |
makeSurrogate(ch.agent.crnickl.api.Database db,
ch.agent.crnickl.api.DBObjectType dot,
org.bson.types.ObjectId id)
Create a surrogate for a database object.
|
protected com.mongodb.DBObject |
mongoObject(Object... arg)
Return an array of key-value pairs as a DBObject.
|
protected com.mongodb.DBObject |
operation(MongoDatabaseMethods.Operator op,
Object... arg)
Return a com.mongodb.DbObject representing an operation object for an
operator and list of arguments.
|
public MongoDB getMongoDB(ch.agent.crnickl.api.Database db)
public MongoDB getMongoDB(ch.agent.crnickl.api.DBObject dbObj)
public MongoDB getMongoDB(ch.agent.crnickl.api.Surrogate surr)
public com.mongodb.DBObject getObject(ch.agent.crnickl.api.Surrogate s,
boolean mustExist)
throws ch.agent.crnickl.T2DBException
mustExist is false the method returns null if the object cannot be found,
else an exception is thrown.s - a surrogatemustExist - if true throw an exception when the object cannot be foundch.agent.crnickl.T2DBExceptionpublic org.bson.types.ObjectId getObjectId(com.mongodb.BasicDBObject bdo)
bdo - a BasicDBObjectObjectIdpublic org.bson.types.ObjectId getIdOrZero(ch.agent.crnickl.api.DBObject dBObject)
This method is for use inside the MongoDB implementation
and its argument must have a DBObjectId implemented
by MongoDBObjectId.
dBObject - a database object or nullprotected org.bson.types.ObjectId getId(ch.agent.crnickl.api.DBObject dBObject)
This method is for use inside the MongoDB implementation
and its argument must have a DBObjectId implemented
by MongoDBObjectId.
dBObject - a non-null database objectpublic org.bson.types.ObjectId getId(ch.agent.crnickl.api.Surrogate surrogate)
This method is for use inside the MongoDB implementation
and its argument must have a DBObjectId implemented
by MongoDBObjectId.
surrogate - the surrogate of a database objectpublic ch.agent.crnickl.api.Surrogate makeSurrogate(ch.agent.crnickl.api.Database db,
ch.agent.crnickl.api.DBObjectType dot,
org.bson.types.ObjectId id)
db - the database of the objectdot - the type of the objectid - the internal ID of the database objectprotected <T> com.mongodb.DBObject asQuery(ch.agent.crnickl.api.DBObjectId id)
throws ch.agent.crnickl.T2DBException
ch.agent.crnickl.T2DBExceptionprotected String extractRegexp(String pattern)
pattern - protected void addOperation(com.mongodb.DBObject operation,
MongoDatabaseMethods.Operator op,
Object... arg)
mongoObject(Object...) for restrictions on the list of arguments.operation - the operation objectop - the operatorarg - the list of argumentsIllegalArgumentExceptionprotected com.mongodb.DBObject operation(MongoDatabaseMethods.Operator op, Object... arg)
mongoObject(Object...) for
restrictions on the list of arguments.op - the operatorarg - the list of argumentsIllegalArgumentExceptionprotected com.mongodb.DBObject mongoObject(Object... arg)
arg - an non-empty array of arguments of even lengthIllegalArgumentExceptionCopyright © 2017. All rights reserved.