Package com.attivio.sdk.connector
Class MockPublisher
- java.lang.Object
-
- com.attivio.client.ContentFeeder
-
- com.attivio.sdk.connector.MockPublisher
-
- All Implemented Interfaces:
DocumentOutputClient,IndexCommitter,IngestClient,DocumentPublisher,SecurityFeeder,java.io.Closeable,java.lang.AutoCloseable
public class MockPublisher extends ContentFeeder implements DocumentPublisher, IndexCommitter
A ContentFeeder based mock publisher. We had to extend ContentFeeder to support maxDocs and setStopped
-
-
Field Summary
-
Fields inherited from class com.attivio.client.ContentFeeder
DEFAULT_BATCH_SIZE_COUNT, DEFAULT_BATCH_SIZE_MB, DEFAULT_WORKFLOW, log, ORIGINAL_CLIENT_ID
-
-
Constructor Summary
Constructors Constructor Description MockPublisher()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidbulkUpdate(BulkUpdate message)Sendmessageto AIE.voiddelete(java.lang.String... docId)Delete a series of documents from AIE by document id.voiddelete(java.lang.String queryWorkflow, Query query)Delete all documents that match a query.voiddeletePrincipal(AttivioPrincipalKey key)Deletes a principal from the index.voidfeed(IngestDocument... docs)Senddocsto AIE.voidfeed(IngestDocument doc, AttivioAcl acl)Sendsdocto the document receiver with the given ACL.voidfeed(AttivioPrincipal principal)Ingests an AttivioPrincipal.java.util.List<PlatformMessage>getSentMessages()booleanisInTestMode()Test mode is set by the user to quickly test that scanner can connect and fetch data.booleanisStopped()voidput(IngestDocument doc, java.lang.String fieldName, java.lang.String id, java.io.InputStream is)Store the content stream in the content store an put aContentPointerin the indicated document field.voidsetMaxDocs(long maxDocs)voidsetStopped(boolean stopped)-
Methods inherited from class com.attivio.client.ContentFeeder
addStaticField, batchDocument, clientHeartbeat, close, commit, delete, deleteByQuery, deleteByQuery, determineMessageSize, dispatchDocumentsInQueue, endMessageGroup, feed, getAuditReader, getClientId, getCommitInterval, getContentStore, getContentStoreCnt, getContentStoreThresholdKB, getDocSize, getDocumentBatchSize, getDocumentsFed, getDocumentsQueued, getDocumentsSent, getIngestWorkflowName, getInMemCnt, getMaxBatchSizeMB, getMessageDefaultDomain, getOptimizeInterval, getSeverity, getSizeToDomain, getStaticFields, getWaitForCompletionTimeout, initializeServiceFactory, isCompleted, isMessageGroupInProgress, isOrderedCommits, makeInactive, optimize, put, put, put, put, refresh, sendIndexMessage, sendMessageInternal, sendQueuedDocuments, setCommitInterval, setContentStoreThresholdKB, setDefaultMessageDomain, setDocumentBatchSize, setIngestWorkflowName, setMaxBatchSizeMB, setOptimizeInterval, setOrderedCommits, setSizeToDomain, setStaticFields, setWaitForCompletionTimeout, startMessageGroup, toString, waitForCompletion, waitForCompletion, waitForCompletion, waitForCompletion
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface com.attivio.sdk.connector.DocumentPublisher
getClientId, waitForCompletion
-
Methods inherited from interface com.attivio.sdk.client.IndexCommitter
commit
-
-
-
-
Method Detail
-
isStopped
public boolean isStopped()
- Specified by:
isStoppedin interfaceDocumentPublisher- Returns:
- true if the scan has been stopped by user intervention.
-
delete
public void delete(java.lang.String queryWorkflow, Query query) throws AttivioExceptionDescription copied from interface:DocumentPublisherDelete all documents that match a query.- Specified by:
deletein interfaceDocumentPublisher- Parameters:
queryWorkflow- to use for query processingquery- the query that identifies documents to delete- Throws:
AttivioException
-
bulkUpdate
public void bulkUpdate(BulkUpdate message) throws AttivioException
Description copied from class:ContentFeederSendmessageto AIE.- Specified by:
bulkUpdatein interfaceDocumentOutputClient- Specified by:
bulkUpdatein interfaceDocumentPublisher- Overrides:
bulkUpdatein classContentFeeder- Parameters:
message- the bulk update message- Throws:
AttivioException
-
delete
public void delete(java.lang.String... docId) throws AttivioExceptionDescription copied from class:ContentFeederDelete a series of documents from AIE by document id.If batching is enabled, then these delete messages will be batched along with any fed documents. If these deletes are meant to apply to uncommitted documents previously fed with this ContentFeeder, then those documents must be committed to the index before this delete is called. When ordered commits is enabled, this entails calling:
contentFeeder.commit(); contentFeeder.waitForCompletion(); contentFeeder.delete("id1",...);When ordered commits is disabled, it entails calling:contentFeeder.waitForCompletion(); contentFeeder.commit(); contentFeeder.waitForCompletion(); contentFeeder.delete("id1",...);- Specified by:
deletein interfaceDocumentOutputClient- Specified by:
deletein interfaceDocumentPublisher- Overrides:
deletein classContentFeeder- Parameters:
docId- The document IDs of the documents to delete.- Throws:
AttivioException- if sending of deletes fails.
-
feed
public void feed(IngestDocument... docs) throws AttivioException
Description copied from class:ContentFeederSenddocsto AIE.- Specified by:
feedin interfaceDocumentOutputClient- Specified by:
feedin interfaceDocumentPublisher- Overrides:
feedin classContentFeeder- Parameters:
docs- the documents to send.- Throws:
AttivioException- The publisher will throw anAttivioExceptionwith an error code ofConnectorError.CRAWL_STOPPEDif the scanner was stopped by the administrator or the limit on the number of documents was reached - seeAttivioException.getErrorCode(). Exceptions with other error code indicate an error.
-
deletePrincipal
public void deletePrincipal(AttivioPrincipalKey key) throws AttivioException
Description copied from class:ContentFeederDeletes a principal from the index.- Specified by:
deletePrincipalin interfaceIngestClient- Specified by:
deletePrincipalin interfaceSecurityFeeder- Overrides:
deletePrincipalin classContentFeeder- Parameters:
key- unique ID of the principal- Throws:
AttivioException- if sending of documents fails.
-
feed
public void feed(IngestDocument doc, AttivioAcl acl) throws AttivioException
Description copied from class:ContentFeederSendsdocto the document receiver with the given ACL.- Specified by:
feedin interfaceIngestClient- Specified by:
feedin interfaceSecurityFeeder- Overrides:
feedin classContentFeeder- Parameters:
doc- the documentacl- the ACL- Throws:
AttivioException- if sending of documents fails.
-
feed
public void feed(AttivioPrincipal principal) throws AttivioException
Description copied from class:ContentFeederIngests an AttivioPrincipal. Any existing data for the principal and its associations will be deleted.- Specified by:
feedin interfaceIngestClient- Specified by:
feedin interfaceSecurityFeeder- Overrides:
feedin classContentFeeder- Parameters:
principal- the principal- Throws:
AttivioException- if sending of documents fails.
-
put
public void put(IngestDocument doc, java.lang.String fieldName, java.lang.String id, java.io.InputStream is) throws AttivioException
Description copied from interface:DocumentPublisherStore the content stream in the content store an put aContentPointerin the indicated document field.- Specified by:
putin interfaceDocumentPublisher- Parameters:
doc- the Attivio document where theContentPointershould be placed.fieldName- to put theContentPointerin.id- An id to identify the content in the content store. Could be any id that will guarantee uniqueness e.g.UUID.randomUUID().is- the stream of content.- Throws:
AttivioException
-
isInTestMode
public boolean isInTestMode()
Description copied from interface:DocumentPublisherTest mode is set by the user to quickly test that scanner can connect and fetch data. It is typically used by the scanner to avoid changing the state of incremental scanning when in test mode.- Specified by:
isInTestModein interfaceDocumentPublisher- Returns:
trueif running in test mode;falseif not running in test mode
-
setStopped
public void setStopped(boolean stopped)
-
setMaxDocs
public void setMaxDocs(long maxDocs)
-
getSentMessages
public java.util.List<PlatformMessage> getSentMessages() throws AttivioException
- Throws:
AttivioException
-
-