[exo-jcr-commits] exo-jcr SVN: r4548 - in jcr/trunk/exo.jcr.component.core/src: main/java/org/exoplatform/services/jcr/impl/config and 8 other directories.

do-not-reply at jboss.org do-not-reply at jboss.org
Fri Jun 17 09:27:58 EDT 2011


Author: nzamosenchuk
Date: 2011-06-17 09:27:57 -0400 (Fri, 17 Jun 2011)
New Revision: 4548

Added:
   jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/lock/jbosscache/JDBCCacheLoader.java
   jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/JDBCUtils.java
Modified:
   jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/clean/rdbms/DBClean.java
   jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/config/JDBCConfigurationPersister.java
   jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/init/IngresSQLDBInitializer.java
   jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/init/OracleDBInitializer.java
   jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/init/PgSQLDBInitializer.java
   jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/value/cas/JDBCValueContentAddressStorageImpl.java
   jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/util/jdbc/DBInitializer.java
   jcr/trunk/exo.jcr.component.core/src/main/resources/conf/portal/cluster/jbosscache-lock.xml
   jcr/trunk/exo.jcr.component.core/src/test/resources/conf/standalone/cluster/test-jbosscache-lock.xml
   jcr/trunk/exo.jcr.component.core/src/test/resources/conf/standalone/test-jbosscache-lock.xml
Log:
EXOJCR-1374: committing patch made by Nicolas Filotto

Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/clean/rdbms/DBClean.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/clean/rdbms/DBClean.java	2011-06-16 15:14:09 UTC (rev 4547)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/clean/rdbms/DBClean.java	2011-06-17 13:27:57 UTC (rev 4548)
@@ -18,13 +18,13 @@
 
 import org.exoplatform.commons.utils.SecurityHelper;
 import org.exoplatform.services.jcr.core.security.JCRRuntimePermissions;
+import org.exoplatform.services.jcr.impl.storage.jdbc.JDBCUtils;
 import org.exoplatform.services.jcr.impl.util.jdbc.DBInitializer;
 import org.exoplatform.services.log.ExoLogger;
 import org.exoplatform.services.log.Log;
 
 import java.security.PrivilegedExceptionAction;
 import java.sql.Connection;
-import java.sql.ResultSet;
 import java.sql.SQLException;
 import java.sql.Statement;
 import java.util.ArrayList;
@@ -194,27 +194,7 @@
     */
    protected boolean isTableExists(Connection conn, String tableName) throws SQLException
    {
-      ResultSet trs = conn.getMetaData().getTables(null, null, tableName, null);
-      try
-      {
-         boolean res = false;
-         while (trs.next())
-         {
-            res = true; // check for columns/table type matching etc.
-         }
-         return res;
-      }
-      finally
-      {
-         try
-         {
-            trs.close();
-         }
-         catch (SQLException e)
-         {
-            LOG.error("Can't close the ResultSet: " + e);
-         }
-      }
+      return JDBCUtils.tableExists(tableName, conn);
    }
 
    /**

Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/config/JDBCConfigurationPersister.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/config/JDBCConfigurationPersister.java	2011-06-16 15:14:09 UTC (rev 4547)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/config/JDBCConfigurationPersister.java	2011-06-17 13:27:57 UTC (rev 4548)
@@ -24,6 +24,7 @@
 import org.exoplatform.services.jcr.config.RepositoryConfigurationException;
 import org.exoplatform.services.jcr.impl.storage.jdbc.DBConstants;
 import org.exoplatform.services.jcr.impl.storage.jdbc.DialectDetecter;
+import org.exoplatform.services.jcr.impl.storage.jdbc.JDBCUtils;
 import org.exoplatform.services.log.ExoLogger;
 import org.exoplatform.services.log.Log;
 
@@ -31,6 +32,7 @@
 import java.io.ByteArrayOutputStream;
 import java.io.IOException;
 import java.io.InputStream;
+import java.security.PrivilegedAction;
 import java.security.PrivilegedExceptionAction;
 import java.sql.Connection;
 import java.sql.PreparedStatement;
@@ -220,36 +222,14 @@
     */
    protected boolean isDbInitialized(final Connection con)
    {
-      try
+      return SecurityHelper.doPrivilegedAction(new PrivilegedAction<Boolean>()
       {
-         ResultSet trs = SecurityHelper.doPrivilegedSQLExceptionAction(new PrivilegedExceptionAction<ResultSet>()
-         {
-            public ResultSet run() throws Exception
-            {
-               return con.getMetaData().getTables(null, null, configTableName, null);
-            }
-         });
 
-         try
+         public Boolean run()
          {
-            return trs.next();
+            return JDBCUtils.tableExists(configTableName, con);
          }
-         finally
-         {
-            try
-            {
-               trs.close();
-            }
-            catch (SQLException e)
-            {
-               LOG.error("Can't close the ResultSet: " + e);
-            }
-         }
-      }
-      catch (SQLException e)
-      {
-         return false;
-      }
+      });
    }
 
    public boolean hasConfig() throws RepositoryConfigurationException

