org.naftulin.configmgr.parsers
Class DbDirectParserImpl

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

public class DbDirectParserImpl
extends java.lang.Object
implements ConfigEntryParser


Constructor Summary
DbDirectParserImpl(java.lang.String driverClass, java.lang.String connectionUrl, java.lang.String sql, java.lang.String user, java.lang.String password, 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.
 java.lang.String getConnectionUrl()
           
 java.lang.String getDriverClass()
           
 java.lang.String getKeyColumnName()
           
 java.util.List<NameValuePairImpl> getNameValuePairs()
           
 java.lang.String getPassword()
           
 java.lang.String getSql()
           
 java.lang.String getUser()
           
 java.lang.String getValueColumnName()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DbDirectParserImpl

public DbDirectParserImpl(java.lang.String driverClass,
                          java.lang.String connectionUrl,
                          java.lang.String sql,
                          java.lang.String user,
                          java.lang.String password,
                          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 loading the database driver and connecting to the database using database URL and user/ password if provided with any other connection specific properties if provided in configuration 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.

getDriverClass

public java.lang.String getDriverClass()

getKeyColumnName

public java.lang.String getKeyColumnName()

getNameValuePairs

public java.util.List<NameValuePairImpl> getNameValuePairs()

getPassword

public java.lang.String getPassword()

getSql

public java.lang.String getSql()

getUser

public java.lang.String getUser()

getValueColumnName

public java.lang.String getValueColumnName()

getConnectionUrl

public java.lang.String getConnectionUrl()


Copyright © 2009. All Rights Reserved.