public class prefs
extends java.lang.Object
omero.prefs
Preferences
node in order to store Java properties-file
like values on a user basis. This simplifies configuration and permits
quicker re-installs, and less wrangling with configuration files.
A single string value is stored as DEFAULT
(which by default is the
value DEFAULT
, and points to the name of some node under
"omero.prefs". This value can be overridden by the "OMERO_CONFIG" environment
variable. Almost all commands work on this default node, referred to here as
a "profile".修飾子とタイプ | フィールドと説明 |
---|---|
static boolean |
DEBUG
Activated by setting DBEUG=true in the environment.
|
static java.lang.String |
DEFAULT
Key (and default value) of the property under
ROOT which defines
which "profile" (subnode} is in effect. |
static java.lang.String |
ENV
Environment variable which can be set to override the current, active
profile.
|
static java.lang.String |
ROOT
"omero.prefs", the value of the root
Preferences node used for
all configuration work. |
static java.util.Properties |
STDIN
Storing the standard in as a
Properties instance as early as
possible to prevent lost data. |
コンストラクタと説明 |
---|
prefs() |
修飾子とタイプ | メソッドと説明 |
---|---|
static java.lang.String[] |
all(java.lang.String[] args)
Calls
Preferences.childrenNames() and returns the array. |
static java.lang.String[] |
args(java.lang.String... args)
Converts varargs to a String-array.
|
static java.lang.String[] |
def(java.lang.String[] args)
Returns the current default if no argument is given, or sets the default
to the given string (or "" if null) otherwise returing "Default set to:
... ".
|
static java.lang.String[] |
dispatch(java.lang.String[] args)
Uses the first string in the argument array to reflectively invoke
another method with the same signature on
prefs . |
static java.lang.String[] |
drop(java.lang.String[] args)
Drops the entire profile (
subnode ) via
Preferences.removeNode() . |
static java.lang.String[] |
exit(java.lang.String[] args)
Uses the length of the argument array as the exit code.
|
static java.lang.String[] |
export(java.lang.String[] args)
Exports all properties in the current profile to
System.out , or
if a single argument is given, that is take to be the name of a target
ouput file. |
static java.lang.String[] |
get(java.lang.String[] args)
Returns either the given key=value pairs (or all if no argument is
given).
|
static java.lang.String[] |
help(java.lang.String[] args)
Returns a help string array.
|
static java.lang.String[] |
join(java.lang.String... args)
Joins all the String arguments given into a single String (joined with "
"), and returns that String as the first element of a new array.
|
static java.lang.String[] |
keys(java.lang.String[] args)
Returns
Preferences.keys() |
static java.lang.String[] |
load_nowarn(java.lang.String[] args)
Performs the same actions as
load(String[]) but does not throw
CONFLICT if a key already exists. |
static java.lang.String[] |
load(java.lang.String[] args)
Loads a profile from
Properties files, or properly formatted
System.in input if no files are given. |
static void |
main(java.lang.String[] args)
Entry point to the prefs command line too.
|
static java.lang.String[] |
notNull(java.lang.String[] args)
Returns an empty array if the argument is null.
|
static java.lang.String[] |
pop(java.lang.String[] args)
Creates a new subarray from the argument, effectively popping off the
first element.
|
static java.lang.String[] |
print(java.lang.String[] args)
Prints the arg array and returns an empty array (for exit purposes)
|
static java.lang.String[] |
printDebug(java.lang.String[] args)
Delegates to
printErr(String[]) iff DEBUG is true. |
static java.lang.String[] |
printErr(java.lang.String[] args)
Prints the arg array and returns the input array (for exit purposes)
|
static java.lang.String[] |
set(java.lang.String[] args)
Takes an array of length 2, using args[0] as the key and args[1] as the
value to be set.
|
static java.lang.String[] |
sys(java.lang.String[] args)
Replaces the user
Preferences instance with the system
Preferences and continues dispatching. |
static java.lang.String[] |
test(java.lang.String[] args)
Simple test framework, callable from the command line via "java prefs
test"
|
static java.lang.String[] |
usage(java.lang.String[] args)
Returns a usage string array.
|
public static final java.util.Properties STDIN
Properties
instance as early as
possible to prevent lost data.public static final boolean DEBUG
System.err
.public static final java.lang.String ROOT
Preferences
node used for
all configuration work.public static final java.lang.String DEFAULT
ROOT
which defines
which "profile" (subnode} is in effect.public static final java.lang.String ENV
public static void main(java.lang.String[] args)
dispatch(String[])
method to invoke a public static method which
takes a popped
String-argument array.args
- Not null. Can be empty.public static java.lang.String[] usage(java.lang.String[] args)
args
- Ignored.public static java.lang.String[] help(java.lang.String[] args)
usage(String[])
but
may eventually return a more man page-like statement.args
- Ignored.public static java.lang.String[] print(java.lang.String[] args)
public static java.lang.String[] printErr(java.lang.String[] args)
public static java.lang.String[] printDebug(java.lang.String[] args)
printErr(String[])
iff DEBUG
is true.public static java.lang.String[] exit(java.lang.String[] args)
public static java.lang.String[] dispatch(java.lang.String[] args) throws java.lang.Throwable
prefs
. If the array is
null, empty, or begins with an non-extant method, USAGE
will be
thrown. Otherwise, invokes the named method, returning its return value
or returning the cause of any InvocationTargetException
.java.lang.Throwable
public static java.lang.String[] sys(java.lang.String[] args) throws java.lang.Throwable
Preferences
instance with the system
Preferences
and continues dispatching.java.lang.Throwable
public static java.lang.String[] all(java.lang.String[] args) throws java.util.prefs.BackingStoreException
Preferences.childrenNames()
and returns the array.args
- Ignored.java.util.prefs.BackingStoreException
public static java.lang.String[] def(java.lang.String[] args)
args
- String array of length 0 or 1. Otherwise USAGE
is
thrown.public static java.lang.String[] drop(java.lang.String[] args) throws java.util.prefs.BackingStoreException
subnode
) via
Preferences.removeNode()
.args
- Ignored.java.util.prefs.BackingStoreException
public static java.lang.String[] keys(java.lang.String[] args) throws java.util.prefs.BackingStoreException
Preferences.keys()
args
- Ignored.java.util.prefs.BackingStoreException
public static java.lang.String[] get(java.lang.String[] args) throws java.util.prefs.BackingStoreException
java.util.prefs.BackingStoreException
public static java.lang.String[] set(java.lang.String[] args) throws java.util.prefs.BackingStoreException
load(String[])
.args
- java.util.prefs.BackingStoreException
public static java.lang.String[] export(java.lang.String[] args) throws java.util.prefs.BackingStoreException, java.io.IOException
System.out
, or
if a single argument is given, that is take to be the name of a target
ouput file. Export will fail if the file already exists. This method may
be removed in favor of using piping with get(String[])
.
Properties are in standard Java Properties
format.java.util.prefs.BackingStoreException
java.io.IOException
public static java.lang.String[] load(java.lang.String[] args) throws java.io.IOException
Properties
files, or properly formatted
System.in
input if no files are given. If a key to be loaded
already exists in the configuration, CONFLICT
will be thrown.
Use load_nowarn(String[])
instead, or drop(String[])
the profile before loading.java.io.IOException
public static java.lang.String[] load_nowarn(java.lang.String[] args) throws java.io.IOException
load(String[])
but does not throw
CONFLICT
if a key already exists.java.io.IOException
public static java.lang.String[] args(java.lang.String... args)
public static java.lang.String[] join(java.lang.String... args)
public static java.lang.String[] notNull(java.lang.String[] args)
public static java.lang.String[] pop(java.lang.String[] args)
public static java.lang.String[] test(java.lang.String[] args) throws java.lang.Throwable
java.lang.Throwable