Added: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/lock/jbosscache/JDBCCacheLoader.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/lock/jbosscache/JDBCCacheLoader.java	                        (rev 0)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/lock/jbosscache/JDBCCacheLoader.java	2011-06-17 13:27:57 UTC (rev 4548)
@@ -0,0 +1,55 @@
+/*
+ * Copyright (C) 2011 eXo Platform SAS.
+ *
+ * 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.exoplatform.services.jcr.impl.core.lock.jbosscache;
+
+import org.exoplatform.services.jcr.impl.storage.jdbc.JDBCUtils;
+import org.jboss.cache.config.CacheLoaderConfig;
+import org.jboss.cache.loader.AdjListJDBCCacheLoaderConfig;
+
+import java.sql.Connection;
+
+
+/**
+ * This class is used to override the method AdjListJDBCCacheLoader#tableExists in order
+ * to more easily ensure multi-schema support.
+ * 
+ * @author <a href="mailto:nfilotto at exoplatform.com">Nicolas Filotto</a>
+ * @version $Id$
+ *
+ */
+public class JDBCCacheLoader extends org.jboss.cache.loader.JDBCCacheLoader
+{
+
+   @Override
+   protected boolean tableExists(String tableName, Connection con)
+   {
+      return JDBCUtils.tableExists(tableName, con);
+   }
+   
+   /**
+    * @see org.jboss.cache.loader.AdjListJDBCCacheLoader#processConfig(org.jboss.cache.config.CacheLoaderConfig.IndividualCacheLoaderConfig)
+    */
+   @Override
+   protected AdjListJDBCCacheLoaderConfig processConfig(CacheLoaderConfig.IndividualCacheLoaderConfig base)
+   {
+      AdjListJDBCCacheLoaderConfig config = super.processConfig(base);
+      config.setClassName(getClass().getName());
+      return config;
+   }
+}


