net.sf.farrago.util
Class FarragoProperties

java.lang.Object
  extended by java.util.Dictionary<K,V>
      extended by java.util.Hashtable<Object,Object>
          extended by java.util.Properties
              extended by net.sf.farrago.util.FarragoProperties
All Implemented Interfaces:
Serializable, Cloneable, Map<Object,Object>

public class FarragoProperties
extends Properties

Provides the properties which control limited aspects of Farrago behavior. In most cases, Farrago behavior should be controlled by defining configuration parameters in the catalog, NOT by defining properties here. Java properties should only be used for controlling bootstrap behavior (before the catalog becomes available) or internals which don't belong as parameters (e.g. tweaks for controlling test behavior). As a gentle hint to keep properties to a minimum, we intentionally make it difficult to set them. How? By not defining a master Farrago .properties file. Instead, runtime and build scripts set just the properties they need on the command line.

Version:
$Id: //open/dev/farrago/src/net/sf/farrago/util/FarragoProperties.java#21 $
Author:
John V. Sichi
See Also:
Serialized Form

Field Summary
 StringProperty catalogDir
          The optional string property "net.sf.farrago.catalog" is the path to the Farrago repository directory.
 StringProperty defaultSessionFactoryLibraryName
          The optional string property "net.sf.farrago.defaultSessionFactoryLibraryName" is the name of the plugin library to use for the default session factory.
 StringProperty homeDir
          The string property "net.sf.farrago.home" is the path to the Farrago installation directory.
private static FarragoProperties instance
           
private static String PROPERTY_EXPANSION_PATTERN
           
 StringProperty testFilesetConcurrent
          The string property "net.sf.farrago.fileset.concurrentsql" specifies a newline-separated list of concurrency test SQL script files to run.
 StringProperty testFilesetRegression
          The string property "net.sf.farrago.fileset.regressionsql" specifies a newline-separated list of regression test SQL script files to run.
 StringProperty testFilesetUnitlurql
          The string property "org.eigenbase.fileset.unitlurql" specifies a newline-separated list of LURQL test script files to run.
 StringProperty testFilesetUnitsql
          The string property "net.sf.farrago.fileset.unitsql" specifies a newline-separated list of unit test SQL script files to run.
 StringProperty testJdbcDriverClass
          The string property "net.sf.farrago.test.jdbcDriverClass" specifies the fully qualified name of the JDBC driver to use during testing.
 BooleanProperty testTableReloadCrash
          The boolean property "net.sf.farrago.ddl.DdlReloadTableStmt.crash" causes ALTER TABLE to fail in a mode which simultates a database crash.
 IntegerProperty testTableReloadSleep
          The integer property "net.sf.farrago.ddl.DdlReloadTableStmt.sleep" specifies (if set) the number of milliseconds that ALTER TABLE should sleep after taking locks and before executing.
 StringProperty traceConfigFile
          The string property "java.util.logging.config.file" is the path to the Farrago trace configuration file.
 
Fields inherited from class java.util.Properties
defaults
 
Constructor Summary
private FarragoProperties()
           
 
Method Summary
 String expandProperties(String value)
          Expands properties embedded in the given String.
 File getCatalogDir()
           
static FarragoProperties instance()
           
static FarragoProperties newInstance()
          WARNING: in most cases you should be using the singleton instance instead.
 
Methods inherited from class java.util.Properties
getProperty, getProperty, list, list, load, loadFromXML, propertyNames, save, setProperty, store, storeToXML, storeToXML
 
Methods inherited from class java.util.Hashtable
clear, clone, contains, containsKey, containsValue, elements, entrySet, equals, get, hashCode, isEmpty, keys, keySet, put, putAll, rehash, remove, size, toString, values
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

instance

private static FarragoProperties instance

PROPERTY_EXPANSION_PATTERN

private static final String PROPERTY_EXPANSION_PATTERN
See Also:
Constant Field Values

traceConfigFile

public final StringProperty traceConfigFile
The string property "java.util.logging.config.file" is the path to the Farrago trace configuration file.


homeDir

public final StringProperty homeDir
The string property "net.sf.farrago.home" is the path to the Farrago installation directory.


catalogDir

public final StringProperty catalogDir
The optional string property "net.sf.farrago.catalog" is the path to the Farrago repository directory. See also getCatalogDir()


defaultSessionFactoryLibraryName

public final StringProperty defaultSessionFactoryLibraryName
The optional string property "net.sf.farrago.defaultSessionFactoryLibraryName" is the name of the plugin library to use for the default session factory. Defaults to FarragoDefaultSessionFactory.


testJdbcDriverClass

public final StringProperty testJdbcDriverClass
The string property "net.sf.farrago.test.jdbcDriverClass" specifies the fully qualified name of the JDBC driver to use during testing. If not specified, FarragoJdbcEngineDriver is used.


testFilesetUnitsql

public final StringProperty testFilesetUnitsql
The string property "net.sf.farrago.fileset.unitsql" specifies a newline-separated list of unit test SQL script files to run.


testFilesetRegression

public final StringProperty testFilesetRegression
The string property "net.sf.farrago.fileset.regressionsql" specifies a newline-separated list of regression test SQL script files to run.


testFilesetConcurrent

public final StringProperty testFilesetConcurrent
The string property "net.sf.farrago.fileset.concurrentsql" specifies a newline-separated list of concurrency test SQL script files to run.


testFilesetUnitlurql

public final StringProperty testFilesetUnitlurql
The string property "org.eigenbase.fileset.unitlurql" specifies a newline-separated list of LURQL test script files to run.


testTableReloadSleep

public final IntegerProperty testTableReloadSleep
The integer property "net.sf.farrago.ddl.DdlReloadTableStmt.sleep" specifies (if set) the number of milliseconds that ALTER TABLE should sleep after taking locks and before executing. This is a trap intended solely for test instrumentation.


testTableReloadCrash

public final BooleanProperty testTableReloadCrash
The boolean property "net.sf.farrago.ddl.DdlReloadTableStmt.crash" causes ALTER TABLE to fail in a mode which simultates a database crash.

Constructor Detail

FarragoProperties

private FarragoProperties()
Method Detail

instance

public static FarragoProperties instance()
Returns:
the singleton properties object, constructed from System.getProperties().

newInstance

public static FarragoProperties newInstance()
WARNING: in most cases you should be using the singleton instance instead.

Returns:
a new instance of FarragoProperties

getCatalogDir

public File getCatalogDir()
Returns:
the directory containing the Farrago repos files; equivalent to catalogDir if set, otherwise the "catalog" subdirectory of homeDir

expandProperties

public String expandProperties(String value)
Expands properties embedded in the given String. Property names are encoded as in Ant: ${propertyName}. Property names must match the Pattern \w character class ([a-zA-z_0-9]); groups of characters may be separated by periods (such as net.sf.farrago.home).

References to unknown or undefined properties are not modified (e.g., the expansion of "${UNKNOWN}" is "${UNKNOWN}").

Currently, two special properties are supported:

All other tokens are used as keys to property values in this object.

Parameters:
value - a value that may or may not contain property names to be expanded.
Returns:
the value parameter with its property references expanded -- returns value if no known property references are found