Merged HEAD-BUG-FIX (5.1/Cloud) to HEAD (5.1/Cloud)

99533: Put back the package level methods overridden by the Cloud mock FileContentStore
    - The FileContentStore changes reduced some string parsing by calling different, internal
      methods.  Unfortunately, these are overridden in the Cloud build, to mimic the the behaviour of the TenantS3ContentStore.
    - Files were being written to tenant-specific stores but read from the general store, where they didn't exist.


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@99547 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Alan Davis
2015-03-17 09:39:45 +00:00
parent fc1cb0841f
commit 168da1866d

View File

@@ -349,16 +349,6 @@ public class FileContentStore
Pair<String, String> urlParts = super.getContentUrlParts(contentUrl);
String protocol = urlParts.getFirst();
String relativePath = urlParts.getSecond();
return makeFile(protocol, relativePath);
}
/**
* Make the file based on the content URL parts.
*
* @param protocol must be {@link ContentStore#PROTOCOL_DELIMITER} for this class
*/
private File makeFile(String protocol, String relativePath)
{
// Check the protocol
if (!protocol.equals(FileContentStore.STORE_PROTOCOL))
{
@@ -388,16 +378,13 @@ public class FileContentStore
@Override
public boolean exists(String contentUrl)
{
Pair<String, String> urlParts = super.getContentUrlParts(contentUrl);
String protocol = urlParts.getFirst();
String relativePath = urlParts.getSecond();
if (protocol.equals(SPOOF_PROTOCOL))
if (contentUrl.startsWith(SPOOF_PROTOCOL))
{
return true;
}
else
{
File file = makeFile(protocol, relativePath);
File file = makeFile(contentUrl);
return file.exists();
}
}
@@ -447,18 +434,15 @@ public class FileContentStore
*/
public ContentReader getReader(String contentUrl)
{
Pair<String, String> urlParts = super.getContentUrlParts(contentUrl);
String protocol = urlParts.getFirst();
String relativePath = urlParts.getSecond();
// Handle the spoofed URL
if (protocol.equals(SPOOF_PROTOCOL))
if (contentUrl.startsWith(SPOOF_PROTOCOL))
{
return new SpoofedTextContentReader(contentUrl);
}
// else, it's a real file we are after
try
{
File file = makeFile(protocol, relativePath);
File file = makeFile(contentUrl);
ContentReader reader = null;
if (file.exists())
{
@@ -626,17 +610,13 @@ public class FileContentStore
{
throw new UnsupportedOperationException("This store is currently read-only: " + this);
}
// Dig out protocol
Pair<String, String> urlParts = super.getContentUrlParts(contentUrl);
String protocol = urlParts.getFirst();
String relativePath = urlParts.getSecond();
if (protocol.equals(SPOOF_PROTOCOL))
if (contentUrl.startsWith(SPOOF_PROTOCOL))
{
// This is not a failure but the content can never actually be deleted
return false;
}
// Handle regular files based on the real files
File file = makeFile(protocol, relativePath);
File file = makeFile(contentUrl);
boolean deleted = false;
if (!file.exists())
{