org.naftulin.configmgr.parsers
Class DbJndiParserImpl

java.lang.Object
  extended by org.naftulin.configmgr.parsers.AbstractJndiParser
      extended by org.naftulin.configmgr.parsers.DbJndiParserImpl
All Implemented Interfaces:
ConfigEntryParser

public class DbJndiParserImpl
extends AbstractJndiParser
implements ConfigEntryParser


Field Summary
 
Fields inherited from class org.naftulin.configmgr.parsers.AbstractJndiParser
initialContextFactory, jndiName, nameValuePairs
 
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)
           
 
Method Summary
 ConfigurationManagementEntry getConfigurationManagementEntry(java.lang.String key, java.net.URL fileUrl)
          Returns configuratoin management entry that contains a Map with key-value pairs read from the database based on the sql specified.
protected  void validateParameters(java.lang.String key)
          Validates that key, jndi name, sql, etc are not null parameters
 
Methods inherited from class org.naftulin.configmgr.parsers.AbstractJndiParser
getJndiContext, prepareJndiProperties
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

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)
Method Detail

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 key
fileUrl - 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.