| java.lang.Object org.mmbase.util.xml.UtilReader
UtilReader | public class UtilReader (Code) | | 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.
since: MMBase-1.6.4 author: Rob Vermeulen author: Michiel Meeuwissen version: $Id: UtilReader.java,v 1.33 2007/11/19 15:01:36 michiel Exp $ |
Inner Class :public static class PropertiesMap extends AbstractMap | |
Constructor Summary | |
public | UtilReader(String fileName) Instantiates a UtilReader for a given configuration file in /utils. | public | UtilReader(String fileName, ResourceWatcher w) Produces a UtilReader for the given resource name.
Parameters: fileName - a Resource name relative to config/utils Parameters: w - A unstarted ResourceWatcher without files. | public | UtilReader(String resourceName, Runnable onChange) Produces a UtilReader for the given resource name. |
DTD_UTIL | final public static String DTD_UTIL(Code) | | DTD respource filename of the most recent Utilities config DTD
|
DTD_UTIL_1_0 | final public static String DTD_UTIL_1_0(Code) | | DTD resource filename of the Utilities config DTD version 1.0
|
PUBLIC_ID_UTIL | final public static String PUBLIC_ID_UTIL(Code) | | Public ID of the most recent Utilities config DTD
|
PUBLIC_ID_UTIL_1_0 | final public static String PUBLIC_ID_UTIL_1_0(Code) | | Public ID of the Utilities config DTD version 1.0
|
UtilReader | public UtilReader(String fileName)(Code) | | Instantiates a UtilReader for a given configuration file in /utils. If the configuration file is used on more spots, then you may consider
using the static method
UtilReader.get(String) in stead.
Parameters: fileName - The name of the property file (e.g. httppost.xml). |
UtilReader | public UtilReader(String fileName, ResourceWatcher w)(Code) | | Produces a UtilReader for the given resource name.
Parameters: fileName - a Resource name relative to config/utils Parameters: w - A unstarted ResourceWatcher without files. (It will be only be called from thefilewatcher in this reader). It defines what must happen if something changes in the util'sconfiguration. Since you probably don't need the resource name for that any more, youcan also simply use UtilReader.UtilReader(String,Runnable) since: MMBase-1.8 |
UtilReader | public UtilReader(String resourceName, Runnable onChange)(Code) | | Produces a UtilReader for the given resource name.
Parameters: resourceName - a Resource name relative to config/utils Parameters: onChange - A Runnable defining what must happen if something changes. since: MMBase-1.8 |
finalize | public void finalize()(Code) | | |
get | public static UtilReader get(String fileName)(Code) | | Returns a UtilReader for the given fileName. When you use this, the UtilReader instance will be cached.
since: MMBase-1.8 |
getProperties | public PropertiesMap<String> getProperties()(Code) | | Get the properties of this utility.
|
registerPublicIDs | public static void registerPublicIDs()(Code) | | Register the Public Ids for DTDs used by UtilReader
This method is called by XMLEntityResolver.
|
resourceAvailable | public boolean resourceAvailable()(Code) | | Reports whether the configured resource (in the constructor) is actually backed. If not,
getProperties will certainly return an empty Map.
since: MMBase-1.8.1 |
|
|