|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.aselect.system.configmanager.ConfigManager
public class ConfigManager
A common configuration manager.
Description:
The ConfigManager
offers an interface to the configuration,
which can be used by all A-Select components. It's set up like a factory to
resolve the right ConfigHandler
.
The ConfigManager
offers an interface to the
ConfigHandler
that is created during initialization.
Concurrency issues:
-
Constructor Summary | |
---|---|
ConfigManager()
Default constructor. |
Method Summary | |
---|---|
java.lang.Object |
getNextSection(java.lang.Object oSection)
Returns the next section with the same type that is direclty located after the given section. |
java.lang.String |
getParam(java.lang.Object oSection,
java.lang.String sConfigItem)
Returns a String that contains the requested configuration
parameter. |
java.lang.Object |
getSection(java.lang.Object oRootSection,
java.lang.String sSectionType)
Returns a sub-section from the configuration of the given root section specified by the given type. |
java.lang.Object |
getSection(java.lang.Object oRootSection,
java.lang.String sSectionType,
java.lang.String sSectionID)
Returns a sub-section from the configuration of the given root-section. |
void |
importConfig(java.io.File fConfig)
Deprecated. All config should be stored in only one config file. |
void |
init(java.lang.String sDriverName,
java.lang.String sUser,
java.lang.String sPassword,
java.lang.String sDatabaseURL,
java.lang.String sDatabaseTable,
java.lang.String sConfigId,
SystemLogger oSystemLogger)
Initialize the ConfigManager for use with a database. |
void |
init(java.lang.String sConfigFile,
SystemLogger oSystemLogger)
Initialize the ConfigManager for use with a config file. |
boolean |
removeSection(java.lang.Object oRootSection,
java.lang.String sSectionType)
Removes a specified configuration section. |
boolean |
removeSection(java.lang.Object oRootSection,
java.lang.String sSectionType,
java.lang.String sSectionID)
Removes a configuration section specified by section ID. |
void |
saveConfig()
Saves the configuration as is known by the ConfigHandler. |
boolean |
setParam(java.lang.Object oSection,
java.lang.String sConfigItem,
java.lang.String sConfigValue,
boolean bMandatory)
Adds a config parameter to the given section. |
java.lang.Object |
setSection(java.lang.Object oRootSection,
java.lang.String sSectionType)
Adds an empty configuration section of the specified sectionType
of the rootSection. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ConfigManager()
Method Detail |
---|
public void init(java.lang.String sConfigFile, SystemLogger oSystemLogger) throws ASelectConfigException
ConfigManager
for use with a config file.
ConfigManager
will create an
ConfigHandler
with file support. ConfigHandler
per ConfigManager
will be created.
sConfigFile
- String
that contains the full path and filename
of the configuration file.oSystemLogger
- SystemLogger
initialized SystemLogger Object.
ASelectConfigException
- If initialization fails.public void init(java.lang.String sDriverName, java.lang.String sUser, java.lang.String sPassword, java.lang.String sDatabaseURL, java.lang.String sDatabaseTable, java.lang.String sConfigId, SystemLogger oSystemLogger) throws ASelectConfigException
ConfigManager
for use with a database.
sDriverName
- JDBC Driver namesUser
- JDBC UsernamesPassword
- Password for sUser to access JDBC databasesDatabaseURL
- URL to JDBC databasesDatabaseTable
- Name of table that contains the A-Select configsConfigId
- Unique ID of the configuration in the table.oSystemLogger
- SystemLogger
initialized SystemLogger Object.
ASelectConfigException
- If initialization fails.public java.lang.Object getSection(java.lang.Object oRootSection, java.lang.String sSectionType, java.lang.String sSectionID) throws ASelectConfigException
null
: the first section will
be returned. The requested section ID must be a String
containing one '=' character (syntax: [param]=[value]). ASelectConfigException
will be thrown.
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.public java.lang.Object getSection(java.lang.Object oRootSection, java.lang.String sSectionType) throws ASelectConfigException
null
: the first section will be
returned.
oRootSection
- Section that is used to resulve the subsectionsSectionType
- Type of the subsection that should be returned
ASelectConfigException
- If retrieving failspublic java.lang.Object setSection(java.lang.Object oRootSection, java.lang.String sSectionType) throws ASelectConfigException
sectionType
of the rootSection.
oRootSection
- Section to which the new section is addedsSectionType
- Type of the section that will be added
ASelectConfigException
- If setting failspublic boolean removeSection(java.lang.Object oRootSection, java.lang.String sSectionType) throws ASelectConfigException
oRootSection
- Section containing the section that must be removedsSectionType
- Type of the section that must be removed
ASelectConfigException
- If removing failspublic boolean removeSection(java.lang.Object oRootSection, java.lang.String sSectionType, java.lang.String sSectionID) throws ASelectConfigException
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 failspublic java.lang.String getParam(java.lang.Object oSection, java.lang.String sConfigItem) throws ASelectConfigException
String
that contains the requested configuration
parameter.
String
that will be returned will be retrieved from
the given config section and has the specified config item name.
oSection
- Section from which contains the parametersConfigItem
- The name of the config parameter
String
containing the requested config parameter
ASelectConfigException
- If retrieving failspublic boolean setParam(java.lang.Object oSection, java.lang.String sConfigItem, java.lang.String sConfigValue, boolean bMandatory) throws ASelectConfigException
oSection
- 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 failspublic java.lang.Object getNextSection(java.lang.Object oSection) throws ASelectConfigException
null
if no next section can be found.
oSection
- Section that has the same type as the section that must be
returned
ASelectConfigException
- If retrieving failspublic void saveConfig() throws ASelectConfigException
ASelectConfigException
- If saving failspublic void importConfig(java.io.File fConfig) throws ASelectConfigException
ConfigHandler
.
ConfigManager
must be initialized.
fConfig
- The configuration File
that will be imported in
the configuration that is known in the memory of the
ConfigHandler
ASelectConfigException
- If importing fails
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |