marytts.server
Class MaryProperties

java.lang.Object
  extended by marytts.server.MaryProperties

public class MaryProperties
extends java.lang.Object

A static class reading once, at program start, properties from a number of external property files, and providing them via static getter methods to anyone wishing to read them. At program start, this will read all the config files in the MARY_BASE/conf directory that end in *.config. See the config files for more information.

Author:
Marc Schröder

Constructor Summary
MaryProperties()
           
 
Method Summary
static java.util.Vector<java.lang.String> effectClasses()
          Names of the classes to use as audio effects.
static java.util.Vector<java.lang.String> effectHelpTexts()
          Help text of audio effects.
static java.util.Vector<java.lang.String> effectNames()
          Names of audio effects.
static java.util.Vector<java.lang.String> effectSampleParams()
          Sample Parameters of audio effects.
static boolean getAutoBoolean(java.lang.String property)
          Get or infer a boolean property from the underlying properties.
static boolean getAutoBoolean(java.lang.String property, boolean defaultValue)
          Get or infer a boolean property from the underlying properties.
static boolean getBoolean(java.lang.String property)
          Get a boolean property from the underlying properties.
static boolean getBoolean(java.lang.String property, boolean defaultValue)
          Get a boolean property from the underlying properties.
static java.lang.Class getClass(java.lang.String property)
          Get a Class property from the underlying properties.
static java.lang.Class getClass(java.lang.String property, java.lang.Class defaultValue)
          Get a Class property from the underlying properties.
static java.lang.String getFilename(java.lang.String property)
          Get a filename property from the underlying properties.
static java.lang.String getFilename(java.lang.String property, java.lang.String defaultValue)
          Get a filename property from the underlying properties.
static int getInteger(java.lang.String property)
          Get an integer property from the underlying properties.
static int getInteger(java.lang.String property, int defaultValue)
          Get a property from the underlying properties.
static java.lang.String getProperty(java.lang.String property)
          Get a property from the underlying properties.
static java.lang.String getProperty(java.lang.String property, java.lang.String defaultValue)
          Get a property from the underlying properties.
static java.lang.String localePrefix(java.util.Locale locale)
          Provide the config file prefix used for different locales in the config files.
static java.lang.Object[] localSchemas()
          An Object[] containing File objects referencing local Schema files
static java.lang.String maryBase()
          The mary base directory, e.g.
static java.util.Vector<java.lang.String> moduleInitInfo()
          Names of the classes to use as modules, plus optional parameter info.
static boolean needAutoBoolean(java.lang.String property)
          Get or infer a boolean property from the underlying properties, throwing an exception if it is not defined.
static boolean needBoolean(java.lang.String property)
          Get a boolean property from the underlying properties, throwing an exception if it is not defined.
static java.lang.Class needClass(java.lang.String property)
          Get a Class property from the underlying properties, throwing an exception if it is not defined.
static java.lang.String needFilename(java.lang.String property)
          Get a filename property from the underlying properties, throwing an exception if it is not defined.
static int needInteger(java.lang.String property)
          Get an integer property from the underlying properties, throwing an exception if it is not defined.
static java.lang.String needProperty(java.lang.String property)
          Get a property from the underlying properties, throwing an exception if it is not defined.
static void readProperties()
          Read the properties from property files and command line.
static java.util.Vector<java.lang.String> synthesizerClasses()
          Names of the classes to use as waveform synthesizers.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MaryProperties

public MaryProperties()
Method Detail

maryBase

public static java.lang.String maryBase()
The mary base directory, e.g. /usr/local/mary


moduleInitInfo

public static java.util.Vector<java.lang.String> moduleInitInfo()
Names of the classes to use as modules, plus optional parameter info.

See Also:
for details on expected format.

synthesizerClasses

public static java.util.Vector<java.lang.String> synthesizerClasses()
Names of the classes to use as waveform synthesizers.


effectClasses

public static java.util.Vector<java.lang.String> effectClasses()
Names of the classes to use as audio effects.


effectNames

public static java.util.Vector<java.lang.String> effectNames()
Names of audio effects.


effectSampleParams

public static java.util.Vector<java.lang.String> effectSampleParams()
Sample Parameters of audio effects.


effectHelpTexts

public static java.util.Vector<java.lang.String> effectHelpTexts()
Help text of audio effects.


localSchemas

public static java.lang.Object[] localSchemas()
An Object[] containing File objects referencing local Schema files


readProperties

public static void readProperties()
                           throws java.lang.Exception
Read the properties from property files and command line. Properties are read from The system properties settings have precedence, i.e. it is possible to override single config settings on the command line.
This method will also do dependency checking, and propose to download missing packages from the MARY installer.

Throws:
java.lang.Exception

getProperty

public static java.lang.String getProperty(java.lang.String property)
Get a property from the underlying properties.

Parameters:
property - the property requested
Returns:
the property value if found, null otherwise.

getBoolean

public static boolean getBoolean(java.lang.String property)
Get a boolean property from the underlying properties.

Parameters:
property - the property requested
Returns:
the boolean property value if found, false otherwise.

getAutoBoolean

