ALF-9613: caching content store. Various improvements and bug fixes. Including:

ALF-10097: disk-persistent cache settings in ehcache
ALF-10098: clean up  process should remove empty parent directories from content cache disk directory
ALF-10126: timeToIdle ehcache property was not affecting cache cleaner job
ALF-10127: externally deleted cached content files were not re-cached until after the items expired from ehcache

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@30171 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Matt Ward
2011-09-02 09:03:49 +00:00
parent 1b2e8c53ec
commit ac8b3ce1fc
11 changed files with 409 additions and 71 deletions

View File

@@ -34,6 +34,7 @@ import org.alfresco.repo.content.UnsupportedContentUrlException;
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.Deleter;
import org.alfresco.util.GUID;
import org.alfresco.util.Pair;
import org.apache.commons.logging.Log;
@@ -613,7 +614,7 @@ public class FileContentStore
// Delete empty parents regardless of whether the file was ignore above.
if (deleteEmptyDirs && deleted)
{
deleteEmptyParents(file);
Deleter.deleteEmptyParents(file, getRootLocation());
}
// done
@@ -626,38 +627,7 @@ public class FileContentStore
return deleted;
}
/**
* Deletes the parents of the specified file. The file itself must have been
* deleted before calling this method - since only empty directories can be deleted.
*
* @param file
*/
private void deleteEmptyParents(File file)
{
String root = getRootLocation();
File parent = file.getParentFile();
boolean deleted = false;
do
{
try
{
if (parent.isDirectory() && !parent.getCanonicalPath().equals(root))
{
// Only an empty directory will successfully be deleted.
deleted = parent.delete();
}
}
catch (IOException error)
{
logger.error("Unable to construct canonical path for " + parent.getAbsolutePath());
break;
}
parent = parent.getParentFile();
}
while(deleted);
}
/**
* Creates a new content URL. This must be supported by all