[jboss-cvs] JBossAS SVN: r107532 - in projects/jboss-jca/trunk/common/src: main/java/org/jboss/jca/common/metadata and 7 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Wed Aug 11 05:51:40 EDT 2010
Author: maeste
Date: 2010-08-11 05:51:40 -0400 (Wed, 11 Aug 2010)
New Revision: 107532
Added:
projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/metadata/AbstractParser.java
projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/metadata/ds/DsParser.java
projects/jboss-jca/trunk/common/src/test/java/org/jboss/jca/common/metadata/ra/DsParserTestCase.java
projects/jboss-jca/trunk/common/src/test/resources/ds/
projects/jboss-jca/trunk/common/src/test/resources/ds/db2-400-ds.xml
projects/jboss-jca/trunk/common/src/test/resources/ds/db2-ds.xml
projects/jboss-jca/trunk/common/src/test/resources/ds/db2-jcc-xa-ds.xml
projects/jboss-jca/trunk/common/src/test/resources/ds/db2-xa-ds
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/DataSources.java
projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/api/metadata/ds/RecoverySettings.java
projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/api/metadata/ds/SecuritySettings.java
projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/api/metadata/ds/StatementSettings.java
projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/api/metadata/ds/TimeOutSettings.java
projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/api/metadata/ds/ValidationSettings.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/ds/DatasourcesImpl.java
projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/metadata/ds/TimeOutSettingsImpl.java
projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/metadata/ds/XADataSourceImpl.java
projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/metadata/jbossra/JbossRaParser.java
projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/metadata/ra/RaParser.java
projects/jboss-jca/trunk/common/src/main/resources/schema/datasources_1_0.xsd
Log:
JBJCA-400 Parser implementation and its trest suite
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-11 08:56:50 UTC (rev 107531)
+++ projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/api/metadata/ds/DataSource.java 2010-08-11 09:51:40 UTC (rev 107532)
@@ -198,7 +198,7 @@
/**
* maxPoolSize tag
*/
- MAXPOOLSIZE("maxPoolSize"),
+ MAXPOOLSIZE("max-pool-size"),
/**
* prefill tag
*/
@@ -206,7 +206,7 @@
/**
* userName tag
*/
- USERNAME("userName"),
+ USERNAME("user-name"),
/**
* password tag
*/
@@ -214,47 +214,47 @@
/**
* connectionUrl tag
*/
- CONNECTIONURL("connectionUrl"),
+ CONNECTIONURL("connection-url"),
/**
* driverClass tag
*/
- DRIVERCLASS("driverClass"),
+ DRIVERCLASS("driver-class"),
/**
* transactionIsolation tag
*/
- TRANSACTIONISOLATION("transactionIsolation"),
+ TRANSACTIONISOLATION("transaction-isolation"),
/**
* connectionProperty tag
*/
- CONNECTIONPROPERTY("connectionProperty"),
+ CONNECTIONPROPERTY("connection-property"),
/**
* timeOutSettings tag
*/
- TIMEOUTSETTINGS("timeOutSettings"),
+ TIMEOUTSETTINGS("time-out-settings"),
/**
* securitySettings tag
*/
- SECURITYSETTINGS("securitySettings"),
+ SECURITYSETTINGS("security-settings"),
/**
* statementSettings tag
*/
- STATEMENTSETTINGS("statementSettings"),
+ STATEMENTSETTINGS("statement-settings"),
/**
* validationSettings tag
*/
- VALIDATIONSETTINGS("validationSettings"),
+ VALIDATIONSETTINGS("validation-settings"),
/**
* urlDelimiter tag
*/
- URLDELIMITER("urlDelimiter"),
+ URLDELIMITER("url-delimiter"),
/**
* urlSelectorStrategyClassName tag
*/
- URLSELECTORSTRATEGYCLASSNAME("urlSelectorStrategyClassName"),
+ URLSELECTORSTRATEGYCLASSNAME("url-selector-strategy-className"),
/**
* newConnectionSql tag
*/
- NEWCONNECTIONSQL("newConnectionSql");
+ NEWCONNECTIONSQL("new-sonnection-sql");
private final String name;
@@ -335,7 +335,7 @@
/** jndiName attribute
*
*/
- USEJAVACONTEXT("useJavaContext");
+ USEJAVACONTEXT("use-java-context");
private final String name;
Modified: projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/api/metadata/ds/DataSources.java
===================================================================
--- projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/api/metadata/ds/DataSources.java 2010-08-11 08:56:50 UTC (rev 107531)
+++ projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/api/metadata/ds/DataSources.java 2010-08-11 09:51:40 UTC (rev 107532)
@@ -28,8 +28,8 @@
import java.util.List;
import java.util.Map;
-import javax.sql.XADataSource;
+
/**
*
* A DataSources.
@@ -52,7 +52,7 @@
*
* @return the xaDataSource.
*/
- public List<XADataSource> getXaDataSource();
+ public List<XaDataSource> getXaDataSource();
/**
*
Modified: projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/api/metadata/ds/RecoverySettings.java
===================================================================
--- projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/api/metadata/ds/RecoverySettings.java 2010-08-11 08:56:50 UTC (rev 107531)
+++ projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/api/metadata/ds/RecoverySettings.java 2010-08-11 09:51:40 UTC (rev 107532)
@@ -81,19 +81,19 @@
/**
* noRecover tag
*/
- NORECOVER("noRecover"),
+ NORECOVER("no-recover"),
/**
* recoverUserName tag
*/
- RECOVERUSERNAME("recoverUserName"),
+ RECOVERUSERNAME("recover-user-name"),
/**
* recoverPassword tag
*/
- RECOVERPASSWORD("recoverPassword"),
+ RECOVERPASSWORD("recover-password"),
/**
* recoverSecurityDomain tag
*/
- RECOVERSECURITYDOMAIN("recoverSecurityDomain");
+ RECOVERSECURITYDOMAIN("recover-security-domain");
private final String name;
Modified: projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/api/metadata/ds/SecuritySettings.java
===================================================================
--- projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/api/metadata/ds/SecuritySettings.java 2010-08-11 08:56:50 UTC (rev 107531)
+++ projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/api/metadata/ds/SecuritySettings.java 2010-08-11 09:51:40 UTC (rev 107532)
@@ -93,11 +93,11 @@
/**
* securityManager tag
*/
- SECURITYMANAGER("securityManager"),
+ SECURITYMANAGER("security-manager"),
/**
* securityDomain tag
*/
- SECURITYDOMAIN("securityDomain");
+ SECURITYDOMAIN("security-domain");
private final String name;
Modified: projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/api/metadata/ds/StatementSettings.java
===================================================================
--- projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/api/metadata/ds/StatementSettings.java 2010-08-11 08:56:50 UTC (rev 107531)
+++ projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/api/metadata/ds/StatementSettings.java 2010-08-11 09:51:40 UTC (rev 107532)
@@ -99,15 +99,15 @@
/**
* trackStatements tag
*/
- TRACKSTATEMENTS("trackStatements"),
+ TRACKSTATEMENTS("track-statements"),
/**
* preparedStatementCacheSize tag
*/
- PREPAREDSTATEMENTCACHESIZE("preparedStatementCacheSize"),
+ PREPAREDSTATEMENTCACHESIZE("prepared-statement-cache-size"),
/**
* sharePreparedStatements tag
*/
- SHAREPREPAREDSTATEMENTS("sharePreparedStatements");
+ SHAREPREPAREDSTATEMENTS("share-prepared-statements");
private final String name;
Modified: projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/api/metadata/ds/TimeOutSettings.java
===================================================================
--- projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/api/metadata/ds/TimeOutSettings.java 2010-08-11 08:56:50 UTC (rev 107531)
+++ projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/api/metadata/ds/TimeOutSettings.java 2010-08-11 09:51:40 UTC (rev 107532)
@@ -86,6 +86,13 @@
public Long getAllocationRetryWaitMillis();
/**
+ * Get the xaResourceTimeout.
+ *
+ * @return the xaResourceTimeout.
+ */
+ public Long getXaResourceTimeout();
+
+ /**
*
* A Tag.
*
@@ -102,31 +109,35 @@
/**
* blockingTimeoutMillis tag
*/
- BLOCKINGTIMEOUTMILLIS("blockingTimeoutMillis"),
+ BLOCKINGTIMEOUTMILLIS("blocking-timeout-millis"),
/**
* idleTimeoutMinutes tag
*/
- IDLETIMEOUTMINUTES("idleTimeoutMinutes"),
+ IDLETIMEOUTMINUTES("idle-timeout-minutes"),
/**
* setTxQueryTimeout tag
*/
- SETTXQUERYTIMEOUT("setTxQueryTimeout"),
+ SETTXQUERYTIMEOUT("set-tx-query-timeout"),
/**
* queryTimeout tag
*/
- QUERYTIMEOUT("queryTimeout"),
+ QUERYTIMEOUT("query-timeout"),
/**
* useTryLock tag
*/
- USETRYLOCK("useTryLock"),
+ USETRYLOCK("use-try-lock"),
/**
* allocationRetry tag
*/
- ALLOCATIONRETRY("allocationRetry"),
+ ALLOCATIONRETRY("allocation-retry"),
/**
+ * xaResourceTimeout tag
+ */
+ XARESOURCETIMEOUT("xa-resource-timeout"),
+ /**
* allocationRetryWaitMillis tag
*/
- ALLOCATIONRETRYWAITMILLIS("allocationRetryWaitMillis");
+ ALLOCATIONRETRYWAITMILLIS("allocation-retry-wait-millis");
private final String name;
Modified: projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/api/metadata/ds/ValidationSettings.java
===================================================================
--- projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/api/metadata/ds/ValidationSettings.java 2010-08-11 08:56:50 UTC (rev 107531)
+++ projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/api/metadata/ds/ValidationSettings.java 2010-08-11 09:51:40 UTC (rev 107532)
@@ -109,23 +109,23 @@
/**
* validConnectionCheckerClassName tag
*/
- VALIDCONNECTIONCHECKERCLASSNAME("validConnectionCheckerClassName"),
+ VALIDCONNECTIONCHECKERCLASSNAME("valid-connection-checker-className"),
/**
* checkValidConnectionSql tag
*/
- CHECKVALIDCONNECTIONSQL("checkValidConnectionSql"),
+ CHECKVALIDCONNECTIONSQL("check-valid-connection-sql"),
/**
* validateOnMatch tag
*/
- VALIDATEONMATCH("validateOnMatch"),
+ VALIDATEONMATCH("validate-on-match"),
/**
* backgroundValidation tag
*/
- BACKGROUNDVALIDATION("backgroundValidation"),
+ BACKGROUNDVALIDATION("background-validation"),
/**
* backgroundValidationMinutes tag
*/
- BACKGROUNDVALIDATIONMINUTES("backgroundValidationMinutes"),
+ BACKGROUNDVALIDATIONMINUTES("background-validation-minutes"),
/**
* useFastFail tag
*/
@@ -133,11 +133,11 @@
/**
* staleConnectionCheckerClassName tag
*/
- STALECONNECTIONCHECKERCLASSNAME("staleConnectionCheckerClassName"),
+ STALECONNECTIONCHECKERCLASSNAME("stale-connection-checker-class-name"),
/**
* exceptionSorterClassName tag
*/
- EXCEPTIONSORTERCLASSNAME("exceptionSorterClassName");
+ EXCEPTIONSORTERCLASSNAME("exception-sorter-class-name");
private final String name;
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-11 08:56:50 UTC (rev 107531)
+++ projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/api/metadata/ds/XaDataSource.java 2010-08-11 09:51:40 UTC (rev 107532)
@@ -208,11 +208,11 @@
/**
* minPoolSize tag
*/
- MINPOOLSIZE("minPoolSize"),
+ MINPOOLSIZE("min-pool-size"),
/**
* maxPoolSize tag
*/
- MAXPOOLSIZE("maxPoolSize"),
+ MAXPOOLSIZE("max-pool-size"),
/**
* prefill tag
*/
@@ -220,7 +220,7 @@
/**
* userName tag
*/
- USERNAME("userName"),
+ USERNAME("user-name"),
/**
* password tag
*/
@@ -228,19 +228,19 @@
/**
* xaDatasourceProperty tag
*/
- XADATASOURCEPROPERTY("xaDatasourceProperty"),
+ XADATASOURCEPROPERTY("xa-datasource-property"),
/**
* xaDatasourceClass tag
*/
- XADATASOURCECLASS("xaDatasourceClass"),
+ XADATASOURCECLASS("xa-datasource-class"),
/**
* transactionIsolation tag
*/
- TRANSACTIONISOLATION("transactionIsolation"),
+ TRANSACTIONISOLATION("transaction-isolation"),
/**
* isSameRmOverrideValue tag
*/
- ISSAMERMOVERRIDEVALUE("isSameRmOverrideValue"),
+ ISSAMERMOVERRIDEVALUE("is-same-rm-override-value"),
/**
* interleaving tag
*/
@@ -248,39 +248,35 @@
/**
* recoverySettings tag
*/
- RECOVERYSETTINGS("recoverySettings"),
+ RECOVERYSETTINGS("recovery-settings"),
/**
* timeOutSettings tag
*/
- TIMEOUTSETTINGS("timeOutSettings"),
+ TIMEOUTSETTINGS("time-out-settings"),
/**
- * xaResourceTimeout tag
- */
- XARESOURCETIMEOUT("xaResourceTimeout"),
- /**
* securitySettings tag
*/
- SECURITYSETTINGS("securitySettings"),
+ SECURITYSETTINGS("security-settings"),
/**
* statementSettings tag
*/
- STATEMENTSETTINGS("statementSettings"),
+ STATEMENTSETTINGS("statement-settings"),
/**
* validationSettings tag
*/
- VALIDATIONSETTINGS("validationSettings"),
+ VALIDATIONSETTINGS("validation-settings"),
/**
* urlDelimiter tag
*/
- URLDELIMITER("urlDelimiter"),
+ URLDELIMITER("url-delimiter"),
/**
* urlSelectorStrategyClassName tag
*/
- URLSELECTORSTRATEGYCLASSNAME("urlSelectorStrategyClassName"),
+ URLSELECTORSTRATEGYCLASSNAME("url-selector-strategy-class-name"),
/**
* newConnectionSql tag
*/
- NEWCONNECTIONSQL("newConnectionSql");
+ NEWCONNECTIONSQL("new-connection-sql");
private final String name;
Added: projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/metadata/AbstractParser.java
===================================================================
--- projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/metadata/AbstractParser.java (rev 0)
+++ projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/metadata/AbstractParser.java 2010-08-11 09:51:40 UTC (rev 107532)
@@ -0,0 +1,138 @@
+/*
+ * 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.metadata;
+
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+
+/**
+ *
+ * A AbstractParser.
+ *
+ * @author <a href="stefano.maestri at jboss.com">Stefano Maestri</a>
+ *
+ */
+public abstract class AbstractParser
+{
+
+ /**
+ * convert an xml element in boolean value. Empty elements results with true (tag presence is sufficient condition)
+ *
+ * @param reader the StAX reader
+ * @return the boolean representing element
+ * @throws XMLStreamException StAX exception
+ */
+ protected boolean elementAsBoolean(XMLStreamReader reader) throws XMLStreamException
+ {
+ return reader.getElementText() == null || reader.getElementText().length() == 0 ? true : Boolean.valueOf(reader
+ .getElementText().trim());
+ }
+
+ /**
+ * convert an xml attribute in boolean value. Empty elements results with false
+ *
+ * @param reader the StAX reader
+ * @param attributeName the name of the attribute
+ * @return the boolean representing element
+ * @throws XMLStreamException StAX exception
+ */
+ protected boolean attributeAsBoolean(XMLStreamReader reader, String attributeName) throws XMLStreamException
+ {
+ return reader.getAttributeValue("", attributeName) == null
+ || reader.getAttributeValue("", attributeName).length() == 0
+ ? false :
+ Boolean.valueOf(reader.getAttributeValue("", attributeName).trim());
+ }
+
+ /**
+ * convert an xml element in String value
+ *
+ * @param reader the StAX reader
+ * @return the string representing element
+ * @throws XMLStreamException StAX exception
+ */
+ protected String elementAsString(XMLStreamReader reader) throws XMLStreamException
+ {
+ return reader.getElementText() == null ? null : reader.getElementText().trim();
+ }
+
+ /**
+ * convert an xml element in String value
+ *
+ * @param reader the StAX reader
+ * @param attributeName the name of the attribute
+ * @return the string representing element
+ * @throws XMLStreamException StAX exception
+ */
+ protected String attributeAsString(XMLStreamReader reader, String attributeName) throws XMLStreamException
+ {
+ return reader.getAttributeValue("", attributeName) == null ? null : reader.getAttributeValue("", attributeName)
+ .trim();
+ }
+
+ /**
+ * convert an xml element in Integer value
+ *
+ * @param reader the StAX reader
+ * @return the integer representing element
+ * @throws XMLStreamException StAX exception
+ * @throws ParserException in case it isn't a number
+ */
+ protected Integer elementAsInteger(XMLStreamReader reader) throws XMLStreamException, ParserException
+ {
+ Integer integerValue;
+ integerValue = null;
+ try
+ {
+ integerValue = Integer.valueOf(reader.getElementText().trim());
+ }
+ catch (NumberFormatException nfe)
+ {
+ throw new ParserException(reader.getLocalName() + "isn't a valid number");
+ }
+ return integerValue;
+ }
+
+ /**
+ * convert an xml element in Long value
+ *
+ * @param reader the StAX reader
+ * @return the long representing element
+ * @throws XMLStreamException StAX exception
+ * @throws ParserException in case it isn't a number
+ */
+ protected Long elementAsLong(XMLStreamReader reader) throws XMLStreamException, ParserException
+ {
+ Long longValue;
+ longValue = null;
+ try
+ {
+ longValue = Long.valueOf(reader.getElementText().trim());
+ }
+ catch (NumberFormatException nfe)
+ {
+ throw new ParserException(reader.getLocalName() + "isn't a valid number");
+ }
+ return longValue;
+ }
+
+}
Modified: projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/metadata/ds/DatasourcesImpl.java
===================================================================
--- projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/metadata/ds/DatasourcesImpl.java 2010-08-11 08:56:50 UTC (rev 107531)
+++ projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/metadata/ds/DatasourcesImpl.java 2010-08-11 09:51:40 UTC (rev 107532)
@@ -23,12 +23,12 @@
import org.jboss.jca.common.api.metadata.ds.DataSource;
import org.jboss.jca.common.api.metadata.ds.DataSources;
+import org.jboss.jca.common.api.metadata.ds.XaDataSource;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
-import javax.sql.XADataSource;
/**
*
@@ -44,7 +44,7 @@
private final ArrayList<DataSource> datasource;
- private final ArrayList<XADataSource> xaDataSource;
+ private final ArrayList<XaDataSource> xaDataSource;
/**
* Create a new DatasourcesImpl.
@@ -52,7 +52,7 @@
* @param datasource datasource
* @param xaDataSource xaDataSource
*/
- public DatasourcesImpl(List<DataSource> datasource, List<XADataSource> xaDataSource)
+ public DatasourcesImpl(List<DataSource> datasource, List<XaDataSource> xaDataSource)
{
super();
if (datasource != null)
@@ -66,12 +66,12 @@
}
if (xaDataSource != null)
{
- this.xaDataSource = new ArrayList<XADataSource>(xaDataSource.size());
+ this.xaDataSource = new ArrayList<XaDataSource>(xaDataSource.size());
this.xaDataSource.addAll(xaDataSource);
}
else
{
- this.xaDataSource = new ArrayList<XADataSource>(0);
+ this.xaDataSource = new ArrayList<XaDataSource>(0);
}
}
@@ -92,7 +92,7 @@
* @return the xaDataSource.
*/
@Override
- public final List<XADataSource> getXaDataSource()
+ public final List<XaDataSource> getXaDataSource()
{
return Collections.unmodifiableList(xaDataSource);
}
Added: projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/metadata/ds/DsParser.java
===================================================================
--- projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/metadata/ds/DsParser.java (rev 0)
+++ projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/metadata/ds/DsParser.java 2010-08-11 09:51:40 UTC (rev 107532)
@@ -0,0 +1,856 @@
+/*
+ * 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.metadata.ds;
+
+import org.jboss.jca.common.api.metadata.ds.DataSource;
+import org.jboss.jca.common.api.metadata.ds.DataSources;
+import org.jboss.jca.common.api.metadata.ds.RecoverySettings;
+import org.jboss.jca.common.api.metadata.ds.SecuritySettings;
+import org.jboss.jca.common.api.metadata.ds.SecuritySettings.SecurityManager;
+import org.jboss.jca.common.api.metadata.ds.StatementSettings;
+import org.jboss.jca.common.api.metadata.ds.StatementSettings.TrackStatementsEnum;
+import org.jboss.jca.common.api.metadata.ds.TimeOutSettings;
+import org.jboss.jca.common.api.metadata.ds.TransactionIsolation;
+import org.jboss.jca.common.api.metadata.ds.ValidationSettings;
+import org.jboss.jca.common.api.metadata.ds.XaDataSource;
+import org.jboss.jca.common.api.metadata.ds.XaDataSource.Attribute;
+import org.jboss.jca.common.metadata.AbstractParser;
+import org.jboss.jca.common.metadata.MetadataParser;
+import org.jboss.jca.common.metadata.ParserException;
+
+import java.io.InputStream;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+
+import static javax.xml.stream.XMLStreamConstants.END_ELEMENT;
+import static javax.xml.stream.XMLStreamConstants.START_ELEMENT;
+
+/**
+ *
+ * A DsParser.
+ *
+ * @author <a href="stefano.maestri at jboss.com">Stefano Maestri</a>
+ *
+ */
+public class DsParser extends AbstractParser implements MetadataParser<DataSources>
+{
+
+ @Override
+ public DataSources parse(InputStream xmlInputStream) throws Exception
+ {
+
+ XMLStreamReader reader = null;
+ DataSources dataSources = null;
+
+ try
+ {
+ XMLInputFactory inputFactory = XMLInputFactory.newInstance();
+ reader = inputFactory.createXMLStreamReader(xmlInputStream);
+
+ //iterate over tags
+ int iterate;
+ try
+ {
+ iterate = reader.nextTag();
+ }
+ catch (XMLStreamException e)
+ {
+ //founding a non tag..go on. Normally non-tag found at beginning are comments or DTD declaration
+ iterate = reader.nextTag();
+ }
+ switch (iterate)
+ {
+ case END_ELEMENT : {
+ // should mean we're done, so ignore it.
+ break;
+ }
+ case START_ELEMENT : {
+
+ switch (Tag.forName(reader.getLocalName()))
+ {
+ case DATASOURCES : {
+ dataSources = parseDataSources(reader);
+ break;
+ }
+ default :
+ throw new ParserException("Unexpected element:" + reader.getLocalName());
+ }
+
+ break;
+ }
+ default :
+ throw new IllegalStateException();
+ }
+ }
+ finally
+ {
+ if (reader != null)
+ reader.close();
+ }
+ return dataSources;
+
+ }
+
+ private DataSources parseDataSources(XMLStreamReader reader) throws XMLStreamException, ParserException
+ {
+ ArrayList<XaDataSource> xaDataSource = new ArrayList<XaDataSource>();
+ ArrayList<DataSource> datasource = new ArrayList<DataSource>();
+ while (reader.hasNext())
+ {
+ switch (reader.nextTag())
+ {
+ case END_ELEMENT : {
+ if (Tag.forName(reader.getLocalName()) == Tag.DATASOURCES)
+ {
+
+ return new DatasourcesImpl(datasource, xaDataSource);
+ }
+ else
+ {
+ if (DataSources.Tag.forName(reader.getLocalName()) == DataSources.Tag.UNKNOWN)
+ {
+ throw new ParserException("unexpected end tag" + reader.getLocalName());
+ }
+ }
+ break;
+ }
+ case START_ELEMENT : {
+ switch (DataSources.Tag.forName(reader.getLocalName()))
+ {
+ case DATASOURCE : {
+ datasource.add(parseDataSource(reader));
+ break;
+ }
+ case XA_DATASOURCE : {
+ xaDataSource.add(parseXADataSource(reader));
+ break;
+ }
+ default :
+ throw new ParserException("Unexpected element:" + reader.getLocalName());
+ }
+ break;
+ }
+ }
+ }
+ throw new ParserException("Reached end of xml document unexpectedly");
+ }
+
+ private XaDataSource parseXADataSource(XMLStreamReader reader) throws XMLStreamException, ParserException
+ {
+ Integer minPoolSize = null;
+ Integer maxPoolSize = null;
+ boolean prefill = false;
+ String userName = null;
+ String password = null;
+ TransactionIsolation transactionIsolation = null;
+ Map<String, String> xaDataSourceProperty = new HashMap<String, String>();
+ TimeOutSettings timeOutSettings = null;
+ SecuritySettings securitySettings = null;
+ StatementSettings statementSettings = null;
+ ValidationSettings validationSettings = null;
+ String urlDelimiter = null;
+ String urlSelectorStrategyClassName = null;
+ String newConnectionSql = null;
+
+ boolean interleaving = false;
+ boolean isSameRmOverrideValue = false;
+ String xaDataSourceClass = null;
+ RecoverySettings recoverySettings = null;
+
+ //attributes reading
+
+ boolean useJavaContext = false;
+ String poolName = null;
+ boolean enabled = true;
+ String jndiName = null;
+
+ for (Attribute attribute : XaDataSource.Attribute.values())
+ {
+ switch (attribute)
+ {
+ case ENABLED : {
+ enabled = attributeAsBoolean(reader, attribute.getLocalName());
+ break;
+ }
+ case JNDINAME : {
+ jndiName = attributeAsString(reader, attribute.getLocalName());
+ break;
+ }
+ case POOL_NAME : {
+ poolName = attributeAsString(reader, attribute.getLocalName());
+ break;
+ }
+ case USEJAVACONTEXT : {
+ useJavaContext = attributeAsBoolean(reader, attribute.getLocalName());
+ break;
+ }
+ default :
+ break;
+ }
+ }
+
+ //elements reading
+ while (reader.hasNext())
+ {
+ switch (reader.nextTag())
+ {
+ case END_ELEMENT : {
+ if (DataSources.Tag.forName(reader.getLocalName()) == DataSources.Tag.XA_DATASOURCE)
+ {
+
+ return new XADataSourceImpl(minPoolSize, maxPoolSize, prefill, userName, password,
+ xaDataSourceProperty, xaDataSourceClass, transactionIsolation, isSameRmOverrideValue,
+ interleaving, recoverySettings, timeOutSettings, securitySettings, statementSettings,
+ validationSettings, urlDelimiter, urlSelectorStrategyClassName, newConnectionSql,
+ useJavaContext, poolName, enabled, jndiName);
+ }
+ else
+ {
+ if (XaDataSource.Tag.forName(reader.getLocalName()) == XaDataSource.Tag.UNKNOWN)
+ {
+ throw new ParserException("unexpected end tag" + reader.getLocalName());
+ }
+ }
+ break;
+ }
+ case START_ELEMENT : {
+ switch (XaDataSource.Tag.forName(reader.getLocalName()))
+ {
+ case XADATASOURCEPROPERTY : {
+ xaDataSourceProperty.put(reader.getAttributeValue("", "name"),
+ reader.getAttributeValue("", "value"));
+ break;
+ }
+ case XADATASOURCECLASS : {
+ xaDataSourceClass = elementAsString(reader);
+ break;
+ }
+ case MAXPOOLSIZE : {
+ maxPoolSize = elementAsInteger(reader);
+ break;
+ }
+ case MINPOOLSIZE : {
+ minPoolSize = elementAsInteger(reader);
+ break;
+ }
+ case NEWCONNECTIONSQL : {
+ newConnectionSql = elementAsString(reader);
+ break;
+ }
+ case PASSWORD : {
+ password = elementAsString(reader);
+ break;
+ }
+ case USERNAME : {
+ userName = elementAsString(reader);
+ break;
+ }
+ case PREFILL : {
+ prefill = elementAsBoolean(reader);
+ break;
+ }
+ case URLDELIMITER : {
+ urlDelimiter = elementAsString(reader);
+ break;
+ }
+ case URLSELECTORSTRATEGYCLASSNAME : {
+ urlSelectorStrategyClassName = elementAsString(reader);
+ break;
+ }
+ case TRANSACTIONISOLATION : {
+ transactionIsolation = TransactionIsolation.valueOf(elementAsString(reader));
+ break;
+ }
+ case SECURITYSETTINGS : {
+ securitySettings = parseSecuritySettings(reader);
+ break;
+ }
+ case STATEMENTSETTINGS : {
+ statementSettings = parseStatementSettings(reader);
+ break;
+ }
+ case TIMEOUTSETTINGS : {
+ timeOutSettings = parseTimeOutSettings(reader);
+ break;
+ }
+ case VALIDATIONSETTINGS : {
+ validationSettings = parseValidationSetting(reader);
+ break;
+ }
+ case INTERLEAVING : {
+ interleaving = elementAsBoolean(reader);
+ break;
+ }
+ case ISSAMERMOVERRIDEVALUE : {
+ isSameRmOverrideValue = elementAsBoolean(reader);
+ break;
+ }
+ case RECOVERYSETTINGS : {
+ recoverySettings = parseRecoverySettings(reader);
+ break;
+ }
+ default :
+ throw new ParserException("Unexpected element:" + reader.getLocalName());
+ }
+ break;
+ }
+ }
+ }
+ throw new ParserException("Reached end of xml document unexpectedly");
+ }
+
+ private RecoverySettings parseRecoverySettings(XMLStreamReader reader) throws XMLStreamException, ParserException
+ {
+ String recoverUserName = null;
+ String recoverPassword = null;
+ String recoverSecurityDomain = null;
+ boolean noRecover = false;
+
+ while (reader.hasNext())
+ {
+ switch (reader.nextTag())
+ {
+ case END_ELEMENT : {
+ if (XaDataSource.Tag.forName(reader.getLocalName()) == XaDataSource.Tag.RECOVERYSETTINGS)
+ {
+
+
+ return new RecoverySettingsImpl(noRecover, recoverUserName, recoverPassword, recoverSecurityDomain);
+ }
+ else
+ {
+ if (RecoverySettings.Tag.forName(reader.getLocalName()) == RecoverySettings.Tag.UNKNOWN)
+ {
+ throw new ParserException("unexpected end tag" + reader.getLocalName());
+ }
+ }
+ break;
+ }
+ case START_ELEMENT : {
+ switch (RecoverySettings.Tag.forName(reader.getLocalName()))
+ {
+ case NORECOVER : {
+ noRecover = elementAsBoolean(reader);
+ break;
+ }
+ case RECOVERPASSWORD : {
+ recoverPassword = elementAsString(reader);
+ break;
+ }
+ case RECOVERUSERNAME : {
+ recoverUserName = elementAsString(reader);
+ break;
+ }
+ case RECOVERSECURITYDOMAIN : {
+ recoverSecurityDomain = elementAsString(reader);
+ break;
+ }
+ default :
+ throw new ParserException("Unexpected element:" + reader.getLocalName());
+ }
+ break;
+ }
+ }
+ }
+ throw new ParserException("Reached end of xml document unexpectedly");
+ }
+
+ private DataSource parseDataSource(XMLStreamReader reader) throws XMLStreamException, ParserException
+ {
+ Integer minPoolSize = null;
+ Integer maxPoolSize = null;
+ boolean prefill = false;
+ String userName = null;
+ String password = null;
+ String connectionUrl = null;
+ String driverClass = null;
+ TransactionIsolation transactionIsolation = null;
+ Map<String, String> connectionProperties = new HashMap<String, String>();
+ TimeOutSettings timeOutSettings = null;
+ SecuritySettings securitySettings = null;
+ StatementSettings statementSettings = null;
+ ValidationSettings validationSettings = null;
+ String urlDelimiter = null;
+ String urlSelectorStrategyClassName = null;
+ String newConnectionSql = null;
+
+ //attributes reading
+ boolean useJavaContext = false;
+ String poolName = null;
+ boolean enabled = true;
+ String jndiName = null;
+
+ for (Attribute attribute : XaDataSource.Attribute.values())
+ {
+ switch (attribute)
+ {
+ case ENABLED : {
+ enabled = attributeAsBoolean(reader, attribute.getLocalName());
+ break;
+ }
+ case JNDINAME : {
+ jndiName = attributeAsString(reader, attribute.getLocalName());
+ break;
+ }
+ case POOL_NAME : {
+ poolName = attributeAsString(reader, attribute.getLocalName());
+ break;
+ }
+ case USEJAVACONTEXT : {
+ useJavaContext = attributeAsBoolean(reader, attribute.getLocalName());
+ break;
+ }
+ default :
+ break;
+ }
+ }
+
+ //elements reading
+ while (reader.hasNext())
+ {
+ switch (reader.nextTag())
+ {
+ case END_ELEMENT : {
+ if (DataSources.Tag.forName(reader.getLocalName()) == DataSources.Tag.DATASOURCE)
+ {
+
+ return new DataSourceImpl(minPoolSize, maxPoolSize, prefill, userName, password, connectionUrl,
+ driverClass, transactionIsolation, connectionProperties, timeOutSettings, securitySettings,
+ statementSettings, validationSettings, urlDelimiter, urlSelectorStrategyClassName,
+ newConnectionSql, useJavaContext, poolName, enabled, jndiName);
+ }
+ else
+ {
+ if (DataSource.Tag.forName(reader.getLocalName()) == DataSource.Tag.UNKNOWN)
+ {
+ throw new ParserException("unexpected end tag" + reader.getLocalName());
+ }
+ }
+ break;
+ }
+ case START_ELEMENT : {
+ switch (DataSource.Tag.forName(reader.getLocalName()))
+ {
+ case CONNECTIONPROPERTY : {
+ connectionProperties.put(reader.getAttributeValue("", "name"),
+ reader.getAttributeValue("", "value"));
+ break;
+ }
+ case CONNECTIONURL : {
+ connectionUrl = elementAsString(reader);
+ break;
+ }
+ case DRIVERCLASS : {
+ driverClass = elementAsString(reader);
+ break;
+ }
+ case MAXPOOLSIZE : {
+ maxPoolSize = elementAsInteger(reader);
+ break;
+ }
+ case MIN_POOL_SIZE : {
+ minPoolSize = elementAsInteger(reader);
+ break;
+ }
+ case NEWCONNECTIONSQL : {
+ newConnectionSql = elementAsString(reader);
+ break;
+ }
+ case PASSWORD : {
+ password = elementAsString(reader);
+ break;
+ }
+ case USERNAME : {
+ userName = elementAsString(reader);
+ break;
+ }
+ case PREFILL : {
+ prefill = elementAsBoolean(reader);
+ break;
+ }
+ case URLDELIMITER : {
+ urlDelimiter = elementAsString(reader);
+ break;
+ }
+ case URLSELECTORSTRATEGYCLASSNAME : {
+ urlSelectorStrategyClassName = elementAsString(reader);
+ break;
+ }
+ case TRANSACTIONISOLATION : {
+ transactionIsolation = TransactionIsolation.valueOf(elementAsString(reader));
+ break;
+ }
+ case SECURITYSETTINGS : {
+ securitySettings = parseSecuritySettings(reader);
+ break;
+ }
+ case STATEMENTSETTINGS : {
+ statementSettings = parseStatementSettings(reader);
+ break;
+ }
+ case TIMEOUTSETTINGS : {
+ timeOutSettings = parseTimeOutSettings(reader);
+ break;
+ }
+ case VALIDATIONSETTINGS : {
+ validationSettings = parseValidationSetting(reader);
+ break;
+ }
+ default :
+ throw new ParserException("Unexpected element:" + reader.getLocalName());
+ }
+ break;
+ }
+ }
+ }
+ throw new ParserException("Reached end of xml document unexpectedly");
+ }
+
+ private ValidationSettings parseValidationSetting(XMLStreamReader reader) throws XMLStreamException, ParserException
+ {
+ boolean validateOnMatch = false;
+ boolean useFastFail = false;
+ Long backgroundValidationMinutes = null;
+ String staleConnectionCheckerClassName = null;
+ boolean backgroundValidation = false;
+ String checkValidConnectionSql = null;
+ String validConnectionCheckerClassName = null;
+ String exceptionSorterClassName = null;
+
+ while (reader.hasNext())
+ {
+ switch (reader.nextTag())
+ {
+ case END_ELEMENT : {
+ if (DataSource.Tag.forName(reader.getLocalName()) == DataSource.Tag.VALIDATIONSETTINGS)
+ {
+
+ return new ValidationSettingsImpl(validConnectionCheckerClassName, checkValidConnectionSql,
+ validateOnMatch, backgroundValidation, backgroundValidationMinutes, useFastFail,
+ staleConnectionCheckerClassName, exceptionSorterClassName);
+
+ }
+ else
+ {
+ if (ValidationSettings.Tag.forName(reader.getLocalName()) == ValidationSettings.Tag.UNKNOWN)
+ {
+ throw new ParserException("unexpected end tag" + reader.getLocalName());
+ }
+ }
+ break;
+ }
+ case START_ELEMENT : {
+ switch (ValidationSettings.Tag.forName(reader.getLocalName()))
+ {
+ case BACKGROUNDVALIDATION : {
+ backgroundValidation = elementAsBoolean(reader);
+ break;
+ }
+ case BACKGROUNDVALIDATIONMINUTES : {
+ backgroundValidationMinutes = elementAsLong(reader);
+ break;
+ }
+ case CHECKVALIDCONNECTIONSQL : {
+ checkValidConnectionSql = elementAsString(reader);
+ break;
+ }
+ case EXCEPTIONSORTERCLASSNAME : {
+ exceptionSorterClassName = elementAsString(reader);
+ break;
+ }
+ case STALECONNECTIONCHECKERCLASSNAME : {
+ staleConnectionCheckerClassName = elementAsString(reader);
+ break;
+ }
+ case USEFASTFAIL : {
+ useFastFail = elementAsBoolean(reader);
+ break;
+ }
+ case VALIDATEONMATCH : {
+ validateOnMatch = elementAsBoolean(reader);
+ break;
+ }
+ case VALIDCONNECTIONCHECKERCLASSNAME : {
+ validConnectionCheckerClassName = elementAsString(reader);
+ break;
+ }
+ default :
+ throw new ParserException("Unexpected element:" + reader.getLocalName());
+ }
+ break;
+ }
+ }
+ }
+ throw new ParserException("Reached end of xml document unexpectedly");
+ }
+
+ private TimeOutSettings parseTimeOutSettings(XMLStreamReader reader) throws XMLStreamException, ParserException
+ {
+
+ Long blockingTimeoutMillis = null;
+ Long idleTimeoutMinutes = null;
+ boolean setTxQuertTimeout = false;
+ Long queryTimeout = null;
+ Long allocationRetry = null;
+ Long allocationRetryWaitMillis = null;
+ Long useTryLock = null;
+ Long xaResourceTimeout = null;
+
+ while (reader.hasNext())
+ {
+ switch (reader.nextTag())
+ {
+ case END_ELEMENT : {
+ if (DataSource.Tag.forName(reader.getLocalName()) == DataSource.Tag.TIMEOUTSETTINGS)
+ {
+
+ return new TimeOutSettingsImpl(blockingTimeoutMillis, idleTimeoutMinutes, setTxQuertTimeout,
+ queryTimeout, useTryLock, allocationRetry, allocationRetryWaitMillis, xaResourceTimeout);
+ }
+ else
+ {
+ if (TimeOutSettings.Tag.forName(reader.getLocalName()) == TimeOutSettings.Tag.UNKNOWN)
+ {
+ throw new ParserException("unexpected end tag" + reader.getLocalName());
+ }
+ }
+ break;
+ }
+ case START_ELEMENT : {
+ switch (TimeOutSettings.Tag.forName(reader.getLocalName()))
+ {
+ case ALLOCATIONRETRY : {
+ allocationRetry = elementAsLong(reader);
+ break;
+ }
+ case ALLOCATIONRETRYWAITMILLIS : {
+ allocationRetryWaitMillis = elementAsLong(reader);
+ break;
+ }
+ case BLOCKINGTIMEOUTMILLIS : {
+ blockingTimeoutMillis = elementAsLong(reader);
+ break;
+ }
+ case IDLETIMEOUTMINUTES : {
+ idleTimeoutMinutes = elementAsLong(reader);
+ break;
+ }
+ case QUERYTIMEOUT : {
+ queryTimeout = elementAsLong(reader);
+ break;
+ }
+ case SETTXQUERYTIMEOUT : {
+ setTxQuertTimeout = elementAsBoolean(reader);
+ break;
+ }
+ case USETRYLOCK : {
+ useTryLock = elementAsLong(reader);
+ break;
+ }
+ case XARESOURCETIMEOUT : {
+ xaResourceTimeout = elementAsLong(reader);
+ break;
+ }
+ default :
+ throw new ParserException("Unexpected element:" + reader.getLocalName());
+ }
+ break;
+ }
+ }
+ }
+ throw new ParserException("Reached end of xml document unexpectedly");
+ }
+
+ private StatementSettings parseStatementSettings(XMLStreamReader reader) throws XMLStreamException, ParserException
+ {
+
+ Long preparedStatementsCacheSize = null;
+ boolean sharePreparedStatements = false;
+ TrackStatementsEnum trackStatements = null;
+
+ while (reader.hasNext())
+ {
+ switch (reader.nextTag())
+ {
+ case END_ELEMENT : {
+ if (DataSource.Tag.forName(reader.getLocalName()) == DataSource.Tag.STATEMENTSETTINGS)
+ {
+
+ return new StatementSettingsImpl(sharePreparedStatements, preparedStatementsCacheSize,
+ trackStatements);
+ }
+ else
+ {
+ if (StatementSettings.Tag.forName(reader.getLocalName()) == StatementSettings.Tag.UNKNOWN)
+ {
+ throw new ParserException("unexpected end tag" + reader.getLocalName());
+ }
+ }
+ break;
+ }
+ case START_ELEMENT : {
+ switch (StatementSettings.Tag.forName(reader.getLocalName()))
+ {
+ case PREPAREDSTATEMENTCACHESIZE : {
+ preparedStatementsCacheSize = elementAsLong(reader);
+ break;
+ }
+ case TRACKSTATEMENTS : {
+ trackStatements = TrackStatementsEnum.valueOf(elementAsString(reader));
+ break;
+ }
+ case SHAREPREPAREDSTATEMENTS : {
+ sharePreparedStatements = elementAsBoolean(reader);
+ break;
+ }
+ default :
+ throw new ParserException("Unexpected element:" + reader.getLocalName());
+ }
+ break;
+ }
+ }
+ }
+ throw new ParserException("Reached end of xml document unexpectedly");
+ }
+
+ private SecuritySettings parseSecuritySettings(XMLStreamReader reader) throws XMLStreamException, ParserException
+ {
+
+ SecurityManager securityManager = null;
+ String securityDomain = null;
+
+ while (reader.hasNext())
+ {
+ switch (reader.nextTag())
+ {
+ case END_ELEMENT : {
+ if (DataSource.Tag.forName(reader.getLocalName()) == DataSource.Tag.SECURITYSETTINGS)
+ {
+
+ return new SecuritySettingsImpl(securityManager, securityDomain);
+ }
+ else
+ {
+ if (SecuritySettings.Tag.forName(reader.getLocalName()) == SecuritySettings.Tag.UNKNOWN)
+ {
+ throw new ParserException("unexpected end tag" + reader.getLocalName());
+ }
+ }
+ break;
+ }
+ case START_ELEMENT : {
+ switch (SecuritySettings.Tag.forName(reader.getLocalName()))
+ {
+ case SECURITYDOMAIN : {
+ securityDomain = elementAsString(reader);
+ break;
+ }
+ case SECURITYMANAGER : {
+ securityManager = SecurityManager.valueOf(elementAsString(reader));
+ break;
+ }
+ default :
+ throw new ParserException("Unexpected element:" + reader.getLocalName());
+ }
+ break;
+ }
+ }
+ }
+ throw new ParserException("Reached end of xml document unexpectedly");
+ }
+
+ /**
+ *
+ * A Tag.
+ *
+ * @author <a href="stefano.maestri at jboss.com">Stefano Maestri</a>
+ *
+ */
+ public enum Tag
+ {
+ /** always first
+ *
+ */
+ UNKNOWN(null),
+
+ /** jboss-ra tag name
+ *
+ */
+ DATASOURCES("datasources");
+
+ private final String name;
+
+ /**
+ *
+ * Create a new Tag.
+ *
+ * @param name a name
+ */
+ Tag(final String name)
+ {
+ this.name = name;
+ }
+
+ /**
+ * Get the local name of this element.
+ *
+ * @return the local name
+ */
+ public String getLocalName()
+ {
+ return name;
+ }
+
+ private static final Map<String, Tag> MAP;
+
+ static
+ {
+ final Map<String, Tag> map = new HashMap<String, Tag>();
+ for (Tag element : values())
+ {
+ final String name = element.getLocalName();
+ if (name != null)
+ map.put(name, element);
+ }
+ MAP = map;
+ }
+
+ /**
+ *
+ * Static method to get enum instance given localName string
+ *
+ * @param localName a string used as localname (typically tag name as defined in xsd)
+ * @return the enum instance
+ */
+ public static Tag forName(String localName)
+ {
+ final Tag element = MAP.get(localName);
+ return element == null ? UNKNOWN : element;
+ }
+
+ }
+}
Modified: projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/metadata/ds/TimeOutSettingsImpl.java
===================================================================
--- projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/metadata/ds/TimeOutSettingsImpl.java 2010-08-11 08:56:50 UTC (rev 107531)
+++ projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/metadata/ds/TimeOutSettingsImpl.java 2010-08-11 09:51:40 UTC (rev 107532)
@@ -49,6 +49,8 @@
private final Long allocationRetryWaitMillis;
+ private final Long xaResourceTimeout;
+
/**
* Create a new TimeOutSettingsImpl.
*
@@ -59,9 +61,11 @@
* @param useTryLock useTryLock
* @param allocationRetry allocationRetry
* @param allocationRetryWaitMillis allocationRetryWaitMillis
+ * @param xaResourceTimeout xaResourceTimeout
*/
public TimeOutSettingsImpl(Long blockingTimeoutMillis, Long idleTimeoutMinutes, boolean setTxQuertTimeout,
- Long queryTimeout, Long useTryLock, Long allocationRetry, Long allocationRetryWaitMillis)
+ Long queryTimeout, Long useTryLock, Long allocationRetry, Long allocationRetryWaitMillis,
+ Long xaResourceTimeout)
{
super();
this.blockingTimeoutMillis = blockingTimeoutMillis;
@@ -71,6 +75,7 @@
this.useTryLock = useTryLock;
this.allocationRetry = allocationRetry;
this.allocationRetryWaitMillis = allocationRetryWaitMillis;
+ this.xaResourceTimeout = xaResourceTimeout;
}
/**
@@ -162,6 +167,7 @@
result = prime * result + ((queryTimeout == null) ? 0 : queryTimeout.hashCode());
result = prime * result + (setTxQuertTimeout ? 1231 : 1237);
result = prime * result + ((useTryLock == null) ? 0 : useTryLock.hashCode());
+ result = prime * result + ((xaResourceTimeout == null) ? 0 : xaResourceTimeout.hashCode());
return result;
}
@@ -219,6 +225,13 @@
}
else if (!useTryLock.equals(other.useTryLock))
return false;
+ if (xaResourceTimeout == null)
+ {
+ if (other.xaResourceTimeout != null)
+ return false;
+ }
+ else if (!xaResourceTimeout.equals(other.xaResourceTimeout))
+ return false;
return true;
}
@@ -228,8 +241,19 @@
return "TimeOutSettingsImpl [blockingTimeoutMillis=" + blockingTimeoutMillis + ", idleTimeoutMinutes="
+ idleTimeoutMinutes + ", setTxQuertTimeout=" + setTxQuertTimeout + ", queryTimeout=" + queryTimeout
+ ", useTryLock=" + useTryLock + ", allocationRetry=" + allocationRetry + ", allocationRetryWaitMillis="
- + allocationRetryWaitMillis + "]";
+ + allocationRetryWaitMillis + ", xaResourceTimeout=" + xaResourceTimeout + "]";
}
+ /**
+ * Get the xaResourceTimeout.
+ *
+ * @return the xaResourceTimeout.
+ */
+ @Override
+ public Long getXaResourceTimeout()
+ {
+ return xaResourceTimeout;
+ }
+
}
Modified: projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/metadata/ds/XADataSourceImpl.java
===================================================================
--- projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/metadata/ds/XADataSourceImpl.java 2010-08-11 08:56:50 UTC (rev 107531)
+++ projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/metadata/ds/XADataSourceImpl.java 2010-08-11 09:51:40 UTC (rev 107532)
@@ -49,7 +49,7 @@
private final String password;
- private final HashMap<String, String> xaDataSoourceProperty;
+ private final HashMap<String, String> xaDataSourceProperty;
private final String xaDataSourceClass;
@@ -69,7 +69,7 @@
* @param prefill prefill
* @param userName userName
* @param password password
- * @param xaDataSoourceProperty xaDataSoourceProperty
+ * @param xaDataSourceProperty xaDataSoourceProperty
* @param xaDataSourceClass xaDataSourceClass
* @param transactionIsolation transactionIsolation
* @param isSameRmOverrideValue isSameRmOverrideValue
@@ -88,7 +88,7 @@
* @param jndiName jndiName
*/
public XADataSourceImpl(Integer minPoolSize, Integer maxPoolSize, boolean prefill, String userName, String password,
- Map<String, String> xaDataSoourceProperty, String xaDataSourceClass,
+ Map<String, String> xaDataSourceProperty, String xaDataSourceClass,
TransactionIsolation transactionIsolation, boolean isSameRmOverrideValue, boolean interleaving,
RecoverySettings recoverySettings, TimeOutSettings timeOutSettings, SecuritySettings securitySettings,
StatementSettings statementSettings, ValidationSettings validationSettings, String urlDelimiter,
@@ -100,14 +100,14 @@
poolName, enabled, jndiName);
this.userName = userName;
this.password = password;
- if (xaDataSoourceProperty != null)
+ if (xaDataSourceProperty != null)
{
- this.xaDataSoourceProperty = new HashMap<String, String>(xaDataSoourceProperty.size());
- this.xaDataSoourceProperty.putAll(xaDataSoourceProperty);
+ this.xaDataSourceProperty = new HashMap<String, String>(xaDataSourceProperty.size());
+ this.xaDataSourceProperty.putAll(xaDataSourceProperty);
}
else
{
- this.xaDataSoourceProperty = new HashMap<String, String>(0);
+ this.xaDataSourceProperty = new HashMap<String, String>(0);
}
this.xaDataSourceClass = xaDataSourceClass;
this.isSameRmOverrideValue = isSameRmOverrideValue;
@@ -146,7 +146,7 @@
@Override
public final Map<String, String> getXaDataSoourceProperty()
{
- return Collections.unmodifiableMap(xaDataSoourceProperty);
+ return Collections.unmodifiableMap(xaDataSourceProperty);
}
/**
@@ -262,7 +262,7 @@
result = prime * result + (useJavaContext ? 1231 : 1237);
result = prime * result + ((userName == null) ? 0 : userName.hashCode());
result = prime * result + ((validationSettings == null) ? 0 : validationSettings.hashCode());
- result = prime * result + ((xaDataSoourceProperty == null) ? 0 : xaDataSoourceProperty.hashCode());
+ result = prime * result + ((xaDataSourceProperty == null) ? 0 : xaDataSourceProperty.hashCode());
result = prime * result + ((xaDataSourceClass == null) ? 0 : xaDataSourceClass.hashCode());
return result;
}
@@ -387,12 +387,12 @@
}
else if (!validationSettings.equals(other.validationSettings))
return false;
- if (xaDataSoourceProperty == null)
+ if (xaDataSourceProperty == null)
{
- if (other.xaDataSoourceProperty != null)
+ if (other.xaDataSourceProperty != null)
return false;
}
- else if (!xaDataSoourceProperty.equals(other.xaDataSoourceProperty))
+ else if (!xaDataSourceProperty.equals(other.xaDataSourceProperty))
return false;
if (xaDataSourceClass == null)
{
@@ -408,7 +408,7 @@
public String toString()
{
return "XADataSourceImpl [minPoolSize=" + minPoolSize + ", maxPoolSize=" + maxPoolSize + ", prefill=" + prefill
- + ", userName=" + userName + ", password=" + password + ", xaDataSoourceProperty=" + xaDataSoourceProperty
+ + ", userName=" + userName + ", password=" + password + ", xaDataSoourceProperty=" + xaDataSourceProperty
+ ", xaDataSourceClass=" + xaDataSourceClass + ", transactionIsolation=" + transactionIsolation
+ ", isSameRmOverrideValue=" + isSameRmOverrideValue + ", interleaving=" + interleaving
+ ", recoverySettings=" + recoverySettings + ", timeOutSettings=" + timeOutSettings + ", securitySettings="
Modified: projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/metadata/jbossra/JbossRaParser.java
===================================================================
--- projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/metadata/jbossra/JbossRaParser.java 2010-08-11 08:56:50 UTC (rev 107531)
+++ projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/metadata/jbossra/JbossRaParser.java 2010-08-11 09:51:40 UTC (rev 107532)
@@ -27,6 +27,7 @@
import org.jboss.jca.common.api.metadata.jbossra.jbossra20.JbossRa20;
import org.jboss.jca.common.api.metadata.ra.OverrideElementAttribute;
import org.jboss.jca.common.api.metadata.ra.RaConfigProperty;
+import org.jboss.jca.common.metadata.AbstractParser;
import org.jboss.jca.common.metadata.MetadataParser;
import org.jboss.jca.common.metadata.ParserException;
import org.jboss.jca.common.metadata.jbossra.jbossra10.JbossRa10Impl;
@@ -52,7 +53,7 @@
* @author <a href="stefano.maestri at jboss.com">Stefano Maestri</a>
*
*/
-public class JbossRaParser implements MetadataParser<JbossRa>
+public class JbossRaParser extends AbstractParser implements MetadataParser<JbossRa>
{
/**
@@ -72,15 +73,23 @@
XMLInputFactory inputFactory = XMLInputFactory.newInstance();
reader = inputFactory.createXMLStreamReader(xmlInputStream);
- //iterate over tags
- switch (reader.nextTag())
+ int iterate;
+ try
{
+ iterate = reader.nextTag();
+ }
+ catch (XMLStreamException e)
+ {
+ //founding a non tag..go on Normally non-tag found at beginning are comments or DTD declaration
+ iterate = reader.nextTag();
+ }
+ switch (iterate)
+ {
case END_ELEMENT : {
// should mean we're done, so ignore it.
break;
}
case START_ELEMENT : {
- System.out.println(reader.getNamespaceURI());
if (JbossRa20.NAMESPACE.equals(reader.getNamespaceURI()))
{
switch (Tag.forName(reader.getLocalName()))
Modified: projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/metadata/ra/RaParser.java
===================================================================
--- projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/metadata/ra/RaParser.java 2010-08-11 08:56:50 UTC (rev 107531)
+++ projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/metadata/ra/RaParser.java 2010-08-11 09:51:40 UTC (rev 107532)
@@ -47,6 +47,7 @@
import org.jboss.jca.common.api.metadata.ra.ra16.Activationspec16;
import org.jboss.jca.common.api.metadata.ra.ra16.ConfigProperty16;
import org.jboss.jca.common.api.metadata.ra.ra16.Connector16;
+import org.jboss.jca.common.metadata.AbstractParser;
import org.jboss.jca.common.metadata.MetadataParser;
import org.jboss.jca.common.metadata.ParserException;
import org.jboss.jca.common.metadata.ra.common.AdminObjectImpl;
@@ -91,7 +92,7 @@
* @author <a href="stefano.maestri at jboss.com">Stefano Maestri</a>
*
*/
-public class RaParser implements MetadataParser<Connector>
+public class RaParser extends AbstractParser implements MetadataParser<Connector>
{
@Override
@@ -114,7 +115,7 @@
}
catch (XMLStreamException e)
{
- //fpunding a non tag..go on
+ //founding a non tag..go on Normally non-tag found at beginning are comments or DTD declaration
iterate = reader.nextTag();
}
switch (iterate)
@@ -1397,11 +1398,6 @@
return new LocalizedXsdString(reader.getElementText().trim(), id, lang);
}
- private boolean elementAsBoolean(XMLStreamReader reader) throws XMLStreamException
- {
- return Boolean.valueOf(reader.getElementText().trim());
- }
-
/**
*
* A Tag.
Modified: projects/jboss-jca/trunk/common/src/main/resources/schema/datasources_1_0.xsd
===================================================================
--- projects/jboss-jca/trunk/common/src/main/resources/schema/datasources_1_0.xsd 2010-08-11 08:56:50 UTC (rev 107531)
+++ projects/jboss-jca/trunk/common/src/main/resources/schema/datasources_1_0.xsd 2010-08-11 09:51:40 UTC (rev 107532)
@@ -297,16 +297,6 @@
</xs:element>
<xs:element minOccurs="0" name="recovery-settings" type="recovery-settings_type"/>
<xs:element name="time-out-settings" type="time-out-settings_type" minOccurs="0"/>
- <xs:element minOccurs="0" name="xa-resource-timeout" type="xs:token">
- <xs:annotation>
- <xs:documentation>
- <![CDATA[[
- Passed to XAResource.setTransactionTimeout() Default is zero which
- does not invoke the setter e.g. 5 minutes <xa-resource-timeout>300</xa-resource-timeout>
- ]]>
- </xs:documentation>
- </xs:annotation>
- </xs:element>
<xs:element minOccurs="0" name="security-settings" type="security-settings_type"> </xs:element>
<xs:element name="statement-settings" minOccurs="0">
@@ -684,6 +674,16 @@
</xs:documentation>
</xs:annotation>
</xs:element>
+ <xs:element minOccurs="0" name="xa-resource-timeout" type="xs:token">
+ <xs:annotation>
+ <xs:documentation>
+ <![CDATA[[
+ Passed to XAResource.setTransactionTimeout() Default is zero which
+ does not invoke the setter e.g. 5 minutes <xa-resource-timeout>300</xa-resource-timeout>
+ ]]>
+ </xs:documentation>
+ </xs:annotation>
+ </xs:element>
</xs:sequence>
</xs:complexType>
<xs:complexType name="recovery-settings_type">
Added: projects/jboss-jca/trunk/common/src/test/java/org/jboss/jca/common/metadata/ra/DsParserTestCase.java
===================================================================
--- projects/jboss-jca/trunk/common/src/test/java/org/jboss/jca/common/metadata/ra/DsParserTestCase.java (rev 0)
+++ projects/jboss-jca/trunk/common/src/test/java/org/jboss/jca/common/metadata/ra/DsParserTestCase.java 2010-08-11 09:51:40 UTC (rev 107532)
@@ -0,0 +1,74 @@
+/*
+ * 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.metadata.ra;
+
+import org.jboss.jca.common.api.metadata.ds.DataSources;
+import org.jboss.jca.common.metadata.ds.DsParser;
+
+import java.io.File;
+import java.io.FileInputStream;
+
+import org.junit.Test;
+
+import static org.hamcrest.core.Is.is;
+import static org.junit.Assert.assertThat;
+
+/**
+ *
+ * A RaParserTestCase.
+ *
+ * @author <a href="stefano.maestri at jboss.com">Stefano Maestri</a>
+ *
+ */
+public class DsParserTestCase
+{
+ /**
+ * shouldParseJbossRa10WithSingleProperty
+ * @throws Exception in case of error
+ */
+ @Test
+ public void shouldParseJbossRa10WithSingleProperty() throws Exception
+ {
+ FileInputStream is = null;
+ try
+ {
+ //given
+ File xmlFile = new File(Thread.currentThread().getContextClassLoader()
+ .getResource("ds/db2-ds.xml").toURI());
+ is = new FileInputStream(xmlFile);
+ DsParser parser = new DsParser();
+ //when
+ DataSources ds = parser.parse(is);
+ //then
+ assertThat(ds.getDatasource().size(), is(1));
+
+
+ }
+ finally
+ {
+ if (is != null)
+ is.close();
+ }
+ }
+
+
+}
Added: projects/jboss-jca/trunk/common/src/test/resources/ds/db2-400-ds.xml
===================================================================
--- projects/jboss-jca/trunk/common/src/test/resources/ds/db2-400-ds.xml (rev 0)
+++ projects/jboss-jca/trunk/common/src/test/resources/ds/db2-400-ds.xml 2010-08-11 09:51:40 UTC (rev 107532)
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<datasources xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:noNamespaceSchemaLocation="file:/dati/project/RH/jboss-jca/common/src/main/resources/schema/datasources_1_0.xsd">
+ <datasource jndi-name="DB2-400" pool-name="DB2-400">
+ <min-pool-size>0</min-pool-size>
+ <user-name>[username]</user-name>
+ <password>[password]</password>
+ <connection-url>jdbc:as400://[systemname]/[schema];extended dynamic=true;package=jbpkg;package cache=true;package library=jboss;errors=full</connection-url>
+ <driver-class>com.ibm.as400.access.AS400JDBCDriver</driver-class>
+ </datasource>
+</datasources>
Added: projects/jboss-jca/trunk/common/src/test/resources/ds/db2-ds.xml
===================================================================
--- projects/jboss-jca/trunk/common/src/test/resources/ds/db2-ds.xml (rev 0)
+++ projects/jboss-jca/trunk/common/src/test/resources/ds/db2-ds.xml 2010-08-11 09:51:40 UTC (rev 107532)
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<datasources xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:noNamespaceSchemaLocation="file:/dati/project/RH/jboss-jca/common/src/main/resources/schema/datasources_1_0.xsd">
+ <datasource jndi-name="DB2DS" pool-name="DB2DS">
+ <min-pool-size>0</min-pool-size>
+ <max-pool-size>50</max-pool-size>
+ <user-name>x</user-name>
+ <password>y</password>
+ <connection-url>jdbc:db2:yourdatabase</connection-url>
+ <driver-class>COM.ibm.db2.jdbc.app.DB2Driver</driver-class>
+
+ <!-- DB2 Universal Driver Note connection URL is in form of
+ jdbc:db2://host:port:dbname
+
+ Default port for Type 4 driver is 50000
+
+ Note, host and port must be specified if using Type 4 driver. And be forewarned, no native
+ XA support is provided with Type 4; you must set a DB property calling for Type 2 to get XA
+
+ <driver-class>com.ibm.db2.jcc.DB2Driver</driver-class>
+ <connection-url>jdbc:db2://[hostname]:[port]/databasename"</connection-url>
+
+ Please see http://www-128.ibm.com/developerworks/db2/library/techarticle/dm-0512kokkat/
+ or the DB2 JDBC application developers manual.
+ -->
+ <!-- New org.jboss.resource.adapter.jdbc.vendor.DB2ExceptionSorter
+ <validation-settings>
+ <exception-sorter-class-name>org.jboss.resource.adapter.jdbc.vendor.DB2ExceptionSorter</exception-sorter-class-name>
+ <check-valid-connection-sql>some arbitrary sql</check-valid-connection-sql>
+ </validation-settings>
+ -->
+
+ <!-- sql to call when connection is created
+ <new-connection-sql>some arbitrary sql</new-connection-sql>
+ -->
+
+ </datasource>
+</datasources>
Added: projects/jboss-jca/trunk/common/src/test/resources/ds/db2-jcc-xa-ds.xml
===================================================================
--- projects/jboss-jca/trunk/common/src/test/resources/ds/db2-jcc-xa-ds.xml (rev 0)
+++ projects/jboss-jca/trunk/common/src/test/resources/ds/db2-jcc-xa-ds.xml 2010-08-11 09:51:40 UTC (rev 107532)
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<datasources xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:noNamespaceSchemaLocation="file:/dati/project/RH/jboss-jca/common/src/main/resources/schema/datasources_1_0.xsd">
+
+ <xa-datasource jndi-name="DB2XADS" pool-name="DB2XADS">
+ <xa-datasource-property name="DatabaseName">your_database_name</xa-datasource-property>
+ <xa-datasource-property name="User">your_user</xa-datasource-property>
+ <xa-datasource-property name="Password">your_password</xa-datasource-property>
+
+ <!-- If driverType 4 is used, the following tags are needed -->
+ <xa-datasource-property name="ServerName">your_server_name</xa-datasource-property>
+ <xa-datasource-property name="DriverType">4</xa-datasource-property>
+ <!-- Note, as opposed to the Type2 driver, DB2 Type 4 requires the PortNumber. By default this is 50000-->
+ <xa-datasource-property name="PortNumber">your_port_number</xa-datasource-property>
+ <xa-datasource-class>com.ibm.db2.jcc.DB2XADataSource</xa-datasource-class>
+ <!-- Must be set if using multiple DB2 XA resources in same transaction -->
+ <is-same-rm-override-value>false</is-same-rm-override-value>
+ <interleaving/>
+
+ </xa-datasource>
+
+</datasources>
Added: projects/jboss-jca/trunk/common/src/test/resources/ds/db2-xa-ds
===================================================================
--- projects/jboss-jca/trunk/common/src/test/resources/ds/db2-xa-ds (rev 0)
+++ projects/jboss-jca/trunk/common/src/test/resources/ds/db2-xa-ds 2010-08-11 09:51:40 UTC (rev 107532)
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<datasources xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:noNamespaceSchemaLocation="file:/dati/project/RH/jboss-jca/common/src/main/resources/schema/datasources_1_0.xsd">
+
+ <xa-datasource jndi-name="DB2XADS" pool-name="DB2XADS">
+ <xa-datasource-property name="DatabaseName">yout_database_name</xa-datasource-property>
+ <xa-datasource-property name="User">your_user</xa-datasource-property>
+ <xa-datasource-property name="Password">your_password</xa-datasource-property>
+ <xa-datasource-class>COM.ibm.db2.jdbc.DB2XADataSource</xa-datasource-class>
+ <!-- uncomment to enable interleaving <interleaving/> -->
+ <is-same-rm-override-value>false</is-same-rm-override-value>
+ <!-- <interleaving/> -->
+ </xa-datasource>
+
+</datasources>
More information about the jboss-cvs-commits
mailing list