diff --git a/config/alfresco/import-export-context.xml b/config/alfresco/import-export-context.xml
index 8b904e2014..66e4987505 100644
--- a/config/alfresco/import-export-context.xml
+++ b/config/alfresco/import-export-context.xml
@@ -166,7 +166,7 @@
${version.store.version2Store}
- versions
+ versions2
diff --git a/config/alfresco/node-services-context.xml b/config/alfresco/node-services-context.xml
index 678d6e0d79..954bc8794c 100644
--- a/config/alfresco/node-services-context.xml
+++ b/config/alfresco/node-services-context.xml
@@ -126,6 +126,9 @@
+
+
+
true
diff --git a/source/java/org/alfresco/repo/node/integrity/IntegrityChecker.java b/source/java/org/alfresco/repo/node/integrity/IntegrityChecker.java
index affd8e1bef..998d749805 100644
--- a/source/java/org/alfresco/repo/node/integrity/IntegrityChecker.java
+++ b/source/java/org/alfresco/repo/node/integrity/IntegrityChecker.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2005-2007 Alfresco Software Limited.
+ * Copyright (C) 2005-2008 Alfresco Software Limited.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -34,6 +34,7 @@ import java.util.Map;
import org.alfresco.repo.node.NodeServicePolicies;
import org.alfresco.repo.policy.JavaBehaviour;
import org.alfresco.repo.policy.PolicyComponent;
+import org.alfresco.repo.tenant.TenantService;
import org.alfresco.repo.transaction.AlfrescoTransactionSupport;
import org.alfresco.repo.transaction.RetryingTransactionHelper;
import org.alfresco.service.cmr.dictionary.AspectDefinition;
@@ -103,6 +104,7 @@ public class IntegrityChecker
private PolicyComponent policyComponent;
private DictionaryService dictionaryService;
private NodeService nodeService;
+ private TenantService tenantService;
private boolean enabled;
private boolean failOnViolation;
private int maxErrorsPerTransaction;
@@ -172,6 +174,11 @@ public class IntegrityChecker
{
this.nodeService = nodeService;
}
+
+ public void setTenantService(TenantService tenantService)
+ {
+ this.tenantService = tenantService;
+ }
/**
* @param enabled set to false to disable integrity checking completely
@@ -330,7 +337,7 @@ public class IntegrityChecker
public void onCreateNode(ChildAssociationRef childAssocRef)
{
NodeRef childRef = childAssocRef.getChildRef();
- if (! storesToIgnore.contains(childRef.getStoreRef().toString()))
+ if (! storesToIgnore.contains(tenantService.getBaseName(childRef.getStoreRef()).toString()))
{
IntegrityEvent event = null;
// check properties on child node
@@ -380,7 +387,7 @@ public class IntegrityChecker
Map before,
Map after)
{
- if (! storesToIgnore.contains(nodeRef.getStoreRef().toString()))
+ if (! storesToIgnore.contains(tenantService.getBaseName(nodeRef.getStoreRef()).toString()))
{
IntegrityEvent event = null;
// check properties on node
@@ -402,7 +409,7 @@ public class IntegrityChecker
*/
public void onAddAspect(NodeRef nodeRef, QName aspectTypeQName)
{
- if (! storesToIgnore.contains(nodeRef.getStoreRef().toString()))
+ if (! storesToIgnore.contains(tenantService.getBaseName(nodeRef.getStoreRef()).toString()))
{
IntegrityEvent event = null;
// check properties on node
@@ -438,7 +445,7 @@ public class IntegrityChecker
*/
public void onRemoveAspect(NodeRef nodeRef, QName aspectTypeQName)
{
- if (! storesToIgnore.contains(nodeRef.getStoreRef().toString()))
+ if (! storesToIgnore.contains(tenantService.getBaseName(nodeRef.getStoreRef()).toString()))
{
IntegrityEvent event = null;
// check mandatory aspects
@@ -463,7 +470,7 @@ public class IntegrityChecker
return;
}
- if (! storesToIgnore.contains(childAssocRef.getChildRef().getStoreRef().toString()))
+ if (! storesToIgnore.contains(tenantService.getBaseName(childAssocRef.getChildRef().getStoreRef()).toString()))
{
IntegrityEvent event = null;
// check source type
@@ -513,7 +520,7 @@ public class IntegrityChecker
*/
public void onDeleteChildAssociation(ChildAssociationRef childAssocRef)
{
- if (! storesToIgnore.contains(childAssocRef.getChildRef().getStoreRef().toString()))
+ if (! storesToIgnore.contains(tenantService.getBaseName(childAssocRef.getChildRef().getStoreRef()).toString()))
{
IntegrityEvent event = null;
// check source multiplicity
@@ -543,7 +550,7 @@ public class IntegrityChecker
*/
public void onCreateAssociation(AssociationRef nodeAssocRef)
{
- if (! storesToIgnore.contains(nodeAssocRef.getSourceRef().getStoreRef().toString()))
+ if (! storesToIgnore.contains(tenantService.getBaseName(nodeAssocRef.getSourceRef().getStoreRef()).toString()))
{
IntegrityEvent event = null;
// check source type
@@ -585,7 +592,7 @@ public class IntegrityChecker
*/
public void onDeleteAssociation(AssociationRef nodeAssocRef)
{
- if (! storesToIgnore.contains(nodeAssocRef.getSourceRef().getStoreRef().toString()))
+ if (! storesToIgnore.contains(tenantService.getBaseName(nodeAssocRef.getSourceRef().getStoreRef()).toString()))
{
IntegrityEvent event = null;
// check source multiplicity
diff --git a/source/java/org/alfresco/repo/tenant/MultiTAdminServiceImpl.java b/source/java/org/alfresco/repo/tenant/MultiTAdminServiceImpl.java
index 6e31eef93c..d79e25a07c 100755
--- a/source/java/org/alfresco/repo/tenant/MultiTAdminServiceImpl.java
+++ b/source/java/org/alfresco/repo/tenant/MultiTAdminServiceImpl.java
@@ -200,7 +200,8 @@ public class MultiTAdminServiceImpl implements TenantAdminService, ApplicationCo
public static final String PROTOCOL_STORE_ARCHIVE = "archive";
public static final String STORE_BASE_ID_USER = "alfrescoUserStore";
public static final String STORE_BASE_ID_SYSTEM = "system";
- public static final String STORE_BASE_ID_VERSION = "lightWeightVersionStore";
+ public static final String STORE_BASE_ID_VERSION1 = "lightWeightVersionStore"; // deprecated
+ public static final String STORE_BASE_ID_VERSION2 = "version2Store";
public static final String STORE_BASE_ID_SPACES = "SpacesStore";
@@ -338,8 +339,12 @@ public class MultiTAdminServiceImpl implements TenantAdminService, ApplicationCo
ImporterBootstrap systemImporterBootstrap = (ImporterBootstrap)ctx.getBean("systemBootstrap");
bootstrapSystemTenantStore(systemImporterBootstrap, tenantDomain);
+ // deprecated
ImporterBootstrap versionImporterBootstrap = (ImporterBootstrap)ctx.getBean("versionBootstrap");
bootstrapVersionTenantStore(versionImporterBootstrap, tenantDomain);
+
+ ImporterBootstrap version2ImporterBootstrap = (ImporterBootstrap)ctx.getBean("version2Bootstrap");
+ bootstrapVersionTenantStore(version2ImporterBootstrap, tenantDomain);
ImporterBootstrap spacesArchiveImporterBootstrap = (ImporterBootstrap)ctx.getBean("spacesArchiveBootstrap");
bootstrapSpacesArchiveTenantStore(spacesArchiveImporterBootstrap, tenantDomain);
@@ -648,7 +653,8 @@ public class MultiTAdminServiceImpl implements TenantAdminService, ApplicationCo
// delete tenant-specific stores
nodeService.deleteStore(tenantService.getName(tenantAdminUser, new StoreRef(PROTOCOL_STORE_WORKSPACE, STORE_BASE_ID_SPACES)));
nodeService.deleteStore(tenantService.getName(tenantAdminUser, new StoreRef(PROTOCOL_STORE_ARCHIVE, STORE_BASE_ID_SPACES)));
- nodeService.deleteStore(tenantService.getName(tenantAdminUser, new StoreRef(PROTOCOL_STORE_WORKSPACE, STORE_BASE_ID_VERSION)));
+ nodeService.deleteStore(tenantService.getName(tenantAdminUser, new StoreRef(PROTOCOL_STORE_WORKSPACE, STORE_BASE_ID_VERSION1)));
+ nodeService.deleteStore(tenantService.getName(tenantAdminUser, new StoreRef(PROTOCOL_STORE_WORKSPACE, STORE_BASE_ID_VERSION2)));
nodeService.deleteStore(tenantService.getName(tenantAdminUser, new StoreRef(PROTOCOL_STORE_SYSTEM, STORE_BASE_ID_SYSTEM)));
nodeService.deleteStore(tenantService.getName(tenantAdminUser, new StoreRef(PROTOCOL_STORE_USER, STORE_BASE_ID_USER)));
@@ -701,7 +707,7 @@ public class MultiTAdminServiceImpl implements TenantAdminService, ApplicationCo
}
private void importBootstrapSystemTenantStore(String tenantDomain, File directorySource)
- {
+ {
// Import Bootstrap (restore) Tenant-Specific Version Store
Properties bootstrapView = new Properties();
bootstrapView.put("path", "/");
@@ -720,7 +726,8 @@ public class MultiTAdminServiceImpl implements TenantAdminService, ApplicationCo
private void bootstrapSystemTenantStore(ImporterBootstrap systemImporterBootstrap, String tenantDomain)
{
// Bootstrap Tenant-Specific System Store
- StoreRef bootstrapStoreRef = new StoreRef(PROTOCOL_STORE_SYSTEM, tenantService.getName(STORE_BASE_ID_SYSTEM, tenantDomain));
+ StoreRef bootstrapStoreRef = systemImporterBootstrap.getStoreRef();
+ bootstrapStoreRef = new StoreRef(bootstrapStoreRef.getProtocol(), tenantService.getName(bootstrapStoreRef.getIdentifier(), tenantDomain));
systemImporterBootstrap.setStoreUrl(bootstrapStoreRef.toString());
// override default property (workspace://SpacesStore)
@@ -734,7 +741,7 @@ public class MultiTAdminServiceImpl implements TenantAdminService, ApplicationCo
}
private void importBootstrapUserTenantStore(String tenantDomain, File directorySource)
- {
+ {
// Import Bootstrap (restore) Tenant-Specific User Store
Properties bootstrapView = new Properties();
bootstrapView.put("path", "/");
@@ -751,9 +758,10 @@ public class MultiTAdminServiceImpl implements TenantAdminService, ApplicationCo
}
private void bootstrapUserTenantStore(ImporterBootstrap userImporterBootstrap, String tenantDomain, char[] tenantAdminRawPassword)
- {
+ {
// Bootstrap Tenant-Specific User Store
- StoreRef bootstrapStoreRef = new StoreRef(PROTOCOL_STORE_USER, tenantService.getName(STORE_BASE_ID_USER, tenantDomain));
+ StoreRef bootstrapStoreRef = userImporterBootstrap.getStoreRef();
+ bootstrapStoreRef = new StoreRef(bootstrapStoreRef.getProtocol(), tenantService.getName(bootstrapStoreRef.getIdentifier(), tenantDomain));
userImporterBootstrap.setStoreUrl(bootstrapStoreRef.toString());
// override admin username property
@@ -772,11 +780,11 @@ public class MultiTAdminServiceImpl implements TenantAdminService, ApplicationCo
}
private void importBootstrapVersionTenantStore(String tenantDomain, File directorySource)
- {
+ {
// Import Bootstrap (restore) Tenant-Specific Version Store
Properties bootstrapView = new Properties();
bootstrapView.put("path", "/");
- bootstrapView.put("location", directorySource.getPath()+"/"+tenantDomain+"_versions.acp");
+ bootstrapView.put("location", directorySource.getPath()+"/"+tenantDomain+"_versions2.acp");
List bootstrapViews = new ArrayList(1);
bootstrapViews.add(bootstrapView);
@@ -791,7 +799,8 @@ public class MultiTAdminServiceImpl implements TenantAdminService, ApplicationCo
private void bootstrapVersionTenantStore(ImporterBootstrap versionImporterBootstrap, String tenantDomain)
{
// Bootstrap Tenant-Specific Version Store
- StoreRef bootstrapStoreRef = new StoreRef(PROTOCOL_STORE_WORKSPACE, tenantService.getName(STORE_BASE_ID_VERSION, tenantDomain));
+ StoreRef bootstrapStoreRef = versionImporterBootstrap.getStoreRef();
+ bootstrapStoreRef = new StoreRef(bootstrapStoreRef.getProtocol(), tenantService.getName(bootstrapStoreRef.getIdentifier(), tenantDomain));
versionImporterBootstrap.setStoreUrl(bootstrapStoreRef.toString());
versionImporterBootstrap.bootstrap();
@@ -800,7 +809,7 @@ public class MultiTAdminServiceImpl implements TenantAdminService, ApplicationCo
}
private void importBootstrapSpacesArchiveTenantStore(String tenantDomain, File directorySource)
- {
+ {
// Import Bootstrap (restore) Tenant-Specific Spaces Archive Store
Properties bootstrapView = new Properties();
bootstrapView.put("path", "/");
@@ -818,13 +827,14 @@ public class MultiTAdminServiceImpl implements TenantAdminService, ApplicationCo
private void bootstrapSpacesArchiveTenantStore(ImporterBootstrap spacesArchiveImporterBootstrap, String tenantDomain)
{
- // Bootstrap Tenant-Specific Spaces Archive Store
- StoreRef bootstrapStoreRef = new StoreRef(PROTOCOL_STORE_ARCHIVE, tenantService.getName(STORE_BASE_ID_SPACES, tenantDomain));
+ // Bootstrap Tenant-Specific Spaces Archive Store
+ StoreRef bootstrapStoreRef = spacesArchiveImporterBootstrap.getStoreRef();
+ bootstrapStoreRef = new StoreRef(bootstrapStoreRef.getProtocol(), tenantService.getName(bootstrapStoreRef.getIdentifier(), tenantDomain));
spacesArchiveImporterBootstrap.setStoreUrl(bootstrapStoreRef.toString());
// override default property (archive://SpacesStore)
List mustNotExistStoreUrls = new ArrayList();
- mustNotExistStoreUrls.add(new StoreRef(PROTOCOL_STORE_ARCHIVE, tenantService.getName(STORE_BASE_ID_SPACES, tenantDomain)).toString());
+ mustNotExistStoreUrls.add(bootstrapStoreRef.toString());
spacesArchiveImporterBootstrap.setMustNotExistStoreUrls(mustNotExistStoreUrls);
spacesArchiveImporterBootstrap.bootstrap();
@@ -833,7 +843,7 @@ public class MultiTAdminServiceImpl implements TenantAdminService, ApplicationCo
}
private void importBootstrapSpacesModelsTenantStore(String tenantDomain, File directorySource)
- {
+ {
// Import Bootstrap (restore) Tenant-Specific Spaces Store
Properties bootstrapView = new Properties();
bootstrapView.put("path", "/");
@@ -850,7 +860,7 @@ public class MultiTAdminServiceImpl implements TenantAdminService, ApplicationCo
}
private void importBootstrapSpacesTenantStore(String tenantDomain, File directorySource)
- {
+ {
// Import Bootstrap (restore) Tenant-Specific Spaces Store
Properties bootstrapView = new Properties();
bootstrapView.put("path", "/");
@@ -871,8 +881,9 @@ public class MultiTAdminServiceImpl implements TenantAdminService, ApplicationCo
private void bootstrapSpacesTenantStore(ImporterBootstrap spacesImporterBootstrap, String tenantDomain)
{
- // Bootstrap Tenant-Specific Spaces Store
- StoreRef bootstrapStoreRef = new StoreRef(PROTOCOL_STORE_WORKSPACE, tenantService.getName(STORE_BASE_ID_SPACES, tenantDomain));
+ // Bootstrap Tenant-Specific Spaces Store
+ StoreRef bootstrapStoreRef = spacesImporterBootstrap.getStoreRef();
+ bootstrapStoreRef = new StoreRef(bootstrapStoreRef.getProtocol(), tenantService.getName(bootstrapStoreRef.getIdentifier(), tenantDomain));
spacesImporterBootstrap.setStoreUrl(bootstrapStoreRef.toString());
// override admin username property
@@ -1156,6 +1167,11 @@ public class MultiTAdminServiceImpl implements TenantAdminService, ApplicationCo
return tenantService.getUserDomain(username);
}
+ public String getBaseNameUser(String username)
+ {
+ return tenantService.getBaseNameUser(username);
+ }
+
public String getDomainUser(String baseUsername, String tenantDomain)
{
return tenantService.getDomainUser(baseUsername, tenantDomain);
diff --git a/source/java/org/alfresco/repo/tenant/MultiTDemoTest.java b/source/java/org/alfresco/repo/tenant/MultiTDemoTest.java
index e1e4bdd9be..26a80eac8e 100644
--- a/source/java/org/alfresco/repo/tenant/MultiTDemoTest.java
+++ b/source/java/org/alfresco/repo/tenant/MultiTDemoTest.java
@@ -105,6 +105,7 @@ public class MultiTDemoTest extends TestCase
public static final String TEST_USER2 = "bob";
public static final String TEST_USER3 = "eve";
+ private static final int DEFAULT_DM_STORE_COUNT = 6;
public static StoreRef SPACES_STORE = new StoreRef(StoreRef.PROTOCOL_WORKSPACE, "SpacesStore");
@@ -348,7 +349,7 @@ public class MultiTDemoTest extends TestCase
}
}
- public void testCreateUserContent()
+ public void testCreateVersionableUserContent()
{
logger.info("Create demo content");
@@ -370,11 +371,14 @@ public class MultiTDemoTest extends TestCase
public Object doWork() throws Exception
{
NodeRef homeSpaceRef = getHomeSpaceFolderNode(tenantUserName);
- addTextContent(homeSpaceRef, tenantUserName+" quick brown fox.txt", "The quick brown fox jumps over the lazy dog (tenant " + tenantDomain + ")");
+
+ NodeRef contentRef = addTextContent(homeSpaceRef, tenantUserName+" quick brown fox.txt", "The quick brown fox jumps over the lazy dog (tenant " + tenantDomain + ")");
+ nodeService.addAspect(contentRef, ContentModel.ASPECT_VERSIONABLE, null);
if (tenantDomain.equals(TEST_TENANT_DOMAIN2))
{
- addTextContent(homeSpaceRef, tenantUserName+" quick brown fox ANO.txt", "The quick brown fox jumps over the lazy dog ANO (tenant " + tenantDomain + ")");
+ contentRef = addTextContent(homeSpaceRef, tenantUserName+" quick brown fox ANO.txt", "The quick brown fox jumps over the lazy dog ANO (tenant " + tenantDomain + ")");
+ nodeService.addAspect(contentRef, ContentModel.ASPECT_VERSIONABLE, null);
}
return null;
@@ -389,8 +393,27 @@ public class MultiTDemoTest extends TestCase
{
logger.info("Get tenant stores");
- // super tenant
- assertTrue("Super tenant: ", (nodeService.getStores().size() >= 5));
+ // system
+ AuthenticationUtil.runAs(new RunAsWork