[jboss-cvs] JBossAS SVN: r107714 - in projects/jboss-jca/trunk/common/src: main/java/org/jboss/jca/common/metadata and 3 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Fri Aug 20 10:15:20 EDT 2010
Author: maeste
Date: 2010-08-20 10:15:19 -0400 (Fri, 20 Aug 2010)
New Revision: 107714
Added:
projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/api/metadata/ds/CommonDataSource.java
projects/jboss-jca/trunk/common/src/test/resources/adapters/ra-xa.xml
Modified:
projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/api/metadata/ds/DataSource.java
projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/api/metadata/ds/XaDataSource.java
projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/metadata/MetadataFactory.java
projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/metadata/ds/DataSourceAbstractImpl.java
projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/metadata/ds/DataSourceImpl.java
projects/jboss-jca/trunk/common/src/test/java/org/jboss/jca/common/metadata/MetadataFactoryTestCase.java
Log:
JBJCA-400: support of XaDataSource in merging it into connector. Test to verify it added too
Added: projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/api/metadata/ds/CommonDataSource.java
===================================================================
--- projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/api/metadata/ds/CommonDataSource.java (rev 0)
+++ projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/api/metadata/ds/CommonDataSource.java 2010-08-20 14:15:19 UTC (rev 107714)
@@ -0,0 +1,124 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.jca.common.api.metadata.ds;
+
+import org.jboss.jca.common.api.metadata.JCAMetadata;
+
+/**
+ *
+ * A CommonDataSource.
+ *
+ * @author <a href="stefano.maestri at jboss.com">Stefano Maestri</a>
+ *
+ */
+public interface CommonDataSource extends JCAMetadata
+{
+
+ /**
+ * Get the minPoolSize.
+ *
+ * @return the minPoolSize.
+ */
+
+ public Integer getMinPoolSize();
+
+ /**
+ * Get the maxPoolSize.
+ *
+ * @return the maxPoolSize.
+ */
+
+ public Integer getMaxPoolSize();
+
+ /**
+ * Get the prefill.
+ *
+ * @return the prefill.
+ */
+
+ public boolean isPrefill();
+
+ /**
+ * Get the transactionIsolation.
+ *
+ * @return the transactionIsolation.
+ */
+
+ public TransactionIsolation getTransactionIsolation();
+
+ /**
+ * Get the timeOut
+ *
+ * @return the timeOut.
+ */
+
+ public TimeOut getTimeOut();
+
+ /**
+ * Get the security.
+ *
+ * @return the security.
+ */
+
+ public Security getSecurity();
+
+ /**
+ * Get the validation.
+ *
+ * @return the validation.
+ */
+
+ public Validation getValidation();
+
+ /**
+ * Get the useJavaContext.
+ *
+ * @return the useJavaContext.
+ */
+
+ public boolean isUseJavaContext();
+
+ /**
+ * Get the poolName.
+ *
+ * @return the poolName.
+ */
+
+ public String getPoolName();
+
+ /**
+ * Get the enabled.
+ *
+ * @return the enabled.
+ */
+
+ public boolean isEnabled();
+
+ /**
+ * Get the jndiName.
+ *
+ * @return the jndiName.
+ */
+
+ public String getJndiName();
+
+}
Modified: projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/api/metadata/ds/DataSource.java
===================================================================
--- projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/api/metadata/ds/DataSource.java 2010-08-20 13:18:57 UTC (rev 107713)
+++ projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/api/metadata/ds/DataSource.java 2010-08-20 14:15:19 UTC (rev 107714)
@@ -21,9 +21,6 @@
*/
package org.jboss.jca.common.api.metadata.ds;
-import org.jboss.jca.common.api.metadata.JCAMetadata;
-import org.jboss.jca.common.api.metadata.ra.MergeableMetadata;
-
import java.util.HashMap;
import java.util.Map;
@@ -34,31 +31,11 @@
* @author <a href="stefano.maestri at jboss.com">Stefano Maestri</a>
*
*/
-public interface DataSource extends JCAMetadata, MergeableMetadata<DataSource>
+public interface DataSource extends CommonDataSource
{
- /**
- * Get the minPoolSize.
- *
- * @return the minPoolSize.
- */
- public Integer getMinPoolSize();
/**
- * Get the maxPoolSize.
- *
- * @return the maxPoolSize.
- */
- public Integer getMaxPoolSize();
-
- /**
- * Get the prefill.
- *
- * @return the prefill.
- */
- public boolean isPrefill();
-
- /**
* Get the userName.
*
* @return the userName.
@@ -86,12 +63,6 @@
*/
public String getDriverClass();
- /**
- * Get the transactionIsolation.
- *
- * @return the transactionIsolation.
- */
- public TransactionIsolation getTransactionIsolation();
/**
* Get the connectionProperties.
@@ -100,33 +71,14 @@
*/
public Map<String, String> getConnectionProperties();
- /**
- * Get the timeOut.
- *
- * @return the timeOut.
- */
- public TimeOut getTimeOut();
/**
- * Get the security.
- *
- * @return the security.
- */
- public Security getSecurity();
-
- /**
* Get the statement.
*
* @return the statement.
*/
public Statement getStatement();
- /**
- * Get the validation.
- *
- * @return the validation.
- */
- public Validation getValidation();
/**
* Get the urlDelimiter.
@@ -149,35 +101,8 @@
*/
public String getNewConnectionSql();
- /**
- * Get the useJavaContext.
- *
- * @return the useJavaContext.
- */
- public boolean isUseJavaContext();
/**
- * Get the poolName.
- *
- * @return the poolName.
- */
- public String getPoolName();
-
- /**
- * Get the enabled.
- *
- * @return the enabled.
- */
- public boolean isEnabled();
-
- /**
- * Get the jndiName.
- *
- * @return the jndiName.
- */
- public String getJndiName();
-
- /**
*
* A Tag.
*
Modified: projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/api/metadata/ds/XaDataSource.java
===================================================================
--- projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/api/metadata/ds/XaDataSource.java 2010-08-20 13:18:57 UTC (rev 107713)
+++ projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/api/metadata/ds/XaDataSource.java 2010-08-20 14:15:19 UTC (rev 107714)
@@ -21,8 +21,6 @@
*/
package org.jboss.jca.common.api.metadata.ds;
-import org.jboss.jca.common.api.metadata.JCAMetadata;
-
import java.util.HashMap;
import java.util.Map;
@@ -33,31 +31,10 @@
* @author <a href="stefano.maestri at jboss.com">Stefano Maestri</a>
*
*/
-public interface XaDataSource extends JCAMetadata
+public interface XaDataSource extends CommonDataSource
{
/**
- * Get the minPoolSize.
- *
- * @return the minPoolSize.
- */
- public Integer getMinPoolSize();
-
- /**
- * Get the maxPoolSize.
- *
- * @return the maxPoolSize.
- */
- public Integer getMaxPoolSize();
-
- /**
- * Get the prefill.
- *
- * @return the prefill.
- */
- public boolean isPrefill();
-
- /**
* Get the userName.
*
* @return the userName.
@@ -79,12 +56,6 @@
*/
public String getXaDataSourceClass();
- /**
- * Get the transactionIsolation.
- *
- * @return the transactionIsolation.
- */
- public TransactionIsolation getTransactionIsolation();
/**
* Get the isSameRmOverride.
@@ -107,33 +78,14 @@
*/
public Recovery getRecovery();
- /**
- * Get the timeOut.
- *
- * @return the timeOut.
- */
- public TimeOut getTimeOut();
/**
- * Get the security.
- *
- * @return the security.
- */
- public Security getSecurity();
-
- /**
* Get the statement.
*
* @return the statement.
*/
public Statement getStatement();
- /**
- * Get the validation.
- *
- * @return the validation.
- */
- public Validation getValidation();
/**
* Get the urlDelimiter.
@@ -157,34 +109,6 @@
public String getNewConnectionSql();
/**
- * Get the useJavaContext.
- *
- * @return the useJavaContext.
- */
- public boolean isUseJavaContext();
-
- /**
- * Get the poolName.
- *
- * @return the poolName.
- */
- public String getPoolName();
-
- /**
- * Get the enabled.
- *
- * @return the enabled.
- */
- public boolean isEnabled();
-
- /**
- * Get the jndiName.
- *
- * @return the jndiName.
- */
- public String getJndiName();
-
- /**
* Get the xaDataSourceProperty.
*
* @return the xaDataSourceProperty.
Modified: projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/metadata/MetadataFactory.java
===================================================================
--- projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/metadata/MetadataFactory.java 2010-08-20 13:18:57 UTC (rev 107713)
+++ projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/metadata/MetadataFactory.java 2010-08-20 14:15:19 UTC (rev 107714)
@@ -23,6 +23,7 @@
package org.jboss.jca.common.metadata;
import org.jboss.jca.common.api.metadata.common.TransactionSupportEnum;
+import org.jboss.jca.common.api.metadata.ds.CommonDataSource;
import org.jboss.jca.common.api.metadata.ds.DataSource;
import org.jboss.jca.common.api.metadata.ds.XaDataSource;
import org.jboss.jca.common.api.metadata.jbossra.JbossRa;
@@ -174,16 +175,17 @@
*
* Create a connector from a DataSource metadata
*
- * @param ds the datasource
+ * @param cds the datasource it is one of interface extending {@link CommonDataSource}.
+ * IOW it can be both {@link DataSource} or {@link XaDataSource}
* @param connector the connector to merge
* @return the connector with mapped properties taken forn ds
* @throws IllegalArgumentException if version is't 1.0, 1.5 or 1.6
* @throws Exception in case of error
*/
- public Connector mergeConnectorAndDs(DataSource ds, Connector connector)
+ public Connector mergeConnectorAndDs(CommonDataSource cds, Connector connector)
throws IllegalArgumentException, Exception
{
- if (ds == null)
+ if (cds == null)
{
return null;
}
@@ -216,13 +218,13 @@
if (connector.getVersion() == Version.V_10)
{
- List<ConfigProperty> configProperties = createConfigProperties(ds,
- connector.getResourceadapter().getConfigProperties());
+ List<ConfigProperty> configProperties = createConfigProperties(cds, connector.getResourceadapter()
+ .getConfigProperties());
ResourceAdapter resourceadapter = new ResourceAdapter10Impl(managedconnectionfactoryClass,
- connectionfactoryInterface, connectionfactoryImplClass, connectionInterface, connectionImplClass,
- transactionSupport, authenticationMechanism, configProperties, reauthenticationSupport,
- securityPermissions, id);
+ connectionfactoryInterface, connectionfactoryImplClass, connectionInterface,
+ connectionImplClass, transactionSupport, authenticationMechanism, configProperties,
+ reauthenticationSupport, securityPermissions, id);
Connector newConnector = new Connector10Impl(moduleName, vendorName, eisType, resourceadapterVersion,
license, resourceadapter, description, displayNames, icons, id);
@@ -232,42 +234,42 @@
else
{
List<? extends ConfigProperty> originalProperties = null;
- if (connector.getResourceadapter() != null
- && connector.getResourceadapter() instanceof ResourceAdapter1516
- &&
- ((ResourceAdapter1516) connector.getResourceadapter()).getOutboundResourceadapter() != null
- &&
- ((ResourceAdapter1516) connector.getResourceadapter()).getOutboundResourceadapter()
- .getConnectionDefinitions() != null)
+ if (connector.getResourceadapter() != null &&
+ connector.getResourceadapter() instanceof ResourceAdapter1516)
{
- originalProperties = ((ResourceAdapter1516) connector
- .getResourceadapter()).getOutboundResourceadapter()
- .getConnectionDefinitions().get(0).getConfigProperties();
+ ResourceAdapter1516 ra1516 = ((ResourceAdapter1516) connector.getResourceadapter());
+ if (ra1516.getOutboundResourceadapter() != null &&
+ ra1516.getOutboundResourceadapter().getConnectionDefinitions() != null)
+ {
+ originalProperties = ra1516.getOutboundResourceadapter().getConnectionDefinitions().get(0)
+ .getConfigProperties();
+ }
}
- List<ConfigProperty> configProperties = createConfigProperties(ds, originalProperties);
+ List<ConfigProperty> configProperties = createConfigProperties(cds, originalProperties);
List<ConnectionDefinition> connectionDefinitions = new ArrayList<ConnectionDefinition>(1);
- ConnectionDefinition connectionDefinition = new ConnectionDefinitionImpl(managedconnectionfactoryClass,
- configProperties, connectionfactoryInterface, connectionfactoryImplClass, connectionInterface,
- connectionImplClass, id);
+ ConnectionDefinition connectionDefinition = new ConnectionDefinitionImpl(
+ managedconnectionfactoryClass, configProperties, connectionfactoryInterface,
+ connectionfactoryImplClass, connectionInterface, connectionImplClass, id);
connectionDefinitions.add(connectionDefinition);
- OutboundResourceAdapter outboundResourceadapter = new OutboundResourceAdapterImpl(connectionDefinitions,
- transactionSupport, authenticationMechanism, reauthenticationSupport, id);
+ OutboundResourceAdapter outboundResourceadapter = new OutboundResourceAdapterImpl(
+ connectionDefinitions, transactionSupport, authenticationMechanism, reauthenticationSupport, id);
String resourceadapterClass = null;
List<? extends ConfigProperty> raConfigProperties = null;
InboundResourceAdapter inboundResourceadapter = null;
- ResourceAdapter1516 resourceadapter = new ResourceAdapter1516Impl(resourceadapterClass, raConfigProperties,
- outboundResourceadapter, inboundResourceadapter, adminobjects, securityPermissions, id);
+ ResourceAdapter1516 resourceadapter = new ResourceAdapter1516Impl(resourceadapterClass,
+ raConfigProperties, outboundResourceadapter, inboundResourceadapter, adminobjects,
+ securityPermissions, id);
if (connector.getVersion() == Version.V_16)
{
List<String> requiredWorkContexts = null;
boolean metadataComplete = false;
- Connector newConnector = new Connector16Impl(moduleName, vendorName, eisType, resourceadapterVersion,
- license,
- resourceadapter, requiredWorkContexts, metadataComplete, description, displayNames, icons, id);
+ Connector newConnector = new Connector16Impl(moduleName, vendorName, eisType,
+ resourceadapterVersion, license, resourceadapter, requiredWorkContexts, metadataComplete,
+ description, displayNames, icons, id);
return newConnector.merge(connector);
}
@@ -286,9 +288,19 @@
}
- private static List<ConfigProperty> createConfigProperties(DataSource ds,
+ private static List<ConfigProperty> createConfigProperties(CommonDataSource cds,
List<? extends ConfigProperty> originalProperties)
{
+ DataSource ds = null;
+ XaDataSource xads = null;
+ if (cds instanceof DataSource)
+ {
+ ds = (DataSource) cds;
+ }
+ if (cds instanceof XaDataSource)
+ {
+ xads = (XaDataSource) cds;
+ }
if (originalProperties != null)
{
List<ConfigProperty> configProperties = new ArrayList<ConfigProperty>(originalProperties.size());
@@ -300,7 +312,7 @@
switch (prototype)
{
case USERNAME : {
- if (ds.getUserName() != null && !ds.getUserName().trim().equals(""))
+ if (ds != null && ds.getUserName() != null && !ds.getUserName().trim().equals(""))
{
configProperties.add(ConfigPropertyFactory.createConfigProperty(prototype, ds.getUserName()));
}
@@ -309,7 +321,7 @@
}
case PASSWORD : {
- if (ds.getPassword() != null && !ds.getPassword().trim().equals(""))
+ if (ds != null && ds.getPassword() != null && !ds.getPassword().trim().equals(""))
{
configProperties.add(ConfigPropertyFactory.createConfigProperty(prototype, ds.getPassword()));
}
@@ -318,18 +330,18 @@
}
case XADATASOURCEPROPERTIES : {
- if (ds instanceof XaDataSource && ((XaDataSource) ds).getXaDataSourceProperty() != null)
+ if (xads != null && xads.getXaDataSourceProperty() != null)
{
StringBuffer valueBuf = new StringBuffer();
- for (Entry<String, String> xaConfigProperty : ((XaDataSource) ds).getXaDataSourceProperty()
- .entrySet())
+ for (Entry<String, String> xaConfigProperty : xads.getXaDataSourceProperty().entrySet())
{
valueBuf.append(xaConfigProperty.getKey());
valueBuf.append("=");
valueBuf.append(xaConfigProperty.getValue());
valueBuf.append(";");
}
- configProperties.add(ConfigPropertyFactory.createConfigProperty(prototype, valueBuf.toString()));
+ configProperties.add(ConfigPropertyFactory.createConfigProperty(prototype,
+ valueBuf.toString()));
}
@@ -337,17 +349,18 @@
}
case URLDELIMITER : {
- if (ds.getUrlDelimiter() != null && !ds.getUrlDelimiter().trim().equals(""))
+ if (ds != null && ds.getUrlDelimiter() != null && !ds.getUrlDelimiter().trim().equals(""))
{
- configProperties.add(ConfigPropertyFactory.createConfigProperty(prototype, ds.getUrlDelimiter()));
+ configProperties.add(ConfigPropertyFactory.createConfigProperty(prototype,
+ ds.getUrlDelimiter()));
}
break;
}
case URLSELECTORSTRATEGYCLASSNAME : {
- if (ds.getUrlSelectorStrategyClassName() != null
- && !ds.getUrlSelectorStrategyClassName().trim().equals(""))
+ if (ds != null && ds.getUrlSelectorStrategyClassName() != null &&
+ !ds.getUrlSelectorStrategyClassName().trim().equals(""))
{
configProperties.add(ConfigPropertyFactory.createConfigProperty(prototype,
ds.getUrlSelectorStrategyClassName()));
@@ -357,17 +370,17 @@
}
case XADATASOURCECLASS : {
- if (ds instanceof XaDataSource && ((XaDataSource) ds).getXaDataSourceClass() != null)
+ if (xads != null && xads.getXaDataSourceClass() != null)
{
configProperties.add(ConfigPropertyFactory.createConfigProperty(prototype,
- ((XaDataSource) ds).getXaDataSourceClass()));
+ xads.getXaDataSourceClass()));
}
break;
}
case TRANSACTIONISOLATION : {
- if (ds.getTransactionIsolation() != null)
+ if (ds != null && ds.getTransactionIsolation() != null)
{
configProperties.add(ConfigPropertyFactory.createConfigProperty(prototype, ds
.getTransactionIsolation().name()));
@@ -377,7 +390,8 @@
}
case PREPAREDSTATEMENTCACHESIZE : {
- if (ds.getStatement() != null && ds.getStatement().getPreparedStatementsCacheSize() != null)
+ if (ds != null && ds.getStatement() != null &&
+ ds.getStatement().getPreparedStatementsCacheSize() != null)
{
configProperties.add(ConfigPropertyFactory.createConfigProperty(prototype, ds.getStatement()
.getPreparedStatementsCacheSize()));
@@ -387,18 +401,17 @@
}
case SHAREPREPAREDSTATEMENTS : {
- if (ds.getStatement() != null)
+ if (ds != null && ds.getStatement() != null)
{
configProperties.add(ConfigPropertyFactory.createConfigProperty(prototype,
- ds.getStatement() != null
- && ds.getStatement().isSharePreparedStatements()));
+ ds.getStatement() != null && ds.getStatement().isSharePreparedStatements()));
}
break;
}
case NEWCONNECTIONSQL : {
- if (ds.getNewConnectionSql() != null)
+ if (ds != null && ds.getNewConnectionSql() != null)
{
configProperties.add(ConfigPropertyFactory.createConfigProperty(prototype,
ds.getNewConnectionSql()));
@@ -408,8 +421,9 @@
}
case CHECKVALIDCONNECTIONSQL : {
- if (ds.getValidation() != null && ds.getValidation().getCheckValidConnectionSql() != null
- && !ds.getValidation().getCheckValidConnectionSql().trim().equals(""))
+ if (ds != null && ds.getValidation() != null &&
+ ds.getValidation().getCheckValidConnectionSql() != null &&
+ !ds.getValidation().getCheckValidConnectionSql().trim().equals(""))
{
configProperties.add(ConfigPropertyFactory.createConfigProperty(prototype, ds.getValidation()
.getCheckValidConnectionSql()));
@@ -419,7 +433,8 @@
}
case VALIDCONNECTIONCHECKERCLASSNAME : {
- if (ds.getValidation() != null && ds.getValidation().getCheckValidConnectionSql() != null)
+ if (ds != null && ds.getValidation() != null &&
+ ds.getValidation().getCheckValidConnectionSql() != null)
{
configProperties.add(ConfigPropertyFactory.createConfigProperty(prototype, ds.getValidation()
.getCheckValidConnectionSql()));
@@ -429,7 +444,8 @@
}
case EXCEPTIONSORTERCLASSNAME : {
- if (ds.getValidation() != null && ds.getValidation().getExceptionSorterClassName() != null)
+ if (ds != null && ds.getValidation() != null &&
+ ds.getValidation().getExceptionSorterClassName() != null)
{
configProperties.add(ConfigPropertyFactory.createConfigProperty(prototype, ds.getValidation()
.getExceptionSorterClassName()));
@@ -439,7 +455,8 @@
}
case STALECONNECTIONCHECKERCLASSNAME : {
- if (ds.getValidation() != null && ds.getValidation().getStaleConnectionCheckerClassName() != null)
+ if (ds != null && ds.getValidation() != null &&
+ ds.getValidation().getStaleConnectionCheckerClassName() != null)
{
configProperties.add(ConfigPropertyFactory.createConfigProperty(prototype, ds.getValidation()
.getStaleConnectionCheckerClassName()));
@@ -449,7 +466,7 @@
}
case TRACKSTATEMENTS : {
- if (ds.getStatement() != null && ds.getStatement().getTrackStatements() != null)
+ if (ds != null && ds.getStatement() != null && ds.getStatement().getTrackStatements() != null)
{
configProperties.add(ConfigPropertyFactory.createConfigProperty(prototype, ds.getStatement()
.getTrackStatements().name()));
@@ -459,7 +476,7 @@
}
case VALIDATEONMATCH : {
- if (ds.getValidation() != null)
+ if (ds != null && ds.getValidation() != null)
{
configProperties.add(ConfigPropertyFactory.createConfigProperty(prototype, ds.getValidation()
.isValidateOnMatch()));
@@ -469,7 +486,7 @@
}
case TRANSACTIONQUERYTIMEOUT : {
- if (ds.getTimeOut() != null)
+ if (ds != null && ds.getTimeOut() != null)
{
configProperties.add(ConfigPropertyFactory.createConfigProperty(prototype, ds.getTimeOut()
.isSetTxQueryTimeout()));
@@ -479,7 +496,7 @@
}
case QUERYTIMEOUT : {
- if (ds.getTimeOut() != null && ds.getTimeOut().getQueryTimeout() != null)
+ if (ds != null && ds.getTimeOut() != null && ds.getTimeOut().getQueryTimeout() != null)
{
configProperties.add(ConfigPropertyFactory.createConfigProperty(prototype, ds.getTimeOut()
.getQueryTimeout()));
@@ -489,7 +506,7 @@
}
case USETRYLOCK : {
- if (ds.getTimeOut() != null && ds.getTimeOut().getUseTryLock() != null)
+ if (ds != null && ds.getTimeOut() != null && ds.getTimeOut().getUseTryLock() != null)
{
configProperties.add(ConfigPropertyFactory.createConfigProperty(prototype, ds.getTimeOut()
.getUseTryLock()));
@@ -498,15 +515,16 @@
break;
}
case DRIVERCLASS : {
- if (ds.getDriverClass() != null)
+ if (ds != null && ds.getDriverClass() != null)
{
- configProperties.add(ConfigPropertyFactory.createConfigProperty(prototype, ds.getDriverClass()));
+ configProperties.add(ConfigPropertyFactory.createConfigProperty(prototype,
+ ds.getDriverClass()));
}
break;
}
case URLPROPERTY :
case CONNECTIONPROPERTIES : {
- if (ds.getConnectionProperties() != null)
+ if (ds != null && ds.getConnectionProperties() != null)
{
StringBuffer valueBuf = new StringBuffer();
for (Entry<String, String> connProperty : ds.getConnectionProperties().entrySet())
@@ -516,15 +534,17 @@
valueBuf.append(connProperty.getValue());
valueBuf.append(";");
}
- configProperties.add(ConfigPropertyFactory.createConfigProperty(prototype, valueBuf.toString()));
+ configProperties.add(ConfigPropertyFactory.createConfigProperty(prototype,
+ valueBuf.toString()));
}
break;
}
case CONNECTIONURL : {
- if (ds.getConnectionUrl() != null)
+ if (ds != null && ds.getConnectionUrl() != null)
{
- configProperties.add(ConfigPropertyFactory.createConfigProperty(prototype, ds.getConnectionUrl()));
+ configProperties.add(ConfigPropertyFactory.createConfigProperty(prototype,
+ ds.getConnectionUrl()));
}
break;
}
@@ -532,14 +552,17 @@
break;
}
}
- for (Entry<String, String> connectionProperty : ds.getConnectionProperties().entrySet())
+ if (ds != null)
{
- ConfigPropertyFactory.Prototype prototype = ConfigPropertyFactory.Prototype.forName(connectionProperty
- .getKey());
- if (prototype != ConfigPropertyFactory.Prototype.UNKNOWN)
+ for (Entry<String, String> connectionProperty : ds.getConnectionProperties().entrySet())
{
- configProperties
- .add(ConfigPropertyFactory.createConfigProperty(prototype, connectionProperty.getValue()));
+ ConfigPropertyFactory.Prototype prototype = ConfigPropertyFactory.Prototype
+ .forName(connectionProperty.getKey());
+ if (prototype != ConfigPropertyFactory.Prototype.UNKNOWN)
+ {
+ configProperties.add(ConfigPropertyFactory.createConfigProperty(prototype,
+ connectionProperty.getValue()));
+ }
}
}
return configProperties;
@@ -570,9 +593,8 @@
public static ConfigProperty createConfigProperty(Prototype prototype, String value)
{
- return new ConfigPropertyImpl(prototype.getDescription(), prototype.getLocalName(), prototype.getLocalType(),
- new XsdString(
- value, null), null);
+ return new ConfigPropertyImpl(prototype.getDescription(), prototype.getLocalName(),
+ prototype.getLocalType(), new XsdString(value, null), null);
}
/**
@@ -586,9 +608,8 @@
public static ConfigProperty createConfigProperty(Prototype prototype, boolean value)
{
- return new ConfigPropertyImpl(prototype.getDescription(), prototype.getLocalName(), prototype.getLocalType(),
- new XsdString(
- String.valueOf(value), null), null);
+ return new ConfigPropertyImpl(prototype.getDescription(), prototype.getLocalName(),
+ prototype.getLocalType(), new XsdString(String.valueOf(value), null), null);
}
/**
@@ -602,9 +623,8 @@
public static ConfigProperty createConfigProperty(Prototype prototype, Number value)
{
- return new ConfigPropertyImpl(prototype.getDescription(), prototype.getLocalName(), prototype.getLocalType(),
- new XsdString(
- String.valueOf(value), null), null);
+ return new ConfigPropertyImpl(prototype.getDescription(), prototype.getLocalName(),
+ prototype.getLocalType(), new XsdString(String.valueOf(value), null), null);
}
/**
@@ -623,18 +643,17 @@
/** CONNECTIONURL **/
CONNECTIONURL("ConnectionURL", "java.lang.String", "The jdbc connection url class."),
/** CONNECTIONPROPERTIES **/
- CONNECTIONPROPERTIES("ConnectionProperties", "java.lang.String", "Connection properties for the database."),
+ CONNECTIONPROPERTIES("ConnectionProperties", "java.lang.String",
+ "Connection properties for the database."),
/** USERNAME **/
USERNAME("UserName", "java.lang.String", "The default user name used to create JDBC connections."),
/** PASSWORD **/
PASSWORD("Password", "java.lang.String", "The default password used to create JDBC connections."),
/** XADATASOURCEPROPERTIES **/
- XADATASOURCEPROPERTIES(
- "XADataSourceProperties",
- "java.lang.String",
- "The properties to set up the XA driver. These properties must be in the form " +
- "name1=value1;name2=value2;...namen=valuen"),
+ XADATASOURCEPROPERTIES("XADataSourceProperties", "java.lang.String",
+ "The properties to set up the XA driver. These properties must be in the form "
+ + "name1=value1;name2=value2;...namen=valuen"),
/** URLDELIMITER **/
URLDELIMITER("URLDelimiter", "java.lang.String", "The jdbc connection url delimeter."),
/** URLPROPERTY **/
@@ -646,11 +665,9 @@
XADATASOURCECLASS("XADataSourceClass", "java.lang.String",
"The class name of the JDBC XA driver that handlesthis JDBC URL."),
/** TRANSACTIONISOLATION **/
- TRANSACTIONISOLATION(
- "TransactionIsolation",
- "java.lang.String",
- "The transaction isolation for new connections. Not necessary: the driver default will be used " +
- "if ommitted."),
+ TRANSACTIONISOLATION("TransactionIsolation", "java.lang.String",
+ "The transaction isolation for new connections. Not necessary: the driver default will be used "
+ + "if ommitted."),
/** PREPAREDSTATEMENTCACHESIZE **/
PREPAREDSTATEMENTCACHESIZE("PreparedStatementCacheSize", "java.lang.Integer",
"The number of cached prepared statements per connection."),
@@ -661,32 +678,24 @@
NEWCONNECTIONSQL("NewConnectionSQL", "java.lang.String",
"An SQL statement to be executed when a new connection is created as auxillary setup."),
/** CHECKVALIDCONNECTIONSQL **/
- CHECKVALIDCONNECTIONSQL(
- "CheckValidConnectionSQL",
- "java.lang.String",
- "An SQL statement that may be executed when a managed connection is taken out of the pool and is " +
- "about to be given to a client: the purpose is to verify that the connection still works."),
+ CHECKVALIDCONNECTIONSQL("CheckValidConnectionSQL", "java.lang.String",
+ "An SQL statement that may be executed when a managed connection is taken out of the pool and is "
+ + "about to be given to a client: the purpose is to verify that the connection still works."),
/** VALIDCONNECTIONCHECKERCLASSNAME **/
- VALIDCONNECTIONCHECKERCLASSNAME(
- "ValidConnectionCheckerClassName",
- "java.lang.String",
- "The fully qualified name of a class implementing org.jboss.jca.adapters.jdbc.ValidConnectionChecker" +
- " that can determine for a particular vender db when a connection is valid."),
+ VALIDCONNECTIONCHECKERCLASSNAME("ValidConnectionCheckerClassName", "java.lang.String",
+ "The fully qualified name of a class implementing org.jboss.jca.adapters.jdbc.ValidConnectionChecker"
+ + " that can determine for a particular vender db when a connection is valid."),
/** EXCEPTIONSORTERCLASSNAME **/
EXCEPTIONSORTERCLASSNAME(
"ExceptionSorterClassName",
"java.lang.String",
"The fully qualified name of a class implementing org.jboss.jca.adapters.jdbc.ExceptionSorter that"
- +
- " can determine for a particular vender db which exceptions are fatal and mean a connection should"
- +
- " be discarded."),
+ + " can determine for a particular vender db which exceptions are "
+ + "fatal and mean a connection should be discarded."),
/** STALECONNECTIONCHECKERCLASSNAME **/
- STALECONNECTIONCHECKERCLASSNAME(
- "StaleConnectionCheckerClassName",
- "java.lang.String",
- "The fully qualified name of a class implementing org.jboss.jca.adapters.jdbc.StaleConnectionChecker" +
- " that can determine for a particular vender db when a connection is stale."),
+ STALECONNECTIONCHECKERCLASSNAME("StaleConnectionCheckerClassName", "java.lang.String",
+ "The fully qualified name of a class implementing org.jboss.jca.adapters.jdbc.StaleConnectionChecker"
+ + " that can determine for a particular vender db when a connection is stale."),
/** TRACKSTATEMENTS **/
TRACKSTATEMENTS("TrackStatements", "java.lang.String",
"Whether to track unclosed statements - false/true/nowarn"),
Modified: projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/metadata/ds/DataSourceAbstractImpl.java
===================================================================
--- projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/metadata/ds/DataSourceAbstractImpl.java 2010-08-20 13:18:57 UTC (rev 107713)
+++ projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/metadata/ds/DataSourceAbstractImpl.java 2010-08-20 14:15:19 UTC (rev 107714)
@@ -21,14 +21,13 @@
*/
package org.jboss.jca.common.metadata.ds;
+import org.jboss.jca.common.api.metadata.ds.CommonDataSource;
import org.jboss.jca.common.api.metadata.ds.Security;
import org.jboss.jca.common.api.metadata.ds.Statement;
import org.jboss.jca.common.api.metadata.ds.TimeOut;
import org.jboss.jca.common.api.metadata.ds.TransactionIsolation;
import org.jboss.jca.common.api.metadata.ds.Validation;
-import java.io.Serializable;
-
/**
*
* A DataSourceAbstractImpl.
@@ -36,7 +35,7 @@
* @author <a href="stefano.maestri at jboss.com">Stefano Maestri</a>
*
*/
-public abstract class DataSourceAbstractImpl implements Serializable
+public abstract class DataSourceAbstractImpl implements CommonDataSource
{
/** The serialVersionUID */
@@ -160,6 +159,7 @@
* @return the minPoolSize.
*/
+ @Override
public final Integer getMinPoolSize()
{
return minPoolSize;
@@ -171,6 +171,7 @@
* @return the maxPoolSize.
*/
+ @Override
public final Integer getMaxPoolSize()
{
return maxPoolSize;
@@ -182,6 +183,7 @@
* @return the prefill.
*/
+ @Override
public final boolean isPrefill()
{
return prefill;
@@ -193,6 +195,7 @@
* @return the transactionIsolation.
*/
+ @Override
public final TransactionIsolation getTransactionIsolation()
{
return transactionIsolation;
@@ -204,6 +207,7 @@
* @return the timeOut.
*/
+ @Override
public final TimeOut getTimeOut()
{
return timeOut;
@@ -215,6 +219,7 @@
* @return the security.
*/
+ @Override
public final Security getSecurity()
{
return security;
@@ -226,6 +231,7 @@
* @return the validation.
*/
+ @Override
public final Validation getValidation()
{
return validation;
@@ -237,6 +243,7 @@
* @return the useJavaContext.
*/
+ @Override
public final boolean isUseJavaContext()
{
return useJavaContext;
@@ -248,6 +255,7 @@
* @return the poolName.
*/
+ @Override
public final String getPoolName()
{
return poolName;
@@ -259,6 +267,7 @@
* @return the enabled.
*/
+ @Override
public final boolean isEnabled()
{
return enabled;
@@ -270,6 +279,7 @@
* @return the jndiName.
*/
+ @Override
public final String getJndiName()
{
return jndiName;
Modified: projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/metadata/ds/DataSourceImpl.java
===================================================================
--- projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/metadata/ds/DataSourceImpl.java 2010-08-20 13:18:57 UTC (rev 107713)
+++ projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/metadata/ds/DataSourceImpl.java 2010-08-20 14:15:19 UTC (rev 107714)
@@ -27,7 +27,6 @@
import org.jboss.jca.common.api.metadata.ds.TimeOut;
import org.jboss.jca.common.api.metadata.ds.TransactionIsolation;
import org.jboss.jca.common.api.metadata.ds.Validation;
-import org.jboss.jca.common.api.metadata.ra.MergeableMetadata;
import java.util.Collections;
import java.util.HashMap;
@@ -382,9 +381,5 @@
+ enabled + ", jndiName=" + jndiName + "]";
}
- @Override
- public DataSource merge(MergeableMetadata<?> jmd) throws Exception
- {
- return this;
- }
+
}
Modified: projects/jboss-jca/trunk/common/src/test/java/org/jboss/jca/common/metadata/MetadataFactoryTestCase.java
===================================================================
--- projects/jboss-jca/trunk/common/src/test/java/org/jboss/jca/common/metadata/MetadataFactoryTestCase.java 2010-08-20 13:18:57 UTC (rev 107713)
+++ projects/jboss-jca/trunk/common/src/test/java/org/jboss/jca/common/metadata/MetadataFactoryTestCase.java 2010-08-20 14:15:19 UTC (rev 107714)
@@ -55,26 +55,26 @@
public class MetadataFactoryTestCase
{
/**
- * shouldParseConnector16
+ * shouldMergeDsAndConnector
* @throws Exception in case of error
*/
@SuppressWarnings("unchecked")
@Test
- public void shouldMergeDsAndCOnnector() throws Exception
+ public void shouldMergeDsAndConnector() throws Exception
{
FileInputStream is = null;
try
{
//given
- File xmlFile = new File(Thread.currentThread().getContextClassLoader()
- .getResource("adapters/ra.xml").toURI());
+ File xmlFile = new File(Thread.currentThread().getContextClassLoader().getResource("adapters/ra.xml")
+ .toURI());
is = new FileInputStream(xmlFile);
RaParser parser = new RaParser();
Connector connector = parser.parse(is);
is.close();
- xmlFile = new File(Thread.currentThread().getContextClassLoader()
- .getResource("ds/postgres-ds.xml").toURI());
+ xmlFile = new File(Thread.currentThread().getContextClassLoader().getResource("ds/postgres-ds.xml")
+ .toURI());
is = new FileInputStream(xmlFile);
DsParser dsparser = new DsParser();
//when
@@ -83,21 +83,21 @@
List<? extends ConfigProperty> properties = null;
ResourceAdapter1516 resourceAdapter1516 = (ResourceAdapter1516) connector.getResourceadapter();
if (connector.getResourceadapter() != null &&
- connector.getResourceadapter() instanceof ResourceAdapter1516 &&
- resourceAdapter1516.getOutboundResourceadapter() != null &&
- resourceAdapter1516.getOutboundResourceadapter()
- .getConnectionDefinitions() != null)
+ connector.getResourceadapter() instanceof ResourceAdapter1516 &&
+ resourceAdapter1516.getOutboundResourceadapter() != null &&
+ resourceAdapter1516.getOutboundResourceadapter().getConnectionDefinitions() != null)
{
- properties = resourceAdapter1516.getOutboundResourceadapter()
- .getConnectionDefinitions().get(0).getConfigProperties();
+ properties = resourceAdapter1516.getOutboundResourceadapter().getConnectionDefinitions().get(0)
+ .getConfigProperties();
}
//verify pre-condition
- assertThat(resourceAdapter1516.getOutboundResourceadapter()
- .getTransactionSupport(), is(TransactionSupportEnum.LocalTransaction));
- assertThat(resourceAdapter1516.getOutboundResourceadapter()
- .getConnectionDefinitions().get(0).getManagedConnectionFactoryClass(), equalTo(new XsdString(
- "org.jboss.jca.adapters.jdbc.local.LocalManagedConnectionFactory", null)));
+ assertThat(resourceAdapter1516.getOutboundResourceadapter().getTransactionSupport(),
+ is(TransactionSupportEnum.LocalTransaction));
+ assertThat(
+ resourceAdapter1516.getOutboundResourceadapter().getConnectionDefinitions().get(0)
+ .getManagedConnectionFactoryClass(),
+ equalTo(new XsdString("org.jboss.jca.adapters.jdbc.local." + "LocalManagedConnectionFactory", null)));
//when
MetadataFactory mf = new MetadataFactory();
@@ -109,13 +109,13 @@
List<? extends ConfigProperty> mergedProperties = null;
ResourceAdapter1516 mergedResourceAdapter1516 = (ResourceAdapter1516) merged.getResourceadapter();
- if (connector.getResourceadapter() != null && connector.getResourceadapter() instanceof ResourceAdapter1516 &&
- resourceAdapter1516.getOutboundResourceadapter() != null &&
- resourceAdapter1516.getOutboundResourceadapter()
- .getConnectionDefinitions() != null)
+ if (connector.getResourceadapter() != null &&
+ connector.getResourceadapter() instanceof ResourceAdapter1516 &&
+ resourceAdapter1516.getOutboundResourceadapter() != null &&
+ resourceAdapter1516.getOutboundResourceadapter().getConnectionDefinitions() != null)
{
- mergedProperties = mergedResourceAdapter1516.getOutboundResourceadapter()
- .getConnectionDefinitions().get(0).getConfigProperties();
+ mergedProperties = mergedResourceAdapter1516.getOutboundResourceadapter().getConnectionDefinitions()
+ .get(0).getConfigProperties();
}
//then merged properties are presents
assertThat((List<ConfigProperty>) mergedProperties,
@@ -133,11 +133,11 @@
MetadataFactory.ConfigPropertyFactory.Prototype.DRIVERCLASS, "org.postgresql.Driver")));
//then metadata read from ra.xml still present (not deleted by merge)
- assertThat(mergedResourceAdapter1516.getOutboundResourceadapter()
- .getTransactionSupport(), is(TransactionSupportEnum.LocalTransaction));
- assertThat(mergedResourceAdapter1516.getOutboundResourceadapter()
- .getConnectionDefinitions().get(0).getManagedConnectionFactoryClass(), equalTo(new XsdString(
- "org.jboss.jca.adapters.jdbc.local.LocalManagedConnectionFactory", null)));
+ assertThat(mergedResourceAdapter1516.getOutboundResourceadapter().getTransactionSupport(),
+ is(TransactionSupportEnum.LocalTransaction));
+ assertThat(mergedResourceAdapter1516.getOutboundResourceadapter().getConnectionDefinitions().get(0)
+ .getManagedConnectionFactoryClass(),
+ equalTo(new XsdString("org.jboss.jca.adapters.jdbc.local.LocalManagedConnectionFactory", null)));
//then it have empty property for not set ones
assertThat((List<ConfigProperty>) mergedProperties,
@@ -158,4 +158,105 @@
}
+ /**
+ * shouldMergeXaDsAndConnector
+ * @throws Exception in case of error
+ */
+ @SuppressWarnings("unchecked")
+ @Test
+ public void shouldMergeXaDsAndConnector() throws Exception
+ {
+
+ FileInputStream is = null;
+ try
+ {
+ //given
+ File xmlFile = new File(Thread.currentThread().getContextClassLoader().getResource("adapters/ra-xa.xml")
+ .toURI());
+ is = new FileInputStream(xmlFile);
+ RaParser parser = new RaParser();
+ Connector connector = parser.parse(is);
+ is.close();
+ xmlFile = new File(Thread.currentThread().getContextClassLoader().getResource("ds/postgres-xa-ds.xml")
+ .toURI());
+ is = new FileInputStream(xmlFile);
+ DsParser dsparser = new DsParser();
+ //when
+ DataSources ds = dsparser.parse(is);
+
+ List<? extends ConfigProperty> properties = null;
+ ResourceAdapter1516 resourceAdapter1516 = (ResourceAdapter1516) connector.getResourceadapter();
+ if (connector.getResourceadapter() != null &&
+ connector.getResourceadapter() instanceof ResourceAdapter1516 &&
+ resourceAdapter1516.getOutboundResourceadapter() != null &&
+ resourceAdapter1516.getOutboundResourceadapter().getConnectionDefinitions() != null)
+ {
+ properties = resourceAdapter1516.getOutboundResourceadapter().getConnectionDefinitions().get(0)
+ .getConfigProperties();
+ }
+
+ //verify pre-condition
+ assertThat(resourceAdapter1516.getOutboundResourceadapter().getTransactionSupport(),
+ is(TransactionSupportEnum.XATransaction));
+ assertThat(resourceAdapter1516.getOutboundResourceadapter().getConnectionDefinitions().get(0)
+ .getManagedConnectionFactoryClass(),
+ equalTo(new XsdString("org.jboss.jca.adapters.jdbc.xa.XAManagedConnectionFactory", null)));
+
+ //when
+ MetadataFactory mf = new MetadataFactory();
+ Connector merged = mf.mergeConnectorAndDs(ds.getXaDataSource().get(0), connector);
+ //then
+ assertThat(merged, instanceOf(Connector15.class));
+ assertThat(merged.getVersion(), is(Version.V_15));
+
+ List<? extends ConfigProperty> mergedProperties = null;
+
+ ResourceAdapter1516 mergedResourceAdapter1516 = (ResourceAdapter1516) merged.getResourceadapter();
+ if (connector.getResourceadapter() != null &&
+ connector.getResourceadapter() instanceof ResourceAdapter1516 &&
+ resourceAdapter1516.getOutboundResourceadapter() != null &&
+ resourceAdapter1516.getOutboundResourceadapter().getConnectionDefinitions() != null)
+ {
+ mergedProperties = mergedResourceAdapter1516.getOutboundResourceadapter().getConnectionDefinitions()
+ .get(0).getConfigProperties();
+ }
+
+ //then merged properties are presents
+
+ assertThat((List<ConfigProperty>) mergedProperties,
+ hasItem(MetadataFactory.ConfigPropertyFactory.createConfigProperty(
+ MetadataFactory.ConfigPropertyFactory.Prototype.XADATASOURCEPROPERTIES,
+ "DatabaseName=database_name;User=user;ServerName=server_name;PortNumber=5432;"
+ + "Password=password;")));
+
+ assertThat((List<ConfigProperty>) mergedProperties,
+ hasItem(MetadataFactory.ConfigPropertyFactory.createConfigProperty(
+ MetadataFactory.ConfigPropertyFactory.Prototype.XADATASOURCECLASS,
+ "org.postgresql.xa.PGXADataSource")));
+
+ //then metadata read from ra.xml still present (not deleted by merge)
+ assertThat(mergedResourceAdapter1516.getOutboundResourceadapter().getTransactionSupport(),
+ is(TransactionSupportEnum.XATransaction));
+ assertThat(mergedResourceAdapter1516.getOutboundResourceadapter().getConnectionDefinitions().get(0)
+ .getManagedConnectionFactoryClass(),
+ equalTo(new XsdString("org.jboss.jca.adapters.jdbc.xa.XAManagedConnectionFactory", null)));
+
+ //then it have empty property for not set ones
+ assertThat((List<ConfigProperty>) mergedProperties,
+ not(hasItem(MetadataFactory.ConfigPropertyFactory.createConfigProperty(
+ MetadataFactory.ConfigPropertyFactory.Prototype.PREPAREDSTATEMENTCACHESIZE, ""))));
+
+ //then it does not contain property not in ra.xml
+ assertThat((List<ConfigProperty>) mergedProperties,
+ not(hasItem(MetadataFactory.ConfigPropertyFactory.createConfigProperty(
+ MetadataFactory.ConfigPropertyFactory.Prototype.CONNECTIONURL, ""))));
+
+ }
+ finally
+ {
+ if (is != null)
+ is.close();
+ }
+
+ }
}
Added: projects/jboss-jca/trunk/common/src/test/resources/adapters/ra-xa.xml
===================================================================
--- projects/jboss-jca/trunk/common/src/test/resources/adapters/ra-xa.xml (rev 0)
+++ projects/jboss-jca/trunk/common/src/test/resources/adapters/ra-xa.xml 2010-08-20 14:15:19 UTC (rev 107714)
@@ -0,0 +1,158 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<connector xmlns="http://java.sun.com/xml/ns/j2ee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
+ http://java.sun.com/xml/ns/j2ee/connector_1_5.xsd"
+ version="1.5">
+
+ <description>JBoss Resource Adapter for JDBC 4 XA drivers</description>
+ <display-name>JBoss JDBC XATransaction ResourceAdapter</display-name>
+
+ <vendor-name>Red Hat Middleware LLC</vendor-name>
+ <eis-type>JDBC 4.0 XA Relational Database</eis-type>
+ <resourceadapter-version>7.0</resourceadapter-version>
+
+ <license>
+ <description>
+JBoss, Home of Professional Open Source.
+Copyright 2010, Red Hat Middleware LLC, and individual contributors
+as indicated by the @author tags. See the copyright.txt file in the
+distribution for a full listing of individual contributors.
+
+This is free software; you can redistribute it and/or modify it
+under the terms of the GNU Lesser General Public License as
+published by the Free Software Foundation; either version 2.1 of
+the License, or (at your option) any later version.
+
+This software is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public
+License along with this software; if not, write to the Free
+Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ </description>
+ <license-required>true</license-required>
+ </license>
+
+ <resourceadapter>
+ <outbound-resourceadapter>
+ <connection-definition>
+ <managedconnectionfactory-class>org.jboss.jca.adapters.jdbc.xa.XAManagedConnectionFactory</managedconnectionfactory-class>
+ <config-property>
+ <description>The default user name used to create JDBC connections.</description>
+ <config-property-name>UserName</config-property-name>
+ <config-property-type>java.lang.String</config-property-type>
+ </config-property>
+ <config-property>
+ <description>The default password used to create JDBC connections.</description>
+ <config-property-name>Password</config-property-name>
+ <config-property-type>java.lang.String</config-property-type>
+ </config-property>
+ <config-property>
+ <description>The properties to set up the XA driver. These properties must be in the form name1=value1;name2=value2;...namen=valuen</description>
+ <config-property-name>XADataSourceProperties</config-property-name>
+ <config-property-type>java.lang.String</config-property-type>
+ </config-property>
+ <config-property>
+ <description>The jdbc connection url delimeter.</description>
+ <config-property-name>URLDelimiter</config-property-name>
+ <config-property-type>java.lang.String</config-property-type>
+ </config-property>
+ <config-property>
+ <description>The property that contains the list of URLs.</description>
+ <config-property-name>URLProperty</config-property-name>
+ <config-property-type>java.lang.String</config-property-type>
+ </config-property>
+ <config-property>
+ <description>The configurable URLSelectorStrategy class name.</description>
+ <config-property-name>UrlSelectorStrategyClassName</config-property-name>
+ <config-property-type>java.lang.String</config-property-type>
+ </config-property>
+ <config-property>
+ <description>The class name of the JDBC XA driver that handlesthis JDBC URL.</description>
+ <config-property-name>XADataSourceClass</config-property-name>
+ <config-property-type>java.lang.String</config-property-type>
+ </config-property>
+ <config-property>
+ <description>The transaction isolation for new connections. Not necessary: the driver default will be used if ommitted.</description>
+ <config-property-name>TransactionIsolation</config-property-name>
+ <config-property-type>java.lang.String</config-property-type>
+ </config-property>
+ <config-property>
+ <description>The number of cached prepared statements per connection.</description>
+ <config-property-name>PreparedStatementCacheSize</config-property-name>
+ <config-property-type>java.lang.Integer</config-property-type>
+ </config-property>
+ <config-property>
+ <description>Whether to share prepared statements.</description>
+ <config-property-name>SharePreparedStatements</config-property-name>
+ <config-property-type>java.lang.Boolean</config-property-type>
+ </config-property>
+ <config-property>
+ <description>An SQL statement to be executed when a new connection is created as auxillary setup.</description>
+ <config-property-name>NewConnectionSQL</config-property-name>
+ <config-property-type>java.lang.String</config-property-type>
+ </config-property>
+ <config-property>
+ <description>An SQL statement that may be executed when a managed connection is taken out of the pool and is about to be given to a client: the purpose is to verify that the connection still works.</description>
+ <config-property-name>CheckValidConnectionSQL</config-property-name>
+ <config-property-type>java.lang.String</config-property-type>
+ </config-property>
+ <config-property>
+ <description>The fully qualified name of a class implementing org.jboss.jca.adapters.jdbc.ValidConnectionChecker that can determine for a particular vender db when a connection is valid.</description>
+ <config-property-name>ValidConnectionCheckerClassName</config-property-name>
+ <config-property-type>java.lang.String</config-property-type>
+ </config-property>
+ <config-property>
+ <description>The fully qualified name of a class implementing org.jboss.jca.adapters.jdbc.ExceptionSorter that can determine for a particular vender db which exceptions are fatal and mean a connection should be discarded.</description>
+ <config-property-name>ExceptionSorterClassName</config-property-name>
+ <config-property-type>java.lang.String</config-property-type>
+ </config-property>
+ <config-property>
+ <description>The fully qualified name of a class implementing org.jboss.jca.adapters.jdbc.StaleConnectionChecker that can determine for a particular vender db when a connection is stale.</description>
+ <config-property-name>StaleConnectionCheckerClassName</config-property-name>
+ <config-property-type>java.lang.String</config-property-type>
+ </config-property>
+ <config-property>
+ <description>Whether to track unclosed statements - false/true/nowarn</description>
+ <config-property-name>TrackStatements</config-property-name>
+ <config-property-type>java.lang.String</config-property-type>
+ </config-property>
+ <config-property>
+ <description>Whether to validate the connection on the ManagedConnectionFactory.matchManagedConnection method</description>
+ <config-property-name>ValidateOnMatch</config-property-name>
+ <config-property-type>java.lang.Boolean</config-property-type>
+ </config-property>
+ <config-property>
+ <description>Whether to set the query timeout based on the transaction timeout</description>
+ <config-property-name>TransactionQueryTimeout</config-property-name>
+ <config-property-type>java.lang.Boolean</config-property-type>
+ </config-property>
+ <config-property>
+ <description>A configured query timeout</description>
+ <config-property-name>QueryTimeout</config-property-name>
+ <config-property-type>java.lang.Integer</config-property-type>
+ </config-property>
+ <config-property>
+ <description>Maximum wait for a lock</description>
+ <config-property-name>UseTryLock</config-property-name>
+ <config-property-type>java.lang.Integer</config-property-type>
+ </config-property>
+ <connectionfactory-interface>javax.sql.DataSource</connectionfactory-interface>
+ <connectionfactory-impl-class>org.jboss.jca.adapters.jdbc.WrapperDataSource</connectionfactory-impl-class>
+ <connection-interface>java.sql.Connection</connection-interface>
+ <connection-impl-class>org.jboss.jca.adapters.jdbc.WrappedConnection</connection-impl-class>
+ </connection-definition>
+ <transaction-support>XATransaction</transaction-support>
+ <authentication-mechanism>
+ <authentication-mechanism-type>BasicPassword</authentication-mechanism-type>
+ <credential-interface>javax.resource.spi.security.PasswordCredential</credential-interface>
+ </authentication-mechanism>
+ <reauthentication-support>false</reauthentication-support>
+ </outbound-resourceadapter>
+ </resourceadapter>
+</connector>
More information about the jboss-cvs-commits
mailing list