Class MockIngestAuditApi

    • Constructor Detail

      • MockIngestAuditApi

        public MockIngestAuditApi()
    • Method Detail

      • reset

        public static void reset()
      • getCreatedDocuments

        public java.lang.Iterable<java.lang.String> getCreatedDocuments​(java.util.Date start,
                                                                        java.util.Date end)
                                                                 throws AttivioException
        Returns a list of IDs for all documents which were received by the system or created within the system during the specified date range.
        Specified by:
        getCreatedDocuments in interface AuditReaderApi
        Parameters:
        start - the inclusive start date.
        end - the exclusive end date.
        Throws:
        AttivioException - if query cannot be executed
      • getCreatedDocuments

        public java.lang.Iterable<java.lang.String> getCreatedDocuments​(java.util.UUID clientId)
                                                                 throws AttivioException
        Returns a list of IDs for all documents which were received by the system or created within the system by the specified clientId.
        Specified by:
        getCreatedDocuments in interface AuditReaderApi
        Parameters:
        clientId - restricts results to clientId, null not allowed.
        Throws:
        AttivioException - if query cannot be executed
      • getSearchableDocuments

        public java.lang.Iterable<java.lang.String> getSearchableDocuments​(java.lang.String indexName,
                                                                           java.util.Date start,
                                                                           java.util.Date end)
                                                                    throws AttivioException
        Returns an Iterable of IDs for all documents which became searchable during the specified date range. Indexed documents become searchable when an associated commit is received. The component with name <indexName>-content-dispatcher generates ProcessingResultCode.OK result codes for each document it sees document it processes. Once it generates an associated OK result for a Commit message, those documents are searchable.

        A reference algorithm is to find the latest commit (T1) that occurred before the start of the time range and the latest commit (T2) before the end of the time range. Then any documents that reached the indexer in the time range T1-T2 are the ones that became searchable.

        Specified by:
        getSearchableDocuments in interface AuditReaderApi
        Parameters:
        indexName - the name of the index. To look up index related information, the actual Attivio component that interfaces to the index must be determined. The indexName is used to compute this component name. This is done by adding the suffix -content-dispatcher to the indexName. Additionally if indexName does not supply the workflow where the component is located (specified by a name followed by a .), the default name indexer. will be prepended.
        start - the inclusive start date.
        end - the exclusive end date.
        Throws:
        AttivioException - if query cannot be executed
      • getSearchableDocuments

        public java.lang.Iterable<java.lang.String> getSearchableDocuments​(java.lang.String indexName,
                                                                           java.util.UUID clientId)
                                                                    throws AttivioException
        Returns an Iterable of IDs for all documents that are searchable and were fed by the specified client. Indexed documents become searchable when an associated commit is received. The component with name <indexName>-content-dispatcher generates ProcessingResultCode.OK result codes for each document it sees document it processes. Once it generates an associated OK result for a Commit message, those documents are searchable.
        Specified by:
        getSearchableDocuments in interface AuditReaderApi
        Parameters:
        indexName - the name of the index. To look up index related information, the actual Attivio component that interfaces to the index must be determined. The indexName is used to compute this component name. This is done by adding the suffix -content-dispatcher to the indexName. Additionally if indexName does not supply the workflow where the component is located (specified by a name followed by a .), the default name indexer. will be prepended.
        clientId - restricts results to clientId, null not allowed.
        Throws:
        AttivioException - if query cannot be executed
      • getProcessedDocuments

        public java.lang.Iterable<java.lang.String> getProcessedDocuments​(java.util.Date start,
                                                                          java.util.Date end)
                                                                   throws AttivioException
        Returns a list of IDs for all documents which have completed processing during the specified date range. A document is considered complete when all possible side-effects of processing the document have occurred. This state is associated with the receipt of an AuditDetail for the document with a resultCode of ProcessingResultCode.COMPLETED.
        Specified by:
        getProcessedDocuments in interface AuditReaderApi
        Parameters:
        start - the inclusive start date.
        end - the exclusive end date.
        Throws:
        AttivioException - if query cannot be executed
      • getProcessedDocuments

        public java.lang.Iterable<java.lang.String> getProcessedDocuments​(java.util.UUID clientId)
                                                                   throws AttivioException
        Returns a list of IDs for all documents which have completed processing which were sent by the specified client. A document is considered complete when all possible side-effects of processing the document have occurred. This state is associated with the receipt of an AuditDetail for the document with a resultCode of ProcessingResultCode.COMPLETED.
        Specified by:
        getProcessedDocuments in interface AuditReaderApi
        Parameters:
        clientId - restricts results to clientId, null not allowed.
        Throws:
        AttivioException - if query cannot be executed
      • getDocuments

        public java.lang.Iterable<java.lang.String> getDocuments​(java.util.EnumSet<ProcessingResultCode> codeSet,
                                                                 java.util.UUID clientId)
                                                          throws AttivioException
        Returns a list of IDs for all documents for which a resultCode in codeSet was received at some point during content processing. Since there are multiple content processing stages codes may appear multiple times and multiple codes may match. The returned list will be restricted to documents fed by clientId.
        Specified by:
        getDocuments in interface AuditReaderApi
        Parameters:
        codeSet - set of result codes to match
        clientId - restricts results to clientId, null not allowed.
        Returns:
        an Iterable of document IDs. Document IDs appear at most once.
        Throws:
        AttivioException - if query cannot be executed
      • getDocuments

        public java.lang.Iterable<java.lang.String> getDocuments​(java.util.EnumSet<ProcessingResultCode> codeSet,
                                                                 java.util.Date start,
                                                                 java.util.Date end)
                                                          throws AttivioException
        Returns a list of IDs for all documents for which a resultCode in codeSet was received at some point during content processing. Since there are multiple content processing stages codes may appear multiple times and multiple codes may match. The returned list will be restricted to documents fed within the specified time range.
        Specified by:
        getDocuments in interface AuditReaderApi
        Parameters:
        codeSet - set of result codes to match
        start - the inclusive start date.
        end - the exclusive end date.
        Returns:
        an Iterable of document IDs. Document IDs appear at most once.
        Throws:
        AttivioException - if query cannot be executed
      • whenSearchable

        public java.util.Date whenSearchable​(java.lang.String indexName,
                                             java.util.UUID clientId,
                                             java.lang.String docId)
                                      throws AttivioException
        Returns the earliest date an index commit was received after the document was indexed. A document is considered indexed after the receipt of a ProcessingResultCode.OK audit result for the index content dispatcher component ( <indexName>-content-dispatcher). Documents which are not marked OK by the indexer are not considered by this method as they will never become searchable.
        Specified by:
        whenSearchable in interface AuditReaderApi
        Parameters:
        indexName - the name of the index. To look up index related information, the actual Attivio component that interfaces to the index must be determined. The indexName is used to compute this component name. This is done by adding the suffix -content-dispatcher to the indexName. Additionally if indexName does not supply the workflow where the component is located (specified by a name followed by a .), the default name indexer. will be prepended.
        clientId - restricts results to clientId, null not allowed.
        Returns:
        the date when document docId became searchable or null if not yet searchable
        Throws:
        AttivioException - if query cannot be executed
      • whenSearchable

        public java.util.Date whenSearchable​(java.lang.String indexName,
                                             java.util.UUID clientId)
                                      throws AttivioException
        Returns the earliest date an index commit was received after all documents for the client were indexed. A document is considered indexed after the receipt of a ProcessingResultCode.OK audit result for the index content dispatcher component ( <indexName>-content-dispatcher). Documents which are not marked OK by the indexer are not considered by this method as they will never become searchable.
        Specified by:
        whenSearchable in interface AuditReaderApi
        Parameters:
        indexName - the name of the index. To look up index related information, the actual Attivio component that interfaces to the index must be determined. The indexName is used to compute this component name. This is done by adding the suffix -content-dispatcher to the indexName. Additionally if indexName does not supply the workflow where the component is located (specified by a name followed by a .), the default name indexer. will be prepended.
        clientId - restricts results to clientId, null not allowed.
        Returns:
        the date when all documents submitted (so far) by client clientId became searchable or null if all documents are not yet searchable or no documents have been submitted by the client.
        Throws:
        AttivioException - if query cannot be executed
      • waitForCompletion

        public AuditClientSummary waitForCompletion​(java.util.UUID clientId)
                                             throws AttivioException
        Waits until all documents and messages created by this client have completed processing. If this method is called while feeding of new documents or messages occur in a separate thread or process, it may hang indefinitely or return prematurely. The only way to ensure that no processing associated with the client is occurring is to feed and waitForCompletion from the same thread of control.
        Specified by:
        waitForCompletion in interface AuditReaderApi
        Parameters:
        clientId - restricts results to clientId, null not allowed.
        Returns:
        summary information about the client ingestion state or null if the client does not exist.
        Throws:
        AttivioException - if query cannot be executed
      • waitForCompletion

        public AuditClientSummary waitForCompletion​(java.util.UUID clientId,
                                                    long timeout)
                                             throws AttivioException
        Waits until all documents and messages created by this client have completed processing. If this method is called while feeding of new documents or messages occur in a separate thread or process, it may hang indefinitely or return prematurely. The only way to ensure that no processing associated with the client is occurring is to feed and waitForCompletion from the same thread of control.
        Specified by:
        waitForCompletion in interface AuditReaderApi
        Returns:
        the associated AuditClientSummary if waited successfully, null if timeout occurred or client does not exist.
        Throws:
        AttivioException - if query cannot be executed
      • getSummary

        public AuditClientSummary getSummary​(java.util.UUID clientId)
                                      throws AttivioException
        Specified by:
        getSummary in interface AuditReaderApi
        Parameters:
        clientId - restricts results to clientId, null not allowed.
        Returns:
        summary information about the client ingestion state or null if the client does not exist.
        Throws:
        AttivioException - if query cannot be executed
      • audit

        public long audit​(java.util.List<AuditDetail> details)
                   throws AttivioException
        Description copied from interface: AuditWriterApi
        Writes a batch of audit information to the store. After this call completes, the client referenced by the audit record will be active and will be returned by AuditReaderApi.getActiveClients(). Note, that if an exception is encountered while storing the audit information, the rest of the list will still be attempted to be stored. All exceptions encountered while persisting the list are returned with any exception after the first added as suppressed exceptions of the first.
        Specified by:
        audit in interface AuditWriterApi
        Returns:
        the sequence id for the last audit record in the list.
        Throws:
        AttivioException - if the audit information could not be stored
      • getAuditDetails

        public java.lang.Iterable<AuditDetail> getAuditDetails​(java.lang.String docId,
                                                               java.util.UUID clientId)
                                                        throws AttivioException
        Returns an Iterable of AuditDetails associated with the document. This list may include the audit information for a number of components and will include the creation and completion audit records if available. This method may be called while the document is still being processed.
        Specified by:
        getAuditDetails in interface AuditReaderApi
        Parameters:
        docId - the document ID to match
        clientId - restricts results to clientId, null not allowed.
        Throws:
        AttivioException - if query cannot be executed
      • getAuditDetails

        public java.lang.Iterable<AuditDetail> getAuditDetails​(java.lang.String docId,
                                                               java.util.Date start,
                                                               java.util.Date end)
                                                        throws AttivioException
        Returns an Iterable of AuditDetails associated with the document. This list may include the audit information for a number of components and will include the creation and completion audit records if available. This method may be called while the document is still being processed. null values for start and end will return all available audit records for the document.
        Specified by:
        getAuditDetails in interface AuditReaderApi
        Parameters:
        docId - the document ID to match
        start - the inclusive start date.
        end - the exclusive end date.
        Throws:
        AttivioException - if query cannot be executed
      • getLostDetails

        public java.lang.Iterable<AuditDetail> getLostDetails​(long startSeq,
                                                              long endSeq)
                                                       throws AttivioException
        Description copied from interface: AuditReaderApi
        Returns all audit detail events that have been flagged as LOST and have a sequence id >= startSeq and < endSeq.

        NOTE: this method is used internally to replay LOST messages for fault tolerance.

        Specified by:
        getLostDetails in interface AuditReaderApi
        Throws:
        AttivioException
      • purge

        public void purge​(java.util.UUID clientId)
                   throws AttivioException
        Description copied from interface: AuditWriterApi
        Purges all audit data associated with the client ID.
        Specified by:
        purge in interface AuditWriterApi
        Parameters:
        clientId - restricts results to clientId, null not allowed.
        Throws:
        AttivioException
      • purge

        public void purge​(java.util.Date start,
                          java.util.Date end)
                   throws AttivioException
        Description copied from interface: AuditWriterApi
        Purges all audit data within the time range.
        If start and end are both null, deletes all records and summary records. Otherwise, summary records are retained. If deleting individual summary records is required, use AuditWriterApi.purge(UUID) instead
        Specified by:
        purge in interface AuditWriterApi
        Parameters:
        start - the inclusive start date.
        end - the exclusive end date.
        Throws:
        AttivioException
      • purgeInactiveClients

        public int purgeInactiveClients​(long lastInactiveTimeToKeep)
                                 throws AttivioException
        Purges the audit data for all clients that are inactive and went inactive before lastInactiveTimeToKeep
        Specified by:
        purgeInactiveClients in interface AuditWriterApi
        Returns:
        number of clients that were purged
        Throws:
        AttivioException
      • truncateAll

        public void truncateAll()
                         throws AttivioException
        Truncates all data tables containing audit information. This is provided at the system level as an efficient way to get rid of all audit related data.
        Specified by:
        truncateAll in interface AieSystemAuditApi
        Throws:
        AttivioException
      • setLastLossDetectionSequence

        public void setLastLossDetectionSequence​(java.util.UUID clientId,
                                                 long seq)
                                          throws AttivioException
        Updates the last sequence number considered for loss detection for clientId. Used by loss detection to determine which detail records to be considered for the next round of loss detection. Note, that the storage and retrieval mechanism assume that the sequence numbers stored are always increasing. Attempts to set a lower sequence number will result in undefined behavior. If no activity exists for clientId then result is undefined.
        Specified by:
        setLastLossDetectionSequence in interface AieSystemAuditApi
        Throws:
        AttivioException