public class ApplicationSetup extends Object
This class retrieves and provides access
to all the constants and parameters for
the system. When it is statically initialised,
it loads the properties file specified by the system property
terrier.setup. If this is not specified, then the default value is
the value of the terrier.home system property, appended by etc/terrier.properties.
eg java -Dterrier.home=$TERRIER_HOME -Dterrier.setup=$TERRIER_HOME/etc/terrier.properties TrecTerrier
System Properties used:
terrier.setup | Specifies where the terrier.properties file can be found. |
terrier.home | Specified where Terrier has been installed, if the terrier.properties
file cannot be found, or the terrier.properties file does not specify the terrier.home in it.
NB:In the future, this may further default to $TERRIER_HOME from the environment. |
file.separator | What separates directory names in this platform. Set automatically by Java |
line.separator | What separates lines in a file on this platform. Set automatically by Java |
In essence, for Terrier to function properly, you need to specify one of the following on the command line:
Any property defined in the properties file can be overridden as follows:
Modifier and Type | Class and Description |
---|---|
static interface |
ApplicationSetup.TerrierApplicationPlugin
Interface for plugins.
|
Modifier and Type | Field and Description |
---|---|
protected static Properties |
appProperties
The properties object in which the
properties from the file are read.
|
static boolean |
BLOCK_INDEXING
Specifies whether block information will
be used for indexing.
|
static int |
BLOCK_SIZE
The size of a block of terms in a document.
|
static String |
COLLECTION_SPEC
The name of the file that contains the
list of resources to be processed during indexing.
|
static String |
DEFAULT_LOG4J_CONFIG
Default log4j config Terrier loads if no TERRIER_ETC/terrier-log.xml file exists
|
static int |
DOCS_CHECK_SINGLEPASS
Number of documents between each memory check in the single pass inversion method.
|
static String |
EOL
The new line character used by the operating system.
|
static int |
EXPANSION_DOCUMENTS
The number of top ranked documents considered for
expanding the query.
|
static String |
EXPANSION_MODELS
Deprecated.
As of Terrier 3.5
The name of the file which contains the query expansion
methods used. The corresponding property is
expansion.models and the default
value is qemodels. If a relative path is given,
it is prefixed with TERRIER_ETC.
|
static int |
EXPANSION_TERMS
The number of terms added to the original query.
|
static boolean |
FIELD_QUERYING
Specifies whether fields will be used for querying.
|
static String |
FILE_SEPARATOR
The file separator used by the operating system.
|
static boolean |
IGNORE_EMPTY_DOCUMENTS
Ignore or not empty documents.
|
protected static List<ApplicationSetup.TerrierApplicationPlugin> |
loadedPlugins
list of loaded plugins
|
static String |
LOG4J_CONFIG
The configuration file used by log4j
|
static int |
MAX_BLOCKS
The maximum number of blocks in a document.
|
static int |
MAX_TERM_LENGTH
The maximum size of a term.
|
static int |
MEMORY_THRESHOLD_SINGLEPASS
Memory threshold in the single pass inversion method.
|
static String |
TERRIER_ETC
The directory under which the configuration files
of Terrier are stored.
|
static String |
TERRIER_HOME
The directory under which the application is installed.
|
static String |
TERRIER_INDEX_PATH
The name of the directory where the inverted
file and other data structures are stored.
|
static String |
TERRIER_INDEX_PREFIX
The prefix of the data structures' filenames.
|
static String |
TERRIER_SHARE
The name of the directory where installation independent
read-only data is stored.
|
static String |
TERRIER_VAR
The name of the directory where the data structures
and the output of Terrier are stored.
|
static String |
TERRIER_VERSION
Current Terrier version
|
static String |
TREC_MODELS
Deprecated.
As of Terrier 3.5
The filename of the file that contains
the weighting models to be used. The corresponding
property is trec.models and the default value
is trec.models. If a relative path is given, then
it is prefixed with TERRIER_ETC.
|
static String |
TREC_QRELS
Deprecated.
As of Terrier 3.5
The name of the file that contains a list of qrels files
to be used for evaluation. The corresponding property is
trec.qrels and its default value is trec.qrels.
If a relative path is given, TERRIER_ETC will be prefixed.
|
static String |
TREC_RESULTS
The name of the directory where the results
are stored.
|
static String |
TREC_RESULTS_SUFFIX
The suffix of the files, where the results are stored.
|
static String |
TREC_TOPICS_LIST
Deprecated.
As of Terrier 3.5
The name of the file that contains a list of
files where queries are stored. The corresponding property
is trec.topics.list and the default value
is trec.topics.list. If a relative path is given,
TERRIER_ETC will be prefixed.
|
protected static Properties |
UsedAppProperties |
Constructor and Description |
---|
ApplicationSetup() |
Modifier and Type | Method and Description |
---|---|
static void |
bootstrapInitialisation()
forces ApplicatinSetup initilisation
|
static void |
clearAllProperties()
Clears ApplicationSetup of all properties
|
static void |
configure(InputStream propertiesStream)
Loads the common Terrier properties from the specified InputStream
|
ApplicationSetup.TerrierApplicationPlugin |
getPlugin(String name)
Return a loaded plugin by name.
|
static Properties |
getProperties()
Returns the underlying properties object for ApplicationSetup
|
static String |
getProperty(String propertyKey,
String defaultValue)
Returns the value for the specified property, given
a default value, in case the property was not defined
during the initialization of the system.
|
static Properties |
getUsedProperties()
Returns a properties object detailing all the properties fetched during the lifetime of this class.
|
static void |
loadCommonProperties()
Loads the ApplicationSetup variables, e.g.
|
static String |
makeAbsolute(String filename,
String DefaultPath)
Checks whether the given filename is absolute and if not, it
adds on the default path to make it absolute.
|
static void |
setDefaultProperty(String propertyKey,
String defaultValue)
set a property value only if it has not already been set
|
static void |
setProperty(String propertyKey,
String value)
Sets a value for the specified property.
|
protected static void |
setupPlugins()
Calls the initialise method of any plugins named in terrier.plugins
|
public static final String TERRIER_VERSION
public static final String DEFAULT_LOG4J_CONFIG
protected static final Properties appProperties
protected static final Properties UsedAppProperties
public static String FILE_SEPARATOR
public static String EOL
public static String TERRIER_HOME
public static String TERRIER_ETC
public static String TERRIER_SHARE
public static String TERRIER_VAR
public static String TERRIER_INDEX_PATH
public static String COLLECTION_SPEC
public static String TREC_RESULTS
public static String TREC_TOPICS_LIST
public static String TREC_QRELS
public static String TREC_RESULTS_SUFFIX
public static String TREC_MODELS
public static int MAX_TERM_LENGTH
public static boolean IGNORE_EMPTY_DOCUMENTS
public static String TERRIER_INDEX_PREFIX
public static int EXPANSION_TERMS
public static int EXPANSION_DOCUMENTS
public static String EXPANSION_MODELS
public static int BLOCK_SIZE
public static int MAX_BLOCKS
public static boolean BLOCK_INDEXING
public static boolean FIELD_QUERYING
public static int MEMORY_THRESHOLD_SINGLEPASS
public static int DOCS_CHECK_SINGLEPASS
public static String LOG4J_CONFIG
protected static List<ApplicationSetup.TerrierApplicationPlugin> loadedPlugins
public static void bootstrapInitialisation()
public static void loadCommonProperties()
public static void configure(InputStream propertiesStream) throws IOException
IOException
public static String getProperty(String propertyKey, String defaultValue)
propertyKey
- The property to be returneddefaultValue
- The default value used, in case it is not definedpublic static Properties getUsedProperties()
public static Properties getProperties()
public static void setProperty(String propertyKey, String value)
propertyKey
- the name of the property to set.value
- the value of the property to set.public static void setDefaultProperty(String propertyKey, String defaultValue)
propertyKey
- the name of the property to set.defaultValue
- the value of the property to set.protected static void setupPlugins()
public ApplicationSetup.TerrierApplicationPlugin getPlugin(String name)
public static String makeAbsolute(String filename, String DefaultPath)
filename
- String the filename to make absoluteDefaultPath
- String the prefix to addpublic static void clearAllProperties()
Terrier 4.0. Copyright © 2004-2014 University of Glasgow