exo-jcr SVN: r3954 - in jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl: core/query/lucene and 1 other directories.
by do-not-reply@jboss.org
Author: tolusha
Date: 2011-02-09 06:25:30 -0500 (Wed, 09 Feb 2011)
New Revision: 3954
Modified:
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/Indexable.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/MultiIndex.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/JDBCWorkspaceDataContainer.java
Log:
EXOJCR-1104: for Sybase keep old way reindexing
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/Indexable.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/Indexable.java 2011-02-09 11:10:36 UTC (rev 3953)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/Indexable.java 2011-02-09 11:25:30 UTC (rev 3954)
@@ -26,18 +26,17 @@
* Date: 1 02 2011
*
* @author <a href="mailto:anatoliy.bazko@exoplatform.com.ua">Anatoliy Bazko</a>
- * @version $Id: Indexing.java 34360 2010-11-11 11:11:11Z tolusha $
+ * @version $Id: Indexable.java 34360 2010-11-11 11:11:11Z tolusha $
*/
public interface Indexable
{
/**
- * Returns NodeDataIndexingIterator.
+ * Returns NodeDataIndexingIterator or null.
*
* @param pageSize
- * the maximum amount of the rows which can be retrieved from database per once
- * @return NodeDataIndexingIterator
+ * the maximum amount of the rows which can be retrieved from storage per once
+ * @return NodeDataIndexingIterator or null
* @throws RepositoryException
*/
- NodeDataIndexingIterator getNodeDataIndexingIterator(int pageSize)
- throws RepositoryException;
+ NodeDataIndexingIterator getNodeDataIndexingIterator(int pageSize) throws RepositoryException;
}
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/MultiIndex.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/MultiIndex.java 2011-02-09 11:10:36 UTC (rev 3953)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/MultiIndex.java 2011-02-09 11:25:30 UTC (rev 3954)
@@ -432,14 +432,24 @@
// traverse and index workspace
executeAndLog(new Start(Action.INTERNAL_TRANSACTION));
- // NodeData rootState = (NodeData) stateMgr.getItemData(rootId);
+ long count;
+
// check if we have deal with JDBC indexing mechanism
Indexable indexableComponent = (Indexable)handler.getContext().getContainer().getComponent(Indexable.class);
- long count =
- indexableComponent == null ? createIndex(indexingTree.getIndexingRoot(), stateMgr) : createIndex(
- indexableComponent.getNodeDataIndexingIterator(handler.getReindexingPageSize()),
- indexingTree.getIndexingRoot());
+ if (indexableComponent == null)
+ {
+ count = createIndex(indexingTree.getIndexingRoot(), stateMgr);
+ }
+ else
+ {
+ NodeDataIndexingIterator iterator =
+ indexableComponent.getNodeDataIndexingIterator(handler.getReindexingPageSize());
+ count =
+ iterator == null ? createIndex(indexingTree.getIndexingRoot(), stateMgr) : createIndex(iterator,
+ indexingTree.getIndexingRoot());
+ }
+
executeAndLog(new Commit(getTransactionId()));
log.info("Created initial index for {} nodes", new Long(count));
releaseMultiReader();
@@ -1630,6 +1640,7 @@
{
while (iterator.hasNext())
{
+
Callable<Void> task = new Callable<Void>()
{
public Void call() throws Exception
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 2011-02-09 11:10:36 UTC (rev 3953)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/JDBCWorkspaceDataContainer.java 2011-02-09 11:25:30 UTC (rev 3954)
@@ -1511,6 +1511,7 @@
public NodeDataIndexingIterator getNodeDataIndexingIterator(int pageSize)
throws RepositoryException
{
- return new JdbcNodeDataIndexingIterator(connFactory, pageSize);
+ return dbDialect.equals(DBConstants.DB_DIALECT_SYBASE) ? null : new JdbcNodeDataIndexingIterator(connFactory,
+ pageSize);
}
}
13 years, 3 months
exo-jcr SVN: r3953 - in jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc: db and 2 other directories.
by do-not-reply@jboss.org
Author: tolusha
Date: 2011-02-09 06:10:36 -0500 (Wed, 09 Feb 2011)
New Revision: 3953
Removed:
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/db/SybaseConnectionFactory.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/db/SybaseMultiDbJDBCConnection.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/db/SybaseSingleDbJDBCConnection.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/SybaseConnectionFactory.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/SybaseMultiDbJDBCConnection.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/SybaseSingleDbJDBCConnection.java
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/optimisation/CQJDBCWorkspaceDataContainer.java
Log:
EXOJCR-1104: for Sybase keep old way reindexing
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 2011-02-09 11:02:47 UTC (rev 3952)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/JDBCWorkspaceDataContainer.java 2011-02-09 11:10:36 UTC (rev 3953)
@@ -49,7 +49,6 @@
import org.exoplatform.services.jcr.impl.storage.jdbc.db.MSSQLConnectionFactory;
import org.exoplatform.services.jcr.impl.storage.jdbc.db.MySQLConnectionFactory;
import org.exoplatform.services.jcr.impl.storage.jdbc.db.OracleConnectionFactory;
-import org.exoplatform.services.jcr.impl.storage.jdbc.db.SybaseConnectionFactory;
import org.exoplatform.services.jcr.impl.storage.jdbc.db.WorkspaceStorageConnectionFactory;
import org.exoplatform.services.jcr.impl.storage.jdbc.indexing.JdbcNodeDataIndexingIterator;
import org.exoplatform.services.jcr.impl.storage.jdbc.init.IngresSQLDBInitializer;
@@ -836,27 +835,7 @@
}
else if (dbDialect == DBConstants.DB_DIALECT_SYBASE)
{
- if (dbSourceName != null)
- {
- DataSource ds = (DataSource)new InitialContext().lookup(dbSourceName);
- if (ds != null)
- {
- this.connFactory =
- new SybaseConnectionFactory(ds, containerName, multiDb, valueStorageProvider, maxBufferSize,
- swapDirectory, swapCleaner);
- }
- else
- {
- throw new RepositoryException("Datasource '" + dbSourceName + "' is not bound in this context.");
- }
- }
- else
- {
- this.connFactory =
- new SybaseConnectionFactory(dbDriver, dbUrl, dbUserName, dbPassword, containerName, multiDb,
- valueStorageProvider, maxBufferSize, swapDirectory, swapCleaner);
- }
-
+ this.connFactory = defaultConnectionFactory();
sqlPath = "/conf/storage/jcr-" + (multiDb ? "m" : "s") + "jdbc.sybase.sql";
dbInitilizer = defaultDBInitializer(sqlPath);
}
Deleted: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/db/SybaseConnectionFactory.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/db/SybaseConnectionFactory.java 2011-02-09 11:02:47 UTC (rev 3952)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/db/SybaseConnectionFactory.java 2011-02-09 11:10:36 UTC (rev 3953)
@@ -1,125 +0,0 @@
-/*
- * Copyright (C) 2009 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.db;
-
-import org.exoplatform.services.jcr.impl.util.io.FileCleaner;
-import org.exoplatform.services.jcr.storage.WorkspaceStorageConnection;
-import org.exoplatform.services.jcr.storage.value.ValueStoragePluginProvider;
-
-import java.io.File;
-import java.sql.SQLException;
-
-import javax.jcr.RepositoryException;
-import javax.sql.DataSource;
-
-/**
- * Created by The eXo Platform SAS.
- *
- * Date: 8 02 2011
- *
- * @author <a href="mailto:anatoliy.bazko@exoplatform.com.ua">Anatoliy Bazko</a>
- * @version $Id: MSSQLConnectionFactory.java 34360 2010-11-11 11:11:11Z tolusha $
- */
-public class SybaseConnectionFactory extends GenericConnectionFactory
-{
-
- /**
- * SybaseConnectionFactory constructor.
- *
- * @param dataSource
- * - DataSource
- * @param dbDriver
- * - JDBC Driver
- * @param dbUrl
- * - JDBC URL
- * @param dbUserName
- * - database username
- * @param dbPassword
- * - database user password
- * @param containerName
- * - Container name (see configuration)
- * @param multiDb
- * - multidatabase state flag
- * @param valueStorageProvider
- * - external Value Storages provider
- * @param maxBufferSize
- * - Maximum buffer size (see configuration)
- * @param swapDirectory
- * - Swap directory (see configuration)
- * @param swapCleaner
- * - Swap cleaner (internal FileCleaner).
- * @throws RepositoryException
- * if error eccurs
- */
- public SybaseConnectionFactory(String dbDriver, String dbUrl, String dbUserName, String dbPassword,
- String containerName, boolean multiDb, ValueStoragePluginProvider valueStorageProvider, int maxBufferSize,
- File swapDirectory, FileCleaner swapCleaner) throws RepositoryException
- {
- super(dbDriver, dbUrl, dbUserName, dbPassword, containerName, multiDb, valueStorageProvider, maxBufferSize,
- swapDirectory, swapCleaner);
- }
-
- /**
- * SybaseConnectionFactory constructor.
- *
- * @param dataSource
- * - DataSource
- * @param containerName
- * - Container name (see configuration)
- * @param multiDb
- * - multidatabase state flag
- * @param valueStorageProvider
- * - external Value Storages provider
- * @param maxBufferSize
- * - Maximum buffer size (see configuration)
- * @param swapDirectory
- * - Swap directory (see configuration)
- * @param swapCleaner
- * - Swap cleaner (internal FileCleaner).
- */
- public SybaseConnectionFactory(DataSource dbDataSource, String containerName, boolean multiDb,
- ValueStoragePluginProvider valueStorageProvider, int maxBufferSize, File swapDirectory, FileCleaner swapCleaner)
- {
- super(dbDataSource, containerName, multiDb, valueStorageProvider, maxBufferSize, swapDirectory, swapCleaner);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public WorkspaceStorageConnection openConnection(boolean readOnly) throws RepositoryException
- {
- try
- {
- if (multiDb)
- {
- return new SybaseMultiDbJDBCConnection(getJdbcConnection(readOnly), readOnly, containerName,
- valueStorageProvider, maxBufferSize, swapDirectory, swapCleaner);
- }
-
- return new SybaseSingleDbJDBCConnection(getJdbcConnection(readOnly), readOnly, containerName,
- valueStorageProvider, maxBufferSize, swapDirectory, swapCleaner);
-
- }
- catch (SQLException e)
- {
- throw new RepositoryException(e);
- }
- }
-}
Deleted: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/db/SybaseMultiDbJDBCConnection.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/db/SybaseMultiDbJDBCConnection.java 2011-02-09 11:02:47 UTC (rev 3952)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/db/SybaseMultiDbJDBCConnection.java 2011-02-09 11:10:36 UTC (rev 3953)
@@ -1,79 +0,0 @@
-/*
- * Copyright (C) 2003-2010 eXo Platform SAS.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Affero General Public License
- * as published by the Free Software Foundation; either version 3
- * of the License, or (at your option) any later version.
- *
- * This program 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 General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see<http://www.gnu.org/licenses/>.
- */
-package org.exoplatform.services.jcr.impl.storage.jdbc.db;
-
-import org.exoplatform.services.jcr.impl.util.io.FileCleaner;
-import org.exoplatform.services.jcr.storage.value.ValueStoragePluginProvider;
-
-import java.io.File;
-import java.sql.Connection;
-import java.sql.SQLException;
-
-/**
- * Created by The eXo Platform SAS.
- *
- * Date: 8 02 2011
- *
- * @author <a href="mailto:anatoliy.bazko@exoplatform.com.ua">Anatoliy Bazko</a>
- * @version $Id: SybaseMultiDbJDBCConnection.java 34360 2010-11-11 11:11:11Z tolusha $
- */
-public class SybaseMultiDbJDBCConnection extends MultiDbJDBCConnection
-{
- /**
- * Sybase Multidatabase JDBC Connection constructor.
- *
- * @param dbConnection
- * JDBC connection, shoudl be opened before
- * @param readOnly
- * boolean if true the dbConnection was marked as READ-ONLY.
- * @param containerName
- * Workspace Storage Container name (see configuration)
- * @param valueStorageProvider
- * External Value Storages provider
- * @param maxBufferSize
- * Maximum buffer size (see configuration)
- * @param swapDirectory
- * Swap directory File (see configuration)
- * @param swapCleaner
- * Swap cleaner (internal FileCleaner).
- * @throws SQLException
- *
- * @see org.exoplatform.services.jcr.impl.util.io.FileCleaner
- */
- public SybaseMultiDbJDBCConnection(Connection dbConnection, boolean readOnly, String containerName,
- ValueStoragePluginProvider valueStorageProvider, int maxBufferSize, File swapDirectory, FileCleaner swapCleaner)
- throws SQLException
- {
- super(dbConnection, readOnly, containerName, valueStorageProvider, maxBufferSize, swapDirectory, swapCleaner);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected void prepareQueries() throws SQLException
- {
- super.prepareQueries();
- FIND_NODES_AND_PROPERTIES =
- "select J.*, P.ID AS P_ID, P.NAME AS P_NAME, P.VERSION AS P_VERSION, P.P_TYPE, P.P_MULTIVALUED,"
- + " V.DATA, V.ORDER_NUM, V.STORAGE_DESC from JCR_SVALUE V, JCR_SITEM P"
- + " join (select A.* from"
- + " (select Row_Number() over (order by I.ID) as r__, I.ID, I.PARENT_ID, I.NAME, I.VERSION, I.I_INDEX, I.N_ORDER_NUM"
- + " from JCR_SITEM I where I.I_CLASS=1) as A where A.r__ <= ? and A.r__ > ?) J on P.PARENT_ID = J.ID"
- + " where P.I_CLASS=2 and V.PROPERTY_ID=P.ID order by J.ID";
- }
-}
Deleted: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/db/SybaseSingleDbJDBCConnection.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/db/SybaseSingleDbJDBCConnection.java 2011-02-09 11:02:47 UTC (rev 3952)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/db/SybaseSingleDbJDBCConnection.java 2011-02-09 11:10:36 UTC (rev 3953)
@@ -1,80 +0,0 @@
-/*
- * Copyright (C) 2003-2010 eXo Platform SAS.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Affero General Public License
- * as published by the Free Software Foundation; either version 3
- * of the License, or (at your option) any later version.
- *
- * This program 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 General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see<http://www.gnu.org/licenses/>.
- */
-package org.exoplatform.services.jcr.impl.storage.jdbc.db;
-
-import org.exoplatform.services.jcr.impl.util.io.FileCleaner;
-import org.exoplatform.services.jcr.storage.value.ValueStoragePluginProvider;
-
-import java.io.File;
-import java.sql.Connection;
-import java.sql.SQLException;
-
-/**
- * Created by The eXo Platform SAS.
- *
- * Date: 8 02 2011
- *
- * @author <a href="mailto:anatoliy.bazko@exoplatform.com.ua">Anatoliy Bazko</a>
- * @version $Id: MSSQLSingleDbJDBCConnection.java 34360 2010-11-11 11:11:11Z tolusha $
- */
-public class SybaseSingleDbJDBCConnection extends SingleDbJDBCConnection
-{
- /**
- * Sybase Singledatabase JDBC Connection constructor.
- *
- * @param dbConnection
- * JDBC connection, should be opened before
- * @param readOnly
- * boolean if true the dbConnection was marked as READ-ONLY.
- * @param containerName
- * Workspace Storage Container name (see configuration)
- * @param valueStorageProvider
- * External Value Storages provider
- * @param maxBufferSize
- * Maximum buffer size (see configuration)
- * @param swapDirectory
- * Swap directory File (see configuration)
- * @param swapCleaner
- * Swap cleaner (internal FileCleaner).
- * @throws SQLException
- *
- * @see org.exoplatform.services.jcr.impl.util.io.FileCleaner
- */
- public SybaseSingleDbJDBCConnection(Connection dbConnection, boolean readOnly, String containerName,
- ValueStoragePluginProvider valueStorageProvider, int maxBufferSize, File swapDirectory, FileCleaner swapCleaner)
- throws SQLException
- {
- super(dbConnection, readOnly, containerName, valueStorageProvider, maxBufferSize, swapDirectory, swapCleaner);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected void prepareQueries() throws SQLException
- {
- super.prepareQueries();
- FIND_NODES_AND_PROPERTIES =
- "select J.*, P.ID AS P_ID, P.NAME AS P_NAME, P.VERSION AS P_VERSION, P.P_TYPE, P.P_MULTIVALUED,"
- + " V.DATA, V.ORDER_NUM, V.STORAGE_DESC from JCR_SVALUE V, JCR_SITEM P"
- + " join (select A.* from"
- + " (select Row_Number() over (order by I.ID) as r__, I.ID, I.PARENT_ID, I.NAME, I.VERSION, I.I_INDEX, I.N_ORDER_NUM"
- + " from JCR_SITEM I where I.CONTAINER_NAME='?' and I.I_CLASS=1) as A where A.r__ <= ? and A.r__ > ?"
- + ") J on P.PARENT_ID = J.ID"
- + " where P.I_CLASS=2 and P.CONTAINER_NAME='?' and V.PROPERTY_ID=P.ID order by J.ID";
- }
-}
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/CQJDBCWorkspaceDataContainer.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/CQJDBCWorkspaceDataContainer.java 2011-02-09 11:02:47 UTC (rev 3952)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/CQJDBCWorkspaceDataContainer.java 2011-02-09 11:10:36 UTC (rev 3953)
@@ -35,7 +35,6 @@
import org.exoplatform.services.jcr.impl.storage.jdbc.optimisation.db.MSSQLConnectionFactory;
import org.exoplatform.services.jcr.impl.storage.jdbc.optimisation.db.MySQLConnectionFactory;
import org.exoplatform.services.jcr.impl.storage.jdbc.optimisation.db.OracleConnectionFactory;
-import org.exoplatform.services.jcr.impl.storage.jdbc.optimisation.db.SybaseConnectionFactory;
import org.exoplatform.services.jcr.impl.util.io.FileCleanerHolder;
import org.exoplatform.services.jcr.impl.util.jdbc.DBInitializerException;
import org.exoplatform.services.jcr.storage.value.ValueStoragePluginProvider;
@@ -273,27 +272,7 @@
}
else if (dbDialect == DBConstants.DB_DIALECT_SYBASE)
{
- if (dbSourceName != null)
- {
- DataSource ds = (DataSource)new InitialContext().lookup(dbSourceName);
- if (ds != null)
- {
- this.connFactory =
- new SybaseConnectionFactory(ds, containerName, multiDb, valueStorageProvider, maxBufferSize,
- swapDirectory, swapCleaner);
- }
- else
- {
- throw new RepositoryException("Datasource '" + dbSourceName + "' is not bound in this context.");
- }
- }
- else
- {
- this.connFactory =
- new SybaseConnectionFactory(dbDriver, dbUrl, dbUserName, dbPassword, containerName, multiDb,
- valueStorageProvider, maxBufferSize, swapDirectory, swapCleaner);
- }
-
+ this.connFactory = defaultConnectionFactory();
sqlPath = "/conf/storage/jcr-" + (multiDb ? "m" : "s") + "jdbc.sybase.sql";
dbInitilizer = defaultDBInitializer(sqlPath);
}
Deleted: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/SybaseConnectionFactory.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/SybaseConnectionFactory.java 2011-02-09 11:02:47 UTC (rev 3952)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/SybaseConnectionFactory.java 2011-02-09 11:10:36 UTC (rev 3953)
@@ -1,125 +0,0 @@
-/*
- * Copyright (C) 2009 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.optimisation.db;
-
-import org.exoplatform.services.jcr.impl.util.io.FileCleaner;
-import org.exoplatform.services.jcr.storage.WorkspaceStorageConnection;
-import org.exoplatform.services.jcr.storage.value.ValueStoragePluginProvider;
-
-import java.io.File;
-import java.sql.SQLException;
-
-import javax.jcr.RepositoryException;
-import javax.sql.DataSource;
-
-/**
- * Created by The eXo Platform SAS.
- *
- * Date: 8 02 2011
- *
- * @author <a href="mailto:anatoliy.bazko@exoplatform.com.ua">Anatoliy Bazko</a>
- * @version $Id: MSSQLConnectionFactory.java 34360 2010-11-11 11:11:11Z tolusha $
- */
-public class SybaseConnectionFactory extends GenericCQConnectionFactory
-{
-
- /**
- * SybaseConnectionFactory constructor.
- *
- * @param dataSource
- * - DataSource
- * @param dbDriver
- * - JDBC Driver
- * @param dbUrl
- * - JDBC URL
- * @param dbUserName
- * - database username
- * @param dbPassword
- * - database user password
- * @param containerName
- * - Container name (see configuration)
- * @param multiDb
- * - multidatabase state flag
- * @param valueStorageProvider
- * - external Value Storages provider
- * @param maxBufferSize
- * - Maximum buffer size (see configuration)
- * @param swapDirectory
- * - Swap directory (see configuration)
- * @param swapCleaner
- * - Swap cleaner (internal FileCleaner).
- * @throws RepositoryException
- * if error eccurs
- */
- public SybaseConnectionFactory(String dbDriver, String dbUrl, String dbUserName, String dbPassword,
- String containerName, boolean multiDb, ValueStoragePluginProvider valueStorageProvider, int maxBufferSize,
- File swapDirectory, FileCleaner swapCleaner) throws RepositoryException
- {
- super(dbDriver, dbUrl, dbUserName, dbPassword, containerName, multiDb, valueStorageProvider, maxBufferSize,
- swapDirectory, swapCleaner);
- }
-
- /**
- * SybaseConnectionFactory constructor.
- *
- * @param dataSource
- * - DataSource
- * @param containerName
- * - Container name (see configuration)
- * @param multiDb
- * - multidatabase state flag
- * @param valueStorageProvider
- * - external Value Storages provider
- * @param maxBufferSize
- * - Maximum buffer size (see configuration)
- * @param swapDirectory
- * - Swap directory (see configuration)
- * @param swapCleaner
- * - Swap cleaner (internal FileCleaner).
- */
- public SybaseConnectionFactory(DataSource dbDataSource, String containerName, boolean multiDb,
- ValueStoragePluginProvider valueStorageProvider, int maxBufferSize, File swapDirectory, FileCleaner swapCleaner)
- {
- super(dbDataSource, containerName, multiDb, valueStorageProvider, maxBufferSize, swapDirectory, swapCleaner);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public WorkspaceStorageConnection openConnection(boolean readOnly) throws RepositoryException
- {
- try
- {
- if (multiDb)
- {
- return new SybaseMultiDbJDBCConnection(getJdbcConnection(readOnly), readOnly, containerName,
- valueStorageProvider, maxBufferSize, swapDirectory, swapCleaner);
- }
-
- return new SybaseSingleDbJDBCConnection(getJdbcConnection(readOnly), readOnly, containerName,
- valueStorageProvider, maxBufferSize, swapDirectory, swapCleaner);
-
- }
- catch (SQLException e)
- {
- throw new RepositoryException(e);
- }
- }
-}
Deleted: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/SybaseMultiDbJDBCConnection.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/SybaseMultiDbJDBCConnection.java 2011-02-09 11:02:47 UTC (rev 3952)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/SybaseMultiDbJDBCConnection.java 2011-02-09 11:10:36 UTC (rev 3953)
@@ -1,79 +0,0 @@
-/*
- * Copyright (C) 2003-2010 eXo Platform SAS.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Affero General Public License
- * as published by the Free Software Foundation; either version 3
- * of the License, or (at your option) any later version.
- *
- * This program 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 General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see<http://www.gnu.org/licenses/>.
- */
-package org.exoplatform.services.jcr.impl.storage.jdbc.optimisation.db;
-
-import org.exoplatform.services.jcr.impl.util.io.FileCleaner;
-import org.exoplatform.services.jcr.storage.value.ValueStoragePluginProvider;
-
-import java.io.File;
-import java.sql.Connection;
-import java.sql.SQLException;
-
-/**
- * Created by The eXo Platform SAS.
- *
- * Date: 8 02 2011
- *
- * @author <a href="mailto:anatoliy.bazko@exoplatform.com.ua">Anatoliy Bazko</a>
- * @version $Id: SybaseMultiDbJDBCConnection.java 34360 2010-11-11 11:11:11Z tolusha $
- */
-public class SybaseMultiDbJDBCConnection extends MultiDbJDBCConnection
-{
- /**
- * Sybase Multidatabase JDBC Connection constructor.
- *
- * @param dbConnection
- * JDBC connection, shoudl be opened before
- * @param readOnly
- * boolean if true the dbConnection was marked as READ-ONLY.
- * @param containerName
- * Workspace Storage Container name (see configuration)
- * @param valueStorageProvider
- * External Value Storages provider
- * @param maxBufferSize
- * Maximum buffer size (see configuration)
- * @param swapDirectory
- * Swap directory File (see configuration)
- * @param swapCleaner
- * Swap cleaner (internal FileCleaner).
- * @throws SQLException
- *
- * @see org.exoplatform.services.jcr.impl.util.io.FileCleaner
- */
- public SybaseMultiDbJDBCConnection(Connection dbConnection, boolean readOnly, String containerName,
- ValueStoragePluginProvider valueStorageProvider, int maxBufferSize, File swapDirectory, FileCleaner swapCleaner)
- throws SQLException
- {
- super(dbConnection, readOnly, containerName, valueStorageProvider, maxBufferSize, swapDirectory, swapCleaner);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected void prepareQueries() throws SQLException
- {
- super.prepareQueries();
- FIND_NODES_AND_PROPERTIES =
- "select J.*, P.ID AS P_ID, P.NAME AS P_NAME, P.VERSION AS P_VERSION, P.P_TYPE, P.P_MULTIVALUED,"
- + " V.DATA, V.ORDER_NUM, V.STORAGE_DESC from JCR_SVALUE V, JCR_SITEM P"
- + " join (select A.* from"
- + " (select Row_Number() over (order by I.ID) as r__, I.ID, I.PARENT_ID, I.NAME, I.VERSION, I.I_INDEX, I.N_ORDER_NUM"
- + " from JCR_SITEM I where I.I_CLASS=1) as A where A.r__ <= ? and A.r__ > ?) J on P.PARENT_ID = J.ID"
- + " where P.I_CLASS=2 and V.PROPERTY_ID=P.ID order by J.ID";
- }
-}
Deleted: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/SybaseSingleDbJDBCConnection.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/SybaseSingleDbJDBCConnection.java 2011-02-09 11:02:47 UTC (rev 3952)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/SybaseSingleDbJDBCConnection.java 2011-02-09 11:10:36 UTC (rev 3953)
@@ -1,80 +0,0 @@
-/*
- * Copyright (C) 2003-2010 eXo Platform SAS.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Affero General Public License
- * as published by the Free Software Foundation; either version 3
- * of the License, or (at your option) any later version.
- *
- * This program 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 General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see<http://www.gnu.org/licenses/>.
- */
-package org.exoplatform.services.jcr.impl.storage.jdbc.optimisation.db;
-
-import org.exoplatform.services.jcr.impl.util.io.FileCleaner;
-import org.exoplatform.services.jcr.storage.value.ValueStoragePluginProvider;
-
-import java.io.File;
-import java.sql.Connection;
-import java.sql.SQLException;
-
-/**
- * Created by The eXo Platform SAS.
- *
- * Date: 8 02 2011
- *
- * @author <a href="mailto:anatoliy.bazko@exoplatform.com.ua">Anatoliy Bazko</a>
- * @version $Id: MSSQLSingleDbJDBCConnection.java 34360 2010-11-11 11:11:11Z tolusha $
- */
-public class SybaseSingleDbJDBCConnection extends SingleDbJDBCConnection
-{
- /**
- * Sybase Singledatabase JDBC Connection constructor.
- *
- * @param dbConnection
- * JDBC connection, should be opened before
- * @param readOnly
- * boolean if true the dbConnection was marked as READ-ONLY.
- * @param containerName
- * Workspace Storage Container name (see configuration)
- * @param valueStorageProvider
- * External Value Storages provider
- * @param maxBufferSize
- * Maximum buffer size (see configuration)
- * @param swapDirectory
- * Swap directory File (see configuration)
- * @param swapCleaner
- * Swap cleaner (internal FileCleaner).
- * @throws SQLException
- *
- * @see org.exoplatform.services.jcr.impl.util.io.FileCleaner
- */
- public SybaseSingleDbJDBCConnection(Connection dbConnection, boolean readOnly, String containerName,
- ValueStoragePluginProvider valueStorageProvider, int maxBufferSize, File swapDirectory, FileCleaner swapCleaner)
- throws SQLException
- {
- super(dbConnection, readOnly, containerName, valueStorageProvider, maxBufferSize, swapDirectory, swapCleaner);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected void prepareQueries() throws SQLException
- {
- super.prepareQueries();
- FIND_NODES_AND_PROPERTIES =
- "select J.*, P.ID AS P_ID, P.NAME AS P_NAME, P.VERSION AS P_VERSION, P.P_TYPE, P.P_MULTIVALUED,"
- + " V.DATA, V.ORDER_NUM, V.STORAGE_DESC from JCR_SVALUE V, JCR_SITEM P"
- + " join (select A.* from"
- + " (select Row_Number() over (order by I.ID) as r__, I.ID, I.PARENT_ID, I.NAME, I.VERSION, I.I_INDEX, I.N_ORDER_NUM"
- + " from JCR_SITEM I where I.CONTAINER_NAME='?' and I.I_CLASS=1) as A where A.r__ <= ? and A.r__ > ?"
- + ") J on P.PARENT_ID = J.ID"
- + " where P.I_CLASS=2 and P.CONTAINER_NAME='?' and V.PROPERTY_ID=P.ID order by J.ID";
- }
-}
13 years, 3 months
exo-jcr SVN: r3952 - jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/db.
by do-not-reply@jboss.org
Author: areshetnyak
Date: 2011-02-09 06:02:47 -0500 (Wed, 09 Feb 2011)
New Revision: 3952
Modified:
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/db/DB2SingleDbJDBCConnection.java
Log:
EXOJCR-1104 : FIND_NODES_AND_PROPERTIES query was fixed for DB2 database.
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/db/DB2SingleDbJDBCConnection.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/db/DB2SingleDbJDBCConnection.java 2011-02-09 10:54:34 UTC (rev 3951)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/db/DB2SingleDbJDBCConnection.java 2011-02-09 11:02:47 UTC (rev 3952)
@@ -73,8 +73,8 @@
+ " V.DATA, V.ORDER_NUM, V.STORAGE_DESC from JCR_SVALUE V, JCR_SITEM P"
+ " join (select A.* from"
+ " (select Row_Number() over (order by I.ID) as r__, I.ID, I.PARENT_ID, I.NAME, I.VERSION, I.I_INDEX, I.N_ORDER_NUM"
- + " from JCR_SITEM I where I.CONTAINER_NAME='?' and I.I_CLASS=1) as A where A.r__ <= ? and A.r__ > ?"
+ + " from JCR_SITEM I where I.CONTAINER_NAME=? and I.I_CLASS=1) as A where A.r__ <= ? and A.r__ > ?"
+ ") J on P.PARENT_ID = J.ID"
- + " where P.I_CLASS=2 and P.CONTAINER_NAME='?' and V.PROPERTY_ID=P.ID order by J.ID";
+ + " where P.I_CLASS=2 and P.CONTAINER_NAME=? and V.PROPERTY_ID=P.ID order by J.ID";
}
}
13 years, 3 months
exo-jcr SVN: r3951 - jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db.
by do-not-reply@jboss.org
Author: areshetnyak
Date: 2011-02-09 05:54:34 -0500 (Wed, 09 Feb 2011)
New Revision: 3951
Modified:
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/DB2SingleDbJDBCConnection.java
Log:
EXOJCR-1104 : FIND_NODES_AND_PROPERTIES query was fixed for DB2 database.
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/DB2SingleDbJDBCConnection.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/DB2SingleDbJDBCConnection.java 2011-02-09 09:34:05 UTC (rev 3950)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/DB2SingleDbJDBCConnection.java 2011-02-09 10:54:34 UTC (rev 3951)
@@ -73,8 +73,8 @@
+ " V.DATA, V.ORDER_NUM, V.STORAGE_DESC from JCR_SVALUE V, JCR_SITEM P"
+ " join (select A.* from"
+ " (select Row_Number() over (order by I.ID) as r__, I.ID, I.PARENT_ID, I.NAME, I.VERSION, I.I_INDEX, I.N_ORDER_NUM"
- + " from JCR_SITEM I where I.CONTAINER_NAME='?' and I.I_CLASS=1) as A where A.r__ <= ? and A.r__ > ?"
+ + " from JCR_SITEM I where I.CONTAINER_NAME=? and I.I_CLASS=1) as A where A.r__ <= ? and A.r__ > ?"
+ ") J on P.PARENT_ID = J.ID"
- + " where P.I_CLASS=2 and P.CONTAINER_NAME='?' and V.PROPERTY_ID=P.ID order by J.ID";
+ + " where P.I_CLASS=2 and P.CONTAINER_NAME=? and V.PROPERTY_ID=P.ID order by J.ID";
}
}
13 years, 3 months
exo-jcr SVN: r3950 - in jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc: db and 2 other directories.
by do-not-reply@jboss.org
Author: tolusha
Date: 2011-02-09 04:34:05 -0500 (Wed, 09 Feb 2011)
New Revision: 3950
Modified:
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/JDBCStorageConnection.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/db/MSSQLSingleDbJDBCConnection.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/CQJDBCStorageConnection.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/MSSQLSingleDbJDBCConnection.java
Log:
EXOJCR-1104: fix query
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/JDBCStorageConnection.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/JDBCStorageConnection.java 2011-02-08 16:34:46 UTC (rev 3949)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/JDBCStorageConnection.java 2011-02-09 09:34:05 UTC (rev 3950)
@@ -2573,10 +2573,8 @@
SortedSet<TempPropertyData> ptTempProp = tempNode.properties.get(Constants.JCR_PRIMARYTYPE.getAsString());
if (ptTempProp != null)
{
- byte[] data = ptTempProp.first().getAsByteArray();
-
- ptValue = new ByteArrayPersistedValueData(ptTempProp.first().orderNum, data);
- ptName = InternalQName.parse(new String((data != null ? data : new byte[]{}), Constants.DEFAULT_ENCODING));
+ ptValue = ((ExtendedTempPropertyData)ptTempProp.first()).vdata;
+ ptName = InternalQName.parse(new String(ptValue.getAsByteArray(), Constants.DEFAULT_ENCODING));
}
// mixins if exist in the list of properties
@@ -2588,10 +2586,10 @@
{
for (TempPropertyData mxnb : mixinsTempProps)
{
- byte[] data = mxnb.getAsByteArray();
+ ValueData vdata = ((ExtendedTempPropertyData)mxnb).vdata;
- mixinsData.add(new ByteArrayPersistedValueData(mxnb.orderNum, data));
- mixins.add(InternalQName.parse(new String(data, Constants.DEFAULT_ENCODING)));
+ mixinsData.add(vdata);
+ mixins.add(InternalQName.parse(new String(vdata.getAsByteArray(), Constants.DEFAULT_ENCODING)));
}
}
@@ -2622,14 +2620,9 @@
{
for (TempPropertyData tempProp : tempNode.properties.get(propName))
{
- ExtendedTempPropertyData extTempProp = (ExtendedTempPropertyData)tempProp;
+ ExtendedTempPropertyData exTempProp = (ExtendedTempPropertyData)tempProp;
- ValueData vdata =
- extTempProp.storage_desc == null ? readValueData(extTempProp.id, extTempProp.orderNum,
- extTempProp.version, extTempProp.data) : readValueData(identifier, extTempProp.orderNum,
- extTempProp.storage_desc);
-
- valueData.add(vdata);
+ valueData.add(exTempProp.vdata);
}
}
@@ -2681,25 +2674,22 @@
{
public int orderNum;
- public InputStream data;
+ public byte[] data;
public TempPropertyData(ResultSet item) throws SQLException
{
orderNum = item.getInt(COLUMN_VORDERNUM);
- data = item.getBinaryStream(COLUMN_VDATA);
+ readData(item);
}
- public byte[] getAsByteArray() throws IOException
+ public int compareTo(TempPropertyData o)
{
- byte[] readBuffer = new byte[data.available()];
- data.read(readBuffer);
-
- return readBuffer;
+ return orderNum - o.orderNum;
}
- public int compareTo(TempPropertyData o)
+ protected void readData(ResultSet item) throws SQLException
{
- return orderNum - o.orderNum;
+ data = item.getBytes(COLUMN_VDATA);
}
}
@@ -2716,11 +2706,13 @@
public int type;
- boolean multi;
+ public boolean multi;
public String storage_desc;
- public ExtendedTempPropertyData(ResultSet item) throws SQLException
+ public ValueData vdata;
+
+ public ExtendedTempPropertyData(ResultSet item) throws SQLException, ValueStorageNotFoundException, IOException
{
super(item);
@@ -2730,7 +2722,29 @@
type = item.getInt("P_TYPE");
multi = item.getBoolean("P_MULTIVALUED");
storage_desc = item.getString(COLUMN_VSTORAGE_DESC);
+
+ readData(item);
}
+
+ @Override
+ protected void readData(ResultSet item) throws SQLException
+ {
+ InputStream data = item.getBinaryStream(COLUMN_VDATA);
+ try
+ {
+ vdata =
+ storage_desc == null ? readValueData(id, orderNum, version, data) : readValueData(getIdentifier(id),
+ orderNum, storage_desc);
+ }
+ catch (ValueStorageNotFoundException e)
+ {
+ throw new SQLException(e);
+ }
+ catch (IOException e)
+ {
+ throw new SQLException(e);
+ }
+ }
}
/**
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/db/MSSQLSingleDbJDBCConnection.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/db/MSSQLSingleDbJDBCConnection.java 2011-02-08 16:34:46 UTC (rev 3949)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/db/MSSQLSingleDbJDBCConnection.java 2011-02-09 09:34:05 UTC (rev 3950)
@@ -73,8 +73,8 @@
+ " V.DATA, V.ORDER_NUM, V.STORAGE_DESC from JCR_SVALUE V, JCR_SITEM P"
+ " join (select A.* from"
+ " (select Row_Number() over (order by I.ID) as r__, I.ID, I.PARENT_ID, I.NAME, I.VERSION, I.I_INDEX, I.N_ORDER_NUM"
- + " from JCR_SITEM I where I.CONTAINER_NAME='?' and I.I_CLASS=1) as A where A.r__ <= ? and A.r__ > ?"
+ + " from JCR_SITEM I where I.CONTAINER_NAME=? and I.I_CLASS=1) as A where A.r__ <= ? and A.r__ > ?"
+ ") J on P.PARENT_ID = J.ID"
- + " where P.I_CLASS=2 and P.CONTAINER_NAME='?' and V.PROPERTY_ID=P.ID order by J.ID";
+ + " where P.I_CLASS=2 and P.CONTAINER_NAME=? and V.PROPERTY_ID=P.ID order by J.ID";
}
}
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/CQJDBCStorageConnection.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/CQJDBCStorageConnection.java 2011-02-08 16:34:46 UTC (rev 3949)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/CQJDBCStorageConnection.java 2011-02-09 09:34:05 UTC (rev 3950)
@@ -313,8 +313,7 @@
{
for (TempPropertyData value : permValues)
{
- StringTokenizer parser =
- new StringTokenizer(new String(value.getAsByteArray()), AccessControlEntry.DELIMITER);
+ StringTokenizer parser = new StringTokenizer(new String(value.data), AccessControlEntry.DELIMITER);
naPermissions.add(new AccessControlEntry(parser.nextToken(), parser.nextToken()));
}
@@ -338,7 +337,7 @@
{
SortedSet<TempPropertyData> ownerValues = properties.get(Constants.EXO_OWNER.getAsString());
if (ownerValues != null)
- return new String(ownerValues.first().getAsByteArray());
+ return new String(ownerValues.first().data);
else
throw new IllegalACLException("Property exo:owner is not found for node with id: " + getIdentifier(cid));
}
@@ -447,7 +446,7 @@
+ qpath.getAsString() + ", id " + cid + ", container " + this.containerName, null);
}
- byte[] data = primaryType.first().getAsByteArray();
+ byte[] data = primaryType.first().data;
InternalQName ptName = InternalQName.parse(new String((data != null ? data : new byte[]{})));
// MIXIN
@@ -460,7 +459,7 @@
List<InternalQName> mNames = new ArrayList<InternalQName>();
for (TempPropertyData mxnb : mixTypes)
{
- InternalQName mxn = InternalQName.parse(new String(mxnb.getAsByteArray()));
+ InternalQName mxn = InternalQName.parse(new String(mxnb.data));
mNames.add(mxn);
if (!privilegeable && Constants.EXO_PRIVILEGEABLE.equals(mxn))
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/MSSQLSingleDbJDBCConnection.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/MSSQLSingleDbJDBCConnection.java 2011-02-08 16:34:46 UTC (rev 3949)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/MSSQLSingleDbJDBCConnection.java 2011-02-09 09:34:05 UTC (rev 3950)
@@ -73,8 +73,8 @@
+ " V.DATA, V.ORDER_NUM, V.STORAGE_DESC from JCR_SVALUE V, JCR_SITEM P"
+ " join (select A.* from"
+ " (select Row_Number() over (order by I.ID) as r__, I.ID, I.PARENT_ID, I.NAME, I.VERSION, I.I_INDEX, I.N_ORDER_NUM"
- + " from JCR_SITEM I where I.CONTAINER_NAME='?' and I.I_CLASS=1) as A where A.r__ <= ? and A.r__ > ?"
- + ") J on P.PARENT_ID = J.ID"
- + " where P.I_CLASS=2 and P.CONTAINER_NAME='?' and V.PROPERTY_ID=P.ID order by J.ID";
+ + " from JCR_SITEM I where I.CONTAINER_NAME=? and I.I_CLASS=1) as A where A.r__ <= ? and A.r__ > ?"
+ + " ) J on P.PARENT_ID = J.ID"
+ + " where P.I_CLASS=2 and P.CONTAINER_NAME=? and V.PROPERTY_ID=P.ID order by J.ID";
}
}
13 years, 3 months
exo-jcr SVN: r3949 - in core/branches/2.3.x/patch: 2.3.8 and 1 other directories.
by do-not-reply@jboss.org
Author: tolusha
Date: 2011-02-08 11:34:46 -0500 (Tue, 08 Feb 2011)
New Revision: 3949
Added:
core/branches/2.3.x/patch/2.3.8/
core/branches/2.3.x/patch/2.3.8/COR-228/
core/branches/2.3.x/patch/2.3.8/COR-228/COR-228.patch
Log:
COR-228: patch proposed
Added: core/branches/2.3.x/patch/2.3.8/COR-228/COR-228.patch
===================================================================
--- core/branches/2.3.x/patch/2.3.8/COR-228/COR-228.patch (rev 0)
+++ core/branches/2.3.x/patch/2.3.8/COR-228/COR-228.patch 2011-02-08 16:34:46 UTC (rev 3949)
@@ -0,0 +1,615 @@
+Index: exo.core.component.document/src/main/java/org/exoplatform/services/document/impl/PDFDocumentReader.java
+===================================================================
+--- exo.core.component.document/src/main/java/org/exoplatform/services/document/impl/PDFDocumentReader.java (revision 3930)
++++ exo.core.component.document/src/main/java/org/exoplatform/services/document/impl/PDFDocumentReader.java (working copy)
+@@ -18,37 +18,30 @@
+ */
+ package org.exoplatform.services.document.impl;
+
+-import com.lowagie.text.pdf.PdfDate;
+-import com.lowagie.text.pdf.PdfReader;
+-
++import org.apache.jempbox.xmp.XMPMetadata;
++import org.apache.jempbox.xmp.XMPSchemaBasic;
++import org.apache.jempbox.xmp.XMPSchemaDublinCore;
++import org.apache.pdfbox.exceptions.InvalidPasswordException;
+ import org.apache.pdfbox.pdmodel.PDDocument;
++import org.apache.pdfbox.pdmodel.PDDocumentCatalog;
++import org.apache.pdfbox.pdmodel.PDDocumentInformation;
++import org.apache.pdfbox.pdmodel.common.PDMetadata;
+ import org.apache.pdfbox.util.PDFTextStripper;
+-import org.exoplatform.commons.utils.ISO8601;
+ import org.exoplatform.services.document.DCMetaData;
+ import org.exoplatform.services.document.DocumentReadException;
+ import org.exoplatform.services.log.ExoLogger;
+ import org.exoplatform.services.log.Log;
+-import org.w3c.dom.Document;
+-import org.w3c.dom.Node;
+-import org.w3c.dom.NodeList;
+-import org.xml.sax.SAXException;
+
+-import java.io.ByteArrayInputStream;
+ import java.io.IOException;
+ import java.io.InputStream;
+ import java.io.StringWriter;
+ import java.security.AccessController;
+ import java.security.PrivilegedActionException;
+ import java.security.PrivilegedExceptionAction;
+-import java.text.ParseException;
+ import java.util.Calendar;
+-import java.util.HashMap;
++import java.util.List;
+ import java.util.Properties;
+
+-import javax.xml.parsers.DocumentBuilder;
+-import javax.xml.parsers.DocumentBuilderFactory;
+-import javax.xml.parsers.ParserConfigurationException;
+-
+ /**
+ * Created by The eXo Platform SAS A parser of Adobe PDF files.
+ *
+@@ -168,204 +161,186 @@
+ */
+ public Properties getProperties(InputStream is) throws IOException, DocumentReadException
+ {
+-
+- Properties props = null;
+-
+- PdfReader reader = new PdfReader(is, "".getBytes());
+-
+- // Read the file metadata
+- byte[] metadata = reader.getMetadata();
+-
+- if (metadata != null)
+- {
+- // there is XMP metadata try exctract it
+- props = getPropertiesFromMetadata(metadata);
+- }
+-
+- if (props == null)
+- {
+- // it's old pdf document version
+- props = getPropertiesFromInfo(reader.getInfo());
+- }
+- reader.close();
+- if (is != null)
+- try
+- {
+- is.close();
+- }
+- catch (IOException e)
+- {
+- }
+- return props;
+- }
+-
+- /**
+- * Extract properties from XMP xml.
+- *
+- * @param metadata XML as byte array
+- * @return extracted properties
+- * @throws DocumentReadException
+- * @throws Exception if extracting fails
+- */
+- protected Properties getPropertiesFromMetadata(byte[] metadata) throws IOException, DocumentReadException
+- {
+-
+- Properties props = null;
+-
+- // parse xml
+-
+- Document doc;
++ PDDocument pdDocument = PDDocument.load(is);
++ Properties props = new Properties();
+ try
+ {
+- DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+- DocumentBuilder docBuilder = dbf.newDocumentBuilder();
+- doc = docBuilder.parse(new ByteArrayInputStream(metadata));
+- }
+- catch (SAXException e)
+- {
+- throw new DocumentReadException(e.getMessage(), e);
+- }
+- catch (ParserConfigurationException e)
+- {
+- throw new DocumentReadException(e.getMessage(), e);
+- }
+-
+- // Check is there PDF/A-1 XMP
+- String version = "";
+- NodeList list = doc.getElementsByTagName("pdfaid:conformance");
+- if (list != null && list.item(0) != null)
+- {
+- version += list.item(0).getTextContent() + "-";
+- }
+-
+- list = doc.getElementsByTagName("pdfaid:part");
+- if (list != null && list.item(0) != null)
+- {
+- version += list.item(0).getTextContent();
+- }
+-
+- // PDF/A-1a or PDF/A-1b
+- if (version.equalsIgnoreCase("A-1"))
+- {
+- props = getPropsFromPDFAMetadata(doc);
+- }
+-
+- return props;
+- }
+-
+- /**
+- * Extracts properties from PDF Info hash set.
+- *
+- * @param Pdf Info hash set
+- * @return Extracted properties
+- * @throws Exception if extracting fails
+- */
+- @SuppressWarnings("unchecked")
+- protected Properties getPropertiesFromInfo(HashMap info) throws IOException
+- {
+- Properties props = new Properties();
+-
+- String title = (String)info.get("Title");
+- if (title != null)
+- {
+- props.put(DCMetaData.TITLE, title);
+- }
+-
+- String author = (String)info.get("Author");
+- if (author != null)
+- {
+- props.put(DCMetaData.CREATOR, author);
+- }
+-
+- String subject = (String)info.get("Subject");
+- if (subject != null)
+- {
+- props.put(DCMetaData.SUBJECT, subject);
+- }
+-
+- String creationDate = (String)info.get("CreationDate");
+- if (creationDate != null)
+- {
+- props.put(DCMetaData.DATE, PdfDate.decode(creationDate));
+- }
+-
+- String modDate = (String)info.get("ModDate");
+- if (modDate != null)
+- {
+- props.put(DCMetaData.DATE, PdfDate.decode(modDate));
+- }
+-
+- return props;
+- }
+-
+- private Properties getPropsFromPDFAMetadata(Document doc) throws IOException, DocumentReadException
+- {
+- Properties props = new Properties();
+- // get properties
+- NodeList list = doc.getElementsByTagName("rdf:li");
+- if (list != null && list.getLength() > 0)
+- {
+- for (int i = 0; i < list.getLength(); i++)
++ if (pdDocument.isEncrypted())
+ {
+-
+- Node n = list.item(i);
+- // dc:title - TITLE
+- if (n.getParentNode().getParentNode().getNodeName().equals("dc:title"))
++ try
+ {
+- String title = n.getLastChild().getTextContent();
+- props.put(DCMetaData.TITLE, title);
++ pdDocument.decrypt("");
+ }
+-
+- // dc:creator - CREATOR
+- if (n.getParentNode().getParentNode().getNodeName().equals("dc:creator"))
++ catch (InvalidPasswordException e)
+ {
+- String author = n.getLastChild().getTextContent();
+- props.put(DCMetaData.CREATOR, author);
++ throw new DocumentReadException("The pdf document is encrypted.", e);
+ }
+-
+- // DC:description - SUBJECT
+- if (n.getParentNode().getParentNode().getNodeName().equals("dc:description"))
++ catch (org.apache.pdfbox.exceptions.CryptographyException e)
+ {
+- String description = n.getLastChild().getTextContent();
+- props.put(DCMetaData.SUBJECT, description);
+- // props.put(DCMetaData.DESCRIPTION, description);
++ throw new DocumentReadException(e.getMessage(), e);
+ }
+ }
+- }
+
+- try
+- {
+- // xmp:CreateDate - DATE
+- list = doc.getElementsByTagName("xmp:CreateDate");
+- if (list != null && list.item(0) != null)
++ PDDocumentCatalog catalog = pdDocument.getDocumentCatalog();
++ PDMetadata meta = catalog.getMetadata();
++ if (meta != null)
+ {
+- Node creationDateNode = list.item(0).getLastChild();
+- if (creationDateNode != null)
++ XMPMetadata metadata = meta.exportXMPMetadata();
++
++ XMPSchemaDublinCore dc = metadata.getDublinCoreSchema();
++ if (dc != null)
+ {
+- String creationDate = creationDateNode.getTextContent();
+- Calendar c = ISO8601.parseEx(creationDate);
+- props.put(DCMetaData.DATE, c);
++ try
++ {
++ if (dc.getTitle() != null)
++ props.put(DCMetaData.TITLE, dc.getTitle());
++ }
++ catch (Exception e)
++ {
++ log.warn("getTitle failed: " + e);
++ }
++ try
++ {
++ if (dc.getDescription() != null)
++ props.put(DCMetaData.SUBJECT, dc.getDescription());
++ }
++ catch (Exception e)
++ {
++ log.warn("getSubject failed: " + e);
++ }
++
++ try
++ {
++ if (dc.getCreators() != null)
++ {
++ List<String> list = dc.getCreators();
++ for (String creator : list)
++ {
++ props.put(DCMetaData.CREATOR, creator);
++ }
++ }
++ }
++ catch (Exception e)
++ {
++ log.warn("getCreator failed: " + e);
++ }
++
++ try
++ {
++ if (dc.getDates() != null)
++ {
++ List<Calendar> list = dc.getDates();
++
++ for (Calendar date : list)
++ {
++ props.put(DCMetaData.DATE, date);
++ }
++ }
++ }
++ catch (Exception e)
++ {
++ log.warn("getDate failed: " + e);
++ }
+ }
++
++ XMPSchemaBasic basic = metadata.getBasicSchema();
++ if (basic != null)
++ {
++ try
++ {
++ if (basic.getCreateDate() != null)
++ props.put(DCMetaData.DATE, basic.getCreateDate());
++ }
++ catch (Exception e)
++ {
++ log.warn("getCreationDate failed: " + e);
++ }
++ try
++ {
++ if (basic.getModifyDate() != null)
++ props.put(DCMetaData.DATE, basic.getModifyDate());
++ }
++ catch (Exception e)
++ {
++ log.warn("getModificationDate failed: " + e);
++ }
++ }
+ }
+
+- // xmp:ModifyDate - DATE
+- list = doc.getElementsByTagName("xmp:ModifyDate");
+- if (list != null && list.item(0) != null)
++ if (props.isEmpty())
+ {
+- Node modifyDateNode = list.item(0).getLastChild();
+- if (modifyDateNode != null)
++ // The pdf doesn't contain any XMP metadata or XMP metadata do not contains any
++ // usefull data, try to use the document information instead
++ PDDocumentInformation docInfo = pdDocument.getDocumentInformation();
++
++ if (docInfo != null)
+ {
+- String modifyDate = modifyDateNode.getTextContent();
+- Calendar c = ISO8601.parseEx(modifyDate);
+- props.put(DCMetaData.DATE, c);
++ try
++ {
++ if (docInfo.getCreationDate() != null)
++ props.put(DCMetaData.DATE, docInfo.getCreationDate());
++ }
++ catch (Exception e)
++ {
++ log.warn("getCreationDate failed: " + e);
++ }
++ try
++ {
++ if (docInfo.getCreator() != null)
++ props.put(DCMetaData.CREATOR, docInfo.getCreator());
++ }
++ catch (Exception e)
++ {
++ log.warn("getCreator failed: " + e);
++ }
++ try
++ {
++
++ if (docInfo.getKeywords() != null)
++ props.put(DCMetaData.SUBJECT, docInfo.getKeywords());
++ }
++ catch (Exception e)
++ {
++ log.warn("getKeywords failed: " + e);
++ }
++ try
++ {
++ if (docInfo.getModificationDate() != null)
++ props.put(DCMetaData.DATE, docInfo.getModificationDate());
++ }
++ catch (Exception e)
++ {
++ log.warn("getModificationDate failed: " + e);
++ }
++ try
++ {
++ if (docInfo.getSubject() != null)
++ props.put(DCMetaData.DESCRIPTION, docInfo.getSubject());
++ }
++ catch (Exception e)
++ {
++ log.warn("getSubject failed: " + e);
++ }
++ try
++ {
++ if (docInfo.getTitle() != null)
++ props.put(DCMetaData.TITLE, docInfo.getTitle());
++ }
++ catch (Exception e)
++ {
++ log.warn("getTitle failed: " + e);
++ }
+ }
+ }
+ }
+- catch (ParseException e)
++ finally
+ {
+- throw new DocumentReadException(e.getMessage(), e);
++ if (pdDocument != null)
++ {
++ pdDocument.close();
++ }
+ }
++
+ return props;
+ }
+-
+ }
+Index: exo.core.component.document/src/test/java/org/exoplatform/services/document/test/TestPropertiesExtracting.java
+===================================================================
+--- exo.core.component.document/src/test/java/org/exoplatform/services/document/test/TestPropertiesExtracting.java (revision 3930)
++++ exo.core.component.document/src/test/java/org/exoplatform/services/document/test/TestPropertiesExtracting.java (working copy)
+@@ -18,7 +18,6 @@
+ */
+ package org.exoplatform.services.document.test;
+
+-import org.exoplatform.commons.utils.ISO8601;
+ import org.exoplatform.services.document.DCMetaData;
+ import org.exoplatform.services.document.DocumentReader;
+ import org.exoplatform.services.document.DocumentReaderService;
+@@ -41,20 +40,48 @@
+ service = (DocumentReaderService)getComponentInstanceOfType(DocumentReaderService.class);
+ }
+
++ public void testPDFDocumentReaderService() throws Exception
++ {
++ InputStream is = TestPropertiesExtracting.class.getResourceAsStream("/test.pdf");
++ DocumentReader rdr = service.getDocumentReader("application/pdf");
++ Properties props = rdr.getProperties(is);
++ assertTrue(props.isEmpty());
++
++ // Properties etalon = new Properties();
++ // etalon.put(DCMetaData.PUBLISHER, "FOP 0.20.4");
++ // evalProps(etalon, props, false);
++ }
++
+ public void testPDFDocumentReaderServiceXMPMetadata() throws Exception
+ {
+ InputStream is = TestPropertiesExtracting.class.getResourceAsStream("/MyTest.pdf");
++ DocumentReader rdr = service.getDocumentReader("application/pdf");
++
++ Properties testprops = rdr.getProperties(is);
++ // printProps(testprops);
++
++ Properties etalon = new Properties();
++ etalon.put(DCMetaData.TITLE, "Test de convertion de fichier tif");
++ etalon.put(DCMetaData.CREATOR, "Christian Klaus");
++ etalon.put(DCMetaData.SUBJECT, "20080901 TEST Christian Etat OK");
++ // Calendar c = ISO8601.parseEx("2008-09-01T08:01:10+00:00");
++ // etalon.put(DCMetaData.DATE, c);
++
++ evalProps(etalon, testprops, false);
++ }
++
++ public void testPDFDocumentReaderServiceBrokenFile() throws Exception
++ {
++ InputStream is = TestPropertiesExtracting.class.getResourceAsStream("/pfs_accapp.pdf");
+ try
+ {
++
+ DocumentReader rdr = service.getDocumentReader("application/pdf");
+ Properties testprops = rdr.getProperties(is);
+ Properties etalon = new Properties();
+- etalon.put(DCMetaData.TITLE, "Test de convertion de fichier tif");
+- etalon.put(DCMetaData.CREATOR, "Christian Klaus");
+- etalon.put(DCMetaData.SUBJECT, "20080901 TEST Christian Etat OK");
+- Calendar c = ISO8601.parseEx("2008-09-01T08:01:10+00:00");
+- etalon.put(DCMetaData.DATE, c);
+- evalProps(etalon, testprops);
++ etalon.put(DCMetaData.TITLE, "Personal Account Opening Form VN");
++ etalon.put(DCMetaData.CREATOR, "mr");
++ evalProps(etalon, testprops, false);
+ }
+ finally
+ {
+@@ -62,6 +89,25 @@
+ }
+ }
+
++ public void testPDFDocumentReaderServiceMetro() throws Exception
++ {
++ InputStream is = TestPropertiesExtracting.class.getResourceAsStream("/metro.pdf");
++ try
++ {
++
++ DocumentReader rdr = service.getDocumentReader("application/pdf");
++ Properties testprops = rdr.getProperties(is);
++ Properties etalon = new Properties();
++ etalon.put(DCMetaData.TITLE, "metro");
++ etalon.put(DCMetaData.CREATOR, "Preview");
++ evalProps(etalon, testprops, false);
++ }
++ finally
++ {
++ is.close();
++ }
++ }
++
+ public void testWordDocumentReaderService() throws Exception
+ {
+ InputStream is = TestPropertiesExtracting.class.getResourceAsStream("/test.doc");
+@@ -75,7 +121,7 @@
+ etalon.put(DCMetaData.CREATOR, "Max Yakimenko");
+ etalon.put(DCMetaData.CONTRIBUTOR, "Max Yakimenko");
+ etalon.put(DCMetaData.DESCRIPTION, "test-Comments");
+- evalProps(etalon, props);
++ evalProps(etalon, props, true);
+ }
+ finally
+ {
+@@ -96,7 +142,7 @@
+ etalon.put(DCMetaData.CREATOR, "Max Yakimenko");
+ etalon.put(DCMetaData.CONTRIBUTOR, "Max Yakimenko");
+ etalon.put(DCMetaData.DESCRIPTION, "test-Comments");
+- evalProps(etalon, props);
++ evalProps(etalon, props, true);
+ }
+ finally
+ {
+@@ -118,7 +164,7 @@
+ etalon.put(DCMetaData.CONTRIBUTOR, "Max Yakimenko");
+ etalon.put(DCMetaData.DESCRIPTION, "test-Comments");
+
+- evalProps(etalon, props);
++ evalProps(etalon, props, true);
+ }
+ finally
+ {
+@@ -146,7 +192,7 @@
+ etalon.put(DCMetaData.CONTRIBUTOR, "Max Yakimenko");
+ etalon.put(DCMetaData.DESCRIPTION, "test-Comments");
+
+- evalProps(etalon, props);
++ evalProps(etalon, props, true);
+ }
+ finally
+ {
+@@ -174,7 +220,7 @@
+ etalon.put(DCMetaData.CONTRIBUTOR, "Max Yakimenko");
+ etalon.put(DCMetaData.DESCRIPTION, "test-Comments");
+
+- evalProps(etalon, props);
++ evalProps(etalon, props, true);
+ }
+ finally
+ {
+@@ -202,7 +248,7 @@
+ etalon.put(DCMetaData.CONTRIBUTOR, "Max Yakimenko");
+ etalon.put(DCMetaData.DESCRIPTION, "test-Comments");
+
+- evalProps(etalon, props);
++ evalProps(etalon, props, true);
+ }
+ finally
+ {
+@@ -228,7 +274,7 @@
+ etalon.put(DCMetaData.CREATOR, "nikolaz ");
+ etalon.put(DCMetaData.DESCRIPTION, "test-Comments");
+
+- evalProps(etalon, props);
++ evalProps(etalon, props, true);
+ }
+ finally
+ {
+@@ -236,7 +282,7 @@
+ }
+ }
+
+- private void evalProps(Properties etalon, Properties testedProps)
++ private void evalProps(Properties etalon, Properties testedProps, boolean testSize)
+ {
+ Iterator it = etalon.entrySet().iterator();
+ while (it.hasNext())
+@@ -244,13 +290,12 @@
+ Map.Entry prop = (Map.Entry)it.next();
+ Object tval = testedProps.get(prop.getKey());
+ assertNotNull(prop.getKey() + " property not founded. ", tval);
+- if (tval instanceof Date)
+- {
+- System.out.println("was:" + ((Date)tval).getTime() + " expected: " + ((Date)prop.getValue()).getTime());
+- }
+ assertEquals(prop.getKey() + " property value is incorrect", prop.getValue(), tval);
+ }
+- assertEquals("size is incorrect", etalon.size(), testedProps.size());
++ if (testSize)
++ {
++ assertEquals("size is incorrect", etalon.size(), testedProps.size());
++ }
+ }
+
+ }
+Index: exo.core.component.document/src/test/resources/metro.pdf
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+
+Property changes on: exo.core.component.document\src\test\resources\metro.pdf
+___________________________________________________________________
+Added: svn:mime-type
+ + application/octet-stream
+
+Index: exo.core.component.document/src/test/resources/pfs_accapp.pdf
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+
+Property changes on: exo.core.component.document\src\test\resources\pfs_accapp.pdf
+___________________________________________________________________
+Added: svn:mime-type
+ + application/octet-stream
+
13 years, 3 months
exo-jcr SVN: r3948 - in jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc: db and 2 other directories.
by do-not-reply@jboss.org
Author: tolusha
Date: 2011-02-08 09:04:56 -0500 (Tue, 08 Feb 2011)
New Revision: 3948
Added:
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/db/DB2ConnectionFactory.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/db/DB2MultiDbJDBCConnection.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/db/DB2SingleDbJDBCConnection.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/DB2ConnectionFactory.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/DB2MultiDbJDBCConnection.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/DB2SingleDbJDBCConnection.java
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/optimisation/CQJDBCWorkspaceDataContainer.java
Log:
EXOJCR-1104: add DB2 support
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 2011-02-08 13:47:24 UTC (rev 3947)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/JDBCWorkspaceDataContainer.java 2011-02-08 14:04:56 UTC (rev 3948)
@@ -42,6 +42,7 @@
import org.exoplatform.services.jcr.impl.dataflow.serialization.ObjectReaderImpl;
import org.exoplatform.services.jcr.impl.dataflow.serialization.ObjectWriterImpl;
import org.exoplatform.services.jcr.impl.storage.WorkspaceDataContainerBase;
+import org.exoplatform.services.jcr.impl.storage.jdbc.db.DB2ConnectionFactory;
import org.exoplatform.services.jcr.impl.storage.jdbc.db.DefaultOracleConnectionFactory;
import org.exoplatform.services.jcr.impl.storage.jdbc.db.GenericConnectionFactory;
import org.exoplatform.services.jcr.impl.storage.jdbc.db.HSQLDBConnectionFactory;
@@ -783,13 +784,53 @@
}
else if (dbDialect == DBConstants.DB_DIALECT_DB2)
{
- this.connFactory = defaultConnectionFactory();
+ if (dbSourceName != null)
+ {
+ DataSource ds = (DataSource)new InitialContext().lookup(dbSourceName);
+ if (ds != null)
+ {
+ this.connFactory =
+ new DB2ConnectionFactory(ds, containerName, multiDb, valueStorageProvider, maxBufferSize,
+ swapDirectory, swapCleaner);
+ }
+ else
+ {
+ throw new RepositoryException("Datasource '" + dbSourceName + "' is not bound in this context.");
+ }
+ }
+ else
+ {
+ this.connFactory =
+ new DB2ConnectionFactory(dbDriver, dbUrl, dbUserName, dbPassword, containerName, multiDb,
+ valueStorageProvider, maxBufferSize, swapDirectory, swapCleaner);
+ }
+
sqlPath = "/conf/storage/jcr-" + (multiDb ? "m" : "s") + "jdbc.db2.sql";
dbInitilizer = defaultDBInitializer(sqlPath);
}
else if (dbDialect == DBConstants.DB_DIALECT_DB2V8)
{
- this.connFactory = defaultConnectionFactory();
+ if (dbSourceName != null)
+ {
+ DataSource ds = (DataSource)new InitialContext().lookup(dbSourceName);
+ if (ds != null)
+ {
+ this.connFactory =
+ new DB2ConnectionFactory(ds, containerName, multiDb, valueStorageProvider, maxBufferSize,
+ swapDirectory, swapCleaner);
+ }
+ else
+ {
+ throw new RepositoryException("Datasource '" + dbSourceName + "' is not bound in this context.");
+ }
+ }
+ else
+ {
+ this.connFactory =
+ new DB2ConnectionFactory(dbDriver, dbUrl, dbUserName, dbPassword, containerName, multiDb,
+ valueStorageProvider, maxBufferSize, swapDirectory, swapCleaner);
+ }
+
sqlPath = "/conf/storage/jcr-" + (multiDb ? "m" : "s") + "jdbc.db2v8.sql";
dbInitilizer = defaultDBInitializer(sqlPath);
}
Added: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/db/DB2ConnectionFactory.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/db/DB2ConnectionFactory.java (rev 0)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/db/DB2ConnectionFactory.java 2011-02-08 14:04:56 UTC (rev 3948)
@@ -0,0 +1,125 @@
+/*
+ * Copyright (C) 2009 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.db;
+
+import org.exoplatform.services.jcr.impl.util.io.FileCleaner;
+import org.exoplatform.services.jcr.storage.WorkspaceStorageConnection;
+import org.exoplatform.services.jcr.storage.value.ValueStoragePluginProvider;
+
+import java.io.File;
+import java.sql.SQLException;
+
+import javax.jcr.RepositoryException;
+import javax.sql.DataSource;
+
+/**
+ * Created by The eXo Platform SAS.
+ *
+ * Date: 8 02 2011
+ *
+ * @author <a href="mailto:anatoliy.bazko@exoplatform.com.ua">Anatoliy Bazko</a>
+ * @version $Id: DB2ConnectionFactory.java 34360 2010-11-11 11:11:11Z tolusha $
+ */
+public class DB2ConnectionFactory extends GenericConnectionFactory
+{
+
+ /**
+ * DB2ConnectionFactory constructor.
+ *
+ * @param dataSource
+ * - DataSource
+ * @param dbDriver
+ * - JDBC Driver
+ * @param dbUrl
+ * - JDBC URL
+ * @param dbUserName
+ * - database username
+ * @param dbPassword
+ * - database user password
+ * @param containerName
+ * - Container name (see configuration)
+ * @param multiDb
+ * - multidatabase state flag
+ * @param valueStorageProvider
+ * - external Value Storages provider
+ * @param maxBufferSize
+ * - Maximum buffer size (see configuration)
+ * @param swapDirectory
+ * - Swap directory (see configuration)
+ * @param swapCleaner
+ * - Swap cleaner (internal FileCleaner).
+ * @throws RepositoryException
+ * if error eccurs
+ */
+ public DB2ConnectionFactory(String dbDriver, String dbUrl, String dbUserName, String dbPassword,
+ String containerName, boolean multiDb, ValueStoragePluginProvider valueStorageProvider, int maxBufferSize,
+ File swapDirectory, FileCleaner swapCleaner) throws RepositoryException
+ {
+ super(dbDriver, dbUrl, dbUserName, dbPassword, containerName, multiDb, valueStorageProvider, maxBufferSize,
+ swapDirectory, swapCleaner);
+ }
+
+ /**
+ * DB2ConnectionFactory constructor.
+ *
+ * @param dataSource
+ * - DataSource
+ * @param containerName
+ * - Container name (see configuration)
+ * @param multiDb
+ * - multidatabase state flag
+ * @param valueStorageProvider
+ * - external Value Storages provider
+ * @param maxBufferSize
+ * - Maximum buffer size (see configuration)
+ * @param swapDirectory
+ * - Swap directory (see configuration)
+ * @param swapCleaner
+ * - Swap cleaner (internal FileCleaner).
+ */
+ public DB2ConnectionFactory(DataSource dbDataSource, String containerName, boolean multiDb,
+ ValueStoragePluginProvider valueStorageProvider, int maxBufferSize, File swapDirectory, FileCleaner swapCleaner)
+ {
+ super(dbDataSource, containerName, multiDb, valueStorageProvider, maxBufferSize, swapDirectory, swapCleaner);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public WorkspaceStorageConnection openConnection(boolean readOnly) throws RepositoryException
+ {
+ try
+ {
+ if (multiDb)
+ {
+ return new DB2MultiDbJDBCConnection(getJdbcConnection(readOnly), readOnly, containerName,
+ valueStorageProvider, maxBufferSize, swapDirectory, swapCleaner);
+ }
+
+ return new DB2SingleDbJDBCConnection(getJdbcConnection(readOnly), readOnly, containerName,
+ valueStorageProvider, maxBufferSize, swapDirectory, swapCleaner);
+
+ }
+ catch (SQLException e)
+ {
+ throw new RepositoryException(e);
+ }
+ }
+}
Added: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/db/DB2MultiDbJDBCConnection.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/db/DB2MultiDbJDBCConnection.java (rev 0)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/db/DB2MultiDbJDBCConnection.java 2011-02-08 14:04:56 UTC (rev 3948)
@@ -0,0 +1,79 @@
+/*
+ * Copyright (C) 2003-2010 eXo Platform SAS.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Affero General Public License
+ * as published by the Free Software Foundation; either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, see<http://www.gnu.org/licenses/>.
+ */
+package org.exoplatform.services.jcr.impl.storage.jdbc.db;
+
+import org.exoplatform.services.jcr.impl.util.io.FileCleaner;
+import org.exoplatform.services.jcr.storage.value.ValueStoragePluginProvider;
+
+import java.io.File;
+import java.sql.Connection;
+import java.sql.SQLException;
+
+/**
+ * Created by The eXo Platform SAS.
+ *
+ * Date: 8 02 2011
+ *
+ * @author <a href="mailto:anatoliy.bazko@exoplatform.com.ua">Anatoliy Bazko</a>
+ * @version $Id: DB2MultiDbJDBCConnection.ajva 34360 2010-11-11 11:11:11Z tolusha $
+ */
+public class DB2MultiDbJDBCConnection extends MultiDbJDBCConnection
+{
+ /**
+ * DB2 Multidatabase JDBC Connection constructor.
+ *
+ * @param dbConnection
+ * JDBC connection, shoudl be opened before
+ * @param readOnly
+ * boolean if true the dbConnection was marked as READ-ONLY.
+ * @param containerName
+ * Workspace Storage Container name (see configuration)
+ * @param valueStorageProvider
+ * External Value Storages provider
+ * @param maxBufferSize
+ * Maximum buffer size (see configuration)
+ * @param swapDirectory
+ * Swap directory File (see configuration)
+ * @param swapCleaner
+ * Swap cleaner (internal FileCleaner).
+ * @throws SQLException
+ *
+ * @see org.exoplatform.services.jcr.impl.util.io.FileCleaner
+ */
+ public DB2MultiDbJDBCConnection(Connection dbConnection, boolean readOnly, String containerName,
+ ValueStoragePluginProvider valueStorageProvider, int maxBufferSize, File swapDirectory, FileCleaner swapCleaner)
+ throws SQLException
+ {
+ super(dbConnection, readOnly, containerName, valueStorageProvider, maxBufferSize, swapDirectory, swapCleaner);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected void prepareQueries() throws SQLException
+ {
+ super.prepareQueries();
+ FIND_NODES_AND_PROPERTIES =
+ "select J.*, P.ID AS P_ID, P.NAME AS P_NAME, P.VERSION AS P_VERSION, P.P_TYPE, P.P_MULTIVALUED,"
+ + " V.DATA, V.ORDER_NUM, V.STORAGE_DESC from JCR_SVALUE V, JCR_SITEM P"
+ + " join (select A.* from"
+ + " (select Row_Number() over (order by I.ID) as r__, I.ID, I.PARENT_ID, I.NAME, I.VERSION, I.I_INDEX, I.N_ORDER_NUM"
+ + " from JCR_SITEM I where I.I_CLASS=1) as A where A.r__ <= ? and A.r__ > ?) J on P.PARENT_ID = J.ID"
+ + " where P.I_CLASS=2 and V.PROPERTY_ID=P.ID order by J.ID";
+ }
+}
Added: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/db/DB2SingleDbJDBCConnection.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/db/DB2SingleDbJDBCConnection.java (rev 0)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/db/DB2SingleDbJDBCConnection.java 2011-02-08 14:04:56 UTC (rev 3948)
@@ -0,0 +1,80 @@
+/*
+ * Copyright (C) 2003-2010 eXo Platform SAS.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Affero General Public License
+ * as published by the Free Software Foundation; either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, see<http://www.gnu.org/licenses/>.
+ */
+package org.exoplatform.services.jcr.impl.storage.jdbc.db;
+
+import org.exoplatform.services.jcr.impl.util.io.FileCleaner;
+import org.exoplatform.services.jcr.storage.value.ValueStoragePluginProvider;
+
+import java.io.File;
+import java.sql.Connection;
+import java.sql.SQLException;
+
+/**
+ * Created by The eXo Platform SAS.
+ *
+ * Date: 8 02 2011
+ *
+ * @author <a href="mailto:anatoliy.bazko@exoplatform.com.ua">Anatoliy Bazko</a>
+ * @version $Id: MSSQLSingleDbJDBCConnection.java 34360 2010-11-11 11:11:11Z tolusha $
+ */
+public class DB2SingleDbJDBCConnection extends SingleDbJDBCConnection
+{
+ /**
+ * Sybase Singledatabase JDBC Connection constructor.
+ *
+ * @param dbConnection
+ * JDBC connection, should be opened before
+ * @param readOnly
+ * boolean if true the dbConnection was marked as READ-ONLY.
+ * @param containerName
+ * Workspace Storage Container name (see configuration)
+ * @param valueStorageProvider
+ * External Value Storages provider
+ * @param maxBufferSize
+ * Maximum buffer size (see configuration)
+ * @param swapDirectory
+ * Swap directory File (see configuration)
+ * @param swapCleaner
+ * Swap cleaner (internal FileCleaner).
+ * @throws SQLException
+ *
+ * @see org.exoplatform.services.jcr.impl.util.io.FileCleaner
+ */
+ public DB2SingleDbJDBCConnection(Connection dbConnection, boolean readOnly, String containerName,
+ ValueStoragePluginProvider valueStorageProvider, int maxBufferSize, File swapDirectory, FileCleaner swapCleaner)
+ throws SQLException
+ {
+ super(dbConnection, readOnly, containerName, valueStorageProvider, maxBufferSize, swapDirectory, swapCleaner);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected void prepareQueries() throws SQLException
+ {
+ super.prepareQueries();
+ FIND_NODES_AND_PROPERTIES =
+ "select J.*, P.ID AS P_ID, P.NAME AS P_NAME, P.VERSION AS P_VERSION, P.P_TYPE, P.P_MULTIVALUED,"
+ + " V.DATA, V.ORDER_NUM, V.STORAGE_DESC from JCR_SVALUE V, JCR_SITEM P"
+ + " join (select A.* from"
+ + " (select Row_Number() over (order by I.ID) as r__, I.ID, I.PARENT_ID, I.NAME, I.VERSION, I.I_INDEX, I.N_ORDER_NUM"
+ + " from JCR_SITEM I where I.CONTAINER_NAME='?' and I.I_CLASS=1) as A where A.r__ <= ? and A.r__ > ?"
+ + ") J on P.PARENT_ID = J.ID"
+ + " where P.I_CLASS=2 and P.CONTAINER_NAME='?' and V.PROPERTY_ID=P.ID order by J.ID";
+ }
+}
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/CQJDBCWorkspaceDataContainer.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/CQJDBCWorkspaceDataContainer.java 2011-02-08 13:47:24 UTC (rev 3947)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/CQJDBCWorkspaceDataContainer.java 2011-02-08 14:04:56 UTC (rev 3948)
@@ -28,6 +28,7 @@
import org.exoplatform.services.jcr.impl.storage.jdbc.init.OracleDBInitializer;
import org.exoplatform.services.jcr.impl.storage.jdbc.init.PgSQLDBInitializer;
import org.exoplatform.services.jcr.impl.storage.jdbc.init.StorageDBInitializer;
+import org.exoplatform.services.jcr.impl.storage.jdbc.optimisation.db.DB2ConnectionFactory;
import org.exoplatform.services.jcr.impl.storage.jdbc.optimisation.db.DefaultOracleConnectionFactory;
import org.exoplatform.services.jcr.impl.storage.jdbc.optimisation.db.GenericCQConnectionFactory;
import org.exoplatform.services.jcr.impl.storage.jdbc.optimisation.db.HSQLDBConnectionFactory;
@@ -220,13 +221,53 @@
}
else if (dbDialect == DBConstants.DB_DIALECT_DB2)
{
- this.connFactory = defaultConnectionFactory();
+ if (dbSourceName != null)
+ {
+ DataSource ds = (DataSource)new InitialContext().lookup(dbSourceName);
+ if (ds != null)
+ {
+ this.connFactory =
+ new DB2ConnectionFactory(ds, containerName, multiDb, valueStorageProvider, maxBufferSize,
+ swapDirectory, swapCleaner);
+ }
+ else
+ {
+ throw new RepositoryException("Datasource '" + dbSourceName + "' is not bound in this context.");
+ }
+ }
+ else
+ {
+ this.connFactory =
+ new DB2ConnectionFactory(dbDriver, dbUrl, dbUserName, dbPassword, containerName, multiDb,
+ valueStorageProvider, maxBufferSize, swapDirectory, swapCleaner);
+ }
+
sqlPath = "/conf/storage/jcr-" + (multiDb ? "m" : "s") + "jdbc.db2.sql";
dbInitilizer = defaultDBInitializer(sqlPath);
}
else if (dbDialect == DBConstants.DB_DIALECT_DB2V8)
{
- this.connFactory = defaultConnectionFactory();
+ if (dbSourceName != null)
+ {
+ DataSource ds = (DataSource)new InitialContext().lookup(dbSourceName);
+ if (ds != null)
+ {
+ this.connFactory =
+ new DB2ConnectionFactory(ds, containerName, multiDb, valueStorageProvider, maxBufferSize,
+ swapDirectory, swapCleaner);
+ }
+ else
+ {
+ throw new RepositoryException("Datasource '" + dbSourceName + "' is not bound in this context.");
+ }
+ }
+ else
+ {
+ this.connFactory =
+ new DB2ConnectionFactory(dbDriver, dbUrl, dbUserName, dbPassword, containerName, multiDb,
+ valueStorageProvider, maxBufferSize, swapDirectory, swapCleaner);
+ }
+
sqlPath = "/conf/storage/jcr-" + (multiDb ? "m" : "s") + "jdbc.db2v8.sql";
dbInitilizer = defaultDBInitializer(sqlPath);
}
Added: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/DB2ConnectionFactory.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/DB2ConnectionFactory.java (rev 0)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/DB2ConnectionFactory.java 2011-02-08 14:04:56 UTC (rev 3948)
@@ -0,0 +1,125 @@
+/*
+ * Copyright (C) 2009 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.optimisation.db;
+
+import org.exoplatform.services.jcr.impl.util.io.FileCleaner;
+import org.exoplatform.services.jcr.storage.WorkspaceStorageConnection;
+import org.exoplatform.services.jcr.storage.value.ValueStoragePluginProvider;
+
+import java.io.File;
+import java.sql.SQLException;
+
+import javax.jcr.RepositoryException;
+import javax.sql.DataSource;
+
+/**
+ * Created by The eXo Platform SAS.
+ *
+ * Date: 8 02 2011
+ *
+ * @author <a href="mailto:anatoliy.bazko@exoplatform.com.ua">Anatoliy Bazko</a>
+ * @version $Id: DB2ConnectionFactory.java 34360 2010-11-11 11:11:11Z tolusha $
+ */
+public class DB2ConnectionFactory extends GenericCQConnectionFactory
+{
+
+ /**
+ * DB2ConnectionFactory constructor.
+ *
+ * @param dataSource
+ * - DataSource
+ * @param dbDriver
+ * - JDBC Driver
+ * @param dbUrl
+ * - JDBC URL
+ * @param dbUserName
+ * - database username
+ * @param dbPassword
+ * - database user password
+ * @param containerName
+ * - Container name (see configuration)
+ * @param multiDb
+ * - multidatabase state flag
+ * @param valueStorageProvider
+ * - external Value Storages provider
+ * @param maxBufferSize
+ * - Maximum buffer size (see configuration)
+ * @param swapDirectory
+ * - Swap directory (see configuration)
+ * @param swapCleaner
+ * - Swap cleaner (internal FileCleaner).
+ * @throws RepositoryException
+ * if error eccurs
+ */
+ public DB2ConnectionFactory(String dbDriver, String dbUrl, String dbUserName, String dbPassword,
+ String containerName, boolean multiDb, ValueStoragePluginProvider valueStorageProvider, int maxBufferSize,
+ File swapDirectory, FileCleaner swapCleaner) throws RepositoryException
+ {
+ super(dbDriver, dbUrl, dbUserName, dbPassword, containerName, multiDb, valueStorageProvider, maxBufferSize,
+ swapDirectory, swapCleaner);
+ }
+
+ /**
+ * DB2ConnectionFactory constructor.
+ *
+ * @param dataSource
+ * - DataSource
+ * @param containerName
+ * - Container name (see configuration)
+ * @param multiDb
+ * - multidatabase state flag
+ * @param valueStorageProvider
+ * - external Value Storages provider
+ * @param maxBufferSize
+ * - Maximum buffer size (see configuration)
+ * @param swapDirectory
+ * - Swap directory (see configuration)
+ * @param swapCleaner
+ * - Swap cleaner (internal FileCleaner).
+ */
+ public DB2ConnectionFactory(DataSource dbDataSource, String containerName, boolean multiDb,
+ ValueStoragePluginProvider valueStorageProvider, int maxBufferSize, File swapDirectory, FileCleaner swapCleaner)
+ {
+ super(dbDataSource, containerName, multiDb, valueStorageProvider, maxBufferSize, swapDirectory, swapCleaner);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public WorkspaceStorageConnection openConnection(boolean readOnly) throws RepositoryException
+ {
+ try
+ {
+ if (multiDb)
+ {
+ return new DB2MultiDbJDBCConnection(getJdbcConnection(readOnly), readOnly, containerName,
+ valueStorageProvider, maxBufferSize, swapDirectory, swapCleaner);
+ }
+
+ return new DB2SingleDbJDBCConnection(getJdbcConnection(readOnly), readOnly, containerName,
+ valueStorageProvider, maxBufferSize, swapDirectory, swapCleaner);
+
+ }
+ catch (SQLException e)
+ {
+ throw new RepositoryException(e);
+ }
+ }
+}
Added: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/DB2MultiDbJDBCConnection.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/DB2MultiDbJDBCConnection.java (rev 0)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/DB2MultiDbJDBCConnection.java 2011-02-08 14:04:56 UTC (rev 3948)
@@ -0,0 +1,79 @@
+/*
+ * Copyright (C) 2003-2010 eXo Platform SAS.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Affero General Public License
+ * as published by the Free Software Foundation; either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, see<http://www.gnu.org/licenses/>.
+ */
+package org.exoplatform.services.jcr.impl.storage.jdbc.optimisation.db;
+
+import org.exoplatform.services.jcr.impl.util.io.FileCleaner;
+import org.exoplatform.services.jcr.storage.value.ValueStoragePluginProvider;
+
+import java.io.File;
+import java.sql.Connection;
+import java.sql.SQLException;
+
+/**
+ * Created by The eXo Platform SAS.
+ *
+ * Date: 8 02 2011
+ *
+ * @author <a href="mailto:anatoliy.bazko@exoplatform.com.ua">Anatoliy Bazko</a>
+ * @version $Id: DB2MultiDbJDBCConnection.ajva 34360 2010-11-11 11:11:11Z tolusha $
+ */
+public class DB2MultiDbJDBCConnection extends MultiDbJDBCConnection
+{
+ /**
+ * DB2 Multidatabase JDBC Connection constructor.
+ *
+ * @param dbConnection
+ * JDBC connection, shoudl be opened before
+ * @param readOnly
+ * boolean if true the dbConnection was marked as READ-ONLY.
+ * @param containerName
+ * Workspace Storage Container name (see configuration)
+ * @param valueStorageProvider
+ * External Value Storages provider
+ * @param maxBufferSize
+ * Maximum buffer size (see configuration)
+ * @param swapDirectory
+ * Swap directory File (see configuration)
+ * @param swapCleaner
+ * Swap cleaner (internal FileCleaner).
+ * @throws SQLException
+ *
+ * @see org.exoplatform.services.jcr.impl.util.io.FileCleaner
+ */
+ public DB2MultiDbJDBCConnection(Connection dbConnection, boolean readOnly, String containerName,
+ ValueStoragePluginProvider valueStorageProvider, int maxBufferSize, File swapDirectory, FileCleaner swapCleaner)
+ throws SQLException
+ {
+ super(dbConnection, readOnly, containerName, valueStorageProvider, maxBufferSize, swapDirectory, swapCleaner);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected void prepareQueries() throws SQLException
+ {
+ super.prepareQueries();
+ FIND_NODES_AND_PROPERTIES =
+ "select J.*, P.ID AS P_ID, P.NAME AS P_NAME, P.VERSION AS P_VERSION, P.P_TYPE, P.P_MULTIVALUED,"
+ + " V.DATA, V.ORDER_NUM, V.STORAGE_DESC from JCR_SVALUE V, JCR_SITEM P"
+ + " join (select A.* from"
+ + " (select Row_Number() over (order by I.ID) as r__, I.ID, I.PARENT_ID, I.NAME, I.VERSION, I.I_INDEX, I.N_ORDER_NUM"
+ + " from JCR_SITEM I where I.I_CLASS=1) as A where A.r__ <= ? and A.r__ > ?) J on P.PARENT_ID = J.ID"
+ + " where P.I_CLASS=2 and V.PROPERTY_ID=P.ID order by J.ID";
+ }
+}
Added: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/DB2SingleDbJDBCConnection.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/DB2SingleDbJDBCConnection.java (rev 0)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/DB2SingleDbJDBCConnection.java 2011-02-08 14:04:56 UTC (rev 3948)
@@ -0,0 +1,80 @@
+/*
+ * Copyright (C) 2003-2010 eXo Platform SAS.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Affero General Public License
+ * as published by the Free Software Foundation; either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, see<http://www.gnu.org/licenses/>.
+ */
+package org.exoplatform.services.jcr.impl.storage.jdbc.optimisation.db;
+
+import org.exoplatform.services.jcr.impl.util.io.FileCleaner;
+import org.exoplatform.services.jcr.storage.value.ValueStoragePluginProvider;
+
+import java.io.File;
+import java.sql.Connection;
+import java.sql.SQLException;
+
+/**
+ * Created by The eXo Platform SAS.
+ *
+ * Date: 8 02 2011
+ *
+ * @author <a href="mailto:anatoliy.bazko@exoplatform.com.ua">Anatoliy Bazko</a>
+ * @version $Id: MSSQLSingleDbJDBCConnection.java 34360 2010-11-11 11:11:11Z tolusha $
+ */
+public class DB2SingleDbJDBCConnection extends SingleDbJDBCConnection
+{
+ /**
+ * Sybase Singledatabase JDBC Connection constructor.
+ *
+ * @param dbConnection
+ * JDBC connection, should be opened before
+ * @param readOnly
+ * boolean if true the dbConnection was marked as READ-ONLY.
+ * @param containerName
+ * Workspace Storage Container name (see configuration)
+ * @param valueStorageProvider
+ * External Value Storages provider
+ * @param maxBufferSize
+ * Maximum buffer size (see configuration)
+ * @param swapDirectory
+ * Swap directory File (see configuration)
+ * @param swapCleaner
+ * Swap cleaner (internal FileCleaner).
+ * @throws SQLException
+ *
+ * @see org.exoplatform.services.jcr.impl.util.io.FileCleaner
+ */
+ public DB2SingleDbJDBCConnection(Connection dbConnection, boolean readOnly, String containerName,
+ ValueStoragePluginProvider valueStorageProvider, int maxBufferSize, File swapDirectory, FileCleaner swapCleaner)
+ throws SQLException
+ {
+ super(dbConnection, readOnly, containerName, valueStorageProvider, maxBufferSize, swapDirectory, swapCleaner);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected void prepareQueries() throws SQLException
+ {
+ super.prepareQueries();
+ FIND_NODES_AND_PROPERTIES =
+ "select J.*, P.ID AS P_ID, P.NAME AS P_NAME, P.VERSION AS P_VERSION, P.P_TYPE, P.P_MULTIVALUED,"
+ + " V.DATA, V.ORDER_NUM, V.STORAGE_DESC from JCR_SVALUE V, JCR_SITEM P"
+ + " join (select A.* from"
+ + " (select Row_Number() over (order by I.ID) as r__, I.ID, I.PARENT_ID, I.NAME, I.VERSION, I.I_INDEX, I.N_ORDER_NUM"
+ + " from JCR_SITEM I where I.CONTAINER_NAME='?' and I.I_CLASS=1) as A where A.r__ <= ? and A.r__ > ?"
+ + ") J on P.PARENT_ID = J.ID"
+ + " where P.I_CLASS=2 and P.CONTAINER_NAME='?' and V.PROPERTY_ID=P.ID order by J.ID";
+ }
+}
13 years, 3 months
exo-jcr SVN: r3947 - jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/db.
by do-not-reply@jboss.org
Author: tolusha
Date: 2011-02-08 08:47:24 -0500 (Tue, 08 Feb 2011)
New Revision: 3947
Added:
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/db/SybaseSingleDbJDBCConnection.java
Log:
EXOJCR-1104: add Sybase support
Added: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/db/SybaseSingleDbJDBCConnection.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/db/SybaseSingleDbJDBCConnection.java (rev 0)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/db/SybaseSingleDbJDBCConnection.java 2011-02-08 13:47:24 UTC (rev 3947)
@@ -0,0 +1,80 @@
+/*
+ * Copyright (C) 2003-2010 eXo Platform SAS.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Affero General Public License
+ * as published by the Free Software Foundation; either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, see<http://www.gnu.org/licenses/>.
+ */
+package org.exoplatform.services.jcr.impl.storage.jdbc.db;
+
+import org.exoplatform.services.jcr.impl.util.io.FileCleaner;
+import org.exoplatform.services.jcr.storage.value.ValueStoragePluginProvider;
+
+import java.io.File;
+import java.sql.Connection;
+import java.sql.SQLException;
+
+/**
+ * Created by The eXo Platform SAS.
+ *
+ * Date: 8 02 2011
+ *
+ * @author <a href="mailto:anatoliy.bazko@exoplatform.com.ua">Anatoliy Bazko</a>
+ * @version $Id: MSSQLSingleDbJDBCConnection.java 34360 2010-11-11 11:11:11Z tolusha $
+ */
+public class SybaseSingleDbJDBCConnection extends SingleDbJDBCConnection
+{
+ /**
+ * Sybase Singledatabase JDBC Connection constructor.
+ *
+ * @param dbConnection
+ * JDBC connection, should be opened before
+ * @param readOnly
+ * boolean if true the dbConnection was marked as READ-ONLY.
+ * @param containerName
+ * Workspace Storage Container name (see configuration)
+ * @param valueStorageProvider
+ * External Value Storages provider
+ * @param maxBufferSize
+ * Maximum buffer size (see configuration)
+ * @param swapDirectory
+ * Swap directory File (see configuration)
+ * @param swapCleaner
+ * Swap cleaner (internal FileCleaner).
+ * @throws SQLException
+ *
+ * @see org.exoplatform.services.jcr.impl.util.io.FileCleaner
+ */
+ public SybaseSingleDbJDBCConnection(Connection dbConnection, boolean readOnly, String containerName,
+ ValueStoragePluginProvider valueStorageProvider, int maxBufferSize, File swapDirectory, FileCleaner swapCleaner)
+ throws SQLException
+ {
+ super(dbConnection, readOnly, containerName, valueStorageProvider, maxBufferSize, swapDirectory, swapCleaner);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected void prepareQueries() throws SQLException
+ {
+ super.prepareQueries();
+ FIND_NODES_AND_PROPERTIES =
+ "select J.*, P.ID AS P_ID, P.NAME AS P_NAME, P.VERSION AS P_VERSION, P.P_TYPE, P.P_MULTIVALUED,"
+ + " V.DATA, V.ORDER_NUM, V.STORAGE_DESC from JCR_SVALUE V, JCR_SITEM P"
+ + " join (select A.* from"
+ + " (select Row_Number() over (order by I.ID) as r__, I.ID, I.PARENT_ID, I.NAME, I.VERSION, I.I_INDEX, I.N_ORDER_NUM"
+ + " from JCR_SITEM I where I.CONTAINER_NAME='?' and I.I_CLASS=1) as A where A.r__ <= ? and A.r__ > ?"
+ + ") J on P.PARENT_ID = J.ID"
+ + " where P.I_CLASS=2 and P.CONTAINER_NAME='?' and V.PROPERTY_ID=P.ID order by J.ID";
+ }
+}
13 years, 3 months
exo-jcr SVN: r3946 - in jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc: db and 2 other directories.
by do-not-reply@jboss.org
Author: tolusha
Date: 2011-02-08 08:40:27 -0500 (Tue, 08 Feb 2011)
New Revision: 3946
Added:
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/db/SybaseConnectionFactory.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/db/SybaseMultiDbJDBCConnection.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/SybaseConnectionFactory.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/SybaseMultiDbJDBCConnection.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/SybaseSingleDbJDBCConnection.java
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/optimisation/CQJDBCWorkspaceDataContainer.java
Log:
EXOJCR-1104: add Sybase support
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 2011-02-08 13:23:29 UTC (rev 3945)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/JDBCWorkspaceDataContainer.java 2011-02-08 13:40:27 UTC (rev 3946)
@@ -48,6 +48,7 @@
import org.exoplatform.services.jcr.impl.storage.jdbc.db.MSSQLConnectionFactory;
import org.exoplatform.services.jcr.impl.storage.jdbc.db.MySQLConnectionFactory;
import org.exoplatform.services.jcr.impl.storage.jdbc.db.OracleConnectionFactory;
+import org.exoplatform.services.jcr.impl.storage.jdbc.db.SybaseConnectionFactory;
import org.exoplatform.services.jcr.impl.storage.jdbc.db.WorkspaceStorageConnectionFactory;
import org.exoplatform.services.jcr.impl.storage.jdbc.indexing.JdbcNodeDataIndexingIterator;
import org.exoplatform.services.jcr.impl.storage.jdbc.init.IngresSQLDBInitializer;
@@ -794,7 +795,27 @@
}
else if (dbDialect == DBConstants.DB_DIALECT_SYBASE)
{
- this.connFactory = defaultConnectionFactory();
+ if (dbSourceName != null)
+ {
+ DataSource ds = (DataSource)new InitialContext().lookup(dbSourceName);
+ if (ds != null)
+ {
+ this.connFactory =
+ new SybaseConnectionFactory(ds, containerName, multiDb, valueStorageProvider, maxBufferSize,
+ swapDirectory, swapCleaner);
+ }
+ else
+ {
+ throw new RepositoryException("Datasource '" + dbSourceName + "' is not bound in this context.");
+ }
+ }
+ else
+ {
+ this.connFactory =
+ new SybaseConnectionFactory(dbDriver, dbUrl, dbUserName, dbPassword, containerName, multiDb,
+ valueStorageProvider, maxBufferSize, swapDirectory, swapCleaner);
+ }
+
sqlPath = "/conf/storage/jcr-" + (multiDb ? "m" : "s") + "jdbc.sybase.sql";
dbInitilizer = defaultDBInitializer(sqlPath);
}
Added: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/db/SybaseConnectionFactory.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/db/SybaseConnectionFactory.java (rev 0)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/db/SybaseConnectionFactory.java 2011-02-08 13:40:27 UTC (rev 3946)
@@ -0,0 +1,125 @@
+/*
+ * Copyright (C) 2009 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.db;
+
+import org.exoplatform.services.jcr.impl.util.io.FileCleaner;
+import org.exoplatform.services.jcr.storage.WorkspaceStorageConnection;
+import org.exoplatform.services.jcr.storage.value.ValueStoragePluginProvider;
+
+import java.io.File;
+import java.sql.SQLException;
+
+import javax.jcr.RepositoryException;
+import javax.sql.DataSource;
+
+/**
+ * Created by The eXo Platform SAS.
+ *
+ * Date: 8 02 2011
+ *
+ * @author <a href="mailto:anatoliy.bazko@exoplatform.com.ua">Anatoliy Bazko</a>
+ * @version $Id: MSSQLConnectionFactory.java 34360 2010-11-11 11:11:11Z tolusha $
+ */
+public class SybaseConnectionFactory extends GenericConnectionFactory
+{
+
+ /**
+ * SybaseConnectionFactory constructor.
+ *
+ * @param dataSource
+ * - DataSource
+ * @param dbDriver
+ * - JDBC Driver
+ * @param dbUrl
+ * - JDBC URL
+ * @param dbUserName
+ * - database username
+ * @param dbPassword
+ * - database user password
+ * @param containerName
+ * - Container name (see configuration)
+ * @param multiDb
+ * - multidatabase state flag
+ * @param valueStorageProvider
+ * - external Value Storages provider
+ * @param maxBufferSize
+ * - Maximum buffer size (see configuration)
+ * @param swapDirectory
+ * - Swap directory (see configuration)
+ * @param swapCleaner
+ * - Swap cleaner (internal FileCleaner).
+ * @throws RepositoryException
+ * if error eccurs
+ */
+ public SybaseConnectionFactory(String dbDriver, String dbUrl, String dbUserName, String dbPassword,
+ String containerName, boolean multiDb, ValueStoragePluginProvider valueStorageProvider, int maxBufferSize,
+ File swapDirectory, FileCleaner swapCleaner) throws RepositoryException
+ {
+ super(dbDriver, dbUrl, dbUserName, dbPassword, containerName, multiDb, valueStorageProvider, maxBufferSize,
+ swapDirectory, swapCleaner);
+ }
+
+ /**
+ * SybaseConnectionFactory constructor.
+ *
+ * @param dataSource
+ * - DataSource
+ * @param containerName
+ * - Container name (see configuration)
+ * @param multiDb
+ * - multidatabase state flag
+ * @param valueStorageProvider
+ * - external Value Storages provider
+ * @param maxBufferSize
+ * - Maximum buffer size (see configuration)
+ * @param swapDirectory
+ * - Swap directory (see configuration)
+ * @param swapCleaner
+ * - Swap cleaner (internal FileCleaner).
+ */
+ public SybaseConnectionFactory(DataSource dbDataSource, String containerName, boolean multiDb,
+ ValueStoragePluginProvider valueStorageProvider, int maxBufferSize, File swapDirectory, FileCleaner swapCleaner)
+ {
+ super(dbDataSource, containerName, multiDb, valueStorageProvider, maxBufferSize, swapDirectory, swapCleaner);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public WorkspaceStorageConnection openConnection(boolean readOnly) throws RepositoryException
+ {
+ try
+ {
+ if (multiDb)
+ {
+ return new SybaseMultiDbJDBCConnection(getJdbcConnection(readOnly), readOnly, containerName,
+ valueStorageProvider, maxBufferSize, swapDirectory, swapCleaner);
+ }
+
+ return new SybaseSingleDbJDBCConnection(getJdbcConnection(readOnly), readOnly, containerName,
+ valueStorageProvider, maxBufferSize, swapDirectory, swapCleaner);
+
+ }
+ catch (SQLException e)
+ {
+ throw new RepositoryException(e);
+ }
+ }
+}
Added: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/db/SybaseMultiDbJDBCConnection.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/db/SybaseMultiDbJDBCConnection.java (rev 0)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/db/SybaseMultiDbJDBCConnection.java 2011-02-08 13:40:27 UTC (rev 3946)
@@ -0,0 +1,79 @@
+/*
+ * Copyright (C) 2003-2010 eXo Platform SAS.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Affero General Public License
+ * as published by the Free Software Foundation; either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, see<http://www.gnu.org/licenses/>.
+ */
+package org.exoplatform.services.jcr.impl.storage.jdbc.db;
+
+import org.exoplatform.services.jcr.impl.util.io.FileCleaner;
+import org.exoplatform.services.jcr.storage.value.ValueStoragePluginProvider;
+
+import java.io.File;
+import java.sql.Connection;
+import java.sql.SQLException;
+
+/**
+ * Created by The eXo Platform SAS.
+ *
+ * Date: 8 02 2011
+ *
+ * @author <a href="mailto:anatoliy.bazko@exoplatform.com.ua">Anatoliy Bazko</a>
+ * @version $Id: SybaseMultiDbJDBCConnection.java 34360 2010-11-11 11:11:11Z tolusha $
+ */
+public class SybaseMultiDbJDBCConnection extends MultiDbJDBCConnection
+{
+ /**
+ * Sybase Multidatabase JDBC Connection constructor.
+ *
+ * @param dbConnection
+ * JDBC connection, shoudl be opened before
+ * @param readOnly
+ * boolean if true the dbConnection was marked as READ-ONLY.
+ * @param containerName
+ * Workspace Storage Container name (see configuration)
+ * @param valueStorageProvider
+ * External Value Storages provider
+ * @param maxBufferSize
+ * Maximum buffer size (see configuration)
+ * @param swapDirectory
+ * Swap directory File (see configuration)
+ * @param swapCleaner
+ * Swap cleaner (internal FileCleaner).
+ * @throws SQLException
+ *
+ * @see org.exoplatform.services.jcr.impl.util.io.FileCleaner
+ */
+ public SybaseMultiDbJDBCConnection(Connection dbConnection, boolean readOnly, String containerName,
+ ValueStoragePluginProvider valueStorageProvider, int maxBufferSize, File swapDirectory, FileCleaner swapCleaner)
+ throws SQLException
+ {
+ super(dbConnection, readOnly, containerName, valueStorageProvider, maxBufferSize, swapDirectory, swapCleaner);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected void prepareQueries() throws SQLException
+ {
+ super.prepareQueries();
+ FIND_NODES_AND_PROPERTIES =
+ "select J.*, P.ID AS P_ID, P.NAME AS P_NAME, P.VERSION AS P_VERSION, P.P_TYPE, P.P_MULTIVALUED,"
+ + " V.DATA, V.ORDER_NUM, V.STORAGE_DESC from JCR_SVALUE V, JCR_SITEM P"
+ + " join (select A.* from"
+ + " (select Row_Number() over (order by I.ID) as r__, I.ID, I.PARENT_ID, I.NAME, I.VERSION, I.I_INDEX, I.N_ORDER_NUM"
+ + " from JCR_SITEM I where I.I_CLASS=1) as A where A.r__ <= ? and A.r__ > ?) J on P.PARENT_ID = J.ID"
+ + " where P.I_CLASS=2 and V.PROPERTY_ID=P.ID order by J.ID";
+ }
+}
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/CQJDBCWorkspaceDataContainer.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/CQJDBCWorkspaceDataContainer.java 2011-02-08 13:23:29 UTC (rev 3945)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/CQJDBCWorkspaceDataContainer.java 2011-02-08 13:40:27 UTC (rev 3946)
@@ -34,6 +34,7 @@
import org.exoplatform.services.jcr.impl.storage.jdbc.optimisation.db.MSSQLConnectionFactory;
import org.exoplatform.services.jcr.impl.storage.jdbc.optimisation.db.MySQLConnectionFactory;
import org.exoplatform.services.jcr.impl.storage.jdbc.optimisation.db.OracleConnectionFactory;
+import org.exoplatform.services.jcr.impl.storage.jdbc.optimisation.db.SybaseConnectionFactory;
import org.exoplatform.services.jcr.impl.util.io.FileCleanerHolder;
import org.exoplatform.services.jcr.impl.util.jdbc.DBInitializerException;
import org.exoplatform.services.jcr.storage.value.ValueStoragePluginProvider;
@@ -231,7 +232,27 @@
}
else if (dbDialect == DBConstants.DB_DIALECT_SYBASE)
{
- this.connFactory = defaultConnectionFactory();
+ if (dbSourceName != null)
+ {
+ DataSource ds = (DataSource)new InitialContext().lookup(dbSourceName);
+ if (ds != null)
+ {
+ this.connFactory =
+ new SybaseConnectionFactory(ds, containerName, multiDb, valueStorageProvider, maxBufferSize,
+ swapDirectory, swapCleaner);
+ }
+ else
+ {
+ throw new RepositoryException("Datasource '" + dbSourceName + "' is not bound in this context.");
+ }
+ }
+ else
+ {
+ this.connFactory =
+ new SybaseConnectionFactory(dbDriver, dbUrl, dbUserName, dbPassword, containerName, multiDb,
+ valueStorageProvider, maxBufferSize, swapDirectory, swapCleaner);
+ }
+
sqlPath = "/conf/storage/jcr-" + (multiDb ? "m" : "s") + "jdbc.sybase.sql";
dbInitilizer = defaultDBInitializer(sqlPath);
}
Added: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/SybaseConnectionFactory.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/SybaseConnectionFactory.java (rev 0)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/SybaseConnectionFactory.java 2011-02-08 13:40:27 UTC (rev 3946)
@@ -0,0 +1,125 @@
+/*
+ * Copyright (C) 2009 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.optimisation.db;
+
+import org.exoplatform.services.jcr.impl.util.io.FileCleaner;
+import org.exoplatform.services.jcr.storage.WorkspaceStorageConnection;
+import org.exoplatform.services.jcr.storage.value.ValueStoragePluginProvider;
+
+import java.io.File;
+import java.sql.SQLException;
+
+import javax.jcr.RepositoryException;
+import javax.sql.DataSource;
+
+/**
+ * Created by The eXo Platform SAS.
+ *
+ * Date: 8 02 2011
+ *
+ * @author <a href="mailto:anatoliy.bazko@exoplatform.com.ua">Anatoliy Bazko</a>
+ * @version $Id: MSSQLConnectionFactory.java 34360 2010-11-11 11:11:11Z tolusha $
+ */
+public class SybaseConnectionFactory extends GenericCQConnectionFactory
+{
+
+ /**
+ * SybaseConnectionFactory constructor.
+ *
+ * @param dataSource
+ * - DataSource
+ * @param dbDriver
+ * - JDBC Driver
+ * @param dbUrl
+ * - JDBC URL
+ * @param dbUserName
+ * - database username
+ * @param dbPassword
+ * - database user password
+ * @param containerName
+ * - Container name (see configuration)
+ * @param multiDb
+ * - multidatabase state flag
+ * @param valueStorageProvider
+ * - external Value Storages provider
+ * @param maxBufferSize
+ * - Maximum buffer size (see configuration)
+ * @param swapDirectory
+ * - Swap directory (see configuration)
+ * @param swapCleaner
+ * - Swap cleaner (internal FileCleaner).
+ * @throws RepositoryException
+ * if error eccurs
+ */
+ public SybaseConnectionFactory(String dbDriver, String dbUrl, String dbUserName, String dbPassword,
+ String containerName, boolean multiDb, ValueStoragePluginProvider valueStorageProvider, int maxBufferSize,
+ File swapDirectory, FileCleaner swapCleaner) throws RepositoryException
+ {
+ super(dbDriver, dbUrl, dbUserName, dbPassword, containerName, multiDb, valueStorageProvider, maxBufferSize,
+ swapDirectory, swapCleaner);
+ }
+
+ /**
+ * SybaseConnectionFactory constructor.
+ *
+ * @param dataSource
+ * - DataSource
+ * @param containerName
+ * - Container name (see configuration)
+ * @param multiDb
+ * - multidatabase state flag
+ * @param valueStorageProvider
+ * - external Value Storages provider
+ * @param maxBufferSize
+ * - Maximum buffer size (see configuration)
+ * @param swapDirectory
+ * - Swap directory (see configuration)
+ * @param swapCleaner
+ * - Swap cleaner (internal FileCleaner).
+ */
+ public SybaseConnectionFactory(DataSource dbDataSource, String containerName, boolean multiDb,
+ ValueStoragePluginProvider valueStorageProvider, int maxBufferSize, File swapDirectory, FileCleaner swapCleaner)
+ {
+ super(dbDataSource, containerName, multiDb, valueStorageProvider, maxBufferSize, swapDirectory, swapCleaner);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public WorkspaceStorageConnection openConnection(boolean readOnly) throws RepositoryException
+ {
+ try
+ {
+ if (multiDb)
+ {
+ return new SybaseMultiDbJDBCConnection(getJdbcConnection(readOnly), readOnly, containerName,
+ valueStorageProvider, maxBufferSize, swapDirectory, swapCleaner);
+ }
+
+ return new SybaseSingleDbJDBCConnection(getJdbcConnection(readOnly), readOnly, containerName,
+ valueStorageProvider, maxBufferSize, swapDirectory, swapCleaner);
+
+ }
+ catch (SQLException e)
+ {
+ throw new RepositoryException(e);
+ }
+ }
+}
Added: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/SybaseMultiDbJDBCConnection.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/SybaseMultiDbJDBCConnection.java (rev 0)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/SybaseMultiDbJDBCConnection.java 2011-02-08 13:40:27 UTC (rev 3946)
@@ -0,0 +1,79 @@
+/*
+ * Copyright (C) 2003-2010 eXo Platform SAS.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Affero General Public License
+ * as published by the Free Software Foundation; either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, see<http://www.gnu.org/licenses/>.
+ */
+package org.exoplatform.services.jcr.impl.storage.jdbc.optimisation.db;
+
+import org.exoplatform.services.jcr.impl.util.io.FileCleaner;
+import org.exoplatform.services.jcr.storage.value.ValueStoragePluginProvider;
+
+import java.io.File;
+import java.sql.Connection;
+import java.sql.SQLException;
+
+/**
+ * Created by The eXo Platform SAS.
+ *
+ * Date: 8 02 2011
+ *
+ * @author <a href="mailto:anatoliy.bazko@exoplatform.com.ua">Anatoliy Bazko</a>
+ * @version $Id: SybaseMultiDbJDBCConnection.java 34360 2010-11-11 11:11:11Z tolusha $
+ */
+public class SybaseMultiDbJDBCConnection extends MultiDbJDBCConnection
+{
+ /**
+ * Sybase Multidatabase JDBC Connection constructor.
+ *
+ * @param dbConnection
+ * JDBC connection, shoudl be opened before
+ * @param readOnly
+ * boolean if true the dbConnection was marked as READ-ONLY.
+ * @param containerName
+ * Workspace Storage Container name (see configuration)
+ * @param valueStorageProvider
+ * External Value Storages provider
+ * @param maxBufferSize
+ * Maximum buffer size (see configuration)
+ * @param swapDirectory
+ * Swap directory File (see configuration)
+ * @param swapCleaner
+ * Swap cleaner (internal FileCleaner).
+ * @throws SQLException
+ *
+ * @see org.exoplatform.services.jcr.impl.util.io.FileCleaner
+ */
+ public SybaseMultiDbJDBCConnection(Connection dbConnection, boolean readOnly, String containerName,
+ ValueStoragePluginProvider valueStorageProvider, int maxBufferSize, File swapDirectory, FileCleaner swapCleaner)
+ throws SQLException
+ {
+ super(dbConnection, readOnly, containerName, valueStorageProvider, maxBufferSize, swapDirectory, swapCleaner);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected void prepareQueries() throws SQLException
+ {
+ super.prepareQueries();
+ FIND_NODES_AND_PROPERTIES =
+ "select J.*, P.ID AS P_ID, P.NAME AS P_NAME, P.VERSION AS P_VERSION, P.P_TYPE, P.P_MULTIVALUED,"
+ + " V.DATA, V.ORDER_NUM, V.STORAGE_DESC from JCR_SVALUE V, JCR_SITEM P"
+ + " join (select A.* from"
+ + " (select Row_Number() over (order by I.ID) as r__, I.ID, I.PARENT_ID, I.NAME, I.VERSION, I.I_INDEX, I.N_ORDER_NUM"
+ + " from JCR_SITEM I where I.I_CLASS=1) as A where A.r__ <= ? and A.r__ > ?) J on P.PARENT_ID = J.ID"
+ + " where P.I_CLASS=2 and V.PROPERTY_ID=P.ID order by J.ID";
+ }
+}
Added: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/SybaseSingleDbJDBCConnection.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/SybaseSingleDbJDBCConnection.java (rev 0)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/SybaseSingleDbJDBCConnection.java 2011-02-08 13:40:27 UTC (rev 3946)
@@ -0,0 +1,80 @@
+/*
+ * Copyright (C) 2003-2010 eXo Platform SAS.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Affero General Public License
+ * as published by the Free Software Foundation; either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, see<http://www.gnu.org/licenses/>.
+ */
+package org.exoplatform.services.jcr.impl.storage.jdbc.optimisation.db;
+
+import org.exoplatform.services.jcr.impl.util.io.FileCleaner;
+import org.exoplatform.services.jcr.storage.value.ValueStoragePluginProvider;
+
+import java.io.File;
+import java.sql.Connection;
+import java.sql.SQLException;
+
+/**
+ * Created by The eXo Platform SAS.
+ *
+ * Date: 8 02 2011
+ *
+ * @author <a href="mailto:anatoliy.bazko@exoplatform.com.ua">Anatoliy Bazko</a>
+ * @version $Id: MSSQLSingleDbJDBCConnection.java 34360 2010-11-11 11:11:11Z tolusha $
+ */
+public class SybaseSingleDbJDBCConnection extends SingleDbJDBCConnection
+{
+ /**
+ * Sybase Singledatabase JDBC Connection constructor.
+ *
+ * @param dbConnection
+ * JDBC connection, should be opened before
+ * @param readOnly
+ * boolean if true the dbConnection was marked as READ-ONLY.
+ * @param containerName
+ * Workspace Storage Container name (see configuration)
+ * @param valueStorageProvider
+ * External Value Storages provider
+ * @param maxBufferSize
+ * Maximum buffer size (see configuration)
+ * @param swapDirectory
+ * Swap directory File (see configuration)
+ * @param swapCleaner
+ * Swap cleaner (internal FileCleaner).
+ * @throws SQLException
+ *
+ * @see org.exoplatform.services.jcr.impl.util.io.FileCleaner
+ */
+ public SybaseSingleDbJDBCConnection(Connection dbConnection, boolean readOnly, String containerName,
+ ValueStoragePluginProvider valueStorageProvider, int maxBufferSize, File swapDirectory, FileCleaner swapCleaner)
+ throws SQLException
+ {
+ super(dbConnection, readOnly, containerName, valueStorageProvider, maxBufferSize, swapDirectory, swapCleaner);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected void prepareQueries() throws SQLException
+ {
+ super.prepareQueries();
+ FIND_NODES_AND_PROPERTIES =
+ "select J.*, P.ID AS P_ID, P.NAME AS P_NAME, P.VERSION AS P_VERSION, P.P_TYPE, P.P_MULTIVALUED,"
+ + " V.DATA, V.ORDER_NUM, V.STORAGE_DESC from JCR_SVALUE V, JCR_SITEM P"
+ + " join (select A.* from"
+ + " (select Row_Number() over (order by I.ID) as r__, I.ID, I.PARENT_ID, I.NAME, I.VERSION, I.I_INDEX, I.N_ORDER_NUM"
+ + " from JCR_SITEM I where I.CONTAINER_NAME='?' and I.I_CLASS=1) as A where A.r__ <= ? and A.r__ > ?"
+ + ") J on P.PARENT_ID = J.ID"
+ + " where P.I_CLASS=2 and P.CONTAINER_NAME='?' and V.PROPERTY_ID=P.ID order by J.ID";
+ }
+}
13 years, 3 months
exo-jcr SVN: r3945 - jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db.
by do-not-reply@jboss.org
Author: tolusha
Date: 2011-02-08 08:23:29 -0500 (Tue, 08 Feb 2011)
New Revision: 3945
Modified:
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/MSSQLMultiDbJDBCConnection.java
Log:
EXOJCR-1104: fix query
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/MSSQLMultiDbJDBCConnection.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/MSSQLMultiDbJDBCConnection.java 2011-02-08 12:53:15 UTC (rev 3944)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/MSSQLMultiDbJDBCConnection.java 2011-02-08 13:23:29 UTC (rev 3945)
@@ -57,13 +57,6 @@
throws SQLException
{
super(dbConnection, readOnly, containerName, valueStorageProvider, maxBufferSize, swapDirectory, swapCleaner);
- FIND_NODES_AND_PROPERTIES =
- "select J.*, P.ID AS P_ID, P.NAME AS P_NAME, P.VERSION AS P_VERSION, P.P_TYPE, P.P_MULTIVALUED,"
- + " V.DATA, V.ORDER_NUM, V.STORAGE_DESC from JCR_SVALUE V, JCR_SITEM P"
- + " join (select A.* from"
- + " (select Row_Number() over (order by I.ID) as r__, I.ID, I.PARENT_ID, I.NAME, I.VERSION, I.I_INDEX, I.N_ORDER_NUM"
- + " from JCR_SITEM I where I.I_CLASS=1) as A where A.r__ <= ? and A.r__ > ?) J on P.PARENT_ID = J.ID"
- + " where P.I_CLASS=2 and V.PROPERTY_ID=P.ID order by J.ID";
}
/**
@@ -73,5 +66,12 @@
protected void prepareQueries() throws SQLException
{
super.prepareQueries();
+ FIND_NODES_AND_PROPERTIES =
+ "select J.*, P.ID AS P_ID, P.NAME AS P_NAME, P.VERSION AS P_VERSION, P.P_TYPE, P.P_MULTIVALUED,"
+ + " V.DATA, V.ORDER_NUM, V.STORAGE_DESC from JCR_SVALUE V, JCR_SITEM P"
+ + " join (select A.* from"
+ + " (select Row_Number() over (order by I.ID) as r__, I.ID, I.PARENT_ID, I.NAME, I.VERSION, I.I_INDEX, I.N_ORDER_NUM"
+ + " from JCR_SITEM I where I.I_CLASS=1) as A where A.r__ <= ? and A.r__ > ?) J on P.PARENT_ID = J.ID"
+ + " where P.I_CLASS=2 and V.PROPERTY_ID=P.ID order by J.ID";
}
}
13 years, 3 months