public class ConfigurationFileHandler extends Object implements ConfigurationHandler
Modifier and Type | Class and Description |
---|---|
private static class |
ConfigurationFileHandler.MyErrorHandler
Description of the Class
|
Modifier and Type | Field and Description |
---|---|
private static char |
C_PFIX |
private static char |
C_SEP |
private Vector |
categories |
private HashMap |
initValues |
private HashMap |
props |
private boolean |
validate |
Constructor and Description |
---|
ConfigurationFileHandler()
Creates a new instance of ConfigurationFileLoader
|
Modifier and Type | Method and Description |
---|---|
Vector |
getCategories()
This method should return a
Vector of all
categories. |
HashMap |
getProperties()
This method should return all properties that was read
by the particular handler.
|
private Hashtable |
getVariables(Document doc)
Gets the variables attribute of the ConfigurationManager object
|
void |
initialize(HashMap parameters)
This method is used to send any parameters from
the ConfigurationManager to the particular handler.
|
void |
load()
This method should read the configuration and then
set the categories and properties.
|
void |
load(File file) |
void |
load(InputStream is)
This method will read in a file and generate the properties
|
void |
load(String theURL)
This method will read the content from an URL and generate the
properties.
|
private void |
processProperties(Document doc)
Description of the Method
|
private String |
replaceVariables(Hashtable vars,
String line)
Description of the Method
|
void |
setValidation(boolean validate) |
void |
store()
This method should store all categories and properties.
|
void |
store(File file,
HashMap data)
This method will save the current categories and their properties to a
file
|
private static final char C_SEP
private static final char C_PFIX
private boolean validate
private HashMap initValues
private Vector categories
public ConfigurationFileHandler()
public void initialize(HashMap parameters)
ConfigurationHandler
initialize
in interface ConfigurationHandler
parameters
- public void setValidation(boolean validate)
public void load() throws ConfigurationManagerException
ConfigurationHandler
load
in interface ConfigurationHandler
ConfigurationManagerException
public void load(File file) throws ConfigurationManagerException
file
- ConfigurationManagerException
private Hashtable getVariables(Document doc)
doc
- Description of the Parameterprivate String replaceVariables(Hashtable vars, String line)
vars
- Description of the Parameterline
- Description of the Parameterprivate void processProperties(Document doc)
doc
- Description of the Parameterpublic void load(InputStream is) throws ConfigurationManagerException
is
- The inputstreamConfigurationManagerException
- if the file cannot be processedpublic void load(String theURL) throws ConfigurationManagerException
theURL
- Description of the ParameterConfigurationManagerException
- if the file cannot be processedpublic void store(File file, HashMap data) throws ConfigurationManagerException
file
- the file that will be generatedConfigurationManagerException
- Description of the Exceptionpublic Vector getCategories()
Vector
of all
categories. The category names must be stored as Strings
inside the Vector
.getCategories
in interface ConfigurationHandler
Vector
public HashMap getProperties()
getProperties
in interface ConfigurationHandler
HashMap
with all properties.public void store() throws ConfigurationManagerException
store
in interface ConfigurationHandler
ConfigurationManagerException
WebARTS Library Licensed Under the GNU - General Public License. Other Libraries licensed under their respective Open Source Licenses