[jboss-svn-commits] JBL Code SVN: r30206 - in labs/jbosstm/workspace/whitingjr/trunk/performance/src/main/java/org/jboss/jbossts/performance/persistence: closures and 1 other directory.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Wed Nov 18 13:28:26 EST 2009


Author: whitingjr
Date: 2009-11-18 13:28:25 -0500 (Wed, 18 Nov 2009)
New Revision: 30206

Added:
   labs/jbosstm/workspace/whitingjr/trunk/performance/src/main/java/org/jboss/jbossts/performance/persistence/closures/
   labs/jbosstm/workspace/whitingjr/trunk/performance/src/main/java/org/jboss/jbossts/performance/persistence/closures/ExecuteStatementClosure.java
Log:
Updated to support deleting of constraints and adding again.


Added: labs/jbosstm/workspace/whitingjr/trunk/performance/src/main/java/org/jboss/jbossts/performance/persistence/closures/ExecuteStatementClosure.java
===================================================================
--- labs/jbosstm/workspace/whitingjr/trunk/performance/src/main/java/org/jboss/jbossts/performance/persistence/closures/ExecuteStatementClosure.java	                        (rev 0)
+++ labs/jbosstm/workspace/whitingjr/trunk/performance/src/main/java/org/jboss/jbossts/performance/persistence/closures/ExecuteStatementClosure.java	2009-11-18 18:28:25 UTC (rev 30206)
@@ -0,0 +1,60 @@
+ /*
+  * 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.persistence.closures;
+
+import java.sql.Connection;
+import java.sql.PreparedStatement;
+import java.sql.SQLException;
+
+import org.apache.commons.collections.Closure;
+import org.apache.commons.dbutils.DbUtils;
+import org.apache.log4j.Logger;
+
+public class ExecuteStatementClosure implements Closure
+{
+   private Connection connection;
+   private static final Logger logger = Logger.getLogger(ExecuteStatementClosure.class);
+   @Override
+   public void execute(Object input)
+   {
+      String statement = input.toString();
+      PreparedStatement preparedStatement = null;
+      try{
+         preparedStatement =  this.connection.prepareStatement(statement);
+         preparedStatement.execute();
+      }
+      catch (SQLException sqle)
+      {
+         logger.error(sqle.getMessage(), sqle);
+      }
+      finally
+      {
+         DbUtils.closeQuietly(preparedStatement);
+      }
+   }
+
+   public void setConnection(Connection conn)
+   {
+      this.connection = conn;
+   }
+}



More information about the jboss-svn-commits mailing list