IBM WebSphereTM eXtreme Scale, Release 8.6
API Specification

com.ibm.websphere.objectgrid.plugins.index
Interface MapIndex

All Known Subinterfaces:
MapRangeIndex

public interface MapIndex

This interface is an abstract index that can be created on a Map. The index can be used to perform efficient look ups and possibly other operations such as relational operations on an attribute in a Map. The MapIndex is provided with all update events and maintains an index that can be used to issue simple queries against the index later. The index could use an index defined callback to make an index on composite attributes.

Since:
WAS XD 6.0.1
See Also:
ObjectMap.getIndex(String)

Nested Class Summary
static class MapIndex.SpecialValue
          This class represents directives for finding types of values in an index.
 
Field Summary
static MapIndex.SpecialValue EMPTY_VALUE
          A SpecialValue constant that indicates a particular attribute value should be excluded from an index query.
 
Method Summary
 Iterator findAll()
          Returns the keys of the entire map.
 Iterator findAll(Object attributeValue)
          Returns the keys for the entries that have the specified attribute value.
 

Field Detail

EMPTY_VALUE

static final MapIndex.SpecialValue EMPTY_VALUE
A SpecialValue constant that indicates a particular attribute value should be excluded from an index query.

Since:
7.0
Method Detail

findAll

Iterator findAll(Object attributeValue)
                 throws FinderException
Returns the keys for the entries that have the specified attribute value.

For maps that are configured to have ObjectMap.getKeyOutputFormat() set to OutputFormat.RAW, the keys returned will be SerializedKey objects. If required, you can use the SerializedEntry.getObject() method to retrieve (possibly inflating the serialized object) the original key or value object. If the index is a composite index (having more than one attribute), the attributeValue parameter must be the type of Object[] of the same size as the number of attributes defined in the index. Each attribute value element in the Object array is corresponding to the list of attribute names defined for the composite index. Use constant value EMPTY_VALUE to indicate a particular attribute value to be excluded from value evaluation during index searching.

For example, if there is a composite index that has attributes defined: state,city,zip.

To find all keys that match a specific state, city and zip:
Iterator result = idx.findAll(new Object[]{"MN", "Rochester", "55901"});

To find all keys that match only the state:
Iterator result = idx.findAll(new Object[]{"MN", MapIndex.EMPTY_VALUE, MapIndex.EMPTY_VALUE});

Parameters:
attributeValue - a reference to the attribute value to search for. In composite index case, this must be the type of Object[].
Returns:
the list of the keys for the entries with an attribute equal to the specified attribute value.
Throws:
FinderException - if an exception or retry limit is reached when concurrent transactions updating the index prevent findAll from completing.
IllegalArgumentException - For a composite index, the IllegalArgumentException will be thrown in each of the following conditions: If the attributeValue is null or is not of type Object[], and also if the attributeValue is of type Object[] but has length unequal to the length of the configured attribute names.

findAll

Iterator findAll()
                 throws FinderException
Returns the keys of the entire map. Be cautious when executing this method from an ObjectGrid client process. It will have significant impact on network traffic and memory footprint in client process because all keys will be fetched from ObjectGrid servers into client process. For maps that are configured to have ObjectMap.getKeyOutputFormat() set to OutputFormat.RAW, the keys returned will be SerializedKey objects. If required, you can use the SerializedEntry.getObject() method to retrieve (possibly inflating the serialized object) the original key or value object.

Returns:
the list of the keys for all entries in the map.
Throws:
FinderException - if an exception or retry limit is reached when concurrent transactions updating the index prevent findAll from completing.
Since:
WAS XD 6.1

IBM WebSphereTM eXtreme Scale, Release 8.6
API Specification

© Copyright International Business Machines Corp 2005,2012. All rights reserved.