anl.aida
Class Configurator

java.lang.Object
  extended by anl.aida.Configurator

public class Configurator
extends java.lang.Object

Retreives a configuration and sets the UIMA CPE parameters appropriately.


Field Summary
private static java.lang.String CACHE_CREATE_KEY
           
private static java.lang.String CACHE_DIR_KEY
           
private static java.lang.String CACHE_FILTER_KEY
           
private static java.lang.String CACHE_LENGTH_KEY
           
private static java.lang.String CACHE_START_DATE_KEY
           
private static java.lang.String CACHE_TS_DAYS_KEY
           
private static java.lang.String GAPP_FILE_KEY
           
private static java.lang.String GATE_GAZETTEER_KEY
           
private static java.lang.String GATE_HOME_KEY
           
private static java.lang.String GATE_JAPE_KEY
           
private static java.lang.String GATE_MAPPING_KEY
           
private static java.lang.String GAZETTEER_KEY
           
private static Configurator instance
           
private static java.lang.String JAPE_KEY
           
private static java.lang.String LUCENE_INDEX_KEY
           
private static java.lang.String LUCENE_MAPPING_KEY
           
private static java.lang.String OVERWRITE_INDEX_KEY
           
private  java.util.Properties props
           
private static java.lang.String READER_NAMES_KEY
           
private static java.lang.String READER_PROP_PREFIX
           
private  java.util.List<java.lang.String> readerClassNames
           
private  java.util.List<Pair<java.lang.String,java.lang.String>> readerProperties
           
 
Constructor Summary
private Configurator(java.lang.String configFile)
           
 
Method Summary
 void configure(org.apache.uima.collection.metadata.CpeDescription desc)
          Configures the specified CPE using the specified config file.
private  void copyFiles()
           
static Configurator getConfigurator()
           
static Configurator init(java.lang.String configFile)
          Initializes this Configurator with the specified config file.
private  void initFileProps(java.io.File configDirectory)
           
private  void initReaderProps()
           
 java.lang.Iterable<java.lang.String> readerClassNames()
          Gets an interable over the class names of the component readers to use to create the cache.
 java.lang.Iterable<Pair<java.lang.String,java.lang.String>> readerProperties()
          Gets an iterable over the reader configuration properties.
private  java.lang.String reifyVariable(java.lang.String name, java.lang.String value, java.util.Set<java.lang.String> workingProps)
           
private  void replaceVars()
           
private  java.lang.String transformPath(java.io.File configDir, java.lang.String val)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

GAPP_FILE_KEY

private static java.lang.String GAPP_FILE_KEY

GATE_MAPPING_KEY

private static java.lang.String GATE_MAPPING_KEY

GATE_HOME_KEY

private static java.lang.String GATE_HOME_KEY

GATE_JAPE_KEY

private static java.lang.String GATE_JAPE_KEY

GATE_GAZETTEER_KEY

private static java.lang.String GATE_GAZETTEER_KEY

LUCENE_INDEX_KEY

private static java.lang.String LUCENE_INDEX_KEY

LUCENE_MAPPING_KEY

private static java.lang.String LUCENE_MAPPING_KEY

OVERWRITE_INDEX_KEY

private static java.lang.String OVERWRITE_INDEX_KEY

CACHE_DIR_KEY

private static java.lang.String CACHE_DIR_KEY

CACHE_CREATE_KEY

private static java.lang.String CACHE_CREATE_KEY

CACHE_START_DATE_KEY

private static java.lang.String CACHE_START_DATE_KEY

CACHE_LENGTH_KEY

private static java.lang.String CACHE_LENGTH_KEY

CACHE_TS_DAYS_KEY

private static java.lang.String CACHE_TS_DAYS_KEY

CACHE_FILTER_KEY

private static java.lang.String CACHE_FILTER_KEY

READER_NAMES_KEY

private static java.lang.String READER_NAMES_KEY

READER_PROP_PREFIX

private static java.lang.String READER_PROP_PREFIX

JAPE_KEY

private static java.lang.String JAPE_KEY

GAZETTEER_KEY

private static java.lang.String GAZETTEER_KEY

instance

private static Configurator instance

props

private java.util.Properties props

readerClassNames

private java.util.List<java.lang.String> readerClassNames

readerProperties

private java.util.List<Pair<java.lang.String,java.lang.String>> readerProperties
Constructor Detail

Configurator

private Configurator(java.lang.String configFile)
              throws java.io.IOException
Throws:
java.io.IOException
Method Detail

init

public static Configurator init(java.lang.String configFile)
                         throws java.io.IOException
Initializes this Configurator with the specified config file.

Parameters:
configFile - the file to read config info from
Returns:
the initialized Configurator.
Throws:
java.io.IOException - if there is an error rading the config file.

getConfigurator

public static Configurator getConfigurator()

replaceVars

private void replaceVars()
                  throws java.io.IOException
Throws:
java.io.IOException

reifyVariable

private java.lang.String reifyVariable(java.lang.String name,
                                       java.lang.String value,
                                       java.util.Set<java.lang.String> workingProps)
                                throws java.io.IOException
Throws:
java.io.IOException

initReaderProps

private void initReaderProps()
                      throws java.io.IOException
Throws:
java.io.IOException

initFileProps

private void initFileProps(java.io.File configDirectory)
                    throws java.io.IOException
Throws:
java.io.IOException

transformPath

private java.lang.String transformPath(java.io.File configDir,
                                       java.lang.String val)
                                throws java.io.IOException
Throws:
java.io.IOException

readerClassNames

public java.lang.Iterable<java.lang.String> readerClassNames()
Gets an interable over the class names of the component readers to use to create the cache. These names are pulled from the config file.

Returns:
an interable over the class names of the component readers to use to create the cache.

readerProperties

public java.lang.Iterable<Pair<java.lang.String,java.lang.String>> readerProperties()
Gets an iterable over the reader configuration properties. A reader configuration properties is an property in the config file prefixed with reader.property.

Returns:
an iterable over the reader configuration properties.

copyFiles

private void copyFiles()
                throws java.io.IOException
Throws:
java.io.IOException

configure

public void configure(org.apache.uima.collection.metadata.CpeDescription desc)
               throws java.io.IOException,
                      org.apache.uima.collection.metadata.CpeDescriptorException
Configures the specified CPE using the specified config file.

Parameters:
desc - the CpeDescription to configure
Throws:
java.io.IOException
org.apache.uima.collection.metadata.CpeDescriptorException