@Plugin(name="MongoDb", category="Core", printObject=true) public final class MongoDbProvider extends Object implements NoSqlProvider<MongoDbConnection>
NoSqlProvider
.Modifier and Type | Method and Description |
---|---|
static MongoDbProvider |
createNoSqlProvider(String collectionName,
String writeConcernConstant,
String writeConcernConstantClassName,
String databaseName,
String server,
String port,
String username,
String password,
String factoryClassName,
String factoryMethodName)
Factory method for creating a MongoDB provider within the plugin manager.
|
MongoDbConnection |
getConnection()
Obtains a connection from this provider.
|
String |
toString()
All implementations must override
Object.toString() to provide information about the provider
configuration (obscuring passwords with one-way hashes). |
public MongoDbConnection getConnection()
NoSqlProvider
Where applicable, this method should return a connection from the connection pool as opposed to opening a brand new connection every time.
getConnection
in interface NoSqlProvider<MongoDbConnection>
NoSqlConnection
public String toString()
NoSqlProvider
Object.toString()
to provide information about the provider
configuration (obscuring passwords with one-way hashes).toString
in interface NoSqlProvider<MongoDbConnection>
toString
in class Object
@PluginFactory public static MongoDbProvider createNoSqlProvider(@PluginAttribute(value="collectionName") String collectionName, @PluginAttribute(value="writeConcernConstant") String writeConcernConstant, @PluginAttribute(value="writeConcernConstantClass") String writeConcernConstantClassName, @PluginAttribute(value="databaseName") String databaseName, @PluginAttribute(value="server") String server, @PluginAttribute(value="port") String port, @PluginAttribute(value="username") String username, @PluginAttribute(value="password",sensitive=true) String password, @PluginAttribute(value="factoryClassName") String factoryClassName, @PluginAttribute(value="factoryMethodName") String factoryMethodName)
collectionName
- The name of the MongoDB collection to which log events should be written.writeConcernConstant
- The WriteConcern
constant to control writing details, defaults to
WriteConcern.ACKNOWLEDGED
.writeConcernConstantClassName
- The name of a class containing the aforementioned static WriteConcern
constant. Defaults to WriteConcern
.databaseName
- The name of the MongoDB database containing the collection to which log events should be
written. Mutually exclusive with factoryClassName&factoryMethodName!=null
.server
- The host name of the MongoDB server, defaults to localhost and mutually exclusive with
factoryClassName&factoryMethodName!=null
.port
- The port the MongoDB server is listening on, defaults to the default MongoDB port and mutually
exclusive with factoryClassName&factoryMethodName!=null
.username
- The username to authenticate against the MongoDB server with.password
- The password to authenticate against the MongoDB server with.factoryClassName
- A fully qualified class name containing a static factory method capable of returning a
DB
or a MongoClient
.factoryMethodName
- The name of the public static factory method belonging to the aforementioned factory
class.Copyright © 1999-2015 Apache Software Foundation. All Rights Reserved.
Apache Logging, Apache Log4j, Log4j, Apache, the Apache feather logo, the Apache Logging project logo, and the Apache Log4j logo are trademarks of The Apache Software Foundation.