org.ceryle.tm
Class TopicNameIndexImpl

java.lang.Object
  extended by org.ceryle.tm.TopicNameIndexImpl
All Implemented Interfaces:
TopicNameIndex

public class TopicNameIndexImpl
extends Object
implements TopicNameIndex

TopicNameIndexImpl extends Hashtable, implementing TopicNameIndex as an index of Topic labels within a TopicMap. "Labels" in Ceryle are Topic base names in the scope of the XTM PSI "Display".

This attempts to keep the cache up to date, such that when a request is made that can't be fulfilled, it causes the index to flag that it needs to be rebuilt, which happens via a low priority Thread. This class will likely be replaced by a Lucene-based implementation at some time in the future.

Since:
JDK1.3
Version:
$Id: TopicNameIndexImpl.java,v 3.1 2007-06-15 12:09:33 altheim Exp $
Author:
Murray Altheim

Constructor Summary
TopicNameIndexImpl(TopicMapProcessor tmprocessor, TopicMap topicmap)
           
 
Method Summary
 boolean addToIndex(Topic topic)
          Adds the Topic to the index, returning true if added.
 Topic getTopicByName(String label)
          Returns a Topic with the provided label, null if unable to match.
 void index()
          Builds the index of Topic labels.
 boolean isIndexed()
          Returns true if the indexer has been run.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TopicNameIndexImpl

public TopicNameIndexImpl(TopicMapProcessor tmprocessor,
                          TopicMap topicmap)
Method Detail

isIndexed

public boolean isIndexed()
Returns true if the indexer has been run. This doesn't necessarily mean the index is in sync with the current contents of the TopicMap.

Specified by:
isIndexed in interface TopicNameIndex

addToIndex

public boolean addToIndex(Topic topic)
                   throws IndexException
Adds the Topic to the index, returning true if added.

Specified by:
addToIndex in interface TopicNameIndex
Throws:
IndexException

index

public void index()
Builds the index of Topic labels. The 'indexed' flag is set only if the index size matches the count of Topics in the TopicMap. If merging is ncessary this might not match, and is therefore an unreliable indicator of synchronization.

Specified by:
index in interface TopicNameIndex

getTopicByName

public Topic getTopicByName(String label)
Returns a Topic with the provided label, null if unable to match.

Specified by:
getTopicByName in interface TopicNameIndex
Parameters:
label - the label for the Topic.
Returns:
the Topics matching the query.


The Ceryle Project. Copyright ©2001-2007 Murray Altheim, All Rights Reserved. See LICENSE included with distribution.