SMILA (incubation) API documentation

org.eclipse.smila.connectivity.deltaindexing
Interface DeltaIndexingManager

All Known Implementing Classes:
DeltaIndexingManagerImpl, DeltaIndexingManagerImpl

public interface DeltaIndexingManager

The Interface DeltaIndexingManager.


Nested Class Summary
static class DeltaIndexingManager.LockState
          An enumeration defining the lock states a data source in the DeltaIndexingManager.
 
Method Summary
 boolean checkForUpdate(java.lang.String sessionId, Id id, java.lang.String hash)
          checks if the hash of the current id is new or has changed (true) or not (false). // to reduce method calls mark entry as visited on return value false
 void clear()
          Clears all entries of the DeltaIndexingManager including sessions.
 void clear(java.lang.String sessionId)
          Clear all entries if the given sessionId.
 void delete(java.lang.String sessionId, Id id)
          Delete.
 boolean exists(java.lang.String dataSourceId)
          Checks if the entries for the given dataSourceId exist.
 void finish(java.lang.String sessionId)
          Finish this delta indexing session and remove the lock.
 long getEntryCount(java.lang.String dataSourceID)
          Get the number of delta indexing entries for the given dataSourceID.
 java.util.Map<java.lang.String,java.lang.Long> getEntryCounts()
          Get the number of delta indexing entries for all data sources.
 java.util.Map<java.lang.String,DeltaIndexingManager.LockState> getLockStates()
          Get an overview what data sources are locked or unlocked.
 java.lang.String init(java.lang.String dataSourceID)
          Initializes the internal state for an import of a dataSourceID and creates a session wherein it establishes a lock to avoid that the same. dataSourceID is initialized multiple times concurrently.
 java.util.Iterator<Id> obsoleteIdIterator(java.lang.String sessionId, Id id)
          Obsolete id iterator for id fragments.
 java.util.Iterator<Id> obsoleteIdIterator(java.lang.String sessionId, java.lang.String dataSourceID)
          Obsolete id iterator.
 void rollback(java.lang.String sessionId)
          rolls back changes that were made in the curreent session between init() and finish(), it should be called before finishing process.
 void unlockDatasource(java.lang.String dataSourceID)
          Unlock the given data source and removes the sessions.
 void unlockDatasources()
          Unlock all data sources and removes all sessions.
 void visit(java.lang.String sessionId, Id id, java.lang.String hash, boolean isCompound)
          Creates or updates the delta indexing entry.
 

Method Detail

init

java.lang.String init(java.lang.String dataSourceID)
                      throws DeltaIndexingException
Initializes the internal state for an import of a dataSourceID and creates a session wherein it establishes a lock to avoid that the same. dataSourceID is initialized multiple times concurrently. It returns a unique Id for the session that a client has to use to gain access to the locked data source.

Parameters:
dataSourceID - dataSourceID
Returns:
a String containing the sessionId
Throws:
DeltaIndexingException - the delta indexing exception

checkForUpdate

boolean checkForUpdate(java.lang.String sessionId,
                       Id id,
                       java.lang.String hash)
                       throws DeltaIndexingSessionException,
                              DeltaIndexingException
checks if the hash of the current id is new or has changed (true) or not (false). // to reduce method calls mark entry as visited on return value false

Parameters:
sessionId - the id of the delta indexing session
id - the id
hash - the hash
Returns:
true, if check for update
Throws:
DeltaIndexingSessionException - if the sessionId is invalid
DeltaIndexingException - the delta indexing exception

visit

void visit(java.lang.String sessionId,
           Id id,
           java.lang.String hash,
           boolean isCompound)
           throws DeltaIndexingSessionException,
                  DeltaIndexingException
Creates or updates the delta indexing entry. Sets the hash, the isCompound flag and marks this id as visited.

Parameters:
sessionId - the id of the delta indexing session
id - the id
hash - the hash
isCompound - boolean flag if the record identified by id is a compound record (true) or not (false)
Throws:
DeltaIndexingSessionException - if the sessionId is invalid
DeltaIndexingException - the delta indexing exception

