public class MockUnclusteredIngestionHistory extends Object implements IngestionHistoryApi, Closeable
Modifier and Type | Class and Description |
---|---|
protected class |
MockUnclusteredIngestionHistory.Data |
Constructor and Description |
---|
MockUnclusteredIngestionHistory() |
Modifier and Type | Method and Description |
---|---|
void |
childCreated(String namespace,
String key,
String childKey)
Marks the
childKey as one created by the record associated with key . |
void |
clear(String namespace)
Removes all historical information associated with the
namespace . |
void |
close() |
protected List<String> |
getAllChildData(String namespace) |
protected List<String> |
getAllDocumentData(String namespace) |
Iterable<String> |
getChildren(String namespace,
String key)
Returns an Iterable of the children that were marked as created via the
IngestionHistoryApi.childCreated(String, String, String) method. |
Date |
getPreviousStartTime(String namespace)
Returns the start time for the last session for this
namespace . |
byte[] |
getSignature(String namespace,
String key)
Returns the last signature associated with the key or
null if no signature is present. |
Date |
getStartTime(String namespace)
Returns the start time of the current session for this
namespace . |
Iterable<String> |
getUnvisited(String namespace)
Returns an
Iterable of the keys that have not been visited in the current session. |
Iterable<String> |
getUnvisited(String namespace,
Date since)
Returns an
Iterable of the keys that have not been visited since the time since . |
void |
removeDocumentByKey(String namespace,
String key)
Removes a document using the key
|
Date |
startSession(String namespace)
Starts a new session for the namespace.
|
protected void |
updateDocumentWithDate(String namespace,
String key,
byte[] signature,
Date useDate) |
protected void |
updateDocumentWithDate(String namespace,
String key,
Date useDate) |
void |
visit(String namespace,
String key,
byte[] signature)
Records the
key as having been visited updates its associated signature. |
public Date startSession(String namespace) throws AttivioException
IngestionHistoryApi
IngestionHistoryApi.getStartTime(String)
will return the new session start time.startSession
in interface IngestionHistoryApi
namespace
- a namespace to use (e.g., connector or source name)AttivioException
public Date getStartTime(String namespace) throws AttivioException
IngestionHistoryApi
namespace
. The return value is the same as the value returned
by the last IngestionHistoryApi.startSession(String)
call for this namespace
. If no session has ever been started, returns
null
.getStartTime
in interface IngestionHistoryApi
namespace
- a namespace to use (e.g., connector or source name)AttivioException
public Date getPreviousStartTime(String namespace) throws AttivioException
IngestionHistoryApi
namespace
. If no previous session exists, returns null
.getPreviousStartTime
in interface IngestionHistoryApi
namespace
- a namespace to use (e.g., connector or source name)AttivioException
public void visit(String namespace, String key, byte[] signature) throws AttivioException
IngestionHistoryApi
key
as having been visited updates its associated signature. The signature is commonly used to detect
whether an object has changed since the last ingestion (by storing a checksum or message digest of the content). The visit
time is also recorded.visit
in interface IngestionHistoryApi
namespace
- a namespace to use (e.g., connector or source name)key
- a record key or document ID.signature
- an arbitrary value indicating a signature to associate with the key, may be null
.AttivioException
public byte[] getSignature(String namespace, String key) throws AttivioException
IngestionHistoryApi
null
if no signature is present.getSignature
in interface IngestionHistoryApi
namespace
- a namespace to use (e.g., connector or source name)key
- a record key or document ID.AttivioException
public Iterable<String> getUnvisited(String namespace) throws AttivioException
IngestionHistoryApi
Iterable
of the keys that have not been visited in the current session. The unvisited keys are those for
which there has been a IngestionHistoryApi.visit(String, String, byte[])
call at some point, but not one since the last
IngestionHistoryApi.startSession(String)
call. This allows a connector to record visits each time it runs and get a list of documents
that are not present on subsequent runs. Since these documents have been removed from the source system, the connector may
decide to remove them from the Attivio system.
A call to remove()
on the returned iterator will remove the visit and signature information from the history for the
associated key. All child associations (see IngestionHistoryApi.childCreated(String, String, String)
of removed keys are also removed.
getUnvisited
in interface IngestionHistoryApi
namespace
- a namespace to use (e.g., connector or source name)AttivioException
public Iterable<String> getUnvisited(String namespace, Date since) throws AttivioException
IngestionHistoryApi
Returns an Iterable
of the keys that have not been visited since the time since
. The unvisited keys are those
for which there has been a IngestionHistoryApi.visit(String, String, byte[])
call at some point, but not one since the time
since
. This allows a connector to record visits each time it runs and get a list of documents that are not present on
subsequent runs. Since these documents have been removed from the source system, the connector may decide to remove them from
the Attivio system.
A call to remove()
on the returned iterator will remove the visit and signature information from the history for the
associated key. All child associations (see IngestionHistoryApi.childCreated(String, String, String)
of removed keys are also removed.
getUnvisited
in interface IngestionHistoryApi
namespace
- a namespace to use (e.g., connector or source name)since
- the mininum visit date to consider a record as visited.AttivioException
public void childCreated(String namespace, String key, String childKey) throws AttivioException
IngestionHistoryApi
childKey
as one created by the record associated with key
. All children associated with key
are returned by the Iterable returned by a subsequent call to IngestionHistoryApi.getChildren(String, String)
.
The expectation is that the child document has not previously been created. If the signature of the
parent document id has changed remove the children documents and add the ones found in the new version
of the parent document. Adding a child that already existed will have undefined consequences.
This does not support children of children, only supports parent document and it's children. Children of children will have undefined consequences.
childCreated
in interface IngestionHistoryApi
namespace
- a namespace to use (e.g., connector or source name)key
- a record key or document ID.childKey
- a record key or document ID.AttivioException
public Iterable<String> getChildren(String namespace, String key) throws AttivioException
IngestionHistoryApi
IngestionHistoryApi.childCreated(String, String, String)
method.
When using the returned Iterable and removing children then the expectation is that all the children are removed.getChildren
in interface IngestionHistoryApi
namespace
- a namespace to use (e.g., connector or source name)key
- a record key or document ID.key
AttivioException
public void clear(String namespace) throws AttivioException
IngestionHistoryApi
namespace
.clear
in interface IngestionHistoryApi
namespace
- a namespace to use (e.g., connector or source name)AttivioException
public void removeDocumentByKey(String namespace, String key) throws AttivioException
IngestionHistoryApi
removeDocumentByKey
in interface IngestionHistoryApi
namespace
- a namespace to use (e.g., connector or source name)key
- a record key or document ID.AttivioException
public void close() throws IOException
close
in interface Closeable
close
in interface AutoCloseable
IOException
protected void updateDocumentWithDate(String namespace, String key, Date useDate) throws AttivioException
AttivioException
protected List<String> getAllChildData(String namespace) throws AttivioException
AttivioException
protected List<String> getAllDocumentData(String namespace) throws AttivioException
AttivioException
protected void updateDocumentWithDate(String namespace, String key, byte[] signature, Date useDate) throws AttivioException
AttivioException
Copyright © 2018 Attivio, Inc. All Rights Reserved.
PATENT NOTICE: Attivio, Inc. Software Related Patents. With respect to the Attivio software product(s) being used, the following patents apply: Querying Joined Data Within A Search Engine Index: United States Patent No.(s): 8,073,840. Ordered Processing of Groups of Messages: U.S. Patent No.(s) 8,495,656. Signal processing approach to sentiment analysis for entities in documents: U.S. Patent No.(s) 8,725,494. Other U.S. and International Patents Pending.