Package org.apache.logging.log4j.couchdb
Class CouchDbProvider
java.lang.Object
org.apache.logging.log4j.couchdb.CouchDbProvider
- All Implemented Interfaces:
NoSqlProvider<CouchDbConnection>
@Plugin(name="CouchDB",
category="Core",
printObject=true)
public final class CouchDbProvider
extends Object
implements NoSqlProvider<CouchDbConnection>
The Apache CouchDB implementation of
NoSqlProvider
.-
Field Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivate
CouchDbProvider
(org.lightcouch.CouchDbClient client, String description) -
Method Summary
Modifier and TypeMethodDescriptionstatic CouchDbProvider
createNoSqlProvider
(String databaseName, String protocol, String server, String port, String username, String password, String factoryClassName, String factoryMethodName) Factory method for creating an Apache CouchDB provider within the plugin manager.Obtains a connection from this provider.toString()
All implementations must overrideObject.toString()
to provide information about the provider configuration (obscuring passwords with one-way hashes).
-
Field Details
-
HTTP
private static final int HTTP- See Also:
-
HTTPS
private static final int HTTPS- See Also:
-
LOGGER
-
client
private final org.lightcouch.CouchDbClient client -
description
-
-
Constructor Details
-
CouchDbProvider
-
-
Method Details
-
getConnection
Description copied from interface:NoSqlProvider
Obtains a connection from this provider. The concept of a connection in this case is not strictly an active duplex UDP or TCP connection to the underlying database. It can be thought of more as a gateway, a path for inserting objects that may use a persistent connection or may use HTTP web service calls, etc.Where applicable, this method should return a connection from the connection pool as opposed to opening a brand new connection every time.
- Specified by:
getConnection
in interfaceNoSqlProvider<CouchDbConnection>
- Returns:
- a connection that can be used to create and persist objects to this database.
- See Also:
-
toString
Description copied from interface:NoSqlProvider
All implementations must overrideObject.toString()
to provide information about the provider configuration (obscuring passwords with one-way hashes).- Specified by:
toString
in interfaceNoSqlProvider<CouchDbConnection>
- Overrides:
toString
in classObject
- Returns:
- the string representation of this NoSQL provider.
-
createNoSqlProvider
@PluginFactory public static CouchDbProvider createNoSqlProvider(@PluginAttribute("databaseName") String databaseName, @PluginAttribute("protocol") String protocol, @PluginAttribute(value="server",defaultString="localhost") @ValidHost String server, @PluginAttribute(value="port",defaultString="0") @ValidPort String port, @PluginAttribute("username") String username, @PluginAttribute(value="password",sensitive=true) String password, @PluginAttribute("factoryClassName") String factoryClassName, @PluginAttribute("factoryMethodName") String factoryMethodName) Factory method for creating an Apache CouchDB provider within the plugin manager.- Parameters:
databaseName
- The name of the database to which log event documents will be written.protocol
- Either "http" or "https," defaults to "http" and mutually exclusive withfactoryClassName&factoryMethodName!=null
.server
- The host name of the CouchDB server, defaults to localhost and mutually exclusive withfactoryClassName&factoryMethodName!=null
.port
- The port that CouchDB is listening on, defaults to 80 ifprotocol
is "http" and 443 ifprotocol
is "https," and mutually exclusive withfactoryClassName&factoryMethodName!=null
.username
- The username to authenticate against the MongoDB server with, mutually exclusive withfactoryClassName&factoryMethodName!=null
.password
- The password to authenticate against the MongoDB server with, mutually exclusive withfactoryClassName&factoryMethodName!=null
.factoryClassName
- A fully qualified class name containing a static factory method capable of returning aCouchDbClient
orCouchDbProperties
.factoryMethodName
- The name of the public static factory method belonging to the aforementioned factory class.- Returns:
- a new Apache CouchDB provider.
-