jfig.utils
Class SetupManager
java.lang.Object
jfig.utils.SetupManager
- public class SetupManager
- extends java.lang.Object
find, load, and manager user preferences.
SetupManager manages program and user enviroment properties,
in four different levels. First, the Java System properties are
initialized (which may not be possible for unsigned Applets).
Second, the global properties are loaded via the ClassLoader from
a Java 1.1 resource, e.g. "/filename"
Third, user resources are loaded from a file "$USER/filename" in the
user's home directory.
Finally, local resources are added from a file "./filename" in the
current working directory.
For all these cases, the "filename" argument is given as an argument
to the constructor of the SetupManager object.
Field Summary |
(package private) static SetupManager |
_setupManager
|
(package private) static boolean |
debug
|
(package private) static java.util.Properties |
globals
|
(package private) static java.util.Properties |
locals
|
(package private) static java.util.Properties |
properties
|
(package private) static java.util.Properties |
userprops
|
Method Summary |
static boolean |
getBoolean(java.lang.String key,
boolean defaultvalue)
|
static java.awt.Color |
getColor(java.lang.String key,
java.awt.Color defaultcolor)
|
static double |
getDouble(java.lang.String key,
double defaultvalue)
|
static int |
getInteger(java.lang.String key,
int defaultvalue)
|
static java.util.Properties |
getProperties()
|
static java.lang.String |
getProperty(java.lang.String key)
|
static java.lang.String |
getProperty(java.lang.String key,
java.lang.String defaultvalue)
|
static SetupManager |
getSetupManager()
|
static void |
list(java.io.PrintStream ps)
|
static void |
loadAllProperties(java.lang.String filename)
|
static void |
loadGlobalProperties(java.lang.String filename)
load "global" properties from the resource named "filename". |
static void |
loadLocalProperties(java.io.InputStream IS)
|
static void |
loadLocalProperties(java.lang.String filename)
|
static void |
loadURLProperties(java.lang.String urlname)
|
static void |
loadUserProperties(java.lang.String filename)
|
static void |
main(java.lang.String[] argv)
|
static void |
merge(java.util.Properties dest,
java.util.Properties src)
|
static void |
message(java.lang.String msg)
|
static void |
save(java.io.OutputStream OS,
java.lang.String label)
|
static void |
saveLocalProperties(java.lang.String label,
java.lang.String filename)
|
static void |
saveUserProperties(java.lang.String label,
java.lang.String filename)
|
static void |
setBoolean(java.lang.String key,
boolean value)
|
static void |
setProperty(java.lang.String key,
java.lang.String value)
|
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
_setupManager
static SetupManager _setupManager
properties
static java.util.Properties properties
globals
static java.util.Properties globals
userprops
static java.util.Properties userprops
locals
static java.util.Properties locals
debug
static boolean debug
getSetupManager
public static SetupManager getSetupManager()
getProperties
public static java.util.Properties getProperties()
getProperty
public static java.lang.String getProperty(java.lang.String key,
java.lang.String defaultvalue)
getProperty
public static java.lang.String getProperty(java.lang.String key)
getInteger
public static int getInteger(java.lang.String key,
int defaultvalue)
getBoolean
public static boolean getBoolean(java.lang.String key,
boolean defaultvalue)
getDouble
public static double getDouble(java.lang.String key,
double defaultvalue)
getColor
public static java.awt.Color getColor(java.lang.String key,
java.awt.Color defaultcolor)
setProperty
public static void setProperty(java.lang.String key,
java.lang.String value)
setBoolean
public static void setBoolean(java.lang.String key,
boolean value)
loadAllProperties
public static void loadAllProperties(java.lang.String filename)
loadGlobalProperties
public static void loadGlobalProperties(java.lang.String filename)
- load "global" properties from the resource named "filename".
To get a valid Java classpath resource name, this method automatically
prepends a "/" to filename, of none is specified.
For example, when called with the filename "jfig/.jfigrc", this
method will look for a resource named "/jfig/.jfigrc" and parse
the properties from that resource.
loadUserProperties
public static void loadUserProperties(java.lang.String filename)
loadLocalProperties
public static void loadLocalProperties(java.lang.String filename)
loadLocalProperties
public static void loadLocalProperties(java.io.InputStream IS)
loadURLProperties
public static void loadURLProperties(java.lang.String urlname)
save
public static void save(java.io.OutputStream OS,
java.lang.String label)
saveUserProperties
public static void saveUserProperties(java.lang.String label,
java.lang.String filename)
saveLocalProperties
public static void saveLocalProperties(java.lang.String label,
java.lang.String filename)
merge
public static void merge(java.util.Properties dest,
java.util.Properties src)
list
public static void list(java.io.PrintStream ps)
message
public static void message(java.lang.String msg)
toString
public java.lang.String toString()
main
public static void main(java.lang.String[] argv)