gov.nist.nlpir.irf.irfman
Class InfoServer

java.lang.Object
  |
  +--gov.nist.nlpir.irf.irfman.InfoServer

public class InfoServer
extends java.lang.Object
implements java.io.Serializable

The InfoServer is responsible for keeping track of available indexes, document collections, and indirectly of available indexers and query-document matchers.

Version:
$Revision: 1.5 $
Author:
This software was produced by NIST, an agency of the U.S. government, and by statute is not subject to copyright in the United States. Recipients of this software assume all responsibilities associated with its operation, modification and maintenance.
See Also:
Serialized Form

Field Summary
private static java.util.Vector classesToShutdown
          This static vector will contain every class that registered itself with the registerForShutdown() method.
private  java.util.Vector converters
          Names of the used converters if they actually exist.
private  java.util.Dictionary docColls
          Available document collections.
private  HandlesByOid handlesByOid
          Handles by Oid table
private  IndexerManager indexerMan
          Manager for available indexers.
static int lastUsedOidAtStart
          The Oid class can't keep track itself of the last Oid given away because of the static keyword vs Serialization behavior.
private  java.lang.String locationOfBrokeredStorage
          High-level information for use by brokers in locating persistent storage - transient here; saved by collection in DocCollection.
private  MatcherManager matcherMan
          Manager for available query-doc matchers.
(package private) static long serialVersionUID
          serial version universal id - put here so Java does not insert one which may change due to revisions and make it impossible to deserialize earlier versions of serialized objects
 
Constructor Summary
InfoServer()
           
 
Method Summary
 void addConverter(java.lang.String converterName)
           
 void addDocColl(DocCollection doccoll)
          Add a document collection to the dictionary of available document collections
 DocCollection findDocColl(char[] doccollname)
          Look up a document collection by name in the dictionary of available collections
 DocCollection findDocColl(java.lang.String doccollname)
          Look up a document collection by name in the dictionary of available collections
 java.util.Vector getConverters()
           
 java.util.Enumeration getDocCollIter()
          Get an enumeration to allow interation over the available document collections
 void getFirstInstances()
          For proxy management purpose.
 HandlesByOid getHandlesByOid()
           
 IndexerManager getIndexerManager()
          Get the IndexerManager which is a component of this InfoServer
 java.lang.String getLocationOfBrokeredStorage()
           
 MatcherManager getMatcherManager()
          Get the MatcherManager which is a component of this InfoServer
 java.util.Vector getModifiedDocColls()
          Find the document collections that have been modified
private  void initialize()
          Initialize the Infoserver dictionary of document collections, etc.
 void present()
          Print out a list of available resources
static void registerForShutdown(java.lang.Class toBeRegistered)
          This method must be called from a static initializer by every class that wishes to be notified when the InfoServer shuts down.
 void setLocationOfBrokeredStorage(java.lang.String location)
          Set the the locationOfBrokeredStorage
 void setMaxHandlesByOidCacheEntries(int maxHandlesByOidCacheEntries)
          If one wants to change the size of the cache used to match Handles to Oids, this function * is for this purpose.
 void shutdown()
          This method must be called before this InfoServer disappears, otherwise there will likely be synchronization problems, like Handles not being saved.
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

serialVersionUID

static final long serialVersionUID
serial version universal id - put here so Java does not insert one which may change due to revisions and make it impossible to deserialize earlier versions of serialized objects

handlesByOid

private HandlesByOid handlesByOid
Handles by Oid table

docColls

private java.util.Dictionary docColls
Available document collections.

converters

private java.util.Vector converters
Names of the used converters if they actually exist.

locationOfBrokeredStorage

private transient java.lang.String locationOfBrokeredStorage
High-level information for use by brokers in locating persistent storage - transient here; saved by collection in DocCollection.

indexerMan

private transient IndexerManager indexerMan
Manager for available indexers.

matcherMan

private transient MatcherManager matcherMan
Manager for available query-doc matchers.

lastUsedOidAtStart

