Merged V4.0-BUG-FIX to HEAD

36915: ALF-12874: Schema reference files are out of date
   - Difference: expected primary key .alf_tenant.PRIMARY.columnNames[0]="id", but was .alf_tenant.PRIMARY.columnNames[0]="tenant_domain"
   - fixed the rename of alf_tenant PK "id" -> "tenant_domain" (for all 5 DB types)
   36950: Merged V4.0 to V4.0-BUG-FIX (RECORD ONLY)
      36917: Merged V4.0-BUG-FIX to V4.0
         36915: ALF-12874: Schema reference files are out of date
         - Difference: expected primary key .alf_tenant.PRIMARY.columnNames[0]="id", but was .alf_tenant.PRIMARY.columnNames[0]="tenant_domain"
         - fixed the rename of alf_tenant PK "id" -> "tenant_domain" (for all 5 DB types)
   36951: Merged V4.0 (4.0.2) to V4.0-BUG-FIX (4.0.3)
      36949: ALF-13745: Merged V3.4-BUG-FIX (3.4.10) to V4.0 (4.0.2)
         36948: ALF-13667 Additional OpenOffice mimetypes to be added to the mime-type maps
            - On reflection the maxSourceSizeKBytes limits for power point files were too small. Did not take into account
              images in the files rather than just text.
      36923: Merged DEV to V4.0
         36600: ALF-14129 : Failed to do upgrade from 3.4.8 to 4.0.2
            Statements from ActivitiTaskIdIndexes.sql script were marked as optional.
      36922: Merged DEV to V4.0
         36729: ALF-14129 : Failed to do upgrade from 3.4.8 to 4.0.2
            Outdated Schema-Reference-ACT.xml were updated for all dialects and regression after ALF-12874 was fixed.
   36953: Merged BRANCHES/DEV/V3.4-BUG-FIX to BRANCHES/DEV/V4.0-BUG-FIX
      36905: ALF-14178 Share - Path issue with number of character limitation. Updated qname to max DB limit of 255 chars.
   36954: ALF-14209 SOLR - does not support query for all stores
   - it is now possible for SOLR to track any store and Alfresco to execute queries against that store (no federation or sharding yet ....)
   36965: Extra debugging after review of ALF-14238
   37032: ALF-12723: Missing mergeinfo for r34655
   37033: Merged V4.0 to V4.0-BUG-FIX
      36999: ALF-5285: Reverse merging r26226, as it causes regressions ALF-14202, ALF-14242 and ALF-14245
      37001: ALF-14169: Alfresco startup fails if XAM module was deployed
         Jan approved fix
      37005: ALF-14169: Fix unit test compilation
      37020: Resolved some "Patch description is not available" warnings in 4.0.2
      37022: ALF-12874: Schema reference files are out of date
      - Fixed up PostgreSQL diffs
      37027: ALF-12874: Schema reference files are out of date
      - DB2 fixes by Dmitry


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@37036 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Dave Ward
2012-05-25 17:19:13 +00:00
parent 18ad785d32
commit ff2ae89c08
22 changed files with 366 additions and 130 deletions

View File

@@ -29,6 +29,8 @@ import org.alfresco.repo.cache.SimpleCache;
import org.alfresco.service.cmr.repository.ContentIOException;
import org.alfresco.service.cmr.repository.ContentReader;
import org.alfresco.service.cmr.repository.ContentWriter;
import org.alfresco.util.GUID;
import org.alfresco.util.Pair;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -45,7 +47,8 @@ public abstract class AbstractRoutingContentStore implements ContentStore
{
private static Log logger = LogFactory.getLog(AbstractRoutingContentStore.class);
private SimpleCache<String, ContentStore> storesByContentUrl;
private String instanceKey = GUID.generate();
private SimpleCache<Pair<String, String>, ContentStore> storesByContentUrl;
private ReadLock storesCacheReadLock;
private WriteLock storesCacheWriteLock;
@@ -59,7 +62,7 @@ public abstract class AbstractRoutingContentStore implements ContentStore
/**
* @param storesCache cache of stores used to access URLs
*/
public void setStoresCache(SimpleCache<String, ContentStore> storesCache)
public void setStoresCache(SimpleCache<Pair<String, String>, ContentStore> storesCache)
{
this.storesByContentUrl = storesCache;
}
@@ -89,11 +92,12 @@ public abstract class AbstractRoutingContentStore implements ContentStore
*/
private ContentStore selectReadStore(String contentUrl)
{
Pair<String, String> cacheKey = new Pair<String, String>(instanceKey, contentUrl);
storesCacheReadLock.lock();
try
{
// Check if the store is in the cache
ContentStore store = storesByContentUrl.get(contentUrl);
ContentStore store = storesByContentUrl.get(cacheKey);
if (store != null)
{
// We found a store that was previously used
@@ -127,7 +131,7 @@ public abstract class AbstractRoutingContentStore implements ContentStore
try
{
// Double check
ContentStore store = storesByContentUrl.get(contentUrl);
ContentStore store = storesByContentUrl.get(cacheKey);
if (store != null && store.exists(contentUrl))
{
// We found a store and can use it
@@ -169,7 +173,7 @@ public abstract class AbstractRoutingContentStore implements ContentStore
// We found one
store = storeInList;
// Put the value in the cache
storesByContentUrl.put(contentUrl, store);
storesByContentUrl.put(cacheKey, store);
break;
}
// Check if the content URL was supported
@@ -326,6 +330,7 @@ public abstract class AbstractRoutingContentStore implements ContentStore
public ContentWriter getWriter(ContentContext context) throws ContentIOException
{
String contentUrl = context.getContentUrl();
Pair<String, String> cacheKey = new Pair<String, String>(instanceKey, contentUrl);
if (contentUrl != null)
{
// Check to see if it is in the cache
@@ -333,7 +338,7 @@ public abstract class AbstractRoutingContentStore implements ContentStore
try
{
// Check if the store is in the cache
ContentStore store = storesByContentUrl.get(contentUrl);
ContentStore store = storesByContentUrl.get(cacheKey);
if (store != null)
{
throw new ContentExistsException(this, contentUrl);
@@ -370,11 +375,12 @@ public abstract class AbstractRoutingContentStore implements ContentStore
}
ContentWriter writer = store.getWriter(context);
String newContentUrl = writer.getContentUrl();
Pair<String, String> newCacheKey = new Pair<String, String>(instanceKey, newContentUrl);
// Cache the store against the URL
storesCacheWriteLock.lock();
try
{
storesByContentUrl.put(newContentUrl, store);
storesByContentUrl.put(newCacheKey, store);
}
finally
{