[Java programming language only]

Configuring the InverseRangeIndex plug-in

[Version 8.6 and later] You can configure the built-in InverseRangeIndex, the com.ibm.websphere.objectgrid.plugins.index.InverseRangeIndex class, with an XML file or programmatically.

Before you begin

About this task

The InverseRangeIndex plug-in is designed to support lookups with a specific search key in range style data. Range style data contain attributes with boundary values. Consider the following sample table, which includes both non-range and range style data. The table Product Data contains non-range attributes, including ProductName, Condition, and Country. These attributes are part of the index key. The table also includes range style attributes, including StartPromotionDate, EndPromotionDate, MinimumRAM, and MaximumRAM, which are also part of the index key. The attribute Price is the value for the cached object that is not part of the indexing key or search key in the data grid. To define an inverse range index, you must use the AttributeName property that is a comma-delimited list of attributes, of which must contain one or more non-range attributes and one or more range style attributes. Indexing attributes might be part of the cache key or cache value and specified with the AddressableKeyName property. For more information about AttributeName, see InverseRangeIndex plug-in attributes.
Table 1. Example: Product data
ProductName StartPromotionDate EndPromotionDate MinimumRAM MaximumRAM Condition Country Price
PC01 01/01/11 12/31/11 2 4 Good US 199
PC01 01/01/11 12/31/11 6 8 Good US 259
PC01 01/01/12 12/31/12 2 4 Good US 299
PC01 01/01/12 12/31/12 2 8 Good US 499
PC02 01/01/08 12/31/10 2 4 Good US 99
PC02 01/01/10 12/31/11 2 4 Good US 289
PC02 01/01/12 12/31/12 4 6 Good US 389
The index key class ProductKey has three non-range attributes: productName, condition, and country. It also has four range-style attributes with boundary values: [startPromotionDate, endPromotionDate], [minimumRAM, maximumRAM]. The following classes are used while objects are placed in the map:
public class ProductKey {
String productName; 
Date startPromotionDate;
Date endPromotionDate;
Integer minimumRAM;
Integer maximumRAM;
String condition;
String country;
}
The search key class ProductSearchKey has five attributes that search for range style data: productName, promotionDate, RAM, condition, and country. The following objects are used in the MapIndexPlugin operation:
public class ProductSearchKey {
String productName;
Date promotionDate;
Integer RAM;
String condition;
String country; 
}
Based on these classes, the InverseRangeIndex can be configured with AttributeName property as:
key.productName, promotionDate[key.startPromotionDate, key.endPromotionDate], 
RAM[key.minimumRAM,key.maximumRAM], condition[key.condition], key.country
For more information about the syntax of AttributeName, see InverseRangeIndex plug-in attributes.

Procedure

Use the backingMapPluginCollections element to define the plug-in:

<bean id="MapIndexPlugin"  
   className="com.ibm.websphere.objectgrid.plugins.index.InverseRangeIndex">
	<property name="Name" type="java.lang.String" value="productData"/>
	<property name="AttributeName" type="java.lang.String" value="key.productName, 
	promotionDate[key.startPromotionDate, key.endPromotionDate], 
  RAM[key.minimumRAM,key.maximumRAM], 
	condition[key.condition], key.country"/>
</bean>
For more information about the backingMapPluginCollections element, see ObjectGrid descriptor XML file.