public abstract class AbstractMongoDatabase<KEY> extends java.lang.Object implements MongoDatabase
| Modifier and Type | Field and Description |
|---|---|
protected java.lang.String |
databaseName |
| Modifier | Constructor and Description |
|---|---|
protected |
AbstractMongoDatabase(java.lang.String databaseName,
MongoBackend backend) |
| Modifier and Type | Method and Description |
|---|---|
protected void |
addIndex(org.bson.BSONObject indexDescription) |
protected void |
addNamespace(MongoCollection<KEY> collection) |
protected void |
checkCollectionName(java.lang.String collectionName) |
void |
clearLastStatus(io.netty.channel.Channel channel) |
protected org.bson.BSONObject |
commandCount(java.lang.String command,
org.bson.BSONObject query) |
protected org.bson.BSONObject |
commandCreateIndexes(io.netty.channel.Channel channel,
java.lang.String command,
org.bson.BSONObject query) |
protected org.bson.BSONObject |
commandDatabaseStats() |
protected org.bson.BSONObject |
commandDelete(io.netty.channel.Channel channel,
java.lang.String command,
org.bson.BSONObject query) |
protected org.bson.BSONObject |
commandDrop(org.bson.BSONObject query) |
protected org.bson.BSONObject |
commandGetLastError(io.netty.channel.Channel channel,
java.lang.String command,
org.bson.BSONObject query) |
protected org.bson.BSONObject |
commandGetPrevError(io.netty.channel.Channel channel,
java.lang.String command,
org.bson.BSONObject query) |
protected org.bson.BSONObject |
commandInsert(io.netty.channel.Channel channel,
java.lang.String command,
org.bson.BSONObject query) |
protected org.bson.BSONObject |
commandResetError(io.netty.channel.Channel channel,
java.lang.String command,
org.bson.BSONObject query) |
protected org.bson.BSONObject |
commandUpdate(io.netty.channel.Channel channel,
java.lang.String command,
org.bson.BSONObject query) |
protected int |
countIndexes() |
protected MongoCollection<KEY> |
createCollection(java.lang.String collectionName) |
protected org.bson.BSONObject |
deleteDocuments(io.netty.channel.Channel channel,
java.lang.String collectionName,
org.bson.BSONObject selector,
int limit) |
MongoCollection<KEY> |
deregisterCollection(java.lang.String collectionName) |
void |
drop() |
void |
dropCollection(java.lang.String collectionName) |
java.lang.String |
getDatabaseName() |
protected abstract long |
getFileSize() |
protected abstract long |
getStorageSize() |
void |
handleClose(io.netty.channel.Channel channel) |
org.bson.BSONObject |
handleCommand(io.netty.channel.Channel channel,
java.lang.String command,
org.bson.BSONObject query) |
void |
handleDelete(MongoDelete delete) |
void |
handleInsert(MongoInsert insert) |
java.lang.Iterable<org.bson.BSONObject> |
handleQuery(MongoQuery query) |
void |
handleUpdate(MongoUpdate updateCommand) |
protected void |
initializeNamespacesAndIndexes() |
protected org.bson.BSONObject |
insertDocuments(io.netty.channel.Channel channel,
java.lang.String collectionName,
java.util.List<org.bson.BSONObject> documents) |
boolean |
isEmpty() |
protected org.bson.BSONObject |
listCollections() |
protected org.bson.BSONObject |
listIndexes() |
void |
moveCollection(MongoDatabase oldDatabase,
MongoCollection<?> collection,
java.lang.String newCollectionName) |
protected abstract MongoCollection<KEY> |
openOrCreateCollection(java.lang.String collectionName,
java.lang.String idField) |
protected abstract Index<KEY> |
openOrCreateUniqueIndex(java.lang.String collectionName,
java.lang.String key,
boolean ascending) |
protected void |
putLastError(io.netty.channel.Channel channel,
MongoServerException ex) |
protected void |
putLastResult(io.netty.channel.Channel channel,
org.bson.BSONObject result) |
MongoCollection<KEY> |
resolveCollection(java.lang.String collectionName,
boolean throwIfNotFound) |
protected MongoCollection<KEY> |
resolveOrCreateCollection(java.lang.String collectionName) |
java.lang.String |
toString() |
protected org.bson.BSONObject |
updateDocuments(io.netty.channel.Channel channel,
java.lang.String collectionName,
org.bson.BSONObject selector,
org.bson.BSONObject update,
boolean multi,
boolean upsert) |
protected AbstractMongoDatabase(java.lang.String databaseName,
MongoBackend backend)
protected void initializeNamespacesAndIndexes()
throws MongoServerException
MongoServerExceptionpublic final java.lang.String getDatabaseName()
getDatabaseName in interface MongoDatabasepublic java.lang.String toString()
toString in class java.lang.Objectpublic org.bson.BSONObject handleCommand(io.netty.channel.Channel channel,
java.lang.String command,
org.bson.BSONObject query)
throws MongoServerException
handleCommand in interface MongoDatabaseMongoServerExceptionprotected org.bson.BSONObject listCollections()
throws MongoServerException
MongoServerExceptionprotected org.bson.BSONObject listIndexes()
throws MongoServerException
MongoServerExceptionprotected MongoCollection<KEY> resolveOrCreateCollection(java.lang.String collectionName) throws MongoServerException
MongoServerExceptionprotected org.bson.BSONObject commandInsert(io.netty.channel.Channel channel,
java.lang.String command,
org.bson.BSONObject query)
throws MongoServerException
MongoServerExceptionprotected org.bson.BSONObject commandUpdate(io.netty.channel.Channel channel,
java.lang.String command,
org.bson.BSONObject query)
throws MongoServerException
MongoServerExceptionprotected org.bson.BSONObject commandDelete(io.netty.channel.Channel channel,
java.lang.String command,
org.bson.BSONObject query)
throws MongoServerException
MongoServerExceptionprotected org.bson.BSONObject commandCreateIndexes(io.netty.channel.Channel channel,
java.lang.String command,
org.bson.BSONObject query)
throws MongoServerException
MongoServerExceptionprotected int countIndexes()
protected org.bson.BSONObject commandDatabaseStats()
throws MongoServerException
MongoServerExceptionprotected abstract long getFileSize()
protected abstract long getStorageSize()
protected org.bson.BSONObject commandDrop(org.bson.BSONObject query)
throws MongoServerException
MongoServerExceptionprotected org.bson.BSONObject commandGetLastError(io.netty.channel.Channel channel,
java.lang.String command,
org.bson.BSONObject query)
throws MongoServerException
MongoServerExceptionprotected org.bson.BSONObject commandGetPrevError(io.netty.channel.Channel channel,
java.lang.String command,
org.bson.BSONObject query)
protected org.bson.BSONObject commandResetError(io.netty.channel.Channel channel,
java.lang.String command,
org.bson.BSONObject query)
protected org.bson.BSONObject commandCount(java.lang.String command,
org.bson.BSONObject query)
throws MongoServerException
MongoServerExceptionpublic java.lang.Iterable<org.bson.BSONObject> handleQuery(MongoQuery query) throws MongoServerException
handleQuery in interface MongoDatabaseMongoServerExceptionpublic void handleClose(io.netty.channel.Channel channel)
handleClose in interface MongoDatabasepublic void clearLastStatus(io.netty.channel.Channel channel)
public void handleInsert(MongoInsert insert) throws MongoServerException
handleInsert in interface MongoDatabaseMongoServerExceptionpublic MongoCollection<KEY> resolveCollection(java.lang.String collectionName, boolean throwIfNotFound) throws MongoServerException
resolveCollection in interface MongoDatabaseMongoServerExceptionprotected void checkCollectionName(java.lang.String collectionName)
throws MongoServerException
MongoServerExceptionpublic boolean isEmpty()
isEmpty in interface MongoDatabaseprotected void addNamespace(MongoCollection<KEY> collection) throws MongoServerException
MongoServerExceptionpublic void handleDelete(MongoDelete delete) throws MongoServerException
handleDelete in interface MongoDatabaseMongoServerExceptionpublic void handleUpdate(MongoUpdate updateCommand) throws MongoServerException
handleUpdate in interface MongoDatabaseMongoServerExceptionprotected void addIndex(org.bson.BSONObject indexDescription)
throws MongoServerException
MongoServerExceptionprotected abstract Index<KEY> openOrCreateUniqueIndex(java.lang.String collectionName, java.lang.String key, boolean ascending)
protected org.bson.BSONObject insertDocuments(io.netty.channel.Channel channel,
java.lang.String collectionName,
java.util.List<org.bson.BSONObject> documents)
throws MongoServerException
MongoServerExceptionprotected org.bson.BSONObject deleteDocuments(io.netty.channel.Channel channel,
java.lang.String collectionName,
org.bson.BSONObject selector,
int limit)
throws MongoServerException
MongoServerExceptionprotected org.bson.BSONObject updateDocuments(io.netty.channel.Channel channel,
java.lang.String collectionName,
org.bson.BSONObject selector,
org.bson.BSONObject update,
boolean multi,
boolean upsert)
throws MongoServerException
MongoServerExceptionprotected void putLastError(io.netty.channel.Channel channel,
MongoServerException ex)
protected void putLastResult(io.netty.channel.Channel channel,
org.bson.BSONObject result)
protected MongoCollection<KEY> createCollection(java.lang.String collectionName) throws MongoServerException
MongoServerExceptionprotected abstract MongoCollection<KEY> openOrCreateCollection(java.lang.String collectionName, java.lang.String idField)
public void drop()
throws MongoServerException
drop in interface MongoDatabaseMongoServerExceptionpublic void dropCollection(java.lang.String collectionName)
throws MongoServerException
dropCollection in interface MongoDatabaseMongoServerExceptionpublic MongoCollection<KEY> deregisterCollection(java.lang.String collectionName) throws MongoServerException
deregisterCollection in interface MongoDatabaseMongoServerExceptionpublic void moveCollection(MongoDatabase oldDatabase, MongoCollection<?> collection, java.lang.String newCollectionName) throws MongoServerException
moveCollection in interface MongoDatabaseMongoServerException