com.timeindexing.index
Class AbstractManagedIndex

java.lang.Object
  extended bycom.timeindexing.index.AbstractIndex
      extended bycom.timeindexing.index.AbstractManagedIndex
All Implemented Interfaces:
ExtendedIndex, ExtendedIndexHeader, Index, IndexEventGenerator, IndexHeader, ManagedIndex, ManagedIndexHeader
Direct Known Subclasses:
FileIndex, IncoreIndex

public abstract class AbstractManagedIndex
extends AbstractIndex
implements ManagedIndex, ManagedIndexHeader

An abstract index that has the managed facilities needed by the core of the system, but not accessible to the application layer. This is to be extended by classes that are implementations of indexes.


Constructor Summary
AbstractManagedIndex()
           
 
Method Summary
 boolean addIndexURI(ID indexID, java.net.URI URIName)
          Add a new indexID/indexURI
 IndexView asView()
          Get a view onto the Index.
 boolean close()
          Close this index.
 IndexProperties getAllOptions()
          Get all the option from the header.
 ManagedIndexHeader getHeader()
          Get the headerfor the index.
 java.net.URI getIndexURI(ID indexID)
          Get the index URI of a nominated index.
 java.lang.Object getOption(HeaderOption option)
          Get an option from the header.
 Index getTrackedIndex(ID indexID)
          Get an Index being tracked
 boolean hasIndexURI(java.net.URI URIName)
          Does this index have the URI of some other index
 boolean hasOption(HeaderOption option)
          Does an option exist in the header.
protected  boolean isOpen(java.lang.String name)
          Try and determine if this index is alreay open
 boolean isTrackingIndex(ID indexID)
          Is an Index being tracked
 java.util.Set listOptions()
          Get the set of optional header values.
 java.util.Collection listTrackedIndexes()
          List all the Referenced Indexes.
 ManagedIndexHeader notInTimeOrder()
          State that the index is not in time order any more.
 boolean reallyClose()
          Really close this index.
 ManagedIndexHeader setDataPathName(java.lang.String path)
          Set the path of the data if the index data style is external or shadow.
 ManagedIndexHeader setDataSize(long size)
          Set the size of the data items, if there is fixed size data.
 ManagedIndexHeader setDescription(Description d)
          Set the description.
 ManagedIndexHeader setEndTime(Timestamp end)
          Set the end time
 ManagedIndexHeader setFirstDataTime(Timestamp first)
          Set the first data time
 ManagedIndexHeader setFirstOffset(Offset offset)
          Set the Offset of the fisrt item.
 ManagedIndexHeader setFirstTime(Timestamp first)
          Set the first time
 ManagedIndexHeader setID(ID id)
          Set the ID of the index.
 ManagedIndexHeader setIndexDataType(DataType type)
          Set the data type of the index.
 ManagedIndexHeader setIndexPathName(java.lang.String path)
          Set the path of the index file
 ManagedIndexHeader setIndexType(IndexType type)
          Set the type of the index.
 ManagedIndexHeader setItemSize(int size)
          Set the size of the index items.
 ManagedIndexHeader setLastDataTime(Timestamp last)
          Set the last data time
 ManagedIndexHeader setLastOffset(Offset offset)
          Set the Offset of the last item.
 ManagedIndexHeader setLastTime(Timestamp last)
          Set the last time
 ManagedIndexHeader setLength(long length)
          Set the no of items in the index.
 ManagedIndexHeader setName(java.lang.String name)
          Set the name of the index.
 ManagedIndexHeader setOption(HeaderOption option, java.lang.Object object)
          Set an option in the header.
 ManagedIndexHeader setOptions(IndexProperties someProperties)
          Set options in the header based on the passed IndexProperties.
 ManagedIndexHeader setReadOnly(boolean readonly)
          Set the read only status.
 ManagedIndexHeader setStartTime(Timestamp start)
          Set the start time
 ManagedIndexHeader setTerminated(boolean t)
          Set the index to be terminated.
 ManagedIndexHeader setURI(java.net.URI uri)
          Set the URI of the index.
 boolean syncHeader(ManagedIndexHeader indexHeader)
          Syncrhronize the values in this index header from values in a specified IndexHeader object.
 int trackReferencedIndex(Index index)
          Track a Referenced Index.
 