obsoleteIdIterator

java.util.Iterator<Id> obsoleteIdIterator(java.lang.String sessionId,
                                          java.lang.String dataSourceID)
                                          throws DeltaIndexingSessionException,
                                                 DeltaIndexingException
Obsolete id iterator.

Parameters:
sessionId - the id of the delta indexing session
dataSourceID - the data source id
Returns:
the iterator< id>
Throws:
DeltaIndexingSessionException - if the sessionId is invalid
DeltaIndexingException - the delta indexing exception

obsoleteIdIterator

java.util.Iterator<Id> obsoleteIdIterator(java.lang.String sessionId,
                                          Id id)
                                          throws DeltaIndexingSessionException,
                                                 DeltaIndexingException
Obsolete id iterator for id fragments.

Parameters:
sessionId - the id of the delta indexing session
id - the id
Returns:
the iterator< id>
Throws:
DeltaIndexingSessionException - if the sessionId is invalid
DeltaIndexingException - the delta indexing exception

clear

void clear(java.lang.String sessionId)
           throws DeltaIndexingSessionException,
                  DeltaIndexingException
Clear all entries if the given sessionId.

Parameters:
sessionId - the id of the delta indexing session
Throws:
DeltaIndexingSessionException - if the sessionId is invalid
DeltaIndexingException - the delta indexing exception

rollback

void rollback(java.lang.String sessionId)
              throws DeltaIndexingSessionException,
                     DeltaIndexingException
rolls back changes that were made in the curreent session between init() and finish(), it should be called before finishing process.

Parameters:
sessionId - the id of the delta indexing session
Throws:
DeltaIndexingSessionException - if the sessionId is invalid
DeltaIndexingException - the delta indexing exception

delete

void delete(java.lang.String sessionId,
            Id id)
            throws DeltaIndexingSessionException,
                   DeltaIndexingException
Delete.

Parameters:
sessionId - the id of the delta indexing session
id - the id
Throws:
DeltaIndexingSessionException - if the sessionId is invalid
DeltaIndexingException - the delta indexing exception

finish

void finish(java.lang.String sessionId)
            throws DeltaIndexingSessionException,
                   DeltaIndexingException
Finish this delta indexing session and remove the lock.

Parameters:
sessionId - the id of the delta indexing session
Throws:
DeltaIndexingSessionException - if the sessionId is invalid
DeltaIndexingException - the delta indexing exception

clear

void clear()
           throws DeltaIndexingException
Clears all entries of the DeltaIndexingManager including sessions.

Throws:
DeltaIndexingException - the delta indexing exception

unlockDatasource

void unlockDatasource(java.lang.String dataSourceID)
                      throws DeltaIndexingException
Unlock the given data source and removes the sessions.

Parameters:
dataSourceID - the data source id
Throws:
DeltaIndexingException - the delta indexing exception

unlockDatasources

void unlockDatasources()
                       throws DeltaIndexingException
Unlock all data sources and removes all sessions.

Throws:
DeltaIndexingException - the delta indexing exception

getLockStates

java.util.Map<java.lang.String,DeltaIndexingManager.LockState> getLockStates()
Get an overview what data sources are locked or unlocked.

Returns:
a map containing the dataSoureId and the LockState

exists

boolean exists(java.lang.String dataSourceId)
Checks if the entries for the given dataSourceId exist.

Parameters:
dataSourceId - the data source id
Returns:
true, if successful

getEntryCount

long getEntryCount(java.lang.String dataSourceID)
Get the number of delta indexing entries for the given dataSourceID.

Parameters:
dataSourceID - the data source id
Returns:
the number of entries

getEntryCounts

java.util.Map<java.lang.String,java.lang.Long> getEntryCounts()
Get the number of delta indexing entries for all data sources.

Returns:
a map of dataSoureIds and the entry counts

SMILA (incubation) API documentation