org.eigenbase.util
Class SaffronProperties

java.lang.Object
  extended by java.util.Dictionary<K,V>
      extended by java.util.Hashtable<Object,Object>
          extended by java.util.Properties
              extended by org.eigenbase.util.SaffronProperties
All Implemented Interfaces:
Serializable, Cloneable, Map<Object,Object>

public class SaffronProperties
extends Properties

Provides an environment for debugging information, et cetera, used by saffron.

getIntProperty(java.lang.String) and getBooleanProperty(java.lang.String) are convenience methods.

It is a singleton, accessed via the instance() method. It is populated from System properties if saffron is invoked via a main() method, from a javax.servlet.ServletContext if saffron is invoked from a servlet, and so forth. If there is a file called "saffron.properties" in the current directory, it is read too.

Every property used in saffron code must have a member in this class. The member must be public and final, and be of type Property or some subtype. The javadoc comment must describe the name of the property (for example, "net.sf.saffron.connection.PoolSize") and the default value, if any. Developers, please make sure that this remains so!

See Also:
Serialized Form

Field Summary
 BooleanProperty allowInfiniteCostConverters
          The boolean property "saffron.opt.allowInfiniteCostConverters" determines whether the optimizer will consider adding converters of infinite cost in order to convert a relational expression from one calling convention to another.
 StringProperty classDir
          The string property "saffron.class.dir" is the path of the directory to compile classes to.
 IntegerProperty debugLevel
          The integer property "saffron.debug.level" determines how much debugging information is printed.
 StringProperty debugOut
          The string property "saffron.debug.out" is the name of the file to send debugging information to.
 StringProperty defaultCharset
          The string property "saffron.default.charset" is the name of the default character set.
 StringProperty defaultCollation
          The string property "saffron.default.collation.name" is the name of the default collation.
 StringProperty defaultCollationStrength
          The string property "saffron.default.collation.strength" is the strength of the default collation.
 StringProperty defaultNationalCharset
          The string property "saffron.default.nationalcharset" is the name of the default national character set which is used with the N'string' construct which may or may not be different from the defaultCharset.
 BooleanProperty generateCalcProgramComments
          The boolean property "saffron.calc.comments.generate" determines if to generate comments in calculator programs in order to make debugging easier.
 StringProperty javaCompilerArgs
          The string property "saffron.java.compiler.args" is the argument string for the java compiler.
 StringProperty javaCompilerClass
          The string property "saffron.java.compiler.class" is the name of the Java compiler to use.
 StringProperty javaDir
          The string property "saffron.java.dir" is the directory to generate temporary java files to.
 StringProperty packageName
          The string property "saffron.package.name" is the package in which to include temporary classes.
 BooleanProperty printBeforeCompile
          The boolean property "saffron.Statement.printBeforeCompile" controls whether Statement prints the statement before compiling it.
private static SaffronProperties properties
          The singleton properties object.
 BooleanProperty stupid
          The boolean property "saffron.stupid" determines whether to optimize variable assignments.
 StringProperty testClass
          The string property "saffron.test.Class" is used by FarragoTestCase to filter tests.
 BooleanProperty testEverything
          The string property "saffron.test.everything" is used by FarragoTestCase to filter tests.
 StringProperty testJdbcDrivers
          The string property "saffron.test.jdbc.drivers" is a comma-separated list of class names to be used as JDBC drivers.
 StringProperty testJdbcUrl
          The string property "saffron.test.jdbc.url" is the URL of the JDBC database which contains the EMP and DEPT tables used for testing.
 StringProperty testName
          The string property "saffron.test.Name" is used by FarragoTestCase to filter tests.
 StringProperty testSuite
          The string property "saffron.test.Suite" is used by FarragoTestCase to filter tests.
 
Fields inherited from class java.util.Properties
defaults
 
Constructor Summary
private SaffronProperties()
          This constructor is private; please use instance() to create a SaffronProperties.
 
Method Summary
 boolean getBooleanProperty(String key)
          Retrieves a boolean property.
 boolean getBooleanProperty(String key, boolean defaultValue)
          Retrieves a boolean property, or a default value if the property does not exist.
 int getIntProperty(String key)
          Retrieves an integer property.
static SaffronProperties instance()
          Retrieves the singleton instance of SaffronProperties.
 void loadSaffronProperties(Properties source)
          Adds all saffron-related properties found in the source list.
 
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

properties

private static SaffronProperties properties
The singleton properties object.


classDir

public final StringProperty classDir
The string property "saffron.class.dir" is the path of the directory to compile classes to.


printBeforeCompile

public final BooleanProperty printBeforeCompile
The boolean property "saffron.Statement.printBeforeCompile" controls whether Statement prints the statement before compiling it.


javaCompilerClass

public final StringProperty javaCompilerClass
The string property "saffron.java.compiler.class" is the name of the Java compiler to use. It must implement JavaCompiler. The default value is "JP.ac.tsukuba.openjava.SunJavaCompiler".


