|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
public interface CouchDbConnector
Primary interface for working with Objects mapped as documents in CouchDb. Mapped Objects must have getters and setters for id and revision. public String getId() public void setId(String s) public String getRevision() public void setRevision(String s) Reflection is used to access these methods.
| 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 json)
|
|
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 |
setRevisionLimit(int limit)
|
|
void |
update(java.lang.Object o)
Updates the document. |
|
| Method Detail |
|---|
void create(java.lang.String id,
org.codehaus.jackson.JsonNode json)
id - json - The document in the form of an Jackson JsonNode.
UpdateConflictException - if there was an update conflict.void create(java.lang.Object o)
o -
UpdateConflictException - if there was an update conflict.void update(java.lang.Object o)
o -
UpdateConflictException - if there was an update conflict.java.lang.String delete(java.lang.Object o)
o -
UpdateConflictException - if there was an update conflict.
java.lang.String delete(java.lang.String id,
java.lang.String revision)
id - revision -
UpdateConflictException - if there was an update conflict.
<T> T get(java.lang.Class<T> c,
java.lang.String id)
T - c - the target class to map to.id - the id of the document in the database.
DocumentNotFoundException - if the document was not found.
<T> T get(java.lang.Class<T> c,
java.lang.String id,
java.lang.String rev)
T - c - the target class to map to.id - the id of the document in the database.rev - of the object.
DocumentNotFoundException - if the document was not found.
<T> T getWithConflicts(java.lang.Class<T> c,
java.lang.String id)
T - c - the target class to map to.id - the id of the document in the database.
DocumentNotFoundException - if the document was not found.boolean contains(java.lang.String id)
id -
java.io.InputStream getAsStream(java.lang.String id)
id -
DocumentNotFoundException - if the document was not found.
java.io.InputStream getAsStream(java.lang.String id,
java.lang.String rev)
id - rev -
DocumentNotFoundException - if the document was not found.java.util.List<Revision> getRevisions(java.lang.String id)
id -
DocumentNotFoundException - if the document was not found.
AttachmentInputStream getAttachment(java.lang.String id,
java.lang.String attachmentId)
id - attachmentId -
DocumentNotFoundException - if the document was not found.
java.lang.String createAttachment(java.lang.String docId,
AttachmentInputStream data)
docId - a - - the data to be saved as an attachment
UpdateConflictException - if there was an update conflict.
java.lang.String createAttachment(java.lang.String docId,
java.lang.String revision,
AttachmentInputStream data)
docId - revision - a - - the data to be saved as an attachment
UpdateConflictException - if there was an update conflict.
java.lang.String deleteAttachment(java.lang.String docId,
java.lang.String revision,
java.lang.String attachmentId)
docId - revision - attachmentId -
UpdateConflictException - if there was an update conflict.java.util.List<java.lang.String> getAllDocIds()
<T> java.util.List<T> queryView(ViewQuery query,
java.lang.Class<T> type)
T - query - type - the type to map the result to
ViewResult queryView(ViewQuery query)
query -
java.io.InputStream queryForStream(ViewQuery query)
query -
void createDatabaseIfNotExists()
java.lang.String getDatabaseName()
java.lang.String path()
HttpClient getConnection()
DbInfo getDbInfo()
DesignDocInfo getDesignDocInfo(java.lang.String designDocId)
designDocId -
void compact()
void compactViews(java.lang.String designDocumentId)
designDocumentId - void cleanupViews()
int getRevisionLimit()
void setRevisionLimit(int limit)
ReplicationStatus replicateFrom(java.lang.String source)
source - database
ReplicationStatus replicateFrom(java.lang.String source,
java.util.Collection<java.lang.String> docIds)
source - databasedocIds -
ReplicationStatus replicateTo(java.lang.String target)
target - database
ReplicationStatus replicateTo(java.lang.String target,
java.util.Collection<java.lang.String> docIds)
target - databasedocIds -
void addToBulkBuffer(java.lang.Object o)
o - java.util.List<DocumentOperationResult> flushBulkBuffer()
void clearBulkBuffer()
java.util.List<DocumentOperationResult> executeBulk(java.util.Collection<?> objects)
objects, - all objects will have their id and revision set.
java.util.List<DocumentOperationResult> executeAllOrNothing(java.util.Collection<?> objects)
objects, - all objects will have their id and revision set.
java.util.List<DocumentChange> changes(ChangesCommand cmd)
cmd -
ChangesFeed changesFeed(ChangesCommand cmd)
cmd -
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||