SPT Object Database API

com.sptci.prevayler
Class IndexSystem

java.lang.Object
  extended by com.sptci.prevayler.StorageSystem
      extended by com.sptci.prevayler.IndexSystem
All Implemented Interfaces:
AbstractDatabase<PrevalentObject>, DatabaseSystem, Serializable
Direct Known Subclasses:
ConstraintSystem

abstract class IndexSystem
extends StorageSystem

Abstracts all index management operations for the prevalent system.

© Copyright 2008 Sans Pareil Technologies, Inc.

Version:
$Id: IndexSystem.java 22 2008-11-24 19:04:25Z sptrakesh $
Author:
Rakesh Vidyadharan 2008-05-23

Nested Class Summary
 
Nested classes/interfaces inherited from class com.sptci.prevayler.StorageSystem
StorageSystem.TaskQueue
 
Field Summary
private static long serialVersionUID
           
 
Fields inherited from class com.sptci.prevayler.StorageSystem
logger
 
Constructor Summary
IndexSystem()
           
 
Method Summary
protected  void checkFields(PrevalentObject object)
          Check all the fields in the prevalent object for Index annotation and check for unique constraint violations.
private  void checkIndex(Index index, PrevalentObject object)
          Check the index specified at the class level on the prevalent object.
private  void checkIndices(PrevalentObject object)
          Check the Indices annotations on the specified prevalent object and check unique constraints.
protected  void checkUnique(PrevalentObject object)
          Check all unique constraints (including object id) for the specified prevalent object.
protected  void index(PrevalentObject object)
          Manage additional maps required to support qeries on the prevalent object.
protected  void indexClass(PrevalentObject object)
          Process the index annotations on the prevalent object and manage the StorageSystem.indexMap as appropriate.
protected  void indexFields(PrevalentObject object)
          Process Index annotations on the fields of the specified prevalent object and manage the StorageSystem.indexMap as appropriate.
private  void processIndex(Index index, PrevalentObject object)
          Process the Index annotation at the class level of the specified prevalent object.
private  void processIndices(PrevalentObject object)
          Process the Indices annotation and manage the StorageSystem.indexMap as appropriate.
protected  void remove(PrevalentObject object)
          Remove the index for the specified prevalent object.
 
Methods inherited from class com.sptci.prevayler.StorageSystem
generateOid, getIndexStorage, getIndexStorage, getPrimaryStorage, getPrimaryStorage, getReferenceStorage, getReferenceStorage, getRelationStorage, getRelationStorage, getTaskQueue
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.sptci.prevayler.DatabaseSystem
delete, save
 
Methods inherited from interface com.sptci.prevayler.AbstractDatabase
count, fetch, fetch, fetch, fetchIntersection, fetchUnion, search
 

Field Detail

serialVersionUID

private static final long serialVersionUID
See Also:
Constant Field Values
Constructor Detail

IndexSystem

IndexSystem()
Method Detail

checkUnique

protected void checkUnique(PrevalentObject object)
                    throws PrevalentException
Check all unique constraints (including object id) for the specified prevalent object.

Parameters:
object - The prevalent object to check.
Throws:
ConstraintException - If unique constraints are violated.
PrevalentException - If errors are encountered while processing the fields of the prevalent object.
See Also:
checkIndices(com.sptci.prevayler.PrevalentObject), checkIndex(com.sptci.prevayler.annotations.Index, com.sptci.prevayler.PrevalentObject), checkFields(com.sptci.prevayler.PrevalentObject)

checkIndices

private void checkIndices(PrevalentObject object)
                   throws PrevalentException
Check the Indices annotations on the specified prevalent object and check unique constraints.

Parameters:
object - The prevalent object to check.
Throws:
ConstraintException - If a unique constraint is violated.
PrevalentException - If exceptions are encountered while processing the fields of the prevalent object.
See Also:
checkIndex(com.sptci.prevayler.annotations.Index, com.sptci.prevayler.PrevalentObject)

checkIndex

private void checkIndex(Index index,
                        PrevalentObject object)
                 throws PrevalentException
Check the index specified at the class level on the prevalent object.

Parameters:
index - The annotation for the prevalent object.
object - The prevalent object to check.
Throws:
ConstraintException - If a unique constraint is violated.
PrevalentException - If exceptions are encountered while processing the fields of the prevalent object.

checkFields

protected void checkFields(PrevalentObject object)
                    throws PrevalentException
Check all the fields in the prevalent object for Index annotation and check for unique constraint violations.

Parameters:
object - The prevalent object to check.
Throws:
ConstraintException - If a unique constraint is violated.
PrevalentException - If exceptions are encountered while processing the fields of the prevalent object.

index

protected void index(PrevalentObject object)
              throws PrevalentException
Manage additional maps required to support qeries on the prevalent object.

Parameters:
object - The prevalent object to add query support for.
Throws:
PrevalentException - If errors are encountered while fetching the values of the fields in prevalent object.
See Also:
indexFields(com.sptci.prevayler.PrevalentObject), indexClass(com.sptci.prevayler.PrevalentObject)

indexFields

protected void indexFields(PrevalentObject object)
                    throws PrevalentException
Process Index annotations on the fields of the specified prevalent object and manage the StorageSystem.indexMap as appropriate.

Parameters:
object - The prevalent object to index.
Throws:
PrevalentException - If errors are encountered while processing the object fields.

indexClass

protected void indexClass(PrevalentObject object)
                   throws PrevalentException
Process the index annotations on the prevalent object and manage the StorageSystem.indexMap as appropriate.

Parameters:
object - The prevalent object to process.
Throws:
PrevalentException - If errors are encountered while processing the field values of the prevalent object.
See Also:
processIndices(com.sptci.prevayler.PrevalentObject), processIndex(com.sptci.prevayler.annotations.Index, com.sptci.prevayler.PrevalentObject)

processIndices

private void processIndices(PrevalentObject object)
                     throws PrevalentException
Process the Indices annotation and manage the StorageSystem.indexMap as appropriate.

Parameters:
object - The prevalent object whose class level index annotations are to be processed.
Throws:
PrevalentException - If errors are encountered while processing the fields of the prevalent object.
See Also:
processIndex(com.sptci.prevayler.annotations.Index, com.sptci.prevayler.PrevalentObject)

processIndex

private void processIndex(Index index,
                          PrevalentObject object)
                   throws PrevalentException
Process the Index annotation at the class level of the specified prevalent object.

Parameters:
index - The annotation to process.
object - The prevalent object to process.
Throws:
PrevalentException - If errors are encountered while processing the fields in the prevalent object.

remove

protected void remove(PrevalentObject object)
               throws PrevalentException
Remove the index for the specified prevalent object. This is typically called prior to deleting a prevalent object.

Parameters:
object - The prevalent object to de-index.
Throws:
PrevalentException - If errors are encountered while removing the index for the prevalent object.

SPT Object Database API