exo-jcr SVN: r858 - jcr/branches/1.12.0-JBC/component/core/src/test/java/org/exoplatform/services/jcr/api/lock.
by do-not-reply@jboss.org
Author: nzamosenchuk
Date: 2009-11-25 08:08:18 -0500 (Wed, 25 Nov 2009)
New Revision: 858
Added:
jcr/branches/1.12.0-JBC/component/core/src/test/java/org/exoplatform/services/jcr/api/lock/TestLockCleanupOnRestart.java
Log:
EXOJCR-262: Added manual test for checking whether lock-properties are deleted on restart (startup)
Added: jcr/branches/1.12.0-JBC/component/core/src/test/java/org/exoplatform/services/jcr/api/lock/TestLockCleanupOnRestart.java
===================================================================
--- jcr/branches/1.12.0-JBC/component/core/src/test/java/org/exoplatform/services/jcr/api/lock/TestLockCleanupOnRestart.java (rev 0)
+++ jcr/branches/1.12.0-JBC/component/core/src/test/java/org/exoplatform/services/jcr/api/lock/TestLockCleanupOnRestart.java 2009-11-25 13:08:18 UTC (rev 858)
@@ -0,0 +1,99 @@
+/*
+ * 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.api.lock;
+
+import org.exoplatform.services.jcr.JcrAPIBaseTest;
+import org.exoplatform.services.jcr.impl.core.NodeImpl;
+import org.hsqldb.DatabaseManager;
+
+import java.sql.Connection;
+import java.sql.DriverManager;
+
+import javax.jcr.PathNotFoundException;
+
+/**
+ * @author <a href="mailto:nikolazius@gmail.com">Nikolay Zamosenchuk</a>
+ * @version $Id$
+ *
+ */
+public class TestLockCleanupOnRestart extends JcrAPIBaseTest
+{
+
+ /*
+ * This test should be performed manually because it requires JCR tearDown and startup without
+ * cleaning it's content.
+ *
+ * To check whether lock-properties are deleted as expected, first run:
+ * >mvn clean test -Dtest=org.exoplatform.services.jcr.api.lock.TestLockCleanupOnRestart
+ * then (without clean!) :
+ * >mvn test -Dtest=org.exoplatform.services.jcr.api.lock.TestLockCleanupOnRestart
+ */
+
+ private static String testNodeName = "LockIt";
+
+ public void testLockCleanUp() throws Exception
+ {
+ log.info("/!\\ This test should be executed twice ('mvn clean test "
+ + "-Dtest=...' and then without 'clean') and separately from other tests /!\\");
+ NodeImpl node;
+ try
+ {
+ node = (NodeImpl)root.getNode(testNodeName);
+ log.info("Node \"/LockIt\" found, this is correct SECOND run.");
+ }
+ catch (PathNotFoundException e)
+ {
+ node = (NodeImpl)root.addNode(testNodeName);
+ node.addMixin("mix:lockable");
+ log.info("Node \"/LockIt\" not found, this is probably FIRST run. If not, "
+ + "ensure that \"clean\" is not invoked in \"maven test\"!");
+ }
+ session.save();
+ // locking the node with open-scoped deep lock.
+ // no exception should be thrown
+ try
+ {
+ node.lock(true, false);
+ // ok!
+ }
+ catch (Exception e)
+ {
+ fail("Unexpected exception" + e.getStackTrace());
+ }
+ session.logout();
+ }
+
+ @Override
+ protected void tearDown() throws Exception
+ {
+ // super.tearDown in not invoked to prevent DB cleaning
+ // shutdown HSSQLDB :)
+ for (Object uri : DatabaseManager.getDatabaseURIs())
+ {
+ try
+ {
+ Connection c = DriverManager.getConnection("jdbc:hsqldb:" + uri.toString(), "sa", "");
+ c.createStatement().execute("SHUTDOWN");
+ }
+ catch (Throwable e)
+ {
+ }
+ }
+ }
+}
Property changes on: jcr/branches/1.12.0-JBC/component/core/src/test/java/org/exoplatform/services/jcr/api/lock/TestLockCleanupOnRestart.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Id
Name: svn:eol-style
+ native
16 years, 7 months
exo-jcr SVN: r857 - in jcr/branches/1.12.0-OPT: exo.jcr.component.ext/src/test/java/org/exoplatform/services/jcr/ext and 1 other directories.
by do-not-reply@jboss.org
Author: tolusha
Date: 2009-11-25 07:59:51 -0500 (Wed, 25 Nov 2009)
New Revision: 857
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.ext/src/test/java/org/exoplatform/services/jcr/ext/BaseStandaloneTest.java
jcr/branches/1.12.0-OPT/exo.jcr.component.ftp/src/test/java/org/exoplatform/services/ftp/BaseStandaloneTest.java
Log:
EXOJCR-221: createNode improvement, dont call isNodeType method
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-25 11:33:59 UTC (rev 856)
+++ jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/SessionDataManager.java 2009-11-25 12:59:51 UTC (rev 857)
@@ -1890,11 +1890,11 @@
private NodeImpl createNode(NodeData data, NodeData parent) throws RepositoryException
{
NodeImpl node = new NodeImpl(data, parent, session);
- if (node.isNodeType(Constants.NT_VERSION))
+ if (data.getPrimaryTypeName().equals(Constants.NT_VERSION))
{
return new VersionImpl(data, session);
}
- else if (node.isNodeType(Constants.NT_VERSIONHISTORY))
+ else if (data.getPrimaryTypeName().equals(Constants.NT_VERSIONHISTORY))
{
return new VersionHistoryImpl(data, session);
}
Modified: jcr/branches/1.12.0-OPT/exo.jcr.component.ext/src/test/java/org/exoplatform/services/jcr/ext/BaseStandaloneTest.java
===================================================================
--- jcr/branches/1.12.0-OPT/exo.jcr.component.ext/src/test/java/org/exoplatform/services/jcr/ext/BaseStandaloneTest.java 2009-11-25 11:33:59 UTC (rev 856)
+++ jcr/branches/1.12.0-OPT/exo.jcr.component.ext/src/test/java/org/exoplatform/services/jcr/ext/BaseStandaloneTest.java 2009-11-25 12:59:51 UTC (rev 857)
@@ -388,7 +388,7 @@
return testFile;
}
- protected void checkMixins(String[] mixins, NodeImpl node)
+ protected void checkMixins(String[] mixins, NodeImpl node) throws RepositoryException
{
try
{
Modified: jcr/branches/1.12.0-OPT/exo.jcr.component.ftp/src/test/java/org/exoplatform/services/ftp/BaseStandaloneTest.java
===================================================================
--- jcr/branches/1.12.0-OPT/exo.jcr.component.ftp/src/test/java/org/exoplatform/services/ftp/BaseStandaloneTest.java 2009-11-25 11:33:59 UTC (rev 856)
+++ jcr/branches/1.12.0-OPT/exo.jcr.component.ftp/src/test/java/org/exoplatform/services/ftp/BaseStandaloneTest.java 2009-11-25 12:59:51 UTC (rev 857)
@@ -343,7 +343,7 @@
return testFile;
}
- protected void checkMixins(String[] mixins, NodeImpl node)
+ protected void checkMixins(String[] mixins, NodeImpl node) throws RepositoryException
{
try
{
16 years, 7 months
exo-jcr SVN: r856 - jcr/branches/1.12.0-JBC/component/core/src/test/resources/conf/standalone.
by do-not-reply@jboss.org
Author: sergiykarpenko
Date: 2009-11-25 06:33:59 -0500 (Wed, 25 Nov 2009)
New Revision: 856
Modified:
jcr/branches/1.12.0-JBC/component/core/src/test/resources/conf/standalone/test-jcr-config-sjdbc.xml
Log:
EXOJCR-199: test-jcr-config-sjdbc - JBoss cache added
Modified: jcr/branches/1.12.0-JBC/component/core/src/test/resources/conf/standalone/test-jcr-config-sjdbc.xml
===================================================================
--- jcr/branches/1.12.0-JBC/component/core/src/test/resources/conf/standalone/test-jcr-config-sjdbc.xml 2009-11-25 10:59:29 UTC (rev 855)
+++ jcr/branches/1.12.0-JBC/component/core/src/test/resources/conf/standalone/test-jcr-config-sjdbc.xml 2009-11-25 11:33:59 UTC (rev 856)
@@ -29,8 +29,9 @@
<authentication-policy>org.exoplatform.services.jcr.impl.core.access.JAASAuthenticator</authentication-policy>
<workspaces>
<workspace name="ws">
- <container class="org.exoplatform.services.jcr.impl.storage.jdbc.JDBCWorkspaceDataContainer">
+ <container class="org.exoplatform.services.jcr.impl.storage.jbosscache.JBossCacheWorkspaceDataContainer">
<properties>
+ <property name="jbosscache-configuration" value="conf/standalone/test-jbosscache-config-exoloader_db1_ws.xml" />
<property name="source-name" value="jdbcjcr" />
<property name="dialect" value="hsqldb" />
<property name="multi-db" value="false" />
@@ -54,31 +55,32 @@
<property name="root-nodetype" value="nt:unstructured" />
</properties>
</initializer>
- <cache enabled="true" class="org.exoplatform.services.jcr.impl.dataflow.persistent.LinkedWorkspaceStorageCacheImpl">
+ <!--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>
+ </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>
+
+ <!--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>
+ </lock-manager-->
</workspace>
<workspace name="ws1">
- <container class="org.exoplatform.services.jcr.impl.storage.jdbc.JDBCWorkspaceDataContainer">
+ <container class="org.exoplatform.services.jcr.impl.storage.jbosscache.JBossCacheWorkspaceDataContainer">
<properties>
- <property name="source-name" value="jdbcjcr" />
+ <property name="jbosscache-configuration" value="conf/standalone/test-jbosscache-config-exoloader_db1_ws1.xml" /> <property name="source-name" value="jdbcjcr" />
<property name="dialect" value="hsqldb" />
<property name="multi-db" value="false" />
<property name="update-storage" value="false" />
@@ -101,12 +103,12 @@
<property name="root-nodetype" value="nt:unstructured" />
</properties>
</initializer>
- <cache enabled="true" class="org.exoplatform.services.jcr.impl.dataflow.persistent.LinkedWorkspaceStorageCacheImpl">
+ <!--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>
+ </cache-->
<query-handler class="org.exoplatform.services.jcr.impl.core.query.lucene.SearchIndex">
<properties>
<property name="index-dir" value="target/temp/index/db1/ws1" />
@@ -121,9 +123,9 @@
</workspace>
<workspace name="ws2">
- <container class="org.exoplatform.services.jcr.impl.storage.jdbc.JDBCWorkspaceDataContainer">
+ <container class="org.exoplatform.services.jcr.impl.storage.jbosscache.JBossCacheWorkspaceDataContainer">
<properties>
- <property name="source-name" value="jdbcjcr" />
+ <property name="jbosscache-configuration" value="conf/standalone/test-jbosscache-config-exoloader_db1_ws2.xml" /> <property name="source-name" value="jdbcjcr" />
<property name="dialect" value="hsqldb" />
<property name="multi-db" value="false" />
<property name="update-storage" value="false" />
@@ -146,12 +148,12 @@
<property name="root-nodetype" value="nt:unstructured" />
</properties>
</initializer>
- <cache enabled="true" class="org.exoplatform.services.jcr.impl.dataflow.persistent.LinkedWorkspaceStorageCacheImpl">
+ <!--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>
+ </cache-->
<query-handler class="org.exoplatform.services.jcr.impl.core.query.lucene.SearchIndex">
<properties>
<property name="index-dir" value="target/temp/index/db1/ws2" />
@@ -167,8 +169,9 @@
<workspace name="ws3">
<!-- for system storage -->
- <container class="org.exoplatform.services.jcr.impl.storage.jdbc.JDBCWorkspaceDataContainer">
+ <container class="org.exoplatform.services.jcr.impl.storage.jbosscache.JBossCacheWorkspaceDataContainer">
<properties>
+ <property name="jbosscache-configuration" value="conf/standalone/test-jbosscache-config-exoloader_db1_ws3.xml" />
<property name="source-name" value="jdbcjcr" />
<property name="dialect" value="hsqldb" />
<property name="multi-db" value="false" />
@@ -208,12 +211,12 @@
<property name="root-nodetype" value="nt:unstructured" />
</properties>
</initializer>
- <cache enabled="true" class="org.exoplatform.services.jcr.impl.dataflow.persistent.LinkedWorkspaceStorageCacheImpl">
+ <!--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>
+ </cache-->
<query-handler class="org.exoplatform.services.jcr.impl.core.query.lucene.SearchIndex">
<properties>
<property name="index-dir" value="target/temp/index/db1/ws3" />
@@ -237,8 +240,9 @@
<authentication-policy>org.exoplatform.services.jcr.impl.core.access.JAASAuthenticator</authentication-policy>
<workspaces>
<workspace name="ws">
- <container class="org.exoplatform.services.jcr.impl.storage.jdbc.JDBCWorkspaceDataContainer">
+ <container class="org.exoplatform.services.jcr.impl.storage.jbosscache.JBossCacheWorkspaceDataContainer">
<properties>
+ <property name="jbosscache-configuration" value="conf/standalone/test-jbosscache-config-exoloader_db1tck_ws.xml" />
<property name="source-name" value="jdbcjcrtck" />
<property name="dialect" value="hsqldb" />
<property name="multi-db" value="false" />
@@ -264,12 +268,12 @@
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">
+ <!--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>
+ </cache-->
<query-handler class="org.exoplatform.services.jcr.impl.core.query.lucene.SearchIndex">
<properties>
<property name="index-dir" value="target/temp/index/db1tck/ws" />
@@ -293,8 +297,9 @@
</workspace>
<workspace name="ws1">
- <container class="org.exoplatform.services.jcr.impl.storage.jdbc.JDBCWorkspaceDataContainer">
+ <container class="org.exoplatform.services.jcr.impl.storage.jbosscache.JBossCacheWorkspaceDataContainer">
<properties>
+ <property name="jbosscache-configuration" value="conf/standalone/test-jbosscache-config-exoloader_db1tck_ws1.xml" />
<property name="source-name" value="jdbcjcrtck" />
<property name="dialect" value="hsqldb" />
<property name="multi-db" value="false" />
@@ -320,12 +325,12 @@
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">
+ <!--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>
+ </cache-->
<query-handler class="org.exoplatform.services.jcr.impl.core.query.lucene.SearchIndex">
<properties>
<property name="index-dir" value="target/temp/index/db1tck/ws1" />
@@ -340,8 +345,9 @@
</workspace>
<workspace name="ws2">
- <container class="org.exoplatform.services.jcr.impl.storage.jdbc.JDBCWorkspaceDataContainer">
+ <container class="org.exoplatform.services.jcr.impl.storage.jbosscache.JBossCacheWorkspaceDataContainer">
<properties>
+ <property name="jbosscache-configuration" value="conf/standalone/test-jbosscache-config-exoloader_db1tck_ws2.xml" />
<property name="source-name" value="jdbcjcrtck" />
<property name="dialect" value="hsqldb" />
<property name="multi-db" value="false" />
@@ -367,12 +373,12 @@
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">
+ <!--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>
+ </cache-->
<query-handler class="org.exoplatform.services.jcr.impl.core.query.lucene.SearchIndex">
<properties>
<property name="index-dir" value="target/temp/index/db1tck/ws2" />
16 years, 7 months
exo-jcr SVN: r855 - jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent.
by do-not-reply@jboss.org
Author: nzamosenchuk
Date: 2009-11-25 05:59:29 -0500 (Wed, 25 Nov 2009)
New Revision: 855
Modified:
jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/JBossCacheWorkspaceDataManager.java
Log:
EXOJCR-243: delete lock data on node deletion
Modified: jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/JBossCacheWorkspaceDataManager.java
===================================================================
--- jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/JBossCacheWorkspaceDataManager.java 2009-11-25 10:57:20 UTC (rev 854)
+++ jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/JBossCacheWorkspaceDataManager.java 2009-11-25 10:59:29 UTC (rev 855)
@@ -76,6 +76,7 @@
WorkspaceStorageConnection thisConnection = null;
WorkspaceStorageConnection systemConnection = null;
+ List<String> removeLocksList = new ArrayList<String>();
// prepare changes log list
List<PlainChangesLog> chengesLogList = new ArrayList<PlainChangesLog>();
@@ -192,18 +193,22 @@
if (itemState.isAdded())
{
doAdd(data, conn, addedNodes);
+ removeLocksList.remove(data.getIdentifier());
}
else if (itemState.isUpdated())
{
doUpdate(data, conn);
+ removeLocksList.remove(data.getIdentifier());
}
else if (itemState.isDeleted())
{
doDelete(data, conn);
+ removeLocksList.add(data.getIdentifier());
}
else if (itemState.isRenamed())
{
doRename(data, conn, addedNodes);
+ removeLocksList.remove(data.getIdentifier());
}
else if (itemState.isMixinChanged())
{
@@ -215,6 +220,10 @@
+ "ms, " + data.getQPath().getAsString());
}
}
+ for (String identifier : removeLocksList)
+ {
+ thisConnection.removeLockData(identifier);
+ }
if (thisConnection != null)
thisConnection.commit();
if (systemConnection != null && !systemConnection.equals(thisConnection))
16 years, 7 months
exo-jcr SVN: r854 - jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/core.
by do-not-reply@jboss.org
Author: areshetnyak
Date: 2009-11-25 05:57:20 -0500 (Wed, 25 Nov 2009)
New Revision: 854
Modified:
jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/core/BackupWorkspaceInitializer.java
jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/core/SysViewWorkspaceInitializer.java
Log:
EXOJCR-203 : In SysViewWorkspaceinitializer and BackupWorkspaceInitializer was changed dependency from CacheableWorkspaceDataManager to WorkspacePersistentDataManager.
Modified: jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/core/BackupWorkspaceInitializer.java
===================================================================
--- jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/core/BackupWorkspaceInitializer.java 2009-11-25 10:44:59 UTC (rev 853)
+++ jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/core/BackupWorkspaceInitializer.java 2009-11-25 10:57:20 UTC (rev 854)
@@ -36,6 +36,7 @@
import org.exoplatform.services.jcr.impl.dataflow.TransientPropertyData;
import org.exoplatform.services.jcr.impl.dataflow.TransientValueData;
import org.exoplatform.services.jcr.impl.dataflow.persistent.CacheableWorkspaceDataManager;
+import org.exoplatform.services.jcr.impl.dataflow.persistent.WorkspacePersistentDataManager;
import org.exoplatform.services.jcr.impl.storage.JCRInvalidItemStateException;
import org.exoplatform.services.jcr.impl.util.io.FileCleaner;
import org.exoplatform.services.jcr.observation.ExtendedEvent;
@@ -74,7 +75,7 @@
private FileCleaner fileCleaner;
public BackupWorkspaceInitializer(WorkspaceEntry config, RepositoryEntry repConfig,
- CacheableWorkspaceDataManager dataManager, NamespaceRegistryImpl namespaceRegistry,
+ WorkspacePersistentDataManager dataManager, NamespaceRegistryImpl namespaceRegistry,
LocationFactory locationFactory, NodeTypeManagerImpl nodeTypeManager, ValueFactoryImpl valueFactory,
AccessManager accessManager) throws RepositoryConfigurationException, PathNotFoundException, RepositoryException
{
Modified: jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/core/SysViewWorkspaceInitializer.java
===================================================================
--- jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/core/SysViewWorkspaceInitializer.java 2009-11-25 10:44:59 UTC (rev 853)
+++ jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/core/SysViewWorkspaceInitializer.java 2009-11-25 10:57:20 UTC (rev 854)
@@ -18,6 +18,28 @@
*/
package org.exoplatform.services.jcr.impl.core;
+import java.io.ByteArrayOutputStream;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.util.ArrayList;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Stack;
+
+import javax.jcr.NamespaceException;
+import javax.jcr.PathNotFoundException;
+import javax.jcr.PropertyType;
+import javax.jcr.RepositoryException;
+import javax.xml.stream.FactoryConfigurationError;
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.events.StartElement;
+
import org.apache.ws.commons.util.Base64;
import org.exoplatform.services.jcr.access.AccessManager;
import org.exoplatform.services.jcr.config.RepositoryConfigurationException;
@@ -41,34 +63,13 @@
import org.exoplatform.services.jcr.impl.dataflow.TransientPropertyData;
import org.exoplatform.services.jcr.impl.dataflow.TransientValueData;
import org.exoplatform.services.jcr.impl.dataflow.persistent.CacheableWorkspaceDataManager;
+import org.exoplatform.services.jcr.impl.dataflow.persistent.WorkspacePersistentDataManager;
import org.exoplatform.services.jcr.impl.util.JCRDateFormat;
import org.exoplatform.services.jcr.impl.util.io.FileCleaner;
import org.exoplatform.services.jcr.storage.WorkspaceDataContainer;
import org.exoplatform.services.log.ExoLogger;
import org.exoplatform.services.log.Log;
-import java.io.ByteArrayOutputStream;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.util.ArrayList;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Stack;
-
-import javax.jcr.NamespaceException;
-import javax.jcr.PathNotFoundException;
-import javax.jcr.PropertyType;
-import javax.jcr.RepositoryException;
-import javax.xml.stream.FactoryConfigurationError;
-import javax.xml.stream.XMLInputFactory;
-import javax.xml.stream.XMLStreamException;
-import javax.xml.stream.XMLStreamReader;
-import javax.xml.stream.events.StartElement;
-
/**
* Created by The eXo Platform SAS. <br/>
*
@@ -357,7 +358,7 @@
* @param repConfig
* RepositoryEntry
* @param dataManager
- * CacheableWorkspaceDataManager
+ * WorkspacePersistentDataManager
* @param namespaceRegistry
* NamespaceRegistryImpl
* @param locationFactory
@@ -376,9 +377,10 @@
* if Repository error
*/
public SysViewWorkspaceInitializer(WorkspaceEntry config, RepositoryEntry repConfig,
- CacheableWorkspaceDataManager dataManager, NamespaceRegistryImpl namespaceRegistry,
- LocationFactory locationFactory, NodeTypeManagerImpl nodeTypeManager, ValueFactoryImpl valueFactory,
- AccessManager accessManager) throws RepositoryConfigurationException, PathNotFoundException, RepositoryException
+ WorkspacePersistentDataManager dataManager, NamespaceRegistryImpl namespaceRegistry,
+ LocationFactory locationFactory, NodeTypeManagerImpl nodeTypeManager, ValueFactoryImpl valueFactory,
+ AccessManager accessManager) throws RepositoryConfigurationException, PathNotFoundException,
+ RepositoryException
{
this.workspaceName = config.getName();
@@ -409,7 +411,7 @@
* @param repConfig
* RepositoryEntry
* @param dataManager
- * CacheableWorkspaceDataManager
+ * WorkspacePersistentDataManager
* @param namespaceRegistry
* NamespaceRegistryImpl
* @param locationFactory
@@ -426,7 +428,7 @@
* if Repository error
*/
public SysViewWorkspaceInitializer(WorkspaceEntry config, RepositoryEntry repConfig,
- CacheableWorkspaceDataManager dataManager, NamespaceRegistryImpl namespaceRegistry,
+ WorkspacePersistentDataManager dataManager, NamespaceRegistryImpl namespaceRegistry,
LocationFactory locationFactory, NodeTypeManagerImpl nodeTypeManager, ValueFactoryImpl valueFactory,
AccessManager accessManager, String restorePath) throws RepositoryException
{
16 years, 7 months
exo-jcr SVN: r853 - in jcr/branches/1.12.0-OPT/exo.jcr.component.core/src: main/java/org/exoplatform/services/jcr/impl/core/version and 2 other directories.
by do-not-reply@jboss.org
Author: tolusha
Date: 2009-11-25 05:44:59 -0500 (Wed, 25 Nov 2009)
New Revision: 853
Modified:
jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/ItemImpl.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/PropertyImpl.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/core/version/VersionHistoryImpl.java
jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/BaseStandaloneTest.java
jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/load/perf/TestGetNodesPerf.java
Log:
EXOJRC-221: improvements with location & definitions
Modified: jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/ItemImpl.java
===================================================================
--- jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/ItemImpl.java 2009-11-25 10:28:31 UTC (rev 852)
+++ jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/ItemImpl.java 2009-11-25 10:44:59 UTC (rev 853)
@@ -23,6 +23,7 @@
import org.exoplatform.services.jcr.access.AccessManager;
import org.exoplatform.services.jcr.access.PermissionType;
import org.exoplatform.services.jcr.core.ExtendedPropertyType;
+import org.exoplatform.services.jcr.core.nodetype.ItemDefinitionData;
import org.exoplatform.services.jcr.core.nodetype.NodeTypeData;
import org.exoplatform.services.jcr.core.nodetype.NodeTypeDataManager;
import org.exoplatform.services.jcr.core.nodetype.PropertyDefinitionData;
@@ -97,6 +98,11 @@
*/
protected JCRPath location;
+ /**
+ * Item QPath.
+ */
+ protected QPath qpath;
+
protected SessionDataManager dataManager;
protected LocationFactory locationFactory;
@@ -157,7 +163,7 @@
/**
* {@inheritDoc}
*/
- public String getPath()
+ public String getPath() throws RepositoryException
{
return getLocation().getAsString(false);
}
@@ -165,7 +171,7 @@
/**
* {@inheritDoc}
*/
- public String getName()
+ public String getName() throws RepositoryException
{
return getLocation().getName().getAsString();
}
@@ -231,7 +237,7 @@
*/
public int getDepth()
{
- return getLocation().getDepth();
+ return qpath.getDepth();
}
/**
@@ -741,8 +747,11 @@
*
* @return item JCRPath
*/
- public JCRPath getLocation()
+ public JCRPath getLocation() throws RepositoryException
{
+ if (this.location == null)
+ this.location = session.getLocationFactory().createJCRPath(qpath);
+
return this.location;
}
@@ -758,6 +767,15 @@
abstract void loadData(ItemData data) throws RepositoryException;
+ abstract void loadData(ItemData data, ItemDefinitionData itemDefinitionData) throws RepositoryException;
+
+ /**
+ * Returns Item definition data.
+ *
+ * @return
+ */
+ abstract ItemDefinitionData getItemDefinitionData();
+
public boolean hasPermission(String action) throws RepositoryException
{
NodeData ndata;
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-25 10:28:31 UTC (rev 852)
+++ jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/NodeImpl.java 2009-11-25 10:44:59 UTC (rev 853)
@@ -24,6 +24,7 @@
import org.exoplatform.services.jcr.access.SystemIdentity;
import org.exoplatform.services.jcr.core.ExtendedNode;
import org.exoplatform.services.jcr.core.nodetype.ExtendedNodeTypeManager;
+import org.exoplatform.services.jcr.core.nodetype.ItemDefinitionData;
import org.exoplatform.services.jcr.core.nodetype.NodeDefinitionData;
import org.exoplatform.services.jcr.core.nodetype.NodeTypeData;
import org.exoplatform.services.jcr.core.nodetype.NodeTypeDataManager;
@@ -137,7 +138,7 @@
*
* @param data
* Node data
- * @param session
+ * @param session
* Session
* @throws RepositoryException
* if error occurs during the Node data loading
@@ -150,6 +151,25 @@
}
/**
+ * NodeImpl constructor.
+ *
+ * @param data
+ * Node data
+ * @param parent
+ * Parent node data
+ * @param session
+ * Session
+ * @throws RepositoryException
+ * if error occurs during the Node data loading
+ */
+ public NodeImpl(NodeData data, NodeData parent, SessionImpl session) throws RepositoryException
+ {
+ super(data, session);
+ this.sysLocFactory = session.getSystemLocationFactory();
+ loadData(data, parent);
+ }
+
+ /**
* {@inheritDoc}
*/
public void accept(ItemVisitor visitor) throws RepositoryException
@@ -1357,7 +1377,8 @@
throw new RepositoryException("ACL is NULL " + nodeData.getQPath().getAsString());
this.data = nodeData;
- this.location = session.getLocationFactory().createJCRPath(getData().getQPath());
+ this.qpath = nodeData.getQPath();
+ this.location = null;
initDefinition();
}
@@ -1365,6 +1386,84 @@
/**
* {@inheritDoc}
*/
+ private void loadData(ItemData data, NodeData parent) throws RepositoryException, InvalidItemStateException,
+ ConstraintViolationException
+ {
+
+ if (data == null)
+ throw new InvalidItemStateException("Data is null for " + this.getPath()
+ + " Probably was deleted by another session and can not be loaded from container ");
+
+ if (!data.isNode())
+ throw new RepositoryException("Load data failed: Node expected");
+
+ NodeData nodeData = (NodeData)data;
+
+ // TODO do we need this three checks here?
+ if (nodeData.getPrimaryTypeName() == null)
+ throw new RepositoryException("Load data: NodeData has no primaryTypeName. Null value found. "
+ + (nodeData.getQPath() != null ? nodeData.getQPath().getAsString() : "[null path node]") + " " + nodeData);
+
+ if (nodeData.getMixinTypeNames() == null)
+ throw new RepositoryException("Load data: NodeData has no mixinTypeNames. Null value found. "
+ + (nodeData.getQPath() != null ? nodeData.getQPath().getAsString() : "[null path node]"));
+
+ if (nodeData.getACL() == null)
+ throw new RepositoryException("ACL is NULL " + nodeData.getQPath().getAsString());
+
+ this.data = nodeData;
+ this.qpath = nodeData.getQPath();
+ this.location = null;
+
+ initDefinition(parent);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void loadData(ItemData data, ItemDefinitionData itemDefinitionData) throws RepositoryException,
+ InvalidItemStateException, ConstraintViolationException
+ {
+
+ if (data == null)
+ throw new InvalidItemStateException("Data is null for " + this.getPath()
+ + " Probably was deleted by another session and can not be loaded from container ");
+
+ if (!data.isNode())
+ throw new RepositoryException("Load data failed: Node expected");
+
+ NodeData nodeData = (NodeData)data;
+
+ // TODO do we need this three checks here?
+ if (nodeData.getPrimaryTypeName() == null)
+ throw new RepositoryException("Load data: NodeData has no primaryTypeName. Null value found. "
+ + (nodeData.getQPath() != null ? nodeData.getQPath().getAsString() : "[null path node]") + " " + nodeData);
+
+ if (nodeData.getMixinTypeNames() == null)
+ throw new RepositoryException("Load data: NodeData has no mixinTypeNames. Null value found. "
+ + (nodeData.getQPath() != null ? nodeData.getQPath().getAsString() : "[null path node]"));
+
+ if (nodeData.getACL() == null)
+ throw new RepositoryException("ACL is NULL " + nodeData.getQPath().getAsString());
+
+ this.data = nodeData;
+ this.location = null;
+ this.qpath = nodeData.getQPath();
+ this.definition = (NodeDefinitionData)itemDefinitionData;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public ItemDefinitionData getItemDefinitionData()
+ {
+ return definition;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
public Lock lock(boolean isDeep, boolean isSessionScoped) throws UnsupportedRepositoryOperationException,
LockException, AccessDeniedException, RepositoryException
{
@@ -2685,6 +2784,33 @@
throw new ConstraintViolationException("Node definition not found for " + getPath());
}
+ /**
+ * Init NodeDefinition.
+ *
+ * @throws RepositoryException
+ * if error occurs
+ * @throws ConstraintViolationException
+ * if definition not found
+ */
+ private void initDefinition(NodeData parent) throws RepositoryException, ConstraintViolationException
+ {
+
+ if (this.isRoot())
+ { // root - no parent
+ this.definition =
+ new NodeDefinitionData(null, null, true, true, OnParentVersionAction.ABORT, true,
+ new InternalQName[]{Constants.NT_BASE}, null, false);
+ return;
+ }
+
+ this.definition =
+ session.getWorkspace().getNodeTypesHolder().getChildNodeDefinition(getInternalName(),
+ parent.getPrimaryTypeName(), parent.getMixinTypeNames());
+
+ if (definition == null)
+ throw new ConstraintViolationException("Node definition not found for " + getPath());
+ }
+
private void removeMergeFailed(Version version, PlainChangesLog changesLog) throws RepositoryException
{
Modified: jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/PropertyImpl.java
===================================================================
--- jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/PropertyImpl.java 2009-11-25 10:28:31 UTC (rev 852)
+++ jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/PropertyImpl.java 2009-11-25 10:44:59 UTC (rev 853)
@@ -19,6 +19,7 @@
package org.exoplatform.services.jcr.impl.core;
import org.exoplatform.services.jcr.core.nodetype.ExtendedNodeTypeManager;
+import org.exoplatform.services.jcr.core.nodetype.ItemDefinitionData;
import org.exoplatform.services.jcr.core.nodetype.PropertyDefinitionData;
import org.exoplatform.services.jcr.core.nodetype.PropertyDefinitionDatas;
import org.exoplatform.services.jcr.datamodel.InternalQName;
@@ -93,14 +94,42 @@
this.propertyData = (TransientPropertyData)data;
this.type = propertyData.getType();
- this.location = session.getLocationFactory().createJCRPath(getData().getQPath());
- this.propertyDef = null;
+ this.qpath = data.getQPath();
+ this.location = null;
+
initDefinitions(this.propertyData.isMultiValued());
}
/**
* {@inheritDoc}
*/
+ void loadData(ItemData data, ItemDefinitionData itemDefinitionData) throws RepositoryException,
+ ConstraintViolationException
+ {
+
+ if (!(data instanceof TransientPropertyData))
+ throw new RepositoryException("Load data: TransientPropertyData is expected, but have " + data);
+
+ this.data = data;
+ this.propertyData = (TransientPropertyData)data;
+ this.type = propertyData.getType();
+
+ this.location = null;
+ this.qpath = data.getQPath();
+ this.propertyDef = (PropertyDefinitionData)itemDefinitionData;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public ItemDefinitionData getItemDefinitionData()
+ {
+ return propertyDef;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
public Value getValue() throws ValueFormatException, RepositoryException
{
@@ -526,9 +555,10 @@
*/
public String dump()
{
- String vals = "Property " + getPath() + " values: ";
+ String vals = "Property ";
try
{
+ vals = getPath() + " values: ";
for (int i = 0; i < getValueArray().length; i++)
{
vals += new String(((BaseValue)getValueArray()[i]).getInternalData().getAsByteArray()) + ";";
@@ -564,19 +594,4 @@
return false;
}
- /**
- * {@inheritDoc}
- */
- @Override
- public int hashCode()
- {
- try
- {
- return getLocation().getAsString(false).hashCode();
- }
- catch (Exception e)
- {
- return super.hashCode();
- }
- }
}
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-25 10:28:31 UTC (rev 852)
+++ jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/SessionDataManager.java 2009-11-25 10:44:59 UTC (rev 853)
@@ -578,7 +578,7 @@
for (NodeData data : nodeDatas)
{
- NodeImpl item = itemFactory.createNode(data);
+ NodeImpl item = itemFactory.createNode(data, parent);
session.getActionHandler().postRead(item);
@@ -1729,7 +1729,7 @@
}
else
{
- item.loadData(newItem.getData());
+ item.loadData(newItem.getData(), newItem.getItemDefinitionData());
return item;
}
}
@@ -1839,12 +1839,19 @@
String dump()
{
String str = "Items Pool: \n";
- for (ItemImpl item : items.values())
+ try
{
- str +=
- (item.isNode() ? "Node\t\t" : "Property\t") + "\t" + item.isValid() + "\t" + item.isNew() + "\t"
- + item.getInternalIdentifier() + "\t" + item.getPath() + "\n";
+ for (ItemImpl item : items.values())
+ {
+ str +=
+ (item.isNode() ? "Node\t\t" : "Property\t") + "\t" + item.isValid() + "\t" + item.isNew() + "\t"
+ + item.getInternalIdentifier() + "\t" + item.getPath() + "\n";
+ }
}
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
return str;
}
@@ -1880,10 +1887,26 @@
return node;
}
+ private NodeImpl createNode(NodeData data, NodeData parent) throws RepositoryException
+ {
+ NodeImpl node = new NodeImpl(data, parent, session);
+ if (node.isNodeType(Constants.NT_VERSION))
+ {
+ return new VersionImpl(data, session);
+ }
+ else if (node.isNodeType(Constants.NT_VERSIONHISTORY))
+ {
+ return new VersionHistoryImpl(data, session);
+ }
+ else
+ return node;
+ }
+
private PropertyImpl createProperty(ItemData data) throws RepositoryException
{
return new PropertyImpl(data, session);
}
+
}
/**
Modified: jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/version/VersionHistoryImpl.java
===================================================================
--- jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/version/VersionHistoryImpl.java 2009-11-25 10:28:31 UTC (rev 852)
+++ jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/version/VersionHistoryImpl.java 2009-11-25 10:44:59 UTC (rev 853)
@@ -629,7 +629,7 @@
}
- public boolean isVersionBelongToThis(Version version)
+ public boolean isVersionBelongToThis(Version version) throws RepositoryException
{
return ((VersionImpl)version).getLocation().isDescendantOf(getLocation(), false);
}
Modified: jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/BaseStandaloneTest.java
===================================================================
--- jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/BaseStandaloneTest.java 2009-11-25 10:28:31 UTC (rev 852)
+++ jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/BaseStandaloneTest.java 2009-11-25 10:44:59 UTC (rev 853)
@@ -387,7 +387,7 @@
return testFile;
}
- protected void checkMixins(String[] mixins, NodeImpl node)
+ protected void checkMixins(String[] mixins, NodeImpl node) throws RepositoryException
{
try
{
Modified: jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/load/perf/TestGetNodesPerf.java
===================================================================
--- jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/load/perf/TestGetNodesPerf.java 2009-11-25 10:28:31 UTC (rev 852)
+++ jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/load/perf/TestGetNodesPerf.java 2009-11-25 10:44:59 UTC (rev 853)
@@ -19,11 +19,7 @@
import org.exoplatform.services.jcr.JcrAPIBaseTest;
import org.exoplatform.services.jcr.impl.core.SessionImpl;
-import java.io.File;
-import java.io.PrintWriter;
-
import javax.jcr.Node;
-import javax.jcr.PathNotFoundException;
import javax.jcr.RepositoryException;
import javax.jcr.Session;
@@ -39,14 +35,17 @@
{
private static final String testName = "testRoot";
- private static final int sessionCount = 20;
+ private static final int sessionCount = 1;
+ private static final int tryCount = 10;
+
private Session[] sessions = new Session[sessionCount];
private GetNodesThread[] threads = new GetNodesThread[sessionCount];
public void testGetNodes() throws Exception
{
+
for (int i = 0; i < sessionCount; i++)
{
sessions[i] = (SessionImpl)repository.login(credentials, "ws");
@@ -67,6 +66,10 @@
log.info("waiting for 10 seconds...");
Thread.sleep(10000);
+ System.gc();
+ Runtime rt = Runtime.getRuntime();
+ long usedMemory = rt.totalMemory() - rt.freeMemory();
+
log.info("getting nodes...");
for (int i = 0; i < sessionCount; i++)
{
@@ -87,8 +90,7 @@
break;
}
-
- log.info("Test finished");
+ log.info("Memory used: " + (rt.totalMemory() - rt.freeMemory() - usedMemory) / 1024 + "Kb");
}
private class GetNodesThread extends Thread
@@ -107,9 +109,12 @@
{
Node testRoot = curSession.getRootNode().getNode(testName);
- long startTime = System.currentTimeMillis();
- testRoot.getNodes();
- log.info("Total time: " + (System.currentTimeMillis() - startTime) / 1000 + "s");
+ for (int k = 0; k < tryCount; k++)
+ {
+ long startTime = System.currentTimeMillis();
+ testRoot.getNodes();
+ log.info("Total time: " + (System.currentTimeMillis() - startTime) / 1000 + "s");
+ }
}
catch (RepositoryException e)
{
16 years, 7 months
exo-jcr SVN: r852 - jcr/trunk.
by do-not-reply@jboss.org
Author: dkatayev
Date: 2009-11-25 05:28:31 -0500 (Wed, 25 Nov 2009)
New Revision: 852
Modified:
jcr/trunk/pom.xml
Log:
EXOJCR-162 pom.xml cleaned up
Modified: jcr/trunk/pom.xml
===================================================================
--- jcr/trunk/pom.xml 2009-11-25 09:14:54 UTC (rev 851)
+++ jcr/trunk/pom.xml 2009-11-25 10:28:31 UTC (rev 852)
@@ -352,72 +352,7 @@
<artifactId>commons-io</artifactId>
<version>1.3</version>
</dependency>
-
-<!-- _________________________________________________________________________________________ -->
-<!--
-
- <dependency>
- <groupId>org.exoplatform.ws</groupId>
- <artifactId>exo.ws.frameworks.servlet</artifactId>
- <version>${org.exoplatform.ws.version}</version>
- </dependency>
-
- <dependency>
- <groupId>javax.xml.stream</groupId>
- <artifactId>stax-api</artifactId>
- <version>1.0</version>
- </dependency>
-
- <dependency>
- <groupId>jotm</groupId>
- <artifactId>jotm</artifactId>
- <version>2.0.10</version>
- <exclusions>
- <exclusion>
- <groupId>javax.resource</groupId>
- <artifactId>connector</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
-
- <dependency>
- <groupId>commons-codec</groupId>
- <artifactId>commons-codec</artifactId>
- <version>1.2</version>
- </dependency>
-
- <dependency>
- <groupId>commons-chain</groupId>
- <artifactId>commons-chain</artifactId>
- <version>1.0</version>
- </dependency>
-
- <dependency>
- <groupId>com.amazon</groupId>
- <artifactId>s3</artifactId>
- <version>0.1</version>
- </dependency>
-
- <dependency>
- <groupId>com.amazonaws.sdb</groupId>
- <artifactId>simpledb</artifactId>
- <version>2007-11-07</version>
- </dependency>
-
- <dependency>
- <groupId>com.sun.xml.bind</groupId>
- <artifactId>jaxb-impl</artifactId>
- <version>2.1.7</version>
- </dependency>
- <dependency>
- <groupId>javax.resource</groupId>
- <artifactId>connector</artifactId>
- <version>1.5</version>
- </dependency>
-
-
--->
</dependencies>
</dependencyManagement>
16 years, 7 months
exo-jcr SVN: r851 - jcr/branches/1.12.0-JBC/component/core/src/test/java/org/exoplatform/services/jcr/api/writing.
by do-not-reply@jboss.org
Author: sergiykarpenko
Date: 2009-11-25 04:14:54 -0500 (Wed, 25 Nov 2009)
New Revision: 851
Modified:
jcr/branches/1.12.0-JBC/component/core/src/test/java/org/exoplatform/services/jcr/api/writing/TestNodeReference.java
Log:
EXOJCR-246: TestNodeReference fixed
Modified: jcr/branches/1.12.0-JBC/component/core/src/test/java/org/exoplatform/services/jcr/api/writing/TestNodeReference.java
===================================================================
--- jcr/branches/1.12.0-JBC/component/core/src/test/java/org/exoplatform/services/jcr/api/writing/TestNodeReference.java 2009-11-25 09:00:49 UTC (rev 850)
+++ jcr/branches/1.12.0-JBC/component/core/src/test/java/org/exoplatform/services/jcr/api/writing/TestNodeReference.java 2009-11-25 09:14:54 UTC (rev 851)
@@ -243,7 +243,7 @@
log.debug(testNode1.getPath() + " ref >>> " + p.getPath());
}
- assertEquals(5, testNode1.getReferences().getSize());
+ assertEquals(4, testNode1.getReferences().getSize());
refs = testNode2.getReferences();
if (log.isDebugEnabled())
16 years, 7 months
exo-jcr SVN: r850 - in jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc: db and 1 other directory.
by do-not-reply@jboss.org
Author: nzamosenchuk
Date: 2009-11-25 04:00:49 -0500 (Wed, 25 Nov 2009)
New Revision: 850
Modified:
jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/DBConstants.java
jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/JDBCStorageConnection.java
jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/JDBCWorkspaceDataContainer.java
jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/db/MultiDbJDBCConnection.java
jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/db/SingleDbJDBCConnection.java
Log:
EXOJCR-262: Cleanup implemented on JDBCWorkspaceDataContainer startup, using method deleteLockProperties() from JDBCStorageConnection.
Modified: jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/DBConstants.java
===================================================================
--- jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/DBConstants.java 2009-11-24 16:50:33 UTC (rev 849)
+++ jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/DBConstants.java 2009-11-25 09:00:49 UTC (rev 850)
@@ -218,6 +218,16 @@
protected String DELETE_REF;
/**
+ * Sweep Lock-property's value(jcr:LockIsDeep, jcr:LockOwner)
+ */
+ protected String DELETE_LOCK_VALUES;
+
+ /**
+ * Sweep Lock-properties (jcr:LockIsDeep, jcr:LockOwner)
+ */
+ protected String DELETE_LOCK_PROPERTIES;
+
+ /**
* FIND_REFERENCE
*/
protected String FIND_REFERENCE;
Modified: jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/JDBCStorageConnection.java
===================================================================
--- jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/JDBCStorageConnection.java 2009-11-24 16:50:33 UTC (rev 849)
+++ jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/JDBCStorageConnection.java 2009-11-25 09:00:49 UTC (rev 850)
@@ -2413,5 +2413,7 @@
protected abstract ResultSet findAllNodeIdentifiers() throws SQLException;
protected abstract ResultSet findAllReferencedNodeIdentifiers() throws SQLException;
+
+ protected abstract void deleteLockProperties() throws SQLException;
}
Modified: jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/JDBCWorkspaceDataContainer.java
===================================================================
--- jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/JDBCWorkspaceDataContainer.java 2009-11-24 16:50:33 UTC (rev 849)
+++ jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/JDBCWorkspaceDataContainer.java 2009-11-25 09:00:49 UTC (rev 850)
@@ -46,6 +46,7 @@
import java.io.File;
import java.io.IOException;
import java.sql.Connection;
+import java.sql.SQLException;
import javax.jcr.RepositoryException;
import javax.naming.InitialContext;
@@ -295,6 +296,8 @@
LOG.debug("update-storage parameter is not set " + dbSourceName);
}
+ deleteLockProperties();
+
this.storageVersion =
StorageUpdateManager.checkVersion(dbSourceName, this.connFactory.getJdbcConnection(), multiDb,
enableStorageUpdate);
@@ -303,6 +306,30 @@
}
/**
+ * Removes all the properties in repository: "jcr:lockOwner" & "jcr:lockIsDeep"
+ *
+ * @throws RepositoryException
+ * @throws IllegalStateException
+ */
+ protected void deleteLockProperties() throws RepositoryException
+ {
+ // try to sweep lock properties
+ JDBCStorageConnection connection = (JDBCStorageConnection)this.connFactory.openConnection();
+ try
+ {
+ if (LOG.isDebugEnabled())
+ LOG.debug("Sweeping old lock's properties on " + dbSourceName);
+ (connection).deleteLockProperties();
+ connection.commit();
+ }
+ catch (SQLException e)
+ {
+ connection.rollback();
+ LOG.error("Unable to remove lock properties. Rollback...", e);
+ }
+ }
+
+ /**
* Prepare sefault connection factory.
*
* @return GenericConnectionFactory
Modified: jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/db/MultiDbJDBCConnection.java
===================================================================
--- jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/db/MultiDbJDBCConnection.java 2009-11-24 16:50:33 UTC (rev 849)
+++ jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/db/MultiDbJDBCConnection.java 2009-11-25 09:00:49 UTC (rev 850)
@@ -122,6 +122,10 @@
protected PreparedStatement deleteValue;
+ protected PreparedStatement deleteLockValues;
+
+ protected PreparedStatement deleteLockProperties;
+
protected PreparedStatement renameNode;
protected PreparedStatement findReference;
@@ -246,6 +250,9 @@
DELETE_VALUE = "delete from JCR_MVALUE where PROPERTY_ID=?";
DELETE_REF = "delete from JCR_MREF where PROPERTY_ID=?";
+ DELETE_LOCK_VALUES =
+ "delete from JCR_MVALUE where PROPERTY_ID in (select ID from JCR_MITEM where (NAME=? or NAME=?) and I_CLASS=2)";
+ DELETE_LOCK_PROPERTIES = "delete from JCR_MITEM where (NAME=? or NAME=?) and I_CLASS=2";
}
/**
@@ -745,4 +752,31 @@
return result;
}
+
+ /**
+ * @see org.exoplatform.services.jcr.impl.storage.jdbc.JDBCStorageConnection#deleteLockProperties()
+ */
+ @Override
+ protected void deleteLockProperties() throws SQLException
+ {
+ // delete property values first
+ if (deleteLockValues == null)
+ {
+ deleteLockValues = dbConnection.prepareStatement(DELETE_LOCK_VALUES);
+ deleteLockValues.setString(1, "[" + Constants.NS_JCR_URI + "]" + Constants.JCR_LOCKISDEEP.getName());
+ deleteLockValues.setString(2, "[" + Constants.NS_JCR_URI + "]" + Constants.JCR_LOCKOWNER.getName());
+ }
+
+ deleteLockValues.executeUpdate();
+
+ // delete actuall properties
+ if (deleteLockProperties == null)
+ {
+ deleteLockProperties = dbConnection.prepareStatement(DELETE_LOCK_PROPERTIES);
+ deleteLockProperties.setString(1, "[" + Constants.NS_JCR_URI + "]" + Constants.JCR_LOCKISDEEP.getName());
+ deleteLockProperties.setString(2, "[" + Constants.NS_JCR_URI + "]" + Constants.JCR_LOCKOWNER.getName());
+ }
+
+ deleteLockProperties.executeUpdate();
+ }
}
Modified: jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/db/SingleDbJDBCConnection.java
===================================================================
--- jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/db/SingleDbJDBCConnection.java 2009-11-24 16:50:33 UTC (rev 849)
+++ jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/db/SingleDbJDBCConnection.java 2009-11-25 09:00:49 UTC (rev 850)
@@ -121,6 +121,10 @@
protected PreparedStatement deleteValue;
+ protected PreparedStatement deleteLockValues;
+
+ protected PreparedStatement deleteLockProperties;
+
protected PreparedStatement renameNode;
protected PreparedStatement findReference;
@@ -257,6 +261,10 @@
DELETE_ITEM = "delete from JCR_SITEM where ID=?";
DELETE_VALUE = "delete from JCR_SVALUE where PROPERTY_ID=?";
DELETE_REF = "delete from JCR_SREF where PROPERTY_ID=?";
+
+ DELETE_LOCK_VALUES =
+ "delete from JCR_SVALUE where PROPERTY_ID in (select ID from JCR_SITEM where (NAME=? or NAME=?) and I_CLASS=2)";
+ DELETE_LOCK_PROPERTIES = "delete from JCR_SITEM where (NAME=? or NAME=?) and I_CLASS=2";
}
/**
@@ -761,4 +769,31 @@
return result;
}
+
+ /**
+ * @see org.exoplatform.services.jcr.impl.storage.jdbc.JDBCStorageConnection#deleteLockProperties()
+ */
+ @Override
+ protected void deleteLockProperties() throws SQLException
+ {
+ // delete property values first
+ if (deleteLockValues == null)
+ {
+ deleteLockValues = dbConnection.prepareStatement(DELETE_LOCK_VALUES);
+ deleteLockValues.setString(1, "[" + Constants.NS_JCR_URI + "]" + Constants.JCR_LOCKISDEEP.getName());
+ deleteLockValues.setString(2, "[" + Constants.NS_JCR_URI + "]" + Constants.JCR_LOCKOWNER.getName());
+ }
+
+ deleteLockValues.executeUpdate();
+
+ // delete actuall properties
+ if (deleteLockProperties == null)
+ {
+ deleteLockProperties = dbConnection.prepareStatement(DELETE_LOCK_PROPERTIES);
+ deleteLockProperties.setString(1, "[" + Constants.NS_JCR_URI + "]" + Constants.JCR_LOCKISDEEP.getName());
+ deleteLockProperties.setString(2, "[" + Constants.NS_JCR_URI + "]" + Constants.JCR_LOCKOWNER.getName());
+ }
+
+ deleteLockProperties.executeUpdate();
+ }
}
16 years, 7 months
exo-jcr SVN: r849 - in jcr/trunk/applications: java/exo.jcr.applications.backupconsole/bin and 1 other directory.
by do-not-reply@jboss.org
Author: dkatayev
Date: 2009-11-24 11:50:33 -0500 (Tue, 24 Nov 2009)
New Revision: 849
Modified:
jcr/trunk/applications/java/exo.jcr.applications.backupconsole/bin/jcrbackup.cmd
jcr/trunk/applications/java/exo.jcr.applications.backupconsole/bin/jcrbackup.sh
jcr/trunk/applications/product-exo-jcr-as-jboss-ear.xml
jcr/trunk/applications/product-exo-jcr-as-jonas-ear.xml
jcr/trunk/applications/product-exo-jcr-as-tomcat6.xml
Log:
EXOJCR-260 assemblies and scripts updated
Modified: jcr/trunk/applications/java/exo.jcr.applications.backupconsole/bin/jcrbackup.cmd
===================================================================
--- jcr/trunk/applications/java/exo.jcr.applications.backupconsole/bin/jcrbackup.cmd 2009-11-24 16:46:27 UTC (rev 848)
+++ jcr/trunk/applications/java/exo.jcr.applications.backupconsole/bin/jcrbackup.cmd 2009-11-24 16:50:33 UTC (rev 849)
@@ -1 +1 @@
-java -jar exo.jcr.applications.backupconsole-1.12.0-Beta04-SNAPSHOT.jar %*
+java -jar exo.jcr.applications.backupconsole-1.12.0-Beta05-SNAPSHOT.jar %*
Modified: jcr/trunk/applications/java/exo.jcr.applications.backupconsole/bin/jcrbackup.sh
===================================================================
--- jcr/trunk/applications/java/exo.jcr.applications.backupconsole/bin/jcrbackup.sh 2009-11-24 16:46:27 UTC (rev 848)
+++ jcr/trunk/applications/java/exo.jcr.applications.backupconsole/bin/jcrbackup.sh 2009-11-24 16:50:33 UTC (rev 849)
@@ -1,3 +1,3 @@
#!/bin/sh
-java -jar exo.jcr.applications.backupconsole-1.12.0-Beta04-SNAPSHOT.jar $*
+java -jar exo.jcr.applications.backupconsole-1.12.0-Beta05-SNAPSHOT.jar $*
Modified: jcr/trunk/applications/product-exo-jcr-as-jboss-ear.xml
===================================================================
--- jcr/trunk/applications/product-exo-jcr-as-jboss-ear.xml 2009-11-24 16:46:27 UTC (rev 848)
+++ jcr/trunk/applications/product-exo-jcr-as-jboss-ear.xml 2009-11-24 16:50:33 UTC (rev 849)
@@ -22,7 +22,7 @@
<parent>
<groupId>org.exoplatform.jcr</groupId>
<artifactId>exo.jcr.applications.config</artifactId>
- <version>1.12.0-Beta04-SNAPSHOT</version>
+ <version>1.12.0-Beta05-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
@@ -36,7 +36,7 @@
<dependency>
<groupId>org.exoplatform.jcr</groupId>
<artifactId>exo.jcr.ear</artifactId>
- <version>1.12.0-Beta04-SNAPSHOT</version>
+ <version>1.12.0-Beta05-SNAPSHOT</version>
<type>ear</type>
<scope>runtime</scope>
</dependency>
Modified: jcr/trunk/applications/product-exo-jcr-as-jonas-ear.xml
===================================================================
--- jcr/trunk/applications/product-exo-jcr-as-jonas-ear.xml 2009-11-24 16:46:27 UTC (rev 848)
+++ jcr/trunk/applications/product-exo-jcr-as-jonas-ear.xml 2009-11-24 16:50:33 UTC (rev 849)
@@ -22,7 +22,7 @@
<parent>
<groupId>org.exoplatform.jcr</groupId>
<artifactId>exo.jcr.applications.config</artifactId>
- <version>1.12.0-Beta04-SNAPSHOT</version>
+ <version>1.12.0-Beta05-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
@@ -36,7 +36,7 @@
<dependency>
<groupId>org.exoplatform.jcr</groupId>
<artifactId>exo.jcr.ear</artifactId>
- <version>1.12.0-Beta04-SNAPSHOT</version>
+ <version>1.12.0-Beta05-SNAPSHOT</version>
<type>ear</type>
<scope>runtime</scope>
</dependency>
Modified: jcr/trunk/applications/product-exo-jcr-as-tomcat6.xml
===================================================================
--- jcr/trunk/applications/product-exo-jcr-as-tomcat6.xml 2009-11-24 16:46:27 UTC (rev 848)
+++ jcr/trunk/applications/product-exo-jcr-as-tomcat6.xml 2009-11-24 16:50:33 UTC (rev 849)
@@ -22,7 +22,7 @@
<parent>
<groupId>org.exoplatform.jcr</groupId>
<artifactId>exo.jcr.applications.config</artifactId>
- <version>1.12.0-Beta04-SNAPSHOT</version>
+ <version>1.12.0-Beta05-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
16 years, 7 months