Property changes on: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/lock/jbosscache/JDBCCacheLoader.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Added: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/JDBCUtils.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/JDBCUtils.java	                        (rev 0)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/JDBCUtils.java	2011-06-17 13:27:57 UTC (rev 4548)
@@ -0,0 +1,94 @@
+/*
+ * Copyright (C) 2011 eXo Platform SAS.
+ *
+ * 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.exoplatform.services.jcr.impl.storage.jdbc;
+
+import org.exoplatform.services.log.ExoLogger;
+import org.exoplatform.services.log.Log;
+
+import java.sql.Connection;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.sql.Statement;
+
+/**
+ * This class provides JDBC tools
+ * 
+ * @author <a href="mailto:nfilotto at exoplatform.com">Nicolas Filotto</a>
+ * @version $Id$
+ *
+ */
+public class JDBCUtils
+{
+   private static final Log LOG = ExoLogger.getLogger("exo.jcr.component.core.JDBCUtils");
+
+   private JDBCUtils()
+   {
+   }
+
+   /**
+    * Indicates whether or not a given table exists
+    * @param tableName the name of the table to check
+    * @param con the connection to use
+    * @return <code>true</code> if it exists, <code>false</code> otherwise
+    */
+   public static boolean tableExists(String tableName, Connection con)
+   {
+      Statement stmt = null;
+      ResultSet trs = null;
+      try
+      {
+         stmt = con.createStatement();
+         trs = stmt.executeQuery("SELECT count(*) FROM " + tableName);
+         return trs.next();
+      }
+      catch (SQLException e)
+      {
+         if (LOG.isDebugEnabled())
+         {
+            LOG.debug("SQLException occurs while checking the table " + tableName, e);
+         }
+         return false;
+      }
+      finally
+      {
+         if (trs != null)
+         {
+            try
+            {
+               trs.close();
+            }
+            catch (SQLException e)
+            {
+               LOG.error("Can't close the ResultSet: " + e);
+            }
+         }
+         if (stmt != null)
+         {
+            try
+            {
+               stmt.close();
+            }
+            catch (SQLException e)
+            {
+               LOG.error("Can't close the Statement: " + e);
+            }
+         }
+      }
+   }
+}


Property changes on: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/JDBCUtils.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/init/IngresSQLDBInitializer.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/init/IngresSQLDBInitializer.java	2011-06-16 15:14:09 UTC (rev 4547)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/init/IngresSQLDBInitializer.java	2011-06-17 13:27:57 UTC (rev 4548)
@@ -48,15 +48,6 @@
     * {@inheritDoc}
     */
    @Override
-   protected boolean isIndexExists(Connection conn, String tableName, String indexName) throws SQLException
-   {
-      return super.isIndexExists(conn, tableName.toUpperCase().toLowerCase(), indexName.toUpperCase().toLowerCase());
-   }
-
-   /**
-    * {@inheritDoc}
-    */
-   @Override
    protected boolean isTableExists(Connection conn, String tableName) throws SQLException
    {
       return super.isTableExists(conn, tableName.toUpperCase().toLowerCase());

Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/init/OracleDBInitializer.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/init/OracleDBInitializer.java	2011-06-16 15:14:09 UTC (rev 4547)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/init/OracleDBInitializer.java	2011-06-17 13:27:57 UTC (rev 4548)
@@ -93,127 +93,4 @@
          }
       }
    }
-
-   @Override
-   protected boolean isTriggerExists(Connection conn, String triggerName) throws SQLException
-   {
-      String sql = "SELECT COUNT(trigger_name) FROM all_triggers WHERE trigger_name = '" + triggerName + "'";
-      Statement st = null;
-      ResultSet r = null;
-      try
-      {
-         st = conn.createStatement();
-         r = st.executeQuery(sql);
-
-         if (r.next())
-            return r.getInt(1) > 0;
-         else
-            return false;
-      }
-      finally
-      {
-         if (r != null)
-         {
-            try
-            {
-               r.close();
-            }
-            catch (SQLException e)
-            {
-               LOG.error("Can't close the ResultSet: " + e);
-            }
-         }
-
-         if (st != null)
-         {
-            try
-            {
-               st.close();
-            }
-            catch (SQLException e)
-            {
-               LOG.error("Can't close the Statement: " + e);
-            }
-         }
-      }
-   }
-
-   @Override
-   protected boolean isTableExists(Connection conn, String tableName) throws SQLException
-   {
-      Statement st = null;
-      try
-      {
-         st = conn.createStatement();
-         st.executeUpdate("SELECT 1 FROM " + tableName);
-         return true;
-      }
-      catch (SQLException e)
-      {
-         // check: ORA-00942: table or view does not exist
-         if (e.getMessage().indexOf("ORA-00942") >= 0)
-            return false;
-         throw e;
-      }
-      finally
-      {
-         if (st != null)
-         {
-            try
-            {
-               st.close();
-            }
-            catch (SQLException e)
-            {
-               LOG.error("Can't close the Statement: " + e);
-            }
-         }
-      }
-   }
-
-   @Override
-   protected boolean isIndexExists(Connection conn, String tableName, String indexName) throws SQLException
-   {
-      // use of oracle system view
-      String sql = "SELECT COUNT(index_name) FROM all_indexes WHERE index_name='" + indexName + "'";
-      Statement st = null;
-      ResultSet r = null;
-      try
-      {
-         st = conn.createStatement();
-         r = st.executeQuery(sql);
-
-         if (r.next())
-            return r.getInt(1) > 0;
-         else
-            return false;
-      }
-      finally
-      {
-         if (r != null)
-         {
-            try
-            {
-               r.close();
-            }
-            catch (SQLException e)
-            {
-               LOG.error("Can't close the ResultSet: " + e);
-            }
-         }
-
-         if (st != null)
-         {
-            try
-            {
-               st.close();
-            }
-            catch (SQLException e)
-            {
-               LOG.error("Can't close the Statement: " + e);
-            }
-         }
-
-      }
-   }
 }

Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/init/PgSQLDBInitializer.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/init/PgSQLDBInitializer.java	2011-06-16 15:14:09 UTC (rev 4547)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/init/PgSQLDBInitializer.java	2011-06-17 13:27:57 UTC (rev 4548)
@@ -43,12 +43,6 @@
    }
 
    @Override
