public class HttpPushAPI extends PushAPI
Modifier and Type | Class and Description |
---|---|
class |
HttpPushAPI.HttpIterableCheckpointInfo |
class |
HttpPushAPI.HttpIterableSyncedEntries |
static class |
HttpPushAPI.TaskStatus |
Modifier and Type | Field and Description |
---|---|
protected java.lang.String |
connectorName_ |
static java.lang.String |
HTTPPAPI_VERSION |
static java.lang.String |
HTTPPAPI_VERSION_KEY |
protected static int |
METHOD_GET |
protected static int |
METHOD_POST |
DEFAULT_CHECKPOINT_NAME, STREAMING_BLOCK_SIZE
Constructor and Description |
---|
HttpPushAPI(java.lang.String host,
java.lang.String port,
java.lang.String connectorName,
java.lang.String connectorType,
java.lang.String login,
java.lang.String password) |
HttpPushAPI(java.lang.String host,
java.lang.String port,
java.lang.String urlPrefix,
java.lang.String connectorName,
java.lang.String connectorType,
java.lang.String login,
java.lang.String password) |
Modifier and Type | Method and Description |
---|---|
void |
addDocument(Document document)
Adds a document.
|
void |
addDocumentList(Document[] documents)
Adds a set of documents.
|
boolean |
areDocumentsSearchable(java.math.BigInteger serial)
Checks whether documents sent prior a given setCheckpoint operation
are searchable.
|
boolean |
areDocumentsSearchable(java.math.BigInteger serial,
boolean onAllReplicas,
boolean ignoreDetachedReplicas)
Checks whether documents sent prior a given setCheckpoint operation
are searchable.
|
protected void |
checkHTTPPAPIVersion(java.lang.String serverVersion) |
void |
clearAllCheckpoints()
Resets all the checkpoints values.
|
void |
commit() |
long |
countSyncedEntries(java.lang.String rootPath,
EnumerationMode mode)
This method is not supported (a call will throw an
UnsupportedOperationException)
|
protected int |
createPartialFlushTask() |
void |
deleteDocument(java.lang.String uri)
Deletes a document specified by its URI.
|
void |
deleteDocumentList(int[] dids,
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.
|
java.lang.Iterable<CheckpointInfo> |
enumerateCheckpointInfo()
Enumerates all the checkpoints known by the system (synchronized).
|
java.lang.Iterable<CheckpointInfo> |
enumerateCheckpointInfo(boolean showSynchronizedOnly)
Enumerates all the checkpoints.
|
java.lang.Iterable<SyncedEntry> |
enumerateSyncedEntries(java.lang.String rootPath,
EnumerationMode mode)
Enumerates synchronized entries.
|
java.lang.String |
getCheckpoint(java.lang.String name)
Gets the value of a named checkpoint in the indexing process.
|
CheckpointInfo |
getCheckpoint(java.lang.String name,
boolean showSynchronizedOnly)
Gets the checkpoint detailed information.
|
java.lang.String |
getConnectorName()
Gets the name of the connector associated to this push client.
|
DocumentStatus |
getDocumentStatus(java.lang.String uri)
Gets document status.
|
DocumentStatus[] |
getDocumentStatusList(java.lang.String[] uri)
Gets the status of a given list of documents in the push server.
|
protected HttpPushAPI.TaskStatus |
getTaskStatus(int taskId) |
void |
ping()
Tests the connection with the server.
|
protected com.exalead.papi.helper.http.V2.HTTPCommandResult |
process(int method,
java.lang.String command,
com.exalead.papi.helper.http.V2.HTTPCommandParameterContainer container) |
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 |
stopPushSession(boolean releaseConnections)
Stops the current session on the push server.
|
java.lang.String[] |
suggestSyncedEntries(java.lang.String rootPath,
int limit)
Suggest synchronized entries.
|
void |
sync()
Deprecated.
since V6R2015x, replaced by
synchronize() |
java.math.BigInteger |
synchronize()
Forces the synchronization of all pending operations before returning.
|
protected Document |
transformDocumentUpdate(Document document,
java.lang.String[] fields) |
void |
triggerIndexingJob()
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[] documentUpdates) |
void |
updateDocumentList(Document[] docList,
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.
|
clearCheckpoints, countSyncedEntries, deleteDocumentRootPath, deleteDocumentRootPath, deleteDocumentsWithPrefix, deleteDocumentsWithPrefix, enumerateSyncedEntries, getCheckpoint, getDocumentDidsAndSlices, setCheckpoint, setCheckpoint, setCheckpoint, triggerIndexingJobWhenIdle
protected static final int METHOD_GET
protected static final int METHOD_POST
public static final java.lang.String HTTPPAPI_VERSION_KEY
public static final java.lang.String HTTPPAPI_VERSION
protected java.lang.String connectorName_
public HttpPushAPI(java.lang.String host, java.lang.String port, java.lang.String urlPrefix, java.lang.String connectorName, java.lang.String connectorType, java.lang.String login, java.lang.String password)
public HttpPushAPI(java.lang.String host, java.lang.String port, java.lang.String connectorName, java.lang.String connectorType, java.lang.String login, java.lang.String password)
protected void checkHTTPPAPIVersion(java.lang.String serverVersion)
protected com.exalead.papi.helper.http.V2.HTTPCommandResult process(int method, java.lang.String command, com.exalead.papi.helper.http.V2.HTTPCommandParameterContainer container) throws PushAPIException
PushAPIException
public void addDocument(Document document) throws PushAPIException
PushAPI
addDocument
in class PushAPI
document
- Document to be added.PushAPIException
- upon errorpublic void addDocumentList(Document[] documents) throws PushAPIException
PushAPI
addDocumentList
in class PushAPI
documents
- Documents to be added.PushAPIException
- upon error.public void clearAllCheckpoints() throws PushAPIException
PushAPI
clearAllCheckpoints
in class PushAPI
PushAPIException
- upon errorpublic long countSyncedEntries(java.lang.String rootPath, EnumerationMode mode) throws PushAPIException
countSyncedEntries
in class PushAPI
rootPath
- mode
- PushAPIException
public void deleteDocument(java.lang.String uri) throws PushAPIException
PushAPI
deleteDocument
in class PushAPI
uri
- the URI of the document to deletePushAPIException
- upon errorpublic void deleteDocumentList(java.lang.String[] uris) throws PushAPIException
PushAPI
deleteDocumentList
in class PushAPI
uris
- the list of URIs of the documents to deletePushAPIException
- upon errorpublic void deleteDocumentList(int[] dids, int[] slices) throws PushAPIException
PushAPI
deleteDocumentList
in class PushAPI
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 PushAPI
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 java.lang.Iterable<CheckpointInfo> enumerateCheckpointInfo() throws PushAPIException
PushAPI
enumerateCheckpointInfo
in class PushAPI
PushAPIException
- upon errorPushAPI.setCheckpoint(String, String, boolean)
,
PushAPI.synchronize()
public java.lang.Iterable<CheckpointInfo> enumerateCheckpointInfo(boolean showSynchronizedOnly)
PushAPI
enumerateCheckpointInfo
in class PushAPI
showSynchronizedOnly
- if true, then returns synchronized (i.e safe) checkpoints,
otherwise returns the unsynchronized checkpoints (in memory only)
when more recent than the synchronized ones.PushAPI.setCheckpoint(String, String, boolean)
,
PushAPI.synchronize()
public java.lang.Iterable<SyncedEntry> enumerateSyncedEntries(java.lang.String rootPath, EnumerationMode mode) throws PushAPIException
PushAPI
enumerateSyncedEntries
in class PushAPI
rootPath
- A part of the URI used to select a subset of the corpus. Empty
string can be used to delete the whole collection.mode
- This implementation supports only
EnumerationMode.RECURSIVE_DOCUMENTSPushAPIException
#sync()}
public java.lang.String getCheckpoint(java.lang.String name) throws PushAPIException
PushAPI
getCheckpoint
in class PushAPI
name
- the name of the checkpointPushAPIException
- upon errorPushAPI.setCheckpoint(String, String, boolean)
public CheckpointInfo getCheckpoint(java.lang.String name, boolean showSynchronizedOnly) throws PushAPIException
PushAPI
getCheckpoint
in class PushAPI
name
- the name of the checkpoint to retrieve.showSynchronizedOnly
- if true, then returns the last synchronized (i.e safe) checkpoint,
otherwise returns the unsynchronized checkpoint (in memory only)
when more recent than the last synchronized one.CheckpointInfo.value
is empty, then it means the checkpoint is not defined.PushAPIException
PushAPI.setCheckpoint(String, String, boolean)
public DocumentStatus getDocumentStatus(java.lang.String uri) throws PushAPIException
PushAPI
areDocumentsSearchable
method.getDocumentStatus
in class PushAPI
uri
- the URI to be looked up.getDocumentStatus
method always returns a non-null
DocumentStatus
object. To check if
the document actually exists in the index, please use the
DocumentStatus.isExist()
method.PushAPIException
DocumentStatus
public DocumentStatus[] getDocumentStatusList(java.lang.String[] uri) throws PushAPIException
PushAPI
getDocumentStatusList
in class PushAPI
uri
- the URIs of the documents for which the status should be retrieved.PushAPIException
- upon errorpublic void ping() throws PushAPIException
PushAPI
ping
in class PushAPI
PushAPIException
- upon error (invalid connector name or IO error)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 PushAPI
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 java.lang.String[] suggestSyncedEntries(java.lang.String rootPath, int limit) throws PushAPIException
PushAPI
suggestSyncedEntries
in class PushAPI
rootPath
- URI prefix used to select a subset of the corpus. Empty string can
be used to enumerate the whole collection. The character '/' is used
to build a hierarchical view of your corpus.limit
- maximum number of suggestions.PushAPIException
- upon error#sync()}
public void updateDocumentList(Document[] documentUpdates) throws PushAPIException
PushAPIException
protected Document transformDocumentUpdate(Document document, java.lang.String[] fields) throws PushAPIException
PushAPIException
public void updateDocument(Document doc, java.lang.String[] fields) throws PushAPIException
PushAPI
updateDocument
in class PushAPI
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[] docList, java.lang.String[][] fieldsList) throws PushAPIException
PushAPI
updateDocumentList
in class PushAPI
docList
- 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 PushAPI
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 PushAPI
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)
public boolean areDocumentsSearchable(java.math.BigInteger serial) throws PushAPIException
PushAPI
areDocumentsSearchable
in class PushAPI
serial
- the serial returned by a setCheckpoint operationPushAPIException
- upon errorpublic boolean areDocumentsSearchable(java.math.BigInteger serial, boolean onAllReplicas, boolean ignoreDetachedReplicas) throws PushAPIException
PushAPI
areDocumentsSearchable
in class PushAPI
serial
- the serial returned by a setCheckpoint operationonAllReplicas
- true if the serial must be available on all replicas, false otherwiseignoreDetachedReplicas
- true if detached replicas should not be taken into account, false otherwisePushAPIException
- upon errorprotected int createPartialFlushTask() throws PushAPIException
PushAPIException
protected HttpPushAPI.TaskStatus getTaskStatus(int taskId) throws PushAPIException
PushAPIException
public void commit() throws PushAPIException
PushAPIException
public void triggerIndexingJob() throws PushAPIException
PushAPI
triggerIndexingJob
in class PushAPI
PushAPIException
- upon errorpublic void sync() throws PushAPIException
synchronize()
PushAPI
PushAPI.synchronize()
has been introduced and returns a serial.sync
in class PushAPI
PushAPIException
- upon errorpublic java.math.BigInteger synchronize() throws PushAPIException
PushAPI
synchronize
in class PushAPI
PushAPIException
- upon errorpublic java.lang.String getConnectorName()
PushAPI
getConnectorName
in class PushAPI
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 PushAPI
PushAPISessionExistsException
- if the session is already started.PushAPIException
- if any another error occurred.public void stopPushSession(boolean releaseConnections) throws PushAPIException
PushAPI
stopPushSession
in class PushAPI
PushAPISessionNotFoundException
- if session is not started.PushAPIException
- if another error occurred.startPushSession}
Copyright © 2021 Dassault Systèmes, All Rights Reserved.