Package de.bwaldvogel.mongo.backend
Class AbstractMongoDatabase<P>
- java.lang.Object
-
- de.bwaldvogel.mongo.backend.AbstractMongoDatabase<P>
-
- All Implemented Interfaces:
MongoDatabase
public abstract class AbstractMongoDatabase<P> extends java.lang.Object implements MongoDatabase
-
-
Field Summary
Fields Modifier and Type Field Description protected java.lang.StringdatabaseName
-
Constructor Summary
Constructors Modifier Constructor Description protectedAbstractMongoDatabase(java.lang.String databaseName, MongoBackend backend)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected MongoCollection<P>createCollection(java.lang.String collectionName)voiddrop()voiddropCollection(java.lang.String collectionName)protected voiddropIndex(MongoCollection<P> collection, java.lang.String indexName)java.lang.StringgetDatabaseName()protected abstract longgetFileSize()protected abstract longgetStorageSize()voidhandleClose(io.netty.channel.Channel channel)DocumenthandleCommand(io.netty.channel.Channel channel, java.lang.String command, Document query)voidhandleDelete(MongoDelete delete)voidhandleInsert(MongoInsert insert)java.lang.Iterable<Document>handleQuery(MongoQuery query)voidhandleUpdate(MongoUpdate updateCommand)protected voidinitializeNamespacesAndIndexes()booleanisEmpty()voidmoveCollection(MongoDatabase oldDatabase, MongoCollection<?> collection, java.lang.String newCollectionName)protected abstract MongoCollection<P>openOrCreateCollection(java.lang.String collectionName, java.lang.String idField)protected abstract Index<P>openOrCreateUniqueIndex(java.lang.String collectionName, java.lang.String indexName, java.util.List<IndexKey> keys, boolean sparse)MongoCollection<P>resolveCollection(java.lang.String collectionName, boolean throwIfNotFound)java.lang.StringtoString()voidunregisterCollection(java.lang.String collectionName)
-
-
-
Constructor Detail
-
AbstractMongoDatabase
protected AbstractMongoDatabase(java.lang.String databaseName, MongoBackend backend)
-
-
Method Detail
-
initializeNamespacesAndIndexes
protected void initializeNamespacesAndIndexes()
-
getDatabaseName
public final java.lang.String getDatabaseName()
- Specified by:
getDatabaseNamein interfaceMongoDatabase
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
handleCommand
public Document handleCommand(io.netty.channel.Channel channel, java.lang.String command, Document query)
- Specified by:
handleCommandin interfaceMongoDatabase
-
dropIndex
protected void dropIndex(MongoCollection<P> collection, java.lang.String indexName)
-
getFileSize
protected abstract long getFileSize()
-
getStorageSize
protected abstract long getStorageSize()
-
handleQuery
public java.lang.Iterable<Document> handleQuery(MongoQuery query)
- Specified by:
handleQueryin interfaceMongoDatabase
-
handleClose
public void handleClose(io.netty.channel.Channel channel)
- Specified by:
handleClosein interfaceMongoDatabase
-
handleInsert
public void handleInsert(MongoInsert insert)
- Specified by:
handleInsertin interfaceMongoDatabase
-
resolveCollection
public MongoCollection<P> resolveCollection(java.lang.String collectionName, boolean throwIfNotFound)
- Specified by:
resolveCollectionin interfaceMongoDatabase
-
isEmpty
public boolean isEmpty()
- Specified by:
isEmptyin interfaceMongoDatabase
-
handleDelete
public void handleDelete(MongoDelete delete)
- Specified by:
handleDeletein interfaceMongoDatabase
-
handleUpdate
public void handleUpdate(MongoUpdate updateCommand)
- Specified by:
handleUpdatein interfaceMongoDatabase
-
openOrCreateUniqueIndex
protected abstract Index<P> openOrCreateUniqueIndex(java.lang.String collectionName, java.lang.String indexName, java.util.List<IndexKey> keys, boolean sparse)
-
createCollection
protected MongoCollection<P> createCollection(java.lang.String collectionName)
-
openOrCreateCollection
protected abstract MongoCollection<P> openOrCreateCollection(java.lang.String collectionName, java.lang.String idField)
-
drop
public void drop()
- Specified by:
dropin interfaceMongoDatabase
-
dropCollection
public void dropCollection(java.lang.String collectionName)
- Specified by:
dropCollectionin interfaceMongoDatabase
-
unregisterCollection
public void unregisterCollection(java.lang.String collectionName)
- Specified by:
unregisterCollectionin interfaceMongoDatabase
-
moveCollection
public void moveCollection(MongoDatabase oldDatabase, MongoCollection<?> collection, java.lang.String newCollectionName)
- Specified by:
moveCollectionin interfaceMongoDatabase
-
-