Author: indika
Date: Sat Sep 6 22:59:50 2008
New Revision: 692779
URL: http://svn.apache.org/viewvc?rev=692779&view=rev
Log: (empty)
Modified:
synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/util/datasource/DataSourceInformation.java
synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/util/datasource/DataSourceRegistrar.java
synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/util/datasource/JNDIBasedDataSourceRegistry.java
synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/util/datasource/factory/DataSourceFactory.java
synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/util/datasource/factory/DataSourceInformationFactory.java
synapse/trunk/java/repository/conf/synapse.properties
Modified:
synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/util/datasource/DataSourceInformation.java
URL:
http://svn.apache.org/viewvc/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/util/datasource/DataSourceInformation.java?rev=692779&r1=692778&r2=692779&view=diff
==============================================================================
---
synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/util/datasource/DataSourceInformation.java
(original)
+++
synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/util/datasource/DataSourceInformation.java
Sat Sep 6 22:59:50 2008
@@ -43,6 +43,16 @@
private boolean defaultReadOnly = false;
private boolean testOnBorrow = true;
private boolean testOnReturn = false;
+ private int minIdle = GenericObjectPool.DEFAULT_MAX_IDLE;
+ private int initialSize;
+ private int defaultTransactionIsolation = -1;
+ private String defaultCatalog;
+ private boolean accessToUnderlyingConnectionAllowed;
+ private boolean removeAbandoned;
+ private long removeAbandonedTimeout;
+ private boolean logAbandoned;
+ private boolean poolPreparedStatements;
+ private int maxOpenPreparedStatements;
private long timeBetweenEvictionRunsMillis =
GenericObjectPool.DEFAULT_TIME_BETWEEN_EVICTION_RUNS_MILLIS;
@@ -58,6 +68,80 @@
private final Map<String, Object> parameters = new HashMap<String,
Object>();
+
+ public int getMinIdle() {
+ return minIdle;
+ }
+
+ public void setMinIdle(int minIdle) {
+ this.minIdle = minIdle;
+ }
+
+
+ public int getDefaultTransactionIsolation() {
+ return defaultTransactionIsolation;
+ }
+
+ public void setDefaultTransactionIsolation(int
defaultTransactionIsolation) {
+ this.defaultTransactionIsolation = defaultTransactionIsolation;
+ }
+
+ public String getDefaultCatalog() {
+ return defaultCatalog;
+ }
+
+ public void setDefaultCatalog(String defaultCatalog) {
+ this.defaultCatalog = defaultCatalog;
+ }
+
+ public boolean isAccessToUnderlyingConnectionAllowed() {
+ return accessToUnderlyingConnectionAllowed;
+ }
+
+ public void setAccessToUnderlyingConnectionAllowed(boolean
accessToUnderlyingConnectionAllowed) {
+ this.accessToUnderlyingConnectionAllowed =
accessToUnderlyingConnectionAllowed;
+ }
+
+ public boolean isRemoveAbandoned() {
+ return removeAbandoned;
+ }
+
+ public void setRemoveAbandoned(boolean removeAbandoned) {
+ this.removeAbandoned = removeAbandoned;
+ }
+
+ public long getRemoveAbandonedTimeout() {
+ return removeAbandonedTimeout;
+ }
+
+ public void setRemoveAbandonedTimeout(long removeAbandonedTimeout) {
+ this.removeAbandonedTimeout = removeAbandonedTimeout;
+ }
+
+ public boolean isLogAbandoned() {
+ return logAbandoned;
+ }
+
+ public void setLogAbandoned(boolean logAbandoned) {
+ this.logAbandoned = logAbandoned;
+ }
+
+ public boolean isPoolPreparedStatements() {
+ return poolPreparedStatements;
+ }
+
+ public void setPoolPreparedStatements(boolean poolPreparedStatements) {
+ this.poolPreparedStatements = poolPreparedStatements;
+ }
+
+ public int getMaxOpenPreparedStatements() {
+ return maxOpenPreparedStatements;
+ }
+
+ public void setMaxOpenPreparedStatements(int maxOpenPreparedStatements) {
+ this.maxOpenPreparedStatements = maxOpenPreparedStatements;
+ }
+
public String getUser() {
return user;
}
@@ -209,4 +293,12 @@
public void setValidationQuery(String validationQuery) {
this.validationQuery = validationQuery;
}
+
+ public int getInitialSize() {
+ return initialSize;
+ }
+
+ public void setInitialSize(int initialSize) {
+ this.initialSize = initialSize;
+ }
}
Modified:
synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/util/datasource/DataSourceRegistrar.java
URL:
http://svn.apache.org/viewvc/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/util/datasource/DataSourceRegistrar.java?rev=692779&r1=692778&r2=692779&view=diff
==============================================================================
---
synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/util/datasource/DataSourceRegistrar.java
(original)
+++
synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/util/datasource/DataSourceRegistrar.java
Sat Sep 6 22:59:50 2008
@@ -35,7 +35,7 @@
*/
public class DataSourceRegistrar {
- public static final Log log = LogFactory.getLog(DataSourceRegistrar.class);
+ private static final Log log =
LogFactory.getLog(DataSourceRegistrar.class);
/**
* The static constants only for constructing key prefix for each property
@@ -87,6 +87,45 @@
// The prefix for root level properties
String rootPrefix = buffer.toString();
+ Properties jndiEvn = null;
+ //Registering data sources with the initial context
+ for (String dsName : dataSourcesNames) {
+
+ if (dsName == null) {
+ continue;
+ }
+
+ StringBuffer registryBuffer = new StringBuffer();
+ registryBuffer.append(rootPrefix);
+ registryBuffer.append(dsName);
+ registryBuffer.append(DOT_STRING);
+ registryBuffer.append(PROP_REGISTRY);
+ String registryKey = registryBuffer.toString();
+
+ String registry = MiscellaneousUtil.getProperty(dsProperties,
+ registryKey, PROP_REGISTRY_MEMORY);
+
+
+ DataSourceInformation information =
+ DataSourceInformationFactory.
+ createDataSourceInformation(dsName, dsProperties);
+
+ DataSourceRegistry dataSourceRegistry;
+
+ if (PROP_REGISTRY_JNDI.equals(registry)) {
+ if (jndiEvn == null) {
+ jndiEvn = createJNDIEnvironment(dsProperties, rootPrefix);
+ }
+ dataSourceRegistry =
JNDIBasedDataSourceRegistry.getInstance(jndiEvn);
+ } else {
+ dataSourceRegistry = InMemoryDataSourceRegistry.getInstance();
+ }
+ dataSourceRegistry.register(information);
+ }
+ }
+
+ private static Properties createJNDIEnvironment(Properties dsProperties,
String rootPrefix) {
+
// setting naming provider
Properties jndiEvn = new Properties(); //This is needed for
PerUserPoolDatasource
@@ -149,39 +188,6 @@
log.info("DataSources will be registered in the JNDI context with
provider PROP_URL : " +
providerUrl);
-
- //Registering data sources with the initial context
- for (String dsName : dataSourcesNames) {
-
- if (dsName == null) {
- continue;
- }
-
- StringBuffer registryBuffer = new StringBuffer();
- registryBuffer.append(SynapseConstants.SYNAPSE_DATASOURCES);
- registryBuffer.append(DOT_STRING);
- registryBuffer.append(dsName);
- registryBuffer.append(DOT_STRING);
- registryBuffer.append(PROP_REGISTRY);
- String registryKey = registryBuffer.toString();
-
- String registry = MiscellaneousUtil.getProperty(dsProperties,
- registryKey, PROP_REGISTRY_MEMORY);
-
-
- DataSourceInformation information =
- DataSourceInformationFactory.
- createDataSourceInformation(dsName, dsProperties);
-
- DataSourceRegistry dataSourceRegistry;
-
- if (PROP_REGISTRY_JNDI.equals(registry)) {
- dataSourceRegistry =
JNDIBasedDataSourceRegistry.getInstance(jndiEvn);
- } else {
- dataSourceRegistry = InMemoryDataSourceRegistry.getInstance();
- }
- dataSourceRegistry.register(information);
- }
-
+ return jndiEvn;
}
}
Modified:
synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/util/datasource/JNDIBasedDataSourceRegistry.java
URL:
http://svn.apache.org/viewvc/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/util/datasource/JNDIBasedDataSourceRegistry.java?rev=692779&r1=692778&r2=692779&view=diff
==============================================================================
---
synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/util/datasource/JNDIBasedDataSourceRegistry.java
(original)
+++
synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/util/datasource/JNDIBasedDataSourceRegistry.java
Sat Sep 6 22:59:50 2008
@@ -38,7 +38,8 @@
private static Log log =
LogFactory.getLog(JNDIBasedDataSourceRegistry.class);
- private static final JNDIBasedDataSourceRegistry ourInstance = new
JNDIBasedDataSourceRegistry();
+ private static final JNDIBasedDataSourceRegistry ourInstance =
+ new JNDIBasedDataSourceRegistry();
private static InitialContext initialContext;
private static final Properties indiEnv = new Properties();
private static boolean initialize = false;
@@ -136,13 +137,16 @@
// Construct DriverAdapterCPDS reference
String className = (String) information.getParameter(
DataSourceInformationFactory.PROP_CPDSADAPTER +
- DataSourceInformationFactory.DOT_STRING +
"className");
+ DataSourceInformationFactory.DOT_STRING +
+ DataSourceInformationFactory.PROP_CPDS_CLASS_NAME);
String factory = (String) information.getParameter(
DataSourceInformationFactory.PROP_CPDSADAPTER +
- DataSourceInformationFactory.DOT_STRING +
"factory");
+ DataSourceInformationFactory.DOT_STRING +
+ DataSourceInformationFactory.PROP_CPDS_FACTORY);
String name = (String) information.getParameter(
DataSourceInformationFactory.PROP_CPDSADAPTER +
- DataSourceInformationFactory.DOT_STRING + "name");
+ DataSourceInformationFactory.DOT_STRING +
+ DataSourceInformationFactory.PROP_CPDS_NAME);
Reference cpdsRef =
new Reference(className, factory, null);
@@ -257,69 +261,46 @@
*/
private static void setBasicDataSourceParameters(Reference ref,
DataSourceInformation information) {
- String defaultTransactionIsolation = (String) information.getParameter(
- DataSourceInformationFactory.PROP_DEFAULTTRANSACTIONISOLATION);
- String defaultCatalog = String.valueOf(
-
information.getParameter(DataSourceInformationFactory.PROP_DEFAULTCATALOG));
+ int defaultTransactionIsolation =
information.getDefaultTransactionIsolation();
+ String defaultCatalog = information.getDefaultCatalog();
- ref.add(
- new StringRefAddr(DataSourceInformationFactory.PROP_MINIDLE,
- String.valueOf(information.getParameter(
- DataSourceInformationFactory.PROP_MINIDLE))));
- if (defaultTransactionIsolation != null &&
!"".equals(defaultTransactionIsolation)) {
+ if (defaultTransactionIsolation != -1) {
ref.add(
new StringRefAddr(
DataSourceInformationFactory.PROP_DEFAULTTRANSACTIONISOLATION,
- String.valueOf(
- information.getParameter(
- DataSourceInformationFactory.
-
PROP_DEFAULTTRANSACTIONISOLATION))));
+ String.valueOf(defaultTransactionIsolation)));
}
ref.add(
+ new StringRefAddr(DataSourceInformationFactory.PROP_MINIDLE,
+ String.valueOf(information.getMaxIdle())));
+ ref.add(
new StringRefAddr(
DataSourceInformationFactory.PROP_ACCESSTOUNDERLYINGCONNECTIONALLOWED,
- String.valueOf(
- information.getParameter(
- DataSourceInformationFactory.
-
PROP_ACCESSTOUNDERLYINGCONNECTIONALLOWED))));
+
String.valueOf(information.isAccessToUnderlyingConnectionAllowed())));
ref.add(
new StringRefAddr(
DataSourceInformationFactory.PROP_REMOVEABANDONED,
- String.valueOf(
- information.getParameter(
-
DataSourceInformationFactory.PROP_REMOVEABANDONED))));
+ String.valueOf(information.isRemoveAbandoned())));
ref.add
(new
StringRefAddr(DataSourceInformationFactory.PROP_REMOVEABANDONEDTIMEOUT,
- String.valueOf(
- information.getParameter
- (DataSourceInformationFactory.
-
PROP_REMOVEABANDONEDTIMEOUT))));
+
String.valueOf(information.getRemoveAbandonedTimeout())));
ref.add
(new StringRefAddr(
DataSourceInformationFactory.PROP_LOGABANDONED,
- String.valueOf(
- information.getParameter(
-
DataSourceInformationFactory.PROP_LOGABANDONED))));
+ String.valueOf(information.isLogAbandoned())));
ref.add(
new StringRefAddr(
DataSourceInformationFactory.PROP_POOLPREPAREDSTATEMENTS,
- String.valueOf(
- information.getParameter(
- DataSourceInformationFactory.
-
PROP_POOLPREPAREDSTATEMENTS))));
+
String.valueOf(information.isPoolPreparedStatements())));
ref.add(
new
StringRefAddr(DataSourceInformationFactory.PROP_MAXOPENPREPAREDSTATEMENTS,
- String.valueOf(
- information.getParameter(
- DataSourceInformationFactory.
-
PROP_MAXOPENPREPAREDSTATEMENTS))));
+
String.valueOf(information.getMaxOpenPreparedStatements())));
ref.add(
new StringRefAddr(
DataSourceInformationFactory.PROP_INITIALSIZE,
String.valueOf(
- information.getParameter(
-
DataSourceInformationFactory.PROP_INITIALSIZE))));
+ information.getInitialSize())));
if (defaultCatalog != null && !"".equals(defaultCatalog)) {
ref.add(new StringRefAddr
Modified:
synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/util/datasource/factory/DataSourceFactory.java
URL:
http://svn.apache.org/viewvc/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/util/datasource/factory/DataSourceFactory.java?rev=692779&r1=692778&r2=692779&view=diff
==============================================================================
---
synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/util/datasource/factory/DataSourceFactory.java
(original)
+++
synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/util/datasource/factory/DataSourceFactory.java
Sat Sep 6 22:59:50 2008
@@ -19,6 +19,8 @@
package org.apache.synapse.util.datasource.factory;
import org.apache.commons.dbcp.BasicDataSource;
+import org.apache.commons.dbcp.cpdsadapter.DriverAdapterCPDS;
+import org.apache.commons.dbcp.datasources.PerUserPoolDataSource;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.synapse.SynapseException;
@@ -62,6 +64,8 @@
String user = information.getUser();
String password = information.getPassword();
+ int defaultTransactionIsolation =
information.getDefaultTransactionIsolation();
+
if (DataSourceInformation.BASIC_DATA_SOURCE.equals(dsType)) {
@@ -80,19 +84,98 @@
basicDataSource.setMaxActive(information.getMaxActive());
basicDataSource.setMaxIdle(information.getMaxIdle());
basicDataSource.setMaxWait(information.getMaxWait());
+ basicDataSource.setMaxIdle(information.getMaxIdle());
basicDataSource.setDefaultAutoCommit(information.isDefaultAutoCommit());
basicDataSource.setDefaultReadOnly(information.isDefaultReadOnly());
basicDataSource.setTestOnBorrow(information.isTestOnBorrow());
basicDataSource.setTestOnReturn(information.isTestOnReturn());
basicDataSource.setTestWhileIdle(information.isTestWhileIdle());
+ basicDataSource.setMinEvictableIdleTimeMillis(
+ information.getMinEvictableIdleTimeMillis());
+ basicDataSource.setTimeBetweenEvictionRunsMillis(
+ information.getTimeBetweenEvictionRunsMillis());
+ basicDataSource.setNumTestsPerEvictionRun(
+ information.getNumTestsPerEvictionRun());
+ basicDataSource.setMaxOpenPreparedStatements(
+ information.getMaxOpenPreparedStatements());
+ basicDataSource.setAccessToUnderlyingConnectionAllowed(
+ information.isAccessToUnderlyingConnectionAllowed());
+ basicDataSource.setInitialSize(information.getInitialSize());
+
basicDataSource.setPoolPreparedStatements(information.isPoolPreparedStatements());
+
+
+ if (defaultTransactionIsolation != -1) {
+
basicDataSource.setDefaultTransactionIsolation(defaultTransactionIsolation);
+ }
+
+ String defaultCatalog = information.getDefaultCatalog();
+ if (defaultCatalog != null || !"".equals(defaultCatalog)) {
+ basicDataSource.setDefaultCatalog(defaultCatalog);
+ }
String validationQuery = information.getValidationQuery();
if (validationQuery != null && !"".equals(validationQuery)) {
basicDataSource.setValidationQuery(validationQuery);
}
+
return basicDataSource;
+ } else if
(DataSourceInformation.PER_USER_POOL_DATA_SOURCE.equals(dsType)) {
+
+ DriverAdapterCPDS adapterCPDS = new DriverAdapterCPDS();
+
+ try {
+ adapterCPDS.setDriver(driver);
+ } catch (ClassNotFoundException e) {
+ handleException("Error setting driver : " + driver + "
DriverAdapterCPDS");
+ }
+
+ adapterCPDS.setUrl(url);
+
+ if (user != null && !"".equals(user)) {
+ adapterCPDS.setUser(user);
+ }
+
+ if (password != null && !"".equals(password)) {
+ adapterCPDS.setPassword(password);
+ }
+
+
adapterCPDS.setPoolPreparedStatements(information.isPoolPreparedStatements());
+ adapterCPDS.setMaxIdle(information.getMaxIdle());
+
+
+ PerUserPoolDataSource perUserPoolDataSource = new
PerUserPoolDataSource();
+ perUserPoolDataSource.setConnectionPoolDataSource(adapterCPDS);
+
+
perUserPoolDataSource.setDefaultMaxActive(information.getMaxActive());
+ perUserPoolDataSource.setDefaultMaxIdle(information.getMaxIdle());
+ perUserPoolDataSource.setDefaultMaxWait((int)
information.getMaxWait());
+
perUserPoolDataSource.setDefaultAutoCommit(information.isDefaultAutoCommit());
+
perUserPoolDataSource.setDefaultReadOnly(information.isDefaultReadOnly());
+
perUserPoolDataSource.setTestOnBorrow(information.isTestOnBorrow());
+
perUserPoolDataSource.setTestOnReturn(information.isTestOnReturn());
+
perUserPoolDataSource.setTestWhileIdle(information.isTestWhileIdle());
+ perUserPoolDataSource.setMinEvictableIdleTimeMillis(
+ (int) information.getMinEvictableIdleTimeMillis());
+ perUserPoolDataSource.setTimeBetweenEvictionRunsMillis(
+ (int) information.getTimeBetweenEvictionRunsMillis());
+ perUserPoolDataSource.setNumTestsPerEvictionRun(
+ information.getNumTestsPerEvictionRun());
+
+ if (defaultTransactionIsolation != -1) {
+
perUserPoolDataSource.setDefaultTransactionIsolation(defaultTransactionIsolation);
+ }
+
+
+ String validationQuery = information.getValidationQuery();
+
+ if (validationQuery != null && !"".equals(validationQuery)) {
+ perUserPoolDataSource.setValidationQuery(validationQuery);
+ }
+
+ return perUserPoolDataSource;
+
} else {
handleException("Unsupported DataSorce : " + dsType);
}
Modified:
synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/util/datasource/factory/DataSourceInformationFactory.java
URL:
http://svn.apache.org/viewvc/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/util/datasource/factory/DataSourceInformationFactory.java?rev=692779&r1=692778&r2=692779&view=diff
==============================================================================
---
synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/util/datasource/factory/DataSourceInformationFactory.java
(original)
+++
synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/util/datasource/factory/DataSourceInformationFactory.java
Sat Sep 6 22:59:50 2008
@@ -55,6 +55,9 @@
public static final String PROP_DEFAULTMAXIDLE = "defaultMaxIdle";
public static final String PROP_DEFAULTMAXWAIT = "defaultMaxWait";
public static final String PROP_DATA_SOURCE_NAME = "dataSourceName";
+ public static final String PROP_CPDS_CLASS_NAME = "className";
+ public static final String PROP_CPDS_FACTORY = "factory";
+ public static final String PROP_CPDS_NAME = "name";
public final static String PROP_DEFAULTAUTOCOMMIT = "defaultAutoCommit";
public final static String PROP_DEFAULTREADONLY = "defaultReadOnly";
@@ -134,6 +137,7 @@
String password = (String) MiscellaneousUtil.getProperty(
properties, prefix + PROP_PASSWORD, "synapse", String.class);
+
information.setPassword(password);
String dataSourceName = (String) MiscellaneousUtil.getProperty(
@@ -180,87 +184,87 @@
boolean defaultAutoCommit = (Boolean)
MiscellaneousUtil.getProperty(properties,
prefix + PROP_DEFAULTAUTOCOMMIT, true, Boolean.class);
+
boolean defaultReadOnly = (Boolean)
MiscellaneousUtil.getProperty(properties,
prefix + PROP_DEFAULTREADONLY, false, Boolean.class);
+
boolean testOnBorrow = (Boolean)
MiscellaneousUtil.getProperty(properties,
prefix + PROP_TESTONBORROW, true, Boolean.class);
+
boolean testOnReturn = (Boolean)
MiscellaneousUtil.getProperty(properties,
prefix + PROP_TESTONRETURN, false, Boolean.class);
+
long timeBetweenEvictionRunsMillis = (Long)
MiscellaneousUtil.getProperty(properties,
prefix + PROP_TIMEBETWEENEVICTIONRUNSMILLIS,
GenericObjectPool.DEFAULT_TIME_BETWEEN_EVICTION_RUNS_MILLIS,
Long.class);
+
int numTestsPerEvictionRun = (Integer)
MiscellaneousUtil.getProperty(properties,
prefix + PROP_NUMTESTSPEREVICTIONRUN,
GenericObjectPool.DEFAULT_NUM_TESTS_PER_EVICTION_RUN,
Integer.class);
+
long minEvictableIdleTimeMillis = (Long)
MiscellaneousUtil.getProperty(properties,
prefix + PROP_MINEVICTABLEIDLETIMEMILLIS,
GenericObjectPool.DEFAULT_MIN_EVICTABLE_IDLE_TIME_MILLIS,
Long.class);
+
boolean testWhileIdle = (Boolean)
MiscellaneousUtil.getProperty(properties,
prefix + PROP_TESTWHILEIDLE, false, Boolean.class);
+
String validationQuery = MiscellaneousUtil.getProperty(properties,
prefix + PROP_VALIDATIONQUERY, null);
- information.setDefaultAutoCommit(defaultAutoCommit);
- information.setDefaultReadOnly(defaultReadOnly);
- information.setTestOnBorrow(testOnBorrow);
- information.setTestOnReturn(testOnReturn);
-
information.setTimeBetweenEvictionRunsMillis(timeBetweenEvictionRunsMillis);
- information.setNumTestsPerEvictionRun(numTestsPerEvictionRun);
- information.setMinEvictableIdleTimeMillis(minEvictableIdleTimeMillis);
- information.setTestWhileIdle(testWhileIdle);
- information.setValidationQuery(validationQuery);
-
- setBasicDataSourceParameters(information, properties, prefix);
-
- return information;
- }
-
- /**
- * /**
- * Helper method to set all BasicDataSource specific parameter
- *
- * @param information The naming reference instance
- * @param properties The properties which contains required parameter
value
- * @param prefix The key prefix for which is used to get data from
given properties
- */
- public static void setBasicDataSourceParameters(DataSourceInformation
information, Properties properties, String prefix) {
-
int minIdle = (Integer) MiscellaneousUtil.getProperty(properties,
prefix + PROP_MINIDLE, GenericObjectPool.DEFAULT_MIN_IDLE,
Integer.class);
+
int initialSize = (Integer) MiscellaneousUtil.getProperty(
properties, prefix + PROP_INITIALSIZE, 0, Integer.class);
- String defaultTransactionIsolation =
MiscellaneousUtil.getProperty(properties,
- prefix + PROP_DEFAULTTRANSACTIONISOLATION, null);
+
+ int defaultTransactionIsolation = (Integer)
MiscellaneousUtil.getProperty(properties,
+ prefix + PROP_DEFAULTTRANSACTIONISOLATION, -1, Integer.class);
+
String defaultCatalog = MiscellaneousUtil.getProperty(
properties, prefix + PROP_DEFAULTCATALOG, null);
+
boolean accessToUnderlyingConnectionAllowed =
(Boolean) MiscellaneousUtil.getProperty(properties,
prefix + PROP_ACCESSTOUNDERLYINGCONNECTIONALLOWED,
false, Boolean.class);
+
boolean removeAbandoned = (Boolean)
MiscellaneousUtil.getProperty(properties,
prefix + PROP_REMOVEABANDONED, false, Boolean.class);
+
int removeAbandonedTimeout = (Integer)
MiscellaneousUtil.getProperty(properties,
prefix + PROP_REMOVEABANDONEDTIMEOUT, 300, Integer.class);
+
boolean logAbandoned = (Boolean)
MiscellaneousUtil.getProperty(properties,
prefix + PROP_LOGABANDONED, false, Boolean.class);
+
boolean poolPreparedStatements = (Boolean)
MiscellaneousUtil.getProperty(properties,
prefix + PROP_POOLPREPAREDSTATEMENTS, false, Boolean.class);
+
int maxOpenPreparedStatements = (Integer)
MiscellaneousUtil.getProperty(properties,
prefix + PROP_MAXOPENPREPAREDSTATEMENTS,
GenericKeyedObjectPool.DEFAULT_MAX_TOTAL, Integer.class);
- information.addParameter(PROP_MINIDLE, minIdle);
- information.addParameter(PROP_DEFAULTTRANSACTIONISOLATION,
- defaultTransactionIsolation);
- information.addParameter(PROP_ACCESSTOUNDERLYINGCONNECTIONALLOWED,
- accessToUnderlyingConnectionAllowed);
- information.addParameter(PROP_REMOVEABANDONED, removeAbandoned);
- information.addParameter(PROP_REMOVEABANDONEDTIMEOUT,
removeAbandonedTimeout);
- information.addParameter(PROP_LOGABANDONED, logAbandoned);
- information.addParameter(PROP_POOLPREPAREDSTATEMENTS,
poolPreparedStatements);
- information.addParameter(PROP_MAXOPENPREPAREDSTATEMENTS,
- maxOpenPreparedStatements);
- information.addParameter(PROP_INITIALSIZE, initialSize);
- information.addParameter(PROP_DEFAULTCATALOG, defaultCatalog);
+ information.setDefaultAutoCommit(defaultAutoCommit);
+ information.setDefaultReadOnly(defaultReadOnly);
+ information.setTestOnBorrow(testOnBorrow);
+ information.setTestOnReturn(testOnReturn);
+
information.setTimeBetweenEvictionRunsMillis(timeBetweenEvictionRunsMillis);
+ information.setNumTestsPerEvictionRun(numTestsPerEvictionRun);
+ information.setMinEvictableIdleTimeMillis(minEvictableIdleTimeMillis);
+ information.setTestWhileIdle(testWhileIdle);
+ information.setValidationQuery(validationQuery);
+ information.setMaxIdle(minIdle);
+
information.setDefaultTransactionIsolation(defaultTransactionIsolation);
+
information.setAccessToUnderlyingConnectionAllowed(accessToUnderlyingConnectionAllowed);
+ information.setRemoveAbandoned(removeAbandoned);
+ information.setRemoveAbandonedTimeout(removeAbandonedTimeout);
+ information.setLogAbandoned(logAbandoned);
+ information.setPoolPreparedStatements(poolPreparedStatements);
+ information.setMaxOpenPreparedStatements(maxOpenPreparedStatements);
+ information.setInitialSize(initialSize);
+ information.setDefaultCatalog(defaultCatalog);
+
+ return information;
}
/**
Modified: synapse/trunk/java/repository/conf/synapse.properties
URL:
http://svn.apache.org/viewvc/synapse/trunk/java/repository/conf/synapse.properties?rev=692779&r1=692778&r2=692779&view=diff
==============================================================================
--- synapse/trunk/java/repository/conf/synapse.properties (original)
+++ synapse/trunk/java/repository/conf/synapse.properties Sat Sep 6 22:59:50
2008
@@ -1,74 +1,74 @@
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-#
-
-#synapse.threads.core = 20
-#synapse.threads.max = 100
-#synapse.threads.keepalive = 5
-#synapse.threads.qlen = 10
-#synapse.threads.group = synapse-thread-group
-#synapse.threads.idprefix = SynapseWorker
-
-# KeyStores configurations
-
-#keystore.identity.location=lib/identity.jks
-#keystore.identity.type=JKS
-#keystore.identity.alias=synapse
-#keystore.identity.storePassword=password
-#keystore.identity.keyPassword=password
-#keystore.identity.parameters=enableHostnameVerifier=false;keyStoreCertificateFilePath=/home/esb.cer
-#
-#keystore.trust.location=lib/trust.jks
-#keystore.trust.type=JKS
-#keystore.trust.alias=synapse
-#keystore.trust.storePassword=password
-#keystore.trust.parameters=enableHostnameVerifier=false;keyStoreCertificateFilePath=/home/esb.cer
-
-# DataSources Configurations
-
-#synapse.datasources=lookupds,reportds
-#synapse.datasources.icFactory=com.sun.jndi.rmi.registry.RegistryContextFactory
-#synapse.datasources.providerPort=2199
-## If following property is present , then assume that
-##synapse.datasources.providerUrl=rmi://localhost:2199
-#
-#
-#synapse.datasources.lookupds.registry=Memory
-#synapse.datasources.lookupds.type=BasicDataSource
-#synapse.datasources.lookupds.driverClassName=org.apache.derby.jdbc.ClientDriver
-#synapse.datasources.lookupds.url=jdbc:derby://localhost:1527/lookupdb;create=false
-#synapse.datasources.lookupds.username=synapse
-#synapse.datasources.lookupds.password=synapse
-#synapse.datasources.lookupds.dsName=lookupdb
-#synapse.datasources.lookupds.maxActive=100
-#synapse.datasources.lookupds.maxIdle=20
-#synapse.datasources.lookupds.maxWait=10000
-#
-#synapse.datasources.reportds.registry=JNDI
-#synapse.datasources.reportds.type=PerUserPoolDataSource
-#synapse.datasources.reportds.cpdsadapter.factory=org.apache.commons.dbcp.cpdsadapter.DriverAdapterCPDS
-#synapse.datasources.reportds.cpdsadapter.className=org.apache.commons.dbcp.cpdsadapter.DriverAdapterCPDS
-#synapse.datasources.reportds.cpdsadapter.name=cpds
-#synapse.datasources.reportds.dsName=reportdb
-#synapse.datasources.reportds.driverClassName=org.apache.derby.jdbc.ClientDriver
-#synapse.datasources.reportds.url=jdbc:derby://localhost:1527/reportdb;create=false
-#synapse.datasources.reportds.username=synapse
-#synapse.datasources.reportds.password=synapse
-#synapse.datasources.reportds.maxActive=100
-#synapse.datasources.reportds.maxIdle=20
-#synapse.datasources.reportds.maxWait=10000
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+#synapse.threads.core = 20
+#synapse.threads.max = 100
+#synapse.threads.keepalive = 5
+#synapse.threads.qlen = 10
+#synapse.threads.group = synapse-thread-group
+#synapse.threads.idprefix = SynapseWorker
+
+# KeyStores configurations
+
+#keystore.identity.location=lib/identity.jks
+#keystore.identity.type=JKS
+#keystore.identity.alias=synapse
+#keystore.identity.storePassword=password
+#keystore.identity.keyPassword=password
+#keystore.identity.parameters=enableHostnameVerifier=false;keyStoreCertificateFilePath=/home/esb.cer
+#
+#keystore.trust.location=lib/trust.jks
+#keystore.trust.type=JKS
+#keystore.trust.alias=synapse
+#keystore.trust.storePassword=password
+#keystore.trust.parameters=enableHostnameVerifier=false;keyStoreCertificateFilePath=/home/esb.cer
+
+# DataSources Configurations
+
+#synapse.datasources=lookupds,reportds
+#synapse.datasources.icFactory=com.sun.jndi.rmi.registry.RegistryContextFactory
+#synapse.datasources.providerPort=2199
+## If following property is present , then assumes that there is an external
JNDI provider and will not start a RMI registry
+##synapse.datasources.providerUrl=rmi://localhost:2199
+#
+#
+#synapse.datasources.lookupds.registry=Memory
+#synapse.datasources.lookupds.type=BasicDataSource
+#synapse.datasources.lookupds.driverClassName=org.apache.derby.jdbc.ClientDriver
+#synapse.datasources.lookupds.url=jdbc:derby://localhost:1527/lookupdb;create=false
+#synapse.datasources.lookupds.username=synapse
+#synapse.datasources.lookupds.password=synapse
+#synapse.datasources.lookupds.dsName=lookupdb
+#synapse.datasources.lookupds.maxActive=100
+#synapse.datasources.lookupds.maxIdle=20
+#synapse.datasources.lookupds.maxWait=10000
+#
+#synapse.datasources.reportds.registry=JNDI
+#synapse.datasources.reportds.type=PerUserPoolDataSource
+#synapse.datasources.reportds.cpdsadapter.factory=org.apache.commons.dbcp.cpdsadapter.DriverAdapterCPDS
+#synapse.datasources.reportds.cpdsadapter.className=org.apache.commons.dbcp.cpdsadapter.DriverAdapterCPDS
+#synapse.datasources.reportds.cpdsadapter.name=cpds
+#synapse.datasources.reportds.dsName=reportdb
+#synapse.datasources.reportds.driverClassName=org.apache.derby.jdbc.ClientDriver
+#synapse.datasources.reportds.url=jdbc:derby://localhost:1527/reportdb;create=false
+#synapse.datasources.reportds.username=synapse
+#synapse.datasources.reportds.password=synapse
+#synapse.datasources.reportds.maxActive=100
+#synapse.datasources.reportds.maxIdle=20
+#synapse.datasources.reportds.maxWait=10000