-   protected boolean isIndexExists(Connection conn, String tableName, String indexName) throws SQLException
-   {
-      return super.isIndexExists(conn, tableName.toUpperCase().toLowerCase(), indexName.toUpperCase().toLowerCase());
-   }
-
-   @Override
    protected boolean isTableExists(Connection conn, String tableName) throws SQLException
    {
       return super.isTableExists(conn, tableName.toUpperCase().toLowerCase());

Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/value/cas/JDBCValueContentAddressStorageImpl.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/value/cas/JDBCValueContentAddressStorageImpl.java	2011-06-16 15:14:09 UTC (rev 4547)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/value/cas/JDBCValueContentAddressStorageImpl.java	2011-06-17 13:27:57 UTC (rev 4548)
@@ -22,6 +22,7 @@
 import org.exoplatform.services.jcr.config.RepositoryConfigurationException;
 import org.exoplatform.services.jcr.impl.storage.jdbc.DBConstants;
 import org.exoplatform.services.jcr.impl.storage.jdbc.DialectDetecter;
+import org.exoplatform.services.jcr.impl.storage.jdbc.JDBCUtils;
 import org.exoplatform.services.log.ExoLogger;
 import org.exoplatform.services.log.Log;
 
@@ -222,10 +223,8 @@
                "SELECT DISTINCT C.PROPERTY_ID AS PROPERTY_ID FROM " + tableName + " C, " + tableName + " P "
                   + "WHERE C.CAS_ID=P.CAS_ID AND C.PROPERTY_ID<>P.PROPERTY_ID AND P.PROPERTY_ID=?";
 
-            // init database objects
-            ResultSet trs = dbMetaData.getTables(null, null, tableName, null);
             // check if table already exists
-            if (!trs.next())
+            if (!JDBCUtils.tableExists(tableName, conn))
             {
                st = conn.createStatement();
 

Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/util/jdbc/DBInitializer.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/util/jdbc/DBInitializer.java	2011-06-16 15:14:09 UTC (rev 4547)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/util/jdbc/DBInitializer.java	2011-06-17 13:27:57 UTC (rev 4548)
@@ -19,6 +19,7 @@
 package org.exoplatform.services.jcr.impl.util.jdbc;
 
 import org.exoplatform.commons.utils.SecurityHelper;
+import org.exoplatform.services.jcr.impl.storage.jdbc.JDBCUtils;
 import org.exoplatform.services.log.ExoLogger;
 import org.exoplatform.services.log.Log;
 
@@ -28,10 +29,10 @@
 import java.security.PrivilegedAction;
 import java.security.PrivilegedExceptionAction;
 import java.sql.Connection;
-import java.sql.DatabaseMetaData;
-import java.sql.ResultSet;
 import java.sql.SQLException;
 import java.sql.Statement;
+import java.util.HashSet;
+import java.util.Set;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 
@@ -173,77 +174,22 @@
 
    protected boolean isTableExists(final Connection conn, final String tableName) throws SQLException
    {
-      ResultSet trs = SecurityHelper.doPrivilegedSQLExceptionAction(new PrivilegedExceptionAction<ResultSet>()
+      return SecurityHelper.doPrivilegedAction(new PrivilegedAction<Boolean>()
       {
-         public ResultSet run() throws Exception
+         public Boolean run()
          {
-            return conn.getMetaData().getTables(null, null, tableName, null);
+            return JDBCUtils.tableExists(tableName, conn);
          }
       });
-
-      try
-      {
-         boolean res = false;
-         while (trs.next())
-         {
-            res = true; // check for columns/table type matching etc.
-         }
-         return res;
-      }
-      finally
-      {
-         try
-         {
-            trs.close();
-         }
-         catch (SQLException e)
-         {
-            LOG.error("Can't close the ResultSet: " + e);
-         }
-      }
    }
-
-   protected boolean isIndexExists(Connection conn, String tableName, String indexName) throws SQLException
-   {
-      ResultSet irs = conn.getMetaData().getIndexInfo(null, null, tableName, false, true);
-      try
-      {
-         boolean res = false;
-         while (irs.next())
-         {
-            if (irs.getShort("TYPE") != DatabaseMetaData.tableIndexStatistic
-               && irs.getString("INDEX_NAME").equalsIgnoreCase(indexName))
-            {
-               res = true; // check for index params matching etc.
-            }
-         }
-         return res;
-      }
-      finally
-      {
-         try
-         {
-            irs.close();
-         }
-         catch (SQLException e)
-         {
-            LOG.error("Can't close the ResultSet: " + e);
-         }
-      }
-   }
-
+ 
    protected boolean isSequenceExists(Connection conn, String sequenceName) throws SQLException
    {
       return false;
    }
 
-   protected boolean isTriggerExists(Connection conn, String triggerName) throws SQLException
+   private boolean isObjectExists(Connection conn, String sql, Set<String> existingTables) throws SQLException
    {
-      return false;
-   }
-
-   public boolean isObjectExists(Connection conn, String sql) throws SQLException
-   {
       Matcher tMatcher = creatTablePattern.matcher(sql);
       if (tMatcher.find())
       {
@@ -259,6 +205,7 @@
                {
                   LOG.debug("Table is already exists " + tableName);
                }
+               existingTables.add(tableName);
                return true;
             }
          }
@@ -277,6 +224,7 @@
                {
                   LOG.debug("View is already exists " + tableName);
                }
+               existingTables.add(tableName);
                return true;
             }
          }
@@ -295,11 +243,11 @@
                if ((tMatcher = dbObjectNamePattern.matcher(onTableName)).find())
                {
                   String tableName = onTableName.substring(tMatcher.start(), tMatcher.end());
-                  if (isIndexExists(conn, tableName, indexName))
+                  if (existingTables.contains(tableName))
                   {
                      if (LOG.isDebugEnabled())
                      {
-                        LOG.debug("Index is already exists " + indexName);
+                        LOG.debug("The table " + tableName + " already exists so we assume that the index " + indexName + " exists also.");
                      }
                      return true;
                   }
@@ -343,11 +291,11 @@
          {
             // got trigger name
             String triggerName = sql.substring(tMatcher.start(), tMatcher.end());
-            if (isTriggerExists(conn, triggerName))
+            if (!existingTables.isEmpty())
             {
                if (LOG.isDebugEnabled())
                {
-                  LOG.debug("Trigger is already exists " + triggerName);
+                  LOG.debug("At least one table has been created so we assume that the trigger " + triggerName + " exists also");
                }
                return true;
             }
@@ -394,6 +342,7 @@
 
       String sql = null;
       Statement st = null;
+      Set<String> existingTables = new HashSet<String>();
       try
       {
          st = connection.createStatement();
@@ -404,7 +353,7 @@
             String s = cleanWhitespaces(scr.trim());
             if (s.length() > 0)
             {
-               if (isObjectExists(connection, sql = s))
+               if (isObjectExists(connection, sql = s, existingTables))
                {
                   continue;
                }
@@ -445,7 +394,7 @@
          boolean isAlreadyCreated = false;
          try
          {
-            isAlreadyCreated = isObjectExists(connection, sql);
+            isAlreadyCreated = isObjectExists(connection, sql, existingTables);
          }
          catch (SQLException ce)
          {

Modified: jcr/trunk/exo.jcr.component.core/src/main/resources/conf/portal/cluster/jbosscache-lock.xml
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/resources/conf/portal/cluster/jbosscache-lock.xml	2011-06-16 15:14:09 UTC (rev 4547)
+++ jcr/trunk/exo.jcr.component.core/src/main/resources/conf/portal/cluster/jbosscache-lock.xml	2011-06-17 13:27:57 UTC (rev 4548)
@@ -18,7 +18,7 @@
 			For another cache-loader class you should use another template with
 			cache-loader specific parameters
 		-->
-      <loader class="org.jboss.cache.loader.JDBCCacheLoader" async="false" fetchPersistentState="false"
+      <loader class="org.exoplatform.services.jcr.impl.core.lock.jbosscache.JDBCCacheLoader" async="false" fetchPersistentState="false"
          ignoreModifications="false" purgeOnStartup="false">
          <properties>
             cache.jdbc.table.name=${jbosscache-cl-cache.jdbc.table.name}

Modified: jcr/trunk/exo.jcr.component.core/src/test/resources/conf/standalone/cluster/test-jbosscache-lock.xml
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/test/resources/conf/standalone/cluster/test-jbosscache-lock.xml	2011-06-16 15:14:09 UTC (rev 4547)
+++ jcr/trunk/exo.jcr.component.core/src/test/resources/conf/standalone/cluster/test-jbosscache-lock.xml	2011-06-17 13:27:57 UTC (rev 4548)
@@ -18,7 +18,7 @@
 			For another cache-loader class you should use another template with
 			cache-loader specific parameters
 		-->
-      <loader class="org.jboss.cache.loader.JDBCCacheLoader" async="false" fetchPersistentState="false"
+      <loader class="org.exoplatform.services.jcr.impl.core.lock.jbosscache.JDBCCacheLoader" async="false" fetchPersistentState="false"
          ignoreModifications="false" purgeOnStartup="false">
          <properties>
             cache.jdbc.table.name=${jbosscache-cl-cache.jdbc.table.name}

Modified: jcr/trunk/exo.jcr.component.core/src/test/resources/conf/standalone/test-jbosscache-lock.xml
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/test/resources/conf/standalone/test-jbosscache-lock.xml	2011-06-16 15:14:09 UTC (rev 4547)
+++ jcr/trunk/exo.jcr.component.core/src/test/resources/conf/standalone/test-jbosscache-lock.xml	2011-06-17 13:27:57 UTC (rev 4548)
@@ -13,7 +13,7 @@
 			For another cache-loader class you should use another template with
 			cache-loader specific parameters
 		-->
-      <loader class="org.jboss.cache.loader.JDBCCacheLoader" async="false" fetchPersistentState="false"
+      <loader class="org.exoplatform.services.jcr.impl.core.lock.jbosscache.JDBCCacheLoader" async="false" fetchPersistentState="false"
          ignoreModifications="false" purgeOnStartup="false">
          <properties>
             cache.jdbc.table.name=${jbosscache-cl-cache.jdbc.table.name}



More information about the exo-jcr-commits mailing list