Package org.apache.logging.log4j.mongodb
Class MongoDbConnection
- java.lang.Object
-
- org.apache.logging.log4j.core.appender.nosql.AbstractNoSqlConnection<com.mongodb.BasicDBObject,MongoDbObject>
-
- org.apache.logging.log4j.mongodb.MongoDbConnection
-
- All Implemented Interfaces:
java.io.Closeable,java.lang.AutoCloseable,NoSqlConnection<com.mongodb.BasicDBObject,MongoDbObject>
public final class MongoDbConnection extends AbstractNoSqlConnection<com.mongodb.BasicDBObject,MongoDbObject>
The MongoDB implementation ofNoSqlConnection.
-
-
Constructor Summary
Constructors Constructor Description MongoDbConnection(com.mongodb.DB database, com.mongodb.WriteConcern writeConcern, java.lang.String collectionName, java.lang.Boolean isCapped, java.lang.Integer collectionSize)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcloseImpl()MongoDbObject[]createList(int length)Creates an array of the specified length typed to match theNoSqlObjectimplementation appropriate for this provider.MongoDbObjectcreateObject()Instantiates and returns aNoSqlObjectinstance whose properties can be configured before ultimate insertion viaNoSqlConnection.insertObject(NoSqlObject).voidinsertObject(NoSqlObject<com.mongodb.BasicDBObject> object)Inserts the given object into the underlying NoSQL database.-
Methods inherited from class org.apache.logging.log4j.core.appender.nosql.AbstractNoSqlConnection
close, isClosed
-
-
-
-
Method Detail
-
createObject
public MongoDbObject createObject()
Description copied from interface:NoSqlConnectionInstantiates and returns aNoSqlObjectinstance whose properties can be configured before ultimate insertion viaNoSqlConnection.insertObject(NoSqlObject).- Returns:
- a new object.
- See Also:
NoSqlObject
-
createList
public MongoDbObject[] createList(int length)
Description copied from interface:NoSqlConnectionCreates an array of the specified length typed to match theNoSqlObjectimplementation appropriate for this provider.- Parameters:
length- the length of the array to create.- Returns:
- a new array.
- See Also:
NoSqlObject
-
insertObject
public void insertObject(NoSqlObject<com.mongodb.BasicDBObject> object)
Description copied from interface:NoSqlConnectionInserts the given object into the underlying NoSQL database.- Parameters:
object- The object to insert.
-
closeImpl
public void closeImpl()
- Specified by:
closeImplin classAbstractNoSqlConnection<com.mongodb.BasicDBObject,MongoDbObject>
-
-