exo-jcr SVN: r3127 - jcr/branches/1.14-ISPN/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/infinispan.
by do-not-reply@jboss.org
Author: nfilotto
Date: 2010-09-16 14:43:44 -0400 (Thu, 16 Sep 2010)
New Revision: 3127
Modified:
jcr/branches/1.14-ISPN/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/infinispan/BufferedISPNCache.java
jcr/branches/1.14-ISPN/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/infinispan/ISPNCacheWorkspaceStorageCache.java
Log:
EXOJCR-830: The put method needs to return non null value in some specific cases
Modified: jcr/branches/1.14-ISPN/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/infinispan/BufferedISPNCache.java
===================================================================
--- jcr/branches/1.14-ISPN/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/infinispan/BufferedISPNCache.java 2010-09-16 15:35:06 UTC (rev 3126)
+++ jcr/branches/1.14-ISPN/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/infinispan/BufferedISPNCache.java 2010-09-16 18:43:44 UTC (rev 3127)
@@ -722,13 +722,29 @@
*/
public Object put(CacheKey key, Object value)
{
+ return put(key, value, false);
+ }
+
+ /**
+ * Put object in cache.
+ * @param key
+ * cache key
+ * @param value
+ * cache value
+ * @param withReturnValue
+ * indicates if a return value is expected
+ * @return <code>null</code> if <code>withReturnValue</code> has been set to <code>false</code>
+ * the previous value otherwise
+ */
+ public Object put(CacheKey key, Object value, boolean withReturnValue)
+ {
CompressedISPNChangesBuffer changesContainer = getChangesBufferSafe();
changesContainer.add(new PutObjectContainer(key, value, parentCache, changesContainer.getHistoryIndex(), local
.get(), allowLocalChanges));
- return null;
+ return withReturnValue ? parentCache.get(key) : null;
}
-
+
/**
* {@inheritDoc}
*/
Modified: jcr/branches/1.14-ISPN/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/infinispan/ISPNCacheWorkspaceStorageCache.java
===================================================================
--- jcr/branches/1.14-ISPN/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/infinispan/ISPNCacheWorkspaceStorageCache.java 2010-09-16 15:35:06 UTC (rev 3126)
+++ jcr/branches/1.14-ISPN/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/infinispan/ISPNCacheWorkspaceStorageCache.java 2010-09-16 18:43:44 UTC (rev 3127)
@@ -600,7 +600,7 @@
}
}
- return (ItemData)cache.put(new CacheId(node.getIdentifier()), node);
+ return (ItemData)cache.put(new CacheId(node.getIdentifier()), node, true);
}
protected ItemData putNodeInBufferedCache(NodeData node, ModifyChildOption modifyListsOfChild)
@@ -636,7 +636,7 @@
}
cache.put(new CacheQPath(prop.getParentIdentifier(), prop.getQPath()), prop.getIdentifier());
- return (PropertyData)cache.put(new CacheId(prop.getIdentifier()), prop);
+ return (PropertyData)cache.put(new CacheId(prop.getIdentifier()), prop, true);
}
protected void removeItem(ItemData item)
@@ -667,7 +667,7 @@
*/
protected void updateMixin(NodeData node)
{
- NodeData prevData = (NodeData)cache.put(new CacheId(node.getIdentifier()), node);
+ NodeData prevData = (NodeData)cache.put(new CacheId(node.getIdentifier()), node, true);
if (prevData != null)
{
15 years, 8 months
exo-jcr SVN: r3126 - in jcr/trunk/exo.jcr.component.core: src/test/java/org/exoplatform/services/jcr/impl and 6 other directories.
by do-not-reply@jboss.org
Author: sergiykarpenko
Date: 2010-09-16 11:35:06 -0400 (Thu, 16 Sep 2010)
New Revision: 3126
Added:
jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/util/
jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/util/jdbc/
jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/util/jdbc/TestDBCleanerService.java
jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/util/TesterConfigurationHelper.java
Removed:
jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/util/ConfigurationHelper.java
Modified:
jcr/trunk/exo.jcr.component.core/pom.xml
jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/core/TestRepositoryManagement.java
jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/core/TestWorkspaceManagement.java
jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/core/TestWorkspaceRestore.java
jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/storage/ValueStoragePluginTest.java
jcr/trunk/exo.jcr.component.core/src/test/resources/conf/standalone/test-configuration-sjdbc.xml
jcr/trunk/exo.jcr.component.core/src/test/resources/conf/standalone/test-configuration.xml
Log:
EXOJCR-939: DBCleanerService test added
Modified: jcr/trunk/exo.jcr.component.core/pom.xml
===================================================================
--- jcr/trunk/exo.jcr.component.core/pom.xml 2010-09-16 15:32:57 UTC (rev 3125)
+++ jcr/trunk/exo.jcr.component.core/pom.xml 2010-09-16 15:35:06 UTC (rev 3126)
@@ -1,795 +1,797 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-
- 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.
-
--->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>org.exoplatform.jcr</groupId>
- <artifactId>jcr-parent</artifactId>
- <version>1.14.0-CR1-SNAPSHOT</version>
- </parent>
- <artifactId>exo.jcr.component.core</artifactId>
- <name>eXo JCR :: Component :: Core Service</name>
- <description>eXo JCR Service core component</description>
- <properties>
- <jcr.test.configuration.file>/conf/standalone/test-configuration.xml</jcr.test.configuration.file>
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ 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.
+
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.exoplatform.jcr</groupId>
+ <artifactId>jcr-parent</artifactId>
+ <version>1.14.0-CR1-SNAPSHOT</version>
+ </parent>
+ <artifactId>exo.jcr.component.core</artifactId>
+ <name>eXo JCR :: Component :: Core Service</name>
+ <description>eXo JCR Service core component</description>
+ <properties>
+ <jcr.test.configuration.file>/conf/standalone/test-configuration.xml</jcr.test.configuration.file>
<jbosscache.shareable>true</jbosscache.shareable>
- </properties>
- <dependencies>
- <dependency>
- <groupId>javax.jcr</groupId>
- <artifactId>jcr</artifactId>
- </dependency>
- <dependency>
- <groupId>org.exoplatform.kernel</groupId>
- <artifactId>exo.kernel.container</artifactId>
- </dependency>
- <dependency>
- <groupId>org.exoplatform.kernel</groupId>
- <artifactId>exo.kernel.commons</artifactId>
- </dependency>
- <dependency>
- <groupId>org.exoplatform.kernel</groupId>
- <artifactId>exo.kernel.commons.test</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.exoplatform.kernel</groupId>
- <artifactId>exo.kernel.component.command</artifactId>
- </dependency>
- <dependency>
- <groupId>org.exoplatform.kernel</groupId>
- <artifactId>exo.kernel.component.common</artifactId>
- </dependency>
- <dependency>
- <groupId>org.exoplatform.kernel</groupId>
- <artifactId>exo.kernel.component.cache</artifactId>
- </dependency>
- <dependency>
- <groupId>org.exoplatform.core</groupId>
- <artifactId>exo.core.component.organization.api</artifactId>
- </dependency>
- <dependency>
- <groupId>org.exoplatform.core</groupId>
- <artifactId>exo.core.component.document</artifactId>
- </dependency>
- <dependency>
- <groupId>org.exoplatform.core</groupId>
- <artifactId>exo.core.component.security.core</artifactId>
- </dependency>
- <dependency>
- <groupId>org.exoplatform.ws</groupId>
- <artifactId>exo.ws.commons</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.exoplatform.jcr</groupId>
- <artifactId>exo.jcr.cluster.testclient</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.lucene</groupId>
- <artifactId>lucene-core</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.lucene</groupId>
- <artifactId>lucene-spellchecker</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.lucene</groupId>
- <artifactId>lucene-memory</artifactId>
- </dependency>
- <dependency>
- <groupId>com.sun.xml.stream</groupId>
- <artifactId>sjsxp</artifactId>
- </dependency>
- <dependency>
- <groupId>commons-dbcp</groupId>
- <artifactId>commons-dbcp</artifactId>
- <exclusions>
- <exclusion>
- <groupId>xerces</groupId>
- <artifactId>xercesImpl</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- <dependency>
- <groupId>commons-pool</groupId>
- <artifactId>commons-pool</artifactId>
- </dependency>
- <dependency>
- <groupId>commons-lang</groupId>
- <artifactId>commons-lang</artifactId>
- </dependency>
- <dependency>
- <groupId>commons-chain</groupId>
- <artifactId>commons-chain</artifactId>
- </dependency>
- <dependency>
- <groupId>xml-apis</groupId>
- <artifactId>xml-apis</artifactId>
- </dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-api</artifactId>
- <scope>compile</scope>
- </dependency>
- <dependency>
- <groupId>stax</groupId>
- <artifactId>stax-api</artifactId>
- </dependency>
- <dependency>
- <groupId>org.jibx</groupId>
- <artifactId>jibx-run</artifactId>
- </dependency>
- <dependency>
- <groupId>picocontainer</groupId>
- <artifactId>picocontainer</artifactId>
- </dependency>
- <dependency>
- <groupId>javax.resource</groupId>
- <artifactId>connector-api</artifactId>
- </dependency>
- <dependency>
- <groupId>javax.transaction</groupId>
- <artifactId>jta</artifactId>
- </dependency>
- <dependency>
- <groupId>concurrent</groupId>
- <artifactId>concurrent</artifactId>
- </dependency>
- <dependency>
- <groupId>commons-collections</groupId>
- <artifactId>commons-collections</artifactId>
- </dependency>
- <dependency>
- <groupId>commons-beanutils</groupId>
- <artifactId>commons-beanutils</artifactId>
- </dependency>
- <dependency>
- <groupId>jgroups</groupId>
- <artifactId>jgroups</artifactId>
- </dependency>
- <dependency>
- <groupId>commons-logging</groupId>
- <artifactId>commons-logging</artifactId>
- </dependency>
- <dependency>
- <groupId>javax.xml.stream</groupId>
- <artifactId>stax-api</artifactId>
- </dependency>
- <dependency>
- <groupId>xpp3</groupId>
- <artifactId>xpp3</artifactId>
- </dependency>
- <dependency>
- <groupId>jboss.jbossts</groupId>
- <artifactId>jbossjts</artifactId>
- </dependency>
- <dependency>
- <groupId>jboss.jbossts</groupId>
- <artifactId>jbossts-common</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.ws.commons</groupId>
- <artifactId>ws-commons-util</artifactId>
- <exclusions>
- <exclusion>
- <groupId>xml-apis</groupId>
- <artifactId>xml-apis</artifactId>
- </exclusion>
- <exclusion>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- <!-- TCK binaries and deps for repo stub, some eXo API test -->
- <dependency>
- <groupId>org.jboss.cache</groupId>
- <artifactId>jbosscache-core</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.jackrabbit</groupId>
- <artifactId>jackrabbit-jcr-tests</artifactId>
- <classifier>sources</classifier>
- <scope>test</scope>
- <exclusions>
- <exclusion>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-api</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-log4j12</artifactId>
- <scope>test</scope>
- </dependency>
- <!-- ===== Databases JDBC support for tests ===== -->
- <dependency>
- <groupId>hsqldb</groupId>
- <artifactId>hsqldb</artifactId>
- <scope>test</scope>
- </dependency>
- <!-- For MySQL support -->
- <dependency>
- <groupId>mysql</groupId>
- <artifactId>mysql-connector-java</artifactId>
- <version>5.1.8</version>
- <scope>test</scope>
- </dependency>
- <!-- For PostgresSQL support -->
- <dependency>
- <groupId>postgresql</groupId>
- <artifactId>postgresql</artifactId>
- <version>8.3-603.jdbc3</version>
- <scope>test</scope>
- </dependency>
- <!-- For Oracle 10g support (local-jcr repository) -->
- <!-- dependency>
- <groupId>ojdbc</groupId>
- <artifactId>ojdbc</artifactId>
- <version>14</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>ojdbc</groupId>
- <artifactId>orai18n</artifactId>
- <version>14</version>
- <scope>test</scope>
- </dependency -->
- <!-- For IBM DB2 support (local-jcr repository) -->
- <!-- dependency>
- <groupId>com.ibm.db2</groupId>
- <artifactId>db2jcc</artifactId>
- <version>9.1</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>com.ibm.db2</groupId>
- <artifactId>db2jcc_license_cu</artifactId>
- <version>9.1</version>
- <scope>test</scope>
- </dependency -->
- <!-- For MS SQL 7/2000/2005 and Sybase ASE/Anywhere support (jTDS driver) -->
- <!-- dependency>
- <groupId>net.sourceforge.jtds</groupId>
- <artifactId>jtds</artifactId>
- <version>1.2</version>
- <scope>test</scope>
- </dependency -->
- <!-- For MS SQL 2005 support (Microsoft JDBC driver) (local-jcr repository) -->
- <!-- dependency>
- <groupId>com.microsoft.sqlserver</groupId>
- <artifactId>sqljdbc</artifactId>
- <version>9.0</version>
- <scope>test</scope>
- </dependency -->
- <!-- dependency>
- <groupId>com.microsoft</groupId>
- <artifactId>sqljdbc</artifactId>
- <version>2.0</version>
- <scope>test</scope>
- </dependency -->
- <!-- For Apache Derby support (aka JavaDB) -->
- <!-- dependency>
- <groupId>org.apache.derby</groupId>
- <artifactId>derby</artifactId>
- <version>10.2.2.0</version>
- <scope>test</scope>
- </dependency -->
- <!-- H2 Database (not supported now) -->
- <!-- dependency>
- <groupId>com.h2database</groupId>
- <artifactId>h2</artifactId>
- <version>1.2.132</version>
- </dependency-->
- <!-- Ingres Database (local repository) -->
- <!-- dependency>
- <groupId>com.ingres.jdbc</groupId>
- <artifactId>iijdbc</artifactId>
- <version>9.2</version>
- <scope>test</scope>
- </dependency -->
- <!-- For Sybase ASE/Anywhere support (jConnect driver) (local-jcr repository) -->
- <!-- dependency>
- <groupId>com.sybase.jdbc3.jdbc</groupId>
- <artifactId>jconn3</artifactId>
- <version>6.05</version>
- <scope>test</scope>
- </dependency -->
- </dependencies>
- <!-- ======================================================================= -->
- <build>
- <resources>
- <resource>
- <directory>src/main/resources</directory>
- <includes>
- <include>**/*.xml</include>
- <include>**/*.sql</include>
- <include>**/*.dtd</include>
- </includes>
- </resource>
- </resources>
- <testResources>
- <testResource>
- <directory>src/test/resources</directory>
- <includes>
- <include>**/*.properties</include>
- <include>login.conf</include>
- <include>**/*.xml</include>
- <include>**/*.drl</include>
- <include>**/*.vm</include>
- <include>**/*.doc</include>
- <include>**/*.xls</include>
- <include>**/*.ppt</include>
- <include>**/*.txt</include>
- <include>**/*.tiff</include>
- <include>**/*.pdf</include>
- <include>**/*.dtd</include>
- <include>**/*.policy</include>
- </includes>
- </testResource>
- </testResources>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-dependency-plugin</artifactId>
- <executions>
- <execution>
- <id>unpack</id>
- <phase>generate-test-sources</phase>
- <goals>
- <goal>unpack</goal>
- </goals>
- <configuration>
- <artifactItems>
- <artifactItem>
- <groupId>org.apache.jackrabbit</groupId>
- <artifactId>jackrabbit-jcr-tests</artifactId>
- <classifier>sources</classifier>
- <type>jar</type>
- <overWrite>false</overWrite>
- </artifactItem>
- </artifactItems>
- <outputDirectory>${project.build.testSourceDirectory}</outputDirectory>
- </configuration>
- </execution>
- </executions>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-surefire-plugin</artifactId>
- <configuration>
- <argLine>${env.MAVEN_OPTS} -Djava.security.manager=org.exoplatform.commons.test.TestSecurityManager -Djava.security.policy=${project.build.directory}/test-classes/test.policy</argLine>
- <systemProperties>
+ </properties>
+ <dependencies>
+ <dependency>
+ <groupId>javax.jcr</groupId>
+ <artifactId>jcr</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.exoplatform.kernel</groupId>
+ <artifactId>exo.kernel.container</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.exoplatform.kernel</groupId>
+ <artifactId>exo.kernel.commons</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.exoplatform.kernel</groupId>
+ <artifactId>exo.kernel.commons.test</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.exoplatform.kernel</groupId>
+ <artifactId>exo.kernel.component.command</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.exoplatform.kernel</groupId>
+ <artifactId>exo.kernel.component.common</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.exoplatform.kernel</groupId>
+ <artifactId>exo.kernel.component.cache</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.exoplatform.core</groupId>
+ <artifactId>exo.core.component.organization.api</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.exoplatform.core</groupId>
+ <artifactId>exo.core.component.document</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.exoplatform.core</groupId>
+ <artifactId>exo.core.component.security.core</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.exoplatform.ws</groupId>
+ <artifactId>exo.ws.commons</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.exoplatform.jcr</groupId>
+ <artifactId>exo.jcr.cluster.testclient</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.lucene</groupId>
+ <artifactId>lucene-core</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.lucene</groupId>
+ <artifactId>lucene-spellchecker</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.lucene</groupId>
+ <artifactId>lucene-memory</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>com.sun.xml.stream</groupId>
+ <artifactId>sjsxp</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>commons-dbcp</groupId>
+ <artifactId>commons-dbcp</artifactId>
+ <exclusions>
+ <exclusion>
+ <groupId>xerces</groupId>
+ <artifactId>xercesImpl</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>commons-pool</groupId>
+ <artifactId>commons-pool</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>commons-lang</groupId>
+ <artifactId>commons-lang</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>commons-chain</groupId>
+ <artifactId>commons-chain</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>xml-apis</groupId>
+ <artifactId>xml-apis</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-api</artifactId>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>stax</groupId>
+ <artifactId>stax-api</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.jibx</groupId>
+ <artifactId>jibx-run</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>picocontainer</groupId>
+ <artifactId>picocontainer</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>javax.resource</groupId>
+ <artifactId>connector-api</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>javax.transaction</groupId>
+ <artifactId>jta</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>concurrent</groupId>
+ <artifactId>concurrent</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>commons-collections</groupId>
+ <artifactId>commons-collections</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>commons-beanutils</groupId>
+ <artifactId>commons-beanutils</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>jgroups</groupId>
+ <artifactId>jgroups</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>commons-logging</groupId>
+ <artifactId>commons-logging</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>javax.xml.stream</groupId>
+ <artifactId>stax-api</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>xpp3</groupId>
+ <artifactId>xpp3</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>jboss.jbossts</groupId>
+ <artifactId>jbossjts</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>jboss.jbossts</groupId>
+ <artifactId>jbossts-common</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.ws.commons</groupId>
+ <artifactId>ws-commons-util</artifactId>
+ <exclusions>
+ <exclusion>
+ <groupId>xml-apis</groupId>
+ <artifactId>xml-apis</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <!-- TCK binaries and deps for repo stub, some eXo API test -->
+ <dependency>
+ <groupId>org.jboss.cache</groupId>
+ <artifactId>jbosscache-core</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.jackrabbit</groupId>
+ <artifactId>jackrabbit-jcr-tests</artifactId>
+ <classifier>sources</classifier>
+ <scope>test</scope>
+ <exclusions>
+ <exclusion>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-api</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-log4j12</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <!-- ===== Databases JDBC support for tests ===== -->
+ <dependency>
+ <groupId>hsqldb</groupId>
+ <artifactId>hsqldb</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <!-- For MySQL support -->
+ <dependency>
+ <groupId>mysql</groupId>
+ <artifactId>mysql-connector-java</artifactId>
+ <version>5.1.8</version>
+ <scope>test</scope>
+ </dependency>
+ <!-- For PostgresSQL support -->
+ <dependency>
+ <groupId>postgresql</groupId>
+ <artifactId>postgresql</artifactId>
+ <version>8.3-603.jdbc3</version>
+ <scope>test</scope>
+ </dependency>
+ <!-- For Oracle 10g support (local-jcr repository) -->
+ <!-- dependency>
+ <groupId>ojdbc</groupId>
+ <artifactId>ojdbc</artifactId>
+ <version>14</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>ojdbc</groupId>
+ <artifactId>orai18n</artifactId>
+ <version>14</version>
+ <scope>test</scope>
+ </dependency -->
+ <!-- For IBM DB2 support (local-jcr repository) -->
+ <!-- dependency>
+ <groupId>com.ibm.db2</groupId>
+ <artifactId>db2jcc</artifactId>
+ <version>9.1</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>com.ibm.db2</groupId>
+ <artifactId>db2jcc_license_cu</artifactId>
+ <version>9.1</version>
+ <scope>test</scope>
+ </dependency -->
+ <!-- For MS SQL 7/2000/2005 and Sybase ASE/Anywhere support (jTDS driver) -->
+ <!-- dependency>
+ <groupId>net.sourceforge.jtds</groupId>
+ <artifactId>jtds</artifactId>
+ <version>1.2</version>
+ <scope>test</scope>
+ </dependency -->
+ <!-- For MS SQL 2005 support (Microsoft JDBC driver) (local-jcr repository) -->
+ <!-- dependency>
+ <groupId>com.microsoft.sqlserver</groupId>
+ <artifactId>sqljdbc</artifactId>
+ <version>9.0</version>
+ <scope>test</scope>
+ </dependency -->
+ <!-- dependency>
+ <groupId>com.microsoft</groupId>
+ <artifactId>sqljdbc</artifactId>
+ <version>2.0</version>
+ <scope>test</scope>
+ </dependency -->
+ <!-- For Apache Derby support (aka JavaDB) -->
+ <!-- dependency>
+ <groupId>org.apache.derby</groupId>
+ <artifactId>derby</artifactId>
+ <version>10.2.2.0</version>
+ <scope>test</scope>
+ </dependency -->
+ <!-- H2 Database (not supported now) -->
+ <!-- dependency>
+ <groupId>com.h2database</groupId>
+ <artifactId>h2</artifactId>
+ <version>1.2.132</version>
+ </dependency-->
+ <!-- Ingres Database (local repository) -->
+ <!-- dependency>
+ <groupId>com.ingres.jdbc</groupId>
+ <artifactId>iijdbc</artifactId>
+ <version>9.2</version>
+ <scope>test</scope>
+ </dependency -->
+ <!-- For Sybase ASE/Anywhere support (jConnect driver) (local-jcr repository) -->
+ <!-- dependency>
+ <groupId>com.sybase.jdbc3.jdbc</groupId>
+ <artifactId>jconn3</artifactId>
+ <version>6.05</version>
+ <scope>test</scope>
+ </dependency -->
+ </dependencies>
+ <!-- ======================================================================= -->
+ <build>
+ <resources>
+ <resource>
+ <directory>src/main/resources</directory>
+ <includes>
+ <include>**/*.xml</include>
+ <include>**/*.sql</include>
+ <include>**/*.dtd</include>
+ </includes>
+ </resource>
+ </resources>
+ <testResources>
+ <testResource>
+ <directory>src/test/resources</directory>
+ <includes>
+ <include>**/*.properties</include>
+ <include>login.conf</include>
+ <include>**/*.xml</include>
+ <include>**/*.drl</include>
+ <include>**/*.vm</include>
+ <include>**/*.doc</include>
+ <include>**/*.xls</include>
+ <include>**/*.ppt</include>
+ <include>**/*.txt</include>
+ <include>**/*.tiff</include>
+ <include>**/*.pdf</include>
+ <include>**/*.dtd</include>
+ <include>**/*.policy</include>
+ </includes>
+ </testResource>
+ </testResources>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-dependency-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>unpack</id>
+ <phase>generate-test-sources</phase>
+ <goals>
+ <goal>unpack</goal>
+ </goals>
+ <configuration>
+ <artifactItems>
+ <artifactItem>
+ <groupId>org.apache.jackrabbit</groupId>
+ <artifactId>jackrabbit-jcr-tests</artifactId>
+ <classifier>sources</classifier>
+ <type>jar</type>
+ <overWrite>false</overWrite>
+ </artifactItem>
+ </artifactItems>
+ <outputDirectory>${project.build.testSourceDirectory}</outputDirectory>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <argLine>${env.MAVEN_OPTS} -Djava.security.manager=org.exoplatform.commons.test.TestSecurityManager -Djava.security.policy=${project.build.directory}/test-classes/test.policy</argLine>
+ <systemProperties>
+ <property>
+ <name>jcr.test.configuration.file</name>
+ <value>${jcr.test.configuration.file}</value>
+ </property>
+ <property>
+ <name>emma.coverage.out.file</name>
+ <value>target/emma/coverage.ec</value>
+ </property>
<property>
- <name>jcr.test.configuration.file</name>
- <value>${jcr.test.configuration.file}</value>
- </property>
- <property>
- <name>emma.coverage.out.file</name>
- <value>target/emma/coverage.ec</value>
- </property>
- <property>
<name>jbosscache-shareable</name>
<value>${jbosscache.shareable}</value>
</property>
- <!-- Uncomment the line below if you want to enable the statistics -->
- <!--property>
- <name>JDBCWorkspaceDataContainer.statistics.enabled</name>
- <value>true</value>
- </property-->
- </systemProperties>
- <includes>
- <include>org/exoplatform/services/jcr/api/**/Test*.java</include>
- <include>org/exoplatform/services/jcr/usecases/**/Test*.java</include>
- <include>org/exoplatform/services/jcr/usecases/**/*Test.java</include>
- <include>org/exoplatform/services/jcr/impl/**/Test*.java</include>
- </includes>
- <excludes>
- <exclude>org/exoplatform/services/jcr/**/TestQueryUsecases.java</exclude>
- <exclude>org/exoplatform/services/jcr/**/TestRollbackBigFiles.java</exclude>
- <exclude>org/exoplatform/services/jcr/**/TestErrorMultithreading.java</exclude>
- <exclude>org/exoplatform/services/jcr/**/api/TestAll.java</exclude>
- <exclude>org/exoplatform/services/jcr/**/api/**/TestSameNameItems.java</exclude>
- <exclude>org/exoplatform/services/jcr/**/api/**/TestVersionRestore.java</exclude>
- <exclude>org/exoplatform/services/jcr/**/api/**/TestSameNameItems.java</exclude>
- <exclude>org/exoplatform/services/jcr/**/api/**/TestVersionRestore.java</exclude>
- <exclude>org/exoplatform/services/jcr/**/impl/**/TestWorkspaceManagement.java</exclude>
- <exclude>org/exoplatform/services/jcr/**/impl/**/TestRepositoryManagement.java</exclude>
- <exclude>org/exoplatform/services/jcr/**/impl/**/TestSaveConfiguration.java</exclude>
- <exclude>org/exoplatform/services/jcr/**/impl/**/ValueStoragePluginTest.java</exclude>
- <exclude>org/exoplatform/services/jcr/**/impl/**/TestWorkspaceRestore.java</exclude>
- <exclude>org/exoplatform/services/jcr/**/impl/**/TestSessionCleaner.java</exclude>
- <exclude>org/exoplatform/services/jcr/**/impl/**/Base*.java</exclude>
- <exclude>org/exoplatform/services/jcr/**/impl/**/TestJCRSerializationStream.java</exclude>
- <exclude>org/exoplatform/services/jcr/**/impl/**/TestJCRSerializationVersionRestore.java</exclude>
- <exclude>org/exoplatform/services/jcr/**/usecases/**/RemoveSameNameSiblingTest.java</exclude>
- <exclude>org/exoplatform/services/jcr/**/usecases/**/TestQueryWithNumberAndSpace.java</exclude>
- <exclude>org/exoplatform/services/jcr/**/usecases/BaseUsecasesTest.java</exclude>
- <exclude>org/exoplatform/services/jcr/**/usecases/**/ExportWorkspaceSystemViewTest.java</exclude>
- <exclude>org/exoplatform/services/jcr/**/impl/**/TestSessionDataManager.java</exclude>
- <exclude>org/exoplatform/services/jcr/**/impl/**/TestLinkedWorkspaceStorageCacheMetrics.java</exclude>
- <exclude>org/exoplatform/services/jcr/**/impl/**/SQLBenchmarkTest.java</exclude>
- <exclude>org/exoplatform/services/jcr/**/impl/**/TestLockPerstistentDataManager.java</exclude>
- <exclude>org/exoplatform/services/jcr/**/impl/**/TestCleanableFileStreamValueData.java</exclude>
- </excludes>
- </configuration>
- </plugin>
- <plugin>
- <groupId>org.jibx</groupId>
- <artifactId>maven-jibx-plugin</artifactId>
- <configuration>
- <directory>src/main/resources</directory>
- <includes>
- <includes>binding*.xml</includes>
- </includes>
- </configuration>
- <executions>
- <execution>
- <goals>
- <goal>bind</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
- <plugin>
- <artifactId>maven-antrun-plugin</artifactId>
- <executions>
- <execution>
- <id>delete-sources</id>
- <phase>process-sources</phase>
- <configuration>
- <tasks>
- <echo>Remove files that have been customized</echo>
- <delete>
- <fileset dir="${project.build.directory}/generated-sources/javacc/org/exoplatform/services/jcr/impl/core/query">
- <include name="sql/ASTLiteral.java" />
- <include name="sql/ASTContainsExpression.java" />
- <include name="sql/ASTPredicate.java" />
- <include name="sql/ASTIdentifier.java" />
- <include name="xpath/SimpleNode.java" />
- </fileset>
- </delete>
- </tasks>
- </configuration>
- <goals>
- <goal>run</goal>
- </goals>
- </execution>
- <execution>
- <id>prepare-test-policy</id>
- <phase>process-test-resources</phase>
- <configuration>
- <tasks>
- <echo>Creating Access Policy for tests</echo>
- <makeurl file="${settings.localRepository}" property="localRepositoryURL" />
- <makeurl file="${project.build.outputDirectory}" property="outputDirectoryURL" />
- <makeurl file="${project.build.testOutputDirectory}" property="testOutputDirectoryURL" />
- <copy todir="${project.build.testOutputDirectory}" overwrite="true">
- <fileset dir="${project.basedir}/src/test/resources/">
- <include name="test.policy" />
- </fileset>
- <filterset>
- <filter token="MAVEN_REPO" value="${localRepositoryURL}" />
- <filter token="MAIN_CLASSES" value="${outputDirectoryURL}" />
- <filter token="TEST_CLASSES" value="${testOutputDirectoryURL}" />
- </filterset>
- </copy>
- </tasks>
- </configuration>
- <goals>
- <goal>run</goal>
- </goals>
- </execution>
- </executions>
- <dependencies>
- <dependency>
- <groupId>ant</groupId>
- <artifactId>ant-optional</artifactId>
- <version>1.5.3-1</version>
- </dependency>
- </dependencies>
- </plugin>
- <plugin>
- <groupId>org.codehaus.mojo</groupId>
- <artifactId>javacc-maven-plugin</artifactId>
- <executions>
- <execution>
- <id>fulltext</id>
- <configuration>
- <sourceDirectory>${basedir}/src/main/javacc/fulltext</sourceDirectory>
- </configuration>
- <goals>
- <goal>jjtree-javacc</goal>
- </goals>
- </execution>
- <execution>
- <id>sql</id>
- <configuration>
- <sourceDirectory>${basedir}/src/main/javacc/sql</sourceDirectory>
- </configuration>
- <goals>
- <goal>jjtree-javacc</goal>
- </goals>
- </execution>
- <execution>
- <id>xpath</id>
- <configuration>
- <sourceDirectory>${basedir}/src/main/javacc/xpath</sourceDirectory>
- </configuration>
- <goals>
- <goal>jjtree-javacc</goal>
- </goals>
- </execution>
- </executions>
- <dependencies>
- <dependency>
- <groupId>net.java.dev.javacc</groupId>
- <artifactId>javacc</artifactId>
- <version>3.2</version>
- </dependency>
- </dependencies>
- </plugin>
- <plugin>
- <groupId>org.codehaus.mojo</groupId>
- <artifactId>taglist-maven-plugin</artifactId>
- </plugin>
- </plugins>
- </build>
- <profiles>
- <!-- *** -->
- <!-- TCK -->
- <!-- *** -->
- <!-- Use "mvn -Prun-tck" to launch only them -->
- <profile>
- <id>run-tck</id>
- <build>
- <testResources>
- <testResource>
- <directory>src/TCK/java</directory>
- <includes>
- <include>**/org/apache/jackrabbit/test/api/nodetype/spec/*.txt</include>
- </includes>
- </testResource>
- </testResources>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-surefire-plugin</artifactId>
- <configuration>
- <!-- TAKE CARE TO UPDATE ALSO run-all PROFILE -->
- <argLine>${env.MAVEN_OPTS} -Djava.security.manager=org.exoplatform.commons.test.TestSecurityManager -Djava.security.policy=${project.build.directory}/test-classes/test.policy</argLine>
- <systemProperties>
- <property>
- <name>jcr.test.configuration.file</name>
- <value>${jcr.test.configuration.file}</value>
- </property>
- <property>
- <name>emma.coverage.out.file</name>
- <value>target/emma/coverage.ec</value>
- </property>
- <property>
+ <!-- Uncomment the line below if you want to enable the statistics -->
+ <!--property>
+ <name>JDBCWorkspaceDataContainer.statistics.enabled</name>
+ <value>true</value>
+ </property-->
+ </systemProperties>
+ <includes>
+ <include>org/exoplatform/services/jcr/api/**/Test*.java</include>
+ <include>org/exoplatform/services/jcr/usecases/**/Test*.java</include>
+ <include>org/exoplatform/services/jcr/usecases/**/*Test.java</include>
+ <include>org/exoplatform/services/jcr/impl/**/Test*.java</include>
+ </includes>
+ <excludes>
+ <exclude>org/exoplatform/services/jcr/**/TestQueryUsecases.java</exclude>
+ <exclude>org/exoplatform/services/jcr/**/TestRollbackBigFiles.java</exclude>
+ <exclude>org/exoplatform/services/jcr/**/TestErrorMultithreading.java</exclude>
+ <exclude>org/exoplatform/services/jcr/**/api/TestAll.java</exclude>
+ <exclude>org/exoplatform/services/jcr/**/api/**/TestSameNameItems.java</exclude>
+ <exclude>org/exoplatform/services/jcr/**/api/**/TestVersionRestore.java</exclude>
+ <exclude>org/exoplatform/services/jcr/**/api/**/TestSameNameItems.java</exclude>
+ <exclude>org/exoplatform/services/jcr/**/api/**/TestVersionRestore.java</exclude>
+ <exclude>org/exoplatform/services/jcr/**/impl/**/TestWorkspaceManagement.java</exclude>
+ <exclude>org/exoplatform/services/jcr/**/impl/**/TestRepositoryManagement.java</exclude>
+ <exclude>org/exoplatform/services/jcr/**/impl/**/TestDBCleanerService.java</exclude>
+ <exclude>org/exoplatform/services/jcr/**/impl/**/TestSaveConfiguration.java</exclude>
+ <exclude>org/exoplatform/services/jcr/**/impl/**/ValueStoragePluginTest.java</exclude>
+ <exclude>org/exoplatform/services/jcr/**/impl/**/TestWorkspaceRestore.java</exclude>
+ <exclude>org/exoplatform/services/jcr/**/impl/**/TestSessionCleaner.java</exclude>
+ <exclude>org/exoplatform/services/jcr/**/impl/**/Base*.java</exclude>
+ <exclude>org/exoplatform/services/jcr/**/impl/**/TestJCRSerializationStream.java</exclude>
+ <exclude>org/exoplatform/services/jcr/**/impl/**/TestJCRSerializationVersionRestore.java</exclude>
+ <exclude>org/exoplatform/services/jcr/**/usecases/**/RemoveSameNameSiblingTest.java</exclude>
+ <exclude>org/exoplatform/services/jcr/**/usecases/**/TestQueryWithNumberAndSpace.java</exclude>
+ <exclude>org/exoplatform/services/jcr/**/usecases/BaseUsecasesTest.java</exclude>
+ <exclude>org/exoplatform/services/jcr/**/usecases/**/ExportWorkspaceSystemViewTest.java</exclude>
+ <exclude>org/exoplatform/services/jcr/**/impl/**/TestSessionDataManager.java</exclude>
+ <exclude>org/exoplatform/services/jcr/**/impl/**/TestLinkedWorkspaceStorageCacheMetrics.java</exclude>
+ <exclude>org/exoplatform/services/jcr/**/impl/**/SQLBenchmarkTest.java</exclude>
+ <exclude>org/exoplatform/services/jcr/**/impl/**/TestLockPerstistentDataManager.java</exclude>
+ <exclude>org/exoplatform/services/jcr/**/impl/**/TestCleanableFileStreamValueData.java</exclude>
+ </excludes>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.jibx</groupId>
+ <artifactId>maven-jibx-plugin</artifactId>
+ <configuration>
+ <directory>src/main/resources</directory>
+ <includes>
+ <includes>binding*.xml</includes>
+ </includes>
+ </configuration>
+ <executions>
+ <execution>
+ <goals>
+ <goal>bind</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <artifactId>maven-antrun-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>delete-sources</id>
+ <phase>process-sources</phase>
+ <configuration>
+ <tasks>
+ <echo>Remove files that have been customized</echo>
+ <delete>
+ <fileset dir="${project.build.directory}/generated-sources/javacc/org/exoplatform/services/jcr/impl/core/query">
+ <include name="sql/ASTLiteral.java" />
+ <include name="sql/ASTContainsExpression.java" />
+ <include name="sql/ASTPredicate.java" />
+ <include name="sql/ASTIdentifier.java" />
+ <include name="xpath/SimpleNode.java" />
+ </fileset>
+ </delete>
+ </tasks>
+ </configuration>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ </execution>
+ <execution>
+ <id>prepare-test-policy</id>
+ <phase>process-test-resources</phase>
+ <configuration>
+ <tasks>
+ <echo>Creating Access Policy for tests</echo>
+ <makeurl file="${settings.localRepository}" property="localRepositoryURL" />
+ <makeurl file="${project.build.outputDirectory}" property="outputDirectoryURL" />
+ <makeurl file="${project.build.testOutputDirectory}" property="testOutputDirectoryURL" />
+ <copy todir="${project.build.testOutputDirectory}" overwrite="true">
+ <fileset dir="${project.basedir}/src/test/resources/">
+ <include name="test.policy" />
+ </fileset>
+ <filterset>
+ <filter token="MAVEN_REPO" value="${localRepositoryURL}" />
+ <filter token="MAIN_CLASSES" value="${outputDirectoryURL}" />
+ <filter token="TEST_CLASSES" value="${testOutputDirectoryURL}" />
+ </filterset>
+ </copy>
+ </tasks>
+ </configuration>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ </execution>
+ </executions>
+ <dependencies>
+ <dependency>
+ <groupId>ant</groupId>
+ <artifactId>ant-optional</artifactId>
+ <version>1.5.3-1</version>
+ </dependency>
+ </dependencies>
+ </plugin>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>javacc-maven-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>fulltext</id>
+ <configuration>
+ <sourceDirectory>${basedir}/src/main/javacc/fulltext</sourceDirectory>
+ </configuration>
+ <goals>
+ <goal>jjtree-javacc</goal>
+ </goals>
+ </execution>
+ <execution>
+ <id>sql</id>
+ <configuration>
+ <sourceDirectory>${basedir}/src/main/javacc/sql</sourceDirectory>
+ </configuration>
+ <goals>
+ <goal>jjtree-javacc</goal>
+ </goals>
+ </execution>
+ <execution>
+ <id>xpath</id>
+ <configuration>
+ <sourceDirectory>${basedir}/src/main/javacc/xpath</sourceDirectory>
+ </configuration>
+ <goals>
+ <goal>jjtree-javacc</goal>
+ </goals>
+ </execution>
+ </executions>
+ <dependencies>
+ <dependency>
+ <groupId>net.java.dev.javacc</groupId>
+ <artifactId>javacc</artifactId>
+ <version>3.2</version>
+ </dependency>
+ </dependencies>
+ </plugin>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>taglist-maven-plugin</artifactId>
+ </plugin>
+ </plugins>
+ </build>
+ <profiles>
+ <!-- *** -->
+ <!-- TCK -->
+ <!-- *** -->
+ <!-- Use "mvn -Prun-tck" to launch only them -->
+ <profile>
+ <id>run-tck</id>
+ <build>
+ <testResources>
+ <testResource>
+ <directory>src/TCK/java</directory>
+ <includes>
+ <include>**/org/apache/jackrabbit/test/api/nodetype/spec/*.txt</include>
+ </includes>
+ </testResource>
+ </testResources>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <!-- TAKE CARE TO UPDATE ALSO run-all PROFILE -->
+ <argLine>${env.MAVEN_OPTS} -Djava.security.manager=org.exoplatform.commons.test.TestSecurityManager -Djava.security.policy=${project.build.directory}/test-classes/test.policy</argLine>
+ <systemProperties>
+ <property>
+ <name>jcr.test.configuration.file</name>
+ <value>${jcr.test.configuration.file}</value>
+ </property>
+ <property>
+ <name>emma.coverage.out.file</name>
+ <value>target/emma/coverage.ec</value>
+ </property>
+ <property>
<name>jbosscache-shareable</name>
<value>${jbosscache.shareable}</value>
</property>
<property>
- <name>known.issues</name>
- <value>org.apache.jackrabbit.test.api.SetValueConstraintViolationExceptionTest#testBooleanProperty
- org.apache.jackrabbit.test.api.SetValueConstraintViolationExceptionTest#testMultipleBooleanProperty
- org.apache.jackrabbit.test.api.version.RestoreTest#testRestoreName
- org.apache.jackrabbit.test.api.version.RestoreTest#testRestoreOrder
- org.apache.jackrabbit.test.api.version.RestoreTest#testRestoreOrder2
- org.apache.jackrabbit.test.api.nodetype.PropertyDefTest#testIsRequiredType
- org.apache.jackrabbit.test.api.SetPropertyConstraintViolationExceptionTest#testBooleanProperty
- org.apache.jackrabbit.test.api.nodetype.PredefinedNodeTypeTest#testShareable
- org.apache.jackrabbit.test.api.nodetype.PredefinedNodeTypeTest#testSimpleVersionable
- org.apache.jackrabbit.test.api.nodetype.PredefinedNodeTypeTest#testActivity
- org.apache.jackrabbit.test.api.nodetype.PredefinedNodeTypeTest#testConfiguration
- org.apache.jackrabbit.test.api.nodetype.PredefinedNodeTypeTest#testVersionable
- org.apache.jackrabbit.test.api.nodetype.PredefinedNodeTypeTest#testVersion
- org.apache.jackrabbit.test.api.NamespaceRegistryTest#testRegisterNamespace</value>
- </property>
- <!-- Uncomment the line below if you want to enable the statistics -->
- <!--property>
- <name>JDBCWorkspaceDataContainer.statistics.enabled</name>
- <value>true</value>
- </property-->
- </systemProperties>
- <includes>
- <include>org/apache/jackrabbit/test/api/*Test.java</include>
- <include>org/apache/jackrabbit/test/api/observation/*Test.java</include>
- <include>org/apache/jackrabbit/test/api/lock/*Test.java</include>
- <include>org/apache/jackrabbit/test/api/nodetype/*Test.java</include>
- <include>org/apache/jackrabbit/test/api/query/*Test.java</include>
- <include>org/apache/jackrabbit/test/api/version/*Test.java</include>
- </includes>
- <excludes>
- <exclude>org/apache/jackrabbit/test/api/TestAll.java</exclude>
- <exclude>org/apache/jackrabbit/test/api/**/Abstract*.java</exclude>
- <exclude>org/apache/jackrabbit/test/api/**/FrozenNodeTest.java</exclude>
- <exclude>org/exoplatform/services/jcr/impl/core/security/Test*.java</exclude>
- </excludes>
- </configuration>
- </plugin>
- </plugins>
- </build>
- </profile>
- <!-- *** -->
- <!-- ALL -->
- <!-- *** -->
- <!-- Use "mvn -Prun-all" to launch default tests and TCK -->
- <profile>
- <id>run-all</id>
- <build>
- <testResources>
- <testResource>
- <directory>src/TCK/java</directory>
- <includes>
- <include>**/org/apache/jackrabbit/test/api/nodetype/spec/*.txt</include>
- </includes>
- </testResource>
- </testResources>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-surefire-plugin</artifactId>
- <configuration>
- <!-- TAKE CARE TO UPDATE ALSO run-tck PROFILE -->
- <argLine>${env.MAVEN_OPTS} -Djava.security.manager=org.exoplatform.commons.test.TestSecurityManager -Djava.security.policy=${project.build.directory}/test-classes/test.policy</argLine>
- <systemProperties>
- <property>
- <name>jcr.test.configuration.file</name>
- <value>${jcr.test.configuration.file}</value>
- </property>
- <property>
- <name>emma.coverage.out.file</name>
- <value>target/emma/coverage.ec</value>
- </property>
- <property>
+ <name>known.issues</name>
+ <value>org.apache.jackrabbit.test.api.SetValueConstraintViolationExceptionTest#testBooleanProperty
+ org.apache.jackrabbit.test.api.SetValueConstraintViolationExceptionTest#testMultipleBooleanProperty
+ org.apache.jackrabbit.test.api.version.RestoreTest#testRestoreName
+ org.apache.jackrabbit.test.api.version.RestoreTest#testRestoreOrder
+ org.apache.jackrabbit.test.api.version.RestoreTest#testRestoreOrder2
+ org.apache.jackrabbit.test.api.nodetype.PropertyDefTest#testIsRequiredType
+ org.apache.jackrabbit.test.api.SetPropertyConstraintViolationExceptionTest#testBooleanProperty
+ org.apache.jackrabbit.test.api.nodetype.PredefinedNodeTypeTest#testShareable
+ org.apache.jackrabbit.test.api.nodetype.PredefinedNodeTypeTest#testSimpleVersionable
+ org.apache.jackrabbit.test.api.nodetype.PredefinedNodeTypeTest#testActivity
+ org.apache.jackrabbit.test.api.nodetype.PredefinedNodeTypeTest#testConfiguration
+ org.apache.jackrabbit.test.api.nodetype.PredefinedNodeTypeTest#testVersionable
+ org.apache.jackrabbit.test.api.nodetype.PredefinedNodeTypeTest#testVersion
+ org.apache.jackrabbit.test.api.NamespaceRegistryTest#testRegisterNamespace</value>
+ </property>
+ <!-- Uncomment the line below if you want to enable the statistics -->
+ <!--property>
+ <name>JDBCWorkspaceDataContainer.statistics.enabled</name>
+ <value>true</value>
+ </property-->
+ </systemProperties>
+ <includes>
+ <include>org/apache/jackrabbit/test/api/*Test.java</include>
+ <include>org/apache/jackrabbit/test/api/observation/*Test.java</include>
+ <include>org/apache/jackrabbit/test/api/lock/*Test.java</include>
+ <include>org/apache/jackrabbit/test/api/nodetype/*Test.java</include>
+ <include>org/apache/jackrabbit/test/api/query/*Test.java</include>
+ <include>org/apache/jackrabbit/test/api/version/*Test.java</include>
+ </includes>
+ <excludes>
+ <exclude>org/apache/jackrabbit/test/api/TestAll.java</exclude>
+ <exclude>org/apache/jackrabbit/test/api/**/Abstract*.java</exclude>
+ <exclude>org/apache/jackrabbit/test/api/**/FrozenNodeTest.java</exclude>
+ <exclude>org/exoplatform/services/jcr/impl/core/security/Test*.java</exclude>
+ </excludes>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ <!-- *** -->
+ <!-- ALL -->
+ <!-- *** -->
+ <!-- Use "mvn -Prun-all" to launch default tests and TCK -->
+ <profile>
+ <id>run-all</id>
+ <build>
+ <testResources>
+ <testResource>
+ <directory>src/TCK/java</directory>
+ <includes>
+ <include>**/org/apache/jackrabbit/test/api/nodetype/spec/*.txt</include>
+ </includes>
+ </testResource>
+ </testResources>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <!-- TAKE CARE TO UPDATE ALSO run-tck PROFILE -->
+ <argLine>${env.MAVEN_OPTS} -Djava.security.manager=org.exoplatform.commons.test.TestSecurityManager -Djava.security.policy=${project.build.directory}/test-classes/test.policy</argLine>
+ <systemProperties>
+ <property>
+ <name>jcr.test.configuration.file</name>
+ <value>${jcr.test.configuration.file}</value>
+ </property>
+ <property>
+ <name>emma.coverage.out.file</name>
+ <value>target/emma/coverage.ec</value>
+ </property>
+ <property>
<name>jbosscache-shareable</name>
<value>${jbosscache.shareable}</value>
</property>
<property>
- <name>known.issues</name>
- <value>org.apache.jackrabbit.test.api.SetValueConstraintViolationExceptionTest#testBooleanProperty
- org.apache.jackrabbit.test.api.SetValueConstraintViolationExceptionTest#testMultipleBooleanProperty
- org.apache.jackrabbit.test.api.version.RestoreTest#testRestoreName
- org.apache.jackrabbit.test.api.version.RestoreTest#testRestoreOrder
- org.apache.jackrabbit.test.api.version.RestoreTest#testRestoreOrder2
- org.apache.jackrabbit.test.api.nodetype.PropertyDefTest#testIsRequiredType
- org.apache.jackrabbit.test.api.SetPropertyConstraintViolationExceptionTest#testBooleanProperty
- org.apache.jackrabbit.test.api.nodetype.PredefinedNodeTypeTest#testShareable
- org.apache.jackrabbit.test.api.nodetype.PredefinedNodeTypeTest#testSimpleVersionable
- org.apache.jackrabbit.test.api.nodetype.PredefinedNodeTypeTest#testActivity
- org.apache.jackrabbit.test.api.nodetype.PredefinedNodeTypeTest#testConfiguration
- org.apache.jackrabbit.test.api.nodetype.PredefinedNodeTypeTest#testVersionable
- org.apache.jackrabbit.test.api.nodetype.PredefinedNodeTypeTest#testVersion
- org.apache.jackrabbit.test.api.NamespaceRegistryTest#testRegisterNamespace</value>
- </property>
- <!-- Uncomment the line below if you want to enable the statistics -->
- <!--property>
- <name>JDBCWorkspaceDataContainer.statistics.enabled</name>
- <value>true</value>
- </property-->
- </systemProperties>
- <includes>
- <!-- From default tests -->
- <include>org/exoplatform/services/jcr/api/**/Test*.java</include>
- <include>org/exoplatform/services/jcr/usecases/**/Test*.java</include>
- <include>org/exoplatform/services/jcr/usecases/**/*Test.java</include>
- <include>org/exoplatform/services/jcr/impl/**/Test*.java</include>
- <!-- From TCK -->
- <include>org/apache/jackrabbit/test/api/*Test.java</include>
- <include>org/apache/jackrabbit/test/api/observation/*Test.java</include>
- <include>org/apache/jackrabbit/test/api/lock/*Test.java</include>
- <include>org/apache/jackrabbit/test/api/nodetype/*Test.java</include>
- <include>org/apache/jackrabbit/test/api/query/*Test.java</include>
- <include>org/apache/jackrabbit/test/api/version/*Test.java</include>
- </includes>
- <excludes>
- <!-- From default tests -->
- <exclude>org/exoplatform/services/jcr/**/TestQueryUsecases.java</exclude>
- <exclude>org/exoplatform/services/jcr/**/TestImport.java</exclude>
- <exclude>org/exoplatform/services/jcr/**/TestRollbackBigFiles.java</exclude>
- <exclude>org/exoplatform/services/jcr/**/TestErrorMultithreading.java</exclude>
- <exclude>org/exoplatform/services/jcr/**/api/TestAll.java</exclude>
- <exclude>org/exoplatform/services/jcr/**/api/**/TestSameNameItems.java</exclude>
- <exclude>org/exoplatform/services/jcr/**/api/**/TestVersionRestore.java</exclude>
- <exclude>org/exoplatform/services/jcr/**/api/**/TestSameNameItems.java</exclude>
- <exclude>org/exoplatform/services/jcr/**/api/**/TestVersionRestore.java</exclude>
- <exclude>org/exoplatform/services/jcr/**/impl/**/TestWorkspaceManagement.java</exclude>
- <exclude>org/exoplatform/services/jcr/**/impl/**/TestRepositoryManagement.java</exclude>
- <exclude>org/exoplatform/services/jcr/**/impl/**/TestSaveConfiguration.java</exclude>
- <exclude>org/exoplatform/services/jcr/**/impl/**/ValueStoragePluginTest.java</exclude>
- <exclude>org/exoplatform/services/jcr/**/impl/**/TestWorkspaceRestore.java</exclude>
- <exclude>org/exoplatform/services/jcr/**/impl/**/TestSessionCleaner.java</exclude>
- <exclude>org/exoplatform/services/jcr/**/impl/**/Base*.java</exclude>
- <exclude>org/exoplatform/services/jcr/**/impl/**/TestJCRSerializationStream.java</exclude>
- <exclude>org/exoplatform/services/jcr/**/impl/**/TestJCRSerializationVersionRestore.java</exclude>
- <exclude>org/exoplatform/services/jcr/**/usecases/**/RemoveSameNameSiblingTest.java</exclude>
- <exclude>org/exoplatform/services/jcr/**/usecases/**/TestQueryWithNumberAndSpace.java</exclude>
- <exclude>org/exoplatform/services/jcr/**/usecases/BaseUsecasesTest.java</exclude>
- <exclude>org/exoplatform/services/jcr/**/usecases/**/ExportWorkspaceSystemViewTest.java</exclude>
- <exclude>org/exoplatform/services/jcr/**/impl/**/TestSessionDataManager.java</exclude>
- <exclude>org/exoplatform/services/jcr/**/impl/**/TestLinkedWorkspaceStorageCacheMetrics.java</exclude>
- <exclude>org/exoplatform/services/jcr/**/impl/**/SQLBenchmarkTest.java</exclude>
- <exclude>org/exoplatform/services/jcr/**/impl/**/TestCleanableFileStreamValueData.java</exclude>
- <exclude>org/exoplatform/services/jcr/**/impl/**/TestLockPerstistentDataManager.java</exclude>
- <!-- From TCK -->
- <exclude>org/apache/jackrabbit/test/api/TestAll.java</exclude>
- <exclude>org/apache/jackrabbit/test/api/**/Abstract*.java</exclude>
- <exclude>org/apache/jackrabbit/test/api/**/FrozenNodeTest.java</exclude>
- </excludes>
- </configuration>
- </plugin>
- </plugins>
- </build>
- </profile>
- <profile>
- <id>run-devtests</id>
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-surefire-plugin</artifactId>
- <configuration>
- <phase>test</phase>
- <forkMode>never</forkMode>
- <!-- argLine>${env.MAVEN_OPTS}</argLine -->
- <goals>
- <goal>test</goal>
- </goals>
- <systemProperties>
+ <name>known.issues</name>
+ <value>org.apache.jackrabbit.test.api.SetValueConstraintViolationExceptionTest#testBooleanProperty
+ org.apache.jackrabbit.test.api.SetValueConstraintViolationExceptionTest#testMultipleBooleanProperty
+ org.apache.jackrabbit.test.api.version.RestoreTest#testRestoreName
+ org.apache.jackrabbit.test.api.version.RestoreTest#testRestoreOrder
+ org.apache.jackrabbit.test.api.version.RestoreTest#testRestoreOrder2
+ org.apache.jackrabbit.test.api.nodetype.PropertyDefTest#testIsRequiredType
+ org.apache.jackrabbit.test.api.SetPropertyConstraintViolationExceptionTest#testBooleanProperty
+ org.apache.jackrabbit.test.api.nodetype.PredefinedNodeTypeTest#testShareable
+ org.apache.jackrabbit.test.api.nodetype.PredefinedNodeTypeTest#testSimpleVersionable
+ org.apache.jackrabbit.test.api.nodetype.PredefinedNodeTypeTest#testActivity
+ org.apache.jackrabbit.test.api.nodetype.PredefinedNodeTypeTest#testConfiguration
+ org.apache.jackrabbit.test.api.nodetype.PredefinedNodeTypeTest#testVersionable
+ org.apache.jackrabbit.test.api.nodetype.PredefinedNodeTypeTest#testVersion
+ org.apache.jackrabbit.test.api.NamespaceRegistryTest#testRegisterNamespace</value>
+ </property>
+ <!-- Uncomment the line below if you want to enable the statistics -->
+ <!--property>
+ <name>JDBCWorkspaceDataContainer.statistics.enabled</name>
+ <value>true</value>
+ </property-->
+ </systemProperties>
+ <includes>
+ <!-- From default tests -->
+ <include>org/exoplatform/services/jcr/api/**/Test*.java</include>
+ <include>org/exoplatform/services/jcr/usecases/**/Test*.java</include>
+ <include>org/exoplatform/services/jcr/usecases/**/*Test.java</include>
+ <include>org/exoplatform/services/jcr/impl/**/Test*.java</include>
+ <!-- From TCK -->
+ <include>org/apache/jackrabbit/test/api/*Test.java</include>
+ <include>org/apache/jackrabbit/test/api/observation/*Test.java</include>
+ <include>org/apache/jackrabbit/test/api/lock/*Test.java</include>
+ <include>org/apache/jackrabbit/test/api/nodetype/*Test.java</include>
+ <include>org/apache/jackrabbit/test/api/query/*Test.java</include>
+ <include>org/apache/jackrabbit/test/api/version/*Test.java</include>
+ </includes>
+ <excludes>
+ <!-- From default tests -->
+ <exclude>org/exoplatform/services/jcr/**/TestQueryUsecases.java</exclude>
+ <exclude>org/exoplatform/services/jcr/**/TestImport.java</exclude>
+ <exclude>org/exoplatform/services/jcr/**/TestRollbackBigFiles.java</exclude>
+ <exclude>org/exoplatform/services/jcr/**/TestErrorMultithreading.java</exclude>
+ <exclude>org/exoplatform/services/jcr/**/api/TestAll.java</exclude>
+ <exclude>org/exoplatform/services/jcr/**/api/**/TestSameNameItems.java</exclude>
+ <exclude>org/exoplatform/services/jcr/**/api/**/TestVersionRestore.java</exclude>
+ <exclude>org/exoplatform/services/jcr/**/api/**/TestSameNameItems.java</exclude>
+ <exclude>org/exoplatform/services/jcr/**/api/**/TestVersionRestore.java</exclude>
+ <exclude>org/exoplatform/services/jcr/**/impl/**/TestWorkspaceManagement.java</exclude>
+ <exclude>org/exoplatform/services/jcr/**/impl/**/TestRepositoryManagement.java</exclude>
+ <exclude>org/exoplatform/services/jcr/**/impl/**/TestDBCleanerService.java</exclude>
+ <exclude>org/exoplatform/services/jcr/**/impl/**/TestSaveConfiguration.java</exclude>
+ <exclude>org/exoplatform/services/jcr/**/impl/**/ValueStoragePluginTest.java</exclude>
+ <exclude>org/exoplatform/services/jcr/**/impl/**/TestWorkspaceRestore.java</exclude>
+ <exclude>org/exoplatform/services/jcr/**/impl/**/TestSessionCleaner.java</exclude>
+ <exclude>org/exoplatform/services/jcr/**/impl/**/Base*.java</exclude>
+ <exclude>org/exoplatform/services/jcr/**/impl/**/TestJCRSerializationStream.java</exclude>
+ <exclude>org/exoplatform/services/jcr/**/impl/**/TestJCRSerializationVersionRestore.java</exclude>
+ <exclude>org/exoplatform/services/jcr/**/usecases/**/RemoveSameNameSiblingTest.java</exclude>
+ <exclude>org/exoplatform/services/jcr/**/usecases/**/TestQueryWithNumberAndSpace.java</exclude>
+ <exclude>org/exoplatform/services/jcr/**/usecases/BaseUsecasesTest.java</exclude>
+ <exclude>org/exoplatform/services/jcr/**/usecases/**/ExportWorkspaceSystemViewTest.java</exclude>
+ <exclude>org/exoplatform/services/jcr/**/impl/**/TestSessionDataManager.java</exclude>
+ <exclude>org/exoplatform/services/jcr/**/impl/**/TestLinkedWorkspaceStorageCacheMetrics.java</exclude>
+ <exclude>org/exoplatform/services/jcr/**/impl/**/SQLBenchmarkTest.java</exclude>
+ <exclude>org/exoplatform/services/jcr/**/impl/**/TestCleanableFileStreamValueData.java</exclude>
+ <exclude>org/exoplatform/services/jcr/**/impl/**/TestLockPerstistentDataManager.java</exclude>
+ <!-- From TCK -->
+ <exclude>org/apache/jackrabbit/test/api/TestAll.java</exclude>
+ <exclude>org/apache/jackrabbit/test/api/**/Abstract*.java</exclude>
+ <exclude>org/apache/jackrabbit/test/api/**/FrozenNodeTest.java</exclude>
+ </excludes>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ <profile>
+ <id>run-devtests</id>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <phase>test</phase>
+ <forkMode>never</forkMode>
+ <!-- argLine>${env.MAVEN_OPTS}</argLine -->
+ <goals>
+ <goal>test</goal>
+ </goals>
+ <systemProperties>
+ <property>
+ <name>jcr.test.configuration.file</name>
+ <value>${jcr.test.configuration.file}</value>
+ </property>
<property>
- <name>jcr.test.configuration.file</name>
- <value>${jcr.test.configuration.file}</value>
- </property>
- <property>
<name>jbosscache-shareable</name>
<value>${jbosscache.shareable}</value>
</property>
- <!-- Uncomment the line below if you want to enable the statistics -->
- <!--property>
- <name>JDBCWorkspaceDataContainer.statistics.enabled</name>
- <value>true</value>
- </property-->
- </systemProperties>
- <includes>
- <include>**/**/reading_/Test*.java</include>
- <include>**/**/writing_/Test*.java</include>
- <include>**/**/TestJBossCacheWorkspaceStorageCache_.java</include>
- <exclude>**/**/TestCleanableFileStreamValueData.java</exclude>
- <include>**/**/TestSVNodeDataOptimization_.java</include>
- <include>**/**/TestValueConstraints.java</include>
- </includes>
- <excludes>
- <exclude>org/exoplatform/services/jcr/impl/core/security/Test*.java</exclude>
- </excludes>
- </configuration>
- </plugin>
- </plugins>
- </build>
- </profile>
- </profiles>
-</project>
+ <!-- Uncomment the line below if you want to enable the statistics -->
+ <!--property>
+ <name>JDBCWorkspaceDataContainer.statistics.enabled</name>
+ <value>true</value>
+ </property-->
+ </systemProperties>
+ <includes>
+ <include>**/**/reading_/Test*.java</include>
+ <include>**/**/writing_/Test*.java</include>
+ <include>**/**/TestJBossCacheWorkspaceStorageCache_.java</include>
+ <exclude>**/**/TestCleanableFileStreamValueData.java</exclude>
+ <include>**/**/TestSVNodeDataOptimization_.java</include>
+ <include>**/**/TestValueConstraints.java</include>
+ </includes>
+ <excludes>
+ <exclude>org/exoplatform/services/jcr/impl/core/security/Test*.java</exclude>
+ </excludes>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ </profiles>
+</project>
Modified: jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/core/TestRepositoryManagement.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/core/TestRepositoryManagement.java 2010-09-16 15:32:57 UTC (rev 3125)
+++ jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/core/TestRepositoryManagement.java 2010-09-16 15:35:06 UTC (rev 3126)
@@ -24,7 +24,7 @@
import org.exoplatform.services.jcr.config.RepositoryEntry;
import org.exoplatform.services.jcr.config.WorkspaceEntry;
import org.exoplatform.services.jcr.impl.storage.jdbc.JDBCWorkspaceDataContainer;
-import org.exoplatform.services.jcr.util.ConfigurationHelper;
+import org.exoplatform.services.jcr.util.TesterConfigurationHelper;
import org.exoplatform.services.jcr.util.IdGenerator;
import javax.jcr.NamespaceException;
@@ -51,12 +51,12 @@
private boolean isDefaultWsMultiDb;
- private final ConfigurationHelper helper;
+ private final TesterConfigurationHelper helper;
public TestRepositoryManagement()
{
super();
- this.helper = ConfigurationHelper.getInstence();
+ this.helper = TesterConfigurationHelper.getInstence();
}
// TODO remove this method
Modified: jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/core/TestWorkspaceManagement.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/core/TestWorkspaceManagement.java 2010-09-16 15:32:57 UTC (rev 3125)
+++ jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/core/TestWorkspaceManagement.java 2010-09-16 15:35:06 UTC (rev 3126)
@@ -25,7 +25,7 @@
import org.exoplatform.services.jcr.config.RepositoryEntry;
import org.exoplatform.services.jcr.config.WorkspaceEntry;
import org.exoplatform.services.jcr.impl.storage.jdbc.JDBCWorkspaceDataContainer;
-import org.exoplatform.services.jcr.util.ConfigurationHelper;
+import org.exoplatform.services.jcr.util.TesterConfigurationHelper;
import org.exoplatform.services.jcr.util.IdGenerator;
import java.io.File;
@@ -43,14 +43,14 @@
{
private boolean isDefaultWsMultiDb = false;
- private final ConfigurationHelper helper;
+ private final TesterConfigurationHelper helper;
private WorkspaceEntry wsEntry;
public TestWorkspaceManagement()
{
super();
- this.helper = ConfigurationHelper.getInstence();
+ this.helper = TesterConfigurationHelper.getInstence();
}
@Override
@@ -290,7 +290,58 @@
fail();
}
}
+ }
+ catch (RepositoryException e)
+ {
+ e.printStackTrace();
+ fail(e.getLocalizedMessage());
+ }
+ catch (RepositoryConfigurationException e)
+ {
+ fail(e.getLocalizedMessage());
+ }
+ if (defRep != null)
+ {
+ try
+ {
+ Session sess = defRep.getSystemSession(workspaceEntry.getName());
+ fail();
+ }
+ catch (RepositoryException e)
+ {
+ // Ok
+ }
+ }
+ }
+
+ public void testRemoveWorkspaceFromDB() throws Exception
+ {
+ WorkspaceEntry workspaceEntry =
+ helper.getNewWs("wsForRemove", isDefaultWsMultiDb, wsEntry.getContainer().getParameterValue(
+ JDBCWorkspaceDataContainer.SOURCE_NAME), "target/temp/values/" + IdGenerator.generate(), wsEntry
+ .getContainer());
+
+ RepositoryService service = (RepositoryService)container.getComponentInstanceOfType(RepositoryService.class);
+ RepositoryImpl defRep = (RepositoryImpl)service.getDefaultRepository();
+ try
+ {
+ helper.createWorkspace(workspaceEntry, container);
+ doTestOnWorkspace(workspaceEntry.getName());
+ assertTrue(defRep.canRemoveWorkspace(workspaceEntry.getName()));
+ String[] names = service.getDefaultRepository().getWorkspaceNames();
+ service.getDefaultRepository().removeWorkspace(workspaceEntry.getName());
+ String[] namesAfter = service.getDefaultRepository().getWorkspaceNames();
+
+ // remove one
+ assertTrue(names.length == namesAfter.length + 1);
+ for (int i = 0; i < namesAfter.length; i++)
+ {
+ if (workspaceEntry.getName().equals(namesAfter[i]))
+ {
+ fail();
+ }
+ }
}
catch (RepositoryException e)
{
Modified: jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/core/TestWorkspaceRestore.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/core/TestWorkspaceRestore.java 2010-09-16 15:32:57 UTC (rev 3125)
+++ jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/core/TestWorkspaceRestore.java 2010-09-16 15:35:06 UTC (rev 3126)
@@ -23,7 +23,7 @@
import org.exoplatform.services.jcr.config.RepositoryConfigurationException;
import org.exoplatform.services.jcr.config.WorkspaceEntry;
import org.exoplatform.services.jcr.impl.storage.jdbc.JDBCWorkspaceDataContainer;
-import org.exoplatform.services.jcr.util.ConfigurationHelper;
+import org.exoplatform.services.jcr.util.TesterConfigurationHelper;
import org.exoplatform.services.log.ExoLogger;
import org.exoplatform.services.log.Log;
@@ -52,7 +52,7 @@
private final Log log = ExoLogger.getLogger("exo.jcr.component.core.TestWorkspaceRestore");
- private final ConfigurationHelper helper = ConfigurationHelper.getInstence();
+ private final TesterConfigurationHelper helper = TesterConfigurationHelper.getInstence();
private WorkspaceEntry wsEntry;
Modified: jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/storage/ValueStoragePluginTest.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/storage/ValueStoragePluginTest.java 2010-09-16 15:32:57 UTC (rev 3125)
+++ jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/storage/ValueStoragePluginTest.java 2010-09-16 15:35:06 UTC (rev 3126)
@@ -25,7 +25,7 @@
import org.exoplatform.services.jcr.config.WorkspaceEntry;
import org.exoplatform.services.jcr.impl.core.RepositoryImpl;
import org.exoplatform.services.jcr.impl.storage.jdbc.JDBCWorkspaceDataContainer;
-import org.exoplatform.services.jcr.util.ConfigurationHelper;
+import org.exoplatform.services.jcr.util.TesterConfigurationHelper;
import org.exoplatform.services.jcr.util.IdGenerator;
import org.exoplatform.services.log.ExoLogger;
import org.exoplatform.services.log.Log;
@@ -205,7 +205,7 @@
private String createWs() throws Exception
{
- ConfigurationHelper helper = ConfigurationHelper.getInstence();
+ TesterConfigurationHelper helper = TesterConfigurationHelper.getInstence();
WorkspaceEntry wsEntry = (WorkspaceEntry)session.getContainer().getComponentInstanceOfType(WorkspaceEntry.class);
boolean isDefaultWsMultiDb = false;
if ("true".equals(wsEntry.getContainer().getParameterValue("multi-db")))
Added: jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/util/jdbc/TestDBCleanerService.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/util/jdbc/TestDBCleanerService.java (rev 0)
+++ jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/util/jdbc/TestDBCleanerService.java 2010-09-16 15:35:06 UTC (rev 3126)
@@ -0,0 +1,369 @@
+/*
+ * Copyright (C) 2003-2010 eXo Platform SAS.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Affero General Public License
+ * as published by the Free Software Foundation; either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, see<http://www.gnu.org/licenses/>.
+ */
+package org.exoplatform.services.jcr.impl.util.jdbc;
+
+import org.exoplatform.services.jcr.JcrImplBaseTest;
+import org.exoplatform.services.jcr.RepositoryService;
+import org.exoplatform.services.jcr.config.RepositoryEntry;
+import org.exoplatform.services.jcr.config.WorkspaceEntry;
+import org.exoplatform.services.jcr.impl.core.NodeImpl;
+import org.exoplatform.services.jcr.impl.core.RepositoryImpl;
+import org.exoplatform.services.jcr.impl.core.SessionImpl;
+import org.exoplatform.services.jcr.util.IdGenerator;
+import org.exoplatform.services.jcr.util.TesterConfigurationHelper;
+
+import java.sql.Connection;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.sql.Statement;
+
+import javax.jcr.Node;
+import javax.jcr.Session;
+import javax.naming.InitialContext;
+import javax.sql.DataSource;
+
+/**
+ * This test uses "testdbcleaner" datasource to create own test repository with workspace.
+ * So, please, check test-configuration.xml or test-configuration-sjdbc.xml does such datasource binded.
+ *
+ * Created by The eXo Platform SAS.
+ *
+ * <br/>Date:
+ *
+ * @author <a href="karpenko.sergiy(a)gmail.com">Karpenko Sergiy</a>
+ * @version $Id: TestRemoveWorkspace.java 111 2008-11-11 11:11:11Z serg $
+ */
+public class TestDBCleanerService extends JcrImplBaseTest
+{
+ private final static String DS_NAME = "testdbcleaner";
+
+ private final TesterConfigurationHelper helper;
+
+ private WorkspaceEntry wsEntry;
+
+ public TestDBCleanerService()
+ {
+ super();
+ this.helper = TesterConfigurationHelper.getInstence();
+ }
+
+ @SuppressWarnings("deprecation")
+ @Override
+ public void setUp() throws Exception
+ {
+ super.setUp();
+ wsEntry = (WorkspaceEntry)session.getContainer().getComponentInstanceOfType(WorkspaceEntry.class);
+ }
+
+ public void tearDown() throws Exception
+ {
+ // drop any table
+ DataSource ds = (DataSource)new InitialContext().lookup(DS_NAME);
+ Connection conn = ds.getConnection();
+ Statement statement = conn.createStatement();
+ try
+ {
+ statement.executeUpdate("drop table JCR_SREF");
+ }
+ catch (SQLException e)
+ {
+ }
+ try
+ {
+ statement.executeUpdate("drop table JCR_SVALUE");
+ }
+ catch (SQLException e)
+ {
+ }
+ try
+ {
+ statement.executeUpdate("drop table JCR_SITEM");
+ }
+ catch (SQLException e)
+ {
+ }
+ try
+ {
+ statement.executeUpdate("drop table JCR_MREF");
+ }
+ catch (SQLException e)
+ {
+ }
+ try
+ {
+ statement.executeUpdate("drop table JCR_MVALUE");
+ }
+ catch (SQLException e)
+ {
+ }
+ try
+ {
+ statement.executeUpdate("drop table JCR_MITEM");
+ }
+ catch (SQLException e)
+ {
+ }
+ try
+ {
+ statement.executeUpdate("drop table JCR_MCONTAINER");
+ }
+ catch (SQLException e)
+ {
+ }
+ try
+ {
+ statement.executeUpdate("drop table JCR_SCONTAINER");
+ }
+ catch (SQLException e)
+ {
+ }
+ if (statement != null)
+ {
+ try
+ {
+ statement.close();
+ }
+ catch (SQLException e)
+ {
+ }
+ }
+ super.tearDown();
+ }
+
+ public void testRemoveRepositoryMultiDB() throws Exception
+ {
+ String repositoryName = "repoTestRemoveMulti";
+
+ RepositoryEntry repositoryEntry = createMultiDB(repositoryName);
+
+ RepositoryService service = (RepositoryService)container.getComponentInstanceOfType(RepositoryService.class);
+ RepositoryImpl newRepository = (RepositoryImpl)service.getRepository(repositoryName);
+ assertTrue(service.canRemoveRepository(repositoryName));
+
+ String wsName = repositoryEntry.getWorkspaceEntries().get(0).getName();
+ SessionImpl sess = newRepository.getSystemSession(wsName);
+
+ // add nodes to workspaces and check it via datasource
+ NodeImpl node = (NodeImpl)sess.getRootNode().addNode("testNode");
+ String id = node.getData().getIdentifier();
+ sess.save();
+ sess.logout();
+
+ DataSource ds = (DataSource)new InitialContext().lookup(DS_NAME);
+ Connection conn = ds.getConnection();
+ Statement statement = conn.createStatement();
+ ResultSet res = statement.executeQuery("select * from JCR_MITEM where ID='" + id + "'");
+ assertTrue(res.next());
+
+ // remove repository;
+ DBCleanerService.removeRepositoryData(repositoryEntry);
+
+ // check - does JCR_SITEM become empty
+ try
+ {
+ res = statement.executeQuery("select * from JCR_MITEM where ID='" + id + "'");
+ fail();
+ }
+ catch (SQLException e)
+ {
+ //ok
+ }
+ statement.close();
+
+ service.removeRepository(repositoryName);
+ }
+
+ public void testRemoveRepositorySingleDB() throws Exception
+ {
+ String repositoryName = "repoTestRemoveSingle";
+
+ RepositoryEntry repositoryEntry = createSingleDB(repositoryName);
+
+ RepositoryService service = (RepositoryService)container.getComponentInstanceOfType(RepositoryService.class);
+ RepositoryImpl newRepository = (RepositoryImpl)service.getRepository(repositoryName);
+ assertTrue(service.canRemoveRepository(repositoryName));
+
+ String wsName = repositoryEntry.getWorkspaceEntries().get(0).getName();
+ SessionImpl sess = newRepository.getSystemSession(wsName);
+
+ // now add nodes to workspaces and check it via datasource
+ NodeImpl node = (NodeImpl)sess.getRootNode().addNode("testNode");
+ String id = node.getData().getIdentifier();
+ sess.save();
+ sess.logout();
+
+ DataSource ds = (DataSource)new InitialContext().lookup(DS_NAME);
+ Connection conn = ds.getConnection();
+ Statement statement = conn.createStatement();
+ ResultSet res = statement.executeQuery("select * from JCR_SITEM where ID='" + wsName + id + "'");
+ assertTrue(res.next());
+
+ // remove repository content
+ DBCleanerService.removeRepositoryData(repositoryEntry);
+
+ // check - does JCR_SITEM become empty
+ res = statement.executeQuery("select * from JCR_SITEM where ID='" + wsName + id + "'");
+ assertFalse(res.next());
+ statement.close();
+
+ service.removeRepository(repositoryName);
+ }
+
+ public void testRemoveWorkspaceMultiDB() throws Exception
+ {
+ String repositoryName = "repoTestRemoveMulti";
+
+ RepositoryEntry repositoryEntry = createMultiDB(repositoryName);
+
+ RepositoryService service = (RepositoryService)container.getComponentInstanceOfType(RepositoryService.class);
+ RepositoryImpl newRepository = (RepositoryImpl)service.getRepository(repositoryName);
+ assertTrue(service.canRemoveRepository(repositoryName));
+
+ String wsName = repositoryEntry.getWorkspaceEntries().get(0).getName();
+ SessionImpl sess = newRepository.getSystemSession(wsName);
+
+ // now add nodes to workspaces and check it via datasource
+ NodeImpl node = (NodeImpl)sess.getRootNode().addNode("testNode");
+ String id = node.getData().getIdentifier();
+ sess.save();
+ sess.logout();
+
+ DataSource ds = (DataSource)new InitialContext().lookup(DS_NAME);
+ Connection conn = ds.getConnection();
+ Statement statement = conn.createStatement();
+ ResultSet res = statement.executeQuery("select * from JCR_MITEM where ID='" + id + "'");
+ assertTrue(res.next());
+
+ // remove workspace data from database
+ DBCleanerService.removeWorkspaceData(repositoryEntry.getWorkspaceEntries().get(0));
+
+ // check - does JCR_SITEM become empty
+ try
+ {
+ res = statement.executeQuery("select * from JCR_MITEM where ID='" + id + "'");
+ fail();
+ }
+ catch (SQLException e)
+ {
+ //ok
+ }
+ statement.close();
+
+ service.removeRepository(repositoryName);
+ }
+
+ public void testRemoveWorkspaceSingleDB() throws Exception
+ {
+ String repositoryName = "repoTestRemoveSingle";
+
+ RepositoryEntry repositoryEntry = createSingleDB(repositoryName);
+
+ WorkspaceEntry workspaceEntry = repositoryEntry.getWorkspaceEntries().get(0);
+
+ RepositoryService service = (RepositoryService)container.getComponentInstanceOfType(RepositoryService.class);
+ Session sess = ((RepositoryImpl)service.getRepository(repositoryName)).getSystemSession(workspaceEntry.getName());
+ Node root2 = sess.getRootNode();
+ assertNotNull(root2);
+
+ NodeImpl n = (NodeImpl)root2.addNode("node1");
+ assertTrue(root2.hasNode("node1"));
+
+ String id = n.getData().getIdentifier();
+
+ sess.save();
+
+ n.setProperty("prop", "some value");
+ n.setProperty("prop2", "some value two");
+ sess.save();
+
+ Node n2 = n.addNode("subnode");
+ n2.setProperty("prop", "some value");
+ n2.addNode("subnode1");
+ n2.addNode("subnode2");
+ n2.addNode("subnode2");
+ sess.save();
+ sess.logout();
+
+ DataSource ds = (DataSource)new InitialContext().lookup(DS_NAME);
+ Connection conn = ds.getConnection();
+ Statement statement = conn.createStatement();
+ ResultSet res =
+ statement.executeQuery("select * from JCR_SITEM where ID='" + workspaceEntry.getName() + id + "'");
+ assertTrue(res.next());
+
+ // remove workspace data from database
+ DBCleanerService.removeWorkspaceData(workspaceEntry);
+
+ // check - does JCR_SITEM become empty
+ res = statement.executeQuery("select * from JCR_SITEM where ID='" + workspaceEntry.getName() + id + "'");
+ assertFalse(res.next());
+ statement.close();
+
+ service.removeRepository(repositoryName);
+ }
+
+ private RepositoryEntry createMultiDB(String repositoryName) throws Exception
+ {
+ RepositoryEntry repositoryEntry = new RepositoryEntry();
+
+ repositoryEntry.setName(repositoryName);
+ repositoryEntry.setSessionTimeOut(3600000);
+ repositoryEntry.setAuthenticationPolicy("org.exoplatform.services.jcr.impl.core.access.JAASAuthenticator");
+ repositoryEntry.setSecurityDomain("exo-domain");
+ repositoryEntry.setSystemWorkspaceName(repositoryName + "ws");
+ repositoryEntry.setDefaultWorkspaceName(repositoryName + "ws");
+
+ WorkspaceEntry workspaceEntry =
+ helper.getNewWs(repositoryName + "ws", true, DS_NAME, "target/temp/values/" + IdGenerator.generate(), wsEntry
+ .getContainer(), false);
+
+ repositoryEntry.addWorkspace(workspaceEntry);
+
+ RepositoryService service = (RepositoryService)container.getComponentInstanceOfType(RepositoryService.class);
+
+ service.createRepository(repositoryEntry);
+ return repositoryEntry;
+ }
+
+ private RepositoryEntry createSingleDB(String repositoryName) throws Exception
+ {
+ RepositoryEntry repositoryEntry = new RepositoryEntry();
+
+ repositoryEntry.setName(repositoryName);
+ repositoryEntry.setSessionTimeOut(3600000);
+ repositoryEntry.setAuthenticationPolicy("org.exoplatform.services.jcr.impl.core.access.JAASAuthenticator");
+ repositoryEntry.setSecurityDomain("exo-domain");
+ repositoryEntry.setSystemWorkspaceName(repositoryName + "ws");
+ repositoryEntry.setDefaultWorkspaceName(repositoryName + "ws");
+
+ WorkspaceEntry workspaceEntry =
+ helper.getNewWs(repositoryName + "ws", false, DS_NAME, "target/temp/values/" + IdGenerator.generate(), wsEntry
+ .getContainer(), false);
+
+ repositoryEntry.addWorkspace(workspaceEntry);
+
+ WorkspaceEntry secondWs =
+ helper.getNewWs(repositoryName + "ws2", false, DS_NAME, "target/temp/values/" + IdGenerator.generate(),
+ wsEntry.getContainer(), false);
+ repositoryEntry.addWorkspace(secondWs);
+
+ RepositoryService service = (RepositoryService)container.getComponentInstanceOfType(RepositoryService.class);
+
+ service.createRepository(repositoryEntry);
+ return repositoryEntry;
+ }
+}
Deleted: jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/util/ConfigurationHelper.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/util/ConfigurationHelper.java 2010-09-16 15:32:57 UTC (rev 3125)
+++ jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/util/ConfigurationHelper.java 2010-09-16 15:35:06 UTC (rev 3126)
@@ -1,214 +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.util;
-
-import org.apache.commons.dbcp.BasicDataSourceFactory;
-import org.exoplatform.container.ExoContainer;
-import org.exoplatform.services.jcr.RepositoryService;
-import org.exoplatform.services.jcr.config.CacheEntry;
-import org.exoplatform.services.jcr.config.ContainerEntry;
-import org.exoplatform.services.jcr.config.LockManagerEntry;
-import org.exoplatform.services.jcr.config.LockPersisterEntry;
-import org.exoplatform.services.jcr.config.QueryHandlerEntry;
-import org.exoplatform.services.jcr.config.RepositoryConfigurationException;
-import org.exoplatform.services.jcr.config.SimpleParameterEntry;
-import org.exoplatform.services.jcr.config.ValueStorageEntry;
-import org.exoplatform.services.jcr.config.ValueStorageFilterEntry;
-import org.exoplatform.services.jcr.config.WorkspaceEntry;
-import org.exoplatform.services.jcr.impl.core.RepositoryImpl;
-import org.exoplatform.services.jcr.impl.storage.jdbc.JDBCWorkspaceDataContainer;
-import org.exoplatform.services.log.ExoLogger;
-import org.exoplatform.services.log.Log;
-
-import java.sql.Connection;
-import java.sql.PreparedStatement;
-import java.sql.SQLException;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Properties;
-
-import javax.jcr.RepositoryException;
-import javax.naming.Context;
-import javax.naming.InitialContext;
-import javax.sql.DataSource;
-
-/**
- * Created by The eXo Platform SAS
- *
- * @author <a href="mailto:Sergey.Kabashnyuk@gmail.com">Sergey Kabashnyuk</a>
- * @version $Id: ConfigurationHelper.java 11907 2008-03-13 15:36:21Z ksm $
- */
-public class ConfigurationHelper
-{
- private static Log log = ExoLogger.getLogger("exo.jcr.component.core.ConfigurationHelper");
-
- private static ConfigurationHelper instence;
-
- private ConfigurationHelper()
- {
- System.setProperty(Context.INITIAL_CONTEXT_FACTORY, "org.exoplatform.services.naming.SimpleContextFactory");
- }
-
- public void createWorkspace(WorkspaceEntry workspaceEntry, ExoContainer container)
- throws RepositoryConfigurationException, RepositoryException
- {
- RepositoryService service = (RepositoryService)container.getComponentInstanceOfType(RepositoryService.class);
- RepositoryImpl defRep;
-
- defRep = (RepositoryImpl)service.getDefaultRepository();
- defRep.configWorkspace(workspaceEntry);
- defRep.createWorkspace(workspaceEntry.getName());
-
- }
-
- public String getNewDataSource(String type) throws Exception
- {
-
- String newDS = IdGenerator.generate();
- Properties properties = new Properties();
-
- properties.setProperty("driverClassName", "org.hsqldb.jdbcDriver");
- String newurl = "jdbc:hsqldb:file:target/temp/data/" + newDS;
-
- log.info("New url " + newurl);
-
- properties.setProperty("url", newurl);
- properties.setProperty("username", "sa");
- properties.setProperty("password", "");
- DataSource bds = BasicDataSourceFactory.createDataSource(properties);
- if (!newurl.contains("hsqldb"))
- {
- createDatabase(bds, newDS);
- }
-
- new InitialContext().bind(newDS, bds);
- return newDS;
-
- }
-
- public WorkspaceEntry getNewWs(String wsName, boolean isMultiDb, String dsName, String vsPath, ContainerEntry entry)
- throws Exception
- {
-
- List params = new ArrayList();
-
- if (isMultiDb || dsName == null)
- {
- dsName = getNewDataSource("");
- }
-
- params.add(new SimpleParameterEntry("sourceName", dsName));
- params.add(new SimpleParameterEntry("db-type", "generic"));
- params.add(new SimpleParameterEntry("multi-db", isMultiDb ? "true" : "false"));
- params.add(new SimpleParameterEntry("update-storage", "true"));
- params.add(new SimpleParameterEntry("max-buffer-size", "204800"));
-
- if (entry.getParameterValue(JDBCWorkspaceDataContainer.DB_DIALECT) != null)
- {
- params.add(new SimpleParameterEntry(JDBCWorkspaceDataContainer.DB_DIALECT, entry
- .getParameterValue(JDBCWorkspaceDataContainer.DB_DIALECT)));
- }
-
- String oldSwap = entry.getParameterValue("swap-directory");
- String newSwap = oldSwap.substring(0, oldSwap.lastIndexOf('/')) + '/' + wsName;
-
- params.add(new SimpleParameterEntry("swap-directory", newSwap));
-
- ContainerEntry containerEntry =
- new ContainerEntry("org.exoplatform.services.jcr.impl.storage.jdbc.JDBCWorkspaceDataContainer",
- (ArrayList)params);
- containerEntry.setParameters(params);
-
- if (vsPath != null)
- {
-
- ArrayList<ValueStorageFilterEntry> vsparams = new ArrayList<ValueStorageFilterEntry>();
- ValueStorageFilterEntry filterEntry = new ValueStorageFilterEntry();
- filterEntry.setPropertyType("Binary");
- vsparams.add(filterEntry);
-
- ValueStorageEntry valueStorageEntry =
- new ValueStorageEntry("org.exoplatform.services.jcr.impl.storage.value.fs.SimpleFileValueStorage", vsparams);
- ArrayList<SimpleParameterEntry> spe = new ArrayList<SimpleParameterEntry>();
- spe.add(new SimpleParameterEntry("path", vsPath));
- valueStorageEntry.setId(IdGenerator.generate());
- valueStorageEntry.setParameters(spe);
- valueStorageEntry.setFilters(vsparams);
-
- // containerEntry.setValueStorages();
- containerEntry.setParameters(params);
- ArrayList list = new ArrayList(1);
- list.add(valueStorageEntry);
-
- containerEntry.setValueStorages(list);
-
- }
-
- // Indexer
- ArrayList qParams = new ArrayList();
- qParams.add(new SimpleParameterEntry("indexDir", "../temp/index/" + IdGenerator.generate()));
- QueryHandlerEntry qEntry =
- new QueryHandlerEntry("org.exoplatform.services.jcr.impl.core.query.lucene.SearchIndex", qParams);
-
- WorkspaceEntry workspaceEntry =
- new WorkspaceEntry(wsName != null ? wsName : IdGenerator.generate(), "nt:unstructured");
- workspaceEntry.setContainer(containerEntry);
-
- ArrayList cacheParams = new ArrayList();
-
- cacheParams.add(new SimpleParameterEntry("maxSize", "2000"));
- cacheParams.add(new SimpleParameterEntry("liveTime", "20m"));
- CacheEntry cacheEntry = new CacheEntry(cacheParams);
- cacheEntry.setType("org.exoplatform.services.jcr.impl.dataflow.persistent.LinkedWorkspaceStorageCacheImpl");
-
- workspaceEntry.setCache(cacheEntry);
-
- workspaceEntry.setQueryHandler(qEntry);
-
- LockManagerEntry lockManagerEntry = new LockManagerEntry();
- lockManagerEntry.setTimeout(900000);
- LockPersisterEntry persisterEntry = new LockPersisterEntry();
- persisterEntry.setType("org.exoplatform.services.jcr.impl.core.lock.FileSystemLockPersister");
- ArrayList lpParams = new ArrayList();
- lpParams.add(new SimpleParameterEntry("path", "../temp/lock"));
- persisterEntry.setParameters(lpParams);
- lockManagerEntry.setPersister(persisterEntry);
- workspaceEntry.setLockManager(lockManagerEntry);
-
- // workspaceEntry
- return workspaceEntry;
- }
-
- private void createDatabase(DataSource ds, String dbName) throws SQLException
- {
- Connection connection = ds.getConnection();
- PreparedStatement st = connection.prepareStatement("create database " + dbName);
- st.executeQuery();
- }
-
- public static ConfigurationHelper getInstence()
- {
- if (instence == null)
- {
- instence = new ConfigurationHelper();
- }
-
- return instence;
- }
-}
Added: jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/util/TesterConfigurationHelper.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/util/TesterConfigurationHelper.java (rev 0)
+++ jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/util/TesterConfigurationHelper.java 2010-09-16 15:35:06 UTC (rev 3126)
@@ -0,0 +1,349 @@
+/*
+ * 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.util;
+
+import org.apache.commons.dbcp.BasicDataSourceFactory;
+import org.exoplatform.container.ExoContainer;
+import org.exoplatform.services.jcr.RepositoryService;
+import org.exoplatform.services.jcr.config.CacheEntry;
+import org.exoplatform.services.jcr.config.ContainerEntry;
+import org.exoplatform.services.jcr.config.LockManagerEntry;
+import org.exoplatform.services.jcr.config.LockPersisterEntry;
+import org.exoplatform.services.jcr.config.QueryHandlerEntry;
+import org.exoplatform.services.jcr.config.RepositoryConfigurationException;
+import org.exoplatform.services.jcr.config.SimpleParameterEntry;
+import org.exoplatform.services.jcr.config.ValueStorageEntry;
+import org.exoplatform.services.jcr.config.ValueStorageFilterEntry;
+import org.exoplatform.services.jcr.config.WorkspaceEntry;
+import org.exoplatform.services.jcr.impl.core.RepositoryImpl;
+import org.exoplatform.services.jcr.impl.storage.jdbc.DialectDetecter;
+import org.exoplatform.services.jcr.impl.storage.jdbc.JDBCWorkspaceDataContainer;
+import org.exoplatform.services.log.ExoLogger;
+import org.exoplatform.services.log.Log;
+
+import java.sql.Connection;
+import java.sql.PreparedStatement;
+import java.sql.SQLException;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Properties;
+
+import javax.jcr.RepositoryException;
+import javax.naming.Context;
+import javax.naming.InitialContext;
+import javax.sql.DataSource;
+
+/**
+ * Created by The eXo Platform SAS
+ *
+ * @author <a href="mailto:Sergey.Kabashnyuk@gmail.com">Sergey Kabashnyuk</a>
+ * @version $Id: ConfigurationHelper.java 11907 2008-03-13 15:36:21Z ksm $
+ */
+public class TesterConfigurationHelper
+{
+ private static Log log = ExoLogger.getLogger("exo.jcr.component.core.ConfigurationHelper");
+
+ private static TesterConfigurationHelper instence;
+
+ private TesterConfigurationHelper()
+ {
+ System.setProperty(Context.INITIAL_CONTEXT_FACTORY, "org.exoplatform.services.naming.SimpleContextFactory");
+ }
+
+ public void createWorkspace(WorkspaceEntry workspaceEntry, ExoContainer container)
+ throws RepositoryConfigurationException, RepositoryException
+ {
+ RepositoryService service = (RepositoryService)container.getComponentInstanceOfType(RepositoryService.class);
+ RepositoryImpl defRep;
+
+ defRep = (RepositoryImpl)service.getDefaultRepository();
+ defRep.configWorkspace(workspaceEntry);
+ defRep.createWorkspace(workspaceEntry.getName());
+
+ }
+
+ public String getNewDataSource(String type) throws Exception
+ {
+
+ String newDS = IdGenerator.generate();
+ Properties properties = new Properties();
+
+ properties.setProperty("driverClassName", "org.hsqldb.jdbcDriver");
+ String newurl = "jdbc:hsqldb:file:target/temp/data/" + newDS;
+
+ log.info("New url " + newurl);
+
+ properties.setProperty("url", newurl);
+ properties.setProperty("username", "sa");
+ properties.setProperty("password", "");
+ DataSource bds = BasicDataSourceFactory.createDataSource(properties);
+ if (!newurl.contains("hsqldb"))
+ {
+ createDatabase(bds, newDS);
+ }
+
+ new InitialContext().bind(newDS, bds);
+ return newDS;
+
+ }
+
+ public WorkspaceEntry getNewWs(String wsName, boolean isMultiDb, String dsName, String vsPath, ContainerEntry entry)
+ throws Exception
+ {
+ return getNewWs(wsName, isMultiDb, dsName, vsPath, entry, true);
+ }
+
+ public WorkspaceEntry getNewWs(String wsName, boolean isMultiDb, String dsName, String vsPath, ContainerEntry entry,
+ boolean newMultiDbDS) throws Exception
+ {
+
+ String dbDialect = null;
+ if (dsName != null)
+ {
+ DataSource ds = (DataSource)new InitialContext().lookup(dsName);
+ if (ds != null)
+ {
+ Connection jdbcConn = null;
+
+ jdbcConn = ds.getConnection();
+ dbDialect = DialectDetecter.detect(jdbcConn.getMetaData());
+
+ }
+ }
+
+ if (newMultiDbDS && (isMultiDb || dsName == null))
+ {
+ dsName = getNewDataSource("");
+ }
+
+ List params = new ArrayList();
+
+ params.add(new SimpleParameterEntry("sourceName", dsName));
+ params.add(new SimpleParameterEntry("db-type", "generic"));
+ params.add(new SimpleParameterEntry("multi-db", isMultiDb ? "true" : "false"));
+ params.add(new SimpleParameterEntry("update-storage", "true"));
+ params.add(new SimpleParameterEntry("max-buffer-size", "204800"));
+
+ if (dbDialect != null)
+ {
+ params.add(new SimpleParameterEntry(JDBCWorkspaceDataContainer.DB_DIALECT, dbDialect));
+ }
+ else if (entry.getParameterValue(JDBCWorkspaceDataContainer.DB_DIALECT) != null)
+ {
+ params.add(new SimpleParameterEntry(JDBCWorkspaceDataContainer.DB_DIALECT, entry
+ .getParameterValue(JDBCWorkspaceDataContainer.DB_DIALECT)));
+ }
+
+ String oldSwap = entry.getParameterValue("swap-directory");
+ String newSwap = oldSwap.substring(0, oldSwap.lastIndexOf('/')) + '/' + wsName;
+
+ params.add(new SimpleParameterEntry("swap-directory", newSwap));
+
+ ContainerEntry containerEntry =
+ new ContainerEntry("org.exoplatform.services.jcr.impl.storage.jdbc.JDBCWorkspaceDataContainer",
+ (ArrayList)params);
+ containerEntry.setParameters(params);
+
+ if (vsPath != null)
+ {
+
+ ArrayList<ValueStorageFilterEntry> vsparams = new ArrayList<ValueStorageFilterEntry>();
+ ValueStorageFilterEntry filterEntry = new ValueStorageFilterEntry();
+ filterEntry.setPropertyType("Binary");
+ vsparams.add(filterEntry);
+
+ ValueStorageEntry valueStorageEntry =
+ new ValueStorageEntry("org.exoplatform.services.jcr.impl.storage.value.fs.SimpleFileValueStorage", vsparams);
+ ArrayList<SimpleParameterEntry> spe = new ArrayList<SimpleParameterEntry>();
+ spe.add(new SimpleParameterEntry("path", vsPath));
+ valueStorageEntry.setId(IdGenerator.generate());
+ valueStorageEntry.setParameters(spe);
+ valueStorageEntry.setFilters(vsparams);
+
+ // containerEntry.setValueStorages();
+ containerEntry.setParameters(params);
+ ArrayList list = new ArrayList(1);
+ list.add(valueStorageEntry);
+
+ containerEntry.setValueStorages(list);
+
+ }
+
+ // Indexer
+ ArrayList qParams = new ArrayList();
+ qParams.add(new SimpleParameterEntry("indexDir", "../temp/index/" + IdGenerator.generate()));
+ QueryHandlerEntry qEntry =
+ new QueryHandlerEntry("org.exoplatform.services.jcr.impl.core.query.lucene.SearchIndex", qParams);
+
+ WorkspaceEntry workspaceEntry =
+ new WorkspaceEntry(wsName != null ? wsName : IdGenerator.generate(), "nt:unstructured");
+ workspaceEntry.setContainer(containerEntry);
+
+ ArrayList cacheParams = new ArrayList();
+
+ cacheParams.add(new SimpleParameterEntry("maxSize", "2000"));
+ cacheParams.add(new SimpleParameterEntry("liveTime", "20m"));
+ CacheEntry cacheEntry = new CacheEntry(cacheParams);
+ cacheEntry.setType("org.exoplatform.services.jcr.impl.dataflow.persistent.LinkedWorkspaceStorageCacheImpl");
+
+ workspaceEntry.setCache(cacheEntry);
+
+ workspaceEntry.setQueryHandler(qEntry);
+
+ LockManagerEntry lockManagerEntry = new LockManagerEntry();
+ lockManagerEntry.setTimeout(900000);
+ LockPersisterEntry persisterEntry = new LockPersisterEntry();
+ persisterEntry.setType("org.exoplatform.services.jcr.impl.core.lock.FileSystemLockPersister");
+ ArrayList lpParams = new ArrayList();
+ lpParams.add(new SimpleParameterEntry("path", "../temp/lock"));
+ persisterEntry.setParameters(lpParams);
+ lockManagerEntry.setPersister(persisterEntry);
+ workspaceEntry.setLockManager(lockManagerEntry);
+
+ // workspaceEntry
+ return workspaceEntry;
+ }
+
+ // public WorkspaceEntry getNewWsOnDataSource(String wsName, boolean isMultiDb, String dsName, String vsPath,
+ // ContainerEntry entry) throws Exception
+ // {
+ //
+ // String dbDialect = null;
+ // if (dsName != null)
+ // {
+ // DataSource ds = (DataSource)new InitialContext().lookup(dsName);
+ // if (ds != null)
+ // {
+ // Connection jdbcConn = null;
+ //
+ // jdbcConn = ds.getConnection();
+ // dbDialect = DialectDetecter.detect(jdbcConn.getMetaData());
+ // }
+ // }
+ //
+ // List params = new ArrayList();
+ //
+ // if (isMultiDb && dsName == null)
+ // {
+ // dsName = getNewDataSource("");
+ // }
+ //
+ // params.add(new SimpleParameterEntry("sourceName", dsName));
+ // params.add(new SimpleParameterEntry("db-type", "generic"));
+ // params.add(new SimpleParameterEntry("multi-db", isMultiDb ? "true" : "false"));
+ // params.add(new SimpleParameterEntry("update-storage", "true"));
+ // params.add(new SimpleParameterEntry("max-buffer-size", "204800"));
+ //
+ // if (dbDialect != null)
+ // {
+ // params.add(new SimpleParameterEntry(JDBCWorkspaceDataContainer.DB_DIALECT, dbDialect));
+ // }
+ // else if (entry.getParameterValue(JDBCWorkspaceDataContainer.DB_DIALECT) != null)
+ // {
+ // params.add(new SimpleParameterEntry(JDBCWorkspaceDataContainer.DB_DIALECT, entry
+ // .getParameterValue(JDBCWorkspaceDataContainer.DB_DIALECT)));
+ // }
+ //
+ // String oldSwap = entry.getParameterValue("swap-directory");
+ // String newSwap = oldSwap.substring(0, oldSwap.lastIndexOf('/')) + '/' + wsName;
+ //
+ // params.add(new SimpleParameterEntry("swap-directory", newSwap));
+ //
+ // ContainerEntry containerEntry =
+ // new ContainerEntry("org.exoplatform.services.jcr.impl.storage.jdbc.JDBCWorkspaceDataContainer",
+ // (ArrayList)params);
+ // containerEntry.setParameters(params);
+ //
+ // if (vsPath != null)
+ // {
+ //
+ // ArrayList<ValueStorageFilterEntry> vsparams = new ArrayList<ValueStorageFilterEntry>();
+ // ValueStorageFilterEntry filterEntry = new ValueStorageFilterEntry();
+ // filterEntry.setPropertyType("Binary");
+ // vsparams.add(filterEntry);
+ //
+ // ValueStorageEntry valueStorageEntry =
+ // new ValueStorageEntry("org.exoplatform.services.jcr.impl.storage.value.fs.SimpleFileValueStorage", vsparams);
+ // ArrayList<SimpleParameterEntry> spe = new ArrayList<SimpleParameterEntry>();
+ // spe.add(new SimpleParameterEntry("path", vsPath));
+ // valueStorageEntry.setId(IdGenerator.generate());
+ // valueStorageEntry.setParameters(spe);
+ // valueStorageEntry.setFilters(vsparams);
+ //
+ // // containerEntry.setValueStorages();
+ // containerEntry.setParameters(params);
+ // ArrayList list = new ArrayList(1);
+ // list.add(valueStorageEntry);
+ //
+ // containerEntry.setValueStorages(list);
+ //
+ // }
+ //
+ // // Indexer
+ // ArrayList qParams = new ArrayList();
+ // qParams.add(new SimpleParameterEntry("indexDir", "../temp/index/" + IdGenerator.generate()));
+ // QueryHandlerEntry qEntry =
+ // new QueryHandlerEntry("org.exoplatform.services.jcr.impl.core.query.lucene.SearchIndex", qParams);
+ //
+ // WorkspaceEntry workspaceEntry =
+ // new WorkspaceEntry(wsName != null ? wsName : IdGenerator.generate(), "nt:unstructured");
+ // workspaceEntry.setContainer(containerEntry);
+ //
+ // ArrayList cacheParams = new ArrayList();
+ //
+ // cacheParams.add(new SimpleParameterEntry("maxSize", "2000"));
+ // cacheParams.add(new SimpleParameterEntry("liveTime", "20m"));
+ // CacheEntry cacheEntry = new CacheEntry(cacheParams);
+ // cacheEntry.setType("org.exoplatform.services.jcr.impl.dataflow.persistent.LinkedWorkspaceStorageCacheImpl");
+ //
+ // workspaceEntry.setCache(cacheEntry);
+ //
+ // workspaceEntry.setQueryHandler(qEntry);
+ //
+ // LockManagerEntry lockManagerEntry = new LockManagerEntry();
+ // lockManagerEntry.setTimeout(900000);
+ // LockPersisterEntry persisterEntry = new LockPersisterEntry();
+ // persisterEntry.setType("org.exoplatform.services.jcr.impl.core.lock.FileSystemLockPersister");
+ // ArrayList lpParams = new ArrayList();
+ // lpParams.add(new SimpleParameterEntry("path", "../temp/lock"));
+ // persisterEntry.setParameters(lpParams);
+ // lockManagerEntry.setPersister(persisterEntry);
+ // workspaceEntry.setLockManager(lockManagerEntry);
+ //
+ // // workspaceEntry
+ // return workspaceEntry;
+ // }
+
+ private void createDatabase(DataSource ds, String dbName) throws SQLException
+ {
+ Connection connection = ds.getConnection();
+ PreparedStatement st = connection.prepareStatement("create database " + dbName);
+ st.executeQuery();
+ }
+
+ public static TesterConfigurationHelper getInstence()
+ {
+ if (instence == null)
+ {
+ instence = new TesterConfigurationHelper();
+ }
+
+ return instence;
+ }
+}
Modified: jcr/trunk/exo.jcr.component.core/src/test/resources/conf/standalone/test-configuration-sjdbc.xml
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/test/resources/conf/standalone/test-configuration-sjdbc.xml 2010-09-16 15:32:57 UTC (rev 3125)
+++ jcr/trunk/exo.jcr.component.core/src/test/resources/conf/standalone/test-configuration-sjdbc.xml 2010-09-16 15:35:06 UTC (rev 3126)
@@ -118,7 +118,7 @@
<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/"/>
- <property name="publication" value="http://www.exoplatform.com/jcr/publication/1.1/"/>
+ <property name="publication" value="http://www.exoplatform.com/jcr/publication/1.1/"/>
</properties-param>
</init-params>
</component-plugin>
@@ -135,9 +135,9 @@
<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>
- <value>jar:/conf/test/wcm-nodetypes.xml</value>
- <value>jar:/conf/test/nodetypes-publication-config.xml</value>
- <value>jar:/conf/test/publication-plugins-nodetypes-config.xml</value>
+ <value>jar:/conf/test/wcm-nodetypes.xml</value>
+ <value>jar:/conf/test/nodetypes-publication-config.xml</value>
+ <value>jar:/conf/test/publication-plugins-nodetypes-config.xml</value>
</values-param>
<values-param>
@@ -391,6 +391,33 @@
</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>testdbcleaner</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="org.hsqldb.jdbcDriver"/>
+ <property name="url" value="jdbc:hsqldb:file:target/temp/data/testdbcleaner"/>
+ <property name="username" value="sa"/>
+ <property name="password" value=""/>
+ </properties-param>
+ </init-params>
+ </component-plugin>
+ <component-plugin>
<name>bind.jcr</name>
<set-method>addPlugin</set-method>
<type>org.exoplatform.services.naming.BindReferencePlugin</type>
Modified: jcr/trunk/exo.jcr.component.core/src/test/resources/conf/standalone/test-configuration.xml
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/test/resources/conf/standalone/test-configuration.xml 2010-09-16 15:32:57 UTC (rev 3125)
+++ jcr/trunk/exo.jcr.component.core/src/test/resources/conf/standalone/test-configuration.xml 2010-09-16 15:35:06 UTC (rev 3126)
@@ -525,6 +525,33 @@
</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>testdbcleaner</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="org.hsqldb.jdbcDriver"/>
+ <property name="url" value="jdbc:hsqldb:file:target/temp/data/testdbcleaner"/>
+ <property name="username" value="sa"/>
+ <property name="password" value=""/>
+ </properties-param>
+ </init-params>
+ </component-plugin>
<component-plugin>
<name>bind.jcr</name>
<set-method>addPlugin</set-method>
15 years, 8 months
exo-jcr SVN: r3125 - jcr/branches/1.14-ISPN/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/infinispan.
by do-not-reply@jboss.org
Author: nfilotto
Date: 2010-09-16 11:32:57 -0400 (Thu, 16 Sep 2010)
New Revision: 3125
Modified:
jcr/branches/1.14-ISPN/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/infinispan/ISPNCacheFactory.java
Log:
EXOJCR-938: Since the cluster name will be ${original-cluster-name} + "-" + ${container-name}, we are sure that 2 caches created by 2 different ExoContainer will never share the same CacheManager since their GlobalConfig will be different, so the Map in which we register the CacheManager has been simplified
Modified: jcr/branches/1.14-ISPN/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/infinispan/ISPNCacheFactory.java
===================================================================
--- jcr/branches/1.14-ISPN/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/infinispan/ISPNCacheFactory.java 2010-09-16 15:16:19 UTC (rev 3124)
+++ jcr/branches/1.14-ISPN/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/infinispan/ISPNCacheFactory.java 2010-09-16 15:32:57 UTC (rev 3125)
@@ -62,8 +62,8 @@
* A Map that contains all the registered CacheManager order by {@link ExoContainer}
* instances and {@link GlobalConfiguration}.
*/
- private static Map<ExoContainer, Map<GlobalConfiguration, EmbeddedCacheManager>> CACHES =
- new HashMap<ExoContainer, Map<GlobalConfiguration, EmbeddedCacheManager>>();
+ private static Map<GlobalConfiguration, EmbeddedCacheManager> CACHE_MANAGERS =
+ new HashMap<GlobalConfiguration, EmbeddedCacheManager>();
/**
* Creates InfinispanCacheFactory with provided configuration transaction managers.
@@ -140,24 +140,18 @@
*/
private static synchronized EmbeddedCacheManager getUniqueInstance(String regionId, EmbeddedCacheManager manager)
{
- ExoContainer container = ExoContainerContext.getCurrentContainer();
- Map<GlobalConfiguration, EmbeddedCacheManager> allCacheManagers = CACHES.get(container);
- if (allCacheManagers == null)
- {
- allCacheManagers = new HashMap<GlobalConfiguration, EmbeddedCacheManager>();
- CACHES.put(container, allCacheManagers);
- }
GlobalConfiguration gc = manager.getGlobalConfiguration();
+ ExoContainer container = ExoContainerContext.getCurrentContainer();
// Ensure that the cluster name won't be used between 2 ExoContainers
gc.setClusterName(gc.getClusterName() + "-" + container.getContext().getName());
Configuration conf = manager.getDefaultConfiguration();
- if (allCacheManagers.containsKey(gc))
+ if (CACHE_MANAGERS.containsKey(gc))
{
- manager = allCacheManagers.get(gc);
+ manager = CACHE_MANAGERS.get(gc);
}
else
{
- allCacheManagers.put(gc, manager);
+ CACHE_MANAGERS.put(gc, manager);
if (log.isInfoEnabled())
log.info("A new JBoss Cache instance has been registered for the region " + regionId + " and the container " + container.getContext().getName());
}
15 years, 8 months
exo-jcr SVN: r3124 - in jcr/branches/1.14-ISPN/exo.jcr.component.core/src: main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/infinispan and 2 other directories.
by do-not-reply@jboss.org
Author: nfilotto
Date: 2010-09-16 11:16:19 -0400 (Thu, 16 Sep 2010)
New Revision: 3124
Modified:
jcr/branches/1.14-ISPN/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/lock/infinispan/ISPNCacheableLockManagerImpl.java
jcr/branches/1.14-ISPN/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/infinispan/ISPNCacheWorkspaceStorageCache.java
jcr/branches/1.14-ISPN/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/infinispan/ISPNCacheFactory.java
jcr/branches/1.14-ISPN/exo.jcr.component.core/src/test/resources/conf/standalone/cluster/test-jcr-config.xml
Log:
EXOJCR-938: All the Cache instances with the same GlobalConfiguration, will share the same CacheManager
Modified: jcr/branches/1.14-ISPN/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/lock/infinispan/ISPNCacheableLockManagerImpl.java
===================================================================
--- jcr/branches/1.14-ISPN/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/lock/infinispan/ISPNCacheableLockManagerImpl.java 2010-09-16 15:01:49 UTC (rev 3123)
+++ jcr/branches/1.14-ISPN/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/lock/infinispan/ISPNCacheableLockManagerImpl.java 2010-09-16 15:16:19 UTC (rev 3124)
@@ -112,7 +112,7 @@
// configure cache loader parameters with correct DB data-types
configureJDBCCacheLoader(config.getLockManager());
- cache = factory.createCache(config.getLockManager());
+ cache = factory.createCache("Lock-" + config.getUniqueName(), config.getLockManager());
// Context recall is a workaround of JDBCCacheLoader starting.
context.recall();
Modified: jcr/branches/1.14-ISPN/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/infinispan/ISPNCacheWorkspaceStorageCache.java
===================================================================
--- jcr/branches/1.14-ISPN/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/infinispan/ISPNCacheWorkspaceStorageCache.java 2010-09-16 15:01:49 UTC (rev 3123)
+++ jcr/branches/1.14-ISPN/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/infinispan/ISPNCacheWorkspaceStorageCache.java 2010-09-16 15:16:19 UTC (rev 3124)
@@ -209,7 +209,7 @@
// create parent Infinispan instance
CacheEntry cacheEntry = wsConfig.getCache();
- Cache<Serializable, Object> parentCache = factory.createCache(cacheEntry);
+ Cache<Serializable, Object> parentCache = factory.createCache("Data-" + wsConfig.getUniqueName(), cacheEntry);
Boolean allowLocalChanges = null;
try
Modified: jcr/branches/1.14-ISPN/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/infinispan/ISPNCacheFactory.java
===================================================================
--- jcr/branches/1.14-ISPN/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/infinispan/ISPNCacheFactory.java 2010-09-16 15:01:49 UTC (rev 3123)
+++ jcr/branches/1.14-ISPN/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/infinispan/ISPNCacheFactory.java 2010-09-16 15:16:19 UTC (rev 3124)
@@ -18,6 +18,8 @@
*/
package org.exoplatform.services.jcr.infinispan;
+import org.exoplatform.container.ExoContainer;
+import org.exoplatform.container.ExoContainerContext;
import org.exoplatform.container.configuration.ConfigurationManager;
import org.exoplatform.services.jcr.config.MappedParametrizedObjectEntry;
import org.exoplatform.services.jcr.config.RepositoryConfigurationException;
@@ -25,6 +27,8 @@
import org.exoplatform.services.log.ExoLogger;
import org.exoplatform.services.log.Log;
import org.infinispan.Cache;
+import org.infinispan.config.Configuration;
+import org.infinispan.config.GlobalConfiguration;
import org.infinispan.manager.DefaultCacheManager;
import org.infinispan.manager.EmbeddedCacheManager;
@@ -32,6 +36,8 @@
import java.io.InputStream;
import java.security.AccessController;
import java.security.PrivilegedAction;
+import java.util.HashMap;
+import java.util.Map;
/**
* Factory that creates and starts pre-configured instances of Infinispan.
@@ -48,11 +54,16 @@
public static final String INFINISPAN_CONFIG = "infinispan-configuration";
- public static final String JGROUPS_CONFIG = "jgroups-configuration";
-
private final TemplateConfigurationHelper configurationHelper;
- private final Log log = ExoLogger.getLogger("exo.jcr.component.core.InfinispanCacheFactory");
+ private static final Log log = ExoLogger.getLogger("exo.jcr.component.core.InfinispanCacheFactory");
+
+ /**
+ * A Map that contains all the registered CacheManager order by {@link ExoContainer}
+ * instances and {@link GlobalConfiguration}.
+ */
+ private static Map<ExoContainer, Map<GlobalConfiguration, EmbeddedCacheManager>> CACHES =
+ new HashMap<ExoContainer, Map<GlobalConfiguration, EmbeddedCacheManager>>();
/**
* Creates InfinispanCacheFactory with provided configuration transaction managers.
@@ -71,11 +82,12 @@
* "infinispan-configuration" property in parameterEntry instance.
* <br>
*
+ * @param regionId the unique id of the cache region to create
* @param parameterEntry
* @return
* @throws RepositoryConfigurationException
*/
- public Cache<K, V> createCache(MappedParametrizedObjectEntry parameterEntry) throws RepositoryConfigurationException
+ public Cache<K, V> createCache(final String regionId, MappedParametrizedObjectEntry parameterEntry) throws RepositoryConfigurationException
{
// get Infinispan configuration file path
final String configurationPath = parameterEntry.getParameterValue(INFINISPAN_CONFIG);
@@ -97,7 +109,7 @@
final EmbeddedCacheManager manager;
try
{
- manager = new DefaultCacheManager(configStream);
+ manager = getUniqueInstance(regionId, new DefaultCacheManager(configStream));
}
catch (IOException e)
{
@@ -108,11 +120,51 @@
{
public Cache<K, V> run()
{
- return manager.getCache();
+ return manager.getCache(regionId);
}
};
Cache<K, V> cache = AccessController.doPrivileged(action);
return cache;
}
+
+ /**
+ * Try to find if a {@link EmbeddedCacheManager} of the same type (i.e. their {@link GlobalConfiguration} are equals)
+ * has already been registered for the same current container.
+ * If no cache manager has been registered, we register the given cache manager otherwise we
+ * use the previously registered cache manager and we define a dedicated region for the related cache.
+ * @param regionId the unique id of the cache region to create
+ * @param manager the current cache manager of the cache to create
+ * @return the given cache manager if it has not been registered otherwise the cache manager of the same
+ * type that has already been registered..
+ */
+ private static synchronized EmbeddedCacheManager getUniqueInstance(String regionId, EmbeddedCacheManager manager)
+ {
+ ExoContainer container = ExoContainerContext.getCurrentContainer();
+ Map<GlobalConfiguration, EmbeddedCacheManager> allCacheManagers = CACHES.get(container);
+ if (allCacheManagers == null)
+ {
+ allCacheManagers = new HashMap<GlobalConfiguration, EmbeddedCacheManager>();
+ CACHES.put(container, allCacheManagers);
+ }
+ GlobalConfiguration gc = manager.getGlobalConfiguration();
+ // Ensure that the cluster name won't be used between 2 ExoContainers
+ gc.setClusterName(gc.getClusterName() + "-" + container.getContext().getName());
+ Configuration conf = manager.getDefaultConfiguration();
+ if (allCacheManagers.containsKey(gc))
+ {
+ manager = allCacheManagers.get(gc);
+ }
+ else
+ {
+ allCacheManagers.put(gc, manager);
+ if (log.isInfoEnabled())
+ log.info("A new JBoss Cache instance has been registered for the region " + regionId + " and the container " + container.getContext().getName());
+ }
+ // Define the configuration of the cache
+ manager.defineConfiguration(regionId, conf);
+ if (log.isInfoEnabled())
+ log.info("The region " + regionId + " has been registered for the container " + container.getContext().getName());
+ return manager;
+ }
}
Modified: jcr/branches/1.14-ISPN/exo.jcr.component.core/src/test/resources/conf/standalone/cluster/test-jcr-config.xml
===================================================================
--- jcr/branches/1.14-ISPN/exo.jcr.component.core/src/test/resources/conf/standalone/cluster/test-jcr-config.xml 2010-09-16 15:01:49 UTC (rev 3123)
+++ jcr/branches/1.14-ISPN/exo.jcr.component.core/src/test/resources/conf/standalone/cluster/test-jcr-config.xml 2010-09-16 15:16:19 UTC (rev 3124)
@@ -63,7 +63,7 @@
<properties>
<property name="infinispan-configuration" value="conf/standalone/cluster/test-infinispan-config.xml" />
<property name="jgroups-configuration" value="flush-udp.xml" />
- <property name="infinispan-cluster-name" value="JCR-cluster-db1-ws" />
+ <property name="infinispan-cluster-name" value="JCR-cluster" />
</properties>
</cache>
<query-handler class="org.exoplatform.services.jcr.impl.core.query.lucene.SearchIndex">
@@ -76,7 +76,7 @@
<property name="time-out" value="15m" />
<property name="infinispan-configuration" value="conf/standalone/cluster/test-infinispan-config.xml" />
<property name="jgroups-configuration" value="flush-udp.xml" />
- <property name="infinispan-cluster-name" value="JCR-cluster-locks-db1-ws" />
+ <property name="infinispan-cluster-name" value="JCR-cluster" />
<property name="infinispan-cl-cache.jdbc.table.name" value="jcrlocks_db1_ws" />
<property name="infinispan-cl-cache.jdbc.table.create" value="true" />
<property name="infinispan-cl-cache.jdbc.table.drop" value="false" />
@@ -114,7 +114,7 @@
<properties>
<property name="infinispan-configuration" value="conf/standalone/cluster/test-infinispan-config.xml" />
<property name="jgroups-configuration" value="flush-udp.xml" />
- <property name="infinispan-cluster-name" value="JCR-cluster-db1-ws1" />
+ <property name="infinispan-cluster-name" value="JCR-cluster" />
</properties>
</cache>
<query-handler class="org.exoplatform.services.jcr.impl.core.query.lucene.SearchIndex">
@@ -133,7 +133,7 @@
<property name="time-out" value="15m" />
<property name="infinispan-configuration" value="conf/standalone/cluster/test-infinispan-config.xml" />
<property name="jgroups-configuration" value="flush-udp.xml" />
- <property name="infinispan-cluster-name" value="JCR-cluster-locks-db1-ws1" />
+ <property name="infinispan-cluster-name" value="JCR-cluster" />
<property name="infinispan-cl-cache.jdbc.table.name" value="jcrlocks_db1_ws1" />
<property name="infinispan-cl-cache.jdbc.table.create" value="true" />
<property name="infinispan-cl-cache.jdbc.table.drop" value="false" />
@@ -171,7 +171,7 @@
<properties>
<property name="infinispan-configuration" value="conf/standalone/cluster/test-infinispan-config.xml" />
<property name="jgroups-configuration" value="flush-udp.xml" />
- <property name="infinispan-cluster-name" value="JCR-cluster-db1-ws2" />
+ <property name="infinispan-cluster-name" value="JCR-cluster" />
</properties>
</cache>
<query-handler class="org.exoplatform.services.jcr.impl.core.query.lucene.SearchIndex">
@@ -190,7 +190,7 @@
<property name="time-out" value="15m" />
<property name="infinispan-configuration" value="conf/standalone/cluster/test-infinispan-config.xml" />
<property name="jgroups-configuration" value="flush-udp.xml" />
- <property name="infinispan-cluster-name" value="JCR-cluster-locks-db1-ws2" />
+ <property name="infinispan-cluster-name" value="JCR-cluster" />
<property name="infinispan-cl-cache.jdbc.table.name" value="jcrlocks_db1_ws2" />
<property name="infinispan-cl-cache.jdbc.table.create" value="true" />
<property name="infinispan-cl-cache.jdbc.table.drop" value="false" />
@@ -246,7 +246,7 @@
<properties>
<property name="infinispan-configuration" value="conf/standalone/cluster/test-infinispan-config.xml" />
<property name="jgroups-configuration" value="flush-udp.xml" />
- <property name="infinispan-cluster-name" value="JCR-cluster-db1-ws3" />
+ <property name="infinispan-cluster-name" value="JCR-cluster" />
</properties>
</cache>
<query-handler class="org.exoplatform.services.jcr.impl.core.query.lucene.SearchIndex">
@@ -265,7 +265,7 @@
<property name="time-out" value="15m" />
<property name="infinispan-configuration" value="conf/standalone/cluster/test-infinispan-config.xml" />
<property name="jgroups-configuration" value="flush-udp.xml" />
- <property name="infinispan-cluster-name" value="JCR-cluster-locks-db1-ws3" />
+ <property name="infinispan-cluster-name" value="JCR-cluster" />
<property name="infinispan-cl-cache.jdbc.table.name" value="jcrlocks_db1_ws3" />
<property name="infinispan-cl-cache.jdbc.table.create" value="true" />
<property name="infinispan-cl-cache.jdbc.table.drop" value="false" />
@@ -319,7 +319,7 @@
<properties>
<property name="infinispan-configuration" value="conf/standalone/cluster/test-infinispan-config.xml" />
<property name="jgroups-configuration" value="flush-udp.xml" />
- <property name="infinispan-cluster-name" value="JCR-cluster-db1tck-ws" />
+ <property name="infinispan-cluster-name" value="JCR-cluster" />
</properties>
</cache>
<query-handler class="org.exoplatform.services.jcr.impl.core.query.lucene.SearchIndex">
@@ -339,7 +339,7 @@
<property name="time-out" value="15m" />
<property name="infinispan-configuration" value="conf/standalone/cluster/test-infinispan-config.xml" />
<property name="jgroups-configuration" value="flush-udp.xml" />
- <property name="infinispan-cluster-name" value="JCR-cluster-locks-db1tck-ws" />
+ <property name="infinispan-cluster-name" value="JCR-cluster" />
<property name="infinispan-cl-cache.jdbc.table.name" value="jcrlocks_db1tck_ws" />
<property name="infinispan-cl-cache.jdbc.table.create" value="true" />
<property name="infinispan-cl-cache.jdbc.table.drop" value="false" />
@@ -383,7 +383,7 @@
<properties>
<property name="infinispan-configuration" value="conf/standalone/cluster/test-infinispan-config.xml" />
<property name="jgroups-configuration" value="flush-udp.xml" />
- <property name="infinispan-cluster-name" value="JCR-cluster-db1tck-ws1" />
+ <property name="infinispan-cluster-name" value="JCR-cluster" />
</properties>
</cache>
<query-handler class="org.exoplatform.services.jcr.impl.core.query.lucene.SearchIndex">
@@ -402,7 +402,7 @@
<property name="time-out" value="15m" />
<property name="infinispan-configuration" value="conf/standalone/cluster/test-infinispan-config.xml" />
<property name="jgroups-configuration" value="flush-udp.xml" />
- <property name="infinispan-cluster-name" value="JCR-cluster-locks-db1tck-ws1" />
+ <property name="infinispan-cluster-name" value="JCR-cluster" />
<property name="infinispan-cl-cache.jdbc.table.name" value="jcrlocks_db1tck_ws1" />
<property name="infinispan-cl-cache.jdbc.table.create" value="true" />
<property name="infinispan-cl-cache.jdbc.table.drop" value="false" />
@@ -446,7 +446,7 @@
<properties>
<property name="infinispan-configuration" value="conf/standalone/cluster/test-infinispan-config.xml" />
<property name="jgroups-configuration" value="flush-udp.xml" />
- <property name="infinispan-cluster-name" value="JCR-cluster-db1tck-ws2" />
+ <property name="infinispan-cluster-name" value="JCR-cluster" />
</properties>
</cache>
<query-handler class="org.exoplatform.services.jcr.impl.core.query.lucene.SearchIndex">
@@ -468,7 +468,7 @@
<property name="time-out" value="15m" />
<property name="infinispan-configuration" value="conf/standalone/cluster/test-infinispan-config.xml" />
<property name="jgroups-configuration" value="flush-udp.xml" />
- <property name="infinispan-cluster-name" value="JCR-cluster-locks-db1tck-ws2" />
+ <property name="infinispan-cluster-name" value="JCR-cluster" />
<property name="infinispan-cl-cache.jdbc.table.name" value="jcrlocks_db1tck_ws2" />
<property name="infinispan-cl-cache.jdbc.table.create" value="true" />
<property name="infinispan-cl-cache.jdbc.table.drop" value="false" />
15 years, 8 months
exo-jcr SVN: r3123 - jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/util/jdbc.
by do-not-reply@jboss.org
Author: sergiykarpenko
Date: 2010-09-16 11:01:49 -0400 (Thu, 16 Sep 2010)
New Revision: 3123
Modified:
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/util/jdbc/SingleDBCleaner.java
Log:
EXOJCR-939: DBCleaner security updated
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/util/jdbc/SingleDBCleaner.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/util/jdbc/SingleDBCleaner.java 2010-09-16 14:44:28 UTC (rev 3122)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/util/jdbc/SingleDBCleaner.java 2010-09-16 15:01:49 UTC (rev 3123)
@@ -16,8 +16,11 @@
*/
package org.exoplatform.services.jcr.impl.util.jdbc;
+import org.exoplatform.services.jcr.impl.util.SecurityHelper;
+
import java.io.IOException;
import java.io.InputStream;
+import java.security.PrivilegedExceptionAction;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
@@ -96,7 +99,7 @@
// Remove only child nodes in cycle, till all nodes will be removed.
// Such algorithm used to avoid any constraint violation exception related to foreign key.
PreparedStatement getChildItems = null;
- Statement removeItems = connection.createStatement();
+ final Statement removeItems = connection.createStatement();
try
{
@@ -108,7 +111,16 @@
do
{
- ResultSet result = getChildItems.executeQuery();
+ final PreparedStatement getChildIds = getChildItems;
+ ResultSet result =
+ (ResultSet)SecurityHelper.doPriviledgedSQLExceptionAction(new PrivilegedExceptionAction<Object>()
+ {
+ public Object run() throws Exception
+ {
+ return getChildIds.executeQuery();
+ }
+ });
+
StringBuilder childListBuilder = new StringBuilder();
if (result.next())
{
@@ -123,8 +135,15 @@
childListBuilder.append(" , '" + result.getString(1) + "'");
}
// now remove nodes;
- String q = REMOVE_ITEMS.replace("?", childListBuilder.toString());
- removeItems.executeUpdate(q);
+ final String q = REMOVE_ITEMS.replace("?", childListBuilder.toString());
+ SecurityHelper.doPriviledgedSQLExceptionAction(new PrivilegedExceptionAction<Object>()
+ {
+ public Object run() throws Exception
+ {
+ removeItems.executeUpdate(q);
+ return null;
+ }
+ });
}
while (true);
}
@@ -138,7 +157,6 @@
if (removeItems != null)
{
removeItems.close();
- removeItems = null;
}
}
}
15 years, 8 months
exo-jcr SVN: r3122 - in jcr/trunk/exo.jcr.component.core/src/main: resources/conf/storage and 1 other directories.
by do-not-reply@jboss.org
Author: sergiykarpenko
Date: 2010-09-16 10:44:28 -0400 (Thu, 16 Sep 2010)
New Revision: 3122
Added:
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/util/jdbc/MultiDBCleaner.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/util/jdbc/SingleDBCleaner.java
jcr/trunk/exo.jcr.component.core/src/main/resources/conf/storage/cleanup/
jcr/trunk/exo.jcr.component.core/src/main/resources/conf/storage/cleanup/jcr-mjdbc.sql
jcr/trunk/exo.jcr.component.core/src/main/resources/conf/storage/cleanup/jcr-sjdbc.sql
Modified:
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/util/jdbc/DBCleaner.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/util/jdbc/DBCleanerService.java
Log:
EXOJCR-939: DBCleaner separated to multi and single; script support added
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/util/jdbc/DBCleaner.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/util/jdbc/DBCleaner.java 2010-09-16 13:41:50 UTC (rev 3121)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/util/jdbc/DBCleaner.java 2010-09-16 14:44:28 UTC (rev 3122)
@@ -16,14 +16,23 @@
*/
package org.exoplatform.services.jcr.impl.util.jdbc;
+import org.exoplatform.services.jcr.core.security.JCRRuntimePermissions;
+import org.exoplatform.services.jcr.impl.util.SecurityHelper;
import org.exoplatform.services.log.ExoLogger;
import org.exoplatform.services.log.Log;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+import java.security.PrivilegedExceptionAction;
import java.sql.Connection;
-import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
/**
* The goal of this class is remove workspace data from database.
@@ -34,47 +43,29 @@
* @author <a href="karpenko.sergiy(a)gmail.com">Karpenko Sergiy</a>
* @version $Id: DBCleaner.java 111 2008-11-11 11:11:11Z serg $
*/
-public class DBCleaner
+public abstract class DBCleaner
{
protected final static Log LOG = ExoLogger.getLogger("exo.jcr.component.core.DBCleaner");
- protected final static int MAX_IDS_RETURNED = 100;
+ protected final Pattern dbObjectNamePattern;
- protected String REMOVE_PROPERTIES;
+ protected final Connection connection;
- protected String REMOVE_ITEMS;
+ protected String[] scripts;
- protected String REMOVE_VALUES;
-
- protected String REMOVE_REFERENCES;
-
- protected String GET_CHILD_IDS;
-
- protected String DROP_JCR_MITEM_TABLE;
-
- protected String DROP_JCR_MVALUE_TABLE;
-
- protected String DROP_MREF_TABLE;
-
- private final Connection connection;
-
- private final String containerName;
-
- private final boolean isMultiDB;
-
/**
* Constructor.
*
* @param containerName - workspace name
* @param connection - SQL conneciton
*/
- public DBCleaner(Connection connection, String containerName, boolean isMulti)
+ public DBCleaner(Connection connection, InputStream inputStream) throws IOException
{
+ this.dbObjectNamePattern = Pattern.compile(DBInitializer.SQL_OBJECTNAME, Pattern.CASE_INSENSITIVE);
this.connection = connection;
- this.containerName = containerName;
- this.isMultiDB = isMulti;
- prepareQueries();
+ // parse script
+ this.scripts = readScriptResource(inputStream);
}
/**
@@ -92,20 +83,37 @@
*/
public void cleanWorkspace() throws DBCleanerException
{
+ SecurityManager security = System.getSecurityManager();
+ if (security != null)
+ {
+ security.checkPermission(JCRRuntimePermissions.MANAGE_REPOSITORY_PERMISSION);
+ }
+
+ String sql = null;
+ Statement st = null;
try
{
connection.setAutoCommit(false);
- // check is multi db
- if (isMultiDB)
+ st = connection.createStatement();
+ for (String scr : scripts)
{
- //remove table
- dropWorkspace();
+ String s = cleanWhitespaces(scr.trim());
+ if (s.length() > 0)
+ {
+ if (!canExecuteQuery(connection, sql = s))
+ {
+ // table not found , so try drop other
+ continue;
+ }
+
+ if (LOG.isDebugEnabled())
+ {
+ LOG.debug("Execute script: \n[" + sql + "]");
+ }
+ executeQuery(st, sql);
+ }
}
- else
- {
- // clean up all record of this container
- removeWorkspaceRecords();
- }
+
connection.commit();
}
catch (SQLException e)
@@ -122,6 +130,18 @@
}
finally
{
+ if (st != null)
+ {
+ try
+ {
+ st.close();
+ }
+ catch (SQLException e)
+ {
+ LOG.error("Can't close the Statement: " + e);
+ }
+ }
+
try
{
connection.close();
@@ -133,138 +153,145 @@
}
}
- protected void prepareQueries()
+ protected boolean canExecuteQuery(Connection conn, String sql) throws SQLException
{
- //for single db support
-
- REMOVE_PROPERTIES = "delete from JCR_SITEM where I_CLASS=2 and CONTAINER_NAME=?";
-
- GET_CHILD_IDS =
- "select ID from JCR_SITEM where CONTAINER_NAME=? and ID not in(select PARENT_ID from JCR_SITEM where CONTAINER_NAME=?)";
-
- // "delete from JCR_SITEM where CONTAINER_NAME=?";
- REMOVE_ITEMS = "delete from JCR_SITEM where ID in( ? )";
-
- REMOVE_VALUES =
- "delete from JCR_SVALUE where exists"
- + "(select * from JCR_SITEM where JCR_SITEM.ID=JCR_SVALUE.PROPERTY_ID and JCR_SITEM.CONTAINER_NAME=?)";
-
- REMOVE_REFERENCES =
- "delete from JCR_SREF where exists"
- + "(select * from JCR_SITEM where JCR_SITEM.ID=JCR_SREF.PROPERTY_ID and JCR_SITEM.CONTAINER_NAME=?)";
-
- // for multi db support
- DROP_JCR_MITEM_TABLE = "DROP TABLE JCR_MITEM";
- DROP_JCR_MVALUE_TABLE = "DROP TABLE JCR_MVALUE";
- DROP_MREF_TABLE = "DROP TABLE JCR_MREF";
+ return isTablesFromQueryExists(conn, sql);
}
- protected void dropWorkspace() throws SQLException
+ protected String cleanWhitespaces(String string)
{
- final Statement statement = connection.createStatement();
- connection.setAutoCommit(false);
-
- try
+ if (string != null)
{
- // order of dropped tables is important
- statement.executeUpdate(DROP_MREF_TABLE);
- statement.executeUpdate(DROP_JCR_MVALUE_TABLE);
- statement.executeUpdate(DROP_JCR_MITEM_TABLE);
- }
- finally
- {
- if (statement != null)
+ char[] cc = string.toCharArray();
+ for (int ci = cc.length - 1; ci > 0; ci--)
{
- try
+ if (Character.isWhitespace(cc[ci]))
{
- statement.close();
+ cc[ci] = ' ';
}
- catch (SQLException e)
- {
- LOG.error("Can't close the Statement: " + e);
- }
}
+ return new String(cc);
}
+ return string;
}
- protected void removeWorkspaceRecords() throws SQLException
+ protected void executeQuery(final Statement statement, final String sql) throws SQLException
{
- executeUpdate(connection, REMOVE_REFERENCES, containerName);
- executeUpdate(connection, REMOVE_VALUES, containerName);
-
- clearItems(connection, containerName);
+ SecurityHelper.doPriviledgedSQLExceptionAction(new PrivilegedExceptionAction<Object>()
+ {
+ public Object run() throws Exception
+ {
+ statement.executeUpdate(sql);
+ return null;
+ }
+ });
}
- protected void executeUpdate(Connection connection, String query, String containerName) throws SQLException
+ protected boolean isTableExists(Connection conn, String tableName) throws SQLException
{
- PreparedStatement statements = null;
+ ResultSet trs = conn.getMetaData().getTables(null, null, tableName, null);
try
{
- statements = connection.prepareStatement(query);
- statements.setString(1, containerName);
- statements.executeUpdate();
+ boolean res = false;
+ while (trs.next())
+ {
+ res = true; // check for columns/table type matching etc.
+ }
+ return res;
}
finally
{
- if (statements != null)
+ try
{
- statements.close();
- statements = null;
+ trs.close();
}
+ catch (SQLException e)
+ {
+ LOG.error("Can't close the ResultSet: " + e);
+ }
}
}
- protected void clearItems(Connection connection, String containerName) throws SQLException
+ protected boolean isTablesFromQueryExists(Connection conn, String sql) throws SQLException
{
- executeUpdate(connection, REMOVE_PROPERTIES, containerName);
+ Matcher tMatcher = dbObjectNamePattern.matcher(sql);
+ while (tMatcher.find())
+ {
+ // got table name
+ String tableName = sql.substring(tMatcher.start(), tMatcher.end());
+ if (!isTableExists(conn, tableName))
+ {
+ LOG.error("Table [" + tableName + "] from query [" + sql
+ + "] was not found. So query will not be executed , but will try execute next one.");
+ return false;
+ }
+ }
+ return true;
+ }
- // Remove only child nodes in cycle, till all nodes will be removed.
- // Such algorithm used to avoid any constraint violation exception related to foreign key.
- PreparedStatement getChildItems = null;
- Statement removeItems = connection.createStatement();
+ protected String[] readScriptResource(final InputStream is) throws IOException
+ {
+ //extract string
+ PrivilegedAction<InputStreamReader> actionGetReader = new PrivilegedAction<InputStreamReader>()
+ {
+ public InputStreamReader run()
+ {
+ return new InputStreamReader(is);
+ }
+ };
+ InputStreamReader isr = AccessController.doPrivileged(actionGetReader);
+ String script = null;
try
{
- getChildItems = connection.prepareStatement(GET_CHILD_IDS);
- getChildItems.setString(1, containerName);
- getChildItems.setString(2, containerName);
-
- getChildItems.setMaxRows(MAX_IDS_RETURNED);
-
- do
+ StringBuilder sbuff = new StringBuilder();
+ char[] buff = new char[is.available()];
+ int r = 0;
+ while ((r = isr.read(buff)) > 0)
{
- ResultSet result = getChildItems.executeQuery();
- StringBuilder childListBuilder = new StringBuilder();
- if (result.next())
- {
- childListBuilder.append("'" + result.getString(1) + "'");
- }
- else
- {
- break;
- }
- while (result.next())
- {
- childListBuilder.append(" , '" + result.getString(1) + "'");
- }
- // now remove nodes;
- String q = REMOVE_ITEMS.replace("?", childListBuilder.toString());
- removeItems.executeUpdate(q);
+ sbuff.append(buff, 0, r);
}
- while (true);
+
+ script = sbuff.toString();
}
finally
{
- if (getChildItems != null)
+ try
{
- getChildItems.close();
- getChildItems = null;
+ is.close();
}
- if (removeItems != null)
+ catch (IOException e)
{
- removeItems.close();
- removeItems = null;
}
}
+
+ // parse scripts
+ String[] scripts = null;
+ if (script.startsWith(DBInitializer.SQL_DELIMITER_COMMENT_PREFIX))
+ {
+ // read custom prefix
+ try
+ {
+ String s = script.substring(DBInitializer.SQL_DELIMITER_COMMENT_PREFIX.length());
+ int endOfDelimIndex = s.indexOf("*/");
+ String delim = s.substring(0, endOfDelimIndex).trim();
+ s = s.substring(endOfDelimIndex + 2).trim();
+ scripts = s.split(delim);
+ }
+ catch (IndexOutOfBoundsException e)
+ {
+ LOG.warn("Error of parse SQL-script file. Invalid DELIMITER configuration. Valid format is '"
+ + DBInitializer.SQL_DELIMITER_COMMENT_PREFIX
+ + "XXX*/' at begin of the SQL-script file, where XXX - DELIMITER string." + " Spaces will be trimed. ",
+ e);
+ LOG.info("Using DELIMITER:[" + DBInitializer.SQL_DELIMITER + "]");
+ scripts = script.split(DBInitializer.SQL_DELIMITER);
+ }
+ }
+ else
+ {
+ scripts = script.split(DBInitializer.SQL_DELIMITER);
+ }
+ return scripts;
}
}
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/util/jdbc/DBCleanerService.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/util/jdbc/DBCleanerService.java 2010-09-16 13:41:50 UTC (rev 3121)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/util/jdbc/DBCleanerService.java 2010-09-16 14:44:28 UTC (rev 3122)
@@ -16,7 +16,16 @@
*/
package org.exoplatform.services.jcr.impl.util.jdbc;
+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.log.ExoLogger;
+import org.exoplatform.services.log.Log;
+
import java.io.IOException;
+import java.io.InputStream;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
@@ -26,12 +35,6 @@
import javax.naming.NamingException;
import javax.sql.DataSource;
-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.log.ExoLogger;
-import org.exoplatform.services.log.Log;
-
/**
* Created by The eXo Platform SAS.
*
@@ -66,13 +69,34 @@
throw new RepositoryException(err, e);
}
- DBCleaner cleaner = new DBCleaner(conn, wsJDBCConfig.getContainerName(), wsJDBCConfig.isMultiDb());
+ final String sqlPath = "/conf/storage/cleanup/jcr-" + (wsJDBCConfig.isMultiDb() ? "m" : "s") + "jdbc.sql";
+ PrivilegedAction<InputStream> action = new PrivilegedAction<InputStream>()
+ {
+ public InputStream run()
+ {
+ return this.getClass().getResourceAsStream(sqlPath);
+ }
+ };
+ InputStream is = AccessController.doPrivileged(action);
- try{
- cleaner.cleanWorkspace();
- }catch(DBCleanerException e){
- throw new RepositoryException(e.getMessage(),e);
+ DBCleaner cleaner;
+ if (wsJDBCConfig.isMultiDb())
+ {
+ cleaner = new MultiDBCleaner(conn, is);
}
+ else
+ {
+ cleaner = new SingleDBCleaner(conn, is, wsJDBCConfig.getContainerName());
+ }
+
+ try
+ {
+ cleaner.cleanWorkspace();
+ }
+ catch (DBCleanerException e)
+ {
+ throw new RepositoryException(e.getMessage(), e);
+ }
}
public static void removeRepositoryData(RepositoryEntry repoConfig) throws RepositoryConfigurationException,
Added: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/util/jdbc/MultiDBCleaner.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/util/jdbc/MultiDBCleaner.java (rev 0)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/util/jdbc/MultiDBCleaner.java 2010-09-16 14:44:28 UTC (rev 3122)
@@ -0,0 +1,37 @@
+/*
+ * Copyright (C) 2003-2010 eXo Platform SAS.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Affero General Public License
+ * as published by the Free Software Foundation; either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, see<http://www.gnu.org/licenses/>.
+ */
+package org.exoplatform.services.jcr.impl.util.jdbc;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.sql.Connection;
+
+/**
+ * Created by The eXo Platform SAS.
+ *
+ * <br/>Date:
+ *
+ * @author <a href="karpenko.sergiy(a)gmail.com">Karpenko Sergiy</a>
+ * @version $Id: MultiDBCLeaner.java 111 2008-11-11 11:11:11Z serg $
+ */
+public final class MultiDBCleaner extends DBCleaner
+{
+ public MultiDBCleaner(Connection connection, InputStream inputStream) throws IOException
+ {
+ super(connection, inputStream);
+ }
+}
Added: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/util/jdbc/SingleDBCleaner.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/util/jdbc/SingleDBCleaner.java (rev 0)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/util/jdbc/SingleDBCleaner.java 2010-09-16 14:44:28 UTC (rev 3122)
@@ -0,0 +1,145 @@
+/*
+ * Copyright (C) 2003-2010 eXo Platform SAS.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Affero General Public License
+ * as published by the Free Software Foundation; either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, see<http://www.gnu.org/licenses/>.
+ */
+package org.exoplatform.services.jcr.impl.util.jdbc;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.sql.Connection;
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.sql.Statement;
+
+/**
+ * Created by The eXo Platform SAS.
+ *
+ * <br/>Date:
+ *
+ * @author <a href="karpenko.sergiy(a)gmail.com">Karpenko Sergiy</a>
+ * @version $Id: SingleDBCleaner.java 111 2008-11-11 11:11:11Z serg $
+ */
+public final class SingleDBCleaner extends DBCleaner
+{
+ public final String CLEAN_JCR_SITEM_AS_DEFAULT = "/*$CLEAN_JCR_SITEM_DEFAULT*/";
+
+ protected final int MAX_IDS_RETURNED = 100;
+
+ protected String GET_CHILD_IDS;
+
+ protected String REMOVE_ITEMS;
+
+ protected final String containerName;
+
+ public SingleDBCleaner(Connection connection, InputStream inputStream, String containerName) throws IOException
+ {
+ super(connection, inputStream);
+ this.containerName = containerName;
+ prepareQueries();
+ }
+
+ protected void prepareQueries()
+ {
+ GET_CHILD_IDS =
+ "select ID from JCR_SITEM where CONTAINER_NAME=? and ID not in(select PARENT_ID from JCR_SITEM where CONTAINER_NAME=?)";
+
+ REMOVE_ITEMS = "delete from JCR_SITEM where ID in( ? )";
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ protected boolean canExecuteQuery(Connection conn, String sql) throws SQLException
+ {
+ if (sql.equalsIgnoreCase(CLEAN_JCR_SITEM_AS_DEFAULT))
+ {
+ return true;
+ }
+ else
+ {
+ return isTablesFromQueryExists(conn, sql);
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ protected void executeQuery(final Statement statement, final String sql) throws SQLException
+ {
+ if (sql.equalsIgnoreCase(CLEAN_JCR_SITEM_AS_DEFAULT))
+ {
+ clearItems(statement.getConnection(), containerName);
+ }
+ else
+ {
+ // check query for "?" mask and replace it with containerName
+ String q = sql.replace("?", "'" + containerName + "'");
+ super.executeQuery(statement, q);
+ }
+ }
+
+ private void clearItems(Connection connection, String containerName) throws SQLException
+ {
+ // Remove only child nodes in cycle, till all nodes will be removed.
+ // Such algorithm used to avoid any constraint violation exception related to foreign key.
+ PreparedStatement getChildItems = null;
+ Statement removeItems = connection.createStatement();
+
+ try
+ {
+ getChildItems = connection.prepareStatement(GET_CHILD_IDS);
+ getChildItems.setString(1, containerName);
+ getChildItems.setString(2, containerName);
+
+ getChildItems.setMaxRows(MAX_IDS_RETURNED);
+
+ do
+ {
+ ResultSet result = getChildItems.executeQuery();
+ StringBuilder childListBuilder = new StringBuilder();
+ if (result.next())
+ {
+ childListBuilder.append("'" + result.getString(1) + "'");
+ }
+ else
+ {
+ break;
+ }
+ while (result.next())
+ {
+ childListBuilder.append(" , '" + result.getString(1) + "'");
+ }
+ // now remove nodes;
+ String q = REMOVE_ITEMS.replace("?", childListBuilder.toString());
+ removeItems.executeUpdate(q);
+ }
+ while (true);
+ }
+ finally
+ {
+ if (getChildItems != null)
+ {
+ getChildItems.close();
+ getChildItems = null;
+ }
+ if (removeItems != null)
+ {
+ removeItems.close();
+ removeItems = null;
+ }
+ }
+ }
+}
Added: jcr/trunk/exo.jcr.component.core/src/main/resources/conf/storage/cleanup/jcr-mjdbc.sql
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/resources/conf/storage/cleanup/jcr-mjdbc.sql (rev 0)
+++ jcr/trunk/exo.jcr.component.core/src/main/resources/conf/storage/cleanup/jcr-mjdbc.sql 2010-09-16 14:44:28 UTC (rev 3122)
@@ -0,0 +1,3 @@
+DROP TABLE JCR_MREF;
+DROP TABLE JCR_MVALUE;
+DROP TABLE JCR_MITEM;
\ No newline at end of file
Added: jcr/trunk/exo.jcr.component.core/src/main/resources/conf/storage/cleanup/jcr-sjdbc.sql
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/resources/conf/storage/cleanup/jcr-sjdbc.sql (rev 0)
+++ jcr/trunk/exo.jcr.component.core/src/main/resources/conf/storage/cleanup/jcr-sjdbc.sql 2010-09-16 14:44:28 UTC (rev 3122)
@@ -0,0 +1,4 @@
+delete from JCR_SVALUE where exists(select * from JCR_SITEM where JCR_SITEM.ID=JCR_SVALUE.PROPERTY_ID and JCR_SITEM.CONTAINER_NAME=?);
+delete from JCR_SREF where exists(select * from JCR_SITEM where JCR_SITEM.ID=JCR_SREF.PROPERTY_ID and JCR_SITEM.CONTAINER_NAME=?);
+delete from JCR_SITEM where I_CLASS=2 and CONTAINER_NAME=?;
+/*$CLEAN_JCR_SITEM_DEFAULT*/;
15 years, 8 months
exo-jcr SVN: r3121 - in jcr/trunk/exo.jcr.component.core/src: main/java/org/exoplatform/services/jcr/dataflow and 25 other directories.
by do-not-reply@jboss.org
Author: tolusha
Date: 2010-09-16 09:41:50 -0400 (Thu, 16 Sep 2010)
New Revision: 3121
Modified:
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/core/nodetype/ItemDefinitionData.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/dataflow/ItemDataConsumer.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/dataflow/TransactionChangesLog.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/dataflow/persistent/WorkspaceStorageCache.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/ItemImpl.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/NamespaceDataPersister.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/NodeImpl.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/SessionDataManager.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/SessionImpl.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/WorkspaceImpl.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/lock/FileSystemLockPersister.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/lock/LockManagerImpl.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/lock/jbosscache/CacheableLockManagerImpl.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/lock/jbosscache/jdbc/CacheableJDBCLockManagerImpl.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/nodetype/ItemAutocreator.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/nodetype/NodeTypeDataManagerImpl.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/nodetype/registration/AbstractItemDefinitionAccessProvider.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/nodetype/registration/JCRNodeTypeDataPersister.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/nodetype/registration/NodeDefinitionComparator.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/nodetype/registration/PropertyDefinitionComparator.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/AggregateRuleImpl.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/LuceneQueryBuilder.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/NodeIndexer.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/SharedFieldSortComparator.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/version/FrozenNodeInitializer.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/version/ItemDataMergeVisitor.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/version/ItemDataRestoreVisitor.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/version/VersionHistoryImpl.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/version/VersionImpl.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/ACLInheritanceSupportedWorkspaceDataManager.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/CacheableWorkspaceDataManager.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/LinkedWorkspaceStorageCacheImpl.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/VersionableWorkspaceDataManager.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/WorkspacePersistentDataManager.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/jbosscache/JBossCacheWorkspaceStorageCache.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/session/LocalWorkspaceStorageDataManagerProxy.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/session/SessionChangesLog.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/session/TransactionableDataManager.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/version/VersionHistoryDataHelper.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/inmemory/InmemoryStorageConnection.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/JDBCStorageConnection.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/SQLExceptionHandler.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/statistics/StatisticsJDBCStorageConnection.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/xml/VersionHistoryRemover.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/xml/importing/BaseXmlImporter.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/storage/WorkspaceStorageConnection.java
jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/core/TestGetNode.java
jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/core/TestSessionDataManager.java
jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/dataflow/persistent/TestCacheableWorkspaceDataManager.java
jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/dataflow/persistent/TestLinkedCacheMultithread.java
jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/dataflow/persistent/WorkspaceStorageCacheBaseCase.java
jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/storage/JDBCHWDCTest.java
jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/storage/JDBCStorageConnectionTest.java
jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/storage/StorageUpdateTest.java
jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/storage/fs/TestJCRVSReadWrite.java
jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/storage/jdbc/SQLBenchmarkTest.java
jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/version/TestFrozenNodeInitializer.java
Log:
EXOJCR-954: allow to get property with same name as child node, Implemented by adding paramter in the method getItemData() which indicates what need exactly to get: node or property
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/core/nodetype/ItemDefinitionData.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/core/nodetype/ItemDefinitionData.java 2010-09-16 11:23:57 UTC (rev 3120)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/core/nodetype/ItemDefinitionData.java 2010-09-16 13:41:50 UTC (rev 3121)
@@ -172,4 +172,5 @@
{
return name.getAsString();
}
+
}
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/dataflow/ItemDataConsumer.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/dataflow/ItemDataConsumer.java 2010-09-16 11:23:57 UTC (rev 3120)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/dataflow/ItemDataConsumer.java 2010-09-16 13:41:50 UTC (rev 3121)
@@ -22,6 +22,7 @@
import org.exoplatform.services.jcr.datamodel.NodeData;
import org.exoplatform.services.jcr.datamodel.PropertyData;
import org.exoplatform.services.jcr.datamodel.QPathEntry;
+import org.exoplatform.services.jcr.impl.core.ItemImpl.ItemType;
import java.util.List;
@@ -42,14 +43,18 @@
{
/**
- * Find Item by parent (id) and name (with path index).
+ * Find Item by parent (id) and name (with path index) of define type.
*
- * @param parent NodeData
- * @param name QPathEntry
+ * @param parent
+ * NodeData
+ * @param name
+ * item name
+ * @param itemType
+ * itemType
* @return ItemData, data by parent and name
* @throws RepositoryException
*/
- ItemData getItemData(NodeData parent, QPathEntry name) throws RepositoryException;
+ ItemData getItemData(NodeData parent, QPathEntry name, ItemType itemType) throws RepositoryException;
/**
* Find Item by identifier.
@@ -73,7 +78,7 @@
* @return int, child nodes count
*/
int getChildNodesCount(NodeData parent) throws RepositoryException;
-
+
/**
* Get child Properties of the parent node.
*
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/dataflow/TransactionChangesLog.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/dataflow/TransactionChangesLog.java 2010-09-16 11:23:57 UTC (rev 3120)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/dataflow/TransactionChangesLog.java 2010-09-16 13:41:50 UTC (rev 3121)
@@ -18,11 +18,11 @@
*/
package org.exoplatform.services.jcr.dataflow;
-import org.exoplatform.services.jcr.datamodel.IllegalPathException;
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.Constants;
+import org.exoplatform.services.jcr.impl.core.ItemImpl.ItemType;
import java.io.Externalizable;
import java.io.IOException;
@@ -139,14 +139,15 @@
return null;
}
- public ItemState getItemState(NodeData parentData, QPathEntry name)
+ public ItemState getItemState(NodeData parentData, QPathEntry name, ItemType itemType)
{
List<ItemState> allStates = getAllStates();
for (int i = allStates.size() - 1; i >= 0; i--)
{
ItemState state = allStates.get(i);
if (state.getData().getParentIdentifier().equals(parentData.getIdentifier())
- && state.getData().getQPath().getEntries()[state.getData().getQPath().getEntries().length - 1].isSame(name))
+ && state.getData().getQPath().getEntries()[state.getData().getQPath().getEntries().length - 1].isSame(name)
+ && itemType.isSuitableFor(state.getData()))
return state;
}
return null;
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/dataflow/persistent/WorkspaceStorageCache.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/dataflow/persistent/WorkspaceStorageCache.java 2010-09-16 11:23:57 UTC (rev 3120)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/dataflow/persistent/WorkspaceStorageCache.java 2010-09-16 13:41:50 UTC (rev 3121)
@@ -22,6 +22,7 @@
import org.exoplatform.services.jcr.datamodel.NodeData;
import org.exoplatform.services.jcr.datamodel.PropertyData;
import org.exoplatform.services.jcr.datamodel.QPathEntry;
+import org.exoplatform.services.jcr.impl.core.ItemImpl.ItemType;
import java.util.List;
@@ -41,13 +42,17 @@
public static final String LIVE_TIME_PARAMETER_NAME = "live-time";
/**
- * Get item by parent identifier and name +index.
+ * Get item by parent identifier and name +index of define type.
*
* @param parentIdentifier
- * @param path
- * @return itemData by parent Identifier and item name with index or null if not found
+ * parent identifier
+ * @param name
+ * item name
+ * @param itemType
+ * item type
+ * @return itemData by parent Identifier and item name with index of define type or null in other case
*/
- ItemData get(String parentIdentifier, QPathEntry name);
+ ItemData get(String parentIdentifier, QPathEntry name, ItemType itemType);
/**
* Get item by identifier.
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/ItemImpl.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/ItemImpl.java 2010-09-16 11:23:57 UTC (rev 3120)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/ItemImpl.java 2010-09-16 13:41:50 UTC (rev 3121)
@@ -387,7 +387,8 @@
if (ntManager.isNodeType(Constants.MIX_VERSIONABLE, node.getPrimaryTypeName(), node.getMixinTypeNames()))
{
- ItemData vhpd = dataManager.getItemData(node, new QPathEntry(Constants.JCR_VERSIONHISTORY, 1));
+ ItemData vhpd =
+ dataManager.getItemData(node, new QPathEntry(Constants.JCR_VERSIONHISTORY, 1), ItemType.PROPERTY);
if (vhpd != null && !vhpd.isNode())
{
try
@@ -435,8 +436,8 @@
PropertyImpl prevProp;
PropertyDefinitionDatas defs;
ItemImpl prevItem =
- dataManager.getItem(parentNode.nodeData(), new QPathEntry(propertyName, 0), true, dataManager.isNew(parentNode
- .getIdentifier()));
+ dataManager.getItem(parentNode.nodeData(), new QPathEntry(propertyName, 0), true,
+ dataManager.isNew(parentNode.getIdentifier()), ItemType.PROPERTY);
NodeTypeDataManager ntm = session.getWorkspace().getNodeTypesHolder();
NodeData parentData = (NodeData)parentNode.getData();
@@ -450,8 +451,8 @@
{
// new property null values;
TransientPropertyData nullData =
- new TransientPropertyData(qpath, identifier, version, PropertyType.UNDEFINED, parentNode
- .getInternalIdentifier(), isMultiValue);
+ new TransientPropertyData(qpath, identifier, version, PropertyType.UNDEFINED,
+ parentNode.getInternalIdentifier(), isMultiValue);
PropertyImpl nullProperty = new PropertyImpl(nullData, session);
nullProperty.invalidate();
return nullProperty;
@@ -659,8 +660,8 @@
NodeData refNode = (NodeData)changedItem.getData();
// Check referential integrity (remove of mix:referenceable node)
- if (ntManager.isNodeType(Constants.MIX_REFERENCEABLE, refNode.getPrimaryTypeName(), refNode
- .getMixinTypeNames()))
+ if (ntManager.isNodeType(Constants.MIX_REFERENCEABLE, refNode.getPrimaryTypeName(),
+ refNode.getMixinTypeNames()))
{
// mix:referenceable
@@ -984,8 +985,8 @@
throws RepositoryException
{
ValueConstraintsMatcher constraints =
- new ValueConstraintsMatcher(def.getValueConstraints(), session.getLocationFactory(), session
- .getTransientNodesManager(), session.getWorkspace().getNodeTypesHolder());
+ new ValueConstraintsMatcher(def.getValueConstraints(), session.getLocationFactory(),
+ session.getTransientNodesManager(), session.getWorkspace().getNodeTypesHolder());
for (ValueData value : newValues)
{
@@ -1012,4 +1013,36 @@
}
}
}
+
+ /**
+ * Class contains enumerated item types. Is used in methods to indicate what need exactly get: node or property.
+ */
+ public enum ItemType {
+ UNKNOWN, NODE, PROPERTY;
+
+ /**
+ * Indicate if item type suit for ItemData.
+ *
+ * @param itemData
+ * ItemData
+ * @return true if item type is UNKNOWN type or the same as ItemData and false in other case
+ */
+ public boolean isSuitableFor(ItemData itemData)
+ {
+ boolean isNode = itemData.isNode();
+ return this == UNKNOWN || this == NODE && isNode || this == PROPERTY && !isNode;
+ }
+
+ /**
+ * Return item type based on ItemData.
+ *
+ * @param itemData
+ * item data
+ * @return ItemType
+ */
+ public static ItemType getItemType(ItemData itemData)
+ {
+ return itemData.isNode() ? ItemType.NODE : ItemType.PROPERTY;
+ }
+ }
}
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/NamespaceDataPersister.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/NamespaceDataPersister.java 2010-09-16 11:23:57 UTC (rev 3120)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/NamespaceDataPersister.java 2010-09-16 13:41:50 UTC (rev 3121)
@@ -36,6 +36,7 @@
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.core.ItemImpl.ItemType;
import org.exoplatform.services.jcr.impl.dataflow.TransientItemData;
import org.exoplatform.services.jcr.impl.dataflow.TransientNodeData;
import org.exoplatform.services.jcr.impl.dataflow.TransientPropertyData;
@@ -185,7 +186,8 @@
}
PlainChangesLogImpl plainChangesLogImpl = new PlainChangesLogImpl();
- ItemData prefData = dataManager.getItemData(nsRoot, new QPathEntry(new InternalQName("", prefix), 0));
+ ItemData prefData =
+ dataManager.getItemData(nsRoot, new QPathEntry(new InternalQName("", prefix), 0), ItemType.NODE);
if (prefData != null && prefData.isNode())
{
@@ -220,12 +222,14 @@
if (jcrSystem != null)
{
NodeData exoNamespaces =
- (NodeData)dataManager.getItemData(jcrSystem, new QPathEntry(Constants.EXO_NAMESPACES, 1));
+ (NodeData)dataManager.getItemData(jcrSystem, new QPathEntry(Constants.EXO_NAMESPACES, 1),
+ ItemType.NODE);
if (exoNamespaces == null)
{
initStorage(jcrSystem, !repConfig.getAccessControl().equals(AccessControlPolicy.DISABLE));
this.nsRoot =
- (NodeData)dataManager.getItemData(jcrSystem, new QPathEntry(Constants.EXO_NAMESPACES, 1));
+ (NodeData)dataManager.getItemData(jcrSystem, new QPathEntry(Constants.EXO_NAMESPACES, 1),
+ ItemType.NODE);
}
else
{
@@ -264,7 +268,8 @@
{
NodeData jcrSystem = (NodeData)dataManager.getItemData(Constants.SYSTEM_UUID);
if (jcrSystem != null)
- this.nsRoot = (NodeData)dataManager.getItemData(jcrSystem, new QPathEntry(Constants.EXO_NAMESPACES, 1));
+ this.nsRoot =
+ (NodeData)dataManager.getItemData(jcrSystem, new QPathEntry(Constants.EXO_NAMESPACES, 1), ItemType.NODE);
else
throw new RepositoryException(
"/jcr:system is not found. Possible the workspace is not initialized properly");
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/NodeImpl.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/NodeImpl.java 2010-09-16 11:23:57 UTC (rev 3120)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/NodeImpl.java 2010-09-16 13:41:50 UTC (rev 3121)
@@ -217,8 +217,8 @@
}
// Validate
- if (session.getWorkspace().getNodeTypesHolder().isNodeType(type.getName(), nodeData().getPrimaryTypeName(),
- nodeData().getMixinTypeNames()))
+ if (session.getWorkspace().getNodeTypesHolder()
+ .isNodeType(type.getName(), nodeData().getPrimaryTypeName(), nodeData().getMixinTypeNames()))
{
throw new ConstraintViolationException("Can not add mixin type " + mixinName + " to " + getPath());
}
@@ -267,7 +267,8 @@
}
ItemImpl parentItem =
- dataManager.getItem(nodeData(), itemPath.makeParentPath().getInternalPath().getEntries(), false);
+ dataManager.getItem(nodeData(), itemPath.makeParentPath().getInternalPath().getEntries(), false,
+ ItemType.UNKNOWN);
if (parentItem == null)
{
@@ -283,8 +284,8 @@
// find node type
NodeDefinitionData nodeDef =
- session.getWorkspace().getNodeTypesHolder().getChildNodeDefinition(name, nodeData().getPrimaryTypeName(),
- nodeData().getMixinTypeNames());
+ session.getWorkspace().getNodeTypesHolder()
+ .getChildNodeDefinition(name, nodeData().getPrimaryTypeName(), nodeData().getMixinTypeNames());
if (nodeDef == null)
{
@@ -326,7 +327,8 @@
}
ItemImpl parentItem =
- dataManager.getItem(nodeData(), itemPath.makeParentPath().getInternalPath().getEntries(), false);
+ dataManager.getItem(nodeData(), itemPath.makeParentPath().getInternalPath().getEntries(), false,
+ ItemType.UNKNOWN);
if (parentItem == null)
{
@@ -354,16 +356,16 @@
checkValid();
NodeTypeData type =
- session.getWorkspace().getNodeTypesHolder().getNodeType(
- locationFactory.parseJCRName(mixinName).getInternalName());
+ session.getWorkspace().getNodeTypesHolder()
+ .getNodeType(locationFactory.parseJCRName(mixinName).getInternalName());
if (type == null)
{
throw new NoSuchNodeTypeException("Nodetype not found (mixin) " + mixinName);
}
- if (session.getWorkspace().getNodeTypesHolder().isNodeType(type.getName(), nodeData().getPrimaryTypeName(),
- nodeData().getMixinTypeNames()))
+ if (session.getWorkspace().getNodeTypesHolder()
+ .isNodeType(type.getName(), nodeData().getPrimaryTypeName(), nodeData().getMixinTypeNames()))
{
return false;
}
@@ -418,7 +420,8 @@
if (vancestor != null)
{
PropertyData isCheckedOut =
- (PropertyData)dataManager.getItemData(vancestor, new QPathEntry(Constants.JCR_ISCHECKEDOUT, 1));
+ (PropertyData)dataManager.getItemData(vancestor, new QPathEntry(Constants.JCR_ISCHECKEDOUT, 1),
+ ItemType.PROPERTY);
try
{
return ValueDataConvertor.readBoolean(isCheckedOut.getValues().get(0));
@@ -518,8 +521,8 @@
new TransientValueData(true))));
ValueData baseVersion =
- ((PropertyData)dataManager.getItemData(nodeData(), new QPathEntry(Constants.JCR_BASEVERSION, 0))).getValues()
- .get(0);
+ ((PropertyData)dataManager.getItemData(nodeData(), new QPathEntry(Constants.JCR_BASEVERSION, 0),
+ ItemType.PROPERTY)).getValues().get(0);
changesLog.add(ItemState.createUpdatedState(updatePropertyData(Constants.JCR_PREDECESSORS, baseVersion)));
@@ -602,7 +605,8 @@
values.add(new TransientValueData(type.getName()));
PropertyData prop =
- (PropertyData)dataManager.getItemData(((NodeData)getData()), new QPathEntry(Constants.JCR_MIXINTYPES, 0));
+ (PropertyData)dataManager.getItemData(((NodeData)getData()), new QPathEntry(Constants.JCR_MIXINTYPES, 0),
+ ItemType.PROPERTY);
ItemState state;
if (prop != null)
@@ -738,7 +742,8 @@
}
PropertyData bvProp =
- (PropertyData)dataManager.getItemData(nodeData(), new QPathEntry(Constants.JCR_BASEVERSION, 1));
+ (PropertyData)dataManager.getItemData(nodeData(), new QPathEntry(Constants.JCR_BASEVERSION, 1),
+ ItemType.PROPERTY);
try
{
return (Version)session.getNodeByUUID(ValueDataConvertor.readString(bvProp.getValues().get(0)));
@@ -782,9 +787,9 @@
NodeData ancestor = (NodeData)dataManager.getItemData(Constants.ROOT_UUID);
for (int i = 1; i < myPath.getDepth(); i++)
{
- ancestor = (NodeData)dataManager.getItemData(ancestor, myPath.getEntries()[i]);
- if (corrSession.getWorkspace().getNodeTypesHolder().isNodeType(Constants.MIX_REFERENCEABLE,
- ancestor.getPrimaryTypeName(), ancestor.getMixinTypeNames()))
+ ancestor = (NodeData)dataManager.getItemData(ancestor, myPath.getEntries()[i], ItemType.NODE);
+ if (corrSession.getWorkspace().getNodeTypesHolder()
+ .isNodeType(Constants.MIX_REFERENCEABLE, ancestor.getPrimaryTypeName(), ancestor.getMixinTypeNames()))
{
NodeData corrAncestor = (NodeData)corrDataManager.getItemData(ancestor.getIdentifier());
if (corrAncestor == null)
@@ -794,7 +799,8 @@
}
NodeData corrNode =
- (NodeData)corrDataManager.getItemData(corrAncestor, myPath.getRelPath(myPath.getDepth() - i));
+ (NodeData)corrDataManager.getItemData(corrAncestor, myPath.getRelPath(myPath.getDepth() - i),
+ ItemType.NODE);
if (corrNode != null)
{
return corrNode;
@@ -852,8 +858,8 @@
new NodeDefinitionData(null, null, true, true, OnParentVersionAction.ABORT, false,
new InternalQName[]{requiredName}, null, true);
this.nodeDefinition =
- new NodeDefinitionImpl(ntData, nodeTypesHolder, nodeTypeManager, sysLocFactory, session
- .getValueFactory(), session.getTransientNodesManager());
+ new NodeDefinitionImpl(ntData, nodeTypesHolder, nodeTypeManager, sysLocFactory,
+ session.getValueFactory(), session.getTransientNodesManager());
}
}
else
@@ -862,8 +868,8 @@
NodeData parent = (NodeData)dataManager.getItemData(getParentIdentifier());
this.definition =
- nodeTypesHolder.getChildNodeDefinition(getInternalName(), parent.getPrimaryTypeName(), parent
- .getMixinTypeNames());
+ nodeTypesHolder.getChildNodeDefinition(getInternalName(), parent.getPrimaryTypeName(),
+ parent.getMixinTypeNames());
if (definition == null)
{
@@ -879,8 +885,8 @@
}
nodeDefinition =
- new NodeDefinitionImpl(definition, nodeTypesHolder, nodeTypeManager, sysLocFactory, session
- .getValueFactory(), session.getTransientNodesManager());
+ new NodeDefinitionImpl(definition, nodeTypesHolder, nodeTypeManager, sysLocFactory,
+ session.getValueFactory(), session.getTransientNodesManager());
}
}
@@ -970,7 +976,7 @@
JCRPath itemPath = locationFactory.parseRelPath(relPath);
- ItemImpl node = dataManager.getItem(nodeData(), itemPath.getInternalPath().getEntries(), true);
+ ItemImpl node = dataManager.getItem(nodeData(), itemPath.getInternalPath().getEntries(), true, ItemType.NODE);
if (node == null || !node.isNode())
{
throw new PathNotFoundException("Node not found " + (isRoot() ? "" : getLocation().getAsString(false)) + "/"
@@ -1114,7 +1120,8 @@
{
if (ntData.getPrimaryItemName() != null)
{
- Item primaryItem = dataManager.getItem(nodeData(), new QPathEntry(ntData.getPrimaryItemName(), 0), true);
+ Item primaryItem =
+ dataManager.getItem(nodeData(), new QPathEntry(ntData.getPrimaryItemName(), 0), true, ItemType.UNKNOWN);
if (primaryItem != null)
{
return primaryItem;
@@ -1266,7 +1273,7 @@
LOG.debug("getProperty() " + getLocation().getAsString(false) + " " + relPath);
}
- ItemImpl prop = dataManager.getItem(nodeData(), itemPath.getInternalPath().getEntries(), true);
+ ItemImpl prop = dataManager.getItem(nodeData(), itemPath.getInternalPath().getEntries(), true, ItemType.PROPERTY);
if (prop == null || prop.isNode())
{
throw new PathNotFoundException("Property not found " + itemPath.getAsString(false));
@@ -1365,7 +1372,7 @@
JCRPath itemPath = locationFactory.parseRelPath(relPath);
- ItemData node = dataManager.getItemData(nodeData(), itemPath.getInternalPath().getEntries());
+ ItemData node = dataManager.getItemData(nodeData(), itemPath.getInternalPath().getEntries(), ItemType.NODE);
return node != null && node.isNode();
}
@@ -1401,7 +1408,7 @@
JCRPath itemPath = locationFactory.parseRelPath(relPath);
- ItemData prop = dataManager.getItemData(nodeData(), itemPath.getInternalPath().getEntries());
+ ItemData prop = dataManager.getItemData(nodeData(), itemPath.getInternalPath().getEntries(), ItemType.PROPERTY);
return prop != null && !prop.isNode();
}
@@ -1460,8 +1467,8 @@
{
checkValid();
- return session.getWorkspace().getNodeTypesHolder().isNodeType(qName, nodeData().getPrimaryTypeName(),
- nodeData().getMixinTypeNames());
+ return session.getWorkspace().getNodeTypesHolder()
+ .isNodeType(qName, nodeData().getPrimaryTypeName(), nodeData().getMixinTypeNames());
}
/**
@@ -1551,8 +1558,8 @@
}
this.definition =
- session.getWorkspace().getNodeTypesHolder().getChildNodeDefinition(getInternalName(),
- parent.getPrimaryTypeName(), parent.getMixinTypeNames());
+ session.getWorkspace().getNodeTypesHolder()
+ .getChildNodeDefinition(getInternalName(), parent.getPrimaryTypeName(), parent.getMixinTypeNames());
if (definition == null)
{
@@ -1766,7 +1773,8 @@
session.getActionHandler().preRemoveMixin(this, name);
PropertyData propData =
- (PropertyData)dataManager.getItemData(nodeData(), new QPathEntry(Constants.JCR_MIXINTYPES, 0));
+ (PropertyData)dataManager.getItemData(nodeData(), new QPathEntry(Constants.JCR_MIXINTYPES, 0),
+ ItemType.PROPERTY);
// create new property data with new values
TransientPropertyData prop =
@@ -1795,7 +1803,7 @@
for (PropertyDefinitionData pd : ntmanager.getAllPropertyDefinitions(removedName))
{
- ItemData p = dataManager.getItemData(nodeData(), new QPathEntry(pd.getName(), 1));
+ ItemData p = dataManager.getItemData(nodeData(), new QPathEntry(pd.getName(), 1), ItemType.PROPERTY);
if (p != null && !p.isNode())
{
// remove it
@@ -1805,7 +1813,7 @@
for (NodeDefinitionData nd : ntmanager.getAllChildNodeDefinitions(removedName))
{
- ItemData n = dataManager.getItemData(nodeData(), new QPathEntry(nd.getName(), 1));
+ ItemData n = dataManager.getItemData(nodeData(), new QPathEntry(nd.getName(), 1), ItemType.NODE);
if (n != null && n.isNode())
{
// remove node with subtree
@@ -1951,7 +1959,8 @@
}
QPath destPath = locationFactory.parseRelPath(relPath).getInternalPath();
- NodeImpl destParent = (NodeImpl)dataManager.getItem(nodeData(), destPath.makeParentPath().getEntries(), false);
+ NodeImpl destParent =
+ (NodeImpl)dataManager.getItem(nodeData(), destPath.makeParentPath().getEntries(), false, ItemType.UNKNOWN);
if (destParent == null)
{
throw new PathNotFoundException("Parent not found for " + relPath);
@@ -1964,7 +1973,7 @@
NodeImpl destNode =
(NodeImpl)dataManager.getItem(destParent.nodeData(),
- new QPathEntry(destPath.getName(), destPath.getIndex()), false);
+ new QPathEntry(destPath.getName(), destPath.getIndex()), false, ItemType.NODE);
if (destNode != null)
{
@@ -2114,8 +2123,8 @@
checkValid();
- return doUpdateProperty(this, locationFactory.parseJCRName(name).getInternalName(), valueFactory
- .createValue(value), false, PropertyType.UNDEFINED);
+ return doUpdateProperty(this, locationFactory.parseJCRName(name).getInternalName(),
+ valueFactory.createValue(value), false, PropertyType.UNDEFINED);
}
@@ -2128,8 +2137,8 @@
checkValid();
- return doUpdateProperty(this, locationFactory.parseJCRName(name).getInternalName(), valueFactory
- .createValue(value), false, PropertyType.UNDEFINED);
+ return doUpdateProperty(this, locationFactory.parseJCRName(name).getInternalName(),
+ valueFactory.createValue(value), false, PropertyType.UNDEFINED);
}
@@ -2142,8 +2151,8 @@
checkValid();
- return doUpdateProperty(this, locationFactory.parseJCRName(name).getInternalName(), valueFactory
- .createValue(value), false, PropertyType.UNDEFINED);
+ return doUpdateProperty(this, locationFactory.parseJCRName(name).getInternalName(),
+ valueFactory.createValue(value), false, PropertyType.UNDEFINED);
}
/**
@@ -2155,8 +2164,8 @@
checkValid();
- return doUpdateProperty(this, locationFactory.parseJCRName(name).getInternalName(), valueFactory
- .createValue(value), false, PropertyType.UNDEFINED);
+ return doUpdateProperty(this, locationFactory.parseJCRName(name).getInternalName(),
+ valueFactory.createValue(value), false, PropertyType.UNDEFINED);
}
/**
@@ -2168,8 +2177,8 @@
checkValid();
- return doUpdateProperty(this, locationFactory.parseJCRName(name).getInternalName(), valueFactory
- .createValue(value), false, PropertyType.UNDEFINED);
+ return doUpdateProperty(this, locationFactory.parseJCRName(name).getInternalName(),
+ valueFactory.createValue(value), false, PropertyType.UNDEFINED);
}
@@ -2182,8 +2191,8 @@
checkValid();
- return doUpdateProperty(this, locationFactory.parseJCRName(name).getInternalName(), valueFactory
- .createValue(value), false, PropertyType.UNDEFINED);
+ return doUpdateProperty(this, locationFactory.parseJCRName(name).getInternalName(),
+ valueFactory.createValue(value), false, PropertyType.UNDEFINED);
}
@@ -2196,8 +2205,8 @@
checkValid();
- return doUpdateProperty(this, locationFactory.parseJCRName(name).getInternalName(), valueFactory
- .createValue(value), false, PropertyType.UNDEFINED);
+ return doUpdateProperty(this, locationFactory.parseJCRName(name).getInternalName(),
+ valueFactory.createValue(value), false, PropertyType.UNDEFINED);
}
@@ -2210,8 +2219,8 @@
checkValid();
- return doUpdateProperty(this, locationFactory.parseJCRName(name).getInternalName(), valueFactory.createValue(
- value, type), false, type);
+ return doUpdateProperty(this, locationFactory.parseJCRName(name).getInternalName(),
+ valueFactory.createValue(value, type), false, type);
}
/**
@@ -2386,7 +2395,7 @@
NodeData thisParent = (NodeData)session.getTransientNodesManager().getItemData(getParentIdentifier());
QPathEntry[] qpath = getInternalPath().getEntries();
- NodeData thisNew = (NodeData)pmanager.getItemData(thisParent, qpath[qpath.length - 1]);
+ NodeData thisNew = (NodeData)pmanager.getItemData(thisParent, qpath[qpath.length - 1], ItemType.NODE);
// reload node impl with old uuid to a new one data
session.getTransientNodesManager().getItemsPool().reload(getInternalIdentifier(), thisNew);
}
@@ -2422,8 +2431,8 @@
}
// Check if node is not protected
NodeDefinitionData childNodeDefinition =
- session.getWorkspace().getNodeTypesHolder().getChildNodeDefinition(name, nodeData().getPrimaryTypeName(),
- nodeData().getMixinTypeNames());
+ session.getWorkspace().getNodeTypesHolder()
+ .getChildNodeDefinition(name, nodeData().getPrimaryTypeName(), nodeData().getMixinTypeNames());
if (childNodeDefinition == null)
{
throw new ConstraintViolationException("Can't find child node definition for "
@@ -2472,7 +2481,8 @@
}
PropertyData vhProp =
- (PropertyData)dataManager.getItemData(nodeData(), new QPathEntry(Constants.JCR_VERSIONHISTORY, 1));
+ (PropertyData)dataManager.getItemData(nodeData(), new QPathEntry(Constants.JCR_VERSIONHISTORY, 1),
+ ItemType.PROPERTY);
if (vhProp == null)
{
throw new UnsupportedRepositoryOperationException("Node does not have jcr:versionHistory " + getPath());
@@ -2639,16 +2649,16 @@
QPath.makeChildPath(newData.getQPath().makeParentPath(), newData.getQPath().getName(), sameNameIndex);
newData =
- new TransientNodeData(siblingPath, newData.getIdentifier(), newData.getPersistedVersion(), newData
- .getPrimaryTypeName(), newData.getMixinTypeNames(), j, newData.getParentIdentifier(), newData
- .getACL());
+ new TransientNodeData(siblingPath, newData.getIdentifier(), newData.getPersistedVersion(),
+ newData.getPrimaryTypeName(), newData.getMixinTypeNames(), j, newData.getParentIdentifier(),
+ newData.getACL());
}
else
{
newData =
new TransientNodeData(newData.getQPath(), newData.getIdentifier(), newData.getPersistedVersion(),
- newData.getPrimaryTypeName(), newData.getMixinTypeNames(), j, newData.getParentIdentifier(), newData
- .getACL());
+ newData.getPrimaryTypeName(), newData.getMixinTypeNames(), j, newData.getParentIdentifier(),
+ newData.getACL());
}
/*
@@ -2696,11 +2706,13 @@
PlainChangesLog changesLog =
new PlainChangesLogImpl(new ArrayList<ItemState>(), session.getId(), ExtendedEvent.UNLOCK);
- ItemData lockOwner = dataManager.getItemData(nodeData(), new QPathEntry(Constants.JCR_LOCKOWNER, 0));
+ ItemData lockOwner =
+ dataManager.getItemData(nodeData(), new QPathEntry(Constants.JCR_LOCKOWNER, 0), ItemType.PROPERTY);
changesLog.add(ItemState.createDeletedState(lockOwner));
- ItemData lockIsDeep = dataManager.getItemData(nodeData(), new QPathEntry(Constants.JCR_LOCKISDEEP, 0));
+ ItemData lockIsDeep =
+ dataManager.getItemData(nodeData(), new QPathEntry(Constants.JCR_LOCKISDEEP, 0), ItemType.PROPERTY);
changesLog.add(ItemState.createDeletedState(lockIsDeep));
@@ -2715,7 +2727,8 @@
protected PropertyImpl property(InternalQName name) throws IllegalPathException, PathNotFoundException,
RepositoryException
{
- PropertyImpl prop = (PropertyImpl)dataManager.getItem(nodeData(), new QPathEntry(name, 1), false);
+ PropertyImpl prop =
+ (PropertyImpl)dataManager.getItem(nodeData(), new QPathEntry(name, 1), false, ItemType.PROPERTY);
if (prop == null || prop.isNode())
{
throw new PathNotFoundException("Property not found " + name);
@@ -2744,7 +2757,8 @@
protected PropertyData updatePropertyData(InternalQName name, List<ValueData> values) throws RepositoryException
{
- PropertyData existed = (PropertyData)dataManager.getItemData(nodeData(), new QPathEntry(name, 0));
+ PropertyData existed =
+ (PropertyData)dataManager.getItemData(nodeData(), new QPathEntry(name, 0), ItemType.PROPERTY);
if (existed == null)
{
@@ -2758,8 +2772,9 @@
}
TransientPropertyData tdata =
- new TransientPropertyData(QPath.makeChildPath(getInternalPath(), name), existed.getIdentifier(), existed
- .getPersistedVersion(), existed.getType(), existed.getParentIdentifier(), existed.isMultiValued(), values);
+ new TransientPropertyData(QPath.makeChildPath(getInternalPath(), name), existed.getIdentifier(),
+ existed.getPersistedVersion(), existed.getType(), existed.getParentIdentifier(), existed.isMultiValued(),
+ values);
return tdata;
}
@@ -2767,7 +2782,8 @@
protected PropertyData updatePropertyData(InternalQName name, ValueData value) throws RepositoryException
{
- PropertyData existed = (PropertyData)dataManager.getItemData(nodeData(), new QPathEntry(name, 0));
+ PropertyData existed =
+ (PropertyData)dataManager.getItemData(nodeData(), new QPathEntry(name, 0), ItemType.PROPERTY);
if (existed == null)
{
@@ -2776,8 +2792,9 @@
}
TransientPropertyData tdata =
- new TransientPropertyData(QPath.makeChildPath(getInternalPath(), name), existed.getIdentifier(), existed
- .getPersistedVersion(), existed.getType(), existed.getParentIdentifier(), existed.isMultiValued(), value);
+ new TransientPropertyData(QPath.makeChildPath(getInternalPath(), name), existed.getIdentifier(),
+ existed.getPersistedVersion(), existed.getType(), existed.getParentIdentifier(), existed.isMultiValued(),
+ value);
return tdata;
}
@@ -2824,7 +2841,8 @@
EntityCollection res = new EntityCollection();
TransientPropertyData mergeFailed =
- (TransientPropertyData)dataManager.getItemData(nodeData(), new QPathEntry(Constants.JCR_MERGEFAILED, 0));
+ (TransientPropertyData)dataManager.getItemData(nodeData(), new QPathEntry(Constants.JCR_MERGEFAILED, 0),
+ ItemType.PROPERTY);
List<ValueData> mergeFailedRefs = new ArrayList<ValueData>();
int state = 0;
@@ -2838,9 +2856,9 @@
}
mergeFailed =
- new TransientPropertyData(mergeFailed.getQPath(), mergeFailed.getIdentifier(), mergeFailed
- .getPersistedVersion(), mergeFailed.getType(), mergeFailed.getParentIdentifier(), mergeFailed
- .isMultiValued(), mergeFailedRefs);
+ new TransientPropertyData(mergeFailed.getQPath(), mergeFailed.getIdentifier(),
+ mergeFailed.getPersistedVersion(), mergeFailed.getType(), mergeFailed.getParentIdentifier(),
+ mergeFailed.isMultiValued(), mergeFailedRefs);
state = ItemState.UPDATED;
}
@@ -2894,20 +2912,20 @@
{
NodeDefinitionData def =
- session.getWorkspace().getNodeTypesHolder().getChildNodeDefinition(nameToAdd, parentNode.getPrimaryTypeName(),
- parentNode.getMixinTypeNames());
+ session.getWorkspace().getNodeTypesHolder()
+ .getChildNodeDefinition(nameToAdd, parentNode.getPrimaryTypeName(), parentNode.getMixinTypeNames());
boolean allowSns = def.isAllowsSameNameSiblings();
int ind = 1;
- NodeData sibling = (NodeData)dataManager.getItemData(parentNode, new QPathEntry(nameToAdd, ind));
+ NodeData sibling = (NodeData)dataManager.getItemData(parentNode, new QPathEntry(nameToAdd, ind), ItemType.NODE);
while (sibling != null)
{
if (allowSns)
{
ind++;
- sibling = (NodeData)dataManager.getItemData(parentNode, new QPathEntry(nameToAdd, ind));
+ sibling = (NodeData)dataManager.getItemData(parentNode, new QPathEntry(nameToAdd, ind), ItemType.NODE);
}
else
{
@@ -2953,8 +2971,8 @@
// create new nodedata, [PN] fix of use index as persisted version
NodeData nodeData =
- new TransientNodeData(path, identifier, -1, primaryTypeName, mixinTypeNames, orderNum, parentNode
- .getInternalIdentifier(), acl);
+ new TransientNodeData(path, identifier, -1, primaryTypeName, mixinTypeNames, orderNum,
+ parentNode.getInternalIdentifier(), acl);
// Create new Node
ItemState state = ItemState.createAddedState(nodeData, false);
@@ -2987,7 +3005,7 @@
{
try
{
- ItemData pdata = dataManager.getItemData(nodeData(), new QPathEntry(name, 1));
+ ItemData pdata = dataManager.getItemData(nodeData(), new QPathEntry(name, 1), ItemType.PROPERTY);
if (pdata != null && !pdata.isNode())
{
@@ -3004,7 +3022,8 @@
{
PropertyData mergeFailed =
- (PropertyData)dataManager.getItemData(nodeData(), new QPathEntry(Constants.JCR_MERGEFAILED, 0));
+ (PropertyData)dataManager.getItemData(nodeData(), new QPathEntry(Constants.JCR_MERGEFAILED, 0),
+ ItemType.PROPERTY);
if (mergeFailed == null)
{
@@ -3041,9 +3060,10 @@
// to jcr:predecessors (with doneMerge) or just removed from
// jcr:mergeFailed (with cancelMerge) the jcr:mergeFailed
// property is automatically remove
- changesLog.add(ItemState.createDeletedState(new TransientPropertyData(mergeFailed.getQPath(), mergeFailed
- .getIdentifier(), mergeFailed.getPersistedVersion(), mergeFailed.getType(), mergeFailed
- .getParentIdentifier(), mergeFailed.isMultiValued(), mergeFailed.getValues()), true));
+ changesLog.add(ItemState.createDeletedState(
+ new TransientPropertyData(mergeFailed.getQPath(), mergeFailed.getIdentifier(), mergeFailed
+ .getPersistedVersion(), mergeFailed.getType(), mergeFailed.getParentIdentifier(), mergeFailed
+ .isMultiValued(), mergeFailed.getValues()), true));
}
}
@@ -3051,9 +3071,9 @@
{
NodeData nodeData = (NodeData)data;
data =
- new TransientNodeData(nodeData.getQPath(), nodeData.getIdentifier(), nodeData.getPersistedVersion(), nodeData
- .getPrimaryTypeName(), nodeData.getMixinTypeNames(), nodeData.getOrderNumber(), nodeData
- .getParentIdentifier(), acl);
+ new TransientNodeData(nodeData.getQPath(), nodeData.getIdentifier(), nodeData.getPersistedVersion(),
+ nodeData.getPrimaryTypeName(), nodeData.getMixinTypeNames(), nodeData.getOrderNumber(),
+ nodeData.getParentIdentifier(), acl);
}
private void updateMixin(List<InternalQName> newMixin) throws RepositoryException
@@ -3064,8 +3084,9 @@
NodeData nodeData = (NodeData)data;
data =
- new TransientNodeData(nodeData.getQPath(), nodeData.getIdentifier(), nodeData.getPersistedVersion(), nodeData
- .getPrimaryTypeName(), mixins, nodeData.getOrderNumber(), nodeData.getParentIdentifier(), nodeData.getACL());
+ new TransientNodeData(nodeData.getQPath(), nodeData.getIdentifier(), nodeData.getPersistedVersion(),
+ nodeData.getPrimaryTypeName(), mixins, nodeData.getOrderNumber(), nodeData.getParentIdentifier(),
+ nodeData.getACL());
// ((TransientNodeData)data).setMixinTypeNames(mixins);
@@ -3085,7 +3106,8 @@
}
PropertyData permProp =
- (PropertyData)dataManager.getItemData(nodeData(), new QPathEntry(Constants.EXO_PERMISSIONS, 0));
+ (PropertyData)dataManager.getItemData(nodeData(), new QPathEntry(Constants.EXO_PERMISSIONS, 0),
+ ItemType.PROPERTY);
permProp =
new TransientPropertyData(permProp.getQPath(), permProp.getIdentifier(), permProp.getPersistedVersion(),
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/SessionDataManager.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/SessionDataManager.java 2010-09-16 11:23:57 UTC (rev 3120)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/SessionDataManager.java 2010-09-16 13:41:50 UTC (rev 3121)
@@ -34,6 +34,7 @@
import org.exoplatform.services.jcr.datamodel.QPath;
import org.exoplatform.services.jcr.datamodel.QPathEntry;
import org.exoplatform.services.jcr.impl.Constants;
+import org.exoplatform.services.jcr.impl.core.ItemImpl.ItemType;
import org.exoplatform.services.jcr.impl.core.nodetype.NodeTypeManagerImpl;
import org.exoplatform.services.jcr.impl.core.version.ChildVersionRemoveVisitor;
import org.exoplatform.services.jcr.impl.core.version.VersionHistoryImpl;
@@ -158,7 +159,7 @@
QPathEntry[] relPathEntries = path.getRelPath(path.getDepth());
- return getItemData(parent, relPathEntries);
+ return getItemData(parent, relPathEntries, ItemType.UNKNOWN);
}
/**
@@ -168,15 +169,25 @@
* @param parent
* @param relPath
* - array of QPathEntry which represents the relation path to the searched item
+ * @param itemType
+ * - item type
* @return existed item data or null if not found
* @throws RepositoryException
*/
- public ItemData getItemData(NodeData parent, QPathEntry[] relPathEntries) throws RepositoryException
+ public ItemData getItemData(NodeData parent, QPathEntry[] relPathEntries, ItemType itemType)
+ throws RepositoryException
{
ItemData item = parent;
for (int i = 0; i < relPathEntries.length; i++)
{
- item = getItemData(parent, relPathEntries[i]);
+ if (i == relPathEntries.length - 1)
+ {
+ item = getItemData(parent, relPathEntries[i], itemType);
+ }
+ else
+ {
+ item = getItemData(parent, relPathEntries[i], ItemType.UNKNOWN);
+ }
if (item == null)
{
@@ -198,15 +209,12 @@
/**
* {@inheritDoc}
*/
- public ItemData getItemData(NodeData parent, QPathEntry name) throws RepositoryException
+ public ItemData getItemData(NodeData parent, QPathEntry name, ItemType itemType) throws RepositoryException
{
- return getItemData(parent, name, false);
+ return getItemData(parent, name, false, itemType);
}
- /**
- * {@inheritDoc}
- */
- private ItemData getItemData(NodeData parent, QPathEntry name, boolean skipCheckInPersistence)
+ private ItemData getItemData(NodeData parent, QPathEntry name, boolean skipCheckInPersistence, ItemType itemType)
throws RepositoryException
{
if (name.getName().equals(JCRPath.PARENT_RELPATH) && name.getNamespace().equals(Constants.NS_DEFAULT_URI))
@@ -224,13 +232,13 @@
ItemData data = null;
// 1. Try in transient changes
- ItemState state = changesLog.getItemState(parent, name);
+ ItemState state = changesLog.getItemState(parent, name, itemType);
if (state == null)
{
// 2. Try from txdatamanager
if (!(skipCheckInPersistence))
{
- data = transactionableManager.getItemData(parent, name);
+ data = transactionableManager.getItemData(parent, name, itemType);
}
}
else if (!state.isDeleted())
@@ -272,12 +280,15 @@
* - parent of the searched item
* @param name
* - item name
+ * @param itemType
+ * - item type
* @param pool
* - indicates does the item fall in pool
* @return existed item or null if not found
* @throws RepositoryException
*/
- public ItemImpl getItem(NodeData parent, QPathEntry name, boolean pool) throws RepositoryException
+ public ItemImpl getItem(NodeData parent, QPathEntry name, boolean pool, ItemType itemType)
+ throws RepositoryException
{
long start = System.currentTimeMillis();
if (log.isDebugEnabled())
@@ -288,7 +299,7 @@
ItemImpl item = null;
try
{
- return item = readItem(getItemData(parent, name), pool);
+ return item = readItem(getItemData(parent, name, itemType), pool);
}
finally
{
@@ -312,11 +323,13 @@
* - indicates does the item fall in pool
* @param skipCheckInPersistence
* - skip getting Item from persistence if need
+ * @param itemType
+ * - item type
* @return existed item or null if not found
* @throws RepositoryException
*/
- public ItemImpl getItem(NodeData parent, QPathEntry name, boolean pool, boolean skipCheckInPersistence)
- throws RepositoryException
+ public ItemImpl getItem(NodeData parent, QPathEntry name, boolean pool, boolean skipCheckInPersistence,
+ ItemType itemType) throws RepositoryException
{
long start = System.currentTimeMillis();
if (log.isDebugEnabled())
@@ -327,7 +340,7 @@
ItemImpl item = null;
try
{
- return item = readItem(getItemData(parent, name, skipCheckInPersistence), pool);
+ return item = readItem(getItemData(parent, name, skipCheckInPersistence, itemType), pool);
}
finally
{
@@ -350,10 +363,13 @@
* - array of QPathEntry which represents the relation path to the searched item
* @param pool
* - indicates does the item fall in pool
+ * @param itemType
+ * - item type
* @return existed item or null if not found
* @throws RepositoryException
*/
- public ItemImpl getItem(NodeData parent, QPathEntry[] relPath, boolean pool) throws RepositoryException
+ public ItemImpl getItem(NodeData parent, QPathEntry[] relPath, boolean pool, ItemType itemType)
+ throws RepositoryException
{
long start = System.currentTimeMillis();
if (log.isDebugEnabled())
@@ -369,7 +385,7 @@
ItemImpl item = null;
try
{
- return item = readItem(getItemData(parent, relPath), pool);
+ return item = readItem(getItemData(parent, relPath, itemType), pool);
}
finally
{
@@ -900,7 +916,14 @@
QPathEntry[] relPathEntries = path.getRelPath(path.getDepth());
for (int i = 0; i < relPathEntries.length; i++)
{
- item = getItemData(parent, relPathEntries[i]);
+ if (i == relPathEntries.length - 1)
+ {
+ item = getItemData(parent, relPathEntries[i], ItemType.NODE);
+ }
+ else
+ {
+ item = getItemData(parent, relPathEntries[i], ItemType.UNKNOWN);
+ }
if (item == null)
{
@@ -948,7 +971,7 @@
try
{
- ItemData item = getItemData(parent, name);
+ ItemData item = getItemData(parent, name, ItemType.NODE);
if (item != null && item.isNode())
{
// node ACL
@@ -1051,8 +1074,8 @@
if (itemData.isNode())
{
checkRemoveChildVersionStorages =
- !session.getWorkspace().getNodeTypesHolder().isNodeType(Constants.NT_VERSIONHISTORY,
- ((NodeData)itemData).getPrimaryTypeName());
+ !session.getWorkspace().getNodeTypesHolder()
+ .isNodeType(Constants.NT_VERSIONHISTORY, ((NodeData)itemData).getPrimaryTypeName());
}
boolean rootAdded = false;
@@ -1195,7 +1218,7 @@
// We can't remove this VH now.
return;
} // else -- if we has a references in workspace where the VH is being
- // deleted we can remove VH now.
+ // deleted we can remove VH now.
}
}
finally
@@ -1234,7 +1257,7 @@
NodeData nextSibling =
(NodeData)dataManager.getItemData(parentNodeData, new QPathEntry(cause.getQPath().getName(), cause.getQPath()
- .getIndex() + 1));
+ .getIndex() + 1), ItemType.NODE);
String reindexedId = null;
// repeat till next sibling exists and it's not a caused Node (deleted or moved to) or just
@@ -1266,7 +1289,7 @@
// next...
nextSibling =
(NodeData)dataManager.getItemData(parentNodeData, new QPathEntry(nextSibling.getQPath().getName(),
- nextSibling.getQPath().getIndex() + 1));
+ nextSibling.getQPath().getIndex() + 1), ItemType.NODE);
}
return changes;
@@ -1585,12 +1608,11 @@
{
Collection<ItemDefinitionData> mandatoryItemDefs =
- session.getWorkspace().getNodeTypesHolder().getManadatoryItemDefs(nData.getPrimaryTypeName(),
- nData.getMixinTypeNames());
+ session.getWorkspace().getNodeTypesHolder()
+ .getManadatoryItemDefs(nData.getPrimaryTypeName(), nData.getMixinTypeNames());
for (ItemDefinitionData itemDefinitionData : mandatoryItemDefs)
{
-
- if (getItemData(nData, new QPathEntry(itemDefinitionData.getName(), 0)) == null)
+ if (getItemData(nData, new QPathEntry(itemDefinitionData.getName(), 0), ItemType.UNKNOWN) == null)
{
throw new ConstraintViolationException("Mandatory item " + itemDefinitionData.getName()
+ " not found. Node [" + nData.getQPath().getAsString() + " primary type: "
@@ -1647,7 +1669,7 @@
{
ItemData persisted =
transactionableManager.getItemData(parent, rstate.getData().getQPath().getEntries()[rstate.getData()
- .getQPath().getEntries().length - 1]);
+ .getQPath().getEntries().length - 1], ItemType.getItemType(rstate.getData()));
if (persisted != null)
{
@@ -1684,7 +1706,8 @@
if (parent != null)
{
QPathEntry[] path = item.getQPath().getEntries();
- persisted = transactionableManager.getItemData(parent, path[path.length - 1]);
+ persisted =
+ transactionableManager.getItemData(parent, path[path.length - 1], ItemType.getItemType(item));
} // else, the item has an invalid state, will be throwed on save
}
@@ -1704,7 +1727,9 @@
if (parent != null)
{
QPathEntry[] path = pooled.getData().getQPath().getEntries();
- persisted = transactionableManager.getItemData(parent, path[path.length - 1]);
+ persisted =
+ transactionableManager.getItemData(parent, path[path.length - 1],
+ ItemType.getItemType(pooled.getData()));
} // else, the item has an invalid state, will be throwed on save
}
if (persisted != null)
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/SessionImpl.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/SessionImpl.java 2010-09-16 11:23:57 UTC (rev 3120)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/SessionImpl.java 2010-09-16 13:41:50 UTC (rev 3121)
@@ -32,6 +32,7 @@
import org.exoplatform.services.jcr.datamodel.NodeData;
import org.exoplatform.services.jcr.datamodel.QPathEntry;
import org.exoplatform.services.jcr.impl.Constants;
+import org.exoplatform.services.jcr.impl.core.ItemImpl.ItemType;
import org.exoplatform.services.jcr.impl.core.lock.SessionLockManager;
import org.exoplatform.services.jcr.impl.core.lock.WorkspaceLockManager;
import org.exoplatform.services.jcr.impl.core.nodetype.NodeTypeImpl;
@@ -938,7 +939,7 @@
// Check for node with destAbsPath name in session
NodeImpl destNode =
(NodeImpl)dataManager.getItem((NodeData)destParentNode.getData(), new QPathEntry(destNodePath
- .getInternalPath().getName(), 0), false);
+ .getInternalPath().getName(), 0), false, ItemType.NODE);
if (destNode != null)
{
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/WorkspaceImpl.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/WorkspaceImpl.java 2010-09-16 11:23:57 UTC (rev 3120)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/WorkspaceImpl.java 2010-09-16 13:41:50 UTC (rev 3121)
@@ -27,6 +27,7 @@
import org.exoplatform.services.jcr.dataflow.PlainChangesLogImpl;
import org.exoplatform.services.jcr.datamodel.NodeData;
import org.exoplatform.services.jcr.datamodel.QPathEntry;
+import org.exoplatform.services.jcr.impl.core.ItemImpl.ItemType;
import org.exoplatform.services.jcr.impl.core.nodetype.NodeTypeImpl;
import org.exoplatform.services.jcr.impl.core.nodetype.NodeTypeManagerImpl;
import org.exoplatform.services.jcr.impl.core.query.QueryManagerFactory;
@@ -197,7 +198,7 @@
NodeImpl destNode =
(NodeImpl)session.getTransientNodesManager().getItem((NodeData)destParentNode.getData(),
- new QPathEntry(destNodePath.getInternalPath().getName(), 0), false);
+ new QPathEntry(destNodePath.getInternalPath().getName(), 0), false, ItemType.NODE);
if (destNode != null)
{
@@ -428,7 +429,7 @@
// Check for node with destAbsPath name in session
NodeImpl destNode =
(NodeImpl)session.getTransientNodesManager().getItem((NodeData)destParentNode.getData(),
- new QPathEntry(destNodePath.getInternalPath().getName(), 0), false);
+ new QPathEntry(destNodePath.getInternalPath().getName(), 0), false, ItemType.NODE);
if (destNode != null)
{
@@ -523,7 +524,7 @@
// Check for node with destAbsPath name in session
NodeImpl destNode =
(NodeImpl)session.getTransientNodesManager().getItem((NodeData)destParentNode.getData(),
- new QPathEntry(destNodePath.getInternalPath().getName(), 0), false);
+ new QPathEntry(destNodePath.getInternalPath().getName(), 0), false, ItemType.NODE);
ItemState changesItemState = null;
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/lock/FileSystemLockPersister.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/lock/FileSystemLockPersister.java 2010-09-16 11:23:57 UTC (rev 3120)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/lock/FileSystemLockPersister.java 2010-09-16 13:41:50 UTC (rev 3121)
@@ -31,6 +31,7 @@
import org.exoplatform.services.jcr.datamodel.QPath;
import org.exoplatform.services.jcr.datamodel.QPathEntry;
import org.exoplatform.services.jcr.impl.Constants;
+import org.exoplatform.services.jcr.impl.core.ItemImpl.ItemType;
import org.exoplatform.services.jcr.impl.core.query.SearchManager;
import org.exoplatform.services.jcr.impl.dataflow.TransientPropertyData;
import org.exoplatform.services.jcr.impl.dataflow.persistent.WorkspacePersistentDataManager;
@@ -183,7 +184,8 @@
if (lockedNodeData != null)
{
PropertyData dataLockIsDeep =
- (PropertyData)dataManager.getItemData(lockedNodeData, new QPathEntry(Constants.JCR_LOCKISDEEP, 0));
+ (PropertyData)dataManager.getItemData(lockedNodeData, new QPathEntry(Constants.JCR_LOCKISDEEP, 0),
+ ItemType.PROPERTY);
if (dataLockIsDeep != null)
{
@@ -193,7 +195,8 @@
}
PropertyData dataLockOwner =
- (PropertyData)dataManager.getItemData(lockedNodeData, new QPathEntry(Constants.JCR_LOCKOWNER, 0));
+ (PropertyData)dataManager.getItemData(lockedNodeData, new QPathEntry(Constants.JCR_LOCKOWNER, 0),
+ ItemType.PROPERTY);
if (dataLockOwner != null)
plainChangesLog.add(ItemState.createDeletedState(new TransientPropertyData(QPath.makeChildPath(
lockedNodeData.getQPath(), Constants.JCR_LOCKOWNER), dataLockOwner.getIdentifier(), 0,
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/lock/LockManagerImpl.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/lock/LockManagerImpl.java 2010-09-16 11:23:57 UTC (rev 3120)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/lock/LockManagerImpl.java 2010-09-16 13:41:50 UTC (rev 3121)
@@ -44,6 +44,7 @@
import org.exoplatform.services.jcr.impl.core.NodeImpl;
import org.exoplatform.services.jcr.impl.core.SessionDataManager;
import org.exoplatform.services.jcr.impl.core.SessionImpl;
+import org.exoplatform.services.jcr.impl.core.ItemImpl.ItemType;
import org.exoplatform.services.jcr.impl.dataflow.TransientItemData;
import org.exoplatform.services.jcr.impl.dataflow.TransientPropertyData;
import org.exoplatform.services.jcr.impl.dataflow.persistent.WorkspacePersistentDataManager;
@@ -703,12 +704,14 @@
new PlainChangesLogImpl(new ArrayList<ItemState>(), SystemIdentity.SYSTEM, ExtendedEvent.UNLOCK);
ItemData lockOwner =
- copyItemData((PropertyData)dataManager.getItemData(nData, new QPathEntry(Constants.JCR_LOCKOWNER, 1)));
+ copyItemData((PropertyData)dataManager.getItemData(nData, new QPathEntry(Constants.JCR_LOCKOWNER, 1),
+ ItemType.PROPERTY));
changesLog.add(ItemState.createDeletedState(lockOwner));
ItemData lockIsDeep =
- copyItemData((PropertyData)dataManager.getItemData(nData, new QPathEntry(Constants.JCR_LOCKISDEEP, 1)));
+ copyItemData((PropertyData)dataManager.getItemData(nData, new QPathEntry(Constants.JCR_LOCKISDEEP, 1),
+ ItemType.PROPERTY));
changesLog.add(ItemState.createDeletedState(lockIsDeep));
// lock probably removed by other thread
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/lock/jbosscache/CacheableLockManagerImpl.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/lock/jbosscache/CacheableLockManagerImpl.java 2010-09-16 11:23:57 UTC (rev 3120)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/lock/jbosscache/CacheableLockManagerImpl.java 2010-09-16 13:41:50 UTC (rev 3121)
@@ -41,6 +41,7 @@
import org.exoplatform.services.jcr.datamodel.QPathEntry;
import org.exoplatform.services.jcr.impl.Constants;
import org.exoplatform.services.jcr.impl.core.SessionDataManager;
+import org.exoplatform.services.jcr.impl.core.ItemImpl.ItemType;
import org.exoplatform.services.jcr.impl.core.lock.LockRemover;
import org.exoplatform.services.jcr.impl.core.lock.SessionLockManager;
import org.exoplatform.services.jcr.impl.dataflow.TransientItemData;
@@ -267,7 +268,7 @@
configureJDBCCacheLoader(config.getLockManager());
cache = factory.createCache(config.getLockManager());
-
+
Fqn<String> rootFqn = Fqn.fromElements(config.getUniqueName());
shareable =
@@ -1114,7 +1115,8 @@
new PlainChangesLogImpl(new ArrayList<ItemState>(), SystemIdentity.SYSTEM, ExtendedEvent.UNLOCK);
ItemData lockOwner =
- copyItemData((PropertyData)dataManager.getItemData(nData, new QPathEntry(Constants.JCR_LOCKOWNER, 1)));
+ copyItemData((PropertyData)dataManager.getItemData(nData, new QPathEntry(Constants.JCR_LOCKOWNER, 1),
+ ItemType.PROPERTY));
//TODO EXOJCR-412, should be refactored in future.
//Skip removing, because that lock was removed in other node of cluster.
@@ -1126,7 +1128,8 @@
changesLog.add(ItemState.createDeletedState(lockOwner));
ItemData lockIsDeep =
- copyItemData((PropertyData)dataManager.getItemData(nData, new QPathEntry(Constants.JCR_LOCKISDEEP, 1)));
+ copyItemData((PropertyData)dataManager.getItemData(nData, new QPathEntry(Constants.JCR_LOCKISDEEP, 1),
+ ItemType.PROPERTY));
//TODO EXOJCR-412, should be refactored in future.
//Skip removing, because that lock was removed in other node of cluster.
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/lock/jbosscache/jdbc/CacheableJDBCLockManagerImpl.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/lock/jbosscache/jdbc/CacheableJDBCLockManagerImpl.java 2010-09-16 11:23:57 UTC (rev 3120)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/lock/jbosscache/jdbc/CacheableJDBCLockManagerImpl.java 2010-09-16 13:41:50 UTC (rev 3121)
@@ -40,6 +40,7 @@
import org.exoplatform.services.jcr.datamodel.QPathEntry;
import org.exoplatform.services.jcr.impl.Constants;
import org.exoplatform.services.jcr.impl.core.SessionDataManager;
+import org.exoplatform.services.jcr.impl.core.ItemImpl.ItemType;
import org.exoplatform.services.jcr.impl.core.lock.LockRemover;
import org.exoplatform.services.jcr.impl.core.lock.SessionLockManager;
import org.exoplatform.services.jcr.impl.core.lock.jbosscache.CacheableLockManager;
@@ -895,7 +896,7 @@
List<LockData> locksData = new ArrayList<LockData>();
for (String nodeId : nodesId)
{
- LockData lockData = (LockData)cache.get(makeLockFqn((String)nodeId), LOCK_DATA);
+ LockData lockData = (LockData)cache.get(makeLockFqn(nodeId), LOCK_DATA);
if (lockData != null)
{
locksData.add(lockData);
@@ -949,7 +950,8 @@
new PlainChangesLogImpl(new ArrayList<ItemState>(), SystemIdentity.SYSTEM, ExtendedEvent.UNLOCK);
ItemData lockOwner =
- copyItemData((PropertyData)dataManager.getItemData(nData, new QPathEntry(Constants.JCR_LOCKOWNER, 1)));
+ copyItemData((PropertyData)dataManager.getItemData(nData, new QPathEntry(Constants.JCR_LOCKOWNER, 1),
+ ItemType.PROPERTY));
//TODO EXOJCR-412, should be refactored in future.
//Skip removing, because that lock was removed in other node of cluster.
@@ -961,7 +963,8 @@
changesLog.add(ItemState.createDeletedState(lockOwner));
ItemData lockIsDeep =
- copyItemData((PropertyData)dataManager.getItemData(nData, new QPathEntry(Constants.JCR_LOCKISDEEP, 1)));
+ copyItemData((PropertyData)dataManager.getItemData(nData, new QPathEntry(Constants.JCR_LOCKISDEEP, 1),
+ ItemType.PROPERTY));
//TODO EXOJCR-412, should be refactored in future.
//Skip removing, because that lock was removed in other node of cluster.
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/nodetype/ItemAutocreator.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/nodetype/ItemAutocreator.java 2010-09-16 11:23:57 UTC (rev 3120)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/nodetype/ItemAutocreator.java 2010-09-16 13:41:50 UTC (rev 3121)
@@ -33,6 +33,7 @@
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.core.ItemImpl.ItemType;
import org.exoplatform.services.jcr.impl.core.value.BaseValue;
import org.exoplatform.services.jcr.impl.dataflow.TransientNodeData;
import org.exoplatform.services.jcr.impl.dataflow.TransientPropertyData;
@@ -117,13 +118,13 @@
{
final ItemData pdata =
avoidCheckExistedChildItems ? null : targetDataManager.getItemData(parent, new QPathEntry(
- ndef.getName(), 0));
+ ndef.getName(), 0), ItemType.NODE);
if (pdata == null && !addedNodes.contains(ndef.getName()) || pdata != null && !pdata.isNode())
{
final TransientNodeData childNodeData =
- TransientNodeData.createNodeData(parent, ndef.getName(), ndef.getDefaultPrimaryType(), IdGenerator
- .generate());
+ TransientNodeData.createNodeData(parent, ndef.getName(), ndef.getDefaultPrimaryType(),
+ IdGenerator.generate());
changes.add(ItemState.createAddedState(childNodeData, false));
changes.addAll(makeAutoCreatedItems(childNodeData, childNodeData.getPrimaryTypeName(),
targetDataManager, owner).getAllStates());
@@ -162,7 +163,7 @@
final ItemData pdata =
avoidCheckExistedChildItems ? null : targetDataManager.getItemData(parent, new QPathEntry(
- pdef.getName(), 0));
+ pdef.getName(), 0), ItemType.PROPERTY);
if (pdata == null && !addedProperties.contains(pdef.getName()) || pdata != null && pdata.isNode())
{
@@ -171,8 +172,8 @@
if (listAutoCreateValue != null)
{
final TransientPropertyData propertyData =
- TransientPropertyData.createPropertyData(parent, pdef.getName(), pdef.getRequiredType(), pdef
- .isMultiple(), listAutoCreateValue);
+ TransientPropertyData.createPropertyData(parent, pdef.getName(), pdef.getRequiredType(),
+ pdef.isMultiple(), listAutoCreateValue);
changes.add(ItemState.createAddedState(propertyData));
addedProperties.add(pdef.getName());
}
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/nodetype/NodeTypeDataManagerImpl.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/nodetype/NodeTypeDataManagerImpl.java 2010-09-16 11:23:57 UTC (rev 3120)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/nodetype/NodeTypeDataManagerImpl.java 2010-09-16 13:41:50 UTC (rev 3121)
@@ -38,6 +38,7 @@
import org.exoplatform.services.jcr.datamodel.QPathEntry;
import org.exoplatform.services.jcr.impl.Constants;
import org.exoplatform.services.jcr.impl.core.LocationFactory;
+import org.exoplatform.services.jcr.impl.core.ItemImpl.ItemType;
import org.exoplatform.services.jcr.impl.core.nodetype.registration.NodeDefinitionComparator;
import org.exoplatform.services.jcr.impl.core.nodetype.registration.NodeTypeConverter;
import org.exoplatform.services.jcr.impl.core.nodetype.registration.NodeTypeDataPersister;
@@ -700,7 +701,8 @@
// update primary type
final PropertyData item =
- (PropertyData)this.dataManager.getItemData(nodeData, new QPathEntry(Constants.JCR_PRIMARYTYPE, 1));
+ (PropertyData)this.dataManager.getItemData(nodeData, new QPathEntry(Constants.JCR_PRIMARYTYPE, 1),
+ ItemType.PROPERTY);
final TransientPropertyData primaryTypeData =
new TransientPropertyData(item.getQPath(), item.getIdentifier(), item.getPersistedVersion(), item.getType(),
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/nodetype/registration/AbstractItemDefinitionAccessProvider.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/nodetype/registration/AbstractItemDefinitionAccessProvider.java 2010-09-16 11:23:57 UTC (rev 3120)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/nodetype/registration/AbstractItemDefinitionAccessProvider.java 2010-09-16 13:41:50 UTC (rev 3121)
@@ -30,6 +30,7 @@
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.core.ItemImpl.ItemType;
import org.exoplatform.services.jcr.impl.dataflow.TransientPropertyData;
import org.exoplatform.services.jcr.impl.dataflow.TransientValueData;
import org.exoplatform.services.jcr.impl.dataflow.ValueDataConvertor;
@@ -71,7 +72,7 @@
protected List<ValueData> loadPropertyValues(NodeData parentNode, InternalQName propertyName)
throws RepositoryException
{
- ItemData property = dataManager.getItemData(parentNode, new QPathEntry(propertyName, 1));
+ ItemData property = dataManager.getItemData(parentNode, new QPathEntry(propertyName, 1), ItemType.PROPERTY);
if (property != null)
{
if (property.isNode())
@@ -344,8 +345,8 @@
writeBoolean(changesLog, itemDefinition, Constants.JCR_MANDATORY, nodeDefinitionData.isMandatory());
- writeString(changesLog, itemDefinition, Constants.JCR_ONPARENTVERSION, OnParentVersionAction
- .nameFromValue(nodeDefinitionData.getOnParentVersion()));
+ writeString(changesLog, itemDefinition, Constants.JCR_ONPARENTVERSION,
+ OnParentVersionAction.nameFromValue(nodeDefinitionData.getOnParentVersion()));
}
protected void writeName(PlainChangesLog changesLog, NodeData parentNode, InternalQName propertyName,
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/nodetype/registration/JCRNodeTypeDataPersister.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/nodetype/registration/JCRNodeTypeDataPersister.java 2010-09-16 11:23:57 UTC (rev 3120)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/nodetype/registration/JCRNodeTypeDataPersister.java 2010-09-16 13:41:50 UTC (rev 3121)
@@ -41,6 +41,7 @@
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.core.ItemImpl.ItemType;
import org.exoplatform.services.jcr.impl.dataflow.ItemDataRemoveVisitor;
import org.exoplatform.services.jcr.impl.dataflow.TransientNodeData;
import org.exoplatform.services.jcr.impl.dataflow.TransientPropertyData;
@@ -139,7 +140,8 @@
return false;
}
- NodeData nodeTypeData = (NodeData)dataManager.getItemData(nodeTypeStorageRoot, new QPathEntry(nodeTypeName, 1));
+ NodeData nodeTypeData =
+ (NodeData)dataManager.getItemData(nodeTypeStorageRoot, new QPathEntry(nodeTypeName, 1), ItemType.NODE);
return nodeTypeData != null;
}
@@ -274,7 +276,7 @@
validatate();
NodeData nodeTypeData =
- (NodeData)dataManager.getItemData(nodeTypeStorageRoot, new QPathEntry(nodeType.getName(), 1));
+ (NodeData)dataManager.getItemData(nodeTypeStorageRoot, new QPathEntry(nodeType.getName(), 1), ItemType.NODE);
ItemDataRemoveVisitor removeVisitor = new ItemDataRemoveVisitor(dataManager, nodeTypeStorageRoot.getQPath());
nodeTypeData.accept(removeVisitor);
@@ -293,7 +295,8 @@
if (jcrSystem != null)
{
NodeData jcrNodetypes =
- (NodeData)dataManager.getItemData(jcrSystem, new QPathEntry(Constants.JCR_NODETYPES, 1));
+ (NodeData)dataManager.getItemData(jcrSystem, new QPathEntry(Constants.JCR_NODETYPES, 1),
+ ItemType.NODE);
if (jcrNodetypes == null)
{
this.nodeTypeStorageRoot = initNodetypesRoot(jcrSystem, addACL);
@@ -331,7 +334,7 @@
return null;
}
//Searching nodeType root
- ItemData nodeType = dataManager.getItemData(nodeTypeStorageRoot, new QPathEntry(nodeTypeName, 1));
+ ItemData nodeType = dataManager.getItemData(nodeTypeStorageRoot, new QPathEntry(nodeTypeName, 1), ItemType.NODE);
if (nodeType == null)
throw new NoSuchNodeTypeException("Node type definition " + nodeTypeName.getAsString() + "not found");
if (!nodeType.isNode())
@@ -395,7 +398,8 @@
}
// remove first
NodeData removeNodeTypeData =
- (NodeData)dataManager.getItemData(nodeTypeStorageRoot, new QPathEntry(nodeTypeData.getName(), 1));
+ (NodeData)dataManager.getItemData(nodeTypeStorageRoot, new QPathEntry(nodeTypeData.getName(), 1),
+ ItemType.NODE);
if (removeNodeTypeData != null)
{
ItemDataRemoveVisitor removeVisitor =
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/nodetype/registration/NodeDefinitionComparator.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/nodetype/registration/NodeDefinitionComparator.java 2010-09-16 11:23:57 UTC (rev 3120)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/nodetype/registration/NodeDefinitionComparator.java 2010-09-16 13:41:50 UTC (rev 3121)
@@ -29,6 +29,7 @@
import org.exoplatform.services.jcr.datamodel.NodeData;
import org.exoplatform.services.jcr.datamodel.QPathEntry;
import org.exoplatform.services.jcr.impl.Constants;
+import org.exoplatform.services.jcr.impl.core.ItemImpl.ItemType;
import org.exoplatform.services.jcr.impl.core.nodetype.ItemAutocreator;
import org.exoplatform.services.log.ExoLogger;
import org.exoplatform.services.log.Log;
@@ -75,6 +76,7 @@
this.affectedNodes = affectedNodes;
}
+ @Override
public PlainChangesLog compare(NodeTypeData registeredNodeType, NodeDefinitionData[] ancestorDefinition,
NodeDefinitionData[] recipientDefinition) throws ConstraintViolationException, RepositoryException
{
@@ -114,7 +116,8 @@
{
for (NodeData nodeData : nodesData)
{
- ItemData child = dataConsumer.getItemData(nodeData, new QPathEntry(nodeDefinitionData.getName(), 0));
+ ItemData child =
+ dataConsumer.getItemData(nodeData, new QPathEntry(nodeDefinitionData.getName(), 0), ItemType.NODE);
if (child == null || !child.isNode())
{
throw new ConstraintViolationException("Fail to add mandatory and not auto-created "
@@ -153,8 +156,8 @@
{
for (int i = 0; i < requiredPrimaryTypes.length; i++)
{
- if (!nodeTypeDataManager.isNodeType(requiredPrimaryTypes[i], child.getPrimaryTypeName(), child
- .getMixinTypeNames()))
+ if (!nodeTypeDataManager.isNodeType(requiredPrimaryTypes[i], child.getPrimaryTypeName(),
+ child.getMixinTypeNames()))
{
StringBuffer buffer = new StringBuffer();
buffer.append("Fail to change ");
@@ -189,8 +192,8 @@
{
for (int i = 0; i < requiredPrimaryTypes.length; i++)
{
- if (!nodeTypeDataManager.isNodeType(requiredPrimaryTypes[i], child.getPrimaryTypeName(), child
- .getMixinTypeNames()))
+ if (!nodeTypeDataManager.isNodeType(requiredPrimaryTypes[i], child.getPrimaryTypeName(),
+ child.getMixinTypeNames()))
{
StringBuffer buffer = new StringBuffer();
buffer.append("Fail to change ");
@@ -388,7 +391,8 @@
{
ItemData child =
- dataConsumer.getItemData(nodeData, new QPathEntry(recipientDefinitionData.getName(), 0));
+ dataConsumer.getItemData(nodeData, new QPathEntry(recipientDefinitionData.getName(), 0),
+ ItemType.NODE);
if (child == null || !child.isNode())
{
String message =
@@ -410,7 +414,8 @@
{
ItemData child =
- dataConsumer.getItemData(nodeData, new QPathEntry(recipientDefinitionData.getName(), 0));
+ dataConsumer.getItemData(nodeData, new QPathEntry(recipientDefinitionData.getName(), 0),
+ ItemType.NODE);
if (child == null || !child.isNode())
{
String message =
@@ -423,8 +428,8 @@
}
}
}
- if (!Arrays.deepEquals(ancestorDefinitionData.getRequiredPrimaryTypes(), recipientDefinitionData
- .getRequiredPrimaryTypes()))
+ if (!Arrays.deepEquals(ancestorDefinitionData.getRequiredPrimaryTypes(),
+ recipientDefinitionData.getRequiredPrimaryTypes()))
{
checkRequiredPrimaryType(registeredNodeType, nodesData, ancestorDefinitionData.getRequiredPrimaryTypes(),
recipientDefinitionData, allRecipientDefinition);
@@ -483,7 +488,8 @@
for (NodeData nodeData : nodesData)
{
ItemData child =
- dataConsumer.getItemData(nodeData, new QPathEntry(removeNodeDefinitionData.getName(), 0));
+ dataConsumer.getItemData(nodeData, new QPathEntry(removeNodeDefinitionData.getName(), 0),
+ ItemType.NODE);
if (child != null && child.isNode())
{
throw new ConstraintViolationException("Can't remove node definition "
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/nodetype/registration/PropertyDefinitionComparator.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/nodetype/registration/PropertyDefinitionComparator.java 2010-09-16 11:23:57 UTC (rev 3120)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/nodetype/registration/PropertyDefinitionComparator.java 2010-09-16 13:41:50 UTC (rev 3121)
@@ -32,6 +32,7 @@
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.core.ItemImpl.ItemType;
import org.exoplatform.services.jcr.impl.core.LocationFactory;
import org.exoplatform.services.jcr.impl.core.nodetype.ItemAutocreator;
import org.exoplatform.services.jcr.impl.core.value.ValueConstraintsMatcher;
@@ -84,6 +85,7 @@
this.locationFactory = locationFactory;
}
+ @Override
public PlainChangesLog compare(NodeTypeData registeredNodeType, PropertyDefinitionData[] ancestorDefinition,
PropertyDefinitionData[] recipientDefinition) throws RepositoryException
{
@@ -158,7 +160,8 @@
else
{
PropertyData propertyData =
- (PropertyData)dataConsumer.getItemData(nodeData, new QPathEntry(recipientDefinitionData.getName(), 0));
+ (PropertyData)dataConsumer.getItemData(nodeData, new QPathEntry(recipientDefinitionData.getName(), 0),
+ ItemType.PROPERTY);
if (propertyData.getValues().size() > 1)
{
throw new ConstraintViolationException("Can't change property definition "
@@ -275,7 +278,8 @@
else
{
PropertyData propertyData =
- (PropertyData)dataConsumer.getItemData(nodeData, new QPathEntry(recipientDefinitionData.getName(), 0));
+ (PropertyData)dataConsumer.getItemData(nodeData, new QPathEntry(recipientDefinitionData.getName(), 0),
+ ItemType.PROPERTY);
if (recipientDefinitionData.getRequiredType() != PropertyType.UNDEFINED
&& propertyData.getType() != recipientDefinitionData.getRequiredType())
{
@@ -329,7 +333,8 @@
else
{
PropertyData propertyData =
- (PropertyData)dataConsumer.getItemData(nodeData, new QPathEntry(recipientDefinitionData.getName(), 0));
+ (PropertyData)dataConsumer.getItemData(nodeData, new QPathEntry(recipientDefinitionData.getName(), 0),
+ ItemType.PROPERTY);
checkValueConstraints(recipientDefinitionData, propertyData);
}
}
@@ -388,7 +393,8 @@
&& newPropertyDefinitionData.isAutoCreated())
{
ItemData pdata =
- dataConsumer.getItemData(nodeData, new QPathEntry(newPropertyDefinitionData.getName(), 0));
+ dataConsumer.getItemData(nodeData, new QPathEntry(newPropertyDefinitionData.getName(), 0),
+ ItemType.UNKNOWN);
if (pdata == null || (pdata != null && pdata.isNode()))
{
PlainChangesLog autoCreatedChanges =
@@ -521,8 +527,8 @@
checkRequiredType(registeredNodeType, recipientDefinitionData, allRecipientDefinition, nodesData);
}
// ValueConstraints
- if (!Arrays.deepEquals(ancestorDefinitionData.getValueConstraints(), recipientDefinitionData
- .getValueConstraints()))
+ if (!Arrays.deepEquals(ancestorDefinitionData.getValueConstraints(),
+ recipientDefinitionData.getValueConstraints()))
{
checkValueConstraints(registeredNodeType, recipientDefinitionData, allRecipientDefinition, nodesData);
}
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/AggregateRuleImpl.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/AggregateRuleImpl.java 2010-09-16 11:23:57 UTC (rev 3120)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/AggregateRuleImpl.java 2010-09-16 13:41:50 UTC (rev 3121)
@@ -27,6 +27,7 @@
import org.exoplatform.services.jcr.datamodel.QPathEntry;
import org.exoplatform.services.jcr.impl.Constants;
import org.exoplatform.services.jcr.impl.core.LocationFactory;
+import org.exoplatform.services.jcr.impl.core.ItemImpl.ItemType;
import org.exoplatform.services.jcr.util.Text;
import org.w3c.dom.CharacterData;
import org.w3c.dom.Node;
@@ -408,7 +409,7 @@
else
{
cne = new ArrayList<NodeData>();
- ItemData item = ism.getItemData(nodeState, currentName);
+ ItemData item = ism.getItemData(nodeState, currentName, ItemType.NODE);
if (item != null && item.isNode())
{
cne.add((NodeData)item);
@@ -501,7 +502,7 @@
for (Iterator it = nodeStates.iterator(); it.hasNext();)
{
NodeData state = (NodeData)it.next();
- ItemData prop = ism.getItemData(state, new QPathEntry(propertyName, 1));
+ ItemData prop = ism.getItemData(state, new QPathEntry(propertyName, 1), ItemType.PROPERTY);
if (prop != null && !prop.isNode())
{
propStates.add(prop);
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/LuceneQueryBuilder.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/LuceneQueryBuilder.java 2010-09-16 11:23:57 UTC (rev 3120)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/LuceneQueryBuilder.java 2010-09-16 13:41:50 UTC (rev 3121)
@@ -20,9 +20,9 @@
import org.apache.lucene.index.Term;
import org.apache.lucene.queryParser.ParseException;
import org.apache.lucene.queryParser.QueryParser;
+import org.apache.lucene.search.BooleanClause.Occur;
import org.apache.lucene.search.BooleanQuery;
import org.apache.lucene.search.Query;
-import org.apache.lucene.search.BooleanClause.Occur;
import org.exoplatform.commons.utils.ISO8601;
import org.exoplatform.services.jcr.core.nodetype.NodeTypeDataManager;
import org.exoplatform.services.jcr.dataflow.ItemDataConsumer;
@@ -34,6 +34,7 @@
import org.exoplatform.services.jcr.datamodel.QPath;
import org.exoplatform.services.jcr.datamodel.QPathEntry;
import org.exoplatform.services.jcr.impl.Constants;
+import org.exoplatform.services.jcr.impl.core.ItemImpl.ItemType;
import org.exoplatform.services.jcr.impl.core.LocationFactory;
import org.exoplatform.services.jcr.impl.core.SessionImpl;
import org.exoplatform.services.jcr.impl.core.query.AndQueryNode;
@@ -760,6 +761,7 @@
final int[] transform = new int[]{TransformConstants.TRANSFORM_NONE};
node.acceptOperands(new DefaultQueryNodeVisitor()
{
+ @Override
public Object visit(PropertyFunctionQueryNode node, Object data)
{
if (node.getFunctionName().equals(PropertyFunctionQueryNode.LOWER_CASE))
@@ -1030,7 +1032,7 @@
ItemData item = parent;
for (int i = 0; i < relPathEntries.length; i++)
{
- item = sharedItemMgr.getItemData(parent, relPathEntries[i]);
+ item = sharedItemMgr.getItemData(parent, relPathEntries[i], ItemType.UNKNOWN);
if (item == null)
break;
@@ -1333,6 +1335,6 @@
values.add(literal);
log.debug("Using literal " + literal + " as is.");
}
- return (String[])values.toArray(new String[values.size()]);
+ return values.toArray(new String[values.size()]);
}
}
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/NodeIndexer.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/NodeIndexer.java 2010-09-16 11:23:57 UTC (rev 3120)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/NodeIndexer.java 2010-09-16 13:41:50 UTC (rev 3121)
@@ -34,6 +34,7 @@
import org.exoplatform.services.jcr.datamodel.ValueData;
import org.exoplatform.services.jcr.impl.Constants;
import org.exoplatform.services.jcr.impl.core.LocationFactory;
+import org.exoplatform.services.jcr.impl.core.ItemImpl.ItemType;
import org.exoplatform.services.jcr.impl.core.value.ValueFactoryImpl;
import org.exoplatform.services.jcr.impl.util.SecurityHelper;
import org.slf4j.Logger;
@@ -302,7 +303,8 @@
// seems nt:file found, try for nt:resource props
PropertyData pmime =
- (PropertyData)stateProvider.getItemData(node, new QPathEntry(Constants.JCR_MIMETYPE, 0));
+ (PropertyData)stateProvider.getItemData(node, new QPathEntry(Constants.JCR_MIMETYPE, 0),
+ ItemType.PROPERTY);
if (pmime != null)
{
// ok, have a reader
@@ -310,7 +312,7 @@
// otherwise read prop with values from DM
PropertyData propData =
prop.getValues().size() > 0 ? prop : ((PropertyData)stateProvider.getItemData(node, new QPathEntry(
- Constants.JCR_DATA, 0)));
+ Constants.JCR_DATA, 0), ItemType.PROPERTY));
// index if have jcr:mimeType sibling for this binary property only
try
@@ -328,7 +330,8 @@
// check the jcr:encoding property
PropertyData encProp =
- (PropertyData)stateProvider.getItemData(node, new QPathEntry(Constants.JCR_ENCODING, 0));
+ (PropertyData)stateProvider.getItemData(node, new QPathEntry(Constants.JCR_ENCODING, 0),
+ ItemType.PROPERTY);
String encoding = null;
if (encProp != null)
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/SharedFieldSortComparator.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/SharedFieldSortComparator.java 2010-09-16 11:23:57 UTC (rev 3120)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/SharedFieldSortComparator.java 2010-09-16 13:41:50 UTC (rev 3121)
@@ -16,13 +16,6 @@
*/
package org.exoplatform.services.jcr.impl.core.query.lucene;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.jcr.InvalidItemStateException;
-import javax.jcr.RepositoryException;
-
import org.apache.lucene.document.Document;
import org.apache.lucene.index.IndexReader;
import org.apache.lucene.search.ScoreDoc;
@@ -39,9 +32,17 @@
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.core.ItemImpl.ItemType;
import org.exoplatform.services.jcr.impl.core.JCRPath;
import org.exoplatform.services.jcr.impl.core.LocationFactory;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.jcr.InvalidItemStateException;
+import javax.jcr.RepositoryException;
+
/**
* Implements a <code>SortComparator</code> which knows how to sort on a lucene
* field that contains values for multiple properties.
@@ -96,6 +97,7 @@
* @return a <code>ScoreDocComparator</code> for the
* @throws IOException if an error occurs while reading from the index.
*/
+ @Override
public ScoreDocComparator newComparator(IndexReader reader, String relPath) throws IOException
{
@@ -126,6 +128,7 @@
/**
* @throws UnsupportedOperationException always.
*/
+ @Override
protected Comparable getComparable(String termtext)
{
throw new UnsupportedOperationException();
@@ -317,7 +320,7 @@
ItemData parent = ism.getItemData(uuid);
if (!parent.isNode())
throw new InvalidItemStateException();
- ItemData property = getItemData((NodeData)parent, relPath);
+ ItemData property = getItemData((NodeData)parent, relPath, ItemType.PROPERTY);
if (property != null)
{
if (property.isNode())
@@ -339,7 +342,7 @@
}
}
- private ItemData getItemData(NodeData parent, QPathEntry name) throws RepositoryException
+ private ItemData getItemData(NodeData parent, QPathEntry name, ItemType itemType) throws RepositoryException
{
if (name.getName().equals(JCRPath.PARENT_RELPATH) && name.getNamespace().equals(Constants.NS_DEFAULT_URI))
{
@@ -349,19 +352,26 @@
return ism.getItemData(parent.getParentIdentifier());
}
- return ism.getItemData(parent, name);
+ return ism.getItemData(parent, name, itemType);
}
- private ItemData getItemData(NodeData parent, QPath relPath) throws RepositoryException
+ private ItemData getItemData(NodeData parent, QPath relPath, ItemType itemType) throws RepositoryException
{
- QPathEntry[] relPathEntries =relPath.getEntries(); //relPath.getRelPath(relPath.getDepth());
+ QPathEntry[] relPathEntries = relPath.getEntries(); //relPath.getRelPath(relPath.getDepth());
ItemData item = parent;
for (int i = 0; i < relPathEntries.length; i++)
{
- item = getItemData(parent, relPathEntries[i]);
+ if (i == relPathEntries.length - 1)
+ {
+ item = getItemData(parent, relPathEntries[i], itemType);
+ }
+ else
+ {
+ item = getItemData(parent, relPathEntries[i], ItemType.UNKNOWN);
+ }
if (item == null)
break;
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/version/FrozenNodeInitializer.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/version/FrozenNodeInitializer.java 2010-09-16 11:23:57 UTC (rev 3120)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/version/FrozenNodeInitializer.java 2010-09-16 13:41:50 UTC (rev 3121)
@@ -31,6 +31,7 @@
import org.exoplatform.services.jcr.datamodel.ValueData;
import org.exoplatform.services.jcr.impl.Constants;
import org.exoplatform.services.jcr.impl.core.SessionDataManager;
+import org.exoplatform.services.jcr.impl.core.ItemImpl.ItemType;
import org.exoplatform.services.jcr.impl.core.value.BaseValue;
import org.exoplatform.services.jcr.impl.dataflow.AbstractItemDataCopyVisitor;
import org.exoplatform.services.jcr.impl.dataflow.TransientNodeData;
@@ -271,8 +272,8 @@
false, new TransientValueData(Constants.NT_VERSIONEDCHILD));
ValueData vh =
- ((PropertyData)dataManager.getItemData(node, new QPathEntry(Constants.JCR_VERSIONHISTORY, 0)))
- .getValues().get(0);
+ ((PropertyData)dataManager.getItemData(node, new QPathEntry(Constants.JCR_VERSIONHISTORY, 0),
+ ItemType.PROPERTY)).getValues().get(0);
PropertyData pd =
TransientPropertyData.createPropertyData(frozenNode, Constants.JCR_CHILDVERSIONHISTORY,
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/version/ItemDataMergeVisitor.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/version/ItemDataMergeVisitor.java 2010-09-16 11:23:57 UTC (rev 3120)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/version/ItemDataMergeVisitor.java 2010-09-16 13:41:50 UTC (rev 3121)
@@ -28,6 +28,7 @@
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.core.ItemImpl.ItemType;
import org.exoplatform.services.jcr.impl.core.SessionDataManager;
import org.exoplatform.services.jcr.impl.core.SessionImpl;
import org.exoplatform.services.jcr.impl.dataflow.AbstractItemDataCopyVisitor;
@@ -112,6 +113,7 @@
mergeSession.getAccessManager(), mergeSession.getUserState());
}
+ @Override
protected void validateReferential(NodeData node) throws RepositoryException
{
// no REFERENCE validation here
@@ -299,7 +301,8 @@
SessionDataManager mergeDataManager = mergeSession.getTransientNodesManager();
PropertyData isCheckedOutProperty =
- (PropertyData)mergeDataManager.getItemData(mergeNode, new QPathEntry(Constants.JCR_ISCHECKEDOUT, 0));
+ (PropertyData)mergeDataManager.getItemData(mergeNode, new QPathEntry(Constants.JCR_ISCHECKEDOUT, 0),
+ ItemType.PROPERTY);
try
{
@@ -361,9 +364,9 @@
QPath mergePath = mergeNode.getQPath();
TransientNodeData mergedNode =
- new TransientNodeData(mergePath, mergeNode.getIdentifier(), mergeNode.getPersistedVersion(), corrNode
- .getPrimaryTypeName(), corrNode.getMixinTypeNames(), mergeNode.getOrderNumber(), mergeNode
- .getParentIdentifier(), mergeNode.getACL());
+ new TransientNodeData(mergePath, mergeNode.getIdentifier(), mergeNode.getPersistedVersion(),
+ corrNode.getPrimaryTypeName(), corrNode.getMixinTypeNames(), mergeNode.getOrderNumber(),
+ mergeNode.getParentIdentifier(), mergeNode.getACL());
if (!mergeNode.getIdentifier().equals(corrNode.getIdentifier()))
{
@@ -393,8 +396,8 @@
for (PropertyData cp : mergeChildProps)
{
TransientPropertyData existed =
- new TransientPropertyData(cp.getQPath(), cp.getIdentifier(), cp.getPersistedVersion(), cp.getType(), cp
- .getParentIdentifier(), cp.isMultiValued(), copyValues(cp));
+ new TransientPropertyData(cp.getQPath(), cp.getIdentifier(), cp.getPersistedVersion(), cp.getType(),
+ cp.getParentIdentifier(), cp.isMultiValued(), copyValues(cp));
changes.add(new ItemState(existed, ItemState.DELETED, true, mergedNode.getQPath(), true));
existedProps.put(existed.getQPath().getName(), existed);
@@ -405,8 +408,8 @@
PropertyData existed = existedProps.get(cp.getQPath().getName());
TransientPropertyData mcp =
new TransientPropertyData(QPath.makeChildPath(mergePath, cp.getQPath().getName()), existed != null
- ? existed.getIdentifier() : cp.getIdentifier(), existed != null ? existed.getPersistedVersion() : cp
- .getPersistedVersion(), cp.getType(), mergedNode.getIdentifier(), cp.isMultiValued(), copyValues(cp));
+ ? existed.getIdentifier() : cp.getIdentifier(), existed != null ? existed.getPersistedVersion()
+ : cp.getPersistedVersion(), cp.getType(), mergedNode.getIdentifier(), cp.isMultiValued(), copyValues(cp));
changes.add(new ItemState(mcp, ItemState.ADDED, true, mergedNode.getQPath(), true));
}
@@ -462,7 +465,7 @@
SessionDataManager dmanager = session.getTransientNodesManager();
PropertyData bvProperty =
- (PropertyData)dmanager.getItemData(node, new QPathEntry(Constants.JCR_BASEVERSION, 0));
+ (PropertyData)dmanager.getItemData(node, new QPathEntry(Constants.JCR_BASEVERSION, 0), ItemType.PROPERTY);
try
{
@@ -486,8 +489,8 @@
SessionDataManager mergeDataManager = mergeSession.getTransientNodesManager();
NodeTypeDataManager mergeNtManager = mergeSession.getWorkspace().getNodeTypesHolder();
- if (mergeNtManager.isNodeType(Constants.MIX_REFERENCEABLE, mergeNode.getPrimaryTypeName(), mergeNode
- .getMixinTypeNames()))
+ if (mergeNtManager.isNodeType(Constants.MIX_REFERENCEABLE, mergeNode.getPrimaryTypeName(),
+ mergeNode.getMixinTypeNames()))
{
// by UUID
return (NodeData)corrDataManager.getItemData(mergeNode.getIdentifier());
@@ -499,15 +502,15 @@
final QPath ancesstorPath = mergePath.makeAncestorPath(i);
NodeData mergeAncestor = (NodeData)mergeDataManager.getItemData(ancesstorPath);
if (mergeAncestor != null
- && mergeNtManager.isNodeType(Constants.MIX_REFERENCEABLE, mergeAncestor.getPrimaryTypeName(), mergeAncestor
- .getMixinTypeNames()))
+ && mergeNtManager.isNodeType(Constants.MIX_REFERENCEABLE, mergeAncestor.getPrimaryTypeName(),
+ mergeAncestor.getMixinTypeNames()))
{
NodeData corrAncestor = (NodeData)corrDataManager.getItemData(mergeAncestor.getIdentifier());
if (corrAncestor != null)
{
QPathEntry[] relPathEntries = mergePath.getRelPath(mergePath.getDepth() - i);
- return (NodeData)corrDataManager.getItemData(corrAncestor, relPathEntries);
+ return (NodeData)corrDataManager.getItemData(corrAncestor, relPathEntries, ItemType.NODE);
}
}
}
@@ -523,7 +526,8 @@
SessionDataManager mergeDataManager = mergeSession.getTransientNodesManager();
PropertyData predecessorsProperty =
- (PropertyData)mergeDataManager.getItemData(mergeVersion, new QPathEntry(Constants.JCR_PREDECESSORS, 0));
+ (PropertyData)mergeDataManager.getItemData(mergeVersion, new QPathEntry(Constants.JCR_PREDECESSORS, 0),
+ ItemType.PROPERTY);
if (predecessorsProperty != null)
for (ValueData pv : predecessorsProperty.getValues())
@@ -568,7 +572,8 @@
SessionDataManager mergeDataManager = mergeSession.getTransientNodesManager();
PropertyData successorsProperty =
- (PropertyData)mergeDataManager.getItemData(mergeVersion, new QPathEntry(Constants.JCR_SUCCESSORS, 0));
+ (PropertyData)mergeDataManager.getItemData(mergeVersion, new QPathEntry(Constants.JCR_SUCCESSORS, 0),
+ ItemType.PROPERTY);
if (successorsProperty != null)
for (ValueData sv : successorsProperty.getValues())
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/version/ItemDataRestoreVisitor.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/version/ItemDataRestoreVisitor.java 2010-09-16 11:23:57 UTC (rev 3120)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/version/ItemDataRestoreVisitor.java 2010-09-16 13:41:50 UTC (rev 3121)
@@ -30,6 +30,7 @@
import org.exoplatform.services.jcr.datamodel.ValueData;
import org.exoplatform.services.jcr.impl.Constants;
import org.exoplatform.services.jcr.impl.core.SessionImpl;
+import org.exoplatform.services.jcr.impl.core.ItemImpl.ItemType;
import org.exoplatform.services.jcr.impl.dataflow.AbstractItemDataCopyVisitor;
import org.exoplatform.services.jcr.impl.dataflow.ItemDataCopyVisitor;
import org.exoplatform.services.jcr.impl.dataflow.ItemDataRemoveVisitor;
@@ -127,6 +128,7 @@
userSession.getUserState());
}
+ @Override
protected void validateReferential(NodeData node) throws RepositoryException
{
// no REFERENCE validation here
@@ -221,7 +223,7 @@
log.debug("Restore: " + nodePath.getAsString() + ", removeExisting=" + removeExisting);
PropertyData frozenIdentifier =
- (PropertyData)dataManager.getItemData(frozen, new QPathEntry(Constants.JCR_FROZENUUID, 1));
+ (PropertyData)dataManager.getItemData(frozen, new QPathEntry(Constants.JCR_FROZENUUID, 1), ItemType.PROPERTY);
String fidentifier = null;
NodeData existing = null;
@@ -275,6 +277,7 @@
.getAccessManager(), userSession.getUserState());
}
+ @Override
protected boolean isRemoveDescendant(ItemData item) throws RepositoryException
{
return item.getQPath().isDescendantOf(removedRoot.getQPath())
@@ -310,10 +313,12 @@
}
PropertyData frozenPrimaryType =
- (PropertyData)dataManager.getItemData(frozen, new QPathEntry(Constants.JCR_FROZENPRIMARYTYPE, 0));
+ (PropertyData)dataManager.getItemData(frozen, new QPathEntry(Constants.JCR_FROZENPRIMARYTYPE, 0),
+ ItemType.PROPERTY);
PropertyData frozenMixinTypes =
- (PropertyData)dataManager.getItemData(frozen, new QPathEntry(Constants.JCR_FROZENMIXINTYPES, 0));
+ (PropertyData)dataManager.getItemData(frozen, new QPathEntry(Constants.JCR_FROZENMIXINTYPES, 0),
+ ItemType.PROPERTY);
InternalQName[] mixins = null;
if (frozenMixinTypes != null)
@@ -422,7 +427,7 @@
String vhIdentifier =
new String(((PropertyData)dataManager.getItemData(frozen, new QPathEntry(
- Constants.JCR_CHILDVERSIONHISTORY, 0))).getValues().get(0).getAsByteArray());
+ Constants.JCR_CHILDVERSIONHISTORY, 0), ItemType.PROPERTY)).getValues().get(0).getAsByteArray());
NodeData cHistory = null;
if ((cHistory = (NodeData)dataManager.getItemData(vhIdentifier)) == null)
@@ -446,7 +451,7 @@
{
versionableIdentifier =
new String(((PropertyData)dataManager.getItemData(childHistory, new QPathEntry(
- Constants.JCR_VERSIONABLEUUID, 0))).getValues().get(0).getAsByteArray());
+ Constants.JCR_VERSIONABLEUUID, 0), ItemType.PROPERTY)).getValues().get(0).getAsByteArray());
}
catch (IOException e)
@@ -477,7 +482,8 @@
// not found, gets last version (by time of creation) and restore it
NodeData lastVersionData = childHistory.getLastVersionData();
NodeData cvFrozen =
- (NodeData)dataManager.getItemData(lastVersionData, new QPathEntry(Constants.JCR_FROZENNODE, 1));
+ (NodeData)dataManager.getItemData(lastVersionData, new QPathEntry(Constants.JCR_FROZENNODE, 1),
+ ItemType.NODE);
ItemDataRestoreVisitor restoreVisitor =
new ItemDataRestoreVisitor(currentNode(), qname, childHistory, userSession, removeExisting, changes);
@@ -524,8 +530,8 @@
try
{
jcrUuid =
- new String(((PropertyData)dataManager.getItemData(frozen, new QPathEntry(Constants.JCR_UUID, 0)))
- .getValues().get(0).getAsByteArray());
+ new String(((PropertyData)dataManager.getItemData(frozen, new QPathEntry(Constants.JCR_UUID, 0),
+ ItemType.PROPERTY)).getValues().get(0).getAsByteArray());
}
catch (IOException e)
@@ -540,7 +546,7 @@
// try to use existing node uuid, otherwise to generate one new
existing =
(NodeData)dataManager.getItemData(currentNode(), new QPathEntry(frozen.getQPath().getName(), frozen
- .getQPath().getIndex()));
+ .getQPath().getIndex()), ItemType.NODE);
if (existing != null)
{
jcrUuid = existing.getIdentifier();
@@ -595,7 +601,8 @@
{
// current C in the workspace will be left unchanged,
NodeData existed =
- (NodeData)dataManager.getItemData(currentNode(), new QPathEntry(frozen.getQPath().getName(), 0));
+ (NodeData)dataManager.getItemData(currentNode(), new QPathEntry(frozen.getQPath().getName(), 0),
+ ItemType.NODE);
if (existed != null)
{
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/version/VersionHistoryImpl.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/version/VersionHistoryImpl.java 2010-09-16 11:23:57 UTC (rev 3120)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/version/VersionHistoryImpl.java 2010-09-16 13:41:50 UTC (rev 3121)
@@ -109,7 +109,8 @@
checkValid();
PropertyData versionableUuid =
- (PropertyData)dataManager.getItemData(nodeData(), new QPathEntry(Constants.JCR_VERSIONABLEUUID, 0));
+ (PropertyData)dataManager.getItemData(nodeData(), new QPathEntry(Constants.JCR_VERSIONABLEUUID, 0),
+ ItemType.PROPERTY);
if (versionableUuid != null)
{
@@ -139,7 +140,8 @@
checkValid();
VersionImpl version =
- (VersionImpl)dataManager.getItem(nodeData(), new QPathEntry(Constants.JCR_ROOTVERSION, 0), true);
+ (VersionImpl)dataManager
+ .getItem(nodeData(), new QPathEntry(Constants.JCR_ROOTVERSION, 0), true, ItemType.NODE);
if (version == null)
{
throw new VersionException("There are no root version in the version history " + getPath());
@@ -187,7 +189,8 @@
JCRName jcrVersionName = locationFactory.parseJCRName(versionName);
VersionImpl version =
- (VersionImpl)dataManager.getItem(nodeData(), new QPathEntry(jcrVersionName.getInternalName(), 1), pool);
+ (VersionImpl)dataManager.getItem(nodeData(), new QPathEntry(jcrVersionName.getInternalName(), 1), pool,
+ ItemType.NODE);
if (version == null)
{
throw new VersionException("There are no version with name '" + versionName + "' in the version history "
@@ -360,13 +363,13 @@
// and point successor to predecessor directly
PropertyData successorsData =
- (PropertyData)dataManager
- .getItemData((NodeData)version.getData(), new QPathEntry(Constants.JCR_SUCCESSORS, 0));
+ (PropertyData)dataManager.getItemData((NodeData)version.getData(),
+ new QPathEntry(Constants.JCR_SUCCESSORS, 0), ItemType.PROPERTY);
// jcr:predecessors
PropertyData predecessorsData =
(PropertyData)dataManager.getItemData((NodeData)version.getData(), new QPathEntry(Constants.JCR_PREDECESSORS,
- 0));
+ 0), ItemType.PROPERTY);
try
{
@@ -538,7 +541,8 @@
InternalQName labelQName = jcrLabelName.getInternalName();
PropertyData vldata =
- (PropertyData)dataManager.getItemData(getData().getVersionLabelsData(), new QPathEntry(labelQName, 0));
+ (PropertyData)dataManager.getItemData(getData().getVersionLabelsData(), new QPathEntry(labelQName, 0),
+ ItemType.PROPERTY);
if (vldata != null)
{
@@ -592,8 +596,8 @@
// A reference to V is added to the jcr:successors property of
// each of the versions identified in Vs jcr:predecessors property.
List<ValueData> predecessors =
- ((PropertyData)dataManager.getItemData(versionableNodeData, new QPathEntry(Constants.JCR_PREDECESSORS, 0)))
- .getValues();
+ ((PropertyData)dataManager.getItemData(versionableNodeData, new QPathEntry(Constants.JCR_PREDECESSORS, 0),
+ ItemType.PROPERTY)).getValues();
List<ValueData> predecessorsNew = new ArrayList<ValueData>();
for (ValueData predecessorValue : predecessors)
{
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/version/VersionImpl.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/version/VersionImpl.java 2010-09-16 11:23:57 UTC (rev 3120)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/version/VersionImpl.java 2010-09-16 13:41:50 UTC (rev 3121)
@@ -80,7 +80,8 @@
{
checkValid();
- PropertyData pdata = (PropertyData)dataManager.getItemData(nodeData(), new QPathEntry(Constants.JCR_CREATED, 0));
+ PropertyData pdata =
+ (PropertyData)dataManager.getItemData(nodeData(), new QPathEntry(Constants.JCR_CREATED, 0), ItemType.PROPERTY);
if (pdata == null)
{
@@ -99,7 +100,8 @@
checkValid();
PropertyData successorsData =
- (PropertyData)dataManager.getItemData(nodeData(), new QPathEntry(Constants.JCR_SUCCESSORS, 0));
+ (PropertyData)dataManager.getItemData(nodeData(), new QPathEntry(Constants.JCR_SUCCESSORS, 0),
+ ItemType.PROPERTY);
if (successorsData == null)
{
@@ -142,7 +144,8 @@
checkValid();
PropertyData predecessorsData =
- (PropertyData)dataManager.getItemData(nodeData(), new QPathEntry(Constants.JCR_PREDECESSORS, 0));
+ (PropertyData)dataManager.getItemData(nodeData(), new QPathEntry(Constants.JCR_PREDECESSORS, 0),
+ ItemType.PROPERTY);
if (predecessorsData == null)
{
@@ -184,7 +187,8 @@
ValueData successorRef = new TransientValueData(new Identifier(successorIdentifier));
PropertyData successorsProp =
- (PropertyData)dataManager.getItemData(nodeData(), new QPathEntry(Constants.JCR_SUCCESSORS, 0));
+ (PropertyData)dataManager.getItemData(nodeData(), new QPathEntry(Constants.JCR_SUCCESSORS, 0),
+ ItemType.PROPERTY);
if (successorsProp == null)
{
@@ -230,7 +234,8 @@
ValueData predeccessorRef = new TransientValueData(new Identifier(predeccessorIdentifier));
PropertyData predeccessorsProp =
- (PropertyData)dataManager.getItemData(nodeData(), new QPathEntry(Constants.JCR_PREDECESSORS, 0));
+ (PropertyData)dataManager.getItemData(nodeData(), new QPathEntry(Constants.JCR_PREDECESSORS, 0),
+ ItemType.PROPERTY);
if (predeccessorsProp == null)
{
@@ -271,7 +276,8 @@
void removeSuccessor(String successorIdentifier, PlainChangesLog changesLog) throws RepositoryException
{
PropertyData successorsProp =
- (PropertyData)dataManager.getItemData(nodeData(), new QPathEntry(Constants.JCR_SUCCESSORS, 0));
+ (PropertyData)dataManager.getItemData(nodeData(), new QPathEntry(Constants.JCR_SUCCESSORS, 0),
+ ItemType.PROPERTY);
if (successorsProp != null)
{
List<ValueData> newSuccessors = new ArrayList<ValueData>();
@@ -310,7 +316,8 @@
{
PropertyData successorsProp =
- (PropertyData)dataManager.getItemData(nodeData(), new QPathEntry(Constants.JCR_SUCCESSORS, 0));
+ (PropertyData)dataManager.getItemData(nodeData(), new QPathEntry(Constants.JCR_SUCCESSORS, 0),
+ ItemType.PROPERTY);
if (successorsProp != null)
{
@@ -350,7 +357,8 @@
void removePredecessor(String predecessorIdentifier, PlainChangesLog changesLog) throws RepositoryException
{
PropertyData predeccessorsProp =
- (PropertyData)dataManager.getItemData(nodeData(), new QPathEntry(Constants.JCR_PREDECESSORS, 0));
+ (PropertyData)dataManager.getItemData(nodeData(), new QPathEntry(Constants.JCR_PREDECESSORS, 0),
+ ItemType.PROPERTY);
if (predeccessorsProp != null)
{
@@ -390,7 +398,8 @@
{
PropertyData predeccessorsProp =
- (PropertyData)dataManager.getItemData(nodeData(), new QPathEntry(Constants.JCR_PREDECESSORS, 0));
+ (PropertyData)dataManager.getItemData(nodeData(), new QPathEntry(Constants.JCR_PREDECESSORS, 0),
+ ItemType.PROPERTY);
if (predeccessorsProp != null)
{
@@ -460,7 +469,8 @@
DataManager dmanager = restoreSession.getTransientNodesManager().getTransactManager();
- NodeData frozenData = (NodeData)dmanager.getItemData(nodeData(), new QPathEntry(Constants.JCR_FROZENNODE, 1));
+ NodeData frozenData =
+ (NodeData)dmanager.getItemData(nodeData(), new QPathEntry(Constants.JCR_FROZENNODE, 1), ItemType.NODE);
ItemDataRestoreVisitor restoreVisitor =
new ItemDataRestoreVisitor(destParent, name, historyData, restoreSession, removeExisting, delegatedLog);
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/ACLInheritanceSupportedWorkspaceDataManager.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/ACLInheritanceSupportedWorkspaceDataManager.java 2010-09-16 11:23:57 UTC (rev 3120)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/ACLInheritanceSupportedWorkspaceDataManager.java 2010-09-16 13:41:50 UTC (rev 3121)
@@ -25,6 +25,7 @@
import org.exoplatform.services.jcr.datamodel.NodeData;
import org.exoplatform.services.jcr.datamodel.PropertyData;
import org.exoplatform.services.jcr.datamodel.QPathEntry;
+import org.exoplatform.services.jcr.impl.core.ItemImpl.ItemType;
import org.exoplatform.services.jcr.impl.dataflow.TransientNodeData;
import org.exoplatform.services.log.ExoLogger;
import org.exoplatform.services.log.Log;
@@ -165,9 +166,9 @@
/**
* {@inheritDoc}
*/
- public ItemData getItemData(NodeData parent, QPathEntry name) throws RepositoryException
+ public ItemData getItemData(NodeData parent, QPathEntry name, ItemType itemType) throws RepositoryException
{
- final ItemData item = persistentManager.getItemData(parent, name);
+ final ItemData item = persistentManager.getItemData(parent, name, itemType);
return item != null && item.isNode() ? initACL(parent, (NodeData)item) : item;
}
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/CacheableWorkspaceDataManager.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/CacheableWorkspaceDataManager.java 2010-09-16 11:23:57 UTC (rev 3120)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/CacheableWorkspaceDataManager.java 2010-09-16 13:41:50 UTC (rev 3121)
@@ -25,6 +25,7 @@
import org.exoplatform.services.jcr.datamodel.PropertyData;
import org.exoplatform.services.jcr.datamodel.QPathEntry;
import org.exoplatform.services.jcr.datamodel.ValueData;
+import org.exoplatform.services.jcr.impl.core.ItemImpl.ItemType;
import org.exoplatform.services.jcr.impl.dataflow.persistent.jbosscache.JBossCacheWorkspaceStorageCache;
import org.exoplatform.services.jcr.impl.storage.SystemDataContainerHolder;
import org.exoplatform.services.jcr.impl.storage.jdbc.JDBCStorageConnection;
@@ -337,6 +338,7 @@
/**
* {@inheritDoc}
*/
+ @Override
public int getChildNodesCount(NodeData parent) throws RepositoryException
{
if (cache.isEnabled())
@@ -354,6 +356,7 @@
/**
* {@inheritDoc}
*/
+ @Override
public List<NodeData> getChildNodesData(NodeData nodeData) throws RepositoryException
{
return getChildNodesData(nodeData, false);
@@ -362,6 +365,7 @@
/**
* {@inheritDoc}
*/
+ @Override
public List<PropertyData> getChildPropertiesData(NodeData nodeData) throws RepositoryException
{
List<PropertyData> childs = getChildPropertiesData(nodeData, false);
@@ -376,11 +380,12 @@
/**
* {@inheritDoc}
*/
- public ItemData getItemData(NodeData parentData, QPathEntry name) throws RepositoryException
+ @Override
+ public ItemData getItemData(NodeData parentData, QPathEntry name, ItemType itemType) throws RepositoryException
{
// 1. Try from cache
- ItemData data = getCachedItemData(parentData, name);
+ ItemData data = getCachedItemData(parentData, name, itemType);
// 2. Try from container
if (data == null)
@@ -392,10 +397,10 @@
request.start();
// Try first to get the value from the cache since a
// request could have been launched just before
- data = getCachedItemData(parentData, name);
+ data = getCachedItemData(parentData, name, itemType);
if (data == null)
{
- data = getPersistedItemData(parentData, name);
+ data = getPersistedItemData(parentData, name, itemType);
}
else if (!data.isNode())
{
@@ -418,6 +423,7 @@
/**
* {@inheritDoc}
*/
+ @Override
public ItemData getItemData(String identifier) throws RepositoryException
{
// 2. Try from cache
@@ -459,6 +465,7 @@
/**
* {@inheritDoc}
*/
+ @Override
public List<PropertyData> getReferencesData(String identifier, boolean skipVersionStorage)
throws RepositoryException
{
@@ -468,6 +475,7 @@
/**
* {@inheritDoc}
*/
+ @Override
public List<PropertyData> listChildPropertiesData(NodeData nodeData) throws RepositoryException
{
return listChildPropertiesData(nodeData, false);
@@ -501,13 +509,16 @@
* parent
* @param name
* Item name
+ * @param itemType
+ * item type
* @return ItemData
* @throws RepositoryException
* error
*/
- protected ItemData getCachedItemData(NodeData parentData, QPathEntry name) throws RepositoryException
+ protected ItemData getCachedItemData(NodeData parentData, QPathEntry name, ItemType itemType)
+ throws RepositoryException
{
- return cache.get(parentData.getIdentifier(), name);
+ return cache.get(parentData.getIdentifier(), name, itemType);
}
/**
@@ -647,13 +658,16 @@
* parent
* @param name
* Item name
+ * @param itemType
+ * item type
* @return ItemData
* @throws RepositoryException
* error
*/
- protected ItemData getPersistedItemData(NodeData parentData, QPathEntry name) throws RepositoryException
+ protected ItemData getPersistedItemData(NodeData parentData, QPathEntry name, ItemType itemType)
+ throws RepositoryException
{
- ItemData data = super.getItemData(parentData, name);
+ ItemData data = super.getItemData(parentData, name, itemType);
if (data != null && cache.isEnabled())
{
cache.put(data);
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/LinkedWorkspaceStorageCacheImpl.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/LinkedWorkspaceStorageCacheImpl.java 2010-09-16 11:23:57 UTC (rev 3120)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/LinkedWorkspaceStorageCacheImpl.java 2010-09-16 13:41:50 UTC (rev 3121)
@@ -30,6 +30,7 @@
import org.exoplatform.services.jcr.datamodel.QPath;
import org.exoplatform.services.jcr.datamodel.QPathEntry;
import org.exoplatform.services.jcr.impl.Constants;
+import org.exoplatform.services.jcr.impl.core.ItemImpl.ItemType;
import org.exoplatform.services.log.ExoLogger;
import org.exoplatform.services.log.Log;
@@ -41,10 +42,10 @@
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
+import java.util.Map.Entry;
import java.util.Timer;
import java.util.TimerTask;
import java.util.WeakHashMap;
-import java.util.Map.Entry;
import java.util.concurrent.Semaphore;
import java.util.concurrent.locks.ReentrantLock;
@@ -880,13 +881,19 @@
/**
* {@inheritDoc}
*/
- public ItemData get(final String parentId, final QPathEntry name)
+ public ItemData get(final String parentId, final QPathEntry name, ItemType itemType)
{
if (enabled && parentId != null && name != null)
{
try
{
- return getItem(parentId, name);
+ ItemData itemData = getItem(parentId, name);
+ if (itemData != null && itemType.isSuitableFor(itemData))
+ {
+ return itemData;
+ }
+
+ return null;
}
catch (Exception e)
{
@@ -906,9 +913,8 @@
protected void putItem(final ItemData data)
{
cache.put(new CacheId(data.getIdentifier()), new CacheValue(data, System.currentTimeMillis() + liveTime));
- cache.put(new CacheQPath(data.getParentIdentifier(), data.getQPath()), new CacheValue(data, System
- .currentTimeMillis()
- + liveTime));
+ cache.put(new CacheQPath(data.getParentIdentifier(), data.getQPath()),
+ new CacheValue(data, System.currentTimeMillis() + liveTime));
}
/**
@@ -1052,7 +1058,7 @@
{
if (enabled && parentData != null && childItems != null)
{ // TODO don't check parentData !=
- // null && childItems != null
+ // null && childItems != null
String logInfo = null;
if (LOG.isDebugEnabled())
@@ -1114,7 +1120,7 @@
{
if (enabled && parentData != null && childItems != null)
{ // TODO don't check parentData !=
- // null && childItems != null
+ // null && childItems != null
String logInfo = null;
if (LOG.isDebugEnabled())
@@ -1165,7 +1171,7 @@
{
if (enabled && parentData != null && childItems != null)
{ // TODO don't check parentData !=
- // null && childItems != null
+ // null && childItems != null
String logInfo = null;
if (LOG.isDebugEnabled())
@@ -1643,8 +1649,7 @@
{
writeLock.unlock();
}
- LOG
- .info(name + " : set liveTime=" + liveTime + "ms. New value will be applied to items cached from this moment.");
+ LOG.info(name + " : set liveTime=" + liveTime + "ms. New value will be applied to items cached from this moment.");
}
/**
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/VersionableWorkspaceDataManager.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/VersionableWorkspaceDataManager.java 2010-09-16 11:23:57 UTC (rev 3120)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/VersionableWorkspaceDataManager.java 2010-09-16 13:41:50 UTC (rev 3121)
@@ -31,6 +31,7 @@
import org.exoplatform.services.jcr.datamodel.QPath;
import org.exoplatform.services.jcr.datamodel.QPathEntry;
import org.exoplatform.services.jcr.impl.Constants;
+import org.exoplatform.services.jcr.impl.core.ItemImpl.ItemType;
import org.exoplatform.services.jcr.util.IdGenerator;
import org.exoplatform.services.log.ExoLogger;
import org.exoplatform.services.log.Log;
@@ -127,17 +128,17 @@
* {@inheritDoc}
*/
@Override
- public ItemData getItemData(NodeData parentData, QPathEntry name) throws RepositoryException
+ public ItemData getItemData(NodeData parentData, QPathEntry name, ItemType itemType) throws RepositoryException
{
if (parentData != null)
{
final QPath ipath = QPath.makeChildPath(parentData.getQPath(), name);
if (isSystemDescendant(ipath) && !this.equals(versionDataManager))
{
- return versionDataManager.getItemData(parentData, name);
+ return versionDataManager.getItemData(parentData, name, itemType);
}
}
- return super.getItemData(parentData, name);
+ return super.getItemData(parentData, name, itemType);
}
/**
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/WorkspacePersistentDataManager.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/WorkspacePersistentDataManager.java 2010-09-16 11:23:57 UTC (rev 3120)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/WorkspacePersistentDataManager.java 2010-09-16 13:41:50 UTC (rev 3121)
@@ -39,6 +39,7 @@
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.core.ItemImpl.ItemType;
import org.exoplatform.services.jcr.impl.dataflow.TransientValueData;
import org.exoplatform.services.jcr.impl.storage.SystemDataContainerHolder;
import org.exoplatform.services.jcr.storage.WorkspaceDataContainer;
@@ -577,7 +578,9 @@
NodeData parent = (NodeData)acon.getItemData(node.getParentIdentifier());
QPathEntry myName = node.getQPath().getEntries()[node.getQPath().getEntries().length - 1];
ItemData sibling =
- acon.getItemData(parent, new QPathEntry(myName.getNamespace(), myName.getName(), myName.getIndex() - 1));
+ acon.getItemData(parent, new QPathEntry(myName.getNamespace(), myName.getName(), myName.getIndex() - 1),
+ ItemType.NODE);
+
if (sibling == null || !sibling.isNode())
{
throw new InvalidItemStateException("Node can't be saved " + node.getQPath().getAsString()
@@ -796,12 +799,13 @@
/**
* {@inheritDoc}
*/
- public ItemData getItemData(final NodeData parentData, final QPathEntry name) throws RepositoryException
+ public ItemData getItemData(final NodeData parentData, final QPathEntry name, ItemType itemType)
+ throws RepositoryException
{
final WorkspaceStorageConnection con = dataContainer.openConnection();
try
{
- return con.getItemData(parentData, name);
+ return con.getItemData(parentData, name, itemType);
}
finally
{
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/jbosscache/JBossCacheWorkspaceStorageCache.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/jbosscache/JBossCacheWorkspaceStorageCache.java 2010-09-16 11:23:57 UTC (rev 3120)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/jbosscache/JBossCacheWorkspaceStorageCache.java 2010-09-16 13:41:50 UTC (rev 3121)
@@ -33,6 +33,7 @@
import org.exoplatform.services.jcr.datamodel.QPath;
import org.exoplatform.services.jcr.datamodel.QPathEntry;
import org.exoplatform.services.jcr.impl.Constants;
+import org.exoplatform.services.jcr.impl.core.ItemImpl.ItemType;
import org.exoplatform.services.jcr.impl.dataflow.TransientNodeData;
import org.exoplatform.services.jcr.impl.dataflow.TransientPropertyData;
import org.exoplatform.services.jcr.jbosscache.ExoJBossCacheFactory;
@@ -140,7 +141,7 @@
protected final Fqn<String> childPropsList;
protected final Fqn<String> rootFqn;
-
+
/**
* Node order comparator for getChildNodes().
*/
@@ -322,8 +323,8 @@
// if expiration is used, set appropriate factory with with timeout set via configuration (or default one 15minutes)
this.cache =
- new BufferedJBossCache(parentCache, useExpiration, wsConfig.getCache()
- .getParameterTime(JBOSSCACHE_EXPIRATION, JBOSSCACHE_EXPIRATION_DEFAULT));
+ new BufferedJBossCache(parentCache, useExpiration, wsConfig.getCache().getParameterTime(JBOSSCACHE_EXPIRATION,
+ JBOSSCACHE_EXPIRATION_DEFAULT));
this.itemsRoot = Fqn.fromRelativeElements(rootFqn, ITEMS);
this.childNodes = Fqn.fromRelativeElements(rootFqn, CHILD_NODES);
@@ -605,12 +606,16 @@
/**
* {@inheritDoc}
*/
- public ItemData get(String parentId, QPathEntry name)
+ public ItemData get(String parentId, QPathEntry name, ItemType itemType)
{
+ String itemId = null;
+ if (itemType == ItemType.NODE || itemType == ItemType.UNKNOWN)
+ {
+ // try as node first
+ itemId = (String)cache.get(makeChildFqn(childNodes, parentId, name), ITEM_ID);
+ }
- // get as node first
- String itemId = (String)cache.get(makeChildFqn(childNodes, parentId, name), ITEM_ID);
- if (itemId == null)
+ if (itemType == ItemType.PROPERTY || itemType == ItemType.UNKNOWN && itemId == null)
{
// try as property
itemId = (String)cache.get(makeChildFqn(childProps, parentId, name), ITEM_ID);
@@ -755,7 +760,7 @@
}
return count;
}
-
+
/**
* {@inheritDoc}
*/
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/session/LocalWorkspaceStorageDataManagerProxy.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/session/LocalWorkspaceStorageDataManagerProxy.java 2010-09-16 11:23:57 UTC (rev 3120)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/session/LocalWorkspaceStorageDataManagerProxy.java 2010-09-16 13:41:50 UTC (rev 3121)
@@ -31,6 +31,7 @@
import org.exoplatform.services.jcr.datamodel.PropertyData;
import org.exoplatform.services.jcr.datamodel.QPathEntry;
import org.exoplatform.services.jcr.datamodel.ValueData;
+import org.exoplatform.services.jcr.impl.core.ItemImpl.ItemType;
import org.exoplatform.services.jcr.impl.core.value.ValueFactoryImpl;
import org.exoplatform.services.jcr.impl.dataflow.AbstractPersistedValueData;
import org.exoplatform.services.jcr.impl.dataflow.TransientItemData;
@@ -102,9 +103,9 @@
/**
* {@inheritDoc}
*/
- public ItemData getItemData(NodeData parentData, QPathEntry name) throws RepositoryException
+ public ItemData getItemData(NodeData parentData, QPathEntry name, ItemType itemType) throws RepositoryException
{
- return copyItemData(storageDataManager.getItemData(parentData, name));
+ return copyItemData(storageDataManager.getItemData(parentData, name, itemType));
}
/**
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/session/SessionChangesLog.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/session/SessionChangesLog.java 2010-09-16 11:23:57 UTC (rev 3120)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/session/SessionChangesLog.java 2010-09-16 13:41:50 UTC (rev 3121)
@@ -27,6 +27,7 @@
import org.exoplatform.services.jcr.datamodel.QPath;
import org.exoplatform.services.jcr.datamodel.QPathEntry;
import org.exoplatform.services.jcr.impl.Constants;
+import org.exoplatform.services.jcr.impl.core.ItemImpl.ItemType;
import java.util.ArrayList;
import java.util.Collection;
@@ -299,13 +300,29 @@
* Get ItemState by parent and item name.
*
* @param parentData
+ * parent
* @param name
+ * item name
+ * @param itemType
+ * item type
* @return
* @throws IllegalPathException
*/
- public ItemState getItemState(NodeData parentData, QPathEntry name) throws IllegalPathException
+ public ItemState getItemState(NodeData parentData, QPathEntry name, ItemType itemType) throws IllegalPathException
{
- return index.get(new ParentIDQPathBasedKey(parentData.getIdentifier(), name));
+ if (itemType != ItemType.UNKNOWN)
+ {
+ return index.get(new ParentIDQPathBasedKey(parentData.getIdentifier(), name, itemType));
+ }
+ else
+ {
+ ItemState state = index.get(new ParentIDQPathBasedKey(parentData.getIdentifier(), name, ItemType.NODE));
+ if (state == null)
+ {
+ state = index.get(new ParentIDQPathBasedKey(parentData.getIdentifier(), name, ItemType.PROPERTY));
+ }
+ return state;
+ }
}
/**
@@ -718,6 +735,8 @@
*/
private final String parentIdentifier;
+ private final ItemType itemType;
+
/**
* KeyParentUUIDQPath constructor.
*
@@ -728,6 +747,7 @@
{
this.name = item.getData().getQPath().getEntries()[item.getData().getQPath().getEntries().length - 1];
this.parentIdentifier = item.getData().getParentIdentifier();
+ this.itemType = ItemType.getItemType(item.getData());
}
/**
@@ -738,10 +758,11 @@
* @param name
* item name
*/
- ParentIDQPathBasedKey(String parentIdentifier, QPathEntry name)
+ ParentIDQPathBasedKey(String parentIdentifier, QPathEntry name, ItemType itemType)
{
this.name = name;
this.parentIdentifier = parentIdentifier;
+ this.itemType = itemType;
}
/**
@@ -756,6 +777,7 @@
result = prime * result + name.getNamespace().hashCode();
result = prime * result + name.getIndex();
result = prime * result + (parentIdentifier == null ? 0 : parentIdentifier.hashCode());
+ result = prime * result + itemType.ordinal();
return result;
}
@@ -782,6 +804,7 @@
else if (!name.getName().equals(other.name.getName())
|| !name.getNamespace().equals(other.name.getNamespace()) || name.getIndex() != other.name.getIndex())
return false;
+
if (parentIdentifier == null)
{
if (other.parentIdentifier != null)
@@ -789,6 +812,15 @@
}
else if (!parentIdentifier.equals(other.parentIdentifier))
return false;
+
+ if (itemType == null)
+ {
+ if (other.itemType != null)
+ return false;
+ }
+ else if (!itemType.equals(other.itemType))
+ return false;
+
return true;
}
}
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/session/TransactionableDataManager.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/session/TransactionableDataManager.java 2010-09-16 11:23:57 UTC (rev 3120)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/session/TransactionableDataManager.java 2010-09-16 13:41:50 UTC (rev 3121)
@@ -29,6 +29,7 @@
import org.exoplatform.services.jcr.datamodel.PropertyData;
import org.exoplatform.services.jcr.datamodel.QPathEntry;
import org.exoplatform.services.jcr.impl.core.SessionImpl;
+import org.exoplatform.services.jcr.impl.core.ItemImpl.ItemType;
import org.exoplatform.services.jcr.impl.dataflow.persistent.LocalWorkspaceDataManagerStub;
import org.exoplatform.services.log.ExoLogger;
import org.exoplatform.services.log.Log;
@@ -212,12 +213,12 @@
/**
* {@inheritDoc}
*/
- public ItemData getItemData(NodeData parentData, QPathEntry name) throws RepositoryException
+ public ItemData getItemData(NodeData parentData, QPathEntry name, ItemType itemType) throws RepositoryException
{
ItemData data = null;
if (txStarted())
{
- ItemState state = transactionLog.getItemState(parentData, name);
+ ItemState state = transactionLog.getItemState(parentData, name, itemType);
if (state != null)
{
data = state.getData();
@@ -229,7 +230,7 @@
}
else
{
- return storageDataManager.getItemData(parentData, name);
+ return storageDataManager.getItemData(parentData, name, itemType);
}
}
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/version/VersionHistoryDataHelper.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/version/VersionHistoryDataHelper.java 2010-09-16 11:23:57 UTC (rev 3120)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/version/VersionHistoryDataHelper.java 2010-09-16 13:41:50 UTC (rev 3121)
@@ -29,6 +29,7 @@
import org.exoplatform.services.jcr.datamodel.QPath;
import org.exoplatform.services.jcr.datamodel.QPathEntry;
import org.exoplatform.services.jcr.impl.Constants;
+import org.exoplatform.services.jcr.impl.core.ItemImpl.ItemType;
import org.exoplatform.services.jcr.impl.dataflow.TransientNodeData;
import org.exoplatform.services.jcr.impl.dataflow.TransientPropertyData;
import org.exoplatform.services.jcr.impl.dataflow.TransientValueData;
@@ -139,7 +140,8 @@
NodeData vData = (NodeData)dataManager.getItemData(getIdentifier());
- NodeData rootVersion = (NodeData)dataManager.getItemData(vData, new QPathEntry(Constants.JCR_ROOTVERSION, 0));
+ NodeData rootVersion =
+ (NodeData)dataManager.getItemData(vData, new QPathEntry(Constants.JCR_ROOTVERSION, 0), ItemType.NODE);
List<NodeData> vChilds = new ArrayList<NodeData>();
@@ -165,7 +167,8 @@
for (NodeData vd : versionsData)
{
- PropertyData createdData = (PropertyData)dataManager.getItemData(vd, new QPathEntry(Constants.JCR_CREATED, 0));
+ PropertyData createdData =
+ (PropertyData)dataManager.getItemData(vd, new QPathEntry(Constants.JCR_CREATED, 0), ItemType.PROPERTY);
if (createdData == null)
throw new VersionException("jcr:created is not found, version: " + vd.getQPath().getAsString());
@@ -191,12 +194,12 @@
public NodeData getVersionData(InternalQName versionQName) throws VersionException, RepositoryException
{
- return (NodeData)dataManager.getItemData(this, new QPathEntry(versionQName, 0));
+ return (NodeData)dataManager.getItemData(this, new QPathEntry(versionQName, 0), ItemType.NODE);
}
public NodeData getVersionLabelsData() throws VersionException, RepositoryException
{
- return (NodeData)dataManager.getItemData(this, new QPathEntry(Constants.JCR_VERSIONLABELS, 0));
+ return (NodeData)dataManager.getItemData(this, new QPathEntry(Constants.JCR_VERSIONLABELS, 0), ItemType.NODE);
}
public List<PropertyData> getVersionLabels() throws VersionException, RepositoryException
@@ -242,7 +245,7 @@
NodeData rootItem = (NodeData)dataManager.getItemData(Constants.SYSTEM_UUID);
NodeData versionStorageData =
- (NodeData)dataManager.getItemData(rootItem, new QPathEntry(Constants.JCR_VERSIONSTORAGE, 1)); // Constants
+ (NodeData)dataManager.getItemData(rootItem, new QPathEntry(Constants.JCR_VERSIONSTORAGE, 1), ItemType.NODE); // Constants
// Make versionStorageData transient
if (!(versionStorageData instanceof TransientNodeData))
versionStorageData =
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/inmemory/InmemoryStorageConnection.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/inmemory/InmemoryStorageConnection.java 2010-09-16 11:23:57 UTC (rev 3120)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/inmemory/InmemoryStorageConnection.java 2010-09-16 13:41:50 UTC (rev 3121)
@@ -24,6 +24,7 @@
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.core.ItemImpl.ItemType;
import org.exoplatform.services.jcr.impl.core.JCRPath;
import org.exoplatform.services.jcr.storage.WorkspaceStorageConnection;
import org.exoplatform.services.log.ExoLogger;
@@ -62,9 +63,16 @@
identifiers = new TreeMap();
}
- public ItemData getItemData(NodeData parentData, QPathEntry name) throws RepositoryException, IllegalStateException
+ public ItemData getItemData(NodeData parentData, QPathEntry name, ItemType itemType) throws RepositoryException,
+ IllegalStateException
{
- return getItemData(QPath.makeChildPath(parentData.getQPath(), name));
+ ItemData itemData = getItemData(QPath.makeChildPath(parentData.getQPath(), name));
+ if (itemData != null && itemType.isSuitableFor(itemData))
+ {
+ return itemData;
+ }
+
+ return null;
}
public ItemData getItemData(QPath qPath) throws RepositoryException, IllegalStateException
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/JDBCStorageConnection.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/JDBCStorageConnection.java 2010-09-16 11:23:57 UTC (rev 3120)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/JDBCStorageConnection.java 2010-09-16 13:41:50 UTC (rev 3121)
@@ -33,6 +33,7 @@
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.core.ItemImpl.ItemType;
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;
@@ -1042,16 +1043,20 @@
return getItemByIdentifier(getInternalId(identifier));
}
- public ItemData getItemData(NodeData parentData, QPathEntry name) throws RepositoryException, IllegalStateException
+ /**
+ * {@inheritDoc}
+ */
+ public ItemData getItemData(NodeData parentData, QPathEntry name, ItemType itemType) throws RepositoryException,
+ IllegalStateException
{
if (parentData != null)
{
- return getItemByName(parentData, getInternalId(parentData.getIdentifier()), name);
+ return getItemByName(parentData, getInternalId(parentData.getIdentifier()), name, itemType);
}
// it's a root node
- return getItemByName(null, null, name);
+ return getItemByName(null, null, name, itemType);
}
/**
@@ -1200,30 +1205,47 @@
* - parent container internal id (depends on Multi/Single DB)
* @param name
* - item name
+ * @param itemType
+ * - item type
* @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
+ protected ItemData getItemByName(NodeData parent, String parentId, QPathEntry name, ItemType itemType)
+ throws RepositoryException, IllegalStateException
{
checkIfOpened();
try
{
- ResultSet item = findItemByName(parentId, name.getAsString(), name.getIndex());
+ ResultSet item = null;
try
{
+ if (itemType != ItemType.PROPERTY)
+ {
+ item = findItemByName(parentId, name.getAsString(), name.getIndex());
+ }
+ else
+ {
+ item = findPropertyByName(parentId, name.getAsString());
+ }
+
if (item.next())
+ {
return itemData(parent.getQPath(), item, item.getInt(COLUMN_CLASS), parent.getACL());
+ }
+
return null;
}
finally
{
try
{
- item.close();
+ if (item != null)
+ {
+ item.close();
+ }
}
catch (SQLException e)
{
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/SQLExceptionHandler.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/SQLExceptionHandler.java 2010-09-16 11:23:57 UTC (rev 3120)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/SQLExceptionHandler.java 2010-09-16 13:41:50 UTC (rev 3121)
@@ -22,6 +22,7 @@
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.core.ItemImpl.ItemType;
import org.exoplatform.services.jcr.impl.storage.JCRInvalidItemStateException;
import org.exoplatform.services.jcr.impl.storage.JCRItemExistsException;
@@ -180,7 +181,9 @@
throw ownException;
}
- me = conn.getItemData(parent, new QPathEntry(item.getQPath().getName(), item.getQPath().getIndex()));
+ me =
+ conn.getItemData(parent, new QPathEntry(item.getQPath().getName(), item.getQPath().getIndex()),
+ ItemType.getItemType(item));
if (me != null)
{
message += "Item already exists in storage: " + itemInfo;
@@ -261,7 +264,9 @@
throw ownException;
}
- me = conn.getItemData(parent, new QPathEntry(item.getQPath().getName(), item.getQPath().getIndex()));
+ me =
+ conn.getItemData(parent, new QPathEntry(item.getQPath().getName(), item.getQPath().getIndex()),
+ ItemType.getItemType(item));
if (me != null)
{
message += "Item already exists in storage: " + itemInfo;
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/statistics/StatisticsJDBCStorageConnection.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/statistics/StatisticsJDBCStorageConnection.java 2010-09-16 11:23:57 UTC (rev 3120)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/statistics/StatisticsJDBCStorageConnection.java 2010-09-16 13:41:50 UTC (rev 3121)
@@ -20,6 +20,7 @@
import org.exoplatform.services.jcr.datamodel.NodeData;
import org.exoplatform.services.jcr.datamodel.PropertyData;
import org.exoplatform.services.jcr.datamodel.QPathEntry;
+import org.exoplatform.services.jcr.impl.core.ItemImpl.ItemType;
import org.exoplatform.services.jcr.impl.storage.jdbc.JDBCWorkspaceDataContainer;
import org.exoplatform.services.jcr.statistics.JCRStatisticsManager;
import org.exoplatform.services.jcr.statistics.Statistics;
@@ -40,7 +41,7 @@
* Created by The eXo Platform SAS
* Author : Nicolas Filotto
* nicolas.filotto(a)exoplatform.com
- * 26 f�vr. 2010
+ * 26 f�vr. 2010
*/
public class StatisticsJDBCStorageConnection implements WorkspaceStorageConnection
{
@@ -204,7 +205,6 @@
}
}
-
/**
* The nested {@link WorkspaceStorageConnection}
*/
@@ -384,15 +384,16 @@
}
/**
- * @see org.exoplatform.services.jcr.storage.WorkspaceStorageConnection#getItemData(org.exoplatform.services.jcr.datamodel.NodeData, org.exoplatform.services.jcr.datamodel.QPathEntry)
+ * {@inheritDoc}
*/
- public ItemData getItemData(NodeData parentData, QPathEntry name) throws RepositoryException, IllegalStateException
+ public ItemData getItemData(NodeData parentData, QPathEntry name, ItemType itemType) throws RepositoryException,
+ IllegalStateException
{
Statistics s = ALL_STATISTICS.get(GET_ITEM_DATA_BY_NODE_DATA_NQ_PATH_ENTRY_DESCR);
try
{
s.begin();
- return wcs.getItemData(parentData, name);
+ return wcs.getItemData(parentData, name, itemType);
}
finally
{
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/xml/VersionHistoryRemover.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/xml/VersionHistoryRemover.java 2010-09-16 11:23:57 UTC (rev 3120)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/xml/VersionHistoryRemover.java 2010-09-16 13:41:50 UTC (rev 3121)
@@ -30,6 +30,7 @@
import org.exoplatform.services.jcr.impl.Constants;
import org.exoplatform.services.jcr.impl.core.RepositoryImpl;
import org.exoplatform.services.jcr.impl.core.SessionImpl;
+import org.exoplatform.services.jcr.impl.core.ItemImpl.ItemType;
import org.exoplatform.services.jcr.impl.dataflow.ItemDataRemoveVisitor;
import org.exoplatform.services.log.ExoLogger;
import org.exoplatform.services.log.Log;
@@ -217,7 +218,8 @@
if (ntManager.isNodeType(Constants.NT_VERSIONEDCHILD, vhnode.getPrimaryTypeName(), vhnode.getMixinTypeNames()))
{
PropertyData property =
- (PropertyData)dataManager.getItemData(nodeData, new QPathEntry(Constants.JCR_CHILDVERSIONHISTORY, 1));
+ (PropertyData)dataManager.getItemData(nodeData, new QPathEntry(Constants.JCR_CHILDVERSIONHISTORY, 1),
+ ItemType.PROPERTY);
if (property == null)
throw new RepositoryException("Property " + Constants.JCR_CHILDVERSIONHISTORY.getAsString()
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/xml/importing/BaseXmlImporter.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/xml/importing/BaseXmlImporter.java 2010-09-16 11:23:57 UTC (rev 3120)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/xml/importing/BaseXmlImporter.java 2010-09-16 13:41:50 UTC (rev 3121)
@@ -38,6 +38,7 @@
import org.exoplatform.services.jcr.impl.Constants;
import org.exoplatform.services.jcr.impl.core.LocationFactory;
import org.exoplatform.services.jcr.impl.core.RepositoryImpl;
+import org.exoplatform.services.jcr.impl.core.ItemImpl.ItemType;
import org.exoplatform.services.jcr.impl.core.value.ValueFactoryImpl;
import org.exoplatform.services.jcr.impl.dataflow.ItemDataRemoveVisitor;
import org.exoplatform.services.jcr.impl.dataflow.version.VersionHistoryDataHelper;
@@ -228,7 +229,7 @@
ItemData sameNameNode = null;
try
{
- sameNameNode = dataConsumer.getItemData(parentData, new QPathEntry(name, 0));
+ sameNameNode = dataConsumer.getItemData(parentData, new QPathEntry(name, 0), ItemType.NODE);
}
catch (PathNotFoundException e)
{
@@ -723,7 +724,8 @@
try
{
PropertyData vhpd =
- (PropertyData)dataConsumer.getItemData(mixVersionableNode, new QPathEntry(Constants.JCR_VERSIONHISTORY, 1));
+ (PropertyData)dataConsumer.getItemData(mixVersionableNode, new QPathEntry(Constants.JCR_VERSIONHISTORY, 1),
+ ItemType.PROPERTY);
try
{
String vhID = new String(vhpd.getValues().get(0).getAsByteArray());
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/storage/WorkspaceStorageConnection.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/storage/WorkspaceStorageConnection.java 2010-09-16 11:23:57 UTC (rev 3120)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/storage/WorkspaceStorageConnection.java 2010-09-16 13:41:50 UTC (rev 3121)
@@ -22,6 +22,7 @@
import org.exoplatform.services.jcr.datamodel.NodeData;
import org.exoplatform.services.jcr.datamodel.PropertyData;
import org.exoplatform.services.jcr.datamodel.QPathEntry;
+import org.exoplatform.services.jcr.impl.core.ItemImpl.ItemType;
import java.util.List;
@@ -50,12 +51,14 @@
/**
* Reads <code>ItemData</code> from the storage using item's parent and name relative the parent
- * location.
+ * location of define type.
*
* @param parentData
* - the item's parent NodeData
* @param name
* - item's path entry (QName + index)
+ * @param itemType
+ * item type
* @return - stored ItemData wich has exact the same path Entry (name+index) inside the parent; or
* null if not such an item data found
* @throws RepositoryException
@@ -63,7 +66,8 @@
* @throws IllegalStateException
* if connection is closed
*/
- ItemData getItemData(NodeData parentData, QPathEntry name) throws RepositoryException, IllegalStateException;
+ ItemData getItemData(NodeData parentData, QPathEntry name, ItemType itemType) throws RepositoryException,
+ IllegalStateException;
/**
* Reads <code>ItemData</code> from the storage by item identifier.
@@ -93,7 +97,7 @@
* if connection is closed
*/
List<NodeData> getChildNodesData(NodeData parent) throws RepositoryException, IllegalStateException;
-
+
/**
* Reads count of <code>parent<code/> child nodes.
*
Modified: jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/core/TestGetNode.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/core/TestGetNode.java 2010-09-16 11:23:57 UTC (rev 3120)
+++ jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/core/TestGetNode.java 2010-09-16 13:41:50 UTC (rev 3121)
@@ -20,6 +20,7 @@
import org.exoplatform.services.jcr.JcrImplBaseTest;
+import javax.jcr.Node;
import javax.jcr.PathNotFoundException;
/**
@@ -48,4 +49,17 @@
}
}
+ public void testGetNodeAndPropertyWithSameName() throws Exception
+ {
+ String sameName = "sameName";
+ Node rootNode = session.getRootNode();
+ Node aNode = rootNode.addNode("a");
+ aNode.addNode(sameName);
+ aNode.setProperty(sameName, "aa");
+ session.save();
+
+ assertNotNull(aNode.getProperty(sameName));
+ assertNotNull(aNode.getNode(sameName));
+ }
+
}
Modified: jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/core/TestSessionDataManager.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/core/TestSessionDataManager.java 2010-09-16 11:23:57 UTC (rev 3120)
+++ jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/core/TestSessionDataManager.java 2010-09-16 13:41:50 UTC (rev 3121)
@@ -26,6 +26,7 @@
import org.exoplatform.services.jcr.datamodel.QPath;
import org.exoplatform.services.jcr.datamodel.QPathEntry;
import org.exoplatform.services.jcr.impl.Constants;
+import org.exoplatform.services.jcr.impl.core.ItemImpl.ItemType;
import org.exoplatform.services.jcr.impl.dataflow.TransientNodeData;
import org.exoplatform.services.jcr.impl.dataflow.TransientPropertyData;
import org.exoplatform.services.jcr.impl.dataflow.TransientValueData;
@@ -34,8 +35,6 @@
import java.util.ArrayList;
import java.util.List;
-import javax.jcr.ItemNotFoundException;
-import javax.jcr.Node;
import javax.jcr.PropertyType;
import javax.jcr.RepositoryException;
@@ -314,7 +313,7 @@
{
// get non-existent data by getItemData(NodeData parent, QPathEntry name)
assertNull(modificationManager.getItemData((NodeData)((NodeImpl)root).getData(), new QPathEntry("",
- "testgetitemNode", 0)));
+ "testgetitemNode", 0), ItemType.NODE));
// get non-existent data by ItemData getItemData(QPath path)
assertNull(modificationManager.getItemData(QPath.makeChildPath(((NodeImpl)root).getData().getQPath(),
new InternalQName("", "testgetitemNode"))));
@@ -323,7 +322,7 @@
// get data by getItemData(NodeData parent, QPathEntry name)
assertNotNull(modificationManager.getItemData((NodeData)((NodeImpl)root).getData(), new QPathEntry("",
- "testgetitemNode", 0)));
+ "testgetitemNode", 0), ItemType.NODE));
// get data by ItemData getItemData(QPath path)
assertNotNull(modificationManager.getItemData(QPath.makeChildPath(((NodeImpl)root).getData().getQPath(),
new InternalQName("", "testgetitemNode"))));
Modified: jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/dataflow/persistent/TestCacheableWorkspaceDataManager.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/dataflow/persistent/TestCacheableWorkspaceDataManager.java 2010-09-16 11:23:57 UTC (rev 3120)
+++ jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/dataflow/persistent/TestCacheableWorkspaceDataManager.java 2010-09-16 13:41:50 UTC (rev 3121)
@@ -27,6 +27,7 @@
import org.exoplatform.services.jcr.datamodel.PropertyData;
import org.exoplatform.services.jcr.datamodel.QPathEntry;
import org.exoplatform.services.jcr.datamodel.ValueData;
+import org.exoplatform.services.jcr.impl.core.ItemImpl.ItemType;
import org.exoplatform.services.jcr.impl.storage.SystemDataContainerHolder;
import org.exoplatform.services.jcr.impl.storage.WorkspaceDataContainerBase;
import org.exoplatform.services.jcr.storage.WorkspaceDataContainer;
@@ -90,6 +91,7 @@
{
Thread thread = new Thread()
{
+ @Override
public void run()
{
try
@@ -147,7 +149,7 @@
{
public void execute() throws Exception
{
- ItemData item = cwdm.getItemData(nodeData, new QPathEntry("http://www.foo.com", "foo", 0));
+ ItemData item = cwdm.getItemData(nodeData, new QPathEntry("http://www.foo.com", "foo", 0), ItemType.NODE);
assertNotNull(item);
}
};
@@ -306,9 +308,14 @@
private volatile ItemData itemData;
- public ItemData get(String parentIdentifier, QPathEntry name)
+ public ItemData get(String parentIdentifier, QPathEntry name, ItemType itemType)
{
- return itemData;
+ if (itemData != null && itemType.isSuitableFor(itemData))
+ {
+ return itemData;
+ }
+
+ return null;
}
public ItemData get(String identifier)
@@ -426,17 +433,22 @@
getChildPropertiesDataCalls.incrementAndGet();
return Arrays
.asList((PropertyData)new PersistedPropertyData("getChildPropertiesData", null, null, 0,
- PropertyType.STRING, false, Arrays
- .asList((ValueData)new ByteArrayPersistedValueData(1, "foo".getBytes()))));
+ PropertyType.STRING, false,
+ Arrays.asList((ValueData)new ByteArrayPersistedValueData(1, "foo".getBytes()))));
}
public AtomicInteger getItemDataByNodeDataNQPathEntryCalls = new AtomicInteger();
- public ItemData getItemData(NodeData parentData, QPathEntry name) throws RepositoryException,
+ public ItemData getItemData(NodeData parentData, QPathEntry name, ItemType itemType) throws RepositoryException,
IllegalStateException
{
getItemDataByNodeDataNQPathEntryCalls.incrementAndGet();
- return new PersistedNodeData("getItemData", null, null, 0, 1, null, null, null);
+ if (itemType != ItemType.PROPERTY)
+ {
+ return new PersistedNodeData("getItemData", null, null, 0, 1, null, null, null);
+ }
+
+ return null;
}
public AtomicInteger getItemDataByIdCalls = new AtomicInteger();
@@ -471,8 +483,8 @@
listChildPropertiesDataCalls.incrementAndGet();
return Arrays
.asList((PropertyData)new PersistedPropertyData("listChildPropertiesData", null, null, 0,
- PropertyType.STRING, false, Arrays
- .asList((ValueData)new ByteArrayPersistedValueData(1, "foo".getBytes()))));
+ PropertyType.STRING, false,
+ Arrays.asList((ValueData)new ByteArrayPersistedValueData(1, "foo".getBytes()))));
}
public void rename(NodeData data) throws RepositoryException, UnsupportedOperationException,
Modified: jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/dataflow/persistent/TestLinkedCacheMultithread.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/dataflow/persistent/TestLinkedCacheMultithread.java 2010-09-16 11:23:57 UTC (rev 3120)
+++ jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/dataflow/persistent/TestLinkedCacheMultithread.java 2010-09-16 13:41:50 UTC (rev 3121)
@@ -25,6 +25,7 @@
import org.exoplatform.services.jcr.datamodel.QPath;
import org.exoplatform.services.jcr.impl.Constants;
import org.exoplatform.services.jcr.impl.core.NodeImpl;
+import org.exoplatform.services.jcr.impl.core.ItemImpl.ItemType;
import org.exoplatform.services.jcr.impl.dataflow.TransientNodeData;
import org.exoplatform.services.jcr.impl.dataflow.TransientPropertyData;
import org.exoplatform.services.jcr.impl.dataflow.TransientValueData;
@@ -79,6 +80,7 @@
super.setName(name);
}
+ @Override
public void run()
{
// log.info("START");
@@ -99,7 +101,7 @@
// by parent + name
NodeData n =
(NodeData)cache.get(rndNode.getParentIdentifier(), rndNode.getQPath().getEntries()[rndNode
- .getQPath().getEntries().length - 1]);
+ .getQPath().getEntries().length - 1], ItemType.NODE);
if (n != null)
assertEquals(rndNode.getIdentifier(), n.getIdentifier());
}
@@ -142,6 +144,7 @@
super.setName(name);
}
+ @Override
public void run()
{
// log.info("START");
@@ -229,6 +232,7 @@
super.setName(name);
}
+ @Override
public void run()
{
// log.info("START");
@@ -280,6 +284,7 @@
this.timeout = timeout;
}
+ @Override
public void run()
{
synchronized (cache)
Modified: jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/dataflow/persistent/WorkspaceStorageCacheBaseCase.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/dataflow/persistent/WorkspaceStorageCacheBaseCase.java 2010-09-16 11:23:57 UTC (rev 3120)
+++ jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/dataflow/persistent/WorkspaceStorageCacheBaseCase.java 2010-09-16 13:41:50 UTC (rev 3121)
@@ -33,6 +33,7 @@
import org.exoplatform.services.jcr.datamodel.ValueData;
import org.exoplatform.services.jcr.impl.Constants;
import org.exoplatform.services.jcr.impl.core.NodeImpl;
+import org.exoplatform.services.jcr.impl.core.ItemImpl.ItemType;
import org.exoplatform.services.jcr.util.IdGenerator;
import java.util.ArrayList;
@@ -141,6 +142,7 @@
private WorkspaceStorageCache cache;
+ @Override
public void setUp() throws Exception
{
super.setUp();
@@ -251,15 +253,15 @@
throw e;
}
assertEquals("Cached node " + nodeData1.getQPath().getAsString() + " is not equals", cache.get(rootUuid,
- nodePath1.getEntries()[nodePath1.getEntries().length - 1]), nodeData1);
+ nodePath1.getEntries()[nodePath1.getEntries().length - 1], ItemType.NODE), nodeData1);
assertEquals("Cached node " + nodeData2.getQPath().getAsString() + " is not equals", cache.get(rootUuid,
- nodePath2.getEntries()[nodePath2.getEntries().length - 1]), nodeData2);
+ nodePath2.getEntries()[nodePath2.getEntries().length - 1], ItemType.NODE), nodeData2);
assertEquals("Cached node " + nodeData1.getIdentifier() + " is not equals", cache.get(nodeUuid1), nodeData1);
assertEquals("Cached node " + nodeData2.getIdentifier() + " is not equals", cache.get(nodeUuid2), nodeData2);
assertEquals("Cached property " + propertyPath12.getAsString() + " is not equals", cache.get(nodeUuid1,
- propertyPath12.getEntries()[propertyPath12.getEntries().length - 1]), propertyData12);
+ propertyPath12.getEntries()[propertyPath12.getEntries().length - 1], ItemType.PROPERTY), propertyData12);
assertEquals("Cached property " + propertyData12.getIdentifier() + " is not equals", cache.get(propertyUuid12),
propertyData12);
}
@@ -300,21 +302,21 @@
}
// prev stuff
assertEquals("Cached " + nodeData1.getQPath().getAsString() + " is not equals", cache.get(rootUuid, nodePath1
- .getEntries()[nodePath1.getEntries().length - 1]), nodeData1);
+ .getEntries()[nodePath1.getEntries().length - 1], ItemType.NODE), nodeData1);
assertEquals("Cached " + nodeData2.getQPath().getAsString() + " is not equals", cache.get(rootUuid, nodePath2
- .getEntries()[nodePath2.getEntries().length - 1]), nodeData2);
+ .getEntries()[nodePath2.getEntries().length - 1], ItemType.NODE), nodeData2);
assertEquals("Cached " + propertyData12.getQPath().getAsString() + " is not equals", cache.get(nodeUuid1,
- propertyPath12.getEntries()[propertyPath12.getEntries().length - 1]), propertyData12);
+ propertyPath12.getEntries()[propertyPath12.getEntries().length - 1], ItemType.PROPERTY), propertyData12);
// childs...
// nodes
assertEquals("Cached child node " + nodeData31.getQPath().getAsString() + " is not equals", cache.get(nodeUuid3,
- nodePath31.getEntries()[nodePath31.getEntries().length - 1]), nodeData31);
+ nodePath31.getEntries()[nodePath31.getEntries().length - 1], ItemType.NODE), nodeData31);
assertEquals("Cached child node " + nodeData31.getIdentifier() + " is not equals", cache.get(nodeUuid31),
nodeData31);
assertEquals("Cached child node " + nodeData32.getQPath().getAsString() + " is not equals", cache.get(nodeUuid3,
- nodePath32.getEntries()[nodePath32.getEntries().length - 1]), nodeData32);
+ nodePath32.getEntries()[nodePath32.getEntries().length - 1], ItemType.NODE), nodeData32);
assertEquals("Cached child node " + nodeData32.getIdentifier() + " is not equals", cache.get(nodeUuid32),
nodeData32);
@@ -327,20 +329,24 @@
// props
assertEquals("Cached child property " + propertyData11.getQPath().getAsString() + " is not equals", cache.get(
- nodeUuid1, propertyPath11.getEntries()[propertyPath11.getEntries().length - 1]), propertyData11);
+ nodeUuid1, propertyPath11.getEntries()[propertyPath11.getEntries().length - 1], ItemType.PROPERTY),
+ propertyData11);
assertEquals("Cached child property " + propertyData11.getIdentifier() + " is not equals", cache
.get(propertyUuid11), propertyData11);
assertEquals("Cached child property " + propertyData12.getQPath().getAsString() + " is not equals", cache.get(
- nodeUuid1, propertyPath12.getEntries()[propertyPath12.getEntries().length - 1]), propertyData12);
+ nodeUuid1, propertyPath12.getEntries()[propertyPath12.getEntries().length - 1], ItemType.PROPERTY),
+ propertyData12);
assertEquals("Cached child property " + propertyData12.getIdentifier() + " is not equals", cache
.get(propertyUuid12), propertyData12);
assertEquals("Cached child property " + propertyData21.getQPath().getAsString() + " is not equals", cache.get(
- nodeUuid2, propertyPath21.getEntries()[propertyPath21.getEntries().length - 1]), propertyData21);
+ nodeUuid2, propertyPath21.getEntries()[propertyPath21.getEntries().length - 1], ItemType.PROPERTY),
+ propertyData21);
assertEquals("Cached child property " + propertyData21.getIdentifier() + " is not equals", cache
.get(propertyUuid21), propertyData21);
assertEquals("Cached child property " + propertyData22.getQPath().getAsString() + " is not equals", cache.get(
- nodeUuid2, propertyPath22.getEntries()[propertyPath22.getEntries().length - 1]), propertyData22);
+ nodeUuid2, propertyPath22.getEntries()[propertyPath22.getEntries().length - 1], ItemType.PROPERTY),
+ propertyData22);
assertEquals("Cached child property " + propertyData22.getIdentifier() + " is not equals", cache
.get(propertyUuid22), propertyData22);
@@ -393,20 +399,24 @@
}
// props, prev stuff
assertEquals("Cached child property " + propertyData11.getQPath().getAsString() + " is not equals", cache.get(
- nodeUuid1, propertyPath11.getEntries()[propertyPath11.getEntries().length - 1]), propertyData11);
+ nodeUuid1, propertyPath11.getEntries()[propertyPath11.getEntries().length - 1], ItemType.PROPERTY),
+ propertyData11);
assertEquals("Cached child property " + propertyData11.getIdentifier() + " is not equals", cache
.get(propertyUuid11), propertyData11);
assertEquals("Cached child property " + propertyData12.getQPath().getAsString() + " is not equals", cache.get(
- nodeUuid1, propertyPath12.getEntries()[propertyPath12.getEntries().length - 1]), propertyData12);
+ nodeUuid1, propertyPath12.getEntries()[propertyPath12.getEntries().length - 1], ItemType.PROPERTY),
+ propertyData12);
assertEquals("Cached child property " + propertyData12.getIdentifier() + " is not equals", cache
.get(propertyUuid12), propertyData12);
assertEquals("Cached child property " + propertyData21.getQPath().getAsString() + " is not equals", cache.get(
- nodeUuid2, propertyPath21.getEntries()[propertyPath21.getEntries().length - 1]), propertyData21);
+ nodeUuid2, propertyPath21.getEntries()[propertyPath21.getEntries().length - 1], ItemType.PROPERTY),
+ propertyData21);
assertEquals("Cached child property " + propertyData21.getIdentifier() + " is not equals", cache
.get(propertyUuid21), propertyData21);
assertEquals("Cached child property " + propertyData22.getQPath().getAsString() + " is not equals", cache.get(
- nodeUuid2, propertyPath22.getEntries()[propertyPath22.getEntries().length - 1]), propertyData22);
+ nodeUuid2, propertyPath22.getEntries()[propertyPath22.getEntries().length - 1], ItemType.PROPERTY),
+ propertyData22);
assertEquals("Cached child property " + propertyData22.getIdentifier() + " is not equals", cache
.get(propertyUuid22), propertyData22);
@@ -429,22 +439,25 @@
// check
assertEquals("Cached child property " + propertyData11.getQPath().getAsString() + " is not equals", cache.get(
- nodeUuid1, propertyPath11.getEntries()[propertyPath11.getEntries().length - 1]), propertyData11);
+ nodeUuid1, propertyPath11.getEntries()[propertyPath11.getEntries().length - 1], ItemType.PROPERTY),
+ propertyData11);
assertEquals("Cached child property " + propertyData11.getIdentifier() + " is not equals", cache
.get(propertyUuid11), propertyData11);
// here
assertNull("Child property " + propertyData12.getQPath().getAsString() + " is not in the cache", cache.get(
- nodeUuid1, propertyPath12.getEntries()[propertyPath12.getEntries().length - 1]));
+ nodeUuid1, propertyPath12.getEntries()[propertyPath12.getEntries().length - 1], ItemType.PROPERTY));
assertNull("Child property " + propertyData12.getQPath().getAsString() + " is not in the cache", cache
.get(propertyUuid12));
assertEquals("Cached child property " + propertyData21.getQPath().getAsString() + " is not equals", cache.get(
- nodeUuid2, propertyPath21.getEntries()[propertyPath21.getEntries().length - 1]), propertyData21);
+ nodeUuid2, propertyPath21.getEntries()[propertyPath21.getEntries().length - 1], ItemType.PROPERTY),
+ propertyData21);
assertEquals("Cached child property " + propertyData21.getIdentifier() + " is not equals", cache
.get(propertyUuid21), propertyData21);
assertEquals("Cached child property " + propertyData22.getQPath().getAsString() + " is not equals", cache.get(
- nodeUuid2, propertyPath22.getEntries()[propertyPath22.getEntries().length - 1]), propertyData22);
+ nodeUuid2, propertyPath22.getEntries()[propertyPath22.getEntries().length - 1], ItemType.PROPERTY),
+ propertyData22);
assertEquals("Cached child property " + propertyData22.getIdentifier() + " is not equals", cache
.get(propertyUuid22), propertyData22);
Modified: jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/storage/JDBCHWDCTest.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/storage/JDBCHWDCTest.java 2010-09-16 11:23:57 UTC (rev 3120)
+++ jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/storage/JDBCHWDCTest.java 2010-09-16 13:41:50 UTC (rev 3121)
@@ -32,11 +32,11 @@
import org.exoplatform.services.jcr.datamodel.QPathEntry;
import org.exoplatform.services.jcr.impl.Constants;
import org.exoplatform.services.jcr.impl.core.SessionDataManager;
+import org.exoplatform.services.jcr.impl.core.ItemImpl.ItemType;
import org.exoplatform.services.jcr.impl.dataflow.TransientNodeData;
import org.exoplatform.services.jcr.impl.dataflow.TransientPropertyData;
import org.exoplatform.services.jcr.impl.dataflow.TransientValueData;
import org.exoplatform.services.jcr.impl.dataflow.session.TransactionableDataManager;
-import org.exoplatform.services.jcr.impl.dataflow.session.WorkspaceStorageDataManagerProxy;
import org.exoplatform.services.jcr.impl.storage.jdbc.JDBCWorkspaceDataContainer;
import org.exoplatform.services.jcr.storage.WorkspaceStorageConnection;
import org.exoplatform.services.jcr.util.IdGenerator;
@@ -142,7 +142,7 @@
con = wdContainer.openConnection();
try
{
- NodeData storedNode = (NodeData)con.getItemData(rootData, new QPathEntry(nodeName, 1));
+ NodeData storedNode = (NodeData)con.getItemData(rootData, new QPathEntry(nodeName, 1), ItemType.NODE);
assertEquals(path, storedNode.getQPath());
}
catch (Exception e)
@@ -211,7 +211,7 @@
// get
try
{
- NodeData storedNode = (NodeData)wdm.getItemData(rootData, new QPathEntry(nodeName, 1));
+ NodeData storedNode = (NodeData)wdm.getItemData(rootData, new QPathEntry(nodeName, 1), ItemType.NODE);
assertEquals(path, storedNode.getQPath());
}
catch (Exception e)
Modified: jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/storage/JDBCStorageConnectionTest.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/storage/JDBCStorageConnectionTest.java 2010-09-16 11:23:57 UTC (rev 3120)
+++ jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/storage/JDBCStorageConnectionTest.java 2010-09-16 13:41:50 UTC (rev 3121)
@@ -33,6 +33,7 @@
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.core.ItemImpl.ItemType;
import org.exoplatform.services.jcr.impl.dataflow.TransientNodeData;
import org.exoplatform.services.jcr.impl.dataflow.TransientPropertyData;
import org.exoplatform.services.jcr.impl.dataflow.TransientValueData;
@@ -98,7 +99,7 @@
testRoot =
(NodeData)dataManager.getItemData(root,
- troot.getQPath().getEntries()[troot.getQPath().getEntries().length - 1]);
+ troot.getQPath().getEntries()[troot.getQPath().getEntries().length - 1], ItemType.NODE);
assertNotNull("Can't find test root node " + troot.getQPath().getAsString(), testRoot);
}
@@ -135,7 +136,8 @@
{
NodeData troot =
- (NodeData)dataManager.getItemData(root, new QPathEntry(InternalQName.parse("[]jdbcStorageConnectionTest"), 1));
+ (NodeData)dataManager.getItemData(root, new QPathEntry(InternalQName.parse("[]jdbcStorageConnectionTest"), 1),
+ ItemType.NODE);
assertEquals("Inherited acl should be here", root.getACL().getOwner(), troot.getACL().getOwner());
}
@@ -160,7 +162,8 @@
// test
NodeData troot =
- (NodeData)dataManager.getItemData(root, new QPathEntry(InternalQName.parse("[]jdbcStorageConnectionTest"), 1));
+ (NodeData)dataManager.getItemData(root, new QPathEntry(InternalQName.parse("[]jdbcStorageConnectionTest"), 1),
+ ItemType.NODE);
assertEquals("Owner is not valid", "exo", troot.getACL().getOwner());
}
@@ -192,7 +195,8 @@
// test
NodeData troot =
- (NodeData)dataManager.getItemData(root, new QPathEntry(InternalQName.parse("[]jdbcStorageConnectionTest"), 1));
+ (NodeData)dataManager.getItemData(root, new QPathEntry(InternalQName.parse("[]jdbcStorageConnectionTest"), 1),
+ ItemType.NODE);
List<String> iperms = troot.getACL().getPermissions(SystemIdentity.ANY);
assertEquals("Wrong permission for " + SystemIdentity.ANY, 1, iperms.size());
@@ -242,7 +246,8 @@
// test
NodeData troot =
- (NodeData)dataManager.getItemData(root, new QPathEntry(InternalQName.parse("[]jdbcStorageConnectionTest"), 1));
+ (NodeData)dataManager.getItemData(root, new QPathEntry(InternalQName.parse("[]jdbcStorageConnectionTest"), 1),
+ ItemType.NODE);
assertEquals("Owner is not valid", "exo", troot.getACL().getOwner());
Modified: jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/storage/StorageUpdateTest.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/storage/StorageUpdateTest.java 2010-09-16 11:23:57 UTC (rev 3120)
+++ jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/storage/StorageUpdateTest.java 2010-09-16 13:41:50 UTC (rev 3121)
@@ -25,6 +25,7 @@
import org.exoplatform.services.jcr.datamodel.PropertyData;
import org.exoplatform.services.jcr.datamodel.QPathEntry;
import org.exoplatform.services.jcr.impl.core.PropertyImpl;
+import org.exoplatform.services.jcr.impl.core.ItemImpl.ItemType;
import org.exoplatform.services.jcr.impl.dataflow.TransientPropertyData;
import org.exoplatform.services.jcr.impl.dataflow.TransientValueData;
import org.exoplatform.services.jcr.impl.storage.jdbc.JDBCStorageConnection;
@@ -71,6 +72,7 @@
private boolean isDefaultWsMultiDb;
+ @Override
public void setUp() throws Exception
{
super.setUp();
@@ -155,7 +157,8 @@
(NodeData)session.getTransientNodesManager().getTransactManager()
.getItemData(jcrUuid.getParentIdentifier());
QPathEntry[] qentry = bugData.getQPath().getEntries();
- PropertyData persistedBugData = (PropertyData)conn.getItemData(parent, qentry[qentry.length - 1]);
+ PropertyData persistedBugData =
+ (PropertyData)conn.getItemData(parent, qentry[qentry.length - 1], ItemType.PROPERTY);
log.info("node_V node BUG uuid: " + node_V.getUUID() + ", jcr:uuid: "
+ new String(persistedBugData.getValues().get(0).getAsByteArray()));
Modified: jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/storage/fs/TestJCRVSReadWrite.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/storage/fs/TestJCRVSReadWrite.java 2010-09-16 11:23:57 UTC (rev 3120)
+++ jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/storage/fs/TestJCRVSReadWrite.java 2010-09-16 13:41:50 UTC (rev 3121)
@@ -31,6 +31,7 @@
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.core.ItemImpl.ItemType;
import org.exoplatform.services.jcr.impl.core.NodeImpl;
import org.exoplatform.services.jcr.impl.dataflow.TransientNodeData;
import org.exoplatform.services.jcr.impl.dataflow.TransientPropertyData;
@@ -284,13 +285,20 @@
}
// copied from SessionDataManager
- protected ItemData getItemData(DataManager manager, NodeData parent, QPathEntry[] relPathEntries)
+ protected ItemData getItemData(DataManager manager, NodeData parent, QPathEntry[] relPathEntries, ItemType itemType)
throws RepositoryException
{
ItemData item = parent;
for (int i = 0; i < relPathEntries.length; i++)
{
- item = manager.getItemData(parent, relPathEntries[i]);
+ if (i == relPathEntries.length - 1)
+ {
+ item = manager.getItemData(parent, relPathEntries[i], itemType);
+ }
+ else
+ {
+ item = manager.getItemData(parent, relPathEntries[i], ItemType.UNKNOWN);
+ }
if (item == null)
break;
@@ -356,7 +364,7 @@
Set<QPathEntry[]> caseProps = new HashSet<QPathEntry[]>(props);
for (QPathEntry[] prop : caseProps)
{
- PropertyData p = (PropertyData)getItemData(manager, parent, prop);
+ PropertyData p = (PropertyData)getItemData(manager, parent, prop, ItemType.PROPERTY);
List<ValueData> vals = p.getValues();
for (int i = 0; i < vals.size(); i++)
{
Modified: jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/storage/jdbc/SQLBenchmarkTest.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/storage/jdbc/SQLBenchmarkTest.java 2010-09-16 11:23:57 UTC (rev 3120)
+++ jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/storage/jdbc/SQLBenchmarkTest.java 2010-09-16 13:41:50 UTC (rev 3121)
@@ -1,14 +1,5 @@
package org.exoplatform.services.jcr.impl.storage.jdbc;
-import java.sql.SQLException;
-import java.util.Arrays;
-import java.util.List;
-import java.util.concurrent.CountDownLatch;
-import java.util.concurrent.atomic.AtomicReference;
-
-import javax.jcr.InvalidItemStateException;
-import javax.jcr.RepositoryException;
-
import org.exoplatform.container.StandaloneContainer;
import org.exoplatform.services.jcr.BaseStandaloneTest;
import org.exoplatform.services.jcr.RepositoryService;
@@ -23,10 +14,20 @@
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.core.ItemImpl.ItemType;
import org.exoplatform.services.jcr.impl.core.RepositoryImpl;
import org.exoplatform.services.jcr.storage.WorkspaceDataContainer;
import org.exoplatform.services.jcr.storage.WorkspaceStorageConnection;
+import java.sql.SQLException;
+import java.util.Arrays;
+import java.util.List;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.atomic.AtomicReference;
+
+import javax.jcr.InvalidItemStateException;
+import javax.jcr.RepositoryException;
+
/*
* Copyright (C) 2003-2009 eXo Platform SAS.
*
@@ -55,21 +56,21 @@
*/
public class SQLBenchmarkTest
{
-/*
- static
- {
- try
+ /*
+ static
{
- Class.forName("com.jdbmonitor.MonitorDriver");
- System.out.println("Driver Loaded");
+ try
+ {
+ Class.forName("com.jdbmonitor.MonitorDriver");
+ System.out.println("Driver Loaded");
+ }
+ catch (ClassNotFoundException e)
+ {
+ e.printStackTrace();
+ }
+
}
- catch (ClassNotFoundException e)
- {
- e.printStackTrace();
- }
-
- }
-*/
+ */
/**
* @param args
*/
@@ -307,7 +308,7 @@
{
public ItemData execute(Object... args) throws Exception
{
- return getItemData((WorkspaceDataContainer)args[0], (NodeData)args[1], (QPathEntry)args[2]);
+ return getItemData((WorkspaceDataContainer)args[0], (NodeData)args[1], (QPathEntry)args[2], ItemType.NODE);
}
};
@@ -553,13 +554,13 @@
return true;
}
- public static ItemData getItemData(WorkspaceDataContainer dataContainer, NodeData parentData, QPathEntry name)
- throws RepositoryException, IllegalStateException
+ public static ItemData getItemData(WorkspaceDataContainer dataContainer, NodeData parentData, QPathEntry name,
+ ItemType itemType) throws RepositoryException, IllegalStateException
{
final WorkspaceStorageConnection con = dataContainer.openConnection();
try
{
- return con.getItemData(parentData, name);
+ return con.getItemData(parentData, name, itemType);
}
finally
{
@@ -675,6 +676,7 @@
{
Thread t = new Thread()
{
+ @Override
public void run()
{
try
Modified: jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/version/TestFrozenNodeInitializer.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/version/TestFrozenNodeInitializer.java 2010-09-16 11:23:57 UTC (rev 3120)
+++ jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/version/TestFrozenNodeInitializer.java 2010-09-16 13:41:50 UTC (rev 3121)
@@ -27,6 +27,7 @@
import org.exoplatform.services.jcr.datamodel.QPath;
import org.exoplatform.services.jcr.datamodel.QPathEntry;
import org.exoplatform.services.jcr.impl.Constants;
+import org.exoplatform.services.jcr.impl.core.ItemImpl.ItemType;
import org.exoplatform.services.jcr.impl.dataflow.TransientNodeData;
import java.util.List;
@@ -217,7 +218,7 @@
PropertyData vh =
(PropertyData)session.getTransientNodesManager().getItemData((NodeData)state.getData(),
- new QPathEntry(Constants.JCR_VERSIONHISTORY, 0));
+ new QPathEntry(Constants.JCR_VERSIONHISTORY, 0), ItemType.PROPERTY);
String vhUuid = new String(vh.getValues().get(0).getAsByteArray());
15 years, 8 months
exo-jcr SVN: r3120 - kernel/trunk/exo.kernel.component.ext.cache.impl.jboss.v3/src/main/java/org/exoplatform/services/cache/impl/jboss.
by do-not-reply@jboss.org
Author: nfilotto
Date: 2010-09-16 07:23:57 -0400 (Thu, 16 Sep 2010)
New Revision: 3120
Modified:
kernel/trunk/exo.kernel.component.ext.cache.impl.jboss.v3/src/main/java/org/exoplatform/services/cache/impl/jboss/ExoCacheFactoryImpl.java
Log:
EXOJCR-943: When the cache is not shareable the cluster name will be ${current-cluster-name} + "-" + ${region-name}
Modified: kernel/trunk/exo.kernel.component.ext.cache.impl.jboss.v3/src/main/java/org/exoplatform/services/cache/impl/jboss/ExoCacheFactoryImpl.java
===================================================================
--- kernel/trunk/exo.kernel.component.ext.cache.impl.jboss.v3/src/main/java/org/exoplatform/services/cache/impl/jboss/ExoCacheFactoryImpl.java 2010-09-16 11:02:45 UTC (rev 3119)
+++ kernel/trunk/exo.kernel.component.ext.cache.impl.jboss.v3/src/main/java/org/exoplatform/services/cache/impl/jboss/ExoCacheFactoryImpl.java 2010-09-16 11:23:57 UTC (rev 3120)
@@ -312,7 +312,7 @@
String clusterName = cfg.getClusterName();
if (clusterName != null && (clusterName = clusterName.trim()).length() > 0)
{
- cfg.setClusterName(clusterName + " " + region);
+ cfg.setClusterName(clusterName + "-" + region);
}
return cache;
}
15 years, 8 months
exo-jcr SVN: r3119 - in jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core: query/jbosscache and 1 other directory.
by do-not-reply@jboss.org
Author: nfilotto
Date: 2010-09-16 07:02:45 -0400 (Thu, 16 Sep 2010)
New Revision: 3119
Modified:
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/lock/jbosscache/CacheableLockManagerImpl.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/jbosscache/JBossCacheIndexChangesFilter.java
Log:
EXOJCR-942: The PrivilegedCacheHelper has been re-added to execute cache.start and cache.create
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/lock/jbosscache/CacheableLockManagerImpl.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/lock/jbosscache/CacheableLockManagerImpl.java 2010-09-16 06:08:55 UTC (rev 3118)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/lock/jbosscache/CacheableLockManagerImpl.java 2010-09-16 11:02:45 UTC (rev 3119)
@@ -274,7 +274,7 @@
config.getLockManager().getParameterBoolean(JBOSSCACHE_SHAREABLE, JBOSSCACHE_SHAREABLE_DEFAULT)
.booleanValue();
cache = ExoJBossCacheFactory.getUniqueInstance(CacheType.LOCK_CACHE, rootFqn, cache, shareable);
- cache.create();
+ PrivilegedCacheHelper.create(cache);
if (cache.getCacheStatus().startAllowed())
{
// Add the cache loader needed to prevent TimeoutException
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/jbosscache/JBossCacheIndexChangesFilter.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/jbosscache/JBossCacheIndexChangesFilter.java 2010-09-16 06:08:55 UTC (rev 3118)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/jbosscache/JBossCacheIndexChangesFilter.java 2010-09-16 11:02:45 UTC (rev 3119)
@@ -135,9 +135,10 @@
this.cache =
ExoJBossCacheFactory.getUniqueInstance(CacheType.INDEX_CACHE, rootFqn, initCache, config.getParameterBoolean(
PARAM_JBOSSCACHE_SHAREABLE, PARAM_JBOSSCACHE_SHAREABLE_DEFAULT));
- this.cache.create();
- this.cache.start();
+ PrivilegedCacheHelper.create(cache);
+ PrivilegedCacheHelper.start(cache);
+
// start will invoke cache listener which will notify handler that mode is changed
IndexerIoMode ioMode =
((CacheSPI)cache).getRPCManager().isCoordinator() ? IndexerIoMode.READ_WRITE : IndexerIoMode.READ_ONLY;
15 years, 8 months
exo-jcr SVN: r3118 - in jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl: core/query/jbosscache and 1 other directories.
by do-not-reply@jboss.org
Author: nfilotto
Date: 2010-09-16 02:08:55 -0400 (Thu, 16 Sep 2010)
New Revision: 3118
Modified:
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/lock/jbosscache/CacheableLockManagerImpl.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/jbosscache/JBossCacheIndexChangesFilter.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/jbosscache/JBossCacheWorkspaceStorageCache.java
Log:
EXOJCR-942: By default, the parameter jbosscache-shareable is set to false
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/lock/jbosscache/CacheableLockManagerImpl.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/lock/jbosscache/CacheableLockManagerImpl.java 2010-09-16 06:07:12 UTC (rev 3117)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/lock/jbosscache/CacheableLockManagerImpl.java 2010-09-16 06:08:55 UTC (rev 3118)
@@ -125,7 +125,7 @@
*/
public static final String JBOSSCACHE_SHAREABLE = "jbosscache-shareable";
- public static final Boolean JBOSSCACHE_SHAREABLE_DEFAULT = Boolean.TRUE;
+ public static final Boolean JBOSSCACHE_SHAREABLE_DEFAULT = Boolean.FALSE;
public static final String JBOSSCACHE_JDBC_CL_AUTO = "auto";
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/jbosscache/JBossCacheIndexChangesFilter.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/jbosscache/JBossCacheIndexChangesFilter.java 2010-09-16 06:07:12 UTC (rev 3117)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/jbosscache/JBossCacheIndexChangesFilter.java 2010-09-16 06:08:55 UTC (rev 3118)
@@ -73,7 +73,7 @@
*/
public static final String PARAM_JBOSSCACHE_SHAREABLE = "jbosscache-shareable";
- public static final Boolean PARAM_JBOSSCACHE_SHAREABLE_DEFAULT = Boolean.TRUE;
+ public static final Boolean PARAM_JBOSSCACHE_SHAREABLE_DEFAULT = Boolean.FALSE;
private final Cache<Serializable, Object> cache;
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/jbosscache/JBossCacheWorkspaceStorageCache.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/jbosscache/JBossCacheWorkspaceStorageCache.java 2010-09-16 06:07:12 UTC (rev 3117)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/jbosscache/JBossCacheWorkspaceStorageCache.java 2010-09-16 06:08:55 UTC (rev 3118)
@@ -105,7 +105,7 @@
*/
public static final String JBOSSCACHE_SHAREABLE = "jbosscache-shareable";
- public static final Boolean JBOSSCACHE_SHAREABLE_DEFAULT = Boolean.TRUE;
+ public static final Boolean JBOSSCACHE_SHAREABLE_DEFAULT = Boolean.FALSE;
public static final long JBOSSCACHE_EXPIRATION_DEFAULT = 900000; // 15 minutes
15 years, 8 months