exo-jcr SVN: r1203 - in jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/resources/conf: cluster and 1 other directory.
by do-not-reply@jboss.org
Author: nzamosenchuk
Date: 2009-12-28 04:09:38 -0500 (Mon, 28 Dec 2009)
New Revision: 1203
Added:
jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/resources/conf/cluster/
jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/resources/conf/cluster/readme.txt
jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/resources/conf/cluster/test-configuration.xml
jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/resources/conf/cluster/test-jbosscache-config-ws.xml
jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/resources/conf/cluster/test-jbosscache-config-ws1.xml
jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/resources/conf/cluster/test-jbosscache-config-ws2.xml
jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/resources/conf/cluster/test-jbosscache-config-ws3.xml
jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/resources/conf/cluster/test-jbosscache-config-wstck.xml
jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/resources/conf/cluster/test-jbosscache-config-wstck1.xml
jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/resources/conf/cluster/test-jbosscache-config-wstck2.xml
jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/resources/conf/cluster/test-jbosscache-indexer-config-exoloader_db1_ws.xml
jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/resources/conf/cluster/test-jcr-config.xml
Log:
EXOJCR-325: Added config for cluster.
Added: jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/resources/conf/cluster/readme.txt
===================================================================
--- jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/resources/conf/cluster/readme.txt (rev 0)
+++ jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/resources/conf/cluster/readme.txt 2009-12-28 09:09:38 UTC (rev 1203)
@@ -0,0 +1,44 @@
+This configuration is designed for cluster mode.
+
+** USAGE **
+To use this configuration set, replace following line in pom.xml
+ <jcr.test.configuration.file>/conf/cluster/test-configuration.xml</jcr.test.configuration.file>
+
+** DATABASE **
+It uses MySQL databases,
+that can be created with following script (appendix A). MySQL password currently is set
+to "admin", please change it in order to be suitable for Your's MySQL
+configuration.
+
+** INDEXER **
+Indexer on "WS" is configured to use JBossCacheChangesFilter, that pushes lists of
+added/removed nodes and indexes through the separate instance of JBoss Cache.
+Please configure index-dir of query handler to the same (*shared?) folder for
+each cluster node (i.e. "/tmp/jcr-clustering/index/db1/ws" or "/mnt/server-nfs/index/db1/ws").
+<property name="index-dir" value="target/temp/index/db1/ws" />
+
+** TODO **
+Re-configure jGroups ports, to avoid warnings of message discarding.
+
+Appendix A: DB script
+
+DROP DATABASE IF EXISTS cluster_jcr1 ;
+create database cluster_jcr1 default charset latin1 collate latin1_general_cs;
+DROP DATABASE IF EXISTS cluster_jcr2 ;
+create database cluster_jcr2 default charset latin1 collate latin1_general_cs;
+DROP DATABASE IF EXISTS cluster_jcr3 ;
+create database cluster_jcr3 default charset latin1 collate latin1_general_cs;
+DROP DATABASE IF EXISTS cluster_jcr4 ;
+create database cluster_jcr4 default charset latin1 collate latin1_general_cs;
+DROP DATABASE IF EXISTS cluster_jcr5 ;
+create database cluster_jcr5 default charset latin1 collate latin1_general_cs;
+DROP DATABASE IF EXISTS cluster_jcr6 ;
+create database cluster_jcr6 default charset latin1 collate latin1_general_cs;
+DROP DATABASE IF EXISTS cluster_jcr7 ;
+create database cluster_jcr7 default charset latin1 collate latin1_general_cs;
+DROP DATABASE IF EXISTS cluster_jcr8;
+create database cluster_jcr8 default charset latin1 collate latin1_general_cs;
+DROP DATABASE IF EXISTS cluster_jcr9 ;
+create database cluster_jcr9 default charset latin1 collate latin1_general_cs;
+DROP DATABASE IF EXISTS cluster_jcr10 ;
+create database cluster_jcr10 default charset latin1 collate latin1_general_cs;
\ No newline at end of file
Property changes on: jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/resources/conf/cluster/readme.txt
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/resources/conf/cluster/test-configuration.xml
===================================================================
--- jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/resources/conf/cluster/test-configuration.xml (rev 0)
+++ jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/resources/conf/cluster/test-configuration.xml 2009-12-28 09:09:38 UTC (rev 1203)
@@ -0,0 +1,593 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!--
+
+ 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.
+
+-->
+<configuration
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.exoplaform.org/xml/ns/kernel_1_0.xsd http://www.exoplaform.org/xml/ns/kernel_1_0.xsd"
+ xmlns="http://www.exoplaform.org/xml/ns/kernel_1_0.xsd">
+ <component>
+ <key>org.exoplatform.services.log.LogConfigurationInitializer</key>
+ <type>org.exoplatform.services.log.LogConfigurationInitializer</type>
+ <init-params>
+ <value-param>
+ <name>logger</name>
+ <value>org.exoplatform.services.log.impl.BufferedLog4JLogger</value>
+ </value-param>
+ <value-param>
+ <name>configurator</name>
+ <value>org.exoplatform.services.log.impl.Log4JConfigurator</value>
+ </value-param>
+ <properties-param>
+ <name>properties</name>
+ <description>Log4J properties</description>
+ <property name="log4j.rootLogger" value="INFO, stdout, file"/>
+
+ <property name="log4j.appender.stdout" value="org.apache.log4j.ConsoleAppender"/>
+ <property name="log4j.appender.stdout.threshold" value="DEBUG"/>
+
+ <property name="log4j.appender.stdout.layout" value="org.apache.log4j.PatternLayout"/>
+ <property name="log4j.appender.stdout.layout.ConversionPattern"
+ value="%d{dd.MM.yyyy HH:mm:ss} *%-5p* [%t] %c{1}: %m (%F, line %L) %n"/>
+
+ <property name="log4j.appender.file" value="org.apache.log4j.FileAppender"/>
+ <property name="log4j.appender.file.File" value="target/jcr.log"/>
+
+ <property name="log4j.appender.file.layout" value="org.apache.log4j.PatternLayout"/>
+ <property name="log4j.appender.file.layout.ConversionPattern"
+ value="%d{dd.MM.yyyy HH:mm:ss} *%-5p* [%t] %c{1}: %m (%F, line %L) %n"/>
+
+ <property name="log4j.category.jcr.JBossCacheStorageConnection1" value="DEBUG"/>
+
+ <!-- property name="log4j.category.jcr.NodeImpl" value="DEBUG"/ -->
+ </properties-param>
+
+ <!-- value-param>
+ <name>logger</name>
+ <value>org.exoplatform.services.log.impl.BufferedSimpleLog</value>
+ </value-param>
+ <value-param>
+ <name>configurator</name>
+ <value>org.exoplatform.services.log.impl.SimpleLogConfigurator</value>
+ </value-param>
+ <properties-param>
+ <name>properties</name>
+ <description>SimpleLog properties</description>
+ <property name="org.apache.commons.logging.simplelog.defaultlog" value="debug"/>
+ <property name="org.apache.commons.logging.simplelog.showdatetime" value="true"/>
+ </properties-param -->
+
+ <!-- value-param>
+ <name>logger</name>
+ <value>org.exoplatform.services.log.impl.BufferedJdk14Logger</value>
+ </value-param>
+ <value-param>
+ <name>configurator</name>
+ <value>org.exoplatform.services.log.impl.Jdk14Configurator</value>
+ </value-param>
+ <properties-param>
+ <name>properties</name>
+ <description>jdk1.4 Logger properties</description>
+ <property name="handlers" value="java.util.logging.ConsoleHandler"/>
+ <property name=".level" value="FINE"/>
+ <property name="java.util.logging.ConsoleHandler.level" value="FINE"/>
+ </properties-param -->
+
+ </init-params>
+ </component>
+
+ <!-- component>
+ <type>org.exoplatform.services.jbosscache.JBossCacheService</type>
+ <init-params>
+ <value-param>
+ <name>jbosscache-configuration</name>
+ <value>conf/portal/exojcr-jboss-cache-conf.xml</value>
+ </value-param>
+ </init-params>
+ </component -->
+
+ <component>
+ <key>org.exoplatform.services.jcr.RepositoryService</key>
+ <type>org.exoplatform.services.jcr.impl.RepositoryServiceImpl</type>
+ <component-plugins>
+ <component-plugin>
+ <name>add.namespaces</name>
+ <set-method>addPlugin</set-method>
+ <type>org.exoplatform.services.jcr.impl.AddNamespacesPlugin</type>
+ <init-params>
+ <properties-param>
+ <name>namespaces</name>
+ <property name="test" value="http://www.apache.org/jackrabbit/test"/>
+ <property name="exojcrtest" value="http://www.exoplatform.org/jcr/test/1.0"/>
+ <property name="rma" value="http://www.rma.com/jcr/"/>
+ <property name="metadata" value="http://www.exoplatform.com/jcr/metadata/1.1/"/>
+ <property name="dc" value="http://purl.org/dc/elements/1.1/"/>
+ </properties-param>
+ </init-params>
+ </component-plugin>
+ <component-plugin>
+ <name>add.nodeType</name>
+ <set-method>addPlugin</set-method>
+ <type>org.exoplatform.services.jcr.impl.AddNodeTypePlugin</type>
+ <init-params>
+ <values-param>
+ <name>autoCreatedInNewRepository</name>
+ <description>Node types configuration file</description>
+ <value>jar:/conf/test/nodetypes-tck.xml</value>
+ <value>jar:/conf/test/nodetypes-impl.xml</value>
+ <value>jar:/conf/test/nodetypes-usecase.xml</value>
+ <value>jar:/conf/test/nodetypes-config.xml</value>
+ <value>jar:/conf/test/nodetypes-config-extended.xml</value>
+ </values-param>
+
+ <values-param>
+ <name>testInitNodeTypesRepository</name>
+ <description>
+ Node types configuration file for repository with name testInitNodeTypesRepository
+ </description>
+ <value>jar:/conf/test/nodetypes-test.xml</value>
+ </values-param>
+
+ <values-param>
+ <name>testInitNodeTypesRepositoryTest2</name>
+ <description>
+ Node types configuration file for repository with name testInitNodeTypesRepositoryTest2
+ </description>
+ <value>jar:/conf/test/nodetypes-test2.xml</value>
+ </values-param>
+
+ <!--values-param>
+ <name>testInitNodeTypesRepositoryTest3</name>
+ <description>Node types from ext. Needed bacause core starup earlie than ext</description>
+ <value>jar:/conf/test/nodetypes-test3_ext.xml</value>
+ </values-param-->
+
+ </init-params>
+ </component-plugin>
+ </component-plugins>
+ </component>
+
+ <component>
+ <key>org.exoplatform.services.jcr.config.RepositoryServiceConfiguration</key>
+ <type>org.exoplatform.services.jcr.impl.config.RepositoryServiceConfigurationImpl</type>
+ <init-params>
+ <value-param>
+ <name>conf-path</name>
+ <description>JCR configuration file</description>
+ <value>jar:/conf/cluster/test-jcr-config.xml</value>
+ </value-param>
+ <!-- properties-param>
+ <name>working-conf</name>
+ <description>working-conf</description>
+ <property name="source-name" value="jdbcjcr"/>
+ <property name="dialect" value="mysql"/>
+ <property name="persister-class-name" value="org.exoplatform.services.jcr.impl.config.JDBCConfigurationPersister"/>
+ </properties-param -->
+ </init-params>
+ </component>
+
+ <component>
+ <type>org.exoplatform.services.organization.impl.mock.DummyOrganizationService</type>
+ </component>
+
+ <component>
+ <key>org.exoplatform.services.security.Authenticator</key>
+ <type>org.exoplatform.services.organization.auth.OrganizationAuthenticatorImpl</type>
+ </component>
+
+ <component>
+ <type>org.exoplatform.services.jcr.impl.ext.action.SessionActionCatalog</type>
+ </component>
+
+ <component>
+ <key>org.exoplatform.services.transaction.TransactionService</key>
+ <type>org.exoplatform.services.transaction.impl.jotm.TransactionServiceJotmImpl</type>
+ <init-params>
+ <value-param>
+ <name>timeout</name>
+ <value>5</value>
+ </value-param>
+ </init-params>
+ </component>
+
+ <external-component-plugins>
+ <target-component>org.exoplatform.services.naming.InitialContextInitializer</target-component>
+ <component-plugin>
+ <name>bind.datasource</name>
+ <set-method>addPlugin</set-method>
+ <type>org.exoplatform.services.naming.BindReferencePlugin</type>
+ <init-params>
+ <value-param>
+ <name>bind-name</name>
+ <value>jdbcjcr</value>
+ </value-param>
+ <value-param>
+ <name>class-name</name>
+ <value>javax.sql.DataSource</value>
+ </value-param>
+ <value-param>
+ <name>factory</name>
+ <value>org.apache.commons.dbcp.BasicDataSourceFactory</value>
+ </value-param>
+ <properties-param>
+ <name>ref-addresses</name>
+ <description>ref-addresses</description>
+ <property name="driverClassName" value="com.mysql.jdbc.Driver" />
+ <property name="url" value="jdbc:mysql://localhost/cluster_jcr1"/>
+ <property name="username" value="root"/>
+ <property name="password" value="admin"/>
+ <property name="maxActive" value="100" />
+ <property name="maxIdle" value="5" />
+ <property name="initialSize" value="5" />
+ </properties-param>
+ </init-params>
+ </component-plugin>
+ <component-plugin>
+ <name>bind.datasource</name>
+ <set-method>addPlugin</set-method>
+ <type>org.exoplatform.services.naming.BindReferencePlugin</type>
+ <init-params>
+ <value-param>
+ <name>bind-name</name>
+ <value>jdbcjcr1</value>
+ </value-param>
+ <value-param>
+ <name>class-name</name>
+ <value>javax.sql.DataSource</value>
+ </value-param>
+ <value-param>
+ <name>factory</name>
+ <value>org.apache.commons.dbcp.BasicDataSourceFactory</value>
+ </value-param>
+ <properties-param>
+ <name>ref-addresses</name>
+ <description>ref-addresses</description>
+ <property name="driverClassName" value="com.mysql.jdbc.Driver" />
+ <property name="url" value="jdbc:mysql://localhost/cluster_jcr2"/>
+ <property name="username" value="root"/>
+ <property name="password" value="admin"/>
+ <property name="maxActive" value="100" />
+ <property name="maxIdle" value="5" />
+ <property name="initialSize" value="5" />
+
+ </properties-param>
+ </init-params>
+ </component-plugin>
+ <component-plugin>
+ <name>bind.datasource</name>
+ <set-method>addPlugin</set-method>
+ <type>org.exoplatform.services.naming.BindReferencePlugin</type>
+ <init-params>
+ <value-param>
+ <name>bind-name</name>
+ <value>jdbcjcr2</value>
+ </value-param>
+ <value-param>
+ <name>class-name</name>
+ <value>javax.sql.DataSource</value>
+ </value-param>
+ <value-param>
+ <name>factory</name>
+ <value>org.apache.commons.dbcp.BasicDataSourceFactory</value>
+ </value-param>
+ <properties-param>
+ <name>ref-addresses</name>
+ <description>ref-addresses</description>
+ <property name="driverClassName" value="com.mysql.jdbc.Driver" />
+ <property name="url" value="jdbc:mysql://localhost/cluster_jcr3"/>
+ <property name="username" value="root"/>
+ <property name="password" value="admin"/>
+ <property name="maxActive" value="100" />
+ <property name="maxIdle" value="5" />
+ <property name="initialSize" value="5" />
+
+ </properties-param>
+ </init-params>
+ </component-plugin>
+ <component-plugin>
+ <name>bind.datasource</name>
+ <set-method>addPlugin</set-method>
+ <type>org.exoplatform.services.naming.BindReferencePlugin</type>
+ <init-params>
+ <value-param>
+ <name>bind-name</name>
+ <value>jdbcjcr3</value>
+ </value-param>
+ <value-param>
+ <name>class-name</name>
+ <value>javax.sql.DataSource</value>
+ </value-param>
+ <value-param>
+ <name>factory</name>
+ <value>org.apache.commons.dbcp.BasicDataSourceFactory</value>
+ </value-param>
+ <properties-param>
+ <name>ref-addresses</name>
+ <description>ref-addresses</description>
+ <property name="driverClassName" value="com.mysql.jdbc.Driver" />
+ <property name="url" value="jdbc:mysql://localhost/cluster_jcr4"/>
+ <property name="username" value="root"/>
+ <property name="password" value="admin"/>
+ <property name="maxActive" value="100" />
+ <property name="maxIdle" value="5" />
+ <property name="initialSize" value="5" />
+
+ </properties-param>
+ </init-params>
+ </component-plugin>
+ <component-plugin>
+ <name>bind.datasource</name>
+ <set-method>addPlugin</set-method>
+ <type>org.exoplatform.services.naming.BindReferencePlugin</type>
+ <init-params>
+ <value-param>
+ <name>bind-name</name>
+ <value>jdbcjcrtest</value>
+ </value-param>
+ <value-param>
+ <name>class-name</name>
+ <value>javax.sql.DataSource</value>
+ </value-param>
+ <value-param>
+ <name>factory</name>
+ <value>org.apache.commons.dbcp.BasicDataSourceFactory</value>
+ </value-param>
+ <properties-param>
+ <name>ref-addresses</name>
+ <description>ref-addresses</description>
+ <property name="driverClassName" value="com.mysql.jdbc.Driver" />
+ <property name="url" value="jdbc:mysql://localhost/cluster_jcr5"/>
+ <property name="username" value="root"/>
+ <property name="password" value="admin"/>
+ <property name="maxActive" value="100" />
+ <property name="maxIdle" value="5" />
+ <property name="initialSize" value="5" />
+
+ </properties-param>
+ </init-params>
+ </component-plugin>
+ <component-plugin>
+ <name>bind.datasource</name>
+ <set-method>addPlugin</set-method>
+ <type>org.exoplatform.services.naming.BindReferencePlugin</type>
+ <init-params>
+ <value-param>
+ <name>bind-name</name>
+ <value>jdbcjcrtck</value>
+ </value-param>
+ <value-param>
+ <name>class-name</name>
+ <value>javax.sql.DataSource</value>
+ </value-param>
+ <value-param>
+ <name>factory</name>
+ <value>org.apache.commons.dbcp.BasicDataSourceFactory</value>
+ </value-param>
+ <properties-param>
+ <name>ref-addresses</name>
+ <description>ref-addresses</description>
+ <property name="driverClassName" value="com.mysql.jdbc.Driver" />
+ <property name="url" value="jdbc:mysql://localhost/cluster_jcr6"/>
+ <property name="username" value="root"/>
+ <property name="password" value="admin"/>
+ <property name="maxActive" value="100" />
+ <property name="maxIdle" value="5" />
+ <property name="initialSize" value="5" />
+ </properties-param>
+ </init-params>
+ </component-plugin>
+ <component-plugin>
+ <name>bind.datasource</name>
+ <set-method>addPlugin</set-method>
+ <type>org.exoplatform.services.naming.BindReferencePlugin</type>
+ <init-params>
+ <value-param>
+ <name>bind-name</name>
+ <value>jdbcjcr1tck</value>
+ </value-param>
+ <value-param>
+ <name>class-name</name>
+ <value>javax.sql.DataSource</value>
+ </value-param>
+ <value-param>
+ <name>factory</name>
+ <value>org.apache.commons.dbcp.BasicDataSourceFactory</value>
+ </value-param>
+ <properties-param>
+ <name>ref-addresses</name>
+ <description>ref-addresses</description>
+ <property name="driverClassName" value="com.mysql.jdbc.Driver" />
+ <property name="url" value="jdbc:mysql://localhost/cluster_jcr7"/>
+ <property name="username" value="root"/>
+ <property name="password" value="admin"/>
+ <property name="maxActive" value="100" />
+ <property name="maxIdle" value="5" />
+ <property name="initialSize" value="5" />
+ </properties-param>
+ </init-params>
+ </component-plugin>
+ <component-plugin>
+ <name>bind.datasource</name>
+ <set-method>addPlugin</set-method>
+ <type>org.exoplatform.services.naming.BindReferencePlugin</type>
+ <init-params>
+ <value-param>
+ <name>bind-name</name>
+ <value>jdbcjcr2tck</value>
+ </value-param>
+ <value-param>
+ <name>class-name</name>
+ <value>javax.sql.DataSource</value>
+ </value-param>
+ <value-param>
+ <name>factory</name>
+ <value>org.apache.commons.dbcp.BasicDataSourceFactory</value>
+ </value-param>
+ <properties-param>
+ <name>ref-addresses</name>
+ <description>ref-addresses</description>
+ <property name="driverClassName" value="com.mysql.jdbc.Driver" />
+ <property name="url" value="jdbc:mysql://localhost/cluster_jcr8"/>
+ <property name="username" value="root"/>
+ <property name="password" value="admin"/>
+ <property name="maxActive" value="100" />
+ <property name="maxIdle" value="5" />
+ <property name="initialSize" value="5" />
+ </properties-param>
+ </init-params>
+ </component-plugin>
+ <component-plugin>
+ <name>bind.datasource</name>
+ <set-method>addPlugin</set-method>
+ <type>org.exoplatform.services.naming.BindReferencePlugin</type>
+ <init-params>
+ <value-param>
+ <name>bind-name</name>
+ <value>jdbcjcr2export1</value>
+ </value-param>
+ <value-param>
+ <name>class-name</name>
+ <value>javax.sql.DataSource</value>
+ </value-param>
+ <value-param>
+ <name>factory</name>
+ <value>org.apache.commons.dbcp.BasicDataSourceFactory</value>
+ </value-param>
+ <properties-param>
+ <name>ref-addresses</name>
+ <description>ref-addresses</description>
+ <property name="driverClassName" value="com.mysql.jdbc.Driver" />
+ <property name="url" value="jdbc:mysql://localhost/cluster_jcr9"/>
+ <property name="username" value="root"/>
+ <property name="password" value="admin"/>
+ <property name="maxActive" value="100" />
+ <property name="maxIdle" value="5" />
+ <property name="initialSize" value="5" />
+ </properties-param>
+ </init-params>
+ </component-plugin>
+ <component-plugin>
+ <name>bind.datasource</name>
+ <set-method>addPlugin</set-method>
+ <type>org.exoplatform.services.naming.BindReferencePlugin</type>
+ <init-params>
+ <value-param>
+ <name>bind-name</name>
+ <value>jdbcjcr2export2</value>
+ </value-param>
+ <value-param>
+ <name>class-name</name>
+ <value>javax.sql.DataSource</value>
+ </value-param>
+ <value-param>
+ <name>factory</name>
+ <value>org.apache.commons.dbcp.BasicDataSourceFactory</value>
+ </value-param>
+ <properties-param>
+ <name>ref-addresses</name>
+ <description>ref-addresses</description>
+ <property name="driverClassName" value="com.mysql.jdbc.Driver" />
+ <property name="url" value="jdbc:mysql://localhost/cluster_jcr10"/>
+ <property name="username" value="root"/>
+ <property name="password" value="admin"/>
+ <property name="maxActive" value="100" />
+ <property name="maxIdle" value="5" />
+ <property name="initialSize" value="5" />
+ </properties-param>
+ </init-params>
+ </component-plugin>
+ <!-- Resource configuration for UserTransaction
+ use JOTM
+ -->
+ <component-plugin>
+ <name>jotm.tx</name>
+ <set-method>addPlugin</set-method>
+ <type>org.exoplatform.services.naming.BindReferencePlugin</type>
+ <init-params>
+ <value-param>
+ <name>bind-name</name>
+ <value>UserTransaction</value>
+ </value-param>
+ <value-param>
+ <name>class-name</name>
+ <value>javax.transaction.UserTransaction</value>
+ </value-param>
+ <value-param>
+ <name>factory</name>
+ <value>org.objectweb.jotm.UserTransactionFactory</value>
+ </value-param>
+ <properties-param>
+ <name>ref-addresses</name>
+ <description>ref-addresses</description>
+ <property name="jotm.timeout" value="60"/>
+ </properties-param>
+ </init-params>
+ </component-plugin>
+ <component-plugin>
+ <name>bind.jcr</name>
+ <set-method>addPlugin</set-method>
+ <type>org.exoplatform.services.naming.BindReferencePlugin</type>
+ <init-params>
+ <value-param>
+ <name>bind-name</name>
+ <value>repo</value>
+ </value-param>
+ <value-param>
+ <name>class-name</name>
+ <value>javax.jcr.Repository</value>
+ </value-param>
+ <value-param>
+ <name>factory</name>
+ <value>org.exoplatform.services.jcr.impl.jndi.BindableRepositoryFactory</value>
+ </value-param>
+ <properties-param>
+ <name>ref-addresses</name>
+ <description>ref-addresses</description>
+ <property name="repositoryName" value="db1"/>
+ <!-- property name="containerConfig" value="exo-configuration.xml"/ -->
+ </properties-param>
+ </init-params>
+ </component-plugin>
+ <component-plugin>
+ <name>rmi.jcr</name>
+ <set-method>addPlugin</set-method>
+ <type>org.exoplatform.services.naming.BindReferencePlugin</type>
+ <init-params>
+ <value-param>
+ <name>bind-name</name>
+ <value>rmirepository</value>
+ </value-param>
+ <value-param>
+ <name>class-name</name>
+ <value>javax.jcr.Repository</value>
+ </value-param>
+ <value-param>
+ <name>factory</name>
+ <value>org.exoplatform.services.jcr.rmi.RepositoryFactory</value>
+ </value-param>
+ <properties-param>
+ <name>ref-addresses</name>
+ <description>ref-addresses</description>
+ <property name="url" value="//localhost:9999/repository"/>
+ </properties-param>
+ </init-params>
+ </component-plugin>
+ </external-component-plugins>
+</configuration>
Property changes on: jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/resources/conf/cluster/test-configuration.xml
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/resources/conf/cluster/test-jbosscache-config-ws.xml
===================================================================
--- jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/resources/conf/cluster/test-jbosscache-config-ws.xml (rev 0)
+++ jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/resources/conf/cluster/test-jbosscache-config-ws.xml 2009-12-28 09:09:38 UTC (rev 1203)
@@ -0,0 +1,86 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<jbosscache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns="urn:jboss:jbosscache-core:config:3.1">
+
+ <locking useLockStriping="false" concurrencyLevel="50000" />
+
+ <clustering mode="replication" clusterName="JBoss-Cache-Cluster_db1_ws">
+ <!--
+ Fetch in memory state is enable, because second cluster-node
+ currently doesn't work properly on clear cache
+ -->
+ <stateRetrieval timeout="20000" fetchInMemoryState="true" />
+ <!--
+ This JGroups configuration is taken from JBC branch, but
+ "enable_bundling" is set to false, because of notice, that appeared
+ during running
+ -->
+ <jgroupsConfig>
+ <!--
+ UDP discard_incompatible_packets="true" enable_bundling="false"
+ enable_diagnostics="false" ip_ttl="2" loopback="false"
+ max_bundle_size="64000" max_bundle_timeout="30"
+ mcast_addr="228.10.10.10" mcast_port="45588"
+ mcast_recv_buf_size="25000000" mcast_send_buf_size="640000"
+ oob_thread_pool.enabled="true"
+ oob_thread_pool.keep_alive_time="10000"
+ oob_thread_pool.max_threads="4" oob_thread_pool.min_threads="1"
+ oob_thread_pool.queue_enabled="true"
+ oob_thread_pool.queue_max_size="10"
+ oob_thread_pool.rejection_policy="Run" thread_naming_pattern="pl"
+ thread_pool.enabled="true" thread_pool.keep_alive_time="30000"
+ thread_pool.max_threads="25" thread_pool.min_threads="1"
+ thread_pool.queue_enabled="true" thread_pool.queue_max_size="10"
+ thread_pool.rejection_policy="Run" tos="8"
+ ucast_recv_buf_size="20000000" ucast_send_buf_size="640000"
+ use_concurrent_stack="true" use_incoming_packet_handler="true" />
+ <PING num_initial_members="3" timeout="2000" /
+ -->
+
+ <TCP bind_addr="127.0.0.1" start_port="9800" loopback="true"
+ recv_buf_size="20000000" send_buf_size="640000"
+ discard_incompatible_packets="true" max_bundle_size="64000"
+ max_bundle_timeout="30" use_incoming_packet_handler="true"
+ enable_bundling="false" use_send_queues="false" sock_conn_timeout="300"
+ skip_suspected_members="true" use_concurrent_stack="true"
+ thread_pool.enabled="true" thread_pool.min_threads="1"
+ thread_pool.max_threads="25" thread_pool.keep_alive_time="5000"
+ thread_pool.queue_enabled="false" thread_pool.queue_max_size="100"
+ thread_pool.rejection_policy="run" oob_thread_pool.enabled="true"
+ oob_thread_pool.min_threads="1" oob_thread_pool.max_threads="8"
+ oob_thread_pool.keep_alive_time="5000"
+ oob_thread_pool.queue_enabled="false"
+ oob_thread_pool.queue_max_size="100"
+ oob_thread_pool.rejection_policy="run" />
+ <MPING timeout="2000" num_initial_members="2" mcast_port="34521"
+ bind_addr="127.0.0.1" mcast_addr="224.0.0.1" />
+
+
+ <MERGE2 max_interval="30000" min_interval="10000" />
+ <FD_SOCK />
+ <FD max_tries="5" shun="true" timeout="10000" />
+ <VERIFY_SUSPECT timeout="1500" />
+ <pbcast.NAKACK discard_delivered_msgs="true" gc_lag="0"
+ retransmit_timeout="300,600,1200,2400,4800" use_mcast_xmit="false" />
+ <UNICAST timeout="300,600,1200,2400,3600" />
+ <pbcast.STABLE desired_avg_gossip="50000" max_bytes="400000"
+ stability_delay="1000" />
+ <pbcast.GMS join_timeout="5000" print_local_addr="true"
+ shun="false" view_ack_collection_timeout="5000" view_bundling="true" />
+ <FRAG2 frag_size="60000" />
+ <pbcast.STREAMING_STATE_TRANSFER />
+ <pbcast.FLUSH timeout="0" />
+
+ </jgroupsConfig>
+
+ <sync />
+
+ </clustering>
+
+ <!-- Configure the TransactionManager -->
+ <transaction
+ transactionManagerLookupClass="org.jboss.cache.transaction.JBossStandaloneJTAManagerLookup" />
+
+ <!-- Enable batching -->
+ <invocationBatching enabled="true" />
+</jbosscache>
Property changes on: jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/resources/conf/cluster/test-jbosscache-config-ws.xml
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/resources/conf/cluster/test-jbosscache-config-ws1.xml
===================================================================
--- jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/resources/conf/cluster/test-jbosscache-config-ws1.xml (rev 0)
+++ jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/resources/conf/cluster/test-jbosscache-config-ws1.xml 2009-12-28 09:09:38 UTC (rev 1203)
@@ -0,0 +1,86 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<jbosscache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns="urn:jboss:jbosscache-core:config:3.1">
+
+ <locking useLockStriping="false" concurrencyLevel="50000" />
+
+ <clustering mode="replication" clusterName="JBoss-Cache-Cluster_db1_ws1">
+ <!--
+ Fetch in memory state is enable, because second cluster-node
+ currently doesn't work properly on clear cache
+ -->
+ <stateRetrieval timeout="20000" fetchInMemoryState="true" />
+ <!--
+ This JGroups configuration is taken from JBC branch, but
+ "enable_bundling" is set to false, because of notice, that appeared
+ during running
+ -->
+ <jgroupsConfig>
+ <!--
+ UDP discard_incompatible_packets="true" enable_bundling="false"
+ enable_diagnostics="false" ip_ttl="2" loopback="false"
+ max_bundle_size="64000" max_bundle_timeout="30"
+ mcast_addr="228.10.10.10" mcast_port="45588"
+ mcast_recv_buf_size="25000000" mcast_send_buf_size="640000"
+ oob_thread_pool.enabled="true"
+ oob_thread_pool.keep_alive_time="10000"
+ oob_thread_pool.max_threads="4" oob_thread_pool.min_threads="1"
+ oob_thread_pool.queue_enabled="true"
+ oob_thread_pool.queue_max_size="10"
+ oob_thread_pool.rejection_policy="Run" thread_naming_pattern="pl"
+ thread_pool.enabled="true" thread_pool.keep_alive_time="30000"
+ thread_pool.max_threads="25" thread_pool.min_threads="1"
+ thread_pool.queue_enabled="true" thread_pool.queue_max_size="10"
+ thread_pool.rejection_policy="Run" tos="8"
+ ucast_recv_buf_size="20000000" ucast_send_buf_size="640000"
+ use_concurrent_stack="true" use_incoming_packet_handler="true" />
+ <PING num_initial_members="3" timeout="2000" /
+ -->
+
+ <TCP bind_addr="127.0.0.1" start_port="9800" loopback="true"
+ recv_buf_size="20000000" send_buf_size="640000"
+ discard_incompatible_packets="true" max_bundle_size="64000"
+ max_bundle_timeout="30" use_incoming_packet_handler="true"
+ enable_bundling="false" use_send_queues="false" sock_conn_timeout="300"
+ skip_suspected_members="true" use_concurrent_stack="true"
+ thread_pool.enabled="true" thread_pool.min_threads="1"
+ thread_pool.max_threads="25" thread_pool.keep_alive_time="5000"
+ thread_pool.queue_enabled="false" thread_pool.queue_max_size="100"
+ thread_pool.rejection_policy="run" oob_thread_pool.enabled="true"
+ oob_thread_pool.min_threads="1" oob_thread_pool.max_threads="8"
+ oob_thread_pool.keep_alive_time="5000"
+ oob_thread_pool.queue_enabled="false"
+ oob_thread_pool.queue_max_size="100"
+ oob_thread_pool.rejection_policy="run" />
+ <MPING timeout="2000" num_initial_members="2" mcast_port="34521"
+ bind_addr="127.0.0.1" mcast_addr="224.0.0.1" />
+
+
+ <MERGE2 max_interval="30000" min_interval="10000" />
+ <FD_SOCK />
+ <FD max_tries="5" shun="true" timeout="10000" />
+ <VERIFY_SUSPECT timeout="1500" />
+ <pbcast.NAKACK discard_delivered_msgs="true" gc_lag="0"
+ retransmit_timeout="300,600,1200,2400,4800" use_mcast_xmit="false" />
+ <UNICAST timeout="300,600,1200,2400,3600" />
+ <pbcast.STABLE desired_avg_gossip="50000" max_bytes="400000"
+ stability_delay="1000" />
+ <pbcast.GMS join_timeout="5000" print_local_addr="true"
+ shun="false" view_ack_collection_timeout="5000" view_bundling="true" />
+ <FRAG2 frag_size="60000" />
+ <pbcast.STREAMING_STATE_TRANSFER />
+ <pbcast.FLUSH timeout="0" />
+
+ </jgroupsConfig>
+
+ <sync />
+
+ </clustering>
+
+ <!-- Configure the TransactionManager -->
+ <transaction
+ transactionManagerLookupClass="org.jboss.cache.transaction.JBossStandaloneJTAManagerLookup" />
+
+ <!-- Enable batching -->
+ <invocationBatching enabled="true" />
+</jbosscache>
Property changes on: jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/resources/conf/cluster/test-jbosscache-config-ws1.xml
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/resources/conf/cluster/test-jbosscache-config-ws2.xml
===================================================================
--- jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/resources/conf/cluster/test-jbosscache-config-ws2.xml (rev 0)
+++ jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/resources/conf/cluster/test-jbosscache-config-ws2.xml 2009-12-28 09:09:38 UTC (rev 1203)
@@ -0,0 +1,86 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<jbosscache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns="urn:jboss:jbosscache-core:config:3.1">
+
+ <locking useLockStriping="false" concurrencyLevel="50000" />
+
+ <clustering mode="replication" clusterName="JBoss-Cache-Cluster_db1_ws2">
+ <!--
+ Fetch in memory state is enable, because second cluster-node
+ currently doesn't work properly on clear cache
+ -->
+ <stateRetrieval timeout="20000" fetchInMemoryState="true" />
+ <!--
+ This JGroups configuration is taken from JBC branch, but
+ "enable_bundling" is set to false, because of notice, that appeared
+ during running
+ -->
+ <jgroupsConfig>
+ <!--
+ UDP discard_incompatible_packets="true" enable_bundling="false"
+ enable_diagnostics="false" ip_ttl="2" loopback="false"
+ max_bundle_size="64000" max_bundle_timeout="30"
+ mcast_addr="228.10.10.10" mcast_port="45588"
+ mcast_recv_buf_size="25000000" mcast_send_buf_size="640000"
+ oob_thread_pool.enabled="true"
+ oob_thread_pool.keep_alive_time="10000"
+ oob_thread_pool.max_threads="4" oob_thread_pool.min_threads="1"
+ oob_thread_pool.queue_enabled="true"
+ oob_thread_pool.queue_max_size="10"
+ oob_thread_pool.rejection_policy="Run" thread_naming_pattern="pl"
+ thread_pool.enabled="true" thread_pool.keep_alive_time="30000"
+ thread_pool.max_threads="25" thread_pool.min_threads="1"
+ thread_pool.queue_enabled="true" thread_pool.queue_max_size="10"
+ thread_pool.rejection_policy="Run" tos="8"
+ ucast_recv_buf_size="20000000" ucast_send_buf_size="640000"
+ use_concurrent_stack="true" use_incoming_packet_handler="true" />
+ <PING num_initial_members="3" timeout="2000" /
+ -->
+
+ <TCP bind_addr="127.0.0.1" start_port="9800" loopback="true"
+ recv_buf_size="20000000" send_buf_size="640000"
+ discard_incompatible_packets="true" max_bundle_size="64000"
+ max_bundle_timeout="30" use_incoming_packet_handler="true"
+ enable_bundling="false" use_send_queues="false" sock_conn_timeout="300"
+ skip_suspected_members="true" use_concurrent_stack="true"
+ thread_pool.enabled="true" thread_pool.min_threads="1"
+ thread_pool.max_threads="25" thread_pool.keep_alive_time="5000"
+ thread_pool.queue_enabled="false" thread_pool.queue_max_size="100"
+ thread_pool.rejection_policy="run" oob_thread_pool.enabled="true"
+ oob_thread_pool.min_threads="1" oob_thread_pool.max_threads="8"
+ oob_thread_pool.keep_alive_time="5000"
+ oob_thread_pool.queue_enabled="false"
+ oob_thread_pool.queue_max_size="100"
+ oob_thread_pool.rejection_policy="run" />
+ <MPING timeout="2000" num_initial_members="2" mcast_port="34521"
+ bind_addr="127.0.0.1" mcast_addr="224.0.0.1" />
+
+
+ <MERGE2 max_interval="30000" min_interval="10000" />
+ <FD_SOCK />
+ <FD max_tries="5" shun="true" timeout="10000" />
+ <VERIFY_SUSPECT timeout="1500" />
+ <pbcast.NAKACK discard_delivered_msgs="true" gc_lag="0"
+ retransmit_timeout="300,600,1200,2400,4800" use_mcast_xmit="false" />
+ <UNICAST timeout="300,600,1200,2400,3600" />
+ <pbcast.STABLE desired_avg_gossip="50000" max_bytes="400000"
+ stability_delay="1000" />
+ <pbcast.GMS join_timeout="5000" print_local_addr="true"
+ shun="false" view_ack_collection_timeout="5000" view_bundling="true" />
+ <FRAG2 frag_size="60000" />
+ <pbcast.STREAMING_STATE_TRANSFER />
+ <pbcast.FLUSH timeout="0" />
+
+ </jgroupsConfig>
+
+ <sync />
+
+ </clustering>
+
+ <!-- Configure the TransactionManager -->
+ <transaction
+ transactionManagerLookupClass="org.jboss.cache.transaction.JBossStandaloneJTAManagerLookup" />
+
+ <!-- Enable batching -->
+ <invocationBatching enabled="true" />
+</jbosscache>
Property changes on: jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/resources/conf/cluster/test-jbosscache-config-ws2.xml
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/resources/conf/cluster/test-jbosscache-config-ws3.xml
===================================================================
--- jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/resources/conf/cluster/test-jbosscache-config-ws3.xml (rev 0)
+++ jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/resources/conf/cluster/test-jbosscache-config-ws3.xml 2009-12-28 09:09:38 UTC (rev 1203)
@@ -0,0 +1,86 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<jbosscache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns="urn:jboss:jbosscache-core:config:3.1">
+
+ <locking useLockStriping="false" concurrencyLevel="50000" />
+
+ <clustering mode="replication" clusterName="JBoss-Cache-Cluster_db1_ws3">
+ <!--
+ Fetch in memory state is enable, because second cluster-node
+ currently doesn't work properly on clear cache
+ -->
+ <stateRetrieval timeout="20000" fetchInMemoryState="true" />
+ <!--
+ This JGroups configuration is taken from JBC branch, but
+ "enable_bundling" is set to false, because of notice, that appeared
+ during running
+ -->
+ <jgroupsConfig>
+ <!--
+ UDP discard_incompatible_packets="true" enable_bundling="false"
+ enable_diagnostics="false" ip_ttl="2" loopback="false"
+ max_bundle_size="64000" max_bundle_timeout="30"
+ mcast_addr="228.10.10.10" mcast_port="45588"
+ mcast_recv_buf_size="25000000" mcast_send_buf_size="640000"
+ oob_thread_pool.enabled="true"
+ oob_thread_pool.keep_alive_time="10000"
+ oob_thread_pool.max_threads="4" oob_thread_pool.min_threads="1"
+ oob_thread_pool.queue_enabled="true"
+ oob_thread_pool.queue_max_size="10"
+ oob_thread_pool.rejection_policy="Run" thread_naming_pattern="pl"
+ thread_pool.enabled="true" thread_pool.keep_alive_time="30000"
+ thread_pool.max_threads="25" thread_pool.min_threads="1"
+ thread_pool.queue_enabled="true" thread_pool.queue_max_size="10"
+ thread_pool.rejection_policy="Run" tos="8"
+ ucast_recv_buf_size="20000000" ucast_send_buf_size="640000"
+ use_concurrent_stack="true" use_incoming_packet_handler="true" />
+ <PING num_initial_members="3" timeout="2000" /
+ -->
+
+ <TCP bind_addr="127.0.0.1" start_port="9800" loopback="true"
+ recv_buf_size="20000000" send_buf_size="640000"
+ discard_incompatible_packets="true" max_bundle_size="64000"
+ max_bundle_timeout="30" use_incoming_packet_handler="true"
+ enable_bundling="false" use_send_queues="false" sock_conn_timeout="300"
+ skip_suspected_members="true" use_concurrent_stack="true"
+ thread_pool.enabled="true" thread_pool.min_threads="1"
+ thread_pool.max_threads="25" thread_pool.keep_alive_time="5000"
+ thread_pool.queue_enabled="false" thread_pool.queue_max_size="100"
+ thread_pool.rejection_policy="run" oob_thread_pool.enabled="true"
+ oob_thread_pool.min_threads="1" oob_thread_pool.max_threads="8"
+ oob_thread_pool.keep_alive_time="5000"
+ oob_thread_pool.queue_enabled="false"
+ oob_thread_pool.queue_max_size="100"
+ oob_thread_pool.rejection_policy="run" />
+ <MPING timeout="2000" num_initial_members="2" mcast_port="34521"
+ bind_addr="127.0.0.1" mcast_addr="224.0.0.1" />
+
+
+ <MERGE2 max_interval="30000" min_interval="10000" />
+ <FD_SOCK />
+ <FD max_tries="5" shun="true" timeout="10000" />
+ <VERIFY_SUSPECT timeout="1500" />
+ <pbcast.NAKACK discard_delivered_msgs="true" gc_lag="0"
+ retransmit_timeout="300,600,1200,2400,4800" use_mcast_xmit="false" />
+ <UNICAST timeout="300,600,1200,2400,3600" />
+ <pbcast.STABLE desired_avg_gossip="50000" max_bytes="400000"
+ stability_delay="1000" />
+ <pbcast.GMS join_timeout="5000" print_local_addr="true"
+ shun="false" view_ack_collection_timeout="5000" view_bundling="true" />
+ <FRAG2 frag_size="60000" />
+ <pbcast.STREAMING_STATE_TRANSFER />
+ <pbcast.FLUSH timeout="0" />
+
+ </jgroupsConfig>
+
+ <sync />
+
+ </clustering>
+
+ <!-- Configure the TransactionManager -->
+ <transaction
+ transactionManagerLookupClass="org.jboss.cache.transaction.JBossStandaloneJTAManagerLookup" />
+
+ <!-- Enable batching -->
+ <invocationBatching enabled="true" />
+</jbosscache>
Property changes on: jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/resources/conf/cluster/test-jbosscache-config-ws3.xml
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/resources/conf/cluster/test-jbosscache-config-wstck.xml
===================================================================
--- jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/resources/conf/cluster/test-jbosscache-config-wstck.xml (rev 0)
+++ jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/resources/conf/cluster/test-jbosscache-config-wstck.xml 2009-12-28 09:09:38 UTC (rev 1203)
@@ -0,0 +1,86 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<jbosscache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns="urn:jboss:jbosscache-core:config:3.1">
+
+ <locking useLockStriping="false" concurrencyLevel="50000" />
+
+ <clustering mode="replication" clusterName="JBoss-Cache-Cluster_db1tck_wstck">
+ <!--
+ Fetch in memory state is enable, because second cluster-node
+ currently doesn't work properly on clear cache
+ -->
+ <stateRetrieval timeout="20000" fetchInMemoryState="true" />
+ <!--
+ This JGroups configuration is taken from JBC branch, but
+ "enable_bundling" is set to false, because of notice, that appeared
+ during running
+ -->
+ <jgroupsConfig>
+ <!--
+ UDP discard_incompatible_packets="true" enable_bundling="false"
+ enable_diagnostics="false" ip_ttl="2" loopback="false"
+ max_bundle_size="64000" max_bundle_timeout="30"
+ mcast_addr="228.10.10.10" mcast_port="45588"
+ mcast_recv_buf_size="25000000" mcast_send_buf_size="640000"
+ oob_thread_pool.enabled="true"
+ oob_thread_pool.keep_alive_time="10000"
+ oob_thread_pool.max_threads="4" oob_thread_pool.min_threads="1"
+ oob_thread_pool.queue_enabled="true"
+ oob_thread_pool.queue_max_size="10"
+ oob_thread_pool.rejection_policy="Run" thread_naming_pattern="pl"
+ thread_pool.enabled="true" thread_pool.keep_alive_time="30000"
+ thread_pool.max_threads="25" thread_pool.min_threads="1"
+ thread_pool.queue_enabled="true" thread_pool.queue_max_size="10"
+ thread_pool.rejection_policy="Run" tos="8"
+ ucast_recv_buf_size="20000000" ucast_send_buf_size="640000"
+ use_concurrent_stack="true" use_incoming_packet_handler="true" />
+ <PING num_initial_members="3" timeout="2000" /
+ -->
+
+ <TCP bind_addr="127.0.0.1" start_port="9800" loopback="true"
+ recv_buf_size="20000000" send_buf_size="640000"
+ discard_incompatible_packets="true" max_bundle_size="64000"
+ max_bundle_timeout="30" use_incoming_packet_handler="true"
+ enable_bundling="false" use_send_queues="false" sock_conn_timeout="300"
+ skip_suspected_members="true" use_concurrent_stack="true"
+ thread_pool.enabled="true" thread_pool.min_threads="1"
+ thread_pool.max_threads="25" thread_pool.keep_alive_time="5000"
+ thread_pool.queue_enabled="false" thread_pool.queue_max_size="100"
+ thread_pool.rejection_policy="run" oob_thread_pool.enabled="true"
+ oob_thread_pool.min_threads="1" oob_thread_pool.max_threads="8"
+ oob_thread_pool.keep_alive_time="5000"
+ oob_thread_pool.queue_enabled="false"
+ oob_thread_pool.queue_max_size="100"
+ oob_thread_pool.rejection_policy="run" />
+ <MPING timeout="2000" num_initial_members="2" mcast_port="34521"
+ bind_addr="127.0.0.1" mcast_addr="224.0.0.1" />
+
+
+ <MERGE2 max_interval="30000" min_interval="10000" />
+ <FD_SOCK />
+ <FD max_tries="5" shun="true" timeout="10000" />
+ <VERIFY_SUSPECT timeout="1500" />
+ <pbcast.NAKACK discard_delivered_msgs="true" gc_lag="0"
+ retransmit_timeout="300,600,1200,2400,4800" use_mcast_xmit="false" />
+ <UNICAST timeout="300,600,1200,2400,3600" />
+ <pbcast.STABLE desired_avg_gossip="50000" max_bytes="400000"
+ stability_delay="1000" />
+ <pbcast.GMS join_timeout="5000" print_local_addr="true"
+ shun="false" view_ack_collection_timeout="5000" view_bundling="true" />
+ <FRAG2 frag_size="60000" />
+ <pbcast.STREAMING_STATE_TRANSFER />
+ <pbcast.FLUSH timeout="0" />
+
+ </jgroupsConfig>
+
+ <sync />
+
+ </clustering>
+
+ <!-- Configure the TransactionManager -->
+ <transaction
+ transactionManagerLookupClass="org.jboss.cache.transaction.JBossStandaloneJTAManagerLookup" />
+
+ <!-- Enable batching -->
+ <invocationBatching enabled="true" />
+</jbosscache>
Property changes on: jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/resources/conf/cluster/test-jbosscache-config-wstck.xml
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/resources/conf/cluster/test-jbosscache-config-wstck1.xml
===================================================================
--- jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/resources/conf/cluster/test-jbosscache-config-wstck1.xml (rev 0)
+++ jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/resources/conf/cluster/test-jbosscache-config-wstck1.xml 2009-12-28 09:09:38 UTC (rev 1203)
@@ -0,0 +1,86 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<jbosscache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns="urn:jboss:jbosscache-core:config:3.1">
+
+ <locking useLockStriping="false" concurrencyLevel="50000" />
+
+ <clustering mode="replication" clusterName="JBoss-Cache-Cluster_db1tck_wstck1">
+ <!--
+ Fetch in memory state is enable, because second cluster-node
+ currently doesn't work properly on clear cache
+ -->
+ <stateRetrieval timeout="20000" fetchInMemoryState="true" />
+ <!--
+ This JGroups configuration is taken from JBC branch, but
+ "enable_bundling" is set to false, because of notice, that appeared
+ during running
+ -->
+ <jgroupsConfig>
+ <!--
+ UDP discard_incompatible_packets="true" enable_bundling="false"
+ enable_diagnostics="false" ip_ttl="2" loopback="false"
+ max_bundle_size="64000" max_bundle_timeout="30"
+ mcast_addr="228.10.10.10" mcast_port="45588"
+ mcast_recv_buf_size="25000000" mcast_send_buf_size="640000"
+ oob_thread_pool.enabled="true"
+ oob_thread_pool.keep_alive_time="10000"
+ oob_thread_pool.max_threads="4" oob_thread_pool.min_threads="1"
+ oob_thread_pool.queue_enabled="true"
+ oob_thread_pool.queue_max_size="10"
+ oob_thread_pool.rejection_policy="Run" thread_naming_pattern="pl"
+ thread_pool.enabled="true" thread_pool.keep_alive_time="30000"
+ thread_pool.max_threads="25" thread_pool.min_threads="1"
+ thread_pool.queue_enabled="true" thread_pool.queue_max_size="10"
+ thread_pool.rejection_policy="Run" tos="8"
+ ucast_recv_buf_size="20000000" ucast_send_buf_size="640000"
+ use_concurrent_stack="true" use_incoming_packet_handler="true" />
+ <PING num_initial_members="3" timeout="2000" /
+ -->
+
+ <TCP bind_addr="127.0.0.1" start_port="9800" loopback="true"
+ recv_buf_size="20000000" send_buf_size="640000"
+ discard_incompatible_packets="true" max_bundle_size="64000"
+ max_bundle_timeout="30" use_incoming_packet_handler="true"
+ enable_bundling="false" use_send_queues="false" sock_conn_timeout="300"
+ skip_suspected_members="true" use_concurrent_stack="true"
+ thread_pool.enabled="true" thread_pool.min_threads="1"
+ thread_pool.max_threads="25" thread_pool.keep_alive_time="5000"
+ thread_pool.queue_enabled="false" thread_pool.queue_max_size="100"
+ thread_pool.rejection_policy="run" oob_thread_pool.enabled="true"
+ oob_thread_pool.min_threads="1" oob_thread_pool.max_threads="8"
+ oob_thread_pool.keep_alive_time="5000"
+ oob_thread_pool.queue_enabled="false"
+ oob_thread_pool.queue_max_size="100"
+ oob_thread_pool.rejection_policy="run" />
+ <MPING timeout="2000" num_initial_members="2" mcast_port="34521"
+ bind_addr="127.0.0.1" mcast_addr="224.0.0.1" />
+
+
+ <MERGE2 max_interval="30000" min_interval="10000" />
+ <FD_SOCK />
+ <FD max_tries="5" shun="true" timeout="10000" />
+ <VERIFY_SUSPECT timeout="1500" />
+ <pbcast.NAKACK discard_delivered_msgs="true" gc_lag="0"
+ retransmit_timeout="300,600,1200,2400,4800" use_mcast_xmit="false" />
+ <UNICAST timeout="300,600,1200,2400,3600" />
+ <pbcast.STABLE desired_avg_gossip="50000" max_bytes="400000"
+ stability_delay="1000" />
+ <pbcast.GMS join_timeout="5000" print_local_addr="true"
+ shun="false" view_ack_collection_timeout="5000" view_bundling="true" />
+ <FRAG2 frag_size="60000" />
+ <pbcast.STREAMING_STATE_TRANSFER />
+ <pbcast.FLUSH timeout="0" />
+
+ </jgroupsConfig>
+
+ <sync />
+
+ </clustering>
+
+ <!-- Configure the TransactionManager -->
+ <transaction
+ transactionManagerLookupClass="org.jboss.cache.transaction.JBossStandaloneJTAManagerLookup" />
+
+ <!-- Enable batching -->
+ <invocationBatching enabled="true" />
+</jbosscache>
Property changes on: jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/resources/conf/cluster/test-jbosscache-config-wstck1.xml
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/resources/conf/cluster/test-jbosscache-config-wstck2.xml
===================================================================
--- jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/resources/conf/cluster/test-jbosscache-config-wstck2.xml (rev 0)
+++ jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/resources/conf/cluster/test-jbosscache-config-wstck2.xml 2009-12-28 09:09:38 UTC (rev 1203)
@@ -0,0 +1,86 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<jbosscache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns="urn:jboss:jbosscache-core:config:3.1">
+
+ <locking useLockStriping="false" concurrencyLevel="50000" />
+
+ <clustering mode="replication" clusterName="JBoss-Cache-Cluster_db1tck_wstck2">
+ <!--
+ Fetch in memory state is enable, because second cluster-node
+ currently doesn't work properly on clear cache
+ -->
+ <stateRetrieval timeout="20000" fetchInMemoryState="true" />
+ <!--
+ This JGroups configuration is taken from JBC branch, but
+ "enable_bundling" is set to false, because of notice, that appeared
+ during running
+ -->
+ <jgroupsConfig>
+ <!--
+ UDP discard_incompatible_packets="true" enable_bundling="false"
+ enable_diagnostics="false" ip_ttl="2" loopback="false"
+ max_bundle_size="64000" max_bundle_timeout="30"
+ mcast_addr="228.10.10.10" mcast_port="45588"
+ mcast_recv_buf_size="25000000" mcast_send_buf_size="640000"
+ oob_thread_pool.enabled="true"
+ oob_thread_pool.keep_alive_time="10000"
+ oob_thread_pool.max_threads="4" oob_thread_pool.min_threads="1"
+ oob_thread_pool.queue_enabled="true"
+ oob_thread_pool.queue_max_size="10"
+ oob_thread_pool.rejection_policy="Run" thread_naming_pattern="pl"
+ thread_pool.enabled="true" thread_pool.keep_alive_time="30000"
+ thread_pool.max_threads="25" thread_pool.min_threads="1"
+ thread_pool.queue_enabled="true" thread_pool.queue_max_size="10"
+ thread_pool.rejection_policy="Run" tos="8"
+ ucast_recv_buf_size="20000000" ucast_send_buf_size="640000"
+ use_concurrent_stack="true" use_incoming_packet_handler="true" />
+ <PING num_initial_members="3" timeout="2000" /
+ -->
+
+ <TCP bind_addr="127.0.0.1" start_port="9800" loopback="true"
+ recv_buf_size="20000000" send_buf_size="640000"
+ discard_incompatible_packets="true" max_bundle_size="64000"
+ max_bundle_timeout="30" use_incoming_packet_handler="true"
+ enable_bundling="false" use_send_queues="false" sock_conn_timeout="300"
+ skip_suspected_members="true" use_concurrent_stack="true"
+ thread_pool.enabled="true" thread_pool.min_threads="1"
+ thread_pool.max_threads="25" thread_pool.keep_alive_time="5000"
+ thread_pool.queue_enabled="false" thread_pool.queue_max_size="100"
+ thread_pool.rejection_policy="run" oob_thread_pool.enabled="true"
+ oob_thread_pool.min_threads="1" oob_thread_pool.max_threads="8"
+ oob_thread_pool.keep_alive_time="5000"
+ oob_thread_pool.queue_enabled="false"
+ oob_thread_pool.queue_max_size="100"
+ oob_thread_pool.rejection_policy="run" />
+ <MPING timeout="2000" num_initial_members="2" mcast_port="34521"
+ bind_addr="127.0.0.1" mcast_addr="224.0.0.1" />
+
+
+ <MERGE2 max_interval="30000" min_interval="10000" />
+ <FD_SOCK />
+ <FD max_tries="5" shun="true" timeout="10000" />
+ <VERIFY_SUSPECT timeout="1500" />
+ <pbcast.NAKACK discard_delivered_msgs="true" gc_lag="0"
+ retransmit_timeout="300,600,1200,2400,4800" use_mcast_xmit="false" />
+ <UNICAST timeout="300,600,1200,2400,3600" />
+ <pbcast.STABLE desired_avg_gossip="50000" max_bytes="400000"
+ stability_delay="1000" />
+ <pbcast.GMS join_timeout="5000" print_local_addr="true"
+ shun="false" view_ack_collection_timeout="5000" view_bundling="true" />
+ <FRAG2 frag_size="60000" />
+ <pbcast.STREAMING_STATE_TRANSFER />
+ <pbcast.FLUSH timeout="0" />
+
+ </jgroupsConfig>
+
+ <sync />
+
+ </clustering>
+
+ <!-- Configure the TransactionManager -->
+ <transaction
+ transactionManagerLookupClass="org.jboss.cache.transaction.JBossStandaloneJTAManagerLookup" />
+
+ <!-- Enable batching -->
+ <invocationBatching enabled="true" />
+</jbosscache>
Property changes on: jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/resources/conf/cluster/test-jbosscache-config-wstck2.xml
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/resources/conf/cluster/test-jbosscache-indexer-config-exoloader_db1_ws.xml
===================================================================
--- jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/resources/conf/cluster/test-jbosscache-indexer-config-exoloader_db1_ws.xml (rev 0)
+++ jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/resources/conf/cluster/test-jbosscache-indexer-config-exoloader_db1_ws.xml 2009-12-28 09:09:38 UTC (rev 1203)
@@ -0,0 +1,72 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<jbosscache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns="urn:jboss:jbosscache-core:config:3.1">
+
+ <!-- Configure the TransactionManager -->
+ <transaction
+ transactionManagerLookupClass="org.jboss.cache.transaction.JBossStandaloneJTAManagerLookup" />
+
+ <clustering mode="replication" clusterName="JBoss-Cache-Indexer-Cluster_db1_ws">
+ <stateRetrieval timeout="20000" fetchInMemoryState="false" />
+ <jgroupsConfig>
+ <!--
+ UDP discard_incompatible_packets="true" enable_bundling="false"
+ enable_diagnostics="false" ip_ttl="2" loopback="false"
+ max_bundle_size="64000" max_bundle_timeout="30"
+ mcast_addr="228.10.10.10" mcast_port="45588"
+ mcast_recv_buf_size="25000000" mcast_send_buf_size="640000"
+ oob_thread_pool.enabled="true"
+ oob_thread_pool.keep_alive_time="10000"
+ oob_thread_pool.max_threads="4" oob_thread_pool.min_threads="1"
+ oob_thread_pool.queue_enabled="true"
+ oob_thread_pool.queue_max_size="10"
+ oob_thread_pool.rejection_policy="Run" thread_naming_pattern="pl"
+ thread_pool.enabled="true" thread_pool.keep_alive_time="30000"
+ thread_pool.max_threads="25" thread_pool.min_threads="1"
+ thread_pool.queue_enabled="true" thread_pool.queue_max_size="10"
+ thread_pool.rejection_policy="Run" tos="8"
+ ucast_recv_buf_size="20000000" ucast_send_buf_size="640000"
+ use_concurrent_stack="true" use_incoming_packet_handler="true" />
+ <PING num_initial_members="3" timeout="2000" /
+ -->
+
+ <TCP bind_addr="127.0.0.1" start_port="9800" loopback="true"
+ recv_buf_size="20000000" send_buf_size="640000"
+ discard_incompatible_packets="true" max_bundle_size="64000"
+ max_bundle_timeout="30" use_incoming_packet_handler="true"
+ enable_bundling="false" use_send_queues="false" sock_conn_timeout="300"
+ skip_suspected_members="true" use_concurrent_stack="true"
+ thread_pool.enabled="true" thread_pool.min_threads="1"
+ thread_pool.max_threads="25" thread_pool.keep_alive_time="5000"
+ thread_pool.queue_enabled="false" thread_pool.queue_max_size="100"
+ thread_pool.rejection_policy="run" oob_thread_pool.enabled="true"
+ oob_thread_pool.min_threads="1" oob_thread_pool.max_threads="8"
+ oob_thread_pool.keep_alive_time="5000"
+ oob_thread_pool.queue_enabled="false"
+ oob_thread_pool.queue_max_size="100"
+ oob_thread_pool.rejection_policy="run" />
+ <MPING timeout="2000" num_initial_members="2" mcast_port="34521"
+ bind_addr="127.0.0.1" mcast_addr="224.0.0.1" />
+
+
+ <MERGE2 max_interval="30000" min_interval="10000" />
+ <FD_SOCK />
+ <FD max_tries="5" shun="true" timeout="10000" />
+ <VERIFY_SUSPECT timeout="1500" />
+ <pbcast.NAKACK discard_delivered_msgs="true" gc_lag="0"
+ retransmit_timeout="300,600,1200,2400,4800" use_mcast_xmit="false" />
+ <UNICAST timeout="300,600,1200,2400,3600" />
+ <pbcast.STABLE desired_avg_gossip="50000" max_bytes="400000"
+ stability_delay="1000" />
+ <pbcast.GMS join_timeout="5000" print_local_addr="true"
+ shun="false" view_ack_collection_timeout="5000" view_bundling="true" />
+ <FRAG2 frag_size="60000" />
+ <pbcast.STREAMING_STATE_TRANSFER />
+ <pbcast.FLUSH timeout="0" />
+
+ </jgroupsConfig>
+
+ <sync />
+ </clustering>
+ <invocationBatching enabled="false" />
+</jbosscache>
Property changes on: jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/resources/conf/cluster/test-jbosscache-indexer-config-exoloader_db1_ws.xml
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/resources/conf/cluster/test-jcr-config.xml
===================================================================
--- jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/resources/conf/cluster/test-jcr-config.xml (rev 0)
+++ jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/resources/conf/cluster/test-jcr-config.xml 2009-12-28 09:09:38 UTC (rev 1203)
@@ -0,0 +1,400 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!--
+
+ 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.
+
+-->
+<repository-service default-repository="db1">
+ <repositories>
+ <repository name="db1" system-workspace="ws" default-workspace="ws">
+ <security-domain>exo-domain</security-domain>
+ <!-- access-control>optional</access-control -->
+ <!-- access-control>disable</access-control -->
+ <session-max-age>1h</session-max-age>
+ <authentication-policy>org.exoplatform.services.jcr.impl.core.access.JAASAuthenticator</authentication-policy>
+ <workspaces>
+ <workspace name="ws">
+ <!-- for system storage -->
+ <container class="org.exoplatform.services.jcr.impl.storage.jdbc.JDBCWorkspaceDataContainer">
+ <properties>
+ <property name="source-name" value="jdbcjcr" />
+ <property name="dialect" value="mysql" />
+ <property name="multi-db" value="true" />
+ <property name="update-storage" value="false" />
+ <property name="max-buffer-size" value="200k" />
+ <property name="swap-directory" value="target/temp/swap/ws" />
+ </properties>
+ <value-storages>
+ <value-storage id="ws" class="org.exoplatform.services.jcr.impl.storage.value.fs.TreeFileValueStorage">
+ <properties>
+ <property name="path" value="target/temp/values/ws" />
+ <property name="digest-algo" value="MD5" />
+ <property name="vcas-type" value="org.exoplatform.services.jcr.impl.storage.value.cas.JDBCValueContentAddressStorageImpl" />
+ <property name="jdbc-source-name" value="jdbcjcr" />
+ <property name="jdbc-dialect" value="mysql" />
+ </properties>
+ <filters>
+ <filter property-type="Binary" />
+ </filters>
+ </value-storage>
+ </value-storages>
+ </container>
+ <initializer class="org.exoplatform.services.jcr.impl.core.ScratchWorkspaceInitializer">
+ <properties>
+ <property name="root-nodetype" value="nt:unstructured" />
+ </properties>
+ </initializer>
+ <!-- initializer class="org.exoplatform.services.jcr.impl.core.RestoreWorkspaceInitializer">
+ <properties>
+ <property name="restore-path" value="./sv_export_root.xml" />
+ <property name="restore-path" value="./src/test/resources/import-export/restore_db1_ws1.xml" />
+ </properties>
+ </initializer
+-->
+ <cache enabled="true" class="org.exoplatform.services.jcr.impl.dataflow.persistent.jbosscache.JBossCacheWorkspaceStorageCache">
+ <properties>
+ <property name="jbosscache-configuration" value="conf/cluster/test-jbosscache-config-ws.xml" />
+ </properties>
+ </cache>
+ <query-handler class="org.exoplatform.services.jcr.impl.core.query.lucene.SearchIndex">
+ <properties>
+ <property name="index-dir" value="target/temp/index/db1/ws" />
+ <property name="changesfilter-class" value="org.exoplatform.services.jcr.impl.core.query.jbosscache.JbossCacheIndexChangesFilter" />
+ <property name="changesfilter-config-path" value="conf/cluster/test-jbosscache-indexer-config-exoloader_db1_ws.xml" />
+ <property name="max-volatile-size" value="307200"/>
+ </properties>
+ </query-handler>
+ <lock-manager>
+ <time-out>15m</time-out>
+ <persister class="org.exoplatform.services.jcr.impl.core.lock.FileSystemLockPersister">
+ <properties>
+ <property name="path" value="target/temp/lock" />
+ </properties>
+ </persister>
+ </lock-manager>
+ </workspace>
+
+ <workspace name="ws1">
+ <container class="org.exoplatform.services.jcr.impl.storage.jdbc.JDBCWorkspaceDataContainer">
+ <properties>
+ <property name="source-name" value="jdbcjcr1" />
+ <property name="dialect" value="mysql" />
+ <property name="multi-db" value="true" />
+ <property name="update-storage" value="false" />
+ <property name="max-buffer-size" value="200k" />
+ <property name="swap-directory" value="target/temp/swap/ws1" />
+ </properties>
+ <value-storages>
+ <value-storage id="ws1" class="org.exoplatform.services.jcr.impl.storage.value.fs.TreeFileValueStorage">
+ <properties>
+ <property name="path" value="target/temp/values/ws1" />
+ </properties>
+ <filters>
+ <filter property-type="Binary" />
+ </filters>
+ </value-storage>
+ </value-storages>
+ </container>
+ <cache enabled="true" class="org.exoplatform.services.jcr.impl.dataflow.persistent.jbosscache.JBossCacheWorkspaceStorageCache">
+ <properties>
+ <property name="jbosscache-configuration" value="conf/cluster/test-jbosscache-config-ws1.xml" />
+ </properties>
+ </cache>
+ <query-handler class="org.exoplatform.services.jcr.impl.core.query.lucene.SearchIndex">
+ <properties>
+ <property name="index-dir" value="target/temp/index/db1/ws1" />
+ <property name="synonymprovider-class" value="org.exoplatform.services.jcr.impl.core.query.lucene.PropertiesSynonymProvider" />
+ <property name="synonymprovider-config-path" value="../../synonyms.properties" />
+ <property name="support-highlighting" value="true" />
+ <property name="indexing-configuration-path" value="../../indexing-configuration.xml" />
+ <property name="query-class" value="org.exoplatform.services.jcr.impl.core.query.QueryImpl" />
+ <property name="spellchecker-class" value="org.exoplatform.services.jcr.impl.core.query.lucene.spell.LuceneSpellChecker$FiveSecondsRefreshInterval" />
+ </properties>
+ </query-handler>
+ </workspace>
+
+ <workspace name="ws2">
+ <container class="org.exoplatform.services.jcr.impl.storage.jdbc.JDBCWorkspaceDataContainer">
+ <properties>
+ <property name="source-name" value="jdbcjcr2" />
+ <property name="dialect" value="mysql" />
+ <property name="multi-db" value="true" />
+ <property name="update-storage" value="false" />
+ <property name="max-buffer-size" value="200k" />
+ <property name="swap-directory" value="target/temp/swap/ws2" />
+ </properties>
+ <value-storages>
+ <value-storage id="ws2" class="org.exoplatform.services.jcr.impl.storage.value.fs.TreeFileValueStorage">
+ <properties>
+ <property name="path" value="target/temp/values/ws2" />
+ </properties>
+ <filters>
+ <filter property-type="Binary" />
+ </filters>
+ </value-storage>
+ </value-storages>
+ </container>
+ <cache enabled="true" class="org.exoplatform.services.jcr.impl.dataflow.persistent.jbosscache.JBossCacheWorkspaceStorageCache">
+ <properties>
+ <property name="jbosscache-configuration" value="conf/cluster/test-jbosscache-config-ws2.xml" />
+ </properties>
+ </cache>
+ <query-handler class="org.exoplatform.services.jcr.impl.core.query.lucene.SearchIndex">
+ <properties>
+ <property name="index-dir" value="target/temp/index/db1/ws2" />
+ <property name="synonymprovider-class" value="org.exoplatform.services.jcr.impl.core.query.lucene.PropertiesSynonymProvider" />
+ <property name="synonymprovider-config-path" value="../../synonyms.properties" />
+ <property name="support-highlighting" value="true" />
+ <property name="indexing-configuration-path" value="../../indexing-configuration.xml" />
+ <property name="query-class" value="org.exoplatform.services.jcr.impl.core.query.QueryImpl" />
+ <property name="spellchecker-class" value="org.exoplatform.services.jcr.impl.core.query.lucene.spell.LuceneSpellChecker$FiveSecondsRefreshInterval" />
+ </properties>
+ </query-handler>
+ </workspace>
+
+ <workspace name="ws3">
+ <!-- for system storage -->
+ <container
+ class="org.exoplatform.services.jcr.impl.storage.jdbc.JDBCWorkspaceDataContainer">
+ <properties>
+ <property name="source-name" value="jdbcjcr3" />
+ <property name="dialect" value="mysql" />
+ <property name="multi-db" value="true" />
+ <property name="update-storage" value="false" />
+ <property name="max-buffer-size" value="200k" />
+ <property name="swap-directory" value="target/temp/swap/ws3" />
+ </properties>
+ <value-storages>
+ <!--
+ This storage is used to check whether properties are removed
+ correctly from each value-storage
+ (TestRemoveFromValueStorage.java)
+ -->
+ <value-storage id="ws3_big"
+ class="org.exoplatform.services.jcr.impl.storage.value.fs.TreeFileValueStorage">
+ <properties>
+ <property name="path" value="target/temp/values/ws3_big" />
+ </properties>
+ <filters>
+ <filter property-type="Binary" min-value-size="1024K" />
+ </filters>
+ </value-storage>
+ <value-storage id="ws3"
+ class="org.exoplatform.services.jcr.impl.storage.value.fs.CASableTreeFileValueStorage">
+ <properties>
+ <property name="path" value="target/temp/values/ws3" />
+ <property name="digest-algo" value="MD5" />
+ <property name="vcas-type"
+ value="org.exoplatform.services.jcr.impl.storage.value.cas.JDBCValueContentAddressStorageImpl" />
+ <property name="jdbc-source-name" value="jdbcjcr" />
+ <property name="jdbc-dialect" value="mysql" />
+ </properties>
+ <filters>
+ <filter property-type="Binary" />
+ </filters>
+ </value-storage>
+ </value-storages>
+ </container>
+ <initializer
+ class="org.exoplatform.services.jcr.impl.core.ScratchWorkspaceInitializer">
+ <properties>
+ <property name="root-nodetype" value="nt:unstructured" />
+ </properties>
+ </initializer>
+ <cache enabled="true" class="org.exoplatform.services.jcr.impl.dataflow.persistent.jbosscache.JBossCacheWorkspaceStorageCache">
+ <properties>
+ <property name="jbosscache-configuration" value="conf/cluster/test-jbosscache-config-ws3.xml" />
+ </properties>
+ </cache>
+ <query-handler
+ class="org.exoplatform.services.jcr.impl.core.query.lucene.SearchIndex">
+ <properties>
+ <property name="index-dir" value="target/temp/index/db1/ws3" />
+ <property name="synonymprovider-class"
+ value="org.exoplatform.services.jcr.impl.core.query.lucene.PropertiesSynonymProvider" />
+ <property name="synonymprovider-config-path" value="../../synonyms.properties" />
+ <property name="support-highlighting" value="true" />
+ <property name="indexing-configuration-path" value="../../indexing-configuration.xml" />
+ <property name="query-class"
+ value="org.exoplatform.services.jcr.impl.core.query.QueryImpl" />
+ <property name="spellchecker-class"
+ value="org.exoplatform.services.jcr.impl.core.query.lucene.spell.LuceneSpellChecker$FiveSecondsRefreshInterval" />
+ </properties>
+ </query-handler>
+ </workspace>
+ </workspaces>
+ </repository>
+
+ <repository name="db1tck" system-workspace="ws" default-workspace="ws">
+ <security-domain>exo-domain</security-domain>
+ <!-- access-control>optional</access-control -->
+ <!-- access-control>disable</access-control -->
+ <session-max-age>1h</session-max-age>
+ <authentication-policy>org.exoplatform.services.jcr.impl.core.access.JAASAuthenticator</authentication-policy>
+ <workspaces>
+ <workspace name="ws">
+ <!-- for system storage -->
+ <container class="org.exoplatform.services.jcr.impl.storage.jdbc.JDBCWorkspaceDataContainer">
+ <properties>
+ <property name="source-name" value="jdbcjcrtck" />
+ <property name="dialect" value="mysql" />
+ <property name="multi-db" value="true" />
+ <property name="update-storage" value="false" />
+ <property name="max-buffer-size" value="200k" />
+ <property name="swap-directory" value="target/temp/swap/wstck" />
+ </properties>
+ <value-storages>
+ <value-storage id="ws" class="org.exoplatform.services.jcr.impl.storage.value.fs.TreeFileValueStorage">
+ <properties>
+ <property name="path" value="target/temp/values/wstck" />
+ </properties>
+ <filters>
+ <filter property-type="Binary" min-value-size="100K" />
+ </filters>
+ </value-storage>
+ </value-storages>
+ </container>
+ <initializer class="org.exoplatform.services.jcr.impl.core.ScratchWorkspaceInitializer">
+ <properties>
+ <property name="root-nodetype" value="nt:unstructured" />
+ <property name="root-permissions" value="any read;*:/platform/administrators read;*:/platform/administrators add_node;*:/platform/administrators set_property;*:/platform/administrators remove" />
+ </properties>
+ </initializer>
+ <cache enabled="true" class="org.exoplatform.services.jcr.impl.dataflow.persistent.jbosscache.JBossCacheWorkspaceStorageCache">
+ <properties>
+ <property name="jbosscache-configuration" value="conf/cluster/test-jbosscache-config-wstck.xml" />
+ </properties>
+ </cache>
+ <query-handler class="org.exoplatform.services.jcr.impl.core.query.lucene.SearchIndex">
+ <properties>
+ <property name="index-dir" value="target/temp/index/db1tck/ws" />
+ <property name="synonymprovider-class" value="org.exoplatform.services.jcr.impl.core.query.lucene.PropertiesSynonymProvider" />
+ <property name="synonymprovider-config-path" value="../../synonyms.properties" />
+ <property name="support-highlighting" value="true" />
+ <property name="indexing-configuration-path" value="../../indexing-configuration.xml" />
+ <property name="query-class" value="org.exoplatform.services.jcr.impl.core.query.QueryImpl" />
+ <property name="excerptprovider-class" value="org.exoplatform.services.jcr.impl.core.query.lucene.WeightedHTMLExcerpt" />
+ <property name="spellchecker-class" value="org.exoplatform.services.jcr.impl.core.query.lucene.spell.LuceneSpellChecker$FiveSecondsRefreshInterval" />
+ </properties>
+ </query-handler>
+ <lock-manager>
+ <time-out>15m</time-out>
+ <persister class="org.exoplatform.services.jcr.impl.core.lock.FileSystemLockPersister">
+ <properties>
+ <property name="path" value="target/temp/locktck" />
+ </properties>
+ </persister>
+ </lock-manager>
+ </workspace>
+
+ <workspace name="ws1">
+ <container class="org.exoplatform.services.jcr.impl.storage.jdbc.JDBCWorkspaceDataContainer">
+ <properties>
+ <property name="source-name" value="jdbcjcr1tck" />
+ <property name="dialect" value="mysql" />
+ <property name="multi-db" value="true" />
+ <property name="update-storage" value="false" />
+ <property name="max-buffer-size" value="200k" />
+ <property name="swap-directory" value="target/temp/swap/ws1tck" />
+ </properties>
+ <value-storages>
+ <value-storage id="ws1" class="org.exoplatform.services.jcr.impl.storage.value.fs.TreeFileValueStorage">
+ <properties>
+ <property name="path" value="target/temp/values/ws1tck" />
+ </properties>
+ <filters>
+ <filter property-type="Binary" min-value-size="100K" />
+ </filters>
+ </value-storage>
+ </value-storages>
+ </container>
+ <initializer class="org.exoplatform.services.jcr.impl.core.ScratchWorkspaceInitializer">
+ <properties>
+ <property name="root-nodetype" value="nt:unstructured" />
+ <property name="root-permissions" value="any read;*:/platform/administrators read;*:/platform/administrators add_node;*:/platform/administrators set_property;*:/platform/administrators remove" />
+ </properties>
+ </initializer>
+ <cache enabled="true" class="org.exoplatform.services.jcr.impl.dataflow.persistent.jbosscache.JBossCacheWorkspaceStorageCache">
+ <properties>
+ <property name="jbosscache-configuration" value="conf/cluster/test-jbosscache-config-wstck1.xml" />
+ </properties>
+ </cache>
+ <query-handler class="org.exoplatform.services.jcr.impl.core.query.lucene.SearchIndex">
+ <properties>
+ <property name="index-dir" value="target/temp/index/db1tck/ws1" />
+ <property name="synonymprovider-class" value="org.exoplatform.services.jcr.impl.core.query.lucene.PropertiesSynonymProvider" />
+ <property name="synonymprovider-config-path" value="../../synonyms.properties" />
+ <property name="support-highlighting" value="true" />
+ <property name="indexing-configuration-path" value="../../indexing-configuration.xml" />
+ <property name="query-class" value="org.exoplatform.services.jcr.impl.core.query.QueryImpl" />
+ <property name="spellchecker-class" value="org.exoplatform.services.jcr.impl.core.query.lucene.spell.LuceneSpellChecker$FiveSecondsRefreshInterval" />
+ </properties>
+ </query-handler>
+ </workspace>
+
+ <workspace name="ws2">
+ <container class="org.exoplatform.services.jcr.impl.storage.jdbc.JDBCWorkspaceDataContainer">
+ <properties>
+ <property name="source-name" value="jdbcjcr2tck" />
+ <property name="dialect" value="mysql" />
+ <property name="multi-db" value="true" />
+ <property name="update-storage" value="false" />
+ <property name="max-buffer-size" value="200k" />
+ <property name="swap-directory" value="target/temp/swap/ws2tck" />
+ </properties>
+ <value-storages>
+ <value-storage id="ws2" class="org.exoplatform.services.jcr.impl.storage.value.fs.TreeFileValueStorage">
+ <properties>
+ <property name="path" value="target/temp/values/ws2tck" />
+ </properties>
+ <filters>
+ <filter property-type="Binary" min-value-size="100K" />
+ </filters>
+ </value-storage>
+ </value-storages>
+ </container>
+ <initializer class="org.exoplatform.services.jcr.impl.core.ScratchWorkspaceInitializer">
+ <properties>
+ <property name="root-nodetype" value="nt:unstructured" />
+ <property name="root-permissions" value="any read;*:/platform/administrators read;*:/platform/administrators add_node;*:/platform/administrators set_property;*:/platform/administrators remove" />
+ </properties>
+ </initializer>
+ <cache enabled="true" class="org.exoplatform.services.jcr.impl.dataflow.persistent.jbosscache.JBossCacheWorkspaceStorageCache">
+ <properties>
+ <property name="jbosscache-configuration" value="conf/cluster/test-jbosscache-config-wstck2.xml" />
+ </properties>
+ </cache>
+ <query-handler class="org.exoplatform.services.jcr.impl.core.query.lucene.SearchIndex">
+ <properties>
+ <property name="index-dir" value="target/temp/index/db1tck/ws2" />
+ <property name="synonymprovider-class" value="org.exoplatform.services.jcr.impl.core.query.lucene.PropertiesSynonymProvider" />
+ <property name="synonymprovider-config-path" value="../../synonyms.properties" />
+ <property name="support-highlighting" value="true" />
+ <property name="indexing-configuration-path" value="../../indexing-configuration.xml" />
+ <property name="query-class" value="org.exoplatform.services.jcr.impl.core.query.QueryImpl" />
+ <property name="spellchecker-class" value="org.exoplatform.services.jcr.impl.core.query.lucene.spell.LuceneSpellChecker$FiveSecondsRefreshInterval" />
+ <property name="excerptprovider-class" value="org.exoplatform.services.jcr.impl.core.query.lucene.WeightedHTMLExcerpt"/>
+ <property name="extractorPoolSize" value="2"/>
+ <property name="extractorTimeout" value="10"/>
+ </properties>
+ </query-handler>
+ </workspace>
+ </workspaces>
+ </repository>
+ </repositories>
+</repository-service>
Property changes on: jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/resources/conf/cluster/test-jcr-config.xml
___________________________________________________________________
Name: svn:mime-type
+ text/plain
16 years, 4 months
exo-jcr SVN: r1202 - jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/monitor.
by do-not-reply@jboss.org
Author: sergiykarpenko
Date: 2009-12-28 03:46:59 -0500 (Mon, 28 Dec 2009)
New Revision: 1202
Modified:
jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/monitor/ManagedConnection.java
jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/monitor/ManagedPreparedStatement.java
jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/monitor/ManagedStatement.java
Log:
EXOJCR-302: jdbc.monitor revert
Modified: jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/monitor/ManagedConnection.java
===================================================================
--- jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/monitor/ManagedConnection.java 2009-12-28 08:36:45 UTC (rev 1201)
+++ jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/monitor/ManagedConnection.java 2009-12-28 08:46:59 UTC (rev 1202)
@@ -21,23 +21,15 @@
import org.exoplatform.services.log.ExoLogger;
import org.exoplatform.services.log.Log;
-import java.sql.Array;
-import java.sql.Blob;
import java.sql.CallableStatement;
-import java.sql.Clob;
import java.sql.Connection;
import java.sql.DatabaseMetaData;
-import java.sql.NClob;
import java.sql.PreparedStatement;
-import java.sql.SQLClientInfoException;
import java.sql.SQLException;
import java.sql.SQLWarning;
-import java.sql.SQLXML;
import java.sql.Savepoint;
import java.sql.Statement;
-import java.sql.Struct;
import java.util.Map;
-import java.util.Properties;
/**
* Created by The eXo Platform SAS.
@@ -292,70 +284,4 @@
jdbcConn.setTypeMap(map);
}
-public Array createArrayOf(String arg0, Object[] arg1) throws SQLException {
- // TODO Auto-generated method stub
- return null;
}
-
-public Blob createBlob() throws SQLException {
- // TODO Auto-generated method stub
- return null;
-}
-
-public Clob createClob() throws SQLException {
- // TODO Auto-generated method stub
- return null;
-}
-
-public NClob createNClob() throws SQLException {
- // TODO Auto-generated method stub
- return null;
-}
-
-public SQLXML createSQLXML() throws SQLException {
- // TODO Auto-generated method stub
- return null;
-}
-
-public Struct createStruct(String arg0, Object[] arg1) throws SQLException {
- // TODO Auto-generated method stub
- return null;
-}
-
-public Properties getClientInfo() throws SQLException {
- // TODO Auto-generated method stub
- return null;
-}
-
-public String getClientInfo(String arg0) throws SQLException {
- // TODO Auto-generated method stub
- return null;
-}
-
-public boolean isValid(int arg0) throws SQLException {
- // TODO Auto-generated method stub
- return false;
-}
-
-public void setClientInfo(Properties arg0) throws SQLClientInfoException {
- // TODO Auto-generated method stub
-
-}
-
-public void setClientInfo(String arg0, String arg1)
- throws SQLClientInfoException {
- // TODO Auto-generated method stub
-
-}
-
-public boolean isWrapperFor(Class<?> arg0) throws SQLException {
- // TODO Auto-generated method stub
- return false;
-}
-
-public <T> T unwrap(Class<T> arg0) throws SQLException {
- // TODO Auto-generated method stub
- return null;
-}
-
-}
Modified: jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/monitor/ManagedPreparedStatement.java
===================================================================
--- jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/monitor/ManagedPreparedStatement.java 2009-12-28 08:36:45 UTC (rev 1201)
+++ jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/monitor/ManagedPreparedStatement.java 2009-12-28 08:46:59 UTC (rev 1202)
@@ -28,15 +28,12 @@
import java.sql.Blob;
import java.sql.Clob;
import java.sql.Date;
-import java.sql.NClob;
import java.sql.ParameterMetaData;
import java.sql.PreparedStatement;
import java.sql.Ref;
import java.sql.ResultSet;
import java.sql.ResultSetMetaData;
-import java.sql.RowId;
import java.sql.SQLException;
-import java.sql.SQLXML;
import java.sql.Time;
import java.sql.Timestamp;
import java.util.Calendar;
@@ -268,106 +265,4 @@
jdbcStmt.setUnicodeStream(parameterIndex, x, length);
}
-public void setAsciiStream(int parameterIndex, InputStream x)
- throws SQLException {
- // TODO Auto-generated method stub
-
}
-
-public void setAsciiStream(int parameterIndex, InputStream x, long length)
- throws SQLException {
- // TODO Auto-generated method stub
-
-}
-
-public void setBinaryStream(int parameterIndex, InputStream x)
- throws SQLException {
- // TODO Auto-generated method stub
-
-}
-
-public void setBinaryStream(int parameterIndex, InputStream x, long length)
- throws SQLException {
- // TODO Auto-generated method stub
-
-}
-
-public void setBlob(int parameterIndex, InputStream inputStream)
- throws SQLException {
- // TODO Auto-generated method stub
-
-}
-
-public void setBlob(int parameterIndex, InputStream inputStream, long length)
- throws SQLException {
- // TODO Auto-generated method stub
-
-}
-
-public void setCharacterStream(int parameterIndex, Reader reader)
- throws SQLException {
- // TODO Auto-generated method stub
-
-}
-
-public void setCharacterStream(int parameterIndex, Reader reader, long length)
- throws SQLException {
- // TODO Auto-generated method stub
-
-}
-
-public void setClob(int parameterIndex, Reader reader) throws SQLException {
- // TODO Auto-generated method stub
-
-}
-
-public void setClob(int parameterIndex, Reader reader, long length)
- throws SQLException {
- // TODO Auto-generated method stub
-
-}
-
-public void setNCharacterStream(int parameterIndex, Reader value)
- throws SQLException {
- // TODO Auto-generated method stub
-
-}
-
-public void setNCharacterStream(int parameterIndex, Reader value, long length)
- throws SQLException {
- // TODO Auto-generated method stub
-
-}
-
-public void setNClob(int parameterIndex, NClob value) throws SQLException {
- // TODO Auto-generated method stub
-
-}
-
-public void setNClob(int parameterIndex, Reader reader) throws SQLException {
- // TODO Auto-generated method stub
-
-}
-
-public void setNClob(int parameterIndex, Reader reader, long length)
- throws SQLException {
- // TODO Auto-generated method stub
-
-}
-
-public void setNString(int parameterIndex, String value) throws SQLException {
- // TODO Auto-generated method stub
-
-}
-
-public void setRowId(int parameterIndex, RowId x) throws SQLException {
- // TODO Auto-generated method stub
-
-}
-
-public void setSQLXML(int parameterIndex, SQLXML xmlObject) throws SQLException {
- // TODO Auto-generated method stub
-
-}
-
-}
Modified: jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/monitor/ManagedStatement.java
===================================================================
--- jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/monitor/ManagedStatement.java 2009-12-28 08:36:45 UTC (rev 1201)
+++ jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/monitor/ManagedStatement.java 2009-12-28 08:46:59 UTC (rev 1202)
@@ -235,29 +235,4 @@
jdbcStmt.setQueryTimeout(seconds);
}
-public boolean isClosed() throws SQLException {
- // TODO Auto-generated method stub
- return false;
}
-
-public boolean isPoolable() throws SQLException {
- // TODO Auto-generated method stub
- return false;
-}
-
-public void setPoolable(boolean poolable) throws SQLException {
- // TODO Auto-generated method stub
-
-}
-
-public boolean isWrapperFor(Class<?> iface) throws SQLException {
- // TODO Auto-generated method stub
- return false;
-}
-
-public <T> T unwrap(Class<T> iface) throws SQLException {
- // TODO Auto-generated method stub
- return null;
-}
-
-}
16 years, 4 months
exo-jcr SVN: r1201 - jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent.
by do-not-reply@jboss.org
Author: pnedonosko
Date: 2009-12-28 03:36:45 -0500 (Mon, 28 Dec 2009)
New Revision: 1201
Modified:
jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/LocalWorkspaceDataManagerStub.java
Log:
EXOJCR-273 unmodifiable list in persistence stub data manager (example of impl)
Modified: jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/LocalWorkspaceDataManagerStub.java
===================================================================
--- jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/LocalWorkspaceDataManagerStub.java 2009-12-26 14:04:18 UTC (rev 1200)
+++ jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/LocalWorkspaceDataManagerStub.java 2009-12-28 08:36:45 UTC (rev 1201)
@@ -18,9 +18,15 @@
*/
package org.exoplatform.services.jcr.impl.dataflow.persistent;
+import org.exoplatform.services.jcr.datamodel.NodeData;
import org.exoplatform.services.log.ExoLogger;
import org.exoplatform.services.log.Log;
+import java.util.Collections;
+import java.util.List;
+
+import javax.jcr.RepositoryException;
+
/**
* Created by The eXo Platform SAS.
*
@@ -37,4 +43,14 @@
{
super(persistentManager);
}
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public List<NodeData> getChildNodesData(NodeData nodeData) throws RepositoryException
+ {
+ return Collections.unmodifiableList(super.getChildNodesData(nodeData));
+ }
+
}
16 years, 4 months
exo-jcr SVN: r1200 - in jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation: db and 1 other directory.
by do-not-reply@jboss.org
Author: sergiykarpenko
Date: 2009-12-26 09:04:18 -0500 (Sat, 26 Dec 2009)
New Revision: 1200
Modified:
jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/CQJDBCStorageConnection.java
jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/MultiDbJDBCConnection.java
jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/SingleDbJDBCConnection.java
Log:
EXOJCR-302: CQJDBCStorageConnection single db queries updated
Modified: jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/CQJDBCStorageConnection.java
===================================================================
--- jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/CQJDBCStorageConnection.java 2009-12-26 12:15:51 UTC (rev 1199)
+++ jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/CQJDBCStorageConnection.java 2009-12-26 14:04:18 UTC (rev 1200)
@@ -65,22 +65,22 @@
/**
* FIND_ITEM_BY_NAME NEW.
*/
- protected String FIND_ITEM_BY_NAME_NEW;
+ protected String FIND_ITEM_BY_NAME_CQ;
/**
* FIND_NODE_BY_ID.
*/
- protected String FIND_ITEM_BY_ID_NEW;
+ protected String FIND_ITEM_BY_ID_CQ;
/**
* FIND_NODES_BY_PARENTID NEW.
*/
- protected String FIND_NODES_BY_PARENTID_NEW;
+ protected String FIND_NODES_BY_PARENTID_CQ;
/**
* GET_PROPERTIES_BY_PARENT_ID
*/
- protected String GET_PROPERTIES_BY_PARENTID;
+ protected String GET_PROPERTIES_BY_PARENTID_CQ;
/**
* FIND_REFERENCE_PROPERTIES
@@ -238,7 +238,7 @@
try
{
- ResultSet resultSet = getChildPropertiesByParentIdentifier(getInternalId(parent.getIdentifier()));
+ ResultSet resultSet = getChildPropertiesByParentIdentifierCQ(getInternalId(parent.getIdentifier()));
List<PropertyData> children = new ArrayList<PropertyData>();
if (resultSet.next())
{
@@ -317,7 +317,7 @@
ResultSet resultSet = null;
try
{
- resultSet = findItemByIdentifierWithAllData(cid);
+ resultSet = findItemByIdentifierCQ(cid);
if (resultSet.next())
{
int itemType = resultSet.getInt(COLUMN_CLASS);
@@ -379,7 +379,7 @@
ResultSet resultSet = null;
try
{
- resultSet = findItemByNameWithAllData(parentId, name.getAsString(), name.getIndex());
+ resultSet = findItemByNameCQ(parentId, name.getAsString(), name.getIndex());
if (resultSet.next())
{
// return itemData(parent.getQPath(), item, item.getInt(COLUMN_CLASS), parent.getACL());
@@ -868,11 +868,11 @@
// }
// }
- protected abstract ResultSet findItemByIdentifierWithAllData(String identifier) throws SQLException;
+ protected abstract ResultSet findItemByIdentifierCQ(String identifier) throws SQLException;
- protected abstract ResultSet findItemByNameWithAllData(String parentId, String name, int index) throws SQLException;
+ protected abstract ResultSet findItemByNameCQ(String parentId, String name, int index) throws SQLException;
protected abstract ResultSet findChildNodesByParentIdentifierCQ(String parentIdentifier) throws SQLException;
- protected abstract ResultSet getChildPropertiesByParentIdentifier(String parentIdentifier) throws SQLException;
+ protected abstract ResultSet getChildPropertiesByParentIdentifierCQ(String parentIdentifier) throws SQLException;
}
Modified: jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/MultiDbJDBCConnection.java
===================================================================
--- jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/MultiDbJDBCConnection.java 2009-12-26 12:15:51 UTC (rev 1199)
+++ jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/MultiDbJDBCConnection.java 2009-12-26 14:04:18 UTC (rev 1200)
@@ -53,13 +53,13 @@
protected PreparedStatement findItemById;
- protected PreparedStatement findItemByIdNew;
+ protected PreparedStatement findItemByIdCQ;
protected PreparedStatement findItemByPath;
protected PreparedStatement findItemByName;
- protected PreparedStatement findItemByNameNew;
+ protected PreparedStatement findItemByNameCQ;
protected PreparedStatement findChildPropertyByPath;
@@ -83,12 +83,14 @@
protected PreparedStatement findValueByPropertyIdOrderNumber;
protected PreparedStatement findNodesByParentId;
+
+ protected PreparedStatement findNodesByParentIdCQ;
protected PreparedStatement findNodesCountByParentId;
protected PreparedStatement findPropertiesByParentId;
- protected PreparedStatement getPropertiesByParentId;
+ protected PreparedStatement getPropertiesByParentIdCQ;
protected PreparedStatement insertNode;
@@ -176,7 +178,7 @@
FIND_ITEM_BY_ID = "select * from JCR_MITEM where ID=?";
- FIND_ITEM_BY_ID_NEW =
+ FIND_ITEM_BY_ID_CQ =
"select I.*, V.ORDER_NUM, V.DATA, V.STORAGE_DESC from JCR_MITEM I LEFT OUTER JOIN JCR_MVALUE V ON (V.PROPERTY_ID=I.ID)"
+ " where (I.ID=?) or (I.PARENT_ID=? and I.I_CLASS=2 and (I.NAME='[http://www.jcp.org/jcr/1.0]primaryType'"
+ " or I.NAME='[http://www.jcp.org/jcr/1.0]mixinTypes' or I.NAME='[http://www.exoplatform.com/jcr/exo/1.0]owner'"
@@ -185,7 +187,7 @@
FIND_ITEM_BY_NAME =
"select * from JCR_MITEM" + " where PARENT_ID=? and NAME=? and I_INDEX=? order by I_CLASS, VERSION DESC";
- FIND_ITEM_BY_NAME_NEW =
+ FIND_ITEM_BY_NAME_CQ =
"select I.*, V.ORDER_NUM, V.DATA, V.STORAGE_DESC from JCR_MITEM I LEFT OUTER JOIN JCR_MVALUE V ON (V.PROPERTY_ID=I.ID)"
+ ", (select ID from JCR_MITEM where PARENT_ID=? and NAME=? and I_INDEX=?) I2"
+ " where (I.ID=I2.ID) or (I.PARENT_ID=I2.ID and I.I_CLASS=2 and (I.NAME='[http://www.jcp.org/jcr/1.0]primaryType'"
@@ -215,7 +217,7 @@
FIND_NODES_BY_PARENTID = "select * from JCR_MITEM" + " where I_CLASS=1 and PARENT_ID=?" + " order by N_ORDER_NUM";
- FIND_NODES_BY_PARENTID_NEW =
+ FIND_NODES_BY_PARENTID_CQ =
"select I.*, V.DATA, V.ORDER_NUM"
+ " from JCR_MITEM I LEFT OUTER JOIN JCR_MVALUE V ON (V.PROPERTY_ID=I.ID), (select ID from JCR_MITEM where PARENT_ID=? and I_CLASS=1) I2"
+ " where (I.I_CLASS=1 AND I.ID=I2.ID) or (I.I_CLASS=2 and I.PARENT_ID=I2.ID and"
@@ -227,7 +229,7 @@
FIND_PROPERTIES_BY_PARENTID = "select * from JCR_MITEM" + " where I_CLASS=2 and PARENT_ID=?" + " order by ID";
// property may contain no values
- GET_PROPERTIES_BY_PARENTID =
+ GET_PROPERTIES_BY_PARENTID_CQ =
"select I.*, V.ORDER_NUM, V.DATA, V.STORAGE_DESC from JCR_MITEM I LEFT OUTER JOIN JCR_MVALUE V ON (V.PROPERTY_ID=I.ID)"
+ " where I.I_CLASS=2 and I.PARENT_ID=? order by ID, ORDER_NUM";
@@ -409,17 +411,17 @@
/**
* {@inheritDoc}
*/
- protected ResultSet findItemByNameWithAllData(String parentId, String name, int index) throws SQLException
+ protected ResultSet findItemByNameCQ(String parentId, String name, int index) throws SQLException
{
- if (findItemByNameNew == null)
- findItemByNameNew = dbConnection.prepareStatement(FIND_ITEM_BY_NAME_NEW);
+ if (findItemByNameCQ == null)
+ findItemByNameCQ = dbConnection.prepareStatement(FIND_ITEM_BY_NAME_CQ);
else
- findItemByNameNew.clearParameters();
+ findItemByNameCQ.clearParameters();
- findItemByNameNew.setString(1, parentId);
- findItemByNameNew.setString(2, name);
- findItemByNameNew.setInt(3, index);
- return findItemByNameNew.executeQuery();
+ findItemByNameCQ.setString(1, parentId);
+ findItemByNameCQ.setString(2, name);
+ findItemByNameCQ.setInt(3, index);
+ return findItemByNameCQ.executeQuery();
}
/**
@@ -489,14 +491,14 @@
@Override
protected ResultSet findChildNodesByParentIdentifierCQ(String parentIdentifier) throws SQLException
{
- if (findNodesByParentId == null)
- findNodesByParentId = dbConnection.prepareStatement(FIND_NODES_BY_PARENTID_NEW);
+ if (findNodesByParentIdCQ == null)
+ findNodesByParentIdCQ = dbConnection.prepareStatement(FIND_NODES_BY_PARENTID_CQ);
else
- findNodesByParentId.clearParameters();
+ findNodesByParentIdCQ.clearParameters();
- findNodesByParentId.setString(1, parentIdentifier);
+ findNodesByParentIdCQ.setString(1, parentIdentifier);
//findNodesByParentId.setString(2, parentIdentifier);
- return findNodesByParentId.executeQuery();
+ return findNodesByParentIdCQ.executeQuery();
}
/**
@@ -641,27 +643,27 @@
}
@Override
- protected ResultSet findItemByIdentifierWithAllData(String identifier) throws SQLException
+ protected ResultSet findItemByIdentifierCQ(String identifier) throws SQLException
{
- if (findItemByIdNew == null)
- findItemByIdNew = dbConnection.prepareStatement(FIND_ITEM_BY_ID_NEW);
+ if (findItemByIdCQ == null)
+ findItemByIdCQ = dbConnection.prepareStatement(FIND_ITEM_BY_ID_CQ);
else
- findItemByIdNew.clearParameters();
- findItemByIdNew.setString(1, identifier);
- findItemByIdNew.setString(2, identifier);
- return findItemByIdNew.executeQuery();
+ findItemByIdCQ.clearParameters();
+ findItemByIdCQ.setString(1, identifier);
+ findItemByIdCQ.setString(2, identifier);
+ return findItemByIdCQ.executeQuery();
}
@Override
- protected ResultSet getChildPropertiesByParentIdentifier(String parentIdentifier) throws SQLException
+ protected ResultSet getChildPropertiesByParentIdentifierCQ(String parentIdentifier) throws SQLException
{
- if (getPropertiesByParentId == null)
- getPropertiesByParentId = dbConnection.prepareStatement(GET_PROPERTIES_BY_PARENTID);
+ if (getPropertiesByParentIdCQ == null)
+ getPropertiesByParentIdCQ = dbConnection.prepareStatement(GET_PROPERTIES_BY_PARENTID_CQ);
else
- getPropertiesByParentId.clearParameters();
+ getPropertiesByParentIdCQ.clearParameters();
- getPropertiesByParentId.setString(1, parentIdentifier);
- return getPropertiesByParentId.executeQuery();
+ getPropertiesByParentIdCQ.setString(1, parentIdentifier);
+ return getPropertiesByParentIdCQ.executeQuery();
}
}
Modified: jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/SingleDbJDBCConnection.java
===================================================================
--- jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/SingleDbJDBCConnection.java 2009-12-26 12:15:51 UTC (rev 1199)
+++ jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/SingleDbJDBCConnection.java 2009-12-26 14:04:18 UTC (rev 1200)
@@ -51,12 +51,14 @@
protected PreparedStatement findItemById;
- protected PreparedStatement findItemByIdNew;
+ protected PreparedStatement findItemByIdCQ;
protected PreparedStatement findItemByPath;
protected PreparedStatement findItemByName;
+ protected PreparedStatement findItemByNameCQ;
+
protected PreparedStatement findChildPropertyByPath;
protected PreparedStatement findPropertyByName;
@@ -77,10 +79,14 @@
protected PreparedStatement findNodesByParentId;
+ protected PreparedStatement findNodesByParentIdCQ;
+
protected PreparedStatement findNodesCountByParentId;
protected PreparedStatement findPropertiesByParentId;
+ protected PreparedStatement getPropertiesByParentIdCQ;
+
protected PreparedStatement insertItem;
protected PreparedStatement insertNode;
@@ -177,17 +183,26 @@
FIND_ITEM_BY_NAME =
"select * from JCR_SITEM"
+ " where CONTAINER_NAME=? and PARENT_ID=? and NAME=? and I_INDEX=? order by I_CLASS, VERSION DESC";
+
+ FIND_ITEM_BY_NAME_CQ =
+ "select I.*, V.ORDER_NUM, V.DATA, V.STORAGE_DESC from JCR_SITEM I LEFT OUTER JOIN JCR_SVALUE V ON (V.PROPERTY_ID=I.ID)"
+ + ", (select ID from JCR_SITEM where CONTAINER_NAME=? and PARENT_ID=? and NAME=? and I_INDEX=?) I2"
+ + " where (I.ID=I2.ID) or (I.PARENT_ID=I2.ID and I.I_CLASS=2 and (I.NAME='[http://www.jcp.org/jcr/1.0]primaryType'"
+ + " or I.NAME='[http://www.jcp.org/jcr/1.0]mixinTypes' or I.NAME='[http://www.exoplatform.com/jcr/exo/1.0]owner'"
+ + " or I.NAME='[http://www.exoplatform.com/jcr/exo/1.0]permissions')) order by I.I_CLASS, I.N_ORDER_NUM, V.ORDER_NUM";
- FIND_ITEM_BY_ID_NEW =
- "select I.*, V.ORDER_NUM, V.DATA, V.STORAGE_DESC"
- + " from JCR_SITEM I LEFT OUTER JOIN JCR_SVALUE V ON (V.PROPERTY_ID=I.ID)"
- + " where I.ID=? OR (I.I_CLASS=2 and I.CONTAINER_NAME=? and I.PARENT_ID=? and I.NAME IN ('[http://www.jcp.org/jcr/1.0]primaryType')) order by V.ORDER_NUM";
+ FIND_ITEM_BY_ID_CQ =
+ "select I.*, V.ORDER_NUM, V.DATA, V.STORAGE_DESC from JCR_SITEM I LEFT OUTER JOIN JCR_SVALUE V ON (V.PROPERTY_ID=I.ID)"
+ + " where (I.ID=?) or (I.PARENT_ID=? and I.I_CLASS=2 and (I.NAME='[http://www.jcp.org/jcr/1.0]primaryType'"
+ + " or I.NAME='[http://www.jcp.org/jcr/1.0]mixinTypes' or I.NAME='[http://www.exoplatform.com/jcr/exo/1.0]owner'"
+ + " or I.NAME='[http://www.exoplatform.com/jcr/exo/1.0]permissions')) order by I.I_CLASS, I.N_ORDER_NUM, V.ORDER_NUM";
FIND_PROPERTY_BY_NAME =
"select V.DATA"
+ " from JCR_SITEM I, JCR_SVALUE V"
+ " where I.I_CLASS=2 and I.CONTAINER_NAME=? and I.PARENT_ID=? and I.NAME=? and I.ID=V.PROPERTY_ID order by V.ORDER_NUM";
+
FIND_REFERENCES =
"select P.ID, P.PARENT_ID, P.VERSION, P.P_TYPE, P.P_MULTIVALUED, P.NAME" + " from JCR_SREF R, JCR_SITEM P"
+ " where R.NODE_ID=? and P.CONTAINER_NAME=? and P.ID=R.PROPERTY_ID and P.I_CLASS=2";
@@ -202,12 +217,23 @@
FIND_NODES_BY_PARENTID =
"select * from JCR_SITEM" + " where I_CLASS=1 and CONTAINER_NAME=? and PARENT_ID=?" + " order by N_ORDER_NUM";
+ FIND_NODES_BY_PARENTID_CQ =
+ "select I.*, V.DATA, V.ORDER_NUM"
+ + " from JCR_SITEM I LEFT OUTER JOIN JCR_SVALUE V ON (V.PROPERTY_ID=I.ID), (select ID from JCR_SITEM where I_CLASS=1 and CONTAINER_NAME=? and PARENT_ID=?) I2"
+ + " where (I.I_CLASS=1 AND I.ID=I2.ID) or (I.I_CLASS=2 and I.PARENT_ID=I2.ID and"
+ + " (I.NAME='[http://www.jcp.org/jcr/1.0]primaryType' or I.NAME='[http://www.jcp.org/jcr/1.0]mixinTypes'"
+ + " or I.NAME='[http://www.exoplatform.com/jcr/exo/1.0]owner' or I.NAME='[http://www.exoplatform.com/jcr/exo/1.0]permissions')) order by I.I_CLASS, I.N_ORDER_NUM, V.ORDER_NUM";
+
FIND_NODES_COUNT_BY_PARENTID =
"select count(ID) from JCR_SITEM" + " where I_CLASS=1 and CONTAINER_NAME=? and PARENT_ID=?";
FIND_PROPERTIES_BY_PARENTID =
"select * from JCR_SITEM" + " where I_CLASS=2 and CONTAINER_NAME=? and PARENT_ID=?" + " order by ID";
+ GET_PROPERTIES_BY_PARENTID_CQ =
+ "select I.*, V.ORDER_NUM, V.DATA, V.STORAGE_DESC from JCR_SITEM I LEFT OUTER JOIN JCR_SVALUE V ON (V.PROPERTY_ID=I.ID)"
+ + " where I.I_CLASS=2 and CONTAINER_NAME=? and I.PARENT_ID=? order by ID, ORDER_NUM";
+
INSERT_NODE =
"insert into JCR_SITEM(ID, PARENT_ID, NAME, CONTAINER_NAME, VERSION, I_CLASS, I_INDEX, N_ORDER_NUM) VALUES(?,?,?,?,?,"
+ I_CLASS_NODE + ",?,?)";
@@ -397,21 +423,7 @@
return findItemByName.executeQuery();
}
- @Override
- protected ResultSet findItemByNameWithAllData(String parentId, String name, int index) throws SQLException
- {
- if (findItemByName == null)
- findItemByName = dbConnection.prepareStatement(FIND_ITEM_BY_NAME);
- else
- findItemByName.clearParameters();
- findItemByName.setString(1, containerName);
- findItemByName.setString(2, parentId);
- findItemByName.setString(3, name);
- findItemByName.setInt(4, index);
- return findItemByName.executeQuery();
- }
-
/**
* {@inheritDoc}
*/
@@ -608,30 +620,61 @@
}
@Override
- protected ResultSet findItemByIdentifierWithAllData(String identifier) throws SQLException
+ protected ResultSet findItemByNameCQ(String parentId, String name, int index) throws SQLException
{
- if (findItemByIdNew == null)
- findItemByIdNew = dbConnection.prepareStatement(FIND_ITEM_BY_ID_NEW);
+ if (findItemByNameCQ == null)
+ findItemByNameCQ = dbConnection.prepareStatement(FIND_ITEM_BY_NAME_CQ);
else
- findItemByIdNew.clearParameters();
- findItemByIdNew.setString(1, identifier);
- findItemByIdNew.setString(2, containerName);
- findItemByIdNew.setString(3, identifier);
- return findItemByIdNew.executeQuery();
+ findItemByNameCQ.clearParameters();
+
+ findItemByNameCQ.setString(1, containerName);
+ findItemByNameCQ.setString(2, parentId);
+ findItemByNameCQ.setString(3, name);
+ findItemByNameCQ.setInt(4, index);
+ return findItemByNameCQ.executeQuery();
}
+
@Override
+ protected ResultSet findItemByIdentifierCQ(String identifier) throws SQLException
+ {
+
+ if (findItemByIdCQ == null)
+ findItemByIdCQ = dbConnection.prepareStatement(FIND_ITEM_BY_ID_CQ);
+ else
+ findItemByIdCQ.clearParameters();
+ findItemByIdCQ.setString(1, identifier);
+ findItemByIdCQ.setString(2, identifier);
+ return findItemByIdCQ.executeQuery();
+ }
+
+ @Override
protected ResultSet findChildNodesByParentIdentifierCQ(String parentIdentifier) throws SQLException
{
- // TODO Auto-generated method stub
- return null;
+
+
+ if (findNodesByParentIdCQ == null)
+ findNodesByParentIdCQ = dbConnection.prepareStatement(FIND_NODES_BY_PARENTID_CQ);
+ else
+ findNodesByParentIdCQ.clearParameters();
+
+ findNodesByParentIdCQ.setString(1, containerName);
+ findNodesByParentIdCQ.setString(2, parentIdentifier);
+ return findNodesByParentIdCQ.executeQuery();
}
@Override
- protected ResultSet getChildPropertiesByParentIdentifier(String parentIdentifier) throws SQLException
+ protected ResultSet getChildPropertiesByParentIdentifierCQ(String parentIdentifier) throws SQLException
{
- // TODO Auto-generated method stub
- return null;
+ if (getPropertiesByParentIdCQ == null)
+ getPropertiesByParentIdCQ = dbConnection.prepareStatement(GET_PROPERTIES_BY_PARENTID_CQ);
+ else
+ getPropertiesByParentIdCQ.clearParameters();
+
+ getPropertiesByParentIdCQ.setString(1, containerName);
+ getPropertiesByParentIdCQ.setString(2, parentIdentifier);
+ return getPropertiesByParentIdCQ.executeQuery();
+
}
}
16 years, 4 months
exo-jcr SVN: r1199 - in jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc: optimisation and 1 other directories.
by do-not-reply@jboss.org
Author: sergiykarpenko
Date: 2009-12-26 07:15:51 -0500 (Sat, 26 Dec 2009)
New Revision: 1199
Modified:
jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/JDBCStorageConnection.java
jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/CQJDBCStorageConnection.java
jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/MultiDbJDBCConnection.java
jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/SingleDbJDBCConnection.java
Log:
EXOJCR-302: CQJDBCStorageConnection clean up
Modified: jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/JDBCStorageConnection.java
===================================================================
--- jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/JDBCStorageConnection.java 2009-12-26 09:53:58 UTC (rev 1198)
+++ jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/JDBCStorageConnection.java 2009-12-26 12:15:51 UTC (rev 1199)
@@ -832,7 +832,7 @@
* @throws IllegalNameException
* - if name on the path is wrong
*/
- private QPath traverseQPath(String cpid) throws SQLException, InvalidItemStateException, IllegalNameException
+ protected QPath traverseQPath(String cpid) throws SQLException, InvalidItemStateException, IllegalNameException
{
// get item by Identifier usecase
List<QPathEntry> qrpath = new ArrayList<QPathEntry>(); // reverted path
Modified: jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/CQJDBCStorageConnection.java
===================================================================
--- jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/CQJDBCStorageConnection.java 2009-12-26 09:53:58 UTC (rev 1198)
+++ jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/CQJDBCStorageConnection.java 2009-12-26 12:15:51 UTC (rev 1199)
@@ -18,6 +18,21 @@
*/
package org.exoplatform.services.jcr.impl.storage.jdbc.optimisation;
+import java.io.File;
+import java.io.IOException;
+import java.sql.Connection;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.StringTokenizer;
+
+import javax.jcr.InvalidItemStateException;
+import javax.jcr.RepositoryException;
+
import org.exoplatform.services.jcr.access.AccessControlEntry;
import org.exoplatform.services.jcr.access.AccessControlList;
import org.exoplatform.services.jcr.dataflow.persistent.PersistedNodeData;
@@ -32,36 +47,12 @@
import org.exoplatform.services.jcr.datamodel.QPathEntry;
import org.exoplatform.services.jcr.datamodel.ValueData;
import org.exoplatform.services.jcr.impl.Constants;
-import org.exoplatform.services.jcr.impl.dataflow.persistent.ByteArrayPersistedValueData;
-import org.exoplatform.services.jcr.impl.dataflow.persistent.CleanableFilePersistedValueData;
-import org.exoplatform.services.jcr.impl.dataflow.persistent.StreamPersistedValueData;
import org.exoplatform.services.jcr.impl.storage.jdbc.JDBCStorageConnection;
import org.exoplatform.services.jcr.impl.storage.value.ValueStorageNotFoundException;
-import org.exoplatform.services.jcr.impl.storage.value.fs.operations.ValueFileIOHelper;
import org.exoplatform.services.jcr.impl.util.io.FileCleaner;
-import org.exoplatform.services.jcr.impl.util.io.SwapFile;
import org.exoplatform.services.jcr.storage.value.ValueIOChannel;
import org.exoplatform.services.jcr.storage.value.ValueStoragePluginProvider;
-import java.io.ByteArrayInputStream;
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.sql.Connection;
-import java.sql.ResultSet;
-import java.sql.SQLException;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.StringTokenizer;
-
-import javax.jcr.InvalidItemStateException;
-import javax.jcr.RepositoryException;
-
/**
* Created by The eXo Platform SAS.
*
@@ -120,9 +111,7 @@
cid = item.getString(COLUMN_ID);
cname = item.getString(COLUMN_NAME);
cversion = item.getInt(COLUMN_VERSION);
-
cpid = item.getString(COLUMN_PARENTID);
-
cindex = item.getInt(COLUMN_INDEX);
cnordernumb = item.getInt(COLUMN_NORDERNUM);
}
@@ -162,7 +151,7 @@
try
{
// query will return nodes and properties in same result set
- ResultSet resultSet = findChildNodesByParentIdentifierNew(getInternalId(parent.getIdentifier()));
+ ResultSet resultSet = findChildNodesByParentIdentifierCQ(getInternalId(parent.getIdentifier()));
if (resultSet.next())
{
Map<String, TempNodeData> tempNodes = loadTempNodesFromResultSet(resultSet);
@@ -236,23 +225,8 @@
*/
public int getChildNodesCount(NodeData parent) throws RepositoryException
{
- checkIfOpened();
- try
- {
- ResultSet count = findChildNodesCountByParentIdentifier(getInternalId(parent.getIdentifier()));
- if (count.next())
- {
- return count.getInt(1);
- }
- else
- {
- throw new RepositoryException("FATAL No resulton childNodes count for " + parent.getQPath().getAsString());
- }
- }
- catch (SQLException e)
- {
- throw new RepositoryException(e);
- }
+ // nothing to optimize
+ return super.getChildNodesCount(parent);
}
/**
@@ -287,29 +261,11 @@
/**
* {@inheritDoc}
- *
- * TODO left as current
*/
public List<PropertyData> listChildPropertiesData(NodeData parent) throws RepositoryException, IllegalStateException
{
- checkIfOpened();
- try
- {
- ResultSet prop = findChildPropertiesByParentIdentifier(getInternalId(parent.getIdentifier()));
- List<PropertyData> children = new ArrayList<PropertyData>();
- while (prop.next())
- children.add(propertyData(parent.getQPath(), prop));
-
- return children;
- }
- catch (SQLException e)
- {
- throw new RepositoryException(e);
- }
- catch (IOException e)
- {
- throw new RepositoryException(e);
- }
+ // nothing to optimize
+ return super.listChildPropertiesData(parent);
}
/**
@@ -320,6 +276,9 @@
return getItemByIdentifier(getInternalId(identifier));
}
+ /**
+ * {@inheritDoc}
+ */
public ItemData getItemData(NodeData parentData, QPathEntry name) throws RepositoryException, IllegalStateException
{
@@ -337,38 +296,10 @@
*/
public List<PropertyData> getReferencesData(String nodeIdentifier) throws RepositoryException, IllegalStateException
{
- checkIfOpened();
- try
- {
- ResultSet refProps = findReferences(getInternalId(nodeIdentifier));
- List<PropertyData> references = new ArrayList<PropertyData>();
- while (refProps.next())
- {
- references.add((PropertyData)itemData(null, refProps, I_CLASS_PROPERTY, null));
- }
-
- // ResultSet resultSet = findReferenceProperties(getInternalId(nodeIdentifier));
- // List<PropertyData> references = new ArrayList<PropertyData>(); //
- // if (resultSet.next())
- // {
- // while (!resultSet.isAfterLast())
- // references.add(loadPropertyRecord(resultSet, null));
- // }
-
- return references;
- }
- catch (SQLException e)
- {
- throw new RepositoryException(e);
- }
- catch (IOException e)
- {
- throw new RepositoryException(e);
- }
+ // can't optimize - result may return same node more than one time, so parse result set is difficult
+ return super.getReferencesData(nodeIdentifier);
}
- // ------------------ Private methods ---------------
-
/**
* Get Item By Identifier.
*
@@ -386,7 +317,7 @@
ResultSet resultSet = null;
try
{
- resultSet = findItemByIdentifierNew(cid);
+ resultSet = findItemByIdentifierWithAllData(cid);
if (resultSet.next())
{
int itemType = resultSet.getInt(COLUMN_CLASS);
@@ -394,7 +325,6 @@
{
Map<String, TempNodeData> node = loadTempNodesFromResultSet(resultSet);
return loadNodeFromTemporaryNodeData(node.get(cid), null, null);
- //return loadNodeRecord(resultSet, null, null);
}
else
{
@@ -449,7 +379,7 @@
ResultSet resultSet = null;
try
{
- resultSet = findItemByNameNew(parentId, name.getAsString(), name.getIndex());
+ resultSet = findItemByNameWithAllData(parentId, name.getAsString(), name.getIndex());
if (resultSet.next())
{
// return itemData(parent.getQPath(), item, item.getInt(COLUMN_CLASS), parent.getACL());
@@ -468,8 +398,6 @@
NodeData nodeData = loadNodeFromTemporaryNodeData(tempNodes.get(firstNodeId), parentQPath, parentACL);
tempNodes.clear();
return nodeData;
-
- //return loadNodeRecord(resultSet, parent.getQPath(), parent.getACL());
}
else
{
@@ -501,207 +429,6 @@
}
}
- /**
- * Build Item path by id.
- *
- * @param cpid
- * - Item id (container id)
- * @return Item QPath
- * @throws SQLException
- * - if database error occurs
- * @throws InvalidItemStateException
- * - if parent not found
- * @throws IllegalNameException
- * - if name on the path is wrong
- */
- private QPath traverseQPath(String cpid) throws SQLException, InvalidItemStateException, IllegalNameException
- {
- // get item by Identifier usecase
- List<QPathEntry> qrpath = new ArrayList<QPathEntry>(); // reverted path
- String caid = cpid; // container ancestor id
- do
- {
- ResultSet parent = null;
- try
- {
- parent = findItemByIdentifier(caid);
- if (!parent.next())
- throw new InvalidItemStateException("Parent not found, uuid: " + getIdentifier(caid));
-
- QPathEntry qpe =
- new QPathEntry(InternalQName.parse(parent.getString(COLUMN_NAME)), parent.getInt(COLUMN_INDEX));
- qrpath.add(qpe);
- caid = parent.getString(COLUMN_PARENTID);
- }
- finally
- {
- parent.close();
- }
- }
- while (!caid.equals(Constants.ROOT_PARENT_UUID));
-
- QPathEntry[] qentries = new QPathEntry[qrpath.size()];
- int qi = 0;
- for (int i = qrpath.size() - 1; i >= 0; i--)
- {
- qentries[qi++] = qrpath.get(i);
- }
- return new QPath(qentries);
- }
-
- /**
- * ItemLocationInfo.
- *
- */
- class ItemLocationInfo
- {
- /**
- * Item qpath
- */
- final QPath qpath;
-
- /**
- * All ancestors of the item with qpath
- */
- final List<String> ancestors;
-
- /**
- * Item id.
- */
- final String itemId;
-
- /**
- * ItemLocationInfo constructor.
- *
- * @param qpath
- * Item path
- * @param ancestors
- * ancesstors id list
- * @param itemId
- * Item id
- */
- ItemLocationInfo(QPath qpath, List<String> ancestors, String itemId)
- {
- this.qpath = qpath;
- this.ancestors = ancestors;
- this.itemId = itemId;
- }
- }
-
- protected String findParentId(String cid) throws SQLException, RepositoryException
- {
- ResultSet pidrs = findItemByIdentifier(cid);
- try
- {
- if (pidrs.next())
- return pidrs.getString(COLUMN_PARENTID);
- else
- throw new RepositoryException("Item not found id: " + getIdentifier(cid));
- }
- finally
- {
- pidrs.close();
- }
- }
-
- /**
- * Build ItemData.
- *
- * @param parentPath
- * - parent path
- * @param item
- * database - ResultSet with Item record(s)
- * @param itemClass
- * - Item type (Node or Property)
- * @param parentACL
- * - parent ACL
- * @return ItemData instance
- * @throws RepositoryException
- * Repository error
- * @throws SQLException
- * database error
- * @throws IOException
- * I/O error
- */
- private ItemData itemData(QPath parentPath, ResultSet item, int itemClass, AccessControlList parentACL)
- throws RepositoryException, SQLException, IOException
- {
- String cid = item.getString(COLUMN_ID);
- String cname = item.getString(COLUMN_NAME);
- int cversion = item.getInt(COLUMN_VERSION);
-
- String cpid = item.getString(COLUMN_PARENTID);
- // if parent ID is empty string - it's a root node
- // cpid = cpid.equals(Constants.ROOT_PARENT_UUID) ? null : cpid;
-
- try
- {
- if (itemClass == I_CLASS_NODE)
- {
- int cindex = item.getInt(COLUMN_INDEX);
- int cnordernumb = item.getInt(COLUMN_NORDERNUM);
- return loadNodeRecord(parentPath, cname, cid, cpid, cindex, cversion, cnordernumb, parentACL);
- }
-
- int cptype = item.getInt(COLUMN_PTYPE);
- boolean cpmultivalued = item.getBoolean(COLUMN_PMULTIVALUED);
- return loadPropertyRecord(parentPath, cname, cid, cpid, cversion, cptype, cpmultivalued);
- }
- catch (InvalidItemStateException e)
- {
- throw new InvalidItemStateException("FATAL: Can't build item path for name " + cname + " id: "
- + getIdentifier(cid) + ". " + e);
- }
- }
-
- /**
- * Read property data without value data. For listChildPropertiesData(NodeData).
- *
- * @param parentPath
- * - parent path
- * @param item
- * database - ResultSet with Item record(s)
- * @return PropertyData instance
- * @throws RepositoryException
- * Repository error
- * @throws SQLException
- * database error
- * @throws IOException
- * I/O error
- */
- private PropertyData propertyData(QPath parentPath, ResultSet item) throws RepositoryException, SQLException,
- IOException
- {
- String cid = item.getString(COLUMN_ID);
- String cname = item.getString(COLUMN_NAME);
- int cversion = item.getInt(COLUMN_VERSION);
- String cpid = item.getString(COLUMN_PARENTID);
- int cptype = item.getInt(COLUMN_PTYPE);
- boolean cpmultivalued = item.getBoolean(COLUMN_PMULTIVALUED);
-
- try
- {
- InternalQName qname = InternalQName.parse(cname);
-
- QPath qpath = QPath.makeChildPath(parentPath == null ? traverseQPath(cpid) : parentPath, qname);
-
- PersistedPropertyData pdata =
- new PersistedPropertyData(getIdentifier(cid), qpath, getIdentifier(cpid), cversion, cptype, cpmultivalued,
- new ArrayList<ValueData>());
-
- return pdata;
- }
- catch (InvalidItemStateException e)
- {
- throw new InvalidItemStateException("FATAL: Can't build property path for name " + cname + " id: "
- + getIdentifier(cid) + ". " + e);
- }
- catch (IllegalNameException e)
- {
- throw new RepositoryException(e);
- }
- }
-
protected List<AccessControlEntry> readACLPermisions(String cid, Map<String, List<byte[]>> properties)
throws SQLException, IllegalACLException
{
@@ -733,209 +460,6 @@
}
/**
- * Load PropertyData record.
- *
- * @param parentPath
- * parent path
- * @param cname
- * Property name
- * @param cid
- * Property id
- * @param cpid
- * Property parent id
- * @param cversion
- * Property persistent verison
- * @param cptype
- * Property type
- * @param cpmultivalued
- * Property multivalued status
- * @return PersistedPropertyData
- * @throws RepositoryException
- * Repository error
- * @throws SQLException
- * database error
- * @throws IOException
- * I/O error
- */
- protected PersistedPropertyData loadPropertyRecord(QPath parentPath, String cname, String cid, String cpid,
- int cversion, int cptype, boolean cpmultivalued) throws RepositoryException, SQLException, IOException
- {
-
- // NOTE: cpid never should be null or root parent (' ')
-
- try
- {
- QPath qpath =
- QPath.makeChildPath(parentPath == null ? traverseQPath(cpid) : parentPath, InternalQName.parse(cname));
-
- String identifier = getIdentifier(cid);
- List<ValueData> values = readValues(cid, identifier, cversion);
- PersistedPropertyData pdata =
- new PersistedPropertyData(identifier, qpath, getIdentifier(cpid), cversion, cptype, cpmultivalued, values);
-
- return pdata;
- }
- catch (IllegalNameException e)
- {
- throw new RepositoryException(e);
- }
- }
-
- protected PersistedNodeData loadNodeRecord(ResultSet item, QPath parentPath, AccessControlList pACL)
- throws RepositoryException, SQLException, IOException
- {
-
- String cid = item.getString(COLUMN_ID);
- String cname = item.getString(COLUMN_NAME);
- int cversion = item.getInt(COLUMN_VERSION);
- String cpid = item.getString(COLUMN_PARENTID);
- int cindex = item.getInt(COLUMN_INDEX);
- int cnordernumb = item.getInt(COLUMN_NORDERNUM);
- AccessControlList parentACL = pACL;
-
- try
- {
- InternalQName qname = InternalQName.parse(cname);
-
- // TODO can't avoid QPath traverse
- QPath qpath;
- String parentCid;
- if (parentPath != null)
- {
- // get by parent and name
- qpath = QPath.makeChildPath(parentPath, qname, cindex);
- parentCid = cpid;
- }
- else
- {
- // get by id
- if (cpid.equals(Constants.ROOT_PARENT_UUID))
- {
- // root node
- qpath = Constants.ROOT_PATH;
- parentCid = null;
- }
- else
- {
- qpath = QPath.makeChildPath(traverseQPath(cpid), qname, cindex);
- parentCid = cpid;
- }
- }
-
- // preload properties
-
- Map<String, List<byte[]>> properties = new LinkedHashMap<String, List<byte[]>>();
-
- // PRIMARY
- if (!item.next() || !item.getString(COLUMN_NAME).equals(Constants.JCR_PRIMARYTYPE.getAsString()))
- {
- throw new SQLException("Node finded but primaryType property not " + cid);
- }
-
- byte[] data = item.getBytes(COLUMN_VDATA);
- InternalQName ptName = InternalQName.parse(new String((data != null ? data : new byte[]{})));
-
- // MIXIN
- MixinInfo mixins = null;
- List<InternalQName> mts = null;
- boolean owneable = false;
- boolean privilegeable = false;
- while (item.next() && item.getString(COLUMN_NAME).equals(Constants.JCR_MIXINTYPES.getAsString()))
- {
- mts = new ArrayList<InternalQName>();
- byte[] mxnb = item.getBytes(COLUMN_VDATA);
- if (mxnb != null)
- {
- InternalQName mxn = InternalQName.parse(new String(mxnb));
- mts.add(mxn);
-
- if (!privilegeable && Constants.EXO_PRIVILEGEABLE.equals(mxn))
- privilegeable = true;
- else if (!owneable && Constants.EXO_OWNEABLE.equals(mxn))
- owneable = true;
- } // else, if SQL NULL - skip it
-
- }
-
- mixins = new MixinInfo(mts, owneable, privilegeable);
-
- try
- {
- // ACL
- AccessControlList acl; // NO DEFAULT values!
-
- if (mixins.hasOwneable())
- {
- // has own owner
- if (mixins.hasPrivilegeable())
- {
- // and permissions
- acl = new AccessControlList(readACLOwner(cid), readACLPermisions(cid));
- }
- else if (parentACL != null)
- {
- // use permissions from existed parent
- acl =
- new AccessControlList(readACLOwner(cid), parentACL.hasPermissions() ? parentACL
- .getPermissionEntries() : null);
- }
- else
- {
- // have to search nearest ancestor permissions in ACL manager
- // acl = new AccessControlList(readACLOwner(cid), traverseACLPermissions(cpid));
- acl = new AccessControlList(readACLOwner(cid), null);
- }
- }
- else if (mixins.hasPrivilegeable())
- {
- // has own permissions
- if (mixins.hasOwneable())
- {
- // and owner
- acl = new AccessControlList(readACLOwner(cid), readACLPermisions(cid));
- }
- else if (parentACL != null)
- {
- // use owner from existed parent
- acl = new AccessControlList(parentACL.getOwner(), readACLPermisions(cid));
- }
- else
- {
- // have to search nearest ancestor owner in ACL manager
- // acl = new AccessControlList(traverseACLOwner(cpid), readACLPermisions(cid));
- acl = new AccessControlList(null, readACLPermisions(cid));
- }
- }
- else
- {
- if (parentACL != null)
- // construct ACL from existed parent ACL
- acl =
- new AccessControlList(parentACL.getOwner(), parentACL.hasPermissions() ? parentACL
- .getPermissionEntries() : null);
- else
- // have to search nearest ancestor owner and permissions in ACL manager
- // acl = traverseACL(cpid);
- acl = null;
- }
-
- return new PersistedNodeData(getIdentifier(cid), qpath, getIdentifier(parentCid), cversion, cnordernumb,
- ptName, mixins.mixinNames(), acl);
-
- }
- catch (IllegalACLException e)
- {
- throw new RepositoryException("FATAL ERROR Node " + getIdentifier(cid) + " " + qpath.getAsString()
- + " has wrong formed ACL. ", e);
- }
- }
- catch (IllegalNameException e)
- {
- throw new RepositoryException(e);
- }
- }
-
- /**
* Create NodeData from TempNodeData content.
*
* @param tempData
@@ -1017,12 +541,14 @@
else if (!owneable && Constants.EXO_OWNEABLE.equals(mxn))
owneable = true;
}
- mts= new InternalQName[mNames.size()];
+ mts = new InternalQName[mNames.size()];
mNames.toArray(mts);
- }else{
+ }
+ else
+ {
mts = new InternalQName[0];
}
-
+
try
{
// ACL
@@ -1034,7 +560,7 @@
if (privilegeable)
{
// and permissions
- acl = new AccessControlList(readACLOwner(cid, properties), readACLPermisions(cid,properties));
+ acl = new AccessControlList(readACLOwner(cid, properties), readACLPermisions(cid, properties));
}
else if (parentACL != null)
{
@@ -1055,7 +581,7 @@
if (owneable)
{
// and owner
- acl = new AccessControlList(readACLOwner(cid,properties), readACLPermisions(cid, properties));
+ acl = new AccessControlList(readACLOwner(cid, properties), readACLPermisions(cid, properties));
}
else if (parentACL != null)
{
@@ -1098,51 +624,58 @@
}
}
- protected PersistedPropertyData loadPropertyRecord(ResultSet item, QPath parentPath) throws RepositoryException,
- SQLException, IOException
+ /**
+ * Load property record from result set. Result set must be ordered by property id.
+ * In other way there may be mistaces.
+ *
+ * @param resultSet - Result set
+ * @param parentPath - parent qpath - needed to create property qpath. May be null.
+ * @return PersistedPropertyData
+ * @throws RepositoryException
+ * @throws SQLException
+ * @throws IOException
+ */
+ protected PersistedPropertyData loadPropertyRecord(ResultSet resultSet, QPath parentPath)
+ throws RepositoryException, SQLException, IOException
{
- String cid = item.getString(COLUMN_ID);
- String cname = item.getString(COLUMN_NAME);
- int cversion = item.getInt(COLUMN_VERSION);
+ String cid = resultSet.getString(COLUMN_ID);
+ String cname = resultSet.getString(COLUMN_NAME);
+ int cversion = resultSet.getInt(COLUMN_VERSION);
- String cpid = item.getString(COLUMN_PARENTID);
+ String cpid = resultSet.getString(COLUMN_PARENTID);
// if parent ID is empty string - it's a root node
// cpid = cpid.equals(Constants.ROOT_PARENT_UUID) ? null : cpid;
try
{
- int cptype = item.getInt(COLUMN_PTYPE);
- boolean cpmultivalued = item.getBoolean(COLUMN_PMULTIVALUED);
- try
- {
- QPath qpath =
- QPath.makeChildPath(parentPath == null ? traverseQPath(cpid) : parentPath, InternalQName.parse(cname));
+ int cptype = resultSet.getInt(COLUMN_PTYPE);
+ boolean cpmultivalued = resultSet.getBoolean(COLUMN_PMULTIVALUED);
+ QPath qpath =
+ QPath.makeChildPath(parentPath == null ? traverseQPath(cpid) : parentPath, InternalQName.parse(cname));
- List<ValueData> data = new ArrayList<ValueData>();
+ List<ValueData> data = new ArrayList<ValueData>();
+ String identifier = getIdentifier(cid);
- String identifier = getIdentifier(cid);
-
- do
- {
- final int orderNum = item.getInt(COLUMN_VORDERNUM);
- final String storageId = item.getString(COLUMN_VSTORAGE_DESC);
- ValueData vdata =
- item.wasNull() ? readValueData(cid, orderNum, cversion, item.getBinaryStream(COLUMN_VDATA))
- : readValueData(identifier, orderNum, storageId);
- data.add(vdata);
- }
- while (item.next() && item.getString(COLUMN_ID) == cid);
-
- PersistedPropertyData pdata =
- new PersistedPropertyData(identifier, qpath, getIdentifier(cpid), cversion, cptype, cpmultivalued, data);
-
- return pdata;
- }
- catch (IllegalNameException e)
+ do
{
- throw new RepositoryException(e);
+ final int orderNum = resultSet.getInt(COLUMN_VORDERNUM);
+ final String storageId = resultSet.getString(COLUMN_VSTORAGE_DESC);
+ ValueData vdata =
+ resultSet.wasNull() ? readValueData(cid, orderNum, cversion, resultSet.getBinaryStream(COLUMN_VDATA))
+ : readValueData(identifier, orderNum, storageId);
+ data.add(vdata);
}
+ while (resultSet.next() && resultSet.getString(COLUMN_ID) == cid);
+
+ PersistedPropertyData pdata =
+ new PersistedPropertyData(identifier, qpath, getIdentifier(cpid), cversion, cptype, cpmultivalued, data);
+
+ return pdata;
}
+ catch (IllegalNameException e)
+ {
+ throw new RepositoryException(e);
+ }
catch (InvalidItemStateException e)
{
throw new InvalidItemStateException("FATAL: Can't build item path for name " + cname + " id: "
@@ -1151,50 +684,6 @@
}
/**
- * Read Property Values.
- *
- * @param identifier
- * property identifier
- * @param cid
- * Property id
- * @param pdata
- * PropertyData
- * @return list of ValueData
- * @throws IOException
- * i/O error
- * @throws SQLException
- * if database errro occurs
- * @throws ValueStorageNotFoundException
- * if no such storage found with Value storageId
- */
- private List<ValueData> readValues(String cid, String identifier, int cversion) throws IOException, SQLException,
- ValueStorageNotFoundException
- {
-
- List<ValueData> data = new ArrayList<ValueData>();
-
- final ResultSet valueRecords = findValuesByPropertyId(cid);
- try
- {
- while (valueRecords.next())
- {
- final int orderNum = valueRecords.getInt(COLUMN_VORDERNUM);
- final String storageId = valueRecords.getString(COLUMN_VSTORAGE_DESC);
- ValueData vdata =
- valueRecords.wasNull() ? readValueData(cid, orderNum, cversion, valueRecords
- .getBinaryStream(COLUMN_VDATA)) : readValueData(identifier, orderNum, storageId);
- data.add(vdata);
- }
- }
- finally
- {
- valueRecords.close();
- }
-
- return data;
- }
-
- /**
* Read ValueData from External Storage.
*
* @param pdata
@@ -1225,227 +714,165 @@
}
}
- /**
- * Read ValueData from database.
- *
- * @param cid
- * Property id
- * @param orderNumber
- * Value order number
- * @param version
- * persistent version (used for BLOB swapping)
- * @param content
- * @return ValueData
- * @throws SQLException
- * database error
- * @throws IOException
- * I/O error (swap)
- */
- protected ValueData readValueData(String cid, int orderNumber, int version, final InputStream content)
- throws SQLException, IOException
- {
+ // protected PersistedNodeData loadNodeRecord(ResultSet item, QPath parentPath, AccessControlList pACL)
+ // throws RepositoryException, SQLException, IOException
+ // {
+ //
+ // String cid = item.getString(COLUMN_ID);
+ // String cname = item.getString(COLUMN_NAME);
+ // int cversion = item.getInt(COLUMN_VERSION);
+ // String cpid = item.getString(COLUMN_PARENTID);
+ // int cindex = item.getInt(COLUMN_INDEX);
+ // int cnordernumb = item.getInt(COLUMN_NORDERNUM);
+ // AccessControlList parentACL = pACL;
+ //
+ // try
+ // {
+ // InternalQName qname = InternalQName.parse(cname);
+ //
+ // // TODO can't avoid QPath traverse
+ // QPath qpath;
+ // String parentCid;
+ // if (parentPath != null)
+ // {
+ // // get by parent and name
+ // qpath = QPath.makeChildPath(parentPath, qname, cindex);
+ // parentCid = cpid;
+ // }
+ // else
+ // {
+ // // get by id
+ // if (cpid.equals(Constants.ROOT_PARENT_UUID))
+ // {
+ // // root node
+ // qpath = Constants.ROOT_PATH;
+ // parentCid = null;
+ // }
+ // else
+ // {
+ // qpath = QPath.makeChildPath(traverseQPath(cpid), qname, cindex);
+ // parentCid = cpid;
+ // }
+ // }
+ //
+ // // preload properties
+ //
+ // Map<String, List<byte[]>> properties = new LinkedHashMap<String, List<byte[]>>();
+ //
+ // // PRIMARY
+ // if (!item.next() || !item.getString(COLUMN_NAME).equals(Constants.JCR_PRIMARYTYPE.getAsString()))
+ // {
+ // throw new SQLException("Node finded but primaryType property not " + cid);
+ // }
+ //
+ // byte[] data = item.getBytes(COLUMN_VDATA);
+ // InternalQName ptName = InternalQName.parse(new String((data != null ? data : new byte[]{})));
+ //
+ // // MIXIN
+ // MixinInfo mixins = null;
+ // List<InternalQName> mts = null;
+ // boolean owneable = false;
+ // boolean privilegeable = false;
+ // while (item.next() && item.getString(COLUMN_NAME).equals(Constants.JCR_MIXINTYPES.getAsString()))
+ // {
+ // mts = new ArrayList<InternalQName>();
+ // byte[] mxnb = item.getBytes(COLUMN_VDATA);
+ // if (mxnb != null)
+ // {
+ // InternalQName mxn = InternalQName.parse(new String(mxnb));
+ // mts.add(mxn);
+ //
+ // if (!privilegeable && Constants.EXO_PRIVILEGEABLE.equals(mxn))
+ // privilegeable = true;
+ // else if (!owneable && Constants.EXO_OWNEABLE.equals(mxn))
+ // owneable = true;
+ // } // else, if SQL NULL - skip it
+ //
+ // }
+ //
+ // mixins = new MixinInfo(mts, owneable, privilegeable);
+ //
+ // try
+ // {
+ // // ACL
+ // AccessControlList acl; // NO DEFAULT values!
+ //
+ // if (mixins.hasOwneable())
+ // {
+ // // has own owner
+ // if (mixins.hasPrivilegeable())
+ // {
+ // // and permissions
+ // acl = new AccessControlList(readACLOwner(cid), readACLPermisions(cid));
+ // }
+ // else if (parentACL != null)
+ // {
+ // // use permissions from existed parent
+ // acl =
+ // new AccessControlList(readACLOwner(cid), parentACL.hasPermissions() ? parentACL
+ // .getPermissionEntries() : null);
+ // }
+ // else
+ // {
+ // // have to search nearest ancestor permissions in ACL manager
+ // // acl = new AccessControlList(readACLOwner(cid), traverseACLPermissions(cpid));
+ // acl = new AccessControlList(readACLOwner(cid), null);
+ // }
+ // }
+ // else if (mixins.hasPrivilegeable())
+ // {
+ // // has own permissions
+ // if (mixins.hasOwneable())
+ // {
+ // // and owner
+ // acl = new AccessControlList(readACLOwner(cid), readACLPermisions(cid));
+ // }
+ // else if (parentACL != null)
+ // {
+ // // use owner from existed parent
+ // acl = new AccessControlList(parentACL.getOwner(), readACLPermisions(cid));
+ // }
+ // else
+ // {
+ // // have to search nearest ancestor owner in ACL manager
+ // // acl = new AccessControlList(traverseACLOwner(cpid), readACLPermisions(cid));
+ // acl = new AccessControlList(null, readACLPermisions(cid));
+ // }
+ // }
+ // else
+ // {
+ // if (parentACL != null)
+ // // construct ACL from existed parent ACL
+ // acl =
+ // new AccessControlList(parentACL.getOwner(), parentACL.hasPermissions() ? parentACL
+ // .getPermissionEntries() : null);
+ // else
+ // // have to search nearest ancestor owner and permissions in ACL manager
+ // // acl = traverseACL(cpid);
+ // acl = null;
+ // }
+ //
+ // return new PersistedNodeData(getIdentifier(cid), qpath, getIdentifier(parentCid), cversion, cnordernumb,
+ // ptName, mixins.mixinNames(), acl);
+ //
+ // }
+ // catch (IllegalACLException e)
+ // {
+ // throw new RepositoryException("FATAL ERROR Node " + getIdentifier(cid) + " " + qpath.getAsString()
+ // + " has wrong formed ACL. ", e);
+ // }
+ // }
+ // catch (IllegalNameException e)
+ // {
+ // throw new RepositoryException(e);
+ // }
+ // }
- ResultSet valueResultSet = null;
+ protected abstract ResultSet findItemByIdentifierWithAllData(String identifier) throws SQLException;
- byte[] buffer = new byte[0];
- byte[] spoolBuffer = new byte[ValueFileIOHelper.IOBUFFER_SIZE];
- int read;
- int len = 0;
- OutputStream out = null;
+ protected abstract ResultSet findItemByNameWithAllData(String parentId, String name, int index) throws SQLException;
- SwapFile swapFile = null;
- try
- {
- // stream from database
- if (content != null)
- while ((read = content.read(spoolBuffer)) >= 0)
- {
- if (out != null)
- {
- // spool to temp file
- out.write(spoolBuffer, 0, read);
- len += read;
- }
- else if (len + read > maxBufferSize)
- {
- // threshold for keeping data in memory exceeded;
- // create temp file and spool buffer contents
- swapFile = SwapFile.get(swapDirectory, cid + orderNumber + "." + version);
- if (swapFile.isSpooled())
- {
- // break, value already spooled
- buffer = null;
- break;
- }
- out = new FileOutputStream(swapFile);
- out.write(buffer, 0, len);
- out.write(spoolBuffer, 0, read);
- buffer = null;
- len += read;
- }
- else
- {
- // reallocate new buffer and spool old buffer contents
- byte[] newBuffer = new byte[len + read];
- System.arraycopy(buffer, 0, newBuffer, 0, len);
- System.arraycopy(spoolBuffer, 0, newBuffer, len, read);
- buffer = newBuffer;
- len += read;
- }
- }
- }
- finally
- {
- if (valueResultSet != null)
- valueResultSet.close();
- if (out != null)
- {
- out.close();
- swapFile.spoolDone();
- }
- }
+ protected abstract ResultSet findChildNodesByParentIdentifierCQ(String parentIdentifier) throws SQLException;
- if (buffer == null)
- return new CleanableFilePersistedValueData(orderNumber, swapFile, swapCleaner);
-
- return new ByteArrayPersistedValueData(orderNumber, buffer);
- }
-
- /**
- * Writes value data to swap file.
- *
- * @param cid
- * Property id
- * @param orderNumber
- * Value order number
- * @param version
- * persistent version (used for BLOB swapping)
- * @param content
- * @return ValueData
- * @throws SQLException
- * database error
- * @throws IOException
- * I/O error (swap)
- */
- protected SwapFile swapValueData(String cid, int orderNumber, int version, final InputStream content)
- throws SQLException, IOException
- {
-
- byte[] spoolBuffer = new byte[ValueFileIOHelper.IOBUFFER_SIZE];
- int read;
- int len = 0;
-
- SwapFile swapFile = SwapFile.get(swapDirectory, cid + orderNumber + "." + version);
- OutputStream out = new FileOutputStream(swapFile);;
-
- if (swapFile.isSpooled())
- {
- return swapFile;
- }
-
- try
- {
- if (content != null)
- while ((read = content.read(spoolBuffer)) >= 0)
- {
- // spool to temp file
- out.write(spoolBuffer, 0, read);
- len += read;
- }
- }
- finally
- {
- out.close();
- swapFile.spoolDone();
- }
-
- return swapFile;
- }
-
- /**
- * Add Values to Property record.
- *
- * @param data
- * PropertyData
- * @throws SQLException
- * database error
- * @throws IOException
- * I/O error
- * @thorws RepositoryException if Value data large of JDBC accepted (Integer.MAX_VALUE)
- */
- protected void addValues(String cid, PropertyData data) throws IOException, SQLException, RepositoryException
- {
- List<ValueData> vdata = data.getValues();
-
- for (int i = 0; i < vdata.size(); i++)
- {
- ValueData vd = vdata.get(i);
- ValueIOChannel channel = valueStorageProvider.getApplicableChannel(data, i);
- InputStream stream;
- int streamLength;
- String storageId;
- if (channel == null)
- {
- // prepare write of Value in database
- if (vd.isByteArray())
- {
- byte[] dataBytes = vd.getAsByteArray();
- stream = new ByteArrayInputStream(dataBytes);
- streamLength = dataBytes.length;
- }
- else
- {
- // it's StreamPersistedValueData
- StreamPersistedValueData streamData = (StreamPersistedValueData)vd;
- stream = streamData.getStream();
-
- // TODO spool on JDBC driver read - multiplexing the data to two stores, database and spool file, with one read.
- SwapFile swapFile = swapValueData(cid, i, data.getPersistedVersion(), stream);
-
- long vlen = swapFile.length();
- if (vlen < 0)
- {
- // TODO not actual with SwapFile, but if it will be reworked can be so
- streamLength = stream.available();
- LOG.warn("Cannot obtain exact Value data length, will use available from the stream " + streamLength
- + ". Property " + data.getQPath().getAsString());
- }
- else if (vlen <= Integer.MAX_VALUE)
- {
- streamLength = (int)vlen;
- }
- else
- {
- throw new RepositoryException("Value data large of allowed by JDBC (Integer.MAX_VALUE) " + vlen
- + ". Property " + data.getQPath().getAsString());
- }
-
- // set persistent file to ValueData, will be available for saving Property.
- streamData.setPersistedFile(swapFile);
- stream = streamData.getAsStream();
- }
- storageId = null;
- }
- else
- {
- // write Value in external VS
- channel.write(data.getIdentifier(), vd);
- valueChanges.add(channel);
- storageId = channel.getStorageId();
- stream = null;
- streamLength = 0;
- }
- addValueData(cid, i, stream, streamLength, storageId);
- }
- }
-
- protected abstract ResultSet findItemByIdentifierNew(String identifier) throws SQLException;
-
- protected abstract ResultSet findItemByNameNew(String parentId, String name, int index) throws SQLException;
-
- protected abstract ResultSet findChildNodesByParentIdentifierNew(String parentIdentifier) throws SQLException;
-
protected abstract ResultSet getChildPropertiesByParentIdentifier(String parentIdentifier) throws SQLException;
-
- protected abstract ResultSet findReferenceProperties(String parentIdentifier) throws SQLException;
}
Modified: jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/MultiDbJDBCConnection.java
===================================================================
--- jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/MultiDbJDBCConnection.java 2009-12-26 09:53:58 UTC (rev 1198)
+++ jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/MultiDbJDBCConnection.java 2009-12-26 12:15:51 UTC (rev 1199)
@@ -409,7 +409,7 @@
/**
* {@inheritDoc}
*/
- protected ResultSet findItemByNameNew(String parentId, String name, int index) throws SQLException
+ protected ResultSet findItemByNameWithAllData(String parentId, String name, int index) throws SQLException
{
if (findItemByNameNew == null)
findItemByNameNew = dbConnection.prepareStatement(FIND_ITEM_BY_NAME_NEW);
@@ -487,7 +487,7 @@
* {@inheritDoc}
*/
@Override
- protected ResultSet findChildNodesByParentIdentifierNew(String parentIdentifier) throws SQLException
+ protected ResultSet findChildNodesByParentIdentifierCQ(String parentIdentifier) throws SQLException
{
if (findNodesByParentId == null)
findNodesByParentId = dbConnection.prepareStatement(FIND_NODES_BY_PARENTID_NEW);
@@ -641,7 +641,7 @@
}
@Override
- protected ResultSet findItemByIdentifierNew(String identifier) throws SQLException
+ protected ResultSet findItemByIdentifierWithAllData(String identifier) throws SQLException
{
if (findItemByIdNew == null)
findItemByIdNew = dbConnection.prepareStatement(FIND_ITEM_BY_ID_NEW);
@@ -664,15 +664,4 @@
return getPropertiesByParentId.executeQuery();
}
- @Override
- protected ResultSet findReferenceProperties(String nodeIdentifier) throws SQLException
- {
- if (findReferenceProperties == null)
- findReferenceProperties = dbConnection.prepareStatement(FIND_REFERENCE_PROPERTIES);
- else
- findReferenceProperties.clearParameters();
-
- findReferenceProperties.setString(1, nodeIdentifier);
- return findReferenceProperties.executeQuery();
- }
}
Modified: jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/SingleDbJDBCConnection.java
===================================================================
--- jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/SingleDbJDBCConnection.java 2009-12-26 09:53:58 UTC (rev 1198)
+++ jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/SingleDbJDBCConnection.java 2009-12-26 12:15:51 UTC (rev 1199)
@@ -398,7 +398,7 @@
}
@Override
- protected ResultSet findItemByNameNew(String parentId, String name, int index) throws SQLException
+ protected ResultSet findItemByNameWithAllData(String parentId, String name, int index) throws SQLException
{
if (findItemByName == null)
findItemByName = dbConnection.prepareStatement(FIND_ITEM_BY_NAME);
@@ -608,7 +608,7 @@
}
@Override
- protected ResultSet findItemByIdentifierNew(String identifier) throws SQLException
+ protected ResultSet findItemByIdentifierWithAllData(String identifier) throws SQLException
{
if (findItemByIdNew == null)
findItemByIdNew = dbConnection.prepareStatement(FIND_ITEM_BY_ID_NEW);
@@ -621,7 +621,7 @@
}
@Override
- protected ResultSet findChildNodesByParentIdentifierNew(String parentIdentifier) throws SQLException
+ protected ResultSet findChildNodesByParentIdentifierCQ(String parentIdentifier) throws SQLException
{
// TODO Auto-generated method stub
return null;
@@ -634,11 +634,4 @@
return null;
}
- @Override
- protected ResultSet findReferenceProperties(String parentIdentifier) throws SQLException
- {
- // TODO Auto-generated method stub
- return null;
- }
-
}
16 years, 4 months
exo-jcr SVN: r1198 - in jcr/branches/1.12.0-OPT/exo.jcr.component.core/src: main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation and 2 other directories.
by do-not-reply@jboss.org
Author: sergiykarpenko
Date: 2009-12-26 04:53:58 -0500 (Sat, 26 Dec 2009)
New Revision: 1198
Modified:
jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/monitor/ManagedConnection.java
jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/monitor/ManagedPreparedStatement.java
jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/monitor/ManagedStatement.java
jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/CQJDBCStorageConnection.java
jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/MultiDbJDBCConnection.java
jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/test/resources/conf/standalone/test-jcr-config.xml
Log:
EXOJCR-302: CQJDBCStorageConnection updated
Modified: jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/monitor/ManagedConnection.java
===================================================================
--- jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/monitor/ManagedConnection.java 2009-12-25 20:13:35 UTC (rev 1197)
+++ jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/monitor/ManagedConnection.java 2009-12-26 09:53:58 UTC (rev 1198)
@@ -21,15 +21,23 @@
import org.exoplatform.services.log.ExoLogger;
import org.exoplatform.services.log.Log;
+import java.sql.Array;
+import java.sql.Blob;
import java.sql.CallableStatement;
+import java.sql.Clob;
import java.sql.Connection;
import java.sql.DatabaseMetaData;
+import java.sql.NClob;
import java.sql.PreparedStatement;
+import java.sql.SQLClientInfoException;
import java.sql.SQLException;
import java.sql.SQLWarning;
+import java.sql.SQLXML;
import java.sql.Savepoint;
import java.sql.Statement;
+import java.sql.Struct;
import java.util.Map;
+import java.util.Properties;
/**
* Created by The eXo Platform SAS.
@@ -284,4 +292,70 @@
jdbcConn.setTypeMap(map);
}
+public Array createArrayOf(String arg0, Object[] arg1) throws SQLException {
+ // TODO Auto-generated method stub
+ return null;
}
+
+public Blob createBlob() throws SQLException {
+ // TODO Auto-generated method stub
+ return null;
+}
+
+public Clob createClob() throws SQLException {
+ // TODO Auto-generated method stub
+ return null;
+}
+
+public NClob createNClob() throws SQLException {
+ // TODO Auto-generated method stub
+ return null;
+}
+
+public SQLXML createSQLXML() throws SQLException {
+ // TODO Auto-generated method stub
+ return null;
+}
+
+public Struct createStruct(String arg0, Object[] arg1) throws SQLException {
+ // TODO Auto-generated method stub
+ return null;
+}
+
+public Properties getClientInfo() throws SQLException {
+ // TODO Auto-generated method stub
+ return null;
+}
+
+public String getClientInfo(String arg0) throws SQLException {
+ // TODO Auto-generated method stub
+ return null;
+}
+
+public boolean isValid(int arg0) throws SQLException {
+ // TODO Auto-generated method stub
+ return false;
+}
+
+public void setClientInfo(Properties arg0) throws SQLClientInfoException {
+ // TODO Auto-generated method stub
+
+}
+
+public void setClientInfo(String arg0, String arg1)
+ throws SQLClientInfoException {
+ // TODO Auto-generated method stub
+
+}
+
+public boolean isWrapperFor(Class<?> arg0) throws SQLException {
+ // TODO Auto-generated method stub
+ return false;
+}
+
+public <T> T unwrap(Class<T> arg0) throws SQLException {
+ // TODO Auto-generated method stub
+ return null;
+}
+
+}
Modified: jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/monitor/ManagedPreparedStatement.java
===================================================================
--- jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/monitor/ManagedPreparedStatement.java 2009-12-25 20:13:35 UTC (rev 1197)
+++ jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/monitor/ManagedPreparedStatement.java 2009-12-26 09:53:58 UTC (rev 1198)
@@ -28,12 +28,15 @@
import java.sql.Blob;
import java.sql.Clob;
import java.sql.Date;
+import java.sql.NClob;
import java.sql.ParameterMetaData;
import java.sql.PreparedStatement;
import java.sql.Ref;
import java.sql.ResultSet;
import java.sql.ResultSetMetaData;
+import java.sql.RowId;
import java.sql.SQLException;
+import java.sql.SQLXML;
import java.sql.Time;
import java.sql.Timestamp;
import java.util.Calendar;
@@ -265,4 +268,106 @@
jdbcStmt.setUnicodeStream(parameterIndex, x, length);
}
+public void setAsciiStream(int parameterIndex, InputStream x)
+ throws SQLException {
+ // TODO Auto-generated method stub
+
}
+
+public void setAsciiStream(int parameterIndex, InputStream x, long length)
+ throws SQLException {
+ // TODO Auto-generated method stub
+
+}
+
+public void setBinaryStream(int parameterIndex, InputStream x)
+ throws SQLException {
+ // TODO Auto-generated method stub
+
+}
+
+public void setBinaryStream(int parameterIndex, InputStream x, long length)
+ throws SQLException {
+ // TODO Auto-generated method stub
+
+}
+
+public void setBlob(int parameterIndex, InputStream inputStream)
+ throws SQLException {
+ // TODO Auto-generated method stub
+
+}
+
+public void setBlob(int parameterIndex, InputStream inputStream, long length)
+ throws SQLException {
+ // TODO Auto-generated method stub
+
+}
+
+public void setCharacterStream(int parameterIndex, Reader reader)
+ throws SQLException {
+ // TODO Auto-generated method stub
+
+}
+
+public void setCharacterStream(int parameterIndex, Reader reader, long length)
+ throws SQLException {
+ // TODO Auto-generated method stub
+
+}
+
+public void setClob(int parameterIndex, Reader reader) throws SQLException {
+ // TODO Auto-generated method stub
+
+}
+
+public void setClob(int parameterIndex, Reader reader, long length)
+ throws SQLException {
+ // TODO Auto-generated method stub
+
+}
+
+public void setNCharacterStream(int parameterIndex, Reader value)
+ throws SQLException {
+ // TODO Auto-generated method stub
+
+}
+
+public void setNCharacterStream(int parameterIndex, Reader value, long length)
+ throws SQLException {
+ // TODO Auto-generated method stub
+
+}
+
+public void setNClob(int parameterIndex, NClob value) throws SQLException {
+ // TODO Auto-generated method stub
+
+}
+
+public void setNClob(int parameterIndex, Reader reader) throws SQLException {
+ // TODO Auto-generated method stub
+
+}
+
+public void setNClob(int parameterIndex, Reader reader, long length)
+ throws SQLException {
+ // TODO Auto-generated method stub
+
+}
+
+public void setNString(int parameterIndex, String value) throws SQLException {
+ // TODO Auto-generated method stub
+
+}
+
+public void setRowId(int parameterIndex, RowId x) throws SQLException {
+ // TODO Auto-generated method stub
+
+}
+
+public void setSQLXML(int parameterIndex, SQLXML xmlObject) throws SQLException {
+ // TODO Auto-generated method stub
+
+}
+
+}
Modified: jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/monitor/ManagedStatement.java
===================================================================
--- jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/monitor/ManagedStatement.java 2009-12-25 20:13:35 UTC (rev 1197)
+++ jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/monitor/ManagedStatement.java 2009-12-26 09:53:58 UTC (rev 1198)
@@ -235,4 +235,29 @@
jdbcStmt.setQueryTimeout(seconds);
}
+public boolean isClosed() throws SQLException {
+ // TODO Auto-generated method stub
+ return false;
}
+
+public boolean isPoolable() throws SQLException {
+ // TODO Auto-generated method stub
+ return false;
+}
+
+public void setPoolable(boolean poolable) throws SQLException {
+ // TODO Auto-generated method stub
+
+}
+
+public boolean isWrapperFor(Class<?> iface) throws SQLException {
+ // TODO Auto-generated method stub
+ return false;
+}
+
+public <T> T unwrap(Class<T> iface) throws SQLException {
+ // TODO Auto-generated method stub
+ return null;
+}
+
+}
Modified: jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/CQJDBCStorageConnection.java
===================================================================
--- jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/CQJDBCStorageConnection.java 2009-12-25 20:13:35 UTC (rev 1197)
+++ jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/CQJDBCStorageConnection.java 2009-12-26 09:53:58 UTC (rev 1198)
@@ -86,13 +86,18 @@
*/
protected String FIND_NODES_BY_PARENTID_NEW;
+ /**
+ * GET_PROPERTIES_BY_PARENT_ID
+ */
protected String GET_PROPERTIES_BY_PARENTID;
+ /**
+ * FIND_REFERENCE_PROPERTIES
+ */
protected String FIND_REFERENCE_PROPERTIES;
/**
* Class needed to store node details (property also) since result set is not sorted in valid way.
- *
*/
private static class TempNodeData
{
@@ -156,20 +161,21 @@
checkIfOpened();
try
{
+ // query will return nodes and properties in same result set
ResultSet resultSet = findChildNodesByParentIdentifierNew(getInternalId(parent.getIdentifier()));
if (resultSet.next())
{
- Map<String, TempNodeData> tempNodes = loadNodesData(resultSet);
+ Map<String, TempNodeData> tempNodes = loadTempNodesFromResultSet(resultSet);
- List<NodeData> childrens = new ArrayList<NodeData>(tempNodes.size());
+ List<NodeData> childNodes = new ArrayList<NodeData>(tempNodes.size());
QPath parentQPath = parent.getQPath();
AccessControlList parentACL = parent.getACL();
for (TempNodeData data : tempNodes.values())
{
NodeData nodeData = loadNodeFromTemporaryNodeData(data, parentQPath, parentACL);
- childrens.add(nodeData);
+ childNodes.add(nodeData);
}
- return childrens;
+ return childNodes;
}
else
{
@@ -187,8 +193,8 @@
}
}
- protected Map<String, TempNodeData> loadNodesData(ResultSet resultSet) throws RepositoryException, IOException,
- SQLException
+ protected Map<String, TempNodeData> loadTempNodesFromResultSet(ResultSet resultSet) throws RepositoryException,
+ IOException, SQLException
{
Map<String, TempNodeData> nodesData = new LinkedHashMap<String, TempNodeData>();
@@ -386,7 +392,7 @@
int itemType = resultSet.getInt(COLUMN_CLASS);
if (itemType == I_CLASS_NODE)
{
- Map<String, TempNodeData> node = loadNodesData(resultSet);
+ Map<String, TempNodeData> node = loadTempNodesFromResultSet(resultSet);
return loadNodeFromTemporaryNodeData(node.get(cid), null, null);
//return loadNodeRecord(resultSet, null, null);
}
@@ -454,7 +460,7 @@
String firstNodeId = resultSet.getString(COLUMN_ID);
// There may be two or more nodes, so load temp NodeDatas and return first one.
- Map<String, TempNodeData> tempNodes = loadNodesData(resultSet);
+ Map<String, TempNodeData> tempNodes = loadTempNodesFromResultSet(resultSet);
QPath parentQPath = parent.getQPath();
AccessControlList parentACL = parent.getACL();
@@ -696,70 +702,34 @@
}
}
- /**
- * Return permission values or throw an exception. We assume the node is mix:privilegeable.
- *
- * @param cid
- * Node id
- * @return list of ACL entries
- * @throws SQLException
- * database error
- * @throws IllegalACLException
- * if property exo:permissions is not found for node
- */
- protected List<AccessControlEntry> readACLPermisions(String cid) throws SQLException, IllegalACLException
+ protected List<AccessControlEntry> readACLPermisions(String cid, Map<String, List<byte[]>> properties)
+ throws SQLException, IllegalACLException
{
List<AccessControlEntry> naPermissions = new ArrayList<AccessControlEntry>();
- ResultSet exoPerm = findPropertyByName(cid, Constants.EXO_PERMISSIONS.getAsString());
- try
+ List<byte[]> permValues = properties.get(Constants.EXO_PERMISSIONS.getAsString());
+
+ if (permValues != null)
{
- if (exoPerm.next())
+ for (byte[] value : permValues)
{
- do
- {
- StringTokenizer parser =
- new StringTokenizer(new String(exoPerm.getBytes(COLUMN_VDATA)), AccessControlEntry.DELIMITER);
- naPermissions.add(new AccessControlEntry(parser.nextToken(), parser.nextToken()));
- }
- while (exoPerm.next());
-
- return naPermissions;
+ StringTokenizer parser = new StringTokenizer(new String(value), AccessControlEntry.DELIMITER);
+ naPermissions.add(new AccessControlEntry(parser.nextToken(), parser.nextToken()));
}
- else
- throw new IllegalACLException("Property exo:permissions is not found for node with id: "
- + getIdentifier(cid));
+
+ return naPermissions;
}
- finally
- {
- exoPerm.close();
- }
+ else
+ throw new IllegalACLException("Property exo:permissions is not found for node with id: " + getIdentifier(cid));
}
- /**
- * Return owner value or throw an exception. We assume the node is mix:owneable.
- *
- * @param cid
- * Node id
- * @return ACL owner
- * @throws SQLException
- * database error
- * @throws IllegalACLException
- * Property exo:owner is not found for node
- */
- protected String readACLOwner(String cid) throws SQLException, IllegalACLException
+ protected String readACLOwner(String cid, Map<String, List<byte[]>> properties) throws IllegalACLException
{
- ResultSet exoOwner = findPropertyByName(cid, Constants.EXO_OWNER.getAsString());
- try
- {
- if (exoOwner.next())
- return new String(exoOwner.getBytes(COLUMN_VDATA));
- else
- throw new IllegalACLException("Property exo:owner is not found for node with id: " + getIdentifier(cid));
- }
- finally
- {
- exoOwner.close();
- }
+ List<byte[]> ownerValues = properties.get(Constants.EXO_OWNER.getAsString());
+ if (ownerValues != null)
+ return new String(ownerValues.get(0));
+ else
+ throw new IllegalACLException("Property exo:owner is not found for node with id: " + getIdentifier(cid));
+
}
/**
@@ -865,16 +835,6 @@
byte[] data = item.getBytes(COLUMN_VDATA);
InternalQName ptName = InternalQName.parse(new String((data != null ? data : new byte[]{})));
- // // PRIMARY
- // ResultSet ptProp = findPropertyByName(cid, Constants.JCR_PRIMARYTYPE.getAsString());
- //
- // if (!ptProp.next())
- // throw new PrimaryTypeNotFoundException("FATAL ERROR primary type record not found. Node "
- // + qpath.getAsString() + ", id " + cid + ", container " + this.containerName, null);
- //
- // byte[] data = ptProp.getBytes(COLUMN_VDATA);
- // InternalQName ptName = InternalQName.parse(new String((data != null ? data : new byte[]{})));
-
// MIXIN
MixinInfo mixins = null;
List<InternalQName> mts = null;
@@ -975,16 +935,27 @@
}
}
- protected PersistedNodeData loadNodeFromTemporaryNodeData(TempNodeData buf, QPath parentPath, AccessControlList pACL)
- throws RepositoryException, SQLException, IOException
+ /**
+ * Create NodeData from TempNodeData content.
+ *
+ * @param tempData
+ * @param parentPath
+ * @param pACL
+ * @return
+ * @throws RepositoryException
+ * @throws SQLException
+ * @throws IOException
+ */
+ protected PersistedNodeData loadNodeFromTemporaryNodeData(TempNodeData tempData, QPath parentPath,
+ AccessControlList pACL) throws RepositoryException, SQLException, IOException
{
- String cid = buf.cid;
- String cname = buf.cname;
- int cversion = buf.cversion;
- String cpid = buf.cpid;
- int cindex = buf.cindex;
- int cnordernumb = buf.cnordernumb;
+ String cid = tempData.cid;
+ String cname = tempData.cname;
+ int cversion = tempData.cversion;
+ String cpid = tempData.cpid;
+ int cindex = tempData.cindex;
+ int cnordernumb = tempData.cnordernumb;
AccessControlList parentACL = pACL;
try
@@ -1016,9 +987,10 @@
}
}
- // PRIMARY
+ Map<String, List<byte[]>> properties = tempData.properties;
- List<byte[]> primaryType = buf.properties.get(Constants.JCR_PRIMARYTYPE.getAsString());
+ // PRIMARY
+ List<byte[]> primaryType = properties.get(Constants.JCR_PRIMARYTYPE.getAsString());
if (primaryType == null || primaryType.size() == 0)
{
throw new SQLException("Node finded but primaryType property not " + cid);
@@ -1028,73 +1000,73 @@
InternalQName ptName = InternalQName.parse(new String((data != null ? data : new byte[]{})));
// MIXIN
- MixinInfo mixins = null;
- List<InternalQName> mts = null;
+ InternalQName[] mts;
boolean owneable = false;
boolean privilegeable = false;
- List<byte[]> mixinTypes = buf.properties.get(Constants.JCR_MIXINTYPES.getAsString());
- if (mixinTypes != null)
+ List<byte[]> mixTypes = properties.get(Constants.JCR_MIXINTYPES.getAsString());
+ if (mixTypes != null)
{
- mts = new ArrayList<InternalQName>();
- for (byte[] mxnb : mixinTypes)
+ List<InternalQName> mNames = new ArrayList<InternalQName>();
+ for (byte[] mxnb : mixTypes)
{
InternalQName mxn = InternalQName.parse(new String(mxnb));
- mts.add(mxn);
+ mNames.add(mxn);
if (!privilegeable && Constants.EXO_PRIVILEGEABLE.equals(mxn))
privilegeable = true;
else if (!owneable && Constants.EXO_OWNEABLE.equals(mxn))
owneable = true;
}
+ mts= new InternalQName[mNames.size()];
+ mNames.toArray(mts);
+ }else{
+ mts = new InternalQName[0];
}
-
- mixins = new MixinInfo(mts, owneable, privilegeable);
-
+
try
{
// ACL
AccessControlList acl; // NO DEFAULT values!
- if (mixins.hasOwneable())
+ if (owneable)
{
// has own owner
- if (mixins.hasPrivilegeable())
+ if (privilegeable)
{
// and permissions
- acl = new AccessControlList(readACLOwner(cid), readACLPermisions(cid));
+ acl = new AccessControlList(readACLOwner(cid, properties), readACLPermisions(cid,properties));
}
else if (parentACL != null)
{
// use permissions from existed parent
acl =
- new AccessControlList(readACLOwner(cid), parentACL.hasPermissions() ? parentACL
+ new AccessControlList(readACLOwner(cid, properties), parentACL.hasPermissions() ? parentACL
.getPermissionEntries() : null);
}
else
{
// have to search nearest ancestor permissions in ACL manager
- // acl = new AccessControlList(readACLOwner(cid), traverseACLPermissions(cpid));
- acl = new AccessControlList(readACLOwner(cid), null);
+ acl = new AccessControlList(readACLOwner(cid, properties), null);
}
}
- else if (mixins.hasPrivilegeable())
+ else if (privilegeable)
{
// has own permissions
- if (mixins.hasOwneable())
+ if (owneable)
{
// and owner
- acl = new AccessControlList(readACLOwner(cid), readACLPermisions(cid));
+ acl = new AccessControlList(readACLOwner(cid,properties), readACLPermisions(cid, properties));
}
else if (parentACL != null)
{
// use owner from existed parent
- acl = new AccessControlList(parentACL.getOwner(), readACLPermisions(cid));
+ acl = new AccessControlList(parentACL.getOwner(), readACLPermisions(cid, properties));
}
else
{
// have to search nearest ancestor owner in ACL manager
// acl = new AccessControlList(traverseACLOwner(cpid), readACLPermisions(cid));
- acl = new AccessControlList(null, readACLPermisions(cid));
+ acl = new AccessControlList(null, readACLPermisions(cid, properties));
}
}
else
@@ -1111,7 +1083,7 @@
}
return new PersistedNodeData(getIdentifier(cid), qpath, getIdentifier(parentCid), cversion, cnordernumb,
- ptName, mixins.mixinNames(), acl);
+ ptName, mts, acl);
}
catch (IllegalACLException e)
Modified: jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/MultiDbJDBCConnection.java
===================================================================
--- jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/MultiDbJDBCConnection.java 2009-12-25 20:13:35 UTC (rev 1197)
+++ jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/MultiDbJDBCConnection.java 2009-12-26 09:53:58 UTC (rev 1198)
@@ -177,15 +177,10 @@
FIND_ITEM_BY_ID = "select * from JCR_MITEM where ID=?";
FIND_ITEM_BY_ID_NEW =
- // "select I.*, P.DATA from JCR_MITEM I, (select I2.PARENT_ID, V.DATA from JCR_MITEM I2, JCR_MVALUE V where I2.I_CLASS=2 and I2.PARENT_ID=?"
- // + " and I2.NAME='[http://www.jcp.org/jcr/1.0]primaryType' and I2.ID=V.PROPERTY_ID) P"
- // + " where I.ID=P.PARENT_ID";
-
- // "select I2.*, V.DATA from JCR_MITEM I LEFT OUTER JOIN JCR_MVALUE V ON (V.PROPERTY_ID=I.ID), (select * from JCR_MITEM where ID=? AND I_CLASS=1) I2"
- // + " where I2.ID=I.ID and I2.ID=I.PARENT_ID and I.NAME IN ('[http://www.jcp.org/jcr/1.0]primaryType')";// order by I.I_CLASS, I.N_ORDER_NUM"
-
"select I.*, V.ORDER_NUM, V.DATA, V.STORAGE_DESC from JCR_MITEM I LEFT OUTER JOIN JCR_MVALUE V ON (V.PROPERTY_ID=I.ID)"
- + " where (I.ID=?) or (I.PARENT_ID=? and I.I_CLASS=2 and (I.NAME='[http://www.jcp.org/jcr/1.0]primaryType' or I.NAME='[http://www.jcp.org/jcr/1.0]mixinTypes')) order by I.I_CLASS, I.NAME DESC";// order by I.I_CLASS, I.N_ORDER_NUM"
+ + " where (I.ID=?) or (I.PARENT_ID=? and I.I_CLASS=2 and (I.NAME='[http://www.jcp.org/jcr/1.0]primaryType'"
+ + " or I.NAME='[http://www.jcp.org/jcr/1.0]mixinTypes' or I.NAME='[http://www.exoplatform.com/jcr/exo/1.0]owner'"
+ + " or I.NAME='[http://www.exoplatform.com/jcr/exo/1.0]permissions')) order by I.I_CLASS, I.N_ORDER_NUM, V.ORDER_NUM";
FIND_ITEM_BY_NAME =
"select * from JCR_MITEM" + " where PARENT_ID=? and NAME=? and I_INDEX=? order by I_CLASS, VERSION DESC";
@@ -193,8 +188,9 @@
FIND_ITEM_BY_NAME_NEW =
"select I.*, V.ORDER_NUM, V.DATA, V.STORAGE_DESC from JCR_MITEM I LEFT OUTER JOIN JCR_MVALUE V ON (V.PROPERTY_ID=I.ID)"
+ ", (select ID from JCR_MITEM where PARENT_ID=? and NAME=? and I_INDEX=?) I2"
- + " where (I.ID=I2.ID) or (I.PARENT_ID=I2.ID and I.I_CLASS=2 and (I.NAME='[http://www.jcp.org/jcr/1.0]primaryType' or I.NAME='[http://www.jcp.org/jcr/1.0]mixinTypes' or I.NAME='[http://www.exoplatform.com/jcr/exo/1.0]owner' or I.NAME='[http://www.exoplatform.com/jcr/exo/1.0]permissions'))"
- + " order by I.I_CLASS, I.N_ORDER_NUM";
+ + " where (I.ID=I2.ID) or (I.PARENT_ID=I2.ID and I.I_CLASS=2 and (I.NAME='[http://www.jcp.org/jcr/1.0]primaryType'"
+ + " or I.NAME='[http://www.jcp.org/jcr/1.0]mixinTypes' or I.NAME='[http://www.exoplatform.com/jcr/exo/1.0]owner'"
+ + " or I.NAME='[http://www.exoplatform.com/jcr/exo/1.0]permissions')) order by I.I_CLASS, I.N_ORDER_NUM, V.ORDER_NUM";
FIND_PROPERTY_BY_NAME =
"select V.DATA" + " from JCR_MITEM I, JCR_MVALUE V"
@@ -204,6 +200,7 @@
"select P.ID, P.PARENT_ID, P.VERSION, P.P_TYPE, P.P_MULTIVALUED, P.NAME" + " from JCR_MREF R, JCR_MITEM P"
+ " where R.NODE_ID=? and P.ID=R.PROPERTY_ID and P.I_CLASS=2";
+ //TODO useless - remove
FIND_REFERENCE_PROPERTIES =
"select P.ID, P.PARENT_ID, P.VERSION, P.P_TYPE, P.P_MULTIVALUED, P.NAME, V.ORDER_NUM, V.DATA, V.STORAGE_DESC"
+ " from JCR_MREF R, JCR_MITEM P, JCR_MVALUE V"
@@ -219,21 +216,17 @@
FIND_NODES_BY_PARENTID = "select * from JCR_MITEM" + " where I_CLASS=1 and PARENT_ID=?" + " order by N_ORDER_NUM";
FIND_NODES_BY_PARENTID_NEW =
- "select I.*, V.DATA"
- + " from JCR_MITEM I LEFT OUTER JOIN JCR_MVALUE V ON (V.PROPERTY_ID=I.ID), (select ID from JCR_MITEM where PARENT_ID=? AND I_CLASS=1) I2"
- + " where (I.I_CLASS=1 AND I.ID=I2.ID) OR (I.I_CLASS=2 and I.PARENT_ID=I2.ID and"
- + " (I.NAME='[http://www.jcp.org/jcr/1.0]primaryType' OR I.NAME='[http://www.jcp.org/jcr/1.0]mixinTypes')) order by I.I_CLASS, I.N_ORDER_NUM";
- //,
+ "select I.*, V.DATA, V.ORDER_NUM"
+ + " from JCR_MITEM I LEFT OUTER JOIN JCR_MVALUE V ON (V.PROPERTY_ID=I.ID), (select ID from JCR_MITEM where PARENT_ID=? and I_CLASS=1) I2"
+ + " where (I.I_CLASS=1 AND I.ID=I2.ID) or (I.I_CLASS=2 and I.PARENT_ID=I2.ID and"
+ + " (I.NAME='[http://www.jcp.org/jcr/1.0]primaryType' or I.NAME='[http://www.jcp.org/jcr/1.0]mixinTypes'"
+ + " or I.NAME='[http://www.exoplatform.com/jcr/exo/1.0]owner' or I.NAME='[http://www.exoplatform.com/jcr/exo/1.0]permissions')) order by I.I_CLASS, I.N_ORDER_NUM, V.ORDER_NUM";
FIND_NODES_COUNT_BY_PARENTID = "select count(ID) from JCR_MITEM" + " where I_CLASS=1 and PARENT_ID=?";
FIND_PROPERTIES_BY_PARENTID = "select * from JCR_MITEM" + " where I_CLASS=2 and PARENT_ID=?" + " order by ID";
- //TODO this query is incorrect because property may have not value
- // GET_PROPERTIES_BY_PARENTID =
- // "select I.*, V.ORDER_NUM, V.DATA, V.STORAGE_DESC from JCR_MITEM I, JCR_MVALUE V"
- // + " where I.I_CLASS=2 and I.PARENT_ID=? and V.PROPERTY_ID=I.ID order by I.ID";
-
+ // property may contain no values
GET_PROPERTIES_BY_PARENTID =
"select I.*, V.ORDER_NUM, V.DATA, V.STORAGE_DESC from JCR_MITEM I LEFT OUTER JOIN JCR_MVALUE V ON (V.PROPERTY_ID=I.ID)"
+ " where I.I_CLASS=2 and I.PARENT_ID=? order by ID, ORDER_NUM";
Modified: jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/test/resources/conf/standalone/test-jcr-config.xml
===================================================================
--- jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/test/resources/conf/standalone/test-jcr-config.xml 2009-12-25 20:13:35 UTC (rev 1197)
+++ jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/test/resources/conf/standalone/test-jcr-config.xml 2009-12-26 09:53:58 UTC (rev 1198)
@@ -30,7 +30,7 @@
<workspaces>
<workspace name="ws">
<!-- for system storage -->
- <container class="org.exoplatform.services.jcr.impl.storage.jdbc.JDBCWorkspaceDataContainer">
+ <container class="org.exoplatform.services.jcr.impl.storage.jdbc.optimisation.CQJDBCWorkspaceDataContainer">
<properties>
<property name="source-name" value="jdbcjcr" />
<property name="dialect" value="hsqldb" />
@@ -90,7 +90,7 @@
</workspace>
<workspace name="ws1">
- <container class="org.exoplatform.services.jcr.impl.storage.jdbc.JDBCWorkspaceDataContainer">
+ <container class="org.exoplatform.services.jcr.impl.storage.jdbc.optimisation.CQJDBCWorkspaceDataContainer">
<properties>
<property name="source-name" value="jdbcjcr1" />
<property name="dialect" value="hsqldb" />
@@ -130,7 +130,7 @@
</workspace>
<workspace name="ws2">
- <container class="org.exoplatform.services.jcr.impl.storage.jdbc.JDBCWorkspaceDataContainer">
+ <container class="org.exoplatform.services.jcr.impl.storage.jdbc.optimisation.CQJDBCWorkspaceDataContainer">
<properties>
<property name="source-name" value="jdbcjcr2" />
<property name="dialect" value="hsqldb" />
@@ -172,7 +172,7 @@
<workspace name="ws3">
<!-- for system storage -->
<container
- class="org.exoplatform.services.jcr.impl.storage.jdbc.JDBCWorkspaceDataContainer">
+ class="org.exoplatform.services.jcr.impl.storage.jdbc.optimisation.CQJDBCWorkspaceDataContainer">
<properties>
<property name="source-name" value="jdbcjcr3" />
<property name="dialect" value="hsqldb" />
@@ -253,7 +253,7 @@
<workspaces>
<workspace name="ws">
<!-- for system storage -->
- <container class="org.exoplatform.services.jcr.impl.storage.jdbc.JDBCWorkspaceDataContainer">
+ <container class="org.exoplatform.services.jcr.impl.storage.jdbc.optimisation.CQJDBCWorkspaceDataContainer">
<properties>
<property name="source-name" value="jdbcjcrtck" />
<property name="dialect" value="hsqldb" />
@@ -308,7 +308,7 @@
</workspace>
<workspace name="ws1">
- <container class="org.exoplatform.services.jcr.impl.storage.jdbc.JDBCWorkspaceDataContainer">
+ <container class="org.exoplatform.services.jcr.impl.storage.jdbc.optimisation.CQJDBCWorkspaceDataContainer">
<properties>
<property name="source-name" value="jdbcjcr1tck" />
<property name="dialect" value="hsqldb" />
@@ -354,7 +354,7 @@
</workspace>
<workspace name="ws2">
- <container class="org.exoplatform.services.jcr.impl.storage.jdbc.JDBCWorkspaceDataContainer">
+ <container class="org.exoplatform.services.jcr.impl.storage.jdbc.optimisation.CQJDBCWorkspaceDataContainer">
<properties>
<property name="source-name" value="jdbcjcr2tck" />
<property name="dialect" value="hsqldb" />
16 years, 4 months
exo-jcr SVN: r1197 - jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/test/resources/conf/standalone.
by do-not-reply@jboss.org
Author: sergiykarpenko
Date: 2009-12-25 15:13:35 -0500 (Fri, 25 Dec 2009)
New Revision: 1197
Modified:
jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/test/resources/conf/standalone/test-configuration.mysql.xml
jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/test/resources/conf/standalone/test-configuration.xml
jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/test/resources/conf/standalone/test-jcr-config.mysql.xml
jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/test/resources/conf/standalone/test-jcr-config.xml
Log:
EXOJCR-302: config revert
Modified: jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/test/resources/conf/standalone/test-configuration.mysql.xml
===================================================================
--- jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/test/resources/conf/standalone/test-configuration.mysql.xml 2009-12-25 17:05:38 UTC (rev 1196)
+++ jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/test/resources/conf/standalone/test-configuration.mysql.xml 2009-12-25 20:13:35 UTC (rev 1197)
@@ -229,9 +229,9 @@
<name>ref-addresses</name>
<description>ref-addresses</description>
<property name="driverClassName" value="com.mysql.jdbc.Driver" />
- <property name="url" value="jdbc:mysql://localhost/portal" />
- <property name="username" value="root" />
- <property name="password" value="eXoAdmin" />
+ <property name="url" value="jdbc:mysql://localhost:13306/portal" />
+ <property name="username" value="exoadmin" />
+ <property name="password" value="exo12321" />
<property name="maxActive" value="20" />
<property name="maxIdle" value="5" />
<property name="initialSize" value="2" />
@@ -259,9 +259,9 @@
<name>ref-addresses</name>
<description>ref-addresses</description>
<property name="driverClassName" value="com.mysql.jdbc.Driver" />
- <property name="url" value="jdbc:mysql://localhost/jcr1" />
- <property name="username" value="root" />
- <property name="password" value="eXoAdmin" />
+ <property name="url" value="jdbc:mysql://localhost:13306/jcr1" />
+ <property name="username" value="exoadmin" />
+ <property name="password" value="exo12321" />
<property name="maxActive" value="20" />
<property name="maxIdle" value="5" />
<property name="initialSize" value="2" />
@@ -289,9 +289,9 @@
<name>ref-addresses</name>
<description>ref-addresses</description>
<property name="driverClassName" value="com.mysql.jdbc.Driver" />
- <property name="url" value="jdbc:mysql://localhost/jcr2" />
- <property name="username" value="root" />
- <property name="password" value="eXoAdmin" />
+ <property name="url" value="jdbc:mysql://localhost:13306/jcr2" />
+ <property name="username" value="exoadmin" />
+ <property name="password" value="exo12321" />
<property name="maxActive" value="20" />
<property name="maxIdle" value="5" />
<property name="initialSize" value="2" />
@@ -319,9 +319,9 @@
<name>ref-addresses</name>
<description>ref-addresses</description>
<property name="driverClassName" value="com.mysql.jdbc.Driver" />
- <property name="url" value="jdbc:mysql://localhost/jcr3" />
- <property name="username" value="root" />
- <property name="password" value="eXoAdmin" />
+ <property name="url" value="jdbc:mysql://localhost:13306/jcr3" />
+ <property name="username" value="exoadmin" />
+ <property name="password" value="exo12321" />
<property name="maxActive" value="20" />
<property name="maxIdle" value="5" />
<property name="initialSize" value="2" />
@@ -349,9 +349,9 @@
<name>ref-addresses</name>
<description>ref-addresses</description>
<property name="driverClassName" value="com.mysql.jdbc.Driver" />
- <property name="url" value="jdbc:mysql://localhost/portaltck" />
- <property name="username" value="root" />
- <property name="password" value="eXoAdmin" />
+ <property name="url" value="jdbc:mysql://localhost:13306/portaltck" />
+ <property name="username" value="exoadmin" />
+ <property name="password" value="exo12321" />
<property name="maxActive" value="20" />
<property name="maxIdle" value="5" />
<property name="initialSize" value="2" />
@@ -379,9 +379,9 @@
<name>ref-addresses</name>
<description>ref-addresses</description>
<property name="driverClassName" value="com.mysql.jdbc.Driver" />
- <property name="url" value="jdbc:mysql://localhost/jcrtck" />
- <property name="username" value="root" />
- <property name="password" value="eXoAdmin" />
+ <property name="url" value="jdbc:mysql://localhost:13306/jcrtck" />
+ <property name="username" value="exoadmin" />
+ <property name="password" value="exo12321" />
<property name="maxActive" value="20" />
<property name="maxIdle" value="5" />
<property name="initialSize" value="2" />
@@ -409,9 +409,9 @@
<name>ref-addresses</name>
<description>ref-addresses</description>
<property name="driverClassName" value="com.mysql.jdbc.Driver" />
- <property name="url" value="jdbc:mysql://localhost/jcr2tck" />
- <property name="username" value="root" />
- <property name="password" value="eXoAdmin" />
+ <property name="url" value="jdbc:mysql://localhost:13306/jcr2tck" />
+ <property name="username" value="exoadmin" />
+ <property name="password" value="exo12321" />
<property name="maxActive" value="20" />
<property name="maxIdle" value="5" />
<property name="initialSize" value="2" />
Modified: jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/test/resources/conf/standalone/test-configuration.xml
===================================================================
--- jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/test/resources/conf/standalone/test-configuration.xml 2009-12-25 17:05:38 UTC (rev 1196)
+++ jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/test/resources/conf/standalone/test-configuration.xml 2009-12-25 20:13:35 UTC (rev 1197)
@@ -176,7 +176,7 @@
<name>working-conf</name>
<description>working-conf</description>
<property name="source-name" value="jdbcjcr"/>
- <property name="dialect" value="mysql"/>
+ <property name="dialect" value="hsqldb"/>
<property name="persister-class-name" value="org.exoplatform.services.jcr.impl.config.JDBCConfigurationPersister"/>
</properties-param>
</init-params>
@@ -227,14 +227,11 @@
</value-param>
<properties-param>
<name>ref-addresses</name>
- <description>ref-addresses</description>
- <property name="driverClassName" value="com.mysql.jdbc.Driver" />
- <property name="url" value="jdbc:mysql://mysql.exoua-int/KarpenkoJ2tck"/>
- <property name="username" value="root"/>
- <property name="password" value="eXoAdmin"/>
- <property name="maxActive" value="100" />
- <property name="maxIdle" value="5" />
- <property name="initialSize" value="5" />
+ <description>ref-addresses</description>
+ <property name="driverClassName" value="org.hsqldb.jdbcDriver"/>
+ <property name="url" value="jdbc:hsqldb:file:target/temp/data/portal"/>
+ <property name="username" value="sa"/>
+ <property name="password" value=""/>
</properties-param>
</init-params>
</component-plugin>
@@ -258,13 +255,10 @@
<properties-param>
<name>ref-addresses</name>
<description>ref-addresses</description>
- <property name="driverClassName" value="com.mysql.jdbc.Driver" />
- <property name="url" value="jdbc:mysql://mysql.exoua-int/KarpenkoJCR2"/>
- <property name="username" value="root"/>
- <property name="password" value="eXoAdmin"/>
- <property name="maxActive" value="100" />
- <property name="maxIdle" value="5" />
- <property name="initialSize" value="5" />
+ <property name="driverClassName" value="org.hsqldb.jdbcDriver"/>
+ <property name="url" value="jdbc:hsqldb:file:target/temp/data/jcr"/>
+ <property name="username" value="sa"/>
+ <property name="password" value=""/>
</properties-param>
</init-params>
</component-plugin>
@@ -288,17 +282,14 @@
<properties-param>
<name>ref-addresses</name>
<description>ref-addresses</description>
- <property name="driverClassName" value="com.mysql.jdbc.Driver" />
- <property name="url" value="jdbc:mysql://mysql.exoua-int/KarpenkoPtck"/>
- <property name="username" value="root"/>
- <property name="password" value="eXoAdmin"/>
- <property name="maxActive" value="100" />
- <property name="maxIdle" value="5" />
- <property name="initialSize" value="5" />
+ <property name="driverClassName" value="org.hsqldb.jdbcDriver"/>
+ <property name="url" value="jdbc:hsqldb:file:target/temp/data/jcr2"/>
+ <property name="username" value="sa"/>
+ <property name="password" value=""/>
</properties-param>
</init-params>
</component-plugin>
- <component-plugin>
+ <component-plugin>
<name>bind.datasource</name>
<set-method>addPlugin</set-method>
<type>org.exoplatform.services.naming.BindReferencePlugin</type>
@@ -318,18 +309,14 @@
<properties-param>
<name>ref-addresses</name>
<description>ref-addresses</description>
- <property name="driverClassName" value="com.mysql.jdbc.Driver" />
- <property name="url" value="jdbc:mysql://mysql.exoua-int/KarpenkoBD3"/>
- <property name="username" value="root"/>
- <property name="password" value="eXoAdmin"/>
- <property name="maxActive" value="100" />
- <property name="maxIdle" value="5" />
- <property name="initialSize" value="5" />
-
+ <property name="driverClassName" value="org.hsqldb.jdbcDriver"/>
+ <property name="url" value="jdbc:hsqldb:file:target/temp/data/jcr3"/>
+ <property name="username" value="sa"/>
+ <property name="password" value=""/>
</properties-param>
</init-params>
</component-plugin>
- <!--component-plugin>
+ <component-plugin>
<name>bind.datasource</name>
<set-method>addPlugin</set-method>
<type>org.exoplatform.services.naming.BindReferencePlugin</type>
@@ -355,7 +342,7 @@
<property name="password" value=""/>
</properties-param>
</init-params>
- </component-plugin-->
+ </component-plugin>
<component-plugin>
<name>bind.datasource</name>
<set-method>addPlugin</set-method>
@@ -376,14 +363,10 @@
<properties-param>
<name>ref-addresses</name>
<description>ref-addresses</description>
- <property name="driverClassName" value="com.mysql.jdbc.Driver" />
- <property name="url" value="jdbc:mysql://mysql.exoua-int/KarpenkoBD1"/>
- <property name="username" value="root"/>
- <property name="password" value="eXoAdmin"/>
- <property name="maxActive" value="100" />
- <property name="maxIdle" value="5" />
- <property name="initialSize" value="5" />
-
+ <property name="driverClassName" value="org.hsqldb.jdbcDriver"/>
+ <property name="url" value="jdbc:hsqldb:file:target/temp/data/portaltck"/>
+ <property name="username" value="sa"/>
+ <property name="password" value=""/>
</properties-param>
</init-params>
</component-plugin>
@@ -407,13 +390,10 @@
<properties-param>
<name>ref-addresses</name>
<description>ref-addresses</description>
- <property name="driverClassName" value="com.mysql.jdbc.Driver" />
- <property name="url" value="jdbc:mysql://mysql.exoua-int/KarpenkoBD2"/>
- <property name="username" value="root"/>
- <property name="password" value="eXoAdmin"/>
- <property name="maxActive" value="100" />
- <property name="maxIdle" value="5" />
- <property name="initialSize" value="5" />
+ <property name="driverClassName" value="org.hsqldb.jdbcDriver"/>
+ <property name="url" value="jdbc:hsqldb:file:target/temp/data/jcrtck"/>
+ <property name="username" value="sa"/>
+ <property name="password" value=""/>
</properties-param>
</init-params>
</component-plugin>
@@ -437,18 +417,14 @@
<properties-param>
<name>ref-addresses</name>
<description>ref-addresses</description>
- <property name="driverClassName" value="com.mysql.jdbc.Driver" />
- <property name="url" value="jdbc:mysql://mysql.exoua-int/KarpenkoJtck"/>
- <property name="username" value="root"/>
- <property name="password" value="eXoAdmin"/>
- <property name="maxActive" value="100" />
- <property name="maxIdle" value="5" />
- <property name="initialSize" value="5" />
-
+ <property name="driverClassName" value="org.hsqldb.jdbcDriver"/>
+ <property name="url" value="jdbc:hsqldb:file:target/temp/data/jcr2tck"/>
+ <property name="username" value="sa"/>
+ <property name="password" value=""/>
</properties-param>
</init-params>
</component-plugin>
- <!--component-plugin>
+ <component-plugin>
<name>bind.datasource</name>
<set-method>addPlugin</set-method>
<type>org.exoplatform.services.naming.BindReferencePlugin</type>
@@ -528,7 +504,7 @@
<property name="password" value=""/>
</properties-param>
</init-params>
- </component-plugin-->
+ </component-plugin>
<!-- Resource configuration for UserTransaction
use JOTM
-->
Modified: jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/test/resources/conf/standalone/test-jcr-config.mysql.xml
===================================================================
--- jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/test/resources/conf/standalone/test-jcr-config.mysql.xml 2009-12-25 17:05:38 UTC (rev 1196)
+++ jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/test/resources/conf/standalone/test-jcr-config.mysql.xml 2009-12-25 20:13:35 UTC (rev 1197)
@@ -1,407 +1,407 @@
-<?xml version="1.0" encoding="ISO-8859-1"?>
-<!--
-
- 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.
-
--->
-<repository-service default-repository="db1">
- <repositories>
- <repository name="db1" system-workspace="ws" default-workspace="ws">
- <security-domain>exo-domain</security-domain>
- <!-- access-control>optional</access-control -->
- <!-- access-control>disable</access-control -->
- <session-max-age>1h</session-max-age>
- <authentication-policy>org.exoplatform.services.jcr.impl.core.access.JAASAuthenticator</authentication-policy>
- <workspaces>
- <workspace name="ws">
- <!-- for system storage -->
- <container class="org.exoplatform.services.jcr.impl.storage.jdbc.optimisation.NewJDBCWorkspaceDataContainer">
- <properties>
- <property name="source-name" value="jdbcjcr" />
- <property name="dialect" value="mysql" />
- <property name="multi-db" value="true" />
- <property name="update-storage" value="false" />
- <property name="max-buffer-size" value="200k" />
- <property name="swap-directory" value="target/temp/swap/ws" />
- </properties>
- <value-storages>
- <value-storage id="ws" class="org.exoplatform.services.jcr.impl.storage.value.fs.TreeFileValueStorage">
- <properties>
- <property name="path" value="target/temp/values/ws" />
- <property name="digest-algo" value="MD5" />
- <property name="vcas-type" value="org.exoplatform.services.jcr.impl.storage.value.cas.JDBCValueContentAddressStorageImpl" />
- <property name="jdbc-source-name" value="jdbcjcr" />
- <property name="jdbc-dialect" value="mysql" />
- </properties>
- <filters>
- <filter property-type="Binary" />
- </filters>
- </value-storage>
- </value-storages>
- </container>
- <initializer class="org.exoplatform.services.jcr.impl.core.ScratchWorkspaceInitializer">
- <properties>
- <property name="root-nodetype" value="nt:unstructured" />
- </properties>
- </initializer>
- <!-- initializer class="org.exoplatform.services.jcr.impl.core.RestoreWorkspaceInitializer">
- <properties>
- <property name="restore-path" value="./sv_export_root.xml" />
- <property name="restore-path" value="./src/test/resources/import-export/restore_db1_ws1.xml" />
- </properties>
- </initializer
--->
- <cache enabled="true" class="org.exoplatform.services.jcr.impl.dataflow.persistent.LinkedWorkspaceStorageCacheImpl">
- <properties>
- <property name="max-size" value="2k" />
- <property name="live-time" value="20m" />
- <property name="statistic-period" value="30" />
- <property name="statistic-log" value="false" />
- </properties>
- </cache>
- <query-handler class="org.exoplatform.services.jcr.impl.core.query.lucene.SearchIndex">
- <properties>
- <property name="index-dir" value="target/temp/index/db1/ws" />
- </properties>
- </query-handler>
- <lock-manager>
- <time-out>15m</time-out>
- <persister class="org.exoplatform.services.jcr.impl.core.lock.FileSystemLockPersister">
- <properties>
- <property name="path" value="target/temp/lock" />
- </properties>
- </persister>
- </lock-manager>
- </workspace>
-
- <workspace name="ws1">
- <container class="org.exoplatform.services.jcr.impl.storage.jdbc.optimisation.NewJDBCWorkspaceDataContainer">
- <properties>
- <property name="source-name" value="jdbcjcr1" />
- <property name="dialect" value="mysql" />
- <property name="multi-db" value="true" />
- <property name="update-storage" value="false" />
- <property name="max-buffer-size" value="200k" />
- <property name="swap-directory" value="target/temp/swap/ws1" />
- </properties>
- <value-storages>
- <value-storage id="ws1" class="org.exoplatform.services.jcr.impl.storage.value.fs.TreeFileValueStorage">
- <properties>
- <property name="path" value="target/temp/values/ws1" />
- </properties>
- <filters>
- <filter property-type="Binary" />
- </filters>
- </value-storage>
- </value-storages>
- </container>
- <cache enabled="true" class="org.exoplatform.services.jcr.impl.dataflow.persistent.LinkedWorkspaceStorageCacheImpl">
- <properties>
- <property name="max-size" value="2k" />
- <property name="live-time" value="20m" />
- </properties>
- </cache>
- <query-handler class="org.exoplatform.services.jcr.impl.core.query.lucene.SearchIndex">
- <properties>
- <property name="index-dir" value="target/temp/index/db1/ws1" />
- <property name="synonymprovider-class" value="org.exoplatform.services.jcr.impl.core.query.lucene.PropertiesSynonymProvider" />
- <property name="synonymprovider-config-path" value="../../synonyms.properties" />
- <property name="support-highlighting" value="true" />
- <property name="indexing-configuration-path" value="../../indexing-configuration.xml" />
- <property name="query-class" value="org.exoplatform.services.jcr.impl.core.query.QueryImpl" />
- <property name="spellchecker-class" value="org.exoplatform.services.jcr.impl.core.query.lucene.spell.LuceneSpellChecker$FiveSecondsRefreshInterval" />
- </properties>
- </query-handler>
- </workspace>
-
- <workspace name="ws2">
- <container class="org.exoplatform.services.jcr.impl.storage.jdbc.optimisation.NewJDBCWorkspaceDataContainer">
- <properties>
- <property name="source-name" value="jdbcjcr2" />
- <property name="dialect" value="mysql" />
- <property name="multi-db" value="true" />
- <property name="update-storage" value="false" />
- <property name="max-buffer-size" value="200k" />
- <property name="swap-directory" value="target/temp/swap/ws2" />
- </properties>
- <value-storages>
- <value-storage id="ws2" class="org.exoplatform.services.jcr.impl.storage.value.fs.TreeFileValueStorage">
- <properties>
- <property name="path" value="target/temp/values/ws2" />
- </properties>
- <filters>
- <filter property-type="Binary" />
- </filters>
- </value-storage>
- </value-storages>
- </container>
- <cache enabled="true" class="org.exoplatform.services.jcr.impl.dataflow.persistent.LinkedWorkspaceStorageCacheImpl">
- <properties>
- <property name="max-size" value="2k" />
- <property name="live-time" value="20m" />
- </properties>
- </cache>
- <query-handler class="org.exoplatform.services.jcr.impl.core.query.lucene.SearchIndex">
- <properties>
- <property name="index-dir" value="target/temp/index/db1/ws2" />
- <property name="synonymprovider-class" value="org.exoplatform.services.jcr.impl.core.query.lucene.PropertiesSynonymProvider" />
- <property name="synonymprovider-config-path" value="../../synonyms.properties" />
- <property name="support-highlighting" value="true" />
- <property name="indexing-configuration-path" value="../../indexing-configuration.xml" />
- <property name="query-class" value="org.exoplatform.services.jcr.impl.core.query.QueryImpl" />
- <property name="spellchecker-class" value="org.exoplatform.services.jcr.impl.core.query.lucene.spell.LuceneSpellChecker$FiveSecondsRefreshInterval" />
- </properties>
- </query-handler>
- </workspace>
-
- <workspace name="ws3">
- <!-- for system storage -->
- <container
- class="org.exoplatform.services.jcr.impl.storage.jdbc.optimisation.NewJDBCWorkspaceDataContainer">
- <properties>
- <property name="source-name" value="jdbcjcr3" />
- <property name="dialect" value="mysql" />
- <property name="multi-db" value="true" />
- <property name="update-storage" value="false" />
- <property name="max-buffer-size" value="200k" />
- <property name="swap-directory" value="target/temp/swap/ws3" />
- </properties>
- <value-storages>
- <!--
- This storage is used to check whether properties are removed
- correctly from each value-storage
- (TestRemoveFromValueStorage.java)
- -->
- <value-storage id="ws3_big"
- class="org.exoplatform.services.jcr.impl.storage.value.fs.TreeFileValueStorage">
- <properties>
- <property name="path" value="target/temp/values/ws3_big" />
- </properties>
- <filters>
- <filter property-type="Binary" min-value-size="1024K" />
- </filters>
- </value-storage>
- <value-storage id="ws3"
- class="org.exoplatform.services.jcr.impl.storage.value.fs.CASableTreeFileValueStorage">
- <properties>
- <property name="path" value="target/temp/values/ws3" />
- <property name="digest-algo" value="MD5" />
- <property name="vcas-type"
- value="org.exoplatform.services.jcr.impl.storage.value.cas.JDBCValueContentAddressStorageImpl" />
- <property name="jdbc-source-name" value="jdbcjcr" />
- <property name="jdbc-dialect" value="mysql" />
- </properties>
- <filters>
- <filter property-type="Binary" />
- </filters>
- </value-storage>
- </value-storages>
- </container>
- <initializer
- class="org.exoplatform.services.jcr.impl.core.ScratchWorkspaceInitializer">
- <properties>
- <property name="root-nodetype" value="nt:unstructured" />
- </properties>
- </initializer>
- <cache enabled="true"
- class="org.exoplatform.services.jcr.impl.dataflow.persistent.LinkedWorkspaceStorageCacheImpl">
- <properties>
- <property name="max-size" value="2k" />
- <property name="live-time" value="20m" />
- </properties>
- </cache>
- <query-handler
- class="org.exoplatform.services.jcr.impl.core.query.lucene.SearchIndex">
- <properties>
- <property name="index-dir" value="target/temp/index/db1/ws3" />
- <property name="synonymprovider-class"
- value="org.exoplatform.services.jcr.impl.core.query.lucene.PropertiesSynonymProvider" />
- <property name="synonymprovider-config-path" value="../../synonyms.properties" />
- <property name="support-highlighting" value="true" />
- <property name="indexing-configuration-path" value="../../indexing-configuration.xml" />
- <property name="query-class"
- value="org.exoplatform.services.jcr.impl.core.query.QueryImpl" />
- <property name="spellchecker-class"
- value="org.exoplatform.services.jcr.impl.core.query.lucene.spell.LuceneSpellChecker$FiveSecondsRefreshInterval" />
- </properties>
- </query-handler>
- </workspace>
- </workspaces>
- </repository>
-
- <repository name="db1tck" system-workspace="ws" default-workspace="ws">
- <security-domain>exo-domain</security-domain>
- <!-- access-control>optional</access-control -->
- <!-- access-control>disable</access-control -->
- <session-max-age>1h</session-max-age>
- <authentication-policy>org.exoplatform.services.jcr.impl.core.access.JAASAuthenticator</authentication-policy>
- <workspaces>
- <workspace name="ws">
- <!-- for system storage -->
- <container class="org.exoplatform.services.jcr.impl.storage.jdbc.optimisation.NewJDBCWorkspaceDataContainer">
- <properties>
- <property name="source-name" value="jdbcjcrtck" />
- <property name="dialect" value="mysql" />
- <property name="multi-db" value="true" />
- <property name="update-storage" value="false" />
- <property name="max-buffer-size" value="200k" />
- <property name="swap-directory" value="target/temp/swap/wstck" />
- </properties>
- <value-storages>
- <value-storage id="ws" class="org.exoplatform.services.jcr.impl.storage.value.fs.TreeFileValueStorage">
- <properties>
- <property name="path" value="target/temp/values/wstck" />
- </properties>
- <filters>
- <filter property-type="Binary" min-value-size="100K" />
- </filters>
- </value-storage>
- </value-storages>
- </container>
- <initializer class="org.exoplatform.services.jcr.impl.core.ScratchWorkspaceInitializer">
- <properties>
- <property name="root-nodetype" value="nt:unstructured" />
- <property name="root-permissions" value="any read;*:/platform/administrators read;*:/platform/administrators add_node;*:/platform/administrators set_property;*:/platform/administrators remove" />
- </properties>
- </initializer>
- <cache enabled="true" class="org.exoplatform.services.jcr.impl.dataflow.persistent.LinkedWorkspaceStorageCacheImpl">
- <properties>
- <property name="max-size" value="2k" />
- <property name="live-time" value="20m" />
- </properties>
- </cache>
- <query-handler class="org.exoplatform.services.jcr.impl.core.query.lucene.SearchIndex">
- <properties>
- <property name="index-dir" value="target/temp/index/db1tck/ws" />
- <property name="synonymprovider-class" value="org.exoplatform.services.jcr.impl.core.query.lucene.PropertiesSynonymProvider" />
- <property name="synonymprovider-config-path" value="../../synonyms.properties" />
- <property name="support-highlighting" value="true" />
- <property name="indexing-configuration-path" value="../../indexing-configuration.xml" />
- <property name="query-class" value="org.exoplatform.services.jcr.impl.core.query.QueryImpl" />
- <property name="excerptprovider-class" value="org.exoplatform.services.jcr.impl.core.query.lucene.WeightedHTMLExcerpt" />
- <property name="spellchecker-class" value="org.exoplatform.services.jcr.impl.core.query.lucene.spell.LuceneSpellChecker$FiveSecondsRefreshInterval" />
- </properties>
- </query-handler>
- <lock-manager>
- <time-out>15m</time-out>
- <persister class="org.exoplatform.services.jcr.impl.core.lock.FileSystemLockPersister">
- <properties>
- <property name="path" value="target/temp/locktck" />
- </properties>
- </persister>
- </lock-manager>
- </workspace>
-
- <workspace name="ws1">
- <container class="org.exoplatform.services.jcr.impl.storage.jdbc.optimisation.NewJDBCWorkspaceDataContainer">
- <properties>
- <property name="source-name" value="jdbcjcr1tck" />
- <property name="dialect" value="mysql" />
- <property name="multi-db" value="true" />
- <property name="update-storage" value="false" />
- <property name="max-buffer-size" value="200k" />
- <property name="swap-directory" value="target/temp/swap/ws1tck" />
- </properties>
- <value-storages>
- <value-storage id="ws1" class="org.exoplatform.services.jcr.impl.storage.value.fs.TreeFileValueStorage">
- <properties>
- <property name="path" value="target/temp/values/ws1tck" />
- </properties>
- <filters>
- <filter property-type="Binary" min-value-size="100K" />
- </filters>
- </value-storage>
- </value-storages>
- </container>
- <initializer class="org.exoplatform.services.jcr.impl.core.ScratchWorkspaceInitializer">
- <properties>
- <property name="root-nodetype" value="nt:unstructured" />
- <property name="root-permissions" value="any read;*:/platform/administrators read;*:/platform/administrators add_node;*:/platform/administrators set_property;*:/platform/administrators remove" />
- </properties>
- </initializer>
- <cache enabled="true" class="org.exoplatform.services.jcr.impl.dataflow.persistent.LinkedWorkspaceStorageCacheImpl">
- <properties>
- <property name="max-size" value="2k" />
- <property name="live-time" value="20m" />
- </properties>
- </cache>
- <query-handler class="org.exoplatform.services.jcr.impl.core.query.lucene.SearchIndex">
- <properties>
- <property name="index-dir" value="target/temp/index/db1tck/ws1" />
- <property name="synonymprovider-class" value="org.exoplatform.services.jcr.impl.core.query.lucene.PropertiesSynonymProvider" />
- <property name="synonymprovider-config-path" value="../../synonyms.properties" />
- <property name="support-highlighting" value="true" />
- <property name="indexing-configuration-path" value="../../indexing-configuration.xml" />
- <property name="query-class" value="org.exoplatform.services.jcr.impl.core.query.QueryImpl" />
- <property name="spellchecker-class" value="org.exoplatform.services.jcr.impl.core.query.lucene.spell.LuceneSpellChecker$FiveSecondsRefreshInterval" />
- </properties>
- </query-handler>
- </workspace>
-
- <workspace name="ws2">
- <container class="org.exoplatform.services.jcr.impl.storage.jdbc.optimisation.NewJDBCWorkspaceDataContainer">
- <properties>
- <property name="source-name" value="jdbcjcr2tck" />
- <property name="dialect" value="mysql" />
- <property name="multi-db" value="true" />
- <property name="update-storage" value="false" />
- <property name="max-buffer-size" value="200k" />
- <property name="swap-directory" value="target/temp/swap/ws2tck" />
- </properties>
- <value-storages>
- <value-storage id="ws2" class="org.exoplatform.services.jcr.impl.storage.value.fs.TreeFileValueStorage">
- <properties>
- <property name="path" value="target/temp/values/ws2tck" />
- </properties>
- <filters>
- <filter property-type="Binary" min-value-size="100K" />
- </filters>
- </value-storage>
- </value-storages>
- </container>
- <initializer class="org.exoplatform.services.jcr.impl.core.ScratchWorkspaceInitializer">
- <properties>
- <property name="root-nodetype" value="nt:unstructured" />
- <property name="root-permissions" value="any read;*:/platform/administrators read;*:/platform/administrators add_node;*:/platform/administrators set_property;*:/platform/administrators remove" />
- </properties>
- </initializer>
- <cache enabled="true" class="org.exoplatform.services.jcr.impl.dataflow.persistent.LinkedWorkspaceStorageCacheImpl">
- <properties>
- <property name="max-size" value="2k" />
- <property name="live-time" value="20m" />
- </properties>
- </cache>
- <query-handler class="org.exoplatform.services.jcr.impl.core.query.lucene.SearchIndex">
- <properties>
- <property name="index-dir" value="target/temp/index/db1tck/ws2" />
- <property name="synonymprovider-class" value="org.exoplatform.services.jcr.impl.core.query.lucene.PropertiesSynonymProvider" />
- <property name="synonymprovider-config-path" value="../../synonyms.properties" />
- <property name="support-highlighting" value="true" />
- <property name="indexing-configuration-path" value="../../indexing-configuration.xml" />
- <property name="query-class" value="org.exoplatform.services.jcr.impl.core.query.QueryImpl" />
- <property name="spellchecker-class" value="org.exoplatform.services.jcr.impl.core.query.lucene.spell.LuceneSpellChecker$FiveSecondsRefreshInterval" />
- <property name="excerptprovider-class" value="org.exoplatform.services.jcr.impl.core.query.lucene.WeightedHTMLExcerpt"/>
- <property name="extractorPoolSize" value="2"/>
- <property name="extractorTimeout" value="10"/>
- </properties>
- </query-handler>
- </workspace>
- </workspaces>
- </repository>
- </repositories>
-</repository-service>
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!--
+
+ 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.
+
+-->
+<repository-service default-repository="db1">
+ <repositories>
+ <repository name="db1" system-workspace="ws" default-workspace="ws">
+ <security-domain>exo-domain</security-domain>
+ <!-- access-control>optional</access-control -->
+ <!-- access-control>disable</access-control -->
+ <session-max-age>1h</session-max-age>
+ <authentication-policy>org.exoplatform.services.jcr.impl.core.access.JAASAuthenticator</authentication-policy>
+ <workspaces>
+ <workspace name="ws">
+ <!-- for system storage -->
+ <container class="org.exoplatform.services.jcr.impl.storage.jdbc.JDBCWorkspaceDataContainer">
+ <properties>
+ <property name="source-name" value="jdbcjcr" />
+ <property name="dialect" value="mysql" />
+ <property name="multi-db" value="true" />
+ <property name="update-storage" value="false" />
+ <property name="max-buffer-size" value="200k" />
+ <property name="swap-directory" value="target/temp/swap/ws" />
+ </properties>
+ <value-storages>
+ <value-storage id="ws" class="org.exoplatform.services.jcr.impl.storage.value.fs.TreeFileValueStorage">
+ <properties>
+ <property name="path" value="target/temp/values/ws" />
+ <property name="digest-algo" value="MD5" />
+ <property name="vcas-type" value="org.exoplatform.services.jcr.impl.storage.value.cas.JDBCValueContentAddressStorageImpl" />
+ <property name="jdbc-source-name" value="jdbcjcr" />
+ <property name="jdbc-dialect" value="mysql" />
+ </properties>
+ <filters>
+ <filter property-type="Binary" />
+ </filters>
+ </value-storage>
+ </value-storages>
+ </container>
+ <initializer class="org.exoplatform.services.jcr.impl.core.ScratchWorkspaceInitializer">
+ <properties>
+ <property name="root-nodetype" value="nt:unstructured" />
+ </properties>
+ </initializer>
+ <!-- initializer class="org.exoplatform.services.jcr.impl.core.RestoreWorkspaceInitializer">
+ <properties>
+ <property name="restore-path" value="./sv_export_root.xml" />
+ <property name="restore-path" value="./src/test/resources/import-export/restore_db1_ws1.xml" />
+ </properties>
+ </initializer
+-->
+ <cache enabled="true" class="org.exoplatform.services.jcr.impl.dataflow.persistent.LinkedWorkspaceStorageCacheImpl">
+ <properties>
+ <property name="max-size" value="2k" />
+ <property name="live-time" value="20m" />
+ <property name="statistic-period" value="30" />
+ <property name="statistic-log" value="false" />
+ </properties>
+ </cache>
+ <query-handler class="org.exoplatform.services.jcr.impl.core.query.lucene.SearchIndex">
+ <properties>
+ <property name="index-dir" value="target/temp/index/db1/ws" />
+ </properties>
+ </query-handler>
+ <lock-manager>
+ <time-out>15m</time-out>
+ <persister class="org.exoplatform.services.jcr.impl.core.lock.FileSystemLockPersister">
+ <properties>
+ <property name="path" value="target/temp/lock" />
+ </properties>
+ </persister>
+ </lock-manager>
+ </workspace>
+
+ <workspace name="ws1">
+ <container class="org.exoplatform.services.jcr.impl.storage.jdbc.JDBCWorkspaceDataContainer">
+ <properties>
+ <property name="source-name" value="jdbcjcr1" />
+ <property name="dialect" value="mysql" />
+ <property name="multi-db" value="true" />
+ <property name="update-storage" value="false" />
+ <property name="max-buffer-size" value="200k" />
+ <property name="swap-directory" value="target/temp/swap/ws1" />
+ </properties>
+ <value-storages>
+ <value-storage id="ws1" class="org.exoplatform.services.jcr.impl.storage.value.fs.TreeFileValueStorage">
+ <properties>
+ <property name="path" value="target/temp/values/ws1" />
+ </properties>
+ <filters>
+ <filter property-type="Binary" />
+ </filters>
+ </value-storage>
+ </value-storages>
+ </container>
+ <cache enabled="true" class="org.exoplatform.services.jcr.impl.dataflow.persistent.LinkedWorkspaceStorageCacheImpl">
+ <properties>
+ <property name="max-size" value="2k" />
+ <property name="live-time" value="20m" />
+ </properties>
+ </cache>
+ <query-handler class="org.exoplatform.services.jcr.impl.core.query.lucene.SearchIndex">
+ <properties>
+ <property name="index-dir" value="target/temp/index/db1/ws1" />
+ <property name="synonymprovider-class" value="org.exoplatform.services.jcr.impl.core.query.lucene.PropertiesSynonymProvider" />
+ <property name="synonymprovider-config-path" value="../../synonyms.properties" />
+ <property name="support-highlighting" value="true" />
+ <property name="indexing-configuration-path" value="../../indexing-configuration.xml" />
+ <property name="query-class" value="org.exoplatform.services.jcr.impl.core.query.QueryImpl" />
+ <property name="spellchecker-class" value="org.exoplatform.services.jcr.impl.core.query.lucene.spell.LuceneSpellChecker$FiveSecondsRefreshInterval" />
+ </properties>
+ </query-handler>
+ </workspace>
+
+ <workspace name="ws2">
+ <container class="org.exoplatform.services.jcr.impl.storage.jdbc.JDBCWorkspaceDataContainer">
+ <properties>
+ <property name="source-name" value="jdbcjcr2" />
+ <property name="dialect" value="mysql" />
+ <property name="multi-db" value="true" />
+ <property name="update-storage" value="false" />
+ <property name="max-buffer-size" value="200k" />
+ <property name="swap-directory" value="target/temp/swap/ws2" />
+ </properties>
+ <value-storages>
+ <value-storage id="ws2" class="org.exoplatform.services.jcr.impl.storage.value.fs.TreeFileValueStorage">
+ <properties>
+ <property name="path" value="target/temp/values/ws2" />
+ </properties>
+ <filters>
+ <filter property-type="Binary" />
+ </filters>
+ </value-storage>
+ </value-storages>
+ </container>
+ <cache enabled="true" class="org.exoplatform.services.jcr.impl.dataflow.persistent.LinkedWorkspaceStorageCacheImpl">
+ <properties>
+ <property name="max-size" value="2k" />
+ <property name="live-time" value="20m" />
+ </properties>
+ </cache>
+ <query-handler class="org.exoplatform.services.jcr.impl.core.query.lucene.SearchIndex">
+ <properties>
+ <property name="index-dir" value="target/temp/index/db1/ws2" />
+ <property name="synonymprovider-class" value="org.exoplatform.services.jcr.impl.core.query.lucene.PropertiesSynonymProvider" />
+ <property name="synonymprovider-config-path" value="../../synonyms.properties" />
+ <property name="support-highlighting" value="true" />
+ <property name="indexing-configuration-path" value="../../indexing-configuration.xml" />
+ <property name="query-class" value="org.exoplatform.services.jcr.impl.core.query.QueryImpl" />
+ <property name="spellchecker-class" value="org.exoplatform.services.jcr.impl.core.query.lucene.spell.LuceneSpellChecker$FiveSecondsRefreshInterval" />
+ </properties>
+ </query-handler>
+ </workspace>
+
+ <workspace name="ws3">
+ <!-- for system storage -->
+ <container
+ class="org.exoplatform.services.jcr.impl.storage.jdbc.JDBCWorkspaceDataContainer">
+ <properties>
+ <property name="source-name" value="jdbcjcr3" />
+ <property name="dialect" value="mysql" />
+ <property name="multi-db" value="true" />
+ <property name="update-storage" value="false" />
+ <property name="max-buffer-size" value="200k" />
+ <property name="swap-directory" value="target/temp/swap/ws3" />
+ </properties>
+ <value-storages>
+ <!--
+ This storage is used to check whether properties are removed
+ correctly from each value-storage
+ (TestRemoveFromValueStorage.java)
+ -->
+ <value-storage id="ws3_big"
+ class="org.exoplatform.services.jcr.impl.storage.value.fs.TreeFileValueStorage">
+ <properties>
+ <property name="path" value="target/temp/values/ws3_big" />
+ </properties>
+ <filters>
+ <filter property-type="Binary" min-value-size="1024K" />
+ </filters>
+ </value-storage>
+ <value-storage id="ws3"
+ class="org.exoplatform.services.jcr.impl.storage.value.fs.CASableTreeFileValueStorage">
+ <properties>
+ <property name="path" value="target/temp/values/ws3" />
+ <property name="digest-algo" value="MD5" />
+ <property name="vcas-type"
+ value="org.exoplatform.services.jcr.impl.storage.value.cas.JDBCValueContentAddressStorageImpl" />
+ <property name="jdbc-source-name" value="jdbcjcr" />
+ <property name="jdbc-dialect" value="mysql" />
+ </properties>
+ <filters>
+ <filter property-type="Binary" />
+ </filters>
+ </value-storage>
+ </value-storages>
+ </container>
+ <initializer
+ class="org.exoplatform.services.jcr.impl.core.ScratchWorkspaceInitializer">
+ <properties>
+ <property name="root-nodetype" value="nt:unstructured" />
+ </properties>
+ </initializer>
+ <cache enabled="true"
+ class="org.exoplatform.services.jcr.impl.dataflow.persistent.LinkedWorkspaceStorageCacheImpl">
+ <properties>
+ <property name="max-size" value="2k" />
+ <property name="live-time" value="20m" />
+ </properties>
+ </cache>
+ <query-handler
+ class="org.exoplatform.services.jcr.impl.core.query.lucene.SearchIndex">
+ <properties>
+ <property name="index-dir" value="target/temp/index/db1/ws3" />
+ <property name="synonymprovider-class"
+ value="org.exoplatform.services.jcr.impl.core.query.lucene.PropertiesSynonymProvider" />
+ <property name="synonymprovider-config-path" value="../../synonyms.properties" />
+ <property name="support-highlighting" value="true" />
+ <property name="indexing-configuration-path" value="../../indexing-configuration.xml" />
+ <property name="query-class"
+ value="org.exoplatform.services.jcr.impl.core.query.QueryImpl" />
+ <property name="spellchecker-class"
+ value="org.exoplatform.services.jcr.impl.core.query.lucene.spell.LuceneSpellChecker$FiveSecondsRefreshInterval" />
+ </properties>
+ </query-handler>
+ </workspace>
+ </workspaces>
+ </repository>
+
+ <repository name="db1tck" system-workspace="ws" default-workspace="ws">
+ <security-domain>exo-domain</security-domain>
+ <!-- access-control>optional</access-control -->
+ <!-- access-control>disable</access-control -->
+ <session-max-age>1h</session-max-age>
+ <authentication-policy>org.exoplatform.services.jcr.impl.core.access.JAASAuthenticator</authentication-policy>
+ <workspaces>
+ <workspace name="ws">
+ <!-- for system storage -->
+ <container class="org.exoplatform.services.jcr.impl.storage.jdbc.JDBCWorkspaceDataContainer">
+ <properties>
+ <property name="source-name" value="jdbcjcrtck" />
+ <property name="dialect" value="mysql" />
+ <property name="multi-db" value="true" />
+ <property name="update-storage" value="false" />
+ <property name="max-buffer-size" value="200k" />
+ <property name="swap-directory" value="target/temp/swap/wstck" />
+ </properties>
+ <value-storages>
+ <value-storage id="ws" class="org.exoplatform.services.jcr.impl.storage.value.fs.TreeFileValueStorage">
+ <properties>
+ <property name="path" value="target/temp/values/wstck" />
+ </properties>
+ <filters>
+ <filter property-type="Binary" min-value-size="100K" />
+ </filters>
+ </value-storage>
+ </value-storages>
+ </container>
+ <initializer class="org.exoplatform.services.jcr.impl.core.ScratchWorkspaceInitializer">
+ <properties>
+ <property name="root-nodetype" value="nt:unstructured" />
+ <property name="root-permissions" value="any read;*:/platform/administrators read;*:/platform/administrators add_node;*:/platform/administrators set_property;*:/platform/administrators remove" />
+ </properties>
+ </initializer>
+ <cache enabled="true" class="org.exoplatform.services.jcr.impl.dataflow.persistent.LinkedWorkspaceStorageCacheImpl">
+ <properties>
+ <property name="max-size" value="2k" />
+ <property name="live-time" value="20m" />
+ </properties>
+ </cache>
+ <query-handler class="org.exoplatform.services.jcr.impl.core.query.lucene.SearchIndex">
+ <properties>
+ <property name="index-dir" value="target/temp/index/db1tck/ws" />
+ <property name="synonymprovider-class" value="org.exoplatform.services.jcr.impl.core.query.lucene.PropertiesSynonymProvider" />
+ <property name="synonymprovider-config-path" value="../../synonyms.properties" />
+ <property name="support-highlighting" value="true" />
+ <property name="indexing-configuration-path" value="../../indexing-configuration.xml" />
+ <property name="query-class" value="org.exoplatform.services.jcr.impl.core.query.QueryImpl" />
+ <property name="excerptprovider-class" value="org.exoplatform.services.jcr.impl.core.query.lucene.WeightedHTMLExcerpt" />
+ <property name="spellchecker-class" value="org.exoplatform.services.jcr.impl.core.query.lucene.spell.LuceneSpellChecker$FiveSecondsRefreshInterval" />
+ </properties>
+ </query-handler>
+ <lock-manager>
+ <time-out>15m</time-out>
+ <persister class="org.exoplatform.services.jcr.impl.core.lock.FileSystemLockPersister">
+ <properties>
+ <property name="path" value="target/temp/locktck" />
+ </properties>
+ </persister>
+ </lock-manager>
+ </workspace>
+
+ <workspace name="ws1">
+ <container class="org.exoplatform.services.jcr.impl.storage.jdbc.JDBCWorkspaceDataContainer">
+ <properties>
+ <property name="source-name" value="jdbcjcr1tck" />
+ <property name="dialect" value="mysql" />
+ <property name="multi-db" value="true" />
+ <property name="update-storage" value="false" />
+ <property name="max-buffer-size" value="200k" />
+ <property name="swap-directory" value="target/temp/swap/ws1tck" />
+ </properties>
+ <value-storages>
+ <value-storage id="ws1" class="org.exoplatform.services.jcr.impl.storage.value.fs.TreeFileValueStorage">
+ <properties>
+ <property name="path" value="target/temp/values/ws1tck" />
+ </properties>
+ <filters>
+ <filter property-type="Binary" min-value-size="100K" />
+ </filters>
+ </value-storage>
+ </value-storages>
+ </container>
+ <initializer class="org.exoplatform.services.jcr.impl.core.ScratchWorkspaceInitializer">
+ <properties>
+ <property name="root-nodetype" value="nt:unstructured" />
+ <property name="root-permissions" value="any read;*:/platform/administrators read;*:/platform/administrators add_node;*:/platform/administrators set_property;*:/platform/administrators remove" />
+ </properties>
+ </initializer>
+ <cache enabled="true" class="org.exoplatform.services.jcr.impl.dataflow.persistent.LinkedWorkspaceStorageCacheImpl">
+ <properties>
+ <property name="max-size" value="2k" />
+ <property name="live-time" value="20m" />
+ </properties>
+ </cache>
+ <query-handler class="org.exoplatform.services.jcr.impl.core.query.lucene.SearchIndex">
+ <properties>
+ <property name="index-dir" value="target/temp/index/db1tck/ws1" />
+ <property name="synonymprovider-class" value="org.exoplatform.services.jcr.impl.core.query.lucene.PropertiesSynonymProvider" />
+ <property name="synonymprovider-config-path" value="../../synonyms.properties" />
+ <property name="support-highlighting" value="true" />
+ <property name="indexing-configuration-path" value="../../indexing-configuration.xml" />
+ <property name="query-class" value="org.exoplatform.services.jcr.impl.core.query.QueryImpl" />
+ <property name="spellchecker-class" value="org.exoplatform.services.jcr.impl.core.query.lucene.spell.LuceneSpellChecker$FiveSecondsRefreshInterval" />
+ </properties>
+ </query-handler>
+ </workspace>
+
+ <workspace name="ws2">
+ <container class="org.exoplatform.services.jcr.impl.storage.jdbc.JDBCWorkspaceDataContainer">
+ <properties>
+ <property name="source-name" value="jdbcjcr2tck" />
+ <property name="dialect" value="mysql" />
+ <property name="multi-db" value="true" />
+ <property name="update-storage" value="false" />
+ <property name="max-buffer-size" value="200k" />
+ <property name="swap-directory" value="target/temp/swap/ws2tck" />
+ </properties>
+ <value-storages>
+ <value-storage id="ws2" class="org.exoplatform.services.jcr.impl.storage.value.fs.TreeFileValueStorage">
+ <properties>
+ <property name="path" value="target/temp/values/ws2tck" />
+ </properties>
+ <filters>
+ <filter property-type="Binary" min-value-size="100K" />
+ </filters>
+ </value-storage>
+ </value-storages>
+ </container>
+ <initializer class="org.exoplatform.services.jcr.impl.core.ScratchWorkspaceInitializer">
+ <properties>
+ <property name="root-nodetype" value="nt:unstructured" />
+ <property name="root-permissions" value="any read;*:/platform/administrators read;*:/platform/administrators add_node;*:/platform/administrators set_property;*:/platform/administrators remove" />
+ </properties>
+ </initializer>
+ <cache enabled="true" class="org.exoplatform.services.jcr.impl.dataflow.persistent.LinkedWorkspaceStorageCacheImpl">
+ <properties>
+ <property name="max-size" value="2k" />
+ <property name="live-time" value="20m" />
+ </properties>
+ </cache>
+ <query-handler class="org.exoplatform.services.jcr.impl.core.query.lucene.SearchIndex">
+ <properties>
+ <property name="index-dir" value="target/temp/index/db1tck/ws2" />
+ <property name="synonymprovider-class" value="org.exoplatform.services.jcr.impl.core.query.lucene.PropertiesSynonymProvider" />
+ <property name="synonymprovider-config-path" value="../../synonyms.properties" />
+ <property name="support-highlighting" value="true" />
+ <property name="indexing-configuration-path" value="../../indexing-configuration.xml" />
+ <property name="query-class" value="org.exoplatform.services.jcr.impl.core.query.QueryImpl" />
+ <property name="spellchecker-class" value="org.exoplatform.services.jcr.impl.core.query.lucene.spell.LuceneSpellChecker$FiveSecondsRefreshInterval" />
+ <property name="excerptprovider-class" value="org.exoplatform.services.jcr.impl.core.query.lucene.WeightedHTMLExcerpt"/>
+ <property name="extractorPoolSize" value="2"/>
+ <property name="extractorTimeout" value="10"/>
+ </properties>
+ </query-handler>
+ </workspace>
+ </workspaces>
+ </repository>
+ </repositories>
+</repository-service>
Modified: jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/test/resources/conf/standalone/test-jcr-config.xml
===================================================================
--- jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/test/resources/conf/standalone/test-jcr-config.xml 2009-12-25 17:05:38 UTC (rev 1196)
+++ jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/test/resources/conf/standalone/test-jcr-config.xml 2009-12-25 20:13:35 UTC (rev 1197)
@@ -1,407 +1,407 @@
-<?xml version="1.0" encoding="ISO-8859-1"?>
-<!--
-
- 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.
-
--->
-<repository-service default-repository="db1">
- <repositories>
- <repository name="db1" system-workspace="ws" default-workspace="ws">
- <security-domain>exo-domain</security-domain>
- <!-- access-control>optional</access-control -->
- <!-- access-control>disable</access-control -->
- <session-max-age>1h</session-max-age>
- <authentication-policy>org.exoplatform.services.jcr.impl.core.access.JAASAuthenticator</authentication-policy>
- <workspaces>
- <workspace name="ws">
- <!-- for system storage -->
- <container class="org.exoplatform.services.jcr.impl.storage.jdbc.optimisation.NewJDBCWorkspaceDataContainer">
- <properties>
- <property name="source-name" value="jdbcjcr" />
- <property name="dialect" value="mysql" />
- <property name="multi-db" value="true" />
- <property name="update-storage" value="false" />
- <property name="max-buffer-size" value="200k" />
- <property name="swap-directory" value="target/temp/swap/ws" />
- </properties>
- <value-storages>
- <value-storage id="ws" class="org.exoplatform.services.jcr.impl.storage.value.fs.TreeFileValueStorage">
- <properties>
- <property name="path" value="target/temp/values/ws" />
- <property name="digest-algo" value="MD5" />
- <property name="vcas-type" value="org.exoplatform.services.jcr.impl.storage.value.cas.JDBCValueContentAddressStorageImpl" />
- <property name="jdbc-source-name" value="jdbcjcr" />
- <property name="jdbc-dialect" value="hsqldb" />
- </properties>
- <filters>
- <filter property-type="Binary" />
- </filters>
- </value-storage>
- </value-storages>
- </container>
- <initializer class="org.exoplatform.services.jcr.impl.core.ScratchWorkspaceInitializer">
- <properties>
- <property name="root-nodetype" value="nt:unstructured" />
- </properties>
- </initializer>
- <!-- initializer class="org.exoplatform.services.jcr.impl.core.RestoreWorkspaceInitializer">
- <properties>
- <property name="restore-path" value="./sv_export_root.xml" />
- <property name="restore-path" value="./src/test/resources/import-export/restore_db1_ws1.xml" />
- </properties>
- </initializer
--->
- <cache enabled="true" class="org.exoplatform.services.jcr.impl.dataflow.persistent.LinkedWorkspaceStorageCacheImpl">
- <properties>
- <property name="max-size" value="2k" />
- <property name="live-time" value="20m" />
- <property name="statistic-period" value="30" />
- <property name="statistic-log" value="false" />
- </properties>
- </cache>
- <query-handler class="org.exoplatform.services.jcr.impl.core.query.lucene.SearchIndex">
- <properties>
- <property name="index-dir" value="target/temp/index/db1/ws" />
- </properties>
- </query-handler>
- <lock-manager>
- <time-out>15m</time-out>
- <persister class="org.exoplatform.services.jcr.impl.core.lock.FileSystemLockPersister">
- <properties>
- <property name="path" value="target/temp/lock" />
- </properties>
- </persister>
- </lock-manager>
- </workspace>
-
- <workspace name="ws1">
- <container class="org.exoplatform.services.jcr.impl.storage.jdbc.optimisation.NewJDBCWorkspaceDataContainer">
- <properties>
- <property name="source-name" value="jdbcjcr1" />
- <property name="dialect" value="mysql" />
- <property name="multi-db" value="true" />
- <property name="update-storage" value="false" />
- <property name="max-buffer-size" value="200k" />
- <property name="swap-directory" value="target/temp/swap/ws1" />
- </properties>
- <value-storages>
- <value-storage id="ws1" class="org.exoplatform.services.jcr.impl.storage.value.fs.TreeFileValueStorage">
- <properties>
- <property name="path" value="target/temp/values/ws1" />
- </properties>
- <filters>
- <filter property-type="Binary" />
- </filters>
- </value-storage>
- </value-storages>
- </container>
- <cache enabled="true" class="org.exoplatform.services.jcr.impl.dataflow.persistent.LinkedWorkspaceStorageCacheImpl">
- <properties>
- <property name="max-size" value="2k" />
- <property name="live-time" value="20m" />
- </properties>
- </cache>
- <query-handler class="org.exoplatform.services.jcr.impl.core.query.lucene.SearchIndex">
- <properties>
- <property name="index-dir" value="target/temp/index/db1/ws1" />
- <property name="synonymprovider-class" value="org.exoplatform.services.jcr.impl.core.query.lucene.PropertiesSynonymProvider" />
- <property name="synonymprovider-config-path" value="../../synonyms.properties" />
- <property name="support-highlighting" value="true" />
- <property name="indexing-configuration-path" value="../../indexing-configuration.xml" />
- <property name="query-class" value="org.exoplatform.services.jcr.impl.core.query.QueryImpl" />
- <property name="spellchecker-class" value="org.exoplatform.services.jcr.impl.core.query.lucene.spell.LuceneSpellChecker$FiveSecondsRefreshInterval" />
- </properties>
- </query-handler>
- </workspace>
-
- <workspace name="ws2">
- <container class="org.exoplatform.services.jcr.impl.storage.jdbc.optimisation.NewJDBCWorkspaceDataContainer">
- <properties>
- <property name="source-name" value="jdbcjcr2" />
- <property name="dialect" value="mysql" />
- <property name="multi-db" value="true" />
- <property name="update-storage" value="false" />
- <property name="max-buffer-size" value="200k" />
- <property name="swap-directory" value="target/temp/swap/ws2" />
- </properties>
- <value-storages>
- <value-storage id="ws2" class="org.exoplatform.services.jcr.impl.storage.value.fs.TreeFileValueStorage">
- <properties>
- <property name="path" value="target/temp/values/ws2" />
- </properties>
- <filters>
- <filter property-type="Binary" />
- </filters>
- </value-storage>
- </value-storages>
- </container>
- <cache enabled="true" class="org.exoplatform.services.jcr.impl.dataflow.persistent.LinkedWorkspaceStorageCacheImpl">
- <properties>
- <property name="max-size" value="2k" />
- <property name="live-time" value="20m" />
- </properties>
- </cache>
- <query-handler class="org.exoplatform.services.jcr.impl.core.query.lucene.SearchIndex">
- <properties>
- <property name="index-dir" value="target/temp/index/db1/ws2" />
- <property name="synonymprovider-class" value="org.exoplatform.services.jcr.impl.core.query.lucene.PropertiesSynonymProvider" />
- <property name="synonymprovider-config-path" value="../../synonyms.properties" />
- <property name="support-highlighting" value="true" />
- <property name="indexing-configuration-path" value="../../indexing-configuration.xml" />
- <property name="query-class" value="org.exoplatform.services.jcr.impl.core.query.QueryImpl" />
- <property name="spellchecker-class" value="org.exoplatform.services.jcr.impl.core.query.lucene.spell.LuceneSpellChecker$FiveSecondsRefreshInterval" />
- </properties>
- </query-handler>
- </workspace>
-
- <workspace name="ws3">
- <!-- for system storage -->
- <container
- class="org.exoplatform.services.jcr.impl.storage.jdbc.optimisation.NewJDBCWorkspaceDataContainer">
- <properties>
- <property name="source-name" value="jdbcjcr3" />
- <property name="dialect" value="mysql" />
- <property name="multi-db" value="true" />
- <property name="update-storage" value="false" />
- <property name="max-buffer-size" value="200k" />
- <property name="swap-directory" value="target/temp/swap/ws3" />
- </properties>
- <value-storages>
- <!--
- This storage is used to check whether properties are removed
- correctly from each value-storage
- (TestRemoveFromValueStorage.java)
- -->
- <value-storage id="ws3_big"
- class="org.exoplatform.services.jcr.impl.storage.value.fs.TreeFileValueStorage">
- <properties>
- <property name="path" value="target/temp/values/ws3_big" />
- </properties>
- <filters>
- <filter property-type="Binary" min-value-size="1024K" />
- </filters>
- </value-storage>
- <value-storage id="ws3"
- class="org.exoplatform.services.jcr.impl.storage.value.fs.CASableTreeFileValueStorage">
- <properties>
- <property name="path" value="target/temp/values/ws3" />
- <property name="digest-algo" value="MD5" />
- <property name="vcas-type"
- value="org.exoplatform.services.jcr.impl.storage.value.cas.JDBCValueContentAddressStorageImpl" />
- <property name="jdbc-source-name" value="jdbcjcr" />
- <property name="jdbc-dialect" value="hsqldb" />
- </properties>
- <filters>
- <filter property-type="Binary" />
- </filters>
- </value-storage>
- </value-storages>
- </container>
- <initializer
- class="org.exoplatform.services.jcr.impl.core.ScratchWorkspaceInitializer">
- <properties>
- <property name="root-nodetype" value="nt:unstructured" />
- </properties>
- </initializer>
- <cache enabled="true"
- class="org.exoplatform.services.jcr.impl.dataflow.persistent.LinkedWorkspaceStorageCacheImpl">
- <properties>
- <property name="max-size" value="2k" />
- <property name="live-time" value="20m" />
- </properties>
- </cache>
- <query-handler
- class="org.exoplatform.services.jcr.impl.core.query.lucene.SearchIndex">
- <properties>
- <property name="index-dir" value="target/temp/index/db1/ws3" />
- <property name="synonymprovider-class"
- value="org.exoplatform.services.jcr.impl.core.query.lucene.PropertiesSynonymProvider" />
- <property name="synonymprovider-config-path" value="../../synonyms.properties" />
- <property name="support-highlighting" value="true" />
- <property name="indexing-configuration-path" value="../../indexing-configuration.xml" />
- <property name="query-class"
- value="org.exoplatform.services.jcr.impl.core.query.QueryImpl" />
- <property name="spellchecker-class"
- value="org.exoplatform.services.jcr.impl.core.query.lucene.spell.LuceneSpellChecker$FiveSecondsRefreshInterval" />
- </properties>
- </query-handler>
- </workspace>
- </workspaces>
- </repository>
-
- <repository name="db1tck" system-workspace="ws" default-workspace="ws">
- <security-domain>exo-domain</security-domain>
- <!-- access-control>optional</access-control -->
- <!-- access-control>disable</access-control -->
- <session-max-age>1h</session-max-age>
- <authentication-policy>org.exoplatform.services.jcr.impl.core.access.JAASAuthenticator</authentication-policy>
- <workspaces>
- <workspace name="ws">
- <!-- for system storage -->
- <container class="org.exoplatform.services.jcr.impl.storage.jdbc.optimisation.NewJDBCWorkspaceDataContainer">
- <properties>
- <property name="source-name" value="jdbcjcrtck" />
- <property name="dialect" value="mysql" />
- <property name="multi-db" value="true" />
- <property name="update-storage" value="false" />
- <property name="max-buffer-size" value="200k" />
- <property name="swap-directory" value="target/temp/swap/wstck" />
- </properties>
- <value-storages>
- <value-storage id="ws" class="org.exoplatform.services.jcr.impl.storage.value.fs.TreeFileValueStorage">
- <properties>
- <property name="path" value="target/temp/values/wstck" />
- </properties>
- <filters>
- <filter property-type="Binary" min-value-size="100K" />
- </filters>
- </value-storage>
- </value-storages>
- </container>
- <initializer class="org.exoplatform.services.jcr.impl.core.ScratchWorkspaceInitializer">
- <properties>
- <property name="root-nodetype" value="nt:unstructured" />
- <property name="root-permissions" value="any read;*:/platform/administrators read;*:/platform/administrators add_node;*:/platform/administrators set_property;*:/platform/administrators remove" />
- </properties>
- </initializer>
- <cache enabled="true" class="org.exoplatform.services.jcr.impl.dataflow.persistent.LinkedWorkspaceStorageCacheImpl">
- <properties>
- <property name="max-size" value="2k" />
- <property name="live-time" value="20m" />
- </properties>
- </cache>
- <query-handler class="org.exoplatform.services.jcr.impl.core.query.lucene.SearchIndex">
- <properties>
- <property name="index-dir" value="target/temp/index/db1tck/ws" />
- <property name="synonymprovider-class" value="org.exoplatform.services.jcr.impl.core.query.lucene.PropertiesSynonymProvider" />
- <property name="synonymprovider-config-path" value="../../synonyms.properties" />
- <property name="support-highlighting" value="true" />
- <property name="indexing-configuration-path" value="../../indexing-configuration.xml" />
- <property name="query-class" value="org.exoplatform.services.jcr.impl.core.query.QueryImpl" />
- <property name="excerptprovider-class" value="org.exoplatform.services.jcr.impl.core.query.lucene.WeightedHTMLExcerpt" />
- <property name="spellchecker-class" value="org.exoplatform.services.jcr.impl.core.query.lucene.spell.LuceneSpellChecker$FiveSecondsRefreshInterval" />
- </properties>
- </query-handler>
- <lock-manager>
- <time-out>15m</time-out>
- <persister class="org.exoplatform.services.jcr.impl.core.lock.FileSystemLockPersister">
- <properties>
- <property name="path" value="target/temp/locktck" />
- </properties>
- </persister>
- </lock-manager>
- </workspace>
-
- <workspace name="ws1">
- <container class="org.exoplatform.services.jcr.impl.storage.jdbc.optimisation.NewJDBCWorkspaceDataContainer">
- <properties>
- <property name="source-name" value="jdbcjcr1tck" />
- <property name="dialect" value="mysql" />
- <property name="multi-db" value="true" />
- <property name="update-storage" value="false" />
- <property name="max-buffer-size" value="200k" />
- <property name="swap-directory" value="target/temp/swap/ws1tck" />
- </properties>
- <value-storages>
- <value-storage id="ws1" class="org.exoplatform.services.jcr.impl.storage.value.fs.TreeFileValueStorage">
- <properties>
- <property name="path" value="target/temp/values/ws1tck" />
- </properties>
- <filters>
- <filter property-type="Binary" min-value-size="100K" />
- </filters>
- </value-storage>
- </value-storages>
- </container>
- <initializer class="org.exoplatform.services.jcr.impl.core.ScratchWorkspaceInitializer">
- <properties>
- <property name="root-nodetype" value="nt:unstructured" />
- <property name="root-permissions" value="any read;*:/platform/administrators read;*:/platform/administrators add_node;*:/platform/administrators set_property;*:/platform/administrators remove" />
- </properties>
- </initializer>
- <cache enabled="true" class="org.exoplatform.services.jcr.impl.dataflow.persistent.LinkedWorkspaceStorageCacheImpl">
- <properties>
- <property name="max-size" value="2k" />
- <property name="live-time" value="20m" />
- </properties>
- </cache>
- <query-handler class="org.exoplatform.services.jcr.impl.core.query.lucene.SearchIndex">
- <properties>
- <property name="index-dir" value="target/temp/index/db1tck/ws1" />
- <property name="synonymprovider-class" value="org.exoplatform.services.jcr.impl.core.query.lucene.PropertiesSynonymProvider" />
- <property name="synonymprovider-config-path" value="../../synonyms.properties" />
- <property name="support-highlighting" value="true" />
- <property name="indexing-configuration-path" value="../../indexing-configuration.xml" />
- <property name="query-class" value="org.exoplatform.services.jcr.impl.core.query.QueryImpl" />
- <property name="spellchecker-class" value="org.exoplatform.services.jcr.impl.core.query.lucene.spell.LuceneSpellChecker$FiveSecondsRefreshInterval" />
- </properties>
- </query-handler>
- </workspace>
-
- <workspace name="ws2">
- <container class="org.exoplatform.services.jcr.impl.storage.jdbc.optimisation.NewJDBCWorkspaceDataContainer">
- <properties>
- <property name="source-name" value="jdbcjcr2tck" />
- <property name="dialect" value="mysql" />
- <property name="multi-db" value="true" />
- <property name="update-storage" value="false" />
- <property name="max-buffer-size" value="200k" />
- <property name="swap-directory" value="target/temp/swap/ws2tck" />
- </properties>
- <value-storages>
- <value-storage id="ws2" class="org.exoplatform.services.jcr.impl.storage.value.fs.TreeFileValueStorage">
- <properties>
- <property name="path" value="target/temp/values/ws2tck" />
- </properties>
- <filters>
- <filter property-type="Binary" min-value-size="100K" />
- </filters>
- </value-storage>
- </value-storages>
- </container>
- <initializer class="org.exoplatform.services.jcr.impl.core.ScratchWorkspaceInitializer">
- <properties>
- <property name="root-nodetype" value="nt:unstructured" />
- <property name="root-permissions" value="any read;*:/platform/administrators read;*:/platform/administrators add_node;*:/platform/administrators set_property;*:/platform/administrators remove" />
- </properties>
- </initializer>
- <cache enabled="true" class="org.exoplatform.services.jcr.impl.dataflow.persistent.LinkedWorkspaceStorageCacheImpl">
- <properties>
- <property name="max-size" value="2k" />
- <property name="live-time" value="20m" />
- </properties>
- </cache>
- <query-handler class="org.exoplatform.services.jcr.impl.core.query.lucene.SearchIndex">
- <properties>
- <property name="index-dir" value="target/temp/index/db1tck/ws2" />
- <property name="synonymprovider-class" value="org.exoplatform.services.jcr.impl.core.query.lucene.PropertiesSynonymProvider" />
- <property name="synonymprovider-config-path" value="../../synonyms.properties" />
- <property name="support-highlighting" value="true" />
- <property name="indexing-configuration-path" value="../../indexing-configuration.xml" />
- <property name="query-class" value="org.exoplatform.services.jcr.impl.core.query.QueryImpl" />
- <property name="spellchecker-class" value="org.exoplatform.services.jcr.impl.core.query.lucene.spell.LuceneSpellChecker$FiveSecondsRefreshInterval" />
- <property name="excerptprovider-class" value="org.exoplatform.services.jcr.impl.core.query.lucene.WeightedHTMLExcerpt"/>
- <property name="extractorPoolSize" value="2"/>
- <property name="extractorTimeout" value="10"/>
- </properties>
- </query-handler>
- </workspace>
- </workspaces>
- </repository>
- </repositories>
-</repository-service>
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!--
+
+ 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.
+
+-->
+<repository-service default-repository="db1">
+ <repositories>
+ <repository name="db1" system-workspace="ws" default-workspace="ws">
+ <security-domain>exo-domain</security-domain>
+ <!-- access-control>optional</access-control -->
+ <!-- access-control>disable</access-control -->
+ <session-max-age>1h</session-max-age>
+ <authentication-policy>org.exoplatform.services.jcr.impl.core.access.JAASAuthenticator</authentication-policy>
+ <workspaces>
+ <workspace name="ws">
+ <!-- for system storage -->
+ <container class="org.exoplatform.services.jcr.impl.storage.jdbc.JDBCWorkspaceDataContainer">
+ <properties>
+ <property name="source-name" value="jdbcjcr" />
+ <property name="dialect" value="hsqldb" />
+ <property name="multi-db" value="true" />
+ <property name="update-storage" value="false" />
+ <property name="max-buffer-size" value="200k" />
+ <property name="swap-directory" value="target/temp/swap/ws" />
+ </properties>
+ <value-storages>
+ <value-storage id="ws" class="org.exoplatform.services.jcr.impl.storage.value.fs.TreeFileValueStorage">
+ <properties>
+ <property name="path" value="target/temp/values/ws" />
+ <property name="digest-algo" value="MD5" />
+ <property name="vcas-type" value="org.exoplatform.services.jcr.impl.storage.value.cas.JDBCValueContentAddressStorageImpl" />
+ <property name="jdbc-source-name" value="jdbcjcr" />
+ <property name="jdbc-dialect" value="hsqldb" />
+ </properties>
+ <filters>
+ <filter property-type="Binary" />
+ </filters>
+ </value-storage>
+ </value-storages>
+ </container>
+ <initializer class="org.exoplatform.services.jcr.impl.core.ScratchWorkspaceInitializer">
+ <properties>
+ <property name="root-nodetype" value="nt:unstructured" />
+ </properties>
+ </initializer>
+ <!-- initializer class="org.exoplatform.services.jcr.impl.core.RestoreWorkspaceInitializer">
+ <properties>
+ <property name="restore-path" value="./sv_export_root.xml" />
+ <property name="restore-path" value="./src/test/resources/import-export/restore_db1_ws1.xml" />
+ </properties>
+ </initializer
+-->
+ <cache enabled="true" class="org.exoplatform.services.jcr.impl.dataflow.persistent.LinkedWorkspaceStorageCacheImpl">
+ <properties>
+ <property name="max-size" value="2k" />
+ <property name="live-time" value="20m" />
+ <property name="statistic-period" value="30" />
+ <property name="statistic-log" value="false" />
+ </properties>
+ </cache>
+ <query-handler class="org.exoplatform.services.jcr.impl.core.query.lucene.SearchIndex">
+ <properties>
+ <property name="index-dir" value="target/temp/index/db1/ws" />
+ </properties>
+ </query-handler>
+ <lock-manager>
+ <time-out>15m</time-out>
+ <persister class="org.exoplatform.services.jcr.impl.core.lock.FileSystemLockPersister">
+ <properties>
+ <property name="path" value="target/temp/lock" />
+ </properties>
+ </persister>
+ </lock-manager>
+ </workspace>
+
+ <workspace name="ws1">
+ <container class="org.exoplatform.services.jcr.impl.storage.jdbc.JDBCWorkspaceDataContainer">
+ <properties>
+ <property name="source-name" value="jdbcjcr1" />
+ <property name="dialect" value="hsqldb" />
+ <property name="multi-db" value="true" />
+ <property name="update-storage" value="false" />
+ <property name="max-buffer-size" value="200k" />
+ <property name="swap-directory" value="target/temp/swap/ws1" />
+ </properties>
+ <value-storages>
+ <value-storage id="ws1" class="org.exoplatform.services.jcr.impl.storage.value.fs.TreeFileValueStorage">
+ <properties>
+ <property name="path" value="target/temp/values/ws1" />
+ </properties>
+ <filters>
+ <filter property-type="Binary" />
+ </filters>
+ </value-storage>
+ </value-storages>
+ </container>
+ <cache enabled="true" class="org.exoplatform.services.jcr.impl.dataflow.persistent.LinkedWorkspaceStorageCacheImpl">
+ <properties>
+ <property name="max-size" value="2k" />
+ <property name="live-time" value="20m" />
+ </properties>
+ </cache>
+ <query-handler class="org.exoplatform.services.jcr.impl.core.query.lucene.SearchIndex">
+ <properties>
+ <property name="index-dir" value="target/temp/index/db1/ws1" />
+ <property name="synonymprovider-class" value="org.exoplatform.services.jcr.impl.core.query.lucene.PropertiesSynonymProvider" />
+ <property name="synonymprovider-config-path" value="../../synonyms.properties" />
+ <property name="support-highlighting" value="true" />
+ <property name="indexing-configuration-path" value="../../indexing-configuration.xml" />
+ <property name="query-class" value="org.exoplatform.services.jcr.impl.core.query.QueryImpl" />
+ <property name="spellchecker-class" value="org.exoplatform.services.jcr.impl.core.query.lucene.spell.LuceneSpellChecker$FiveSecondsRefreshInterval" />
+ </properties>
+ </query-handler>
+ </workspace>
+
+ <workspace name="ws2">
+ <container class="org.exoplatform.services.jcr.impl.storage.jdbc.JDBCWorkspaceDataContainer">
+ <properties>
+ <property name="source-name" value="jdbcjcr2" />
+ <property name="dialect" value="hsqldb" />
+ <property name="multi-db" value="true" />
+ <property name="update-storage" value="false" />
+ <property name="max-buffer-size" value="200k" />
+ <property name="swap-directory" value="target/temp/swap/ws2" />
+ </properties>
+ <value-storages>
+ <value-storage id="ws2" class="org.exoplatform.services.jcr.impl.storage.value.fs.TreeFileValueStorage">
+ <properties>
+ <property name="path" value="target/temp/values/ws2" />
+ </properties>
+ <filters>
+ <filter property-type="Binary" />
+ </filters>
+ </value-storage>
+ </value-storages>
+ </container>
+ <cache enabled="true" class="org.exoplatform.services.jcr.impl.dataflow.persistent.LinkedWorkspaceStorageCacheImpl">
+ <properties>
+ <property name="max-size" value="2k" />
+ <property name="live-time" value="20m" />
+ </properties>
+ </cache>
+ <query-handler class="org.exoplatform.services.jcr.impl.core.query.lucene.SearchIndex">
+ <properties>
+ <property name="index-dir" value="target/temp/index/db1/ws2" />
+ <property name="synonymprovider-class" value="org.exoplatform.services.jcr.impl.core.query.lucene.PropertiesSynonymProvider" />
+ <property name="synonymprovider-config-path" value="../../synonyms.properties" />
+ <property name="support-highlighting" value="true" />
+ <property name="indexing-configuration-path" value="../../indexing-configuration.xml" />
+ <property name="query-class" value="org.exoplatform.services.jcr.impl.core.query.QueryImpl" />
+ <property name="spellchecker-class" value="org.exoplatform.services.jcr.impl.core.query.lucene.spell.LuceneSpellChecker$FiveSecondsRefreshInterval" />
+ </properties>
+ </query-handler>
+ </workspace>
+
+ <workspace name="ws3">
+ <!-- for system storage -->
+ <container
+ class="org.exoplatform.services.jcr.impl.storage.jdbc.JDBCWorkspaceDataContainer">
+ <properties>
+ <property name="source-name" value="jdbcjcr3" />
+ <property name="dialect" value="hsqldb" />
+ <property name="multi-db" value="true" />
+ <property name="update-storage" value="false" />
+ <property name="max-buffer-size" value="200k" />
+ <property name="swap-directory" value="target/temp/swap/ws3" />
+ </properties>
+ <value-storages>
+ <!--
+ This storage is used to check whether properties are removed
+ correctly from each value-storage
+ (TestRemoveFromValueStorage.java)
+ -->
+ <value-storage id="ws3_big"
+ class="org.exoplatform.services.jcr.impl.storage.value.fs.TreeFileValueStorage">
+ <properties>
+ <property name="path" value="target/temp/values/ws3_big" />
+ </properties>
+ <filters>
+ <filter property-type="Binary" min-value-size="1024K" />
+ </filters>
+ </value-storage>
+ <value-storage id="ws3"
+ class="org.exoplatform.services.jcr.impl.storage.value.fs.CASableTreeFileValueStorage">
+ <properties>
+ <property name="path" value="target/temp/values/ws3" />
+ <property name="digest-algo" value="MD5" />
+ <property name="vcas-type"
+ value="org.exoplatform.services.jcr.impl.storage.value.cas.JDBCValueContentAddressStorageImpl" />
+ <property name="jdbc-source-name" value="jdbcjcr" />
+ <property name="jdbc-dialect" value="hsqldb" />
+ </properties>
+ <filters>
+ <filter property-type="Binary" />
+ </filters>
+ </value-storage>
+ </value-storages>
+ </container>
+ <initializer
+ class="org.exoplatform.services.jcr.impl.core.ScratchWorkspaceInitializer">
+ <properties>
+ <property name="root-nodetype" value="nt:unstructured" />
+ </properties>
+ </initializer>
+ <cache enabled="true"
+ class="org.exoplatform.services.jcr.impl.dataflow.persistent.LinkedWorkspaceStorageCacheImpl">
+ <properties>
+ <property name="max-size" value="2k" />
+ <property name="live-time" value="20m" />
+ </properties>
+ </cache>
+ <query-handler
+ class="org.exoplatform.services.jcr.impl.core.query.lucene.SearchIndex">
+ <properties>
+ <property name="index-dir" value="target/temp/index/db1/ws3" />
+ <property name="synonymprovider-class"
+ value="org.exoplatform.services.jcr.impl.core.query.lucene.PropertiesSynonymProvider" />
+ <property name="synonymprovider-config-path" value="../../synonyms.properties" />
+ <property name="support-highlighting" value="true" />
+ <property name="indexing-configuration-path" value="../../indexing-configuration.xml" />
+ <property name="query-class"
+ value="org.exoplatform.services.jcr.impl.core.query.QueryImpl" />
+ <property name="spellchecker-class"
+ value="org.exoplatform.services.jcr.impl.core.query.lucene.spell.LuceneSpellChecker$FiveSecondsRefreshInterval" />
+ </properties>
+ </query-handler>
+ </workspace>
+ </workspaces>
+ </repository>
+
+ <repository name="db1tck" system-workspace="ws" default-workspace="ws">
+ <security-domain>exo-domain</security-domain>
+ <!-- access-control>optional</access-control -->
+ <!-- access-control>disable</access-control -->
+ <session-max-age>1h</session-max-age>
+ <authentication-policy>org.exoplatform.services.jcr.impl.core.access.JAASAuthenticator</authentication-policy>
+ <workspaces>
+ <workspace name="ws">
+ <!-- for system storage -->
+ <container class="org.exoplatform.services.jcr.impl.storage.jdbc.JDBCWorkspaceDataContainer">
+ <properties>
+ <property name="source-name" value="jdbcjcrtck" />
+ <property name="dialect" value="hsqldb" />
+ <property name="multi-db" value="true" />
+ <property name="update-storage" value="false" />
+ <property name="max-buffer-size" value="200k" />
+ <property name="swap-directory" value="target/temp/swap/wstck" />
+ </properties>
+ <value-storages>
+ <value-storage id="ws" class="org.exoplatform.services.jcr.impl.storage.value.fs.TreeFileValueStorage">
+ <properties>
+ <property name="path" value="target/temp/values/wstck" />
+ </properties>
+ <filters>
+ <filter property-type="Binary" min-value-size="100K" />
+ </filters>
+ </value-storage>
+ </value-storages>
+ </container>
+ <initializer class="org.exoplatform.services.jcr.impl.core.ScratchWorkspaceInitializer">
+ <properties>
+ <property name="root-nodetype" value="nt:unstructured" />
+ <property name="root-permissions" value="any read;*:/platform/administrators read;*:/platform/administrators add_node;*:/platform/administrators set_property;*:/platform/administrators remove" />
+ </properties>
+ </initializer>
+ <cache enabled="true" class="org.exoplatform.services.jcr.impl.dataflow.persistent.LinkedWorkspaceStorageCacheImpl">
+ <properties>
+ <property name="max-size" value="2k" />
+ <property name="live-time" value="20m" />
+ </properties>
+ </cache>
+ <query-handler class="org.exoplatform.services.jcr.impl.core.query.lucene.SearchIndex">
+ <properties>
+ <property name="index-dir" value="target/temp/index/db1tck/ws" />
+ <property name="synonymprovider-class" value="org.exoplatform.services.jcr.impl.core.query.lucene.PropertiesSynonymProvider" />
+ <property name="synonymprovider-config-path" value="../../synonyms.properties" />
+ <property name="support-highlighting" value="true" />
+ <property name="indexing-configuration-path" value="../../indexing-configuration.xml" />
+ <property name="query-class" value="org.exoplatform.services.jcr.impl.core.query.QueryImpl" />
+ <property name="excerptprovider-class" value="org.exoplatform.services.jcr.impl.core.query.lucene.WeightedHTMLExcerpt" />
+ <property name="spellchecker-class" value="org.exoplatform.services.jcr.impl.core.query.lucene.spell.LuceneSpellChecker$FiveSecondsRefreshInterval" />
+ </properties>
+ </query-handler>
+ <lock-manager>
+ <time-out>15m</time-out>
+ <persister class="org.exoplatform.services.jcr.impl.core.lock.FileSystemLockPersister">
+ <properties>
+ <property name="path" value="target/temp/locktck" />
+ </properties>
+ </persister>
+ </lock-manager>
+ </workspace>
+
+ <workspace name="ws1">
+ <container class="org.exoplatform.services.jcr.impl.storage.jdbc.JDBCWorkspaceDataContainer">
+ <properties>
+ <property name="source-name" value="jdbcjcr1tck" />
+ <property name="dialect" value="hsqldb" />
+ <property name="multi-db" value="true" />
+ <property name="update-storage" value="false" />
+ <property name="max-buffer-size" value="200k" />
+ <property name="swap-directory" value="target/temp/swap/ws1tck" />
+ </properties>
+ <value-storages>
+ <value-storage id="ws1" class="org.exoplatform.services.jcr.impl.storage.value.fs.TreeFileValueStorage">
+ <properties>
+ <property name="path" value="target/temp/values/ws1tck" />
+ </properties>
+ <filters>
+ <filter property-type="Binary" min-value-size="100K" />
+ </filters>
+ </value-storage>
+ </value-storages>
+ </container>
+ <initializer class="org.exoplatform.services.jcr.impl.core.ScratchWorkspaceInitializer">
+ <properties>
+ <property name="root-nodetype" value="nt:unstructured" />
+ <property name="root-permissions" value="any read;*:/platform/administrators read;*:/platform/administrators add_node;*:/platform/administrators set_property;*:/platform/administrators remove" />
+ </properties>
+ </initializer>
+ <cache enabled="true" class="org.exoplatform.services.jcr.impl.dataflow.persistent.LinkedWorkspaceStorageCacheImpl">
+ <properties>
+ <property name="max-size" value="2k" />
+ <property name="live-time" value="20m" />
+ </properties>
+ </cache>
+ <query-handler class="org.exoplatform.services.jcr.impl.core.query.lucene.SearchIndex">
+ <properties>
+ <property name="index-dir" value="target/temp/index/db1tck/ws1" />
+ <property name="synonymprovider-class" value="org.exoplatform.services.jcr.impl.core.query.lucene.PropertiesSynonymProvider" />
+ <property name="synonymprovider-config-path" value="../../synonyms.properties" />
+ <property name="support-highlighting" value="true" />
+ <property name="indexing-configuration-path" value="../../indexing-configuration.xml" />
+ <property name="query-class" value="org.exoplatform.services.jcr.impl.core.query.QueryImpl" />
+ <property name="spellchecker-class" value="org.exoplatform.services.jcr.impl.core.query.lucene.spell.LuceneSpellChecker$FiveSecondsRefreshInterval" />
+ </properties>
+ </query-handler>
+ </workspace>
+
+ <workspace name="ws2">
+ <container class="org.exoplatform.services.jcr.impl.storage.jdbc.JDBCWorkspaceDataContainer">
+ <properties>
+ <property name="source-name" value="jdbcjcr2tck" />
+ <property name="dialect" value="hsqldb" />
+ <property name="multi-db" value="true" />
+ <property name="update-storage" value="false" />
+ <property name="max-buffer-size" value="200k" />
+ <property name="swap-directory" value="target/temp/swap/ws2tck" />
+ </properties>
+ <value-storages>
+ <value-storage id="ws2" class="org.exoplatform.services.jcr.impl.storage.value.fs.TreeFileValueStorage">
+ <properties>
+ <property name="path" value="target/temp/values/ws2tck" />
+ </properties>
+ <filters>
+ <filter property-type="Binary" min-value-size="100K" />
+ </filters>
+ </value-storage>
+ </value-storages>
+ </container>
+ <initializer class="org.exoplatform.services.jcr.impl.core.ScratchWorkspaceInitializer">
+ <properties>
+ <property name="root-nodetype" value="nt:unstructured" />
+ <property name="root-permissions" value="any read;*:/platform/administrators read;*:/platform/administrators add_node;*:/platform/administrators set_property;*:/platform/administrators remove" />
+ </properties>
+ </initializer>
+ <cache enabled="true" class="org.exoplatform.services.jcr.impl.dataflow.persistent.LinkedWorkspaceStorageCacheImpl">
+ <properties>
+ <property name="max-size" value="2k" />
+ <property name="live-time" value="20m" />
+ </properties>
+ </cache>
+ <query-handler class="org.exoplatform.services.jcr.impl.core.query.lucene.SearchIndex">
+ <properties>
+ <property name="index-dir" value="target/temp/index/db1tck/ws2" />
+ <property name="synonymprovider-class" value="org.exoplatform.services.jcr.impl.core.query.lucene.PropertiesSynonymProvider" />
+ <property name="synonymprovider-config-path" value="../../synonyms.properties" />
+ <property name="support-highlighting" value="true" />
+ <property name="indexing-configuration-path" value="../../indexing-configuration.xml" />
+ <property name="query-class" value="org.exoplatform.services.jcr.impl.core.query.QueryImpl" />
+ <property name="spellchecker-class" value="org.exoplatform.services.jcr.impl.core.query.lucene.spell.LuceneSpellChecker$FiveSecondsRefreshInterval" />
+ <property name="excerptprovider-class" value="org.exoplatform.services.jcr.impl.core.query.lucene.WeightedHTMLExcerpt"/>
+ <property name="extractorPoolSize" value="2"/>
+ <property name="extractorTimeout" value="10"/>
+ </properties>
+ </query-handler>
+ </workspace>
+ </workspaces>
+ </repository>
+ </repositories>
+</repository-service>
16 years, 4 months
exo-jcr SVN: r1196 - in jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc: optimisation and 1 other directories.
by do-not-reply@jboss.org
Author: sergiykarpenko
Date: 2009-12-25 12:05:38 -0500 (Fri, 25 Dec 2009)
New Revision: 1196
Removed:
jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/DBConstants.java
jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/SQLExceptionHandler.java
Modified:
jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/JDBCStorageConnection.java
jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/CQJDBCStorageConnection.java
jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/MultiDbJDBCConnection.java
Log:
EXOJCR-302: code clean up
Modified: jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/JDBCStorageConnection.java
===================================================================
--- jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/JDBCStorageConnection.java 2009-12-25 16:16:18 UTC (rev 1195)
+++ jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/JDBCStorageConnection.java 2009-12-25 17:05:38 UTC (rev 1196)
@@ -1220,7 +1220,7 @@
* Mixin types description (internal use).
*
*/
- class MixinInfo
+ public class MixinInfo
{
/**
@@ -1268,7 +1268,7 @@
* @param privilegeable
* exo:privilegeable flag
*/
- MixinInfo(List<InternalQName> mixinTypes, boolean owneable, boolean privilegeable)
+ public MixinInfo(List<InternalQName> mixinTypes, boolean owneable, boolean privilegeable)
{
this.mixinTypes = mixinTypes;
this.owneable = owneable;
@@ -1280,7 +1280,7 @@
*
* @return InternalQName[] Mixin names array
*/
- InternalQName[] mixinNames()
+ public InternalQName[] mixinNames()
{
if (mixinTypes != null)
{
@@ -1297,7 +1297,7 @@
*
* @return boolean
*/
- boolean hasPrivilegeable()
+ public boolean hasPrivilegeable()
{
return privilegeable;
}
@@ -1307,10 +1307,15 @@
*
* @return boolean
*/
- boolean hasOwneable()
+ public boolean hasOwneable()
{
return owneable;
}
+
+ public String getParentId()
+ {
+ return parentId;
+ }
}
/**
Modified: jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/CQJDBCStorageConnection.java
===================================================================
--- jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/CQJDBCStorageConnection.java 2009-12-25 16:16:18 UTC (rev 1195)
+++ jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/CQJDBCStorageConnection.java 2009-12-25 17:05:38 UTC (rev 1196)
@@ -20,7 +20,6 @@
import org.exoplatform.services.jcr.access.AccessControlEntry;
import org.exoplatform.services.jcr.access.AccessControlList;
-import org.exoplatform.services.jcr.dataflow.ItemState;
import org.exoplatform.services.jcr.dataflow.persistent.PersistedNodeData;
import org.exoplatform.services.jcr.dataflow.persistent.PersistedPropertyData;
import org.exoplatform.services.jcr.datamodel.IllegalACLException;
@@ -36,18 +35,13 @@
import org.exoplatform.services.jcr.impl.dataflow.persistent.ByteArrayPersistedValueData;
import org.exoplatform.services.jcr.impl.dataflow.persistent.CleanableFilePersistedValueData;
import org.exoplatform.services.jcr.impl.dataflow.persistent.StreamPersistedValueData;
-import org.exoplatform.services.jcr.impl.storage.JCRInvalidItemStateException;
import org.exoplatform.services.jcr.impl.storage.jdbc.JDBCStorageConnection;
-import org.exoplatform.services.jcr.impl.storage.jdbc.PrimaryTypeNotFoundException;
import org.exoplatform.services.jcr.impl.storage.value.ValueStorageNotFoundException;
import org.exoplatform.services.jcr.impl.storage.value.fs.operations.ValueFileIOHelper;
import org.exoplatform.services.jcr.impl.util.io.FileCleaner;
import org.exoplatform.services.jcr.impl.util.io.SwapFile;
-import org.exoplatform.services.jcr.storage.WorkspaceStorageConnection;
import org.exoplatform.services.jcr.storage.value.ValueIOChannel;
import org.exoplatform.services.jcr.storage.value.ValueStoragePluginProvider;
-import org.exoplatform.services.log.ExoLogger;
-import org.exoplatform.services.log.Log;
import java.io.ByteArrayInputStream;
import java.io.File;
@@ -56,7 +50,6 @@
import java.io.InputStream;
import java.io.OutputStream;
import java.sql.Connection;
-import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
@@ -67,7 +60,6 @@
import java.util.StringTokenizer;
import javax.jcr.InvalidItemStateException;
-import javax.jcr.PropertyType;
import javax.jcr.RepositoryException;
/**
@@ -76,45 +68,61 @@
* @author <a href="mailto:gennady.azarenkov@exoplatform.com">Gennady Azarenkov</a>
* @version $Id: JDBCStorageConnection.java 34801 2009-07-31 15:44:50Z dkatayev $
*/
-abstract public class CQJDBCStorageConnection extends DBConstants implements WorkspaceStorageConnection
+abstract public class CQJDBCStorageConnection extends JDBCStorageConnection
{
/**
- * Connection logger.
+ * FIND_ITEM_BY_NAME NEW.
*/
- protected static final Log LOG = ExoLogger.getLogger("jcr.JDBCStorageConnection");
+ protected String FIND_ITEM_BY_NAME_NEW;
/**
- * NODE type.
+ * FIND_NODE_BY_ID.
*/
- public static final int I_CLASS_NODE = 1;
+ protected String FIND_ITEM_BY_ID_NEW;
/**
- * PROPERTY type.
+ * FIND_NODES_BY_PARENTID NEW.
*/
- public static final int I_CLASS_PROPERTY = 2;
+ protected String FIND_NODES_BY_PARENTID_NEW;
- protected final ValueStoragePluginProvider valueStorageProvider;
+ protected String GET_PROPERTIES_BY_PARENTID;
- protected final int maxBufferSize;
+ protected String FIND_REFERENCE_PROPERTIES;
- protected final File swapDirectory;
+ /**
+ * Class needed to store node details (property also) since result set is not sorted in valid way.
+ *
+ */
+ private static class TempNodeData
+ {
+ String cid;
- protected final FileCleaner swapCleaner;
+ String cname;
- protected final Connection dbConnection;
+ int cversion;
- protected final String containerName;
+ String cpid;
- protected final SQLExceptionHandler exceptionHandler;
+ int cindex;
- protected final List<ValueIOChannel> valueChanges;
+ int cnordernumb;
- /**
- * Read-only flag, if true the connection is marked as READ-ONLY.
- */
- protected final boolean readOnly;
+ Map<String, List<byte[]>> properties = new HashMap<String, List<byte[]>>();
+ public TempNodeData(ResultSet item) throws SQLException
+ {
+ cid = item.getString(COLUMN_ID);
+ cname = item.getString(COLUMN_NAME);
+ cversion = item.getInt(COLUMN_VERSION);
+
+ cpid = item.getString(COLUMN_PARENTID);
+
+ cindex = item.getInt(COLUMN_INDEX);
+ cnordernumb = item.getInt(COLUMN_NORDERNUM);
+ }
+ }
+
/**
* JDBCStorageConnection constructor.
*
@@ -137,465 +145,17 @@
ValueStoragePluginProvider valueStorageProvider, int maxBufferSize, File swapDirectory, FileCleaner swapCleaner)
throws SQLException
{
-
- this.valueStorageProvider = valueStorageProvider;
-
- this.maxBufferSize = maxBufferSize;
- this.swapDirectory = swapDirectory;
- this.swapCleaner = swapCleaner;
- this.containerName = containerName;
-
- this.dbConnection = dbConnection;
- this.readOnly = readOnly;
-
- // Fix for Sybase jConnect JDBC driver bug.
- // Which throws SQLException(JZ016: The AutoCommit option is already set to
- // false)
- // if conn.setAutoCommit(false) called twise or more times with value
- // 'false'.
- if (dbConnection.getAutoCommit())
- {
- dbConnection.setAutoCommit(false);
- }
-
- prepareQueries();
- this.exceptionHandler = new SQLExceptionHandler(containerName, this);
-
- this.valueChanges = new ArrayList<ValueIOChannel>();
+ super(dbConnection, readOnly, containerName, valueStorageProvider, maxBufferSize, swapDirectory, swapCleaner);
}
/**
* {@inheritDoc}
*/
- @Override
- public boolean equals(Object obj)
- {
- if (obj == this)
- return true;
-
- if (obj instanceof JDBCStorageConnection)
- {
- JDBCStorageConnection another = (JDBCStorageConnection)obj;
- return getJdbcConnection() == another.getJdbcConnection();
- }
-
- return false;
- }
-
- /**
- * Return JDBC connection obtained from initialized data source. NOTE: Helper can obtain one new
- * connection per each call of the method or return one obtained once.
- */
- public Connection getJdbcConnection()
- {
- return dbConnection;
- }
-
- /**
- * Prepared queries at start time.
- *
- * @throws SQLException
- * database error
- */
- abstract protected void prepareQueries() throws SQLException;
-
- /**
- * Used in Single Db Connection classes for Identifier related queries.
- *
- * @param identifier
- * Item id
- * @return String with container internal id
- */
- protected abstract String getInternalId(String identifier);
-
- /**
- * Used in loadXYZRecord methods for extract real Identifier from container value.
- *
- * @param internalId
- * @return
- */
- protected abstract String getIdentifier(String internalId);
-
- // ---------------- WorkspaceStorageConnection -------------
-
- /**
- * @throws IllegalStateException
- * if connection is closed.
- */
- protected void checkIfOpened() throws IllegalStateException
- {
- if (!isOpened())
- throw new IllegalStateException("Connection is closed");
- }
-
- /**
- * {@inheritDoc}
- */
- public boolean isOpened()
- {
- try
- {
- return !dbConnection.isClosed();
- }
- catch (SQLException e)
- {
- LOG.error(e);
- return false;
- }
- }
-
- /**
- * {@inheritDoc}
- */
- public final void rollback() throws IllegalStateException, RepositoryException
- {
- checkIfOpened();
- try
- {
- dbConnection.rollback();
- dbConnection.close();
-
- // rollback from the end
- for (int p = valueChanges.size() - 1; p >= 0; p--)
- valueChanges.get(p).rollback();
- }
- catch (SQLException e)
- {
- throw new RepositoryException(e);
- }
- catch (IOException e)
- {
- throw new RepositoryException(e);
- }
- finally
- {
- valueChanges.clear();
- }
- }
-
- /**
- * {@inheritDoc}
- */
- public final void close() throws IllegalStateException, RepositoryException
- {
- checkIfOpened();
- try
- {
- // If READ-ONLY status back it to READ-WRITE (we assume it was original state)
- if (readOnly)
- dbConnection.setReadOnly(true);
-
- dbConnection.close();
- }
- catch (SQLException e)
- {
- throw new RepositoryException(e);
- }
- }
-
- /**
- * {@inheritDoc}
- */
- public final void commit() throws IllegalStateException, RepositoryException
- {
- checkIfOpened();
- try
- {
- dbConnection.commit();
- dbConnection.close();
-
- try
- {
- for (ValueIOChannel vo : valueChanges)
- vo.commit();
-
- }
- catch (IOException e)
- {
- throw new RepositoryException(e);
- }
- finally
- {
- valueChanges.clear();
- }
- }
- catch (SQLException e)
- {
- throw new RepositoryException(e);
- }
- }
-
- /**
- * {@inheritDoc}
- */
- public void add(NodeData data) throws RepositoryException, UnsupportedOperationException, InvalidItemStateException,
- IllegalStateException
- {
- checkIfOpened();
- try
- {
- addNodeRecord(data);
- if (LOG.isDebugEnabled())
- LOG.debug("Node added " + data.getQPath().getAsString() + ", " + data.getIdentifier() + ", "
- + data.getPrimaryTypeName().getAsString());
-
- }
- catch (SQLException e)
- {
- if (LOG.isDebugEnabled())
- LOG.error("Node add. Database error: " + e);
-
- exceptionHandler.handleAddException(e, data);
- }
- }
-
- /**
- * {@inheritDoc}
- */
- public void add(PropertyData data) throws RepositoryException, UnsupportedOperationException,
- InvalidItemStateException, IllegalStateException
- {
- checkIfOpened();
-
- try
- {
- addPropertyRecord(data);
-
- if (data.getType() == PropertyType.REFERENCE)
- {
- try
- {
- addReference(data);
- }
- catch (IOException e)
- {
- throw new RepositoryException("Can't read REFERENCE property (" + data.getQPath() + " "
- + data.getIdentifier() + ") value: " + e.getMessage(), e);
- }
- }
-
- addValues(getInternalId(data.getIdentifier()), data);
-
- if (LOG.isDebugEnabled())
- LOG.debug("Property added " + data.getQPath().getAsString() + ", " + data.getIdentifier()
- + (data.getValues() != null ? ", values count: " + data.getValues().size() : ", NULL data"));
-
- }
- catch (IOException e)
- {
- if (LOG.isDebugEnabled())
- LOG.error("Property add. IO error: " + e, e);
- throw new RepositoryException("Error of Property Value add " + e, e);
- }
- catch (SQLException e)
- {
- if (LOG.isDebugEnabled())
- LOG.error("Property add. Database error: " + e, e);
- exceptionHandler.handleAddException(e, data);
- }
- }
-
- /**
- * {@inheritDoc}
- */
- public void rename(NodeData data) throws RepositoryException, UnsupportedOperationException,
- InvalidItemStateException, IllegalStateException
- {
-
- checkIfOpened();
- try
- {
- if (renameNode(data) <= 0)
- throw new JCRInvalidItemStateException("(rename) Node not found " + data.getQPath().getAsString() + " "
- + data.getIdentifier() + ". Probably was deleted by another session ", data.getIdentifier(),
- ItemState.RENAMED);
- }
- catch (SQLException e)
- {
- if (LOG.isDebugEnabled())
- LOG.error("Property add. Database error: " + e, e);
- exceptionHandler.handleAddException(e, data);
- }
- }
-
- /**
- * {@inheritDoc}
- */
- public void delete(NodeData data) throws RepositoryException, UnsupportedOperationException,
- InvalidItemStateException, IllegalStateException
- {
- checkIfOpened();
-
- final String cid = getInternalId(data.getIdentifier());
-
- try
- {
- int nc = deleteItemByIdentifier(cid);
- if (nc <= 0)
- throw new JCRInvalidItemStateException("(delete) Node not found " + data.getQPath().getAsString() + " "
- + data.getIdentifier() + ". Probably was deleted by another session ", data.getIdentifier(),
- ItemState.DELETED);
-
- if (LOG.isDebugEnabled())
- LOG.debug("Node deleted " + data.getQPath().getAsString() + ", " + data.getIdentifier() + ", "
- + ((NodeData)data).getPrimaryTypeName().getAsString());
-
- }
- catch (SQLException e)
- {
- if (LOG.isDebugEnabled())
- LOG.error("Node remove. Database error: " + e, e);
- exceptionHandler.handleDeleteException(e, data);
- }
- }
-
- /**
- * {@inheritDoc}
- */
- public void delete(PropertyData data) throws RepositoryException, UnsupportedOperationException,
- InvalidItemStateException, IllegalStateException
- {
- checkIfOpened();
-
- final String cid = getInternalId(data.getIdentifier());
-
- try
- {
- deleteValues(cid, data, false);
-
- // delete references
- deleteReference(cid);
-
- // delete item
- int nc = deleteItemByIdentifier(cid);
- if (nc <= 0)
- throw new JCRInvalidItemStateException("(delete) Property not found " + data.getQPath().getAsString() + " "
- + data.getIdentifier() + ". Probably was deleted by another session ", data.getIdentifier(),
- ItemState.DELETED);
-
- if (LOG.isDebugEnabled())
- LOG.debug("Property deleted "
- + data.getQPath().getAsString()
- + ", "
- + data.getIdentifier()
- + (((PropertyData)data).getValues() != null ? ", values count: "
- + ((PropertyData)data).getValues().size() : ", NULL data"));
-
- }
- catch (IOException e)
- {
- if (LOG.isDebugEnabled())
- LOG.error("Property remove. IO error: " + e, e);
- throw new RepositoryException("Error of Property Value delete " + e, e);
- }
- catch (SQLException e)
- {
- if (LOG.isDebugEnabled())
- LOG.error("Property remove. Database error: " + e, e);
- exceptionHandler.handleDeleteException(e, data);
- }
- }
-
- /**
- * {@inheritDoc}
- */
- public void update(NodeData data) throws RepositoryException, UnsupportedOperationException,
- InvalidItemStateException, IllegalStateException
- {
- checkIfOpened();
- try
- {
- String cid = getInternalId(data.getIdentifier());
- // order numb update
- if (updateNodeByIdentifier(data.getPersistedVersion(), data.getQPath().getIndex(), data.getOrderNumber(), cid) <= 0)
- throw new JCRInvalidItemStateException("(update) Node not found " + data.getQPath().getAsString() + " "
- + data.getIdentifier() + ". Probably was deleted by another session ", data.getIdentifier(),
- ItemState.UPDATED);
-
- if (LOG.isDebugEnabled())
- LOG.debug("Node updated " + data.getQPath().getAsString() + ", " + data.getIdentifier() + ", "
- + data.getPrimaryTypeName().getAsString());
-
- }
- catch (SQLException e)
- {
- if (LOG.isDebugEnabled())
- LOG.error("Node update. Database error: " + e, e);
- exceptionHandler.handleUpdateException(e, data);
- }
- }
-
- /**
- * {@inheritDoc}
- */
- public void update(PropertyData data) throws RepositoryException, UnsupportedOperationException,
- InvalidItemStateException, IllegalStateException
- {
- checkIfOpened();
-
- try
- {
- String cid = getInternalId(data.getIdentifier());
-
- // update type
- if (updatePropertyByIdentifier(data.getPersistedVersion(), data.getType(), cid) <= 0)
- throw new JCRInvalidItemStateException("(update) Property not found " + data.getQPath().getAsString() + " "
- + data.getIdentifier() + ". Probably was deleted by another session ", data.getIdentifier(),
- ItemState.UPDATED);
-
- // update reference
- try
- {
- deleteReference(cid);
-
- if (data.getType() == PropertyType.REFERENCE)
- {
- addReference(data);
- }
- }
- catch (IOException e)
- {
- throw new RepositoryException("Can't update REFERENCE property (" + data.getQPath() + " "
- + data.getIdentifier() + ") value: " + e.getMessage(), e);
- }
-
- // do Values update: delete all and add all
- deleteValues(cid, data, true);
- addValues(cid, data);
-
- if (LOG.isDebugEnabled())
- LOG.debug("Property updated " + data.getQPath().getAsString() + ", " + data.getIdentifier()
- + (data.getValues() != null ? ", values count: " + data.getValues().size() : ", NULL data"));
-
- }
- catch (IOException e)
- {
- if (LOG.isDebugEnabled())
- LOG.error("Property update. IO error: " + e, e);
- throw new RepositoryException("Error of Property Value update " + e, e);
- }
- catch (SQLException e)
- {
- if (LOG.isDebugEnabled())
- LOG.error("Property update. Database error: " + e, e);
- exceptionHandler.handleUpdateException(e, data);
- }
- }
-
- /**
- * {@inheritDoc}
- */
public List<NodeData> getChildNodesData(NodeData parent) throws RepositoryException, IllegalStateException
{
checkIfOpened();
try
{
- // ResultSet node = findChildNodesByParentIdentifier(getInternalId(parent.getIdentifier()));
- // List<NodeData> childrens = new ArrayList<NodeData>();
- // while (node.next())
- // childrens.add((NodeData)itemData(parent.getQPath(), node, I_CLASS_NODE, parent.getACL()));
- //
- // return childrens;
ResultSet resultSet = findChildNodesByParentIdentifierNew(getInternalId(parent.getIdentifier()));
if (resultSet.next())
{
@@ -665,35 +225,6 @@
}
- private static class TempNodeData
- {
- String cid;
-
- String cname;
-
- int cversion;
-
- String cpid;
-
- int cindex;
-
- int cnordernumb;
-
- Map<String, List<byte[]>> properties = new HashMap<String, List<byte[]>>();
-
- public TempNodeData(ResultSet item) throws SQLException
- {
- cid = item.getString(COLUMN_ID);
- cname = item.getString(COLUMN_NAME);
- cversion = item.getInt(COLUMN_VERSION);
-
- cpid = item.getString(COLUMN_PARENTID);
-
- cindex = item.getInt(COLUMN_INDEX);
- cnordernumb = item.getInt(COLUMN_NORDERNUM);
- }
- }
-
/**
* {@inheritDoc}
*/
@@ -1051,40 +582,6 @@
}
}
- /**
- * Find ancestor permissions by cpid. Will search till find the permissions or meet a root node.
- *
- * @param cpid
- * - initial parent node id
- * @return Collection<String>
- * @throws SQLException
- * if database error
- * @throws IllegalACLException
- * if wrong ACL
- * @throws IllegalNameException
- * if wrong QName
- * @throws RepositoryException
- * if Repository error
- */
- private List<AccessControlEntry> traverseACLPermissions(String cpid) throws SQLException, IllegalACLException,
- IllegalNameException, RepositoryException
- {
- String caid = cpid;
- while (!caid.equals(Constants.ROOT_PARENT_UUID))
- {
- MixinInfo naMixins = readMixins(caid);
- if (naMixins.hasPrivilegeable())
- return readACLPermisions(caid);
-
- if (naMixins.parentId == null)
- caid = findParentId(caid);
- else
- caid = naMixins.parentId;
- }
-
- throw new IllegalACLException("Can not find permissions for a node with id " + getIdentifier(cpid));
- }
-
protected String findParentId(String cid) throws SQLException, RepositoryException
{
ResultSet pidrs = findItemByIdentifier(cid);
@@ -1102,168 +599,6 @@
}
/**
- * Find ancestor owner by cpid. Will search till find the owner or meet a root node.
- *
- * @param cpid
- * - initial parent node id
- * @return owner name
- * @throws SQLException
- * if database error
- * @throws IllegalACLException
- * if wrong ACL
- * @throws IllegalNameException
- * if wrong QName
- * @throws RepositoryException
- * if Repository error
- */
- private String traverseACLOwner(String cpid) throws SQLException, IllegalACLException, IllegalNameException,
- RepositoryException
- {
- String caid = cpid;
-
- while (!caid.equals(Constants.ROOT_PARENT_UUID))
- {
- MixinInfo naMixins = readMixins(caid);
- if (naMixins.hasOwneable())
- return readACLOwner(caid);
-
- if (naMixins.parentId == null)
- caid = findParentId(caid);
- else
- caid = naMixins.parentId;
- }
-
- throw new IllegalACLException("Can not find owner for a node with id " + getIdentifier(cpid));
- }
-
- /**
- * Find ancestor ACL by cpid. Will search till find the ACL or meet a root node.
- *
- * @param cpid
- * - initial parent node id
- * @return owner name
- * @throws SQLException
- * if database error
- * @throws IllegalACLException
- * if wrong ACL
- * @throws IllegalNameException
- * if wrong QName
- * @throws RepositoryException
- * if Repository error
- */
- private AccessControlList traverseACL(String cpid) throws SQLException, IllegalACLException, IllegalNameException,
- RepositoryException
- {
- String naOwner = null;
- List<AccessControlEntry> naPermissions = null;
-
- String caid = cpid;
-
- while (!caid.equals(Constants.ROOT_PARENT_UUID))
- {
- MixinInfo naMixins = readMixins(caid);
- if (naOwner == null && naMixins.hasOwneable())
- {
- naOwner = readACLOwner(caid);
- if (naPermissions != null)
- break;
- }
- if (naPermissions == null && naMixins.hasPrivilegeable())
- {
- naPermissions = readACLPermisions(caid);
- if (naOwner != null)
- break;
- }
-
- if (naMixins.parentId == null)
- caid = findParentId(caid);
- else
- caid = naMixins.parentId;
- }
-
- if (naOwner != null && naPermissions != null)
- {
- // got all
- return new AccessControlList(naOwner, naPermissions);
- }
- else if (naOwner == null && naPermissions == null)
- {
- // Default values (i.e. ACL is disabled in repository)
- return new AccessControlList();
- }
- else
- throw new IllegalACLException("ACL is not found for node with id " + getIdentifier(cpid)
- + " or for its ancestors. But repository is ACL enabled.");
- }
-
- /**
- * [PN] Experimental. Use SP for traversing Qpath on the database server side. Hm, I haven't a
- * good result for that yet. Few seconds only for TCK execution. PGSQL SP: CREATE OR REPLACE
- * FUNCTION get_qpath(parentId VARCHAR) RETURNS SETOF record AS $$ DECLARE cur_item RECORD; cur_id
- * varchar; BEGIN cur_id := parentId; WHILE NOT cur_id = ' ' LOOP SELECT id, name, parent_id,
- * i_index INTO cur_item FROM JCR_SITEM WHERE ID=cur_id; IF NOT found THEN RETURN; END IF; RETURN
- * NEXT cur_item; cur_id := cur_item.parent_id; END LOOP; RETURN; END; $$ LANGUAGE plpgsql;
- *
- * @param cpid
- * @return
- * @throws SQLException
- * if database error
- * @throws InvalidItemStateException
- * if Item state is obsolete
- * @throws IllegalNameException
- * if invalid QName
- */
- private QPath traverseQPath_SP_PGSQL(String cpid) throws SQLException, InvalidItemStateException,
- IllegalNameException
- {
- // get item by Identifier usecase:
- // find parent path in db by cpid
- if (cpid == null)
- {
- // root node
- return null; // Constants.ROOT_PATH
- }
- else
- {
- List<QPathEntry> qrpath = new ArrayList<QPathEntry>(); // reverted path
- PreparedStatement cstmt = null;
- try
- {
- cstmt =
- dbConnection
- .prepareStatement("select * from get_qpath(?) AS (id varchar, name varchar, parent_id varchar, i_index int)");
- cstmt.setString(1, cpid);
- // cstmt.setString(2, caid);
- ResultSet parent = cstmt.executeQuery();
-
- while (parent.next())
- {
- QPathEntry qpe =
- new QPathEntry(InternalQName.parse(parent.getString(COLUMN_NAME)), parent.getInt(COLUMN_INDEX));
- qrpath.add(qpe);
- }
-
- // parent = findItemByIdentifier(caid);
- if (qrpath.size() <= 0)
- throw new InvalidItemStateException("Parent not found, uuid: " + getIdentifier(cpid));
- }
- finally
- {
- if (cstmt != null)
- cstmt.close();
- }
-
- QPathEntry[] qentries = new QPathEntry[qrpath.size()];
- int qi = 0;
- for (int i = qrpath.size() - 1; i >= 0; i--)
- {
- qentries[qi++] = qrpath.get(i);
- }
- return new QPath(qentries);
- }
- }
-
- /**
* Build ItemData.
*
* @param parentPath
@@ -1362,151 +697,6 @@
}
/**
- * Mixin types description (internal use).
- *
- */
- class MixinInfo
- {
-
- /**
- * OWNEABLE constant.
- */
- static final int OWNEABLE = 0x0001; // bits 0001
-
- /**
- * PRIVILEGEABLE constant.
- */
- static final int PRIVILEGEABLE = 0x0002; // bits 0010
-
- /**
- * OWNEABLE_PRIVILEGEABLE constant.
- */
- static final int OWNEABLE_PRIVILEGEABLE = OWNEABLE | PRIVILEGEABLE; // bits 0011
-
- /**
- * Mixin types.
- */
- final List<InternalQName> mixinTypes;
-
- /**
- * oexo:owneable flag.
- */
- final boolean owneable;
-
- /**
- * exo:privilegeable flag.
- */
- final boolean privilegeable;
-
- /**
- * Parent Id.
- */
- final String parentId = null;
-
- /**
- * MixinInfo constructor.
- *
- * @param mixinTypes
- * mixin types
- * @param owneable
- * exo:owneable flag
- * @param privilegeable
- * exo:privilegeable flag
- */
- MixinInfo(List<InternalQName> mixinTypes, boolean owneable, boolean privilegeable)
- {
- this.mixinTypes = mixinTypes;
- this.owneable = owneable;
- this.privilegeable = privilegeable;
- }
-
- /**
- * Return Mixin names array.
- *
- * @return InternalQName[] Mixin names array
- */
- InternalQName[] mixinNames()
- {
- if (mixinTypes != null)
- {
- InternalQName[] mns = new InternalQName[mixinTypes.size()];
- mixinTypes.toArray(mns);
- return mns;
- }
- else
- return new InternalQName[0];
- }
-
- /**
- * Tell is exo:privilegeable.
- *
- * @return boolean
- */
- boolean hasPrivilegeable()
- {
- return privilegeable;
- }
-
- /**
- * Tell is exo:owneable.
- *
- * @return boolean
- */
- boolean hasOwneable()
- {
- return owneable;
- }
- }
-
- /**
- * Read mixins from database.
- *
- * @param cid
- * - Item id (internal)
- * @return MixinInfo
- * @throws SQLException
- * database error
- * @throws IllegalNameException
- * if nodetype name in mixin record is wrong
- */
- protected MixinInfo readMixins(String cid) throws SQLException, IllegalNameException
- {
- ResultSet mtrs = findPropertyByName(cid, Constants.JCR_MIXINTYPES.getAsString());
-
- try
- {
- List<InternalQName> mts = null;
- boolean owneable = false;
- boolean privilegeable = false;
- if (mtrs.next())
- {
- mts = new ArrayList<InternalQName>();
- do
- {
- byte[] mxnb = mtrs.getBytes(COLUMN_VDATA);
- if (mxnb != null)
- {
- InternalQName mxn = InternalQName.parse(new String(mxnb));
- mts.add(mxn);
-
- if (!privilegeable && Constants.EXO_PRIVILEGEABLE.equals(mxn))
- privilegeable = true;
- else if (!owneable && Constants.EXO_OWNEABLE.equals(mxn))
- owneable = true;
- } // else, if SQL NULL - skip it
- }
- while (mtrs.next());
- }
-
- return new MixinInfo(mts, owneable, privilegeable);
- }
- finally
- {
- mtrs.close();
- }
- }
-
- /**
* Return permission values or throw an exception. We assume the node is mix:privilegeable.
*
* @param cid
@@ -1573,151 +763,6 @@
}
/**
- * Load NodeData record.
- *
- * @param parentPath
- * parent path
- * @param cname
- * Node name
- * @param cid
- * Node id
- * @param cpid
- * Node parent id
- * @param cindex
- * Node index
- * @param cversion
- * Node persistent version
- * @param cnordernumb
- * Node order number
- * @param parentACL
- * Node parent ACL
- * @return PersistedNodeData
- * @throws RepositoryException
- * Repository error
- * @throws SQLException
- * database error
- */
- protected PersistedNodeData loadNodeRecord(QPath parentPath, String cname, String cid, String cpid, int cindex,
- int cversion, int cnordernumb, AccessControlList parentACL) throws RepositoryException, SQLException
- {
-
- try
- {
- InternalQName qname = InternalQName.parse(cname);
-
- QPath qpath;
- String parentCid;
- if (parentPath != null)
- {
- // get by parent and name
- qpath = QPath.makeChildPath(parentPath, qname, cindex);
- parentCid = cpid;
- }
- else
- {
- // get by id
- if (cpid.equals(Constants.ROOT_PARENT_UUID))
- {
- // root node
- qpath = Constants.ROOT_PATH;
- parentCid = null;
- }
- else
- {
- qpath = QPath.makeChildPath(traverseQPath(cpid), qname, cindex);
- parentCid = cpid;
- }
- }
-
- try
- {
- // PRIMARY
- ResultSet ptProp = findPropertyByName(cid, Constants.JCR_PRIMARYTYPE.getAsString());
-
- if (!ptProp.next())
- throw new PrimaryTypeNotFoundException("FATAL ERROR primary type record not found. Node "
- + qpath.getAsString() + ", id " + cid + ", container " + this.containerName, null);
-
- byte[] data = ptProp.getBytes(COLUMN_VDATA);
- InternalQName ptName = InternalQName.parse(new String((data != null ? data : new byte[]{})));
-
- // MIXIN
- MixinInfo mixins = readMixins(cid);
-
- // ACL
- AccessControlList acl; // NO DEFAULT values!
-
- if (mixins.hasOwneable())
- {
- // has own owner
- if (mixins.hasPrivilegeable())
- {
- // and permissions
- acl = new AccessControlList(readACLOwner(cid), readACLPermisions(cid));
- }
- else if (parentACL != null)
- {
- // use permissions from existed parent
- acl =
- new AccessControlList(readACLOwner(cid), parentACL.hasPermissions() ? parentACL
- .getPermissionEntries() : null);
- }
- else
- {
- // have to search nearest ancestor permissions in ACL manager
- // acl = new AccessControlList(readACLOwner(cid), traverseACLPermissions(cpid));
- acl = new AccessControlList(readACLOwner(cid), null);
- }
- }
- else if (mixins.hasPrivilegeable())
- {
- // has own permissions
- if (mixins.hasOwneable())
- {
- // and owner
- acl = new AccessControlList(readACLOwner(cid), readACLPermisions(cid));
- }
- else if (parentACL != null)
- {
- // use owner from existed parent
- acl = new AccessControlList(parentACL.getOwner(), readACLPermisions(cid));
- }
- else
- {
- // have to search nearest ancestor owner in ACL manager
- // acl = new AccessControlList(traverseACLOwner(cpid), readACLPermisions(cid));
- acl = new AccessControlList(null, readACLPermisions(cid));
- }
- }
- else
- {
- if (parentACL != null)
- // construct ACL from existed parent ACL
- acl =
- new AccessControlList(parentACL.getOwner(), parentACL.hasPermissions() ? parentACL
- .getPermissionEntries() : null);
- else
- // have to search nearest ancestor owner and permissions in ACL manager
- // acl = traverseACL(cpid);
- acl = null;
- }
-
- return new PersistedNodeData(getIdentifier(cid), qpath, getIdentifier(parentCid), cversion, cnordernumb,
- ptName, mixins.mixinNames(), acl);
- }
- catch (IllegalACLException e)
- {
- throw new RepositoryException("FATAL ERROR Node " + getIdentifier(cid) + " " + qpath.getAsString()
- + " has wrong formed ACL. ", e);
- }
- }
- catch (IllegalNameException e)
- {
- throw new RepositoryException(e);
- }
- }
-
- /**
* Load PropertyData record.
*
* @param parentPath
@@ -2134,60 +1179,6 @@
}
/**
- * Delete Property Values.
- *
- * @param cid
- * Property id
- * @param pdata
- * PropertyData
- * @param update
- * boolean true if it's delete-add sequence (update operation)
- * @throws IOException
- * i/O error
- * @throws SQLException
- * if database error occurs
- * @throws ValueStorageNotFoundException
- * if no such storage found with Value storageId
- */
- private void deleteValues(String cid, PropertyData pdata, boolean update) throws IOException, SQLException,
- ValueStorageNotFoundException
- {
-
- final ResultSet valueRecords = findValuesStorageDescriptorsByPropertyId(cid);
- try
- {
- if (valueRecords.next())
- {
- // delete all Values in database
- deleteValueData(cid);
-
- do
- {
- final String storageId = valueRecords.getString(COLUMN_VSTORAGE_DESC);
- if (!valueRecords.wasNull())
- {
- final ValueIOChannel channel = valueStorageProvider.getChannel(storageId);
- try
- {
- channel.delete(pdata.getIdentifier());
- valueChanges.add(channel);
- }
- finally
- {
- channel.close();
- }
- }
- }
- while (valueRecords.next());
- }
- }
- finally
- {
- valueRecords.close();
- }
- }
-
- /**
* Read Property Values.
*
* @param identifier
@@ -2476,50 +1467,6 @@
}
}
- protected abstract int addNodeRecord(NodeData data) throws SQLException;
-
- protected abstract int addPropertyRecord(PropertyData prop) throws SQLException;
-
- protected abstract ResultSet findItemByIdentifier(String identifier) throws SQLException;
-
- protected abstract ResultSet findPropertyByName(String parentId, String name) throws SQLException;
-
- protected abstract ResultSet findItemByName(String parentId, String name, int index) throws SQLException;
-
- protected abstract ResultSet findChildNodesByParentIdentifier(String parentIdentifier) throws SQLException;
-
- protected abstract ResultSet findChildNodesCountByParentIdentifier(String parentIdentifier) throws SQLException;
-
- protected abstract ResultSet findChildPropertiesByParentIdentifier(String parentIdentifier) throws SQLException;
-
- protected abstract int addReference(PropertyData data) throws SQLException, IOException;
-
- protected abstract int renameNode(NodeData data) throws SQLException;
-
- protected abstract int deleteReference(String propertyIdentifier) throws SQLException;
-
- protected abstract ResultSet findReferences(String nodeIdentifier) throws SQLException;
-
- protected abstract int deleteItemByIdentifier(String identifier) throws SQLException;
-
- protected abstract int updateNodeByIdentifier(int version, int index, int orderNumb, String identifier)
- throws SQLException;
-
- protected abstract int updatePropertyByIdentifier(int version, int type, String identifier) throws SQLException;
-
- // -------- values processing ------------
- protected abstract int addValueData(String cid, int orderNumber, InputStream stream, int streamLength,
- String storageId) throws SQLException;
-
- protected abstract int deleteValueData(String cid) throws SQLException;
-
- protected abstract ResultSet findValuesByPropertyId(String cid) throws SQLException;
-
- protected abstract ResultSet findValuesStorageDescriptorsByPropertyId(String cid) throws SQLException;
-
- @Deprecated
- protected abstract ResultSet findValueByPropertyIdOrderNumber(String cid, int orderNumb) throws SQLException;
-
protected abstract ResultSet findItemByIdentifierNew(String identifier) throws SQLException;
protected abstract ResultSet findItemByNameNew(String parentId, String name, int index) throws SQLException;
Deleted: jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/DBConstants.java
===================================================================
--- jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/DBConstants.java 2009-12-25 16:16:18 UTC (rev 1195)
+++ jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/DBConstants.java 2009-12-25 17:05:38 UTC (rev 1196)
@@ -1,348 +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;
-
-/**
- * Created by The eXo Platform SAS.
- *
- * @author Gennady Azarenkov
- * @version $Id: DBConstants.java 34801 2009-07-31 15:44:50Z dkatayev $
- */
-
-public class DBConstants
-{
- // ======================== Error constants ========================
- /**
- * JCR_PK_ITEM.
- */
- protected String JCR_PK_ITEM;
-
- /**
- * JCR_FK_ITEM_PARENT.
- */
- protected String JCR_FK_ITEM_PARENT;
-
- /**
- * JCR_IDX_ITEM_PARENT.
- */
- protected String JCR_IDX_ITEM_PARENT;
-
- /**
- * JCR_IDX_ITEM_PARENT_NAME.
- */
- protected String JCR_IDX_ITEM_PARENT_NAME;
-
- /**
- * JCR_IDX_ITEM_PARENT_ID.
- */
- protected String JCR_IDX_ITEM_PARENT_ID;
-
- /**
- * JCR_PK_VALUE.
- */
- protected String JCR_PK_VALUE;
-
- /**
- * JCR_FK_VALUE_PROPERTY.
- */
- protected String JCR_FK_VALUE_PROPERTY;
-
- /**
- * JCR_IDX_VALUE_PROPERTY.
- */
- protected String JCR_IDX_VALUE_PROPERTY;
-
- /**
- * JCR_PK_REF.
- */
- protected String JCR_PK_REF;
-
- /**
- * JCR_IDX_REF_PROPERTY.
- */
- protected String JCR_IDX_REF_PROPERTY;
-
- // ======================== SQL scripts ========================
- /**
- * FIND_ITEM_BY_ID.
- */
- protected String FIND_ITEM_BY_ID;
-
- /**
- * FIND_ITEM_BY_PATH.
- */
- protected String FIND_ITEM_BY_PATH;
-
- /**
- * FIND_ITEM_BY_NAME.
- */
- protected String FIND_ITEM_BY_NAME;
-
- /**
- * FIND_ITEM_BY_NAME NEW.
- */
- protected String FIND_ITEM_BY_NAME_NEW;
-
- /**
- * FIND_NODE_BY_ID.
- */
- protected String FIND_ITEM_BY_ID_NEW;
-
- /**
- * FIND_CHILD_PROPERTY_BY_PATH.
- */
- protected String FIND_CHILD_PROPERTY_BY_PATH;
-
- /**
- * FIND_PROPERTY_BY_NAME.
- */
- protected String FIND_PROPERTY_BY_NAME;
-
- /**
- * FIND_REFERENCES.
- */
- protected String FIND_REFERENCES;
-
- protected String FIND_REFERENCE_PROPERTIES;
-
- /**
- * FIND_VALUES_BY_PROPERTYID.
- */
- protected String FIND_VALUES_BY_PROPERTYID;
-
- /**
- * FIND_VALUE_BY_PROPERTYID_OREDERNUMB.
- */
- protected String FIND_VALUES_VSTORAGE_DESC_BY_PROPERTYID;
-
- @Deprecated
- protected String FIND_VALUE_BY_PROPERTYID_OREDERNUMB;
-
- /**
- * FIND_NODES_BY_PARENTID.
- */
- protected String FIND_NODES_BY_PARENTID;
-
- /**
- * FIND_NODES_BY_PARENTID NEW.
- */
- protected String FIND_NODES_BY_PARENTID_NEW;
-
- /**
- * FIND_NODES_COUNT_BY_PARENTID.
- */
- protected String FIND_NODES_COUNT_BY_PARENTID;
-
- /**
- * FIND_PROPERTIES_BY_PARENTID.
- */
- protected String FIND_PROPERTIES_BY_PARENTID;
-
- /**
- * FIND_PROPERTIES_BY_PARENTID_NEW.
- */
- protected String GET_PROPERTIES_BY_PARENTID;
-
- /**
- * INSERT_NODE.
- */
- protected String INSERT_NODE;
-
- /**
- * INSERT_PROPERTY.
- */
- protected String INSERT_PROPERTY;
-
- /**
- * INSERT_VALUE.
- */
- protected String INSERT_VALUE;
-
- /**
- * INSERT_REF.
- */
- protected String INSERT_REF;
-
- /**
- * RENAME_NODE.
- */
- protected String RENAME_NODE;
-
- /**
- * UPDATE_NODE.
- */
- protected String UPDATE_NODE;
-
- /**
- * UPDATE_PROPERTY.
- */
- protected String UPDATE_PROPERTY;
-
- /**
- * DELETE_ITEM.
- */
- protected String DELETE_ITEM;
-
- /**
- * DELETE_VALUE.
- */
- protected String DELETE_VALUE;
-
- /**
- * DELETE_REF.
- */
- protected String DELETE_REF;
-
- // ======================== ITEMS table ========================
- /**
- * COLUMN_ID.
- */
- protected static final String COLUMN_ID = "ID";
-
- /**
- * COLUMN_PARENTID.
- */
- protected static final String COLUMN_PARENTID = "PARENT_ID";
-
- /**
- * COLUMN_NAME.
- */
- protected static final String COLUMN_NAME = "NAME";
-
- /**
- * COLUMN_VERSION.
- */
- protected static final String COLUMN_VERSION = "VERSION";
-
- /**
- * COLUMN_CLASS.
- */
- protected static final String COLUMN_CLASS = "I_CLASS";
-
- /**
- * COLUMN_INDEX.
- */
- protected static final String COLUMN_INDEX = "I_INDEX";
-
- /**
- * COLUMN_NORDERNUM.
- */
- protected static final String COLUMN_NORDERNUM = "N_ORDER_NUM";
-
- /**
- * COLUMN_PTYPE.
- */
- protected static final String COLUMN_PTYPE = "P_TYPE";
-
- /**
- * COLUMN_PMULTIVALUED.
- */
- protected static final String COLUMN_PMULTIVALUED = "P_MULTIVALUED";
-
- // VALUE table
- /**
- * COLUMN_VDATA.
- */
- protected static final String COLUMN_VDATA = "DATA";
-
- /**
- * COLUMN_VORDERNUM.
- */
- protected static final String COLUMN_VORDERNUM = "ORDER_NUM";
-
- /**
- * COLUMN_VSTORAGE_DESC.
- */
- protected static final String COLUMN_VSTORAGE_DESC = "STORAGE_DESC";
-
- // Dialects
- /**
- * DB_DIALECT_GENERIC.
- */
- public final static String DB_DIALECT_GENERIC = "Generic".intern();
-
- /**
- * DB_DIALECT_ORACLE.
- */
- public final static String DB_DIALECT_ORACLE = "Oracle".intern();
-
- /**
- * DB_DIALECT_ORACLEOCI.
- */
- public final static String DB_DIALECT_ORACLEOCI = "Oracle-OCI".intern();
-
- /**
- * DB_DIALECT_PGSQL.
- */
- public final static String DB_DIALECT_PGSQL = "PgSQL".intern();
-
- /**
- * DB_DIALECT_MYSQL.
- */
- public final static String DB_DIALECT_MYSQL = "MySQL".intern();
-
- /**
- * DB_DIALECT_MYSQL_UTF8.
- */
- public final static String DB_DIALECT_MYSQL_UTF8 = "MySQL-UTF8".intern();
-
- /**
- * DB_DIALECT_HSQLDB.
- */
- public final static String DB_DIALECT_HSQLDB = "HSQLDB".intern();
-
- /**
- * DB_DIALECT_DB2.
- */
- public final static String DB_DIALECT_DB2 = "DB2".intern();
-
- /**
- * DB_DIALECT_DB2V8.
- */
- public final static String DB_DIALECT_DB2V8 = "DB2V8".intern();
-
- /**
- * DB_DIALECT_MSSQL.
- */
- public final static String DB_DIALECT_MSSQL = "MSSQL".intern();
-
- /**
- * DB_DIALECT_SYBASE.
- */
- public final static String DB_DIALECT_SYBASE = "Sybase".intern();
-
- /**
- * DB_DIALECT_DERBY.
- */
- public final static String DB_DIALECT_DERBY = "Derby".intern();
-
- /**
- * DB_DIALECT_INGRES.
- */
- public final static String DB_DIALECT_INGRES = "Ingres".intern();
-
- /**
- * DB_DIALECTS.
- */
- public final static String[] DB_DIALECTS =
- {DB_DIALECT_GENERIC, DB_DIALECT_ORACLE, DB_DIALECT_ORACLEOCI, DB_DIALECT_PGSQL, DB_DIALECT_MYSQL,
- DB_DIALECT_HSQLDB, DB_DIALECT_DB2, DB_DIALECT_DB2V8, DB_DIALECT_MSSQL, DB_DIALECT_SYBASE, DB_DIALECT_DERBY,
- DB_DIALECT_MYSQL_UTF8, DB_DIALECT_INGRES};
-
-}
Deleted: jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/SQLExceptionHandler.java
===================================================================
--- jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/SQLExceptionHandler.java 2009-12-25 16:16:18 UTC (rev 1195)
+++ jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/SQLExceptionHandler.java 2009-12-25 17:05:38 UTC (rev 1196)
@@ -1,395 +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;
-
-import org.exoplatform.services.jcr.dataflow.ItemState;
-import org.exoplatform.services.jcr.datamodel.ItemData;
-import org.exoplatform.services.jcr.datamodel.NodeData;
-import org.exoplatform.services.jcr.datamodel.QPathEntry;
-import org.exoplatform.services.jcr.impl.storage.JCRInvalidItemStateException;
-import org.exoplatform.services.jcr.impl.storage.JCRItemExistsException;
-
-import java.io.IOException;
-import java.sql.SQLException;
-
-import javax.jcr.InvalidItemStateException;
-import javax.jcr.ItemExistsException;
-import javax.jcr.RepositoryException;
-
-/**
- * Created by The eXo Platform SAS.
- *
- * The eXo JCR database has constraints can be violated.
- *
- * JCR_PK_XCONTAINER - Can not be exisits two containers with same version
- *
- * JCR_PK_XITEM - Item already exists with this ID JCR_FK_XITEM_PARENT - Parent not found by ID
- * JCR_IDX_XITEM_PARENT - Item already exists with the parent, name, index, type(N/P), persisted
- * version JCR_IDX_XITEM_PARENT_NAME - Item already exists with the type(N/P), parent, name, index,
- * persisted version JCR_IDX_XITEM_PARENT_ID - Item already exists with the type(N/P), parent, ID,
- * persisted version
- *
- * JCR_PK_XVALUE - Value already exists with the ID (impossible, ID is autiincremented)
- * JCR_FK_XVALUE_PROPERTY - There is no property exists for the value. JCR_IDX_XVALUE_PROPERTY -
- * Value already exists with the property and order number
- *
- * JCR_PK_XREF - Reference already exists to the node from property with order number
- * JCR_IDX_XREF_PROPERTY - Reference already exists with the property and order number
- *
- * @author Peter Nedonosko
- * @version $Id: SQLExceptionHandler.java 34801 2009-07-31 15:44:50Z dkatayev $
- */
-
-public class SQLExceptionHandler
-{
-
- /**
- * Ccontainer name.
- */
- private final String containerName;
-
- /**
- * Storage connection.
- */
- private final CQJDBCStorageConnection conn;
-
- // ---------------- SQLException handler -------------------
-
- /**
- * SQLExceptionHandler constructor.
- *
- * @param containerName
- * - workspace container name
- * @param conn
- * - storage connection
- */
- SQLExceptionHandler(String containerName, CQJDBCStorageConnection conn)
- {
- this.containerName = containerName;
- this.conn = conn;
- }
-
- /**
- * Handle Add SQLException.
- *
- * @param e
- * - an SQLException
- * @param item
- * - context ItemData
- * @return String with error message
- * @throws RepositoryException
- * if <code>RepositoryException</code> should be thrown
- * @throws InvalidItemStateException
- * if <code>InvalidItemStateException</code> should be thrown
- */
- protected String handleAddException(SQLException e, ItemData item) throws RepositoryException,
- InvalidItemStateException
- {
- String message = "[" + containerName + "] ADD " + (item.isNode() ? "NODE. " : "PROPERTY. ");
- String errMessage = e.getMessage();
- String itemInfo =
- item.getQPath().getAsString() + ", ID: " + item.getIdentifier() + ", ParentID: " + item.getParentIdentifier()
- + (errMessage != null ? ". Cause >>>> " + errMessage : "");
-
- if (errMessage != null)
- {
- // try detect error by foreign key names
- String umsg = errMessage.toLowerCase().toUpperCase();
- if (umsg.indexOf(conn.JCR_FK_ITEM_PARENT) >= 0)
- {
- message += "Parent not found. Item " + itemInfo;
- throw new JCRInvalidItemStateException(message, item.getIdentifier(), ItemState.ADDED, e);
- }
- else if (umsg.indexOf(conn.JCR_PK_ITEM) >= 0)
- {
- message += "Item already exists. Condition: ID. " + itemInfo;
- // InvalidItemStateException ! - because it's impossible add new item with existed UUID
- throw new JCRInvalidItemStateException(message, item.getIdentifier(), ItemState.ADDED, e);
- }
- else if (umsg.indexOf(conn.JCR_IDX_ITEM_PARENT) >= 0 || umsg.indexOf(conn.JCR_IDX_ITEM_PARENT_NAME) >= 0)
- {
- message += "Item already exists. Condition: parent ID, name, index. " + itemInfo;
- throw new ItemExistsException(message, e);
- }
- else if (umsg.indexOf(conn.JCR_IDX_ITEM_PARENT_ID) >= 0)
- {
- message += "Item already exists. Condition: parent ID and ID. " + itemInfo;
- throw new ItemExistsException(message, e);
- }
- else if (umsg.indexOf(conn.JCR_FK_VALUE_PROPERTY) >= 0)
- {
- message += "Property is not exist but the value is being created. Condition: property ID. " + itemInfo;
- throw new RepositoryException(message, e);
- }
- else if (umsg.indexOf(conn.JCR_IDX_VALUE_PROPERTY) >= 0)
- {
- message += "Property already exists. Condition: property ID, order number. " + itemInfo;
- throw new RepositoryException(message, e);
- }
- else if (umsg.indexOf(conn.JCR_PK_VALUE) >= 0)
- {
- message +=
- "[FATAL] Value already exists with the ValueID. Impossible state, check is ValueID is autoincremented. "
- + itemInfo;
- throw new RepositoryException(message, e);
- }
- else if (umsg.indexOf(conn.JCR_PK_REF) >= 0)
- {
- message += "Reference chain already exists. Condition: node ID, property ID, order number. " + itemInfo;
- throw new RepositoryException(message, e);
- }
- else if (umsg.indexOf(conn.JCR_IDX_REF_PROPERTY) >= 0)
- {
- message += "Referenceable property value already exists. Condition: property ID, order number. " + itemInfo;
- throw new RepositoryException(message, e);
- }
- }
-
- // try detect integrity violation
- RepositoryException ownException = null;
- try
- {
- NodeData parent = (NodeData)conn.getItemData(item.getParentIdentifier());
- if (parent != null)
- {
- // have a parent
- try
- {
- ItemData me = conn.getItemData(item.getIdentifier());
- if (me != null)
- {
- // item already exists
- message += "Item already exists in storage: " + itemInfo;
- ownException = new JCRItemExistsException(message, me.getIdentifier(), ItemState.ADDED, e);
- throw ownException;
- }
-
- me = conn.getItemData(parent, new QPathEntry(item.getQPath().getName(), item.getQPath().getIndex()));
- if (me != null)
- {
- message += "Item already exists in storage: " + itemInfo;
- ownException = new JCRItemExistsException(message, me.getIdentifier(), ItemState.ADDED, e);
- throw ownException;
- }
-
- }
- catch (Exception ep)
- {
- // item not found or other things but error of item reading
- if (ownException != null)
- throw ownException;
- }
-
- // MySQL violation
- if (e.getClass().getName().indexOf("MySQLIntegrityConstraintViolationException") >= 0
- && errMessage.indexOf(item.getIdentifier()) >= 0)
- {
- // it's JCR_PK_ITEM violation
- message += "Item already exists. Condition: ID. " + itemInfo;
- throw new JCRInvalidItemStateException(message, item.getIdentifier(), ItemState.ADDED, e);
- }
-
- message += "Error of item add. " + itemInfo;
- ownException = new RepositoryException(message, e);
- throw ownException;
- }
- }
- catch (Exception ep)
- {
- // no parent or error access it
- if (ownException != null)
- throw ownException;
- }
- message += "Error of item add. " + itemInfo;
- throw new JCRInvalidItemStateException(message, item.getIdentifier(), ItemState.ADDED, e);
- }
-
- /**
- * Handle Add IOException.
- *
- * @param e
- * - an IOException
- * @param item
- * - context ItemData
- * @return String with error message
- * @throws RepositoryException
- * if <code>RepositoryException</code> should be thrown
- * @throws InvalidItemStateException
- * if <code>InvalidItemStateException</code> should be thrown
- */
- protected String handleAddException(IOException e, ItemData item) throws RepositoryException,
- InvalidItemStateException
- {
- String message = "[" + containerName + "] ADD " + (item.isNode() ? "NODE. " : "PROPERTY. ");
- String errMessage = e.getMessage();
- String itemInfo =
- item.getQPath().getAsString() + ", ID: " + item.getIdentifier() + ", ParentID: " + item.getParentIdentifier()
- + (errMessage != null ? ". Cause >>>> " + errMessage : "");
-
- // try detect integrity violation
- RepositoryException ownException = null;
- try
- {
- NodeData parent = (NodeData)conn.getItemData(item.getParentIdentifier());
- if (parent != null)
- {
- // have a parent
- try
- {
- ItemData me = conn.getItemData(item.getIdentifier());
- if (me != null)
- {
- // item already exists
- message += "Item already exists in storage: " + itemInfo;
- ownException = new ItemExistsException(message, e);
- throw ownException;
- }
-
- me = conn.getItemData(parent, new QPathEntry(item.getQPath().getName(), item.getQPath().getIndex()));
- if (me != null)
- {
- message += "Item already exists in storage: " + itemInfo;
- ownException = new ItemExistsException(message, e);
- throw ownException;
- }
-
- }
- catch (Exception ep)
- {
- // item not found or other things but error of item reading
- if (ownException != null)
- throw ownException;
- }
- message += "Error of item add. " + itemInfo;
- ownException = new RepositoryException(message, e);
- throw ownException;
- }
- }
- catch (Exception ep)
- {
- // no parent or error access it
- if (ownException != null)
- throw ownException;
- }
- message += "Error of item add. " + itemInfo;
- throw new JCRInvalidItemStateException(message, item.getIdentifier(), ItemState.ADDED, e);
- }
-
- /**
- * Handle delete Exceptions.
- *
- * @param e
- * - an SQLException
- * @param item
- * - context ItemData
- * @return String with error message
- * @throws RepositoryException
- * if <code>RepositoryException</code> should be thrown
- * @throws InvalidItemStateException
- * if <code>InvalidItemStateException</code> should be thrown
- */
- protected String handleDeleteException(SQLException e, ItemData item) throws RepositoryException,
- InvalidItemStateException
- {
- String message = "[" + containerName + "] DELETE " + (item.isNode() ? "NODE. " : "PROPERTY. ");
- String errMessage = e.getMessage();
- String itemInfo =
- item.getQPath().getAsString() + " " + item.getIdentifier()
- + (errMessage != null ? ". Cause >>>> " + errMessage : "");
-
- if (errMessage != null)
- {
- // try detect error by foreign key names
- String umsg = errMessage.toLowerCase().toUpperCase();
- if (umsg.indexOf(conn.JCR_FK_ITEM_PARENT) >= 0)
- {
- message += "Can not delete parent till childs exists. Item " + itemInfo;
- throw new JCRInvalidItemStateException(message, item.getIdentifier(), ItemState.DELETED, e);
- }
- else if (umsg.indexOf(conn.JCR_FK_VALUE_PROPERTY) >= 0)
- {
- message +=
- "[FATAL] Can not delete property item till it contains values. Condition: property ID. " + itemInfo;
- throw new RepositoryException(message, e);
- }
- }
-
- message += "Error of item delete " + itemInfo;
- throw new RepositoryException(message, e);
- }
-
- /**
- * Handle update Exceptions.
- *
- * @param e
- * - an SQLException
- * @param item
- * - context ItemData
- * @return String with error message
- * @throws RepositoryException
- * if <code>RepositoryException</code> should be thrown
- * @throws InvalidItemStateException
- * if <code>InvalidItemStateException</code> should be thrown
- */
- protected String handleUpdateException(SQLException e, ItemData item) throws RepositoryException,
- InvalidItemStateException
- {
- String message = "[" + containerName + "] EDIT " + (item.isNode() ? "NODE. " : "PROPERTY. ");
- String errMessage = e.getMessage();
- String itemInfo =
- item.getQPath().getAsString() + " " + item.getIdentifier()
- + (errMessage != null ? ". Cause >>>> " + errMessage : "");
-
- if (errMessage != null)
- // try detect error by foreign key names
- if (errMessage.toLowerCase().toUpperCase().indexOf(conn.JCR_FK_VALUE_PROPERTY) >= 0)
- {
- message += "Property is not exists but the value is being created. Condition: property ID. " + itemInfo;
- throw new RepositoryException(message, e);
- }
- else if (errMessage.toLowerCase().toUpperCase().indexOf(conn.JCR_PK_ITEM) >= 0)
- {
- message += "Item already exists. Condition: ID. " + itemInfo;
- throw new JCRInvalidItemStateException(message, item.getIdentifier(), ItemState.UPDATED, e);
- }
-
- // try detect integrity violation
- RepositoryException ownException = null;
- try
- {
- ItemData me = conn.getItemData(item.getIdentifier());
- if (me != null)
- {
- // item already exists
- message += "Item already exists. But update errors. " + itemInfo;
- ownException = new RepositoryException(message, e);
- throw ownException;
- }
- }
- catch (Exception ep)
- {
- // item not found or other things but error of item reading
- if (ownException != null)
- throw ownException;
- }
- message += "Error of item update. " + itemInfo;
- throw new JCRInvalidItemStateException(message, item.getIdentifier(), ItemState.UPDATED, e);
- }
-
-}
Modified: jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/MultiDbJDBCConnection.java
===================================================================
--- jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/MultiDbJDBCConnection.java 2009-12-25 16:16:18 UTC (rev 1195)
+++ jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/MultiDbJDBCConnection.java 2009-12-25 17:05:38 UTC (rev 1196)
@@ -185,7 +185,7 @@
// + " where I2.ID=I.ID and I2.ID=I.PARENT_ID and I.NAME IN ('[http://www.jcp.org/jcr/1.0]primaryType')";// order by I.I_CLASS, I.N_ORDER_NUM"
"select I.*, V.ORDER_NUM, V.DATA, V.STORAGE_DESC from JCR_MITEM I LEFT OUTER JOIN JCR_MVALUE V ON (V.PROPERTY_ID=I.ID)"
- + " where (I.ID=?) or (I.PARENT_ID=? and I.I_CLASS=2 and I.NAME IN ('[http://www.jcp.org/jcr/1.0]primaryType','[http://www.jcp.org/jcr/1.0]mixinTypes')) order by I.I_CLASS, I.NAME DESC";// order by I.I_CLASS, I.N_ORDER_NUM"
+ + " where (I.ID=?) or (I.PARENT_ID=? and I.I_CLASS=2 and (I.NAME='[http://www.jcp.org/jcr/1.0]primaryType' or I.NAME='[http://www.jcp.org/jcr/1.0]mixinTypes')) order by I.I_CLASS, I.NAME DESC";// order by I.I_CLASS, I.N_ORDER_NUM"
FIND_ITEM_BY_NAME =
"select * from JCR_MITEM" + " where PARENT_ID=? and NAME=? and I_INDEX=? order by I_CLASS, VERSION DESC";
16 years, 4 months
exo-jcr SVN: r1195 - jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation.
by do-not-reply@jboss.org
Author: sergiykarpenko
Date: 2009-12-25 11:16:18 -0500 (Fri, 25 Dec 2009)
New Revision: 1195
Added:
jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/CQJDBCStorageConnectionIJ.java
jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/CQJDBCWorkspaceDataContainerIJ.java
Modified:
jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/CQJDBCWorkspaceDataContainer.java
Log:
EXOJCR-302: rename classes
Added: jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/CQJDBCStorageConnectionIJ.java
===================================================================
--- jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/CQJDBCStorageConnectionIJ.java (rev 0)
+++ jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/CQJDBCStorageConnectionIJ.java 2009-12-25 16:16:18 UTC (rev 1195)
@@ -0,0 +1,63 @@
+/*
+ * Copyright (C) 2003-2009 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;
+
+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.
+ *
+ * <br/>Date:
+ *
+ * @author <a href="karpenko.sergiy(a)gmail.com">Karpenko Sergiy</a>
+ * @version $Id: CQJDBCStorageConnectionIJ.java 111 2008-11-11 11:11:11Z serg $
+ */
+abstract class CQJDBCStorageConnectionIJ extends CQJDBCStorageConnection
+{
+
+ /**
+ * JDBCStorageConnection constructor.
+ *
+ * @param dbConnection
+ * JDBC connection
+ * @param containerName
+ * Workspace conatiner name
+ * @param valueStorageProvider
+ * External Value Storage provider
+ * @param maxBufferSize
+ * maximum buffer size (config)
+ * @param swapDirectory
+ * swap directory (config)
+ * @param swapCleaner
+ * swap cleaner (FileCleaner)
+ * @throws SQLException
+ * database error
+ */
+ protected CQJDBCStorageConnectionIJ(Connection dbConnection, boolean readOnly, String containerName,
+ ValueStoragePluginProvider valueStorageProvider, int maxBufferSize, File swapDirectory, FileCleaner swapCleaner)
+ throws SQLException
+ {
+ super(dbConnection, readOnly, containerName, valueStorageProvider, maxBufferSize, swapDirectory, swapCleaner);
+
+ }
+
+}
Modified: jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/CQJDBCWorkspaceDataContainer.java
===================================================================
--- jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/CQJDBCWorkspaceDataContainer.java 2009-12-25 15:55:34 UTC (rev 1194)
+++ jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/CQJDBCWorkspaceDataContainer.java 2009-12-25 16:16:18 UTC (rev 1195)
@@ -21,11 +21,9 @@
import org.exoplatform.services.jcr.config.RepositoryConfigurationException;
import org.exoplatform.services.jcr.config.RepositoryEntry;
import org.exoplatform.services.jcr.config.WorkspaceEntry;
-import org.exoplatform.services.jcr.impl.storage.WorkspaceDataContainerBase;
import org.exoplatform.services.jcr.impl.storage.jdbc.DBConstants;
-import org.exoplatform.services.jcr.impl.storage.jdbc.db.GenericConnectionFactory;
+import org.exoplatform.services.jcr.impl.storage.jdbc.JDBCWorkspaceDataContainer;
import org.exoplatform.services.jcr.impl.storage.jdbc.db.OracleConnectionFactory;
-import org.exoplatform.services.jcr.impl.storage.jdbc.db.WorkspaceStorageConnectionFactory;
import org.exoplatform.services.jcr.impl.storage.jdbc.init.DBInitializer;
import org.exoplatform.services.jcr.impl.storage.jdbc.init.DBInitializerException;
import org.exoplatform.services.jcr.impl.storage.jdbc.init.IngresSQLDBInitializer;
@@ -33,19 +31,11 @@
import org.exoplatform.services.jcr.impl.storage.jdbc.init.PgSQLDBInitializer;
import org.exoplatform.services.jcr.impl.storage.jdbc.optimisation.db.HSQLDBConnectionFactory;
import org.exoplatform.services.jcr.impl.storage.jdbc.optimisation.db.MySQLConnectionFactory;
-import org.exoplatform.services.jcr.impl.storage.jdbc.update.StorageUpdateManager;
-import org.exoplatform.services.jcr.impl.util.io.FileCleaner;
-import org.exoplatform.services.jcr.storage.WorkspaceDataContainer;
-import org.exoplatform.services.jcr.storage.WorkspaceStorageConnection;
import org.exoplatform.services.jcr.storage.value.ValueStoragePluginProvider;
-import org.exoplatform.services.log.ExoLogger;
-import org.exoplatform.services.log.Log;
import org.exoplatform.services.naming.InitialContextInitializer;
import org.picocontainer.Startable;
-import java.io.File;
import java.io.IOException;
-import java.sql.Connection;
import javax.jcr.RepositoryException;
import javax.naming.InitialContext;
@@ -58,113 +48,10 @@
* @author <a href="mailto:peter.nedonosko@exoplatform.com.ua">Peter Nedonosko</a>
* @version $Id:GenericWorkspaceDataContainer.java 13433 2007-03-15 16:07:23Z peterit $
*/
-public class CQJDBCWorkspaceDataContainer extends WorkspaceDataContainerBase implements Startable
+public class CQJDBCWorkspaceDataContainer extends JDBCWorkspaceDataContainer implements Startable
{
- protected static final Log LOG = ExoLogger.getLogger("jcr.JDBCWorkspaceDataContainer");
-
- //configuration params
-
- public final static String SOURCE_NAME = "source-name";
-
- public final static String MULTIDB = "multi-db";
-
- public final static String SINGLEDB = "single-db";
-
/**
- * Describe which type of RDBMS will be used (DB creation metadata etc.)
- */
- public final static String DB_DIALECT = "dialect";
-
- public final static String DB_DRIVER = "driverClassName";
-
- public final static String DB_URL = "url";
-
- public final static String DB_USERNAME = "username";
-
- public final static String DB_PASSWORD = "password";
-
- protected final String containerName;
-
- protected final String dbSourceName;
-
- protected final boolean multiDb;
-
- protected final String dbDriver;
-
- protected final String dbDialect;
-
- protected final String dbUrl;
-
- protected final String dbUserName;
-
- protected final String dbPassword;
-
- protected final ValueStoragePluginProvider valueStorageProvider;
-
- protected String storageVersion;
-
- protected int maxBufferSize;
-
- protected File swapDirectory;
-
- protected FileCleaner swapCleaner;
-
- protected GenericConnectionFactory connFactory;
-
- /**
- * Shared connection factory.
- *
- * Issued to share JDBC connection between system and regular workspace in case of same database
- * used for storage.
- *
- */
- class SharedConnectionFactory extends GenericConnectionFactory
- {
-
- /**
- * JDBC connection.
- */
- final private Connection connection;
-
- /**
- * SharedConnectionFactory constructor.
- *
- * @param connection
- * JDBC - connection
- * @param containerName
- * - container name
- * @param multiDb
- * - multidatabase status
- * @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).
- */
- SharedConnectionFactory(Connection connection, String containerName, boolean multiDb,
- ValueStoragePluginProvider valueStorageProvider, int maxBufferSize, File swapDirectory, FileCleaner swapCleaner)
- {
-
- super(null, null, null, null, null, containerName, multiDb, valueStorageProvider, maxBufferSize,
- swapDirectory, swapCleaner);
-
- this.connection = connection;
- }
-
- /**
- * {@inheritDoc}
- */
- public Connection getJdbcConnection() throws RepositoryException
- {
- return connection;
- }
- }
-
- /**
* Constructor with value storage plugins.
*
* @param wsConfig
@@ -180,275 +67,10 @@
InitialContextInitializer contextInit, ValueStoragePluginProvider valueStorageProvider)
throws RepositoryConfigurationException, NamingException, RepositoryException, IOException
{
-
- checkIntegrity(wsConfig, repConfig);
-
- this.containerName = wsConfig.getName();
- this.multiDb = Boolean.parseBoolean(wsConfig.getContainer().getParameterValue(MULTIDB));
- this.valueStorageProvider = valueStorageProvider;
-
- // ------------- Database config ------------------
- String pDbDialect = null;
- try
- {
- pDbDialect = detectDialect(wsConfig.getContainer().getParameterValue(DB_DIALECT));
- LOG.info("Using a dialect '" + pDbDialect + "'");
- }
- catch (RepositoryConfigurationException e)
- {
- LOG.info("Using a default dialect '" + DBConstants.DB_DIALECT_GENERIC + "'");
- pDbDialect = DBConstants.DB_DIALECT_GENERIC;
- }
- this.dbDialect = pDbDialect;
-
- String pDbDriver = null;
- String pDbUrl = null;
- String pDbUserName = null;
- String pDbPassword = null;
- try
- {
- pDbDriver = wsConfig.getContainer().getParameterValue(DB_DRIVER);
-
- // username/passwd may not pesent
- try
- {
- pDbUserName = wsConfig.getContainer().getParameterValue(DB_USERNAME);
- pDbPassword = wsConfig.getContainer().getParameterValue(DB_PASSWORD);
- }
- catch (RepositoryConfigurationException e)
- {
- pDbUserName = pDbPassword = null;
- }
-
- pDbUrl = wsConfig.getContainer().getParameterValue(DB_URL); // last here!
- }
- catch (RepositoryConfigurationException e)
- {
- }
-
- if (pDbUrl != null)
- {
- this.dbDriver = pDbDriver;
- this.dbUrl = pDbUrl;
- this.dbUserName = pDbUserName;
- this.dbPassword = pDbPassword;
- this.dbSourceName = null;
- LOG.info("Connect to JCR database as user '" + this.dbUserName + "'");
- }
- else
- {
- this.dbDriver = null;
- this.dbUrl = null;
- this.dbUserName = null;
- this.dbPassword = null;
-
- String sn;
- try
- {
- sn = wsConfig.getContainer().getParameterValue(SOURCE_NAME);
- }
- catch (RepositoryConfigurationException e)
- {
- sn = wsConfig.getContainer().getParameterValue("sourceName"); // TODO for backward comp,
- // remove in rel.2.0
- }
- this.dbSourceName = sn;
- }
-
- // ------------- Values swap config ------------------
- try
- {
- this.maxBufferSize = wsConfig.getContainer().getParameterInteger(MAXBUFFERSIZE_PROP);
- }
- catch (RepositoryConfigurationException e)
- {
- this.maxBufferSize = DEF_MAXBUFFERSIZE;
- }
-
- try
- {
- String sdParam = wsConfig.getContainer().getParameterValue(SWAPDIR_PROP);
- this.swapDirectory = new File(sdParam);
- }
- catch (RepositoryConfigurationException e1)
- {
- this.swapDirectory = new File(DEF_SWAPDIR);
- }
- if (!swapDirectory.exists())
- swapDirectory.mkdirs();
-
- this.swapCleaner = new FileCleaner(false);
-
- initDatabase();
-
- String suParam = null;
- boolean enableStorageUpdate = false;
- try
- {
- suParam = wsConfig.getContainer().getParameterValue("update-storage");
- enableStorageUpdate = Boolean.parseBoolean(suParam);
- }
- catch (RepositoryConfigurationException e)
- {
- if (LOG.isDebugEnabled())
- LOG.debug("update-storage parameter is not set " + dbSourceName);
- }
-
- this.storageVersion =
- StorageUpdateManager.checkVersion(dbSourceName, this.connFactory.getJdbcConnection(), multiDb,
- enableStorageUpdate);
-
- LOG.info(getInfo());
+ super(wsConfig, repConfig, contextInit, valueStorageProvider);
}
/**
- * Prepare sefault connection factory.
- *
- * @return GenericConnectionFactory
- * @throws NamingException
- * on JNDI error
- * @throws RepositoryException
- * on Storage error
- */
- protected GenericConnectionFactory defaultConnectionFactory() throws NamingException, RepositoryException
- {
- // by default
- if (dbSourceName != null)
- {
- DataSource ds = (DataSource)new InitialContext().lookup(dbSourceName);
- if (ds != null)
- return new GenericConnectionFactory(ds, containerName, multiDb, valueStorageProvider, maxBufferSize,
- swapDirectory, swapCleaner);
-
- throw new RepositoryException("Datasource '" + dbSourceName + "' is not bound in this context.");
- }
-
- return new GenericConnectionFactory(dbDriver, dbUrl, dbUserName, dbPassword, containerName, multiDb,
- valueStorageProvider, maxBufferSize, swapDirectory, swapCleaner);
- }
-
- /**
- * Prepare default DB initializer.
- *
- * @param sqlPath
- * - path to SQL script (database creation script)
- * @return DBInitializer instance
- * @throws NamingException
- * on JNDI error
- * @throws RepositoryException
- * on Storage error
- * @throws IOException
- * on I/O error
- */
- protected DBInitializer defaultDBInitializer(String sqlPath) throws NamingException, RepositoryException,
- IOException
- {
- return new DBInitializer(containerName, this.connFactory.getJdbcConnection(), sqlPath, multiDb);
- }
-
- /**
- * Checks if DataSources used in right manner.
- *
- * @param wsConfig
- * Workspace configuration
- * @param repConfig
- * Repository configuration
- * @throws RepositoryConfigurationException
- * in case of configuration errors
- */
- protected void checkIntegrity(WorkspaceEntry wsConfig, RepositoryEntry repConfig)
- throws RepositoryConfigurationException
- {
- boolean isMulti;
- for (WorkspaceEntry wsEntry : repConfig.getWorkspaceEntries())
- {
- if (wsEntry.getName().equals(wsConfig.getName())
- || !wsEntry.getContainer().getType().equals(wsConfig.getContainer().getType())
- || !wsEntry.getContainer().getType().equals(this.getClass().getName()))
- continue;
-
- // MULTIDB
- if (!wsEntry.getContainer().getParameterValue(MULTIDB).equals(
- wsConfig.getContainer().getParameterValue(MULTIDB)))
- {
- throw new RepositoryConfigurationException("All workspaces must be " + MULTIDB + " or " + SINGLEDB
- + ". But " + wsEntry.getName() + "- multi-db=" + wsEntry.getContainer().getParameterValue(MULTIDB)
- + " and " + wsConfig.getName() + "- multi-db=" + wsConfig.getContainer().getParameterValue(MULTIDB));
- }
-
- isMulti = Boolean.parseBoolean(wsConfig.getContainer().getParameterValue(MULTIDB));
-
- // source name
- String wsSourceName = null;
- String newWsSourceName = null;
- try
- {
- wsSourceName = wsEntry.getContainer().getParameterValue("sourceName");
- newWsSourceName = wsConfig.getContainer().getParameterValue("sourceName");
- }
- catch (RepositoryConfigurationException e)
- {
- }
-
- if (wsSourceName != null && newWsSourceName != null)
- {
- if (isMulti)
- {
- if (wsSourceName.equals(newWsSourceName))
- {
- throw new RepositoryConfigurationException("SourceName " + wsSourceName + " alredy in use in "
- + wsEntry.getName() + ". SourceName must be different in " + MULTIDB
- + ". Check configuration for " + wsConfig.getName());
- }
- }
- else
- {
- if (!wsSourceName.equals(newWsSourceName))
- {
- throw new RepositoryConfigurationException("SourceName must be equals in " + SINGLEDB + " "
- + "repository." + " Check " + wsEntry.getName() + " and " + wsConfig.getName());
- }
- }
- continue;
- }
-
- // db-url
- String wsUri = null;
- String newWsUri = null;
- try
- {
- wsUri = wsEntry.getContainer().getParameterValue("db-url");
- newWsUri = wsConfig.getContainer().getParameterValue("db-url");
- }
- catch (RepositoryConfigurationException e)
- {
- }
-
- if (wsUri != null && newWsUri != null)
- {
- if (isMulti)
- {
- if (wsUri.equals(newWsUri))
- {
- throw new RepositoryConfigurationException("db-url " + wsUri + " alredy in use in "
- + wsEntry.getName() + ". db-url must be different in " + MULTIDB + ". Check configuration for "
- + wsConfig.getName());
-
- }
- }
- else
- {
- if (!wsUri.equals(newWsUri))
- {
- throw new RepositoryConfigurationException("db-url must be equals in " + SINGLEDB + " "
- + "repository." + " Check " + wsEntry.getName() + " and " + wsConfig.getName());
- }
- }
- }
- }
- }
-
- /**
* Init storage database.
*
* @throws NamingException
@@ -609,194 +231,4 @@
}
}
- /**
- * Return ConnectionFactory.
- *
- * @return WorkspaceStorageConnectionFactory connection
- */
- protected GenericConnectionFactory getConnectionFactory()
- {
- return connFactory;
- }
-
- protected String detectDialect(String confParam)
- {
- for (String dbType : DBConstants.DB_DIALECTS)
- {
- if (dbType.equalsIgnoreCase(confParam))
- return dbType;
- }
-
- return DBConstants.DB_DIALECT_GENERIC; // by default
- }
-
- /**
- * {@inheritDoc}
- */
- public WorkspaceStorageConnection openConnection() throws RepositoryException
- {
-
- return connFactory.openConnection();
- }
-
- /**
- * {@inheritDoc}
- */
- public WorkspaceStorageConnection openConnection(boolean readOnly) throws RepositoryException
- {
-
- return connFactory.openConnection(readOnly);
- }
-
- /**
- * {@inheritDoc}
- */
- public WorkspaceStorageConnection reuseConnection(WorkspaceStorageConnection original) throws RepositoryException
- {
-
- if (original instanceof CQJDBCStorageConnection)
- {
- WorkspaceStorageConnectionFactory cFactory =
- new SharedConnectionFactory(((CQJDBCStorageConnection)original).getJdbcConnection(), containerName,
- multiDb, valueStorageProvider, maxBufferSize, swapDirectory, swapCleaner);
-
- return cFactory.openConnection();
- }
- else
- {
- return openConnection();
- }
- }
-
- /**
- * {@inheritDoc}
- */
- public String getName()
- {
- return containerName;
- }
-
- /**
- * {@inheritDoc}
- */
- public String getInfo()
- {
- String str =
- "JDBC based JCR Workspace Data container \n" + "container name: " + containerName + " \n"
- + "data source JNDI name: " + dbSourceName + "\n" + "is multi database: " + multiDb + "\n"
- + "storage version: " + storageVersion + "\n" + "value storage provider: " + valueStorageProvider + "\n"
- + "max buffer size (bytes): " + maxBufferSize + "\n" + "swap directory path: "
- + swapDirectory.getAbsolutePath();
- return str;
- }
-
- /**
- * {@inheritDoc}
- */
- public String getStorageVersion()
- {
- return storageVersion;
- }
-
- /**
- * {@inheritDoc}
- */
- public void start()
- {
- this.swapCleaner.start();
- }
-
- /**
- * {@inheritDoc}
- */
- public void stop()
- {
- this.swapCleaner.halt();
- this.swapCleaner.interrupt();
-
- // TODO HSQLDB Stop (debug)
- // if (dbDialect.equals(DB_DIALECT_GENERIC) ||
- // dbDialect.equals(DB_DIALECT_HSQLDB)) {
- // // shutdown in-process HSQLDB database
- // System.out.println("Shutdown in-process HSQLDB database...");
- // try {
- // JDBCStorageConnection conn = (JDBCStorageConnection) openConnection();
- // Connection jdbcConn = conn.getJdbcConnection();
- // String dbUrl = jdbcConn.getMetaData().getURL();
- // if (dbUrl.startsWith("jdbc:hsqldb:file") ||
- // dbUrl.startsWith("jdbc:hsqldb:mem")) {
- // // yeah, there is in-process hsqldb, shutdown it now
- // jdbcConn.createStatement().execute("SHUTDOWN");
- // System.out.println("Shutdown in-process HSQLDB database... done.");
- // }
- // } catch (Throwable e) {
- // log.error("JDBC Data container stop error " + e);
- // e.printStackTrace();
- // }
- // }
- }
-
- /**
- * {@inheritDoc}
- */
- public boolean isSame(WorkspaceDataContainer another)
- {
- if (another == this)
- return true;
-
- if (another instanceof CQJDBCWorkspaceDataContainer)
- {
- CQJDBCWorkspaceDataContainer anotherJdbc = (CQJDBCWorkspaceDataContainer)another;
-
- if (getDbSourceName() != null)
- // by jndi ds name
- return getDbSourceName().equals(anotherJdbc.getDbSourceName());
-
- // by db connection params
- return getDbDriver().equals(anotherJdbc.getDbDriver()) && getDbUrl().equals(anotherJdbc.getDbUrl())
- && getDbUserName().equals(anotherJdbc.getDbUserName());
- }
-
- return false;
- }
-
- /**
- * Used in <code>equals()</code>.
- *
- * @return DataSource name
- */
- protected String getDbSourceName()
- {
- return dbSourceName;
- }
-
- /**
- * Used in <code>equals()</code>.
- *
- * @return JDBC driver
- */
- protected String getDbDriver()
- {
- return dbDriver;
- }
-
- /**
- * Used in <code>equals()</code>.
- *
- * @return Database URL
- */
- protected String getDbUrl()
- {
- return dbUrl;
- }
-
- /**
- * Used in <code>equals()</code>.
- *
- * @return Database username
- */
- protected String getDbUserName()
- {
- return dbUserName;
- }
}
Added: jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/CQJDBCWorkspaceDataContainerIJ.java
===================================================================
--- jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/CQJDBCWorkspaceDataContainerIJ.java (rev 0)
+++ jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/CQJDBCWorkspaceDataContainerIJ.java 2009-12-25 16:16:18 UTC (rev 1195)
@@ -0,0 +1,58 @@
+/*
+ * Copyright (C) 2003-2009 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;
+
+import org.exoplatform.services.jcr.config.RepositoryConfigurationException;
+import org.exoplatform.services.jcr.config.RepositoryEntry;
+import org.exoplatform.services.jcr.config.WorkspaceEntry;
+import org.exoplatform.services.jcr.storage.value.ValueStoragePluginProvider;
+import org.exoplatform.services.naming.InitialContextInitializer;
+
+import java.io.IOException;
+
+import javax.jcr.RepositoryException;
+import javax.naming.NamingException;
+
+/**
+ * Created by The eXo Platform SAS.
+ *
+ * <br/>Date:
+ *
+ * @author <a href="karpenko.sergiy(a)gmail.com">Karpenko Sergiy</a>
+ * @version $Id: CQJDBWorkspaceDataContainerIJ.java 111 2008-11-11 11:11:11Z serg $
+ */
+public class CQJDBCWorkspaceDataContainerIJ extends CQJDBCWorkspaceDataContainer
+{
+ /**
+ * Constructor with value storage plugins.
+ *
+ * @param wsConfig
+ * Workspace configuration
+ * @param valueStrorageProvider
+ * External Value Stprages provider
+ * @throws RepositoryConfigurationException
+ * if Repository configuration is wrong
+ * @throws NamingException
+ * if JNDI exception (on DataSource lookup)
+ */
+ public CQJDBCWorkspaceDataContainerIJ(WorkspaceEntry wsConfig, RepositoryEntry repConfig,
+ InitialContextInitializer contextInit, ValueStoragePluginProvider valueStorageProvider)
+ throws RepositoryConfigurationException, NamingException, RepositoryException, IOException
+ {
+ super(wsConfig, repConfig, contextInit, valueStorageProvider);
+ }
+}
16 years, 4 months
exo-jcr SVN: r1194 - in jcr/branches/1.12.0-OPT/exo.jcr.component.core/src: main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db and 1 other directories.
by do-not-reply@jboss.org
Author: sergiykarpenko
Date: 2009-12-25 10:55:34 -0500 (Fri, 25 Dec 2009)
New Revision: 1194
Added:
jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/CQJDBCStorageConnection.java
jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/CQJDBCWorkspaceDataContainer.java
jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/SQLExceptionHandler.java
Removed:
jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/NewJDBCStorageConnection.java
jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/NewJDBCWorkspaceDataContainer.java
jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/NewSQLExceptionHandler.java
Modified:
jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/MultiDbJDBCConnection.java
jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/SingleDbJDBCConnection.java
jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/test/resources/conf/standalone/test-configuration.mysql.xml
jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/test/resources/conf/standalone/test-configuration.xml
jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/test/resources/conf/standalone/test-jcr-config.mysql.xml
jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/test/resources/conf/standalone/test-jcr-config.xml
Log:
EXOJCR-302: rename classes
Added: jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/CQJDBCStorageConnection.java
===================================================================
--- jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/CQJDBCStorageConnection.java (rev 0)
+++ jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/CQJDBCStorageConnection.java 2009-12-25 15:55:34 UTC (rev 1194)
@@ -0,0 +1,2532 @@
+/*
+ * 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;
+
+import org.exoplatform.services.jcr.access.AccessControlEntry;
+import org.exoplatform.services.jcr.access.AccessControlList;
+import org.exoplatform.services.jcr.dataflow.ItemState;
+import org.exoplatform.services.jcr.dataflow.persistent.PersistedNodeData;
+import org.exoplatform.services.jcr.dataflow.persistent.PersistedPropertyData;
+import org.exoplatform.services.jcr.datamodel.IllegalACLException;
+import org.exoplatform.services.jcr.datamodel.IllegalNameException;
+import org.exoplatform.services.jcr.datamodel.InternalQName;
+import org.exoplatform.services.jcr.datamodel.ItemData;
+import org.exoplatform.services.jcr.datamodel.NodeData;
+import org.exoplatform.services.jcr.datamodel.PropertyData;
+import org.exoplatform.services.jcr.datamodel.QPath;
+import org.exoplatform.services.jcr.datamodel.QPathEntry;
+import org.exoplatform.services.jcr.datamodel.ValueData;
+import org.exoplatform.services.jcr.impl.Constants;
+import org.exoplatform.services.jcr.impl.dataflow.persistent.ByteArrayPersistedValueData;
+import org.exoplatform.services.jcr.impl.dataflow.persistent.CleanableFilePersistedValueData;
+import org.exoplatform.services.jcr.impl.dataflow.persistent.StreamPersistedValueData;
+import org.exoplatform.services.jcr.impl.storage.JCRInvalidItemStateException;
+import org.exoplatform.services.jcr.impl.storage.jdbc.JDBCStorageConnection;
+import org.exoplatform.services.jcr.impl.storage.jdbc.PrimaryTypeNotFoundException;
+import org.exoplatform.services.jcr.impl.storage.value.ValueStorageNotFoundException;
+import org.exoplatform.services.jcr.impl.storage.value.fs.operations.ValueFileIOHelper;
+import org.exoplatform.services.jcr.impl.util.io.FileCleaner;
+import org.exoplatform.services.jcr.impl.util.io.SwapFile;
+import org.exoplatform.services.jcr.storage.WorkspaceStorageConnection;
+import org.exoplatform.services.jcr.storage.value.ValueIOChannel;
+import org.exoplatform.services.jcr.storage.value.ValueStoragePluginProvider;
+import org.exoplatform.services.log.ExoLogger;
+import org.exoplatform.services.log.Log;
+
+import java.io.ByteArrayInputStream;
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.sql.Connection;
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.StringTokenizer;
+
+import javax.jcr.InvalidItemStateException;
+import javax.jcr.PropertyType;
+import javax.jcr.RepositoryException;
+
+/**
+ * Created by The eXo Platform SAS.
+ *
+ * @author <a href="mailto:gennady.azarenkov@exoplatform.com">Gennady Azarenkov</a>
+ * @version $Id: JDBCStorageConnection.java 34801 2009-07-31 15:44:50Z dkatayev $
+ */
+abstract public class CQJDBCStorageConnection extends DBConstants implements WorkspaceStorageConnection
+{
+
+ /**
+ * Connection logger.
+ */
+ protected static final Log LOG = ExoLogger.getLogger("jcr.JDBCStorageConnection");
+
+ /**
+ * NODE type.
+ */
+ public static final int I_CLASS_NODE = 1;
+
+ /**
+ * PROPERTY type.
+ */
+ public static final int I_CLASS_PROPERTY = 2;
+
+ protected final ValueStoragePluginProvider valueStorageProvider;
+
+ protected final int maxBufferSize;
+
+ protected final File swapDirectory;
+
+ protected final FileCleaner swapCleaner;
+
+ protected final Connection dbConnection;
+
+ protected final String containerName;
+
+ protected final SQLExceptionHandler exceptionHandler;
+
+ protected final List<ValueIOChannel> valueChanges;
+
+ /**
+ * Read-only flag, if true the connection is marked as READ-ONLY.
+ */
+ protected final boolean readOnly;
+
+ /**
+ * JDBCStorageConnection constructor.
+ *
+ * @param dbConnection
+ * JDBC connection
+ * @param containerName
+ * Workspace conatiner name
+ * @param valueStorageProvider
+ * External Value Storage provider
+ * @param maxBufferSize
+ * maximum buffer size (config)
+ * @param swapDirectory
+ * swap directory (config)
+ * @param swapCleaner
+ * swap cleaner (FileCleaner)
+ * @throws SQLException
+ * database error
+ */
+ protected CQJDBCStorageConnection(Connection dbConnection, boolean readOnly, String containerName,
+ ValueStoragePluginProvider valueStorageProvider, int maxBufferSize, File swapDirectory, FileCleaner swapCleaner)
+ throws SQLException
+ {
+
+ this.valueStorageProvider = valueStorageProvider;
+
+ this.maxBufferSize = maxBufferSize;
+ this.swapDirectory = swapDirectory;
+ this.swapCleaner = swapCleaner;
+ this.containerName = containerName;
+
+ this.dbConnection = dbConnection;
+ this.readOnly = readOnly;
+
+ // Fix for Sybase jConnect JDBC driver bug.
+ // Which throws SQLException(JZ016: The AutoCommit option is already set to
+ // false)
+ // if conn.setAutoCommit(false) called twise or more times with value
+ // 'false'.
+ if (dbConnection.getAutoCommit())
+ {
+ dbConnection.setAutoCommit(false);
+ }
+
+ prepareQueries();
+ this.exceptionHandler = new SQLExceptionHandler(containerName, this);
+
+ this.valueChanges = new ArrayList<ValueIOChannel>();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public boolean equals(Object obj)
+ {
+ if (obj == this)
+ return true;
+
+ if (obj instanceof JDBCStorageConnection)
+ {
+ JDBCStorageConnection another = (JDBCStorageConnection)obj;
+ return getJdbcConnection() == another.getJdbcConnection();
+ }
+
+ return false;
+ }
+
+ /**
+ * Return JDBC connection obtained from initialized data source. NOTE: Helper can obtain one new
+ * connection per each call of the method or return one obtained once.
+ */
+ public Connection getJdbcConnection()
+ {
+ return dbConnection;
+ }
+
+ /**
+ * Prepared queries at start time.
+ *
+ * @throws SQLException
+ * database error
+ */
+ abstract protected void prepareQueries() throws SQLException;
+
+ /**
+ * Used in Single Db Connection classes for Identifier related queries.
+ *
+ * @param identifier
+ * Item id
+ * @return String with container internal id
+ */
+ protected abstract String getInternalId(String identifier);
+
+ /**
+ * Used in loadXYZRecord methods for extract real Identifier from container value.
+ *
+ * @param internalId
+ * @return
+ */
+ protected abstract String getIdentifier(String internalId);
+
+ // ---------------- WorkspaceStorageConnection -------------
+
+ /**
+ * @throws IllegalStateException
+ * if connection is closed.
+ */
+ protected void checkIfOpened() throws IllegalStateException
+ {
+ if (!isOpened())
+ throw new IllegalStateException("Connection is closed");
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public boolean isOpened()
+ {
+ try
+ {
+ return !dbConnection.isClosed();
+ }
+ catch (SQLException e)
+ {
+ LOG.error(e);
+ return false;
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public final void rollback() throws IllegalStateException, RepositoryException
+ {
+ checkIfOpened();
+ try
+ {
+ dbConnection.rollback();
+ dbConnection.close();
+
+ // rollback from the end
+ for (int p = valueChanges.size() - 1; p >= 0; p--)
+ valueChanges.get(p).rollback();
+ }
+ catch (SQLException e)
+ {
+ throw new RepositoryException(e);
+ }
+ catch (IOException e)
+ {
+ throw new RepositoryException(e);
+ }
+ finally
+ {
+ valueChanges.clear();
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public final void close() throws IllegalStateException, RepositoryException
+ {
+ checkIfOpened();
+ try
+ {
+ // If READ-ONLY status back it to READ-WRITE (we assume it was original state)
+ if (readOnly)
+ dbConnection.setReadOnly(true);
+
+ dbConnection.close();
+ }
+ catch (SQLException e)
+ {
+ throw new RepositoryException(e);
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public final void commit() throws IllegalStateException, RepositoryException
+ {
+ checkIfOpened();
+ try
+ {
+ dbConnection.commit();
+ dbConnection.close();
+
+ try
+ {
+ for (ValueIOChannel vo : valueChanges)
+ vo.commit();
+
+ }
+ catch (IOException e)
+ {
+ throw new RepositoryException(e);
+ }
+ finally
+ {
+ valueChanges.clear();
+ }
+ }
+ catch (SQLException e)
+ {
+ throw new RepositoryException(e);
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void add(NodeData data) throws RepositoryException, UnsupportedOperationException, InvalidItemStateException,
+ IllegalStateException
+ {
+ checkIfOpened();
+ try
+ {
+ addNodeRecord(data);
+ if (LOG.isDebugEnabled())
+ LOG.debug("Node added " + data.getQPath().getAsString() + ", " + data.getIdentifier() + ", "
+ + data.getPrimaryTypeName().getAsString());
+
+ }
+ catch (SQLException e)
+ {
+ if (LOG.isDebugEnabled())
+ LOG.error("Node add. Database error: " + e);
+
+ exceptionHandler.handleAddException(e, data);
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void add(PropertyData data) throws RepositoryException, UnsupportedOperationException,
+ InvalidItemStateException, IllegalStateException
+ {
+ checkIfOpened();
+
+ try
+ {
+ addPropertyRecord(data);
+
+ if (data.getType() == PropertyType.REFERENCE)
+ {
+ try
+ {
+ addReference(data);
+ }
+ catch (IOException e)
+ {
+ throw new RepositoryException("Can't read REFERENCE property (" + data.getQPath() + " "
+ + data.getIdentifier() + ") value: " + e.getMessage(), e);
+ }
+ }
+
+ addValues(getInternalId(data.getIdentifier()), data);
+
+ if (LOG.isDebugEnabled())
+ LOG.debug("Property added " + data.getQPath().getAsString() + ", " + data.getIdentifier()
+ + (data.getValues() != null ? ", values count: " + data.getValues().size() : ", NULL data"));
+
+ }
+ catch (IOException e)
+ {
+ if (LOG.isDebugEnabled())
+ LOG.error("Property add. IO error: " + e, e);
+ throw new RepositoryException("Error of Property Value add " + e, e);
+ }
+ catch (SQLException e)
+ {
+ if (LOG.isDebugEnabled())
+ LOG.error("Property add. Database error: " + e, e);
+ exceptionHandler.handleAddException(e, data);
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void rename(NodeData data) throws RepositoryException, UnsupportedOperationException,
+ InvalidItemStateException, IllegalStateException
+ {
+
+ checkIfOpened();
+ try
+ {
+ if (renameNode(data) <= 0)
+ throw new JCRInvalidItemStateException("(rename) Node not found " + data.getQPath().getAsString() + " "
+ + data.getIdentifier() + ". Probably was deleted by another session ", data.getIdentifier(),
+ ItemState.RENAMED);
+ }
+ catch (SQLException e)
+ {
+ if (LOG.isDebugEnabled())
+ LOG.error("Property add. Database error: " + e, e);
+ exceptionHandler.handleAddException(e, data);
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void delete(NodeData data) throws RepositoryException, UnsupportedOperationException,
+ InvalidItemStateException, IllegalStateException
+ {
+ checkIfOpened();
+
+ final String cid = getInternalId(data.getIdentifier());
+
+ try
+ {
+ int nc = deleteItemByIdentifier(cid);
+ if (nc <= 0)
+ throw new JCRInvalidItemStateException("(delete) Node not found " + data.getQPath().getAsString() + " "
+ + data.getIdentifier() + ". Probably was deleted by another session ", data.getIdentifier(),
+ ItemState.DELETED);
+
+ if (LOG.isDebugEnabled())
+ LOG.debug("Node deleted " + data.getQPath().getAsString() + ", " + data.getIdentifier() + ", "
+ + ((NodeData)data).getPrimaryTypeName().getAsString());
+
+ }
+ catch (SQLException e)
+ {
+ if (LOG.isDebugEnabled())
+ LOG.error("Node remove. Database error: " + e, e);
+ exceptionHandler.handleDeleteException(e, data);
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void delete(PropertyData data) throws RepositoryException, UnsupportedOperationException,
+ InvalidItemStateException, IllegalStateException
+ {
+ checkIfOpened();
+
+ final String cid = getInternalId(data.getIdentifier());
+
+ try
+ {
+ deleteValues(cid, data, false);
+
+ // delete references
+ deleteReference(cid);
+
+ // delete item
+ int nc = deleteItemByIdentifier(cid);
+ if (nc <= 0)
+ throw new JCRInvalidItemStateException("(delete) Property not found " + data.getQPath().getAsString() + " "
+ + data.getIdentifier() + ". Probably was deleted by another session ", data.getIdentifier(),
+ ItemState.DELETED);
+
+ if (LOG.isDebugEnabled())
+ LOG.debug("Property deleted "
+ + data.getQPath().getAsString()
+ + ", "
+ + data.getIdentifier()
+ + (((PropertyData)data).getValues() != null ? ", values count: "
+ + ((PropertyData)data).getValues().size() : ", NULL data"));
+
+ }
+ catch (IOException e)
+ {
+ if (LOG.isDebugEnabled())
+ LOG.error("Property remove. IO error: " + e, e);
+ throw new RepositoryException("Error of Property Value delete " + e, e);
+ }
+ catch (SQLException e)
+ {
+ if (LOG.isDebugEnabled())
+ LOG.error("Property remove. Database error: " + e, e);
+ exceptionHandler.handleDeleteException(e, data);
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void update(NodeData data) throws RepositoryException, UnsupportedOperationException,
+ InvalidItemStateException, IllegalStateException
+ {
+ checkIfOpened();
+ try
+ {
+ String cid = getInternalId(data.getIdentifier());
+ // order numb update
+ if (updateNodeByIdentifier(data.getPersistedVersion(), data.getQPath().getIndex(), data.getOrderNumber(), cid) <= 0)
+ throw new JCRInvalidItemStateException("(update) Node not found " + data.getQPath().getAsString() + " "
+ + data.getIdentifier() + ". Probably was deleted by another session ", data.getIdentifier(),
+ ItemState.UPDATED);
+
+ if (LOG.isDebugEnabled())
+ LOG.debug("Node updated " + data.getQPath().getAsString() + ", " + data.getIdentifier() + ", "
+ + data.getPrimaryTypeName().getAsString());
+
+ }
+ catch (SQLException e)
+ {
+ if (LOG.isDebugEnabled())
+ LOG.error("Node update. Database error: " + e, e);
+ exceptionHandler.handleUpdateException(e, data);
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void update(PropertyData data) throws RepositoryException, UnsupportedOperationException,
+ InvalidItemStateException, IllegalStateException
+ {
+ checkIfOpened();
+
+ try
+ {
+ String cid = getInternalId(data.getIdentifier());
+
+ // update type
+ if (updatePropertyByIdentifier(data.getPersistedVersion(), data.getType(), cid) <= 0)
+ throw new JCRInvalidItemStateException("(update) Property not found " + data.getQPath().getAsString() + " "
+ + data.getIdentifier() + ". Probably was deleted by another session ", data.getIdentifier(),
+ ItemState.UPDATED);
+
+ // update reference
+ try
+ {
+ deleteReference(cid);
+
+ if (data.getType() == PropertyType.REFERENCE)
+ {
+ addReference(data);
+ }
+ }
+ catch (IOException e)
+ {
+ throw new RepositoryException("Can't update REFERENCE property (" + data.getQPath() + " "
+ + data.getIdentifier() + ") value: " + e.getMessage(), e);
+ }
+
+ // do Values update: delete all and add all
+ deleteValues(cid, data, true);
+ addValues(cid, data);
+
+ if (LOG.isDebugEnabled())
+ LOG.debug("Property updated " + data.getQPath().getAsString() + ", " + data.getIdentifier()
+ + (data.getValues() != null ? ", values count: " + data.getValues().size() : ", NULL data"));
+
+ }
+ catch (IOException e)
+ {
+ if (LOG.isDebugEnabled())
+ LOG.error("Property update. IO error: " + e, e);
+ throw new RepositoryException("Error of Property Value update " + e, e);
+ }
+ catch (SQLException e)
+ {
+ if (LOG.isDebugEnabled())
+ LOG.error("Property update. Database error: " + e, e);
+ exceptionHandler.handleUpdateException(e, data);
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public List<NodeData> getChildNodesData(NodeData parent) throws RepositoryException, IllegalStateException
+ {
+ checkIfOpened();
+ try
+ {
+ // ResultSet node = findChildNodesByParentIdentifier(getInternalId(parent.getIdentifier()));
+ // List<NodeData> childrens = new ArrayList<NodeData>();
+ // while (node.next())
+ // childrens.add((NodeData)itemData(parent.getQPath(), node, I_CLASS_NODE, parent.getACL()));
+ //
+ // return childrens;
+ ResultSet resultSet = findChildNodesByParentIdentifierNew(getInternalId(parent.getIdentifier()));
+ if (resultSet.next())
+ {
+ Map<String, TempNodeData> tempNodes = loadNodesData(resultSet);
+
+ List<NodeData> childrens = new ArrayList<NodeData>(tempNodes.size());
+ QPath parentQPath = parent.getQPath();
+ AccessControlList parentACL = parent.getACL();
+ for (TempNodeData data : tempNodes.values())
+ {
+ NodeData nodeData = loadNodeFromTemporaryNodeData(data, parentQPath, parentACL);
+ childrens.add(nodeData);
+ }
+ return childrens;
+ }
+ else
+ {
+ return new ArrayList<NodeData>();
+ }
+
+ }
+ catch (SQLException e)
+ {
+ throw new RepositoryException(e);
+ }
+ catch (IOException e)
+ {
+ throw new RepositoryException(e);
+ }
+ }
+
+ protected Map<String, TempNodeData> loadNodesData(ResultSet resultSet) throws RepositoryException, IOException,
+ SQLException
+ {
+
+ Map<String, TempNodeData> nodesData = new LinkedHashMap<String, TempNodeData>();
+ do
+ {
+ int itemClass = resultSet.getInt(COLUMN_CLASS);
+ if (itemClass == I_CLASS_NODE)
+ {
+ TempNodeData data = new TempNodeData(resultSet);
+ nodesData.put(data.cid, data);
+ }
+ else
+ {
+ String cpid = resultSet.getString(COLUMN_PARENTID);
+ TempNodeData data = nodesData.get(cpid);
+ if (data.properties == null)
+ {
+ data.properties = new HashMap<String, List<byte[]>>();
+ }
+ Map<String, List<byte[]>> properties = data.properties;
+ String key = resultSet.getString(COLUMN_NAME);
+ List<byte[]> values = properties.get(key);
+ if (values == null)
+ {
+ values = new ArrayList<byte[]>();
+ properties.put(key, values);
+ }
+ values.add(resultSet.getBytes(COLUMN_VDATA));
+ }
+ }
+ while (resultSet.next());
+
+ return nodesData;
+
+ }
+
+ private static class TempNodeData
+ {
+ String cid;
+
+ String cname;
+
+ int cversion;
+
+ String cpid;
+
+ int cindex;
+
+ int cnordernumb;
+
+ Map<String, List<byte[]>> properties = new HashMap<String, List<byte[]>>();
+
+ public TempNodeData(ResultSet item) throws SQLException
+ {
+ cid = item.getString(COLUMN_ID);
+ cname = item.getString(COLUMN_NAME);
+ cversion = item.getInt(COLUMN_VERSION);
+
+ cpid = item.getString(COLUMN_PARENTID);
+
+ cindex = item.getInt(COLUMN_INDEX);
+ cnordernumb = item.getInt(COLUMN_NORDERNUM);
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public int getChildNodesCount(NodeData parent) throws RepositoryException
+ {
+ checkIfOpened();
+ try
+ {
+ ResultSet count = findChildNodesCountByParentIdentifier(getInternalId(parent.getIdentifier()));
+ if (count.next())
+ {
+ return count.getInt(1);
+ }
+ else
+ {
+ throw new RepositoryException("FATAL No resulton childNodes count for " + parent.getQPath().getAsString());
+ }
+ }
+ catch (SQLException e)
+ {
+ throw new RepositoryException(e);
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public List<PropertyData> getChildPropertiesData(NodeData parent) throws RepositoryException, IllegalStateException
+ {
+ checkIfOpened();
+ try
+ {
+
+ ResultSet resultSet = getChildPropertiesByParentIdentifier(getInternalId(parent.getIdentifier()));
+ List<PropertyData> children = new ArrayList<PropertyData>();
+ if (resultSet.next())
+ {
+ while (!resultSet.isAfterLast())
+ children.add(loadPropertyRecord(resultSet, parent.getQPath()));
+ }
+
+ return children;
+
+ }
+ catch (SQLException e)
+ {
+ throw new RepositoryException(e);
+ }
+ catch (IOException e)
+ {
+ throw new RepositoryException(e);
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * TODO left as current
+ */
+ public List<PropertyData> listChildPropertiesData(NodeData parent) throws RepositoryException, IllegalStateException
+ {
+ checkIfOpened();
+ try
+ {
+ ResultSet prop = findChildPropertiesByParentIdentifier(getInternalId(parent.getIdentifier()));
+ List<PropertyData> children = new ArrayList<PropertyData>();
+ while (prop.next())
+ children.add(propertyData(parent.getQPath(), prop));
+
+ return children;
+ }
+ catch (SQLException e)
+ {
+ throw new RepositoryException(e);
+ }
+ catch (IOException e)
+ {
+ throw new RepositoryException(e);
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public ItemData getItemData(String identifier) throws RepositoryException, IllegalStateException
+ {
+ return getItemByIdentifier(getInternalId(identifier));
+ }
+
+ public ItemData getItemData(NodeData parentData, QPathEntry name) throws RepositoryException, IllegalStateException
+ {
+
+ if (parentData != null)
+ {
+ return getItemByName(parentData, getInternalId(parentData.getIdentifier()), name);
+ }
+
+ // it's a root node
+ return getItemByName(null, null, name);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public List<PropertyData> getReferencesData(String nodeIdentifier) throws RepositoryException, IllegalStateException
+ {
+ checkIfOpened();
+ try
+ {
+ ResultSet refProps = findReferences(getInternalId(nodeIdentifier));
+ List<PropertyData> references = new ArrayList<PropertyData>();
+ while (refProps.next())
+ {
+ references.add((PropertyData)itemData(null, refProps, I_CLASS_PROPERTY, null));
+ }
+
+ // ResultSet resultSet = findReferenceProperties(getInternalId(nodeIdentifier));
+ // List<PropertyData> references = new ArrayList<PropertyData>(); //
+ // if (resultSet.next())
+ // {
+ // while (!resultSet.isAfterLast())
+ // references.add(loadPropertyRecord(resultSet, null));
+ // }
+
+ return references;
+ }
+ catch (SQLException e)
+ {
+ throw new RepositoryException(e);
+ }
+ catch (IOException e)
+ {
+ throw new RepositoryException(e);
+ }
+ }
+
+ // ------------------ Private methods ---------------
+
+ /**
+ * Get Item By Identifier.
+ *
+ * @param cid
+ * Item id (container internal)
+ * @return ItemData
+ * @throws RepositoryException
+ * Repository error
+ * @throws IllegalStateException
+ * if connection is closed
+ */
+ protected ItemData getItemByIdentifier(String cid) throws RepositoryException, IllegalStateException
+ {
+ checkIfOpened();
+ ResultSet resultSet = null;
+ try
+ {
+ resultSet = findItemByIdentifierNew(cid);
+ if (resultSet.next())
+ {
+ int itemType = resultSet.getInt(COLUMN_CLASS);
+ if (itemType == I_CLASS_NODE)
+ {
+ Map<String, TempNodeData> node = loadNodesData(resultSet);
+ return loadNodeFromTemporaryNodeData(node.get(cid), null, null);
+ //return loadNodeRecord(resultSet, null, null);
+ }
+ else
+ {
+ return loadPropertyRecord(resultSet, null);
+ }
+
+ }
+ return null;
+ }
+ catch (SQLException e)
+ {
+ throw new RepositoryException("getItemData() error", e);
+ }
+ catch (IOException e)
+ {
+ throw new RepositoryException("getItemData() error", e);
+ }
+ finally
+ {
+ try
+ {
+ if (resultSet != null)
+ resultSet.close();
+ }
+ catch (SQLException e)
+ {
+ LOG.error("getItemData() Error close resultset " + e.getMessage());
+ }
+ }
+
+ }
+
+ /**
+ * Gets an item data from database.
+ *
+ * @param parentPath
+ * - parent QPath
+ * @param parentId
+ * - parent container internal id (depends on Multi/Single DB)
+ * @param name
+ * - item name
+ * @return - ItemData instance
+ * @throws RepositoryException
+ * Repository error
+ * @throws IllegalStateException
+ * if connection is closed
+ */
+ protected ItemData getItemByName(NodeData parent, String parentId, QPathEntry name) throws RepositoryException,
+ IllegalStateException
+ {
+ checkIfOpened();
+ ResultSet resultSet = null;
+ try
+ {
+ resultSet = findItemByNameNew(parentId, name.getAsString(), name.getIndex());
+ if (resultSet.next())
+ {
+ // return itemData(parent.getQPath(), item, item.getInt(COLUMN_CLASS), parent.getACL());
+ int itemType = resultSet.getInt(COLUMN_CLASS);
+ if (itemType == I_CLASS_NODE)
+ {
+ // Remember first node id. If node is not first in result set - it's a bug.
+ String firstNodeId = resultSet.getString(COLUMN_ID);
+
+ // There may be two or more nodes, so load temp NodeDatas and return first one.
+ Map<String, TempNodeData> tempNodes = loadNodesData(resultSet);
+
+ QPath parentQPath = parent.getQPath();
+ AccessControlList parentACL = parent.getACL();
+
+ NodeData nodeData = loadNodeFromTemporaryNodeData(tempNodes.get(firstNodeId), parentQPath, parentACL);
+ tempNodes.clear();
+ return nodeData;
+
+ //return loadNodeRecord(resultSet, parent.getQPath(), parent.getACL());
+ }
+ else
+ {
+ return loadPropertyRecord(resultSet, parent.getQPath());
+ }
+ }
+
+ return null;
+ }
+ catch (SQLException e)
+ {
+ throw new RepositoryException(e);
+ }
+ catch (IOException e)
+ {
+ throw new RepositoryException(e);
+ }
+ finally
+ {
+ try
+ {
+ if (resultSet != null)
+ resultSet.close();
+ }
+ catch (SQLException e)
+ {
+ LOG.error("getItemData() Error close resultset " + e.getMessage());
+ }
+ }
+ }
+
+ /**
+ * Build Item path by id.
+ *
+ * @param cpid
+ * - Item id (container id)
+ * @return Item QPath
+ * @throws SQLException
+ * - if database error occurs
+ * @throws InvalidItemStateException
+ * - if parent not found
+ * @throws IllegalNameException
+ * - if name on the path is wrong
+ */
+ private QPath traverseQPath(String cpid) throws SQLException, InvalidItemStateException, IllegalNameException
+ {
+ // get item by Identifier usecase
+ List<QPathEntry> qrpath = new ArrayList<QPathEntry>(); // reverted path
+ String caid = cpid; // container ancestor id
+ do
+ {
+ ResultSet parent = null;
+ try
+ {
+ parent = findItemByIdentifier(caid);
+ if (!parent.next())
+ throw new InvalidItemStateException("Parent not found, uuid: " + getIdentifier(caid));
+
+ QPathEntry qpe =
+ new QPathEntry(InternalQName.parse(parent.getString(COLUMN_NAME)), parent.getInt(COLUMN_INDEX));
+ qrpath.add(qpe);
+ caid = parent.getString(COLUMN_PARENTID);
+ }
+ finally
+ {
+ parent.close();
+ }
+ }
+ while (!caid.equals(Constants.ROOT_PARENT_UUID));
+
+ QPathEntry[] qentries = new QPathEntry[qrpath.size()];
+ int qi = 0;
+ for (int i = qrpath.size() - 1; i >= 0; i--)
+ {
+ qentries[qi++] = qrpath.get(i);
+ }
+ return new QPath(qentries);
+ }
+
+ /**
+ * ItemLocationInfo.
+ *
+ */
+ class ItemLocationInfo
+ {
+ /**
+ * Item qpath
+ */
+ final QPath qpath;
+
+ /**
+ * All ancestors of the item with qpath
+ */
+ final List<String> ancestors;
+
+ /**
+ * Item id.
+ */
+ final String itemId;
+
+ /**
+ * ItemLocationInfo constructor.
+ *
+ * @param qpath
+ * Item path
+ * @param ancestors
+ * ancesstors id list
+ * @param itemId
+ * Item id
+ */
+ ItemLocationInfo(QPath qpath, List<String> ancestors, String itemId)
+ {
+ this.qpath = qpath;
+ this.ancestors = ancestors;
+ this.itemId = itemId;
+ }
+ }
+
+ /**
+ * Find ancestor permissions by cpid. Will search till find the permissions or meet a root node.
+ *
+ * @param cpid
+ * - initial parent node id
+ * @return Collection<String>
+ * @throws SQLException
+ * if database error
+ * @throws IllegalACLException
+ * if wrong ACL
+ * @throws IllegalNameException
+ * if wrong QName
+ * @throws RepositoryException
+ * if Repository error
+ */
+ private List<AccessControlEntry> traverseACLPermissions(String cpid) throws SQLException, IllegalACLException,
+ IllegalNameException, RepositoryException
+ {
+ String caid = cpid;
+ while (!caid.equals(Constants.ROOT_PARENT_UUID))
+ {
+ MixinInfo naMixins = readMixins(caid);
+ if (naMixins.hasPrivilegeable())
+ return readACLPermisions(caid);
+
+ if (naMixins.parentId == null)
+ caid = findParentId(caid);
+ else
+ caid = naMixins.parentId;
+ }
+
+ throw new IllegalACLException("Can not find permissions for a node with id " + getIdentifier(cpid));
+ }
+
+ protected String findParentId(String cid) throws SQLException, RepositoryException
+ {
+ ResultSet pidrs = findItemByIdentifier(cid);
+ try
+ {
+ if (pidrs.next())
+ return pidrs.getString(COLUMN_PARENTID);
+ else
+ throw new RepositoryException("Item not found id: " + getIdentifier(cid));
+ }
+ finally
+ {
+ pidrs.close();
+ }
+ }
+
+ /**
+ * Find ancestor owner by cpid. Will search till find the owner or meet a root node.
+ *
+ * @param cpid
+ * - initial parent node id
+ * @return owner name
+ * @throws SQLException
+ * if database error
+ * @throws IllegalACLException
+ * if wrong ACL
+ * @throws IllegalNameException
+ * if wrong QName
+ * @throws RepositoryException
+ * if Repository error
+ */
+ private String traverseACLOwner(String cpid) throws SQLException, IllegalACLException, IllegalNameException,
+ RepositoryException
+ {
+ String caid = cpid;
+
+ while (!caid.equals(Constants.ROOT_PARENT_UUID))
+ {
+ MixinInfo naMixins = readMixins(caid);
+ if (naMixins.hasOwneable())
+ return readACLOwner(caid);
+
+ if (naMixins.parentId == null)
+ caid = findParentId(caid);
+ else
+ caid = naMixins.parentId;
+ }
+
+ throw new IllegalACLException("Can not find owner for a node with id " + getIdentifier(cpid));
+ }
+
+ /**
+ * Find ancestor ACL by cpid. Will search till find the ACL or meet a root node.
+ *
+ * @param cpid
+ * - initial parent node id
+ * @return owner name
+ * @throws SQLException
+ * if database error
+ * @throws IllegalACLException
+ * if wrong ACL
+ * @throws IllegalNameException
+ * if wrong QName
+ * @throws RepositoryException
+ * if Repository error
+ */
+ private AccessControlList traverseACL(String cpid) throws SQLException, IllegalACLException, IllegalNameException,
+ RepositoryException
+ {
+ String naOwner = null;
+ List<AccessControlEntry> naPermissions = null;
+
+ String caid = cpid;
+
+ while (!caid.equals(Constants.ROOT_PARENT_UUID))
+ {
+ MixinInfo naMixins = readMixins(caid);
+ if (naOwner == null && naMixins.hasOwneable())
+ {
+ naOwner = readACLOwner(caid);
+ if (naPermissions != null)
+ break;
+ }
+ if (naPermissions == null && naMixins.hasPrivilegeable())
+ {
+ naPermissions = readACLPermisions(caid);
+ if (naOwner != null)
+ break;
+ }
+
+ if (naMixins.parentId == null)
+ caid = findParentId(caid);
+ else
+ caid = naMixins.parentId;
+ }
+
+ if (naOwner != null && naPermissions != null)
+ {
+ // got all
+ return new AccessControlList(naOwner, naPermissions);
+ }
+ else if (naOwner == null && naPermissions == null)
+ {
+ // Default values (i.e. ACL is disabled in repository)
+ return new AccessControlList();
+ }
+ else
+ throw new IllegalACLException("ACL is not found for node with id " + getIdentifier(cpid)
+ + " or for its ancestors. But repository is ACL enabled.");
+ }
+
+ /**
+ * [PN] Experimental. Use SP for traversing Qpath on the database server side. Hm, I haven't a
+ * good result for that yet. Few seconds only for TCK execution. PGSQL SP: CREATE OR REPLACE
+ * FUNCTION get_qpath(parentId VARCHAR) RETURNS SETOF record AS $$ DECLARE cur_item RECORD; cur_id
+ * varchar; BEGIN cur_id := parentId; WHILE NOT cur_id = ' ' LOOP SELECT id, name, parent_id,
+ * i_index INTO cur_item FROM JCR_SITEM WHERE ID=cur_id; IF NOT found THEN RETURN; END IF; RETURN
+ * NEXT cur_item; cur_id := cur_item.parent_id; END LOOP; RETURN; END; $$ LANGUAGE plpgsql;
+ *
+ * @param cpid
+ * @return
+ * @throws SQLException
+ * if database error
+ * @throws InvalidItemStateException
+ * if Item state is obsolete
+ * @throws IllegalNameException
+ * if invalid QName
+ */
+ private QPath traverseQPath_SP_PGSQL(String cpid) throws SQLException, InvalidItemStateException,
+ IllegalNameException
+ {
+ // get item by Identifier usecase:
+ // find parent path in db by cpid
+ if (cpid == null)
+ {
+ // root node
+ return null; // Constants.ROOT_PATH
+ }
+ else
+ {
+ List<QPathEntry> qrpath = new ArrayList<QPathEntry>(); // reverted path
+ PreparedStatement cstmt = null;
+ try
+ {
+ cstmt =
+ dbConnection
+ .prepareStatement("select * from get_qpath(?) AS (id varchar, name varchar, parent_id varchar, i_index int)");
+ cstmt.setString(1, cpid);
+ // cstmt.setString(2, caid);
+ ResultSet parent = cstmt.executeQuery();
+
+ while (parent.next())
+ {
+ QPathEntry qpe =
+ new QPathEntry(InternalQName.parse(parent.getString(COLUMN_NAME)), parent.getInt(COLUMN_INDEX));
+ qrpath.add(qpe);
+ }
+
+ // parent = findItemByIdentifier(caid);
+ if (qrpath.size() <= 0)
+ throw new InvalidItemStateException("Parent not found, uuid: " + getIdentifier(cpid));
+ }
+ finally
+ {
+ if (cstmt != null)
+ cstmt.close();
+ }
+
+ QPathEntry[] qentries = new QPathEntry[qrpath.size()];
+ int qi = 0;
+ for (int i = qrpath.size() - 1; i >= 0; i--)
+ {
+ qentries[qi++] = qrpath.get(i);
+ }
+ return new QPath(qentries);
+ }
+ }
+
+ /**
+ * Build ItemData.
+ *
+ * @param parentPath
+ * - parent path
+ * @param item
+ * database - ResultSet with Item record(s)
+ * @param itemClass
+ * - Item type (Node or Property)
+ * @param parentACL
+ * - parent ACL
+ * @return ItemData instance
+ * @throws RepositoryException
+ * Repository error
+ * @throws SQLException
+ * database error
+ * @throws IOException
+ * I/O error
+ */
+ private ItemData itemData(QPath parentPath, ResultSet item, int itemClass, AccessControlList parentACL)
+ throws RepositoryException, SQLException, IOException
+ {
+ String cid = item.getString(COLUMN_ID);
+ String cname = item.getString(COLUMN_NAME);
+ int cversion = item.getInt(COLUMN_VERSION);
+
+ String cpid = item.getString(COLUMN_PARENTID);
+ // if parent ID is empty string - it's a root node
+ // cpid = cpid.equals(Constants.ROOT_PARENT_UUID) ? null : cpid;
+
+ try
+ {
+ if (itemClass == I_CLASS_NODE)
+ {
+ int cindex = item.getInt(COLUMN_INDEX);
+ int cnordernumb = item.getInt(COLUMN_NORDERNUM);
+ return loadNodeRecord(parentPath, cname, cid, cpid, cindex, cversion, cnordernumb, parentACL);
+ }
+
+ int cptype = item.getInt(COLUMN_PTYPE);
+ boolean cpmultivalued = item.getBoolean(COLUMN_PMULTIVALUED);
+ return loadPropertyRecord(parentPath, cname, cid, cpid, cversion, cptype, cpmultivalued);
+ }
+ catch (InvalidItemStateException e)
+ {
+ throw new InvalidItemStateException("FATAL: Can't build item path for name " + cname + " id: "
+ + getIdentifier(cid) + ". " + e);
+ }
+ }
+
+ /**
+ * Read property data without value data. For listChildPropertiesData(NodeData).
+ *
+ * @param parentPath
+ * - parent path
+ * @param item
+ * database - ResultSet with Item record(s)
+ * @return PropertyData instance
+ * @throws RepositoryException
+ * Repository error
+ * @throws SQLException
+ * database error
+ * @throws IOException
+ * I/O error
+ */
+ private PropertyData propertyData(QPath parentPath, ResultSet item) throws RepositoryException, SQLException,
+ IOException
+ {
+ String cid = item.getString(COLUMN_ID);
+ String cname = item.getString(COLUMN_NAME);
+ int cversion = item.getInt(COLUMN_VERSION);
+ String cpid = item.getString(COLUMN_PARENTID);
+ int cptype = item.getInt(COLUMN_PTYPE);
+ boolean cpmultivalued = item.getBoolean(COLUMN_PMULTIVALUED);
+
+ try
+ {
+ InternalQName qname = InternalQName.parse(cname);
+
+ QPath qpath = QPath.makeChildPath(parentPath == null ? traverseQPath(cpid) : parentPath, qname);
+
+ PersistedPropertyData pdata =
+ new PersistedPropertyData(getIdentifier(cid), qpath, getIdentifier(cpid), cversion, cptype, cpmultivalued,
+ new ArrayList<ValueData>());
+
+ return pdata;
+ }
+ catch (InvalidItemStateException e)
+ {
+ throw new InvalidItemStateException("FATAL: Can't build property path for name " + cname + " id: "
+ + getIdentifier(cid) + ". " + e);
+ }
+ catch (IllegalNameException e)
+ {
+ throw new RepositoryException(e);
+ }
+ }
+
+ /**
+ * Mixin types description (internal use).
+ *
+ */
+ class MixinInfo
+ {
+
+ /**
+ * OWNEABLE constant.
+ */
+ static final int OWNEABLE = 0x0001; // bits 0001
+
+ /**
+ * PRIVILEGEABLE constant.
+ */
+ static final int PRIVILEGEABLE = 0x0002; // bits 0010
+
+ /**
+ * OWNEABLE_PRIVILEGEABLE constant.
+ */
+ static final int OWNEABLE_PRIVILEGEABLE = OWNEABLE | PRIVILEGEABLE; // bits 0011
+
+ /**
+ * Mixin types.
+ */
+ final List<InternalQName> mixinTypes;
+
+ /**
+ * oexo:owneable flag.
+ */
+ final boolean owneable;
+
+ /**
+ * exo:privilegeable flag.
+ */
+ final boolean privilegeable;
+
+ /**
+ * Parent Id.
+ */
+ final String parentId = null;
+
+ /**
+ * MixinInfo constructor.
+ *
+ * @param mixinTypes
+ * mixin types
+ * @param owneable
+ * exo:owneable flag
+ * @param privilegeable
+ * exo:privilegeable flag
+ */
+ MixinInfo(List<InternalQName> mixinTypes, boolean owneable, boolean privilegeable)
+ {
+ this.mixinTypes = mixinTypes;
+ this.owneable = owneable;
+ this.privilegeable = privilegeable;
+ }
+
+ /**
+ * Return Mixin names array.
+ *
+ * @return InternalQName[] Mixin names array
+ */
+ InternalQName[] mixinNames()
+ {
+ if (mixinTypes != null)
+ {
+ InternalQName[] mns = new InternalQName[mixinTypes.size()];
+ mixinTypes.toArray(mns);
+ return mns;
+ }
+ else
+ return new InternalQName[0];
+ }
+
+ /**
+ * Tell is exo:privilegeable.
+ *
+ * @return boolean
+ */
+ boolean hasPrivilegeable()
+ {
+ return privilegeable;
+ }
+
+ /**
+ * Tell is exo:owneable.
+ *
+ * @return boolean
+ */
+ boolean hasOwneable()
+ {
+ return owneable;
+ }
+ }
+
+ /**
+ * Read mixins from database.
+ *
+ * @param cid
+ * - Item id (internal)
+ * @return MixinInfo
+ * @throws SQLException
+ * database error
+ * @throws IllegalNameException
+ * if nodetype name in mixin record is wrong
+ */
+ protected MixinInfo readMixins(String cid) throws SQLException, IllegalNameException
+ {
+ ResultSet mtrs = findPropertyByName(cid, Constants.JCR_MIXINTYPES.getAsString());
+
+ try
+ {
+ List<InternalQName> mts = null;
+ boolean owneable = false;
+ boolean privilegeable = false;
+ if (mtrs.next())
+ {
+ mts = new ArrayList<InternalQName>();
+ do
+ {
+ byte[] mxnb = mtrs.getBytes(COLUMN_VDATA);
+ if (mxnb != null)
+ {
+ InternalQName mxn = InternalQName.parse(new String(mxnb));
+ mts.add(mxn);
+
+ if (!privilegeable && Constants.EXO_PRIVILEGEABLE.equals(mxn))
+ privilegeable = true;
+ else if (!owneable && Constants.EXO_OWNEABLE.equals(mxn))
+ owneable = true;
+ } // else, if SQL NULL - skip it
+ }
+ while (mtrs.next());
+ }
+
+ return new MixinInfo(mts, owneable, privilegeable);
+ }
+ finally
+ {
+ mtrs.close();
+ }
+ }
+
+ /**
+ * Return permission values or throw an exception. We assume the node is mix:privilegeable.
+ *
+ * @param cid
+ * Node id
+ * @return list of ACL entries
+ * @throws SQLException
+ * database error
+ * @throws IllegalACLException
+ * if property exo:permissions is not found for node
+ */
+ protected List<AccessControlEntry> readACLPermisions(String cid) throws SQLException, IllegalACLException
+ {
+ List<AccessControlEntry> naPermissions = new ArrayList<AccessControlEntry>();
+ ResultSet exoPerm = findPropertyByName(cid, Constants.EXO_PERMISSIONS.getAsString());
+ try
+ {
+ if (exoPerm.next())
+ {
+ do
+ {
+ StringTokenizer parser =
+ new StringTokenizer(new String(exoPerm.getBytes(COLUMN_VDATA)), AccessControlEntry.DELIMITER);
+ naPermissions.add(new AccessControlEntry(parser.nextToken(), parser.nextToken()));
+ }
+ while (exoPerm.next());
+
+ return naPermissions;
+ }
+ else
+ throw new IllegalACLException("Property exo:permissions is not found for node with id: "
+ + getIdentifier(cid));
+ }
+ finally
+ {
+ exoPerm.close();
+ }
+ }
+
+ /**
+ * Return owner value or throw an exception. We assume the node is mix:owneable.
+ *
+ * @param cid
+ * Node id
+ * @return ACL owner
+ * @throws SQLException
+ * database error
+ * @throws IllegalACLException
+ * Property exo:owner is not found for node
+ */
+ protected String readACLOwner(String cid) throws SQLException, IllegalACLException
+ {
+ ResultSet exoOwner = findPropertyByName(cid, Constants.EXO_OWNER.getAsString());
+ try
+ {
+ if (exoOwner.next())
+ return new String(exoOwner.getBytes(COLUMN_VDATA));
+ else
+ throw new IllegalACLException("Property exo:owner is not found for node with id: " + getIdentifier(cid));
+ }
+ finally
+ {
+ exoOwner.close();
+ }
+ }
+
+ /**
+ * Load NodeData record.
+ *
+ * @param parentPath
+ * parent path
+ * @param cname
+ * Node name
+ * @param cid
+ * Node id
+ * @param cpid
+ * Node parent id
+ * @param cindex
+ * Node index
+ * @param cversion
+ * Node persistent version
+ * @param cnordernumb
+ * Node order number
+ * @param parentACL
+ * Node parent ACL
+ * @return PersistedNodeData
+ * @throws RepositoryException
+ * Repository error
+ * @throws SQLException
+ * database error
+ */
+ protected PersistedNodeData loadNodeRecord(QPath parentPath, String cname, String cid, String cpid, int cindex,
+ int cversion, int cnordernumb, AccessControlList parentACL) throws RepositoryException, SQLException
+ {
+
+ try
+ {
+ InternalQName qname = InternalQName.parse(cname);
+
+ QPath qpath;
+ String parentCid;
+ if (parentPath != null)
+ {
+ // get by parent and name
+ qpath = QPath.makeChildPath(parentPath, qname, cindex);
+ parentCid = cpid;
+ }
+ else
+ {
+ // get by id
+ if (cpid.equals(Constants.ROOT_PARENT_UUID))
+ {
+ // root node
+ qpath = Constants.ROOT_PATH;
+ parentCid = null;
+ }
+ else
+ {
+ qpath = QPath.makeChildPath(traverseQPath(cpid), qname, cindex);
+ parentCid = cpid;
+ }
+ }
+
+ try
+ {
+ // PRIMARY
+ ResultSet ptProp = findPropertyByName(cid, Constants.JCR_PRIMARYTYPE.getAsString());
+
+ if (!ptProp.next())
+ throw new PrimaryTypeNotFoundException("FATAL ERROR primary type record not found. Node "
+ + qpath.getAsString() + ", id " + cid + ", container " + this.containerName, null);
+
+ byte[] data = ptProp.getBytes(COLUMN_VDATA);
+ InternalQName ptName = InternalQName.parse(new String((data != null ? data : new byte[]{})));
+
+ // MIXIN
+ MixinInfo mixins = readMixins(cid);
+
+ // ACL
+ AccessControlList acl; // NO DEFAULT values!
+
+ if (mixins.hasOwneable())
+ {
+ // has own owner
+ if (mixins.hasPrivilegeable())
+ {
+ // and permissions
+ acl = new AccessControlList(readACLOwner(cid), readACLPermisions(cid));
+ }
+ else if (parentACL != null)
+ {
+ // use permissions from existed parent
+ acl =
+ new AccessControlList(readACLOwner(cid), parentACL.hasPermissions() ? parentACL
+ .getPermissionEntries() : null);
+ }
+ else
+ {
+ // have to search nearest ancestor permissions in ACL manager
+ // acl = new AccessControlList(readACLOwner(cid), traverseACLPermissions(cpid));
+ acl = new AccessControlList(readACLOwner(cid), null);
+ }
+ }
+ else if (mixins.hasPrivilegeable())
+ {
+ // has own permissions
+ if (mixins.hasOwneable())
+ {
+ // and owner
+ acl = new AccessControlList(readACLOwner(cid), readACLPermisions(cid));
+ }
+ else if (parentACL != null)
+ {
+ // use owner from existed parent
+ acl = new AccessControlList(parentACL.getOwner(), readACLPermisions(cid));
+ }
+ else
+ {
+ // have to search nearest ancestor owner in ACL manager
+ // acl = new AccessControlList(traverseACLOwner(cpid), readACLPermisions(cid));
+ acl = new AccessControlList(null, readACLPermisions(cid));
+ }
+ }
+ else
+ {
+ if (parentACL != null)
+ // construct ACL from existed parent ACL
+ acl =
+ new AccessControlList(parentACL.getOwner(), parentACL.hasPermissions() ? parentACL
+ .getPermissionEntries() : null);
+ else
+ // have to search nearest ancestor owner and permissions in ACL manager
+ // acl = traverseACL(cpid);
+ acl = null;
+ }
+
+ return new PersistedNodeData(getIdentifier(cid), qpath, getIdentifier(parentCid), cversion, cnordernumb,
+ ptName, mixins.mixinNames(), acl);
+ }
+ catch (IllegalACLException e)
+ {
+ throw new RepositoryException("FATAL ERROR Node " + getIdentifier(cid) + " " + qpath.getAsString()
+ + " has wrong formed ACL. ", e);
+ }
+ }
+ catch (IllegalNameException e)
+ {
+ throw new RepositoryException(e);
+ }
+ }
+
+ /**
+ * Load PropertyData record.
+ *
+ * @param parentPath
+ * parent path
+ * @param cname
+ * Property name
+ * @param cid
+ * Property id
+ * @param cpid
+ * Property parent id
+ * @param cversion
+ * Property persistent verison
+ * @param cptype
+ * Property type
+ * @param cpmultivalued
+ * Property multivalued status
+ * @return PersistedPropertyData
+ * @throws RepositoryException
+ * Repository error
+ * @throws SQLException
+ * database error
+ * @throws IOException
+ * I/O error
+ */
+ protected PersistedPropertyData loadPropertyRecord(QPath parentPath, String cname, String cid, String cpid,
+ int cversion, int cptype, boolean cpmultivalued) throws RepositoryException, SQLException, IOException
+ {
+
+ // NOTE: cpid never should be null or root parent (' ')
+
+ try
+ {
+ QPath qpath =
+ QPath.makeChildPath(parentPath == null ? traverseQPath(cpid) : parentPath, InternalQName.parse(cname));
+
+ String identifier = getIdentifier(cid);
+ List<ValueData> values = readValues(cid, identifier, cversion);
+ PersistedPropertyData pdata =
+ new PersistedPropertyData(identifier, qpath, getIdentifier(cpid), cversion, cptype, cpmultivalued, values);
+
+ return pdata;
+ }
+ catch (IllegalNameException e)
+ {
+ throw new RepositoryException(e);
+ }
+ }
+
+ protected PersistedNodeData loadNodeRecord(ResultSet item, QPath parentPath, AccessControlList pACL)
+ throws RepositoryException, SQLException, IOException
+ {
+
+ String cid = item.getString(COLUMN_ID);
+ String cname = item.getString(COLUMN_NAME);
+ int cversion = item.getInt(COLUMN_VERSION);
+ String cpid = item.getString(COLUMN_PARENTID);
+ int cindex = item.getInt(COLUMN_INDEX);
+ int cnordernumb = item.getInt(COLUMN_NORDERNUM);
+ AccessControlList parentACL = pACL;
+
+ try
+ {
+ InternalQName qname = InternalQName.parse(cname);
+
+ // TODO can't avoid QPath traverse
+ QPath qpath;
+ String parentCid;
+ if (parentPath != null)
+ {
+ // get by parent and name
+ qpath = QPath.makeChildPath(parentPath, qname, cindex);
+ parentCid = cpid;
+ }
+ else
+ {
+ // get by id
+ if (cpid.equals(Constants.ROOT_PARENT_UUID))
+ {
+ // root node
+ qpath = Constants.ROOT_PATH;
+ parentCid = null;
+ }
+ else
+ {
+ qpath = QPath.makeChildPath(traverseQPath(cpid), qname, cindex);
+ parentCid = cpid;
+ }
+ }
+
+ // preload properties
+
+ Map<String, List<byte[]>> properties = new LinkedHashMap<String, List<byte[]>>();
+
+ // PRIMARY
+ if (!item.next() || !item.getString(COLUMN_NAME).equals(Constants.JCR_PRIMARYTYPE.getAsString()))
+ {
+ throw new SQLException("Node finded but primaryType property not " + cid);
+ }
+
+ byte[] data = item.getBytes(COLUMN_VDATA);
+ InternalQName ptName = InternalQName.parse(new String((data != null ? data : new byte[]{})));
+
+ // // PRIMARY
+ // ResultSet ptProp = findPropertyByName(cid, Constants.JCR_PRIMARYTYPE.getAsString());
+ //
+ // if (!ptProp.next())
+ // throw new PrimaryTypeNotFoundException("FATAL ERROR primary type record not found. Node "
+ // + qpath.getAsString() + ", id " + cid + ", container " + this.containerName, null);
+ //
+ // byte[] data = ptProp.getBytes(COLUMN_VDATA);
+ // InternalQName ptName = InternalQName.parse(new String((data != null ? data : new byte[]{})));
+
+ // MIXIN
+ MixinInfo mixins = null;
+ List<InternalQName> mts = null;
+ boolean owneable = false;
+ boolean privilegeable = false;
+ while (item.next() && item.getString(COLUMN_NAME).equals(Constants.JCR_MIXINTYPES.getAsString()))
+ {
+ mts = new ArrayList<InternalQName>();
+ byte[] mxnb = item.getBytes(COLUMN_VDATA);
+ if (mxnb != null)
+ {
+ InternalQName mxn = InternalQName.parse(new String(mxnb));
+ mts.add(mxn);
+
+ if (!privilegeable && Constants.EXO_PRIVILEGEABLE.equals(mxn))
+ privilegeable = true;
+ else if (!owneable && Constants.EXO_OWNEABLE.equals(mxn))
+ owneable = true;
+ } // else, if SQL NULL - skip it
+
+ }
+
+ mixins = new MixinInfo(mts, owneable, privilegeable);
+
+ try
+ {
+ // ACL
+ AccessControlList acl; // NO DEFAULT values!
+
+ if (mixins.hasOwneable())
+ {
+ // has own owner
+ if (mixins.hasPrivilegeable())
+ {
+ // and permissions
+ acl = new AccessControlList(readACLOwner(cid), readACLPermisions(cid));
+ }
+ else if (parentACL != null)
+ {
+ // use permissions from existed parent
+ acl =
+ new AccessControlList(readACLOwner(cid), parentACL.hasPermissions() ? parentACL
+ .getPermissionEntries() : null);
+ }
+ else
+ {
+ // have to search nearest ancestor permissions in ACL manager
+ // acl = new AccessControlList(readACLOwner(cid), traverseACLPermissions(cpid));
+ acl = new AccessControlList(readACLOwner(cid), null);
+ }
+ }
+ else if (mixins.hasPrivilegeable())
+ {
+ // has own permissions
+ if (mixins.hasOwneable())
+ {
+ // and owner
+ acl = new AccessControlList(readACLOwner(cid), readACLPermisions(cid));
+ }
+ else if (parentACL != null)
+ {
+ // use owner from existed parent
+ acl = new AccessControlList(parentACL.getOwner(), readACLPermisions(cid));
+ }
+ else
+ {
+ // have to search nearest ancestor owner in ACL manager
+ // acl = new AccessControlList(traverseACLOwner(cpid), readACLPermisions(cid));
+ acl = new AccessControlList(null, readACLPermisions(cid));
+ }
+ }
+ else
+ {
+ if (parentACL != null)
+ // construct ACL from existed parent ACL
+ acl =
+ new AccessControlList(parentACL.getOwner(), parentACL.hasPermissions() ? parentACL
+ .getPermissionEntries() : null);
+ else
+ // have to search nearest ancestor owner and permissions in ACL manager
+ // acl = traverseACL(cpid);
+ acl = null;
+ }
+
+ return new PersistedNodeData(getIdentifier(cid), qpath, getIdentifier(parentCid), cversion, cnordernumb,
+ ptName, mixins.mixinNames(), acl);
+
+ }
+ catch (IllegalACLException e)
+ {
+ throw new RepositoryException("FATAL ERROR Node " + getIdentifier(cid) + " " + qpath.getAsString()
+ + " has wrong formed ACL. ", e);
+ }
+ }
+ catch (IllegalNameException e)
+ {
+ throw new RepositoryException(e);
+ }
+ }
+
+ protected PersistedNodeData loadNodeFromTemporaryNodeData(TempNodeData buf, QPath parentPath, AccessControlList pACL)
+ throws RepositoryException, SQLException, IOException
+ {
+
+ String cid = buf.cid;
+ String cname = buf.cname;
+ int cversion = buf.cversion;
+ String cpid = buf.cpid;
+ int cindex = buf.cindex;
+ int cnordernumb = buf.cnordernumb;
+ AccessControlList parentACL = pACL;
+
+ try
+ {
+ InternalQName qname = InternalQName.parse(cname);
+
+ // TODO can't avoid QPath traverse
+ QPath qpath;
+ String parentCid;
+ if (parentPath != null)
+ {
+ // get by parent and name
+ qpath = QPath.makeChildPath(parentPath, qname, cindex);
+ parentCid = cpid;
+ }
+ else
+ {
+ // get by id
+ if (cpid.equals(Constants.ROOT_PARENT_UUID))
+ {
+ // root node
+ qpath = Constants.ROOT_PATH;
+ parentCid = null;
+ }
+ else
+ {
+ qpath = QPath.makeChildPath(traverseQPath(cpid), qname, cindex);
+ parentCid = cpid;
+ }
+ }
+
+ // PRIMARY
+
+ List<byte[]> primaryType = buf.properties.get(Constants.JCR_PRIMARYTYPE.getAsString());
+ if (primaryType == null || primaryType.size() == 0)
+ {
+ throw new SQLException("Node finded but primaryType property not " + cid);
+ }
+
+ byte[] data = primaryType.get(0);
+ InternalQName ptName = InternalQName.parse(new String((data != null ? data : new byte[]{})));
+
+ // MIXIN
+ MixinInfo mixins = null;
+ List<InternalQName> mts = null;
+ boolean owneable = false;
+ boolean privilegeable = false;
+ List<byte[]> mixinTypes = buf.properties.get(Constants.JCR_MIXINTYPES.getAsString());
+ if (mixinTypes != null)
+ {
+ mts = new ArrayList<InternalQName>();
+ for (byte[] mxnb : mixinTypes)
+ {
+ InternalQName mxn = InternalQName.parse(new String(mxnb));
+ mts.add(mxn);
+
+ if (!privilegeable && Constants.EXO_PRIVILEGEABLE.equals(mxn))
+ privilegeable = true;
+ else if (!owneable && Constants.EXO_OWNEABLE.equals(mxn))
+ owneable = true;
+ }
+ }
+
+ mixins = new MixinInfo(mts, owneable, privilegeable);
+
+ try
+ {
+ // ACL
+ AccessControlList acl; // NO DEFAULT values!
+
+ if (mixins.hasOwneable())
+ {
+ // has own owner
+ if (mixins.hasPrivilegeable())
+ {
+ // and permissions
+ acl = new AccessControlList(readACLOwner(cid), readACLPermisions(cid));
+ }
+ else if (parentACL != null)
+ {
+ // use permissions from existed parent
+ acl =
+ new AccessControlList(readACLOwner(cid), parentACL.hasPermissions() ? parentACL
+ .getPermissionEntries() : null);
+ }
+ else
+ {
+ // have to search nearest ancestor permissions in ACL manager
+ // acl = new AccessControlList(readACLOwner(cid), traverseACLPermissions(cpid));
+ acl = new AccessControlList(readACLOwner(cid), null);
+ }
+ }
+ else if (mixins.hasPrivilegeable())
+ {
+ // has own permissions
+ if (mixins.hasOwneable())
+ {
+ // and owner
+ acl = new AccessControlList(readACLOwner(cid), readACLPermisions(cid));
+ }
+ else if (parentACL != null)
+ {
+ // use owner from existed parent
+ acl = new AccessControlList(parentACL.getOwner(), readACLPermisions(cid));
+ }
+ else
+ {
+ // have to search nearest ancestor owner in ACL manager
+ // acl = new AccessControlList(traverseACLOwner(cpid), readACLPermisions(cid));
+ acl = new AccessControlList(null, readACLPermisions(cid));
+ }
+ }
+ else
+ {
+ if (parentACL != null)
+ // construct ACL from existed parent ACL
+ acl =
+ new AccessControlList(parentACL.getOwner(), parentACL.hasPermissions() ? parentACL
+ .getPermissionEntries() : null);
+ else
+ // have to search nearest ancestor owner and permissions in ACL manager
+ // acl = traverseACL(cpid);
+ acl = null;
+ }
+
+ return new PersistedNodeData(getIdentifier(cid), qpath, getIdentifier(parentCid), cversion, cnordernumb,
+ ptName, mixins.mixinNames(), acl);
+
+ }
+ catch (IllegalACLException e)
+ {
+ throw new RepositoryException("FATAL ERROR Node " + getIdentifier(cid) + " " + qpath.getAsString()
+ + " has wrong formed ACL. ", e);
+ }
+ }
+ catch (IllegalNameException e)
+ {
+ throw new RepositoryException(e);
+ }
+ }
+
+ protected PersistedPropertyData loadPropertyRecord(ResultSet item, QPath parentPath) throws RepositoryException,
+ SQLException, IOException
+ {
+ String cid = item.getString(COLUMN_ID);
+ String cname = item.getString(COLUMN_NAME);
+ int cversion = item.getInt(COLUMN_VERSION);
+
+ String cpid = item.getString(COLUMN_PARENTID);
+ // if parent ID is empty string - it's a root node
+ // cpid = cpid.equals(Constants.ROOT_PARENT_UUID) ? null : cpid;
+
+ try
+ {
+ int cptype = item.getInt(COLUMN_PTYPE);
+ boolean cpmultivalued = item.getBoolean(COLUMN_PMULTIVALUED);
+ try
+ {
+ QPath qpath =
+ QPath.makeChildPath(parentPath == null ? traverseQPath(cpid) : parentPath, InternalQName.parse(cname));
+
+ List<ValueData> data = new ArrayList<ValueData>();
+
+ String identifier = getIdentifier(cid);
+
+ do
+ {
+ final int orderNum = item.getInt(COLUMN_VORDERNUM);
+ final String storageId = item.getString(COLUMN_VSTORAGE_DESC);
+ ValueData vdata =
+ item.wasNull() ? readValueData(cid, orderNum, cversion, item.getBinaryStream(COLUMN_VDATA))
+ : readValueData(identifier, orderNum, storageId);
+ data.add(vdata);
+ }
+ while (item.next() && item.getString(COLUMN_ID) == cid);
+
+ PersistedPropertyData pdata =
+ new PersistedPropertyData(identifier, qpath, getIdentifier(cpid), cversion, cptype, cpmultivalued, data);
+
+ return pdata;
+ }
+ catch (IllegalNameException e)
+ {
+ throw new RepositoryException(e);
+ }
+ }
+ catch (InvalidItemStateException e)
+ {
+ throw new InvalidItemStateException("FATAL: Can't build item path for name " + cname + " id: "
+ + getIdentifier(cid) + ". " + e);
+ }
+ }
+
+ /**
+ * Delete Property Values.
+ *
+ * @param cid
+ * Property id
+ * @param pdata
+ * PropertyData
+ * @param update
+ * boolean true if it's delete-add sequence (update operation)
+ * @throws IOException
+ * i/O error
+ * @throws SQLException
+ * if database error occurs
+ * @throws ValueStorageNotFoundException
+ * if no such storage found with Value storageId
+ */
+ private void deleteValues(String cid, PropertyData pdata, boolean update) throws IOException, SQLException,
+ ValueStorageNotFoundException
+ {
+
+ final ResultSet valueRecords = findValuesStorageDescriptorsByPropertyId(cid);
+ try
+ {
+ if (valueRecords.next())
+ {
+ // delete all Values in database
+ deleteValueData(cid);
+
+ do
+ {
+ final String storageId = valueRecords.getString(COLUMN_VSTORAGE_DESC);
+ if (!valueRecords.wasNull())
+ {
+ final ValueIOChannel channel = valueStorageProvider.getChannel(storageId);
+ try
+ {
+ channel.delete(pdata.getIdentifier());
+ valueChanges.add(channel);
+ }
+ finally
+ {
+ channel.close();
+ }
+ }
+ }
+ while (valueRecords.next());
+ }
+ }
+ finally
+ {
+ valueRecords.close();
+ }
+ }
+
+ /**
+ * Read Property Values.
+ *
+ * @param identifier
+ * property identifier
+ * @param cid
+ * Property id
+ * @param pdata
+ * PropertyData
+ * @return list of ValueData
+ * @throws IOException
+ * i/O error
+ * @throws SQLException
+ * if database errro occurs
+ * @throws ValueStorageNotFoundException
+ * if no such storage found with Value storageId
+ */
+ private List<ValueData> readValues(String cid, String identifier, int cversion) throws IOException, SQLException,
+ ValueStorageNotFoundException
+ {
+
+ List<ValueData> data = new ArrayList<ValueData>();
+
+ final ResultSet valueRecords = findValuesByPropertyId(cid);
+ try
+ {
+ while (valueRecords.next())
+ {
+ final int orderNum = valueRecords.getInt(COLUMN_VORDERNUM);
+ final String storageId = valueRecords.getString(COLUMN_VSTORAGE_DESC);
+ ValueData vdata =
+ valueRecords.wasNull() ? readValueData(cid, orderNum, cversion, valueRecords
+ .getBinaryStream(COLUMN_VDATA)) : readValueData(identifier, orderNum, storageId);
+ data.add(vdata);
+ }
+ }
+ finally
+ {
+ valueRecords.close();
+ }
+
+ return data;
+ }
+
+ /**
+ * Read ValueData from External Storage.
+ *
+ * @param pdata
+ * PropertyData
+ * @param orderNumber
+ * Value order number
+ * @param storageId
+ * external Value storage id
+ * @return ValueData
+ * @throws SQLException
+ * database error
+ * @throws IOException
+ * I/O error
+ * @throws ValueStorageNotFoundException
+ * if no such storage found with Value storageId
+ */
+ protected ValueData readValueData(String identifier, int orderNumber, String storageId) throws SQLException,
+ IOException, ValueStorageNotFoundException
+ {
+ ValueIOChannel channel = valueStorageProvider.getChannel(storageId);
+ try
+ {
+ return channel.read(identifier, orderNumber, maxBufferSize);
+ }
+ finally
+ {
+ channel.close();
+ }
+ }
+
+ /**
+ * Read ValueData from database.
+ *
+ * @param cid
+ * Property id
+ * @param orderNumber
+ * Value order number
+ * @param version
+ * persistent version (used for BLOB swapping)
+ * @param content
+ * @return ValueData
+ * @throws SQLException
+ * database error
+ * @throws IOException
+ * I/O error (swap)
+ */
+ protected ValueData readValueData(String cid, int orderNumber, int version, final InputStream content)
+ throws SQLException, IOException
+ {
+
+ ResultSet valueResultSet = null;
+
+ byte[] buffer = new byte[0];
+ byte[] spoolBuffer = new byte[ValueFileIOHelper.IOBUFFER_SIZE];
+ int read;
+ int len = 0;
+ OutputStream out = null;
+
+ SwapFile swapFile = null;
+ try
+ {
+ // stream from database
+ if (content != null)
+ while ((read = content.read(spoolBuffer)) >= 0)
+ {
+ if (out != null)
+ {
+ // spool to temp file
+ out.write(spoolBuffer, 0, read);
+ len += read;
+ }
+ else if (len + read > maxBufferSize)
+ {
+ // threshold for keeping data in memory exceeded;
+ // create temp file and spool buffer contents
+ swapFile = SwapFile.get(swapDirectory, cid + orderNumber + "." + version);
+ if (swapFile.isSpooled())
+ {
+ // break, value already spooled
+ buffer = null;
+ break;
+ }
+ out = new FileOutputStream(swapFile);
+ out.write(buffer, 0, len);
+ out.write(spoolBuffer, 0, read);
+ buffer = null;
+ len += read;
+ }
+ else
+ {
+ // reallocate new buffer and spool old buffer contents
+ byte[] newBuffer = new byte[len + read];
+ System.arraycopy(buffer, 0, newBuffer, 0, len);
+ System.arraycopy(spoolBuffer, 0, newBuffer, len, read);
+ buffer = newBuffer;
+ len += read;
+ }
+ }
+ }
+ finally
+ {
+ if (valueResultSet != null)
+ valueResultSet.close();
+ if (out != null)
+ {
+ out.close();
+ swapFile.spoolDone();
+ }
+ }
+
+ if (buffer == null)
+ return new CleanableFilePersistedValueData(orderNumber, swapFile, swapCleaner);
+
+ return new ByteArrayPersistedValueData(orderNumber, buffer);
+ }
+
+ /**
+ * Writes value data to swap file.
+ *
+ * @param cid
+ * Property id
+ * @param orderNumber
+ * Value order number
+ * @param version
+ * persistent version (used for BLOB swapping)
+ * @param content
+ * @return ValueData
+ * @throws SQLException
+ * database error
+ * @throws IOException
+ * I/O error (swap)
+ */
+ protected SwapFile swapValueData(String cid, int orderNumber, int version, final InputStream content)
+ throws SQLException, IOException
+ {
+
+ byte[] spoolBuffer = new byte[ValueFileIOHelper.IOBUFFER_SIZE];
+ int read;
+ int len = 0;
+
+ SwapFile swapFile = SwapFile.get(swapDirectory, cid + orderNumber + "." + version);
+ OutputStream out = new FileOutputStream(swapFile);;
+
+ if (swapFile.isSpooled())
+ {
+ return swapFile;
+ }
+
+ try
+ {
+ if (content != null)
+ while ((read = content.read(spoolBuffer)) >= 0)
+ {
+ // spool to temp file
+ out.write(spoolBuffer, 0, read);
+ len += read;
+ }
+ }
+ finally
+ {
+ out.close();
+ swapFile.spoolDone();
+ }
+
+ return swapFile;
+ }
+
+ /**
+ * Add Values to Property record.
+ *
+ * @param data
+ * PropertyData
+ * @throws SQLException
+ * database error
+ * @throws IOException
+ * I/O error
+ * @thorws RepositoryException if Value data large of JDBC accepted (Integer.MAX_VALUE)
+ */
+ protected void addValues(String cid, PropertyData data) throws IOException, SQLException, RepositoryException
+ {
+ List<ValueData> vdata = data.getValues();
+
+ for (int i = 0; i < vdata.size(); i++)
+ {
+ ValueData vd = vdata.get(i);
+ ValueIOChannel channel = valueStorageProvider.getApplicableChannel(data, i);
+ InputStream stream;
+ int streamLength;
+ String storageId;
+ if (channel == null)
+ {
+ // prepare write of Value in database
+ if (vd.isByteArray())
+ {
+ byte[] dataBytes = vd.getAsByteArray();
+ stream = new ByteArrayInputStream(dataBytes);
+ streamLength = dataBytes.length;
+ }
+ else
+ {
+ // it's StreamPersistedValueData
+ StreamPersistedValueData streamData = (StreamPersistedValueData)vd;
+ stream = streamData.getStream();
+
+ // TODO spool on JDBC driver read - multiplexing the data to two stores, database and spool file, with one read.
+ SwapFile swapFile = swapValueData(cid, i, data.getPersistedVersion(), stream);
+
+ long vlen = swapFile.length();
+ if (vlen < 0)
+ {
+ // TODO not actual with SwapFile, but if it will be reworked can be so
+ streamLength = stream.available();
+ LOG.warn("Cannot obtain exact Value data length, will use available from the stream " + streamLength
+ + ". Property " + data.getQPath().getAsString());
+ }
+ else if (vlen <= Integer.MAX_VALUE)
+ {
+ streamLength = (int)vlen;
+ }
+ else
+ {
+ throw new RepositoryException("Value data large of allowed by JDBC (Integer.MAX_VALUE) " + vlen
+ + ". Property " + data.getQPath().getAsString());
+ }
+
+ // set persistent file to ValueData, will be available for saving Property.
+ streamData.setPersistedFile(swapFile);
+ stream = streamData.getAsStream();
+ }
+ storageId = null;
+ }
+ else
+ {
+ // write Value in external VS
+ channel.write(data.getIdentifier(), vd);
+ valueChanges.add(channel);
+ storageId = channel.getStorageId();
+ stream = null;
+ streamLength = 0;
+ }
+ addValueData(cid, i, stream, streamLength, storageId);
+ }
+ }
+
+ protected abstract int addNodeRecord(NodeData data) throws SQLException;
+
+ protected abstract int addPropertyRecord(PropertyData prop) throws SQLException;
+
+ protected abstract ResultSet findItemByIdentifier(String identifier) throws SQLException;
+
+ protected abstract ResultSet findPropertyByName(String parentId, String name) throws SQLException;
+
+ protected abstract ResultSet findItemByName(String parentId, String name, int index) throws SQLException;
+
+ protected abstract ResultSet findChildNodesByParentIdentifier(String parentIdentifier) throws SQLException;
+
+ protected abstract ResultSet findChildNodesCountByParentIdentifier(String parentIdentifier) throws SQLException;
+
+ protected abstract ResultSet findChildPropertiesByParentIdentifier(String parentIdentifier) throws SQLException;
+
+ protected abstract int addReference(PropertyData data) throws SQLException, IOException;
+
+ protected abstract int renameNode(NodeData data) throws SQLException;
+
+ protected abstract int deleteReference(String propertyIdentifier) throws SQLException;
+
+ protected abstract ResultSet findReferences(String nodeIdentifier) throws SQLException;
+
+ protected abstract int deleteItemByIdentifier(String identifier) throws SQLException;
+
+ protected abstract int updateNodeByIdentifier(int version, int index, int orderNumb, String identifier)
+ throws SQLException;
+
+ protected abstract int updatePropertyByIdentifier(int version, int type, String identifier) throws SQLException;
+
+ // -------- values processing ------------
+ protected abstract int addValueData(String cid, int orderNumber, InputStream stream, int streamLength,
+ String storageId) throws SQLException;
+
+ protected abstract int deleteValueData(String cid) throws SQLException;
+
+ protected abstract ResultSet findValuesByPropertyId(String cid) throws SQLException;
+
+ protected abstract ResultSet findValuesStorageDescriptorsByPropertyId(String cid) throws SQLException;
+
+ @Deprecated
+ protected abstract ResultSet findValueByPropertyIdOrderNumber(String cid, int orderNumb) throws SQLException;
+
+ protected abstract ResultSet findItemByIdentifierNew(String identifier) throws SQLException;
+
+ protected abstract ResultSet findItemByNameNew(String parentId, String name, int index) throws SQLException;
+
+ protected abstract ResultSet findChildNodesByParentIdentifierNew(String parentIdentifier) throws SQLException;
+
+ protected abstract ResultSet getChildPropertiesByParentIdentifier(String parentIdentifier) throws SQLException;
+
+ protected abstract ResultSet findReferenceProperties(String parentIdentifier) throws SQLException;
+}
Added: jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/CQJDBCWorkspaceDataContainer.java
===================================================================
--- jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/CQJDBCWorkspaceDataContainer.java (rev 0)
+++ jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/CQJDBCWorkspaceDataContainer.java 2009-12-25 15:55:34 UTC (rev 1194)
@@ -0,0 +1,802 @@
+/*
+ * 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;
+
+import org.exoplatform.services.jcr.config.RepositoryConfigurationException;
+import org.exoplatform.services.jcr.config.RepositoryEntry;
+import org.exoplatform.services.jcr.config.WorkspaceEntry;
+import org.exoplatform.services.jcr.impl.storage.WorkspaceDataContainerBase;
+import org.exoplatform.services.jcr.impl.storage.jdbc.DBConstants;
+import org.exoplatform.services.jcr.impl.storage.jdbc.db.GenericConnectionFactory;
+import org.exoplatform.services.jcr.impl.storage.jdbc.db.OracleConnectionFactory;
+import org.exoplatform.services.jcr.impl.storage.jdbc.db.WorkspaceStorageConnectionFactory;
+import org.exoplatform.services.jcr.impl.storage.jdbc.init.DBInitializer;
+import org.exoplatform.services.jcr.impl.storage.jdbc.init.DBInitializerException;
+import org.exoplatform.services.jcr.impl.storage.jdbc.init.IngresSQLDBInitializer;
+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.optimisation.db.HSQLDBConnectionFactory;
+import org.exoplatform.services.jcr.impl.storage.jdbc.optimisation.db.MySQLConnectionFactory;
+import org.exoplatform.services.jcr.impl.storage.jdbc.update.StorageUpdateManager;
+import org.exoplatform.services.jcr.impl.util.io.FileCleaner;
+import org.exoplatform.services.jcr.storage.WorkspaceDataContainer;
+import org.exoplatform.services.jcr.storage.WorkspaceStorageConnection;
+import org.exoplatform.services.jcr.storage.value.ValueStoragePluginProvider;
+import org.exoplatform.services.log.ExoLogger;
+import org.exoplatform.services.log.Log;
+import org.exoplatform.services.naming.InitialContextInitializer;
+import org.picocontainer.Startable;
+
+import java.io.File;
+import java.io.IOException;
+import java.sql.Connection;
+
+import javax.jcr.RepositoryException;
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+import javax.sql.DataSource;
+
+/**
+ * Created by The eXo Platform SAS.
+ *
+ * @author <a href="mailto:peter.nedonosko@exoplatform.com.ua">Peter Nedonosko</a>
+ * @version $Id:GenericWorkspaceDataContainer.java 13433 2007-03-15 16:07:23Z peterit $
+ */
+public class CQJDBCWorkspaceDataContainer extends WorkspaceDataContainerBase implements Startable
+{
+
+ protected static final Log LOG = ExoLogger.getLogger("jcr.JDBCWorkspaceDataContainer");
+
+ //configuration params
+
+ public final static String SOURCE_NAME = "source-name";
+
+ public final static String MULTIDB = "multi-db";
+
+ public final static String SINGLEDB = "single-db";
+
+ /**
+ * Describe which type of RDBMS will be used (DB creation metadata etc.)
+ */
+ public final static String DB_DIALECT = "dialect";
+
+ public final static String DB_DRIVER = "driverClassName";
+
+ public final static String DB_URL = "url";
+
+ public final static String DB_USERNAME = "username";
+
+ public final static String DB_PASSWORD = "password";
+
+ protected final String containerName;
+
+ protected final String dbSourceName;
+
+ protected final boolean multiDb;
+
+ protected final String dbDriver;
+
+ protected final String dbDialect;
+
+ protected final String dbUrl;
+
+ protected final String dbUserName;
+
+ protected final String dbPassword;
+
+ protected final ValueStoragePluginProvider valueStorageProvider;
+
+ protected String storageVersion;
+
+ protected int maxBufferSize;
+
+ protected File swapDirectory;
+
+ protected FileCleaner swapCleaner;
+
+ protected GenericConnectionFactory connFactory;
+
+ /**
+ * Shared connection factory.
+ *
+ * Issued to share JDBC connection between system and regular workspace in case of same database
+ * used for storage.
+ *
+ */
+ class SharedConnectionFactory extends GenericConnectionFactory
+ {
+
+ /**
+ * JDBC connection.
+ */
+ final private Connection connection;
+
+ /**
+ * SharedConnectionFactory constructor.
+ *
+ * @param connection
+ * JDBC - connection
+ * @param containerName
+ * - container name
+ * @param multiDb
+ * - multidatabase status
+ * @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).
+ */
+ SharedConnectionFactory(Connection connection, String containerName, boolean multiDb,
+ ValueStoragePluginProvider valueStorageProvider, int maxBufferSize, File swapDirectory, FileCleaner swapCleaner)
+ {
+
+ super(null, null, null, null, null, containerName, multiDb, valueStorageProvider, maxBufferSize,
+ swapDirectory, swapCleaner);
+
+ this.connection = connection;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public Connection getJdbcConnection() throws RepositoryException
+ {
+ return connection;
+ }
+ }
+
+ /**
+ * Constructor with value storage plugins.
+ *
+ * @param wsConfig
+ * Workspace configuration
+ * @param valueStrorageProvider
+ * External Value Stprages provider
+ * @throws RepositoryConfigurationException
+ * if Repository configuration is wrong
+ * @throws NamingException
+ * if JNDI exception (on DataSource lookup)
+ */
+ public CQJDBCWorkspaceDataContainer(WorkspaceEntry wsConfig, RepositoryEntry repConfig,
+ InitialContextInitializer contextInit, ValueStoragePluginProvider valueStorageProvider)
+ throws RepositoryConfigurationException, NamingException, RepositoryException, IOException
+ {
+
+ checkIntegrity(wsConfig, repConfig);
+
+ this.containerName = wsConfig.getName();
+ this.multiDb = Boolean.parseBoolean(wsConfig.getContainer().getParameterValue(MULTIDB));
+ this.valueStorageProvider = valueStorageProvider;
+
+ // ------------- Database config ------------------
+ String pDbDialect = null;
+ try
+ {
+ pDbDialect = detectDialect(wsConfig.getContainer().getParameterValue(DB_DIALECT));
+ LOG.info("Using a dialect '" + pDbDialect + "'");
+ }
+ catch (RepositoryConfigurationException e)
+ {
+ LOG.info("Using a default dialect '" + DBConstants.DB_DIALECT_GENERIC + "'");
+ pDbDialect = DBConstants.DB_DIALECT_GENERIC;
+ }
+ this.dbDialect = pDbDialect;
+
+ String pDbDriver = null;
+ String pDbUrl = null;
+ String pDbUserName = null;
+ String pDbPassword = null;
+ try
+ {
+ pDbDriver = wsConfig.getContainer().getParameterValue(DB_DRIVER);
+
+ // username/passwd may not pesent
+ try
+ {
+ pDbUserName = wsConfig.getContainer().getParameterValue(DB_USERNAME);
+ pDbPassword = wsConfig.getContainer().getParameterValue(DB_PASSWORD);
+ }
+ catch (RepositoryConfigurationException e)
+ {
+ pDbUserName = pDbPassword = null;
+ }
+
+ pDbUrl = wsConfig.getContainer().getParameterValue(DB_URL); // last here!
+ }
+ catch (RepositoryConfigurationException e)
+ {
+ }
+
+ if (pDbUrl != null)
+ {
+ this.dbDriver = pDbDriver;
+ this.dbUrl = pDbUrl;
+ this.dbUserName = pDbUserName;
+ this.dbPassword = pDbPassword;
+ this.dbSourceName = null;
+ LOG.info("Connect to JCR database as user '" + this.dbUserName + "'");
+ }
+ else
+ {
+ this.dbDriver = null;
+ this.dbUrl = null;
+ this.dbUserName = null;
+ this.dbPassword = null;
+
+ String sn;
+ try
+ {
+ sn = wsConfig.getContainer().getParameterValue(SOURCE_NAME);
+ }
+ catch (RepositoryConfigurationException e)
+ {
+ sn = wsConfig.getContainer().getParameterValue("sourceName"); // TODO for backward comp,
+ // remove in rel.2.0
+ }
+ this.dbSourceName = sn;
+ }
+
+ // ------------- Values swap config ------------------
+ try
+ {
+ this.maxBufferSize = wsConfig.getContainer().getParameterInteger(MAXBUFFERSIZE_PROP);
+ }
+ catch (RepositoryConfigurationException e)
+ {
+ this.maxBufferSize = DEF_MAXBUFFERSIZE;
+ }
+
+ try
+ {
+ String sdParam = wsConfig.getContainer().getParameterValue(SWAPDIR_PROP);
+ this.swapDirectory = new File(sdParam);
+ }
+ catch (RepositoryConfigurationException e1)
+ {
+ this.swapDirectory = new File(DEF_SWAPDIR);
+ }
+ if (!swapDirectory.exists())
+ swapDirectory.mkdirs();
+
+ this.swapCleaner = new FileCleaner(false);
+
+ initDatabase();
+
+ String suParam = null;
+ boolean enableStorageUpdate = false;
+ try
+ {
+ suParam = wsConfig.getContainer().getParameterValue("update-storage");
+ enableStorageUpdate = Boolean.parseBoolean(suParam);
+ }
+ catch (RepositoryConfigurationException e)
+ {
+ if (LOG.isDebugEnabled())
+ LOG.debug("update-storage parameter is not set " + dbSourceName);
+ }
+
+ this.storageVersion =
+ StorageUpdateManager.checkVersion(dbSourceName, this.connFactory.getJdbcConnection(), multiDb,
+ enableStorageUpdate);
+
+ LOG.info(getInfo());
+ }
+
+ /**
+ * Prepare sefault connection factory.
+ *
+ * @return GenericConnectionFactory
+ * @throws NamingException
+ * on JNDI error
+ * @throws RepositoryException
+ * on Storage error
+ */
+ protected GenericConnectionFactory defaultConnectionFactory() throws NamingException, RepositoryException
+ {
+ // by default
+ if (dbSourceName != null)
+ {
+ DataSource ds = (DataSource)new InitialContext().lookup(dbSourceName);
+ if (ds != null)
+ return new GenericConnectionFactory(ds, containerName, multiDb, valueStorageProvider, maxBufferSize,
+ swapDirectory, swapCleaner);
+
+ throw new RepositoryException("Datasource '" + dbSourceName + "' is not bound in this context.");
+ }
+
+ return new GenericConnectionFactory(dbDriver, dbUrl, dbUserName, dbPassword, containerName, multiDb,
+ valueStorageProvider, maxBufferSize, swapDirectory, swapCleaner);
+ }
+
+ /**
+ * Prepare default DB initializer.
+ *
+ * @param sqlPath
+ * - path to SQL script (database creation script)
+ * @return DBInitializer instance
+ * @throws NamingException
+ * on JNDI error
+ * @throws RepositoryException
+ * on Storage error
+ * @throws IOException
+ * on I/O error
+ */
+ protected DBInitializer defaultDBInitializer(String sqlPath) throws NamingException, RepositoryException,
+ IOException
+ {
+ return new DBInitializer(containerName, this.connFactory.getJdbcConnection(), sqlPath, multiDb);
+ }
+
+ /**
+ * Checks if DataSources used in right manner.
+ *
+ * @param wsConfig
+ * Workspace configuration
+ * @param repConfig
+ * Repository configuration
+ * @throws RepositoryConfigurationException
+ * in case of configuration errors
+ */
+ protected void checkIntegrity(WorkspaceEntry wsConfig, RepositoryEntry repConfig)
+ throws RepositoryConfigurationException
+ {
+ boolean isMulti;
+ for (WorkspaceEntry wsEntry : repConfig.getWorkspaceEntries())
+ {
+ if (wsEntry.getName().equals(wsConfig.getName())
+ || !wsEntry.getContainer().getType().equals(wsConfig.getContainer().getType())
+ || !wsEntry.getContainer().getType().equals(this.getClass().getName()))
+ continue;
+
+ // MULTIDB
+ if (!wsEntry.getContainer().getParameterValue(MULTIDB).equals(
+ wsConfig.getContainer().getParameterValue(MULTIDB)))
+ {
+ throw new RepositoryConfigurationException("All workspaces must be " + MULTIDB + " or " + SINGLEDB
+ + ". But " + wsEntry.getName() + "- multi-db=" + wsEntry.getContainer().getParameterValue(MULTIDB)
+ + " and " + wsConfig.getName() + "- multi-db=" + wsConfig.getContainer().getParameterValue(MULTIDB));
+ }
+
+ isMulti = Boolean.parseBoolean(wsConfig.getContainer().getParameterValue(MULTIDB));
+
+ // source name
+ String wsSourceName = null;
+ String newWsSourceName = null;
+ try
+ {
+ wsSourceName = wsEntry.getContainer().getParameterValue("sourceName");
+ newWsSourceName = wsConfig.getContainer().getParameterValue("sourceName");
+ }
+ catch (RepositoryConfigurationException e)
+ {
+ }
+
+ if (wsSourceName != null && newWsSourceName != null)
+ {
+ if (isMulti)
+ {
+ if (wsSourceName.equals(newWsSourceName))
+ {
+ throw new RepositoryConfigurationException("SourceName " + wsSourceName + " alredy in use in "
+ + wsEntry.getName() + ". SourceName must be different in " + MULTIDB
+ + ". Check configuration for " + wsConfig.getName());
+ }
+ }
+ else
+ {
+ if (!wsSourceName.equals(newWsSourceName))
+ {
+ throw new RepositoryConfigurationException("SourceName must be equals in " + SINGLEDB + " "
+ + "repository." + " Check " + wsEntry.getName() + " and " + wsConfig.getName());
+ }
+ }
+ continue;
+ }
+
+ // db-url
+ String wsUri = null;
+ String newWsUri = null;
+ try
+ {
+ wsUri = wsEntry.getContainer().getParameterValue("db-url");
+ newWsUri = wsConfig.getContainer().getParameterValue("db-url");
+ }
+ catch (RepositoryConfigurationException e)
+ {
+ }
+
+ if (wsUri != null && newWsUri != null)
+ {
+ if (isMulti)
+ {
+ if (wsUri.equals(newWsUri))
+ {
+ throw new RepositoryConfigurationException("db-url " + wsUri + " alredy in use in "
+ + wsEntry.getName() + ". db-url must be different in " + MULTIDB + ". Check configuration for "
+ + wsConfig.getName());
+
+ }
+ }
+ else
+ {
+ if (!wsUri.equals(newWsUri))
+ {
+ throw new RepositoryConfigurationException("db-url must be equals in " + SINGLEDB + " "
+ + "repository." + " Check " + wsEntry.getName() + " and " + wsConfig.getName());
+ }
+ }
+ }
+ }
+ }
+
+ /**
+ * Init storage database.
+ *
+ * @throws NamingException
+ * on JNDI error
+ * @throws RepositoryException
+ * on storage error
+ * @throws IOException
+ * on I/O error
+ */
+ protected void initDatabase() throws NamingException, RepositoryException, IOException
+ {
+
+ DBInitializer dbInitilizer = null;
+ String sqlPath = null;
+ if (dbDialect == DBConstants.DB_DIALECT_ORACLEOCI)
+ {
+ LOG.warn(DBConstants.DB_DIALECT_ORACLEOCI + " dialect is experimental!");
+ // sample of connection factory customization
+ if (dbSourceName != null)
+ this.connFactory = defaultConnectionFactory();
+ else
+ this.connFactory =
+ new OracleConnectionFactory(dbDriver, dbUrl, dbUserName, dbPassword, containerName, multiDb,
+ valueStorageProvider, maxBufferSize, swapDirectory, swapCleaner);
+
+ sqlPath = "/conf/storage/jcr-" + (multiDb ? "m" : "s") + "jdbc.ora.sql";
+
+ // a particular db initializer may be configured here too
+ dbInitilizer = new OracleDBInitializer(containerName, this.connFactory.getJdbcConnection(), sqlPath, multiDb);
+ }
+ else if (dbDialect == DBConstants.DB_DIALECT_ORACLE)
+ {
+ this.connFactory = defaultConnectionFactory();
+ sqlPath = "/conf/storage/jcr-" + (multiDb ? "m" : "s") + "jdbc.ora.sql";
+ dbInitilizer = new OracleDBInitializer(containerName, this.connFactory.getJdbcConnection(), sqlPath, multiDb);
+ }
+ else if (dbDialect == DBConstants.DB_DIALECT_PGSQL)
+ {
+ this.connFactory = defaultConnectionFactory();
+ sqlPath = "/conf/storage/jcr-" + (multiDb ? "m" : "s") + "jdbc.pgsql.sql";
+ dbInitilizer = new PgSQLDBInitializer(containerName, this.connFactory.getJdbcConnection(), sqlPath, multiDb);
+ }
+ else if (dbDialect == DBConstants.DB_DIALECT_MYSQL)
+ {
+ // [PN] 28.06.07
+ if (dbSourceName != null)
+ {
+ DataSource ds = (DataSource)new InitialContext().lookup(dbSourceName);
+ if (ds != null)
+ this.connFactory =
+ new MySQLConnectionFactory(ds, containerName, multiDb, valueStorageProvider, maxBufferSize,
+ swapDirectory, swapCleaner);
+ else
+ throw new RepositoryException("Datasource '" + dbSourceName + "' is not bound in this context.");
+ }
+ else
+ this.connFactory =
+ new MySQLConnectionFactory(dbDriver, dbUrl, dbUserName, dbPassword, containerName, multiDb,
+ valueStorageProvider, maxBufferSize, swapDirectory, swapCleaner);
+
+ sqlPath = "/conf/storage/jcr-" + (multiDb ? "m" : "s") + "jdbc.mysql.sql";
+ dbInitilizer = defaultDBInitializer(sqlPath);
+ }
+ else if (dbDialect == DBConstants.DB_DIALECT_MYSQL_UTF8)
+ {
+ // [PN] 13.07.08
+ if (dbSourceName != null)
+ {
+ DataSource ds = (DataSource)new InitialContext().lookup(dbSourceName);
+ if (ds != null)
+ this.connFactory =
+ new MySQLConnectionFactory(ds, containerName, multiDb, valueStorageProvider, maxBufferSize,
+ swapDirectory, swapCleaner);
+ else
+ throw new RepositoryException("Datasource '" + dbSourceName + "' is not bound in this context.");
+ }
+ else
+ this.connFactory =
+ new MySQLConnectionFactory(dbDriver, dbUrl, dbUserName, dbPassword, containerName, multiDb,
+ valueStorageProvider, maxBufferSize, swapDirectory, swapCleaner);
+
+ sqlPath = "/conf/storage/jcr-" + (multiDb ? "m" : "s") + "jdbc.mysql-utf8.sql";
+ dbInitilizer = defaultDBInitializer(sqlPath);
+ }
+ else if (dbDialect == DBConstants.DB_DIALECT_MSSQL)
+ {
+ this.connFactory = defaultConnectionFactory();
+ sqlPath = "/conf/storage/jcr-" + (multiDb ? "m" : "s") + "jdbc.mssql.sql";
+ dbInitilizer = defaultDBInitializer(sqlPath);
+ }
+ else if (dbDialect == DBConstants.DB_DIALECT_DERBY)
+ {
+ this.connFactory = defaultConnectionFactory();
+ sqlPath = "/conf/storage/jcr-" + (multiDb ? "m" : "s") + "jdbc.derby.sql";
+ dbInitilizer = defaultDBInitializer(sqlPath);
+ }
+ else if (dbDialect == DBConstants.DB_DIALECT_DB2)
+ {
+ this.connFactory = defaultConnectionFactory();
+ sqlPath = "/conf/storage/jcr-" + (multiDb ? "m" : "s") + "jdbc.db2.sql";
+ dbInitilizer = defaultDBInitializer(sqlPath);
+ }
+ else if (dbDialect == DBConstants.DB_DIALECT_DB2V8)
+ {
+ this.connFactory = defaultConnectionFactory();
+ sqlPath = "/conf/storage/jcr-" + (multiDb ? "m" : "s") + "jdbc.db2v8.sql";
+ dbInitilizer = defaultDBInitializer(sqlPath);
+ }
+ else if (dbDialect == DBConstants.DB_DIALECT_SYBASE)
+ {
+ this.connFactory = defaultConnectionFactory();
+ sqlPath = "/conf/storage/jcr-" + (multiDb ? "m" : "s") + "jdbc.sybase.sql";
+ dbInitilizer = defaultDBInitializer(sqlPath);
+ }
+ else if (dbDialect == DBConstants.DB_DIALECT_INGRES)
+ {
+ this.connFactory = defaultConnectionFactory();
+ sqlPath = "/conf/storage/jcr-" + (multiDb ? "m" : "s") + "jdbc.ingres.sql";
+ // using Postgres initializer
+ dbInitilizer =
+ new IngresSQLDBInitializer(containerName, this.connFactory.getJdbcConnection(), sqlPath, multiDb);
+ }
+ else if (dbDialect == DBConstants.DB_DIALECT_HSQLDB)
+ {
+ if (dbSourceName != null)
+ {
+ DataSource ds = (DataSource)new InitialContext().lookup(dbSourceName);
+ if (ds != null)
+ this.connFactory =
+ new HSQLDBConnectionFactory(ds, containerName, multiDb, valueStorageProvider, maxBufferSize,
+ swapDirectory, swapCleaner);
+ else
+ throw new RepositoryException("Datasource '" + dbSourceName + "' is not bound in this context.");
+ }
+ else
+ this.connFactory =
+ new HSQLDBConnectionFactory(dbDriver, dbUrl, dbUserName, dbPassword, containerName, multiDb,
+ valueStorageProvider, maxBufferSize, swapDirectory, swapCleaner);
+ sqlPath = "/conf/storage/jcr-" + (multiDb ? "m" : "s") + "jdbc.sql";
+ dbInitilizer = defaultDBInitializer(sqlPath);
+ }
+ else
+ {
+ // generic, DB_HSQLDB
+ this.connFactory = defaultConnectionFactory();
+ sqlPath = "/conf/storage/jcr-" + (multiDb ? "m" : "s") + "jdbc.sql";
+ dbInitilizer = defaultDBInitializer(sqlPath);
+ }
+
+ // database type
+ try
+ {
+ dbInitilizer.init();
+ }
+ catch (DBInitializerException e)
+ {
+ LOG.error("Error of init db " + e, e);
+ }
+ }
+
+ /**
+ * Return ConnectionFactory.
+ *
+ * @return WorkspaceStorageConnectionFactory connection
+ */
+ protected GenericConnectionFactory getConnectionFactory()
+ {
+ return connFactory;
+ }
+
+ protected String detectDialect(String confParam)
+ {
+ for (String dbType : DBConstants.DB_DIALECTS)
+ {
+ if (dbType.equalsIgnoreCase(confParam))
+ return dbType;
+ }
+
+ return DBConstants.DB_DIALECT_GENERIC; // by default
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public WorkspaceStorageConnection openConnection() throws RepositoryException
+ {
+
+ return connFactory.openConnection();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public WorkspaceStorageConnection openConnection(boolean readOnly) throws RepositoryException
+ {
+
+ return connFactory.openConnection(readOnly);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public WorkspaceStorageConnection reuseConnection(WorkspaceStorageConnection original) throws RepositoryException
+ {
+
+ if (original instanceof CQJDBCStorageConnection)
+ {
+ WorkspaceStorageConnectionFactory cFactory =
+ new SharedConnectionFactory(((CQJDBCStorageConnection)original).getJdbcConnection(), containerName,
+ multiDb, valueStorageProvider, maxBufferSize, swapDirectory, swapCleaner);
+
+ return cFactory.openConnection();
+ }
+ else
+ {
+ return openConnection();
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public String getName()
+ {
+ return containerName;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public String getInfo()
+ {
+ String str =
+ "JDBC based JCR Workspace Data container \n" + "container name: " + containerName + " \n"
+ + "data source JNDI name: " + dbSourceName + "\n" + "is multi database: " + multiDb + "\n"
+ + "storage version: " + storageVersion + "\n" + "value storage provider: " + valueStorageProvider + "\n"
+ + "max buffer size (bytes): " + maxBufferSize + "\n" + "swap directory path: "
+ + swapDirectory.getAbsolutePath();
+ return str;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public String getStorageVersion()
+ {
+ return storageVersion;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void start()
+ {
+ this.swapCleaner.start();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void stop()
+ {
+ this.swapCleaner.halt();
+ this.swapCleaner.interrupt();
+
+ // TODO HSQLDB Stop (debug)
+ // if (dbDialect.equals(DB_DIALECT_GENERIC) ||
+ // dbDialect.equals(DB_DIALECT_HSQLDB)) {
+ // // shutdown in-process HSQLDB database
+ // System.out.println("Shutdown in-process HSQLDB database...");
+ // try {
+ // JDBCStorageConnection conn = (JDBCStorageConnection) openConnection();
+ // Connection jdbcConn = conn.getJdbcConnection();
+ // String dbUrl = jdbcConn.getMetaData().getURL();
+ // if (dbUrl.startsWith("jdbc:hsqldb:file") ||
+ // dbUrl.startsWith("jdbc:hsqldb:mem")) {
+ // // yeah, there is in-process hsqldb, shutdown it now
+ // jdbcConn.createStatement().execute("SHUTDOWN");
+ // System.out.println("Shutdown in-process HSQLDB database... done.");
+ // }
+ // } catch (Throwable e) {
+ // log.error("JDBC Data container stop error " + e);
+ // e.printStackTrace();
+ // }
+ // }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public boolean isSame(WorkspaceDataContainer another)
+ {
+ if (another == this)
+ return true;
+
+ if (another instanceof CQJDBCWorkspaceDataContainer)
+ {
+ CQJDBCWorkspaceDataContainer anotherJdbc = (CQJDBCWorkspaceDataContainer)another;
+
+ if (getDbSourceName() != null)
+ // by jndi ds name
+ return getDbSourceName().equals(anotherJdbc.getDbSourceName());
+
+ // by db connection params
+ return getDbDriver().equals(anotherJdbc.getDbDriver()) && getDbUrl().equals(anotherJdbc.getDbUrl())
+ && getDbUserName().equals(anotherJdbc.getDbUserName());
+ }
+
+ return false;
+ }
+
+ /**
+ * Used in <code>equals()</code>.
+ *
+ * @return DataSource name
+ */
+ protected String getDbSourceName()
+ {
+ return dbSourceName;
+ }
+
+ /**
+ * Used in <code>equals()</code>.
+ *
+ * @return JDBC driver
+ */
+ protected String getDbDriver()
+ {
+ return dbDriver;
+ }
+
+ /**
+ * Used in <code>equals()</code>.
+ *
+ * @return Database URL
+ */
+ protected String getDbUrl()
+ {
+ return dbUrl;
+ }
+
+ /**
+ * Used in <code>equals()</code>.
+ *
+ * @return Database username
+ */
+ protected String getDbUserName()
+ {
+ return dbUserName;
+ }
+}
Deleted: jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/NewJDBCStorageConnection.java
===================================================================
--- jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/NewJDBCStorageConnection.java 2009-12-25 15:51:39 UTC (rev 1193)
+++ jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/NewJDBCStorageConnection.java 2009-12-25 15:55:34 UTC (rev 1194)
@@ -1,2532 +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;
-
-import org.exoplatform.services.jcr.access.AccessControlEntry;
-import org.exoplatform.services.jcr.access.AccessControlList;
-import org.exoplatform.services.jcr.dataflow.ItemState;
-import org.exoplatform.services.jcr.dataflow.persistent.PersistedNodeData;
-import org.exoplatform.services.jcr.dataflow.persistent.PersistedPropertyData;
-import org.exoplatform.services.jcr.datamodel.IllegalACLException;
-import org.exoplatform.services.jcr.datamodel.IllegalNameException;
-import org.exoplatform.services.jcr.datamodel.InternalQName;
-import org.exoplatform.services.jcr.datamodel.ItemData;
-import org.exoplatform.services.jcr.datamodel.NodeData;
-import org.exoplatform.services.jcr.datamodel.PropertyData;
-import org.exoplatform.services.jcr.datamodel.QPath;
-import org.exoplatform.services.jcr.datamodel.QPathEntry;
-import org.exoplatform.services.jcr.datamodel.ValueData;
-import org.exoplatform.services.jcr.impl.Constants;
-import org.exoplatform.services.jcr.impl.dataflow.persistent.ByteArrayPersistedValueData;
-import org.exoplatform.services.jcr.impl.dataflow.persistent.CleanableFilePersistedValueData;
-import org.exoplatform.services.jcr.impl.dataflow.persistent.StreamPersistedValueData;
-import org.exoplatform.services.jcr.impl.storage.JCRInvalidItemStateException;
-import org.exoplatform.services.jcr.impl.storage.jdbc.JDBCStorageConnection;
-import org.exoplatform.services.jcr.impl.storage.jdbc.PrimaryTypeNotFoundException;
-import org.exoplatform.services.jcr.impl.storage.value.ValueStorageNotFoundException;
-import org.exoplatform.services.jcr.impl.storage.value.fs.operations.ValueFileIOHelper;
-import org.exoplatform.services.jcr.impl.util.io.FileCleaner;
-import org.exoplatform.services.jcr.impl.util.io.SwapFile;
-import org.exoplatform.services.jcr.storage.WorkspaceStorageConnection;
-import org.exoplatform.services.jcr.storage.value.ValueIOChannel;
-import org.exoplatform.services.jcr.storage.value.ValueStoragePluginProvider;
-import org.exoplatform.services.log.ExoLogger;
-import org.exoplatform.services.log.Log;
-
-import java.io.ByteArrayInputStream;
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.sql.Connection;
-import java.sql.PreparedStatement;
-import java.sql.ResultSet;
-import java.sql.SQLException;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.StringTokenizer;
-
-import javax.jcr.InvalidItemStateException;
-import javax.jcr.PropertyType;
-import javax.jcr.RepositoryException;
-
-/**
- * Created by The eXo Platform SAS.
- *
- * @author <a href="mailto:gennady.azarenkov@exoplatform.com">Gennady Azarenkov</a>
- * @version $Id: JDBCStorageConnection.java 34801 2009-07-31 15:44:50Z dkatayev $
- */
-abstract public class NewJDBCStorageConnection extends DBConstants implements WorkspaceStorageConnection
-{
-
- /**
- * Connection logger.
- */
- protected static final Log LOG = ExoLogger.getLogger("jcr.JDBCStorageConnection");
-
- /**
- * NODE type.
- */
- public static final int I_CLASS_NODE = 1;
-
- /**
- * PROPERTY type.
- */
- public static final int I_CLASS_PROPERTY = 2;
-
- protected final ValueStoragePluginProvider valueStorageProvider;
-
- protected final int maxBufferSize;
-
- protected final File swapDirectory;
-
- protected final FileCleaner swapCleaner;
-
- protected final Connection dbConnection;
-
- protected final String containerName;
-
- protected final NewSQLExceptionHandler exceptionHandler;
-
- protected final List<ValueIOChannel> valueChanges;
-
- /**
- * Read-only flag, if true the connection is marked as READ-ONLY.
- */
- protected final boolean readOnly;
-
- /**
- * JDBCStorageConnection constructor.
- *
- * @param dbConnection
- * JDBC connection
- * @param containerName
- * Workspace conatiner name
- * @param valueStorageProvider
- * External Value Storage provider
- * @param maxBufferSize
- * maximum buffer size (config)
- * @param swapDirectory
- * swap directory (config)
- * @param swapCleaner
- * swap cleaner (FileCleaner)
- * @throws SQLException
- * database error
- */
- protected NewJDBCStorageConnection(Connection dbConnection, boolean readOnly, String containerName,
- ValueStoragePluginProvider valueStorageProvider, int maxBufferSize, File swapDirectory, FileCleaner swapCleaner)
- throws SQLException
- {
-
- this.valueStorageProvider = valueStorageProvider;
-
- this.maxBufferSize = maxBufferSize;
- this.swapDirectory = swapDirectory;
- this.swapCleaner = swapCleaner;
- this.containerName = containerName;
-
- this.dbConnection = dbConnection;
- this.readOnly = readOnly;
-
- // Fix for Sybase jConnect JDBC driver bug.
- // Which throws SQLException(JZ016: The AutoCommit option is already set to
- // false)
- // if conn.setAutoCommit(false) called twise or more times with value
- // 'false'.
- if (dbConnection.getAutoCommit())
- {
- dbConnection.setAutoCommit(false);
- }
-
- prepareQueries();
- this.exceptionHandler = new NewSQLExceptionHandler(containerName, this);
-
- this.valueChanges = new ArrayList<ValueIOChannel>();
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public boolean equals(Object obj)
- {
- if (obj == this)
- return true;
-
- if (obj instanceof JDBCStorageConnection)
- {
- JDBCStorageConnection another = (JDBCStorageConnection)obj;
- return getJdbcConnection() == another.getJdbcConnection();
- }
-
- return false;
- }
-
- /**
- * Return JDBC connection obtained from initialized data source. NOTE: Helper can obtain one new
- * connection per each call of the method or return one obtained once.
- */
- public Connection getJdbcConnection()
- {
- return dbConnection;
- }
-
- /**
- * Prepared queries at start time.
- *
- * @throws SQLException
- * database error
- */
- abstract protected void prepareQueries() throws SQLException;
-
- /**
- * Used in Single Db Connection classes for Identifier related queries.
- *
- * @param identifier
- * Item id
- * @return String with container internal id
- */
- protected abstract String getInternalId(String identifier);
-
- /**
- * Used in loadXYZRecord methods for extract real Identifier from container value.
- *
- * @param internalId
- * @return
- */
- protected abstract String getIdentifier(String internalId);
-
- // ---------------- WorkspaceStorageConnection -------------
-
- /**
- * @throws IllegalStateException
- * if connection is closed.
- */
- protected void checkIfOpened() throws IllegalStateException
- {
- if (!isOpened())
- throw new IllegalStateException("Connection is closed");
- }
-
- /**
- * {@inheritDoc}
- */
- public boolean isOpened()
- {
- try
- {
- return !dbConnection.isClosed();
- }
- catch (SQLException e)
- {
- LOG.error(e);
- return false;
- }
- }
-
- /**
- * {@inheritDoc}
- */
- public final void rollback() throws IllegalStateException, RepositoryException
- {
- checkIfOpened();
- try
- {
- dbConnection.rollback();
- dbConnection.close();
-
- // rollback from the end
- for (int p = valueChanges.size() - 1; p >= 0; p--)
- valueChanges.get(p).rollback();
- }
- catch (SQLException e)
- {
- throw new RepositoryException(e);
- }
- catch (IOException e)
- {
- throw new RepositoryException(e);
- }
- finally
- {
- valueChanges.clear();
- }
- }
-
- /**
- * {@inheritDoc}
- */
- public final void close() throws IllegalStateException, RepositoryException
- {
- checkIfOpened();
- try
- {
- // If READ-ONLY status back it to READ-WRITE (we assume it was original state)
- if (readOnly)
- dbConnection.setReadOnly(true);
-
- dbConnection.close();
- }
- catch (SQLException e)
- {
- throw new RepositoryException(e);
- }
- }
-
- /**
- * {@inheritDoc}
- */
- public final void commit() throws IllegalStateException, RepositoryException
- {
- checkIfOpened();
- try
- {
- dbConnection.commit();
- dbConnection.close();
-
- try
- {
- for (ValueIOChannel vo : valueChanges)
- vo.commit();
-
- }
- catch (IOException e)
- {
- throw new RepositoryException(e);
- }
- finally
- {
- valueChanges.clear();
- }
- }
- catch (SQLException e)
- {
- throw new RepositoryException(e);
- }
- }
-
- /**
- * {@inheritDoc}
- */
- public void add(NodeData data) throws RepositoryException, UnsupportedOperationException, InvalidItemStateException,
- IllegalStateException
- {
- checkIfOpened();
- try
- {
- addNodeRecord(data);
- if (LOG.isDebugEnabled())
- LOG.debug("Node added " + data.getQPath().getAsString() + ", " + data.getIdentifier() + ", "
- + data.getPrimaryTypeName().getAsString());
-
- }
- catch (SQLException e)
- {
- if (LOG.isDebugEnabled())
- LOG.error("Node add. Database error: " + e);
-
- exceptionHandler.handleAddException(e, data);
- }
- }
-
- /**
- * {@inheritDoc}
- */
- public void add(PropertyData data) throws RepositoryException, UnsupportedOperationException,
- InvalidItemStateException, IllegalStateException
- {
- checkIfOpened();
-
- try
- {
- addPropertyRecord(data);
-
- if (data.getType() == PropertyType.REFERENCE)
- {
- try
- {
- addReference(data);
- }
- catch (IOException e)
- {
- throw new RepositoryException("Can't read REFERENCE property (" + data.getQPath() + " "
- + data.getIdentifier() + ") value: " + e.getMessage(), e);
- }
- }
-
- addValues(getInternalId(data.getIdentifier()), data);
-
- if (LOG.isDebugEnabled())
- LOG.debug("Property added " + data.getQPath().getAsString() + ", " + data.getIdentifier()
- + (data.getValues() != null ? ", values count: " + data.getValues().size() : ", NULL data"));
-
- }
- catch (IOException e)
- {
- if (LOG.isDebugEnabled())
- LOG.error("Property add. IO error: " + e, e);
- throw new RepositoryException("Error of Property Value add " + e, e);
- }
- catch (SQLException e)
- {
- if (LOG.isDebugEnabled())
- LOG.error("Property add. Database error: " + e, e);
- exceptionHandler.handleAddException(e, data);
- }
- }
-
- /**
- * {@inheritDoc}
- */
- public void rename(NodeData data) throws RepositoryException, UnsupportedOperationException,
- InvalidItemStateException, IllegalStateException
- {
-
- checkIfOpened();
- try
- {
- if (renameNode(data) <= 0)
- throw new JCRInvalidItemStateException("(rename) Node not found " + data.getQPath().getAsString() + " "
- + data.getIdentifier() + ". Probably was deleted by another session ", data.getIdentifier(),
- ItemState.RENAMED);
- }
- catch (SQLException e)
- {
- if (LOG.isDebugEnabled())
- LOG.error("Property add. Database error: " + e, e);
- exceptionHandler.handleAddException(e, data);
- }
- }
-
- /**
- * {@inheritDoc}
- */
- public void delete(NodeData data) throws RepositoryException, UnsupportedOperationException,
- InvalidItemStateException, IllegalStateException
- {
- checkIfOpened();
-
- final String cid = getInternalId(data.getIdentifier());
-
- try
- {
- int nc = deleteItemByIdentifier(cid);
- if (nc <= 0)
- throw new JCRInvalidItemStateException("(delete) Node not found " + data.getQPath().getAsString() + " "
- + data.getIdentifier() + ". Probably was deleted by another session ", data.getIdentifier(),
- ItemState.DELETED);
-
- if (LOG.isDebugEnabled())
- LOG.debug("Node deleted " + data.getQPath().getAsString() + ", " + data.getIdentifier() + ", "
- + ((NodeData)data).getPrimaryTypeName().getAsString());
-
- }
- catch (SQLException e)
- {
- if (LOG.isDebugEnabled())
- LOG.error("Node remove. Database error: " + e, e);
- exceptionHandler.handleDeleteException(e, data);
- }
- }
-
- /**
- * {@inheritDoc}
- */
- public void delete(PropertyData data) throws RepositoryException, UnsupportedOperationException,
- InvalidItemStateException, IllegalStateException
- {
- checkIfOpened();
-
- final String cid = getInternalId(data.getIdentifier());
-
- try
- {
- deleteValues(cid, data, false);
-
- // delete references
- deleteReference(cid);
-
- // delete item
- int nc = deleteItemByIdentifier(cid);
- if (nc <= 0)
- throw new JCRInvalidItemStateException("(delete) Property not found " + data.getQPath().getAsString() + " "
- + data.getIdentifier() + ". Probably was deleted by another session ", data.getIdentifier(),
- ItemState.DELETED);
-
- if (LOG.isDebugEnabled())
- LOG.debug("Property deleted "
- + data.getQPath().getAsString()
- + ", "
- + data.getIdentifier()
- + (((PropertyData)data).getValues() != null ? ", values count: "
- + ((PropertyData)data).getValues().size() : ", NULL data"));
-
- }
- catch (IOException e)
- {
- if (LOG.isDebugEnabled())
- LOG.error("Property remove. IO error: " + e, e);
- throw new RepositoryException("Error of Property Value delete " + e, e);
- }
- catch (SQLException e)
- {
- if (LOG.isDebugEnabled())
- LOG.error("Property remove. Database error: " + e, e);
- exceptionHandler.handleDeleteException(e, data);
- }
- }
-
- /**
- * {@inheritDoc}
- */
- public void update(NodeData data) throws RepositoryException, UnsupportedOperationException,
- InvalidItemStateException, IllegalStateException
- {
- checkIfOpened();
- try
- {
- String cid = getInternalId(data.getIdentifier());
- // order numb update
- if (updateNodeByIdentifier(data.getPersistedVersion(), data.getQPath().getIndex(), data.getOrderNumber(), cid) <= 0)
- throw new JCRInvalidItemStateException("(update) Node not found " + data.getQPath().getAsString() + " "
- + data.getIdentifier() + ". Probably was deleted by another session ", data.getIdentifier(),
- ItemState.UPDATED);
-
- if (LOG.isDebugEnabled())
- LOG.debug("Node updated " + data.getQPath().getAsString() + ", " + data.getIdentifier() + ", "
- + data.getPrimaryTypeName().getAsString());
-
- }
- catch (SQLException e)
- {
- if (LOG.isDebugEnabled())
- LOG.error("Node update. Database error: " + e, e);
- exceptionHandler.handleUpdateException(e, data);
- }
- }
-
- /**
- * {@inheritDoc}
- */
- public void update(PropertyData data) throws RepositoryException, UnsupportedOperationException,
- InvalidItemStateException, IllegalStateException
- {
- checkIfOpened();
-
- try
- {
- String cid = getInternalId(data.getIdentifier());
-
- // update type
- if (updatePropertyByIdentifier(data.getPersistedVersion(), data.getType(), cid) <= 0)
- throw new JCRInvalidItemStateException("(update) Property not found " + data.getQPath().getAsString() + " "
- + data.getIdentifier() + ". Probably was deleted by another session ", data.getIdentifier(),
- ItemState.UPDATED);
-
- // update reference
- try
- {
- deleteReference(cid);
-
- if (data.getType() == PropertyType.REFERENCE)
- {
- addReference(data);
- }
- }
- catch (IOException e)
- {
- throw new RepositoryException("Can't update REFERENCE property (" + data.getQPath() + " "
- + data.getIdentifier() + ") value: " + e.getMessage(), e);
- }
-
- // do Values update: delete all and add all
- deleteValues(cid, data, true);
- addValues(cid, data);
-
- if (LOG.isDebugEnabled())
- LOG.debug("Property updated " + data.getQPath().getAsString() + ", " + data.getIdentifier()
- + (data.getValues() != null ? ", values count: " + data.getValues().size() : ", NULL data"));
-
- }
- catch (IOException e)
- {
- if (LOG.isDebugEnabled())
- LOG.error("Property update. IO error: " + e, e);
- throw new RepositoryException("Error of Property Value update " + e, e);
- }
- catch (SQLException e)
- {
- if (LOG.isDebugEnabled())
- LOG.error("Property update. Database error: " + e, e);
- exceptionHandler.handleUpdateException(e, data);
- }
- }
-
- /**
- * {@inheritDoc}
- */
- public List<NodeData> getChildNodesData(NodeData parent) throws RepositoryException, IllegalStateException
- {
- checkIfOpened();
- try
- {
- // ResultSet node = findChildNodesByParentIdentifier(getInternalId(parent.getIdentifier()));
- // List<NodeData> childrens = new ArrayList<NodeData>();
- // while (node.next())
- // childrens.add((NodeData)itemData(parent.getQPath(), node, I_CLASS_NODE, parent.getACL()));
- //
- // return childrens;
- ResultSet resultSet = findChildNodesByParentIdentifierNew(getInternalId(parent.getIdentifier()));
- if (resultSet.next())
- {
- Map<String, TempNodeData> tempNodes = loadNodesData(resultSet);
-
- List<NodeData> childrens = new ArrayList<NodeData>(tempNodes.size());
- QPath parentQPath = parent.getQPath();
- AccessControlList parentACL = parent.getACL();
- for (TempNodeData data : tempNodes.values())
- {
- NodeData nodeData = loadNodeFromTemporaryNodeData(data, parentQPath, parentACL);
- childrens.add(nodeData);
- }
- return childrens;
- }
- else
- {
- return new ArrayList<NodeData>();
- }
-
- }
- catch (SQLException e)
- {
- throw new RepositoryException(e);
- }
- catch (IOException e)
- {
- throw new RepositoryException(e);
- }
- }
-
- protected Map<String, TempNodeData> loadNodesData(ResultSet resultSet) throws RepositoryException, IOException,
- SQLException
- {
-
- Map<String, TempNodeData> nodesData = new LinkedHashMap<String, TempNodeData>();
- do
- {
- int itemClass = resultSet.getInt(COLUMN_CLASS);
- if (itemClass == I_CLASS_NODE)
- {
- TempNodeData data = new TempNodeData(resultSet);
- nodesData.put(data.cid, data);
- }
- else
- {
- String cpid = resultSet.getString(COLUMN_PARENTID);
- TempNodeData data = nodesData.get(cpid);
- if (data.properties == null)
- {
- data.properties = new HashMap<String, List<byte[]>>();
- }
- Map<String, List<byte[]>> properties = data.properties;
- String key = resultSet.getString(COLUMN_NAME);
- List<byte[]> values = properties.get(key);
- if (values == null)
- {
- values = new ArrayList<byte[]>();
- properties.put(key, values);
- }
- values.add(resultSet.getBytes(COLUMN_VDATA));
- }
- }
- while (resultSet.next());
-
- return nodesData;
-
- }
-
- private static class TempNodeData
- {
- String cid;
-
- String cname;
-
- int cversion;
-
- String cpid;
-
- int cindex;
-
- int cnordernumb;
-
- Map<String, List<byte[]>> properties = new HashMap<String, List<byte[]>>();
-
- public TempNodeData(ResultSet item) throws SQLException
- {
- cid = item.getString(COLUMN_ID);
- cname = item.getString(COLUMN_NAME);
- cversion = item.getInt(COLUMN_VERSION);
-
- cpid = item.getString(COLUMN_PARENTID);
-
- cindex = item.getInt(COLUMN_INDEX);
- cnordernumb = item.getInt(COLUMN_NORDERNUM);
- }
- }
-
- /**
- * {@inheritDoc}
- */
- public int getChildNodesCount(NodeData parent) throws RepositoryException
- {
- checkIfOpened();
- try
- {
- ResultSet count = findChildNodesCountByParentIdentifier(getInternalId(parent.getIdentifier()));
- if (count.next())
- {
- return count.getInt(1);
- }
- else
- {
- throw new RepositoryException("FATAL No resulton childNodes count for " + parent.getQPath().getAsString());
- }
- }
- catch (SQLException e)
- {
- throw new RepositoryException(e);
- }
- }
-
- /**
- * {@inheritDoc}
- */
- public List<PropertyData> getChildPropertiesData(NodeData parent) throws RepositoryException, IllegalStateException
- {
- checkIfOpened();
- try
- {
-
- ResultSet resultSet = getChildPropertiesByParentIdentifier(getInternalId(parent.getIdentifier()));
- List<PropertyData> children = new ArrayList<PropertyData>();
- if (resultSet.next())
- {
- while (!resultSet.isAfterLast())
- children.add(loadPropertyRecord(resultSet, parent.getQPath()));
- }
-
- return children;
-
- }
- catch (SQLException e)
- {
- throw new RepositoryException(e);
- }
- catch (IOException e)
- {
- throw new RepositoryException(e);
- }
- }
-
- /**
- * {@inheritDoc}
- *
- * TODO left as current
- */
- public List<PropertyData> listChildPropertiesData(NodeData parent) throws RepositoryException, IllegalStateException
- {
- checkIfOpened();
- try
- {
- ResultSet prop = findChildPropertiesByParentIdentifier(getInternalId(parent.getIdentifier()));
- List<PropertyData> children = new ArrayList<PropertyData>();
- while (prop.next())
- children.add(propertyData(parent.getQPath(), prop));
-
- return children;
- }
- catch (SQLException e)
- {
- throw new RepositoryException(e);
- }
- catch (IOException e)
- {
- throw new RepositoryException(e);
- }
- }
-
- /**
- * {@inheritDoc}
- */
- public ItemData getItemData(String identifier) throws RepositoryException, IllegalStateException
- {
- return getItemByIdentifier(getInternalId(identifier));
- }
-
- public ItemData getItemData(NodeData parentData, QPathEntry name) throws RepositoryException, IllegalStateException
- {
-
- if (parentData != null)
- {
- return getItemByName(parentData, getInternalId(parentData.getIdentifier()), name);
- }
-
- // it's a root node
- return getItemByName(null, null, name);
- }
-
- /**
- * {@inheritDoc}
- */
- public List<PropertyData> getReferencesData(String nodeIdentifier) throws RepositoryException, IllegalStateException
- {
- checkIfOpened();
- try
- {
- ResultSet refProps = findReferences(getInternalId(nodeIdentifier));
- List<PropertyData> references = new ArrayList<PropertyData>();
- while (refProps.next())
- {
- references.add((PropertyData)itemData(null, refProps, I_CLASS_PROPERTY, null));
- }
-
- // ResultSet resultSet = findReferenceProperties(getInternalId(nodeIdentifier));
- // List<PropertyData> references = new ArrayList<PropertyData>(); //
- // if (resultSet.next())
- // {
- // while (!resultSet.isAfterLast())
- // references.add(loadPropertyRecord(resultSet, null));
- // }
-
- return references;
- }
- catch (SQLException e)
- {
- throw new RepositoryException(e);
- }
- catch (IOException e)
- {
- throw new RepositoryException(e);
- }
- }
-
- // ------------------ Private methods ---------------
-
- /**
- * Get Item By Identifier.
- *
- * @param cid
- * Item id (container internal)
- * @return ItemData
- * @throws RepositoryException
- * Repository error
- * @throws IllegalStateException
- * if connection is closed
- */
- protected ItemData getItemByIdentifier(String cid) throws RepositoryException, IllegalStateException
- {
- checkIfOpened();
- ResultSet resultSet = null;
- try
- {
- resultSet = findItemByIdentifierNew(cid);
- if (resultSet.next())
- {
- int itemType = resultSet.getInt(COLUMN_CLASS);
- if (itemType == I_CLASS_NODE)
- {
- Map<String, TempNodeData> node = loadNodesData(resultSet);
- return loadNodeFromTemporaryNodeData(node.get(cid), null, null);
- //return loadNodeRecord(resultSet, null, null);
- }
- else
- {
- return loadPropertyRecord(resultSet, null);
- }
-
- }
- return null;
- }
- catch (SQLException e)
- {
- throw new RepositoryException("getItemData() error", e);
- }
- catch (IOException e)
- {
- throw new RepositoryException("getItemData() error", e);
- }
- finally
- {
- try
- {
- if (resultSet != null)
- resultSet.close();
- }
- catch (SQLException e)
- {
- LOG.error("getItemData() Error close resultset " + e.getMessage());
- }
- }
-
- }
-
- /**
- * Gets an item data from database.
- *
- * @param parentPath
- * - parent QPath
- * @param parentId
- * - parent container internal id (depends on Multi/Single DB)
- * @param name
- * - item name
- * @return - ItemData instance
- * @throws RepositoryException
- * Repository error
- * @throws IllegalStateException
- * if connection is closed
- */
- protected ItemData getItemByName(NodeData parent, String parentId, QPathEntry name) throws RepositoryException,
- IllegalStateException
- {
- checkIfOpened();
- ResultSet resultSet = null;
- try
- {
- resultSet = findItemByNameNew(parentId, name.getAsString(), name.getIndex());
- if (resultSet.next())
- {
- // return itemData(parent.getQPath(), item, item.getInt(COLUMN_CLASS), parent.getACL());
- int itemType = resultSet.getInt(COLUMN_CLASS);
- if (itemType == I_CLASS_NODE)
- {
- // Remember first node id. If node is not first in result set - it's a bug.
- String firstNodeId = resultSet.getString(COLUMN_ID);
-
- // There may be two or more nodes, so load temp NodeDatas and return first one.
- Map<String, TempNodeData> tempNodes = loadNodesData(resultSet);
-
- QPath parentQPath = parent.getQPath();
- AccessControlList parentACL = parent.getACL();
-
- NodeData nodeData = loadNodeFromTemporaryNodeData(tempNodes.get(firstNodeId), parentQPath, parentACL);
- tempNodes.clear();
- return nodeData;
-
- //return loadNodeRecord(resultSet, parent.getQPath(), parent.getACL());
- }
- else
- {
- return loadPropertyRecord(resultSet, parent.getQPath());
- }
- }
-
- return null;
- }
- catch (SQLException e)
- {
- throw new RepositoryException(e);
- }
- catch (IOException e)
- {
- throw new RepositoryException(e);
- }
- finally
- {
- try
- {
- if (resultSet != null)
- resultSet.close();
- }
- catch (SQLException e)
- {
- LOG.error("getItemData() Error close resultset " + e.getMessage());
- }
- }
- }
-
- /**
- * Build Item path by id.
- *
- * @param cpid
- * - Item id (container id)
- * @return Item QPath
- * @throws SQLException
- * - if database error occurs
- * @throws InvalidItemStateException
- * - if parent not found
- * @throws IllegalNameException
- * - if name on the path is wrong
- */
- private QPath traverseQPath(String cpid) throws SQLException, InvalidItemStateException, IllegalNameException
- {
- // get item by Identifier usecase
- List<QPathEntry> qrpath = new ArrayList<QPathEntry>(); // reverted path
- String caid = cpid; // container ancestor id
- do
- {
- ResultSet parent = null;
- try
- {
- parent = findItemByIdentifier(caid);
- if (!parent.next())
- throw new InvalidItemStateException("Parent not found, uuid: " + getIdentifier(caid));
-
- QPathEntry qpe =
- new QPathEntry(InternalQName.parse(parent.getString(COLUMN_NAME)), parent.getInt(COLUMN_INDEX));
- qrpath.add(qpe);
- caid = parent.getString(COLUMN_PARENTID);
- }
- finally
- {
- parent.close();
- }
- }
- while (!caid.equals(Constants.ROOT_PARENT_UUID));
-
- QPathEntry[] qentries = new QPathEntry[qrpath.size()];
- int qi = 0;
- for (int i = qrpath.size() - 1; i >= 0; i--)
- {
- qentries[qi++] = qrpath.get(i);
- }
- return new QPath(qentries);
- }
-
- /**
- * ItemLocationInfo.
- *
- */
- class ItemLocationInfo
- {
- /**
- * Item qpath
- */
- final QPath qpath;
-
- /**
- * All ancestors of the item with qpath
- */
- final List<String> ancestors;
-
- /**
- * Item id.
- */
- final String itemId;
-
- /**
- * ItemLocationInfo constructor.
- *
- * @param qpath
- * Item path
- * @param ancestors
- * ancesstors id list
- * @param itemId
- * Item id
- */
- ItemLocationInfo(QPath qpath, List<String> ancestors, String itemId)
- {
- this.qpath = qpath;
- this.ancestors = ancestors;
- this.itemId = itemId;
- }
- }
-
- /**
- * Find ancestor permissions by cpid. Will search till find the permissions or meet a root node.
- *
- * @param cpid
- * - initial parent node id
- * @return Collection<String>
- * @throws SQLException
- * if database error
- * @throws IllegalACLException
- * if wrong ACL
- * @throws IllegalNameException
- * if wrong QName
- * @throws RepositoryException
- * if Repository error
- */
- private List<AccessControlEntry> traverseACLPermissions(String cpid) throws SQLException, IllegalACLException,
- IllegalNameException, RepositoryException
- {
- String caid = cpid;
- while (!caid.equals(Constants.ROOT_PARENT_UUID))
- {
- MixinInfo naMixins = readMixins(caid);
- if (naMixins.hasPrivilegeable())
- return readACLPermisions(caid);
-
- if (naMixins.parentId == null)
- caid = findParentId(caid);
- else
- caid = naMixins.parentId;
- }
-
- throw new IllegalACLException("Can not find permissions for a node with id " + getIdentifier(cpid));
- }
-
- protected String findParentId(String cid) throws SQLException, RepositoryException
- {
- ResultSet pidrs = findItemByIdentifier(cid);
- try
- {
- if (pidrs.next())
- return pidrs.getString(COLUMN_PARENTID);
- else
- throw new RepositoryException("Item not found id: " + getIdentifier(cid));
- }
- finally
- {
- pidrs.close();
- }
- }
-
- /**
- * Find ancestor owner by cpid. Will search till find the owner or meet a root node.
- *
- * @param cpid
- * - initial parent node id
- * @return owner name
- * @throws SQLException
- * if database error
- * @throws IllegalACLException
- * if wrong ACL
- * @throws IllegalNameException
- * if wrong QName
- * @throws RepositoryException
- * if Repository error
- */
- private String traverseACLOwner(String cpid) throws SQLException, IllegalACLException, IllegalNameException,
- RepositoryException
- {
- String caid = cpid;
-
- while (!caid.equals(Constants.ROOT_PARENT_UUID))
- {
- MixinInfo naMixins = readMixins(caid);
- if (naMixins.hasOwneable())
- return readACLOwner(caid);
-
- if (naMixins.parentId == null)
- caid = findParentId(caid);
- else
- caid = naMixins.parentId;
- }
-
- throw new IllegalACLException("Can not find owner for a node with id " + getIdentifier(cpid));
- }
-
- /**
- * Find ancestor ACL by cpid. Will search till find the ACL or meet a root node.
- *
- * @param cpid
- * - initial parent node id
- * @return owner name
- * @throws SQLException
- * if database error
- * @throws IllegalACLException
- * if wrong ACL
- * @throws IllegalNameException
- * if wrong QName
- * @throws RepositoryException
- * if Repository error
- */
- private AccessControlList traverseACL(String cpid) throws SQLException, IllegalACLException, IllegalNameException,
- RepositoryException
- {
- String naOwner = null;
- List<AccessControlEntry> naPermissions = null;
-
- String caid = cpid;
-
- while (!caid.equals(Constants.ROOT_PARENT_UUID))
- {
- MixinInfo naMixins = readMixins(caid);
- if (naOwner == null && naMixins.hasOwneable())
- {
- naOwner = readACLOwner(caid);
- if (naPermissions != null)
- break;
- }
- if (naPermissions == null && naMixins.hasPrivilegeable())
- {
- naPermissions = readACLPermisions(caid);
- if (naOwner != null)
- break;
- }
-
- if (naMixins.parentId == null)
- caid = findParentId(caid);
- else
- caid = naMixins.parentId;
- }
-
- if (naOwner != null && naPermissions != null)
- {
- // got all
- return new AccessControlList(naOwner, naPermissions);
- }
- else if (naOwner == null && naPermissions == null)
- {
- // Default values (i.e. ACL is disabled in repository)
- return new AccessControlList();
- }
- else
- throw new IllegalACLException("ACL is not found for node with id " + getIdentifier(cpid)
- + " or for its ancestors. But repository is ACL enabled.");
- }
-
- /**
- * [PN] Experimental. Use SP for traversing Qpath on the database server side. Hm, I haven't a
- * good result for that yet. Few seconds only for TCK execution. PGSQL SP: CREATE OR REPLACE
- * FUNCTION get_qpath(parentId VARCHAR) RETURNS SETOF record AS $$ DECLARE cur_item RECORD; cur_id
- * varchar; BEGIN cur_id := parentId; WHILE NOT cur_id = ' ' LOOP SELECT id, name, parent_id,
- * i_index INTO cur_item FROM JCR_SITEM WHERE ID=cur_id; IF NOT found THEN RETURN; END IF; RETURN
- * NEXT cur_item; cur_id := cur_item.parent_id; END LOOP; RETURN; END; $$ LANGUAGE plpgsql;
- *
- * @param cpid
- * @return
- * @throws SQLException
- * if database error
- * @throws InvalidItemStateException
- * if Item state is obsolete
- * @throws IllegalNameException
- * if invalid QName
- */
- private QPath traverseQPath_SP_PGSQL(String cpid) throws SQLException, InvalidItemStateException,
- IllegalNameException
- {
- // get item by Identifier usecase:
- // find parent path in db by cpid
- if (cpid == null)
- {
- // root node
- return null; // Constants.ROOT_PATH
- }
- else
- {
- List<QPathEntry> qrpath = new ArrayList<QPathEntry>(); // reverted path
- PreparedStatement cstmt = null;
- try
- {
- cstmt =
- dbConnection
- .prepareStatement("select * from get_qpath(?) AS (id varchar, name varchar, parent_id varchar, i_index int)");
- cstmt.setString(1, cpid);
- // cstmt.setString(2, caid);
- ResultSet parent = cstmt.executeQuery();
-
- while (parent.next())
- {
- QPathEntry qpe =
- new QPathEntry(InternalQName.parse(parent.getString(COLUMN_NAME)), parent.getInt(COLUMN_INDEX));
- qrpath.add(qpe);
- }
-
- // parent = findItemByIdentifier(caid);
- if (qrpath.size() <= 0)
- throw new InvalidItemStateException("Parent not found, uuid: " + getIdentifier(cpid));
- }
- finally
- {
- if (cstmt != null)
- cstmt.close();
- }
-
- QPathEntry[] qentries = new QPathEntry[qrpath.size()];
- int qi = 0;
- for (int i = qrpath.size() - 1; i >= 0; i--)
- {
- qentries[qi++] = qrpath.get(i);
- }
- return new QPath(qentries);
- }
- }
-
- /**
- * Build ItemData.
- *
- * @param parentPath
- * - parent path
- * @param item
- * database - ResultSet with Item record(s)
- * @param itemClass
- * - Item type (Node or Property)
- * @param parentACL
- * - parent ACL
- * @return ItemData instance
- * @throws RepositoryException
- * Repository error
- * @throws SQLException
- * database error
- * @throws IOException
- * I/O error
- */
- private ItemData itemData(QPath parentPath, ResultSet item, int itemClass, AccessControlList parentACL)
- throws RepositoryException, SQLException, IOException
- {
- String cid = item.getString(COLUMN_ID);
- String cname = item.getString(COLUMN_NAME);
- int cversion = item.getInt(COLUMN_VERSION);
-
- String cpid = item.getString(COLUMN_PARENTID);
- // if parent ID is empty string - it's a root node
- // cpid = cpid.equals(Constants.ROOT_PARENT_UUID) ? null : cpid;
-
- try
- {
- if (itemClass == I_CLASS_NODE)
- {
- int cindex = item.getInt(COLUMN_INDEX);
- int cnordernumb = item.getInt(COLUMN_NORDERNUM);
- return loadNodeRecord(parentPath, cname, cid, cpid, cindex, cversion, cnordernumb, parentACL);
- }
-
- int cptype = item.getInt(COLUMN_PTYPE);
- boolean cpmultivalued = item.getBoolean(COLUMN_PMULTIVALUED);
- return loadPropertyRecord(parentPath, cname, cid, cpid, cversion, cptype, cpmultivalued);
- }
- catch (InvalidItemStateException e)
- {
- throw new InvalidItemStateException("FATAL: Can't build item path for name " + cname + " id: "
- + getIdentifier(cid) + ". " + e);
- }
- }
-
- /**
- * Read property data without value data. For listChildPropertiesData(NodeData).
- *
- * @param parentPath
- * - parent path
- * @param item
- * database - ResultSet with Item record(s)
- * @return PropertyData instance
- * @throws RepositoryException
- * Repository error
- * @throws SQLException
- * database error
- * @throws IOException
- * I/O error
- */
- private PropertyData propertyData(QPath parentPath, ResultSet item) throws RepositoryException, SQLException,
- IOException
- {
- String cid = item.getString(COLUMN_ID);
- String cname = item.getString(COLUMN_NAME);
- int cversion = item.getInt(COLUMN_VERSION);
- String cpid = item.getString(COLUMN_PARENTID);
- int cptype = item.getInt(COLUMN_PTYPE);
- boolean cpmultivalued = item.getBoolean(COLUMN_PMULTIVALUED);
-
- try
- {
- InternalQName qname = InternalQName.parse(cname);
-
- QPath qpath = QPath.makeChildPath(parentPath == null ? traverseQPath(cpid) : parentPath, qname);
-
- PersistedPropertyData pdata =
- new PersistedPropertyData(getIdentifier(cid), qpath, getIdentifier(cpid), cversion, cptype, cpmultivalued,
- new ArrayList<ValueData>());
-
- return pdata;
- }
- catch (InvalidItemStateException e)
- {
- throw new InvalidItemStateException("FATAL: Can't build property path for name " + cname + " id: "
- + getIdentifier(cid) + ". " + e);
- }
- catch (IllegalNameException e)
- {
- throw new RepositoryException(e);
- }
- }
-
- /**
- * Mixin types description (internal use).
- *
- */
- class MixinInfo
- {
-
- /**
- * OWNEABLE constant.
- */
- static final int OWNEABLE = 0x0001; // bits 0001
-
- /**
- * PRIVILEGEABLE constant.
- */
- static final int PRIVILEGEABLE = 0x0002; // bits 0010
-
- /**
- * OWNEABLE_PRIVILEGEABLE constant.
- */
- static final int OWNEABLE_PRIVILEGEABLE = OWNEABLE | PRIVILEGEABLE; // bits 0011
-
- /**
- * Mixin types.
- */
- final List<InternalQName> mixinTypes;
-
- /**
- * oexo:owneable flag.
- */
- final boolean owneable;
-
- /**
- * exo:privilegeable flag.
- */
- final boolean privilegeable;
-
- /**
- * Parent Id.
- */
- final String parentId = null;
-
- /**
- * MixinInfo constructor.
- *
- * @param mixinTypes
- * mixin types
- * @param owneable
- * exo:owneable flag
- * @param privilegeable
- * exo:privilegeable flag
- */
- MixinInfo(List<InternalQName> mixinTypes, boolean owneable, boolean privilegeable)
- {
- this.mixinTypes = mixinTypes;
- this.owneable = owneable;
- this.privilegeable = privilegeable;
- }
-
- /**
- * Return Mixin names array.
- *
- * @return InternalQName[] Mixin names array
- */
- InternalQName[] mixinNames()
- {
- if (mixinTypes != null)
- {
- InternalQName[] mns = new InternalQName[mixinTypes.size()];
- mixinTypes.toArray(mns);
- return mns;
- }
- else
- return new InternalQName[0];
- }
-
- /**
- * Tell is exo:privilegeable.
- *
- * @return boolean
- */
- boolean hasPrivilegeable()
- {
- return privilegeable;
- }
-
- /**
- * Tell is exo:owneable.
- *
- * @return boolean
- */
- boolean hasOwneable()
- {
- return owneable;
- }
- }
-
- /**
- * Read mixins from database.
- *
- * @param cid
- * - Item id (internal)
- * @return MixinInfo
- * @throws SQLException
- * database error
- * @throws IllegalNameException
- * if nodetype name in mixin record is wrong
- */
- protected MixinInfo readMixins(String cid) throws SQLException, IllegalNameException
- {
- ResultSet mtrs = findPropertyByName(cid, Constants.JCR_MIXINTYPES.getAsString());
-
- try
- {
- List<InternalQName> mts = null;
- boolean owneable = false;
- boolean privilegeable = false;
- if (mtrs.next())
- {
- mts = new ArrayList<InternalQName>();
- do
- {
- byte[] mxnb = mtrs.getBytes(COLUMN_VDATA);
- if (mxnb != null)
- {
- InternalQName mxn = InternalQName.parse(new String(mxnb));
- mts.add(mxn);
-
- if (!privilegeable && Constants.EXO_PRIVILEGEABLE.equals(mxn))
- privilegeable = true;
- else if (!owneable && Constants.EXO_OWNEABLE.equals(mxn))
- owneable = true;
- } // else, if SQL NULL - skip it
- }
- while (mtrs.next());
- }
-
- return new MixinInfo(mts, owneable, privilegeable);
- }
- finally
- {
- mtrs.close();
- }
- }
-
- /**
- * Return permission values or throw an exception. We assume the node is mix:privilegeable.
- *
- * @param cid
- * Node id
- * @return list of ACL entries
- * @throws SQLException
- * database error
- * @throws IllegalACLException
- * if property exo:permissions is not found for node
- */
- protected List<AccessControlEntry> readACLPermisions(String cid) throws SQLException, IllegalACLException
- {
- List<AccessControlEntry> naPermissions = new ArrayList<AccessControlEntry>();
- ResultSet exoPerm = findPropertyByName(cid, Constants.EXO_PERMISSIONS.getAsString());
- try
- {
- if (exoPerm.next())
- {
- do
- {
- StringTokenizer parser =
- new StringTokenizer(new String(exoPerm.getBytes(COLUMN_VDATA)), AccessControlEntry.DELIMITER);
- naPermissions.add(new AccessControlEntry(parser.nextToken(), parser.nextToken()));
- }
- while (exoPerm.next());
-
- return naPermissions;
- }
- else
- throw new IllegalACLException("Property exo:permissions is not found for node with id: "
- + getIdentifier(cid));
- }
- finally
- {
- exoPerm.close();
- }
- }
-
- /**
- * Return owner value or throw an exception. We assume the node is mix:owneable.
- *
- * @param cid
- * Node id
- * @return ACL owner
- * @throws SQLException
- * database error
- * @throws IllegalACLException
- * Property exo:owner is not found for node
- */
- protected String readACLOwner(String cid) throws SQLException, IllegalACLException
- {
- ResultSet exoOwner = findPropertyByName(cid, Constants.EXO_OWNER.getAsString());
- try
- {
- if (exoOwner.next())
- return new String(exoOwner.getBytes(COLUMN_VDATA));
- else
- throw new IllegalACLException("Property exo:owner is not found for node with id: " + getIdentifier(cid));
- }
- finally
- {
- exoOwner.close();
- }
- }
-
- /**
- * Load NodeData record.
- *
- * @param parentPath
- * parent path
- * @param cname
- * Node name
- * @param cid
- * Node id
- * @param cpid
- * Node parent id
- * @param cindex
- * Node index
- * @param cversion
- * Node persistent version
- * @param cnordernumb
- * Node order number
- * @param parentACL
- * Node parent ACL
- * @return PersistedNodeData
- * @throws RepositoryException
- * Repository error
- * @throws SQLException
- * database error
- */
- protected PersistedNodeData loadNodeRecord(QPath parentPath, String cname, String cid, String cpid, int cindex,
- int cversion, int cnordernumb, AccessControlList parentACL) throws RepositoryException, SQLException
- {
-
- try
- {
- InternalQName qname = InternalQName.parse(cname);
-
- QPath qpath;
- String parentCid;
- if (parentPath != null)
- {
- // get by parent and name
- qpath = QPath.makeChildPath(parentPath, qname, cindex);
- parentCid = cpid;
- }
- else
- {
- // get by id
- if (cpid.equals(Constants.ROOT_PARENT_UUID))
- {
- // root node
- qpath = Constants.ROOT_PATH;
- parentCid = null;
- }
- else
- {
- qpath = QPath.makeChildPath(traverseQPath(cpid), qname, cindex);
- parentCid = cpid;
- }
- }
-
- try
- {
- // PRIMARY
- ResultSet ptProp = findPropertyByName(cid, Constants.JCR_PRIMARYTYPE.getAsString());
-
- if (!ptProp.next())
- throw new PrimaryTypeNotFoundException("FATAL ERROR primary type record not found. Node "
- + qpath.getAsString() + ", id " + cid + ", container " + this.containerName, null);
-
- byte[] data = ptProp.getBytes(COLUMN_VDATA);
- InternalQName ptName = InternalQName.parse(new String((data != null ? data : new byte[]{})));
-
- // MIXIN
- MixinInfo mixins = readMixins(cid);
-
- // ACL
- AccessControlList acl; // NO DEFAULT values!
-
- if (mixins.hasOwneable())
- {
- // has own owner
- if (mixins.hasPrivilegeable())
- {
- // and permissions
- acl = new AccessControlList(readACLOwner(cid), readACLPermisions(cid));
- }
- else if (parentACL != null)
- {
- // use permissions from existed parent
- acl =
- new AccessControlList(readACLOwner(cid), parentACL.hasPermissions() ? parentACL
- .getPermissionEntries() : null);
- }
- else
- {
- // have to search nearest ancestor permissions in ACL manager
- // acl = new AccessControlList(readACLOwner(cid), traverseACLPermissions(cpid));
- acl = new AccessControlList(readACLOwner(cid), null);
- }
- }
- else if (mixins.hasPrivilegeable())
- {
- // has own permissions
- if (mixins.hasOwneable())
- {
- // and owner
- acl = new AccessControlList(readACLOwner(cid), readACLPermisions(cid));
- }
- else if (parentACL != null)
- {
- // use owner from existed parent
- acl = new AccessControlList(parentACL.getOwner(), readACLPermisions(cid));
- }
- else
- {
- // have to search nearest ancestor owner in ACL manager
- // acl = new AccessControlList(traverseACLOwner(cpid), readACLPermisions(cid));
- acl = new AccessControlList(null, readACLPermisions(cid));
- }
- }
- else
- {
- if (parentACL != null)
- // construct ACL from existed parent ACL
- acl =
- new AccessControlList(parentACL.getOwner(), parentACL.hasPermissions() ? parentACL
- .getPermissionEntries() : null);
- else
- // have to search nearest ancestor owner and permissions in ACL manager
- // acl = traverseACL(cpid);
- acl = null;
- }
-
- return new PersistedNodeData(getIdentifier(cid), qpath, getIdentifier(parentCid), cversion, cnordernumb,
- ptName, mixins.mixinNames(), acl);
- }
- catch (IllegalACLException e)
- {
- throw new RepositoryException("FATAL ERROR Node " + getIdentifier(cid) + " " + qpath.getAsString()
- + " has wrong formed ACL. ", e);
- }
- }
- catch (IllegalNameException e)
- {
- throw new RepositoryException(e);
- }
- }
-
- /**
- * Load PropertyData record.
- *
- * @param parentPath
- * parent path
- * @param cname
- * Property name
- * @param cid
- * Property id
- * @param cpid
- * Property parent id
- * @param cversion
- * Property persistent verison
- * @param cptype
- * Property type
- * @param cpmultivalued
- * Property multivalued status
- * @return PersistedPropertyData
- * @throws RepositoryException
- * Repository error
- * @throws SQLException
- * database error
- * @throws IOException
- * I/O error
- */
- protected PersistedPropertyData loadPropertyRecord(QPath parentPath, String cname, String cid, String cpid,
- int cversion, int cptype, boolean cpmultivalued) throws RepositoryException, SQLException, IOException
- {
-
- // NOTE: cpid never should be null or root parent (' ')
-
- try
- {
- QPath qpath =
- QPath.makeChildPath(parentPath == null ? traverseQPath(cpid) : parentPath, InternalQName.parse(cname));
-
- String identifier = getIdentifier(cid);
- List<ValueData> values = readValues(cid, identifier, cversion);
- PersistedPropertyData pdata =
- new PersistedPropertyData(identifier, qpath, getIdentifier(cpid), cversion, cptype, cpmultivalued, values);
-
- return pdata;
- }
- catch (IllegalNameException e)
- {
- throw new RepositoryException(e);
- }
- }
-
- protected PersistedNodeData loadNodeRecord(ResultSet item, QPath parentPath, AccessControlList pACL)
- throws RepositoryException, SQLException, IOException
- {
-
- String cid = item.getString(COLUMN_ID);
- String cname = item.getString(COLUMN_NAME);
- int cversion = item.getInt(COLUMN_VERSION);
- String cpid = item.getString(COLUMN_PARENTID);
- int cindex = item.getInt(COLUMN_INDEX);
- int cnordernumb = item.getInt(COLUMN_NORDERNUM);
- AccessControlList parentACL = pACL;
-
- try
- {
- InternalQName qname = InternalQName.parse(cname);
-
- // TODO can't avoid QPath traverse
- QPath qpath;
- String parentCid;
- if (parentPath != null)
- {
- // get by parent and name
- qpath = QPath.makeChildPath(parentPath, qname, cindex);
- parentCid = cpid;
- }
- else
- {
- // get by id
- if (cpid.equals(Constants.ROOT_PARENT_UUID))
- {
- // root node
- qpath = Constants.ROOT_PATH;
- parentCid = null;
- }
- else
- {
- qpath = QPath.makeChildPath(traverseQPath(cpid), qname, cindex);
- parentCid = cpid;
- }
- }
-
- // preload properties
-
- Map<String, List<byte[]>> properties = new LinkedHashMap<String, List<byte[]>>();
-
- // PRIMARY
- if (!item.next() || !item.getString(COLUMN_NAME).equals(Constants.JCR_PRIMARYTYPE.getAsString()))
- {
- throw new SQLException("Node finded but primaryType property not " + cid);
- }
-
- byte[] data = item.getBytes(COLUMN_VDATA);
- InternalQName ptName = InternalQName.parse(new String((data != null ? data : new byte[]{})));
-
- // // PRIMARY
- // ResultSet ptProp = findPropertyByName(cid, Constants.JCR_PRIMARYTYPE.getAsString());
- //
- // if (!ptProp.next())
- // throw new PrimaryTypeNotFoundException("FATAL ERROR primary type record not found. Node "
- // + qpath.getAsString() + ", id " + cid + ", container " + this.containerName, null);
- //
- // byte[] data = ptProp.getBytes(COLUMN_VDATA);
- // InternalQName ptName = InternalQName.parse(new String((data != null ? data : new byte[]{})));
-
- // MIXIN
- MixinInfo mixins = null;
- List<InternalQName> mts = null;
- boolean owneable = false;
- boolean privilegeable = false;
- while (item.next() && item.getString(COLUMN_NAME).equals(Constants.JCR_MIXINTYPES.getAsString()))
- {
- mts = new ArrayList<InternalQName>();
- byte[] mxnb = item.getBytes(COLUMN_VDATA);
- if (mxnb != null)
- {
- InternalQName mxn = InternalQName.parse(new String(mxnb));
- mts.add(mxn);
-
- if (!privilegeable && Constants.EXO_PRIVILEGEABLE.equals(mxn))
- privilegeable = true;
- else if (!owneable && Constants.EXO_OWNEABLE.equals(mxn))
- owneable = true;
- } // else, if SQL NULL - skip it
-
- }
-
- mixins = new MixinInfo(mts, owneable, privilegeable);
-
- try
- {
- // ACL
- AccessControlList acl; // NO DEFAULT values!
-
- if (mixins.hasOwneable())
- {
- // has own owner
- if (mixins.hasPrivilegeable())
- {
- // and permissions
- acl = new AccessControlList(readACLOwner(cid), readACLPermisions(cid));
- }
- else if (parentACL != null)
- {
- // use permissions from existed parent
- acl =
- new AccessControlList(readACLOwner(cid), parentACL.hasPermissions() ? parentACL
- .getPermissionEntries() : null);
- }
- else
- {
- // have to search nearest ancestor permissions in ACL manager
- // acl = new AccessControlList(readACLOwner(cid), traverseACLPermissions(cpid));
- acl = new AccessControlList(readACLOwner(cid), null);
- }
- }
- else if (mixins.hasPrivilegeable())
- {
- // has own permissions
- if (mixins.hasOwneable())
- {
- // and owner
- acl = new AccessControlList(readACLOwner(cid), readACLPermisions(cid));
- }
- else if (parentACL != null)
- {
- // use owner from existed parent
- acl = new AccessControlList(parentACL.getOwner(), readACLPermisions(cid));
- }
- else
- {
- // have to search nearest ancestor owner in ACL manager
- // acl = new AccessControlList(traverseACLOwner(cpid), readACLPermisions(cid));
- acl = new AccessControlList(null, readACLPermisions(cid));
- }
- }
- else
- {
- if (parentACL != null)
- // construct ACL from existed parent ACL
- acl =
- new AccessControlList(parentACL.getOwner(), parentACL.hasPermissions() ? parentACL
- .getPermissionEntries() : null);
- else
- // have to search nearest ancestor owner and permissions in ACL manager
- // acl = traverseACL(cpid);
- acl = null;
- }
-
- return new PersistedNodeData(getIdentifier(cid), qpath, getIdentifier(parentCid), cversion, cnordernumb,
- ptName, mixins.mixinNames(), acl);
-
- }
- catch (IllegalACLException e)
- {
- throw new RepositoryException("FATAL ERROR Node " + getIdentifier(cid) + " " + qpath.getAsString()
- + " has wrong formed ACL. ", e);
- }
- }
- catch (IllegalNameException e)
- {
- throw new RepositoryException(e);
- }
- }
-
- protected PersistedNodeData loadNodeFromTemporaryNodeData(TempNodeData buf, QPath parentPath, AccessControlList pACL)
- throws RepositoryException, SQLException, IOException
- {
-
- String cid = buf.cid;
- String cname = buf.cname;
- int cversion = buf.cversion;
- String cpid = buf.cpid;
- int cindex = buf.cindex;
- int cnordernumb = buf.cnordernumb;
- AccessControlList parentACL = pACL;
-
- try
- {
- InternalQName qname = InternalQName.parse(cname);
-
- // TODO can't avoid QPath traverse
- QPath qpath;
- String parentCid;
- if (parentPath != null)
- {
- // get by parent and name
- qpath = QPath.makeChildPath(parentPath, qname, cindex);
- parentCid = cpid;
- }
- else
- {
- // get by id
- if (cpid.equals(Constants.ROOT_PARENT_UUID))
- {
- // root node
- qpath = Constants.ROOT_PATH;
- parentCid = null;
- }
- else
- {
- qpath = QPath.makeChildPath(traverseQPath(cpid), qname, cindex);
- parentCid = cpid;
- }
- }
-
- // PRIMARY
-
- List<byte[]> primaryType = buf.properties.get(Constants.JCR_PRIMARYTYPE.getAsString());
- if (primaryType == null || primaryType.size() == 0)
- {
- throw new SQLException("Node finded but primaryType property not " + cid);
- }
-
- byte[] data = primaryType.get(0);
- InternalQName ptName = InternalQName.parse(new String((data != null ? data : new byte[]{})));
-
- // MIXIN
- MixinInfo mixins = null;
- List<InternalQName> mts = null;
- boolean owneable = false;
- boolean privilegeable = false;
- List<byte[]> mixinTypes = buf.properties.get(Constants.JCR_MIXINTYPES.getAsString());
- if (mixinTypes != null)
- {
- mts = new ArrayList<InternalQName>();
- for (byte[] mxnb : mixinTypes)
- {
- InternalQName mxn = InternalQName.parse(new String(mxnb));
- mts.add(mxn);
-
- if (!privilegeable && Constants.EXO_PRIVILEGEABLE.equals(mxn))
- privilegeable = true;
- else if (!owneable && Constants.EXO_OWNEABLE.equals(mxn))
- owneable = true;
- }
- }
-
- mixins = new MixinInfo(mts, owneable, privilegeable);
-
- try
- {
- // ACL
- AccessControlList acl; // NO DEFAULT values!
-
- if (mixins.hasOwneable())
- {
- // has own owner
- if (mixins.hasPrivilegeable())
- {
- // and permissions
- acl = new AccessControlList(readACLOwner(cid), readACLPermisions(cid));
- }
- else if (parentACL != null)
- {
- // use permissions from existed parent
- acl =
- new AccessControlList(readACLOwner(cid), parentACL.hasPermissions() ? parentACL
- .getPermissionEntries() : null);
- }
- else
- {
- // have to search nearest ancestor permissions in ACL manager
- // acl = new AccessControlList(readACLOwner(cid), traverseACLPermissions(cpid));
- acl = new AccessControlList(readACLOwner(cid), null);
- }
- }
- else if (mixins.hasPrivilegeable())
- {
- // has own permissions
- if (mixins.hasOwneable())
- {
- // and owner
- acl = new AccessControlList(readACLOwner(cid), readACLPermisions(cid));
- }
- else if (parentACL != null)
- {
- // use owner from existed parent
- acl = new AccessControlList(parentACL.getOwner(), readACLPermisions(cid));
- }
- else
- {
- // have to search nearest ancestor owner in ACL manager
- // acl = new AccessControlList(traverseACLOwner(cpid), readACLPermisions(cid));
- acl = new AccessControlList(null, readACLPermisions(cid));
- }
- }
- else
- {
- if (parentACL != null)
- // construct ACL from existed parent ACL
- acl =
- new AccessControlList(parentACL.getOwner(), parentACL.hasPermissions() ? parentACL
- .getPermissionEntries() : null);
- else
- // have to search nearest ancestor owner and permissions in ACL manager
- // acl = traverseACL(cpid);
- acl = null;
- }
-
- return new PersistedNodeData(getIdentifier(cid), qpath, getIdentifier(parentCid), cversion, cnordernumb,
- ptName, mixins.mixinNames(), acl);
-
- }
- catch (IllegalACLException e)
- {
- throw new RepositoryException("FATAL ERROR Node " + getIdentifier(cid) + " " + qpath.getAsString()
- + " has wrong formed ACL. ", e);
- }
- }
- catch (IllegalNameException e)
- {
- throw new RepositoryException(e);
- }
- }
-
- protected PersistedPropertyData loadPropertyRecord(ResultSet item, QPath parentPath) throws RepositoryException,
- SQLException, IOException
- {
- String cid = item.getString(COLUMN_ID);
- String cname = item.getString(COLUMN_NAME);
- int cversion = item.getInt(COLUMN_VERSION);
-
- String cpid = item.getString(COLUMN_PARENTID);
- // if parent ID is empty string - it's a root node
- // cpid = cpid.equals(Constants.ROOT_PARENT_UUID) ? null : cpid;
-
- try
- {
- int cptype = item.getInt(COLUMN_PTYPE);
- boolean cpmultivalued = item.getBoolean(COLUMN_PMULTIVALUED);
- try
- {
- QPath qpath =
- QPath.makeChildPath(parentPath == null ? traverseQPath(cpid) : parentPath, InternalQName.parse(cname));
-
- List<ValueData> data = new ArrayList<ValueData>();
-
- String identifier = getIdentifier(cid);
-
- do
- {
- final int orderNum = item.getInt(COLUMN_VORDERNUM);
- final String storageId = item.getString(COLUMN_VSTORAGE_DESC);
- ValueData vdata =
- item.wasNull() ? readValueData(cid, orderNum, cversion, item.getBinaryStream(COLUMN_VDATA))
- : readValueData(identifier, orderNum, storageId);
- data.add(vdata);
- }
- while (item.next() && item.getString(COLUMN_ID) == cid);
-
- PersistedPropertyData pdata =
- new PersistedPropertyData(identifier, qpath, getIdentifier(cpid), cversion, cptype, cpmultivalued, data);
-
- return pdata;
- }
- catch (IllegalNameException e)
- {
- throw new RepositoryException(e);
- }
- }
- catch (InvalidItemStateException e)
- {
- throw new InvalidItemStateException("FATAL: Can't build item path for name " + cname + " id: "
- + getIdentifier(cid) + ". " + e);
- }
- }
-
- /**
- * Delete Property Values.
- *
- * @param cid
- * Property id
- * @param pdata
- * PropertyData
- * @param update
- * boolean true if it's delete-add sequence (update operation)
- * @throws IOException
- * i/O error
- * @throws SQLException
- * if database error occurs
- * @throws ValueStorageNotFoundException
- * if no such storage found with Value storageId
- */
- private void deleteValues(String cid, PropertyData pdata, boolean update) throws IOException, SQLException,
- ValueStorageNotFoundException
- {
-
- final ResultSet valueRecords = findValuesStorageDescriptorsByPropertyId(cid);
- try
- {
- if (valueRecords.next())
- {
- // delete all Values in database
- deleteValueData(cid);
-
- do
- {
- final String storageId = valueRecords.getString(COLUMN_VSTORAGE_DESC);
- if (!valueRecords.wasNull())
- {
- final ValueIOChannel channel = valueStorageProvider.getChannel(storageId);
- try
- {
- channel.delete(pdata.getIdentifier());
- valueChanges.add(channel);
- }
- finally
- {
- channel.close();
- }
- }
- }
- while (valueRecords.next());
- }
- }
- finally
- {
- valueRecords.close();
- }
- }
-
- /**
- * Read Property Values.
- *
- * @param identifier
- * property identifier
- * @param cid
- * Property id
- * @param pdata
- * PropertyData
- * @return list of ValueData
- * @throws IOException
- * i/O error
- * @throws SQLException
- * if database errro occurs
- * @throws ValueStorageNotFoundException
- * if no such storage found with Value storageId
- */
- private List<ValueData> readValues(String cid, String identifier, int cversion) throws IOException, SQLException,
- ValueStorageNotFoundException
- {
-
- List<ValueData> data = new ArrayList<ValueData>();
-
- final ResultSet valueRecords = findValuesByPropertyId(cid);
- try
- {
- while (valueRecords.next())
- {
- final int orderNum = valueRecords.getInt(COLUMN_VORDERNUM);
- final String storageId = valueRecords.getString(COLUMN_VSTORAGE_DESC);
- ValueData vdata =
- valueRecords.wasNull() ? readValueData(cid, orderNum, cversion, valueRecords
- .getBinaryStream(COLUMN_VDATA)) : readValueData(identifier, orderNum, storageId);
- data.add(vdata);
- }
- }
- finally
- {
- valueRecords.close();
- }
-
- return data;
- }
-
- /**
- * Read ValueData from External Storage.
- *
- * @param pdata
- * PropertyData
- * @param orderNumber
- * Value order number
- * @param storageId
- * external Value storage id
- * @return ValueData
- * @throws SQLException
- * database error
- * @throws IOException
- * I/O error
- * @throws ValueStorageNotFoundException
- * if no such storage found with Value storageId
- */
- protected ValueData readValueData(String identifier, int orderNumber, String storageId) throws SQLException,
- IOException, ValueStorageNotFoundException
- {
- ValueIOChannel channel = valueStorageProvider.getChannel(storageId);
- try
- {
- return channel.read(identifier, orderNumber, maxBufferSize);
- }
- finally
- {
- channel.close();
- }
- }
-
- /**
- * Read ValueData from database.
- *
- * @param cid
- * Property id
- * @param orderNumber
- * Value order number
- * @param version
- * persistent version (used for BLOB swapping)
- * @param content
- * @return ValueData
- * @throws SQLException
- * database error
- * @throws IOException
- * I/O error (swap)
- */
- protected ValueData readValueData(String cid, int orderNumber, int version, final InputStream content)
- throws SQLException, IOException
- {
-
- ResultSet valueResultSet = null;
-
- byte[] buffer = new byte[0];
- byte[] spoolBuffer = new byte[ValueFileIOHelper.IOBUFFER_SIZE];
- int read;
- int len = 0;
- OutputStream out = null;
-
- SwapFile swapFile = null;
- try
- {
- // stream from database
- if (content != null)
- while ((read = content.read(spoolBuffer)) >= 0)
- {
- if (out != null)
- {
- // spool to temp file
- out.write(spoolBuffer, 0, read);
- len += read;
- }
- else if (len + read > maxBufferSize)
- {
- // threshold for keeping data in memory exceeded;
- // create temp file and spool buffer contents
- swapFile = SwapFile.get(swapDirectory, cid + orderNumber + "." + version);
- if (swapFile.isSpooled())
- {
- // break, value already spooled
- buffer = null;
- break;
- }
- out = new FileOutputStream(swapFile);
- out.write(buffer, 0, len);
- out.write(spoolBuffer, 0, read);
- buffer = null;
- len += read;
- }
- else
- {
- // reallocate new buffer and spool old buffer contents
- byte[] newBuffer = new byte[len + read];
- System.arraycopy(buffer, 0, newBuffer, 0, len);
- System.arraycopy(spoolBuffer, 0, newBuffer, len, read);
- buffer = newBuffer;
- len += read;
- }
- }
- }
- finally
- {
- if (valueResultSet != null)
- valueResultSet.close();
- if (out != null)
- {
- out.close();
- swapFile.spoolDone();
- }
- }
-
- if (buffer == null)
- return new CleanableFilePersistedValueData(orderNumber, swapFile, swapCleaner);
-
- return new ByteArrayPersistedValueData(orderNumber, buffer);
- }
-
- /**
- * Writes value data to swap file.
- *
- * @param cid
- * Property id
- * @param orderNumber
- * Value order number
- * @param version
- * persistent version (used for BLOB swapping)
- * @param content
- * @return ValueData
- * @throws SQLException
- * database error
- * @throws IOException
- * I/O error (swap)
- */
- protected SwapFile swapValueData(String cid, int orderNumber, int version, final InputStream content)
- throws SQLException, IOException
- {
-
- byte[] spoolBuffer = new byte[ValueFileIOHelper.IOBUFFER_SIZE];
- int read;
- int len = 0;
-
- SwapFile swapFile = SwapFile.get(swapDirectory, cid + orderNumber + "." + version);
- OutputStream out = new FileOutputStream(swapFile);;
-
- if (swapFile.isSpooled())
- {
- return swapFile;
- }
-
- try
- {
- if (content != null)
- while ((read = content.read(spoolBuffer)) >= 0)
- {
- // spool to temp file
- out.write(spoolBuffer, 0, read);
- len += read;
- }
- }
- finally
- {
- out.close();
- swapFile.spoolDone();
- }
-
- return swapFile;
- }
-
- /**
- * Add Values to Property record.
- *
- * @param data
- * PropertyData
- * @throws SQLException
- * database error
- * @throws IOException
- * I/O error
- * @thorws RepositoryException if Value data large of JDBC accepted (Integer.MAX_VALUE)
- */
- protected void addValues(String cid, PropertyData data) throws IOException, SQLException, RepositoryException
- {
- List<ValueData> vdata = data.getValues();
-
- for (int i = 0; i < vdata.size(); i++)
- {
- ValueData vd = vdata.get(i);
- ValueIOChannel channel = valueStorageProvider.getApplicableChannel(data, i);
- InputStream stream;
- int streamLength;
- String storageId;
- if (channel == null)
- {
- // prepare write of Value in database
- if (vd.isByteArray())
- {
- byte[] dataBytes = vd.getAsByteArray();
- stream = new ByteArrayInputStream(dataBytes);
- streamLength = dataBytes.length;
- }
- else
- {
- // it's StreamPersistedValueData
- StreamPersistedValueData streamData = (StreamPersistedValueData)vd;
- stream = streamData.getStream();
-
- // TODO spool on JDBC driver read - multiplexing the data to two stores, database and spool file, with one read.
- SwapFile swapFile = swapValueData(cid, i, data.getPersistedVersion(), stream);
-
- long vlen = swapFile.length();
- if (vlen < 0)
- {
- // TODO not actual with SwapFile, but if it will be reworked can be so
- streamLength = stream.available();
- LOG.warn("Cannot obtain exact Value data length, will use available from the stream " + streamLength
- + ". Property " + data.getQPath().getAsString());
- }
- else if (vlen <= Integer.MAX_VALUE)
- {
- streamLength = (int)vlen;
- }
- else
- {
- throw new RepositoryException("Value data large of allowed by JDBC (Integer.MAX_VALUE) " + vlen
- + ". Property " + data.getQPath().getAsString());
- }
-
- // set persistent file to ValueData, will be available for saving Property.
- streamData.setPersistedFile(swapFile);
- stream = streamData.getAsStream();
- }
- storageId = null;
- }
- else
- {
- // write Value in external VS
- channel.write(data.getIdentifier(), vd);
- valueChanges.add(channel);
- storageId = channel.getStorageId();
- stream = null;
- streamLength = 0;
- }
- addValueData(cid, i, stream, streamLength, storageId);
- }
- }
-
- protected abstract int addNodeRecord(NodeData data) throws SQLException;
-
- protected abstract int addPropertyRecord(PropertyData prop) throws SQLException;
-
- protected abstract ResultSet findItemByIdentifier(String identifier) throws SQLException;
-
- protected abstract ResultSet findPropertyByName(String parentId, String name) throws SQLException;
-
- protected abstract ResultSet findItemByName(String parentId, String name, int index) throws SQLException;
-
- protected abstract ResultSet findChildNodesByParentIdentifier(String parentIdentifier) throws SQLException;
-
- protected abstract ResultSet findChildNodesCountByParentIdentifier(String parentIdentifier) throws SQLException;
-
- protected abstract ResultSet findChildPropertiesByParentIdentifier(String parentIdentifier) throws SQLException;
-
- protected abstract int addReference(PropertyData data) throws SQLException, IOException;
-
- protected abstract int renameNode(NodeData data) throws SQLException;
-
- protected abstract int deleteReference(String propertyIdentifier) throws SQLException;
-
- protected abstract ResultSet findReferences(String nodeIdentifier) throws SQLException;
-
- protected abstract int deleteItemByIdentifier(String identifier) throws SQLException;
-
- protected abstract int updateNodeByIdentifier(int version, int index, int orderNumb, String identifier)
- throws SQLException;
-
- protected abstract int updatePropertyByIdentifier(int version, int type, String identifier) throws SQLException;
-
- // -------- values processing ------------
- protected abstract int addValueData(String cid, int orderNumber, InputStream stream, int streamLength,
- String storageId) throws SQLException;
-
- protected abstract int deleteValueData(String cid) throws SQLException;
-
- protected abstract ResultSet findValuesByPropertyId(String cid) throws SQLException;
-
- protected abstract ResultSet findValuesStorageDescriptorsByPropertyId(String cid) throws SQLException;
-
- @Deprecated
- protected abstract ResultSet findValueByPropertyIdOrderNumber(String cid, int orderNumb) throws SQLException;
-
- protected abstract ResultSet findItemByIdentifierNew(String identifier) throws SQLException;
-
- protected abstract ResultSet findItemByNameNew(String parentId, String name, int index) throws SQLException;
-
- protected abstract ResultSet findChildNodesByParentIdentifierNew(String parentIdentifier) throws SQLException;
-
- protected abstract ResultSet getChildPropertiesByParentIdentifier(String parentIdentifier) throws SQLException;
-
- protected abstract ResultSet findReferenceProperties(String parentIdentifier) throws SQLException;
-}
Deleted: jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/NewJDBCWorkspaceDataContainer.java
===================================================================
--- jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/NewJDBCWorkspaceDataContainer.java 2009-12-25 15:51:39 UTC (rev 1193)
+++ jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/NewJDBCWorkspaceDataContainer.java 2009-12-25 15:55:34 UTC (rev 1194)
@@ -1,802 +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;
-
-import org.exoplatform.services.jcr.config.RepositoryConfigurationException;
-import org.exoplatform.services.jcr.config.RepositoryEntry;
-import org.exoplatform.services.jcr.config.WorkspaceEntry;
-import org.exoplatform.services.jcr.impl.storage.WorkspaceDataContainerBase;
-import org.exoplatform.services.jcr.impl.storage.jdbc.DBConstants;
-import org.exoplatform.services.jcr.impl.storage.jdbc.db.GenericConnectionFactory;
-import org.exoplatform.services.jcr.impl.storage.jdbc.db.OracleConnectionFactory;
-import org.exoplatform.services.jcr.impl.storage.jdbc.db.WorkspaceStorageConnectionFactory;
-import org.exoplatform.services.jcr.impl.storage.jdbc.init.DBInitializer;
-import org.exoplatform.services.jcr.impl.storage.jdbc.init.DBInitializerException;
-import org.exoplatform.services.jcr.impl.storage.jdbc.init.IngresSQLDBInitializer;
-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.optimisation.db.HSQLDBConnectionFactory;
-import org.exoplatform.services.jcr.impl.storage.jdbc.optimisation.db.MySQLConnectionFactory;
-import org.exoplatform.services.jcr.impl.storage.jdbc.update.StorageUpdateManager;
-import org.exoplatform.services.jcr.impl.util.io.FileCleaner;
-import org.exoplatform.services.jcr.storage.WorkspaceDataContainer;
-import org.exoplatform.services.jcr.storage.WorkspaceStorageConnection;
-import org.exoplatform.services.jcr.storage.value.ValueStoragePluginProvider;
-import org.exoplatform.services.log.ExoLogger;
-import org.exoplatform.services.log.Log;
-import org.exoplatform.services.naming.InitialContextInitializer;
-import org.picocontainer.Startable;
-
-import java.io.File;
-import java.io.IOException;
-import java.sql.Connection;
-
-import javax.jcr.RepositoryException;
-import javax.naming.InitialContext;
-import javax.naming.NamingException;
-import javax.sql.DataSource;
-
-/**
- * Created by The eXo Platform SAS.
- *
- * @author <a href="mailto:peter.nedonosko@exoplatform.com.ua">Peter Nedonosko</a>
- * @version $Id:GenericWorkspaceDataContainer.java 13433 2007-03-15 16:07:23Z peterit $
- */
-public class NewJDBCWorkspaceDataContainer extends WorkspaceDataContainerBase implements Startable
-{
-
- protected static final Log LOG = ExoLogger.getLogger("jcr.JDBCWorkspaceDataContainer");
-
- //configuration params
-
- public final static String SOURCE_NAME = "source-name";
-
- public final static String MULTIDB = "multi-db";
-
- public final static String SINGLEDB = "single-db";
-
- /**
- * Describe which type of RDBMS will be used (DB creation metadata etc.)
- */
- public final static String DB_DIALECT = "dialect";
-
- public final static String DB_DRIVER = "driverClassName";
-
- public final static String DB_URL = "url";
-
- public final static String DB_USERNAME = "username";
-
- public final static String DB_PASSWORD = "password";
-
- protected final String containerName;
-
- protected final String dbSourceName;
-
- protected final boolean multiDb;
-
- protected final String dbDriver;
-
- protected final String dbDialect;
-
- protected final String dbUrl;
-
- protected final String dbUserName;
-
- protected final String dbPassword;
-
- protected final ValueStoragePluginProvider valueStorageProvider;
-
- protected String storageVersion;
-
- protected int maxBufferSize;
-
- protected File swapDirectory;
-
- protected FileCleaner swapCleaner;
-
- protected GenericConnectionFactory connFactory;
-
- /**
- * Shared connection factory.
- *
- * Issued to share JDBC connection between system and regular workspace in case of same database
- * used for storage.
- *
- */
- class SharedConnectionFactory extends GenericConnectionFactory
- {
-
- /**
- * JDBC connection.
- */
- final private Connection connection;
-
- /**
- * SharedConnectionFactory constructor.
- *
- * @param connection
- * JDBC - connection
- * @param containerName
- * - container name
- * @param multiDb
- * - multidatabase status
- * @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).
- */
- SharedConnectionFactory(Connection connection, String containerName, boolean multiDb,
- ValueStoragePluginProvider valueStorageProvider, int maxBufferSize, File swapDirectory, FileCleaner swapCleaner)
- {
-
- super(null, null, null, null, null, containerName, multiDb, valueStorageProvider, maxBufferSize,
- swapDirectory, swapCleaner);
-
- this.connection = connection;
- }
-
- /**
- * {@inheritDoc}
- */
- public Connection getJdbcConnection() throws RepositoryException
- {
- return connection;
- }
- }
-
- /**
- * Constructor with value storage plugins.
- *
- * @param wsConfig
- * Workspace configuration
- * @param valueStrorageProvider
- * External Value Stprages provider
- * @throws RepositoryConfigurationException
- * if Repository configuration is wrong
- * @throws NamingException
- * if JNDI exception (on DataSource lookup)
- */
- public NewJDBCWorkspaceDataContainer(WorkspaceEntry wsConfig, RepositoryEntry repConfig,
- InitialContextInitializer contextInit, ValueStoragePluginProvider valueStorageProvider)
- throws RepositoryConfigurationException, NamingException, RepositoryException, IOException
- {
-
- checkIntegrity(wsConfig, repConfig);
-
- this.containerName = wsConfig.getName();
- this.multiDb = Boolean.parseBoolean(wsConfig.getContainer().getParameterValue(MULTIDB));
- this.valueStorageProvider = valueStorageProvider;
-
- // ------------- Database config ------------------
- String pDbDialect = null;
- try
- {
- pDbDialect = detectDialect(wsConfig.getContainer().getParameterValue(DB_DIALECT));
- LOG.info("Using a dialect '" + pDbDialect + "'");
- }
- catch (RepositoryConfigurationException e)
- {
- LOG.info("Using a default dialect '" + DBConstants.DB_DIALECT_GENERIC + "'");
- pDbDialect = DBConstants.DB_DIALECT_GENERIC;
- }
- this.dbDialect = pDbDialect;
-
- String pDbDriver = null;
- String pDbUrl = null;
- String pDbUserName = null;
- String pDbPassword = null;
- try
- {
- pDbDriver = wsConfig.getContainer().getParameterValue(DB_DRIVER);
-
- // username/passwd may not pesent
- try
- {
- pDbUserName = wsConfig.getContainer().getParameterValue(DB_USERNAME);
- pDbPassword = wsConfig.getContainer().getParameterValue(DB_PASSWORD);
- }
- catch (RepositoryConfigurationException e)
- {
- pDbUserName = pDbPassword = null;
- }
-
- pDbUrl = wsConfig.getContainer().getParameterValue(DB_URL); // last here!
- }
- catch (RepositoryConfigurationException e)
- {
- }
-
- if (pDbUrl != null)
- {
- this.dbDriver = pDbDriver;
- this.dbUrl = pDbUrl;
- this.dbUserName = pDbUserName;
- this.dbPassword = pDbPassword;
- this.dbSourceName = null;
- LOG.info("Connect to JCR database as user '" + this.dbUserName + "'");
- }
- else
- {
- this.dbDriver = null;
- this.dbUrl = null;
- this.dbUserName = null;
- this.dbPassword = null;
-
- String sn;
- try
- {
- sn = wsConfig.getContainer().getParameterValue(SOURCE_NAME);
- }
- catch (RepositoryConfigurationException e)
- {
- sn = wsConfig.getContainer().getParameterValue("sourceName"); // TODO for backward comp,
- // remove in rel.2.0
- }
- this.dbSourceName = sn;
- }
-
- // ------------- Values swap config ------------------
- try
- {
- this.maxBufferSize = wsConfig.getContainer().getParameterInteger(MAXBUFFERSIZE_PROP);
- }
- catch (RepositoryConfigurationException e)
- {
- this.maxBufferSize = DEF_MAXBUFFERSIZE;
- }
-
- try
- {
- String sdParam = wsConfig.getContainer().getParameterValue(SWAPDIR_PROP);
- this.swapDirectory = new File(sdParam);
- }
- catch (RepositoryConfigurationException e1)
- {
- this.swapDirectory = new File(DEF_SWAPDIR);
- }
- if (!swapDirectory.exists())
- swapDirectory.mkdirs();
-
- this.swapCleaner = new FileCleaner(false);
-
- initDatabase();
-
- String suParam = null;
- boolean enableStorageUpdate = false;
- try
- {
- suParam = wsConfig.getContainer().getParameterValue("update-storage");
- enableStorageUpdate = Boolean.parseBoolean(suParam);
- }
- catch (RepositoryConfigurationException e)
- {
- if (LOG.isDebugEnabled())
- LOG.debug("update-storage parameter is not set " + dbSourceName);
- }
-
- this.storageVersion =
- StorageUpdateManager.checkVersion(dbSourceName, this.connFactory.getJdbcConnection(), multiDb,
- enableStorageUpdate);
-
- LOG.info(getInfo());
- }
-
- /**
- * Prepare sefault connection factory.
- *
- * @return GenericConnectionFactory
- * @throws NamingException
- * on JNDI error
- * @throws RepositoryException
- * on Storage error
- */
- protected GenericConnectionFactory defaultConnectionFactory() throws NamingException, RepositoryException
- {
- // by default
- if (dbSourceName != null)
- {
- DataSource ds = (DataSource)new InitialContext().lookup(dbSourceName);
- if (ds != null)
- return new GenericConnectionFactory(ds, containerName, multiDb, valueStorageProvider, maxBufferSize,
- swapDirectory, swapCleaner);
-
- throw new RepositoryException("Datasource '" + dbSourceName + "' is not bound in this context.");
- }
-
- return new GenericConnectionFactory(dbDriver, dbUrl, dbUserName, dbPassword, containerName, multiDb,
- valueStorageProvider, maxBufferSize, swapDirectory, swapCleaner);
- }
-
- /**
- * Prepare default DB initializer.
- *
- * @param sqlPath
- * - path to SQL script (database creation script)
- * @return DBInitializer instance
- * @throws NamingException
- * on JNDI error
- * @throws RepositoryException
- * on Storage error
- * @throws IOException
- * on I/O error
- */
- protected DBInitializer defaultDBInitializer(String sqlPath) throws NamingException, RepositoryException,
- IOException
- {
- return new DBInitializer(containerName, this.connFactory.getJdbcConnection(), sqlPath, multiDb);
- }
-
- /**
- * Checks if DataSources used in right manner.
- *
- * @param wsConfig
- * Workspace configuration
- * @param repConfig
- * Repository configuration
- * @throws RepositoryConfigurationException
- * in case of configuration errors
- */
- protected void checkIntegrity(WorkspaceEntry wsConfig, RepositoryEntry repConfig)
- throws RepositoryConfigurationException
- {
- boolean isMulti;
- for (WorkspaceEntry wsEntry : repConfig.getWorkspaceEntries())
- {
- if (wsEntry.getName().equals(wsConfig.getName())
- || !wsEntry.getContainer().getType().equals(wsConfig.getContainer().getType())
- || !wsEntry.getContainer().getType().equals(this.getClass().getName()))
- continue;
-
- // MULTIDB
- if (!wsEntry.getContainer().getParameterValue(MULTIDB).equals(
- wsConfig.getContainer().getParameterValue(MULTIDB)))
- {
- throw new RepositoryConfigurationException("All workspaces must be " + MULTIDB + " or " + SINGLEDB
- + ". But " + wsEntry.getName() + "- multi-db=" + wsEntry.getContainer().getParameterValue(MULTIDB)
- + " and " + wsConfig.getName() + "- multi-db=" + wsConfig.getContainer().getParameterValue(MULTIDB));
- }
-
- isMulti = Boolean.parseBoolean(wsConfig.getContainer().getParameterValue(MULTIDB));
-
- // source name
- String wsSourceName = null;
- String newWsSourceName = null;
- try
- {
- wsSourceName = wsEntry.getContainer().getParameterValue("sourceName");
- newWsSourceName = wsConfig.getContainer().getParameterValue("sourceName");
- }
- catch (RepositoryConfigurationException e)
- {
- }
-
- if (wsSourceName != null && newWsSourceName != null)
- {
- if (isMulti)
- {
- if (wsSourceName.equals(newWsSourceName))
- {
- throw new RepositoryConfigurationException("SourceName " + wsSourceName + " alredy in use in "
- + wsEntry.getName() + ". SourceName must be different in " + MULTIDB
- + ". Check configuration for " + wsConfig.getName());
- }
- }
- else
- {
- if (!wsSourceName.equals(newWsSourceName))
- {
- throw new RepositoryConfigurationException("SourceName must be equals in " + SINGLEDB + " "
- + "repository." + " Check " + wsEntry.getName() + " and " + wsConfig.getName());
- }
- }
- continue;
- }
-
- // db-url
- String wsUri = null;
- String newWsUri = null;
- try
- {
- wsUri = wsEntry.getContainer().getParameterValue("db-url");
- newWsUri = wsConfig.getContainer().getParameterValue("db-url");
- }
- catch (RepositoryConfigurationException e)
- {
- }
-
- if (wsUri != null && newWsUri != null)
- {
- if (isMulti)
- {
- if (wsUri.equals(newWsUri))
- {
- throw new RepositoryConfigurationException("db-url " + wsUri + " alredy in use in "
- + wsEntry.getName() + ". db-url must be different in " + MULTIDB + ". Check configuration for "
- + wsConfig.getName());
-
- }
- }
- else
- {
- if (!wsUri.equals(newWsUri))
- {
- throw new RepositoryConfigurationException("db-url must be equals in " + SINGLEDB + " "
- + "repository." + " Check " + wsEntry.getName() + " and " + wsConfig.getName());
- }
- }
- }
- }
- }
-
- /**
- * Init storage database.
- *
- * @throws NamingException
- * on JNDI error
- * @throws RepositoryException
- * on storage error
- * @throws IOException
- * on I/O error
- */
- protected void initDatabase() throws NamingException, RepositoryException, IOException
- {
-
- DBInitializer dbInitilizer = null;
- String sqlPath = null;
- if (dbDialect == DBConstants.DB_DIALECT_ORACLEOCI)
- {
- LOG.warn(DBConstants.DB_DIALECT_ORACLEOCI + " dialect is experimental!");
- // sample of connection factory customization
- if (dbSourceName != null)
- this.connFactory = defaultConnectionFactory();
- else
- this.connFactory =
- new OracleConnectionFactory(dbDriver, dbUrl, dbUserName, dbPassword, containerName, multiDb,
- valueStorageProvider, maxBufferSize, swapDirectory, swapCleaner);
-
- sqlPath = "/conf/storage/jcr-" + (multiDb ? "m" : "s") + "jdbc.ora.sql";
-
- // a particular db initializer may be configured here too
- dbInitilizer = new OracleDBInitializer(containerName, this.connFactory.getJdbcConnection(), sqlPath, multiDb);
- }
- else if (dbDialect == DBConstants.DB_DIALECT_ORACLE)
- {
- this.connFactory = defaultConnectionFactory();
- sqlPath = "/conf/storage/jcr-" + (multiDb ? "m" : "s") + "jdbc.ora.sql";
- dbInitilizer = new OracleDBInitializer(containerName, this.connFactory.getJdbcConnection(), sqlPath, multiDb);
- }
- else if (dbDialect == DBConstants.DB_DIALECT_PGSQL)
- {
- this.connFactory = defaultConnectionFactory();
- sqlPath = "/conf/storage/jcr-" + (multiDb ? "m" : "s") + "jdbc.pgsql.sql";
- dbInitilizer = new PgSQLDBInitializer(containerName, this.connFactory.getJdbcConnection(), sqlPath, multiDb);
- }
- else if (dbDialect == DBConstants.DB_DIALECT_MYSQL)
- {
- // [PN] 28.06.07
- if (dbSourceName != null)
- {
- DataSource ds = (DataSource)new InitialContext().lookup(dbSourceName);
- if (ds != null)
- this.connFactory =
- new MySQLConnectionFactory(ds, containerName, multiDb, valueStorageProvider, maxBufferSize,
- swapDirectory, swapCleaner);
- else
- throw new RepositoryException("Datasource '" + dbSourceName + "' is not bound in this context.");
- }
- else
- this.connFactory =
- new MySQLConnectionFactory(dbDriver, dbUrl, dbUserName, dbPassword, containerName, multiDb,
- valueStorageProvider, maxBufferSize, swapDirectory, swapCleaner);
-
- sqlPath = "/conf/storage/jcr-" + (multiDb ? "m" : "s") + "jdbc.mysql.sql";
- dbInitilizer = defaultDBInitializer(sqlPath);
- }
- else if (dbDialect == DBConstants.DB_DIALECT_MYSQL_UTF8)
- {
- // [PN] 13.07.08
- if (dbSourceName != null)
- {
- DataSource ds = (DataSource)new InitialContext().lookup(dbSourceName);
- if (ds != null)
- this.connFactory =
- new MySQLConnectionFactory(ds, containerName, multiDb, valueStorageProvider, maxBufferSize,
- swapDirectory, swapCleaner);
- else
- throw new RepositoryException("Datasource '" + dbSourceName + "' is not bound in this context.");
- }
- else
- this.connFactory =
- new MySQLConnectionFactory(dbDriver, dbUrl, dbUserName, dbPassword, containerName, multiDb,
- valueStorageProvider, maxBufferSize, swapDirectory, swapCleaner);
-
- sqlPath = "/conf/storage/jcr-" + (multiDb ? "m" : "s") + "jdbc.mysql-utf8.sql";
- dbInitilizer = defaultDBInitializer(sqlPath);
- }
- else if (dbDialect == DBConstants.DB_DIALECT_MSSQL)
- {
- this.connFactory = defaultConnectionFactory();
- sqlPath = "/conf/storage/jcr-" + (multiDb ? "m" : "s") + "jdbc.mssql.sql";
- dbInitilizer = defaultDBInitializer(sqlPath);
- }
- else if (dbDialect == DBConstants.DB_DIALECT_DERBY)
- {
- this.connFactory = defaultConnectionFactory();
- sqlPath = "/conf/storage/jcr-" + (multiDb ? "m" : "s") + "jdbc.derby.sql";
- dbInitilizer = defaultDBInitializer(sqlPath);
- }
- else if (dbDialect == DBConstants.DB_DIALECT_DB2)
- {
- this.connFactory = defaultConnectionFactory();
- sqlPath = "/conf/storage/jcr-" + (multiDb ? "m" : "s") + "jdbc.db2.sql";
- dbInitilizer = defaultDBInitializer(sqlPath);
- }
- else if (dbDialect == DBConstants.DB_DIALECT_DB2V8)
- {
- this.connFactory = defaultConnectionFactory();
- sqlPath = "/conf/storage/jcr-" + (multiDb ? "m" : "s") + "jdbc.db2v8.sql";
- dbInitilizer = defaultDBInitializer(sqlPath);
- }
- else if (dbDialect == DBConstants.DB_DIALECT_SYBASE)
- {
- this.connFactory = defaultConnectionFactory();
- sqlPath = "/conf/storage/jcr-" + (multiDb ? "m" : "s") + "jdbc.sybase.sql";
- dbInitilizer = defaultDBInitializer(sqlPath);
- }
- else if (dbDialect == DBConstants.DB_DIALECT_INGRES)
- {
- this.connFactory = defaultConnectionFactory();
- sqlPath = "/conf/storage/jcr-" + (multiDb ? "m" : "s") + "jdbc.ingres.sql";
- // using Postgres initializer
- dbInitilizer =
- new IngresSQLDBInitializer(containerName, this.connFactory.getJdbcConnection(), sqlPath, multiDb);
- }
- else if (dbDialect == DBConstants.DB_DIALECT_HSQLDB)
- {
- if (dbSourceName != null)
- {
- DataSource ds = (DataSource)new InitialContext().lookup(dbSourceName);
- if (ds != null)
- this.connFactory =
- new HSQLDBConnectionFactory(ds, containerName, multiDb, valueStorageProvider, maxBufferSize,
- swapDirectory, swapCleaner);
- else
- throw new RepositoryException("Datasource '" + dbSourceName + "' is not bound in this context.");
- }
- else
- this.connFactory =
- new HSQLDBConnectionFactory(dbDriver, dbUrl, dbUserName, dbPassword, containerName, multiDb,
- valueStorageProvider, maxBufferSize, swapDirectory, swapCleaner);
- sqlPath = "/conf/storage/jcr-" + (multiDb ? "m" : "s") + "jdbc.sql";
- dbInitilizer = defaultDBInitializer(sqlPath);
- }
- else
- {
- // generic, DB_HSQLDB
- this.connFactory = defaultConnectionFactory();
- sqlPath = "/conf/storage/jcr-" + (multiDb ? "m" : "s") + "jdbc.sql";
- dbInitilizer = defaultDBInitializer(sqlPath);
- }
-
- // database type
- try
- {
- dbInitilizer.init();
- }
- catch (DBInitializerException e)
- {
- LOG.error("Error of init db " + e, e);
- }
- }
-
- /**
- * Return ConnectionFactory.
- *
- * @return WorkspaceStorageConnectionFactory connection
- */
- protected GenericConnectionFactory getConnectionFactory()
- {
- return connFactory;
- }
-
- protected String detectDialect(String confParam)
- {
- for (String dbType : DBConstants.DB_DIALECTS)
- {
- if (dbType.equalsIgnoreCase(confParam))
- return dbType;
- }
-
- return DBConstants.DB_DIALECT_GENERIC; // by default
- }
-
- /**
- * {@inheritDoc}
- */
- public WorkspaceStorageConnection openConnection() throws RepositoryException
- {
-
- return connFactory.openConnection();
- }
-
- /**
- * {@inheritDoc}
- */
- public WorkspaceStorageConnection openConnection(boolean readOnly) throws RepositoryException
- {
-
- return connFactory.openConnection(readOnly);
- }
-
- /**
- * {@inheritDoc}
- */
- public WorkspaceStorageConnection reuseConnection(WorkspaceStorageConnection original) throws RepositoryException
- {
-
- if (original instanceof NewJDBCStorageConnection)
- {
- WorkspaceStorageConnectionFactory cFactory =
- new SharedConnectionFactory(((NewJDBCStorageConnection)original).getJdbcConnection(), containerName,
- multiDb, valueStorageProvider, maxBufferSize, swapDirectory, swapCleaner);
-
- return cFactory.openConnection();
- }
- else
- {
- return openConnection();
- }
- }
-
- /**
- * {@inheritDoc}
- */
- public String getName()
- {
- return containerName;
- }
-
- /**
- * {@inheritDoc}
- */
- public String getInfo()
- {
- String str =
- "JDBC based JCR Workspace Data container \n" + "container name: " + containerName + " \n"
- + "data source JNDI name: " + dbSourceName + "\n" + "is multi database: " + multiDb + "\n"
- + "storage version: " + storageVersion + "\n" + "value storage provider: " + valueStorageProvider + "\n"
- + "max buffer size (bytes): " + maxBufferSize + "\n" + "swap directory path: "
- + swapDirectory.getAbsolutePath();
- return str;
- }
-
- /**
- * {@inheritDoc}
- */
- public String getStorageVersion()
- {
- return storageVersion;
- }
-
- /**
- * {@inheritDoc}
- */
- public void start()
- {
- this.swapCleaner.start();
- }
-
- /**
- * {@inheritDoc}
- */
- public void stop()
- {
- this.swapCleaner.halt();
- this.swapCleaner.interrupt();
-
- // TODO HSQLDB Stop (debug)
- // if (dbDialect.equals(DB_DIALECT_GENERIC) ||
- // dbDialect.equals(DB_DIALECT_HSQLDB)) {
- // // shutdown in-process HSQLDB database
- // System.out.println("Shutdown in-process HSQLDB database...");
- // try {
- // JDBCStorageConnection conn = (JDBCStorageConnection) openConnection();
- // Connection jdbcConn = conn.getJdbcConnection();
- // String dbUrl = jdbcConn.getMetaData().getURL();
- // if (dbUrl.startsWith("jdbc:hsqldb:file") ||
- // dbUrl.startsWith("jdbc:hsqldb:mem")) {
- // // yeah, there is in-process hsqldb, shutdown it now
- // jdbcConn.createStatement().execute("SHUTDOWN");
- // System.out.println("Shutdown in-process HSQLDB database... done.");
- // }
- // } catch (Throwable e) {
- // log.error("JDBC Data container stop error " + e);
- // e.printStackTrace();
- // }
- // }
- }
-
- /**
- * {@inheritDoc}
- */
- public boolean isSame(WorkspaceDataContainer another)
- {
- if (another == this)
- return true;
-
- if (another instanceof NewJDBCWorkspaceDataContainer)
- {
- NewJDBCWorkspaceDataContainer anotherJdbc = (NewJDBCWorkspaceDataContainer)another;
-
- if (getDbSourceName() != null)
- // by jndi ds name
- return getDbSourceName().equals(anotherJdbc.getDbSourceName());
-
- // by db connection params
- return getDbDriver().equals(anotherJdbc.getDbDriver()) && getDbUrl().equals(anotherJdbc.getDbUrl())
- && getDbUserName().equals(anotherJdbc.getDbUserName());
- }
-
- return false;
- }
-
- /**
- * Used in <code>equals()</code>.
- *
- * @return DataSource name
- */
- protected String getDbSourceName()
- {
- return dbSourceName;
- }
-
- /**
- * Used in <code>equals()</code>.
- *
- * @return JDBC driver
- */
- protected String getDbDriver()
- {
- return dbDriver;
- }
-
- /**
- * Used in <code>equals()</code>.
- *
- * @return Database URL
- */
- protected String getDbUrl()
- {
- return dbUrl;
- }
-
- /**
- * Used in <code>equals()</code>.
- *
- * @return Database username
- */
- protected String getDbUserName()
- {
- return dbUserName;
- }
-}
Deleted: jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/NewSQLExceptionHandler.java
===================================================================
--- jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/NewSQLExceptionHandler.java 2009-12-25 15:51:39 UTC (rev 1193)
+++ jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/NewSQLExceptionHandler.java 2009-12-25 15:55:34 UTC (rev 1194)
@@ -1,395 +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;
-
-import org.exoplatform.services.jcr.dataflow.ItemState;
-import org.exoplatform.services.jcr.datamodel.ItemData;
-import org.exoplatform.services.jcr.datamodel.NodeData;
-import org.exoplatform.services.jcr.datamodel.QPathEntry;
-import org.exoplatform.services.jcr.impl.storage.JCRInvalidItemStateException;
-import org.exoplatform.services.jcr.impl.storage.JCRItemExistsException;
-
-import java.io.IOException;
-import java.sql.SQLException;
-
-import javax.jcr.InvalidItemStateException;
-import javax.jcr.ItemExistsException;
-import javax.jcr.RepositoryException;
-
-/**
- * Created by The eXo Platform SAS.
- *
- * The eXo JCR database has constraints can be violated.
- *
- * JCR_PK_XCONTAINER - Can not be exisits two containers with same version
- *
- * JCR_PK_XITEM - Item already exists with this ID JCR_FK_XITEM_PARENT - Parent not found by ID
- * JCR_IDX_XITEM_PARENT - Item already exists with the parent, name, index, type(N/P), persisted
- * version JCR_IDX_XITEM_PARENT_NAME - Item already exists with the type(N/P), parent, name, index,
- * persisted version JCR_IDX_XITEM_PARENT_ID - Item already exists with the type(N/P), parent, ID,
- * persisted version
- *
- * JCR_PK_XVALUE - Value already exists with the ID (impossible, ID is autiincremented)
- * JCR_FK_XVALUE_PROPERTY - There is no property exists for the value. JCR_IDX_XVALUE_PROPERTY -
- * Value already exists with the property and order number
- *
- * JCR_PK_XREF - Reference already exists to the node from property with order number
- * JCR_IDX_XREF_PROPERTY - Reference already exists with the property and order number
- *
- * @author Peter Nedonosko
- * @version $Id: SQLExceptionHandler.java 34801 2009-07-31 15:44:50Z dkatayev $
- */
-
-public class NewSQLExceptionHandler
-{
-
- /**
- * Ccontainer name.
- */
- private final String containerName;
-
- /**
- * Storage connection.
- */
- private final NewJDBCStorageConnection conn;
-
- // ---------------- SQLException handler -------------------
-
- /**
- * SQLExceptionHandler constructor.
- *
- * @param containerName
- * - workspace container name
- * @param conn
- * - storage connection
- */
- NewSQLExceptionHandler(String containerName, NewJDBCStorageConnection conn)
- {
- this.containerName = containerName;
- this.conn = conn;
- }
-
- /**
- * Handle Add SQLException.
- *
- * @param e
- * - an SQLException
- * @param item
- * - context ItemData
- * @return String with error message
- * @throws RepositoryException
- * if <code>RepositoryException</code> should be thrown
- * @throws InvalidItemStateException
- * if <code>InvalidItemStateException</code> should be thrown
- */
- protected String handleAddException(SQLException e, ItemData item) throws RepositoryException,
- InvalidItemStateException
- {
- String message = "[" + containerName + "] ADD " + (item.isNode() ? "NODE. " : "PROPERTY. ");
- String errMessage = e.getMessage();
- String itemInfo =
- item.getQPath().getAsString() + ", ID: " + item.getIdentifier() + ", ParentID: " + item.getParentIdentifier()
- + (errMessage != null ? ". Cause >>>> " + errMessage : "");
-
- if (errMessage != null)
- {
- // try detect error by foreign key names
- String umsg = errMessage.toLowerCase().toUpperCase();
- if (umsg.indexOf(conn.JCR_FK_ITEM_PARENT) >= 0)
- {
- message += "Parent not found. Item " + itemInfo;
- throw new JCRInvalidItemStateException(message, item.getIdentifier(), ItemState.ADDED, e);
- }
- else if (umsg.indexOf(conn.JCR_PK_ITEM) >= 0)
- {
- message += "Item already exists. Condition: ID. " + itemInfo;
- // InvalidItemStateException ! - because it's impossible add new item with existed UUID
- throw new JCRInvalidItemStateException(message, item.getIdentifier(), ItemState.ADDED, e);
- }
- else if (umsg.indexOf(conn.JCR_IDX_ITEM_PARENT) >= 0 || umsg.indexOf(conn.JCR_IDX_ITEM_PARENT_NAME) >= 0)
- {
- message += "Item already exists. Condition: parent ID, name, index. " + itemInfo;
- throw new ItemExistsException(message, e);
- }
- else if (umsg.indexOf(conn.JCR_IDX_ITEM_PARENT_ID) >= 0)
- {
- message += "Item already exists. Condition: parent ID and ID. " + itemInfo;
- throw new ItemExistsException(message, e);
- }
- else if (umsg.indexOf(conn.JCR_FK_VALUE_PROPERTY) >= 0)
- {
- message += "Property is not exist but the value is being created. Condition: property ID. " + itemInfo;
- throw new RepositoryException(message, e);
- }
- else if (umsg.indexOf(conn.JCR_IDX_VALUE_PROPERTY) >= 0)
- {
- message += "Property already exists. Condition: property ID, order number. " + itemInfo;
- throw new RepositoryException(message, e);
- }
- else if (umsg.indexOf(conn.JCR_PK_VALUE) >= 0)
- {
- message +=
- "[FATAL] Value already exists with the ValueID. Impossible state, check is ValueID is autoincremented. "
- + itemInfo;
- throw new RepositoryException(message, e);
- }
- else if (umsg.indexOf(conn.JCR_PK_REF) >= 0)
- {
- message += "Reference chain already exists. Condition: node ID, property ID, order number. " + itemInfo;
- throw new RepositoryException(message, e);
- }
- else if (umsg.indexOf(conn.JCR_IDX_REF_PROPERTY) >= 0)
- {
- message += "Referenceable property value already exists. Condition: property ID, order number. " + itemInfo;
- throw new RepositoryException(message, e);
- }
- }
-
- // try detect integrity violation
- RepositoryException ownException = null;
- try
- {
- NodeData parent = (NodeData)conn.getItemData(item.getParentIdentifier());
- if (parent != null)
- {
- // have a parent
- try
- {
- ItemData me = conn.getItemData(item.getIdentifier());
- if (me != null)
- {
- // item already exists
- message += "Item already exists in storage: " + itemInfo;
- ownException = new JCRItemExistsException(message, me.getIdentifier(), ItemState.ADDED, e);
- throw ownException;
- }
-
- me = conn.getItemData(parent, new QPathEntry(item.getQPath().getName(), item.getQPath().getIndex()));
- if (me != null)
- {
- message += "Item already exists in storage: " + itemInfo;
- ownException = new JCRItemExistsException(message, me.getIdentifier(), ItemState.ADDED, e);
- throw ownException;
- }
-
- }
- catch (Exception ep)
- {
- // item not found or other things but error of item reading
- if (ownException != null)
- throw ownException;
- }
-
- // MySQL violation
- if (e.getClass().getName().indexOf("MySQLIntegrityConstraintViolationException") >= 0
- && errMessage.indexOf(item.getIdentifier()) >= 0)
- {
- // it's JCR_PK_ITEM violation
- message += "Item already exists. Condition: ID. " + itemInfo;
- throw new JCRInvalidItemStateException(message, item.getIdentifier(), ItemState.ADDED, e);
- }
-
- message += "Error of item add. " + itemInfo;
- ownException = new RepositoryException(message, e);
- throw ownException;
- }
- }
- catch (Exception ep)
- {
- // no parent or error access it
- if (ownException != null)
- throw ownException;
- }
- message += "Error of item add. " + itemInfo;
- throw new JCRInvalidItemStateException(message, item.getIdentifier(), ItemState.ADDED, e);
- }
-
- /**
- * Handle Add IOException.
- *
- * @param e
- * - an IOException
- * @param item
- * - context ItemData
- * @return String with error message
- * @throws RepositoryException
- * if <code>RepositoryException</code> should be thrown
- * @throws InvalidItemStateException
- * if <code>InvalidItemStateException</code> should be thrown
- */
- protected String handleAddException(IOException e, ItemData item) throws RepositoryException,
- InvalidItemStateException
- {
- String message = "[" + containerName + "] ADD " + (item.isNode() ? "NODE. " : "PROPERTY. ");
- String errMessage = e.getMessage();
- String itemInfo =
- item.getQPath().getAsString() + ", ID: " + item.getIdentifier() + ", ParentID: " + item.getParentIdentifier()
- + (errMessage != null ? ". Cause >>>> " + errMessage : "");
-
- // try detect integrity violation
- RepositoryException ownException = null;
- try
- {
- NodeData parent = (NodeData)conn.getItemData(item.getParentIdentifier());
- if (parent != null)
- {
- // have a parent
- try
- {
- ItemData me = conn.getItemData(item.getIdentifier());
- if (me != null)
- {
- // item already exists
- message += "Item already exists in storage: " + itemInfo;
- ownException = new ItemExistsException(message, e);
- throw ownException;
- }
-
- me = conn.getItemData(parent, new QPathEntry(item.getQPath().getName(), item.getQPath().getIndex()));
- if (me != null)
- {
- message += "Item already exists in storage: " + itemInfo;
- ownException = new ItemExistsException(message, e);
- throw ownException;
- }
-
- }
- catch (Exception ep)
- {
- // item not found or other things but error of item reading
- if (ownException != null)
- throw ownException;
- }
- message += "Error of item add. " + itemInfo;
- ownException = new RepositoryException(message, e);
- throw ownException;
- }
- }
- catch (Exception ep)
- {
- // no parent or error access it
- if (ownException != null)
- throw ownException;
- }
- message += "Error of item add. " + itemInfo;
- throw new JCRInvalidItemStateException(message, item.getIdentifier(), ItemState.ADDED, e);
- }
-
- /**
- * Handle delete Exceptions.
- *
- * @param e
- * - an SQLException
- * @param item
- * - context ItemData
- * @return String with error message
- * @throws RepositoryException
- * if <code>RepositoryException</code> should be thrown
- * @throws InvalidItemStateException
- * if <code>InvalidItemStateException</code> should be thrown
- */
- protected String handleDeleteException(SQLException e, ItemData item) throws RepositoryException,
- InvalidItemStateException
- {
- String message = "[" + containerName + "] DELETE " + (item.isNode() ? "NODE. " : "PROPERTY. ");
- String errMessage = e.getMessage();
- String itemInfo =
- item.getQPath().getAsString() + " " + item.getIdentifier()
- + (errMessage != null ? ". Cause >>>> " + errMessage : "");
-
- if (errMessage != null)
- {
- // try detect error by foreign key names
- String umsg = errMessage.toLowerCase().toUpperCase();
- if (umsg.indexOf(conn.JCR_FK_ITEM_PARENT) >= 0)
- {
- message += "Can not delete parent till childs exists. Item " + itemInfo;
- throw new JCRInvalidItemStateException(message, item.getIdentifier(), ItemState.DELETED, e);
- }
- else if (umsg.indexOf(conn.JCR_FK_VALUE_PROPERTY) >= 0)
- {
- message +=
- "[FATAL] Can not delete property item till it contains values. Condition: property ID. " + itemInfo;
- throw new RepositoryException(message, e);
- }
- }
-
- message += "Error of item delete " + itemInfo;
- throw new RepositoryException(message, e);
- }
-
- /**
- * Handle update Exceptions.
- *
- * @param e
- * - an SQLException
- * @param item
- * - context ItemData
- * @return String with error message
- * @throws RepositoryException
- * if <code>RepositoryException</code> should be thrown
- * @throws InvalidItemStateException
- * if <code>InvalidItemStateException</code> should be thrown
- */
- protected String handleUpdateException(SQLException e, ItemData item) throws RepositoryException,
- InvalidItemStateException
- {
- String message = "[" + containerName + "] EDIT " + (item.isNode() ? "NODE. " : "PROPERTY. ");
- String errMessage = e.getMessage();
- String itemInfo =
- item.getQPath().getAsString() + " " + item.getIdentifier()
- + (errMessage != null ? ". Cause >>>> " + errMessage : "");
-
- if (errMessage != null)
- // try detect error by foreign key names
- if (errMessage.toLowerCase().toUpperCase().indexOf(conn.JCR_FK_VALUE_PROPERTY) >= 0)
- {
- message += "Property is not exists but the value is being created. Condition: property ID. " + itemInfo;
- throw new RepositoryException(message, e);
- }
- else if (errMessage.toLowerCase().toUpperCase().indexOf(conn.JCR_PK_ITEM) >= 0)
- {
- message += "Item already exists. Condition: ID. " + itemInfo;
- throw new JCRInvalidItemStateException(message, item.getIdentifier(), ItemState.UPDATED, e);
- }
-
- // try detect integrity violation
- RepositoryException ownException = null;
- try
- {
- ItemData me = conn.getItemData(item.getIdentifier());
- if (me != null)
- {
- // item already exists
- message += "Item already exists. But update errors. " + itemInfo;
- ownException = new RepositoryException(message, e);
- throw ownException;
- }
- }
- catch (Exception ep)
- {
- // item not found or other things but error of item reading
- if (ownException != null)
- throw ownException;
- }
- message += "Error of item update. " + itemInfo;
- throw new JCRInvalidItemStateException(message, item.getIdentifier(), ItemState.UPDATED, e);
- }
-
-}
Added: jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/SQLExceptionHandler.java
===================================================================
--- jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/SQLExceptionHandler.java (rev 0)
+++ jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/SQLExceptionHandler.java 2009-12-25 15:55:34 UTC (rev 1194)
@@ -0,0 +1,395 @@
+/*
+ * 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;
+
+import org.exoplatform.services.jcr.dataflow.ItemState;
+import org.exoplatform.services.jcr.datamodel.ItemData;
+import org.exoplatform.services.jcr.datamodel.NodeData;
+import org.exoplatform.services.jcr.datamodel.QPathEntry;
+import org.exoplatform.services.jcr.impl.storage.JCRInvalidItemStateException;
+import org.exoplatform.services.jcr.impl.storage.JCRItemExistsException;
+
+import java.io.IOException;
+import java.sql.SQLException;
+
+import javax.jcr.InvalidItemStateException;
+import javax.jcr.ItemExistsException;
+import javax.jcr.RepositoryException;
+
+/**
+ * Created by The eXo Platform SAS.
+ *
+ * The eXo JCR database has constraints can be violated.
+ *
+ * JCR_PK_XCONTAINER - Can not be exisits two containers with same version
+ *
+ * JCR_PK_XITEM - Item already exists with this ID JCR_FK_XITEM_PARENT - Parent not found by ID
+ * JCR_IDX_XITEM_PARENT - Item already exists with the parent, name, index, type(N/P), persisted
+ * version JCR_IDX_XITEM_PARENT_NAME - Item already exists with the type(N/P), parent, name, index,
+ * persisted version JCR_IDX_XITEM_PARENT_ID - Item already exists with the type(N/P), parent, ID,
+ * persisted version
+ *
+ * JCR_PK_XVALUE - Value already exists with the ID (impossible, ID is autiincremented)
+ * JCR_FK_XVALUE_PROPERTY - There is no property exists for the value. JCR_IDX_XVALUE_PROPERTY -
+ * Value already exists with the property and order number
+ *
+ * JCR_PK_XREF - Reference already exists to the node from property with order number
+ * JCR_IDX_XREF_PROPERTY - Reference already exists with the property and order number
+ *
+ * @author Peter Nedonosko
+ * @version $Id: SQLExceptionHandler.java 34801 2009-07-31 15:44:50Z dkatayev $
+ */
+
+public class SQLExceptionHandler
+{
+
+ /**
+ * Ccontainer name.
+ */
+ private final String containerName;
+
+ /**
+ * Storage connection.
+ */
+ private final CQJDBCStorageConnection conn;
+
+ // ---------------- SQLException handler -------------------
+
+ /**
+ * SQLExceptionHandler constructor.
+ *
+ * @param containerName
+ * - workspace container name
+ * @param conn
+ * - storage connection
+ */
+ SQLExceptionHandler(String containerName, CQJDBCStorageConnection conn)
+ {
+ this.containerName = containerName;
+ this.conn = conn;
+ }
+
+ /**
+ * Handle Add SQLException.
+ *
+ * @param e
+ * - an SQLException
+ * @param item
+ * - context ItemData
+ * @return String with error message
+ * @throws RepositoryException
+ * if <code>RepositoryException</code> should be thrown
+ * @throws InvalidItemStateException
+ * if <code>InvalidItemStateException</code> should be thrown
+ */
+ protected String handleAddException(SQLException e, ItemData item) throws RepositoryException,
+ InvalidItemStateException
+ {
+ String message = "[" + containerName + "] ADD " + (item.isNode() ? "NODE. " : "PROPERTY. ");
+ String errMessage = e.getMessage();
+ String itemInfo =
+ item.getQPath().getAsString() + ", ID: " + item.getIdentifier() + ", ParentID: " + item.getParentIdentifier()
+ + (errMessage != null ? ". Cause >>>> " + errMessage : "");
+
+ if (errMessage != null)
+ {
+ // try detect error by foreign key names
+ String umsg = errMessage.toLowerCase().toUpperCase();
+ if (umsg.indexOf(conn.JCR_FK_ITEM_PARENT) >= 0)
+ {
+ message += "Parent not found. Item " + itemInfo;
+ throw new JCRInvalidItemStateException(message, item.getIdentifier(), ItemState.ADDED, e);
+ }
+ else if (umsg.indexOf(conn.JCR_PK_ITEM) >= 0)
+ {
+ message += "Item already exists. Condition: ID. " + itemInfo;
+ // InvalidItemStateException ! - because it's impossible add new item with existed UUID
+ throw new JCRInvalidItemStateException(message, item.getIdentifier(), ItemState.ADDED, e);
+ }
+ else if (umsg.indexOf(conn.JCR_IDX_ITEM_PARENT) >= 0 || umsg.indexOf(conn.JCR_IDX_ITEM_PARENT_NAME) >= 0)
+ {
+ message += "Item already exists. Condition: parent ID, name, index. " + itemInfo;
+ throw new ItemExistsException(message, e);
+ }
+ else if (umsg.indexOf(conn.JCR_IDX_ITEM_PARENT_ID) >= 0)
+ {
+ message += "Item already exists. Condition: parent ID and ID. " + itemInfo;
+ throw new ItemExistsException(message, e);
+ }
+ else if (umsg.indexOf(conn.JCR_FK_VALUE_PROPERTY) >= 0)
+ {
+ message += "Property is not exist but the value is being created. Condition: property ID. " + itemInfo;
+ throw new RepositoryException(message, e);
+ }
+ else if (umsg.indexOf(conn.JCR_IDX_VALUE_PROPERTY) >= 0)
+ {
+ message += "Property already exists. Condition: property ID, order number. " + itemInfo;
+ throw new RepositoryException(message, e);
+ }
+ else if (umsg.indexOf(conn.JCR_PK_VALUE) >= 0)
+ {
+ message +=
+ "[FATAL] Value already exists with the ValueID. Impossible state, check is ValueID is autoincremented. "
+ + itemInfo;
+ throw new RepositoryException(message, e);
+ }
+ else if (umsg.indexOf(conn.JCR_PK_REF) >= 0)
+ {
+ message += "Reference chain already exists. Condition: node ID, property ID, order number. " + itemInfo;
+ throw new RepositoryException(message, e);
+ }
+ else if (umsg.indexOf(conn.JCR_IDX_REF_PROPERTY) >= 0)
+ {
+ message += "Referenceable property value already exists. Condition: property ID, order number. " + itemInfo;
+ throw new RepositoryException(message, e);
+ }
+ }
+
+ // try detect integrity violation
+ RepositoryException ownException = null;
+ try
+ {
+ NodeData parent = (NodeData)conn.getItemData(item.getParentIdentifier());
+ if (parent != null)
+ {
+ // have a parent
+ try
+ {
+ ItemData me = conn.getItemData(item.getIdentifier());
+ if (me != null)
+ {
+ // item already exists
+ message += "Item already exists in storage: " + itemInfo;
+ ownException = new JCRItemExistsException(message, me.getIdentifier(), ItemState.ADDED, e);
+ throw ownException;
+ }
+
+ me = conn.getItemData(parent, new QPathEntry(item.getQPath().getName(), item.getQPath().getIndex()));
+ if (me != null)
+ {
+ message += "Item already exists in storage: " + itemInfo;
+ ownException = new JCRItemExistsException(message, me.getIdentifier(), ItemState.ADDED, e);
+ throw ownException;
+ }
+
+ }
+ catch (Exception ep)
+ {
+ // item not found or other things but error of item reading
+ if (ownException != null)
+ throw ownException;
+ }
+
+ // MySQL violation
+ if (e.getClass().getName().indexOf("MySQLIntegrityConstraintViolationException") >= 0
+ && errMessage.indexOf(item.getIdentifier()) >= 0)
+ {
+ // it's JCR_PK_ITEM violation
+ message += "Item already exists. Condition: ID. " + itemInfo;
+ throw new JCRInvalidItemStateException(message, item.getIdentifier(), ItemState.ADDED, e);
+ }
+
+ message += "Error of item add. " + itemInfo;
+ ownException = new RepositoryException(message, e);
+ throw ownException;
+ }
+ }
+ catch (Exception ep)
+ {
+ // no parent or error access it
+ if (ownException != null)
+ throw ownException;
+ }
+ message += "Error of item add. " + itemInfo;
+ throw new JCRInvalidItemStateException(message, item.getIdentifier(), ItemState.ADDED, e);
+ }
+
+ /**
+ * Handle Add IOException.
+ *
+ * @param e
+ * - an IOException
+ * @param item
+ * - context ItemData
+ * @return String with error message
+ * @throws RepositoryException
+ * if <code>RepositoryException</code> should be thrown
+ * @throws InvalidItemStateException
+ * if <code>InvalidItemStateException</code> should be thrown
+ */
+ protected String handleAddException(IOException e, ItemData item) throws RepositoryException,
+ InvalidItemStateException
+ {
+ String message = "[" + containerName + "] ADD " + (item.isNode() ? "NODE. " : "PROPERTY. ");
+ String errMessage = e.getMessage();
+ String itemInfo =
+ item.getQPath().getAsString() + ", ID: " + item.getIdentifier() + ", ParentID: " + item.getParentIdentifier()
+ + (errMessage != null ? ". Cause >>>> " + errMessage : "");
+
+ // try detect integrity violation
+ RepositoryException ownException = null;
+ try
+ {
+ NodeData parent = (NodeData)conn.getItemData(item.getParentIdentifier());
+ if (parent != null)
+ {
+ // have a parent
+ try
+ {
+ ItemData me = conn.getItemData(item.getIdentifier());
+ if (me != null)
+ {
+ // item already exists
+ message += "Item already exists in storage: " + itemInfo;
+ ownException = new ItemExistsException(message, e);
+ throw ownException;
+ }
+
+ me = conn.getItemData(parent, new QPathEntry(item.getQPath().getName(), item.getQPath().getIndex()));
+ if (me != null)
+ {
+ message += "Item already exists in storage: " + itemInfo;
+ ownException = new ItemExistsException(message, e);
+ throw ownException;
+ }
+
+ }
+ catch (Exception ep)
+ {
+ // item not found or other things but error of item reading
+ if (ownException != null)
+ throw ownException;
+ }
+ message += "Error of item add. " + itemInfo;
+ ownException = new RepositoryException(message, e);
+ throw ownException;
+ }
+ }
+ catch (Exception ep)
+ {
+ // no parent or error access it
+ if (ownException != null)
+ throw ownException;
+ }
+ message += "Error of item add. " + itemInfo;
+ throw new JCRInvalidItemStateException(message, item.getIdentifier(), ItemState.ADDED, e);
+ }
+
+ /**
+ * Handle delete Exceptions.
+ *
+ * @param e
+ * - an SQLException
+ * @param item
+ * - context ItemData
+ * @return String with error message
+ * @throws RepositoryException
+ * if <code>RepositoryException</code> should be thrown
+ * @throws InvalidItemStateException
+ * if <code>InvalidItemStateException</code> should be thrown
+ */
+ protected String handleDeleteException(SQLException e, ItemData item) throws RepositoryException,
+ InvalidItemStateException
+ {
+ String message = "[" + containerName + "] DELETE " + (item.isNode() ? "NODE. " : "PROPERTY. ");
+ String errMessage = e.getMessage();
+ String itemInfo =
+ item.getQPath().getAsString() + " " + item.getIdentifier()
+ + (errMessage != null ? ". Cause >>>> " + errMessage : "");
+
+ if (errMessage != null)
+ {
+ // try detect error by foreign key names
+ String umsg = errMessage.toLowerCase().toUpperCase();
+ if (umsg.indexOf(conn.JCR_FK_ITEM_PARENT) >= 0)
+ {
+ message += "Can not delete parent till childs exists. Item " + itemInfo;
+ throw new JCRInvalidItemStateException(message, item.getIdentifier(), ItemState.DELETED, e);
+ }
+ else if (umsg.indexOf(conn.JCR_FK_VALUE_PROPERTY) >= 0)
+ {
+ message +=
+ "[FATAL] Can not delete property item till it contains values. Condition: property ID. " + itemInfo;
+ throw new RepositoryException(message, e);
+ }
+ }
+
+ message += "Error of item delete " + itemInfo;
+ throw new RepositoryException(message, e);
+ }
+
+ /**
+ * Handle update Exceptions.
+ *
+ * @param e
+ * - an SQLException
+ * @param item
+ * - context ItemData
+ * @return String with error message
+ * @throws RepositoryException
+ * if <code>RepositoryException</code> should be thrown
+ * @throws InvalidItemStateException
+ * if <code>InvalidItemStateException</code> should be thrown
+ */
+ protected String handleUpdateException(SQLException e, ItemData item) throws RepositoryException,
+ InvalidItemStateException
+ {
+ String message = "[" + containerName + "] EDIT " + (item.isNode() ? "NODE. " : "PROPERTY. ");
+ String errMessage = e.getMessage();
+ String itemInfo =
+ item.getQPath().getAsString() + " " + item.getIdentifier()
+ + (errMessage != null ? ". Cause >>>> " + errMessage : "");
+
+ if (errMessage != null)
+ // try detect error by foreign key names
+ if (errMessage.toLowerCase().toUpperCase().indexOf(conn.JCR_FK_VALUE_PROPERTY) >= 0)
+ {
+ message += "Property is not exists but the value is being created. Condition: property ID. " + itemInfo;
+ throw new RepositoryException(message, e);
+ }
+ else if (errMessage.toLowerCase().toUpperCase().indexOf(conn.JCR_PK_ITEM) >= 0)
+ {
+ message += "Item already exists. Condition: ID. " + itemInfo;
+ throw new JCRInvalidItemStateException(message, item.getIdentifier(), ItemState.UPDATED, e);
+ }
+
+ // try detect integrity violation
+ RepositoryException ownException = null;
+ try
+ {
+ ItemData me = conn.getItemData(item.getIdentifier());
+ if (me != null)
+ {
+ // item already exists
+ message += "Item already exists. But update errors. " + itemInfo;
+ ownException = new RepositoryException(message, e);
+ throw ownException;
+ }
+ }
+ catch (Exception ep)
+ {
+ // item not found or other things but error of item reading
+ if (ownException != null)
+ throw ownException;
+ }
+ message += "Error of item update. " + itemInfo;
+ throw new JCRInvalidItemStateException(message, item.getIdentifier(), ItemState.UPDATED, e);
+ }
+
+}
Modified: jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/MultiDbJDBCConnection.java
===================================================================
--- jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/MultiDbJDBCConnection.java 2009-12-25 15:51:39 UTC (rev 1193)
+++ jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/MultiDbJDBCConnection.java 2009-12-25 15:55:34 UTC (rev 1194)
@@ -23,7 +23,7 @@
import org.exoplatform.services.jcr.datamodel.ValueData;
import org.exoplatform.services.jcr.impl.Constants;
import org.exoplatform.services.jcr.impl.dataflow.ValueDataConvertor;
-import org.exoplatform.services.jcr.impl.storage.jdbc.optimisation.NewJDBCStorageConnection;
+import org.exoplatform.services.jcr.impl.storage.jdbc.optimisation.CQJDBCStorageConnection;
import org.exoplatform.services.jcr.impl.util.io.FileCleaner;
import org.exoplatform.services.jcr.storage.value.ValueStoragePluginProvider;
@@ -48,7 +48,7 @@
* pnedonosko $
*/
-public class MultiDbJDBCConnection extends NewJDBCStorageConnection
+public class MultiDbJDBCConnection extends CQJDBCStorageConnection
{
protected PreparedStatement findItemById;
@@ -193,13 +193,9 @@
FIND_ITEM_BY_NAME_NEW =
"select I.*, V.ORDER_NUM, V.DATA, V.STORAGE_DESC from JCR_MITEM I LEFT OUTER JOIN JCR_MVALUE V ON (V.PROPERTY_ID=I.ID)"
+ ", (select ID from JCR_MITEM where PARENT_ID=? and NAME=? and I_INDEX=?) I2"
- + " where (I.ID=I2.ID) or (I.PARENT_ID=I2.ID and I.I_CLASS=2 and I.NAME IN ('[http://www.jcp.org/jcr/1.0]primaryType','[http://www.jcp.org/jcr/1.0]mixinTypes'))"
- + " order by I.I_CLASS, I.NAME DESC";
+ + " where (I.ID=I2.ID) or (I.PARENT_ID=I2.ID and I.I_CLASS=2 and (I.NAME='[http://www.jcp.org/jcr/1.0]primaryType' or I.NAME='[http://www.jcp.org/jcr/1.0]mixinTypes' or I.NAME='[http://www.exoplatform.com/jcr/exo/1.0]owner' or I.NAME='[http://www.exoplatform.com/jcr/exo/1.0]permissions'))"
+ + " order by I.I_CLASS, I.N_ORDER_NUM";
- // "select I.*, V.ORDER_NUM, V.DATA, V.STORAGE_DESC from (select * from JCR_MITEM where PARENT_ID=? and NAME=?) I LEFT OUTER JOIN JCR_MVALUE V ON (V.PROPERTY_ID=I.ID)"
- // + ", (select ID from JCR_MITEM where I_CLASS=1 and PARENT_ID=? and NAME=?) I2"
- // + " where (I.ID=I2.ID) or (I.PARENT_ID=I2.ID and I.I_CLASS=2 and I.NAME IN ('[http://www.jcp.org/jcr/1.0]primaryType','[http://www.jcp.org/jcr/1.0]mixinTypes')) order by I.I_CLASS, I.NAME DESC";// order by I.I_CLASS, I.N_ORDER_NUM";
-
FIND_PROPERTY_BY_NAME =
"select V.DATA" + " from JCR_MITEM I, JCR_MVALUE V"
+ " where I.I_CLASS=2 and I.PARENT_ID=? and I.NAME=? and I.ID=V.PROPERTY_ID order by V.ORDER_NUM";
@@ -227,7 +223,7 @@
+ " from JCR_MITEM I LEFT OUTER JOIN JCR_MVALUE V ON (V.PROPERTY_ID=I.ID), (select ID from JCR_MITEM where PARENT_ID=? AND I_CLASS=1) I2"
+ " where (I.I_CLASS=1 AND I.ID=I2.ID) OR (I.I_CLASS=2 and I.PARENT_ID=I2.ID and"
+ " (I.NAME='[http://www.jcp.org/jcr/1.0]primaryType' OR I.NAME='[http://www.jcp.org/jcr/1.0]mixinTypes')) order by I.I_CLASS, I.N_ORDER_NUM";
- //,'[http://www.exoplatform.com/jcr/exo/1.0]owner','[http://www.exoplatform.com/jcr/exo/1.0]permissions'
+ //,
FIND_NODES_COUNT_BY_PARENTID = "select count(ID) from JCR_MITEM" + " where I_CLASS=1 and PARENT_ID=?";
Modified: jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/SingleDbJDBCConnection.java
===================================================================
--- jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/SingleDbJDBCConnection.java 2009-12-25 15:51:39 UTC (rev 1193)
+++ jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/SingleDbJDBCConnection.java 2009-12-25 15:55:34 UTC (rev 1194)
@@ -22,7 +22,7 @@
import org.exoplatform.services.jcr.datamodel.PropertyData;
import org.exoplatform.services.jcr.datamodel.ValueData;
import org.exoplatform.services.jcr.impl.Constants;
-import org.exoplatform.services.jcr.impl.storage.jdbc.optimisation.NewJDBCStorageConnection;
+import org.exoplatform.services.jcr.impl.storage.jdbc.optimisation.CQJDBCStorageConnection;
import org.exoplatform.services.jcr.impl.util.io.FileCleaner;
import org.exoplatform.services.jcr.storage.value.ValueStoragePluginProvider;
@@ -46,7 +46,7 @@
* @version $Id: SingleDbJDBCConnection.java 20950 2008-10-06 14:23:07Z
* pnedonosko $
*/
-public class SingleDbJDBCConnection extends NewJDBCStorageConnection
+public class SingleDbJDBCConnection extends CQJDBCStorageConnection
{
protected PreparedStatement findItemById;
Modified: jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/test/resources/conf/standalone/test-configuration.mysql.xml
===================================================================
--- jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/test/resources/conf/standalone/test-configuration.mysql.xml 2009-12-25 15:51:39 UTC (rev 1193)
+++ jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/test/resources/conf/standalone/test-configuration.mysql.xml 2009-12-25 15:55:34 UTC (rev 1194)
@@ -229,9 +229,9 @@
<name>ref-addresses</name>
<description>ref-addresses</description>
<property name="driverClassName" value="com.mysql.jdbc.Driver" />
- <property name="url" value="jdbc:mysql://localhost:13306/portal" />
- <property name="username" value="exoadmin" />
- <property name="password" value="exo12321" />
+ <property name="url" value="jdbc:mysql://localhost/portal" />
+ <property name="username" value="root" />
+ <property name="password" value="eXoAdmin" />
<property name="maxActive" value="20" />
<property name="maxIdle" value="5" />
<property name="initialSize" value="2" />
@@ -259,9 +259,9 @@
<name>ref-addresses</name>
<description>ref-addresses</description>
<property name="driverClassName" value="com.mysql.jdbc.Driver" />
- <property name="url" value="jdbc:mysql://localhost:13306/jcr1" />
- <property name="username" value="exoadmin" />
- <property name="password" value="exo12321" />
+ <property name="url" value="jdbc:mysql://localhost/jcr1" />
+ <property name="username" value="root" />
+ <property name="password" value="eXoAdmin" />
<property name="maxActive" value="20" />
<property name="maxIdle" value="5" />
<property name="initialSize" value="2" />
@@ -289,9 +289,9 @@
<name>ref-addresses</name>
<description>ref-addresses</description>
<property name="driverClassName" value="com.mysql.jdbc.Driver" />
- <property name="url" value="jdbc:mysql://localhost:13306/jcr2" />
- <property name="username" value="exoadmin" />
- <property name="password" value="exo12321" />
+ <property name="url" value="jdbc:mysql://localhost/jcr2" />
+ <property name="username" value="root" />
+ <property name="password" value="eXoAdmin" />
<property name="maxActive" value="20" />
<property name="maxIdle" value="5" />
<property name="initialSize" value="2" />
@@ -319,9 +319,9 @@
<name>ref-addresses</name>
<description>ref-addresses</description>
<property name="driverClassName" value="com.mysql.jdbc.Driver" />
- <property name="url" value="jdbc:mysql://localhost:13306/jcr3" />
- <property name="username" value="exoadmin" />
- <property name="password" value="exo12321" />
+ <property name="url" value="jdbc:mysql://localhost/jcr3" />
+ <property name="username" value="root" />
+ <property name="password" value="eXoAdmin" />
<property name="maxActive" value="20" />
<property name="maxIdle" value="5" />
<property name="initialSize" value="2" />
@@ -349,9 +349,9 @@
<name>ref-addresses</name>
<description>ref-addresses</description>
<property name="driverClassName" value="com.mysql.jdbc.Driver" />
- <property name="url" value="jdbc:mysql://localhost:13306/portaltck" />
- <property name="username" value="exoadmin" />
- <property name="password" value="exo12321" />
+ <property name="url" value="jdbc:mysql://localhost/portaltck" />
+ <property name="username" value="root" />
+ <property name="password" value="eXoAdmin" />
<property name="maxActive" value="20" />
<property name="maxIdle" value="5" />
<property name="initialSize" value="2" />
@@ -379,9 +379,9 @@
<name>ref-addresses</name>
<description>ref-addresses</description>
<property name="driverClassName" value="com.mysql.jdbc.Driver" />
- <property name="url" value="jdbc:mysql://localhost:13306/jcrtck" />
- <property name="username" value="exoadmin" />
- <property name="password" value="exo12321" />
+ <property name="url" value="jdbc:mysql://localhost/jcrtck" />
+ <property name="username" value="root" />
+ <property name="password" value="eXoAdmin" />
<property name="maxActive" value="20" />
<property name="maxIdle" value="5" />
<property name="initialSize" value="2" />
@@ -409,9 +409,9 @@
<name>ref-addresses</name>
<description>ref-addresses</description>
<property name="driverClassName" value="com.mysql.jdbc.Driver" />
- <property name="url" value="jdbc:mysql://localhost:13306/jcr2tck" />
- <property name="username" value="exoadmin" />
- <property name="password" value="exo12321" />
+ <property name="url" value="jdbc:mysql://localhost/jcr2tck" />
+ <property name="username" value="root" />
+ <property name="password" value="eXoAdmin" />
<property name="maxActive" value="20" />
<property name="maxIdle" value="5" />
<property name="initialSize" value="2" />
Modified: jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/test/resources/conf/standalone/test-configuration.xml
===================================================================
--- jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/test/resources/conf/standalone/test-configuration.xml 2009-12-25 15:51:39 UTC (rev 1193)
+++ jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/test/resources/conf/standalone/test-configuration.xml 2009-12-25 15:55:34 UTC (rev 1194)
@@ -176,7 +176,7 @@
<name>working-conf</name>
<description>working-conf</description>
<property name="source-name" value="jdbcjcr"/>
- <property name="dialect" value="hsqldb"/>
+ <property name="dialect" value="mysql"/>
<property name="persister-class-name" value="org.exoplatform.services.jcr.impl.config.JDBCConfigurationPersister"/>
</properties-param>
</init-params>
@@ -227,11 +227,14 @@
</value-param>
<properties-param>
<name>ref-addresses</name>
- <description>ref-addresses</description>
- <property name="driverClassName" value="org.hsqldb.jdbcDriver"/>
- <property name="url" value="jdbc:hsqldb:file:target/temp/data/portal"/>
- <property name="username" value="sa"/>
- <property name="password" value=""/>
+ <description>ref-addresses</description>
+ <property name="driverClassName" value="com.mysql.jdbc.Driver" />
+ <property name="url" value="jdbc:mysql://mysql.exoua-int/KarpenkoJ2tck"/>
+ <property name="username" value="root"/>
+ <property name="password" value="eXoAdmin"/>
+ <property name="maxActive" value="100" />
+ <property name="maxIdle" value="5" />
+ <property name="initialSize" value="5" />
</properties-param>
</init-params>
</component-plugin>
@@ -255,10 +258,13 @@
<properties-param>
<name>ref-addresses</name>
<description>ref-addresses</description>
- <property name="driverClassName" value="org.hsqldb.jdbcDriver"/>
- <property name="url" value="jdbc:hsqldb:file:target/temp/data/jcr"/>
- <property name="username" value="sa"/>
- <property name="password" value=""/>
+ <property name="driverClassName" value="com.mysql.jdbc.Driver" />
+ <property name="url" value="jdbc:mysql://mysql.exoua-int/KarpenkoJCR2"/>
+ <property name="username" value="root"/>
+ <property name="password" value="eXoAdmin"/>
+ <property name="maxActive" value="100" />
+ <property name="maxIdle" value="5" />
+ <property name="initialSize" value="5" />
</properties-param>
</init-params>
</component-plugin>
@@ -282,14 +288,17 @@
<properties-param>
<name>ref-addresses</name>
<description>ref-addresses</description>
- <property name="driverClassName" value="org.hsqldb.jdbcDriver"/>
- <property name="url" value="jdbc:hsqldb:file:target/temp/data/jcr2"/>
- <property name="username" value="sa"/>
- <property name="password" value=""/>
+ <property name="driverClassName" value="com.mysql.jdbc.Driver" />
+ <property name="url" value="jdbc:mysql://mysql.exoua-int/KarpenkoPtck"/>
+ <property name="username" value="root"/>
+ <property name="password" value="eXoAdmin"/>
+ <property name="maxActive" value="100" />
+ <property name="maxIdle" value="5" />
+ <property name="initialSize" value="5" />
</properties-param>
</init-params>
</component-plugin>
- <component-plugin>
+ <component-plugin>
<name>bind.datasource</name>
<set-method>addPlugin</set-method>
<type>org.exoplatform.services.naming.BindReferencePlugin</type>
@@ -309,14 +318,18 @@
<properties-param>
<name>ref-addresses</name>
<description>ref-addresses</description>
- <property name="driverClassName" value="org.hsqldb.jdbcDriver"/>
- <property name="url" value="jdbc:hsqldb:file:target/temp/data/jcr3"/>
- <property name="username" value="sa"/>
- <property name="password" value=""/>
+ <property name="driverClassName" value="com.mysql.jdbc.Driver" />
+ <property name="url" value="jdbc:mysql://mysql.exoua-int/KarpenkoBD3"/>
+ <property name="username" value="root"/>
+ <property name="password" value="eXoAdmin"/>
+ <property name="maxActive" value="100" />
+ <property name="maxIdle" value="5" />
+ <property name="initialSize" value="5" />
+
</properties-param>
</init-params>
</component-plugin>
- <component-plugin>
+ <!--component-plugin>
<name>bind.datasource</name>
<set-method>addPlugin</set-method>
<type>org.exoplatform.services.naming.BindReferencePlugin</type>
@@ -342,7 +355,7 @@
<property name="password" value=""/>
</properties-param>
</init-params>
- </component-plugin>
+ </component-plugin-->
<component-plugin>
<name>bind.datasource</name>
<set-method>addPlugin</set-method>
@@ -363,10 +376,14 @@
<properties-param>
<name>ref-addresses</name>
<description>ref-addresses</description>
- <property name="driverClassName" value="org.hsqldb.jdbcDriver"/>
- <property name="url" value="jdbc:hsqldb:file:target/temp/data/portaltck"/>
- <property name="username" value="sa"/>
- <property name="password" value=""/>
+ <property name="driverClassName" value="com.mysql.jdbc.Driver" />
+ <property name="url" value="jdbc:mysql://mysql.exoua-int/KarpenkoBD1"/>
+ <property name="username" value="root"/>
+ <property name="password" value="eXoAdmin"/>
+ <property name="maxActive" value="100" />
+ <property name="maxIdle" value="5" />
+ <property name="initialSize" value="5" />
+
</properties-param>
</init-params>
</component-plugin>
@@ -390,10 +407,13 @@
<properties-param>
<name>ref-addresses</name>
<description>ref-addresses</description>
- <property name="driverClassName" value="org.hsqldb.jdbcDriver"/>
- <property name="url" value="jdbc:hsqldb:file:target/temp/data/jcrtck"/>
- <property name="username" value="sa"/>
- <property name="password" value=""/>
+ <property name="driverClassName" value="com.mysql.jdbc.Driver" />
+ <property name="url" value="jdbc:mysql://mysql.exoua-int/KarpenkoBD2"/>
+ <property name="username" value="root"/>
+ <property name="password" value="eXoAdmin"/>
+ <property name="maxActive" value="100" />
+ <property name="maxIdle" value="5" />
+ <property name="initialSize" value="5" />
</properties-param>
</init-params>
</component-plugin>
@@ -417,14 +437,18 @@
<properties-param>
<name>ref-addresses</name>
<description>ref-addresses</description>
- <property name="driverClassName" value="org.hsqldb.jdbcDriver"/>
- <property name="url" value="jdbc:hsqldb:file:target/temp/data/jcr2tck"/>
- <property name="username" value="sa"/>
- <property name="password" value=""/>
+ <property name="driverClassName" value="com.mysql.jdbc.Driver" />
+ <property name="url" value="jdbc:mysql://mysql.exoua-int/KarpenkoJtck"/>
+ <property name="username" value="root"/>
+ <property name="password" value="eXoAdmin"/>
+ <property name="maxActive" value="100" />
+ <property name="maxIdle" value="5" />
+ <property name="initialSize" value="5" />
+
</properties-param>
</init-params>
</component-plugin>
- <component-plugin>
+ <!--component-plugin>
<name>bind.datasource</name>
<set-method>addPlugin</set-method>
<type>org.exoplatform.services.naming.BindReferencePlugin</type>
@@ -504,7 +528,7 @@
<property name="password" value=""/>
</properties-param>
</init-params>
- </component-plugin>
+ </component-plugin-->
<!-- Resource configuration for UserTransaction
use JOTM
-->
Modified: jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/test/resources/conf/standalone/test-jcr-config.mysql.xml
===================================================================
--- jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/test/resources/conf/standalone/test-jcr-config.mysql.xml 2009-12-25 15:51:39 UTC (rev 1193)
+++ jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/test/resources/conf/standalone/test-jcr-config.mysql.xml 2009-12-25 15:55:34 UTC (rev 1194)
@@ -1,407 +1,407 @@
-<?xml version="1.0" encoding="ISO-8859-1"?>
-<!--
-
- 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.
-
--->
-<repository-service default-repository="db1">
- <repositories>
- <repository name="db1" system-workspace="ws" default-workspace="ws">
- <security-domain>exo-domain</security-domain>
- <!-- access-control>optional</access-control -->
- <!-- access-control>disable</access-control -->
- <session-max-age>1h</session-max-age>
- <authentication-policy>org.exoplatform.services.jcr.impl.core.access.JAASAuthenticator</authentication-policy>
- <workspaces>
- <workspace name="ws">
- <!-- for system storage -->
- <container class="org.exoplatform.services.jcr.impl.storage.jdbc.JDBCWorkspaceDataContainer">
- <properties>
- <property name="source-name" value="jdbcjcr" />
- <property name="dialect" value="mysql" />
- <property name="multi-db" value="true" />
- <property name="update-storage" value="false" />
- <property name="max-buffer-size" value="200k" />
- <property name="swap-directory" value="target/temp/swap/ws" />
- </properties>
- <value-storages>
- <value-storage id="ws" class="org.exoplatform.services.jcr.impl.storage.value.fs.TreeFileValueStorage">
- <properties>
- <property name="path" value="target/temp/values/ws" />
- <property name="digest-algo" value="MD5" />
- <property name="vcas-type" value="org.exoplatform.services.jcr.impl.storage.value.cas.JDBCValueContentAddressStorageImpl" />
- <property name="jdbc-source-name" value="jdbcjcr" />
- <property name="jdbc-dialect" value="mysql" />
- </properties>
- <filters>
- <filter property-type="Binary" />
- </filters>
- </value-storage>
- </value-storages>
- </container>
- <initializer class="org.exoplatform.services.jcr.impl.core.ScratchWorkspaceInitializer">
- <properties>
- <property name="root-nodetype" value="nt:unstructured" />
- </properties>
- </initializer>
- <!-- initializer class="org.exoplatform.services.jcr.impl.core.RestoreWorkspaceInitializer">
- <properties>
- <property name="restore-path" value="./sv_export_root.xml" />
- <property name="restore-path" value="./src/test/resources/import-export/restore_db1_ws1.xml" />
- </properties>
- </initializer
--->
- <cache enabled="true" class="org.exoplatform.services.jcr.impl.dataflow.persistent.LinkedWorkspaceStorageCacheImpl">
- <properties>
- <property name="max-size" value="2k" />
- <property name="live-time" value="20m" />
- <property name="statistic-period" value="30" />
- <property name="statistic-log" value="false" />
- </properties>
- </cache>
- <query-handler class="org.exoplatform.services.jcr.impl.core.query.lucene.SearchIndex">
- <properties>
- <property name="index-dir" value="target/temp/index/db1/ws" />
- </properties>
- </query-handler>
- <lock-manager>
- <time-out>15m</time-out>
- <persister class="org.exoplatform.services.jcr.impl.core.lock.FileSystemLockPersister">
- <properties>
- <property name="path" value="target/temp/lock" />
- </properties>
- </persister>
- </lock-manager>
- </workspace>
-
- <workspace name="ws1">
- <container class="org.exoplatform.services.jcr.impl.storage.jdbc.JDBCWorkspaceDataContainer">
- <properties>
- <property name="source-name" value="jdbcjcr1" />
- <property name="dialect" value="mysql" />
- <property name="multi-db" value="true" />
- <property name="update-storage" value="false" />
- <property name="max-buffer-size" value="200k" />
- <property name="swap-directory" value="target/temp/swap/ws1" />
- </properties>
- <value-storages>
- <value-storage id="ws1" class="org.exoplatform.services.jcr.impl.storage.value.fs.TreeFileValueStorage">
- <properties>
- <property name="path" value="target/temp/values/ws1" />
- </properties>
- <filters>
- <filter property-type="Binary" />
- </filters>
- </value-storage>
- </value-storages>
- </container>
- <cache enabled="true" class="org.exoplatform.services.jcr.impl.dataflow.persistent.LinkedWorkspaceStorageCacheImpl">
- <properties>
- <property name="max-size" value="2k" />
- <property name="live-time" value="20m" />
- </properties>
- </cache>
- <query-handler class="org.exoplatform.services.jcr.impl.core.query.lucene.SearchIndex">
- <properties>
- <property name="index-dir" value="target/temp/index/db1/ws1" />
- <property name="synonymprovider-class" value="org.exoplatform.services.jcr.impl.core.query.lucene.PropertiesSynonymProvider" />
- <property name="synonymprovider-config-path" value="../../synonyms.properties" />
- <property name="support-highlighting" value="true" />
- <property name="indexing-configuration-path" value="../../indexing-configuration.xml" />
- <property name="query-class" value="org.exoplatform.services.jcr.impl.core.query.QueryImpl" />
- <property name="spellchecker-class" value="org.exoplatform.services.jcr.impl.core.query.lucene.spell.LuceneSpellChecker$FiveSecondsRefreshInterval" />
- </properties>
- </query-handler>
- </workspace>
-
- <workspace name="ws2">
- <container class="org.exoplatform.services.jcr.impl.storage.jdbc.JDBCWorkspaceDataContainer">
- <properties>
- <property name="source-name" value="jdbcjcr2" />
- <property name="dialect" value="mysql" />
- <property name="multi-db" value="true" />
- <property name="update-storage" value="false" />
- <property name="max-buffer-size" value="200k" />
- <property name="swap-directory" value="target/temp/swap/ws2" />
- </properties>
- <value-storages>
- <value-storage id="ws2" class="org.exoplatform.services.jcr.impl.storage.value.fs.TreeFileValueStorage">
- <properties>
- <property name="path" value="target/temp/values/ws2" />
- </properties>
- <filters>
- <filter property-type="Binary" />
- </filters>
- </value-storage>
- </value-storages>
- </container>
- <cache enabled="true" class="org.exoplatform.services.jcr.impl.dataflow.persistent.LinkedWorkspaceStorageCacheImpl">
- <properties>
- <property name="max-size" value="2k" />
- <property name="live-time" value="20m" />
- </properties>
- </cache>
- <query-handler class="org.exoplatform.services.jcr.impl.core.query.lucene.SearchIndex">
- <properties>
- <property name="index-dir" value="target/temp/index/db1/ws2" />
- <property name="synonymprovider-class" value="org.exoplatform.services.jcr.impl.core.query.lucene.PropertiesSynonymProvider" />
- <property name="synonymprovider-config-path" value="../../synonyms.properties" />
- <property name="support-highlighting" value="true" />
- <property name="indexing-configuration-path" value="../../indexing-configuration.xml" />
- <property name="query-class" value="org.exoplatform.services.jcr.impl.core.query.QueryImpl" />
- <property name="spellchecker-class" value="org.exoplatform.services.jcr.impl.core.query.lucene.spell.LuceneSpellChecker$FiveSecondsRefreshInterval" />
- </properties>
- </query-handler>
- </workspace>
-
- <workspace name="ws3">
- <!-- for system storage -->
- <container
- class="org.exoplatform.services.jcr.impl.storage.jdbc.JDBCWorkspaceDataContainer">
- <properties>
- <property name="source-name" value="jdbcjcr3" />
- <property name="dialect" value="mysql" />
- <property name="multi-db" value="true" />
- <property name="update-storage" value="false" />
- <property name="max-buffer-size" value="200k" />
- <property name="swap-directory" value="target/temp/swap/ws3" />
- </properties>
- <value-storages>
- <!--
- This storage is used to check whether properties are removed
- correctly from each value-storage
- (TestRemoveFromValueStorage.java)
- -->
- <value-storage id="ws3_big"
- class="org.exoplatform.services.jcr.impl.storage.value.fs.TreeFileValueStorage">
- <properties>
- <property name="path" value="target/temp/values/ws3_big" />
- </properties>
- <filters>
- <filter property-type="Binary" min-value-size="1024K" />
- </filters>
- </value-storage>
- <value-storage id="ws3"
- class="org.exoplatform.services.jcr.impl.storage.value.fs.CASableTreeFileValueStorage">
- <properties>
- <property name="path" value="target/temp/values/ws3" />
- <property name="digest-algo" value="MD5" />
- <property name="vcas-type"
- value="org.exoplatform.services.jcr.impl.storage.value.cas.JDBCValueContentAddressStorageImpl" />
- <property name="jdbc-source-name" value="jdbcjcr" />
- <property name="jdbc-dialect" value="mysql" />
- </properties>
- <filters>
- <filter property-type="Binary" />
- </filters>
- </value-storage>
- </value-storages>
- </container>
- <initializer
- class="org.exoplatform.services.jcr.impl.core.ScratchWorkspaceInitializer">
- <properties>
- <property name="root-nodetype" value="nt:unstructured" />
- </properties>
- </initializer>
- <cache enabled="true"
- class="org.exoplatform.services.jcr.impl.dataflow.persistent.LinkedWorkspaceStorageCacheImpl">
- <properties>
- <property name="max-size" value="2k" />
- <property name="live-time" value="20m" />
- </properties>
- </cache>
- <query-handler
- class="org.exoplatform.services.jcr.impl.core.query.lucene.SearchIndex">
- <properties>
- <property name="index-dir" value="target/temp/index/db1/ws3" />
- <property name="synonymprovider-class"
- value="org.exoplatform.services.jcr.impl.core.query.lucene.PropertiesSynonymProvider" />
- <property name="synonymprovider-config-path" value="../../synonyms.properties" />
- <property name="support-highlighting" value="true" />
- <property name="indexing-configuration-path" value="../../indexing-configuration.xml" />
- <property name="query-class"
- value="org.exoplatform.services.jcr.impl.core.query.QueryImpl" />
- <property name="spellchecker-class"
- value="org.exoplatform.services.jcr.impl.core.query.lucene.spell.LuceneSpellChecker$FiveSecondsRefreshInterval" />
- </properties>
- </query-handler>
- </workspace>
- </workspaces>
- </repository>
-
- <repository name="db1tck" system-workspace="ws" default-workspace="ws">
- <security-domain>exo-domain</security-domain>
- <!-- access-control>optional</access-control -->
- <!-- access-control>disable</access-control -->
- <session-max-age>1h</session-max-age>
- <authentication-policy>org.exoplatform.services.jcr.impl.core.access.JAASAuthenticator</authentication-policy>
- <workspaces>
- <workspace name="ws">
- <!-- for system storage -->
- <container class="org.exoplatform.services.jcr.impl.storage.jdbc.JDBCWorkspaceDataContainer">
- <properties>
- <property name="source-name" value="jdbcjcrtck" />
- <property name="dialect" value="mysql" />
- <property name="multi-db" value="true" />
- <property name="update-storage" value="false" />
- <property name="max-buffer-size" value="200k" />
- <property name="swap-directory" value="target/temp/swap/wstck" />
- </properties>
- <value-storages>
- <value-storage id="ws" class="org.exoplatform.services.jcr.impl.storage.value.fs.TreeFileValueStorage">
- <properties>
- <property name="path" value="target/temp/values/wstck" />
- </properties>
- <filters>
- <filter property-type="Binary" min-value-size="100K" />
- </filters>
- </value-storage>
- </value-storages>
- </container>
- <initializer class="org.exoplatform.services.jcr.impl.core.ScratchWorkspaceInitializer">
- <properties>
- <property name="root-nodetype" value="nt:unstructured" />
- <property name="root-permissions" value="any read;*:/platform/administrators read;*:/platform/administrators add_node;*:/platform/administrators set_property;*:/platform/administrators remove" />
- </properties>
- </initializer>
- <cache enabled="true" class="org.exoplatform.services.jcr.impl.dataflow.persistent.LinkedWorkspaceStorageCacheImpl">
- <properties>
- <property name="max-size" value="2k" />
- <property name="live-time" value="20m" />
- </properties>
- </cache>
- <query-handler class="org.exoplatform.services.jcr.impl.core.query.lucene.SearchIndex">
- <properties>
- <property name="index-dir" value="target/temp/index/db1tck/ws" />
- <property name="synonymprovider-class" value="org.exoplatform.services.jcr.impl.core.query.lucene.PropertiesSynonymProvider" />
- <property name="synonymprovider-config-path" value="../../synonyms.properties" />
- <property name="support-highlighting" value="true" />
- <property name="indexing-configuration-path" value="../../indexing-configuration.xml" />
- <property name="query-class" value="org.exoplatform.services.jcr.impl.core.query.QueryImpl" />
- <property name="excerptprovider-class" value="org.exoplatform.services.jcr.impl.core.query.lucene.WeightedHTMLExcerpt" />
- <property name="spellchecker-class" value="org.exoplatform.services.jcr.impl.core.query.lucene.spell.LuceneSpellChecker$FiveSecondsRefreshInterval" />
- </properties>
- </query-handler>
- <lock-manager>
- <time-out>15m</time-out>
- <persister class="org.exoplatform.services.jcr.impl.core.lock.FileSystemLockPersister">
- <properties>
- <property name="path" value="target/temp/locktck" />
- </properties>
- </persister>
- </lock-manager>
- </workspace>
-
- <workspace name="ws1">
- <container class="org.exoplatform.services.jcr.impl.storage.jdbc.JDBCWorkspaceDataContainer">
- <properties>
- <property name="source-name" value="jdbcjcr1tck" />
- <property name="dialect" value="mysql" />
- <property name="multi-db" value="true" />
- <property name="update-storage" value="false" />
- <property name="max-buffer-size" value="200k" />
- <property name="swap-directory" value="target/temp/swap/ws1tck" />
- </properties>
- <value-storages>
- <value-storage id="ws1" class="org.exoplatform.services.jcr.impl.storage.value.fs.TreeFileValueStorage">
- <properties>
- <property name="path" value="target/temp/values/ws1tck" />
- </properties>
- <filters>
- <filter property-type="Binary" min-value-size="100K" />
- </filters>
- </value-storage>
- </value-storages>
- </container>
- <initializer class="org.exoplatform.services.jcr.impl.core.ScratchWorkspaceInitializer">
- <properties>
- <property name="root-nodetype" value="nt:unstructured" />
- <property name="root-permissions" value="any read;*:/platform/administrators read;*:/platform/administrators add_node;*:/platform/administrators set_property;*:/platform/administrators remove" />
- </properties>
- </initializer>
- <cache enabled="true" class="org.exoplatform.services.jcr.impl.dataflow.persistent.LinkedWorkspaceStorageCacheImpl">
- <properties>
- <property name="max-size" value="2k" />
- <property name="live-time" value="20m" />
- </properties>
- </cache>
- <query-handler class="org.exoplatform.services.jcr.impl.core.query.lucene.SearchIndex">
- <properties>
- <property name="index-dir" value="target/temp/index/db1tck/ws1" />
- <property name="synonymprovider-class" value="org.exoplatform.services.jcr.impl.core.query.lucene.PropertiesSynonymProvider" />
- <property name="synonymprovider-config-path" value="../../synonyms.properties" />
- <property name="support-highlighting" value="true" />
- <property name="indexing-configuration-path" value="../../indexing-configuration.xml" />
- <property name="query-class" value="org.exoplatform.services.jcr.impl.core.query.QueryImpl" />
- <property name="spellchecker-class" value="org.exoplatform.services.jcr.impl.core.query.lucene.spell.LuceneSpellChecker$FiveSecondsRefreshInterval" />
- </properties>
- </query-handler>
- </workspace>
-
- <workspace name="ws2">
- <container class="org.exoplatform.services.jcr.impl.storage.jdbc.JDBCWorkspaceDataContainer">
- <properties>
- <property name="source-name" value="jdbcjcr2tck" />
- <property name="dialect" value="mysql" />
- <property name="multi-db" value="true" />
- <property name="update-storage" value="false" />
- <property name="max-buffer-size" value="200k" />
- <property name="swap-directory" value="target/temp/swap/ws2tck" />
- </properties>
- <value-storages>
- <value-storage id="ws2" class="org.exoplatform.services.jcr.impl.storage.value.fs.TreeFileValueStorage">
- <properties>
- <property name="path" value="target/temp/values/ws2tck" />
- </properties>
- <filters>
- <filter property-type="Binary" min-value-size="100K" />
- </filters>
- </value-storage>
- </value-storages>
- </container>
- <initializer class="org.exoplatform.services.jcr.impl.core.ScratchWorkspaceInitializer">
- <properties>
- <property name="root-nodetype" value="nt:unstructured" />
- <property name="root-permissions" value="any read;*:/platform/administrators read;*:/platform/administrators add_node;*:/platform/administrators set_property;*:/platform/administrators remove" />
- </properties>
- </initializer>
- <cache enabled="true" class="org.exoplatform.services.jcr.impl.dataflow.persistent.LinkedWorkspaceStorageCacheImpl">
- <properties>
- <property name="max-size" value="2k" />
- <property name="live-time" value="20m" />
- </properties>
- </cache>
- <query-handler class="org.exoplatform.services.jcr.impl.core.query.lucene.SearchIndex">
- <properties>
- <property name="index-dir" value="target/temp/index/db1tck/ws2" />
- <property name="synonymprovider-class" value="org.exoplatform.services.jcr.impl.core.query.lucene.PropertiesSynonymProvider" />
- <property name="synonymprovider-config-path" value="../../synonyms.properties" />
- <property name="support-highlighting" value="true" />
- <property name="indexing-configuration-path" value="../../indexing-configuration.xml" />
- <property name="query-class" value="org.exoplatform.services.jcr.impl.core.query.QueryImpl" />
- <property name="spellchecker-class" value="org.exoplatform.services.jcr.impl.core.query.lucene.spell.LuceneSpellChecker$FiveSecondsRefreshInterval" />
- <property name="excerptprovider-class" value="org.exoplatform.services.jcr.impl.core.query.lucene.WeightedHTMLExcerpt"/>
- <property name="extractorPoolSize" value="2"/>
- <property name="extractorTimeout" value="10"/>
- </properties>
- </query-handler>
- </workspace>
- </workspaces>
- </repository>
- </repositories>
-</repository-service>
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!--
+
+ 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.
+
+-->
+<repository-service default-repository="db1">
+ <repositories>
+ <repository name="db1" system-workspace="ws" default-workspace="ws">
+ <security-domain>exo-domain</security-domain>
+ <!-- access-control>optional</access-control -->
+ <!-- access-control>disable</access-control -->
+ <session-max-age>1h</session-max-age>
+ <authentication-policy>org.exoplatform.services.jcr.impl.core.access.JAASAuthenticator</authentication-policy>
+ <workspaces>
+ <workspace name="ws">
+ <!-- for system storage -->
+ <container class="org.exoplatform.services.jcr.impl.storage.jdbc.optimisation.NewJDBCWorkspaceDataContainer">
+ <properties>
+ <property name="source-name" value="jdbcjcr" />
+ <property name="dialect" value="mysql" />
+ <property name="multi-db" value="true" />
+ <property name="update-storage" value="false" />
+ <property name="max-buffer-size" value="200k" />
+ <property name="swap-directory" value="target/temp/swap/ws" />
+ </properties>
+ <value-storages>
+ <value-storage id="ws" class="org.exoplatform.services.jcr.impl.storage.value.fs.TreeFileValueStorage">
+ <properties>
+ <property name="path" value="target/temp/values/ws" />
+ <property name="digest-algo" value="MD5" />
+ <property name="vcas-type" value="org.exoplatform.services.jcr.impl.storage.value.cas.JDBCValueContentAddressStorageImpl" />
+ <property name="jdbc-source-name" value="jdbcjcr" />
+ <property name="jdbc-dialect" value="mysql" />
+ </properties>
+ <filters>
+ <filter property-type="Binary" />
+ </filters>
+ </value-storage>
+ </value-storages>
+ </container>
+ <initializer class="org.exoplatform.services.jcr.impl.core.ScratchWorkspaceInitializer">
+ <properties>
+ <property name="root-nodetype" value="nt:unstructured" />
+ </properties>
+ </initializer>
+ <!-- initializer class="org.exoplatform.services.jcr.impl.core.RestoreWorkspaceInitializer">
+ <properties>
+ <property name="restore-path" value="./sv_export_root.xml" />
+ <property name="restore-path" value="./src/test/resources/import-export/restore_db1_ws1.xml" />
+ </properties>
+ </initializer
+-->
+ <cache enabled="true" class="org.exoplatform.services.jcr.impl.dataflow.persistent.LinkedWorkspaceStorageCacheImpl">
+ <properties>
+ <property name="max-size" value="2k" />
+ <property name="live-time" value="20m" />
+ <property name="statistic-period" value="30" />
+ <property name="statistic-log" value="false" />
+ </properties>
+ </cache>
+ <query-handler class="org.exoplatform.services.jcr.impl.core.query.lucene.SearchIndex">
+ <properties>
+ <property name="index-dir" value="target/temp/index/db1/ws" />
+ </properties>
+ </query-handler>
+ <lock-manager>
+ <time-out>15m</time-out>
+ <persister class="org.exoplatform.services.jcr.impl.core.lock.FileSystemLockPersister">
+ <properties>
+ <property name="path" value="target/temp/lock" />
+ </properties>
+ </persister>
+ </lock-manager>
+ </workspace>
+
+ <workspace name="ws1">
+ <container class="org.exoplatform.services.jcr.impl.storage.jdbc.optimisation.NewJDBCWorkspaceDataContainer">
+ <properties>
+ <property name="source-name" value="jdbcjcr1" />
+ <property name="dialect" value="mysql" />
+ <property name="multi-db" value="true" />
+ <property name="update-storage" value="false" />
+ <property name="max-buffer-size" value="200k" />
+ <property name="swap-directory" value="target/temp/swap/ws1" />
+ </properties>
+ <value-storages>
+ <value-storage id="ws1" class="org.exoplatform.services.jcr.impl.storage.value.fs.TreeFileValueStorage">
+ <properties>
+ <property name="path" value="target/temp/values/ws1" />
+ </properties>
+ <filters>
+ <filter property-type="Binary" />
+ </filters>
+ </value-storage>
+ </value-storages>
+ </container>
+ <cache enabled="true" class="org.exoplatform.services.jcr.impl.dataflow.persistent.LinkedWorkspaceStorageCacheImpl">
+ <properties>
+ <property name="max-size" value="2k" />
+ <property name="live-time" value="20m" />
+ </properties>
+ </cache>
+ <query-handler class="org.exoplatform.services.jcr.impl.core.query.lucene.SearchIndex">
+ <properties>
+ <property name="index-dir" value="target/temp/index/db1/ws1" />
+ <property name="synonymprovider-class" value="org.exoplatform.services.jcr.impl.core.query.lucene.PropertiesSynonymProvider" />
+ <property name="synonymprovider-config-path" value="../../synonyms.properties" />
+ <property name="support-highlighting" value="true" />
+ <property name="indexing-configuration-path" value="../../indexing-configuration.xml" />
+ <property name="query-class" value="org.exoplatform.services.jcr.impl.core.query.QueryImpl" />
+ <property name="spellchecker-class" value="org.exoplatform.services.jcr.impl.core.query.lucene.spell.LuceneSpellChecker$FiveSecondsRefreshInterval" />
+ </properties>
+ </query-handler>
+ </workspace>
+
+ <workspace name="ws2">
+ <container class="org.exoplatform.services.jcr.impl.storage.jdbc.optimisation.NewJDBCWorkspaceDataContainer">
+ <properties>
+ <property name="source-name" value="jdbcjcr2" />
+ <property name="dialect" value="mysql" />
+ <property name="multi-db" value="true" />
+ <property name="update-storage" value="false" />
+ <property name="max-buffer-size" value="200k" />
+ <property name="swap-directory" value="target/temp/swap/ws2" />
+ </properties>
+ <value-storages>
+ <value-storage id="ws2" class="org.exoplatform.services.jcr.impl.storage.value.fs.TreeFileValueStorage">
+ <properties>
+ <property name="path" value="target/temp/values/ws2" />
+ </properties>
+ <filters>
+ <filter property-type="Binary" />
+ </filters>
+ </value-storage>
+ </value-storages>
+ </container>
+ <cache enabled="true" class="org.exoplatform.services.jcr.impl.dataflow.persistent.LinkedWorkspaceStorageCacheImpl">
+ <properties>
+ <property name="max-size" value="2k" />
+ <property name="live-time" value="20m" />
+ </properties>
+ </cache>
+ <query-handler class="org.exoplatform.services.jcr.impl.core.query.lucene.SearchIndex">
+ <properties>
+ <property name="index-dir" value="target/temp/index/db1/ws2" />
+ <property name="synonymprovider-class" value="org.exoplatform.services.jcr.impl.core.query.lucene.PropertiesSynonymProvider" />
+ <property name="synonymprovider-config-path" value="../../synonyms.properties" />
+ <property name="support-highlighting" value="true" />
+ <property name="indexing-configuration-path" value="../../indexing-configuration.xml" />
+ <property name="query-class" value="org.exoplatform.services.jcr.impl.core.query.QueryImpl" />
+ <property name="spellchecker-class" value="org.exoplatform.services.jcr.impl.core.query.lucene.spell.LuceneSpellChecker$FiveSecondsRefreshInterval" />
+ </properties>
+ </query-handler>
+ </workspace>
+
+ <workspace name="ws3">
+ <!-- for system storage -->
+ <container
+ class="org.exoplatform.services.jcr.impl.storage.jdbc.optimisation.NewJDBCWorkspaceDataContainer">
+ <properties>
+ <property name="source-name" value="jdbcjcr3" />
+ <property name="dialect" value="mysql" />
+ <property name="multi-db" value="true" />
+ <property name="update-storage" value="false" />
+ <property name="max-buffer-size" value="200k" />
+ <property name="swap-directory" value="target/temp/swap/ws3" />
+ </properties>
+ <value-storages>
+ <!--
+ This storage is used to check whether properties are removed
+ correctly from each value-storage
+ (TestRemoveFromValueStorage.java)
+ -->
+ <value-storage id="ws3_big"
+ class="org.exoplatform.services.jcr.impl.storage.value.fs.TreeFileValueStorage">
+ <properties>
+ <property name="path" value="target/temp/values/ws3_big" />
+ </properties>
+ <filters>
+ <filter property-type="Binary" min-value-size="1024K" />
+ </filters>
+ </value-storage>
+ <value-storage id="ws3"
+ class="org.exoplatform.services.jcr.impl.storage.value.fs.CASableTreeFileValueStorage">
+ <properties>
+ <property name="path" value="target/temp/values/ws3" />
+ <property name="digest-algo" value="MD5" />
+ <property name="vcas-type"
+ value="org.exoplatform.services.jcr.impl.storage.value.cas.JDBCValueContentAddressStorageImpl" />
+ <property name="jdbc-source-name" value="jdbcjcr" />
+ <property name="jdbc-dialect" value="mysql" />
+ </properties>
+ <filters>
+ <filter property-type="Binary" />
+ </filters>
+ </value-storage>
+ </value-storages>
+ </container>
+ <initializer
+ class="org.exoplatform.services.jcr.impl.core.ScratchWorkspaceInitializer">
+ <properties>
+ <property name="root-nodetype" value="nt:unstructured" />
+ </properties>
+ </initializer>
+ <cache enabled="true"
+ class="org.exoplatform.services.jcr.impl.dataflow.persistent.LinkedWorkspaceStorageCacheImpl">
+ <properties>
+ <property name="max-size" value="2k" />
+ <property name="live-time" value="20m" />
+ </properties>
+ </cache>
+ <query-handler
+ class="org.exoplatform.services.jcr.impl.core.query.lucene.SearchIndex">
+ <properties>
+ <property name="index-dir" value="target/temp/index/db1/ws3" />
+ <property name="synonymprovider-class"
+ value="org.exoplatform.services.jcr.impl.core.query.lucene.PropertiesSynonymProvider" />
+ <property name="synonymprovider-config-path" value="../../synonyms.properties" />
+ <property name="support-highlighting" value="true" />
+ <property name="indexing-configuration-path" value="../../indexing-configuration.xml" />
+ <property name="query-class"
+ value="org.exoplatform.services.jcr.impl.core.query.QueryImpl" />
+ <property name="spellchecker-class"
+ value="org.exoplatform.services.jcr.impl.core.query.lucene.spell.LuceneSpellChecker$FiveSecondsRefreshInterval" />
+ </properties>
+ </query-handler>
+ </workspace>
+ </workspaces>
+ </repository>
+
+ <repository name="db1tck" system-workspace="ws" default-workspace="ws">
+ <security-domain>exo-domain</security-domain>
+ <!-- access-control>optional</access-control -->
+ <!-- access-control>disable</access-control -->
+ <session-max-age>1h</session-max-age>
+ <authentication-policy>org.exoplatform.services.jcr.impl.core.access.JAASAuthenticator</authentication-policy>
+ <workspaces>
+ <workspace name="ws">
+ <!-- for system storage -->
+ <container class="org.exoplatform.services.jcr.impl.storage.jdbc.optimisation.NewJDBCWorkspaceDataContainer">
+ <properties>
+ <property name="source-name" value="jdbcjcrtck" />
+ <property name="dialect" value="mysql" />
+ <property name="multi-db" value="true" />
+ <property name="update-storage" value="false" />
+ <property name="max-buffer-size" value="200k" />
+ <property name="swap-directory" value="target/temp/swap/wstck" />
+ </properties>
+ <value-storages>
+ <value-storage id="ws" class="org.exoplatform.services.jcr.impl.storage.value.fs.TreeFileValueStorage">
+ <properties>
+ <property name="path" value="target/temp/values/wstck" />
+ </properties>
+ <filters>
+ <filter property-type="Binary" min-value-size="100K" />
+ </filters>
+ </value-storage>
+ </value-storages>
+ </container>
+ <initializer class="org.exoplatform.services.jcr.impl.core.ScratchWorkspaceInitializer">
+ <properties>
+ <property name="root-nodetype" value="nt:unstructured" />
+ <property name="root-permissions" value="any read;*:/platform/administrators read;*:/platform/administrators add_node;*:/platform/administrators set_property;*:/platform/administrators remove" />
+ </properties>
+ </initializer>
+ <cache enabled="true" class="org.exoplatform.services.jcr.impl.dataflow.persistent.LinkedWorkspaceStorageCacheImpl">
+ <properties>
+ <property name="max-size" value="2k" />
+ <property name="live-time" value="20m" />
+ </properties>
+ </cache>
+ <query-handler class="org.exoplatform.services.jcr.impl.core.query.lucene.SearchIndex">
+ <properties>
+ <property name="index-dir" value="target/temp/index/db1tck/ws" />
+ <property name="synonymprovider-class" value="org.exoplatform.services.jcr.impl.core.query.lucene.PropertiesSynonymProvider" />
+ <property name="synonymprovider-config-path" value="../../synonyms.properties" />
+ <property name="support-highlighting" value="true" />
+ <property name="indexing-configuration-path" value="../../indexing-configuration.xml" />
+ <property name="query-class" value="org.exoplatform.services.jcr.impl.core.query.QueryImpl" />
+ <property name="excerptprovider-class" value="org.exoplatform.services.jcr.impl.core.query.lucene.WeightedHTMLExcerpt" />
+ <property name="spellchecker-class" value="org.exoplatform.services.jcr.impl.core.query.lucene.spell.LuceneSpellChecker$FiveSecondsRefreshInterval" />
+ </properties>
+ </query-handler>
+ <lock-manager>
+ <time-out>15m</time-out>
+ <persister class="org.exoplatform.services.jcr.impl.core.lock.FileSystemLockPersister">
+ <properties>
+ <property name="path" value="target/temp/locktck" />
+ </properties>
+ </persister>
+ </lock-manager>
+ </workspace>
+
+ <workspace name="ws1">
+ <container class="org.exoplatform.services.jcr.impl.storage.jdbc.optimisation.NewJDBCWorkspaceDataContainer">
+ <properties>
+ <property name="source-name" value="jdbcjcr1tck" />
+ <property name="dialect" value="mysql" />
+ <property name="multi-db" value="true" />
+ <property name="update-storage" value="false" />
+ <property name="max-buffer-size" value="200k" />
+ <property name="swap-directory" value="target/temp/swap/ws1tck" />
+ </properties>
+ <value-storages>
+ <value-storage id="ws1" class="org.exoplatform.services.jcr.impl.storage.value.fs.TreeFileValueStorage">
+ <properties>
+ <property name="path" value="target/temp/values/ws1tck" />
+ </properties>
+ <filters>
+ <filter property-type="Binary" min-value-size="100K" />
+ </filters>
+ </value-storage>
+ </value-storages>
+ </container>
+ <initializer class="org.exoplatform.services.jcr.impl.core.ScratchWorkspaceInitializer">
+ <properties>
+ <property name="root-nodetype" value="nt:unstructured" />
+ <property name="root-permissions" value="any read;*:/platform/administrators read;*:/platform/administrators add_node;*:/platform/administrators set_property;*:/platform/administrators remove" />
+ </properties>
+ </initializer>
+ <cache enabled="true" class="org.exoplatform.services.jcr.impl.dataflow.persistent.LinkedWorkspaceStorageCacheImpl">
+ <properties>
+ <property name="max-size" value="2k" />
+ <property name="live-time" value="20m" />
+ </properties>
+ </cache>
+ <query-handler class="org.exoplatform.services.jcr.impl.core.query.lucene.SearchIndex">
+ <properties>
+ <property name="index-dir" value="target/temp/index/db1tck/ws1" />
+ <property name="synonymprovider-class" value="org.exoplatform.services.jcr.impl.core.query.lucene.PropertiesSynonymProvider" />
+ <property name="synonymprovider-config-path" value="../../synonyms.properties" />
+ <property name="support-highlighting" value="true" />
+ <property name="indexing-configuration-path" value="../../indexing-configuration.xml" />
+ <property name="query-class" value="org.exoplatform.services.jcr.impl.core.query.QueryImpl" />
+ <property name="spellchecker-class" value="org.exoplatform.services.jcr.impl.core.query.lucene.spell.LuceneSpellChecker$FiveSecondsRefreshInterval" />
+ </properties>
+ </query-handler>
+ </workspace>
+
+ <workspace name="ws2">
+ <container class="org.exoplatform.services.jcr.impl.storage.jdbc.optimisation.NewJDBCWorkspaceDataContainer">
+ <properties>
+ <property name="source-name" value="jdbcjcr2tck" />
+ <property name="dialect" value="mysql" />
+ <property name="multi-db" value="true" />
+ <property name="update-storage" value="false" />
+ <property name="max-buffer-size" value="200k" />
+ <property name="swap-directory" value="target/temp/swap/ws2tck" />
+ </properties>
+ <value-storages>
+ <value-storage id="ws2" class="org.exoplatform.services.jcr.impl.storage.value.fs.TreeFileValueStorage">
+ <properties>
+ <property name="path" value="target/temp/values/ws2tck" />
+ </properties>
+ <filters>
+ <filter property-type="Binary" min-value-size="100K" />
+ </filters>
+ </value-storage>
+ </value-storages>
+ </container>
+ <initializer class="org.exoplatform.services.jcr.impl.core.ScratchWorkspaceInitializer">
+ <properties>
+ <property name="root-nodetype" value="nt:unstructured" />
+ <property name="root-permissions" value="any read;*:/platform/administrators read;*:/platform/administrators add_node;*:/platform/administrators set_property;*:/platform/administrators remove" />
+ </properties>
+ </initializer>
+ <cache enabled="true" class="org.exoplatform.services.jcr.impl.dataflow.persistent.LinkedWorkspaceStorageCacheImpl">
+ <properties>
+ <property name="max-size" value="2k" />
+ <property name="live-time" value="20m" />
+ </properties>
+ </cache>
+ <query-handler class="org.exoplatform.services.jcr.impl.core.query.lucene.SearchIndex">
+ <properties>
+ <property name="index-dir" value="target/temp/index/db1tck/ws2" />
+ <property name="synonymprovider-class" value="org.exoplatform.services.jcr.impl.core.query.lucene.PropertiesSynonymProvider" />
+ <property name="synonymprovider-config-path" value="../../synonyms.properties" />
+ <property name="support-highlighting" value="true" />
+ <property name="indexing-configuration-path" value="../../indexing-configuration.xml" />
+ <property name="query-class" value="org.exoplatform.services.jcr.impl.core.query.QueryImpl" />
+ <property name="spellchecker-class" value="org.exoplatform.services.jcr.impl.core.query.lucene.spell.LuceneSpellChecker$FiveSecondsRefreshInterval" />
+ <property name="excerptprovider-class" value="org.exoplatform.services.jcr.impl.core.query.lucene.WeightedHTMLExcerpt"/>
+ <property name="extractorPoolSize" value="2"/>
+ <property name="extractorTimeout" value="10"/>
+ </properties>
+ </query-handler>
+ </workspace>
+ </workspaces>
+ </repository>
+ </repositories>
+</repository-service>
Modified: jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/test/resources/conf/standalone/test-jcr-config.xml
===================================================================
--- jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/test/resources/conf/standalone/test-jcr-config.xml 2009-12-25 15:51:39 UTC (rev 1193)
+++ jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/test/resources/conf/standalone/test-jcr-config.xml 2009-12-25 15:55:34 UTC (rev 1194)
@@ -1,407 +1,407 @@
-<?xml version="1.0" encoding="ISO-8859-1"?>
-<!--
-
- 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.
-
--->
-<repository-service default-repository="db1">
- <repositories>
- <repository name="db1" system-workspace="ws" default-workspace="ws">
- <security-domain>exo-domain</security-domain>
- <!-- access-control>optional</access-control -->
- <!-- access-control>disable</access-control -->
- <session-max-age>1h</session-max-age>
- <authentication-policy>org.exoplatform.services.jcr.impl.core.access.JAASAuthenticator</authentication-policy>
- <workspaces>
- <workspace name="ws">
- <!-- for system storage -->
- <container class="org.exoplatform.services.jcr.impl.storage.jdbc.JDBCWorkspaceDataContainer">
- <properties>
- <property name="source-name" value="jdbcjcr" />
- <property name="dialect" value="hsqldb" />
- <property name="multi-db" value="true" />
- <property name="update-storage" value="false" />
- <property name="max-buffer-size" value="200k" />
- <property name="swap-directory" value="target/temp/swap/ws" />
- </properties>
- <value-storages>
- <value-storage id="ws" class="org.exoplatform.services.jcr.impl.storage.value.fs.TreeFileValueStorage">
- <properties>
- <property name="path" value="target/temp/values/ws" />
- <property name="digest-algo" value="MD5" />
- <property name="vcas-type" value="org.exoplatform.services.jcr.impl.storage.value.cas.JDBCValueContentAddressStorageImpl" />
- <property name="jdbc-source-name" value="jdbcjcr" />
- <property name="jdbc-dialect" value="hsqldb" />
- </properties>
- <filters>
- <filter property-type="Binary" />
- </filters>
- </value-storage>
- </value-storages>
- </container>
- <initializer class="org.exoplatform.services.jcr.impl.core.ScratchWorkspaceInitializer">
- <properties>
- <property name="root-nodetype" value="nt:unstructured" />
- </properties>
- </initializer>
- <!-- initializer class="org.exoplatform.services.jcr.impl.core.RestoreWorkspaceInitializer">
- <properties>
- <property name="restore-path" value="./sv_export_root.xml" />
- <property name="restore-path" value="./src/test/resources/import-export/restore_db1_ws1.xml" />
- </properties>
- </initializer
--->
- <cache enabled="true" class="org.exoplatform.services.jcr.impl.dataflow.persistent.LinkedWorkspaceStorageCacheImpl">
- <properties>
- <property name="max-size" value="2k" />
- <property name="live-time" value="20m" />
- <property name="statistic-period" value="30" />
- <property name="statistic-log" value="false" />
- </properties>
- </cache>
- <query-handler class="org.exoplatform.services.jcr.impl.core.query.lucene.SearchIndex">
- <properties>
- <property name="index-dir" value="target/temp/index/db1/ws" />
- </properties>
- </query-handler>
- <lock-manager>
- <time-out>15m</time-out>
- <persister class="org.exoplatform.services.jcr.impl.core.lock.FileSystemLockPersister">
- <properties>
- <property name="path" value="target/temp/lock" />
- </properties>
- </persister>
- </lock-manager>
- </workspace>
-
- <workspace name="ws1">
- <container class="org.exoplatform.services.jcr.impl.storage.jdbc.JDBCWorkspaceDataContainer">
- <properties>
- <property name="source-name" value="jdbcjcr1" />
- <property name="dialect" value="hsqldb" />
- <property name="multi-db" value="true" />
- <property name="update-storage" value="false" />
- <property name="max-buffer-size" value="200k" />
- <property name="swap-directory" value="target/temp/swap/ws1" />
- </properties>
- <value-storages>
- <value-storage id="ws1" class="org.exoplatform.services.jcr.impl.storage.value.fs.TreeFileValueStorage">
- <properties>
- <property name="path" value="target/temp/values/ws1" />
- </properties>
- <filters>
- <filter property-type="Binary" />
- </filters>
- </value-storage>
- </value-storages>
- </container>
- <cache enabled="true" class="org.exoplatform.services.jcr.impl.dataflow.persistent.LinkedWorkspaceStorageCacheImpl">
- <properties>
- <property name="max-size" value="2k" />
- <property name="live-time" value="20m" />
- </properties>
- </cache>
- <query-handler class="org.exoplatform.services.jcr.impl.core.query.lucene.SearchIndex">
- <properties>
- <property name="index-dir" value="target/temp/index/db1/ws1" />
- <property name="synonymprovider-class" value="org.exoplatform.services.jcr.impl.core.query.lucene.PropertiesSynonymProvider" />
- <property name="synonymprovider-config-path" value="../../synonyms.properties" />
- <property name="support-highlighting" value="true" />
- <property name="indexing-configuration-path" value="../../indexing-configuration.xml" />
- <property name="query-class" value="org.exoplatform.services.jcr.impl.core.query.QueryImpl" />
- <property name="spellchecker-class" value="org.exoplatform.services.jcr.impl.core.query.lucene.spell.LuceneSpellChecker$FiveSecondsRefreshInterval" />
- </properties>
- </query-handler>
- </workspace>
-
- <workspace name="ws2">
- <container class="org.exoplatform.services.jcr.impl.storage.jdbc.JDBCWorkspaceDataContainer">
- <properties>
- <property name="source-name" value="jdbcjcr2" />
- <property name="dialect" value="hsqldb" />
- <property name="multi-db" value="true" />
- <property name="update-storage" value="false" />
- <property name="max-buffer-size" value="200k" />
- <property name="swap-directory" value="target/temp/swap/ws2" />
- </properties>
- <value-storages>
- <value-storage id="ws2" class="org.exoplatform.services.jcr.impl.storage.value.fs.TreeFileValueStorage">
- <properties>
- <property name="path" value="target/temp/values/ws2" />
- </properties>
- <filters>
- <filter property-type="Binary" />
- </filters>
- </value-storage>
- </value-storages>
- </container>
- <cache enabled="true" class="org.exoplatform.services.jcr.impl.dataflow.persistent.LinkedWorkspaceStorageCacheImpl">
- <properties>
- <property name="max-size" value="2k" />
- <property name="live-time" value="20m" />
- </properties>
- </cache>
- <query-handler class="org.exoplatform.services.jcr.impl.core.query.lucene.SearchIndex">
- <properties>
- <property name="index-dir" value="target/temp/index/db1/ws2" />
- <property name="synonymprovider-class" value="org.exoplatform.services.jcr.impl.core.query.lucene.PropertiesSynonymProvider" />
- <property name="synonymprovider-config-path" value="../../synonyms.properties" />
- <property name="support-highlighting" value="true" />
- <property name="indexing-configuration-path" value="../../indexing-configuration.xml" />
- <property name="query-class" value="org.exoplatform.services.jcr.impl.core.query.QueryImpl" />
- <property name="spellchecker-class" value="org.exoplatform.services.jcr.impl.core.query.lucene.spell.LuceneSpellChecker$FiveSecondsRefreshInterval" />
- </properties>
- </query-handler>
- </workspace>
-
- <workspace name="ws3">
- <!-- for system storage -->
- <container
- class="org.exoplatform.services.jcr.impl.storage.jdbc.JDBCWorkspaceDataContainer">
- <properties>
- <property name="source-name" value="jdbcjcr3" />
- <property name="dialect" value="hsqldb" />
- <property name="multi-db" value="true" />
- <property name="update-storage" value="false" />
- <property name="max-buffer-size" value="200k" />
- <property name="swap-directory" value="target/temp/swap/ws3" />
- </properties>
- <value-storages>
- <!--
- This storage is used to check whether properties are removed
- correctly from each value-storage
- (TestRemoveFromValueStorage.java)
- -->
- <value-storage id="ws3_big"
- class="org.exoplatform.services.jcr.impl.storage.value.fs.TreeFileValueStorage">
- <properties>
- <property name="path" value="target/temp/values/ws3_big" />
- </properties>
- <filters>
- <filter property-type="Binary" min-value-size="1024K" />
- </filters>
- </value-storage>
- <value-storage id="ws3"
- class="org.exoplatform.services.jcr.impl.storage.value.fs.CASableTreeFileValueStorage">
- <properties>
- <property name="path" value="target/temp/values/ws3" />
- <property name="digest-algo" value="MD5" />
- <property name="vcas-type"
- value="org.exoplatform.services.jcr.impl.storage.value.cas.JDBCValueContentAddressStorageImpl" />
- <property name="jdbc-source-name" value="jdbcjcr" />
- <property name="jdbc-dialect" value="hsqldb" />
- </properties>
- <filters>
- <filter property-type="Binary" />
- </filters>
- </value-storage>
- </value-storages>
- </container>
- <initializer
- class="org.exoplatform.services.jcr.impl.core.ScratchWorkspaceInitializer">
- <properties>
- <property name="root-nodetype" value="nt:unstructured" />
- </properties>
- </initializer>
- <cache enabled="true"
- class="org.exoplatform.services.jcr.impl.dataflow.persistent.LinkedWorkspaceStorageCacheImpl">
- <properties>
- <property name="max-size" value="2k" />
- <property name="live-time" value="20m" />
- </properties>
- </cache>
- <query-handler
- class="org.exoplatform.services.jcr.impl.core.query.lucene.SearchIndex">
- <properties>
- <property name="index-dir" value="target/temp/index/db1/ws3" />
- <property name="synonymprovider-class"
- value="org.exoplatform.services.jcr.impl.core.query.lucene.PropertiesSynonymProvider" />
- <property name="synonymprovider-config-path" value="../../synonyms.properties" />
- <property name="support-highlighting" value="true" />
- <property name="indexing-configuration-path" value="../../indexing-configuration.xml" />
- <property name="query-class"
- value="org.exoplatform.services.jcr.impl.core.query.QueryImpl" />
- <property name="spellchecker-class"
- value="org.exoplatform.services.jcr.impl.core.query.lucene.spell.LuceneSpellChecker$FiveSecondsRefreshInterval" />
- </properties>
- </query-handler>
- </workspace>
- </workspaces>
- </repository>
-
- <repository name="db1tck" system-workspace="ws" default-workspace="ws">
- <security-domain>exo-domain</security-domain>
- <!-- access-control>optional</access-control -->
- <!-- access-control>disable</access-control -->
- <session-max-age>1h</session-max-age>
- <authentication-policy>org.exoplatform.services.jcr.impl.core.access.JAASAuthenticator</authentication-policy>
- <workspaces>
- <workspace name="ws">
- <!-- for system storage -->
- <container class="org.exoplatform.services.jcr.impl.storage.jdbc.JDBCWorkspaceDataContainer">
- <properties>
- <property name="source-name" value="jdbcjcrtck" />
- <property name="dialect" value="hsqldb" />
- <property name="multi-db" value="true" />
- <property name="update-storage" value="false" />
- <property name="max-buffer-size" value="200k" />
- <property name="swap-directory" value="target/temp/swap/wstck" />
- </properties>
- <value-storages>
- <value-storage id="ws" class="org.exoplatform.services.jcr.impl.storage.value.fs.TreeFileValueStorage">
- <properties>
- <property name="path" value="target/temp/values/wstck" />
- </properties>
- <filters>
- <filter property-type="Binary" min-value-size="100K" />
- </filters>
- </value-storage>
- </value-storages>
- </container>
- <initializer class="org.exoplatform.services.jcr.impl.core.ScratchWorkspaceInitializer">
- <properties>
- <property name="root-nodetype" value="nt:unstructured" />
- <property name="root-permissions" value="any read;*:/platform/administrators read;*:/platform/administrators add_node;*:/platform/administrators set_property;*:/platform/administrators remove" />
- </properties>
- </initializer>
- <cache enabled="true" class="org.exoplatform.services.jcr.impl.dataflow.persistent.LinkedWorkspaceStorageCacheImpl">
- <properties>
- <property name="max-size" value="2k" />
- <property name="live-time" value="20m" />
- </properties>
- </cache>
- <query-handler class="org.exoplatform.services.jcr.impl.core.query.lucene.SearchIndex">
- <properties>
- <property name="index-dir" value="target/temp/index/db1tck/ws" />
- <property name="synonymprovider-class" value="org.exoplatform.services.jcr.impl.core.query.lucene.PropertiesSynonymProvider" />
- <property name="synonymprovider-config-path" value="../../synonyms.properties" />
- <property name="support-highlighting" value="true" />
- <property name="indexing-configuration-path" value="../../indexing-configuration.xml" />
- <property name="query-class" value="org.exoplatform.services.jcr.impl.core.query.QueryImpl" />
- <property name="excerptprovider-class" value="org.exoplatform.services.jcr.impl.core.query.lucene.WeightedHTMLExcerpt" />
- <property name="spellchecker-class" value="org.exoplatform.services.jcr.impl.core.query.lucene.spell.LuceneSpellChecker$FiveSecondsRefreshInterval" />
- </properties>
- </query-handler>
- <lock-manager>
- <time-out>15m</time-out>
- <persister class="org.exoplatform.services.jcr.impl.core.lock.FileSystemLockPersister">
- <properties>
- <property name="path" value="target/temp/locktck" />
- </properties>
- </persister>
- </lock-manager>
- </workspace>
-
- <workspace name="ws1">
- <container class="org.exoplatform.services.jcr.impl.storage.jdbc.JDBCWorkspaceDataContainer">
- <properties>
- <property name="source-name" value="jdbcjcr1tck" />
- <property name="dialect" value="hsqldb" />
- <property name="multi-db" value="true" />
- <property name="update-storage" value="false" />
- <property name="max-buffer-size" value="200k" />
- <property name="swap-directory" value="target/temp/swap/ws1tck" />
- </properties>
- <value-storages>
- <value-storage id="ws1" class="org.exoplatform.services.jcr.impl.storage.value.fs.TreeFileValueStorage">
- <properties>
- <property name="path" value="target/temp/values/ws1tck" />
- </properties>
- <filters>
- <filter property-type="Binary" min-value-size="100K" />
- </filters>
- </value-storage>
- </value-storages>
- </container>
- <initializer class="org.exoplatform.services.jcr.impl.core.ScratchWorkspaceInitializer">
- <properties>
- <property name="root-nodetype" value="nt:unstructured" />
- <property name="root-permissions" value="any read;*:/platform/administrators read;*:/platform/administrators add_node;*:/platform/administrators set_property;*:/platform/administrators remove" />
- </properties>
- </initializer>
- <cache enabled="true" class="org.exoplatform.services.jcr.impl.dataflow.persistent.LinkedWorkspaceStorageCacheImpl">
- <properties>
- <property name="max-size" value="2k" />
- <property name="live-time" value="20m" />
- </properties>
- </cache>
- <query-handler class="org.exoplatform.services.jcr.impl.core.query.lucene.SearchIndex">
- <properties>
- <property name="index-dir" value="target/temp/index/db1tck/ws1" />
- <property name="synonymprovider-class" value="org.exoplatform.services.jcr.impl.core.query.lucene.PropertiesSynonymProvider" />
- <property name="synonymprovider-config-path" value="../../synonyms.properties" />
- <property name="support-highlighting" value="true" />
- <property name="indexing-configuration-path" value="../../indexing-configuration.xml" />
- <property name="query-class" value="org.exoplatform.services.jcr.impl.core.query.QueryImpl" />
- <property name="spellchecker-class" value="org.exoplatform.services.jcr.impl.core.query.lucene.spell.LuceneSpellChecker$FiveSecondsRefreshInterval" />
- </properties>
- </query-handler>
- </workspace>
-
- <workspace name="ws2">
- <container class="org.exoplatform.services.jcr.impl.storage.jdbc.JDBCWorkspaceDataContainer">
- <properties>
- <property name="source-name" value="jdbcjcr2tck" />
- <property name="dialect" value="hsqldb" />
- <property name="multi-db" value="true" />
- <property name="update-storage" value="false" />
- <property name="max-buffer-size" value="200k" />
- <property name="swap-directory" value="target/temp/swap/ws2tck" />
- </properties>
- <value-storages>
- <value-storage id="ws2" class="org.exoplatform.services.jcr.impl.storage.value.fs.TreeFileValueStorage">
- <properties>
- <property name="path" value="target/temp/values/ws2tck" />
- </properties>
- <filters>
- <filter property-type="Binary" min-value-size="100K" />
- </filters>
- </value-storage>
- </value-storages>
- </container>
- <initializer class="org.exoplatform.services.jcr.impl.core.ScratchWorkspaceInitializer">
- <properties>
- <property name="root-nodetype" value="nt:unstructured" />
- <property name="root-permissions" value="any read;*:/platform/administrators read;*:/platform/administrators add_node;*:/platform/administrators set_property;*:/platform/administrators remove" />
- </properties>
- </initializer>
- <cache enabled="true" class="org.exoplatform.services.jcr.impl.dataflow.persistent.LinkedWorkspaceStorageCacheImpl">
- <properties>
- <property name="max-size" value="2k" />
- <property name="live-time" value="20m" />
- </properties>
- </cache>
- <query-handler class="org.exoplatform.services.jcr.impl.core.query.lucene.SearchIndex">
- <properties>
- <property name="index-dir" value="target/temp/index/db1tck/ws2" />
- <property name="synonymprovider-class" value="org.exoplatform.services.jcr.impl.core.query.lucene.PropertiesSynonymProvider" />
- <property name="synonymprovider-config-path" value="../../synonyms.properties" />
- <property name="support-highlighting" value="true" />
- <property name="indexing-configuration-path" value="../../indexing-configuration.xml" />
- <property name="query-class" value="org.exoplatform.services.jcr.impl.core.query.QueryImpl" />
- <property name="spellchecker-class" value="org.exoplatform.services.jcr.impl.core.query.lucene.spell.LuceneSpellChecker$FiveSecondsRefreshInterval" />
- <property name="excerptprovider-class" value="org.exoplatform.services.jcr.impl.core.query.lucene.WeightedHTMLExcerpt"/>
- <property name="extractorPoolSize" value="2"/>
- <property name="extractorTimeout" value="10"/>
- </properties>
- </query-handler>
- </workspace>
- </workspaces>
- </repository>
- </repositories>
-</repository-service>
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!--
+
+ 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.
+
+-->
+<repository-service default-repository="db1">
+ <repositories>
+ <repository name="db1" system-workspace="ws" default-workspace="ws">
+ <security-domain>exo-domain</security-domain>
+ <!-- access-control>optional</access-control -->
+ <!-- access-control>disable</access-control -->
+ <session-max-age>1h</session-max-age>
+ <authentication-policy>org.exoplatform.services.jcr.impl.core.access.JAASAuthenticator</authentication-policy>
+ <workspaces>
+ <workspace name="ws">
+ <!-- for system storage -->
+ <container class="org.exoplatform.services.jcr.impl.storage.jdbc.optimisation.NewJDBCWorkspaceDataContainer">
+ <properties>
+ <property name="source-name" value="jdbcjcr" />
+ <property name="dialect" value="mysql" />
+ <property name="multi-db" value="true" />
+ <property name="update-storage" value="false" />
+ <property name="max-buffer-size" value="200k" />
+ <property name="swap-directory" value="target/temp/swap/ws" />
+ </properties>
+ <value-storages>
+ <value-storage id="ws" class="org.exoplatform.services.jcr.impl.storage.value.fs.TreeFileValueStorage">
+ <properties>
+ <property name="path" value="target/temp/values/ws" />
+ <property name="digest-algo" value="MD5" />
+ <property name="vcas-type" value="org.exoplatform.services.jcr.impl.storage.value.cas.JDBCValueContentAddressStorageImpl" />
+ <property name="jdbc-source-name" value="jdbcjcr" />
+ <property name="jdbc-dialect" value="hsqldb" />
+ </properties>
+ <filters>
+ <filter property-type="Binary" />
+ </filters>
+ </value-storage>
+ </value-storages>
+ </container>
+ <initializer class="org.exoplatform.services.jcr.impl.core.ScratchWorkspaceInitializer">
+ <properties>
+ <property name="root-nodetype" value="nt:unstructured" />
+ </properties>
+ </initializer>
+ <!-- initializer class="org.exoplatform.services.jcr.impl.core.RestoreWorkspaceInitializer">
+ <properties>
+ <property name="restore-path" value="./sv_export_root.xml" />
+ <property name="restore-path" value="./src/test/resources/import-export/restore_db1_ws1.xml" />
+ </properties>
+ </initializer
+-->
+ <cache enabled="true" class="org.exoplatform.services.jcr.impl.dataflow.persistent.LinkedWorkspaceStorageCacheImpl">
+ <properties>
+ <property name="max-size" value="2k" />
+ <property name="live-time" value="20m" />
+ <property name="statistic-period" value="30" />
+ <property name="statistic-log" value="false" />
+ </properties>
+ </cache>
+ <query-handler class="org.exoplatform.services.jcr.impl.core.query.lucene.SearchIndex">
+ <properties>
+ <property name="index-dir" value="target/temp/index/db1/ws" />
+ </properties>
+ </query-handler>
+ <lock-manager>
+ <time-out>15m</time-out>
+ <persister class="org.exoplatform.services.jcr.impl.core.lock.FileSystemLockPersister">
+ <properties>
+ <property name="path" value="target/temp/lock" />
+ </properties>
+ </persister>
+ </lock-manager>
+ </workspace>
+
+ <workspace name="ws1">
+ <container class="org.exoplatform.services.jcr.impl.storage.jdbc.optimisation.NewJDBCWorkspaceDataContainer">
+ <properties>
+ <property name="source-name" value="jdbcjcr1" />
+ <property name="dialect" value="mysql" />
+ <property name="multi-db" value="true" />
+ <property name="update-storage" value="false" />
+ <property name="max-buffer-size" value="200k" />
+ <property name="swap-directory" value="target/temp/swap/ws1" />
+ </properties>
+ <value-storages>
+ <value-storage id="ws1" class="org.exoplatform.services.jcr.impl.storage.value.fs.TreeFileValueStorage">
+ <properties>
+ <property name="path" value="target/temp/values/ws1" />
+ </properties>
+ <filters>
+ <filter property-type="Binary" />
+ </filters>
+ </value-storage>
+ </value-storages>
+ </container>
+ <cache enabled="true" class="org.exoplatform.services.jcr.impl.dataflow.persistent.LinkedWorkspaceStorageCacheImpl">
+ <properties>
+ <property name="max-size" value="2k" />
+ <property name="live-time" value="20m" />
+ </properties>
+ </cache>
+ <query-handler class="org.exoplatform.services.jcr.impl.core.query.lucene.SearchIndex">
+ <properties>
+ <property name="index-dir" value="target/temp/index/db1/ws1" />
+ <property name="synonymprovider-class" value="org.exoplatform.services.jcr.impl.core.query.lucene.PropertiesSynonymProvider" />
+ <property name="synonymprovider-config-path" value="../../synonyms.properties" />
+ <property name="support-highlighting" value="true" />
+ <property name="indexing-configuration-path" value="../../indexing-configuration.xml" />
+ <property name="query-class" value="org.exoplatform.services.jcr.impl.core.query.QueryImpl" />
+ <property name="spellchecker-class" value="org.exoplatform.services.jcr.impl.core.query.lucene.spell.LuceneSpellChecker$FiveSecondsRefreshInterval" />
+ </properties>
+ </query-handler>
+ </workspace>
+
+ <workspace name="ws2">
+ <container class="org.exoplatform.services.jcr.impl.storage.jdbc.optimisation.NewJDBCWorkspaceDataContainer">
+ <properties>
+ <property name="source-name" value="jdbcjcr2" />
+ <property name="dialect" value="mysql" />
+ <property name="multi-db" value="true" />
+ <property name="update-storage" value="false" />
+ <property name="max-buffer-size" value="200k" />
+ <property name="swap-directory" value="target/temp/swap/ws2" />
+ </properties>
+ <value-storages>
+ <value-storage id="ws2" class="org.exoplatform.services.jcr.impl.storage.value.fs.TreeFileValueStorage">
+ <properties>
+ <property name="path" value="target/temp/values/ws2" />
+ </properties>
+ <filters>
+ <filter property-type="Binary" />
+ </filters>
+ </value-storage>
+ </value-storages>
+ </container>
+ <cache enabled="true" class="org.exoplatform.services.jcr.impl.dataflow.persistent.LinkedWorkspaceStorageCacheImpl">
+ <properties>
+ <property name="max-size" value="2k" />
+ <property name="live-time" value="20m" />
+ </properties>
+ </cache>
+ <query-handler class="org.exoplatform.services.jcr.impl.core.query.lucene.SearchIndex">
+ <properties>
+ <property name="index-dir" value="target/temp/index/db1/ws2" />
+ <property name="synonymprovider-class" value="org.exoplatform.services.jcr.impl.core.query.lucene.PropertiesSynonymProvider" />
+ <property name="synonymprovider-config-path" value="../../synonyms.properties" />
+ <property name="support-highlighting" value="true" />
+ <property name="indexing-configuration-path" value="../../indexing-configuration.xml" />
+ <property name="query-class" value="org.exoplatform.services.jcr.impl.core.query.QueryImpl" />
+ <property name="spellchecker-class" value="org.exoplatform.services.jcr.impl.core.query.lucene.spell.LuceneSpellChecker$FiveSecondsRefreshInterval" />
+ </properties>
+ </query-handler>
+ </workspace>
+
+ <workspace name="ws3">
+ <!-- for system storage -->
+ <container
+ class="org.exoplatform.services.jcr.impl.storage.jdbc.optimisation.NewJDBCWorkspaceDataContainer">
+ <properties>
+ <property name="source-name" value="jdbcjcr3" />
+ <property name="dialect" value="mysql" />
+ <property name="multi-db" value="true" />
+ <property name="update-storage" value="false" />
+ <property name="max-buffer-size" value="200k" />
+ <property name="swap-directory" value="target/temp/swap/ws3" />
+ </properties>
+ <value-storages>
+ <!--
+ This storage is used to check whether properties are removed
+ correctly from each value-storage
+ (TestRemoveFromValueStorage.java)
+ -->
+ <value-storage id="ws3_big"
+ class="org.exoplatform.services.jcr.impl.storage.value.fs.TreeFileValueStorage">
+ <properties>
+ <property name="path" value="target/temp/values/ws3_big" />
+ </properties>
+ <filters>
+ <filter property-type="Binary" min-value-size="1024K" />
+ </filters>
+ </value-storage>
+ <value-storage id="ws3"
+ class="org.exoplatform.services.jcr.impl.storage.value.fs.CASableTreeFileValueStorage">
+ <properties>
+ <property name="path" value="target/temp/values/ws3" />
+ <property name="digest-algo" value="MD5" />
+ <property name="vcas-type"
+ value="org.exoplatform.services.jcr.impl.storage.value.cas.JDBCValueContentAddressStorageImpl" />
+ <property name="jdbc-source-name" value="jdbcjcr" />
+ <property name="jdbc-dialect" value="hsqldb" />
+ </properties>
+ <filters>
+ <filter property-type="Binary" />
+ </filters>
+ </value-storage>
+ </value-storages>
+ </container>
+ <initializer
+ class="org.exoplatform.services.jcr.impl.core.ScratchWorkspaceInitializer">
+ <properties>
+ <property name="root-nodetype" value="nt:unstructured" />
+ </properties>
+ </initializer>
+ <cache enabled="true"
+ class="org.exoplatform.services.jcr.impl.dataflow.persistent.LinkedWorkspaceStorageCacheImpl">
+ <properties>
+ <property name="max-size" value="2k" />
+ <property name="live-time" value="20m" />
+ </properties>
+ </cache>
+ <query-handler
+ class="org.exoplatform.services.jcr.impl.core.query.lucene.SearchIndex">
+ <properties>
+ <property name="index-dir" value="target/temp/index/db1/ws3" />
+ <property name="synonymprovider-class"
+ value="org.exoplatform.services.jcr.impl.core.query.lucene.PropertiesSynonymProvider" />
+ <property name="synonymprovider-config-path" value="../../synonyms.properties" />
+ <property name="support-highlighting" value="true" />
+ <property name="indexing-configuration-path" value="../../indexing-configuration.xml" />
+ <property name="query-class"
+ value="org.exoplatform.services.jcr.impl.core.query.QueryImpl" />
+ <property name="spellchecker-class"
+ value="org.exoplatform.services.jcr.impl.core.query.lucene.spell.LuceneSpellChecker$FiveSecondsRefreshInterval" />
+ </properties>
+ </query-handler>
+ </workspace>
+ </workspaces>
+ </repository>
+
+ <repository name="db1tck" system-workspace="ws" default-workspace="ws">
+ <security-domain>exo-domain</security-domain>
+ <!-- access-control>optional</access-control -->
+ <!-- access-control>disable</access-control -->
+ <session-max-age>1h</session-max-age>
+ <authentication-policy>org.exoplatform.services.jcr.impl.core.access.JAASAuthenticator</authentication-policy>
+ <workspaces>
+ <workspace name="ws">
+ <!-- for system storage -->
+ <container class="org.exoplatform.services.jcr.impl.storage.jdbc.optimisation.NewJDBCWorkspaceDataContainer">
+ <properties>
+ <property name="source-name" value="jdbcjcrtck" />
+ <property name="dialect" value="mysql" />
+ <property name="multi-db" value="true" />
+ <property name="update-storage" value="false" />
+ <property name="max-buffer-size" value="200k" />
+ <property name="swap-directory" value="target/temp/swap/wstck" />
+ </properties>
+ <value-storages>
+ <value-storage id="ws" class="org.exoplatform.services.jcr.impl.storage.value.fs.TreeFileValueStorage">
+ <properties>
+ <property name="path" value="target/temp/values/wstck" />
+ </properties>
+ <filters>
+ <filter property-type="Binary" min-value-size="100K" />
+ </filters>
+ </value-storage>
+ </value-storages>
+ </container>
+ <initializer class="org.exoplatform.services.jcr.impl.core.ScratchWorkspaceInitializer">
+ <properties>
+ <property name="root-nodetype" value="nt:unstructured" />
+ <property name="root-permissions" value="any read;*:/platform/administrators read;*:/platform/administrators add_node;*:/platform/administrators set_property;*:/platform/administrators remove" />
+ </properties>
+ </initializer>
+ <cache enabled="true" class="org.exoplatform.services.jcr.impl.dataflow.persistent.LinkedWorkspaceStorageCacheImpl">
+ <properties>
+ <property name="max-size" value="2k" />
+ <property name="live-time" value="20m" />
+ </properties>
+ </cache>
+ <query-handler class="org.exoplatform.services.jcr.impl.core.query.lucene.SearchIndex">
+ <properties>
+ <property name="index-dir" value="target/temp/index/db1tck/ws" />
+ <property name="synonymprovider-class" value="org.exoplatform.services.jcr.impl.core.query.lucene.PropertiesSynonymProvider" />
+ <property name="synonymprovider-config-path" value="../../synonyms.properties" />
+ <property name="support-highlighting" value="true" />
+ <property name="indexing-configuration-path" value="../../indexing-configuration.xml" />
+ <property name="query-class" value="org.exoplatform.services.jcr.impl.core.query.QueryImpl" />
+ <property name="excerptprovider-class" value="org.exoplatform.services.jcr.impl.core.query.lucene.WeightedHTMLExcerpt" />
+ <property name="spellchecker-class" value="org.exoplatform.services.jcr.impl.core.query.lucene.spell.LuceneSpellChecker$FiveSecondsRefreshInterval" />
+ </properties>
+ </query-handler>
+ <lock-manager>
+ <time-out>15m</time-out>
+ <persister class="org.exoplatform.services.jcr.impl.core.lock.FileSystemLockPersister">
+ <properties>
+ <property name="path" value="target/temp/locktck" />
+ </properties>
+ </persister>
+ </lock-manager>
+ </workspace>
+
+ <workspace name="ws1">
+ <container class="org.exoplatform.services.jcr.impl.storage.jdbc.optimisation.NewJDBCWorkspaceDataContainer">
+ <properties>
+ <property name="source-name" value="jdbcjcr1tck" />
+ <property name="dialect" value="mysql" />
+ <property name="multi-db" value="true" />
+ <property name="update-storage" value="false" />
+ <property name="max-buffer-size" value="200k" />
+ <property name="swap-directory" value="target/temp/swap/ws1tck" />
+ </properties>
+ <value-storages>
+ <value-storage id="ws1" class="org.exoplatform.services.jcr.impl.storage.value.fs.TreeFileValueStorage">
+ <properties>
+ <property name="path" value="target/temp/values/ws1tck" />
+ </properties>
+ <filters>
+ <filter property-type="Binary" min-value-size="100K" />
+ </filters>
+ </value-storage>
+ </value-storages>
+ </container>
+ <initializer class="org.exoplatform.services.jcr.impl.core.ScratchWorkspaceInitializer">
+ <properties>
+ <property name="root-nodetype" value="nt:unstructured" />
+ <property name="root-permissions" value="any read;*:/platform/administrators read;*:/platform/administrators add_node;*:/platform/administrators set_property;*:/platform/administrators remove" />
+ </properties>
+ </initializer>
+ <cache enabled="true" class="org.exoplatform.services.jcr.impl.dataflow.persistent.LinkedWorkspaceStorageCacheImpl">
+ <properties>
+ <property name="max-size" value="2k" />
+ <property name="live-time" value="20m" />
+ </properties>
+ </cache>
+ <query-handler class="org.exoplatform.services.jcr.impl.core.query.lucene.SearchIndex">
+ <properties>
+ <property name="index-dir" value="target/temp/index/db1tck/ws1" />
+ <property name="synonymprovider-class" value="org.exoplatform.services.jcr.impl.core.query.lucene.PropertiesSynonymProvider" />
+ <property name="synonymprovider-config-path" value="../../synonyms.properties" />
+ <property name="support-highlighting" value="true" />
+ <property name="indexing-configuration-path" value="../../indexing-configuration.xml" />
+ <property name="query-class" value="org.exoplatform.services.jcr.impl.core.query.QueryImpl" />
+ <property name="spellchecker-class" value="org.exoplatform.services.jcr.impl.core.query.lucene.spell.LuceneSpellChecker$FiveSecondsRefreshInterval" />
+ </properties>
+ </query-handler>
+ </workspace>
+
+ <workspace name="ws2">
+ <container class="org.exoplatform.services.jcr.impl.storage.jdbc.optimisation.NewJDBCWorkspaceDataContainer">
+ <properties>
+ <property name="source-name" value="jdbcjcr2tck" />
+ <property name="dialect" value="mysql" />
+ <property name="multi-db" value="true" />
+ <property name="update-storage" value="false" />
+ <property name="max-buffer-size" value="200k" />
+ <property name="swap-directory" value="target/temp/swap/ws2tck" />
+ </properties>
+ <value-storages>
+ <value-storage id="ws2" class="org.exoplatform.services.jcr.impl.storage.value.fs.TreeFileValueStorage">
+ <properties>
+ <property name="path" value="target/temp/values/ws2tck" />
+ </properties>
+ <filters>
+ <filter property-type="Binary" min-value-size="100K" />
+ </filters>
+ </value-storage>
+ </value-storages>
+ </container>
+ <initializer class="org.exoplatform.services.jcr.impl.core.ScratchWorkspaceInitializer">
+ <properties>
+ <property name="root-nodetype" value="nt:unstructured" />
+ <property name="root-permissions" value="any read;*:/platform/administrators read;*:/platform/administrators add_node;*:/platform/administrators set_property;*:/platform/administrators remove" />
+ </properties>
+ </initializer>
+ <cache enabled="true" class="org.exoplatform.services.jcr.impl.dataflow.persistent.LinkedWorkspaceStorageCacheImpl">
+ <properties>
+ <property name="max-size" value="2k" />
+ <property name="live-time" value="20m" />
+ </properties>
+ </cache>
+ <query-handler class="org.exoplatform.services.jcr.impl.core.query.lucene.SearchIndex">
+ <properties>
+ <property name="index-dir" value="target/temp/index/db1tck/ws2" />
+ <property name="synonymprovider-class" value="org.exoplatform.services.jcr.impl.core.query.lucene.PropertiesSynonymProvider" />
+ <property name="synonymprovider-config-path" value="../../synonyms.properties" />
+ <property name="support-highlighting" value="true" />
+ <property name="indexing-configuration-path" value="../../indexing-configuration.xml" />
+ <property name="query-class" value="org.exoplatform.services.jcr.impl.core.query.QueryImpl" />
+ <property name="spellchecker-class" value="org.exoplatform.services.jcr.impl.core.query.lucene.spell.LuceneSpellChecker$FiveSecondsRefreshInterval" />
+ <property name="excerptprovider-class" value="org.exoplatform.services.jcr.impl.core.query.lucene.WeightedHTMLExcerpt"/>
+ <property name="extractorPoolSize" value="2"/>
+ <property name="extractorTimeout" value="10"/>
+ </properties>
+ </query-handler>
+ </workspace>
+ </workspaces>
+ </repository>
+ </repositories>
+</repository-service>
16 years, 4 months