public static boolean getAutoBoolean(java.lang.String property)
Get or infer a boolean property from the underlying properties. Apart from the values "true"and "false", a value "auto" is permitted; it will resolve to "true" in server mode and to "false" in non-server mode.

Parameters:
property - the property requested
Returns:
the boolean property value if found, false otherwise.

getInteger

public static int getInteger(java.lang.String property)
Get an integer property from the underlying properties.

Parameters:
property - the property requested
Returns:
the integer property value if found, -1 otherwise.

getFilename

public static java.lang.String getFilename(java.lang.String property)
Get a filename property from the underlying properties. The string MARY_BASE is replaced with the value of the property mary.base, and path separators are adapted to the current platform.

Parameters:
property - the property requested
Returns:
the filename corresponding to the property value if found, null otherwise.

getClass

public static java.lang.Class getClass(java.lang.String property)
Get a Class property from the underlying properties.

Parameters:
property - the property requested
Returns:
the Class property value if found and valid, null otherwise.

getProperty

public static java.lang.String getProperty(java.lang.String property,
                                           java.lang.String defaultValue)
Get a property from the underlying properties.

Parameters:
property - the property requested
defaultValue - the value to return if the property is not defined
Returns:
the property value if found, defaultValue otherwise.

getBoolean

public static boolean getBoolean(java.lang.String property,
                                 boolean defaultValue)
Get a boolean property from the underlying properties.

Parameters:
property - the property requested
defaultValue - the value to return if the property is not defined
Returns:
the boolean property value if found and valid, defaultValue otherwise.

getAutoBoolean

public static boolean getAutoBoolean(java.lang.String property,
                                     boolean defaultValue)
Get or infer a boolean property from the underlying properties. Apart from the values "true"and "false", a value "auto" is permitted; it will resolve to "true" in server mode and to "false" in non-server mode.

Parameters:
property - the property requested
defaultValue - the value to return if the property is not defined
Returns:
the boolean property value if found and valid, false otherwise.

getInteger

public static int getInteger(java.lang.String property,
                             int defaultValue)
Get a property from the underlying properties.

Parameters:
property - the property requested
defaultValue - the value to return if the property is not defined
Returns:
the integer property value if found and valid, defaultValue otherwise.

getFilename

public static java.lang.String getFilename(java.lang.String property,
                                           java.lang.String defaultValue)
Get a filename property from the underlying properties. The string MARY_BASE is replaced with the value of the property mary.base, and path separators are adapted to the current platform.

Parameters:
property - the property requested
defaultValue - the value to return if the property is not defined
Returns:
the filename corresponding to the property value if found, defaultValue otherwise.

getClass

public static java.lang.Class getClass(java.lang.String property,
                                       java.lang.Class defaultValue)
Get a Class property from the underlying properties.

Parameters:
property - the property requested
defaultValue - the value to return if the property is not defined
Returns:
the property value if found, defaultValue otherwise.

needProperty

public static java.lang.String needProperty(java.lang.String property)
                                     throws NoSuchPropertyException
Get a property from the underlying properties, throwing an exception if it is not defined.

Parameters:
property - the property required
Returns:
the property value
Throws:
NoSuchPropertyException - if the property is not defined.

needBoolean

public static boolean needBoolean(java.lang.String property)
                           throws NoSuchPropertyException
Get a boolean property from the underlying properties, throwing an exception if it is not defined.

Parameters:
property - the property requested
Returns:
the boolean property value
Throws:
NoSuchPropertyException - if the property is not defined.

needAutoBoolean

public static boolean needAutoBoolean(java.lang.String property)
                               throws NoSuchPropertyException
Get or infer a boolean property from the underlying properties, throwing an exception if it is not defined. Apart from the values "true"and "false", a value "auto" is permitted; it will resolve to "true" in server mode and to "false" in non-server mode.

Parameters:
property - the property requested
Returns:
the boolean property value
Throws:
NoSuchPropertyException - if the property is not defined.

needInteger

public static int needInteger(java.lang.String property)
                       throws NoSuchPropertyException
Get an integer property from the underlying properties, throwing an exception if it is not defined.

Parameters:
property - the property requested
Returns:
the integer property value
Throws:
NoSuchPropertyException - if the property is not defined.

needFilename

public static java.lang.String needFilename(java.lang.String property)
                                     throws NoSuchPropertyException
Get a filename property from the underlying properties, throwing an exception if it is not defined. The string MARY_BASE is replaced with the value of the property mary.base, and path separators are adapted to the current platform.

Parameters:
property - the property requested
Returns:
the filename corresponding to the property value
Throws:
NoSuchPropertyException - if the property is not defined or the value is not a valid filename

needClass

public static java.lang.Class needClass(java.lang.String property)
                                 throws NoSuchPropertyException
Get a Class property from the underlying properties, throwing an exception if it is not defined.

Parameters:
property - the property requested
Returns:
the Class corresponding to the property value
Throws:
NoSuchPropertyException - if the property is not defined or the value is not a valid class

localePrefix

public static java.lang.String localePrefix(java.util.Locale locale)
Provide the config file prefix used for different locales in the config files. Will return the string representation of the locale as produced by locale.toString(), e.g. "en_GB"; if locale is null, return null.

Parameters:
locale -
Returns: