|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.sun.jini.tool.envcheck.Util
public class Util
Miscellaneous utility methods for use by the checking framework and plugins.
Field Summary | |
---|---|
private static ResourceBundle |
bundle
the resource bundle for this class |
private static Properties |
nonStandardProperties
the properties which were provided to the local VM |
private static HashMap |
resourceMap
table of localization resources |
Constructor Summary | |
---|---|
Util()
|
Method Summary | |
---|---|
static String |
checkFileName(String name,
String desc)
Validate the accessibility of the non-directory file identified by name . |
static String |
checkSystemPropertyFile(String prop,
String desc)
Validate the accessibility of the non-directory file identified by the system property prop . |
static String |
checkURL(URL url,
String desc)
Check the accessibility of the given URL . |
private static String |
getFormat(String key,
ResourceBundle bundle)
Get the format string associated with key in the
given resource bundle. |
static ResourceBundle |
getResourceBundle(Class clazz)
Get the resource bundle associated with class clazz . |
static String |
getString(String key,
ResourceBundle bundle)
Print out string according to resourceBundle format. |
static String |
getString(String key,
ResourceBundle bundle,
Object val)
Print out string according to resourceBundle format. |
static String |
getString(String key,
ResourceBundle bundle,
Object val1,
Object val2)
Print out string according to resourceBundle format. |
static String |
getString(String key,
ResourceBundle bundle,
Object val1,
Object val2,
Object val3)
Print out string according to resourceBundle format. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private static final HashMap resourceMap
private static ResourceBundle bundle
private static Properties nonStandardProperties
Constructor Detail |
---|
public Util()
Method Detail |
---|
public static String checkFileName(String name, String desc)
name
. The file must exist, must not be a directory, and must
be readable. If any check fails, an error message is returned. If all
checks are successful, null
is returned.
name
- the file namedesc
- a short descriptive string which describes the file, suitable
for inclusion in the error message
null
if all checks passpublic static String checkURL(URL url, String desc)
URL
. If the
url is a file:
url, the usual file access checks are
performed. For any other url a stream is opened, and a non-exceptional
return is considered a success.
url
- the URL
to checkdesc
- a description of the source of the url
null
if the access check passespublic static String checkSystemPropertyFile(String prop, String desc)
prop
. The system property must have a
non-null
value. The file identified by the value must exist,
must not be a directory, and must be readable. If any check fails, an
error message is returned. If all checks are successful,
null
is returned.
prop
- name of a system property whose value must be a file namedesc
- a short descriptive string which describes the file, suitable
for inclusion in the error message
null
if all checks passpublic static ResourceBundle getResourceBundle(Class clazz)
clazz
. The
resource bundle name is constructed by the class name to lower case and
inserting .resources
in front of the name. Thus, if
clazz.getName()
returned a.b.Foo
then the
associated resource bundle name would be a.b.resources.foo
.
If no resource bundle having the associated name is found, a stack trace
is printed and null
is returned. The resource bundle is
loaded using the class loader for the given class, and is cached so that
the search is performed only once.
clazz
- the class for which to obtain a resource bundle
private static String getFormat(String key, ResourceBundle bundle)
key
in the
given resource bundle. If key
is not present in
the bundle, a default format string is returned which will
identify the missing key when printed.
key
- the key of the format string to retrievebundle
- the bundle to retrieve the format string from
public static String getString(String key, ResourceBundle bundle)
key
- the key of the format string to retrievebundle
- the bundle to retrieve the format string frompublic static String getString(String key, ResourceBundle bundle, Object val)
key
- the key of the format string to retrievebundle
- the bundle to retrieve the format string fromval
- the value to substitute into the {0} parameterpublic static String getString(String key, ResourceBundle bundle, Object val1, Object val2)
key
- the key of the format string to retrievebundle
- the bundle to retrieve the format string fromval1
- the value to substitute into the {0} parameterval2
- the value to substitute into the {1} parameterpublic static String getString(String key, ResourceBundle bundle, Object val1, Object val2, Object val3)
key
- the key of the format string to retrievebundle
- the bundle to retrieve the format string fromval1
- the value to substitute into the {0} parameterval2
- the value to substitute into the {1} parameterval3
- the value to substitute into the {2} parameter
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |