public class UtilReader extends Object
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. The map is
unmodifiable, and only mirrors the resource(s) "utils/myutil.xml".| Modifier and Type | Class and Description |
|---|---|
static class |
UtilReader.PropertiesMap<E>
A unmodifiable Map, with extra 'Properties'-like methods.
|
| Modifier and Type | Field and Description |
|---|---|
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 and Description |
|---|
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.
|
| Modifier and Type | Method and Description |
|---|---|
void |
finalize() |
static UtilReader |
get(String fileName)
Returns a UtilReader for the given fileName.
|
protected Map.Entry<String,String> |
getEntry(DocumentReader reader,
String k,
String v) |
UtilReader.PropertiesMap<Collection<Map.Entry<String,String>>> |
getMaps()
Get the properties of this utility.
|
UtilReader.PropertiesMap<String> |
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 EntityResolver.
|
boolean |
resourceAvailable()
Reports whether the configured resource (in the constructor) is actually backed.
|
String |
toString() |
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
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 static void registerPublicIDs()
public static UtilReader get(String fileName)
public UtilReader.PropertiesMap<String> getProperties()
public UtilReader.PropertiesMap<Collection<Map.Entry<String,String>>> getMaps()
public boolean resourceAvailable()
protected Map.Entry<String,String> getEntry(DocumentReader reader, String k, String v)
protected void readProperties(String s)
MMBase 1.9-SNAPSHOT - ${javadoctimestamp}