RandomSec/src/main/java/com/metaweb/gridworks/Configurations.java
Stefano Mazzocchi 1343162a75 major rewrite of the foundation:
- de-maveniziation (uses the same code that Acre uses to drive jetty directly)
 - removed all dependencies on external javascript code (jquery and suggest) by making a local copy (this makes gridworks totally self-serving, meaning that you can use it even if you don't have any internet connectivity)
 - fixed a NPE when the servlet is shutdown before any project is loaded
 - found a way to spawn a browser directly from the java code (untested in windows)
 - added two ant tasks to generate windows and macosx stand-alone binaries (unused just yet)

To run, just type "./gridworks run" at the command line


git-svn-id: http://google-refine.googlecode.com/svn/trunk@65 7d457c2a-affb-35e4-300a-418c747d4874
2010-02-07 23:15:50 +00:00

41 lines
1.1 KiB
Java

package com.metaweb.gridworks;
/**
* Centralized configuration facility.
*/
public class Configurations {
public static String get(String name) {
return System.getProperty(name);
}
public static String get(String name, String def) {
String val = get(name);
return (val == null) ? def : val;
}
public static boolean getBoolean(String name, boolean def) {
String val = get(name);
return (val == null) ? def : Boolean.parseBoolean(val);
}
public static int getInteger(String name, int def) {
String val = get(name);
try {
return (val == null) ? def : Integer.parseInt(val);
} catch (NumberFormatException e) {
throw new RuntimeException("Could not parse '" + val + "' as an integer number.");
}
}
public static float getFloat(String name, float def) {
String val = get(name);
try {
return (val == null) ? def : Float.parseFloat(val);
} catch (NumberFormatException e) {
throw new RuntimeException("Could not parse '" + val + "' as a floating point number.");
}
}
}