Allow other types of content URLs other than store://...

Enforce restriction that all content URLs must be of form protocol://identifier
Allow for read-only stores.
Improved tests so that it is easier, when writing a new store, to determine if the store is compliant or not.


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@5899 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Derek Hulley
2007-06-09 00:43:02 +00:00
parent 9b03b15674
commit f30ccf8d6c
28 changed files with 1685 additions and 628 deletions

View File

@@ -121,9 +121,10 @@ public abstract class AbstractContentWriter extends AbstractContentAccessor impl
*/
public final ContentReader getReader() throws ContentIOException
{
String contentUrl = getContentUrl();
if (!isClosed())
{
return null;
return new EmptyContentReader(contentUrl);
}
ContentReader reader = createReader();
if (reader == null)
@@ -131,7 +132,7 @@ public abstract class AbstractContentWriter extends AbstractContentAccessor impl
throw new AlfrescoRuntimeException("ContentReader failed to create new reader: \n" +
" writer: " + this);
}
else if (reader.getContentUrl() == null || !reader.getContentUrl().equals(getContentUrl()))
else if (reader.getContentUrl() == null || !reader.getContentUrl().equals(contentUrl))
{
throw new AlfrescoRuntimeException("ContentReader has different URL: \n" +
" writer: " + this + "\n" +
@@ -235,7 +236,7 @@ public abstract class AbstractContentWriter extends AbstractContentAccessor impl
// this is a use-once object
if (channel != null)
{
throw new RuntimeException("A channel has already been opened");
throw new ContentIOException("A channel has already been opened");
}
WritableByteChannel directChannel = getDirectWritableChannel();
channel = getCallbackWritableChannel(directChannel, listeners);