|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.aselect.system.configmanager.handler.XMLConfigHandler
public class XMLConfigHandler
ConfigHandler that reads and writes configuration items as XML data.
Description:
ConfigHandler that reads and writes configuration files located on harddisk
or JDBC database. This class can handle XML configuration files that are
located in a file or a JDBC database, like:
table_name -> [id][XML data] where id is unique within the table.
Concurrency issues:
This IConfigHandler
is threadsafe.
Constructor Summary | |
---|---|
XMLConfigHandler(SystemLogger oSystemLogger)
Default constructor. |
Method Summary | |
---|---|
java.lang.Object |
getNextSection(java.lang.Object oSection)
Resolve the next section (XML tag) which has the same type as the supplied section, it will be the follow-up tag. |
java.lang.String |
getParam(java.lang.Object oSection,
java.lang.String sConfigItem)
Retrieves the value of the config parameter from the config section that is supplied. |
java.lang.Object |
getSection(java.lang.Object oRootSection,
java.lang.String sSectionType)
Retrieves a config section by it's type. |
java.lang.Object |
getSection(java.lang.Object oRootSection,
java.lang.String sSectionType,
java.lang.String sSectionID)
Retrieves a config section by it's type and id. |
void |
importConfig(java.io.File configFile)
Deprecated. All config should be stored in only one config file. |
void |
init(java.io.File fConfig)
Parses an XML config File to an XML DOM Object. |
void |
init(java.lang.String sUser,
java.lang.String sPassword,
java.lang.String sDatabaseURL,
java.lang.String sDatabaseTable,
java.lang.String sDriverName,
java.lang.String sConfigId)
Parses the XML configuration located in a JDBC database to an XML Dom object. |
boolean |
removeSection(java.lang.Object oRootSection,
java.lang.String sSectionType)
Removes the section (XML tag) from the supplied root section which has the type that is supplied. |
boolean |
removeSection(java.lang.Object oRootSection,
java.lang.String sSectionType,
java.lang.String sSectionID)
Removes the section (XML tag) from the supplied root section which has the type and the ID that is supplied. |
void |
saveConfig()
Saves the configuration to the physical storage from which it is retrieved. |
boolean |
setParam(java.lang.Object oRootSection,
java.lang.String sConfigItem,
java.lang.String sConfigValue,
boolean bMandatory)
Puts a new parameter into the given section like value . |
java.lang.Object |
setSection(java.lang.Object oRootSection,
java.lang.String sSectionType)
Adds a config section (empty tag) with section type as it's name (tagname) and returns the new section. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public XMLConfigHandler(SystemLogger oSystemLogger)
XMLConfigHandler
.oSystemLogger
should be initialized.
oSystemLogger
- The system logger that should be used.Method Detail |
---|
public void init(java.io.File fConfig) throws ASelectConfigException
init
in interface IConfigHandler
fConfig
- The File
that contains the configuration
ASelectConfigException
- If initialization fails.IConfigHandler.init(java.io.File)
public void init(java.lang.String sUser, java.lang.String sPassword, java.lang.String sDatabaseURL, java.lang.String sDatabaseTable, java.lang.String sDriverName, java.lang.String sConfigId) throws ASelectConfigException
init
in interface IConfigHandler
sUser
- Username that must be used to coneect to the databasesPassword
- Password for the user that must be used to connect to the
databasesDatabaseURL
- URL to the databasesDatabaseTable
- Database table in which the configuration is storedsDriverName
- The name of the driver that will be used to connect to the
databasesConfigId
- The ID of the configuration in which the specific
configuration is located
ASelectConfigException
- If initialization fails.IConfigHandler.init(java.lang.String,
java.lang.String, java.lang.String, java.lang.String,
java.lang.String, java.lang.String)
public java.lang.Object getSection(java.lang.Object oRootSection, java.lang.String sSectionType, java.lang.String sSectionID) throws ASelectConfigException
getSection
in interface IConfigHandler
oRootSection
- The section in which the requested section is located.sSectionType
- The type of the section, in XML the XML tag name.sSectionID
- The id of a section (syntax: [param]=[value])
ASelectConfigException
- If retrieving fails.IConfigHandler.getSection(java.lang.Object,
java.lang.String, java.lang.String)
public java.lang.Object getSection(java.lang.Object oRootSection, java.lang.String sSectionType) throws ASelectConfigException
getSection
in interface IConfigHandler
oRootSection
- The root section.sSectionType
- The type of section.
ASelectConfigException
- If retrieving fails.IConfigHandler.getSection(java.lang.Object,
java.lang.String)
public java.lang.Object setSection(java.lang.Object oRootSection, java.lang.String sSectionType) throws ASelectConfigException
setSection
in interface IConfigHandler
oRootSection
- Section that is used to resulve the subsectionsSectionType
- Type of the subsection that should be returned
ASelectConfigException
- Is setting session fails.IConfigHandler.setSection(java.lang.Object,
java.lang.String)
public java.lang.String getParam(java.lang.Object oSection, java.lang.String sConfigItem) throws ASelectConfigException
getParam
in interface IConfigHandler
oSection
- Section from which contains the parametersConfigItem
- The name of the config parameter
String
containing the requested config parameter
ASelectConfigException
- If retrieving fails.IConfigHandler.getParam(java.lang.Object,
java.lang.String)
public boolean setParam(java.lang.Object oRootSection, java.lang.String sConfigItem, java.lang.String sConfigValue, boolean bMandatory) throws ASelectConfigException
setParam
in interface IConfigHandler
oRootSection
- The config section to which the parameter will be addedsConfigItem
- Name of the config parameter that will be addedsConfigValue
- Value of the config parameter that will be addedbMandatory
- TRUE if config parameter is requered in the section
ASelectConfigException
- If setting fails.IConfigHandler.setParam(java.lang.Object,
java.lang.String, java.lang.String, boolean)
public java.lang.Object getNextSection(java.lang.Object oSection) throws ASelectConfigException
getNextSection
in interface IConfigHandler
oSection
- Section that has the same type as the section that must be
returned
ASelectConfigException
- If retrieving failsIConfigHandler.getNextSection(java.lang.Object)
public boolean removeSection(java.lang.Object oRootSection, java.lang.String sSectionType) throws ASelectConfigException
removeSection
in interface IConfigHandler
oRootSection
- Section containing the section that must be removedsSectionType
- Type of the section that must be removed
ASelectConfigException
- If removinf fails.IConfigHandler.removeSection(java.lang.Object,
java.lang.String)
public boolean removeSection(java.lang.Object oRootSection, java.lang.String sSectionType, java.lang.String sSectionID) throws ASelectConfigException
removeSection
in interface IConfigHandler
oRootSection
- Section containing the section that must be removedsSectionType
- Type of the section that must be removedsSectionID
- ID of section that must be removed (syntax: [name]=[value])
ASelectConfigException
- If removing fails.IConfigHandler.removeSection(java.lang.Object,
java.lang.String, java.lang.String)
public void saveConfig() throws ASelectConfigException
saveConfig
in interface IConfigHandler
ASelectConfigException
- If saving failsIConfigHandler.saveConfig()
public void importConfig(java.io.File configFile) throws ASelectConfigException
importConfig
in interface IConfigHandler
configFile
- The configuration File
that will be imported in
the configuration that is known in the memory of the
ConfigHandler
ASelectConfigException
- If importing fails.IConfigHandler.importConfig(java.io.File)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |