Class ServerProperties

java.lang.Object
org.hsqldb.server.ServerProperties

public class ServerProperties extends Object
A subclass HsqlProperties with functionality needed for the HSQLDB Server implementations.

A property object is checked once and all the errors are stored in collections to be used Meta records specify accepted keys and policies for the expected values.

Policy for defaults:

  • If (non-null) default is specified for the Meta record, then behavior is obvious.
  • If pattern-type Meta record, then there is no default. A value is required for the property.
  • Otherwise null is specified for the Meta record and user must set a value.
If a range is specified in the Meta record, then the value is checked against the range.

If a set of values specified in the Meta record, then the value is checked against the set.

Since:
1.9.0
Author:
Fred Toussi (fredt@users dot sourceforge.net)
  • Field Details

  • Constructor Details

  • Method Details

    • validate

      public void validate()
      Validates according to Meta map, and sets System Properties for those properties with names matching the requisite pattern.
    • setFileName

      public void setFileName(String name)
    • setProperty

      public String setProperty(String key, int value)
    • setProperty

      public String setProperty(String key, boolean value)
    • setProperty

      public String setProperty(String key, String value)
    • setPropertyIfNotExists

      public String setPropertyIfNotExists(String key, String value)
    • getProperties

      public Properties getProperties()
    • getProperty

      public String getProperty(String key)
    • getProperty

      public String getProperty(String key, String defaultValue)
    • getIntegerProperty

      public int getIntegerProperty(String key, int defaultValue)
    • getIntegerProperty

      public static int getIntegerProperty(Properties props, String key, int defaultValue)
    • isPropertyTrue

      public boolean isPropertyTrue(String key)
    • isPropertyTrue

      public boolean isPropertyTrue(String key, boolean defaultValue)
    • removeProperty

      public void removeProperty(String key)
    • addProperties

      public void addProperties(Properties props)
    • addProperties

      public void addProperties(org.hsqldb.persist.HsqlProperties props)
    • propertiesFileExists

      public boolean propertiesFileExists()
    • load

      public boolean load() throws Exception
      Throws:
      Exception
    • save

      public void save() throws Exception
      Saves the properties.
      Throws:
      Exception
    • save

      public void save(String fileString) throws Exception
      Saves the properties
      Throws:
      Exception
    • argArrayToProps

      public static org.hsqldb.persist.HsqlProperties argArrayToProps(String[] arg, String type)
      Creates and populates an HsqlProperties Object from the arguments array of a Main method. Properties are in the form of "-key value" pairs. Each key is prefixed with the type argument and a dot before being inserted into the properties Object.

      "--help" is treated as a key with no value and not inserted.

    • delimitedArgPairsToProps

      public static org.hsqldb.persist.HsqlProperties delimitedArgPairsToProps(String s, String pairsep, String dlimiter, String type)
      Creates and populates a new HsqlProperties Object using a string such as "key1=value1;key2=value2".

      The string that represents the = sign above is specified as pairsep and the one that represents the semicolon is specified as delimiter, allowing any string to be used for either.

      Leading / trailing spaces around the keys and values are discarded.

      The string is parsed by (1) subdividing into segments by delimiter (2) subdividing each segment in two by finding the first instance of the pairsep (3) trimming each pair of segments from step 2 and inserting into the properties object.

      Each key is prefixed with the type argument and a dot before being inserted.

      Any key without a value is added to the list of errors.

    • propertyNames

      public Enumeration propertyNames()
    • isEmpty

      public boolean isEmpty()
    • getErrorKeys

      public String[] getErrorKeys()
    • newMeta

      public static org.hsqldb.persist.HsqlProperties.PropertyMeta newMeta(String name, int type, long defaultVal)
    • newMeta

      public static org.hsqldb.persist.HsqlProperties.PropertyMeta newMeta(String name, int type, String defaultValue)
    • newMeta

      public static org.hsqldb.persist.HsqlProperties.PropertyMeta newMeta(String name, int type, String defaultValue, String[] options)
    • newMeta

      public static org.hsqldb.persist.HsqlProperties.PropertyMeta newMeta(String name, int type, boolean defaultValue)
    • newMeta

      public static org.hsqldb.persist.HsqlProperties.PropertyMeta newMeta(String name, int type, int defaultValue, int[] values)
    • newMeta

      public static org.hsqldb.persist.HsqlProperties.PropertyMeta newMeta(String name, int type, int defaultValue, int rangeLow, int rangeHigh)
    • validateProperty

      public static String validateProperty(String key, String value, org.hsqldb.persist.HsqlProperties.PropertyMeta meta)
      Performs any range checking for property and return an error message
    • toString

      public String toString()
      Overrides:
      toString in class Object