org.jconfig.handler
Class InputStreamHandler
java.lang.Object
|
+--org.jconfig.handler.AbstractHandler
|
+--org.jconfig.handler.BaseXMLHandler
|
+--org.jconfig.handler.InputStreamHandler
- All Implemented Interfaces:
- ConfigurationHandler, java.util.EventListener, FileListener
- public class InputStreamHandler
- extends BaseXMLHandler
- implements ConfigurationHandler
This class is an implementation of the ConfigurationHandler interface.
It tries to find the file with the given name inside the classpath with
getClassLoader().getResourceAsStream(fileName). This handler is used
as default by the ConfigurationManager.
- Author:
- Andreas Mecky andreas.mecky@xcom.de, Terry Dye terry.dye@xcom.de
Method Summary |
java.io.File |
getFile()
|
Configuration |
load(java.lang.String configurationName)
Loads the configuration from a xml file. |
void |
setFileName(java.lang.String fileName)
Sets the filename |
void |
setValidation(boolean validate)
Defines if the xml file should be validated using a DTD or not.
|
void |
store(Configuration configuration)
This method should store all categories and properties. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
InputStreamHandler
public InputStreamHandler()
- Default constructor
InputStreamHandler
public InputStreamHandler(java.lang.String filename)
- Constructor with filename
- Parameters:
filename
-
setFileName
public void setFileName(java.lang.String fileName)
- Sets the filename
- Parameters:
the
- name of the file that the InputStreamHandler will search in the classpath
setValidation
public void setValidation(boolean validate)
- Defines if the xml file should be validated using a DTD or not.
The default setting is false.
- Parameters:
if
- true then it will validate the xml file.
load
public Configuration load(java.lang.String configurationName)
throws ConfigurationManagerException
- Loads the configuration from a xml file.
- Specified by:
load
in interface ConfigurationHandler
- Throws:
ConfigurationManagerException
-
store
public void store(Configuration configuration)
throws ConfigurationManagerException
- This method should store all categories and properties.
- Specified by:
store
in interface ConfigurationHandler
- Following copied from interface:
org.jconfig.handler.ConfigurationHandler
- Throws:
ConfigurationManagerException
-
getFile
public java.io.File getFile()
- Overrides:
getFile
in class AbstractHandler
- See Also:
org.jconfig.handler.ConfigurationHandler#getFile()
Copyright © 2001-2003 Andreas Mecky, Terry Dye. All Rights Reserved.