Author: rajikak
Date: Mon Sep 20 11:05:12 2010
New Revision: 998886
URL: http://svn.apache.org/viewvc?rev=998886&view=rev
Log:
Fixed SYNAPSE-621.
Modified:
synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/AbstractDBMediatorFactory.java
synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/mediators/db/AbstractDBMediator.java
Modified:
synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/AbstractDBMediatorFactory.java
URL:
http://svn.apache.org/viewvc/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/AbstractDBMediatorFactory.java?rev=998886&r1=998885&r2=998886&view=diff
==============================================================================
---
synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/AbstractDBMediatorFactory.java
(original)
+++
synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/AbstractDBMediatorFactory.java
Mon Sep 20 11:05:12 2010
@@ -134,9 +134,24 @@ public abstract class AbstractDBMediator
}
private void readLookupConfig(AbstractDBMediator mediator, OMElement pool)
{
+ DataSourceInformation dataSourceInformation = new
DataSourceInformation();
+ dataSourceInformation.setUrl(getValue(pool, URL_Q));
String dataSourceName = getValue(pool, DSNAME_Q);
mediator.setDataSourceName(dataSourceName);
saveElementConfig(pool, DSNAME_Q, mediator);
+ SecretInformation secretInformation = new SecretInformation();
+ secretInformation.setUser(getValue(pool, USER_Q));
+ secretInformation.setAliasSecret(getValue(pool, PASS_Q));
+ dataSourceInformation.setSecretInformation(secretInformation);
+
+ Iterator poolPropIter = pool.getChildrenWithName(PROP_Q);
+ if(poolPropIter != null){
+ while (poolPropIter.hasNext()){
+ OMElement poolProp = (OMElement) poolPropIter.next();
+ readPoolProperty(mediator, dataSourceInformation, poolProp);
+ }
+ }
+ mediator.setDataSourceInformation(dataSourceInformation);
if (pool.getFirstChildWithName(ICCLASS_Q) != null) {
Modified:
synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/mediators/db/AbstractDBMediator.java
URL:
http://svn.apache.org/viewvc/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/mediators/db/AbstractDBMediator.java?rev=998886&r1=998885&r2=998886&view=diff
==============================================================================
---
synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/mediators/db/AbstractDBMediator.java
(original)
+++
synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/mediators/db/AbstractDBMediator.java
Mon Sep 20 11:05:12 2010
@@ -353,27 +353,27 @@ public abstract class AbstractDBMediator
if (finder.isInitialized()) {
// first try a lookup based on the data source name only
dataSource = finder.find(dataSourceName);
+ }
+
+ if(dataSource == null){
+ // decrypt the password if needed
+ String password =
jndiProperties.getProperty(Context.SECURITY_CREDENTIALS);
+ if (password != null && !"".equals(password)) {
+ jndiProperties.put(Context.SECURITY_CREDENTIALS,
getActualPassword(password));
+ }
- if (dataSource != null) {
- MBeanRepository mBeanRepository =
DatasourceMBeanRepository.getInstance();
- Object mBean = mBeanRepository.getMBean(dataSourceName);
- if (mBean instanceof DBPoolView) {
- setDbPoolView((DBPoolView) mBean);
- }
- } else {
- // decrypt the password if needed
- String password =
jndiProperties.getProperty(Context.SECURITY_CREDENTIALS);
- if (password != null && !"".equals(password)) {
- jndiProperties.put(Context.SECURITY_CREDENTIALS,
getActualPassword(password));
- }
-
- // lookup the data source using the specified jndi properties
- dataSource = DataSourceFinder.find(dataSourceName,
jndiProperties);
- if (dataSource == null) {
- handleException("Cannot find a DataSource " +
dataSourceName + " for given JNDI properties :" + jndiProperties);
- }
+ // lookup the data source using the specified jndi properties
+ dataSource = DataSourceFinder.find(dataSourceName, jndiProperties);
+ if (dataSource == null) {
+ handleException("Cannot find a DataSource " + dataSourceName +
" for given JNDI" +
+ " properties :" + jndiProperties);
}
}
+ MBeanRepository mBeanRepository =
DatasourceMBeanRepository.getInstance();
+ Object mBean = mBeanRepository.getMBean(dataSourceName);
+ if (mBean instanceof DBPoolView) {
+ setDbPoolView((DBPoolView) mBean);
+ }
log.info("Sunccessfully looked up datasource " + dataSourceName + ".");
return dataSource;