public class MarkLogicRepository extends DBSRepositoryBase
Repository.| Modifier and Type | Class and Description |
|---|---|
protected static class |
MarkLogicRepository.MarkLogicBlobFinder |
DBSRepositoryBase.BlobFinder, DBSRepositoryBase.DBSSessionInvoker, DBSRepositoryBase.IdType, DBSRepositoryBase.TransactionContext| Modifier and Type | Field and Description |
|---|---|
protected List<String> |
binaryPaths |
protected CursorService<com.marklogic.xcc.ResultSequence,com.marklogic.xcc.ResultItem,String> |
cursorService |
static String |
DB_DEFAULT |
protected static Collector<CharSequence,?,String> |
PATH_COLLECTOR |
protected static String |
PATH_COLLECTOR_BEGIN |
protected static String |
PATH_COLLECTOR_END |
protected static String |
PATH_COLLECTOR_SEP |
protected List<MarkLogicRangeElementIndexDescriptor> |
rangeElementIndexes |
protected long |
sequenceLastValue
Last value used from the in-memory sequence.
|
protected com.marklogic.xcc.ContentSource |
xccContentSource |
blobManager, changeTokenEnabled, cm, DEBUG_UUIDS, fulltextConfiguration, idType, lockManager, repositoryName, selfRegisteredLockManager, transactionContexts, TYPE_ROOT| Constructor and Description |
|---|
MarkLogicRepository(javax.resource.spi.ConnectionManager cm,
MarkLogicRepositoryDescriptor descriptor) |
| Modifier and Type | Method and Description |
|---|---|
void |
clearLockManagerCaches()
Clears any cache held by the lock manager.
|
void |
closeLockManager()
Closes the lock manager and releases resources.
|
void |
createState(State state)
Creates a document.
|
void |
createStates(List<State> states)
Creates documents.
|
void |
deleteStates(Set<String> ids)
Deletes a set of document.
|
protected Stream<State> |
findAll(String ctsQuery,
String... selects) |
String |
generateNewId()
Generates a new id for a document.
|
List<DBSRepositoryBase.IdType> |
getAllowedIdTypes()
Gets the allowed id types for this DBS repository.
|
Stream<State> |
getDescendants(String rootId,
Set<String> keys)
Returns a stream of descendants from a given root document, in no particular order.
|
Stream<State> |
getDescendants(String rootId,
Set<String> keys,
int limit)
Returns a stream of descendants from a given root document, in no particular order.
|
Lock |
getLock(String id)
Gets the lock on a document.
|
protected Long |
getNextSequenceId() |
protected String |
getProjectedQuery(String query,
Collection<String> keys) |
boolean |
hasChild(String parentId,
String name,
Set<String> ignored)
Checks if a document has a child with the given name
|
protected void |
initBlobsPaths() |
protected void |
initRepository() |
void |
markReferencedBinaries()
Marks the binaries in use by passing them to the binary manager(s)'s GC mark() method.
|
protected void |
markReferencedBinaries(State state,
DocumentBlobManager blobManager) |
protected void |
markReferencedBinary(Object value,
DocumentBlobManager blobManager) |
static com.marklogic.xcc.ContentSource |
newMarkLogicContentSource(MarkLogicRepositoryDescriptor descriptor) |
protected static com.marklogic.xcc.SecurityOptions |
newTrustOptions() |
PartialList<Map<String,Serializable>> |
queryAndFetch(DBSExpressionEvaluator evaluator,
OrderByClause orderByClause,
boolean distinctDocuments,
int limit,
int offset,
int countUpTo)
Queries the repository for documents matching a NXQL query, and returns a projection of the documents.
|
List<State> |
queryKeyValue(String key,
Object value,
Set<String> ignored)
Queries the repository for documents having key = value.
|
List<State> |
queryKeyValue(String key1,
Object value1,
String key2,
Object value2,
Set<String> ignored)
Queries the repository for documents having key1 = value1 and key2 = value2.
|
boolean |
queryKeyValuePresence(String key,
String value,
Set<String> ignored)
Queries the repository to check if there are documents having key = value.
|
State |
readChildState(String parentId,
String name,
Set<String> ignored)
Reads the state of a child document.
|
State |
readPartialState(String id,
Collection<String> keys)
Reads the partial state of a document.
|
State |
readState(String id)
Reads the state of a document.
|
List<State> |
readStates(List<String> ids)
Reads the states of several documents.
|
Lock |
removeLock(String id,
String owner)
Removes the lock from a document.
|
ScrollResult<String> |
scroll(DBSExpressionEvaluator evaluator,
int batchSize,
int keepAliveInSecond)
Executes the given query and returns the first batch of results containing id of documents, next batch must be
requested within the
keepAliveSeconds delay. |
ScrollResult<String> |
scroll(String scrollId)
Get the next batch of results containing id of documents, the
scrollId is part of the previous
ScrollResult response. |
Lock |
setLock(String id,
Lock lock)
Sets a lock on a document.
|
void |
shutdown() |
void |
updateState(String id,
State.StateDiff diff,
DBSTransactionState.ChangeTokenUpdater changeTokenUpdater)
Updates a document.
|
getActiveSessionsCount, getBlobManager, getFulltextConfiguration, getLockManager, getLockManagerName, getName, getRootId, getSession, getSession, initLockManager, initRoot, isChangeTokenEnabled, isFulltextDisabled, newSessionclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitbegin, commit, rollbackcanLockBeRemovedpublic static final String DB_DEFAULT
protected com.marklogic.xcc.ContentSource xccContentSource
protected long sequenceLastValue
protected final List<MarkLogicRangeElementIndexDescriptor> rangeElementIndexes
protected final CursorService<com.marklogic.xcc.ResultSequence,com.marklogic.xcc.ResultItem,String> cursorService
protected List<String> binaryPaths
protected static final String PATH_COLLECTOR_BEGIN
protected static final String PATH_COLLECTOR_END
protected static final String PATH_COLLECTOR_SEP
protected static final Collector<CharSequence,?,String> PATH_COLLECTOR
public MarkLogicRepository(javax.resource.spi.ConnectionManager cm, MarkLogicRepositoryDescriptor descriptor)
public List<DBSRepositoryBase.IdType> getAllowedIdTypes()
DBSRepositoryBasegetAllowedIdTypes in class DBSRepositoryBasepublic static com.marklogic.xcc.ContentSource newMarkLogicContentSource(MarkLogicRepositoryDescriptor descriptor)
protected static com.marklogic.xcc.SecurityOptions newTrustOptions()
protected void initRepository()
public String generateNewId()
DBSRepositoryprotected Long getNextSequenceId()
public void shutdown()
shutdown in interface Repositoryshutdown in class DBSRepositoryBasepublic State readState(String id)
DBSRepositoryid - the document idnull if not foundpublic State readPartialState(String id, Collection<String> keys)
DBSRepositoryid - the document idkeys - the keys to readnull if not foundpublic List<State> readStates(List<String> ids)
DBSRepositoryThe returned states may be in a different order than the ids.
ids - the document idsnull if not foundpublic void createState(State state)
DBSRepositorystate - the document statepublic void createStates(List<State> states)
DBSRepositorystates - the document statespublic void updateState(String id, State.StateDiff diff, DBSTransactionState.ChangeTokenUpdater changeTokenUpdater)
DBSRepositoryid - the document iddiff - the diff to applychangeTokenUpdater - how to get and update the change token (may be null)public void deleteStates(Set<String> ids)
DBSRepositoryids - the document idspublic State readChildState(String parentId, String name, Set<String> ignored)
DBSRepositoryparentId - the parent document idname - the name of the childignored - a set of document ids that should not be considerednull if not foundpublic boolean hasChild(String parentId, String name, Set<String> ignored)
DBSRepositoryparentId - the parent document idname - the name of the childignored - a set of document ids that should not be consideredtrue if the child exists, false if notpublic List<State> queryKeyValue(String key, Object value, Set<String> ignored)
DBSRepositorykey - the keyvalue - the valueignored - a set of document ids that should not be consideredpublic List<State> queryKeyValue(String key1, Object value1, String key2, Object value2, Set<String> ignored)
DBSRepositorykey1 - the first keyvalue1 - the first valuekey2 - the second keyvalue2 - the second valueignored - a set of document ids that should not be consideredpublic Stream<State> getDescendants(String rootId, Set<String> keys)
DBSRepositoryTHE STREAM MUST BE CLOSED WHEN DONE to release resources.
rootId - the root document idkeys - what to collect about the descendants in addition to their idsStates; THE STREAM MUST BE CLOSED WHEN DONEpublic Stream<State> getDescendants(String rootId, Set<String> keys, int limit)
DBSRepositoryTHE STREAM MUST BE CLOSED WHEN DONE to release resources.
rootId - the root document idkeys - what to collect about the descendants in addition to their idslimit - the maximum number of descendants to returnStates; THE STREAM MUST BE CLOSED WHEN DONEpublic boolean queryKeyValuePresence(String key, String value, Set<String> ignored)
DBSRepositorykey - the keyvalue - the valueignored - a set of document ids that should not be consideredtrue if the query matches at least one document, false if the query matches nothingpublic PartialList<Map<String,Serializable>> queryAndFetch(DBSExpressionEvaluator evaluator, OrderByClause orderByClause, boolean distinctDocuments, int limit, int offset, int countUpTo)
DBSRepositoryevaluator - the map-based evaluator for the queryorderByClause - an ORDER BY clausedistinctDocuments - true if the projection should return a maximum of one row per documentlimit - the limit on the number of documents to returnoffset - the offset in the list of documents to returncountUpTo - if -1, count the total size without offset/limit.0, don't count the total size, set it to -1 .n, count the total number if there are less than n documents otherwise set the total size
to -2.public ScrollResult<String> scroll(DBSExpressionEvaluator evaluator, int batchSize, int keepAliveInSecond)
DBSRepositorykeepAliveSeconds delay.public ScrollResult<String> scroll(String scrollId)
DBSRepositoryscrollId is part of the previous
ScrollResult response.public Lock getLock(String id)
LockManager
If the document does not exist, null is returned.
id - the document idnull when there is no lockpublic Lock setLock(String id, Lock lock)
LockManager
If the document is already locked, returns its existing lock status (there is no re-locking, LockManager.removeLock(java.lang.String, java.lang.String)
must be called first).
id - the document idlock - the lock to setnull if locking succeeded, or the existing lock if locking failedpublic Lock removeLock(String id, String owner)
LockManagerThe previous lock is returned.
If owner is null then the lock is unconditionally removed.
If owner is not null, it must match the existing lock owner for the lock to be removed. If it
doesn't match, the returned lock will return true for Lock.getFailed().
id - the document idnull), with a failed flag if locking failedpublic void closeLockManager()
LockManagerpublic void clearLockManagerCaches()
LockManagerprotected void initBlobsPaths()
initBlobsPaths in class DBSRepositoryBasepublic void markReferencedBinaries()
Repositoryprotected void markReferencedBinaries(State state, DocumentBlobManager blobManager)
protected void markReferencedBinary(Object value, DocumentBlobManager blobManager)
protected String getProjectedQuery(String query, Collection<String> keys)
Copyright © 2018 Nuxeo. All rights reserved.