Modified: synapse/trunk/java/modules/utils/src/main/java/org/apache/synapse/commons/util/datasource/factory/DataSourceInformationFactory.java URL: http://svn.apache.org/viewvc/synapse/trunk/java/modules/utils/src/main/java/org/apache/synapse/commons/util/datasource/factory/DataSourceInformationFactory.java?rev=766966&r1=766965&r2=766966&view=diff ============================================================================== --- synapse/trunk/java/modules/utils/src/main/java/org/apache/synapse/commons/util/datasource/factory/DataSourceInformationFactory.java (original) +++ synapse/trunk/java/modules/utils/src/main/java/org/apache/synapse/commons/util/datasource/factory/DataSourceInformationFactory.java Tue Apr 21 03:45:30 2009 @@ -26,7 +26,9 @@ import org.apache.synapse.commons.util.SynapseUtilException; import org.apache.synapse.commons.util.datasource.DataSourceConfigurationConstants; import org.apache.synapse.commons.util.datasource.DataSourceInformation; -import org.apache.synapse.commons.util.secret.SecretCallbackHandlerFactory; +import org.apache.synapse.commons.util.secret.SecretConfigurationConstants; +import org.apache.synapse.commons.util.secret.SecretInformation; +import org.apache.synapse.commons.util.secret.SecretInformationFactory; import java.util.Properties; @@ -60,7 +62,7 @@ } StringBuffer buffer = new StringBuffer(); - buffer.append(DataSourceConfigurationConstants.PROP_SYNAPSE_DATASOURCES); + buffer.append(DataSourceConfigurationConstants.PROP_SYNAPSE_PREFIX_DS); buffer.append(DataSourceConfigurationConstants.DOT_STRING); buffer.append(dsName); buffer.append(DataSourceConfigurationConstants.DOT_STRING); @@ -82,60 +84,44 @@ " cannot be found."); } - DataSourceInformation information = new DataSourceInformation(); - information.setAlias(dsName); + DataSourceInformation datasourceInformation = new DataSourceInformation(); + datasourceInformation.setAlias(dsName); - information.setDriver(driver); - information.setUrl(url); - - // get other required properties - String user = (String) MiscellaneousUtil.getProperty( - properties, prefix + DataSourceConfigurationConstants.PROP_USER_NAME, null, - String.class); - if (user != null && !"".equals(user)) { - information.setUser(user); - } - - String password = (String) MiscellaneousUtil.getProperty( - properties, prefix + DataSourceConfigurationConstants.PROP_PASSWORD, null, - String.class); - - if (password != null && !"".equals(password)) { - information.setAliasPassword(password); - } + datasourceInformation.setDriver(driver); + datasourceInformation.setUrl(url); String dataSourceName = (String) MiscellaneousUtil.getProperty( properties, prefix + DataSourceConfigurationConstants.PROP_DSNAME, dsName, String.class); - information.setDatasourceName(dataSourceName); + datasourceInformation.setDatasourceName(dataSourceName); String dsType = (String) MiscellaneousUtil.getProperty( properties, prefix + DataSourceConfigurationConstants.PROP_TYPE, DataSourceConfigurationConstants.PROP_BASIC_DATA_SOURCE, String.class); - information.setType(dsType); + datasourceInformation.setType(dsType); String repositoryType = (String) MiscellaneousUtil.getProperty( properties, prefix + DataSourceConfigurationConstants.PROP_REGISTRY, DataSourceConfigurationConstants.PROP_REGISTRY_MEMORY, String.class); - information.setRepositoryType(repositoryType); + datasourceInformation.setRepositoryType(repositoryType); Integer maxActive = (Integer) MiscellaneousUtil.getProperty( properties, prefix + DataSourceConfigurationConstants.PROP_MAXACTIVE, GenericObjectPool.DEFAULT_MAX_ACTIVE, Integer.class); - information.setMaxActive(maxActive); + datasourceInformation.setMaxActive(maxActive); Integer maxIdle = (Integer) MiscellaneousUtil.getProperty( properties, prefix + DataSourceConfigurationConstants.PROP_MAXIDLE, GenericObjectPool.DEFAULT_MAX_IDLE, Integer.class); - information.setMaxIdle(maxIdle); + datasourceInformation.setMaxIdle(maxIdle); Long maxWait = (Long) MiscellaneousUtil.getProperty( properties, prefix + DataSourceConfigurationConstants.PROP_MAXWAIT, GenericObjectPool.DEFAULT_MAX_WAIT, Long.class); - information.setMaxWait(maxWait); + datasourceInformation.setMaxWait(maxWait); // Construct DriverAdapterCPDS reference String suffix = DataSourceConfigurationConstants.PROP_CPDSADAPTER + @@ -143,19 +129,19 @@ DataSourceConfigurationConstants.PROP_CLASS_NAME; String className = MiscellaneousUtil.getProperty(properties, prefix + suffix, DataSourceConfigurationConstants.PROP_CPDSADAPTER_DRIVER); - information.addParameter(suffix, className); + datasourceInformation.addParameter(suffix, className); suffix = DataSourceConfigurationConstants.PROP_CPDSADAPTER + DataSourceConfigurationConstants.DOT_STRING + DataSourceConfigurationConstants.PROP_FACTORY; String factory = MiscellaneousUtil.getProperty(properties, prefix + suffix, DataSourceConfigurationConstants.PROP_CPDSADAPTER_DRIVER); - information.addParameter(suffix, factory); + datasourceInformation.addParameter(suffix, factory); suffix = DataSourceConfigurationConstants.PROP_CPDSADAPTER + DataSourceConfigurationConstants.DOT_STRING + DataSourceConfigurationConstants.PROP_NAME; String name = MiscellaneousUtil.getProperty(properties, prefix + suffix, "cpds"); - information.addParameter(suffix, name); + datasourceInformation.addParameter(suffix, name); boolean defaultAutoCommit = (Boolean) MiscellaneousUtil.getProperty(properties, prefix + DataSourceConfigurationConstants.PROP_DEFAULTAUTOCOMMIT, true, @@ -235,52 +221,61 @@ prefix + DataSourceConfigurationConstants.PROP_MAXOPENPREPAREDSTATEMENTS, GenericKeyedObjectPool.DEFAULT_MAX_TOTAL, Integer.class); - 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.setMinIdle(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); + datasourceInformation.setDefaultAutoCommit(defaultAutoCommit); + datasourceInformation.setDefaultReadOnly(defaultReadOnly); + datasourceInformation.setTestOnBorrow(testOnBorrow); + datasourceInformation.setTestOnReturn(testOnReturn); + datasourceInformation.setTimeBetweenEvictionRunsMillis(timeBetweenEvictionRunsMillis); + datasourceInformation.setNumTestsPerEvictionRun(numTestsPerEvictionRun); + datasourceInformation.setMinEvictableIdleTimeMillis(minEvictableIdleTimeMillis); + datasourceInformation.setTestWhileIdle(testWhileIdle); + datasourceInformation.setMinIdle(minIdle); + datasourceInformation.setDefaultTransactionIsolation(defaultTransactionIsolation); + datasourceInformation.setAccessToUnderlyingConnectionAllowed( + accessToUnderlyingConnectionAllowed); + datasourceInformation.setRemoveAbandoned(removeAbandoned); + datasourceInformation.setRemoveAbandonedTimeout(removeAbandonedTimeout); + datasourceInformation.setLogAbandoned(logAbandoned); + datasourceInformation.setPoolPreparedStatements(poolPreparedStatements); + datasourceInformation.setMaxOpenPreparedStatements(maxOpenPreparedStatements); + datasourceInformation.setInitialSize(initialSize); if (validationQuery != null && !"".equals(validationQuery)) { - information.setValidationQuery(validationQuery); + datasourceInformation.setValidationQuery(validationQuery); } if (defaultCatalog != null && !"".equals(defaultCatalog)) { - information.setDefaultCatalog(defaultCatalog); + datasourceInformation.setDefaultCatalog(defaultCatalog); } - information.addProperty(prefix + DataSourceConfigurationConstants.PROP_ICFACTORY, + datasourceInformation.addProperty( + prefix + DataSourceConfigurationConstants.PROP_ICFACTORY, MiscellaneousUtil.getProperty( properties, prefix + DataSourceConfigurationConstants.PROP_ICFACTORY, null)); //Provider URL - information.addProperty(prefix + DataSourceConfigurationConstants.PROP_PROVIDER_URL, + datasourceInformation.addProperty( + prefix + DataSourceConfigurationConstants.PROP_PROVIDER_URL, MiscellaneousUtil.getProperty( properties, prefix + DataSourceConfigurationConstants.PROP_PROVIDER_URL, null)); - information.addProperty(prefix + DataSourceConfigurationConstants.PROP_PROVIDER_PORT, + datasourceInformation.addProperty( + prefix + DataSourceConfigurationConstants.PROP_PROVIDER_PORT, MiscellaneousUtil.getProperty( properties, prefix + DataSourceConfigurationConstants.PROP_PROVIDER_PORT, null)); - information.setPasswordProvider( - SecretCallbackHandlerFactory.createSecretCallbackHandler(properties, - prefix + DataSourceConfigurationConstants.PROP_PASSWORD_PROVIDER)); + String passwordPrompt = (String) MiscellaneousUtil.getProperty( + properties, prefix + SecretConfigurationConstants.PROP_PASSWORD_PROMPT, + "Password for datasource " + dsName, String.class); + + SecretInformation secretInformation = SecretInformationFactory.createSecretInformation( + properties, prefix, passwordPrompt); + + datasourceInformation.setSecretInformation(secretInformation); - return information; + return datasourceInformation; } /**
Modified: synapse/trunk/java/modules/utils/src/main/java/org/apache/synapse/commons/util/datasource/factory/DataSourceInformationListFactory.java URL: http://svn.apache.org/viewvc/synapse/trunk/java/modules/utils/src/main/java/org/apache/synapse/commons/util/datasource/factory/DataSourceInformationListFactory.java?rev=766966&r1=766965&r2=766966&view=diff ============================================================================== --- synapse/trunk/java/modules/utils/src/main/java/org/apache/synapse/commons/util/datasource/factory/DataSourceInformationListFactory.java (original) +++ synapse/trunk/java/modules/utils/src/main/java/org/apache/synapse/commons/util/datasource/factory/DataSourceInformationListFactory.java Tue Apr 21 03:45:30 2009 @@ -55,7 +55,7 @@ } String dataSources = MiscellaneousUtil.getProperty(dsProperties, - DataSourceConfigurationConstants.PROP_SYNAPSE_DATASOURCES, null); + DataSourceConfigurationConstants.PROP_SYNAPSE_PREFIX_DS, null); if (dataSources == null || "".equals(dataSources)) { if (log.isDebugEnabled()) { Modified: synapse/trunk/java/modules/utils/src/main/java/org/apache/synapse/commons/util/datasource/serializer/DataSourceInformationListSerializer.java URL: http://svn.apache.org/viewvc/synapse/trunk/java/modules/utils/src/main/java/org/apache/synapse/commons/util/datasource/serializer/DataSourceInformationListSerializer.java?rev=766966&r1=766965&r2=766966&view=diff ============================================================================== --- synapse/trunk/java/modules/utils/src/main/java/org/apache/synapse/commons/util/datasource/serializer/DataSourceInformationListSerializer.java (original) +++ synapse/trunk/java/modules/utils/src/main/java/org/apache/synapse/commons/util/datasource/serializer/DataSourceInformationListSerializer.java Tue Apr 21 03:45:30 2009 @@ -47,7 +47,7 @@ properties.putAll(DataSourceInformationSerializer.serialize(information)); } } - properties.put(DataSourceConfigurationConstants.PROP_SYNAPSE_DATASOURCES, + properties.put(DataSourceConfigurationConstants.PROP_SYNAPSE_PREFIX_DS, dataSources.toString()); return properties; } Modified: synapse/trunk/java/modules/utils/src/main/java/org/apache/synapse/commons/util/datasource/serializer/DataSourceInformationSerializer.java URL: http://svn.apache.org/viewvc/synapse/trunk/java/modules/utils/src/main/java/org/apache/synapse/commons/util/datasource/serializer/DataSourceInformationSerializer.java?rev=766966&r1=766965&r2=766966&view=diff ============================================================================== --- synapse/trunk/java/modules/utils/src/main/java/org/apache/synapse/commons/util/datasource/serializer/DataSourceInformationSerializer.java (original) +++ synapse/trunk/java/modules/utils/src/main/java/org/apache/synapse/commons/util/datasource/serializer/DataSourceInformationSerializer.java Tue Apr 21 03:45:30 2009 @@ -20,6 +20,7 @@ import org.apache.synapse.commons.util.datasource.DataSourceConfigurationConstants; import org.apache.synapse.commons.util.datasource.DataSourceInformation; +import org.apache.synapse.commons.util.secret.SecretConfigurationConstants; import java.util.Properties; @@ -40,7 +41,7 @@ String alias = information.getAlias(); StringBuffer buffer = new StringBuffer(); - buffer.append(DataSourceConfigurationConstants.PROP_SYNAPSE_DATASOURCES); + buffer.append(DataSourceConfigurationConstants.PROP_SYNAPSE_PREFIX_DS); buffer.append(DataSourceConfigurationConstants.DOT_STRING); buffer.append(alias); buffer.append(DataSourceConfigurationConstants.DOT_STRING); @@ -49,10 +50,10 @@ String prefix = buffer.toString(); addProperty(properties, prefix + DataSourceConfigurationConstants.PROP_DSNAME, information.getDatasourceName()); - addProperty(properties, prefix + DataSourceConfigurationConstants.PROP_USER_NAME, - information.getUser()); - addProperty(properties, prefix + DataSourceConfigurationConstants.PROP_PASSWORD, - information.getAliasPassword()); + addProperty(properties, prefix + SecretConfigurationConstants.PROP_USER_NAME, + information.getSecretInformation().getUser()); + addProperty(properties, prefix + SecretConfigurationConstants.PROP_PASSWORD, + information.getSecretInformation().getAliasPassword()); addProperty(properties, prefix + DataSourceConfigurationConstants.PROP_MAXACTIVE, String.valueOf(information.getMaxActive())); addProperty(properties, prefix + DataSourceConfigurationConstants.PROP_MAXIDLE, Modified: synapse/trunk/java/modules/utils/src/main/java/org/apache/synapse/commons/util/secret/SecretCallbackHandlerFactory.java URL: http://svn.apache.org/viewvc/synapse/trunk/java/modules/utils/src/main/java/org/apache/synapse/commons/util/secret/SecretCallbackHandlerFactory.java?rev=766966&r1=766965&r2=766966&view=diff ============================================================================== --- synapse/trunk/java/modules/utils/src/main/java/org/apache/synapse/commons/util/secret/SecretCallbackHandlerFactory.java (original) +++ synapse/trunk/java/modules/utils/src/main/java/org/apache/synapse/commons/util/secret/SecretCallbackHandlerFactory.java Tue Apr 21 03:45:30 2009 @@ -43,9 +43,7 @@ */ public static SecretCallbackHandler createSecretCallbackHandler(Properties properties, String key) { - String provider = MiscellaneousUtil.getProperty( - properties, key, - null); + String provider = MiscellaneousUtil.getProperty(properties, key, null); return createSecretCallbackHandler(provider); } Modified: synapse/trunk/java/modules/utils/src/main/java/org/apache/synapse/commons/util/secret/SingleSecretCallback.java URL: http://svn.apache.org/viewvc/synapse/trunk/java/modules/utils/src/main/java/org/apache/synapse/commons/util/secret/SingleSecretCallback.java?rev=766966&r1=766965&r2=766966&view=diff ============================================================================== --- synapse/trunk/java/modules/utils/src/main/java/org/apache/synapse/commons/util/secret/SingleSecretCallback.java (original) +++ synapse/trunk/java/modules/utils/src/main/java/org/apache/synapse/commons/util/secret/SingleSecretCallback.java Tue Apr 21 03:45:30 2009 @@ -30,13 +30,13 @@ /* The Id to identify the context that secret is going to be used */ private String id; - public SingleSecretCallback(String prompt) { - this.prompt = prompt; + public SingleSecretCallback(String id) { + this.id = id; } public SingleSecretCallback(String prompt, String id) { - this(prompt); - this.id = id; + this(id); + this.prompt = prompt; } public SingleSecretCallback() { Modified: synapse/trunk/java/repository/conf/synapse.properties URL: http://svn.apache.org/viewvc/synapse/trunk/java/repository/conf/synapse.properties?rev=766966&r1=766965&r2=766966&view=diff ============================================================================== --- synapse/trunk/java/repository/conf/synapse.properties (original) +++ synapse/trunk/java/repository/conf/synapse.properties Tue Apr 21 03:45:30 2009 @@ -15,48 +15,74 @@ ## KIND, either express or implied. See the License for the ## specific language governing permissions and limitations ## under the License. -## +############################################################################# +## Global Synapse Configuration +############################################################################# +# Synapse Thread pool used for executor service (async executions/mediations) +#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 +# +#synapse.statistics.state=enable +# +# Handling of temporary data (streaming to temp files if buffer exceeds). +# The default chunkSize is 1024, and the default chunk threshold is 8 --> 8kb +# To keep more or less data in memory, those settings can be tuned +# Example to keep 1 MB in memory: +#synapse.temp_data.chunk.threshold=1024 +#synapse.temp_data.chunk.size=1024 +# +############################################################################# +# Security Configuration +############################################################################# +# The following property specifies a global password provider implementation +# which will be used globally if not overriden in specific configurations +# synapse.passwordProvider=<any implementation of org.apache.synapse.commons.util.secret.SecretCallbackHandler> +#Examples: +#synapse.passwordProvider=org.apache.synapse.security.secret.handler.SecretManagerSecretCallbackHandler +#synapse.passwordProvider=org.apache.synapse.security.secret.handler.JMXSecretCallbackHandler +#synapse.passwordProvider=org.apache.synapse.security.secret.handler.JlineSecretCallbackHandler +#synapse.passwordProvider=org.apache.synapse.security.secret.handler.JBossEncryptionSecretCallbackHandler # -##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 -# -##synapse.statistics.state=enable -# -## KeyStores configurations +#secretManager.passwordProvider=<any implementation of org.apache.synapse.commons.util.secret.SecretCallbackHandler> +#secretRepositories=file +#secretRepositories.file.provider=org.apache.synapse.security.secret.repository.filebased.FileBaseSecretRepositoryProvider +#secretRepositories.file.location=cipher-text.properties # #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.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 +#keystore.trust.parameters=enableHostnameVerifier=false;keyStoreCertificateFilePath=/home/esb.cer # +################################################################################ +# DataSources Configuration +################################################################################ #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 -## -## +# 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 +# Optionally you can specifiy a specific password provider implementation which overrides any globally configured provider +#synapse.datasources.lookupds.passwordProvider=org.apache.synapse.security.secret.handler.JBossEncryptionSecretCallbackHandler #synapse.datasources.lookupds.username=synapse +# Depending on the password provider used, you may have to use an encrypted password here! #synapse.datasources.lookupds.password=synapse -##synapse.datasources.lookupds.passwordProvider=org.apache.synapse.security.secret.handler.SecretManagerSecretCallbackHandler #synapse.datasources.lookupds.dsName=lookupdb #synapse.datasources.lookupds.maxActive=100 #synapse.datasources.lookupds.maxIdle=20 @@ -70,17 +96,30 @@ #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 +# Optionally you can specifiy a specific password provider implementation which overrides any globally configured provider +#synapse.datasources.lookupds.passwordProvider=org.apache.synapse.security.secret.handler.JBossEncryptionSecretCallbackHandler #synapse.datasources.reportds.username=synapse +# Depending on the password provider used, you may have to use an encrypted password here! #synapse.datasources.reportds.password=synapse -##synapse.datasources.reportds.passwordProvider=org.apache.synapse.security.secret.handler.SecretManagerSecretCallbackHandler #synapse.datasources.reportds.maxActive=100 #synapse.datasources.reportds.maxIdle=20 #synapse.datasources.reportds.maxWait=10000 # -#secretManager.passwordProvider=org.apache.synapse.commons.util.secret.SecretCallbackHandler implementation -# -#secretRepositories=file -## -#secretRepositories.file.provider=org.apache.synapse.security.secret.repository.filebased.FileBaseSecretRepositoryProvider -#secretRepositories.file.location=cipher-text.properties -# +################################################################################ +# JMX Configuration +################################################################################ +# Default is to autodetect free port starting at 1099; change it to meet your deployment requirements! +synapse.jmx.jndiPort=0 +# By default rmi port will be detected automatically, change it to a fixed port to meet your deployment requirements +#synapse.jmx.rmiPort=1101 +# By default the hostname will be detected, but you can force to use another network interface +#synapse.jmx.hostname= +# Optionally you can specifiy a specific password provider implementation which overrides any globally configured provider +#synapse.jmx.passwordProvider=org.apache.synapse.security.secret.handler.JBossEncryptionSecretCallbackHandler +# By default no authentication is required, but you may enforce this by specifying a username and password +#synapse.jmx.username=admin +# Depending on the password provider used, you may have to use an encrypted password here! +#synapse.jmx.password=admin +# Optionally you may want to specify the location of an remote access file to restrict access +#synapse.jmx.remote.access.file= +
