[jboss-svn-commits] JBL Code SVN: r29872 - in labs/jbosstm/workspace/whitingjr/trunk/performance/src/main: java/org/jboss/jbossts and 12 other directories.
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Thu Oct 29 14:10:55 EDT 2009
Author: whitingjr
Date: 2009-10-29 14:10:54 -0400 (Thu, 29 Oct 2009)
New Revision: 29872
Added:
labs/jbosstm/workspace/whitingjr/trunk/performance/src/main/java/org/jboss/jbossts/
labs/jbosstm/workspace/whitingjr/trunk/performance/src/main/java/org/jboss/jbossts/performance/
labs/jbosstm/workspace/whitingjr/trunk/performance/src/main/java/org/jboss/jbossts/performance/MCXaDataSourceWrapper.java
labs/jbosstm/workspace/whitingjr/trunk/performance/src/main/java/org/jboss/jbossts/performance/TransactionXADataSourceFactory.java
labs/jbosstm/workspace/whitingjr/trunk/performance/src/main/resources/properties/database/derby/database-locations/remote-db/db-installation.properties
labs/jbosstm/workspace/whitingjr/trunk/performance/src/main/resources/properties/log-store/
labs/jbosstm/workspace/whitingjr/trunk/performance/src/main/resources/properties/log-store/store-data.properties
Modified:
labs/jbosstm/workspace/whitingjr/trunk/performance/src/main/resources/META-INF/caveatemptor-beans.xml
labs/jbosstm/workspace/whitingjr/trunk/performance/src/main/resources/log4j.xml
labs/jbosstm/workspace/whitingjr/trunk/performance/src/main/resources/properties/database/derby/database-locations/co-located-db/db-installation.properties
labs/jbosstm/workspace/whitingjr/trunk/performance/src/main/resources/properties/database/hsql/database-locations/co-located-db/db-installation.properties
labs/jbosstm/workspace/whitingjr/trunk/performance/src/main/resources/properties/database/hsql/db-profile.properties
labs/jbosstm/workspace/whitingjr/trunk/performance/src/main/resources/properties/jdbc-resource/local-tx/datasource.properties
labs/jbosstm/workspace/whitingjr/trunk/performance/src/main/resources/properties/jdbc-resource/xa/datasource.properties
labs/jbosstm/workspace/whitingjr/trunk/performance/src/main/resources/properties/transaction-management/jta-managed/default.persistence.properties
Log:
Added classes to support xa jdbc connection.
Added: labs/jbosstm/workspace/whitingjr/trunk/performance/src/main/java/org/jboss/jbossts/performance/MCXaDataSourceWrapper.java
===================================================================
--- labs/jbosstm/workspace/whitingjr/trunk/performance/src/main/java/org/jboss/jbossts/performance/MCXaDataSourceWrapper.java (rev 0)
+++ labs/jbosstm/workspace/whitingjr/trunk/performance/src/main/java/org/jboss/jbossts/performance/MCXaDataSourceWrapper.java 2009-10-29 18:10:54 UTC (rev 29872)
@@ -0,0 +1,88 @@
+ /*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt 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.jbossts.performance;
+
+import java.sql.Connection;
+import java.sql.SQLException;
+import java.util.Hashtable;
+import java.util.Properties;
+
+import javax.naming.Context;
+import javax.sql.XADataSource;
+
+import org.apache.log4j.Logger;
+import org.jboss.jbossts.tomcat.XADataSourceWrapper;
+
+import com.arjuna.ats.jdbc.TransactionalDriver;
+import com.arjuna.ats.jdbc.common.jdbcPropertyManager;
+
+public class MCXaDataSourceWrapper extends XADataSourceWrapper
+{
+ private Hashtable initialContextProperties;
+ private static final Logger logger = Logger.getLogger(MCXaDataSourceWrapper.class);
+
+ public Hashtable getInitialContextProperties()
+ {
+ return initialContextProperties;
+ }
+
+ public void setInitialContextProperties(Hashtable initialContextProperties)
+ {
+ this.initialContextProperties = initialContextProperties;
+ }
+
+ @Override
+ protected Connection getTransactionalConnection(String url, Properties properties) throws SQLException
+ {
+ Connection returnValue = null;
+
+ jdbcPropertyManager.propertyManager.setProperty("Context.INITIAL_CONTEXT_FACTORY", System.getProperty(Context.INITIAL_CONTEXT_FACTORY));
+ jdbcPropertyManager.propertyManager.setProperty("Context.URL_PKG_PREFIXES", System.getProperty(Context.URL_PKG_PREFIXES));
+ try
+ {
+ returnValue = getTransactionalDriver().connect(url, properties);
+ }
+ finally
+ {
+ }
+ return returnValue;
+ }
+
+ public MCXaDataSourceWrapper(String name, XADataSource theDataSource)
+ {
+ super(name, theDataSource);
+ }
+ @Override
+ public Connection getConnection() throws SQLException
+ {
+ String stripped = _name.substring(6);
+ logger.info("Stripped jndi name ["+stripped+"].");
+ String url = TransactionalDriver.arjunaDriver + stripped;
+ // although we are not setting any properties, the driver will barf if we pass 'null'.
+ Properties properties = new Properties();
+ properties.setProperty("Context.INITIAL_CONTEXT_FACTORY", (String)this.initialContextProperties.get(Context.INITIAL_CONTEXT_FACTORY));
+ properties.setProperty("Context.URL_PKG_PREFIXES", (String)this.initialContextProperties.get(Context.URL_PKG_PREFIXES));
+ logger.debug(properties);
+ return getTransactionalConnection(url, properties);
+ }
+}
Added: labs/jbosstm/workspace/whitingjr/trunk/performance/src/main/java/org/jboss/jbossts/performance/TransactionXADataSourceFactory.java
===================================================================
--- labs/jbosstm/workspace/whitingjr/trunk/performance/src/main/java/org/jboss/jbossts/performance/TransactionXADataSourceFactory.java (rev 0)
+++ labs/jbosstm/workspace/whitingjr/trunk/performance/src/main/java/org/jboss/jbossts/performance/TransactionXADataSourceFactory.java 2009-10-29 18:10:54 UTC (rev 29872)
@@ -0,0 +1,142 @@
+ /*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt 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.jbossts.performance;
+
+import java.util.Hashtable;
+
+import javax.naming.InitialContext;
+import javax.naming.Name;
+import javax.naming.NamingException;
+
+import org.apache.log4j.Logger;
+import org.jboss.deployment.DeploymentException;
+import org.jboss.jbossts.tomcat.TransactionalResourceFactory;
+import org.jboss.jbossts.tomcat.XADataSourceWrapper;
+import org.jboss.util.naming.NonSerializableFactory;
+import org.jboss.util.naming.Util;
+
+public class TransactionXADataSourceFactory extends TransactionalResourceFactory
+{
+ private static Logger logger = Logger.getLogger(TransactionXADataSourceFactory.class);
+ private String jndiName;
+ private InitialContext initialContext;
+ private Hashtable contextProperties;
+ private XADataSourceWrapper xaDataSource;
+
+ public TransactionXADataSourceFactory(String jndi, XADataSourceWrapper wrapper)
+ {
+ this.jndiName = jndi;
+ this.xaDataSource = wrapper;
+ }
+
+ public void start() throws Exception
+ {
+ logger.info("Start called on transactional factory.");
+ this.initialContext = new InitialContext(this.contextProperties);
+ bindConnectionFactory();
+ }
+
+ protected void unbindConnectionFactory() throws Exception
+ {
+ try
+ {
+ this.initialContext.unbind(jndiName);
+ NonSerializableFactory.unbind( jndiName);
+ logger.info("Unbound datasource for JNDI name '" + jndiName + "'");
+ }
+ catch (NamingException ne)
+ {
+ logger.error("Could not unbind datasource from jndi: " + convertName(jndiName), ne);
+ }
+ finally
+ {
+ this.initialContext.close();
+ }
+ }
+
+
+ public void bindConnectionFactory( ) throws Exception
+ {
+
+ try
+ {
+ Name name = this.initialContext.getNameParser("").parse( jndiName);
+ String key = name.toString();
+ if( true == true && name.size() > 1 )
+ {
+ int size = name.size() - 1;
+ Util.createSubcontext(this.initialContext, name.getPrefix(size));
+ }
+ NonSerializableFactory.rebind(this.initialContext, key, this.xaDataSource);
+ logger.info("Bound datasource to JNDI name '" + key+ "'");
+ }
+ catch (NamingException ne)
+ {
+ throw new DeploymentException("Could not bind ConnectionFactory into jndi: " + jndiName, ne);
+ }
+ finally
+ {
+ this.initialContext.close();
+ }
+ }
+
+ public XADataSourceWrapper getDatasource()
+ {
+ return this.xaDataSource;
+ }
+
+
+ public String getName()
+ {
+ return jndiName;
+ }
+
+
+
+ public void setName(String name)
+ {
+ this.jndiName = name;
+ }
+
+
+ public InitialContext getInitialContext()
+ {
+ return initialContext;
+ }
+
+
+ public void setInitialContext(InitialContext initialContext)
+ {
+ this.initialContext = initialContext;
+ }
+
+ public Hashtable getContextProperties()
+ {
+ return contextProperties;
+ }
+
+ public void setContextProperties(Hashtable contextProperties)
+ {
+ this.contextProperties = contextProperties;
+ }
+}
Modified: labs/jbosstm/workspace/whitingjr/trunk/performance/src/main/resources/META-INF/caveatemptor-beans.xml
===================================================================
--- labs/jbosstm/workspace/whitingjr/trunk/performance/src/main/resources/META-INF/caveatemptor-beans.xml 2009-10-29 18:09:50 UTC (rev 29871)
+++ labs/jbosstm/workspace/whitingjr/trunk/performance/src/main/resources/META-INF/caveatemptor-beans.xml 2009-10-29 18:10:54 UTC (rev 29872)
@@ -4,29 +4,7 @@
xsi:schemaLocation="urn:jboss:bean-deployer bean-deployer_1_0.xsd"
xmlns="urn:jboss:bean-deployer:2.0">
-
- <!-- bean name="VendorDataSource">
- <
- </bean>
- <bean name="caveatEmptorDatasourceFactory" class="org.jboss.jbossts.tomcat.XADataSourceWrapper">
- <constructor>
- <parameter class="java.lang.String">java:/caveatemptorTestingDatasource</parameter>
- <parameter class="javax.sql.XADataSource">
- <inject bean="VendorDataSource" />
- </parameter>
- </constructor>
-
- <property name="connectionURL">${db-vendor-jdbc-connectionURL}</property>
- </bean>
-
- <bean name="caveatemptorTestingDatasource" class="java.lang.Object">
- <constructor factoryMethod="getDatasource">
- <factory bean="caveatEmptorDatasourceFactory" />
- </constructor>
- </bean-->
-
${datasoure.xml}
-
</deployment>
Modified: labs/jbosstm/workspace/whitingjr/trunk/performance/src/main/resources/log4j.xml
===================================================================
--- labs/jbosstm/workspace/whitingjr/trunk/performance/src/main/resources/log4j.xml 2009-10-29 18:09:50 UTC (rev 29871)
+++ labs/jbosstm/workspace/whitingjr/trunk/performance/src/main/resources/log4j.xml 2009-10-29 18:10:54 UTC (rev 29872)
@@ -7,8 +7,11 @@
<!-- Append messages to the console -->
<!-- ============================== -->
- <appender name="FILE" class="org.apache.log4j.FileAppender">
- <param name="fileName" value="log.txt" />
+ <appender name="FILE" class="org.apache.log4j.RollingFileAppender">
+ <param name="file" value="log.txt" />
+ <param name="maxFileSize" value="500KB" />
+ <param name="maxBackupIndex" value="2" />
+
<param name="Threshold" value="TRACE" />
<layout class="org.apache.log4j.PatternLayout">
@@ -32,30 +35,34 @@
<appender-ref ref="CONSOLE"/>
</logger>
- <logger name="org.jboss.tm.performance">
+ <logger name="auction.test.basic">
<level value="TRACE"/>
<appender-ref ref="CONSOLE"/>
</logger>
- <logger name="auction.test.basic">
- <level value="TRACE"/>
+ <logger name="org.jboss.ejb3.embedded.KernelErrors">
+ <level value="DEBUG"/>
<appender-ref ref="CONSOLE"/>
</logger>
-
- <logger name="org.jboss.ejb3.embedded">
- <level value="ERROR"/>
+ <logger name="org.jboss.dependency.plugins.AbstractController">
+ <level value="DEBUG"/>
<appender-ref ref="CONSOLE"/>
</logger>
+
<logger name="org.jboss.resource.adapter.jdbc.local.LocalTxDataSource">
<level value="TRACE"/>
<appender-ref ref="FILE"/>
</logger>
- <!--logger name="org.testng">
- <level value="INFO"/>
- <appender-ref ref="CONSOLE"/>
+ <logger name="org.dbunit.database">
+ <level value="ERROR"/>
+ <appender-ref ref="FILE"/>
</logger>
+ <logger name="org.jboss.jbossts.performance">
+ <level value="TRACE"/>
+ <appender-ref ref="FILE"/>
+ </logger>
- <logger name="org.hibernate">
+ <!--logger name="org.hibernate">
<level value="INFO"/>
<appender-ref ref="CONSOLE"/>
</logger>
Modified: labs/jbosstm/workspace/whitingjr/trunk/performance/src/main/resources/properties/database/derby/database-locations/co-located-db/db-installation.properties
===================================================================
--- labs/jbosstm/workspace/whitingjr/trunk/performance/src/main/resources/properties/database/derby/database-locations/co-located-db/db-installation.properties 2009-10-29 18:09:50 UTC (rev 29871)
+++ labs/jbosstm/workspace/whitingjr/trunk/performance/src/main/resources/properties/database/derby/database-locations/co-located-db/db-installation.properties 2009-10-29 18:10:54 UTC (rev 29872)
@@ -1,6 +1,8 @@
# driver settings
-db-vendor-jdbc-connectionURL=jdbc:mysql://localhost:3306/profiling
-db-vendor-jdbc-userName=sa
-db-vendor-jdbc-password=
+db-vendor-jdbc-connectionURL=jdbc:mysql://localhost:3306/tsperf
+db-vendor-jdbc-userName=usrbert
+db-vendor-jdbc-password=u5rb3rt
+# database dialect
+db-vendor-hibernate.dialect=org.hibernate.dialect.MySQLDialect
Added: labs/jbosstm/workspace/whitingjr/trunk/performance/src/main/resources/properties/database/derby/database-locations/remote-db/db-installation.properties
===================================================================
--- labs/jbosstm/workspace/whitingjr/trunk/performance/src/main/resources/properties/database/derby/database-locations/remote-db/db-installation.properties (rev 0)
+++ labs/jbosstm/workspace/whitingjr/trunk/performance/src/main/resources/properties/database/derby/database-locations/remote-db/db-installation.properties 2009-10-29 18:10:54 UTC (rev 29872)
@@ -0,0 +1,6 @@
+
+# driver settings
+db-vendor-jdbc-connectionURL=jdbc:mysql://localhost:3306/profiling
+db-vendor-jdbc-userName=sa
+db-vendor-jdbc-password=
+
Modified: labs/jbosstm/workspace/whitingjr/trunk/performance/src/main/resources/properties/database/hsql/database-locations/co-located-db/db-installation.properties
===================================================================
--- labs/jbosstm/workspace/whitingjr/trunk/performance/src/main/resources/properties/database/hsql/database-locations/co-located-db/db-installation.properties 2009-10-29 18:09:50 UTC (rev 29871)
+++ labs/jbosstm/workspace/whitingjr/trunk/performance/src/main/resources/properties/database/hsql/database-locations/co-located-db/db-installation.properties 2009-10-29 18:10:54 UTC (rev 29872)
@@ -3,3 +3,4 @@
db-vendor-jdbc-connectionURL=jdbc:hsqldb:hsql://localhost
db-vendor-jdbc-userName=sa
+
Modified: labs/jbosstm/workspace/whitingjr/trunk/performance/src/main/resources/properties/database/hsql/db-profile.properties
===================================================================
--- labs/jbosstm/workspace/whitingjr/trunk/performance/src/main/resources/properties/database/hsql/db-profile.properties 2009-10-29 18:09:50 UTC (rev 29871)
+++ labs/jbosstm/workspace/whitingjr/trunk/performance/src/main/resources/properties/database/hsql/db-profile.properties 2009-10-29 18:10:54 UTC (rev 29872)
@@ -9,6 +9,7 @@
# db vendor driver class
db-vendor-jdbc-same.driverClass=org.hsqldb.jdbcDriver
+#db-vendor-jdbc-xa.driverClass=
# database dialect
db-vendor-hibernate.dialect=org.hibernate.dialect.HSQLDialect
Modified: labs/jbosstm/workspace/whitingjr/trunk/performance/src/main/resources/properties/jdbc-resource/local-tx/datasource.properties
===================================================================
--- labs/jbosstm/workspace/whitingjr/trunk/performance/src/main/resources/properties/jdbc-resource/local-tx/datasource.properties 2009-10-29 18:09:50 UTC (rev 29871)
+++ labs/jbosstm/workspace/whitingjr/trunk/performance/src/main/resources/properties/jdbc-resource/local-tx/datasource.properties 2009-10-29 18:10:54 UTC (rev 29872)
@@ -1 +1 @@
-datasoure.xml=<!-- Enable a JCA datasource available through JNDI --><bean name="caveatEmptorDatasourceFactory" class="org.jboss.resource.adapter.jdbc.local.LocalTxDataSource"><property name="jndiName">java:/caveatemptorTestingDatasource</property><property name="driverClass">${db-vendor-jdbc-same.driverClass}</property><property name="connectionURL">${db-vendor-jdbc-connectionURL}</property><property name="userName">${db-vendor-jdbc-userName}</property><property name="minSize">0</property><property name="maxSize">10</property> <property name="blockingTimeout">1000</property> <property name="idleTimeout">100000</property> <property name="transactionManager"><inject bean="TransactionManager"/></property> <property name="cachedConnectionManager"><inject bean="CachedConnectionManager"/></property> <property name="initialContextProperties"><inject bean="InitialContextProperties"/></property> </bean>
\ No newline at end of file
+datasoure.xml=<!-- Enable a JCA datasource available through JNDI --><bean name="caveatEmptorDatasourceFactory" class="org.jboss.resource.adapter.jdbc.local.LocalTxDataSource"><property name="jndiName">java:/caveatemptorTestingDatasource</property><property name="driverClass">${db-vendor-jdbc-same.driverClass}</property><property name="connectionURL">${db-vendor-jdbc-connectionURL}</property><property name="userName">${db-vendor-jdbc-userName}</property><property name="minSize">0</property><property name="maxSize">10</property> <property name="blockingTimeout">1000</property> <property name="idleTimeout">100000</property> <property name="transactionManager"><inject bean="TransactionManager"/></property> <property name="cachedConnectionManager"><inject bean="CachedConnectionManager"/></property> <property name="initialContextProperties"><inject bean="InitialContextProperties"/></property> </bean> <bean name="caveatemptorTestingDatasource" class="java.lang.Object"><constructo!
r factoryMethod="getDatasource"><factory bean="caveatEmptorDatasourceFactory" /></constructor></bean>
\ No newline at end of file
Modified: labs/jbosstm/workspace/whitingjr/trunk/performance/src/main/resources/properties/jdbc-resource/xa/datasource.properties
===================================================================
--- labs/jbosstm/workspace/whitingjr/trunk/performance/src/main/resources/properties/jdbc-resource/xa/datasource.properties 2009-10-29 18:09:50 UTC (rev 29871)
+++ labs/jbosstm/workspace/whitingjr/trunk/performance/src/main/resources/properties/jdbc-resource/xa/datasource.properties 2009-10-29 18:10:54 UTC (rev 29872)
@@ -1 +1 @@
-datasoure.xml=<!-- place some datasource xml here -->
\ No newline at end of file
+datasoure.xml=<!-- place some datasource xml here --><bean name="VendorXADataSource" class="${db-vendor-jdbc-xa.driverClass}"><property name="user">${db-vendor-jdbc-userName}</property><property name="password">${db-vendor-jdbc-password}</property><property name="url">${db-vendor-jdbc-connectionURL}</property></bean><bean name="DatasourceWrapper" class="org.jboss.jbossts.performance.MCXaDataSourceWrapper"><constructor><parameter class="java.lang.String">java:/caveatemptorTestingDatasource</parameter><parameter class="javax.sql.XADataSource"><inject bean="VendorXADataSource" /></parameter></constructor><property name="initialContextProperties"><inject bean="InitialContextProperties"/></property></bean><bean name="TransactionalResourceFactory" class="org.jboss.jbossts.performance.TransactionXADataSourceFactory"><constructor><parameter class="java.lang.String">java:/caveatemptorTestingDatasource</parameter><parameter class="org.jboss.jbossts.tomcat.XADataSourceWrapper"><injec!
t bean="DatasourceWrapper"/></parameter></constructor></bean><bean name="caveatemptorTestingDatasource" class="java.lang.Object"><constructor factoryMethod="getDatasource"><factory bean="TransactionalResourceFactory" /></constructor></bean>
\ No newline at end of file
Added: labs/jbosstm/workspace/whitingjr/trunk/performance/src/main/resources/properties/log-store/store-data.properties
===================================================================
--- labs/jbosstm/workspace/whitingjr/trunk/performance/src/main/resources/properties/log-store/store-data.properties (rev 0)
+++ labs/jbosstm/workspace/whitingjr/trunk/performance/src/main/resources/properties/log-store/store-data.properties 2009-10-29 18:10:54 UTC (rev 29872)
@@ -0,0 +1 @@
+jboss.server.data.dir=data
\ No newline at end of file
Modified: labs/jbosstm/workspace/whitingjr/trunk/performance/src/main/resources/properties/transaction-management/jta-managed/default.persistence.properties
===================================================================
--- labs/jbosstm/workspace/whitingjr/trunk/performance/src/main/resources/properties/transaction-management/jta-managed/default.persistence.properties 2009-10-29 18:09:50 UTC (rev 29871)
+++ labs/jbosstm/workspace/whitingjr/trunk/performance/src/main/resources/properties/transaction-management/jta-managed/default.persistence.properties 2009-10-29 18:10:54 UTC (rev 29872)
@@ -2,4 +2,5 @@
hibernate.transaction.manager_lookup_class=org.hibernate.transaction.JBossTransactionManagerLookup
hibernate.cache.provider_class=org.hibernate.cache.NoCacheProvider
# bean managed transaction
-hibernate.current_session_context_class=jta
\ No newline at end of file
+hibernate.current_session_context_class=jta
+
More information about the jboss-svn-commits
mailing list