SMILA 1.0 API documentation

org.eclipse.smila.importing.state.objectstore
Class ObjectStoreStateService

java.lang.Object
  extended by org.eclipse.smila.importing.state.objectstore.ObjectStoreStateService

public class ObjectStoreStateService
extends java.lang.Object

ObjectStore based implementation of a state service used in the jobmanager based importing framework.

Author:
scum36

Field Summary
protected static java.lang.String KEY
          key for the entry.
protected static java.lang.String KEY_COMPOUNDID
          key for the compoundId entry in the data object.
protected static java.lang.String KEY_DESCRIPTOR
          key for the descriptor entry in the data object.
protected static java.lang.String KEY_JOBRUNID
          key for the job run ID entry in the data object.
protected static java.lang.String KEY_OBJECTID
          key for the objectId entry in the data object.
protected static java.lang.String KEY_SOURCEID
          key for the sourceId entry in the data object.
protected static java.lang.String ROOT_ENTRIES
          root directory in ObjectStore for delta entries.
 
Constructor Summary
ObjectStoreStateService(java.lang.String storeName, StateStoreConfiguration configuration, ObjectStoreService objectStore)
          creates a new instance of the service.
 
Method Summary
 void clearAll()
          clears all stores.
 void clearSource(java.lang.String sourceId)
          clears a source.
 long countEntries(java.lang.String sourceId, boolean countExact)
          count the entries of the given source.
 void deleteEntry(java.lang.String sourceId, DeltaService.EntryId entryId)
          remove an entry.
 AnyMap getEntry(java.lang.String sourceId, java.lang.String objectId, java.lang.String compoundId)
          retrieves the information for an entry.
 java.util.Collection<java.lang.String> getShardPrefixes(java.lang.String sourceId)
          get object-id prefixes of all shards to use as input for getUnvisitedObjectIds(String, String).
 java.util.Collection<java.lang.String> getSourceIds()
           
 java.util.Collection<DeltaService.EntryId> getUnvisitedObjectIds(java.lang.String sourceAndShardPrefix, java.lang.String jobRunId)
          get all object IDs from a shard that have not been visited in the given job run.
 void mark(java.lang.String sourceId, java.lang.String objectId, java.lang.String compoundId, java.lang.String jobRunId, java.lang.String descriptor)
          marks an entry.
 void markCompoundElementsVisited(java.lang.String sourceId, java.lang.String compoundRecordId, java.lang.String jobRunId)
          update the job run id of all entries that belong to the given compound.
protected  void writeEntry(AnyMap value)
          update the entry in the objectstore.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

KEY

protected static final java.lang.String KEY
key for the entry.

See Also:
Constant Field Values

KEY_OBJECTID

protected static final java.lang.String KEY_OBJECTID
key for the objectId entry in the data object.

See Also:
Constant Field Values

KEY_COMPOUNDID

protected static final java.lang.String KEY_COMPOUNDID
key for the compoundId entry in the data object.

See Also:
Constant Field Values

KEY_SOURCEID

protected static final java.lang.String KEY_SOURCEID
key for the sourceId entry in the data object.

See Also:
Constant Field Values

KEY_DESCRIPTOR

protected static final java.lang.String KEY_DESCRIPTOR
key for the descriptor entry in the data object.

See Also:
Constant Field Values

KEY_JOBRUNID

protected static final java.lang.String KEY_JOBRUNID
key for the job run ID entry in the data object.

See Also:
Constant Field Values

ROOT_ENTRIES

protected static final java.lang.String ROOT_ENTRIES
root directory in ObjectStore for delta entries.

See Also:
Constant Field Values
Constructor Detail

ObjectStoreStateService

public ObjectStoreStateService(java.lang.String storeName,
                               StateStoreConfiguration configuration,
                               ObjectStoreService objectStore)
creates a new instance of the service.

Method Detail

getEntry

public AnyMap getEntry(java.lang.String sourceId,
                       java.lang.String objectId,
                       java.lang.String compoundId)
                throws StateException
retrieves the information for an entry.

Throws:
StateException

mark

public void mark(java.lang.String sourceId,
                 java.lang.String objectId,
                 java.lang.String compoundId,
                 java.lang.String jobRunId,
                 java.lang.String descriptor)
          throws StateException
marks an entry.

Throws:
StateException

clearSource

public void clearSource(java.lang.String sourceId)
                 throws StateException
clears a source.

Throws:
StateException

clearAll

public void clearAll()
              throws StateException
clears all stores.

Throws:
StateException

getSourceIds

public java.util.Collection<java.lang.String> getSourceIds()
                                                    throws StateException
Returns:
all source ids. Throws StateNotFoundException if store doesn't exist yet.
Throws:
StateException

countEntries

public long countEntries(java.lang.String sourceId,
                         boolean countExact)
                  throws StateException
count the entries of the given source. Throws StateNotFoundException if store or source do not exist yet.

Throws:
StateException

getShardPrefixes

public java.util.Collection<java.lang.String> getShardPrefixes(java.lang.String sourceId)
                                                        throws StateException
get object-id prefixes of all shards to use as input for getUnvisitedObjectIds(String, String).

Throws:
StateException

getUnvisitedObjectIds

public java.util.Collection<DeltaService.EntryId> getUnvisitedObjectIds(java.lang.String sourceAndShardPrefix,
                                                                        java.lang.String jobRunId)
                                                                 throws StateException
get all object IDs from a shard that have not been visited in the given job run.

Throws:
StateException

markCompoundElementsVisited

public void markCompoundElementsVisited(java.lang.String sourceId,
                                        java.lang.String compoundRecordId,
                                        java.lang.String jobRunId)
                                 throws StateException
update the job run id of all entries that belong to the given compound.

Throws:
StateException

deleteEntry

public void deleteEntry(java.lang.String sourceId,
                        DeltaService.EntryId entryId)
                 throws StateException
remove an entry.

Throws:
StateException

writeEntry

protected void writeEntry(AnyMap value)
                   throws StateException
update the entry in the objectstore.

Throws:
StateException

SMILA 1.0 API documentation