[exo-jcr-commits] exo-jcr SVN: r2742 - jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc.

do-not-reply at jboss.org do-not-reply at jboss.org
Tue Jul 6 02:11:41 EDT 2010


Author: nzamosenchuk
Date: 2010-07-06 02:11:41 -0400 (Tue, 06 Jul 2010)
New Revision: 2742

Modified:
   jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/JDBCWorkspaceDataContainer.java
Log:
EXOJCR-808: If Sybase RDBMS found and checkSNSNewConnection not configured, it is set to false by default.

Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/JDBCWorkspaceDataContainer.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/JDBCWorkspaceDataContainer.java	2010-07-05 11:31:55 UTC (rev 2741)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/JDBCWorkspaceDataContainer.java	2010-07-06 06:11:41 UTC (rev 2742)
@@ -370,7 +370,7 @@
       }
       catch (RepositoryConfigurationException e)
       {
-         this.checkSNSNewConnection = true;
+         this.checkSNSNewConnection = DBConstants.DB_DIALECT_SYBASE.equals(this.dbDialect) ? false : true;
       }
 
       // ------------- Values swap config ------------------
@@ -393,7 +393,9 @@
          this.swapDirectory = new File(DEF_SWAPDIR);
       }
       if (!PrivilegedFileHelper.exists(swapDirectory))
+      {
          PrivilegedFileHelper.mkdirs(swapDirectory);
+      }
 
       this.swapCleaner = new FileCleaner(false);
 
@@ -409,7 +411,9 @@
       catch (RepositoryConfigurationException e)
       {
          if (LOG.isDebugEnabled())
+         {
             LOG.debug("update-storage parameter is not set " + dbSourceName);
+         }
       }
 
       this.storageVersion =
@@ -435,8 +439,10 @@
       {
          DataSource ds = (DataSource)new InitialContext().lookup(dbSourceName);
          if (ds != null)
+         {
             return new GenericConnectionFactory(ds, containerName, multiDb, valueStorageProvider, maxBufferSize,
                swapDirectory, swapCleaner);
+         }
 
          throw new RepositoryException("Datasource '" + dbSourceName + "' is not bound in this context.");
       }
@@ -483,7 +489,9 @@
          if (wsEntry.getName().equals(wsConfig.getName())
             || !wsEntry.getContainer().getType().equals(wsConfig.getContainer().getType())
             || !wsEntry.getContainer().getType().equals(this.getClass().getName()))
+         {
             continue;
+         }
 
          // MULTIDB
          if (!wsEntry.getContainer().getParameterValue(MULTIDB).equals(
@@ -586,11 +594,15 @@
          LOG.warn(DBConstants.DB_DIALECT_ORACLEOCI + " dialect is experimental!");
          // sample of connection factory customization
          if (dbSourceName != null)
+         {
             this.connFactory = defaultConnectionFactory();
+         }
          else
+         {
             this.connFactory =
                new OracleConnectionFactory(dbDriver, dbUrl, dbUserName, dbPassword, containerName, multiDb,
                   valueStorageProvider, maxBufferSize, swapDirectory, swapCleaner);
+         }
 
          sqlPath = "/conf/storage/jcr-" + (multiDb ? "m" : "s") + "jdbc.ora.sql";
 
@@ -616,16 +628,22 @@
          {
             DataSource ds = (DataSource)new InitialContext().lookup(dbSourceName);
             if (ds != null)
+            {
                this.connFactory =
                   new MySQLConnectionFactory(ds, containerName, multiDb, valueStorageProvider, maxBufferSize,
                      swapDirectory, swapCleaner);
+            }
             else
+            {
                throw new RepositoryException("Datasource '" + dbSourceName + "' is not bound in this context.");
+            }
          }
          else
+         {
             this.connFactory =
                new MySQLConnectionFactory(dbDriver, dbUrl, dbUserName, dbPassword, containerName, multiDb,
                   valueStorageProvider, maxBufferSize, swapDirectory, swapCleaner);
+         }
 
          sqlPath = "/conf/storage/jcr-" + (multiDb ? "m" : "s") + "jdbc.mysql.sql";
          dbInitilizer = defaultDBInitializer(sqlPath);
@@ -637,16 +655,22 @@
          {
             DataSource ds = (DataSource)new InitialContext().lookup(dbSourceName);
             if (ds != null)
+            {
                this.connFactory =
                   new MySQLConnectionFactory(ds, containerName, multiDb, valueStorageProvider, maxBufferSize,
                      swapDirectory, swapCleaner);
+            }
             else
+            {
                throw new RepositoryException("Datasource '" + dbSourceName + "' is not bound in this context.");
+            }
          }
          else
+         {
             this.connFactory =
                new MySQLConnectionFactory(dbDriver, dbUrl, dbUserName, dbPassword, containerName, multiDb,
                   valueStorageProvider, maxBufferSize, swapDirectory, swapCleaner);
+         }
 
          sqlPath = "/conf/storage/jcr-" + (multiDb ? "m" : "s") + "jdbc.mysql-utf8.sql";
          dbInitilizer = defaultDBInitializer(sqlPath);
@@ -695,16 +719,22 @@
          {
             DataSource ds = (DataSource)new InitialContext().lookup(dbSourceName);
             if (ds != null)
+            {
                this.connFactory =
                   new HSQLDBConnectionFactory(ds, containerName, multiDb, valueStorageProvider, maxBufferSize,
                      swapDirectory, swapCleaner);
+            }
             else
+            {
                throw new RepositoryException("Datasource '" + dbSourceName + "' is not bound in this context.");
+            }
          }
          else
+         {
             this.connFactory =
                new HSQLDBConnectionFactory(dbDriver, dbUrl, dbUserName, dbPassword, containerName, multiDb,
                   valueStorageProvider, maxBufferSize, swapDirectory, swapCleaner);
+         }
          sqlPath = "/conf/storage/jcr-" + (multiDb ? "m" : "s") + "jdbc.sql";
          dbInitilizer = defaultDBInitializer(sqlPath);
       }
@@ -875,15 +905,19 @@
    public boolean isSame(WorkspaceDataContainer another)
    {
       if (another == this)
+      {
          return true;
+      }
 
       if (another instanceof JDBCWorkspaceDataContainer)
       {
          JDBCWorkspaceDataContainer anotherJdbc = (JDBCWorkspaceDataContainer)another;
 
          if (getDbSourceName() != null)
+         {
             // by jndi ds name
             return getDbSourceName().equals(anotherJdbc.getDbSourceName());
+         }
 
          // by db connection params
          return getDbDriver().equals(anotherJdbc.getDbDriver()) && getDbUrl().equals(anotherJdbc.getDbUrl())



More information about the exo-jcr-commits mailing list