SMILA (incubation) API documentation

org.eclipse.smila.connectivity.deltaindexing
Interface DeltaIndexingManager

All Known Implementing Classes:
DeltaIndexingManagerImpl, DeltaIndexingManagerImpl

public interface DeltaIndexingManager

The Interface DeltaIndexingManager. To start a processing session, call:

  1. init(String)
    to start a new session
  2. for all items in this run call
    1. #checkForUpdate(String, Id, String)
      to test if the given item has changed since the last run
    2. #visit(String, Id, String, boolean)
      to mark this item as visted
  3. #obsoleteIdIterator(String, Id)
    to get all ids that haven been visited this run and #delete(String, Id) them
  4. finish(String)
    to commit all changes from this run and releaase the lock

See Also:
http://wiki.eclipse.org/SMILA/Documentation/DeltaIndexingManager#Configuration, http://wiki.eclipse.org/SMILA/Specifications/DeltaIndexingAndConnectivtyDiscussion09

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, ConnectivityId id, java.lang.String hash)
          checks if the hash of the current id is new or has changed (true) or not (false).
 void clear()
          Clears all entries of the DeltaIndexingManager including any active sessions! Note that this may cause exceptions in clients currently using any of the closed sessions.
 void clear(java.lang.String sessionId)
          Clear all entries for the given sessionId.
 void delete(java.lang.String sessionId, ConnectivityId 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.
 java.util.Iterator<ConnectivityId> obsoleteIdIterator(java.lang.String sessionId, ConnectivityId id)
          Obsolete id iterator for id fragments of compounds.
 java.util.Iterator<ConnectivityId> 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 current 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, ConnectivityId 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,
                       ConnectivityId 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,
           ConnectivityId id,
           java.lang.String hash,
           boolean isCompound)
           throws DeltaIndexingSessionException,
                  DeltaIndexingException
Creates or updates the delta indexing entry. this is THE method to make the record known to DI. It 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<ConnectivityId> 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<ConnectivityId> obsoleteIdIterator(java.lang.String sessionId,
                                                      ConnectivityId id)
                                                      throws DeltaIndexingSessionException,
                                                             DeltaIndexingException
Obsolete id iterator for id fragments of compounds.

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 for the given sessionId. In order to call clear you first have to initialize a session calling init(). This is to avoid clearing of any locked data sources.

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 current 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,
            ConnectivityId 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 any active sessions! Note that this may cause exceptions in clients currently using any of the closed 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. Note that this may cause exceptions in a client currently using the closed 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. Note that this may cause exceptions in clients currently using any of the closed 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