|
IBM WebSphereTM eXtreme Scale, Release 8.6 API Specification |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface MapIndexPlugin
An index implementation must implement this interface to get modifications to the
Map so it can maintain the index as transactions are committed. Only attributes
that implement the Comparable
interface are eligible to be indexed.
A MapIndexPlugin
implementation that also implements the BackingMapLifecycleListener
interface will be automatically added as an EventListener
on the BackingMap
when the
index set on the backing map.
A MapIndexPlugin
may also implement the BackingMapPlugin
interface in order
to receive enhanced BackingMap plug-in lifecycle method calls. The plug-in is then
also required to correctly implement each of the bean methods related to
introspection of its state (for example isInitialized()
,
isDestroyed()
, etc).
BackingMap.addMapEventListener(EventListener)
,
BackingMap.addMapIndexPlugin(MapIndexPlugin)
,
BackingMap.createDynamicIndex(MapIndexPlugin, DynamicIndexCallback)
,
MapIndex
,
MapRangeIndex
Field Summary | |
---|---|
static String |
SYSTEM_KEY_INDEX_NAME
A built-in index of the the local ObjectGrid instance that allows iterating over all of the keys in a map. |
Method Summary | |
---|---|
void |
doBatchUpdate(TxID txid,
LogSequence sequence)
Called by ObjectGrid runtime to allow the index to be updated as the result of changes applied to a map during the commit cycle of a transaction. |
Object |
getAttribute(Object value)
Extracts the attribute from a specified value Object. |
String |
getAttributeName()
Gets the name of the indexed attribute. |
Object |
getIndexProxy(MapIndexInfo map)
Gets an index proxy object for performing index lookup operations. |
String |
getName()
Gets the name of the index. |
Properties |
getProperties()
Extract properties from a MapIndexPlugin instance. |
boolean |
isRangeIndex()
Indicates if this index is the type of MapRangeIndex interface. |
void |
setAttributeName(String attributeName)
Sets the name of the attribute to be indexed. |
void |
setEntityMetadata(EntityMetadata entityMetadata)
Called by the ObjectGrid runtime to set the EntityMetadata of the BackingMap. |
void |
setProperties(Properties properties)
Set properties of a MapIndexPlugin instance. |
void |
undoBatchUpdate(TxID txid,
LogSequence sequence)
Called by the ObjectGrid runtime to undo any changes made to the index as a result of a prior call to the doBatchUpdate(TxID, LogSequence)
method. |
Field Detail |
---|
static final String SYSTEM_KEY_INDEX_NAME
This index does not support client/server indexes. Invoking this index on a client will allow iterating over the keys in the client cache (if enabled) and will not iterate over all keys in the grid.
Method Detail |
---|
void setProperties(Properties properties)
properties
- The Properties object that can be used to initialize a MapIndexPlugin instance.getProperties()
Properties getProperties()
setProperties(Properties)
void setEntityMetadata(EntityMetadata entityMetadata)
The EntityMetadata is required for supporting Tuple indexing.
entityMetadata
- the EntityMetadata of the BackingMap.boolean isRangeIndex()
MapRangeIndex
Object getAttribute(Object value)
value
- The value Object.
String getAttributeName()
void setAttributeName(String attributeName)
If the object has an attribute called employeeName or EmployeeName, the
index will call the "getEmployeeName" method. The attribute name must be
the same as that in the get method and the attribute must implement the
Comparable
interface. If the attribute type is boolean,
the "isAttributeName" method pattern is supported too.
attributeName
- the name of the attribute to set.String getName()
ObjectMap.getIndex(String)
Object getIndexProxy(MapIndexInfo map)
The caller must cast the object returned to either a MapIndex
or
MapRangeIndex
to perform the lookup operations.
map
- the MapIndexInfo object required for maintaining the index.
.
MapIndex
,
MapRangeIndex
,
ObjectMap.getIndex(String)
void doBatchUpdate(TxID txid, LogSequence sequence) throws ObjectGridRuntimeException
Use the LogElement.getType()
method to determine what
operation is required for updating the index. Use the
LogElement.getBeforeImage()
method to get the value object
that existed prior to the committing transaction applying a change to the
map. Use the LogElement.getAfterImage()
method to get the
value object after the committing transaction applied the change to the
map entry.
For a MapIndexPlugin in an ObjectMap
that is configured to use OutputFormat.RAW
for the keys or values, the keys and values objects in the LogSequence
will be SerializedKey
or SerializedValue
objects respectively. If required, you
can use the SerializedEntry.getObject()
method to retrieve (possibly inflating
the serialized object) the original key or value object.
To override the map's output format configuration, use the PluginOutputFormat
annotation in the implementation class.
Note, the undoBatchUpdate(TxID, LogSequence)
method may be
called later to undo these changes if an exception occurs that causes
the committing transaction to be rolled back instead.
txid
- the transaction context (TxID) for the changes.sequence
- the log sequence that contains the changes from transaction.
ObjectGridRuntimeException
- is a failure occurs that requires transaction
to be rolled back.undoBatchUpdate(TxID, LogSequence)
,
LogElement.getType()
,
LogElement.getBeforeImage()
,
LogElement.getAfterImage()
,
LogSequence
,
TxID
void undoBatchUpdate(TxID txid, LogSequence sequence) throws ObjectGridException
doBatchUpdate(TxID, LogSequence)
method.
This method is called when an exception or error condition that requires
all changes made by a transaction to be rolled back. For this reason,
the implementation of this method should catch all Throwables and
continue with the next LogElement
in the
LogSequence
until all LogElement
s are processed
so that as many changes to the index are undone as possible. An
ObjectGridException should only be thrown after processing the entire
LogSequence
and this method was unable to successfully undo
one or more changes in the LogSequence
.
Use the LogElement.getUndoType()
method to determine what
operation is required to undo any change made to the index. Use the
LogElement.getBeforeImage()
to get the value object that
existed prior to the committing transaction applying a change to the map.
Use the LogElement.getAfterImage()
to get the value
object after the committing transaction applied the change to the map entry.
For a MapIndexPlugin in an ObjectMap
that is configured to use OutputFormat.RAW
for the keys or values, the keys and values objects in the LogSequence
will be SerializedKey
or SerializedValue
objects respectively. If required, you
can use the SerializedEntry.getObject()
method to retrieve (possibly inflating
the serialized object) the original key or value object.
To override the map's output format configuration, use the PluginOutputFormat
annotation in the implementation class.
txid
- the transaction context (TxID) for the changes.sequence
- the log sequence that contains changes from transaction.
ObjectGridException
- is an error occurred during processingLogElement.getUndoType()
,
LogElement.getBeforeImage()
,
LogElement.getAfterImage()
,
LogSequence
,
TxID
|
IBM WebSphereTM eXtreme Scale, Release 8.6 API Specification |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |