|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.ektorp.impl.StdCouchDbConnector
public class StdCouchDbConnector
| Constructor Summary | |
|---|---|
StdCouchDbConnector(java.lang.String databaseName,
CouchDbInstance dbInstance)
|
|
StdCouchDbConnector(java.lang.String databaseName,
CouchDbInstance dbi,
ObjectMapperFactory om)
|
|
| Method Summary | ||
|---|---|---|
void |
addToBulkBuffer(java.lang.Object o)
Add the object to the bulk buffer attached to the executing thread. |
|
java.util.List<DocumentChange> |
changes(ChangesCommand cmd)
Queries the database for changes. |
|
ChangesFeed |
changesFeed(ChangesCommand cmd)
Sets up a continuous changes feed. |
|
void |
cleanupViews()
View indexes on disk are named after their MD5 hash of the view definition. |
|
void |
clearBulkBuffer()
Clears the bulk buffer attached the the executing thread. |
|
void |
compact()
Compaction compresses the database file by removing unused sections created during updates. |
|
void |
compactViews(java.lang.String designDocumentId)
This compacts the view index from the current version of the design document. |
|
boolean |
contains(java.lang.String id)
Check if the database contains a document. |
|
void |
create(java.lang.Object o)
Creates the Object as a document in the database. |
|
void |
create(java.lang.String id,
org.codehaus.jackson.JsonNode node)
|
|
java.lang.String |
createAttachment(java.lang.String docId,
AttachmentInputStream data)
Creates both the document and the attachment |
|
java.lang.String |
createAttachment(java.lang.String docId,
java.lang.String revision,
AttachmentInputStream data)
Adds an attachment to the specified document id. |
|
void |
createDatabaseIfNotExists()
Creates a database on the configured path if it does not exists. |
|
java.lang.String |
delete(java.lang.Object o)
Deletes the Object in the database. |
|
java.lang.String |
delete(java.lang.String id,
java.lang.String revision)
Deletes the document in the database. |
|
java.lang.String |
deleteAttachment(java.lang.String docId,
java.lang.String revision,
java.lang.String attachmentId)
|
|
java.util.List<DocumentOperationResult> |
executeAllOrNothing(java.util.Collection<?> objects)
Creates, updates or deletes all objects in the supplied collection. |
|
java.util.List<DocumentOperationResult> |
executeBulk(java.util.Collection<?> objects)
Creates, updates or deletes all objects in the supplied collection. |
|
java.util.List<DocumentOperationResult> |
flushBulkBuffer()
Sends the bulk buffer attached the the executing thread to the database (through a executeBulk call). |
|
|
get(java.lang.Class<T> c,
java.lang.String id)
|
|
|
get(java.lang.Class<T> c,
java.lang.String id,
java.lang.String rev)
|
|
java.util.List<java.lang.String> |
getAllDocIds()
|
|
java.io.InputStream |
getAsStream(java.lang.String id)
Please note that the stream has to be closed after usage, otherwise http connection leaks will occur and the system will eventually hang due to connection starvation. |
|
java.io.InputStream |
getAsStream(java.lang.String id,
java.lang.String rev)
Please note that the stream has to be closed after usage, otherwise http connection leaks will occur and the system will eventually hang due to connection starvation. |
|
AttachmentInputStream |
getAttachment(java.lang.String id,
java.lang.String attachmentId)
Reads an attachment from the database. |
|
HttpClient |
getConnection()
Convenience method for accessing the underlying HttpClient. |
|
java.lang.String |
getDatabaseName()
|
|
DbInfo |
getDbInfo()
Provides meta information about this database. |
|
DesignDocInfo |
getDesignDocInfo(java.lang.String designDocId)
Obtains information about a given design document, including the index, index size and current status of the design document and associated index information. |
|
int |
getRevisionLimit()
Revision limit defines a upper bound of document revisions which CouchDB keeps track of |
|
java.util.List<Revision> |
getRevisions(java.lang.String id)
|
|
|
getWithConflicts(java.lang.Class<T> c,
java.lang.String id)
Will load the document with any conflicts included. |
|
java.lang.String |
path()
|
|
java.io.InputStream |
queryForStream(ViewQuery query)
|
|
ViewResult |
queryView(ViewQuery query)
|
|
|
queryView(ViewQuery query,
java.lang.Class<T> type)
This method requires the view result values to be document ids or documents : If the value is a document id, then the document is fetched from couchDB. |
|
ReplicationStatus |
replicateFrom(java.lang.String source)
Replicate the content in the source database into this database. |
|
ReplicationStatus |
replicateFrom(java.lang.String source,
java.util.Collection<java.lang.String> docIds)
Replicate the content in the source database into this database. |
|
ReplicationStatus |
replicateTo(java.lang.String target)
Replicate the content in this database into the specified target database. |
|
ReplicationStatus |
replicateTo(java.lang.String target,
java.util.Collection<java.lang.String> docIds)
Replicate the content in this database into the specified target database. |
|
void |
setJsonSerializer(JsonSerializer js)
|
|
void |
setRevisionLimit(int limit)
|
|
void |
update(java.lang.Object o)
Updates the document. |
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public StdCouchDbConnector(java.lang.String databaseName,
CouchDbInstance dbInstance)
public StdCouchDbConnector(java.lang.String databaseName,
CouchDbInstance dbi,
ObjectMapperFactory om)
| Method Detail |
|---|
public java.lang.String path()
path in interface CouchDbConnectorpublic void create(java.lang.Object o)
CouchDbConnector
create in interface CouchDbConnector
public void create(java.lang.String id,
org.codehaus.jackson.JsonNode node)
create in interface CouchDbConnectornode - The document in the form of an Jackson JsonNode.public boolean contains(java.lang.String id)
CouchDbConnector
contains in interface CouchDbConnector
public java.lang.String createAttachment(java.lang.String docId,
AttachmentInputStream data)
CouchDbConnector
createAttachment in interface CouchDbConnector
public java.lang.String createAttachment(java.lang.String docId,
java.lang.String revision,
AttachmentInputStream data)
CouchDbConnector
createAttachment in interface CouchDbConnector
public AttachmentInputStream getAttachment(java.lang.String id,
java.lang.String attachmentId)
CouchDbConnector
getAttachment in interface CouchDbConnectorpublic java.lang.String delete(java.lang.Object o)
CouchDbConnector
delete in interface CouchDbConnector
public <T> T get(java.lang.Class<T> c,
java.lang.String id)
get in interface CouchDbConnectorc - the target class to map to.id - the id of the document in the database.
public <T> T get(java.lang.Class<T> c,
java.lang.String id,
java.lang.String rev)
get in interface CouchDbConnectorc - the target class to map to.id - the id of the document in the database.rev - of the object.
public <T> T getWithConflicts(java.lang.Class<T> c,
java.lang.String id)
CouchDbConnector
getWithConflicts in interface CouchDbConnectorc - the target class to map to.id - the id of the document in the database.
public java.util.List<Revision> getRevisions(java.lang.String id)
getRevisions in interface CouchDbConnectorpublic java.io.InputStream getAsStream(java.lang.String id)
CouchDbConnector
getAsStream in interface CouchDbConnector
public java.io.InputStream getAsStream(java.lang.String id,
java.lang.String rev)
CouchDbConnector
getAsStream in interface CouchDbConnectorpublic void update(java.lang.Object o)
CouchDbConnector
update in interface CouchDbConnector
public java.lang.String delete(java.lang.String id,
java.lang.String revision)
CouchDbConnector
delete in interface CouchDbConnectorpublic java.util.List<java.lang.String> getAllDocIds()
getAllDocIds in interface CouchDbConnectorpublic void createDatabaseIfNotExists()
CouchDbConnector
createDatabaseIfNotExists in interface CouchDbConnectorpublic java.lang.String getDatabaseName()
getDatabaseName in interface CouchDbConnector
public <T> java.util.List<T> queryView(ViewQuery query,
java.lang.Class<T> type)
CouchDbConnector
queryView in interface CouchDbConnectortype - the type to map the result to
public ViewResult queryView(ViewQuery query)
queryView in interface CouchDbConnectorpublic java.io.InputStream queryForStream(ViewQuery query)
queryForStream in interface CouchDbConnector
public java.lang.String deleteAttachment(java.lang.String docId,
java.lang.String revision,
java.lang.String attachmentId)
deleteAttachment in interface CouchDbConnectorpublic HttpClient getConnection()
CouchDbConnector
getConnection in interface CouchDbConnectorpublic DbInfo getDbInfo()
CouchDbConnector
getDbInfo in interface CouchDbConnectorpublic DesignDocInfo getDesignDocInfo(java.lang.String designDocId)
CouchDbConnector
getDesignDocInfo in interface CouchDbConnectorpublic void compact()
CouchDbConnector
compact in interface CouchDbConnectorpublic void cleanupViews()
CouchDbConnector
cleanupViews in interface CouchDbConnectorpublic ReplicationStatus replicateFrom(java.lang.String source)
CouchDbConnector
replicateFrom in interface CouchDbConnectorsource - database
public ReplicationStatus replicateFrom(java.lang.String source,
java.util.Collection<java.lang.String> docIds)
CouchDbConnector
replicateFrom in interface CouchDbConnectorsource - database
public ReplicationStatus replicateTo(java.lang.String target)
CouchDbConnector
replicateTo in interface CouchDbConnectortarget - database
public ReplicationStatus replicateTo(java.lang.String target,
java.util.Collection<java.lang.String> docIds)
CouchDbConnector
replicateTo in interface CouchDbConnectortarget - database
public void compactViews(java.lang.String designDocumentId)
CouchDbConnector
compactViews in interface CouchDbConnectorpublic java.util.List<DocumentOperationResult> executeAllOrNothing(java.util.Collection<?> objects)
CouchDbConnector
executeAllOrNothing in interface CouchDbConnectorpublic java.util.List<DocumentOperationResult> executeBulk(java.util.Collection<?> objects)
CouchDbConnector
executeBulk in interface CouchDbConnectorpublic void addToBulkBuffer(java.lang.Object o)
CouchDbConnector
addToBulkBuffer in interface CouchDbConnectorpublic void clearBulkBuffer()
CouchDbConnector
clearBulkBuffer in interface CouchDbConnectorpublic java.util.List<DocumentOperationResult> flushBulkBuffer()
CouchDbConnector
flushBulkBuffer in interface CouchDbConnectorpublic void setJsonSerializer(JsonSerializer js)
public int getRevisionLimit()
CouchDbConnector
getRevisionLimit in interface CouchDbConnectorpublic void setRevisionLimit(int limit)
setRevisionLimit in interface CouchDbConnectorpublic java.util.List<DocumentChange> changes(ChangesCommand cmd)
CouchDbConnector
changes in interface CouchDbConnectorpublic ChangesFeed changesFeed(ChangesCommand cmd)
CouchDbConnector
changesFeed in interface CouchDbConnector
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||