Methods inherited from class com.timeindexing.index.AbstractIndex
addAccessEventListener, addAddEventListener, addDataType, addItem, addItem, addItem, addPrimaryEventListener, binarySearch, commit, contains, eventMulticaster, getAnnotationStyle, getDataPathName, getDataSize, getDataType, getDescription, getEndTime, getFirstDataTime, getFirstTime, getID, getIndexDataType, getIndexPathName, getIndexType, getItem, getItem, getItem, getItemSize, getLastAccessTime, getLastDataTime, getLastTime, getLength, getName, getStartTime, getURI, hasAnnotations, hasDataType, isActivated, isChanged, isClosed, isFixedSizeData, isInTimeOrder, isReadOnly, isTerminated, iterator, locate, locate, removeAccessEventListener, removeAddEventListener, removePrimaryEventListener, setAutoCommit, setCachePolicy, setLastAccessTime, terminate, updateDescription
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.timeindexing.index.ManagedIndex
addReference, create, open
 
Methods inherited from interface com.timeindexing.index.ExtendedIndex
getFirstOffset, getIndexType, getLastFlushPosition, getLastFlushTime, getLastOffset
 
Methods inherited from interface com.timeindexing.index.Index
activate, addDataType, addItem, addItem, addReference, addReference, commit, contains, getAnnotationStyle, getDataType, getItem, getItem, getItem, getItemSize, getLastAccessTime, hasAnnotations, hasDataType, isActivated, isChanged, isClosed, isWriteLocked, iterator, locate, locate, setAutoCommit, setCachePolicy, terminate, updateDescription
 
Methods inherited from interface com.timeindexing.index.IndexHeader
getDataPathName, getDataSize, getDescription, getEndTime, getFirstDataTime, getFirstTime, getID, getIndexDataType, getIndexPathName, getLastDataTime, getLastTime, getLength, getName, getStartTime, getURI, isFixedSizeData, isInTimeOrder, isReadOnly, isTerminated
 
Methods inherited from interface com.timeindexing.index.ExtendedIndexHeader
addDataType, getAnnotationStyle, getDataSize, getDataType, getItemSize, hasAnnotations, hasDataType
 
Methods inherited from interface com.timeindexing.event.IndexEventGenerator
addAccessEventListener, addAddEventListener, addPrimaryEventListener, removeAccessEventListener, removeAddEventListener, removePrimaryEventListener
 

Constructor Detail

AbstractManagedIndex

public AbstractManagedIndex()
Method Detail

setName

public ManagedIndexHeader setName(java.lang.String name)
Set the name of the index.

Specified by:
setName in interface ManagedIndexHeader

setID

public ManagedIndexHeader setID(ID id)
Set the ID of the index.

Specified by:
setID in interface ManagedIndexHeader

setURI

public ManagedIndexHeader setURI(java.net.URI uri)
Set the URI of the index.

Specified by:
setURI in interface ManagedIndexHeader

setStartTime

public ManagedIndexHeader setStartTime(Timestamp start)
Set the start time

Specified by:
setStartTime in interface ManagedIndexHeader

setEndTime

public ManagedIndexHeader setEndTime(Timestamp end)
Set the end time

Specified by:
setEndTime in interface ManagedIndexHeader

setFirstTime

public ManagedIndexHeader setFirstTime(Timestamp first)
Set the first time

Specified by:
setFirstTime in interface ManagedIndexHeader

setLastTime

public ManagedIndexHeader setLastTime(Timestamp last)
Set the last time

Specified by:
setLastTime in interface ManagedIndexHeader

setFirstDataTime

public ManagedIndexHeader setFirstDataTime(Timestamp first)
Set the first data time

Specified by:
setFirstDataTime in interface ManagedIndexHeader

setLastDataTime

public ManagedIndexHeader setLastDataTime(Timestamp last)
Set the last data time

Specified by:
setLastDataTime in interface ManagedIndexHeader

setLength

public ManagedIndexHeader setLength(long length)
Set the no of items in the index.

Specified by:
setLength in interface ManagedIndexHeader

setTerminated

public ManagedIndexHeader setTerminated(boolean t)
Set the index to be terminated.

Specified by:
setTerminated in interface ManagedIndexHeader

setItemSize

public ManagedIndexHeader setItemSize(int size)
Set the size of the index items.

Specified by:
setItemSize in interface ManagedIndexHeader

setDataSize

public ManagedIndexHeader setDataSize(long size)
Set the size of the data items, if there is fixed size data.

Specified by:
setDataSize in interface ManagedIndexHeader

setFirstOffset

public ManagedIndexHeader setFirstOffset(Offset offset)
Set the Offset of the fisrt item.

Specified by:
setFirstOffset in interface ManagedIndexHeader

setLastOffset

public ManagedIndexHeader setLastOffset(Offset offset)
Set the Offset of the last item.

