|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.ektorp.impl.StdCouchDbConnector
public class StdCouchDbConnector
Constructor Summary | |
---|---|
StdCouchDbConnector(String databaseName,
CouchDbInstance dbInstance)
|
|
StdCouchDbConnector(String databaseName,
CouchDbInstance dbi,
ObjectMapperFactory om)
|
Method Summary | ||
---|---|---|
void |
addToBulkBuffer(Object o)
Add the object to the bulk buffer attached to the executing thread. |
|
String |
callUpdateHandler(String designDocID,
String function,
String docID)
|
|
String |
callUpdateHandler(String designDocID,
String function,
String docID,
Map<String,String> params)
|
|
String |
callUpdateHandler(UpdateHandlerRequest req)
|
|
|
callUpdateHandler(UpdateHandlerRequest req,
Class<T> c)
|
|
List<DocumentChange> |
changes(ChangesCommand cmd)
Queries the database for changes. |
|
StreamingChangesResult |
changesAsStream(ChangesCommand cmd)
Queries the database for changes. this operation gives you the result as a iterable stream of documentchange objects, the stream should be closed when finished |
|
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(String designDocumentId)
This compacts the view index from the current version of the design document. |
|
boolean |
contains(String id)
Check if the database contains a document. |
|
void |
create(Object o)
Creates the Object as a document in the database. |
|
void |
create(String id,
Object node)
|
|
String |
createAttachment(String docId,
AttachmentInputStream data)
Creates both the document and the attachment |
|
String |
createAttachment(String docId,
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. |
|
String |
delete(Object o)
Deletes the Object in the database. |
|
String |
delete(String id,
String revision)
Deletes the document in the database. |
|
String |
deleteAttachment(String docId,
String revision,
String attachmentId)
|
|
void |
ensureFullCommit()
Commits any recent changes to the specified database to disk. |
|
List<DocumentOperationResult> |
executeAllOrNothing(Collection<?> objects)
Creates, updates or deletes all objects in the supplied collection. |
|
List<DocumentOperationResult> |
executeAllOrNothing(InputStream inputStream)
Creates, updates or deletes all objects in the supplied collection. |
|
List<DocumentOperationResult> |
executeBulk(Collection<?> objects)
Creates, updates or deletes all objects in the supplied collection. |
|
List<DocumentOperationResult> |
executeBulk(InputStream inputStream)
Creates, updates or deletes all objects in the supplied collection. |
|
|
find(Class<T> c,
String id)
Same as get(Class |
|
|
find(Class<T> c,
String id,
Options options)
Same as get(Class |
|
List<DocumentOperationResult> |
flushBulkBuffer()
Sends the bulk buffer attached the the executing thread to the database (through a executeBulk call). |
|
|
get(Class<T> c,
String id)
|
|
|
get(Class<T> c,
String id,
Options options)
|
|
|
get(Class<T> c,
String id,
String rev)
|
|
List<String> |
getAllDocIds()
|
|
InputStream |
getAsStream(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. |
|
InputStream |
getAsStream(String id,
Options options)
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. |
|
InputStream |
getAsStream(String id,
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(String id,
String attachmentId)
Reads an attachment from the database. |
|
AttachmentInputStream |
getAttachment(String id,
String attachmentId,
String revision)
|
|
HttpClient |
getConnection()
Convenience method for accessing the underlying HttpClient. |
|
String |
getDatabaseName()
|
|
DbInfo |
getDbInfo()
Provides meta information about this database. |
|
DesignDocInfo |
getDesignDocInfo(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 |
|
List<Revision> |
getRevisions(String id)
|
|
|
getWithConflicts(Class<T> c,
String id)
Will load the document with any conflicts included. |
|
String |
path()
|
|
PurgeResult |
purge(Map<String,List<String>> revisionsToPurge)
Permanently removes the references to deleted documents from the database. |
|
|
queryForPage(ViewQuery query,
PageRequest pr,
Class<T> type)
Provides paged view results. |
|
InputStream |
queryForStream(ViewQuery query)
|
|
StreamingViewResult |
queryForStreamingView(ViewQuery query)
Please note that the StreamingViewResult need to be closed after usage. |
|
ViewResult |
queryView(ViewQuery query)
|
|
|
queryView(ViewQuery query,
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(String source)
Replicate the content in the source database into this database. |
|
ReplicationStatus |
replicateFrom(String source,
Collection<String> docIds)
Replicate the content in the source database into this database. |
|
ReplicationStatus |
replicateTo(String target)
Replicate the content in this database into the specified target database. |
|
ReplicationStatus |
replicateTo(String target,
Collection<String> docIds)
Replicate the content in this database into the specified target database. |
|
void |
setJsonSerializer(JsonSerializer js)
|
|
void |
setRevisionLimit(int limit)
|
|
void |
update(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(String databaseName, CouchDbInstance dbInstance)
public StdCouchDbConnector(String databaseName, CouchDbInstance dbi, ObjectMapperFactory om)
Method Detail |
---|
public String path()
path
in interface CouchDbConnector
public void create(Object o)
CouchDbConnector
create
in interface CouchDbConnector
public void create(String id, Object node)
create
in interface CouchDbConnector
public boolean contains(String id)
CouchDbConnector
contains
in interface CouchDbConnector
public String createAttachment(String docId, AttachmentInputStream data)
CouchDbConnector
createAttachment
in interface CouchDbConnector
public String createAttachment(String docId, String revision, AttachmentInputStream data)
CouchDbConnector
createAttachment
in interface CouchDbConnector
public AttachmentInputStream getAttachment(String id, String attachmentId)
CouchDbConnector
getAttachment
in interface CouchDbConnector
public AttachmentInputStream getAttachment(String id, String attachmentId, String revision)
getAttachment
in interface CouchDbConnector
public String delete(Object o)
CouchDbConnector
delete
in interface CouchDbConnector
public PurgeResult purge(Map<String,List<String>> revisionsToPurge)
CouchDbConnector
purge
in interface CouchDbConnector
revisionsToPurge
- document IDs & revisions to be purged
public <T> T get(Class<T> c, String id)
get
in interface CouchDbConnector
c
- the target class to map to.id
- the id of the document in the database.
public <T> T get(Class<T> c, String id, Options options)
get
in interface CouchDbConnector
c
- the target class to map to.id
- the id of the document in the database.
public <T> T get(Class<T> c, String id, String rev)
get
in interface CouchDbConnector
c
- the target class to map to.id
- the id of the document in the database.rev
- of the object.
public <T> T getWithConflicts(Class<T> c, String id)
CouchDbConnector
getWithConflicts
in interface CouchDbConnector
c
- the target class to map to.id
- the id of the document in the database.
public <T> T find(Class<T> c, String id)
CouchDbConnector
find
in interface CouchDbConnector
public <T> T find(Class<T> c, String id, Options options)
CouchDbConnector
find
in interface CouchDbConnector
public List<Revision> getRevisions(String id)
getRevisions
in interface CouchDbConnector
public InputStream getAsStream(String id)
CouchDbConnector
getAsStream
in interface CouchDbConnector
public InputStream getAsStream(String id, Options options)
CouchDbConnector
getAsStream
in interface CouchDbConnector
public InputStream getAsStream(String id, String rev)
CouchDbConnector
getAsStream
in interface CouchDbConnector
public void update(Object o)
CouchDbConnector
update
in interface CouchDbConnector
public String delete(String id, String revision)
CouchDbConnector
delete
in interface CouchDbConnector
public List<String> getAllDocIds()
getAllDocIds
in interface CouchDbConnector
public void createDatabaseIfNotExists()
CouchDbConnector
createDatabaseIfNotExists
in interface CouchDbConnector
public String getDatabaseName()
getDatabaseName
in interface CouchDbConnector
public <T> List<T> queryView(ViewQuery query, Class<T> type)
CouchDbConnector
queryView
in interface CouchDbConnector
type
- the type to map the result to
public <T> Page<T> queryForPage(ViewQuery query, PageRequest pr, Class<T> type)
CouchDbConnector
queryForPage
in interface CouchDbConnector
public ViewResult queryView(ViewQuery query)
queryView
in interface CouchDbConnector
public StreamingViewResult queryForStreamingView(ViewQuery query)
CouchDbConnector
queryForStreamingView
in interface CouchDbConnector
public InputStream queryForStream(ViewQuery query)
queryForStream
in interface CouchDbConnector
public String deleteAttachment(String docId, String revision, String attachmentId)
deleteAttachment
in interface CouchDbConnector
public HttpClient getConnection()
CouchDbConnector
getConnection
in interface CouchDbConnector
public DbInfo getDbInfo()
CouchDbConnector
getDbInfo
in interface CouchDbConnector
public DesignDocInfo getDesignDocInfo(String designDocId)
CouchDbConnector
getDesignDocInfo
in interface CouchDbConnector
public void compact()
CouchDbConnector
compact
in interface CouchDbConnector
public void cleanupViews()
CouchDbConnector
cleanupViews
in interface CouchDbConnector
public ReplicationStatus replicateFrom(String source)
CouchDbConnector
replicateFrom
in interface CouchDbConnector
source
- database
public ReplicationStatus replicateFrom(String source, Collection<String> docIds)
CouchDbConnector
replicateFrom
in interface CouchDbConnector
source
- database
public ReplicationStatus replicateTo(String target)
CouchDbConnector
replicateTo
in interface CouchDbConnector
target
- database
public ReplicationStatus replicateTo(String target, Collection<String> docIds)
CouchDbConnector
replicateTo
in interface CouchDbConnector
target
- database
public void compactViews(String designDocumentId)
CouchDbConnector
compactViews
in interface CouchDbConnector
public List<DocumentOperationResult> executeAllOrNothing(InputStream inputStream)
CouchDbConnector
executeAllOrNothing
in interface CouchDbConnector
public List<DocumentOperationResult> executeBulk(InputStream inputStream)
CouchDbConnector
executeBulk
in interface CouchDbConnector
public List<DocumentOperationResult> executeAllOrNothing(Collection<?> objects)
CouchDbConnector
executeAllOrNothing
in interface CouchDbConnector
objects
- , all objects will have their id and revision set.
public List<DocumentOperationResult> executeBulk(Collection<?> objects)
CouchDbConnector
executeBulk
in interface CouchDbConnector
objects
- , all objects will have their id and revision set.
public void addToBulkBuffer(Object o)
CouchDbConnector
addToBulkBuffer
in interface CouchDbConnector
public void clearBulkBuffer()
CouchDbConnector
clearBulkBuffer
in interface CouchDbConnector
public List<DocumentOperationResult> flushBulkBuffer()
CouchDbConnector
flushBulkBuffer
in interface CouchDbConnector
public void setJsonSerializer(JsonSerializer js)
public int getRevisionLimit()
CouchDbConnector
getRevisionLimit
in interface CouchDbConnector
public void setRevisionLimit(int limit)
setRevisionLimit
in interface CouchDbConnector
public List<DocumentChange> changes(ChangesCommand cmd)
CouchDbConnector
changes
in interface CouchDbConnector
public StreamingChangesResult changesAsStream(ChangesCommand cmd)
CouchDbConnector
changesAsStream
in interface CouchDbConnector
public ChangesFeed changesFeed(ChangesCommand cmd)
CouchDbConnector
changesFeed
in interface CouchDbConnector
public String callUpdateHandler(String designDocID, String function, String docID)
callUpdateHandler
in interface CouchDbConnector
public String callUpdateHandler(String designDocID, String function, String docID, Map<String,String> params)
callUpdateHandler
in interface CouchDbConnector
public String callUpdateHandler(UpdateHandlerRequest req)
callUpdateHandler
in interface CouchDbConnector
public <T> T callUpdateHandler(UpdateHandlerRequest req, Class<T> c)
callUpdateHandler
in interface CouchDbConnector
public void ensureFullCommit()
CouchDbConnector
ensureFullCommit
in interface CouchDbConnector
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |