public class BackgroundPushAPI extends PipedPushAPI implements java.io.Flushable, java.io.Closeable
Modifier and Type | Field and Description |
---|---|
static long |
defaultMaxBytes
Default maximum total size of background documents (estimated)
|
static int |
defaultMaxDocuments
Default maximum number of background documents per operation.
|
protected long |
maxBytes
Maximum document total size to buffer
|
protected int |
maxDocuments
Number of background documents
|
protected BackgroundPushAPI.BackgroundWorker |
worker
Worker thread.
|
defaultLogger, isBestEffortOnStopSession, jlogger, logger, parent
DEFAULT_CHECKPOINT_NAME, STREAMING_BLOCK_SIZE
Constructor and Description |
---|
BackgroundPushAPI(PushAPI parent)
Create a new BackgroundPushAPI
|
BackgroundPushAPI(PushAPI parent,
int maxDocuments)
Create a new BackgroundPushAPI
|
BackgroundPushAPI(PushAPI parent,
int maxDocuments,
long maxBytes)
Create a new BackgroundPushAPI
|
Modifier and Type | Method and Description |
---|---|
void |
addDocument(Document document)
Adds a document.
|
void |
addDocumentList(Document[] documents)
Adds a set of documents.
|
void |
clearAllCheckpoints()
Resets all the checkpoints values.
|
void |
close()
Closes the BackgroundPushAPI object.
|
static PushAPI |
createPushAPIPlugin(PushAPI papi,
java.lang.String[] keys,
java.lang.String[] values)
Create a new BackgroundPushAPI (PushAPI plugin pipe constructor)
|
void |
deleteDocument(java.lang.String uri)
Deletes a document specified by its URI.
|
void |
deleteDocumentList(int[] did,
int[] slices)
Deletes a list of documents specified by their dids and slices.
|
void |
deleteDocumentList(java.lang.String[] uris)
Deletes a list of documents specified by their URIs.
|
void |
deleteDocumentRootPath(java.lang.String rootPath,
boolean recursive,
boolean clearCache)
Deletes a set of documents corresponding to a URI prefix.
|
void |
deleteDocumentsWithPrefix(java.lang.String prefix,
boolean clearCache)
Deletes a set of documents corresponding to a URI prefix.
|
protected void |
finalize()
Finalizer.
|
void |
flush()
Flush (ie.
|
void |
flushAll()
Flush (ie.
|
void |
flushCurrent()
Flush current (ie.
|
protected void |
push(BackgroundPushAPI.BackgroundWorkerItem item)
Push an operation.
|
java.math.BigInteger |
setCheckpoint(java.lang.String value,
java.lang.String name,
boolean sync)
Sets a checkpoint in the push server.
|
void |
startPushSession()
Starts a new session on the push server.
|
void |
startWorker()
Ensure worker thread is started.
|
void |
stopPushSession(boolean releaseConnections)
Stops the current session on the push server.
|
void |
stopWorker()
Ensure worker thread is ended.
|
void |
sync()
Deprecated.
since V6R2015x, replaced by
synchronize() |
java.math.BigInteger |
synchronize()
Forces the synchronization of all pending operations before returning.
|
void |
triggerIndexingJob()
Forces the processing of all pending operations synchronized to disk.
|
void |
triggerIndexingJobWhenIdle()
Wait for indexing to be idle, and forces the processing of all pending
operations synchronized to disk.
|
void |
updateDocument(Document doc,
java.lang.String[] fields)
Partially updates a document.
|
void |
updateDocumentList(Document[] documents,
java.lang.String[][] fieldsList)
Updates a set of documents.
|
void |
updateDocumentMetas(java.lang.String uri,
java.lang.String stamp,
MetaContainer metaContainer)
Updates the stamp and the meta data of a document, using a strict meta to field
mapping.
|
void |
updateDocumentMetasList(java.lang.String[] uriList,
java.lang.String[] stampList,
MetaContainer[] metaContainerList)
Updates a set of the stamp and meta data for given documents.
|
areDocumentsSearchable, areDocumentsSearchable, clearCheckpoints, countSyncedEntries, debug, enumerateCheckpointInfo, enumerateCheckpointInfo, enumerateSyncedEntries, error, getBestEffortOnStopSession, getCheckpoint, getCheckpoint, getConnectorName, getDocumentStatus, getDocumentStatusList, getLogger, getParent, info, isTraceEnabled, log, ping, setBestEffortOnStopSession, setLogger, suggestSyncedEntries, trace, warning
countSyncedEntries, deleteDocumentRootPath, deleteDocumentRootPath, deleteDocumentsWithPrefix, enumerateSyncedEntries, getCheckpoint, getDocumentDidsAndSlices, setCheckpoint, setCheckpoint, setCheckpoint
public static final int defaultMaxDocuments
public static final long defaultMaxBytes
protected final int maxDocuments
protected final long maxBytes
protected final BackgroundPushAPI.BackgroundWorker worker
public BackgroundPushAPI(PushAPI parent)
parent
- the original PAPImaxDocuments
- buffer size in documentpublic BackgroundPushAPI(PushAPI parent, int maxDocuments)
parent
- the original PAPImaxDocuments
- buffer size in document, or @c -1 if unlimitedpublic BackgroundPushAPI(PushAPI parent, int maxDocuments, long maxBytes)
parent
- the original PAPImaxDocuments
- background size in documentmaxBytes
- maximum background total document size in bytespublic static PushAPI createPushAPIPlugin(PushAPI papi, java.lang.String[] keys, java.lang.String[] values) throws java.lang.Exception
papi
- upstream PushAPIkeys
- configuration keys (see below)keys
- configuration values
Configuration keys are:
java.lang.Exception
public void close() throws java.io.IOException
close
in interface java.io.Closeable
close
in interface java.lang.AutoCloseable
java.io.IOException
protected void push(BackgroundPushAPI.BackgroundWorkerItem item) throws PushAPIException
PushAPIException
public void flush() throws java.io.IOException
flush
in interface java.io.Flushable
java.io.IOException
public void flushAll() throws PushAPIException
PushAPIException
public void startWorker()
public void stopWorker()
public void flushCurrent() throws PushAPIException
PushAPIException
protected void finalize() throws java.io.IOException
finalize
in class java.lang.Object
java.io.IOException
public void addDocument(Document document) throws PushAPIException
PushAPI
addDocument
in class PipedPushAPI
document
- Document to be added.PushAPIException
- upon errorpublic void addDocumentList(Document[] documents) throws PushAPIException
PushAPI
addDocumentList
in class PipedPushAPI
documents
- Documents to be added.PushAPIException
- upon error.public void clearAllCheckpoints() throws PushAPIException
PushAPI
clearAllCheckpoints
in class PipedPushAPI
PushAPIException
- upon errorpublic void deleteDocument(java.lang.String uri) throws PushAPIException
PushAPI
deleteDocument
in class PipedPushAPI
uri
- the URI of the document to deletePushAPIException
- upon errorpublic void deleteDocumentList(java.lang.String[] uris) throws PushAPIException
PushAPI
deleteDocumentList
in class PipedPushAPI
uris
- the list of URIs of the documents to deletePushAPIException
- upon errorpublic void deleteDocumentList(int[] did, int[] slices) throws PushAPIException
PushAPI
deleteDocumentList
in class PipedPushAPI
slices
- the list of slices to delete.PushAPIException
public void deleteDocumentRootPath(java.lang.String rootPath, boolean recursive, boolean clearCache) throws PushAPIException
PushAPI
rootPath
prefix will be deleted.deleteDocumentRootPath
in class PipedPushAPI
rootPath
- a URI prefix used to select the documents to be deleted."A"
would select all URIs in the form
"A/xyz"
"A/B"
would select all URIs in the form
"A/B/xyz"
recursive
- The recursive flag indicates if the URI pattern specified in
rootPath should match multiple depth levels in the URI tree. For
example the rootPath "A/B"
will always match "A/B/C"
, but will match "A/B/C/D"
only if recursive
is true
. In CloudView 5.1 recursive is always
true.clearCache
- The clearCache flag indicates if we want to delete documents
from the document cache when they are deleted from the index.PushAPIException
public void deleteDocumentsWithPrefix(java.lang.String prefix, boolean clearCache) throws PushAPIException
PushAPI
prefix
will be deleted.deleteDocumentsWithPrefix
in class PipedPushAPI
prefix
- a URI prefix used to select the documents to be deleted.clearCache
- The clearCache flag indicates if we want to delete documents
from the document cache when they are deleted from the index.PushAPIException
public java.math.BigInteger setCheckpoint(java.lang.String value, java.lang.String name, boolean sync) throws PushAPIException
PushAPI
PushAPI.areDocumentsSearchable(BigInteger)
for more information.setCheckpoint
in class PipedPushAPI
value
- the value of the checkpoint.name
- the name of the checkpoint.sync
- if all the pending operations in the task log should be
synchronized to disk before returning.PushAPIException
- upon errorPushAPI.synchronize()
,
PushAPI.areDocumentsSearchable(BigInteger)
public void startPushSession() throws PushAPIException
PushAPI
stopPushSession
),
if the push server restarts for any reason, an exception will be thrown.
The connector should then engage a recovery procedure.startPushSession
in class PipedPushAPI
PushAPISessionExistsException
- if the session is already started.PushAPIException
- if any another error occurred.public void stopPushSession(boolean releaseConnections) throws PushAPIException
PushAPI
stopPushSession
in class PipedPushAPI
PushAPISessionNotFoundException
- if session is not started.PushAPIException
- if another error occurred.startPushSession}
public void sync() throws PushAPIException
synchronize()
PushAPI
PushAPI.synchronize()
has been introduced and returns a serial.sync
in class PipedPushAPI
PushAPIException
- upon errorpublic java.math.BigInteger synchronize() throws PushAPIException
PushAPI
synchronize
in class PipedPushAPI
PushAPIException
- upon errorpublic void triggerIndexingJob() throws PushAPIException
PushAPI
triggerIndexingJob
in class PipedPushAPI
PushAPIException
- upon errorpublic void triggerIndexingJobWhenIdle() throws PushAPIException
PushAPI
triggerIndexingJobWhenIdle
in class PipedPushAPI
PushAPIException
- upon errorpublic void updateDocument(Document doc, java.lang.String[] fields) throws PushAPIException
PushAPI
updateDocument
in class PipedPushAPI
doc
- a Document object specifying the URI of the document to be
updated. Parts and metas that are not updated with the document
are fetched from the document cache, so the document cache
*must* be enabled, and only documents added after the document cache
has been enabled can be updated. Old values of multivalued metas will be dropped,
if you want to update a multivalued meta you have to put new values and
also the old values you want to keep in the document.fields
- Not used for the moment.PushAPIException
public void updateDocumentList(Document[] documents, java.lang.String[][] fieldsList) throws PushAPIException
PushAPI
updateDocumentList
in class PipedPushAPI
documents
- the list of documents to updatefieldsList
- for each document, the fields to be updatedPushAPIException
- upon errorPushAPI.updateDocument(Document, String[])
public void updateDocumentMetas(java.lang.String uri, java.lang.String stamp, MetaContainer metaContainer) throws PushAPIException
PushAPI
PushAPI.updateDocument(Document, String[])
which
automatically creates the list of index fields from the meta names found in
the meta data container.PushAPI.updateDocument(Document, String[])
, this gives:
MetaContainer cont = new MetaContainer();
cont.addMeta("organization", "myneworg");
papi.updateDocument("mydocument", null, cont);
If the document does not exist yet, an error is returned by the push
server.updateDocumentMetas
in class PipedPushAPI
uri
- the URI of the document to updatestamp
- the new document stampmetaContainer
- the container of meta to be updatedPushAPIException
- upon errorpublic void updateDocumentMetasList(java.lang.String[] uriList, java.lang.String[] stampList, MetaContainer[] metaContainerList) throws PushAPIException
PushAPI
PushAPI.updateDocument(Document, String[])
which
automatically creates the list of index fields from the meta names found in
the meta data container.updateDocumentMetasList
in class PipedPushAPI
uriList
- the URIs of the documents to updatestampList
- the list of new stampsmetaContainerList
- the list of meta data containersPushAPIException
- upon errorPushAPI.updateDocumentMetas(java.lang.String, java.lang.String, com.exalead.papi.helper.MetaContainer)
Copyright © 2021 Dassault Systèmes, All Rights Reserved.