public static int lastUsedOidAtStart
The Oid class can't keep track itself of the last Oid given away because of the static keyword vs Serialization behavior. We must then store it here. It is static, so the basic serialization can't take care of it. It doesn't have any static initalizer for the same reason. Only the initialize() method can set it at first, and then the deserialization process will assure we can get new Oids during subsequent runs.
See Also:
Oid

classesToShutdown

private static java.util.Vector classesToShutdown
This static vector will contain every class that registered itself with the registerForShutdown() method. When the InfoServer shuts down, each of these classes will be notified.
Constructor Detail

InfoServer

public InfoServer()
Method Detail

initialize

private void initialize()
Initialize the Infoserver dictionary of document collections, etc.

getHandlesByOid

public HandlesByOid getHandlesByOid()
Returns:
the handles-by-Oid table

setMaxHandlesByOidCacheEntries

public void setMaxHandlesByOidCacheEntries(int maxHandlesByOidCacheEntries)
If one wants to change the size of the cache used to match Handles to Oids, this function * is for this purpose.

setLocationOfBrokeredStorage

public void setLocationOfBrokeredStorage(java.lang.String location)
Set the the locationOfBrokeredStorage

getLocationOfBrokeredStorage

public java.lang.String getLocationOfBrokeredStorage()
Returns:
the locationOfBrokeredStorage

present

public void present()
Print out a list of available resources

addDocColl

public void addDocColl(DocCollection doccoll)
Add a document collection to the dictionary of available document collections
Parameters:
doccoll - the document collection to be added

getDocCollIter

public java.util.Enumeration getDocCollIter()
Get an enumeration to allow interation over the available document collections
Returns:
an enumeration allowing iteration over the available document collections

findDocColl

public DocCollection findDocColl(char[] doccollname)
Look up a document collection by name in the dictionary of available collections
Parameters:
doccollname - the name of the document collection to be looked up
Returns:
the document collection corresponding to the specified name

findDocColl

public DocCollection findDocColl(java.lang.String doccollname)
Look up a document collection by name in the dictionary of available collections
Parameters:
doccollname - the name of the document collection to be looked up
Returns:
the document collection corresponding to the specified name

getModifiedDocColls

public java.util.Vector getModifiedDocColls()
Find the document collections that have been modified
Returns:
the modified document collections

getIndexerManager

public IndexerManager getIndexerManager()
Get the IndexerManager which is a component of this InfoServer
Returns:
the IndexerManager which is a component of this InfoServer

getMatcherManager

public MatcherManager getMatcherManager()
Get the MatcherManager which is a component of this InfoServer
Returns:
the MatcherManager which is a component of this InfoServer

addConverter

public void addConverter(java.lang.String converterName)

getConverters

public java.util.Vector getConverters()

getFirstInstances

public void getFirstInstances()
For proxy management purpose.
See Also:
VirtualProxy.getFirstInstance()

shutdown

public void shutdown()
This method must be called before this InfoServer disappears, otherwise there will likely be synchronization problems, like Handles not being saved.

registerForShutdown

public static void registerForShutdown(java.lang.Class toBeRegistered)
This method must be called from a static initializer by every class that wishes to be notified when the InfoServer shuts down. When this happens, the InfoServer will invoke the shutdown() method on every class that registered with the current method. This method will have to be static public. A class may wish to be notified this way if, for instance, it uses a file that may not be saved if the class isn't aware of the shutdown process.
Example:FileClient uses a file (variable name theFile ) and thus it wishes to be notified when the application is about to leave so that it can close this file. It must then register with InfoServer using a static initializer like this one:
 static {
   theInfoServer().
     registerForShutdown(FileClient.class);
 }
 
This way the given InfoServer is aware of the existence of this class. It will call shutdown() on FileClient before it disappears. Thus FileClient must provide this shutdown method:
 public static void shutdown() {
   try {
     theFile.close();
   } catch (IOException ioe) {
     Support.errorMessage("FileClient.shutdown(): Can't close theFile.");
   }
 }