saffron.util
Class SaffronProperties

java.lang.Object
  |
  +--java.util.Dictionary
        |
        +--java.util.Hashtable
              |
              +--java.util.Properties
                    |
                    +--saffron.util.SaffronProperties
All Implemented Interfaces:
Cloneable, Map, Serializable

public class SaffronProperties
extends Properties

SaffronProperties 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.

For each property "saffron.foo.bar" used in saffron code, there should be a String constant called PROPERTY_saffron_foo_bar in this class. The javadoc comment should link to the piece of code which uses that property. (Developers, please make sure that this remains so!)

See Also:
Serialized Form

Field Summary
private static SaffronProperties properties
          The singleton properties object.
static String PROPERTY_saffron_class_dir
          The ""saffron.class.dir"" property is where to compile classes to.
static String PROPERTY_saffron_debug_level
          The integer property ""saffron.debug.level"" determines how much debugging information is printed.
static String PROPERTY_saffron_debug_out
          The string property ""saffron.debug.out"" is the name of the file to send debugging information to.
static String PROPERTY_saffron_java_compiler_args
          The string property ""saffron.java.compiler.args"" is the argument string for the java compiler.
static String PROPERTY_saffron_java_compiler_class
          The property ""saffron.java.compiler.class"" is the name of the Java compiler to use.
static String PROPERTY_saffron_java_compiler_class_DEFAULT
          Default value for PROPERTY_saffron_java_compiler_class (""JP.ac.tsukuba.openjava.SunJavaCompiler"").
static String PROPERTY_saffron_java_dir
          The string propery ""saffron.java.dir"" is the directory to generate temporary java files to.
static String PROPERTY_saffron_package_name
          The string property ""saffron.package.name"" is the package in which to include temporary classes.
static String PROPERTY_saffron_package_name_DEFAULT
          Default value for PROPERTY_saffron_package_name (""saffron.runtime"").
static String PROPERTY_saffron_Statement_printBeforeCompile
          If the boolean property ""saffron.Statement.printBeforeCompile"" is true, Statement prints the statement to System.out before compiling it.
static String PROPERTY_saffron_stupid
          The boolean property ""saffron.stupid"" determines whether to optimize variable assignments.
static String PROPERTY_saffron_test_Class
          The string property ""saffron.test.Class"" is used by Main.suite().
static String PROPERTY_saffron_test_jdbc_drivers
          The string property ""saffron.test.jdbc.drivers"" is a comma-separated list of class names to be used as JDBC drivers.
static String PROPERTY_saffron_test_jdbc_url
          The string property ""saffron.test.jdbc.url"" is the URL of the JDBC database which contains the EMP and DEPT tables used for testing.
static String PROPERTY_saffron_test_Name
          The string property ""saffron.test.Name"" is used by Main.suite().
static String PROPERTY_saffron_test_Suite
          The string property ""saffron.test.Suite"" is used by Main.suite().
 
Fields inherited from class java.util.Properties
defaults
 
Fields inherited from class java.util.Hashtable
 
Constructor Summary
private SaffronProperties()
          Please use instance() to create a SaffronProperties.
 
Method Summary
 void apply()
          Applies properties to the right locations.
 boolean getBooleanProperty(String key)
          Retrieves a boolean property.
 int getIntProperty(String key)
          Retrieves an integer property.
static SaffronProperties instance()
          Retrieves the singleton instance of SaffronProperties.
 
Methods inherited from class java.util.Properties
getProperty, getProperty, list, list, load, propertyNames, save, setProperty, store
 
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.


PROPERTY_saffron_class_dir

public static final String PROPERTY_saffron_class_dir
The ""saffron.class.dir"" property is where to compile classes to.

See Also:
Constant Field Values

PROPERTY_saffron_Statement_printBeforeCompile

public static final String PROPERTY_saffron_Statement_printBeforeCompile
If the boolean property ""saffron.Statement.printBeforeCompile"" is true, Statement prints the statement to System.out before compiling it.

See Also:
Constant Field Values

PROPERTY_saffron_java_compiler_class

public static final String PROPERTY_saffron_java_compiler_class
The property ""saffron.java.compiler.class"" is the name of the Java compiler to use. It must implement JavaCompiler. The default value is "PROPERTY_saffron_java_compiler_class_DEFAULT".

See Also:
Constant Field Values

PROPERTY_saffron_java_compiler_class_DEFAULT

public static final String PROPERTY_saffron_java_compiler_class_DEFAULT
Default value for PROPERTY_saffron_java_compiler_class (""JP.ac.tsukuba.openjava.SunJavaCompiler"").

See Also:
Constant Field Values

PROPERTY_saffron_package_name

public static final String PROPERTY_saffron_package_name
The string property ""saffron.package.name"" is the package in which to include temporary classes. The default is PROPERTY_saffron_package_name_DEFAULT.

See Also:
Constant Field Values

PROPERTY_saffron_package_name_DEFAULT

public static final String PROPERTY_saffron_package_name_DEFAULT
Default value for PROPERTY_saffron_package_name (""saffron.runtime"").

See Also:
Constant Field Values

PROPERTY_saffron_java_dir

public static final String PROPERTY_saffron_java_dir
The string propery ""saffron.java.dir"" is the directory to generate temporary java files to. The default is the class root.

See Also:
Constant Field Values

PROPERTY_saffron_java_compiler_args

public static final String PROPERTY_saffron_java_compiler_args
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.

See Also:
Constant Field Values

PROPERTY_saffron_stupid

public static final String PROPERTY_saffron_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.

See Also:
Constant Field Values

PROPERTY_saffron_debug_level

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

See Also:
Constant Field Values

PROPERTY_saffron_debug_out

public static final String PROPERTY_saffron_debug_out
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.

See Also:
Constant Field Values

PROPERTY_saffron_test_Name

public static final String PROPERTY_saffron_test_Name
The string property ""saffron.test.Name"" is used by Main.suite().

See Also:
Constant Field Values

PROPERTY_saffron_test_Class

public static final String PROPERTY_saffron_test_Class
The string property ""saffron.test.Class"" is used by Main.suite().

See Also:
Constant Field Values

PROPERTY_saffron_test_Suite

public static final String PROPERTY_saffron_test_Suite
The string property ""saffron.test.Suite"" is used by Main.suite().

See Also:
Constant Field Values

PROPERTY_saffron_test_jdbc_url

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

See Also:
Constant Field Values

PROPERTY_saffron_test_jdbc_drivers

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

See Also:
Constant Field Values
Constructor Detail

SaffronProperties

private SaffronProperties()
Please use instance() to create a SaffronProperties.

Method Detail

instance

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


apply

public void apply()
Applies properties to the right locations.


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.


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.


SourceForge.net_Logo