exo-jcr SVN: r627 - jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/db.
by do-not-reply@jboss.org
Author: tolusha
Date: 2009-11-13 04:53:11 -0500 (Fri, 13 Nov 2009)
New Revision: 627
Modified:
jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/db/SingleDbJDBCConnection.java
Log:
EXOJCR-221: fix SQL statement
Modified: jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/db/SingleDbJDBCConnection.java
===================================================================
--- jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/db/SingleDbJDBCConnection.java 2009-11-13 09:49:57 UTC (rev 626)
+++ jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/db/SingleDbJDBCConnection.java 2009-11-13 09:53:11 UTC (rev 627)
@@ -74,7 +74,7 @@
protected PreparedStatement findValueByPropertyIdOrderNumber;
protected PreparedStatement findNodesByParentId;
-
+
protected PreparedStatement findNodesCountByParentId;
protected PreparedStatement findPropertiesByParentId;
@@ -195,8 +195,9 @@
FIND_NODES_BY_PARENTID =
"select * from JCR_SITEM" + " where I_CLASS=1 and CONTAINER_NAME=? and PARENT_ID=?" + " order by N_ORDER_NUM";
- FIND_NODES_COUNT_BY_PARENTID = "select count(ID) from JCR_MITEM" + " where I_CLASS=1 and CONTAINER_NAME=? and PARENT_ID=?";
-
+ FIND_NODES_COUNT_BY_PARENTID =
+ "select count(ID) from JCR_SITEM" + " where I_CLASS=1 and CONTAINER_NAME=? and PARENT_ID=?";
+
FIND_PROPERTIES_BY_PARENTID =
"select * from JCR_SITEM" + " where I_CLASS=2 and CONTAINER_NAME=? and PARENT_ID=?" + " order by ID";
@@ -338,7 +339,7 @@
findNodesByParentId.setString(2, parentCid);
return findNodesByParentId.executeQuery();
}
-
+
/**
* {@inheritDoc}
*/
@@ -353,7 +354,7 @@
findNodesCountByParentId.setString(1, containerName);
findNodesCountByParentId.setString(2, parentCid);
return findNodesCountByParentId.executeQuery();
- }
+ }
/**
* {@inheritDoc}
16 years, 8 months
exo-jcr SVN: r626 - jcr/branches/1.12.0-JBC/component/core/src/test/java/org/exoplatform/services/jcr/impl/storage/jbosscache.
by do-not-reply@jboss.org
Author: areshetnyak
Date: 2009-11-13 04:49:57 -0500 (Fri, 13 Nov 2009)
New Revision: 626
Modified:
jcr/branches/1.12.0-JBC/component/core/src/test/java/org/exoplatform/services/jcr/impl/storage/jbosscache/JDBCCacheLoaderTest.java
Log:
EXOJCR-201 : The JDBCCacheLoaderTest was changed.
Modified: jcr/branches/1.12.0-JBC/component/core/src/test/java/org/exoplatform/services/jcr/impl/storage/jbosscache/JDBCCacheLoaderTest.java
===================================================================
--- jcr/branches/1.12.0-JBC/component/core/src/test/java/org/exoplatform/services/jcr/impl/storage/jbosscache/JDBCCacheLoaderTest.java 2009-11-13 09:43:29 UTC (rev 625)
+++ jcr/branches/1.12.0-JBC/component/core/src/test/java/org/exoplatform/services/jcr/impl/storage/jbosscache/JDBCCacheLoaderTest.java 2009-11-13 09:49:57 UTC (rev 626)
@@ -661,7 +661,10 @@
assertNotNull(childs);
-
+ assertEquals(3, childs.size());
+ assertTrue(childs.contains("[]node1:1"));
+ assertTrue(childs.contains("[]node2:1"));
+ assertTrue(childs.contains("[]node3:1"));
}
public void testGetChildProperties() throws Exception
16 years, 8 months
exo-jcr SVN: r625 - jcr/branches/1.12.0-JBC/component/core/src/test/java/org/exoplatform/services/jcr/impl/storage/jbosscache.
by do-not-reply@jboss.org
Author: areshetnyak
Date: 2009-11-13 04:43:29 -0500 (Fri, 13 Nov 2009)
New Revision: 625
Modified:
jcr/branches/1.12.0-JBC/component/core/src/test/java/org/exoplatform/services/jcr/impl/storage/jbosscache/JDBCCacheLoaderTest.java
Log:
EXOJCR-201 : The JDBCCacheLoaderTest was changed.
Modified: jcr/branches/1.12.0-JBC/component/core/src/test/java/org/exoplatform/services/jcr/impl/storage/jbosscache/JDBCCacheLoaderTest.java
===================================================================
--- jcr/branches/1.12.0-JBC/component/core/src/test/java/org/exoplatform/services/jcr/impl/storage/jbosscache/JDBCCacheLoaderTest.java 2009-11-13 09:40:49 UTC (rev 624)
+++ jcr/branches/1.12.0-JBC/component/core/src/test/java/org/exoplatform/services/jcr/impl/storage/jbosscache/JDBCCacheLoaderTest.java 2009-11-13 09:43:29 UTC (rev 625)
@@ -242,7 +242,7 @@
WorkspaceStorageConnection conn = persistentContainer.openConnection();
// add root (/) with jcr:primaryType
- addDbNode(conn, Constants.ROOT_PATH, Constants.ROOT_UUID, Constants.NT_UNSTRUCTURED, null);
+ addDbNode(conn, Constants.ROOT_PATH, Constants.ROOT_UUID, Constants.NT_UNSTRUCTURED, Constants.ROOT_PARENT_UUID);
// add property (/jcr:mixinTypes)
List<InternalQName> mixins = new ArrayList<InternalQName>();
@@ -260,7 +260,7 @@
WorkspaceStorageConnection conn = persistentContainer.openConnection();
// add root (/) with jcr:primaryType
- addDbNode(conn, Constants.ROOT_PATH, Constants.ROOT_UUID, Constants.NT_UNSTRUCTURED, null);
+ addDbNode(conn, Constants.ROOT_PATH, Constants.ROOT_UUID, Constants.NT_UNSTRUCTURED, Constants.ROOT_PARENT_UUID);
// add property (/jcr:mixinTypes)
List<InternalQName> mixins = new ArrayList<InternalQName>();
16 years, 8 months
exo-jcr SVN: r624 - in jcr/branches/1.12.0-JBC/component/core/src: test/java/org/exoplatform/services/jcr/impl/storage/jbosscache and 1 other directory.
by do-not-reply@jboss.org
Author: areshetnyak
Date: 2009-11-13 04:40:49 -0500 (Fri, 13 Nov 2009)
New Revision: 624
Modified:
jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jbosscache/JDBCCacheLoader.java
jcr/branches/1.12.0-JBC/component/core/src/test/java/org/exoplatform/services/jcr/impl/storage/jbosscache/JDBCCacheLoaderTest.java
Log:
EXOJCR-201 : The JDBCCacheLoaderTest was changed.
Modified: jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jbosscache/JDBCCacheLoader.java
===================================================================
--- jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jbosscache/JDBCCacheLoader.java 2009-11-13 09:16:23 UTC (rev 623)
+++ jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jbosscache/JDBCCacheLoader.java 2009-11-13 09:40:49 UTC (rev 624)
@@ -488,7 +488,7 @@
NodeData parentNodeData = (NodeData)conn.getItemData((String) name.get(1));
if (parentNodeData == null)
- throw new JDBCCacheLoaderException("The parent node with ID = " + (String)name.get(2) + " not exis, FQN = '" + name + "'.");
+ throw new JDBCCacheLoaderException("The parent node with ID = " + (String)name.get(1) + " not exis, FQN = '" + name + "'.");
// get child nodes by parent Id
for (NodeData node : conn.getChildNodesData(parentNodeData))
Modified: jcr/branches/1.12.0-JBC/component/core/src/test/java/org/exoplatform/services/jcr/impl/storage/jbosscache/JDBCCacheLoaderTest.java
===================================================================
--- jcr/branches/1.12.0-JBC/component/core/src/test/java/org/exoplatform/services/jcr/impl/storage/jbosscache/JDBCCacheLoaderTest.java 2009-11-13 09:16:23 UTC (rev 623)
+++ jcr/branches/1.12.0-JBC/component/core/src/test/java/org/exoplatform/services/jcr/impl/storage/jbosscache/JDBCCacheLoaderTest.java 2009-11-13 09:40:49 UTC (rev 624)
@@ -53,6 +53,7 @@
import java.util.List;
import java.util.Map;
import java.util.Properties;
+import java.util.Set;
import javax.naming.Context;
import javax.naming.InitialContext;
@@ -241,7 +242,7 @@
WorkspaceStorageConnection conn = persistentContainer.openConnection();
// add root (/) with jcr:primaryType
- addDbNode(conn, Constants.ROOT_PATH, Constants.ROOT_UUID, Constants.NT_UNSTRUCTURED);
+ addDbNode(conn, Constants.ROOT_PATH, Constants.ROOT_UUID, Constants.NT_UNSTRUCTURED, null);
// add property (/jcr:mixinTypes)
List<InternalQName> mixins = new ArrayList<InternalQName>();
@@ -259,7 +260,7 @@
WorkspaceStorageConnection conn = persistentContainer.openConnection();
// add root (/) with jcr:primaryType
- addDbNode(conn, Constants.ROOT_PATH, Constants.ROOT_UUID, Constants.NT_UNSTRUCTURED);
+ addDbNode(conn, Constants.ROOT_PATH, Constants.ROOT_UUID, Constants.NT_UNSTRUCTURED, null);
// add property (/jcr:mixinTypes)
List<InternalQName> mixins = new ArrayList<InternalQName>();
@@ -280,11 +281,11 @@
* @param primaryType InternalQName
* @throws Exception
*/
- private void addDbNode(WorkspaceStorageConnection conn, QPath root, String nodeId, InternalQName primaryType)
+ private void addDbNode(WorkspaceStorageConnection conn, QPath root, String nodeId, InternalQName primaryType, String parentNodeId)
throws Exception
{
// add root (/)
- conn.add(new TransientNodeData(root, nodeId, 1, primaryType, new InternalQName[0], 0, null,
+ conn.add(new TransientNodeData(root, nodeId, 1, primaryType, new InternalQName[0], 0, parentNodeId,
new AccessControlList()));
// add property (/jcr:primaryType)
@@ -457,7 +458,7 @@
String nodeId = IdGenerator.generate();
addDbNode(conn, QPath.makeChildPath(Constants.ROOT_PATH, InternalQName.parse("[]node")), nodeId,
- Constants.NT_UNSTRUCTURED);
+ Constants.NT_UNSTRUCTURED, Constants.ROOT_UUID);
conn.commit();
List<Modification> modifications = new ArrayList<Modification>();
@@ -495,7 +496,7 @@
String nodeId = IdGenerator.generate();
addDbNode(conn, QPath.makeChildPath(Constants.ROOT_PATH, InternalQName.parse("[]node")), nodeId,
- Constants.NT_UNSTRUCTURED);
+ Constants.NT_UNSTRUCTURED, Constants.ROOT_UUID);
conn.commit();
conn = persistentContainer.openConnection();
@@ -553,7 +554,7 @@
String nodeId = IdGenerator.generate();
addDbNode(conn, QPath.makeChildPath(Constants.ROOT_PATH, InternalQName.parse("[]node")), nodeId,
- Constants.NT_UNSTRUCTURED);
+ Constants.NT_UNSTRUCTURED, Constants.ROOT_UUID);
conn.commit();
// tests it
@@ -583,7 +584,7 @@
WorkspaceStorageConnection conn = persistentContainer.openConnection();
String nodeId = IdGenerator.generate();
- addDbNode(conn, QPath.makeChildPath(Constants.ROOT_PATH, InternalQName.parse("[]node")), nodeId, Constants.NT_UNSTRUCTURED);
+ addDbNode(conn, QPath.makeChildPath(Constants.ROOT_PATH, InternalQName.parse("[]node")), nodeId, Constants.NT_UNSTRUCTURED, Constants.ROOT_UUID);
conn.commit();
// tests it
@@ -643,8 +644,23 @@
{
// prepare
+ WorkspaceStorageConnection conn = persistentContainer.openConnection();
+ QPath baseNodePath = QPath.makeChildPath(Constants.ROOT_PATH, InternalQName.parse("[]baseNode"));
+ String baseNodeId = IdGenerator.generate();
+ addDbNode(conn, baseNodePath, baseNodeId,Constants.NT_UNSTRUCTURED, Constants.ROOT_UUID);
+
+ // add child nodes [node1, node2, node3]
+ addDbNode(conn, QPath.makeChildPath(baseNodePath, InternalQName.parse("[]node1")), IdGenerator.generate(), Constants.NT_UNSTRUCTURED, baseNodeId);
+ addDbNode(conn, QPath.makeChildPath(baseNodePath, InternalQName.parse("[]node2")), IdGenerator.generate(), Constants.NT_UNSTRUCTURED, baseNodeId);
+ addDbNode(conn, QPath.makeChildPath(baseNodePath, InternalQName.parse("[]node3")), IdGenerator.generate(), Constants.NT_UNSTRUCTURED, baseNodeId);
+ conn.commit();
+
// tests it
+ Set<String> childs = (Set<String>) loader.getChildrenNames(Fqn.fromElements(JBossCacheStorage.NODES, baseNodeId));
+
+ assertNotNull(childs);
+
}
16 years, 8 months
exo-jcr SVN: r623 - in ws/trunk: exo.ws.frameworks.servlet and 2 other directories.
by do-not-reply@jboss.org
Author: aparfonov
Date: 2009-11-13 04:16:23 -0500 (Fri, 13 Nov 2009)
New Revision: 623
Modified:
ws/trunk/exo.ws.frameworks.servlet/pom.xml
ws/trunk/exo.ws.testframework/pom.xml
ws/trunk/exo.ws.testframework/src/main/java/org/exoplatform/services/test/mock/MockHttpServletResponse.java
ws/trunk/pom.xml
Log:
EXOJCR-239 :
Modified: ws/trunk/exo.ws.frameworks.servlet/pom.xml
===================================================================
--- ws/trunk/exo.ws.frameworks.servlet/pom.xml 2009-11-13 02:39:29 UTC (rev 622)
+++ ws/trunk/exo.ws.frameworks.servlet/pom.xml 2009-11-13 09:16:23 UTC (rev 623)
@@ -34,6 +34,10 @@
<dependencies>
<dependency>
+ <groupId>javax.servlet</groupId>
+ <artifactId>servlet-api</artifactId>
+ </dependency>
+ <dependency>
<groupId>org.exoplatform.kernel</groupId>
<artifactId>exo.kernel.component.common</artifactId>
</dependency>
Modified: ws/trunk/exo.ws.testframework/pom.xml
===================================================================
--- ws/trunk/exo.ws.testframework/pom.xml 2009-11-13 02:39:29 UTC (rev 622)
+++ ws/trunk/exo.ws.testframework/pom.xml 2009-11-13 09:16:23 UTC (rev 623)
@@ -36,8 +36,6 @@
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
- <version>2.3</version>
- <scope>compile</scope>
</dependency>
</dependencies>
</project>
\ No newline at end of file
Modified: ws/trunk/exo.ws.testframework/src/main/java/org/exoplatform/services/test/mock/MockHttpServletResponse.java
===================================================================
--- ws/trunk/exo.ws.testframework/src/main/java/org/exoplatform/services/test/mock/MockHttpServletResponse.java 2009-11-13 02:39:29 UTC (rev 622)
+++ ws/trunk/exo.ws.testframework/src/main/java/org/exoplatform/services/test/mock/MockHttpServletResponse.java 2009-11-13 09:16:23 UTC (rev 623)
@@ -81,7 +81,7 @@
protected int contentLength = -1;
/** The encoding. */
- protected String encoding = null;
+ protected String charset = null;
/** The date format we will use for creating date headers. */
protected static final SimpleDateFormat format = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss zzz", Locale.US);
@@ -364,15 +364,23 @@
*/
public String getCharacterEncoding()
{
- if (encoding == null)
+ if (charset == null)
return ("UTF-8");
else
- return (encoding);
+ return (charset);
}
/**
* {@inheritDoc}
*/
+ public String getContentType()
+ {
+ return contentType;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
public Locale getLocale()
{
return locale;
@@ -391,6 +399,14 @@
/**
* {@inheritDoc}
*/
+ public void setCharacterEncoding(String charset)
+ {
+ this.charset = charset;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
public void setContentLength(int length)
{
this.contentLength = length;
Modified: ws/trunk/pom.xml
===================================================================
--- ws/trunk/pom.xml 2009-11-13 02:39:29 UTC (rev 622)
+++ ws/trunk/pom.xml 2009-11-13 09:16:23 UTC (rev 623)
@@ -140,6 +140,11 @@
<artifactId>jsr250-api</artifactId>
<version>1.0</version>
</dependency>
+ <dependency>
+ <groupId>javax.servlet</groupId>
+ <artifactId>servlet-api</artifactId>
+ <version>2.4</version>
+ </dependency>
</dependencies>
</dependencyManagement>
</project>
16 years, 8 months
exo-jcr SVN: r622 - in jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/test: resources/conf/standalone and 1 other directory.
by do-not-reply@jboss.org
Author: pnedonosko
Date: 2009-11-12 21:39:29 -0500 (Thu, 12 Nov 2009)
New Revision: 622
Added:
jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/test/resources/conf/standalone/test-configuration.mysql.xml
jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/test/resources/conf/standalone/test-jcr-config.mysql.xml
Modified:
jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/load/perf/TestBulkItemsAdd.java
Log:
EXOJCR-221: For load testing: simple test and MySQL config (not a part of fix)
Modified: jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/load/perf/TestBulkItemsAdd.java
===================================================================
--- jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/load/perf/TestBulkItemsAdd.java 2009-11-13 02:37:50 UTC (rev 621)
+++ jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/load/perf/TestBulkItemsAdd.java 2009-11-13 02:39:29 UTC (rev 622)
@@ -18,45 +18,63 @@
*/
package org.exoplatform.services.jcr.load.perf;
-import org.exoplatform.services.jcr.JcrAPIBaseTest;
-
import java.io.ByteArrayInputStream;
+import java.io.File;
+import java.io.PrintWriter;
import java.util.Calendar;
import javax.jcr.Node;
+import org.exoplatform.services.jcr.JcrAPIBaseTest;
+
/**
* Created by The eXo Platform SAS Author : Peter Nedonosko peter.nedonosko(a)exoplatform.com.ua
* 20.07.2006
*
- * @version $Id: TestBulkItemsAdd.java 34801 2009-07-31 15:44:50Z dkatayev $
+ * @version $Id: TestBulkItemsAdd.java 352 2009-10-23 09:28:36Z pnedonosko $
*/
public class TestBulkItemsAdd extends JcrAPIBaseTest
{
public void testNodeAdd() throws Exception
{
+ StringBuilder stats = new StringBuilder();
+
Node testRoot = session.getRootNode().addNode("testRoot");
session.save();
long startTime = System.currentTimeMillis();
- int nodesCount = 250;
+ int nodesCount = 10000;
for (int i = 0; i < nodesCount; i++)
{
long addTime = System.currentTimeMillis();
String nodeName = "_" + i + "_node";
Node n = testRoot.addNode(nodeName);
long finishTime = System.currentTimeMillis();
- log.info("add node " + nodeName + ", " + (System.currentTimeMillis() - addTime) + "ms, "
- + (finishTime - startTime) + "ms");
+ //log.info("add node " + nodeName + ", " + (System.currentTimeMillis() - addTime) + "ms, "
+ // + (finishTime - startTime) + "ms");
+ //String stat = (System.currentTimeMillis() - addTime) + ";" + (finishTime - startTime);
+ stats.append(i);
+ stats.append(";");
+ stats.append((System.currentTimeMillis() - addTime));
+ stats.append(";");
+ stats.append((finishTime - startTime));
+ stats.append("\r\n");
}
log.info("Nodes added " + nodesCount + ", " + (System.currentTimeMillis() - startTime) + "ms");
startTime = System.currentTimeMillis();
log.info("Nodes will be saved, wait few minutes...");
testRoot.save();
log.info("Nodes saved " + nodesCount + ", " + (System.currentTimeMillis() - startTime) + "ms");
+
+ // save stats
+ PrintWriter statFile = new PrintWriter(new File("stats.txt"));
+ statFile.write(stats.toString());
+ statFile.close();
+
+ log.info("Test done");
}
- public void testNtFileAdd() throws Exception
+ public void _testNtFileAdd() throws Exception
{
Node testRoot = session.getRootNode().addNode("testRoot");
session.save();
Added: jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/test/resources/conf/standalone/test-configuration.mysql.xml
===================================================================
--- jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/test/resources/conf/standalone/test-configuration.mysql.xml (rev 0)
+++ jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/test/resources/conf/standalone/test-configuration.mysql.xml 2009-11-13 02:39:29 UTC (rev 622)
@@ -0,0 +1,498 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!--
+
+ Copyright (C) 2009 eXo Platform SAS.
+
+ This is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of
+ the License, or (at your option) any later version.
+
+ This software is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this software; if not, write to the Free
+ Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+
+-->
+<configuration
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.exoplaform.org/xml/ns/kernel_1_0.xsd http://www.exoplaform.org/xml/ns/kernel_1_0.xsd"
+ xmlns="http://www.exoplaform.org/xml/ns/kernel_1_0.xsd">
+ <component>
+ <key>org.exoplatform.services.log.LogConfigurationInitializer</key>
+ <type>org.exoplatform.services.log.LogConfigurationInitializer</type>
+ <init-params>
+ <value-param>
+ <name>logger</name>
+ <value>org.exoplatform.services.log.impl.BufferedLog4JLogger</value>
+ </value-param>
+ <value-param>
+ <name>configurator</name>
+ <value>org.exoplatform.services.log.impl.Log4JConfigurator</value>
+ </value-param>
+ <properties-param>
+ <name>properties</name>
+ <description>Log4J properties</description>
+ <property name="log4j.rootLogger" value="INFO, stdout, file"/>
+
+ <property name="log4j.appender.stdout" value="org.apache.log4j.ConsoleAppender"/>
+ <property name="log4j.appender.stdout.threshold" value="DEBUG"/>
+
+ <property name="log4j.appender.stdout.layout" value="org.apache.log4j.PatternLayout"/>
+ <property name="log4j.appender.stdout.layout.ConversionPattern"
+ value="%d{dd.MM.yyyy HH:mm:ss} *%-5p* [%t] %c{1}: %m (%F, line %L) %n"/>
+
+ <property name="log4j.appender.file" value="org.apache.log4j.FileAppender"/>
+ <property name="log4j.appender.file.File" value="target/jcr.log"/>
+
+ <property name="log4j.appender.file.layout" value="org.apache.log4j.PatternLayout"/>
+ <property name="log4j.appender.file.layout.ConversionPattern"
+ value="%d{dd.MM.yyyy HH:mm:ss} *%-5p* [%t] %c{1}: %m (%F, line %L) %n"/>
+
+ <property name="log4j.category.jcr.FileCleaner" value="DEBUG"/>
+
+ <!-- property name="log4j.category.jcr.JDBCStorageConnection" value="DEBUG"/>
+ <property name="log4j.category.jcr.NodeImpl" value="DEBUG"/ -->
+
+ <!-- property name="log4j.category.jcr.WorkspaceStorageCacheImpl" value="DEBUG"/ -->
+ <!-- property name="log4j.category.database.DBSchemaCreator" value="DEBUG"/ -->
+ <!-- property name="log4j.category.jcr.WorkspaceDataReplicator" value="DEBUG"/ -->
+
+ <!-- property name="log4j.category.jcr.WorkspaceStorageCacheImpl" value="DEBUG"/ -->
+ <!-- property name="log4j.category.jcr.WorkspacePersistentDataManager" value="DEBUG"/ -->
+ <!-- property name="log4j.category.jcr.SessionDataManager" value="DEBUG"/ -->
+ </properties-param>
+
+ <!-- value-param>
+ <name>logger</name>
+ <value>org.exoplatform.services.log.impl.BufferedSimpleLog</value>
+ </value-param>
+ <value-param>
+ <name>configurator</name>
+ <value>org.exoplatform.services.log.impl.SimpleLogConfigurator</value>
+ </value-param>
+ <properties-param>
+ <name>properties</name>
+ <description>SimpleLog properties</description>
+ <property name="org.apache.commons.logging.simplelog.defaultlog" value="debug"/>
+ <property name="org.apache.commons.logging.simplelog.showdatetime" value="true"/>
+ </properties-param -->
+
+ <!-- value-param>
+ <name>logger</name>
+ <value>org.exoplatform.services.log.impl.BufferedJdk14Logger</value>
+ </value-param>
+ <value-param>
+ <name>configurator</name>
+ <value>org.exoplatform.services.log.impl.Jdk14Configurator</value>
+ </value-param>
+ <properties-param>
+ <name>properties</name>
+ <description>jdk1.4 Logger properties</description>
+ <property name="handlers" value="java.util.logging.ConsoleHandler"/>
+ <property name=".level" value="FINE"/>
+ <property name="java.util.logging.ConsoleHandler.level" value="FINE"/>
+ </properties-param -->
+
+ </init-params>
+ </component>
+
+ <component>
+ <key>org.exoplatform.services.jcr.RepositoryService</key>
+ <type>org.exoplatform.services.jcr.impl.RepositoryServiceImpl</type>
+ <component-plugins>
+ <component-plugin>
+ <name>add.namespaces</name>
+ <set-method>addPlugin</set-method>
+ <type>org.exoplatform.services.jcr.impl.AddNamespacesPlugin</type>
+ <init-params>
+ <properties-param>
+ <name>namespaces</name>
+ <property name="test" value="http://www.apache.org/jackrabbit/test"/>
+ <property name="exojcrtest" value="http://www.exoplatform.org/jcr/test/1.0"/>
+ <property name="rma" value="http://www.rma.com/jcr/"/>
+ <property name="metadata" value="http://www.exoplatform.com/jcr/metadata/1.1/"/>
+ <property name="dc" value="http://purl.org/dc/elements/1.1/"/>
+ </properties-param>
+ </init-params>
+ </component-plugin>
+ <component-plugin>
+ <name>add.nodeType</name>
+ <set-method>addPlugin</set-method>
+ <type>org.exoplatform.services.jcr.impl.AddNodeTypePlugin</type>
+ <init-params>
+ <values-param>
+ <name>autoCreatedInNewRepository</name>
+ <description>Node types configuration file</description>
+ <value>jar:/conf/test/nodetypes-tck.xml</value>
+ <value>jar:/conf/test/nodetypes-impl.xml</value>
+ <value>jar:/conf/test/nodetypes-usecase.xml</value>
+ <value>jar:/conf/test/nodetypes-config.xml</value>
+ <value>jar:/conf/test/nodetypes-config-extended.xml</value>
+ </values-param>
+
+ <values-param>
+ <name>testInitNodeTypesRepository</name>
+ <description>
+ Node types configuration file for repository with name testInitNodeTypesRepository
+ </description>
+ <value>jar:/conf/test/nodetypes-test.xml</value>
+ </values-param>
+
+ <values-param>
+ <name>testInitNodeTypesRepositoryTest2</name>
+ <description>
+ Node types configuration file for repository with name testInitNodeTypesRepositoryTest2
+ </description>
+ <value>jar:/conf/test/nodetypes-test2.xml</value>
+ </values-param>
+
+ <!--values-param>
+ <name>testInitNodeTypesRepositoryTest3</name>
+ <description>Node types from ext. Needed bacause core starup earlie than ext</description>
+ <value>jar:/conf/test/nodetypes-test3_ext.xml</value>
+ </values-param-->
+
+ </init-params>
+ </component-plugin>
+ </component-plugins>
+ </component>
+
+ <component>
+ <key>org.exoplatform.services.jcr.config.RepositoryServiceConfiguration</key>
+ <type>org.exoplatform.services.jcr.impl.config.RepositoryServiceConfigurationImpl</type>
+ <init-params>
+ <value-param>
+ <name>conf-path</name>
+ <description>JCR configuration file</description>
+ <value>jar:/conf/standalone/test-jcr-config.mysql.xml</value>
+ </value-param>
+ <!-- properties-param>
+ <name>working-conf</name>
+ <description>working-conf</description>
+ <property name="source-name" value="jdbcjcr"/>
+ <property name="dialect" value="mysql"/>
+ <property name="persister-class-name" value="org.exoplatform.services.jcr.impl.config.JDBCConfigurationPersister"/>
+ </properties-param -->
+ </init-params>
+ </component>
+
+ <component>
+ <type>org.exoplatform.services.organization.impl.mock.DummyOrganizationService</type>
+ </component>
+
+ <component>
+ <key>org.exoplatform.services.security.Authenticator</key>
+ <type>org.exoplatform.services.organization.auth.OrganizationAuthenticatorImpl</type>
+ </component>
+
+ <component>
+ <type>org.exoplatform.services.jcr.impl.ext.action.SessionActionCatalog</type>
+ </component>
+
+ <component>
+ <key>org.exoplatform.services.transaction.TransactionService</key>
+ <type>org.exoplatform.services.transaction.impl.jotm.TransactionServiceJotmImpl</type>
+ <init-params>
+ <value-param>
+ <name>timeout</name>
+ <value>5</value>
+ </value-param>
+ </init-params>
+ </component>
+
+ <external-component-plugins>
+ <target-component>org.exoplatform.services.naming.InitialContextInitializer</target-component>
+ <component-plugin>
+ <name>bind.datasource</name>
+ <set-method>addPlugin</set-method>
+ <type>org.exoplatform.services.naming.BindReferencePlugin</type>
+ <init-params>
+ <value-param>
+ <name>bind-name</name>
+ <value>jdbcjcr</value>
+ </value-param>
+ <value-param>
+ <name>class-name</name>
+ <value>javax.sql.DataSource</value>
+ </value-param>
+ <value-param>
+ <name>factory</name>
+ <value>org.apache.commons.dbcp.BasicDataSourceFactory</value>
+ </value-param>
+ <properties-param>
+ <name>ref-addresses</name>
+ <description>ref-addresses</description>
+ <property name="driverClassName" value="com.mysql.jdbc.Driver" />
+ <property name="url" value="jdbc:mysql://localhost:13306/portal" />
+ <property name="username" value="exoadmin" />
+ <property name="password" value="exo12321" />
+ <property name="maxActive" value="20" />
+ <property name="maxIdle" value="5" />
+ <property name="initialSize" value="2" />
+ </properties-param>
+ </init-params>
+ </component-plugin>
+ <component-plugin>
+ <name>bind.datasource</name>
+ <set-method>addPlugin</set-method>
+ <type>org.exoplatform.services.naming.BindReferencePlugin</type>
+ <init-params>
+ <value-param>
+ <name>bind-name</name>
+ <value>jdbcjcr1</value>
+ </value-param>
+ <value-param>
+ <name>class-name</name>
+ <value>javax.sql.DataSource</value>
+ </value-param>
+ <value-param>
+ <name>factory</name>
+ <value>org.apache.commons.dbcp.BasicDataSourceFactory</value>
+ </value-param>
+ <properties-param>
+ <name>ref-addresses</name>
+ <description>ref-addresses</description>
+ <property name="driverClassName" value="com.mysql.jdbc.Driver" />
+ <property name="url" value="jdbc:mysql://localhost:13306/jcr1" />
+ <property name="username" value="exoadmin" />
+ <property name="password" value="exo12321" />
+ <property name="maxActive" value="20" />
+ <property name="maxIdle" value="5" />
+ <property name="initialSize" value="2" />
+ </properties-param>
+ </init-params>
+ </component-plugin>
+ <component-plugin>
+ <name>bind.datasource</name>
+ <set-method>addPlugin</set-method>
+ <type>org.exoplatform.services.naming.BindReferencePlugin</type>
+ <init-params>
+ <value-param>
+ <name>bind-name</name>
+ <value>jdbcjcr2</value>
+ </value-param>
+ <value-param>
+ <name>class-name</name>
+ <value>javax.sql.DataSource</value>
+ </value-param>
+ <value-param>
+ <name>factory</name>
+ <value>org.apache.commons.dbcp.BasicDataSourceFactory</value>
+ </value-param>
+ <properties-param>
+ <name>ref-addresses</name>
+ <description>ref-addresses</description>
+ <property name="driverClassName" value="com.mysql.jdbc.Driver" />
+ <property name="url" value="jdbc:mysql://localhost:13306/jcr2" />
+ <property name="username" value="exoadmin" />
+ <property name="password" value="exo12321" />
+ <property name="maxActive" value="20" />
+ <property name="maxIdle" value="5" />
+ <property name="initialSize" value="2" />
+ </properties-param>
+ </init-params>
+ </component-plugin>
+ <component-plugin>
+ <name>bind.datasource</name>
+ <set-method>addPlugin</set-method>
+ <type>org.exoplatform.services.naming.BindReferencePlugin</type>
+ <init-params>
+ <value-param>
+ <name>bind-name</name>
+ <value>jdbcjcr3</value>
+ </value-param>
+ <value-param>
+ <name>class-name</name>
+ <value>javax.sql.DataSource</value>
+ </value-param>
+ <value-param>
+ <name>factory</name>
+ <value>org.apache.commons.dbcp.BasicDataSourceFactory</value>
+ </value-param>
+ <properties-param>
+ <name>ref-addresses</name>
+ <description>ref-addresses</description>
+ <property name="driverClassName" value="com.mysql.jdbc.Driver" />
+ <property name="url" value="jdbc:mysql://localhost:13306/jcr3" />
+ <property name="username" value="exoadmin" />
+ <property name="password" value="exo12321" />
+ <property name="maxActive" value="20" />
+ <property name="maxIdle" value="5" />
+ <property name="initialSize" value="2" />
+ </properties-param>
+ </init-params>
+ </component-plugin>
+ <component-plugin>
+ <name>bind.datasource</name>
+ <set-method>addPlugin</set-method>
+ <type>org.exoplatform.services.naming.BindReferencePlugin</type>
+ <init-params>
+ <value-param>
+ <name>bind-name</name>
+ <value>jdbcjcrtck</value>
+ </value-param>
+ <value-param>
+ <name>class-name</name>
+ <value>javax.sql.DataSource</value>
+ </value-param>
+ <value-param>
+ <name>factory</name>
+ <value>org.apache.commons.dbcp.BasicDataSourceFactory</value>
+ </value-param>
+ <properties-param>
+ <name>ref-addresses</name>
+ <description>ref-addresses</description>
+ <property name="driverClassName" value="com.mysql.jdbc.Driver" />
+ <property name="url" value="jdbc:mysql://localhost:13306/portaltck" />
+ <property name="username" value="exoadmin" />
+ <property name="password" value="exo12321" />
+ <property name="maxActive" value="20" />
+ <property name="maxIdle" value="5" />
+ <property name="initialSize" value="2" />
+ </properties-param>
+ </init-params>
+ </component-plugin>
+ <component-plugin>
+ <name>bind.datasource</name>
+ <set-method>addPlugin</set-method>
+ <type>org.exoplatform.services.naming.BindReferencePlugin</type>
+ <init-params>
+ <value-param>
+ <name>bind-name</name>
+ <value>jdbcjcr1tck</value>
+ </value-param>
+ <value-param>
+ <name>class-name</name>
+ <value>javax.sql.DataSource</value>
+ </value-param>
+ <value-param>
+ <name>factory</name>
+ <value>org.apache.commons.dbcp.BasicDataSourceFactory</value>
+ </value-param>
+ <properties-param>
+ <name>ref-addresses</name>
+ <description>ref-addresses</description>
+ <property name="driverClassName" value="com.mysql.jdbc.Driver" />
+ <property name="url" value="jdbc:mysql://localhost:13306/jcrtck" />
+ <property name="username" value="exoadmin" />
+ <property name="password" value="exo12321" />
+ <property name="maxActive" value="20" />
+ <property name="maxIdle" value="5" />
+ <property name="initialSize" value="2" />
+ </properties-param>
+ </init-params>
+ </component-plugin>
+ <component-plugin>
+ <name>bind.datasource</name>
+ <set-method>addPlugin</set-method>
+ <type>org.exoplatform.services.naming.BindReferencePlugin</type>
+ <init-params>
+ <value-param>
+ <name>bind-name</name>
+ <value>jdbcjcr2tck</value>
+ </value-param>
+ <value-param>
+ <name>class-name</name>
+ <value>javax.sql.DataSource</value>
+ </value-param>
+ <value-param>
+ <name>factory</name>
+ <value>org.apache.commons.dbcp.BasicDataSourceFactory</value>
+ </value-param>
+ <properties-param>
+ <name>ref-addresses</name>
+ <description>ref-addresses</description>
+ <property name="driverClassName" value="com.mysql.jdbc.Driver" />
+ <property name="url" value="jdbc:mysql://localhost:13306/jcr2tck" />
+ <property name="username" value="exoadmin" />
+ <property name="password" value="exo12321" />
+ <property name="maxActive" value="20" />
+ <property name="maxIdle" value="5" />
+ <property name="initialSize" value="2" />
+ </properties-param>
+ </init-params>
+ </component-plugin>
+ <!-- Resource configuration for UserTransaction
+ use JOTM
+ -->
+ <component-plugin>
+ <name>jotm.tx</name>
+ <set-method>addPlugin</set-method>
+ <type>org.exoplatform.services.naming.BindReferencePlugin</type>
+ <init-params>
+ <value-param>
+ <name>bind-name</name>
+ <value>UserTransaction</value>
+ </value-param>
+ <value-param>
+ <name>class-name</name>
+ <value>javax.transaction.UserTransaction</value>
+ </value-param>
+ <value-param>
+ <name>factory</name>
+ <value>org.objectweb.jotm.UserTransactionFactory</value>
+ </value-param>
+ <properties-param>
+ <name>ref-addresses</name>
+ <description>ref-addresses</description>
+ <property name="jotm.timeout" value="60" />
+ </properties-param>
+ </init-params>
+ </component-plugin>
+ <component-plugin>
+ <name>bind.jcr</name>
+ <set-method>addPlugin</set-method>
+ <type>org.exoplatform.services.naming.BindReferencePlugin</type>
+ <init-params>
+ <value-param>
+ <name>bind-name</name>
+ <value>repo</value>
+ </value-param>
+ <value-param>
+ <name>class-name</name>
+ <value>javax.jcr.Repository</value>
+ </value-param>
+ <value-param>
+ <name>factory</name>
+ <value>org.exoplatform.services.jcr.impl.jndi.BindableRepositoryFactory</value>
+ </value-param>
+ <properties-param>
+ <name>ref-addresses</name>
+ <description>ref-addresses</description>
+ <property name="repositoryName" value="db1" />
+ <!-- property name="containerConfig" value="exo-configuration.xml"/ -->
+ </properties-param>
+ </init-params>
+ </component-plugin>
+ <component-plugin>
+ <name>rmi.jcr</name>
+ <set-method>addPlugin</set-method>
+ <type>org.exoplatform.services.naming.BindReferencePlugin</type>
+ <init-params>
+ <value-param>
+ <name>bind-name</name>
+ <value>rmirepository</value>
+ </value-param>
+ <value-param>
+ <name>class-name</name>
+ <value>javax.jcr.Repository</value>
+ </value-param>
+ <value-param>
+ <name>factory</name>
+ <value>org.exoplatform.services.jcr.rmi.RepositoryFactory</value>
+ </value-param>
+ <properties-param>
+ <name>ref-addresses</name>
+ <description>ref-addresses</description>
+ <property name="url" value="//localhost:9999/repository" />
+ </properties-param>
+ </init-params>
+ </component-plugin>
+ </external-component-plugins>
+</configuration>
Property changes on: jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/test/resources/conf/standalone/test-configuration.mysql.xml
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Id
Added: jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/test/resources/conf/standalone/test-jcr-config.mysql.xml
===================================================================
--- jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/test/resources/conf/standalone/test-jcr-config.mysql.xml (rev 0)
+++ jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/test/resources/conf/standalone/test-jcr-config.mysql.xml 2009-11-13 02:39:29 UTC (rev 622)
@@ -0,0 +1,407 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!--
+
+ Copyright (C) 2009 eXo Platform SAS.
+
+ This is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of
+ the License, or (at your option) any later version.
+
+ This software is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this software; if not, write to the Free
+ Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+
+-->
+<repository-service default-repository="db1">
+ <repositories>
+ <repository name="db1" system-workspace="ws" default-workspace="ws">
+ <security-domain>exo-domain</security-domain>
+ <!-- access-control>optional</access-control -->
+ <!-- access-control>disable</access-control -->
+ <session-max-age>1h</session-max-age>
+ <authentication-policy>org.exoplatform.services.jcr.impl.core.access.JAASAuthenticator</authentication-policy>
+ <workspaces>
+ <workspace name="ws">
+ <!-- for system storage -->
+ <container class="org.exoplatform.services.jcr.impl.storage.jdbc.JDBCWorkspaceDataContainer">
+ <properties>
+ <property name="source-name" value="jdbcjcr" />
+ <property name="dialect" value="mysql" />
+ <property name="multi-db" value="true" />
+ <property name="update-storage" value="false" />
+ <property name="max-buffer-size" value="200k" />
+ <property name="swap-directory" value="target/temp/swap/ws" />
+ </properties>
+ <value-storages>
+ <value-storage id="ws" class="org.exoplatform.services.jcr.impl.storage.value.fs.TreeFileValueStorage">
+ <properties>
+ <property name="path" value="target/temp/values/ws" />
+ <property name="digest-algo" value="MD5" />
+ <property name="vcas-type" value="org.exoplatform.services.jcr.impl.storage.value.cas.JDBCValueContentAddressStorageImpl" />
+ <property name="jdbc-source-name" value="jdbcjcr" />
+ <property name="jdbc-dialect" value="mysql" />
+ </properties>
+ <filters>
+ <filter property-type="Binary" />
+ </filters>
+ </value-storage>
+ </value-storages>
+ </container>
+ <initializer class="org.exoplatform.services.jcr.impl.core.ScratchWorkspaceInitializer">
+ <properties>
+ <property name="root-nodetype" value="nt:unstructured" />
+ </properties>
+ </initializer>
+ <!-- initializer class="org.exoplatform.services.jcr.impl.core.RestoreWorkspaceInitializer">
+ <properties>
+ <property name="restore-path" value="./sv_export_root.xml" />
+ <property name="restore-path" value="./src/test/resources/import-export/restore_db1_ws1.xml" />
+ </properties>
+ </initializer
+-->
+ <cache enabled="true" class="org.exoplatform.services.jcr.impl.dataflow.persistent.LinkedWorkspaceStorageCacheImpl">
+ <properties>
+ <property name="max-size" value="2k" />
+ <property name="live-time" value="20m" />
+ <property name="statistic-period" value="30" />
+ <property name="statistic-log" value="false" />
+ </properties>
+ </cache>
+ <query-handler class="org.exoplatform.services.jcr.impl.core.query.lucene.SearchIndex">
+ <properties>
+ <property name="index-dir" value="target/temp/index/db1/ws" />
+ </properties>
+ </query-handler>
+ <lock-manager>
+ <time-out>15m</time-out>
+ <persister class="org.exoplatform.services.jcr.impl.core.lock.FileSystemLockPersister">
+ <properties>
+ <property name="path" value="target/temp/lock" />
+ </properties>
+ </persister>
+ </lock-manager>
+ </workspace>
+
+ <workspace name="ws1">
+ <container class="org.exoplatform.services.jcr.impl.storage.jdbc.JDBCWorkspaceDataContainer">
+ <properties>
+ <property name="source-name" value="jdbcjcr1" />
+ <property name="dialect" value="mysql" />
+ <property name="multi-db" value="true" />
+ <property name="update-storage" value="false" />
+ <property name="max-buffer-size" value="200k" />
+ <property name="swap-directory" value="target/temp/swap/ws1" />
+ </properties>
+ <value-storages>
+ <value-storage id="ws1" class="org.exoplatform.services.jcr.impl.storage.value.fs.TreeFileValueStorage">
+ <properties>
+ <property name="path" value="target/temp/values/ws1" />
+ </properties>
+ <filters>
+ <filter property-type="Binary" />
+ </filters>
+ </value-storage>
+ </value-storages>
+ </container>
+ <cache enabled="true" class="org.exoplatform.services.jcr.impl.dataflow.persistent.LinkedWorkspaceStorageCacheImpl">
+ <properties>
+ <property name="max-size" value="2k" />
+ <property name="live-time" value="20m" />
+ </properties>
+ </cache>
+ <query-handler class="org.exoplatform.services.jcr.impl.core.query.lucene.SearchIndex">
+ <properties>
+ <property name="index-dir" value="target/temp/index/db1/ws1" />
+ <property name="synonymprovider-class" value="org.exoplatform.services.jcr.impl.core.query.lucene.PropertiesSynonymProvider" />
+ <property name="synonymprovider-config-path" value="../../synonyms.properties" />
+ <property name="support-highlighting" value="true" />
+ <property name="indexing-configuration-path" value="../../indexing-configuration.xml" />
+ <property name="query-class" value="org.exoplatform.services.jcr.impl.core.query.QueryImpl" />
+ <property name="spellchecker-class" value="org.exoplatform.services.jcr.impl.core.query.lucene.spell.LuceneSpellChecker$FiveSecondsRefreshInterval" />
+ </properties>
+ </query-handler>
+ </workspace>
+
+ <workspace name="ws2">
+ <container class="org.exoplatform.services.jcr.impl.storage.jdbc.JDBCWorkspaceDataContainer">
+ <properties>
+ <property name="source-name" value="jdbcjcr2" />
+ <property name="dialect" value="mysql" />
+ <property name="multi-db" value="true" />
+ <property name="update-storage" value="false" />
+ <property name="max-buffer-size" value="200k" />
+ <property name="swap-directory" value="target/temp/swap/ws2" />
+ </properties>
+ <value-storages>
+ <value-storage id="ws2" class="org.exoplatform.services.jcr.impl.storage.value.fs.TreeFileValueStorage">
+ <properties>
+ <property name="path" value="target/temp/values/ws2" />
+ </properties>
+ <filters>
+ <filter property-type="Binary" />
+ </filters>
+ </value-storage>
+ </value-storages>
+ </container>
+ <cache enabled="true" class="org.exoplatform.services.jcr.impl.dataflow.persistent.LinkedWorkspaceStorageCacheImpl">
+ <properties>
+ <property name="max-size" value="2k" />
+ <property name="live-time" value="20m" />
+ </properties>
+ </cache>
+ <query-handler class="org.exoplatform.services.jcr.impl.core.query.lucene.SearchIndex">
+ <properties>
+ <property name="index-dir" value="target/temp/index/db1/ws2" />
+ <property name="synonymprovider-class" value="org.exoplatform.services.jcr.impl.core.query.lucene.PropertiesSynonymProvider" />
+ <property name="synonymprovider-config-path" value="../../synonyms.properties" />
+ <property name="support-highlighting" value="true" />
+ <property name="indexing-configuration-path" value="../../indexing-configuration.xml" />
+ <property name="query-class" value="org.exoplatform.services.jcr.impl.core.query.QueryImpl" />
+ <property name="spellchecker-class" value="org.exoplatform.services.jcr.impl.core.query.lucene.spell.LuceneSpellChecker$FiveSecondsRefreshInterval" />
+ </properties>
+ </query-handler>
+ </workspace>
+
+ <workspace name="ws3">
+ <!-- for system storage -->
+ <container
+ class="org.exoplatform.services.jcr.impl.storage.jdbc.JDBCWorkspaceDataContainer">
+ <properties>
+ <property name="source-name" value="jdbcjcr3" />
+ <property name="dialect" value="mysql" />
+ <property name="multi-db" value="true" />
+ <property name="update-storage" value="false" />
+ <property name="max-buffer-size" value="200k" />
+ <property name="swap-directory" value="target/temp/swap/ws3" />
+ </properties>
+ <value-storages>
+ <!--
+ This storage is used to check whether properties are removed
+ correctly from each value-storage
+ (TestRemoveFromValueStorage.java)
+ -->
+ <value-storage id="ws3_big"
+ class="org.exoplatform.services.jcr.impl.storage.value.fs.TreeFileValueStorage">
+ <properties>
+ <property name="path" value="target/temp/values/ws3_big" />
+ </properties>
+ <filters>
+ <filter property-type="Binary" min-value-size="1024K" />
+ </filters>
+ </value-storage>
+ <value-storage id="ws3"
+ class="org.exoplatform.services.jcr.impl.storage.value.fs.CASableTreeFileValueStorage">
+ <properties>
+ <property name="path" value="target/temp/values/ws3" />
+ <property name="digest-algo" value="MD5" />
+ <property name="vcas-type"
+ value="org.exoplatform.services.jcr.impl.storage.value.cas.JDBCValueContentAddressStorageImpl" />
+ <property name="jdbc-source-name" value="jdbcjcr" />
+ <property name="jdbc-dialect" value="mysql" />
+ </properties>
+ <filters>
+ <filter property-type="Binary" />
+ </filters>
+ </value-storage>
+ </value-storages>
+ </container>
+ <initializer
+ class="org.exoplatform.services.jcr.impl.core.ScratchWorkspaceInitializer">
+ <properties>
+ <property name="root-nodetype" value="nt:unstructured" />
+ </properties>
+ </initializer>
+ <cache enabled="true"
+ class="org.exoplatform.services.jcr.impl.dataflow.persistent.LinkedWorkspaceStorageCacheImpl">
+ <properties>
+ <property name="max-size" value="2k" />
+ <property name="live-time" value="20m" />
+ </properties>
+ </cache>
+ <query-handler
+ class="org.exoplatform.services.jcr.impl.core.query.lucene.SearchIndex">
+ <properties>
+ <property name="index-dir" value="target/temp/index/db1/ws3" />
+ <property name="synonymprovider-class"
+ value="org.exoplatform.services.jcr.impl.core.query.lucene.PropertiesSynonymProvider" />
+ <property name="synonymprovider-config-path" value="../../synonyms.properties" />
+ <property name="support-highlighting" value="true" />
+ <property name="indexing-configuration-path" value="../../indexing-configuration.xml" />
+ <property name="query-class"
+ value="org.exoplatform.services.jcr.impl.core.query.QueryImpl" />
+ <property name="spellchecker-class"
+ value="org.exoplatform.services.jcr.impl.core.query.lucene.spell.LuceneSpellChecker$FiveSecondsRefreshInterval" />
+ </properties>
+ </query-handler>
+ </workspace>
+ </workspaces>
+ </repository>
+
+ <repository name="db1tck" system-workspace="ws" default-workspace="ws">
+ <security-domain>exo-domain</security-domain>
+ <!-- access-control>optional</access-control -->
+ <!-- access-control>disable</access-control -->
+ <session-max-age>1h</session-max-age>
+ <authentication-policy>org.exoplatform.services.jcr.impl.core.access.JAASAuthenticator</authentication-policy>
+ <workspaces>
+ <workspace name="ws">
+ <!-- for system storage -->
+ <container class="org.exoplatform.services.jcr.impl.storage.jdbc.JDBCWorkspaceDataContainer">
+ <properties>
+ <property name="source-name" value="jdbcjcrtck" />
+ <property name="dialect" value="mysql" />
+ <property name="multi-db" value="true" />
+ <property name="update-storage" value="false" />
+ <property name="max-buffer-size" value="200k" />
+ <property name="swap-directory" value="target/temp/swap/wstck" />
+ </properties>
+ <value-storages>
+ <value-storage id="ws" class="org.exoplatform.services.jcr.impl.storage.value.fs.TreeFileValueStorage">
+ <properties>
+ <property name="path" value="target/temp/values/wstck" />
+ </properties>
+ <filters>
+ <filter property-type="Binary" min-value-size="100K" />
+ </filters>
+ </value-storage>
+ </value-storages>
+ </container>
+ <initializer class="org.exoplatform.services.jcr.impl.core.ScratchWorkspaceInitializer">
+ <properties>
+ <property name="root-nodetype" value="nt:unstructured" />
+ <property name="root-permissions" value="any read;*:/platform/administrators read;*:/platform/administrators add_node;*:/platform/administrators set_property;*:/platform/administrators remove" />
+ </properties>
+ </initializer>
+ <cache enabled="true" class="org.exoplatform.services.jcr.impl.dataflow.persistent.LinkedWorkspaceStorageCacheImpl">
+ <properties>
+ <property name="max-size" value="2k" />
+ <property name="live-time" value="20m" />
+ </properties>
+ </cache>
+ <query-handler class="org.exoplatform.services.jcr.impl.core.query.lucene.SearchIndex">
+ <properties>
+ <property name="index-dir" value="target/temp/index/db1tck/ws" />
+ <property name="synonymprovider-class" value="org.exoplatform.services.jcr.impl.core.query.lucene.PropertiesSynonymProvider" />
+ <property name="synonymprovider-config-path" value="../../synonyms.properties" />
+ <property name="support-highlighting" value="true" />
+ <property name="indexing-configuration-path" value="../../indexing-configuration.xml" />
+ <property name="query-class" value="org.exoplatform.services.jcr.impl.core.query.QueryImpl" />
+ <property name="excerptprovider-class" value="org.exoplatform.services.jcr.impl.core.query.lucene.WeightedHTMLExcerpt" />
+ <property name="spellchecker-class" value="org.exoplatform.services.jcr.impl.core.query.lucene.spell.LuceneSpellChecker$FiveSecondsRefreshInterval" />
+ </properties>
+ </query-handler>
+ <lock-manager>
+ <time-out>15m</time-out>
+ <persister class="org.exoplatform.services.jcr.impl.core.lock.FileSystemLockPersister">
+ <properties>
+ <property name="path" value="target/temp/locktck" />
+ </properties>
+ </persister>
+ </lock-manager>
+ </workspace>
+
+ <workspace name="ws1">
+ <container class="org.exoplatform.services.jcr.impl.storage.jdbc.JDBCWorkspaceDataContainer">
+ <properties>
+ <property name="source-name" value="jdbcjcr1tck" />
+ <property name="dialect" value="mysql" />
+ <property name="multi-db" value="true" />
+ <property name="update-storage" value="false" />
+ <property name="max-buffer-size" value="200k" />
+ <property name="swap-directory" value="target/temp/swap/ws1tck" />
+ </properties>
+ <value-storages>
+ <value-storage id="ws1" class="org.exoplatform.services.jcr.impl.storage.value.fs.TreeFileValueStorage">
+ <properties>
+ <property name="path" value="target/temp/values/ws1tck" />
+ </properties>
+ <filters>
+ <filter property-type="Binary" min-value-size="100K" />
+ </filters>
+ </value-storage>
+ </value-storages>
+ </container>
+ <initializer class="org.exoplatform.services.jcr.impl.core.ScratchWorkspaceInitializer">
+ <properties>
+ <property name="root-nodetype" value="nt:unstructured" />
+ <property name="root-permissions" value="any read;*:/platform/administrators read;*:/platform/administrators add_node;*:/platform/administrators set_property;*:/platform/administrators remove" />
+ </properties>
+ </initializer>
+ <cache enabled="true" class="org.exoplatform.services.jcr.impl.dataflow.persistent.LinkedWorkspaceStorageCacheImpl">
+ <properties>
+ <property name="max-size" value="2k" />
+ <property name="live-time" value="20m" />
+ </properties>
+ </cache>
+ <query-handler class="org.exoplatform.services.jcr.impl.core.query.lucene.SearchIndex">
+ <properties>
+ <property name="index-dir" value="target/temp/index/db1tck/ws1" />
+ <property name="synonymprovider-class" value="org.exoplatform.services.jcr.impl.core.query.lucene.PropertiesSynonymProvider" />
+ <property name="synonymprovider-config-path" value="../../synonyms.properties" />
+ <property name="support-highlighting" value="true" />
+ <property name="indexing-configuration-path" value="../../indexing-configuration.xml" />
+ <property name="query-class" value="org.exoplatform.services.jcr.impl.core.query.QueryImpl" />
+ <property name="spellchecker-class" value="org.exoplatform.services.jcr.impl.core.query.lucene.spell.LuceneSpellChecker$FiveSecondsRefreshInterval" />
+ </properties>
+ </query-handler>
+ </workspace>
+
+ <workspace name="ws2">
+ <container class="org.exoplatform.services.jcr.impl.storage.jdbc.JDBCWorkspaceDataContainer">
+ <properties>
+ <property name="source-name" value="jdbcjcr2tck" />
+ <property name="dialect" value="mysql" />
+ <property name="multi-db" value="true" />
+ <property name="update-storage" value="false" />
+ <property name="max-buffer-size" value="200k" />
+ <property name="swap-directory" value="target/temp/swap/ws2tck" />
+ </properties>
+ <value-storages>
+ <value-storage id="ws2" class="org.exoplatform.services.jcr.impl.storage.value.fs.TreeFileValueStorage">
+ <properties>
+ <property name="path" value="target/temp/values/ws2tck" />
+ </properties>
+ <filters>
+ <filter property-type="Binary" min-value-size="100K" />
+ </filters>
+ </value-storage>
+ </value-storages>
+ </container>
+ <initializer class="org.exoplatform.services.jcr.impl.core.ScratchWorkspaceInitializer">
+ <properties>
+ <property name="root-nodetype" value="nt:unstructured" />
+ <property name="root-permissions" value="any read;*:/platform/administrators read;*:/platform/administrators add_node;*:/platform/administrators set_property;*:/platform/administrators remove" />
+ </properties>
+ </initializer>
+ <cache enabled="true" class="org.exoplatform.services.jcr.impl.dataflow.persistent.LinkedWorkspaceStorageCacheImpl">
+ <properties>
+ <property name="max-size" value="2k" />
+ <property name="live-time" value="20m" />
+ </properties>
+ </cache>
+ <query-handler class="org.exoplatform.services.jcr.impl.core.query.lucene.SearchIndex">
+ <properties>
+ <property name="index-dir" value="target/temp/index/db1tck/ws2" />
+ <property name="synonymprovider-class" value="org.exoplatform.services.jcr.impl.core.query.lucene.PropertiesSynonymProvider" />
+ <property name="synonymprovider-config-path" value="../../synonyms.properties" />
+ <property name="support-highlighting" value="true" />
+ <property name="indexing-configuration-path" value="../../indexing-configuration.xml" />
+ <property name="query-class" value="org.exoplatform.services.jcr.impl.core.query.QueryImpl" />
+ <property name="spellchecker-class" value="org.exoplatform.services.jcr.impl.core.query.lucene.spell.LuceneSpellChecker$FiveSecondsRefreshInterval" />
+ <property name="excerptprovider-class" value="org.exoplatform.services.jcr.impl.core.query.lucene.WeightedHTMLExcerpt"/>
+ <property name="extractorPoolSize" value="2"/>
+ <property name="extractorTimeout" value="10"/>
+ </properties>
+ </query-handler>
+ </workspace>
+ </workspaces>
+ </repository>
+ </repositories>
+</repository-service>
Property changes on: jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/test/resources/conf/standalone/test-jcr-config.mysql.xml
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Id
16 years, 8 months
exo-jcr SVN: r621 - in jcr/branches/1.12.0-OPT/exo.jcr.component.core/src: main/java/org/exoplatform/services/jcr/impl/core and 6 other directories.
by do-not-reply@jboss.org
Author: pnedonosko
Date: 2009-11-12 21:37:50 -0500 (Thu, 12 Nov 2009)
New Revision: 621
Added:
jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/core/TestNodeOrder.java
Modified:
jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/dataflow/ItemDataConsumer.java
jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/NodeImpl.java
jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/SessionDataManager.java
jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/ACLInheritanceSupportedWorkspaceDataManager.java
jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/CacheableWorkspaceDataManager.java
jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/VersionableWorkspaceDataManager.java
jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/WorkspacePersistentDataManager.java
jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/session/LocalWorkspaceStorageDataManagerProxy.java
jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/session/SessionChangesLog.java
jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/session/TransactionableDataManager.java
jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/DBConstants.java
jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/JDBCStorageConnection.java
jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/db/HSQLDBMultiDbJDBCConnection.java
jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/db/HSQLDBSingleDbJDBCConnection.java
jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/db/MultiDbJDBCConnection.java
jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/db/SingleDbJDBCConnection.java
jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/storage/WorkspaceStorageConnection.java
Log:
EXOJCR-221: optimization of ordernumber and SNS calculations
Modified: jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/dataflow/ItemDataConsumer.java
===================================================================
--- jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/dataflow/ItemDataConsumer.java 2009-11-12 19:01:52 UTC (rev 620)
+++ jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/dataflow/ItemDataConsumer.java 2009-11-13 02:37:50 UTC (rev 621)
@@ -28,48 +28,72 @@
import javax.jcr.RepositoryException;
/**
- * Created by The eXo Platform SAS.
+ * Created by The eXo Platform SAS.<br/>
*
- * @author <a href="mailto:geaz@users.sourceforge.net">Gennady Azarenkov</a>
- * @version $Id: ItemDataConsumer.java 11907 2008-03-13 15:36:21Z ksm $
+ * Basic (Level 1) data flow inmemory operations<br/>
*
- * Basic (Level 1) data flow inmemory operations
- *
* Common Rule for Read : If there is some storage in this manager � try to get the data
* from here first, if not found � call super.someMethod
+ *
+ * @author <a href="mailto:geaz@users.sourceforge.net">Gennady Azarenkov</a>
+ * @version $Id$
*/
public interface ItemDataConsumer
{
/**
- * @param parent
- * @param name
- * @return data by parent and name
+ * Find Item by parent (id) and name (with path index).
+ *
+ * @param parent NodeData
+ * @param name QPathEntry
+ * @return ItemData, data by parent and name
* @throws RepositoryException
*/
ItemData getItemData(NodeData parent, QPathEntry name) throws RepositoryException;
/**
- * @param identifier
- * @return data by identifier
+ * Find Item by identifier.
+ *
+ * @param String identifier
+ * @return ItemData, data by identifier
*/
ItemData getItemData(String identifier) throws RepositoryException;
/**
- * @param parentIdentifier
- * @return children data
+ * Get child Nodes of the parent node.
+ *
+ * @param parent NodeData
+ * @return List of children Nodes
*/
List<NodeData> getChildNodesData(NodeData parent) throws RepositoryException;
/**
- * @param parentIdentifier
- * @return children data
+ * Get children nodes count of the parent node.
+ * @param parent NodeData
+ * @return int, child nodes count
*/
+ int getChildNodesCount(NodeData parent) throws RepositoryException;
+
+ /**
+ * Get child Properties of the parent node.
+ *
+ * @param parent NodeData
+ * @return List of children Properties
+ */
List<PropertyData> getChildPropertiesData(NodeData parent) throws RepositoryException;
- List<PropertyData> listChildPropertiesData(final NodeData nodeData) throws RepositoryException;
+ /**
+ * List child Properties, returned list will contains Properties without actual Values.
+ *
+ * @param parent NodeData
+ * @return List of PropertyData
+ * @throws RepositoryException
+ */
+ List<PropertyData> listChildPropertiesData(final NodeData parent) throws RepositoryException;
/**
+ * Get Referenced properties.
+ *
* @param identifier
* - referenceable id
* @param skipVersionStorage
Modified: jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/NodeImpl.java
===================================================================
--- jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/NodeImpl.java 2009-11-12 19:01:52 UTC (rev 620)
+++ jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/NodeImpl.java 2009-11-13 02:37:50 UTC (rev 621)
@@ -956,7 +956,7 @@
+ itemPath.getAsString(false));
return (NodeImpl)node;
}
-
+
/**
* {@inheritDoc}
*/
@@ -2488,16 +2488,92 @@
// ----------------------------- ExtendedNode -----------------------------
- private int getNextChildOrderNum(List<NodeData> siblings)
+ private int getNextChildOrderNum() throws RepositoryException
{
- int max = -1;
+ // int max = -1;
+ // for (NodeData sibling : siblings)
+ // {
+ // int cur = sibling.getOrderNumber();
+ // if (cur > max)
+ // max = cur;
+ // }
+ // return ++max;
+
+ //return siblings.size();
+
+ return dataManager.getChildNodesCount(nodeData());
+ }
+
+ private int getNextChildIndex(InternalQName nameToAdd, NodeData parentNode) throws RepositoryException,
+ ItemExistsException
+ {
+
+ NodeDefinitionData def =
+ 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));
+ while (sibling != null)
+ {
+ if (allowSns)
+ {
+ ind++;
+ sibling = (NodeData)dataManager.getItemData(parentNode, new QPathEntry(nameToAdd, ind));
+ }
+ else
+ {
+ throw new ItemExistsException("The node " + nameToAdd + " already exists in " + getPath()
+ + " and same name sibling is not allowed ");
+ }
+ };
+
+ return ind;
+
+ // int ind = 0;
+ // for (NodeData sibling : siblings)
+ // {
+ // if (sibling.getQPath().getName().equals(nameToAdd))
+ // {
+ // if (allowSns)
+ // ind++;
+ // else
+ // throw new ItemExistsException("The node " + nameToAdd + " already exists in " + getPath()
+ // + " and same name sibling is not allowed ");
+ // }
+ // }
+ // return ind + 1;
+
+ }
+
+ // old impl
+ @Deprecated
+ private int getNextChildIndex(InternalQName nameToAdd, List<NodeData> siblings, NodeData parentNode)
+ throws RepositoryException, ItemExistsException
+ {
+
+ int ind = 0;
for (NodeData sibling : siblings)
{
- int cur = sibling.getOrderNumber();
- if (cur > max)
- max = cur;
+ if (sibling.getQPath().getName().equals(nameToAdd))
+ {
+ NodeDefinitionData def =
+ session.getWorkspace().getNodeTypesHolder().getChildNodeDefinition(nameToAdd,
+ parentNode.getPrimaryTypeName(), parentNode.getMixinTypeNames());
+ if (LOG.isDebugEnabled())
+ LOG.debug("Calculate index for " + nameToAdd + " " + sibling.getQPath().getAsString());
+
+ if (def.isAllowsSameNameSiblings())
+ ind++;
+ else
+ throw new ItemExistsException("The node " + nameToAdd + " already exists in " + getPath()
+ + " and same name sibling is not allowed ");
+ }
}
- return ++max;
+ return ind + 1;
}
private NodeImpl doAddNode(NodeImpl parentNode, InternalQName name, InternalQName primaryTypeName)
@@ -2510,9 +2586,9 @@
InternalQName[] mixinTypeNames = new InternalQName[0];
String identifier = IdGenerator.generate();
- List<NodeData> siblings = dataManager.getChildNodesData(parentNode.nodeData());
- int orderNum = parentNode.getNextChildOrderNum(siblings);
- int index = parentNode.getNextChildIndex(name, siblings, parentNode.nodeData());
+ //List<NodeData> siblings = dataManager.getChildNodesData(parentNode.nodeData());
+ int orderNum = parentNode.getNextChildOrderNum();
+ int index = parentNode.getNextChildIndex(name, parentNode.nodeData());
QPath path = QPath.makeChildPath(parentNode.getInternalPath(), name, index);
@@ -2546,35 +2622,8 @@
session.getActionHandler().postAddNode(node);
return node;
-
}
- private int getNextChildIndex(InternalQName nameToAdd, List<NodeData> siblings, NodeData parentNode)
- throws RepositoryException, ItemExistsException
- {
-
- int ind = 0;
- for (NodeData sibling : siblings)
- {
- if (sibling.getQPath().getName().equals(nameToAdd))
- {
- NodeDefinitionData def =
- session.getWorkspace().getNodeTypesHolder().getChildNodeDefinition(nameToAdd,
- parentNode.getPrimaryTypeName(), parentNode.getMixinTypeNames());
- if (LOG.isDebugEnabled())
- LOG.debug("Calculate index for " + nameToAdd + " " + sibling.getQPath().getAsString());
-
- if (def.isAllowsSameNameSiblings())
- ind++;
- else
- throw new ItemExistsException("The node " + nameToAdd + " already exists in " + getPath()
- + " and same name sibling is not allowed ");
- }
- }
- return ind + 1;
-
- }
-
private int getOrderNumber()
{
return nodeData().getOrderNumber();
Modified: jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/SessionDataManager.java
===================================================================
--- jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/SessionDataManager.java 2009-11-12 19:01:52 UTC (rev 620)
+++ jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/SessionDataManager.java 2009-11-13 02:37:50 UTC (rev 621)
@@ -674,6 +674,39 @@
/**
* {@inheritDoc}
*/
+ public int getChildNodesCount(NodeData parent) throws RepositoryException
+ {
+ int childsCount = 0;
+
+ for (ItemState change : changesLog.getAllStates())
+ {
+ if (change.isNode() && change.isPersisted()
+ && change.getData().getParentIdentifier().equals(parent.getIdentifier()))
+ {
+ if (change.isDeleted())
+ {
+ childsCount--;
+ }
+ else if (change.isAdded())
+ {
+ childsCount++;
+ }
+ }
+ }
+
+ childsCount = transactionableManager.getChildNodesCount(parent) + childsCount;
+ if (childsCount < 0)
+ {
+ throw new InvalidItemStateException("Node's child nodes were changed in another Session "
+ + parent.getQPath().getAsString());
+ }
+
+ return childsCount;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
public List<PropertyData> getChildPropertiesData(NodeData parent) throws RepositoryException
{
long start = 0;
Modified: jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/ACLInheritanceSupportedWorkspaceDataManager.java
===================================================================
--- jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/ACLInheritanceSupportedWorkspaceDataManager.java 2009-11-12 19:01:52 UTC (rev 620)
+++ jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/ACLInheritanceSupportedWorkspaceDataManager.java 2009-11-13 02:37:50 UTC (rev 621)
@@ -18,6 +18,12 @@
*/
package org.exoplatform.services.jcr.impl.dataflow.persistent;
+import java.util.Calendar;
+import java.util.List;
+
+import javax.jcr.InvalidItemStateException;
+import javax.jcr.RepositoryException;
+
import org.exoplatform.services.jcr.access.AccessControlList;
import org.exoplatform.services.jcr.dataflow.ItemStateChangesLog;
import org.exoplatform.services.jcr.dataflow.SharedDataManager;
@@ -28,12 +34,6 @@
import org.exoplatform.services.log.ExoLogger;
import org.exoplatform.services.log.Log;
-import java.util.Calendar;
-import java.util.List;
-
-import javax.jcr.InvalidItemStateException;
-import javax.jcr.RepositoryException;
-
/**
* Created by The eXo Platform SAS. Data Manager supported ACL Inheritance
*
@@ -124,6 +124,9 @@
return node;
}
+ /**
+ * {@inheritDoc}
+ */
// ------------ ItemDataConsumer impl ------------
public List<NodeData> getChildNodesData(NodeData parent) throws RepositoryException
@@ -133,29 +136,52 @@
initACL(parent, node);
return nodes;
}
+
+ /**
+ * {@inheritDoc}
+ */
+ public int getChildNodesCount(final NodeData parent) throws RepositoryException
+ {
+ return persistentManager.getChildNodesCount(parent);
+ }
+ /**
+ * {@inheritDoc}
+ */
public ItemData getItemData(NodeData parent, QPathEntry name) throws RepositoryException
{
final ItemData item = persistentManager.getItemData(parent, name);
return item != null && item.isNode() ? initACL(parent, (NodeData)item) : item;
}
+ /**
+ * {@inheritDoc}
+ */
public ItemData getItemData(String identifier) throws RepositoryException
{
final ItemData item = persistentManager.getItemData(identifier);
return item != null && item.isNode() ? initACL(null, (NodeData)item) : item;
}
+ /**
+ * {@inheritDoc}
+ */
public List<PropertyData> getChildPropertiesData(NodeData parent) throws RepositoryException
{
return persistentManager.getChildPropertiesData(parent);
}
+ /**
+ * {@inheritDoc}
+ */
public List<PropertyData> listChildPropertiesData(NodeData parent) throws RepositoryException
{
return persistentManager.listChildPropertiesData(parent);
}
+ /**
+ * {@inheritDoc}
+ */
public List<PropertyData> getReferencesData(String identifier, boolean skipVersionStorage)
throws RepositoryException
{
@@ -164,12 +190,18 @@
// ------------ SharedDataManager ----------------------
+ /**
+ * {@inheritDoc}
+ */
public void save(ItemStateChangesLog changes) throws InvalidItemStateException, UnsupportedOperationException,
RepositoryException
{
persistentManager.save(changes);
}
+ /**
+ * {@inheritDoc}
+ */
public Calendar getCurrentTime()
{
return persistentManager.getCurrentTime();
Modified: jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/CacheableWorkspaceDataManager.java
===================================================================
--- jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/CacheableWorkspaceDataManager.java 2009-11-12 19:01:52 UTC (rev 620)
+++ jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/CacheableWorkspaceDataManager.java 2009-11-13 02:37:50 UTC (rev 621)
@@ -369,6 +369,18 @@
}
}
+ public int getChildNodesCount(NodeData parent) throws RepositoryException
+ {
+ if (cache.isEnabled())
+ {
+ List<NodeData> childNodes = cache.getChildNodes(parent);
+ if (childNodes != null)
+ return childNodes.size();
+ }
+
+ return super.getChildNodesCount(parent);
+ }
+
/**
* Get child PropertyData.
*
@@ -453,7 +465,7 @@
}
return propertiesList;
}
-
+
/**
* {@inheritDoc}
*/
Modified: jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/VersionableWorkspaceDataManager.java
===================================================================
--- jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/VersionableWorkspaceDataManager.java 2009-11-12 19:01:52 UTC (rev 620)
+++ jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/VersionableWorkspaceDataManager.java 2009-11-13 02:37:50 UTC (rev 621)
@@ -18,6 +18,12 @@
*/
package org.exoplatform.services.jcr.impl.dataflow.persistent;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.jcr.InvalidItemStateException;
+import javax.jcr.RepositoryException;
+
import org.exoplatform.services.jcr.dataflow.ChangesLogIterator;
import org.exoplatform.services.jcr.dataflow.CompositeChangesLog;
import org.exoplatform.services.jcr.dataflow.DataManager;
@@ -36,12 +42,6 @@
import org.exoplatform.services.log.ExoLogger;
import org.exoplatform.services.log.Log;
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.jcr.InvalidItemStateException;
-import javax.jcr.RepositoryException;
-
/**
* Created by The eXo Platform SAS. Responsible for: *redirecting repository operations if item is
* descendant of /jcr:system/jcr:versionStorage *adding version history for newly added/assigned
@@ -72,11 +72,8 @@
this.versionDataManager = (ACLInheritanceSupportedWorkspaceDataManager)systemDataManager;
}
- /*
- * (non-Javadoc)
- *
- * @see org.exoplatform.services.jcr.impl.core.WorkspaceDataManager#getChildNodes(org.exoplatform.services
- * .jcr.datamodel.NodeData)
+ /**
+ * {@inheritDoc}
*/
@Override
public List<NodeData> getChildNodesData(final NodeData nodeData) throws RepositoryException
@@ -87,12 +84,22 @@
}
return super.getChildNodesData(nodeData);
}
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public int getChildNodesCount(final NodeData parent) throws RepositoryException
+ {
+ if (isSystemDescendant(parent.getQPath()) && !this.equals(versionDataManager))
+ {
+ return versionDataManager.getChildNodesCount(parent);
+ }
+ return super.getChildNodesCount(parent);
+ }
- /*
- * (non-Javadoc)
- *
- * @see org.exoplatform.services.jcr.impl.core.WorkspaceDataManager#getChildProperties(org.exoplatform
- * .services.jcr.datamodel.NodeData)
+ /**
+ * {@inheritDoc}
*/
@Override
public List<PropertyData> getChildPropertiesData(final NodeData nodeData) throws RepositoryException
@@ -104,6 +111,10 @@
return super.getChildPropertiesData(nodeData);
}
+ /**
+ * {@inheritDoc}
+ */
+ @Override
public List<PropertyData> listChildPropertiesData(final NodeData nodeData) throws RepositoryException
{
if (isSystemDescendant(nodeData.getQPath()) && !this.equals(versionDataManager))
@@ -113,6 +124,10 @@
return super.listChildPropertiesData(nodeData);
}
+ /**
+ * {@inheritDoc}
+ */
+ @Override
public ItemData getItemData(NodeData parentData, QPathEntry name) throws RepositoryException
{
if (parentData != null)
@@ -127,8 +142,9 @@
}
/**
- * @see org.exoplatform.services.jcr.impl.dataflow.persistent.WorkspacePersistentDataManager#getItemData(java.lang.String)
+ * {@inheritDoc}
*/
+ @Override
public ItemData getItemData(String identifier) throws RepositoryException
{
// from cache at first
Modified: jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/WorkspacePersistentDataManager.java
===================================================================
--- jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/WorkspacePersistentDataManager.java 2009-11-12 19:01:52 UTC (rev 620)
+++ jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/WorkspacePersistentDataManager.java 2009-11-13 02:37:50 UTC (rev 621)
@@ -290,6 +290,22 @@
con.close();
}
}
+
+ /**
+ * {@inheritDoc}
+ */
+ public int getChildNodesCount(NodeData parent) throws RepositoryException
+ {
+ final WorkspaceStorageConnection con = dataContainer.openConnection();
+ try
+ {
+ return con.getChildNodesCount(parent);
+ }
+ finally
+ {
+ con.close();
+ }
+ }
/**
* {@inheritDoc}
Modified: jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/session/LocalWorkspaceStorageDataManagerProxy.java
===================================================================
--- jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/session/LocalWorkspaceStorageDataManagerProxy.java 2009-11-12 19:01:52 UTC (rev 620)
+++ jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/session/LocalWorkspaceStorageDataManagerProxy.java 2009-11-13 02:37:50 UTC (rev 621)
@@ -97,6 +97,9 @@
storageDataManager.save(newLog);
}
+ /**
+ * {@inheritDoc}
+ */
public ItemData getItemData(NodeData parentData, QPathEntry name) throws RepositoryException
{
return copyItemData(storageDataManager.getItemData(parentData, name));
@@ -117,6 +120,14 @@
{
return copyNodes(storageDataManager.getChildNodesData(parent));
}
+
+ /**
+ * {@inheritDoc}
+ */
+ public int getChildNodesCount(final NodeData parent) throws RepositoryException
+ {
+ return storageDataManager.getChildNodesCount(parent);
+ }
/**
* {@inheritDoc}
@@ -126,6 +137,9 @@
return copyProperties(storageDataManager.getChildPropertiesData(parent));
}
+ /**
+ * {@inheritDoc}
+ */
public List<PropertyData> listChildPropertiesData(NodeData parent) throws RepositoryException
{
return copyPropertiesWithoutValues(storageDataManager.listChildPropertiesData(parent));
Modified: jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/session/SessionChangesLog.java
===================================================================
--- jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/session/SessionChangesLog.java 2009-11-12 19:01:52 UTC (rev 620)
+++ jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/session/SessionChangesLog.java 2009-11-13 02:37:50 UTC (rev 621)
@@ -76,11 +76,8 @@
}
}
- /*
- * (non-Javadoc)
- * @see
- * org.exoplatform.services.jcr.dataflow.PlainChangesLog#add(org.exoplatform.services.jcr.dataflow
- * .ItemState)
+ /**
+ * {@inheritDoc}
*/
@Override
public PlainChangesLog add(ItemState change)
@@ -91,9 +88,8 @@
return this;
}
- /*
- * (non-Javadoc)
- * @see org.exoplatform.services.jcr.dataflow.PlainChangesLog#addAll(java.util.List)
+ /**
+ * {@inheritDoc}
*/
@Override
public PlainChangesLog addAll(List<ItemState> changes)
@@ -107,9 +103,8 @@
return this;
}
- /*
- * (non-Javadoc)
- * @see org.exoplatform.services.jcr.dataflow.PlainChangesLog#clear()
+ /**
+ * {@inheritDoc}
*/
@Override
public void clear()
Modified: jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/session/TransactionableDataManager.java
===================================================================
--- jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/session/TransactionableDataManager.java 2009-11-12 19:01:52 UTC (rev 620)
+++ jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/session/TransactionableDataManager.java 2009-11-13 02:37:50 UTC (rev 621)
@@ -94,6 +94,45 @@
/**
* {@inheritDoc}
*/
+ public int getChildNodesCount(final NodeData parent) throws RepositoryException
+ {
+ if (txStarted())
+ {
+ int txChildsCount = 0;
+ for (ItemState change : transactionLog.getAllStates())
+ {
+ if (change.isNode() && change.isPersisted()
+ && change.getData().getParentIdentifier().equals(parent.getIdentifier()))
+ {
+ if (change.isDeleted())
+ {
+ txChildsCount--;
+ }
+ else if (change.isAdded())
+ {
+ txChildsCount++;
+ }
+ }
+ }
+
+ final int childsCount = storageDataManager.getChildNodesCount(parent) + txChildsCount;
+ if (childsCount < 0)
+ {
+ throw new InvalidItemStateException("Node's child nodes were changed in another Transaction "
+ + parent.getQPath().getAsString());
+ }
+
+ return childsCount;
+ }
+ else
+ {
+ return storageDataManager.getChildNodesCount(parent);
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
public List<PropertyData> getChildPropertiesData(NodeData parent) throws RepositoryException
{
List<PropertyData> props = storageDataManager.getChildPropertiesData(parent);
Modified: jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/DBConstants.java
===================================================================
--- jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/DBConstants.java 2009-11-12 19:01:52 UTC (rev 620)
+++ jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/DBConstants.java 2009-11-13 02:37:50 UTC (rev 621)
@@ -126,6 +126,11 @@
* FIND_NODES_BY_PARENTID.
*/
protected String FIND_NODES_BY_PARENTID;
+
+ /**
+ * FIND_NODES_COUNT_BY_PARENTID.
+ */
+ protected String FIND_NODES_COUNT_BY_PARENTID;
/**
* FIND_PROPERTIES_BY_PARENTID.
Modified: jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/JDBCStorageConnection.java
===================================================================
--- jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/JDBCStorageConnection.java 2009-11-12 19:01:52 UTC (rev 620)
+++ jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/JDBCStorageConnection.java 2009-11-13 02:37:50 UTC (rev 621)
@@ -600,6 +600,29 @@
throw new RepositoryException(e);
}
}
+
+ /**
+ * {@inheritDoc}
+ */
+ public int getChildNodesCount(NodeData parent) throws RepositoryException {
+ checkIfOpened();
+ try
+ {
+ ResultSet count = findChildNodesCountByParentIdentifier(getInternalId(parent.getIdentifier()));
+ if (count.next())
+ {
+ return count.getInt(1);
+ }
+ else
+ {
+ throw new RepositoryException("FATAL No resulton childNodes count for " + parent.getQPath().getAsString());
+ }
+ }
+ catch (SQLException e)
+ {
+ throw new RepositoryException(e);
+ }
+ }
/**
* {@inheritDoc}
@@ -1871,6 +1894,8 @@
protected abstract ResultSet findItemByName(String parentId, String name, int index) throws SQLException;
protected abstract ResultSet findChildNodesByParentIdentifier(String parentIdentifier) throws SQLException;
+
+ protected abstract ResultSet findChildNodesCountByParentIdentifier(String parentIdentifier) throws SQLException;
protected abstract ResultSet findChildPropertiesByParentIdentifier(String parentIdentifier) throws SQLException;
Modified: jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/db/HSQLDBMultiDbJDBCConnection.java
===================================================================
--- jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/db/HSQLDBMultiDbJDBCConnection.java 2009-11-12 19:01:52 UTC (rev 620)
+++ jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/db/HSQLDBMultiDbJDBCConnection.java 2009-11-13 02:37:50 UTC (rev 621)
@@ -74,6 +74,7 @@
"select V.DATA" + " from JCR_MITEM I, JCR_MVALUE V"
+ " where I.PARENT_ID=? and I.I_CLASS=2 and I.NAME=? and I.ID=V.PROPERTY_ID order by V.ORDER_NUM";
FIND_NODES_BY_PARENTID = "select * from JCR_MITEM" + " where PARENT_ID=? and I_CLASS=1" + " order by N_ORDER_NUM";
+ FIND_NODES_COUNT_BY_PARENTID = "select count(ID) from JCR_MITEM" + " where PARENT_ID=? and I_CLASS=1";
FIND_PROPERTIES_BY_PARENTID = "select * from JCR_MITEM" + " where PARENT_ID=? and I_CLASS=2" + " order by ID";
}
}
Modified: jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/db/HSQLDBSingleDbJDBCConnection.java
===================================================================
--- jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/db/HSQLDBSingleDbJDBCConnection.java 2009-11-12 19:01:52 UTC (rev 620)
+++ jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/db/HSQLDBSingleDbJDBCConnection.java 2009-11-13 02:37:50 UTC (rev 621)
@@ -81,6 +81,8 @@
+ " where I.PARENT_ID=? and I.I_CLASS=2 and I.CONTAINER_NAME=? and I.NAME=? and I.ID=V.PROPERTY_ID order by V.ORDER_NUM";
FIND_NODES_BY_PARENTID =
"select * from JCR_SITEM" + " where PARENT_ID=? and I_CLASS=1 and CONTAINER_NAME=?" + " order by N_ORDER_NUM";
+ FIND_NODES_COUNT_BY_PARENTID =
+ "select count(ID) from JCR_SITEM" + " where PARENT_ID=? and I_CLASS=1 and CONTAINER_NAME=?";
FIND_PROPERTIES_BY_PARENTID =
"select * from JCR_SITEM" + " where PARENT_ID=? and I_CLASS=2 and CONTAINER_NAME=?" + " order by ID";
}
@@ -135,7 +137,23 @@
findNodesByParentId.setString(2, containerName);
return findNodesByParentId.executeQuery();
}
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected ResultSet findChildNodesCountByParentIdentifier(String parentCid) throws SQLException
+ {
+ if (findNodesCountByParentId == null)
+ findNodesCountByParentId = dbConnection.prepareStatement(FIND_NODES_COUNT_BY_PARENTID);
+ else
+ findNodesCountByParentId.clearParameters();
+ findNodesCountByParentId.setString(1, parentCid);
+ findNodesCountByParentId.setString(2, containerName);
+ return findNodesCountByParentId.executeQuery();
+ }
+
/**
* {@inheritDoc}
*/
Modified: jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/db/MultiDbJDBCConnection.java
===================================================================
--- jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/db/MultiDbJDBCConnection.java 2009-11-12 19:01:52 UTC (rev 620)
+++ jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/db/MultiDbJDBCConnection.java 2009-11-13 02:37:50 UTC (rev 621)
@@ -77,6 +77,8 @@
protected PreparedStatement findValueByPropertyIdOrderNumber;
protected PreparedStatement findNodesByParentId;
+
+ protected PreparedStatement findNodesCountByParentId;
protected PreparedStatement findPropertiesByParentId;
@@ -185,6 +187,8 @@
FIND_VALUE_BY_PROPERTYID_OREDERNUMB = "select DATA from JCR_MVALUE where PROPERTY_ID=? and ORDER_NUM=?";
FIND_NODES_BY_PARENTID = "select * from JCR_MITEM" + " where I_CLASS=1 and PARENT_ID=?" + " order by N_ORDER_NUM";
+
+ FIND_NODES_COUNT_BY_PARENTID = "select count(ID) from JCR_MITEM" + " where I_CLASS=1 and PARENT_ID=?";
FIND_PROPERTIES_BY_PARENTID = "select * from JCR_MITEM" + " where I_CLASS=2 and PARENT_ID=?" + " order by ID";
@@ -428,6 +432,21 @@
* {@inheritDoc}
*/
@Override
+ protected ResultSet findChildNodesCountByParentIdentifier(String parentIdentifier) throws SQLException
+ {
+ if (findNodesCountByParentId == null)
+ findNodesCountByParentId = dbConnection.prepareStatement(FIND_NODES_COUNT_BY_PARENTID);
+ else
+ findNodesCountByParentId.clearParameters();
+
+ findNodesCountByParentId.setString(1, parentIdentifier);
+ return findNodesCountByParentId.executeQuery();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
protected ResultSet findChildPropertiesByParentIdentifier(String parentIdentifier) throws SQLException
{
if (findPropertiesByParentId == null)
Modified: jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/db/SingleDbJDBCConnection.java
===================================================================
--- jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/db/SingleDbJDBCConnection.java 2009-11-12 19:01:52 UTC (rev 620)
+++ jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/db/SingleDbJDBCConnection.java 2009-11-13 02:37:50 UTC (rev 621)
@@ -74,6 +74,8 @@
protected PreparedStatement findValueByPropertyIdOrderNumber;
protected PreparedStatement findNodesByParentId;
+
+ protected PreparedStatement findNodesCountByParentId;
protected PreparedStatement findPropertiesByParentId;
@@ -193,6 +195,8 @@
FIND_NODES_BY_PARENTID =
"select * from JCR_SITEM" + " where I_CLASS=1 and CONTAINER_NAME=? and PARENT_ID=?" + " order by N_ORDER_NUM";
+ FIND_NODES_COUNT_BY_PARENTID = "select count(ID) from JCR_MITEM" + " where I_CLASS=1 and CONTAINER_NAME=? and PARENT_ID=?";
+
FIND_PROPERTIES_BY_PARENTID =
"select * from JCR_SITEM" + " where I_CLASS=2 and CONTAINER_NAME=? and PARENT_ID=?" + " order by ID";
@@ -334,7 +338,23 @@
findNodesByParentId.setString(2, parentCid);
return findNodesByParentId.executeQuery();
}
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected ResultSet findChildNodesCountByParentIdentifier(String parentCid) throws SQLException
+ {
+ if (findNodesCountByParentId == null)
+ findNodesCountByParentId = dbConnection.prepareStatement(FIND_NODES_COUNT_BY_PARENTID);
+ else
+ findNodesCountByParentId.clearParameters();
+ findNodesCountByParentId.setString(1, containerName);
+ findNodesCountByParentId.setString(2, parentCid);
+ return findNodesCountByParentId.executeQuery();
+ }
+
/**
* {@inheritDoc}
*/
Modified: jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/storage/WorkspaceStorageConnection.java
===================================================================
--- jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/storage/WorkspaceStorageConnection.java 2009-11-12 19:01:52 UTC (rev 620)
+++ jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/storage/WorkspaceStorageConnection.java 2009-11-13 02:37:50 UTC (rev 621)
@@ -93,6 +93,15 @@
* if connection is closed
*/
List<NodeData> getChildNodesData(NodeData parent) throws RepositoryException, IllegalStateException;
+
+ /**
+ * Reads count of <code>parent<code/> child nodes.
+ *
+ * @param parent NodeData
+ * @return long, childs count
+ * @throws RepositoryException if error occurs
+ */
+ int getChildNodesCount(NodeData parent) throws RepositoryException;
/**
* Reads <code>List</code> of <code>PropertyData</code> from the storage using item's parent
Added: jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/core/TestNodeOrder.java
===================================================================
--- jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/core/TestNodeOrder.java (rev 0)
+++ jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/core/TestNodeOrder.java 2009-11-13 02:37:50 UTC (rev 621)
@@ -0,0 +1,271 @@
+/*
+ * 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.
+ */
+/*
+ * Copyright (C) 2009 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.exoplatform.services.jcr.impl.core;
+
+import javax.jcr.ItemExistsException;
+import javax.jcr.Node;
+import javax.jcr.NodeIterator;
+import javax.jcr.Session;
+
+import org.exoplatform.services.jcr.JcrImplBaseTest;
+import org.exoplatform.services.jcr.datamodel.NodeData;
+
+/**
+ * Created by The eXo Platform SAS.
+ *
+ * <br/>Date: 13.11.2009
+ *
+ * @author <a href="mailto:peter.nedonosko@exoplatform.com.ua">Peter Nedonosko</a>
+ * @version $Id$
+ */
+public class TestNodeOrder extends JcrImplBaseTest
+{
+
+ public void testOrder() throws Exception
+ {
+ Node testNode = root.addNode("testNode");
+ session.save();
+ testNode.addNode("z");
+ session.save();
+ testNode.addNode("a");
+ session.save();
+ testNode.addNode("b");
+ session.save();
+ testNode.addNode("c");
+
+ // check
+ NodeIterator nodes = testNode.getNodes();
+ assertEquals(4, nodes.getSize());
+
+ int order = 0;
+ for (; nodes.hasNext();)
+ {
+ NodeImpl n = (NodeImpl)nodes.nextNode();
+ int orderNumb = ((NodeData)n.getData()).getOrderNumber();
+ log.info(orderNumb + ": " + n.getPath());
+
+ assertEquals(order++, orderNumb);
+ }
+ }
+
+ public void testOrderInSession() throws Exception
+ {
+ Node testNode = root.addNode("testNode");
+ session.save();
+
+ testNode.addNode("a");
+ testNode.addNode("a");
+ testNode.addNode("z");
+ testNode.addNode("a");
+
+ // check
+ NodeIterator nodes = testNode.getNodes();
+ assertEquals(4, nodes.getSize());
+
+ int order = 0;
+ for (; nodes.hasNext();)
+ {
+ NodeImpl n = (NodeImpl)nodes.nextNode();
+ int orderNumb = ((NodeData)n.getData()).getOrderNumber();
+ log.info(orderNumb + ": " + n.getPath());
+
+ assertEquals(order++, orderNumb);
+ }
+ }
+
+ public void testOrderCombined() throws Exception
+ {
+ Node testNode = root.addNode("testNode");
+ session.save();
+
+ testNode.addNode("a");
+ testNode.addNode("a");
+ testNode.addNode("z");
+ testNode.addNode("a");
+ session.save();
+
+ testNode.addNode("a");
+ testNode.addNode("y");
+ session.save();
+
+ testNode.addNode("c");
+ testNode.addNode("a");
+ session.save();
+
+ // check
+ NodeIterator nodes = testNode.getNodes();
+ assertEquals(8, nodes.getSize());
+
+ int order = 0;
+ for (; nodes.hasNext();)
+ {
+ NodeImpl n = (NodeImpl)nodes.nextNode();
+ int orderNumb = ((NodeData)n.getData()).getOrderNumber();
+ log.info(orderNumb + ": " + n.getPath());
+
+ assertEquals(order++, orderNumb);
+ }
+ }
+
+ public void testOrderWithRefreshDiscard() throws Exception
+ {
+ Node testNode = root.addNode("testNode");
+ session.save();
+
+ testNode.addNode("a");
+ testNode.addNode("a");
+ testNode.addNode("z");
+ testNode.addNode("a");
+ session.save();
+
+ testNode.addNode("a");
+ testNode.addNode("y");
+ root.refresh(false); // discard added a and y
+
+ testNode.addNode("c");
+ testNode.addNode("a");
+ session.save();
+
+ // check
+ NodeIterator nodes = testNode.getNodes();
+ assertEquals(6, nodes.getSize());
+
+ int order = 0;
+ for (; nodes.hasNext();)
+ {
+ NodeImpl n = (NodeImpl)nodes.nextNode();
+ int orderNumb = ((NodeData)n.getData()).getOrderNumber();
+ log.info(orderNumb + ": " + n.getPath());
+
+ assertEquals(order++, orderNumb);
+ }
+ }
+
+ public void testOrderWithInvalidation() throws Exception
+ {
+ Node testNode = root.addNode("testNode");
+ session.save();
+
+ testNode.addNode("a");
+ testNode.addNode("a");
+ testNode.addNode("z");
+ testNode.addNode("a");
+ session.save();
+
+ testNode.addNode("a");
+ testNode.addNode("y");
+
+ // add some in another session
+ Session another = repository.login(credentials, root.getSession().getWorkspace().getName());
+ Node anotherTest = another.getRootNode().getNode("testNode");
+ another.save();
+ anotherTest.addNode("a");
+ anotherTest.addNode("y");
+ another.save();
+ another.logout();
+
+ try
+ {
+ session.save();
+ fail("Nodes already added in another session, ItemExistsException should be thrown");
+ }
+ catch (ItemExistsException e)
+ {
+ // ok
+ root.refresh(false); // discard a and y
+ }
+
+ testNode.addNode("c");
+ testNode.addNode("a");
+ session.save();
+
+ // check
+ NodeIterator nodes = testNode.getNodes();
+ assertEquals(8, nodes.getSize());
+
+ int order = 0;
+ for (; nodes.hasNext();)
+ {
+ NodeImpl n = (NodeImpl)nodes.nextNode();
+ int orderNumb = ((NodeData)n.getData()).getOrderNumber();
+ log.info(orderNumb + ": " + n.getPath());
+
+ assertEquals(order++, orderNumb);
+ }
+ }
+
+ public void testOrderWithRefreshKeep() throws Exception
+ {
+ Node testNode = root.addNode("testNode");
+ session.save();
+
+ testNode.addNode("a");
+ testNode.addNode("a");
+ testNode.addNode("z");
+ testNode.addNode("a");
+ session.save();
+
+ // add some in another session
+ Session another = repository.login(credentials, root.getSession().getWorkspace().getName());
+ Node anotherTest = another.getRootNode().getNode("testNode");
+ another.save();
+ anotherTest.addNode("a");
+ anotherTest.addNode("y");
+ another.save();
+ another.logout();
+
+ //root.refresh(true); // refresh to see another Session
+ testNode.addNode("a");
+ testNode.addNode("y");
+ session.save();
+
+ // check
+ NodeIterator nodes = testNode.getNodes();
+ assertEquals(8, nodes.getSize());
+
+ int order = 0;
+ for (; nodes.hasNext();)
+ {
+ NodeImpl n = (NodeImpl)nodes.nextNode();
+ int orderNumb = ((NodeData)n.getData()).getOrderNumber();
+ log.info(orderNumb + ": " + n.getPath());
+
+ assertEquals(order++, orderNumb);
+ }
+ }
+
+}
Property changes on: jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/core/TestNodeOrder.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Id
16 years, 8 months
exo-jcr SVN: r620 - jcr/branches.
by do-not-reply@jboss.org
Author: pnedonosko
Date: 2009-11-12 14:01:52 -0500 (Thu, 12 Nov 2009)
New Revision: 620
Added:
jcr/branches/1.12.0-OPT/
Log:
Branch for JCR optimizations and experiments
Copied: jcr/branches/1.12.0-OPT (from rev 619, jcr/trunk)
16 years, 8 months
exo-jcr SVN: r619 - jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jbosscache.
by do-not-reply@jboss.org
Author: areshetnyak
Date: 2009-11-12 12:03:15 -0500 (Thu, 12 Nov 2009)
New Revision: 619
Modified:
jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jbosscache/JDBCCacheLoader.java
Log:
EXOJCR-201 : The JDBCCacheLoaderTest was changed.
Modified: jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jbosscache/JDBCCacheLoader.java
===================================================================
--- jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jbosscache/JDBCCacheLoader.java 2009-11-12 16:51:16 UTC (rev 618)
+++ jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jbosscache/JDBCCacheLoader.java 2009-11-12 17:03:15 UTC (rev 619)
@@ -154,17 +154,6 @@
}
/**
- * Get ID from Fqn.
- * @param fqn
- * @return
- */
- private String getID(Fqn<String> fqn)
- {
- //TODO
- return fqn.toString().split("/")[2];
- }
-
- /**
* Remove NodeData or PropertyData.
*
* @param modification
16 years, 8 months
exo-jcr SVN: r618 - jcr/branches/1.12.0-JBC/component/core/src/test/java/org/exoplatform/services/jcr/impl/storage/jbosscache.
by do-not-reply@jboss.org
Author: areshetnyak
Date: 2009-11-12 11:51:16 -0500 (Thu, 12 Nov 2009)
New Revision: 618
Modified:
jcr/branches/1.12.0-JBC/component/core/src/test/java/org/exoplatform/services/jcr/impl/storage/jbosscache/JDBCCacheLoaderTest.java
Log:
EXOJCR-201 : The JDBCCacheLoaderTest was changed.
Modified: jcr/branches/1.12.0-JBC/component/core/src/test/java/org/exoplatform/services/jcr/impl/storage/jbosscache/JDBCCacheLoaderTest.java
===================================================================
--- jcr/branches/1.12.0-JBC/component/core/src/test/java/org/exoplatform/services/jcr/impl/storage/jbosscache/JDBCCacheLoaderTest.java 2009-11-12 16:32:27 UTC (rev 617)
+++ jcr/branches/1.12.0-JBC/component/core/src/test/java/org/exoplatform/services/jcr/impl/storage/jbosscache/JDBCCacheLoaderTest.java 2009-11-12 16:51:16 UTC (rev 618)
@@ -393,7 +393,7 @@
QPath nodePath = QPath.parse("[]:1[]node:1");
NodeData node =
new TransientNodeData(nodePath, nodeId, 1, Constants.NT_UNSTRUCTURED, new InternalQName[0], 0,
- Constants.ROOT_PARENT_UUID, new AccessControlList());
+ Constants.ROOT_UUID, new AccessControlList());
PropertyData primaryType =
createProperty(nodePath, nodeId, Constants.JCR_PRIMARYTYPE, Constants.NT_UNSTRUCTURED, false);
16 years, 8 months