com.timeindexing.index
Class DefaultIndexHeader

java.lang.Object
  extended bycom.timeindexing.index.DefaultIndexHeader
All Implemented Interfaces:
ExtendedIndexHeader, IndexHeader, ManagedIndexHeader
Direct Known Subclasses:
IncoreIndexHeader, IndexDecoder

public class DefaultIndexHeader
extends java.lang.Object
implements ManagedIndexHeader

The default index header implementation. It holds all the values in an index header.


Constructor Summary
protected DefaultIndexHeader()
          Create a DefaultIndexHeader object.
  DefaultIndexHeader(java.lang.String name)
          Create a DefaultIndexHeader object.
 
Method Summary
 boolean addDataType(ID typeID, java.lang.String typeName)
          Add a new data type
 boolean addIndexURI(ID indexID, java.net.URI URIName)
          Add a new indexID/indexURI
 IndexProperties getAllOptions()
          Get all the option from the header.
 int getAnnotationStyle()
          Get the annotation style.
 java.lang.String getDataPathName()
          Get the path of the data if the index data style is external or shadow.
 long getDataSize()
          Get the size of the data items, if there is fixed size data.
 java.lang.String getDataType(ID typeID)
          Get the type name of the things in the data stream.
 Description getDescription()
          Get the description for an index.
 Timestamp getEndTime()
          Get the end time of the index This is the time the last item was closed, not necessarliy when the last item was added to the index.
 Timestamp getFirstDataTime()
          Get the data time for the first IndexItem in the Index.
 Offset getFirstOffset()
          Get the Offset of the fisrt item.
 Timestamp getFirstTime()
          Get the time the first IndexItem was put into the Index.
 ID getID()
          Get an ID of an index.
 DataType getIndexDataType()
          Get the index data type.
 java.lang.String getIndexPathName()
          Get the path of the index file.
 IndexType getIndexType()
          Get the data style.
 java.net.URI getIndexURI(ID indexID)
          Get the index URI of a nominated index.
 int getItemSize()
          Get the size of the items.
 Timestamp getLastDataTime()
          Get the data time for the last IndexItem in the Index.
 Offset getLastOffset()
          Get the Offset of the last item.
 Timestamp getLastTime()
          Get the time the last IndexItem was put into the Index.
 long getLength()
          Get the length of the index.
 java.lang.String getName()
          Get the name of the index.
 java.lang.Object getOption(HeaderOption option)
          Get an option from the header.
 Timestamp getStartTime()
          Get the start time of the index.
 java.net.URI getURI()
          Get the Index specification in the form of a URI.
 java.lang.Object getValue(java.lang.String name)
          Get a value from the header.
 int getVersionMajor()
          Get the major version no.
 int getVersionMinor()
          Get the minor version no.
 boolean hasAnnotations()
          Does this index have annotations.
 boolean hasDataType(java.lang.String typeName)
          Does this index have a typed name.
 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.
 boolean isFixedSizeData()
          Does the index have fixed size data.
 boolean isInTimeOrder()
          State that the index is not in time order any more.
 boolean isReadOnly()
          Is the Index only available for read-only operations.
 boolean isTerminated()
          Is the Index terminated.
 java.util.Set listOptions()
          Get the set of optional header values.
 ManagedIndexHeader notInTimeOrder()
          State that the index is not in time order any more.
 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 data style.
 ManagedIndexHeader setInTimeOrder()
          State that the index is in time order.
 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.
 ManagedIndexHeader setVersionMajor(int maj)
          Set the major version no.
 ManagedIndexHeader setVersionMinor(int min)
          Set the minor version no.
 boolean syncHeader(ManagedIndexHeader indexHeader)
          Syncrhronize the values in this index header from values in a specified IndexHeader object.
 java.lang.String toString()
          A strign version of the header.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DefaultIndexHeader

protected DefaultIndexHeader()
Create a DefaultIndexHeader object.


DefaultIndexHeader

public DefaultIndexHeader(java.lang.String name)
Create a DefaultIndexHeader object.

Method Detail

getName

public java.lang.String getName()
Get the name of the index.

Specified by:
getName in interface IndexHeader

setName

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

Specified by:
setName in interface ManagedIndexHeader

getID

public ID getID()
Get an ID of an index.

Specified by:
getID in interface IndexHeader

setID

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

Specified by:
setID in interface ManagedIndexHeader

getURI

public java.net.URI getURI()
Get the Index specification in the form of a URI.

Specified by:
getURI in interface IndexHeader

setURI

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

Specified by:
setURI in interface ManagedIndexHeader

getStartTime

public Timestamp getStartTime()
Get the start time of the index. This is when the index was created not necessarliy when the first item was added to the index.

Specified by:
getStartTime in interface IndexHeader

setStartTime

public ManagedIndexHeader setStartTime(Timestamp start)
Set the start time

Specified by:
setStartTime in interface ManagedIndexHeader

getEndTime

public Timestamp getEndTime()
Get the end time of the index This is the time the last item was closed, not necessarliy when the last item was added to the index.

Specified by:
getEndTime in interface IndexHeader

setEndTime

public ManagedIndexHeader setEndTime(Timestamp end)
Set the end time

Specified by:
setEndTime in interface ManagedIndexHeader

getFirstTime

public Timestamp getFirstTime()
Get the time the first IndexItem was put into the Index.

Specified by:
getFirstTime in interface IndexHeader
Returns:
ZeroTimestamp if there is no first item, usually when there are no items in the index

setFirstTime

public ManagedIndexHeader setFirstTime(Timestamp first)
Set the first time

Specified by:
setFirstTime in interface ManagedIndexHeader

