|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.mmbase.util.xml.UtilReader
This class reads configuration files for utilities, that are placed in /config/utils/. A typical way to use it may be like so:
private UtilReader.PropertiesMap utilProperties = new UtilReader("myutil.xml", new Runnable() { public void run() { init();}}).getProperties();
private void init() {
// use utilProperties
}
{
init();
}
This produces a 'watched map' utilProperties. Every time the underlying config file(s) are changed 'init' is called. Init is called on instantation of the surrounding class too.
| Nested Class Summary | |
static class |
UtilReader.PropertiesMap
A unmodifiable Map, with extra 'Properties'-like methods. |
| Field Summary | |
static String |
CONFIG_UTILS
|
static String |
DTD_UTIL
DTD respource filename of the most recent Utilities config DTD |
static String |
DTD_UTIL_1_0
DTD resource filename of the Utilities config DTD version 1.0 |
static String |
PUBLIC_ID_UTIL
Public ID of the most recent Utilities config DTD |
static String |
PUBLIC_ID_UTIL_1_0
Public ID of the Utilities config DTD version 1.0 |
| Constructor Summary | |
UtilReader(String fileName)
Instantiates a UtilReader for a given configuration file in |
|
UtilReader(String fileName,
ResourceWatcher w)
Produces a UtilReader for the given resource name. |
|
UtilReader(String resourceName,
Runnable onChange)
Produces a UtilReader for the given resource name. |
|
| Method Summary | |
void |
finalize()
|
static UtilReader |
get(String fileName)
Returns a UtilReader for the given fileName. |
UtilReader.PropertiesMap |
getProperties()
Get the properties of this utility. |
protected void |
readProperties(String s)
|
static void |
registerPublicIDs()
Register the Public Ids for DTDs used by UtilReader This method is called by XMLEntityResolver. |
boolean |
resourceAvailable()
Reports whether the configured resource (in the constructor) is actually backed. |
| Methods inherited from class java.lang.Object |
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
public static final String CONFIG_UTILS
public static final String PUBLIC_ID_UTIL_1_0
public static final String DTD_UTIL_1_0
public static final String PUBLIC_ID_UTIL
public static final String DTD_UTIL
| Constructor Detail |
public UtilReader(String fileName)
get(String) in stead.
fileName - The name of the property file (e.g. httppost.xml).
public UtilReader(String fileName,
ResourceWatcher w)
fileName - a Resource name relative to config/utilsw - A unstarted ResourceWatcher without files. (It will be only be called from the
filewatcher in this reader). It defines what must happen if something changes in the util's
configuration. Since you probably don't need the resource name for that any more, you
can also simply use UtilReader(String, Runnable)
public UtilReader(String resourceName,
Runnable onChange)
resourceName - a Resource name relative to config/utilsonChange - A Runnable defining what must happen if something changes.| Method Detail |
public static void registerPublicIDs()
public static UtilReader get(String fileName)
public void finalize()
public UtilReader.PropertiesMap getProperties()
public boolean resourceAvailable()
protected void readProperties(String s)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||