org.wdssii.core
Class Index

java.lang.Object
  extended by org.wdssii.core.Index
Direct Known Subclasses:
FamIndex, XMLIndex

public abstract class Index
extends Object

the Index class connects to a data source and provides access to real-time products as they come in.

Version:
$Id: Index.java,v 1.6 2006/12/29 21:15:12 lakshman Exp $
Author:
Lakshman
See Also:
IndexRecord

Field Summary
private  HashSet<String> datatypes
           
private  String indexLocation
           
private  Set<IndexRecordListener> listeners
           
private  HashMap<String,IndexRecord> records
           
private  HashMap<String,HashSet<String>> selections
           
private  HashMap<String,TreeMap<Date,IndexRecord>> timestamps
          datatype to TreeMap
 
Constructor Summary
Index(String indexLocation, Set<IndexRecordListener> listeners)
           
 
Method Summary
(package private)  void addRecByTypeTime(Date time, String dt, IndexRecord rec)
           
 void addRecord(IndexRecord rec)
           
private  void addRecord(String key, IndexRecord rec)
           
 void addRecordListener(IndexRecordListener listener)
          Register a listener to be notified about new records in this index.
private  void addSelection(String key, String s)
           
 Set<String> getDataTypes()
           
 IndexRecord getFirstRecordByTime(String dt)
           
 String getIndexLocation()
          the directory in which this index.xml or index.lb is located
private  String getKey(String[] sels, int start, int last)
           
 IndexRecord getLastRecordByTime(String dt)
           
 Set<String> getNextSelection(String key)
           
 Set<String> getNextSelection(String[] selections)
           
 IndexRecord getRecord(String key)
           
 IndexRecord getRecord(String[] selections)
           
 Map<Date,IndexRecord> getRecordsByTypeTime(String dt, Date from, Date to)
           
abstract  Index newInstance(String path, Set<IndexRecordListener> listeners)
          Create a brand-new Index with these listeners attached.
 int numRecordsByTime(String dt)
           
abstract  void update()
          The update() method will be called periodically.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

timestamps

private HashMap<String,TreeMap<Date,IndexRecord>> timestamps
datatype to TreeMap


records

private HashMap<String,IndexRecord> records

selections

private HashMap<String,HashSet<String>> selections

datatypes

private HashSet<String> datatypes

listeners

private Set<IndexRecordListener> listeners

indexLocation

private String indexLocation
Constructor Detail

Index

public Index(String indexLocation,
             Set<IndexRecordListener> listeners)
Method Detail

newInstance

public abstract Index newInstance(String path,
                                  Set<IndexRecordListener> listeners)
                           throws DataUnavailableException
Create a brand-new Index with these listeners attached.

Throws:
DataUnavailableException

update

public abstract void update()
The update() method will be called periodically. The implementation is allowed to ignore update() calls that happen at inconvenient times.


getIndexLocation

public String getIndexLocation()
the directory in which this index.xml or index.lb is located


addRecordListener

public void addRecordListener(IndexRecordListener listener)
Register a listener to be notified about new records in this index.


addRecord

public void addRecord(IndexRecord rec)

addRecByTypeTime

void addRecByTypeTime(Date time,
                      String dt,
                      IndexRecord rec)

getKey

private String getKey(String[] sels,
                      int start,
                      int last)

getRecordsByTypeTime

public Map<Date,IndexRecord> getRecordsByTypeTime(String dt,
                                                  Date from,
                                                  Date to)

getFirstRecordByTime

public IndexRecord getFirstRecordByTime(String dt)

getLastRecordByTime

public IndexRecord getLastRecordByTime(String dt)

numRecordsByTime

public int numRecordsByTime(String dt)

addSelection

private void addSelection(String key,
                          String s)

addRecord

private void addRecord(String key,
                       IndexRecord rec)

getRecord

public IndexRecord getRecord(String[] selections)

getRecord

public IndexRecord getRecord(String key)

getDataTypes

public Set<String> getDataTypes()

getNextSelection

public Set<String> getNextSelection(String[] selections)

getNextSelection

public Set<String> getNextSelection(String key)