SMILA (incubation) API documentation

org.eclipse.smila.connectivity.deltaindexing2
Interface IDeltaIndexingSession


public interface IDeltaIndexingSession

The Interface IDeltaIndexingSession.

Author:
tmenzel

Method Summary
 boolean checkAndTouch(ConnectivityId id, java.lang.String hash, boolean isCompound)
          this is a combination of #hasChanged(Id, String) and #touch(Id, String, boolean) in one step.
 void clear()
          Clear all entries of the given sessionId.
 void commit()
          Finish this delta indexing session and remove the lock.
 void delete(ConnectivityId id)
          Delete.
 long deleteUntouchedIds()
          Delete untouched ids.
 boolean hasChanged(ConnectivityId id, java.lang.String hash)
          checks if the hash of the current id is new or has changed (true) or not (false).
 void rollback()
          rolls back changes that were made in the curreent session between init() and finish(), it should be called before finishing process.
 void touch(ConnectivityId id, java.lang.String hash, boolean isCompound)
          Creates or updates the delta indexing entry.
 

Method Detail

clear

void clear()
           throws DeltaIndexingSessionException,
                  DeltaIndexingException
Clear all entries of the given sessionId.

Throws:
DeltaIndexingSessionException - if the sessionId is invalid
DeltaIndexingException - the delta indexing exception

commit

void commit()
            throws DeltaIndexingSessionException,
                   DeltaIndexingException
Finish this delta indexing session and remove the lock.

Throws:
DeltaIndexingSessionException - if the sessionId is invalid
DeltaIndexingException - the delta indexing exception

delete

void delete(ConnectivityId id)
            throws DeltaIndexingSessionException,
                   DeltaIndexingException
Delete.

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

deleteUntouchedIds

long deleteUntouchedIds()
                        throws DeltaIndexingSessionException,
                               DeltaIndexingException
Delete untouched ids. rather than calling #delete(Id) by the controller when iterating thru the ids, the implementation may do so internally for all untouched ids in one go more efficiently.

Returns:
the number of deleted ids
Throws:
DeltaIndexingSessionException - the delta indexing session exception
DeltaIndexingException - the delta indexing exception

hasChanged

boolean hasChanged(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:
id - the id
hash - the hash
Returns:
true, if checks for changed
Throws:
DeltaIndexingSessionException - the delta indexing session exception
DeltaIndexingException - the delta indexing exception

rollback

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

Throws:
DeltaIndexingSessionException - if the sessionId is invalid
DeltaIndexingException - the delta indexing exception

touch

void touch(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:
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

checkAndTouch

boolean checkAndTouch(ConnectivityId id,
                      java.lang.String hash,
                      boolean isCompound)
                      throws DeltaIndexingSessionException,
                             DeltaIndexingException
this is a combination of #hasChanged(Id, String) and #touch(Id, String, boolean) in one step.

It has a perf. gain over calling the methods seperatly but has the drawback, that the record is always touched independently of an exception that occurs before putting the record into the Q. on the other hand, this matters not much as the subsequent processing may also cause errors which arent reflected in the "touch" state.

Parameters:
id - the id
hash - the hash
isCompound - the is compound
Returns:
true, if successful
Throws:
DeltaIndexingSessionException - the delta indexing session exception
DeltaIndexingException - the delta indexing exception

SMILA (incubation) API documentation