exo-jcr SVN: r4638 - jcr/trunk/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/backup/impl.
by do-not-reply@jboss.org
Author: tolusha
Date: 2011-07-15 08:22:58 -0400 (Fri, 15 Jul 2011)
New Revision: 4638
Modified:
jcr/trunk/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/backup/impl/BackupManagerImpl.java
Log:
EXOJCR-1434: FileCleaner in BackupManagerImpl should be used from proper RepositoryContainer
Modified: jcr/trunk/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/backup/impl/BackupManagerImpl.java
===================================================================
--- jcr/trunk/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/backup/impl/BackupManagerImpl.java 2011-07-15 12:06:27 UTC (rev 4637)
+++ jcr/trunk/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/backup/impl/BackupManagerImpl.java 2011-07-15 12:22:58 UTC (rev 4638)
@@ -198,7 +198,6 @@
private final RegistryService registryService;
- private FileCleaner fileCleaner;
private BackupScheduler scheduler;
@@ -846,21 +845,7 @@
*/
public void start()
{
- // get FileCleaner from container's component FileCleanerHolder
- try
- {
- ManageableRepository repository = repoService.getCurrentRepository();
- String workspaceName = repository.getConfiguration().getSystemWorkspaceName();
- this.fileCleaner =
- ((FileCleanerHolder)repository.getWorkspaceContainer(workspaceName).getComponent(FileCleanerHolder.class))
- .getFileCleaner();
- }
- catch (RepositoryException e)
- {
- // do nothing. should not happens
- }
-
//remove if exists all old jcrrestorewi*.tmp files.
File[] files = PrivilegedFileHelper.listFiles(tempDir, new JcrRestoreWiFilter());
for (int i = 0; i < files.length; i++)
@@ -1008,10 +993,11 @@
throws RepositoryException, RepositoryConfigurationException, BackupOperationException, FileNotFoundException,
IOException, ClassNotFoundException
{
+ WorkspaceContainerFacade workspaceContainer = repoService.getRepository(repositoryName).getWorkspaceContainer(workspaceName);
WorkspacePersistentDataManager dataManager =
- (WorkspacePersistentDataManager)repoService.getRepository(repositoryName).getWorkspaceContainer(workspaceName)
+ (WorkspacePersistentDataManager)workspaceContainer
.getComponent(WorkspacePersistentDataManager.class);
-
+ FileCleaner fileCleaner = ((FileCleanerHolder)workspaceContainer.getComponent(FileCleanerHolder.class)).getFileCleaner();
JCRRestore restorer = new JCRRestore(dataManager, fileCleaner);
restorer.incrementalRestore(new File(pathBackupFile));
}
14 years, 9 months
exo-jcr SVN: r4637 - jcr/trunk/exo.jcr.component.ext.
by do-not-reply@jboss.org
Author: tolusha
Date: 2011-07-15 08:06:27 -0400 (Fri, 15 Jul 2011)
New Revision: 4637
Modified:
jcr/trunk/exo.jcr.component.ext/pom.xml
Log:
EXOJCR-1443: Review tests in jcr-ext project
Modified: jcr/trunk/exo.jcr.component.ext/pom.xml
===================================================================
--- jcr/trunk/exo.jcr.component.ext/pom.xml 2011-07-15 11:56:25 UTC (rev 4636)
+++ jcr/trunk/exo.jcr.component.ext/pom.xml 2011-07-15 12:06:27 UTC (rev 4637)
@@ -189,7 +189,6 @@
<exclude>**/backup/TestBackupRestart.java</exclude>
<exclude>**/backup/load/TestLoadBackup.java*</exclude>
<exclude>**/replication/**</exclude>
- <exclude>**/LocalStorageMultithreadTest.java</exclude>
<include>**/repository/creation/cluster/**</include>
</excludes>
</configuration>
14 years, 9 months
exo-jcr SVN: r4635 - in jcr/trunk/exo.jcr.component.ext: src/main/java/org/exoplatform/services/jcr/ext/repository and 8 other directories.
by do-not-reply@jboss.org
Author: tolusha
Date: 2011-07-15 07:51:25 -0400 (Fri, 15 Jul 2011)
New Revision: 4635
Added:
jcr/trunk/exo.jcr.component.ext/src/test/java/org/exoplatform/services/jcr/util/TesterRdbmsWorkspaceInitializer.java
Removed:
jcr/trunk/exo.jcr.component.ext/src/test/java/org/exoplatform/services/jcr/ext/DummyAction.java
jcr/trunk/exo.jcr.component.ext/src/test/java/org/exoplatform/services/jcr/ext/access/DenyAccessManager.java
jcr/trunk/exo.jcr.component.ext/src/test/java/org/exoplatform/services/jcr/impl/core/TesterRdbmsWorkspaceInitializer.java
Modified:
jcr/trunk/exo.jcr.component.ext/pom.xml
jcr/trunk/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/repository/RestRepositoryService.java
jcr/trunk/exo.jcr.component.ext/src/test/java/org/exoplatform/services/jcr/ext/access/AccessContextTest.java
jcr/trunk/exo.jcr.component.ext/src/test/java/org/exoplatform/services/jcr/ext/backup/TestRdbmsWorkspaceInitializer.java
jcr/trunk/exo.jcr.component.ext/src/test/java/org/exoplatform/services/jcr/ext/backup/load/TestLoadBackup.java
jcr/trunk/exo.jcr.component.ext/src/test/java/org/exoplatform/services/jcr/ext/repository/RestRepositoryServiceTest.java
jcr/trunk/exo.jcr.component.ext/src/test/java/org/exoplatform/services/jcr/impl/core/SessionDataManagerTestWrapper.java
jcr/trunk/exo.jcr.component.ext/src/test/resources/conf/standalone/test-configuration.xml
Log:
EXOJCR-1443: Review tests in jcr-ext project
Modified: jcr/trunk/exo.jcr.component.ext/pom.xml
===================================================================
--- jcr/trunk/exo.jcr.component.ext/pom.xml 2011-07-15 08:14:35 UTC (rev 4634)
+++ jcr/trunk/exo.jcr.component.ext/pom.xml 2011-07-15 11:51:25 UTC (rev 4635)
@@ -178,20 +178,8 @@
<configuration>
<argLine>${env.MAVEN_OPTS} -Djava.security.manager=org.exoplatform.commons.test.TestSecurityManager -Djava.security.policy=${project.build.directory}/test-classes/test.policy</argLine>
<includes>
- <include>**/actions/*Test.java</include>
- <include>**/metadata/*Test.java</include>
- <include>**/owner/*Test.java</include>
- <include>**/registry/*Test.java</include>
- <include>**/app/*Test.java</include>
- <include>**/resource/*Test.java</include>
- <include>**/groovy/*Test.java</include>
- <include>**/replication/*.java</include>
- <include>**/replication/external/*.java</include>
- <include>**/replication/async/**/*.java</include>
- <include>**/backup/load/TestLoadBackup.java</include>
- <include>**/backup/*.java</include>
- <include>**/backup/server/*.java</include>
- <include>**/repository/creation/*.java</include>
+ <include>org/exoplatform/services/jcr/ext/**/Test*.java</include>
+ <include>org/exoplatform/services/jcr/ext/**/*Test.java</include>
</includes>
<excludes>
<exclude>**/BaseStandaloneTest.java</exclude>
@@ -199,12 +187,10 @@
<exclude>**/backup/BaseRDBMSBackupTest.java</exclude>
<exclude>**/backup/TestBackupScheduler.java</exclude>
<exclude>**/backup/TestBackupRestart.java</exclude>
- <exclude>**/replication/*.java</exclude>
- <exclude>**/replication/external/*.java</exclude>
- <exclude>**/replication/external/BaseTestCaseChecker.java</exclude>
- <exclude>**/access/*.java</exclude>
+ <exclude>**/backup/load/TestLoadBackup.java*</exclude>
+ <exclude>**/replication/**</exclude>
<exclude>**/LocalStorageMultithreadTest.java</exclude>
- <include>**/repository/creation/cluster.java</include>
+ <include>**/repository/creation/cluster/**</include>
</excludes>
</configuration>
</plugin>
Modified: jcr/trunk/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/repository/RestRepositoryService.java
===================================================================
--- jcr/trunk/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/repository/RestRepositoryService.java 2011-07-15 08:14:35 UTC (rev 4634)
+++ jcr/trunk/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/repository/RestRepositoryService.java 2011-07-15 11:51:25 UTC (rev 4635)
@@ -389,9 +389,14 @@
}
}
- repositoryService.removeRepository(repositoryName);
- repositoryService.getConfig().retain(); // save configuration to persistence (file or persister)
- return Response.ok().build();
+ if (repositoryService.canRemoveRepository(repositoryName))
+ {
+ repositoryService.removeRepository(repositoryName);
+ repositoryService.getConfig().retain(); // save configuration to persistence (file or persister)
+ return Response.ok().build();
+ }
+ return Response.status(Status.CONFLICT).entity("Can't remove repository " + repositoryName)
+ .cacheControl(NO_CACHE).build();
}
catch (RepositoryException e)
{
@@ -450,7 +455,7 @@
{
repository.removeWorkspace(workspaceName);
repositoryService.getConfig().retain(); // save configuration to persistence (file or persister)
- return Response.noContent().build();
+ return Response.ok().build();
}
return Response.status(Status.CONFLICT).entity(
"Can't remove workspace " + workspaceName + " in repository " + repositoryName).cacheControl(NO_CACHE)
Deleted: jcr/trunk/exo.jcr.component.ext/src/test/java/org/exoplatform/services/jcr/ext/DummyAction.java
===================================================================
--- jcr/trunk/exo.jcr.component.ext/src/test/java/org/exoplatform/services/jcr/ext/DummyAction.java 2011-07-15 08:14:35 UTC (rev 4634)
+++ jcr/trunk/exo.jcr.component.ext/src/test/java/org/exoplatform/services/jcr/ext/DummyAction.java 2011-07-15 11:51:25 UTC (rev 4635)
@@ -1,40 +0,0 @@
-/*
- * Copyright (C) 2009 eXo Platform SAS.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.exoplatform.services.jcr.ext;
-
-import org.apache.commons.chain.Context;
-import org.exoplatform.services.command.action.Action;
-
-/**
- * Created by The eXo Platform SAS .
- *
- * @author Gennady Azarenkov
- * @version $Id: DummyAction.java 12004 2007-01-17 12:03:57Z geaz $
- */
-
-public class DummyAction implements Action
-{
-
- public boolean execute(Context ctx) throws Exception
- {
- System.out.println("EXECUTE !!! ");
- return false;
- }
-
-}
Modified: jcr/trunk/exo.jcr.component.ext/src/test/java/org/exoplatform/services/jcr/ext/access/AccessContextTest.java
===================================================================
--- jcr/trunk/exo.jcr.component.ext/src/test/java/org/exoplatform/services/jcr/ext/access/AccessContextTest.java 2011-07-15 08:14:35 UTC (rev 4634)
+++ jcr/trunk/exo.jcr.component.ext/src/test/java/org/exoplatform/services/jcr/ext/access/AccessContextTest.java 2011-07-15 11:51:25 UTC (rev 4635)
@@ -18,28 +18,19 @@
*/
package org.exoplatform.services.jcr.ext.access;
-import org.exoplatform.container.xml.InitParams;
-import org.exoplatform.container.xml.ObjectParameter;
import org.exoplatform.services.jcr.ext.BaseStandaloneTest;
import org.exoplatform.services.jcr.impl.core.SessionImpl;
-import org.exoplatform.services.jcr.impl.ext.action.ActionConfiguration;
-import org.exoplatform.services.jcr.impl.ext.action.AddActionsPlugin;
-import org.exoplatform.services.jcr.impl.ext.action.SessionActionCatalog;
-import org.exoplatform.services.jcr.impl.ext.action.AddActionsPlugin.ActionsConfig;
import org.exoplatform.services.log.ExoLogger;
import org.exoplatform.services.log.Log;
import java.util.ArrayList;
-import java.util.List;
import java.util.Random;
-import javax.jcr.AccessDeniedException;
import javax.jcr.Node;
import javax.jcr.NodeIterator;
import javax.jcr.Property;
import javax.jcr.PropertyIterator;
import javax.jcr.RepositoryException;
-import javax.jcr.Value;
/**
* @author <a href="mailto:Sergey.Kabashnyuk@gmail.com">Sergey Kabashnyuk</a>
@@ -54,75 +45,6 @@
private final static int THREAD_COUNT = 300;
- @Override
- public void setUp() throws Exception
- {
-
- super.setUp();
- setContextAction();
- }
-
- private void setContextAction()
- {
- SessionActionCatalog catalog =
- (SessionActionCatalog)container.getComponentInstanceOfType(SessionActionCatalog.class);
- ActionConfiguration ac =
- new ActionConfiguration("org.exoplatform.services.jcr.ext.access.SetAccessControlContextAction",
- "addProperty,changeProperty,removeProperty,read", null, true, null, null);
- List actionsList = new ArrayList();
- ActionsConfig actions = new ActionsConfig();
- actions.setActions(actionsList);
- actionsList.add(ac);
- InitParams params = new InitParams();
- ObjectParameter op = new ObjectParameter();
- op.setObject(actions);
- op.setName("actions");
- params.addParameter(op);
-
- AddActionsPlugin aap = new AddActionsPlugin(params);
- catalog.clear();
- catalog.addPlugin(aap);
- };
-
- public void testSetAccessContext() throws RepositoryException
- {
- setContextAction();
- Node testNode = root.addNode("test");
- session.save();
- testNode.setProperty("p1", 9);
- assertEquals(9, testNode.getProperty("p1").getValue().getLong());
-
- testNode.setProperty("p1", 10);
- session.save();
- testNode.setProperty("p1", (Value)null);
- session.save();
- }
-
- public void testDenyAccessMenager() throws RepositoryException
- {
- Node tNode = root.addNode("testNode");
- tNode.setProperty("deny", "value");
- session.save();
- try
- {
- tNode.getProperty("deny");
- fail("AccessDeniedException scheduled to be");
- }
- catch (AccessDeniedException e)
- {
- // Ok
- }
- SessionImpl sysSession = repository.getSystemSession();
- try
- {
- sysSession.getRootNode().getNode("testNode").getProperty("deny");
- }
- catch (AccessDeniedException e)
- {
- fail("AccessDeniedException ");
- }
- }
-
public void testAccessMenedgerContextMultiThread() throws RepositoryException, InterruptedException
{
Deleted: jcr/trunk/exo.jcr.component.ext/src/test/java/org/exoplatform/services/jcr/ext/access/DenyAccessManager.java
===================================================================
--- jcr/trunk/exo.jcr.component.ext/src/test/java/org/exoplatform/services/jcr/ext/access/DenyAccessManager.java 2011-07-15 08:14:35 UTC (rev 4634)
+++ jcr/trunk/exo.jcr.component.ext/src/test/java/org/exoplatform/services/jcr/ext/access/DenyAccessManager.java 2011-07-15 11:51:25 UTC (rev 4635)
@@ -1,80 +0,0 @@
-/*
- * Copyright (C) 2009 eXo Platform SAS.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.exoplatform.services.jcr.ext.access;
-
-import org.exoplatform.services.jcr.access.AccessControlList;
-import org.exoplatform.services.jcr.access.AccessManager;
-import org.exoplatform.services.jcr.access.SystemIdentity;
-import org.exoplatform.services.jcr.config.RepositoryConfigurationException;
-import org.exoplatform.services.jcr.config.RepositoryEntry;
-import org.exoplatform.services.jcr.config.WorkspaceEntry;
-import org.exoplatform.services.jcr.impl.core.ItemImpl;
-import org.exoplatform.services.jcr.observation.ExtendedEvent;
-import org.exoplatform.services.security.Identity;
-
-import javax.jcr.RepositoryException;
-
-/**
- * @author <a href="mailto:Sergey.Kabashnyuk@gmail.com">Sergey Kabashnyuk</a>
- * @version $Id: DenyAccessManager.java 14111 2008-05-12 15:04:28Z gazarenkov $
- */
-public class DenyAccessManager extends AccessManager
-{
- private String denyName = "";
-
- public DenyAccessManager(RepositoryEntry config, WorkspaceEntry wsConfig) throws RepositoryException,
- RepositoryConfigurationException
- {
- super(config, wsConfig);
- this.denyName = wsConfig.getAccessManager().getParameterValue("name");
-
- if (log.isDebugEnabled())
- log.debug("DenyAccessManager created");
- }
-
- @Override
- public boolean hasPermission(AccessControlList acl, String[] permission, Identity user)
- {
- if (super.hasPermission(acl, permission, user))
- {
- if (user.getUserId().equals("root") || user.getUserId().equals(SystemIdentity.SYSTEM)
- || user.getUserId().equals("admin"))
- return true;
-
- if (context() != null)
- {
- int ivent = ((Integer)context().get("event")).intValue();
- if (ivent == ExtendedEvent.READ)
- {
- ItemImpl curItem = (ItemImpl)context().get("currentItem");
-
- if (curItem != null && curItem.getInternalName().getAsString().indexOf(denyName) > -1)
- {
- if (log.isDebugEnabled())
- log.debug("DenyAccessManager permission deny by rool name='" + denyName + "'");
- return false;
- }
- }
- }
- else
- log.warn("Context = null");
- }
- return false;
- }
-}
Modified: jcr/trunk/exo.jcr.component.ext/src/test/java/org/exoplatform/services/jcr/ext/backup/TestRdbmsWorkspaceInitializer.java
===================================================================
--- jcr/trunk/exo.jcr.component.ext/src/test/java/org/exoplatform/services/jcr/ext/backup/TestRdbmsWorkspaceInitializer.java 2011-07-15 08:14:35 UTC (rev 4634)
+++ jcr/trunk/exo.jcr.component.ext/src/test/java/org/exoplatform/services/jcr/ext/backup/TestRdbmsWorkspaceInitializer.java 2011-07-15 11:51:25 UTC (rev 4635)
@@ -24,11 +24,11 @@
import org.exoplatform.services.jcr.ext.backup.impl.rdbms.FullBackupJob;
import org.exoplatform.services.jcr.ext.backup.impl.rdbms.RdbmsWorkspaceInitializer;
import org.exoplatform.services.jcr.impl.core.SysViewWorkspaceInitializer;
-import org.exoplatform.services.jcr.impl.core.TesterRdbmsWorkspaceInitializer;
import org.exoplatform.services.jcr.impl.core.query.SystemSearchManager;
import org.exoplatform.services.jcr.impl.core.value.ValueFactoryImpl;
import org.exoplatform.services.jcr.impl.util.io.FileCleanerHolder;
import org.exoplatform.services.jcr.util.TesterConfigurationHelper;
+import org.exoplatform.services.jcr.util.TesterRdbmsWorkspaceInitializer;
import java.io.File;
import java.net.URL;
Modified: jcr/trunk/exo.jcr.component.ext/src/test/java/org/exoplatform/services/jcr/ext/backup/load/TestLoadBackup.java
===================================================================
--- jcr/trunk/exo.jcr.component.ext/src/test/java/org/exoplatform/services/jcr/ext/backup/load/TestLoadBackup.java 2011-07-15 08:14:35 UTC (rev 4634)
+++ jcr/trunk/exo.jcr.component.ext/src/test/java/org/exoplatform/services/jcr/ext/backup/load/TestLoadBackup.java 2011-07-15 11:51:25 UTC (rev 4635)
@@ -141,12 +141,9 @@
Thread.sleep(10 * 1000);
- System.out.println(" ============ BACKUP START ============");
-
// backup
File backDir = new File("target/backup/ws1");
backDir.mkdirs();
- BackupChain bch = null;
backupManagerImpl.start();
@@ -156,10 +153,8 @@
config.setBackupType(BACKUP_TYPE);
config.setBackupDir(backDir);
- backupManagerImpl.startBackup(config);
+ BackupChain bch = backupManagerImpl.startBackup(config);
- bch = backupManagerImpl.findBackup(REPOSITORY_NAME_SINGLE_DB, WORKSPACE_NAME);
-
// wait till full backup will be stopped
while (bch.getFullBackupState() != BackupJob.FINISHED)
{
@@ -167,18 +162,11 @@
Thread.sleep(30);
}
- System.out.println(" ============ FULL BACKUP FINISHED ============");
-
if (BACKUP_TYPE == BackupManager.FULL_AND_INCREMENTAL)
{
Thread.sleep(5 * 1000);
}
- // for (Thread thread : threads)
- // {
- // thread.interrupt();
- // }
-
if (BACKUP_TYPE == BackupManager.FULL_AND_INCREMENTAL)
{
Thread.sleep(5 * 1000);
@@ -195,8 +183,6 @@
}
Thread.sleep(10 * 1000);
- System.out.println(" ============ BACKUP FINISHED ============");
-
// restore
WorkspaceEntry ws1back = makeWorkspaceEntry("ws1back", "jdbcjcr_to_repository_restore_singel_db");
@@ -205,8 +191,6 @@
{
BackupChainLog bchLog = new BackupChainLog(backLog);
- System.out.println(" ============ RESTORE START ============");
-
assertNotNull(bchLog.getStartedTime());
assertNotNull(bchLog.getFinishedTime());
@@ -233,8 +217,6 @@
fail("There are no backup files in " + backDir.getAbsolutePath());
}
- System.out.println(" ============ CHECKING INTEGRITY ============");
-
checkIntegrity((NodeImpl)repositoryService.getRepository(REPOSITORY_NAME_SINGLE_DB).login(credentials, "ws1back")
.getRootNode());
}
@@ -276,7 +258,6 @@
// backup
File backDir = new File("target/backup/ws1");
backDir.mkdirs();
- BackupChain bch = null;
backupManagerImpl.start();
@@ -288,12 +269,9 @@
Thread.sleep(5 * 1000);
- System.out.println(" ============ BACKUP START ============");
- backupManagerImpl.startBackup(config);
+ BackupChain bch = backupManagerImpl.startBackup(config);
- bch = backupManagerImpl.findBackup(REPOSITORY_NAME_SINGLE_DB, WORKSPACE_NAME);
-
// wait till full backup will be stopped
while (bch.getFullBackupState() != BackupJob.FINISHED)
{
@@ -310,16 +288,12 @@
fail("Can't get fullBackup chain");
}
- System.out.println(" ============ BACKUP FINISHED ============");
-
// restore
File backLog = new File(bch.getLogFilePath());
if (backLog.exists())
{
BackupChainLog bchLog = new BackupChainLog(backLog);
- System.out.println(" ============ RESTORE START ============");
-
assertNotNull(bchLog.getStartedTime());
assertNotNull(bchLog.getFinishedTime());
@@ -346,8 +320,6 @@
fail("There are no backup files in " + backDir.getAbsolutePath());
}
- System.out.println(" ============ CHECKING INTEGRITY ============");
-
checkIntegrity((NodeImpl)repositoryService.getRepository(REPOSITORY_NAME_SINGLE_DB)
.login(credentials, WORKSPACE_NAME)
.getRootNode());
@@ -380,7 +352,6 @@
// backup
File backDir = new File("target/backup/db7");
backDir.mkdirs();
- RepositoryBackupChain bch = null;
backupManagerImpl.start();
@@ -391,12 +362,8 @@
Thread.sleep(5 * 1000);
- System.out.println(" ============ BACKUP START ============");
+ RepositoryBackupChain bch = backupManagerImpl.startBackup(config);
- backupManagerImpl.startBackup(config);
-
- bch = backupManagerImpl.findRepositoryBackup(REPOSITORY_NAME_SINGLE_DB);
-
// wait till full backup will be stopped
while (bch.getState() != BackupJob.FINISHED)
{
@@ -409,16 +376,12 @@
backupManagerImpl.stopBackup(bch);
}
- System.out.println(" ============ BACKUP FINISHED ============");
-
// restore
File backLog = new File(bch.getLogFilePath());
if (backLog.exists())
{
RepositoryBackupChainLog bchLog = new RepositoryBackupChainLog(backLog);
- System.out.println(" ============ RESTORE START ============");
-
assertNotNull(bchLog.getStartedTime());
assertNotNull(bchLog.getFinishedTime());
@@ -446,8 +409,6 @@
fail("There are no backup files in " + backDir.getAbsolutePath());
}
- System.out.println(" ============ CHECKING INTEGRITY ============");
-
for (String wsName : repositoryService.getRepository(REPOSITORY_NAME_SINGLE_DB).getWorkspaceNames())
{
checkIntegrity((NodeImpl)repositoryService.getRepository(REPOSITORY_NAME_SINGLE_DB).login(credentials, wsName)
@@ -492,7 +453,6 @@
// backup
File backDir = new File("target/backup/ws1");
backDir.mkdirs();
- BackupChain bch = null;
backupManagerImpl.start();
@@ -504,12 +464,8 @@
Thread.sleep(5 * 1000);
- System.out.println(" ============ BACKUP START ============");
+ BackupChain bch = backupManagerImpl.startBackup(config);
- backupManagerImpl.startBackup(config);
-
- bch = backupManagerImpl.findBackup(REPOSITORY_NAME_MULTI_DB, WORKSPACE_NAME);
-
// wait till full backup will be stopped
while (bch.getFullBackupState() != BackupJob.FINISHED)
{
@@ -526,16 +482,12 @@
fail("Can't get fullBackup chain");
}
- System.out.println(" ============ BACKUP FINISHED ============");
-
// restore
File backLog = new File(bch.getLogFilePath());
if (backLog.exists())
{
BackupChainLog bchLog = new BackupChainLog(backLog);
- System.out.println(" ============ RESTORE START ============");
-
assertNotNull(bchLog.getStartedTime());
assertNotNull(bchLog.getFinishedTime());
@@ -562,8 +514,6 @@
fail("There are no backup files in " + backDir.getAbsolutePath());
}
- System.out.println(" ============ CHECKING INTEGRITY ============");
-
checkIntegrity((NodeImpl)repositoryService.getRepository(REPOSITORY_NAME_MULTI_DB)
.login(credentials, WORKSPACE_NAME)
.getRootNode());
Modified: jcr/trunk/exo.jcr.component.ext/src/test/java/org/exoplatform/services/jcr/ext/repository/RestRepositoryServiceTest.java
===================================================================
--- jcr/trunk/exo.jcr.component.ext/src/test/java/org/exoplatform/services/jcr/ext/repository/RestRepositoryServiceTest.java 2011-07-15 08:14:35 UTC (rev 4634)
+++ jcr/trunk/exo.jcr.component.ext/src/test/java/org/exoplatform/services/jcr/ext/repository/RestRepositoryServiceTest.java 2011-07-15 11:51:25 UTC (rev 4635)
@@ -18,29 +18,19 @@
*/
package org.exoplatform.services.jcr.ext.repository;
-import java.io.ByteArrayInputStream;
-import java.io.File;
-import java.io.InputStream;
-import java.net.URI;
-import java.util.ArrayList;
-import java.util.Iterator;
-
-import javax.jcr.NoSuchWorkspaceException;
-import javax.jcr.RepositoryException;
-import javax.jcr.Session;
-import javax.ws.rs.core.MultivaluedMap;
-
import org.exoplatform.services.jcr.config.ContainerEntry;
import org.exoplatform.services.jcr.config.QueryHandlerEntry;
import org.exoplatform.services.jcr.config.RepositoryEntry;
import org.exoplatform.services.jcr.config.SimpleParameterEntry;
import org.exoplatform.services.jcr.config.WorkspaceEntry;
import org.exoplatform.services.jcr.core.CredentialsImpl;
+import org.exoplatform.services.jcr.core.ManageableRepository;
import org.exoplatform.services.jcr.ext.BaseStandaloneTest;
import org.exoplatform.services.jcr.ext.app.SessionProviderService;
import org.exoplatform.services.jcr.ext.app.ThreadLocalSessionProviderService;
import org.exoplatform.services.jcr.ext.backup.ContainerRequestUserRole;
import org.exoplatform.services.jcr.ext.common.SessionProvider;
+import org.exoplatform.services.jcr.util.TesterConfigurationHelper;
import org.exoplatform.services.rest.RequestHandler;
import org.exoplatform.services.rest.impl.ContainerResponse;
import org.exoplatform.services.rest.impl.InputHeadersMap;
@@ -56,6 +46,18 @@
import org.exoplatform.ws.frameworks.json.impl.JsonParserImpl;
import org.exoplatform.ws.frameworks.json.value.JsonValue;
+import java.io.ByteArrayInputStream;
+import java.io.File;
+import java.io.InputStream;
+import java.net.URI;
+import java.util.ArrayList;
+import java.util.Iterator;
+
+import javax.jcr.NoSuchWorkspaceException;
+import javax.jcr.RepositoryException;
+import javax.jcr.Session;
+import javax.ws.rs.core.MultivaluedMap;
+
/**
* Created by The eXo Platform SAS.
*
@@ -69,6 +71,8 @@
{
private String REST_REPOSITORY_SERVICE_PATH = RestRepositoryService.Constants.BASE_URL;
+ protected TesterConfigurationHelper helper = TesterConfigurationHelper.getInstance();
+
private RequestHandler handler;
public void setUp() throws Exception
@@ -337,7 +341,7 @@
cres = new ContainerResponse(responseWriter);
handler.handleRequest(creq, cres);
- assertEquals(204, cres.getStatus());
+ assertEquals(200, cres.getStatus());
try
{
@@ -352,8 +356,10 @@
public void testRemoveRepository() throws Exception
{
- String wsName = "ws";
- String repoName = "db2";
+ ManageableRepository repository = helper.createRepository(container, true, null);
+
+ String wsName = repository.getConfiguration().getSystemWorkspaceName();
+ String repoName = repository.getConfiguration().getName();
Session session =
repositoryService.getRepository(repoName).login(new CredentialsImpl("root", "exo".toCharArray()), wsName);
@@ -363,7 +369,7 @@
MultivaluedMap<String, String> headers = new MultivaluedMapImpl();
ContainerRequestUserRole creq =
- new ContainerRequestUserRole("POST", new URI(REST_REPOSITORY_SERVICE_PATH
+ new ContainerRequestUserRole("GET", new URI(REST_REPOSITORY_SERVICE_PATH
+ RestRepositoryService.Constants.OperationType.REMOVE_REPOSITORY + "/" + repoName + "/false/"),
new URI(""), null, new InputHeadersMap(headers));
@@ -375,7 +381,7 @@
//remove with prepare close sessions
creq =
- new ContainerRequestUserRole("POST", new URI(REST_REPOSITORY_SERVICE_PATH
+ new ContainerRequestUserRole("GET", new URI(REST_REPOSITORY_SERVICE_PATH
+ RestRepositoryService.Constants.OperationType.REMOVE_REPOSITORY + "/" + repoName + "/true/"),
new URI(""), null, new InputHeadersMap(headers));
@@ -383,7 +389,7 @@
cres = new ContainerResponse(responseWriter);
handler.handleRequest(creq, cres);
- assertEquals(204, cres.getStatus());
+ assertEquals(200, cres.getStatus());
try
{
Modified: jcr/trunk/exo.jcr.component.ext/src/test/java/org/exoplatform/services/jcr/impl/core/SessionDataManagerTestWrapper.java
===================================================================
--- jcr/trunk/exo.jcr.component.ext/src/test/java/org/exoplatform/services/jcr/impl/core/SessionDataManagerTestWrapper.java 2011-07-15 08:14:35 UTC (rev 4634)
+++ jcr/trunk/exo.jcr.component.ext/src/test/java/org/exoplatform/services/jcr/impl/core/SessionDataManagerTestWrapper.java 2011-07-15 11:51:25 UTC (rev 4635)
@@ -18,6 +18,7 @@
*/
package org.exoplatform.services.jcr.impl.core;
+import org.exoplatform.services.jcr.impl.core.SessionDataManager;
import org.exoplatform.services.jcr.impl.dataflow.session.SessionChangesLog;
/**
Deleted: jcr/trunk/exo.jcr.component.ext/src/test/java/org/exoplatform/services/jcr/impl/core/TesterRdbmsWorkspaceInitializer.java
===================================================================
--- jcr/trunk/exo.jcr.component.ext/src/test/java/org/exoplatform/services/jcr/impl/core/TesterRdbmsWorkspaceInitializer.java 2011-07-15 08:14:35 UTC (rev 4634)
+++ jcr/trunk/exo.jcr.component.ext/src/test/java/org/exoplatform/services/jcr/impl/core/TesterRdbmsWorkspaceInitializer.java 2011-07-15 11:51:25 UTC (rev 4635)
@@ -1,65 +0,0 @@
-/*
- * Copyright (C) 2009 eXo Platform SAS.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.exoplatform.services.jcr.impl.core;
-
-import org.exoplatform.services.jcr.RepositoryService;
-import org.exoplatform.services.jcr.access.AccessManager;
-import org.exoplatform.services.jcr.config.RepositoryConfigurationException;
-import org.exoplatform.services.jcr.config.RepositoryEntry;
-import org.exoplatform.services.jcr.config.WorkspaceEntry;
-import org.exoplatform.services.jcr.ext.backup.impl.rdbms.RdbmsWorkspaceInitializer;
-import org.exoplatform.services.jcr.impl.core.nodetype.NodeTypeManagerImpl;
-import org.exoplatform.services.jcr.impl.core.value.ValueFactoryImpl;
-import org.exoplatform.services.jcr.impl.dataflow.persistent.CacheableWorkspaceDataManager;
-import org.exoplatform.services.jcr.impl.util.io.FileCleanerHolder;
-
-import javax.jcr.PathNotFoundException;
-import javax.jcr.RepositoryException;
-
-/**
- * Created by The eXo Platform SAS
- *
- * 04.12.2006
- *
- * For testing purpose
- *
- * @author <a href="mailto:peter.nedonosko@exoplatform.com.ua">Peter Nedonosko</a>
- * @version $Id: SessionDataManagerTestWrapper.java 11907 2008-03-13 15:36:21Z ksm $
- */
-public class TesterRdbmsWorkspaceInitializer extends RdbmsWorkspaceInitializer
-{
-
- public TesterRdbmsWorkspaceInitializer(WorkspaceEntry config, RepositoryEntry repConfig,
- CacheableWorkspaceDataManager dataManager, NamespaceRegistryImpl namespaceRegistry,
- LocationFactory locationFactory, NodeTypeManagerImpl nodeTypeManager, ValueFactoryImpl valueFactory,
- AccessManager accessManager, RepositoryService repositoryService, FileCleanerHolder cleanerHolder)
- throws RepositoryConfigurationException,
- PathNotFoundException, RepositoryException
- {
- super(config, repConfig, dataManager, namespaceRegistry, locationFactory, nodeTypeManager, valueFactory,
- accessManager, repositoryService, cleanerHolder);
- }
-
- @Override
- public void fullRdbmsRestore() throws RepositoryException
- {
- super.fullRdbmsRestore();
- }
-
-}
Added: jcr/trunk/exo.jcr.component.ext/src/test/java/org/exoplatform/services/jcr/util/TesterRdbmsWorkspaceInitializer.java
===================================================================
--- jcr/trunk/exo.jcr.component.ext/src/test/java/org/exoplatform/services/jcr/util/TesterRdbmsWorkspaceInitializer.java (rev 0)
+++ jcr/trunk/exo.jcr.component.ext/src/test/java/org/exoplatform/services/jcr/util/TesterRdbmsWorkspaceInitializer.java 2011-07-15 11:51:25 UTC (rev 4635)
@@ -0,0 +1,67 @@
+/*
+ * Copyright (C) 2009 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.exoplatform.services.jcr.util;
+
+import org.exoplatform.services.jcr.RepositoryService;
+import org.exoplatform.services.jcr.access.AccessManager;
+import org.exoplatform.services.jcr.config.RepositoryConfigurationException;
+import org.exoplatform.services.jcr.config.RepositoryEntry;
+import org.exoplatform.services.jcr.config.WorkspaceEntry;
+import org.exoplatform.services.jcr.ext.backup.impl.rdbms.RdbmsWorkspaceInitializer;
+import org.exoplatform.services.jcr.impl.core.LocationFactory;
+import org.exoplatform.services.jcr.impl.core.NamespaceRegistryImpl;
+import org.exoplatform.services.jcr.impl.core.nodetype.NodeTypeManagerImpl;
+import org.exoplatform.services.jcr.impl.core.value.ValueFactoryImpl;
+import org.exoplatform.services.jcr.impl.dataflow.persistent.CacheableWorkspaceDataManager;
+import org.exoplatform.services.jcr.impl.util.io.FileCleanerHolder;
+
+import javax.jcr.PathNotFoundException;
+import javax.jcr.RepositoryException;
+
+/**
+ * Created by The eXo Platform SAS
+ *
+ * 04.12.2006
+ *
+ * For testing purpose
+ *
+ * @author <a href="mailto:peter.nedonosko@exoplatform.com.ua">Peter Nedonosko</a>
+ * @version $Id: SessionDataManagerTestWrapper.java 11907 2008-03-13 15:36:21Z ksm $
+ */
+public class TesterRdbmsWorkspaceInitializer extends RdbmsWorkspaceInitializer
+{
+
+ public TesterRdbmsWorkspaceInitializer(WorkspaceEntry config, RepositoryEntry repConfig,
+ CacheableWorkspaceDataManager dataManager, NamespaceRegistryImpl namespaceRegistry,
+ LocationFactory locationFactory, NodeTypeManagerImpl nodeTypeManager, ValueFactoryImpl valueFactory,
+ AccessManager accessManager, RepositoryService repositoryService, FileCleanerHolder cleanerHolder)
+ throws RepositoryConfigurationException,
+ PathNotFoundException, RepositoryException
+ {
+ super(config, repConfig, dataManager, namespaceRegistry, locationFactory, nodeTypeManager, valueFactory,
+ accessManager, repositoryService, cleanerHolder);
+ }
+
+ @Override
+ public void fullRdbmsRestore() throws RepositoryException
+ {
+ super.fullRdbmsRestore();
+ }
+
+}
Modified: jcr/trunk/exo.jcr.component.ext/src/test/resources/conf/standalone/test-configuration.xml
===================================================================
--- jcr/trunk/exo.jcr.component.ext/src/test/resources/conf/standalone/test-configuration.xml 2011-07-15 08:14:35 UTC (rev 4634)
+++ jcr/trunk/exo.jcr.component.ext/src/test/resources/conf/standalone/test-configuration.xml 2011-07-15 11:51:25 UTC (rev 4635)
@@ -409,33 +409,9 @@
<object type="org.exoplatform.services.jcr.impl.ext.action.AddActionsPlugin$ActionsConfig">
<field name="actions">
<collection type="java.util.ArrayList">
- <!-- an example
<value>
<object type="org.exoplatform.services.jcr.impl.ext.action.ActionConfiguration">
<field name="eventTypes">
- <string>addNode</string>
- </field>
- <field name="path">
- <string>/test</string>
- </field>
- <field name="isDeep">
- <boolean>true</boolean>
- </field>
- <field name="nodeTypes">
- <string>nt:unstructured</string>
- </field>
- <field name="workspace">
- <string>production</string>
- </field>
- <field name="actionClassName">
- <string>org.exoplatform.services.jcr.ext.DummyAction</string>
- </field>
- </object>
- </value>
- -->
- <value>
- <object type="org.exoplatform.services.jcr.impl.ext.action.ActionConfiguration">
- <field name="eventTypes">
<string>addProperty,changeProperty</string>
</field>
<field name="path">
14 years, 9 months
exo-jcr SVN: r4634 - in jcr/branches/1.12.x/patch/1.12.10-GA: JCR-1650 and 1 other directory.
by do-not-reply@jboss.org
Author: tolusha
Date: 2011-07-15 04:14:35 -0400 (Fri, 15 Jul 2011)
New Revision: 4634
Added:
jcr/branches/1.12.x/patch/1.12.10-GA/JCR-1650/
jcr/branches/1.12.x/patch/1.12.10-GA/JCR-1650/JCR-1650.patch
Log:
JCR-1650: patch proposed
Added: jcr/branches/1.12.x/patch/1.12.10-GA/JCR-1650/JCR-1650.patch
===================================================================
--- jcr/branches/1.12.x/patch/1.12.10-GA/JCR-1650/JCR-1650.patch (rev 0)
+++ jcr/branches/1.12.x/patch/1.12.10-GA/JCR-1650/JCR-1650.patch 2011-07-15 08:14:35 UTC (rev 4634)
@@ -0,0 +1,288 @@
+Index: exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/dataflow/persistent/jbosscache/TestJBossCacheWorkspaceStorageCacheInClusterMode.java
+===================================================================
+--- exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/dataflow/persistent/jbosscache/TestJBossCacheWorkspaceStorageCacheInClusterMode.java (revision 4633)
++++ exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/dataflow/persistent/jbosscache/TestJBossCacheWorkspaceStorageCacheInClusterMode.java (working copy)
+@@ -80,7 +80,7 @@
+ transactionService == null ? null : transactionService, new ConfigurationManagerImpl());
+ }
+
+- public void testRaceConditions() throws Exception
++ public void testRaceConditionsNConsistency() throws Exception
+ {
+ JBossCacheWorkspaceStorageCache cache1 = null, cache2 = null;
+ try
+@@ -273,6 +273,106 @@
+ assertEquals(2, cwdmNode1.getItemData(parentNode, qpe, ItemType.PROPERTY).getPersistedVersion());
+ assertNotNull(cwdmNode2.getItemData(parentNode, qpe, ItemType.PROPERTY));
+ assertEquals(2, cwdmNode2.getItemData(parentNode, qpe, ItemType.PROPERTY).getPersistedVersion());
++
++ // testConsistency
++ con = new MyWorkspaceStorageConnection(true);
++ wdc = new MyWorkspaceDataContainer(con);
++ cwdmNode1 = new CacheableWorkspaceDataManager(wdc, cache1, new SystemDataContainerHolder(wdc));
++ cwdmNode2 = new CacheableWorkspaceDataManager(wdc, cache2, new SystemDataContainerHolder(wdc));
++ parentNode =
++ new PersistedNodeData("parent2-id", QPath.makeChildPath(Constants.ROOT_PATH, new InternalQName(null,
++ "parent2-node")), Constants.ROOT_UUID, 1, 0, Constants.NT_UNSTRUCTURED, new InternalQName[0], null);
++
++ // Test getChildNodesData
++ con.setParentNode(parentNode);
++ cwdmNode2.getChildNodesData(parentNode);
++ PlainChangesLog chlog = new PlainChangesLogImpl();
++ chlog.add(ItemState.createAddedState(new PersistedNodeData("id-node" + parentNode.getIdentifier(), QPath
++ .makeChildPath(parentNode.getQPath(), new InternalQName(null, "node")), parentNode.getIdentifier(), 1, 0,
++ Constants.NT_UNSTRUCTURED, new InternalQName[0], null)));
++ cwdmNode1.save(chlog);
++ assertNotNull(cwdmNode1.getChildNodesData(parentNode));
++ assertEquals(2, cwdmNode1.getChildNodesData(parentNode).size());
++ assertNotNull(cwdmNode2.getChildNodesData(parentNode));
++ assertEquals(2, cwdmNode2.getChildNodesData(parentNode).size());
++ parentNode =
++ new PersistedNodeData("parent2-id2", QPath.makeChildPath(Constants.ROOT_PATH, new InternalQName(null,
++ "parent2-node2")), Constants.ROOT_UUID, 1, 0, Constants.NT_UNSTRUCTURED, new InternalQName[0], null);
++ con.setParentNode(parentNode);
++ cwdmNode2.getChildNodesData(parentNode);
++ chlog = new PlainChangesLogImpl();
++ chlog.add(ItemState.createDeletedState(new PersistedNodeData("id-node2" + parentNode.getIdentifier(), QPath
++ .makeChildPath(parentNode.getQPath(), new InternalQName(null, "node2")), parentNode.getIdentifier(), 1, 0,
++ Constants.NT_UNSTRUCTURED, new InternalQName[0], null)));
++ cwdmNode1.save(chlog);
++ assertNotNull(cwdmNode1.getChildNodesData(parentNode));
++ assertEquals(0, cwdmNode1.getChildNodesData(parentNode).size());
++ assertNotNull(cwdmNode2.getChildNodesData(parentNode));
++ assertEquals(0, cwdmNode2.getChildNodesData(parentNode).size());
++
++ // Test getChildPropertiesData
++ parentNode =
++ new PersistedNodeData("parent2-id3", QPath.makeChildPath(Constants.ROOT_PATH, new InternalQName(null,
++ "parent2-node3")), Constants.ROOT_UUID, 1, 0, Constants.NT_UNSTRUCTURED, new InternalQName[0], null);
++ con.setParentNode(parentNode);
++ cwdmNode2.getChildPropertiesData(parentNode);
++ chlog = new PlainChangesLogImpl();
++ chlog.add(ItemState.createAddedState(new PersistedPropertyData("id-property" + parentNode.getIdentifier(),
++ QPath.makeChildPath(parentNode.getQPath(), new InternalQName(null, "property")),
++ parentNode.getIdentifier(), 0, PropertyType.STRING, false, Arrays
++ .asList((ValueData)new ByteArrayPersistedValueData(0, "some data".getBytes("UTF-8"))))));
++ cwdmNode1.save(chlog);
++ assertNotNull(cwdmNode1.getChildPropertiesData(parentNode));
++ assertEquals(2, cwdmNode1.getChildPropertiesData(parentNode).size());
++ assertNotNull(cwdmNode2.getChildPropertiesData(parentNode));
++ assertEquals(2, cwdmNode2.getChildPropertiesData(parentNode).size());
++ parentNode =
++ new PersistedNodeData("parent2-id4", QPath.makeChildPath(Constants.ROOT_PATH, new InternalQName(null,
++ "parent2-node4")), Constants.ROOT_UUID, 1, 0, Constants.NT_UNSTRUCTURED, new InternalQName[0], null);
++ con.setParentNode(parentNode);
++ cwdmNode2.getChildPropertiesData(parentNode);
++ chlog = new PlainChangesLogImpl();
++ chlog.add(ItemState.createDeletedState(new PersistedPropertyData("id-property2" + parentNode.getIdentifier(),
++ QPath.makeChildPath(parentNode.getQPath(), new InternalQName(null, "property2")), parentNode
++ .getIdentifier(), 0, PropertyType.STRING, false, Arrays
++ .asList((ValueData)new ByteArrayPersistedValueData(0, "some data".getBytes("UTF-8"))))));
++ cwdmNode1.save(chlog);
++ assertNotNull(cwdmNode1.getChildPropertiesData(parentNode));
++ assertEquals(0, cwdmNode1.getChildPropertiesData(parentNode).size());
++ assertNotNull(cwdmNode2.getChildPropertiesData(parentNode));
++ assertEquals(0, cwdmNode2.getChildPropertiesData(parentNode).size());
++
++ // Test getReferencesData
++ parentNode =
++ new PersistedNodeData("parent2-id5", QPath.makeChildPath(Constants.ROOT_PATH, new InternalQName(null,
++ "parent2-node5")), Constants.ROOT_UUID, 1, 0, Constants.NT_UNSTRUCTURED, new InternalQName[0], null);
++ con.setParentNode(parentNode);
++ cwdmNode2.getReferencesData(parentNode.getIdentifier(), false);
++ chlog = new PlainChangesLogImpl();
++ chlog.add(ItemState.createAddedState(new PersistedPropertyData("id-reference" + parentNode.getIdentifier(),
++ QPath.makeChildPath(parentNode.getQPath(), new InternalQName(null, "reference")), parentNode
++ .getIdentifier(), 0, PropertyType.REFERENCE, false, Arrays
++ .asList((ValueData)new ByteArrayPersistedValueData(0, parentNode.getIdentifier().getBytes("UTF-8"))))));
++ cwdmNode1.save(chlog);
++ assertNotNull(cwdmNode1.getReferencesData(parentNode.getIdentifier(), false));
++ assertEquals(2, cwdmNode1.getReferencesData(parentNode.getIdentifier(), false).size());
++ assertNotNull(cwdmNode2.getReferencesData(parentNode.getIdentifier(), false));
++ assertEquals(2, cwdmNode2.getReferencesData(parentNode.getIdentifier(), false).size());
++ parentNode =
++ new PersistedNodeData("parent2-id6", QPath.makeChildPath(Constants.ROOT_PATH, new InternalQName(null,
++ "parent2-node6")), Constants.ROOT_UUID, 1, 0, Constants.NT_UNSTRUCTURED, new InternalQName[0], null);
++ con.setParentNode(parentNode);
++ cwdmNode2.getReferencesData(parentNode.getIdentifier(), false);
++ chlog = new PlainChangesLogImpl();
++ chlog.add(ItemState.createDeletedState(new PersistedPropertyData("id-reference2" + parentNode.getIdentifier(),
++ QPath.makeChildPath(parentNode.getQPath(), new InternalQName(null, "reference2")), parentNode
++ .getIdentifier(), 0, PropertyType.REFERENCE, false, Arrays
++ .asList((ValueData)new ByteArrayPersistedValueData(0, parentNode.getIdentifier().getBytes("UTF-8"))))));
++ cwdmNode1.save(chlog);
++ assertNotNull(cwdmNode1.getReferencesData(parentNode.getIdentifier(), false));
++ assertEquals(0, cwdmNode1.getReferencesData(parentNode.getIdentifier(), false).size());
++ assertNotNull(cwdmNode2.getReferencesData(parentNode.getIdentifier(), false));
++ assertEquals(0, cwdmNode2.getReferencesData(parentNode.getIdentifier(), false).size());
+ }
+ finally
+ {
+@@ -336,6 +436,8 @@
+ {
+ if (mode == Mode.WRITE_FIRST) goSignal.countDown();
+ doneSignal.countDown();
++
++ con.wait.remove();
+ }
+ }
+ };
+@@ -360,6 +462,8 @@
+ {
+ if (mode == Mode.READ_FIRST) goSignal.countDown();
+ doneSignal.countDown();
++
++ con.wait.remove();
+ }
+ }
+ };
+@@ -373,22 +477,50 @@
+ {
+
+ protected final CacheableWorkspaceDataManager cwdm;
++
+ public Action(CacheableWorkspaceDataManager cwdm)
+ {
+ this.cwdm = cwdm;
+ }
+ protected abstract void execute(NodeData parentNode) throws Exception;
+ }
++
+ private static enum Mode
+ {
+ READ_FIRST, WRITE_FIRST;
+ }
+- private static class MyWorkspaceStorageConnection implements WorkspaceStorageConnection
++
++ public static class MyWorkspaceStorageConnection implements WorkspaceStorageConnection
+ {
+ public ThreadLocal<Boolean> wait = new ThreadLocal<Boolean>();
++
+ private NodeData parentNode;
++
+ private CountDownLatch goSignal;
+
++ private ItemData itemAdded;
++
++ private boolean canModify;
++
++ private boolean itemDeleted;
++
++ public MyWorkspaceStorageConnection()
++ {
++ }
++
++ public MyWorkspaceStorageConnection(boolean canModify)
++ {
++ this.canModify = canModify;
++ }
++
++ /**
++ * @param canModify the canModify to set
++ */
++ public void setCanModify(boolean canModify)
++ {
++ this.canModify = canModify;
++ }
++
+ public CountDownLatch initCountDownLatch()
+ {
+ return this.goSignal = new CountDownLatch(1);
+@@ -397,16 +529,20 @@
+ public void setParentNode(NodeData parentNode)
+ {
+ this.parentNode = parentNode;
++ this.itemAdded = null;
++ this.itemDeleted = false;
+ }
+
+ public void add(NodeData data) throws RepositoryException, UnsupportedOperationException,
+ InvalidItemStateException, IllegalStateException
+ {
++ this.itemAdded = data;
+ }
+
+ public void add(PropertyData data) throws RepositoryException, UnsupportedOperationException,
+ InvalidItemStateException, IllegalStateException
+ {
++ this.itemAdded = data;
+ }
+
+ public void close() throws IllegalStateException, RepositoryException
+@@ -431,11 +567,13 @@
+ public void delete(NodeData data) throws RepositoryException, UnsupportedOperationException,
+ InvalidItemStateException, IllegalStateException
+ {
++ this.itemDeleted = true;
+ }
+
+ public void delete(PropertyData data) throws RepositoryException, UnsupportedOperationException,
+ InvalidItemStateException, IllegalStateException
+ {
++ this.itemDeleted = true;
+ }
+
+ public int getChildNodesCount(NodeData parent) throws RepositoryException
+@@ -457,8 +595,17 @@
+ }
+ }
+ List<NodeData> children = new ArrayList<NodeData>();
+- children.add(new PersistedNodeData("id-node2" + parentNode.getIdentifier(), QPath.makeChildPath(parent.getQPath(), new InternalQName(null, "node2")), parent.getIdentifier(), 1, 0,
+- Constants.NT_UNSTRUCTURED, new InternalQName[0], null));
++ if (!canModify || !itemDeleted)
++ {
++ children.add(new PersistedNodeData("id-node2" + parentNode.getIdentifier(), QPath.makeChildPath(
++ parent.getQPath(), new InternalQName(null, "node2")), parent.getIdentifier(), 1, 0,
++ Constants.NT_UNSTRUCTURED, new InternalQName[0], null));
++ }
++ if (canModify && itemAdded != null)
++ {
++ children.add((NodeData)itemAdded);
++ }
++
+ return children;
+ }
+
+@@ -479,9 +626,17 @@
+ List<PropertyData> children = new ArrayList<PropertyData>();
+ try
+ {
+- children.add(new PersistedPropertyData("id-property2" + parentNode.getIdentifier(), QPath.makeChildPath(
+- parentNode.getQPath(), new InternalQName(null, "property2")), parentNode.getIdentifier(), 0,
+- PropertyType.STRING, false, Arrays.asList((ValueData)new ByteArrayPersistedValueData(0, "some data".getBytes("UTF-8")))));
++ if (!canModify || !itemDeleted)
++ {
++ children.add(new PersistedPropertyData("id-property2" + parentNode.getIdentifier(), QPath.makeChildPath(
++ parentNode.getQPath(), new InternalQName(null, "property2")), parentNode.getIdentifier(), 0,
++ PropertyType.STRING, false, Arrays.asList((ValueData)new ByteArrayPersistedValueData(0, "some data"
++ .getBytes("UTF-8")))));
++ }
++ if (canModify && itemAdded != null)
++ {
++ children.add((PropertyData)itemAdded);
++ }
+ }
+ catch (UnsupportedEncodingException e)
+ {
+@@ -565,9 +720,18 @@
+ List<PropertyData> children = new ArrayList<PropertyData>();
+ try
+ {
+- children.add(new PersistedPropertyData("id-reference2" + parentNode.getIdentifier(), QPath.makeChildPath(
+- parentNode.getQPath(), new InternalQName(null, "reference2")), parentNode.getIdentifier(), 0,
+- PropertyType.REFERENCE, false, Arrays.asList((ValueData)new ByteArrayPersistedValueData(0, parentNode.getIdentifier().getBytes("UTF-8")))));
++ if (!canModify || !itemDeleted)
++ {
++ children
++ .add(new PersistedPropertyData("id-reference2" + parentNode.getIdentifier(), QPath.makeChildPath(
++ parentNode.getQPath(), new InternalQName(null, "reference2")), parentNode.getIdentifier(), 0,
++ PropertyType.REFERENCE, false, Arrays.asList((ValueData)new ByteArrayPersistedValueData(0,
++ parentNode.getIdentifier().getBytes("UTF-8")))));
++ }
++ if (canModify && itemAdded != null)
++ {
++ children.add((PropertyData)itemAdded);
++ }
+ }
+ catch (UnsupportedEncodingException e)
+ {
14 years, 9 months
exo-jcr SVN: r4633 - in jcr/trunk/exo.jcr.component.core/src: main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/infinispan and 3 other directories.
by do-not-reply@jboss.org
Author: tolusha
Date: 2011-07-15 03:11:30 -0400 (Fri, 15 Jul 2011)
New Revision: 4633
Modified:
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/itemfilters/PatternQPathEntryFilter.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/infinispan/BufferedISPNCache.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/jbosscache/BufferedJBossCache.java
jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/dataflow/persistent/TestWorkspaceStorageCacheInClusterMode.java
jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/dataflow/persistent/infinispan/TestISPNCacheWorkspaceStorageCacheInClusterMode.java
Log:
EXOJCR-1414: Lists stored into the cache can be inconsistent in cluster environment
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/itemfilters/PatternQPathEntryFilter.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/itemfilters/PatternQPathEntryFilter.java 2011-07-14 11:25:59 UTC (rev 4632)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/itemfilters/PatternQPathEntryFilter.java 2011-07-15 07:11:30 UTC (rev 4633)
@@ -57,7 +57,6 @@
/**
* {@inheritDoc}
*/
- @Override
public boolean isExactName()
{
return false;
@@ -66,7 +65,6 @@
/**
* {@inheritDoc}
*/
- @Override
public QPathEntry getQPathEntry()
{
return entry;
@@ -75,7 +73,6 @@
/**
* {@inheritDoc}
*/
- @Override
public boolean accept(ItemData item)
{
if (localNameHasWildcard && localNamePattern == null)
@@ -108,7 +105,6 @@
/**
* {@inheritDoc}
*/
- @Override
public List<? extends ItemData> accept(List<? extends ItemData> itemData)
{
@@ -189,7 +185,6 @@
return entry.hashCode();
}
- @Override
public void writeExternal(ObjectOutput out) throws IOException
{
byte[] buf = entry.getNamespace().getBytes(Constants.DEFAULT_ENCODING);
@@ -206,7 +201,6 @@
/**
* {@inheritDoc}
*/
- @Override
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
{
byte[] buf = new byte[in.readInt()];
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/infinispan/BufferedISPNCache.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/infinispan/BufferedISPNCache.java 2011-07-14 11:25:59 UTC (rev 4632)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/infinispan/BufferedISPNCache.java 2011-07-15 07:11:30 UTC (rev 4633)
@@ -264,6 +264,13 @@
LOG.error("Unexpected object found by key " + key.toString() + ". Expected Set, but found:"
+ existingObject.getClass().getName());
}
+ else if (!localMode && cache.getConfiguration().getCacheMode() != CacheMode.LOCAL)
+ {
+ // to prevent consistency issue since we don't have the list in the local cache, we are in cluster env
+ // and we are in a non local mode, we clear the list in order to enforce other cluster nodes to reload it from the db
+ cache.remove(key);
+ return;
+ }
}
@Override
@@ -321,6 +328,12 @@
LOG.error("Unexpected object found by key " + key.toString() + ". Expected Map, but found:"
+ existingObject.getClass().getName());
}
+ else if (!localMode && cache.getConfiguration().getCacheMode() != CacheMode.LOCAL)
+ {
+ // to prevent consistency issue since we don't have the list in the local cache, we are in cluster env
+ // and we are in a non local mode, we remove all the patterns in order to enforce other cluster nodes to reload them from the db
+ cache.remove(key);
+ }
}
@Override
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/jbosscache/BufferedJBossCache.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/jbosscache/BufferedJBossCache.java 2011-07-14 11:25:59 UTC (rev 4632)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/jbosscache/BufferedJBossCache.java 2011-07-15 07:11:30 UTC (rev 4633)
@@ -18,9 +18,9 @@
*/
package org.exoplatform.services.jcr.impl.dataflow.persistent.jbosscache;
+import org.exoplatform.commons.utils.SecurityHelper;
import org.exoplatform.services.jcr.datamodel.ItemData;
import org.exoplatform.services.jcr.impl.core.itemfilters.QPathEntryFilter;
-import org.exoplatform.commons.utils.SecurityHelper;
import org.exoplatform.services.log.ExoLogger;
import org.exoplatform.services.log.Log;
import org.jboss.cache.Cache;
@@ -33,6 +33,7 @@
import org.jboss.cache.NodeNotExistsException;
import org.jboss.cache.Region;
import org.jboss.cache.config.Configuration;
+import org.jboss.cache.config.Configuration.CacheMode;
import org.jboss.cache.eviction.ExpirationAlgorithmConfig;
import org.jboss.cache.interceptors.base.CommandInterceptor;
import org.jgroups.Address;
@@ -1052,6 +1053,12 @@
LOG.error("Unexpected object found by FQN:" + getFqn() + " and key:" + key + ". Expected Set, but found:"
+ existingObject.getClass().getName());
}
+ else if (!localMode && cache.getConfiguration().getCacheMode() != CacheMode.LOCAL)
+ {
+ // to prevent consistency issue since we don't have the list in the local cache, we are in cluster env
+ // and we are in a non local mode, we clear the list in order to enforce other cluster nodes to reload it from the db
+ cache.put(fqn, key, null);
+ }
}
@Override
@@ -1084,6 +1091,13 @@
@Override
public void apply()
{
+ if (!localMode && cache.getConfiguration().getCacheMode() != CacheMode.LOCAL)
+ {
+ // to prevent consistency issue since we don't have the list in the local cache, we are in cluster env
+ // and we are in a non local mode, we remove all the patterns in order to enforce other cluster nodes to reload them from the db
+ cache.removeNode(fqn);
+ return;
+ }
// force writeLock on next read
cache.getInvocationContext().getOptionOverrides().setForceWriteLock(true);
@@ -1092,6 +1106,7 @@
{
Object name = patternNames.next();
Fqn<Object> patternFqn = Fqn.fromRelativeElements(fqn, name);
+ cache.getInvocationContext().getOptionOverrides().setForceWriteLock(true);
Object patternObject = cache.get(patternFqn, patternKey);
if (!(patternObject instanceof QPathEntryFilter))
{
@@ -1102,6 +1117,7 @@
QPathEntryFilter nameFilter = (QPathEntryFilter)patternObject;
if (nameFilter.accept((ItemData)value))
{
+ cache.getInvocationContext().getOptionOverrides().setForceWriteLock(true);
Object setObject = cache.get(patternFqn, listKey);
if (!(setObject instanceof Set))
{
@@ -1203,6 +1219,7 @@
while (patternNames.hasNext())
{
Fqn<Object> patternFqn = Fqn.fromRelativeElements(fqn, patternNames.next());
+ cache.getInvocationContext().getOptionOverrides().setForceWriteLock(true);
Object patternObject = cache.get(patternFqn, patternKey);
if (!(patternObject instanceof QPathEntryFilter))
{
@@ -1213,6 +1230,7 @@
QPathEntryFilter nameFilter = (QPathEntryFilter)patternObject;
if (nameFilter.accept((ItemData)value))
{
+ cache.getInvocationContext().getOptionOverrides().setForceWriteLock(true);
Object setObject = cache.get(patternFqn, listKey);
if (!(setObject instanceof Set))
{
Modified: jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/dataflow/persistent/TestWorkspaceStorageCacheInClusterMode.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/dataflow/persistent/TestWorkspaceStorageCacheInClusterMode.java 2011-07-14 11:25:59 UTC (rev 4632)
+++ jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/dataflow/persistent/TestWorkspaceStorageCacheInClusterMode.java 2011-07-15 07:11:30 UTC (rev 4633)
@@ -18,6 +18,7 @@
*/
package org.exoplatform.services.jcr.impl.dataflow.persistent;
+import org.exoplatform.commons.utils.QName;
import org.exoplatform.services.jcr.JcrImplBaseTest;
import org.exoplatform.services.jcr.dataflow.ItemState;
import org.exoplatform.services.jcr.dataflow.PlainChangesLog;
@@ -34,6 +35,8 @@
import org.exoplatform.services.jcr.datamodel.QPathEntry;
import org.exoplatform.services.jcr.datamodel.ValueData;
import org.exoplatform.services.jcr.impl.Constants;
+import org.exoplatform.services.jcr.impl.core.itemfilters.PatternQPathEntry;
+import org.exoplatform.services.jcr.impl.core.itemfilters.PatternQPathEntryFilter;
import org.exoplatform.services.jcr.impl.core.itemfilters.QPathEntryFilter;
import org.exoplatform.services.jcr.impl.storage.SystemDataContainerHolder;
import org.exoplatform.services.jcr.impl.storage.WorkspaceDataContainerBase;
@@ -43,6 +46,7 @@
import java.io.UnsupportedEncodingException;
import java.util.ArrayList;
import java.util.Arrays;
+import java.util.Collections;
import java.util.List;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.atomic.AtomicReference;
@@ -60,7 +64,7 @@
{
public abstract T getCacheImpl() throws Exception;
- public void testRaceConditions() throws Exception
+ public void testRaceConditionsNConsistency() throws Exception
{
T cache1 = null, cache2 = null;
try
@@ -85,11 +89,11 @@
{
public void execute(NodeData parentNode) throws Exception
{
- PlainChangesLog chlog = new PlainChangesLogImpl();
+ PlainChangesLog chlog = new PlainChangesLogImpl();
cwdm.getChildNodesData(parentNode);
chlog.add(ItemState.createAddedState(new PersistedNodeData("id-node" + parentNode.getIdentifier(), QPath.makeChildPath(parentNode.getQPath(), new InternalQName(null, "node")), parentNode.getIdentifier(), 1, 0,
Constants.NT_UNSTRUCTURED, new InternalQName[0], null)));
- cwdm.save(chlog);
+ cwdm.save(chlog);
}
};
executeConcurrentReadNWrite(con, readAction, writeAction, Mode.READ_FIRST, parentNode);
@@ -116,16 +120,16 @@
{
public void execute(NodeData parentNode) throws Exception
{
- PlainChangesLog chlog = new PlainChangesLogImpl();
+ PlainChangesLog chlog = new PlainChangesLogImpl();
cwdm.getChildPropertiesData(parentNode);
chlog.add(ItemState.createAddedState(new PersistedPropertyData("id-property" + parentNode.getIdentifier(), QPath.makeChildPath(
parentNode.getQPath(), new InternalQName(null, "property")), parentNode.getIdentifier(), 0,
PropertyType.STRING, false, Arrays.asList((ValueData)new ByteArrayPersistedValueData(0, "some data".getBytes("UTF-8"))))));
cwdm.save(chlog);
}
- };
+ };
parentNode = new PersistedNodeData("parent-id3", QPath.makeChildPath(Constants.ROOT_PATH, new InternalQName(null, "parent-node3")), Constants.ROOT_UUID, 1, 0,
- Constants.NT_UNSTRUCTURED, new InternalQName[0], null);
+ Constants.NT_UNSTRUCTURED, new InternalQName[0], null);
executeConcurrentReadNWrite(con, readAction, writeAction, Mode.READ_FIRST, parentNode);
assertNotNull(cwdmNode1.getChildPropertiesData(parentNode));
assertEquals(2, cwdmNode1.getChildPropertiesData(parentNode).size());
@@ -150,16 +154,16 @@
{
public void execute(NodeData parentNode) throws Exception
{
- PlainChangesLog chlog = new PlainChangesLogImpl();
+ PlainChangesLog chlog = new PlainChangesLogImpl();
cwdm.getReferencesData(parentNode.getIdentifier(), false);
chlog.add(ItemState.createAddedState(new PersistedPropertyData("id-reference" + parentNode.getIdentifier(), QPath.makeChildPath(
parentNode.getQPath(), new InternalQName(null, "reference")), parentNode.getIdentifier(), 0,
PropertyType.REFERENCE, false, Arrays.asList((ValueData)new ByteArrayPersistedValueData(0, parentNode.getIdentifier().getBytes("UTF-8"))))));
cwdm.save(chlog);
}
- };
+ };
parentNode = new PersistedNodeData("parent-id5", QPath.makeChildPath(Constants.ROOT_PATH, new InternalQName(null, "parent-node5")), Constants.ROOT_UUID, 1, 0,
- Constants.NT_UNSTRUCTURED, new InternalQName[0], null);
+ Constants.NT_UNSTRUCTURED, new InternalQName[0], null);
executeConcurrentReadNWrite(con, readAction, writeAction, Mode.READ_FIRST, parentNode);
assertNotNull(cwdmNode1.getReferencesData(parentNode.getIdentifier(), false));
assertEquals(2, cwdmNode1.getReferencesData(parentNode.getIdentifier(), false).size());
@@ -191,9 +195,9 @@
Constants.NT_UNSTRUCTURED, new InternalQName[0], null)));
cwdm.save(chlog);
}
- };
+ };
parentNode = new PersistedNodeData("parent-id7", QPath.makeChildPath(Constants.ROOT_PATH, new InternalQName(null, "parent-node7")), Constants.ROOT_UUID, 1, 0,
- Constants.NT_UNSTRUCTURED, new InternalQName[0], null);
+ Constants.NT_UNSTRUCTURED, new InternalQName[0], null);
executeConcurrentReadNWrite(con, readAction, writeAction, Mode.READ_FIRST, parentNode);
assertNotNull(cwdmNode1.getItemData(parentNode.getIdentifier()));
assertEquals(2, cwdmNode1.getItemData(parentNode.getIdentifier()).getPersistedVersion());
@@ -206,7 +210,7 @@
assertEquals(2, cwdmNode1.getItemData(parentNode.getIdentifier()).getPersistedVersion());
assertNotNull(cwdmNode2.getItemData(parentNode.getIdentifier()));
assertEquals(2, cwdmNode2.getItemData(parentNode.getIdentifier()).getPersistedVersion());
-
+
// Test getItemData by Path
final QPathEntry qpe = new QPathEntry(null, "my-property", 1);
readAction = new Action(cwdmNode2)
@@ -228,9 +232,9 @@
.asList((ValueData)new ByteArrayPersistedValueData(0, "some new data".getBytes("UTF-8"))))));
cwdm.save(chlog);
}
- };
+ };
parentNode = new PersistedNodeData("parent-id9", QPath.makeChildPath(Constants.ROOT_PATH, new InternalQName(null, "parent-node9")), Constants.ROOT_UUID, 1, 0,
- Constants.NT_UNSTRUCTURED, new InternalQName[0], null);
+ Constants.NT_UNSTRUCTURED, new InternalQName[0], null);
executeConcurrentReadNWrite(con, readAction, writeAction, Mode.READ_FIRST, parentNode);
assertNotNull(cwdmNode1.getItemData(parentNode, qpe, ItemType.PROPERTY));
assertEquals(2, cwdmNode1.getItemData(parentNode, qpe, ItemType.PROPERTY).getPersistedVersion());
@@ -243,6 +247,235 @@
assertEquals(2, cwdmNode1.getItemData(parentNode, qpe, ItemType.PROPERTY).getPersistedVersion());
assertNotNull(cwdmNode2.getItemData(parentNode, qpe, ItemType.PROPERTY));
assertEquals(2, cwdmNode2.getItemData(parentNode, qpe, ItemType.PROPERTY).getPersistedVersion());
+
+ // Test getChildNodesData by patterns
+ final List<QPathEntryFilter> nodePatterns =
+ Collections.singletonList((QPathEntryFilter)new PatternQPathEntryFilter(new PatternQPathEntry("",
+ "my-node", -1)));
+ readAction = new Action(cwdmNode2)
+ {
+ public void execute(NodeData parentNode) throws Exception
+ {
+ cwdm.getChildNodesData(parentNode, nodePatterns);
+ }
+ };
+ writeAction = new Action(cwdmNode1)
+ {
+ public void execute(NodeData parentNode) throws Exception
+ {
+ PlainChangesLog chlog = new PlainChangesLogImpl();
+ cwdm.getChildNodesData(parentNode, nodePatterns);
+ chlog.add(ItemState.createAddedState(new PersistedNodeData("my-node2" + parentNode.getIdentifier(),
+ QPath.makeChildPath(parentNode.getQPath(), new QName("", "my-node"), 2), parentNode.getIdentifier(), 1, 2,
+ Constants.NT_UNSTRUCTURED, new InternalQName[0], null)));
+ cwdm.save(chlog);
+ }
+ };
+ con.setCanModify(true);
+ parentNode = new PersistedNodeData("parent-id11", QPath.makeChildPath(Constants.ROOT_PATH, new InternalQName(null, "parent-node11")), Constants.ROOT_UUID, 1, 0,
+ Constants.NT_UNSTRUCTURED, new InternalQName[0], null);
+ executeConcurrentReadNWrite(con, readAction, writeAction, Mode.READ_FIRST, parentNode);
+ assertNotNull(cwdmNode1.getChildNodesData(parentNode, nodePatterns));
+ assertEquals(2, cwdmNode1.getChildNodesData(parentNode, nodePatterns).size());
+ assertNotNull(cwdmNode2.getChildNodesData(parentNode, nodePatterns));
+ assertEquals(2, cwdmNode2.getChildNodesData(parentNode, nodePatterns).size());
+ parentNode = new PersistedNodeData("parent-id12", QPath.makeChildPath(Constants.ROOT_PATH, new InternalQName(null, "parent-node12")), Constants.ROOT_UUID, 1, 0,
+ Constants.NT_UNSTRUCTURED, new InternalQName[0], null);
+ executeConcurrentReadNWrite(con, readAction, writeAction, Mode.WRITE_FIRST, parentNode);
+ assertNotNull(cwdmNode1.getChildNodesData(parentNode, nodePatterns));
+ assertEquals(2, cwdmNode1.getChildNodesData(parentNode, nodePatterns).size());
+ assertNotNull(cwdmNode2.getChildNodesData(parentNode, nodePatterns));
+ assertEquals(2, cwdmNode2.getChildNodesData(parentNode, nodePatterns).size());
+
+ // Test getChildPropertiesData by patterns
+ final List<QPathEntryFilter> propPatterns =
+ Collections.singletonList((QPathEntryFilter)new PatternQPathEntryFilter(new PatternQPathEntry("",
+ "my-property*", -1)));
+ readAction = new Action(cwdmNode2)
+ {
+ public void execute(NodeData parentNode) throws Exception
+ {
+ cwdm.getChildPropertiesData(parentNode, propPatterns);
+ }
+ };
+ writeAction = new Action(cwdmNode1)
+ {
+ public void execute(NodeData parentNode) throws Exception
+ {
+ PlainChangesLog chlog = new PlainChangesLogImpl();
+ cwdm.getChildPropertiesData(parentNode, propPatterns);
+ chlog.add(ItemState.createAddedState(new PersistedPropertyData("id-property" + parentNode.getIdentifier(), QPath.makeChildPath(
+ parentNode.getQPath(), new InternalQName(null, "my-property1")), parentNode.getIdentifier(), 0,
+ PropertyType.STRING, false, Arrays.asList((ValueData)new ByteArrayPersistedValueData(0, "some data".getBytes("UTF-8"))))));
+ cwdm.save(chlog);
+ }
+ };
+ parentNode = new PersistedNodeData("parent-id13", QPath.makeChildPath(Constants.ROOT_PATH, new InternalQName(null, "parent-node13")), Constants.ROOT_UUID, 1, 0,
+ Constants.NT_UNSTRUCTURED, new InternalQName[0], null);
+ executeConcurrentReadNWrite(con, readAction, writeAction, Mode.READ_FIRST, parentNode);
+ assertNotNull(cwdmNode1.getChildPropertiesData(parentNode, propPatterns));
+ assertEquals(2, cwdmNode1.getChildPropertiesData(parentNode, propPatterns).size());
+ assertNotNull(cwdmNode2.getChildPropertiesData(parentNode, propPatterns));
+ assertEquals(2, cwdmNode2.getChildPropertiesData(parentNode, propPatterns).size());
+ parentNode = new PersistedNodeData("parent-id14", QPath.makeChildPath(Constants.ROOT_PATH, new InternalQName(null, "parent-node14")), Constants.ROOT_UUID, 1, 0,
+ Constants.NT_UNSTRUCTURED, new InternalQName[0], null);
+ executeConcurrentReadNWrite(con, readAction, writeAction, Mode.WRITE_FIRST, parentNode);
+ assertNotNull(cwdmNode1.getChildPropertiesData(parentNode, propPatterns));
+ assertEquals(2, cwdmNode1.getChildPropertiesData(parentNode, propPatterns).size());
+ assertNotNull(cwdmNode2.getChildPropertiesData(parentNode, propPatterns));
+ assertEquals(2, cwdmNode2.getChildPropertiesData(parentNode, propPatterns).size());
+
+ // testConsistency
+ con = new MyWorkspaceStorageConnection(true);
+ wdc = new MyWorkspaceDataContainer(con);
+ cwdmNode1 =
+ new CacheableWorkspaceDataManager(wdc, cache1, new SystemDataContainerHolder(wdc));
+ cwdmNode2 =
+ new CacheableWorkspaceDataManager(wdc, cache2, new SystemDataContainerHolder(wdc));
+ parentNode = new PersistedNodeData("parent2-id", QPath.makeChildPath(Constants.ROOT_PATH, new InternalQName(null, "parent2-node")), Constants.ROOT_UUID, 1, 0,
+ Constants.NT_UNSTRUCTURED, new InternalQName[0], null);
+ // Test getChildNodesData
+ con.setParentNode(parentNode);
+ cwdmNode2.getChildNodesData(parentNode);
+ PlainChangesLog chlog = new PlainChangesLogImpl();
+ chlog.add(ItemState.createAddedState(new PersistedNodeData("id-node" + parentNode.getIdentifier(), QPath.makeChildPath(parentNode.getQPath(), new InternalQName(null, "node")), parentNode.getIdentifier(), 1, 0,
+ Constants.NT_UNSTRUCTURED, new InternalQName[0], null)));
+ cwdmNode1.save(chlog);
+ assertNotNull(cwdmNode1.getChildNodesData(parentNode));
+ assertEquals(2, cwdmNode1.getChildNodesData(parentNode).size());
+ assertNotNull(cwdmNode2.getChildNodesData(parentNode));
+ assertEquals(2, cwdmNode2.getChildNodesData(parentNode).size());
+ parentNode = new PersistedNodeData("parent2-id2", QPath.makeChildPath(Constants.ROOT_PATH, new InternalQName(null, "parent2-node2")), Constants.ROOT_UUID, 1, 0,
+ Constants.NT_UNSTRUCTURED, new InternalQName[0], null);
+ con.setParentNode(parentNode);
+ cwdmNode2.getChildNodesData(parentNode);
+ chlog = new PlainChangesLogImpl();
+ chlog.add(ItemState.createDeletedState(new PersistedNodeData("id-node2" + parentNode.getIdentifier(), QPath.makeChildPath(parentNode.getQPath(), new InternalQName(null, "node2")), parentNode.getIdentifier(), 1, 0,
+ Constants.NT_UNSTRUCTURED, new InternalQName[0], null)));
+ cwdmNode1.save(chlog);
+ assertNotNull(cwdmNode1.getChildNodesData(parentNode));
+ assertEquals(0, cwdmNode1.getChildNodesData(parentNode).size());
+ assertNotNull(cwdmNode2.getChildNodesData(parentNode));
+ assertEquals(0, cwdmNode2.getChildNodesData(parentNode).size());
+
+ // Test getChildPropertiesData
+ parentNode = new PersistedNodeData("parent2-id3", QPath.makeChildPath(Constants.ROOT_PATH, new InternalQName(null, "parent2-node3")), Constants.ROOT_UUID, 1, 0,
+ Constants.NT_UNSTRUCTURED, new InternalQName[0], null);
+ con.setParentNode(parentNode);
+ cwdmNode2.getChildPropertiesData(parentNode);
+ chlog = new PlainChangesLogImpl();
+ chlog.add(ItemState.createAddedState(new PersistedPropertyData("id-property" + parentNode.getIdentifier(), QPath.makeChildPath(
+ parentNode.getQPath(), new InternalQName(null, "property")), parentNode.getIdentifier(), 0,
+ PropertyType.STRING, false, Arrays.asList((ValueData)new ByteArrayPersistedValueData(0, "some data".getBytes("UTF-8"))))));
+ cwdmNode1.save(chlog);
+ assertNotNull(cwdmNode1.getChildPropertiesData(parentNode));
+ assertEquals(2, cwdmNode1.getChildPropertiesData(parentNode).size());
+ assertNotNull(cwdmNode2.getChildPropertiesData(parentNode));
+ assertEquals(2, cwdmNode2.getChildPropertiesData(parentNode).size());
+ parentNode = new PersistedNodeData("parent2-id4", QPath.makeChildPath(Constants.ROOT_PATH, new InternalQName(null, "parent2-node4")), Constants.ROOT_UUID, 1, 0,
+ Constants.NT_UNSTRUCTURED, new InternalQName[0], null);
+ con.setParentNode(parentNode);
+ cwdmNode2.getChildPropertiesData(parentNode);
+ chlog = new PlainChangesLogImpl();
+ chlog.add(ItemState.createDeletedState(new PersistedPropertyData("id-property2" + parentNode.getIdentifier(), QPath.makeChildPath(
+ parentNode.getQPath(), new InternalQName(null, "property2")), parentNode.getIdentifier(), 0,
+ PropertyType.STRING, false, Arrays.asList((ValueData)new ByteArrayPersistedValueData(0, "some data".getBytes("UTF-8"))))));
+ cwdmNode1.save(chlog);
+ assertNotNull(cwdmNode1.getChildPropertiesData(parentNode));
+ assertEquals(0, cwdmNode1.getChildPropertiesData(parentNode).size());
+ assertNotNull(cwdmNode2.getChildPropertiesData(parentNode));
+ assertEquals(0, cwdmNode2.getChildPropertiesData(parentNode).size());
+
+ // Test getReferencesData
+ parentNode = new PersistedNodeData("parent2-id5", QPath.makeChildPath(Constants.ROOT_PATH, new InternalQName(null, "parent2-node5")), Constants.ROOT_UUID, 1, 0,
+ Constants.NT_UNSTRUCTURED, new InternalQName[0], null);
+ con.setParentNode(parentNode);
+ cwdmNode2.getReferencesData(parentNode.getIdentifier(), false);
+ chlog = new PlainChangesLogImpl();
+ chlog.add(ItemState.createAddedState(new PersistedPropertyData("id-reference" + parentNode.getIdentifier(), QPath.makeChildPath(
+ parentNode.getQPath(), new InternalQName(null, "reference")), parentNode.getIdentifier(), 0,
+ PropertyType.REFERENCE, false, Arrays.asList((ValueData)new ByteArrayPersistedValueData(0, parentNode.getIdentifier().getBytes("UTF-8"))))));
+ cwdmNode1.save(chlog);
+ assertNotNull(cwdmNode1.getReferencesData(parentNode.getIdentifier(), false));
+ assertEquals(2, cwdmNode1.getReferencesData(parentNode.getIdentifier(), false).size());
+ assertNotNull(cwdmNode2.getReferencesData(parentNode.getIdentifier(), false));
+ assertEquals(2, cwdmNode2.getReferencesData(parentNode.getIdentifier(), false).size());
+ parentNode = new PersistedNodeData("parent2-id6", QPath.makeChildPath(Constants.ROOT_PATH, new InternalQName(null, "parent2-node6")), Constants.ROOT_UUID, 1, 0,
+ Constants.NT_UNSTRUCTURED, new InternalQName[0], null);
+ con.setParentNode(parentNode);
+ cwdmNode2.getReferencesData(parentNode.getIdentifier(), false);
+ chlog = new PlainChangesLogImpl();
+ chlog.add(ItemState.createDeletedState(new PersistedPropertyData("id-reference2" + parentNode.getIdentifier(), QPath.makeChildPath(
+ parentNode.getQPath(), new InternalQName(null, "reference2")), parentNode.getIdentifier(), 0,
+ PropertyType.REFERENCE, false, Arrays.asList((ValueData)new ByteArrayPersistedValueData(0, parentNode.getIdentifier().getBytes("UTF-8"))))));
+ cwdmNode1.save(chlog);
+ assertNotNull(cwdmNode1.getReferencesData(parentNode.getIdentifier(), false));
+ assertEquals(0, cwdmNode1.getReferencesData(parentNode.getIdentifier(), false).size());
+ assertNotNull(cwdmNode2.getReferencesData(parentNode.getIdentifier(), false));
+ assertEquals(0, cwdmNode2.getReferencesData(parentNode.getIdentifier(), false).size());
+
+ // Test getChildNodesData by patterns
+ final List<QPathEntryFilter> patterns =
+ Collections.singletonList((QPathEntryFilter)new PatternQPathEntryFilter(new PatternQPathEntry("",
+ "my-node", -1)));
+ parentNode = new PersistedNodeData("parent2-id11", QPath.makeChildPath(Constants.ROOT_PATH, new InternalQName(null, "parent2-node11")), Constants.ROOT_UUID, 1, 0,
+ Constants.NT_UNSTRUCTURED, new InternalQName[0], null);
+ con.setParentNode(parentNode);
+ cwdmNode2.getChildNodesData(parentNode, patterns);
+ chlog = new PlainChangesLogImpl();
+ chlog.add(ItemState.createAddedState(new PersistedNodeData("my-node2" + parentNode.getIdentifier(),
+ QPath.makeChildPath(parentNode.getQPath(), new QName("", "my-node"), 2), parentNode.getIdentifier(), 1, 2,
+ Constants.NT_UNSTRUCTURED, new InternalQName[0], null)));
+ cwdmNode1.save(chlog);
+ assertNotNull(cwdmNode1.getChildNodesData(parentNode, patterns));
+ assertEquals(2, cwdmNode1.getChildNodesData(parentNode, patterns).size());
+ assertNotNull(cwdmNode2.getChildNodesData(parentNode, patterns));
+ assertEquals(2, cwdmNode2.getChildNodesData(parentNode, patterns).size());
+ parentNode = new PersistedNodeData("parent2-id12", QPath.makeChildPath(Constants.ROOT_PATH, new InternalQName(null, "parent2-node12")), Constants.ROOT_UUID, 1, 0,
+ Constants.NT_UNSTRUCTURED, new InternalQName[0], null);
+ con.setParentNode(parentNode);
+ cwdmNode2.getChildNodesData(parentNode, patterns);
+ chlog = new PlainChangesLogImpl();
+ chlog.add(ItemState.createDeletedState(new PersistedNodeData("my-node" + parentNode.getIdentifier(), QPath
+ .makeChildPath(parentNode.getQPath(), new QName("", "my-node"), 1), parentNode.getIdentifier(), 1, 1,
+ Constants.NT_UNSTRUCTURED, new InternalQName[0], null)));
+ cwdmNode1.save(chlog);
+ assertNotNull(cwdmNode1.getChildNodesData(parentNode, patterns));
+ assertEquals(0, cwdmNode1.getChildNodesData(parentNode, patterns).size());
+ assertNotNull(cwdmNode2.getChildNodesData(parentNode, patterns));
+ assertEquals(0, cwdmNode2.getChildNodesData(parentNode, patterns).size());
+
+
+ // Test getChildPropertiesData by patterns
+ final List<QPathEntryFilter> propPattern2s =
+ Collections.singletonList((QPathEntryFilter)new PatternQPathEntryFilter(new PatternQPathEntry("",
+ "my-property*", -1)));
+ parentNode = new PersistedNodeData("parent2-id13", QPath.makeChildPath(Constants.ROOT_PATH, new InternalQName(null, "parent2-node13")), Constants.ROOT_UUID, 1, 0,
+ Constants.NT_UNSTRUCTURED, new InternalQName[0], null);
+ con.setParentNode(parentNode);
+ cwdmNode2.getChildPropertiesData(parentNode, propPattern2s);
+ chlog = new PlainChangesLogImpl();
+ chlog.add(ItemState.createAddedState(new PersistedPropertyData("id-property" + parentNode.getIdentifier(), QPath.makeChildPath(
+ parentNode.getQPath(), new InternalQName(null, "my-property1")), parentNode.getIdentifier(), 0,
+ PropertyType.STRING, false, Arrays.asList((ValueData)new ByteArrayPersistedValueData(0, "some data".getBytes("UTF-8"))))));
+ cwdmNode1.save(chlog);
+ assertNotNull(cwdmNode1.getChildPropertiesData(parentNode, propPattern2s));
+ assertEquals(2, cwdmNode1.getChildPropertiesData(parentNode, propPattern2s).size());
+ assertNotNull(cwdmNode2.getChildPropertiesData(parentNode, propPattern2s));
+ assertEquals(2, cwdmNode2.getChildPropertiesData(parentNode, propPattern2s).size());
+ parentNode = new PersistedNodeData("parent2-id14", QPath.makeChildPath(Constants.ROOT_PATH, new InternalQName(null, "parent2-node14")), Constants.ROOT_UUID, 1, 0,
+ Constants.NT_UNSTRUCTURED, new InternalQName[0], null);
+ con.setParentNode(parentNode);
+ cwdmNode2.getChildPropertiesData(parentNode, propPattern2s);
+ chlog = new PlainChangesLogImpl();
+ chlog.add(ItemState.createDeletedState(new PersistedPropertyData("id-property2" + parentNode.getIdentifier(), QPath.makeChildPath(
+ parentNode.getQPath(), new InternalQName(null, "my-property2")), parentNode.getIdentifier(), 0,
+ PropertyType.STRING, false, Arrays.asList((ValueData)new ByteArrayPersistedValueData(0, "some data".getBytes("UTF-8"))))));
+ cwdmNode1.save(chlog);
+ assertNotNull(cwdmNode1.getChildPropertiesData(parentNode, propPattern2s));
+ assertEquals(0, cwdmNode1.getChildPropertiesData(parentNode, propPattern2s).size());
+ assertNotNull(cwdmNode2.getChildPropertiesData(parentNode, propPattern2s));
+ assertEquals(0, cwdmNode2.getChildPropertiesData(parentNode, propPattern2s).size());
}
finally
{
@@ -269,7 +502,7 @@
}
}
}
- }
+ }
protected void finalize(T cache)
{
@@ -302,13 +535,14 @@
}
catch (Exception e)
{
- e.printStackTrace();
+ e.printStackTrace();
ex.set(e);
}
finally
{
if (mode == Mode.WRITE_FIRST) goSignal.countDown();
doneSignal.countDown();
+ con.wait.remove();
}
}
};
@@ -332,7 +566,8 @@
{
if (mode == Mode.READ_FIRST) goSignal.countDown();
doneSignal.countDown();
- }
+ con.wait.remove();
+ }
}
};
reader.start();
@@ -355,12 +590,32 @@
{
READ_FIRST, WRITE_FIRST;
}
- private static class MyWorkspaceStorageConnection implements WorkspaceStorageConnection
+ public static class MyWorkspaceStorageConnection implements WorkspaceStorageConnection
{
public ThreadLocal<Boolean> wait = new ThreadLocal<Boolean>();
private NodeData parentNode;
private CountDownLatch goSignal;
+ private ItemData itemAdded;
+ private boolean canModify;
+ private boolean itemDeleted;
+ public MyWorkspaceStorageConnection()
+ {
+ }
+
+ public MyWorkspaceStorageConnection(boolean canModify)
+ {
+ this.canModify = canModify;
+ }
+
+ /**
+ * @param canModify the canModify to set
+ */
+ public void setCanModify(boolean canModify)
+ {
+ this.canModify = canModify;
+ }
+
public CountDownLatch initCountDownLatch()
{
return this.goSignal = new CountDownLatch(1);
@@ -369,16 +624,20 @@
public void setParentNode(NodeData parentNode)
{
this.parentNode = parentNode;
+ this.itemAdded = null;
+ this.itemDeleted = false;
}
public void add(NodeData data) throws RepositoryException, UnsupportedOperationException,
InvalidItemStateException, IllegalStateException
{
+ this.itemAdded = data;
}
public void add(PropertyData data) throws RepositoryException, UnsupportedOperationException,
InvalidItemStateException, IllegalStateException
{
+ this.itemAdded = data;
}
public void close() throws IllegalStateException, RepositoryException
@@ -396,18 +655,20 @@
catch (InterruptedException e)
{
Thread.currentThread().interrupt();
- }
+ }
}
}
public void delete(NodeData data) throws RepositoryException, UnsupportedOperationException,
InvalidItemStateException, IllegalStateException
{
+ this.itemDeleted = true;
}
public void delete(PropertyData data) throws RepositoryException, UnsupportedOperationException,
InvalidItemStateException, IllegalStateException
{
+ this.itemDeleted = true;
}
public int getChildNodesCount(NodeData parent) throws RepositoryException
@@ -426,11 +687,18 @@
catch (InterruptedException e)
{
Thread.currentThread().interrupt();
- }
+ }
}
List<NodeData> children = new ArrayList<NodeData>();
- children.add(new PersistedNodeData("id-node2" + parentNode.getIdentifier(), QPath.makeChildPath(parent.getQPath(), new InternalQName(null, "node2")), parent.getIdentifier(), 1, 0,
- Constants.NT_UNSTRUCTURED, new InternalQName[0], null));
+ if (!canModify || !itemDeleted)
+ {
+ children.add(new PersistedNodeData("id-node2" + parentNode.getIdentifier(), QPath.makeChildPath(parent.getQPath(), new InternalQName(null, "node2")), parent.getIdentifier(), 1, 0,
+ Constants.NT_UNSTRUCTURED, new InternalQName[0], null));
+ }
+ if (canModify && itemAdded != null)
+ {
+ children.add((NodeData)itemAdded);
+ }
return children;
}
@@ -446,14 +714,21 @@
catch (InterruptedException e)
{
Thread.currentThread().interrupt();
- }
+ }
}
List<PropertyData> children = new ArrayList<PropertyData>();
try
{
- children.add(new PersistedPropertyData("id-property2" + parentNode.getIdentifier(), QPath.makeChildPath(
- parentNode.getQPath(), new InternalQName(null, "property2")), parentNode.getIdentifier(), 0,
- PropertyType.STRING, false, Arrays.asList((ValueData)new ByteArrayPersistedValueData(0, "some data".getBytes("UTF-8")))));
+ if (!canModify || !itemDeleted)
+ {
+ children.add(new PersistedPropertyData("id-property2" + parentNode.getIdentifier(), QPath.makeChildPath(
+ parentNode.getQPath(), new InternalQName(null, "property2")), parentNode.getIdentifier(), 0,
+ PropertyType.STRING, false, Arrays.asList((ValueData)new ByteArrayPersistedValueData(0, "some data".getBytes("UTF-8")))));
+ }
+ if (canModify && itemAdded != null)
+ {
+ children.add((PropertyData)itemAdded);
+ }
}
catch (UnsupportedEncodingException e)
{
@@ -465,7 +740,36 @@
public List<PropertyData> getChildPropertiesData(NodeData parent, List<QPathEntryFilter> pattern) throws RepositoryException,
IllegalStateException
{
- return getChildPropertiesData(parent);
+ if (wait.get() != null && wait.get())
+ {
+ try
+ {
+ goSignal.await();
+ }
+ catch (InterruptedException e)
+ {
+ Thread.currentThread().interrupt();
+ }
+ }
+ List<PropertyData> children = new ArrayList<PropertyData>();
+ try
+ {
+ if (!canModify || !itemDeleted)
+ {
+ children.add(new PersistedPropertyData("id-property2" + parentNode.getIdentifier(), QPath.makeChildPath(
+ parentNode.getQPath(), new InternalQName(null, "my-property2")), parentNode.getIdentifier(), 0,
+ PropertyType.STRING, false, Arrays.asList((ValueData)new ByteArrayPersistedValueData(0, "some data".getBytes("UTF-8")))));
+ }
+ if (canModify && itemAdded != null)
+ {
+ children.add((PropertyData)itemAdded);
+ }
+ }
+ catch (UnsupportedEncodingException e)
+ {
+ e.printStackTrace();
+ }
+ return children;
}
/**
@@ -489,7 +793,7 @@
catch (InterruptedException e)
{
Thread.currentThread().interrupt();
- }
+ }
}
if (itemType == ItemType.NODE)
{
@@ -521,7 +825,7 @@
catch (InterruptedException e)
{
Thread.currentThread().interrupt();
- }
+ }
}
return parentNode;
}
@@ -538,14 +842,21 @@
catch (InterruptedException e)
{
Thread.currentThread().interrupt();
- }
+ }
}
List<PropertyData> children = new ArrayList<PropertyData>();
try
{
- children.add(new PersistedPropertyData("id-reference2" + parentNode.getIdentifier(), QPath.makeChildPath(
- parentNode.getQPath(), new InternalQName(null, "reference2")), parentNode.getIdentifier(), 0,
- PropertyType.REFERENCE, false, Arrays.asList((ValueData)new ByteArrayPersistedValueData(0, parentNode.getIdentifier().getBytes("UTF-8")))));
+ if (!canModify || !itemDeleted)
+ {
+ children.add(new PersistedPropertyData("id-reference2" + parentNode.getIdentifier(), QPath.makeChildPath(
+ parentNode.getQPath(), new InternalQName(null, "reference2")), parentNode.getIdentifier(), 0,
+ PropertyType.REFERENCE, false, Arrays.asList((ValueData)new ByteArrayPersistedValueData(0, parentNode.getIdentifier().getBytes("UTF-8")))));
+ }
+ if (canModify && itemAdded != null)
+ {
+ children.add((PropertyData)itemAdded);
+ }
}
catch (UnsupportedEncodingException e)
{
@@ -595,8 +906,32 @@
public List<NodeData> getChildNodesData(NodeData parent, List<QPathEntryFilter> pattern) throws RepositoryException,
IllegalStateException
{
- return getChildNodesData(parent);
+ if (wait.get() != null && wait.get())
+ {
+ try
+ {
+ goSignal.await();
+ }
+ catch (InterruptedException e)
+ {
+ Thread.currentThread().interrupt();
+ }
+ }
+ List<NodeData> children = new ArrayList<NodeData>();
+ if (!canModify || !itemDeleted)
+ {
+ children.add(new PersistedNodeData("my-node" + parent.getIdentifier(), QPath.makeChildPath(parent.getQPath(), new QName("","my-node"), 1), parent.getIdentifier(), 1, 1,
+ Constants.NT_UNSTRUCTURED, new InternalQName[0], null));
+ }
+ if (canModify && itemAdded != null)
+ {
+ children.add((NodeData)itemAdded);
+ }
+
+ return children;
}
+
+
};
private static class MyWorkspaceDataContainer extends WorkspaceDataContainerBase
@@ -656,5 +991,5 @@
{
return "MyWorkspaceDataContainer";
}
- };
+ };
}
Modified: jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/dataflow/persistent/infinispan/TestISPNCacheWorkspaceStorageCacheInClusterMode.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/dataflow/persistent/infinispan/TestISPNCacheWorkspaceStorageCacheInClusterMode.java 2011-07-14 11:25:59 UTC (rev 4632)
+++ jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/dataflow/persistent/infinispan/TestISPNCacheWorkspaceStorageCacheInClusterMode.java 2011-07-15 07:11:30 UTC (rev 4633)
@@ -25,7 +25,10 @@
import org.exoplatform.services.jcr.impl.dataflow.persistent.TestWorkspaceStorageCacheInClusterMode;
import org.exoplatform.services.jcr.infinispan.ISPNCacheFactory;
+import java.lang.reflect.Field;
import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Map;
/**
* @author <a href="mailto:nfilotto@exoplatform.com">Nicolas Filotto</a>
@@ -35,20 +38,35 @@
public class TestISPNCacheWorkspaceStorageCacheInClusterMode extends TestWorkspaceStorageCacheInClusterMode<ISPNCacheWorkspaceStorageCache>
{
+ @SuppressWarnings({"rawtypes", "unchecked"})
public ISPNCacheWorkspaceStorageCache getCacheImpl() throws Exception
{
+ // Clear the Cache Factory to avoid getting several times the same cache
+ Field singletonField = ISPNCacheFactory.class.getDeclaredField("CACHE_MANAGERS");
+ singletonField.setAccessible(true);
+ Map map = (Map)singletonField.get(null);
+ Map backupMap = new HashMap(map);
+ map.clear();
ArrayList<SimpleParameterEntry> list = new ArrayList<SimpleParameterEntry>();
list.add(new SimpleParameterEntry(ISPNCacheFactory.INFINISPAN_CONFIG,
"jar:/conf/standalone/cluster/test-infinispan-config.xml"));
list.add(new SimpleParameterEntry("infinispan-cluster-name", "TestISPNCacheWorkspaceStorageCacheInClusterMode"));
- list.add(new SimpleParameterEntry("jgroups-configuration", "jar:/conf/standalone/cluster/udp-mux.xml"));
+ list.add(new SimpleParameterEntry("jgroups-configuration", "classpath:/flush-udp.xml"));
CacheEntry entry = new CacheEntry(list);
entry.setEnabled(true);
WorkspaceEntry workspaceEntry = new WorkspaceEntry();
workspaceEntry.setCache(entry);
workspaceEntry.setUniqueName("MyWorkspace");
- return new ISPNCacheWorkspaceStorageCache(workspaceEntry, new ConfigurationManagerImpl());
+ try
+ {
+ return new ISPNCacheWorkspaceStorageCache(workspaceEntry, new ConfigurationManagerImpl());
+ }
+ finally
+ {
+ map.clear();
+ map.putAll(backupMap);
+ }
}
protected void finalize(ISPNCacheWorkspaceStorageCache cache)
14 years, 9 months
exo-jcr SVN: r4632 - in jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr: impl/core/query and 2 other directories.
by do-not-reply@jboss.org
Author: dkuleshov
Date: 2011-07-14 07:25:59 -0400 (Thu, 14 Jul 2011)
New Revision: 4632
Modified:
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/core/WorkspaceContainerFacade.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/ErrorLog.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/SearchManager.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/ConsistencyCheck.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/FileBasedNamespaceMappings.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/IndexingQueue.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/IndexingQueueStore.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/MultiIndex.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/PersistentIndex.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/SearchIndex.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/Util.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/VolatileIndex.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/spell/LuceneSpellChecker.java
Log:
EXOJCR-1429: reverted performance regression made by r2599 commit. removed some unnecessary privileged wrappings
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/core/WorkspaceContainerFacade.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/core/WorkspaceContainerFacade.java 2011-07-14 10:11:06 UTC (rev 4631)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/core/WorkspaceContainerFacade.java 2011-07-14 11:25:59 UTC (rev 4632)
@@ -18,6 +18,7 @@
*/
package org.exoplatform.services.jcr.core;
+import org.exoplatform.commons.utils.SecurityHelper;
import org.exoplatform.services.jcr.core.security.JCRRuntimePermissions;
import org.exoplatform.services.jcr.impl.ReadOnlySupport;
import org.exoplatform.services.jcr.impl.WorkspaceContainer;
@@ -25,6 +26,8 @@
import org.exoplatform.services.jcr.impl.backup.SuspendException;
import org.exoplatform.services.jcr.impl.backup.Suspendable;
+import java.security.PrivilegedActionException;
+import java.security.PrivilegedExceptionAction;
import java.util.Collections;
import java.util.List;
@@ -163,7 +166,7 @@
* @param state
* @throws RepositoryException
*/
- public void setState(int state) throws RepositoryException
+ public void setState(final int state) throws RepositoryException
{
// Need privileges to manage repository.
SecurityManager security = System.getSecurityManager();
@@ -172,22 +175,44 @@
security.checkPermission(JCRRuntimePermissions.MANAGE_REPOSITORY_PERMISSION);
}
- switch (state)
+ try
{
- case ManageableRepository.ONLINE :
- setOnline();
- break;
- case ManageableRepository.OFFLINE :
- break;
- case ManageableRepository.READONLY :
- setReadOnly(true);
- break;
- case ManageableRepository.SUSPENDED :
- suspend();
- break;
- default :
- return;
+ SecurityHelper.doPrivilegedExceptionAction(new PrivilegedExceptionAction<Void>()
+ {
+ public Void run() throws RepositoryException
+ {
+ switch (state)
+ {
+ case ManageableRepository.ONLINE :
+ setOnline();
+ break;
+ case ManageableRepository.OFFLINE :
+ break;
+ case ManageableRepository.READONLY :
+ setReadOnly(true);
+ break;
+ case ManageableRepository.SUSPENDED :
+ suspend();
+ break;
+ default :
+ return null;
+ }
+ return null;
+ }
+ });
}
+ catch (PrivilegedActionException e)
+ {
+ Throwable cause = e.getCause();
+ if (cause instanceof RepositoryException)
+ {
+ throw new RepositoryException(cause);
+ }
+ else
+ {
+ throw new RuntimeException(cause);
+ }
+ }
}
/**
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/ErrorLog.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/ErrorLog.java 2011-07-14 10:11:06 UTC (rev 4631)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/ErrorLog.java 2011-07-14 11:25:59 UTC (rev 4632)
@@ -18,21 +18,17 @@
package org.exoplatform.services.jcr.impl.core.query;
import org.exoplatform.commons.utils.PrivilegedFileHelper;
-import org.exoplatform.commons.utils.SecurityHelper;
import org.exoplatform.services.log.ExoLogger;
import org.exoplatform.services.log.Log;
import java.io.BufferedReader;
import java.io.File;
-import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.nio.ByteBuffer;
import java.nio.channels.FileChannel;
-import java.security.PrivilegedAction;
-import java.security.PrivilegedExceptionAction;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
@@ -101,29 +97,22 @@
*/
private void openFile(final File log) throws IOException
{
- SecurityHelper.doPrivilegedIOExceptionAction(new PrivilegedExceptionAction<Object>()
+ // set file size;
+ if (!PrivilegedFileHelper.exists(log))
{
- public Object run() throws Exception
- {
- // set file size;
- if (!log.exists())
- {
- log.getParentFile().mkdirs();
- log.createNewFile();
+ PrivilegedFileHelper.mkdirs(log.getParentFile());
+ PrivilegedFileHelper.createNewFile(log);
- out = PrivilegedFileHelper.fileOutputStream(log).getChannel();
- out.position(1024 * fileSize - 1);
- out.write(ByteBuffer.wrap(new byte[]{0}));
- out.position(0);
- out.force(false);
- }
- else
- {
- out = new FileOutputStream(log, true).getChannel();
- }
- return null;
- }
- });
+ out = PrivilegedFileHelper.fileOutputStream(log).getChannel();
+ out.position(1024 * fileSize - 1);
+ out.write(ByteBuffer.wrap(new byte[]{0}));
+ out.position(0);
+ out.force(false);
+ }
+ else
+ {
+ out = PrivilegedFileHelper.fileOutputStream(log, true).getChannel();
+ }
}
/**
@@ -137,14 +126,7 @@
public void append(final String action, final String uuid) throws IOException
{
initOut();
- SecurityHelper.doPrivilegedIOExceptionAction(new PrivilegedExceptionAction<Object>()
- {
- public Object run() throws Exception
- {
- out.write(ByteBuffer.wrap((action + " " + uuid + "\n").getBytes()));
- return null;
- }
- });
+ out.write(ByteBuffer.wrap((action + " " + uuid + "\n").getBytes()));
}
/**
@@ -155,17 +137,10 @@
*/
public void flush() throws IOException
{
- SecurityHelper.doPrivilegedIOExceptionAction(new PrivilegedExceptionAction<Object>()
+ if (out != null)
{
- public Object run() throws Exception
- {
- if (out != null)
- {
- out.force(false);
- }
- return null;
- }
- });
+ out.force(false);
+ }
}
/**
@@ -176,23 +151,16 @@
*/
public void clear() throws IOException
{
- SecurityHelper.doPrivilegedIOExceptionAction(new PrivilegedExceptionAction<Object>()
+ if (out != null)
{
- public Object run() throws Exception
- {
- if (out != null)
- {
- out.truncate(0);
- out.close();
- out = new FileOutputStream(logFile).getChannel();
- out.position(1024 * fileSize - 1);
- out.write(ByteBuffer.wrap(new byte[]{0}));
- out.position(0);
- out.force(false);
- }
- return null;
- }
- });
+ out.truncate(0);
+ out.close();
+ out = PrivilegedFileHelper.fileOutputStream(logFile).getChannel();
+ out.position(1024 * fileSize - 1);
+ out.write(ByteBuffer.wrap(new byte[]{0}));
+ out.position(0);
+ out.force(false);
+ }
}
/**
@@ -203,18 +171,11 @@
*/
private void initOut() throws IOException
{
- SecurityHelper.doPrivilegedIOExceptionAction(new PrivilegedExceptionAction<Object>()
+ if (out == null)
{
- public Object run() throws Exception
- {
- if (out == null)
- {
- FileOutputStream os = new FileOutputStream(logFile, false);
- out = os.getChannel();
- }
- return null;
- }
- });
+ FileOutputStream os = PrivilegedFileHelper.fileOutputStream(logFile, false);
+ out = os.getChannel();
+ }
}
/**
@@ -225,42 +186,36 @@
*/
public List<String> readList() throws IOException
{
- return SecurityHelper.doPrivilegedIOExceptionAction(new PrivilegedExceptionAction<List<String>>()
+ InputStream in = PrivilegedFileHelper.fileInputStream(logFile);
+ try
{
- public List<String> run() throws Exception
+ List<String> list = new ArrayList<String>();
+ BufferedReader reader = new BufferedReader(new InputStreamReader(in));
+ String line;
+ while ((line = reader.readLine()) != null)
{
- InputStream in = new FileInputStream(logFile);
- try
+ if (!line.matches("\\x00++"))
{
- List<String> list = new ArrayList<String>();
- BufferedReader reader = new BufferedReader(new InputStreamReader(in));
- String line;
- while ((line = reader.readLine()) != null)
- {
- if (!line.matches("\\x00++"))
- {
- list.add(line);
- }
- }
- return list;
+ list.add(line);
+ }
+ }
+ return list;
+ }
+ finally
+ {
+ if (in != null)
+ {
+ try
+ {
+ in.close();
}
- finally
+ catch (IOException e)
{
- if (in != null)
- {
- try
- {
- in.close();
- }
- catch (IOException e)
- {
- LOG.warn("Exception while closing error log: " + e.toString());
- }
- }
+ LOG.warn("Exception while closing error log: " + e.toString());
}
}
- });
+ }
}
public void readChanges(Set<String> rem, Set<String> add) throws IOException
@@ -317,24 +272,17 @@
*/
public void close()
{
- SecurityHelper.doPrivilegedAction(new PrivilegedAction<Object>()
+ if (out != null)
{
- public Object run()
+ try
{
- if (out != null)
- {
- try
- {
- out.close();
- }
- catch (IOException e)
- {
- out = null;
- }
- }
- return null;
+ out.close();
}
- });
+ catch (IOException e)
+ {
+ out = null;
+ }
+ }
}
}
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/SearchManager.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/SearchManager.java 2011-07-14 10:11:06 UTC (rev 4631)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/SearchManager.java 2011-07-14 11:25:59 UTC (rev 4632)
@@ -22,7 +22,6 @@
import org.apache.lucene.search.BooleanQuery;
import org.apache.lucene.search.WildcardQuery;
import org.exoplatform.commons.utils.PrivilegedFileHelper;
-import org.exoplatform.commons.utils.SecurityHelper;
import org.exoplatform.container.ExoContainerContext;
import org.exoplatform.container.configuration.ConfigurationManager;
import org.exoplatform.management.annotations.Managed;
@@ -88,8 +87,6 @@
import java.io.Serializable;
import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;
-import java.security.PrivilegedActionException;
-import java.security.PrivilegedExceptionAction;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
@@ -517,7 +514,7 @@
/**
* {@inheritDoc}
*/
- public void onSaveItems(ItemStateChangesLog itemStates)
+ public void onSaveItems(final ItemStateChangesLog itemStates)
{
//skip empty
if (itemStates.getSize() > 0)
@@ -1454,35 +1451,7 @@
if (handler instanceof Suspendable)
{
- PrivilegedExceptionAction<Object> action = new PrivilegedExceptionAction<Object>()
- {
- public Object run() throws Exception
- {
- ((Suspendable)handler).resume();
- return null;
- }
- };
- try
- {
- SecurityHelper.doPrivilegedExceptionAction(action);
- }
- catch (PrivilegedActionException pae)
- {
- Throwable cause = pae.getCause();
-
- if (cause instanceof ResumeException)
- {
- throw (ResumeException)cause;
- }
- else if (cause instanceof RuntimeException)
- {
- throw (RuntimeException)cause;
- }
- else
- {
- throw new RuntimeException(cause);
- }
- }
+ ((Suspendable)handler).resume();
}
isSuspended = false;
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/ConsistencyCheck.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/ConsistencyCheck.java 2011-07-14 10:11:06 UTC (rev 4631)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/ConsistencyCheck.java 2011-07-14 11:25:59 UTC (rev 4632)
@@ -17,14 +17,12 @@
package org.exoplatform.services.jcr.impl.core.query.lucene;
import org.apache.lucene.document.Document;
-import org.exoplatform.commons.utils.SecurityHelper;
import org.exoplatform.services.jcr.dataflow.ItemDataConsumer;
import org.exoplatform.services.jcr.datamodel.NodeData;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.IOException;
-import java.security.PrivilegedExceptionAction;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.Iterator;
@@ -121,15 +119,8 @@
{
if (error.repairable())
{
- SecurityHelper.doPrivilegedIOExceptionAction(new PrivilegedExceptionAction<Object>()
- {
- public Object run() throws Exception
- {
- // running in privileged mode
- error.repair();
- return null;
- }
- });
+ // running in privileged mode
+ error.repair();
}
else
{
@@ -180,7 +171,7 @@
Set multipleEntries = new HashSet();
// collect all documents UUIDs
documentUUIDs = new HashSet();
- final CachingMultiIndexReader reader = index.getIndexReader();
+ CachingMultiIndexReader reader = index.getIndexReader();
try
{
for (int i = 0; i < reader.maxDoc(); i++)
@@ -195,14 +186,7 @@
continue;
}
final int currentIndex = i;
- Document d = SecurityHelper.doPrivilegedIOExceptionAction(new PrivilegedExceptionAction<Document>()
- {
- public Document run() throws Exception
- {
- return reader.document(currentIndex, FieldSelectors.UUID);
- }
- });
-
+ Document d = reader.document(currentIndex, FieldSelectors.UUID);
String uuid = d.get(FieldNames.UUID);
if (stateMgr.getItemData(uuid) != null)
{
@@ -219,14 +203,7 @@
}
finally
{
- SecurityHelper.doPrivilegedIOExceptionAction(new PrivilegedExceptionAction<Object>()
- {
- public Object run() throws Exception
- {
- reader.release();
- return null;
- }
- });
+ reader.release();
}
// create multiple entries errors
@@ -235,30 +212,23 @@
errors.add(new MultipleEntries((String)it.next()));
}
- final CachingMultiIndexReader newReader = index.getIndexReader();
+ reader = index.getIndexReader();
try
{
// run through documents again and check parent
- for (int i = 0; i < newReader.maxDoc(); i++)
+ for (int i = 0; i < reader.maxDoc(); i++)
{
- if (i > 10 && i % (newReader.maxDoc() / 5) == 0)
+ if (i > 10 && i % (reader.maxDoc() / 5) == 0)
{
- long progress = Math.round((100.0 * i) / (newReader.maxDoc() * 2f));
+ long progress = Math.round((100.0 * i) / (reader.maxDoc() * 2f));
log.info("progress: " + (progress + 50) + "%");
}
- if (newReader.isDeleted(i))
+ if (reader.isDeleted(i))
{
continue;
}
final int currentIndex = i;
- Document d = SecurityHelper.doPrivilegedIOExceptionAction(new PrivilegedExceptionAction<Document>()
- {
- public Document run() throws Exception
- {
- return newReader.document(currentIndex, FieldSelectors.UUID_AND_PARENT);
- }
- });
-
+ Document d = reader.document(currentIndex, FieldSelectors.UUID_AND_PARENT);
String uuid = d.get(FieldNames.UUID);
String parentUUIDString = d.get(FieldNames.PARENT);
@@ -281,14 +251,7 @@
}
finally
{
- SecurityHelper.doPrivilegedIOExceptionAction(new PrivilegedExceptionAction<Object>()
- {
- public Object run() throws Exception
- {
- newReader.release();
- return null;
- }
- });
+ reader.release();
}
}
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/FileBasedNamespaceMappings.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/FileBasedNamespaceMappings.java 2011-07-14 10:11:06 UTC (rev 4631)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/FileBasedNamespaceMappings.java 2011-07-14 11:25:59 UTC (rev 4632)
@@ -16,17 +16,15 @@
*/
package org.exoplatform.services.jcr.impl.core.query.lucene;
-import org.exoplatform.commons.utils.SecurityHelper;
import org.exoplatform.commons.utils.PrivilegedFileHelper;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import org.exoplatform.services.log.ExoLogger;
+import org.exoplatform.services.log.Log;
import java.io.BufferedOutputStream;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
-import java.security.PrivilegedExceptionAction;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
@@ -37,7 +35,7 @@
/**
* The class <code>NamespaceMappings</code> implements a
- * {@link NamespaceResolver} that holds a namespace
+ * NamespaceResolver that holds a namespace
* mapping that is used internally in the search index. Storing paths with the
* full uri of a namespace would require too much space in the search index.
* <p/>
@@ -51,7 +49,7 @@
/**
* Default logger instance for this class
*/
- private static Logger log = LoggerFactory.getLogger("exo.jcr.component.core.NamespaceMappings");
+ private static Log log = ExoLogger.getLogger("exo.jcr.component.core.NamespaceMappings");
/**
* Location of the file that persists the uri / prefix mappings
@@ -149,40 +147,33 @@
*/
private void load() throws IOException
{
- SecurityHelper.doPrivilegedIOExceptionAction(new PrivilegedExceptionAction<Object>()
+ if (PrivilegedFileHelper.exists(storage))
{
- public Object run() throws Exception
+ InputStream in = PrivilegedFileHelper.fileInputStream(storage);
+ try
{
- if (storage.exists())
- {
- InputStream in = PrivilegedFileHelper.fileInputStream(storage);
- try
- {
- Properties props = new Properties();
- log.debug("loading namespace mappings...");
- props.load(in);
+ Properties props = new Properties();
+ log.debug("loading namespace mappings...");
+ props.load(in);
- // read mappings from properties
- Iterator iter = props.keySet().iterator();
- while (iter.hasNext())
- {
- String prefix = (String)iter.next();
- String uri = props.getProperty(prefix);
- log.debug(prefix + " -> " + uri);
- prefixToURI.put(prefix, uri);
- uriToPrefix.put(uri, prefix);
- }
- prefixCount = props.size();
- log.debug("namespace mappings loaded.");
- }
- finally
- {
- in.close();
- }
+ // read mappings from properties
+ Iterator iter = props.keySet().iterator();
+ while (iter.hasNext())
+ {
+ String prefix = (String)iter.next();
+ String uri = props.getProperty(prefix);
+ log.debug(prefix + " -> " + uri);
+ prefixToURI.put(prefix, uri);
+ uriToPrefix.put(uri, prefix);
}
- return null;
+ prefixCount = props.size();
+ log.debug("namespace mappings loaded.");
}
- });
+ finally
+ {
+ in.close();
+ }
+ }
}
/**
@@ -192,35 +183,28 @@
*/
private void store() throws IOException
{
- SecurityHelper.doPrivilegedIOExceptionAction(new PrivilegedExceptionAction<Object>()
+ Properties props = new Properties();
+
+ // store mappings in properties
+ Iterator iter = prefixToURI.keySet().iterator();
+ while (iter.hasNext())
{
- public Object run() throws Exception
- {
- Properties props = new Properties();
+ String prefix = (String)iter.next();
+ String uri = (String)prefixToURI.get(prefix);
+ props.setProperty(prefix, uri);
+ }
- // store mappings in properties
- Iterator iter = prefixToURI.keySet().iterator();
- while (iter.hasNext())
- {
- String prefix = (String)iter.next();
- String uri = (String)prefixToURI.get(prefix);
- props.setProperty(prefix, uri);
- }
-
- OutputStream out = PrivilegedFileHelper.fileOutputStream(storage);
- try
- {
- out = new BufferedOutputStream(out);
- props.store(out, null);
- }
- finally
- {
- // make sure stream is closed
- out.close();
- }
- return null;
- }
- });
+ OutputStream out = PrivilegedFileHelper.fileOutputStream(storage);
+ try
+ {
+ out = new BufferedOutputStream(out);
+ props.store(out, null);
+ }
+ finally
+ {
+ // make sure stream is closed
+ out.close();
+ }
}
public String[] getAllNamespacePrefixes() throws RepositoryException
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/IndexingQueue.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/IndexingQueue.java 2011-07-14 10:11:06 UTC (rev 4631)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/IndexingQueue.java 2011-07-14 11:25:59 UTC (rev 4632)
@@ -19,12 +19,10 @@
import org.apache.lucene.document.Document;
import org.apache.lucene.index.Term;
import org.apache.lucene.index.TermDocs;
-import org.exoplatform.commons.utils.SecurityHelper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.IOException;
-import java.security.PrivilegedExceptionAction;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
@@ -79,60 +77,52 @@
*/
void initialize(final MultiIndex index) throws IOException
{
- SecurityHelper.doPrivilegedIOExceptionAction(new PrivilegedExceptionAction<Object>()
+ if (initialized)
{
- public Object run() throws Exception
+ throw new IllegalStateException("already initialized");
+ }
+ // check index for nodes that need to be reindexed
+ CachingMultiIndexReader reader = index.getIndexReader();
+ try
+ {
+ TermDocs tDocs = reader.termDocs(new Term(FieldNames.REINDEXING_REQUIRED, ""));
+ try
{
- if (initialized)
+ while (tDocs.next())
{
- throw new IllegalStateException("already initialized");
+ queueStore.addUUID(reader.document(tDocs.doc(), FieldSelectors.UUID).get(FieldNames.UUID));
}
- // check index for nodes that need to be reindexed
- CachingMultiIndexReader reader = index.getIndexReader();
- try
- {
- TermDocs tDocs = reader.termDocs(new Term(FieldNames.REINDEXING_REQUIRED, ""));
- try
- {
- while (tDocs.next())
- {
- queueStore.addUUID(reader.document(tDocs.doc(), FieldSelectors.UUID).get(FieldNames.UUID));
- }
- }
- finally
- {
- tDocs.close();
- }
- }
- finally
- {
- reader.release();
- }
- String[] uuids = queueStore.getPending();
- for (int i = 0; i < uuids.length; i++)
- {
- try
- {
- Document doc = index.createDocument(uuids[i]);
- pendingDocuments.put(uuids[i], doc);
- log.debug("added node {}. New size of indexing queue: {}", uuids[i], new Integer(pendingDocuments
- .size()));
- }
- catch (IllegalArgumentException e)
- {
- log.warn("Invalid UUID in indexing queue store: " + uuids[i]);
- }
- catch (RepositoryException e)
- {
- // node does not exist anymore
- log.debug("Node with uuid {} does not exist anymore", uuids[i]);
- queueStore.removeUUID(uuids[i]);
- }
- }
- initialized = true;
- return null;
}
- });
+ finally
+ {
+ tDocs.close();
+ }
+ }
+ finally
+ {
+ reader.release();
+ }
+ String[] uuids = queueStore.getPending();
+ for (int i = 0; i < uuids.length; i++)
+ {
+ try
+ {
+ Document doc = index.createDocument(uuids[i]);
+ pendingDocuments.put(uuids[i], doc);
+ log.debug("added node {}. New size of indexing queue: {}", uuids[i], new Integer(pendingDocuments.size()));
+ }
+ catch (IllegalArgumentException e)
+ {
+ log.warn("Invalid UUID in indexing queue store: " + uuids[i]);
+ }
+ catch (RepositoryException e)
+ {
+ // node does not exist anymore
+ log.debug("Node with uuid {} does not exist anymore", uuids[i]);
+ queueStore.removeUUID(uuids[i]);
+ }
+ }
+ initialized = true;
}
/**
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/IndexingQueueStore.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/IndexingQueueStore.java 2011-07-14 10:11:06 UTC (rev 4631)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/IndexingQueueStore.java 2011-07-14 11:25:59 UTC (rev 4632)
@@ -17,7 +17,6 @@
package org.exoplatform.services.jcr.impl.core.query.lucene;
import org.apache.lucene.store.Directory;
-import org.exoplatform.commons.utils.SecurityHelper;
import org.exoplatform.services.jcr.impl.core.query.lucene.directory.IndexInputStream;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -26,8 +25,6 @@
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
-import java.security.PrivilegedAction;
-import java.security.PrivilegedExceptionAction;
import java.util.HashSet;
import java.util.Set;
@@ -121,27 +118,20 @@
*/
public void close()
{
- SecurityHelper.doPrivilegedAction(new PrivilegedAction<Object>()
+ if (pending.isEmpty())
{
- public Object run()
+ try
{
- if (pending.isEmpty())
+ if (dir.fileExists(INDEXING_QUEUE_FILE))
{
- try
- {
- if (dir.fileExists(INDEXING_QUEUE_FILE))
- {
- dir.deleteFile(INDEXING_QUEUE_FILE);
- }
- }
- catch (IOException e)
- {
- log.warn("unable to delete " + INDEXING_QUEUE_FILE);
- }
+ dir.deleteFile(INDEXING_QUEUE_FILE);
}
- return null;
}
- });
+ catch (IOException e)
+ {
+ log.warn("unable to delete " + INDEXING_QUEUE_FILE);
+ }
+ }
}
//----------------------------< internal >----------------------------------
@@ -154,52 +144,45 @@
*/
private void readStore() throws IOException
{
- SecurityHelper.doPrivilegedIOExceptionAction(new PrivilegedExceptionAction<Object>()
+ if (dir.fileExists(INDEXING_QUEUE_FILE))
{
- public Object run() throws Exception
+ InputStream in = new IndexInputStream(dir.openInput(INDEXING_QUEUE_FILE));
+ BufferedReader reader = new BufferedReader(new InputStreamReader(in, ENCODING));
+ try
{
- if (dir.fileExists(INDEXING_QUEUE_FILE))
+ String line;
+ while ((line = reader.readLine()) != null)
{
- InputStream in = new IndexInputStream(dir.openInput(INDEXING_QUEUE_FILE));
- BufferedReader reader = new BufferedReader(new InputStreamReader(in, ENCODING));
- try
+ int idx = line.indexOf(' ');
+ if (idx == -1)
{
- String line;
- while ((line = reader.readLine()) != null)
+ // invalid line
+ log.warn("invalid line in {}: {}", INDEXING_QUEUE_FILE, line);
+ }
+ else
+ {
+ String cmd = line.substring(0, idx);
+ String uuid = line.substring(idx + 1, line.length());
+ if (ADD.equals(cmd))
{
- int idx = line.indexOf(' ');
- if (idx == -1)
- {
- // invalid line
- log.warn("invalid line in {}: {}", INDEXING_QUEUE_FILE, line);
- }
- else
- {
- String cmd = line.substring(0, idx);
- String uuid = line.substring(idx + 1, line.length());
- if (ADD.equals(cmd))
- {
- pending.add(uuid);
- }
- else if (REMOVE.equals(cmd))
- {
- pending.remove(uuid);
- }
- else
- {
- // invalid line
- log.warn("invalid line in {}: {}", INDEXING_QUEUE_FILE, line);
- }
- }
+ pending.add(uuid);
}
+ else if (REMOVE.equals(cmd))
+ {
+ pending.remove(uuid);
+ }
+ else
+ {
+ // invalid line
+ log.warn("invalid line in {}: {}", INDEXING_QUEUE_FILE, line);
+ }
}
- finally
- {
- in.close();
- }
}
- return null;
}
- });
+ finally
+ {
+ in.close();
+ }
+ }
}
}
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/MultiIndex.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/MultiIndex.java 2011-07-14 10:11:06 UTC (rev 4631)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/MultiIndex.java 2011-07-14 11:25:59 UTC (rev 4632)
@@ -350,21 +350,14 @@
// set index format version and at the same time
// initialize hierarchy cache if requested.
- final CachingMultiIndexReader reader = getIndexReader(handler.isInitializeHierarchyCache());
+ CachingMultiIndexReader reader = getIndexReader(handler.isInitializeHierarchyCache());
try
{
version = IndexFormatVersion.getVersion(reader);
}
finally
{
- SecurityHelper.doPrivilegedIOExceptionAction(new PrivilegedExceptionAction<Object>()
- {
- public Object run() throws Exception
- {
- reader.release();
- return null;
- }
- });
+ reader.release();
}
indexingQueue.initialize(this);
if (modeHandler.getMode() == IndexerIoMode.READ_WRITE)
@@ -406,21 +399,14 @@
}
else
{
- final CachingMultiIndexReader reader = getIndexReader();
+ CachingMultiIndexReader reader = getIndexReader();
try
{
return reader.numDocs();
}
finally
{
- SecurityHelper.doPrivilegedIOExceptionAction(new PrivilegedExceptionAction<Object>()
- {
- public Object run() throws Exception
- {
- reader.release();
- return null;
- }
- });
+ reader.release();
}
}
}
@@ -473,8 +459,8 @@
}
else
{
- log.info("Index can'b be retrieved from coordinator now, because it is offline. " +
- "Possibly coordinator node performs reindexing now. Switching to local re-indexing.");
+ log.info("Index can'b be retrieved from coordinator now, because it is offline. "
+ + "Possibly coordinator node performs reindexing now. Switching to local re-indexing.");
}
}
@@ -484,13 +470,13 @@
{
if (handler.getContext().getRPCService() == null)
{
- log.error("RPC Service is not configured but required for copying the index " +
- "from coordinator node. Index will be created by re-indexing.");
+ log.error("RPC Service is not configured but required for copying the index "
+ + "from coordinator node. Index will be created by re-indexing.");
}
else if (handler.getContext().getRPCService().isCoordinator() == true)
{
- log.info("Copying the index from coordinator configured, but this node is the " +
- "only one in a cluster. Index will be created by re-indexing.");
+ log.info("Copying the index from coordinator configured, but this node is the "
+ + "only one in a cluster. Index will be created by re-indexing.");
}
}
@@ -759,76 +745,69 @@
*/
private void doUpdateRW(final Collection<String> remove, final Collection<Document> add) throws IOException
{
- SecurityHelper.doPrivilegedIOExceptionAction(new PrivilegedExceptionAction<Object>()
+ // make sure a reader is available during long updates
+ if (add.size() > handler.getBufferSize())
{
- public Object run() throws Exception
+ try
{
- // make sure a reader is available during long updates
- if (add.size() > handler.getBufferSize())
+ releaseMultiReader();
+ }
+ catch (IOException e)
+ {
+ // do not fail if an exception is thrown here
+ log.warn("unable to prepare index reader " + "for queries during update", e);
+ }
+ }
+
+ synchronized (updateMonitor)
+ {
+ //updateInProgress = true;
+ indexUpdateMonitor.setUpdateInProgress(true, false);
+ }
+ boolean flush = false;
+ try
+ {
+ long transactionId = nextTransactionId++;
+ executeAndLog(new Start(transactionId));
+
+ for (Iterator<String> it = remove.iterator(); it.hasNext();)
+ {
+ executeAndLog(new DeleteNode(transactionId, it.next()));
+ }
+ for (Iterator<Document> it = add.iterator(); it.hasNext();)
+ {
+ Document doc = it.next();
+ if (doc != null)
{
- try
- {
- releaseMultiReader();
- }
- catch (IOException e)
- {
- // do not fail if an exception is thrown here
- log.warn("unable to prepare index reader " + "for queries during update", e);
- }
+ executeAndLog(new AddNode(transactionId, doc));
+ // commit volatile index if needed
+ flush |= checkVolatileCommit();
}
+ }
+ executeAndLog(new Commit(transactionId));
+ // flush whole index when volatile index has been commited.
+ if (flush)
+ {
+ // if we are going to flush, need to set persistent update
synchronized (updateMonitor)
{
- //updateInProgress = true;
- indexUpdateMonitor.setUpdateInProgress(true, false);
+ indexUpdateMonitor.setUpdateInProgress(true, true);
}
- boolean flush = false;
- try
- {
- long transactionId = nextTransactionId++;
- executeAndLog(new Start(transactionId));
+ flush();
+ }
+ }
+ finally
+ {
+ synchronized (updateMonitor)
+ {
+ //updateInProgress = false;
- for (Iterator<String> it = remove.iterator(); it.hasNext();)
- {
- executeAndLog(new DeleteNode(transactionId, it.next()));
- }
- for (Iterator<Document> it = add.iterator(); it.hasNext();)
- {
- Document doc = it.next();
- if (doc != null)
- {
- executeAndLog(new AddNode(transactionId, doc));
- // commit volatile index if needed
- flush |= checkVolatileCommit();
- }
- }
- executeAndLog(new Commit(transactionId));
-
- // flush whole index when volatile index has been commited.
- if (flush)
- {
- // if we are going to flush, need to set persistent update
- synchronized (updateMonitor)
- {
- indexUpdateMonitor.setUpdateInProgress(true, true);
- }
- flush();
- }
- }
- finally
- {
- synchronized (updateMonitor)
- {
- //updateInProgress = false;
-
- indexUpdateMonitor.setUpdateInProgress(false, flush);
- updateMonitor.notifyAll();
- releaseMultiReader();
- }
- }
- return null;
+ indexUpdateMonitor.setUpdateInProgress(false, flush);
+ updateMonitor.notifyAll();
+ releaseMultiReader();
}
- });
+ }
}
private void invokeOfflineIndex() throws IOException
@@ -1158,18 +1137,11 @@
{
time = System.currentTimeMillis();
}
- SecurityHelper.doPrivilegedIOExceptionAction(new PrivilegedExceptionAction<Object>()
- {
- public Object run() throws Exception
- {
- index.getReadOnlyIndexReader(true).release();
- return null;
- }
- });
+ index.getReadOnlyIndexReader(true).release();
if (log.isDebugEnabled())
{
time = System.currentTimeMillis() - time;
- log.debug("hierarchy cache initialized in {} ms", new Long(time));
+ log.debug("hierarchy cache initialized in {} ms", new Long(time));
}
}
@@ -1559,22 +1531,22 @@
}
}
}
- executeAndLog(new Commit(getTransactionId()));
-
- indexNames.write();
+ executeAndLog(new Commit(getTransactionId()));
- // reset redo log
- redoLog.clear();
+ indexNames.write();
- lastFlushTime = System.currentTimeMillis();
- lastFileSystemFlushTime = System.currentTimeMillis();
- }
+ // reset redo log
+ redoLog.clear();
- // delete obsolete indexes
- attemptDelete();
- return null;
- }
- });
+ lastFlushTime = System.currentTimeMillis();
+ lastFileSystemFlushTime = System.currentTimeMillis();
+ }
+
+ // delete obsolete indexes
+ attemptDelete();
+ return null;
+ }
+ });
}
/**
@@ -1649,35 +1621,28 @@
*/
private void scheduleFlushTask()
{
- SecurityHelper.doPrivilegedAction(new PrivilegedAction<Object>()
+ // cancel task
+ if (flushTask != null)
{
- public Object run()
+ flushTask.cancel();
+ }
+ // clear canceled tasks
+ FLUSH_TIMER.purge();
+ // new flush task, cause canceled can't be re-used
+ flushTask = new TimerTask()
+ {
+ @Override
+ public void run()
{
- // cancel task
- if (flushTask != null)
- {
- flushTask.cancel();
- }
- // clear canceled tasks
- FLUSH_TIMER.purge();
- // new flush task, cause canceled can't be re-used
- flushTask = new TimerTask()
- {
- @Override
- public void run()
- {
- // check if there are any indexing jobs finished
- checkIndexingQueue();
- // check if volatile index should be flushed
- checkFlush();
- }
- };
- FLUSH_TIMER.schedule(flushTask, 0, 1000);
- lastFlushTime = System.currentTimeMillis();
- lastFileSystemFlushTime = System.currentTimeMillis();
- return null;
+ // check if there are any indexing jobs finished
+ checkIndexingQueue();
+ // check if volatile index should be flushed
+ checkFlush();
}
- });
+ };
+ FLUSH_TIMER.schedule(flushTask, 0, 1000);
+ lastFlushTime = System.currentTimeMillis();
+ lastFileSystemFlushTime = System.currentTimeMillis();
}
/**
@@ -1783,7 +1748,7 @@
if (log.isDebugEnabled())
{
time = System.currentTimeMillis() - time;
- log.debug("Committed in-memory index in " + time + "ms.");
+ log.debug("Committed in-memory index in " + time + "ms.");
}
}
}
@@ -2046,25 +2011,18 @@
*/
private void removeDeletable()
{
- SecurityHelper.doPrivilegedAction(new PrivilegedAction<Object>()
+ String fileName = "deletable";
+ try
{
- public Object run()
+ if (indexDir.fileExists(fileName))
{
- String fileName = "deletable";
- try
- {
- if (indexDir.fileExists(fileName))
- {
- indexDir.deleteFile(fileName);
- }
- }
- catch (IOException e)
- {
- log.warn("Unable to remove file 'deletable'.", e);
- }
- return null;
+ indexDir.deleteFile(fileName);
}
- });
+ }
+ catch (IOException e)
+ {
+ log.warn("Unable to remove file 'deletable'.", e);
+ }
}
/**
@@ -2540,8 +2498,8 @@
/**
* The maximum length of a AddNode String.
*/
- private static final int ENTRY_LENGTH =
- Long.toString(Long.MAX_VALUE).length() + Action.ADD_NODE.length() + Constants.UUID_FORMATTED_LENGTH + 2;
+ private static final int ENTRY_LENGTH = Long.toString(Long.MAX_VALUE).length() + Action.ADD_NODE.length()
+ + Constants.UUID_FORMATTED_LENGTH + 2;
/**
* The uuid of the node to add.
@@ -2942,8 +2900,8 @@
/**
* The maximum length of a DeleteNode String.
*/
- private static final int ENTRY_LENGTH =
- Long.toString(Long.MAX_VALUE).length() + Action.DELETE_NODE.length() + Constants.UUID_FORMATTED_LENGTH + 2;
+ private static final int ENTRY_LENGTH = Long.toString(Long.MAX_VALUE).length() + Action.DELETE_NODE.length()
+ + Constants.UUID_FORMATTED_LENGTH + 2;
/**
* The uuid of the node to remove.
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/PersistentIndex.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/PersistentIndex.java 2011-07-14 10:11:06 UTC (rev 4631)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/PersistentIndex.java 2011-07-14 11:25:59 UTC (rev 4632)
@@ -23,11 +23,9 @@
import org.apache.lucene.store.Directory;
import org.apache.lucene.store.IndexInput;
import org.apache.lucene.store.IndexOutput;
-import org.exoplatform.commons.utils.SecurityHelper;
import org.exoplatform.services.jcr.impl.core.query.lucene.directory.DirectoryManager;
import java.io.IOException;
-import java.security.PrivilegedExceptionAction;
/**
* Implements a lucene index which is based on a
@@ -64,14 +62,7 @@
this.name = name;
if (isExisting())
{
- SecurityHelper.doPrivilegedIOExceptionAction(new PrivilegedExceptionAction<Object>()
- {
- public Object run() throws Exception
- {
- IndexMigration.migrate(PersistentIndex.this, directoryManager);
- return null;
- }
- });
+ IndexMigration.migrate(PersistentIndex.this, directoryManager);
}
}
@@ -98,17 +89,10 @@
* @param readers the readers of indexes to add.
* @throws IOException if an error occurs while adding indexes.
*/
- void addIndexes(final IndexReader[] readers) throws IOException
+ void addIndexes(IndexReader[] readers) throws IOException
{
- SecurityHelper.doPrivilegedIOExceptionAction(new PrivilegedExceptionAction<Object>()
- {
- public Object run() throws Exception
- {
- getIndexWriter().addIndexes(readers);
- getIndexWriter().optimize();
- return null;
- }
- });
+ getIndexWriter().addIndexes(readers);
+ getIndexWriter().optimize();
}
/**
@@ -121,47 +105,40 @@
*/
void copyIndex(final AbstractIndex index) throws IOException
{
- SecurityHelper.doPrivilegedIOExceptionAction(new PrivilegedExceptionAction<Object>()
+ // commit changes to directory on other index.
+ index.commit(true);
+ // simply copy over the files
+ byte[] buffer = new byte[1024];
+ Directory dir = index.getDirectory();
+ Directory dest = getDirectory();
+ String[] files = dir.list();
+ for (int i = 0; i < files.length; i++)
{
- public Object run() throws Exception
+ IndexInput in = dir.openInput(files[i]);
+ try
{
- // commit changes to directory on other index.
- index.commit(true);
- // simply copy over the files
- byte[] buffer = new byte[1024];
- Directory dir = index.getDirectory();
- Directory dest = getDirectory();
- String[] files = dir.list();
- for (int i = 0; i < files.length; i++)
+ IndexOutput out = dest.createOutput(files[i]);
+ try
{
- IndexInput in = dir.openInput(files[i]);
- try
+ long remaining = in.length();
+ while (remaining > 0)
{
- IndexOutput out = dest.createOutput(files[i]);
- try
- {
- long remaining = in.length();
- while (remaining > 0)
- {
- int num = (int)Math.min(remaining, buffer.length);
- in.readBytes(buffer, 0, num);
- out.writeBytes(buffer, num);
- remaining -= num;
- }
- }
- finally
- {
- out.close();
- }
+ int num = (int)Math.min(remaining, buffer.length);
+ in.readBytes(buffer, 0, num);
+ out.writeBytes(buffer, num);
+ remaining -= num;
}
- finally
- {
- in.close();
- }
}
- return null;
+ finally
+ {
+ out.close();
+ }
}
- });
+ finally
+ {
+ in.close();
+ }
+ }
}
/**
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/SearchIndex.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/SearchIndex.java 2011-07-14 10:11:06 UTC (rev 4631)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/SearchIndex.java 2011-07-14 11:25:59 UTC (rev 4632)
@@ -76,8 +76,6 @@
import java.io.IOException;
import java.io.InputStream;
import java.security.PrivilegedAction;
-import java.security.PrivilegedActionException;
-import java.security.PrivilegedExceptionAction;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
@@ -585,39 +583,13 @@
{
indexDirectory = new File(path);
- try
- {
- SecurityHelper.doPrivilegedExceptionAction((new PrivilegedExceptionAction<Object>()
+ if (!indexDirectory.exists())
{
- public Object run() throws Exception
+ if (!indexDirectory.mkdirs())
{
- if (!indexDirectory.exists())
- {
- if (!indexDirectory.mkdirs())
- {
- throw new RepositoryException("fail to create index dir " + path);
- }
- }
- return null;
+ throw new RepositoryException("fail to create index dir " + path);
}
- }));
- }
- catch (PrivilegedActionException pae)
- {
- Throwable cause = pae.getCause();
- if (cause instanceof RepositoryException)
- {
- throw (RepositoryException)cause;
}
- else if (cause instanceof RuntimeException)
- {
- throw (RuntimeException)cause;
- }
- else
- {
- throw new RuntimeException(cause);
- }
- }
}
else
{
@@ -644,16 +616,9 @@
else
{
// read local namespace mappings
- final File mapFile = new File(indexDirectory, NS_MAPPING_FILE);
- boolean fileExists = SecurityHelper.doPrivilegedAction(new PrivilegedAction<Boolean>()
+ File mapFile = new File(indexDirectory, NS_MAPPING_FILE);
+ if (mapFile.exists())
{
- public Boolean run()
- {
- return mapFile.exists();
- }
- });
- if (fileExists)
- {
// be backward compatible and use ns_mappings.properties from
// index folder
nsMappings = new FileBasedNamespaceMappings(mapFile);
@@ -1597,15 +1562,8 @@
{
try
{
- spCheck = SecurityHelper.doPrivilegedIOExceptionAction(new PrivilegedExceptionAction<SpellChecker>()
- {
- public SpellChecker run() throws Exception
- {
- SpellChecker spCheck = spellCheckerClass.newInstance();
- spCheck.init(SearchIndex.this, spellCheckerMinDistance, spellCheckerMorePopular);
- return spCheck;
- }
- });
+ spCheck = spellCheckerClass.newInstance();
+ spCheck.init(SearchIndex.this, spellCheckerMinDistance, spellCheckerMorePopular);
}
catch (Exception e)
{
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/Util.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/Util.java 2011-07-14 10:11:06 UTC (rev 4631)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/Util.java 2011-07-14 11:25:59 UTC (rev 4632)
@@ -21,7 +21,6 @@
import org.apache.lucene.index.IndexReader;
import org.apache.lucene.index.Term;
import org.apache.lucene.search.Query;
-import org.exoplatform.commons.utils.SecurityHelper;
import org.exoplatform.services.jcr.datamodel.IllegalNameException;
import org.exoplatform.services.jcr.datamodel.QPathEntry;
import org.exoplatform.services.jcr.datamodel.ValueData;
@@ -31,7 +30,6 @@
import java.io.IOException;
import java.io.UnsupportedEncodingException;
-import java.security.PrivilegedExceptionAction;
import java.util.Iterator;
import java.util.regex.Pattern;
@@ -151,21 +149,14 @@
*/
public static void closeOrRelease(final IndexReader reader) throws IOException
{
- SecurityHelper.doPrivilegedIOExceptionAction(new PrivilegedExceptionAction<Object>()
+ if (reader instanceof ReleaseableIndexReader)
{
- public Object run() throws Exception
- {
- if (reader instanceof ReleaseableIndexReader)
- {
- ((ReleaseableIndexReader)reader).release();
- }
- else
- {
- reader.close();
- }
- return null;
- }
- });
+ ((ReleaseableIndexReader)reader).release();
+ }
+ else
+ {
+ reader.close();
+ }
}
/**
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/VolatileIndex.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/VolatileIndex.java 2011-07-14 10:11:06 UTC (rev 4631)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/VolatileIndex.java 2011-07-14 11:25:59 UTC (rev 4632)
@@ -16,9 +16,6 @@
*/
package org.exoplatform.services.jcr.impl.core.query.lucene;
-import java.io.IOException;
-import java.util.Map;
-
import org.apache.commons.collections.map.LinkedMap;
import org.apache.lucene.analysis.Analyzer;
import org.apache.lucene.document.Document;
@@ -26,6 +23,9 @@
import org.apache.lucene.search.Similarity;
import org.apache.lucene.store.RAMDirectory;
+import java.io.IOException;
+import java.util.Map;
+
/**
* Implements an in-memory index with a pending buffer.
*/
@@ -114,7 +114,7 @@
else
{
// remove document from index
- num = super.removeDocument(idTerm);
+ num = super.getIndexReader().deleteDocuments(idTerm);
}
numDocs -= num;
return num;
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/spell/LuceneSpellChecker.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/spell/LuceneSpellChecker.java 2011-07-14 10:11:06 UTC (rev 4631)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/spell/LuceneSpellChecker.java 2011-07-14 11:25:59 UTC (rev 4632)
@@ -506,9 +506,16 @@
try
{
long time = System.currentTimeMillis();
- Dictionary dict = new LuceneDictionary(reader, FieldNames.FULLTEXT);
+ final Dictionary dict = new LuceneDictionary(reader, FieldNames.FULLTEXT);
log.debug("Starting spell checker index refresh");
- spellChecker.indexDictionary(dict);
+ SecurityHelper.doPrivilegedIOExceptionAction(new PrivilegedExceptionAction<Void>()
+ {
+ public Void run() throws IOException
+ {
+ spellChecker.indexDictionary(dict);
+ return null;
+ }
+ });
time = System.currentTimeMillis() - time;
time = time / 1000;
log.info("Spell checker index refreshed in: " + new Long(time) + " s.");
14 years, 9 months
exo-jcr SVN: r4631 - kernel/trunk/exo.kernel.commons.test/src/main/java/org/exoplatform/commons/test.
by do-not-reply@jboss.org
Author: dkuleshov
Date: 2011-07-14 06:11:06 -0400 (Thu, 14 Jul 2011)
New Revision: 4631
Modified:
kernel/trunk/exo.kernel.commons.test/src/main/java/org/exoplatform/commons/test/TestSecurityManager.java
Log:
EXOJCR-1429: small fix
Modified: kernel/trunk/exo.kernel.commons.test/src/main/java/org/exoplatform/commons/test/TestSecurityManager.java
===================================================================
--- kernel/trunk/exo.kernel.commons.test/src/main/java/org/exoplatform/commons/test/TestSecurityManager.java 2011-07-14 09:11:41 UTC (rev 4630)
+++ kernel/trunk/exo.kernel.commons.test/src/main/java/org/exoplatform/commons/test/TestSecurityManager.java 2011-07-14 10:11:06 UTC (rev 4631)
@@ -114,11 +114,14 @@
}
// Only for debug purpose
- // if (!se.getMessage().equals(
- // "access denied (java.lang.RuntimePermission.com.sun.xml.internal.bind.v2.runtime.reflect)"))
+ // if (!se
+ // .getMessage()
+ // .equals(
+ // "access denied (java.lang.RuntimePermission accessClassInPackage.com.sun.xml.internal.bind.v2.runtime.reflect)"))
// {
// se.printStackTrace();
// }
+
throw se;
}
}
14 years, 9 months
exo-jcr SVN: r4630 - kernel/trunk/exo.kernel.component.common/src/main/java/org/exoplatform/services/naming.
by do-not-reply@jboss.org
Author: tolusha
Date: 2011-07-14 05:11:41 -0400 (Thu, 14 Jul 2011)
New Revision: 4630
Modified:
kernel/trunk/exo.kernel.component.common/src/main/java/org/exoplatform/services/naming/InitialContextInitializer.java
Log:
EXOJCR-1425: Close all database connections, Bind datasources after context is replaced
Modified: kernel/trunk/exo.kernel.component.common/src/main/java/org/exoplatform/services/naming/InitialContextInitializer.java
===================================================================
--- kernel/trunk/exo.kernel.component.common/src/main/java/org/exoplatform/services/naming/InitialContextInitializer.java 2011-07-14 08:38:04 UTC (rev 4629)
+++ kernel/trunk/exo.kernel.component.common/src/main/java/org/exoplatform/services/naming/InitialContextInitializer.java 2011-07-14 09:11:41 UTC (rev 4630)
@@ -118,16 +118,6 @@
ValueParam bindingStorePathParam = params.getValueParam(BINDINGS_STORE_PATH);
- // binder
- if (bindingStorePathParam == null)
- {
- binder = new InitialContextBinder(this, DEFAULT_BINDING_STORE_PATH);
- }
- else
- {
- binder = new InitialContextBinder(this, bindingStorePathParam.getValue());
- }
-
if (LOG.isDebugEnabled())
{
LOG.debug("The default initial context factory is " + DEFAULT_INITIAL_CONTEXT_FACTORY);
@@ -140,6 +130,16 @@
.setProperty(Context.INITIAL_CONTEXT_FACTORY, ExoContainerContextFactory.class.getName());
}
+
+ // binder
+ if (bindingStorePathParam == null)
+ {
+ binder = new InitialContextBinder(this, DEFAULT_BINDING_STORE_PATH);
+ }
+ else
+ {
+ binder = new InitialContextBinder(this, bindingStorePathParam.getValue());
+ }
}
private void setSystemProperty(String propName, String propValue, String propParamName)
14 years, 9 months
exo-jcr SVN: r4629 - in jcr/branches/1.12.x/patch/1.12.10-GA: JCR-1649 and 1 other directory.
by do-not-reply@jboss.org
Author: sergiykarpenko
Date: 2011-07-14 04:38:04 -0400 (Thu, 14 Jul 2011)
New Revision: 4629
Added:
jcr/branches/1.12.x/patch/1.12.10-GA/JCR-1649/
jcr/branches/1.12.x/patch/1.12.10-GA/JCR-1649/JCR-1649.patch
Log:
JCR-1649: patch proposed
Added: jcr/branches/1.12.x/patch/1.12.10-GA/JCR-1649/JCR-1649.patch
===================================================================
--- jcr/branches/1.12.x/patch/1.12.10-GA/JCR-1649/JCR-1649.patch (rev 0)
+++ jcr/branches/1.12.x/patch/1.12.10-GA/JCR-1649/JCR-1649.patch 2011-07-14 08:38:04 UTC (rev 4629)
@@ -0,0 +1,211 @@
+Index: exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/LuceneQueryHits.java
+===================================================================
+--- exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/LuceneQueryHits.java (revision 4627)
++++ exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/LuceneQueryHits.java (working copy)
+@@ -23,67 +23,98 @@
+
+ import java.io.IOException;
+
+-
+ /**
+ * Wraps a lucene query result and adds a close method that allows to release
+ * resources after a query has been executed and the results have been read
+ * completely.
+ */
+-public class LuceneQueryHits implements QueryHits {
++public class LuceneQueryHits implements QueryHits
++{
+
+- /**
+- * The IndexReader in use by the lucene hits.
+- */
+- private final IndexReader reader;
++ /**
++ * The IndexReader in use by the lucene hits.
++ */
++ private final IndexReader reader;
+
+- /**
+- * The scorer for the query.
+- */
+- private final Scorer scorer;
++ /**
++ * The scorer for the query.
++ */
++ private final Scorer scorer;
+
+- public LuceneQueryHits(IndexReader reader,
+- IndexSearcher searcher,
+- Query query)
+- throws IOException {
+- this.reader = reader;
+- this.scorer = query.weight(searcher).scorer(reader);
+- }
++ /**
++ * Release IndexReader on LuceneQueryHits.close().
++ */
++ private final boolean releaseReaderOnClose;
+
+- /**
+- * {@inheritDoc}
+- */
+- public ScoreNode nextScoreNode() throws IOException {
+- if (!scorer.next()) {
+- return null;
+- }
+- int doc = scorer.doc();
+- String uuid = reader.document(doc).get(FieldNames.UUID);
+- return new ScoreNode(uuid, scorer.score(), doc);
+- }
++ public LuceneQueryHits(IndexReader reader, IndexSearcher searcher, Query query) throws IOException
++ {
++ this(reader, searcher, query, false);
++ }
+
+- /**
+- * {@inheritDoc}
+- */
+- public void close() throws IOException {
+- // make sure scorer frees resources
+- scorer.skipTo(Integer.MAX_VALUE);
+- }
++ /**
++ * Constructor.
++ *
++ * @param reader IndexReader
++ * @param searcher IndexSearcher
++ * @param query Query
++ * @param releaseReaderOnClose - release IndexReader on LuceneQueryHits.close().
++ * @throws IOException
++ */
++ public LuceneQueryHits(IndexReader reader, IndexSearcher searcher, Query query, boolean releaseReaderOnClose)
++ throws IOException
++ {
++ this.reader = reader;
++ this.scorer = query.weight(searcher).scorer(reader);
++ this.releaseReaderOnClose = releaseReaderOnClose;
++ }
+
+- /**
+- * @return always -1.
+- */
+- public int getSize() {
+- return -1;
+- }
++ /**
++ * {@inheritDoc}
++ */
++ public ScoreNode nextScoreNode() throws IOException
++ {
++ if (!scorer.next())
++ {
++ return null;
++ }
++ int doc = scorer.doc();
++ String uuid = reader.document(doc).get(FieldNames.UUID);
++ return new ScoreNode(uuid, scorer.score(), doc);
++ }
+
+- /**
+- * {@inheritDoc}
+- */
+- public void skip(int n) throws IOException {
+- while (n-- > 0) {
+- if (nextScoreNode() == null) {
+- return;
+- }
+- }
+- }
++ /**
++ * {@inheritDoc}
++ */
++ public void close() throws IOException
++ {
++ // make sure scorer frees resources
++ scorer.skipTo(Integer.MAX_VALUE);
++
++ if (releaseReaderOnClose && reader != null && reader instanceof ReleaseableIndexReader)
++ {
++ ((ReleaseableIndexReader)reader).release();
++ }
++ }
++
++ /**
++ * @return always -1.
++ */
++ public int getSize()
++ {
++ return -1;
++ }
++
++ /**
++ * {@inheritDoc}
++ */
++ public void skip(int n) throws IOException
++ {
++ while (n-- > 0)
++ {
++ if (nextScoreNode() == null)
++ {
++ return;
++ }
++ }
++ }
+ }
+Index: exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/SearchIndex.java
+===================================================================
+--- exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/SearchIndex.java (revision 4627)
++++ exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/SearchIndex.java (working copy)
+@@ -2716,7 +2716,7 @@
+ IndexSearcher searcher = new IndexSearcher(reader);
+ searcher.setSimilarity(getSimilarity());
+
+- return new LuceneQueryHits(reader, searcher, query);
++ return new LuceneQueryHits(reader, searcher, query, true);
+ }
+
+ /**
+Index: exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/SearchManager.java
+===================================================================
+--- exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/SearchManager.java (revision 4627)
++++ exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/SearchManager.java (working copy)
+@@ -756,9 +756,10 @@
+ private Set<String> getNodes(final org.apache.lucene.search.Query query) throws RepositoryException
+ {
+ Set<String> result = new HashSet<String>();
++ QueryHits hits = null;
+ try
+ {
+- QueryHits hits = handler.executeQuery(query);
++ hits = handler.executeQuery(query);
+
+ ScoreNode sn;
+
+@@ -767,12 +768,26 @@
+ // Node node = session.getNodeById(sn.getNodeId());
+ result.add(sn.getNodeId());
+ }
++ return result;
+ }
+ catch (IOException e)
+ {
+ throw new RepositoryException(e.getLocalizedMessage(), e);
+ }
+- return result;
++ finally
++ {
++ if (hits != null)
++ {
++ try
++ {
++ hits.close();
++ }
++ catch (IOException e)
++ {
++ log.error("Can not close QueryHits.", e);
++ }
++ }
++ }
+ }
+
+ private boolean isPrefixMatch(final InternalQName value, final String prefix) throws RepositoryException
14 years, 9 months
exo-jcr SVN: r4628 - jcr/trunk/exo.jcr.component.core/src/test/resources/conf/standalone.
by do-not-reply@jboss.org
Author: tolusha
Date: 2011-07-14 04:22:45 -0400 (Thu, 14 Jul 2011)
New Revision: 4628
Modified:
jcr/trunk/exo.jcr.component.core/src/test/resources/conf/standalone/test-configuration-sjdbc-jbc.xml
jcr/trunk/exo.jcr.component.core/src/test/resources/conf/standalone/test-configuration-sjdbc.xml
Log:
EXOJCR-1425: Close all database connections, Fix conf
Modified: jcr/trunk/exo.jcr.component.core/src/test/resources/conf/standalone/test-configuration-sjdbc-jbc.xml
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/test/resources/conf/standalone/test-configuration-sjdbc-jbc.xml 2011-07-13 14:57:01 UTC (rev 4627)
+++ jcr/trunk/exo.jcr.component.core/src/test/resources/conf/standalone/test-configuration-sjdbc-jbc.xml 2011-07-14 08:22:45 UTC (rev 4628)
@@ -253,6 +253,7 @@
<property name="url" value="jdbc:hsqldb:file:target/temp/data/portal;hsqldb.tx=mvcc"/>
<property name="username" value="sa"/>
<property name="password" value=""/>
+ <property name="maxActive" value="20" />
</properties-param>
</init-params>
</component-plugin>
Modified: jcr/trunk/exo.jcr.component.core/src/test/resources/conf/standalone/test-configuration-sjdbc.xml
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/test/resources/conf/standalone/test-configuration-sjdbc.xml 2011-07-13 14:57:01 UTC (rev 4627)
+++ jcr/trunk/exo.jcr.component.core/src/test/resources/conf/standalone/test-configuration-sjdbc.xml 2011-07-14 08:22:45 UTC (rev 4628)
@@ -253,6 +253,7 @@
<property name="url" value="jdbc:hsqldb:file:target/temp/data/portal;hsqldb.tx=mvcc"/>
<property name="username" value="sa"/>
<property name="password" value=""/>
+ <property name="maxActive" value="20" />
</properties-param>
</init-params>
</component-plugin>
14 years, 9 months