|
||||||||||
| 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 |
cleanupViews()
View indexes on disk are named after their MD5 hash of the view definition. |
|
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. |
|
|
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. |
|
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)
|
|
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 |
replicateTo(java.lang.String target)
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.void create(java.lang.Object o)
o - void update(java.lang.Object o)
o - java.lang.String delete(java.lang.Object o)
o -
java.lang.String delete(java.lang.String id,
java.lang.String revision)
id - revision -
<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.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 -
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
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
java.lang.String deleteAttachment(java.lang.String docId,
java.lang.String revision,
java.lang.String attachmentId)
docId - revision - attachmentId -
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()
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 replicateTo(java.lang.String target)
target - database
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.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||