Specified by:
setLastOffset in interface ManagedIndexHeader

setIndexType

public ManagedIndexHeader setIndexType(IndexType type)
Set the type of the index. Either inline or external or shadow.

Specified by:
setIndexType in interface ManagedIndexHeader

setIndexDataType

public ManagedIndexHeader setIndexDataType(DataType type)
Set the data type of the index. Some indexes have the same type throughout, other have mixed type data.

Specified by:
setIndexDataType in interface ManagedIndexHeader

setIndexPathName

public ManagedIndexHeader setIndexPathName(java.lang.String path)
Set the path of the index file

Specified by:
setIndexPathName in interface ManagedIndexHeader

setDataPathName

public ManagedIndexHeader setDataPathName(java.lang.String path)
Set the path of the data if the index data style is external or shadow.

Specified by:
setDataPathName in interface ManagedIndexHeader

setDescription

public ManagedIndexHeader setDescription(Description d)
Set the description. This is one of the few attributes of an index that can be set directly.

Specified by:
setDescription in interface ManagedIndexHeader

setReadOnly

public ManagedIndexHeader setReadOnly(boolean readonly)
Set the read only status.

Specified by:
setReadOnly in interface ManagedIndexHeader

notInTimeOrder

public ManagedIndexHeader notInTimeOrder()
State that the index is not in time order any more.

Specified by:
notInTimeOrder in interface ManagedIndexHeader

getIndexURI

public java.net.URI getIndexURI(ID indexID)
Get the index URI of a nominated index.

Specified by:
getIndexURI in interface ExtendedIndexHeader

hasIndexURI

public boolean hasIndexURI(java.net.URI URIName)
Does this index have the URI of some other index

Specified by:
hasIndexURI in interface ExtendedIndexHeader

addIndexURI

public boolean addIndexURI(ID indexID,
                           java.net.URI URIName)
Add a new indexID/indexURI

Specified by:
addIndexURI in interface ExtendedIndexHeader
Returns:
true, if a new index URI was added; false, if the index had this ID/URI pair already

getOption

public java.lang.Object getOption(HeaderOption option)
Get an option from the header.

Specified by:
getOption in interface ManagedIndexHeader

setOption

public ManagedIndexHeader setOption(HeaderOption option,
                                    java.lang.Object object)
Set an option in the header.

Specified by:
setOption in interface ManagedIndexHeader

hasOption

public boolean hasOption(HeaderOption option)
Does an option exist in the header.

Specified by:
hasOption in interface ManagedIndexHeader

listOptions

public java.util.Set listOptions()
Get the set of optional header values.

Specified by:
listOptions in interface ManagedIndexHeader

getAllOptions

public IndexProperties getAllOptions()
Get all the option from the header.

Specified by:
getAllOptions in interface ManagedIndexHeader

setOptions

public ManagedIndexHeader setOptions(IndexProperties someProperties)
Set options in the header based on the passed IndexProperties.

Specified by:
setOptions in interface ManagedIndexHeader

trackReferencedIndex

public int trackReferencedIndex(Index index)
Track a Referenced Index.

Specified by:
trackReferencedIndex in interface ManagedIndex
Returns:
the number of tracked indexes

isTrackingIndex

public boolean isTrackingIndex(ID indexID)
Is an Index being tracked

Specified by:
isTrackingIndex in interface ManagedIndex

getTrackedIndex

public Index getTrackedIndex(ID indexID)
Get an Index being tracked

Specified by:
getTrackedIndex in interface ManagedIndex

listTrackedIndexes

public java.util.Collection listTrackedIndexes()
List all the Referenced Indexes.

Specified by:
listTrackedIndexes in interface ManagedIndex

getHeader

public ManagedIndexHeader getHeader()
Get the headerfor the index.

Specified by:
getHeader in interface ManagedIndex

syncHeader

public boolean syncHeader(ManagedIndexHeader indexHeader)
Syncrhronize the values in this index header from values in a specified IndexHeader object.

Specified by:
syncHeader in interface ManagedIndexHeader

close

public boolean close()
              throws IndexCloseException
Close this index.

Specified by:
close in interface Index
Throws:
IndexCloseException

reallyClose

public boolean reallyClose()
                    throws IndexCloseException
Really close this index.

Specified by:
reallyClose in interface ManagedIndex
Throws:
IndexCloseException

isOpen

protected boolean isOpen(java.lang.String name)
Try and determine if this index is alreay open


asView

public IndexView asView()
Get a view onto the Index.

Specified by:
asView in interface Index