Added getContentReader and createContentWriter to AVMService. Also added convenience

getDirectoryListingArray() calls which return listings as arrays instead of Maps.


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/BRANCHES/WCM-DEV2/root@4377 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Britt Park
2006-11-16 19:53:42 +00:00
parent b5f3167443
commit 4287b291d4
6 changed files with 187 additions and 8 deletions

View File

@@ -40,6 +40,8 @@ import org.alfresco.service.cmr.avm.AVMWrongTypeException;
import org.alfresco.service.cmr.avm.LayeringDescriptor;
import org.alfresco.service.cmr.avm.VersionDescriptor;
import org.alfresco.service.cmr.repository.ContentData;
import org.alfresco.service.cmr.repository.ContentReader;
import org.alfresco.service.cmr.repository.ContentWriter;
import org.alfresco.service.namespace.QName;
import org.alfresco.util.Pair;
import org.apache.log4j.Logger;
@@ -398,6 +400,55 @@ public class AVMRepository
}
}
/**
* Get a content reader from a file node.
* @param version The version of the file.
* @param path The path to the file.
* @return A ContentReader.
*/
public ContentReader getContentReader(int version, String path)
{
fLookupCount.set(1);
try
{
String [] pathParts = SplitPath(path);
AVMStore store = getAVMStoreByName(pathParts[0]);
if (store == null)
{
throw new AVMNotFoundException("Store not found: " + pathParts[0]);
}
return store.getContentReader(version, pathParts[1]);
}
finally
{
fLookupCount.set(null);
}
}
/**
* Get a ContentWriter to a file node.
* @param path The path to the file.
* @return A ContentWriter.
*/
public ContentWriter createContentWriter(String path)
{
fLookupCount.set(1);
try
{
String [] pathParts = SplitPath(path);
AVMStore store = getAVMStoreByName(pathParts[0]);
if (store == null)
{
throw new AVMNotFoundException("Store not found: " + pathParts[0]);
}
return store.createContentWriter(pathParts[1]);
}
finally
{
fLookupCount.set(null);
}
}
/**
* Rename a node.
* @param srcPath Source containing directory.