org.naftulin.configmgr.parsers
Class DbJndiParserImpl
java.lang.Object
org.naftulin.configmgr.parsers.AbstractJndiParser
org.naftulin.configmgr.parsers.DbJndiParserImpl
- All Implemented Interfaces:
- ConfigEntryParser
public class DbJndiParserImpl
- extends AbstractJndiParser
- implements ConfigEntryParser
Constructor Summary |
DbJndiParserImpl(java.lang.String jndiName,
java.lang.String initialContextFactory,
java.lang.String sql,
java.lang.String keyColumnName,
java.lang.String valueColumnName,
java.util.List<NameValuePairImpl> nameValuePairs)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
DbJndiParserImpl
public DbJndiParserImpl(java.lang.String jndiName,
java.lang.String initialContextFactory,
java.lang.String sql,
java.lang.String keyColumnName,
java.lang.String valueColumnName,
java.util.List<NameValuePairImpl> nameValuePairs)
getConfigurationManagementEntry
public ConfigurationManagementEntry getConfigurationManagementEntry(java.lang.String key,
java.net.URL fileUrl)
throws ConfigurationManagerException
- Returns configuratoin management entry that contains a Map with key-value pairs read from the database based on the sql specified.
The steps are: first database connection is established by looking up the database connection in JNDI based on JNDI name,
JNDI Context factory if provided and other parameters as provided in cofiguration description.
Second sql provided is executed against the database connection and lastly the results are read based on the columns provided in the
configuration.
- Specified by:
getConfigurationManagementEntry
in interface ConfigEntryParser
- Parameters:
key
- configuration management keyfileUrl
- file url is null, since database configuration is not file URL based.
- Returns:
- Configuration management entry.
- Throws:
ConfigurationManagerException
- if an error occurs while parsing an entry.
validateParameters
protected void validateParameters(java.lang.String key)
throws ConfigurationManagerException
- Validates that key, jndi name, sql, etc are not null parameters
- Overrides:
validateParameters
in class AbstractJndiParser
- Parameters:
key
-
- Throws:
ConfigurationManagerException
Copyright © 2009. All Rights Reserved.