org.apache.logging.log4j.nosql.appender.couchdb
Class CouchDbConnection

java.lang.Object
  extended by org.apache.logging.log4j.nosql.appender.couchdb.CouchDbConnection
All Implemented Interfaces:
Closeable, NoSqlConnection<Map<String,Object>,DefaultNoSqlObject>

public final class CouchDbConnection
extends Object
implements NoSqlConnection<Map<String,Object>,DefaultNoSqlObject>

The Apache CouchDB implementation of NoSqlConnection.


Constructor Summary
CouchDbConnection(org.lightcouch.CouchDbClient client)
           
 
Method Summary
 void close()
          Closes the underlying connection.
 DefaultNoSqlObject[] createList(int length)
          Creates an array of the specified length typed to match the NoSqlObject implementation appropriate for this provider.
 DefaultNoSqlObject createObject()
          Instantiates and returns a NoSqlObject instance whose properties can be configured before ultimate insertion via NoSqlConnection.insertObject(NoSqlObject).
 void insertObject(NoSqlObject<Map<String,Object>> object)
          Inserts the given object into the underlying NoSQL database.
 boolean isClosed()
          Indicates whether the underlying connection is closed.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CouchDbConnection

public CouchDbConnection(org.lightcouch.CouchDbClient client)
Method Detail

createObject

public DefaultNoSqlObject createObject()
Description copied from interface: NoSqlConnection
Instantiates and returns a NoSqlObject instance whose properties can be configured before ultimate insertion via NoSqlConnection.insertObject(NoSqlObject).

Specified by:
createObject in interface NoSqlConnection<Map<String,Object>,DefaultNoSqlObject>
Returns:
a new object.
See Also:
NoSqlObject

createList

public DefaultNoSqlObject[] createList(int length)
Description copied from interface: NoSqlConnection
Creates an array of the specified length typed to match the NoSqlObject implementation appropriate for this provider.

Specified by:
createList in interface NoSqlConnection<Map<String,Object>,DefaultNoSqlObject>
Parameters:
length - the length of the array to create.
Returns:
a new array.
See Also:
NoSqlObject

insertObject

public void insertObject(NoSqlObject<Map<String,Object>> object)
Description copied from interface: NoSqlConnection
Inserts the given object into the underlying NoSQL database.

Specified by:
insertObject in interface NoSqlConnection<Map<String,Object>,DefaultNoSqlObject>
Parameters:
object - The object to insert.

close

public void close()
Description copied from interface: NoSqlConnection
Closes the underlying connection. This method call should be idempotent. Only the first call should have any effect; all further calls should be ignored. It's possible the underlying connection is stateless (such as an HTTP web service), in which case this method would be a no-op. This method should also commit any open transactions, if applicable and if not already committed.

If this connection is part of a connection pool, executing this method should commit the transaction and return the connection to the pool, but it should not actually close the underlying connection.

Specified by:
close in interface Closeable
Specified by:
close in interface NoSqlConnection<Map<String,Object>,DefaultNoSqlObject>

isClosed

public boolean isClosed()
Description copied from interface: NoSqlConnection
Indicates whether the underlying connection is closed. If the underlying connection is stateless (such as an HTTP web service), this method would likely always return true. Essentially, this method should only return true if a call to NoSqlConnection.insertObject(NoSqlObject) will fail due to the state of this object.

Specified by:
isClosed in interface NoSqlConnection<Map<String,Object>,DefaultNoSqlObject>
Returns:
true if this object is considered closed.


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.