Merged V3.2 to HEAD

15608: Merged V3.1 to V3.2
      14111: MT - fix ETHREEOH-914 (tenant domain mismatch in getting workflow pooled tasks)
      14855: MT - minor fix to result set (for tenant-based parent nodeRef)
      14865: MT - continuation fix for ETHREEOH-210 (Lucene search with QNAME)
      15108: Fix ETHREEOH-2014 - custom folder's children disappear after full re-index (MT w/ dynamic model)
      15146: Fix ETHREEOH-2452 - Cluster & MT: "Unable to find a writer. 'selectWriteStore' may not return null" ...                         
   15610: Merged V3.1 to V3.2
      15175: Cont ... fixup merge (delete file)
   16308: ETHREEOH-2833: The Content rule with 'Items with specific text value in property' condition can't be created.
   16334: (record only) Undo change of version.properties
___________________________________________________________________
Modified: svn:mergeinfo
   Merged /alfresco/BRANCHES/V3.1:r14111,14855,14865,15108,15146
   Merged /alfresco/BRANCHES/V3.2:r15608,15610,16308,16334


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@16871 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Derek Hulley
2009-10-13 14:02:05 +00:00
parent b6b4ffda44
commit b8b6c2785e
8 changed files with 92 additions and 155 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2005-2007 Alfresco Software Limited.
* Copyright (C) 2005-2009 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
@@ -27,9 +27,9 @@ package org.alfresco.repo.content;
import java.io.File;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import org.alfresco.repo.content.filestore.FileContentStore;
import org.alfresco.repo.security.authentication.AuthenticationUtil;
@@ -48,13 +48,14 @@ import org.springframework.context.ConfigurableApplicationContext;
*/
public class TenantRoutingFileContentStore extends AbstractRoutingContentStore implements TenantDeployer, ApplicationContextAware
{
Map<String, FileContentStore> tenantFileStores = new HashMap<String, FileContentStore>();
// cache of tenant file stores
Map<String, FileContentStore> tenantFileStores = new ConcurrentHashMap<String, FileContentStore>();
private String defaultRootDirectory;
private TenantService tenantService;
private ApplicationContext applicationContext;
public void setDefaultRootDir(String defaultRootDirectory)
{
this.defaultRootDirectory = defaultRootDirectory;
@@ -75,11 +76,13 @@ public class TenantRoutingFileContentStore extends AbstractRoutingContentStore i
this.applicationContext = applicationContext;
}
@Override
protected ContentStore selectWriteStore(ContentContext ctx)
{
return getTenantFileStore(tenantService.getCurrentUserDomain());
}
@Override
public List<ContentStore> getAllStores()
{
if (tenantService.isEnabled())
@@ -101,7 +104,13 @@ public class TenantRoutingFileContentStore extends AbstractRoutingContentStore i
private ContentStore getTenantFileStore(String tenantDomain)
{
return tenantFileStores.get(tenantDomain);
ContentStore cs = tenantFileStores.get(tenantDomain);
if (cs == null)
{
init();
cs = tenantFileStores.get(tenantDomain);
}
return cs;
}
private void putTenantFileStore(String tenantDomain, FileContentStore fileStore)
@@ -113,7 +122,7 @@ public class TenantRoutingFileContentStore extends AbstractRoutingContentStore i
{
tenantFileStores.remove(tenantDomain);
}
public void init()
{
String tenantDomain = TenantService.DEFAULT_DOMAIN;
@@ -128,7 +137,7 @@ public class TenantRoutingFileContentStore extends AbstractRoutingContentStore i
}
tenantDomain = tenant.getTenantDomain();
}
putTenantFileStore(tenantDomain, new FileContentStore((ConfigurableApplicationContext) this.applicationContext,
new File(rootDir)));
}