Class HashMapIndex
- java.lang.Object
 - 
- org.apache.jackrabbit.core.persistence.util.HashMapIndex
 
 
- 
- All Implemented Interfaces:
 StringIndex
- Direct Known Subclasses:
 FileBasedIndex
public class HashMapIndex extends Object implements StringIndex
Implements aStringIndexthat is based on a hashmap. Subclasses can override the protectedload()andsave()methods to implement persistent storage of the string index.This class is thread-safe.
 
- 
- 
Field Summary
Fields Modifier and Type Field Description protected HashMap<Integer,String>indexToStringholds the index-to-string lookups.protected HashMap<String,Integer>stringToIndexholds the string-to-index lookups. 
- 
Constructor Summary
Constructors Constructor Description HashMapIndex() 
- 
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description StringindexToString(int i)Returns the string for a given index.protected voidload()Loads the lookup table.protected voidsave()Saves the lookup table.intstringToIndex(String nsUri)Returns the index for a given string. 
 - 
 
- 
- 
Method Detail
- 
load
protected void load()
Loads the lookup table. 
- 
save
protected void save()
Saves the lookup table. 
- 
stringToIndex
public int stringToIndex(String nsUri)
Returns the index for a given string. If the given string is not already indexed, the implementation can either automatically index it or throw an exception. This implementation reloads the table from the resource if a lookup fails and if the resource was modified since.- Specified by:
 stringToIndexin interfaceStringIndex- Parameters:
 nsUri- the indexed (or to be indexed) string- Returns:
 - index of the string
 
 
- 
indexToString
public String indexToString(int i)
Returns the string for a given index. This implementation reloads the table from the resource if a lookup fails and if the resource was modified since.- Specified by:
 indexToStringin interfaceStringIndex- Parameters:
 i- index of a string- Returns:
 - the indexed string
 
 
 - 
 
 -