com.timeindexing.index
Class TimeIndexDirectory

java.lang.Object
  extended by com.timeindexing.index.TimeIndexDirectory

public class TimeIndexDirectory
extends java.lang.Object

This is the TimeIndexDirectory which returns Index objects. It provides a directory of current Indexes, which can be looked up by name or by ID. This is needed in order to shared Indexes between threads.


Field Summary
protected  java.util.HashMap countTable
          The count hashtable.
protected static TimeIndexDirectory directory
           
protected  java.util.HashMap indexByIDDirectory
          The ID directory.
protected  java.util.HashMap indexByNameDirectory
          The path directory.
protected  java.util.HashMap lockMap
           
 
Constructor Summary
TimeIndexDirectory()
          Construct a TimeIndexDirectory
 
Method Summary
static long addHandle(ManagedIndex index)
          Add an extra handle on an Index.
 long decrementCount(ManagedIndex index)
          Decrment the count on an Index.
static ManagedIndex find(ID anID)
          Find a Index by ID.
static ManagedIndex find(java.lang.String name)
          Find a Index by index name.
 ManagedIndex getIndex(ID anID)
          Find a Index by ID.
 ManagedIndex getIndex(java.lang.String name)
          Find a Index by index name.
 long incrementCount(ManagedIndex index)
          Incrmeent the count on an Index.
static boolean indexGate(java.net.URI indexURI)
          Gated access to the index.
 boolean isLocked(java.net.URI indexURI)
          Is an index locked
protected static java.util.Set listIndexes()
          A set of all the index names.
 java.util.Set listIndexesByName()
          List all the Indexes by name.
 boolean lock(java.net.URI indexURI)
          Lock an index
 boolean lockWait(java.net.URI indexURI)
          Wait for an index to be unlocked and ready for action.
static void mem(java.lang.String str)
           
protected  boolean putIndex(ID id, ManagedIndex index)
          Save an Index by index ID
protected  boolean putIndex(java.lang.String name, ManagedIndex index)
          Save an Index by index name.
 long registerIndex(ManagedIndex index, java.lang.String name, ID anID)
          Register an Index using its name and its ID.
static long removeHandle(ManagedIndex index)
          Remove a handle on an Index.
protected  boolean removeIndex(ID id)
          Remove an Index by index ID
protected  boolean removeIndex(java.lang.String name)
          Remove an Index by index name.
 boolean unlock(java.net.URI indexURI)
          Unlock an index
static boolean unlockI(java.net.URI indexURI)
          Unlock an index
 boolean unregisterIndex(ManagedIndex index)
          Unregister an Index.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

directory

protected static final TimeIndexDirectory directory

indexByIDDirectory

protected java.util.HashMap indexByIDDirectory
The ID directory.


indexByNameDirectory

protected java.util.HashMap indexByNameDirectory
The path directory.


countTable

protected java.util.HashMap countTable
The count hashtable.


lockMap

protected java.util.HashMap lockMap
Constructor Detail

TimeIndexDirectory

public TimeIndexDirectory()
Construct a TimeIndexDirectory

Method Detail

lock

public boolean lock(java.net.URI indexURI)
Lock an index


unlock

public boolean unlock(java.net.URI indexURI)
Unlock an index


isLocked

public boolean isLocked(java.net.URI indexURI)
Is an index locked


lockWait

public boolean lockWait(java.net.URI indexURI)
Wait for an index to be unlocked and ready for action.


getIndex

public ManagedIndex getIndex(java.lang.String name)
Find a Index by index name.


putIndex

protected boolean putIndex(java.lang.String name,
                           ManagedIndex index)
Save an Index by index name.


removeIndex

protected boolean removeIndex(java.lang.String name)
Remove an Index by index name.


listIndexesByName

public java.util.Set listIndexesByName()
List all the Indexes by name.


getIndex

public ManagedIndex getIndex(ID anID)
Find a Index by ID.


putIndex

protected boolean putIndex(ID id,
                           ManagedIndex index)
Save an Index by index ID


removeIndex

protected boolean removeIndex(ID id)
Remove an Index by index ID


registerIndex

public long registerIndex(ManagedIndex index,
                          java.lang.String name,
                          ID anID)
Register an Index using its name and its ID.


unregisterIndex

public boolean unregisterIndex(ManagedIndex index)
Unregister an Index.


incrementCount

public long incrementCount(ManagedIndex index)
Incrmeent the count on an Index.


decrementCount

public long decrementCount(ManagedIndex index)
Decrment the count on an Index.


find

public static ManagedIndex find(java.lang.String name)
Find a Index by index name.


find

public static ManagedIndex find(ID anID)
Find a Index by ID.


listIndexes

protected static java.util.Set listIndexes()
A set of all the index names.


addHandle

public static long addHandle(ManagedIndex index)
Add an extra handle on an Index.


removeHandle

public static long removeHandle(ManagedIndex index)
Remove a handle on an Index.


indexGate

public static boolean indexGate(java.net.URI indexURI)
Gated access to the index.

Returns:
true if this locks the index

unlockI

public static boolean unlockI(java.net.URI indexURI)
Unlock an index


mem

public static void mem(java.lang.String str)


Timeindexing 2008