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 void
closeImpl()
MongoDbObject[]
createList(int length)
Creates an array of the specified length typed to match theNoSqlObject
implementation appropriate for this provider.MongoDbObject
createObject()
Instantiates and returns aNoSqlObject
instance whose properties can be configured before ultimate insertion viaNoSqlConnection.insertObject(NoSqlObject)
.void
insertObject(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:NoSqlConnection
Instantiates and returns aNoSqlObject
instance 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:NoSqlConnection
Creates an array of the specified length typed to match theNoSqlObject
implementation 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:NoSqlConnection
Inserts the given object into the underlying NoSQL database.- Parameters:
object
- The object to insert.
-
closeImpl
public void closeImpl()
- Specified by:
closeImpl
in classAbstractNoSqlConnection<com.mongodb.BasicDBObject,MongoDbObject>
-
-