getLastTime

public Timestamp getLastTime()
Get the time the last IndexItem was put into the Index.

Specified by:
getLastTime in interface IndexHeader
Returns:
ZeroTimestamp if there is no last item, usually when there are no items in the index

setLastTime

public ManagedIndexHeader setLastTime(Timestamp last)
Set the last time

Specified by:
setLastTime in interface ManagedIndexHeader

getFirstDataTime

public Timestamp getFirstDataTime()
Get the data time for the first IndexItem in the Index.

Specified by:
getFirstDataTime in interface IndexHeader
Returns:
ZeroTimestamp if there is no first item, usually when there are no items in the index

setFirstDataTime

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

Specified by:
setFirstDataTime in interface ManagedIndexHeader

getLastDataTime

public Timestamp getLastDataTime()
Get the data time for the last IndexItem in the Index.

Specified by:
getLastDataTime in interface IndexHeader
Returns:
ZeroTimestamp if there is no last item, usually when there are no items in the index

setLastDataTime

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

Specified by:
setLastDataTime in interface ManagedIndexHeader

getLength

public long getLength()
Get the length of the index.

Specified by:
getLength in interface IndexHeader

setLength

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

Specified by:
setLength in interface ManagedIndexHeader

isTerminated

public boolean isTerminated()
Is the Index terminated.

Specified by:
isTerminated in interface IndexHeader

setTerminated

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

Specified by:
setTerminated in interface ManagedIndexHeader

getFirstOffset

public Offset getFirstOffset()
Get the Offset of the fisrt item.

Specified by:
getFirstOffset in interface ExtendedIndexHeader

setFirstOffset

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

Specified by:
setFirstOffset in interface ManagedIndexHeader

getLastOffset

public Offset getLastOffset()
Get the Offset of the last item.

Specified by:
getLastOffset in interface ExtendedIndexHeader

setLastOffset

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

Specified by:
setLastOffset in interface ManagedIndexHeader

getItemSize

public int getItemSize()
Get the size of the items.

Specified by:
getItemSize in interface ExtendedIndexHeader

setItemSize

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

Specified by:
setItemSize in interface ManagedIndexHeader

isFixedSizeData

public boolean isFixedSizeData()
Does the index have fixed size data.

Specified by:
isFixedSizeData in interface IndexHeader

getDataSize

public long getDataSize()
Get the size of the data items, if there is fixed size data. The value 0 means variable sized data.

Specified by:
getDataSize in interface ExtendedIndexHeader

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

getIndexType

public IndexType getIndexType()
Get the data style. Either inline or external or shadow.

Specified by:
getIndexType in interface IndexHeader

setIndexType

public ManagedIndexHeader setIndexType(IndexType type)
Set the data style. Either inline or external or shadow.

Specified by:
setIndexType in interface ManagedIndexHeader

getIndexDataType

public DataType getIndexDataType()
Get the index data type. Some indexes have the same type throughout, other have mixed type data.

Specified by:
getIndexDataType in interface IndexHeader

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

getIndexPathName

public java.lang.String getIndexPathName()
Get the path of the index file.

Specified by:
getIndexPathName in interface IndexHeader
Returns:
null if there is no index path

setIndexPathName

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

Specified by:
setIndexPathName in interface ManagedIndexHeader

getDataPathName

public java.lang.String getDataPathName()
Get the path of the data if the index data style is external or shadow.

Specified by:
getDataPathName in interface IndexHeader
Returns:
null if there is no data path

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

getDescription

public Description getDescription()
Get the description for an index.

Specified by:
getDescription in interface IndexHeader
Returns:
null if there is no description

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

isReadOnly

public boolean isReadOnly()
Is the Index only available for read-only operations.

Specified by:
isReadOnly in interface IndexHeader

setReadOnly

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

Specified by:
setReadOnly in interface ManagedIndexHeader

isInTimeOrder

public boolean isInTimeOrder()
State that the index is not in time order any more.

Specified by:
isInTimeOrder in interface IndexHeader

setInTimeOrder

public ManagedIndexHeader setInTimeOrder()
State that the index is in time order.


notInTimeOrder

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

Specified by:
notInTimeOrder in interface ManagedIndexHeader

hasAnnotations

public boolean hasAnnotations()
Does this index have annotations.

Specified by:
hasAnnotations in interface ExtendedIndexHeader

getAnnotationStyle

public int getAnnotationStyle()
Get the annotation style. Either inline or external.

Specified by:
getAnnotationStyle in interface ExtendedIndexHeader

getDataType

public java.lang.String getDataType(ID typeID)
Get the type name of the things in the data stream.

Specified by:
getDataType in interface ExtendedIndexHeader

hasDataType

public boolean hasDataType(java.lang.String typeName)
Does this index have a typed name.

Specified by:
hasDataType in interface ExtendedIndexHeader

addDataType

public boolean addDataType(ID typeID,
                           java.lang.String typeName)
Add a new data type

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

getIndexURI

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

Specified by:
getIndexURI in interface ManagedIndexHeader

hasIndexURI

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

Specified by:
hasIndexURI in interface ManagedIndexHeader

addIndexURI

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

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

getVersionMajor

public int getVersionMajor()
Get the major version no.


setVersionMajor

public ManagedIndexHeader setVersionMajor(int maj)
Set the major version no.


getVersionMinor

public int getVersionMinor()
Get the minor version no.


setVersionMinor

public ManagedIndexHeader setVersionMinor(int min)
Set the minor version no.


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

getValue

public java.lang.Object getValue(java.lang.String name)
Get a value from the header.


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

toString

public java.lang.String toString()
A strign version of the header.