packageName

public final StringProperty packageName
The string property "saffron.package.name" is the package in which to include temporary classes. The default is "saffron.runtime".


javaDir

public final StringProperty javaDir
The string property "saffron.java.dir" is the directory to generate temporary java files to. The default is the class root.


javaCompilerArgs

public final StringProperty javaCompilerArgs
The string property "saffron.java.compiler.args" is the argument string for the java compiler. JavaCompilerArgs.setString(java.lang.String) describes how these arguments are interpreted.


stupid

public final BooleanProperty stupid
The boolean property "saffron.stupid" determines whether to optimize variable assignments. If it is true, records are assigned to a variable even if they are never used. Default is false.


debugLevel

public final IntegerProperty debugLevel
The integer property "saffron.debug.level" determines how much debugging information is printed. The default, 0, means no debugging.


debugOut

public final StringProperty debugOut
The string property "saffron.debug.out" is the name of the file to send debugging information to. "out" (the default), means send to System.out; "err" means send to System.err.


testName

public final StringProperty testName
The string property "saffron.test.Name" is used by FarragoTestCase to filter tests.


testClass

public final StringProperty testClass
The string property "saffron.test.Class" is used by FarragoTestCase to filter tests.


testSuite

public final StringProperty testSuite
The string property "saffron.test.Suite" is used by FarragoTestCase to filter tests.


testEverything

public final BooleanProperty testEverything
The string property "saffron.test.everything" is used by FarragoTestCase to filter tests.


testJdbcUrl

public final StringProperty testJdbcUrl
The string property "saffron.test.jdbc.url" is the URL of the JDBC database which contains the EMP and DEPT tables used for testing.


testJdbcDrivers

public final StringProperty testJdbcDrivers
The string property "saffron.test.jdbc.drivers" is a comma-separated list of class names to be used as JDBC drivers.


allowInfiniteCostConverters

public final BooleanProperty allowInfiniteCostConverters
The boolean property "saffron.opt.allowInfiniteCostConverters" determines whether the optimizer will consider adding converters of infinite cost in order to convert a relational expression from one calling convention to another. The default value is true.


defaultCharset

public final StringProperty defaultCharset
The string property "saffron.default.charset" is the name of the default character set. The default is "ISO-8859-1". It is used in SqlValidator.


defaultNationalCharset

public final StringProperty defaultNationalCharset
The string property "saffron.default.nationalcharset" is the name of the default national character set which is used with the N'string' construct which may or may not be different from the defaultCharset. The default is "ISO-8859-1". It is used in SqlLiteral.SqlLiteral(java.lang.Object, org.eigenbase.sql.type.SqlTypeName, org.eigenbase.sql.parser.SqlParserPos)


defaultCollation

public final StringProperty defaultCollation
The string property "saffron.default.collation.name" is the name of the default collation. The default is "ISO-8859-1$en_US". Used in SqlCollation and SqlLiteral.SqlLiteral(java.lang.Object, org.eigenbase.sql.type.SqlTypeName, org.eigenbase.sql.parser.SqlParserPos)


defaultCollationStrength

public final StringProperty defaultCollationStrength
The string property "saffron.default.collation.strength" is the strength of the default collation. The default is "primary". Used in SqlCollation and SqlLiteral.SqlLiteral(java.lang.Object, org.eigenbase.sql.type.SqlTypeName, org.eigenbase.sql.parser.SqlParserPos)


generateCalcProgramComments

public final BooleanProperty generateCalcProgramComments
The boolean property "saffron.calc.comments.generate" determines if to generate comments in calculator programs in order to make debugging easier. The default is "true". Used in SqlCollation and SqlLiteral.SqlLiteral(java.lang.Object, org.eigenbase.sql.type.SqlTypeName, org.eigenbase.sql.parser.SqlParserPos)

Constructor Detail

SaffronProperties

private SaffronProperties()
This constructor is private; please use instance() to create a SaffronProperties.

Method Detail

instance

public static SaffronProperties instance()
Retrieves the singleton instance of SaffronProperties.


loadSaffronProperties

public void loadSaffronProperties(Properties source)
Adds all saffron-related properties found in the source list. This means all properties whose names start with "saffron." or "net.sf.saffron." The added properties can replace existing properties.

Parameters:
source - a Properties list

getBooleanProperty

public boolean getBooleanProperty(String key)
Retrieves a boolean property. Returns true if the property exists, and its value is 1, true or yes; returns false otherwise.


getBooleanProperty

public boolean getBooleanProperty(String key,
                                  boolean defaultValue)
Retrieves a boolean property, or a default value if the property does not exist. Returns true if the property exists, and its value is 1, true or yes; the default value if it does not exist; false otherwise.


getIntProperty

public int getIntProperty(String key)
Retrieves an integer property. Returns -1 if the property is not found, or if its value is not an integer.