mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-24 17:32:48 +00:00
Properly hooked up the on close callback for output streams to AVM Nodes.
Got rid of a now superfluous setContentData() call, and now treat files with no content url (yet) as having length 0. git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/BRANCHES/WCM-DEV2/root@3660 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -26,6 +26,7 @@ import java.util.List;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
|
||||||
|
import org.alfresco.error.AlfrescoRuntimeException;
|
||||||
import org.alfresco.service.cmr.avm.AVMException;
|
import org.alfresco.service.cmr.avm.AVMException;
|
||||||
import org.alfresco.service.cmr.avm.AVMNodeDescriptor;
|
import org.alfresco.service.cmr.avm.AVMNodeDescriptor;
|
||||||
import org.alfresco.service.cmr.avm.AVMService;
|
import org.alfresco.service.cmr.avm.AVMService;
|
||||||
@@ -225,6 +226,10 @@ class AVMCrawler implements Runnable
|
|||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (e instanceof AlfrescoRuntimeException)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
e.printStackTrace(System.err);
|
e.printStackTrace(System.err);
|
||||||
throw new AVMException("Failure", e);
|
throw new AVMException("Failure", e);
|
||||||
}
|
}
|
||||||
|
@@ -1037,18 +1037,26 @@ public class AVMNodeService extends AbstractNodeServiceImpl implements NodeServi
|
|||||||
// Invoke policy behaviors.
|
// Invoke policy behaviors.
|
||||||
invokeBeforeUpdateNode(nodeRef);
|
invokeBeforeUpdateNode(nodeRef);
|
||||||
Object [] avmVersionPath = AVMNodeConverter.ToAVMVersionPath(nodeRef);
|
Object [] avmVersionPath = AVMNodeConverter.ToAVMVersionPath(nodeRef);
|
||||||
|
if ((Integer)avmVersionPath[0] >= 0)
|
||||||
|
{
|
||||||
|
throw new InvalidNodeRefException("Read only store.", nodeRef);
|
||||||
|
}
|
||||||
// TODO Just until we can set built in properties on AVM Nodes.
|
// TODO Just until we can set built in properties on AVM Nodes.
|
||||||
if (isBuiltInProperty(qname))
|
if (isBuiltInProperty(qname))
|
||||||
{
|
{
|
||||||
if (qname.equals(ContentModel.PROP_CONTENT))
|
if (qname.equals(ContentModel.PROP_CONTENT))
|
||||||
{
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
fAVMService.setContentData((String)avmVersionPath[1], (ContentData)value);
|
||||||
|
}
|
||||||
|
catch (ClassCastException e)
|
||||||
|
{
|
||||||
|
throw new AVMException("Invalid ContentData.");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if ((Integer)avmVersionPath[0] >= 0)
|
|
||||||
{
|
|
||||||
throw new InvalidNodeRefException("Read only store.", nodeRef);
|
|
||||||
}
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
fAVMService.setNodeProperty((String)avmVersionPath[1], qname, new PropertyValue(null, value));
|
fAVMService.setNodeProperty((String)avmVersionPath[1], qname, new PropertyValue(null, value));
|
||||||
|
@@ -352,8 +352,9 @@ public class AVMStoreImpl implements AVMStore, Serializable
|
|||||||
NodeRef nodeRef = AVMNodeConverter.ToNodeRef(-1, fName + ":" + path);
|
NodeRef nodeRef = AVMNodeConverter.ToNodeRef(-1, fName + ":" + path);
|
||||||
ContentWriter writer =
|
ContentWriter writer =
|
||||||
AVMContext.fgInstance.getContentService().getWriter(nodeRef, ContentModel.PROP_CONTENT, true);
|
AVMContext.fgInstance.getContentService().getWriter(nodeRef, ContentModel.PROP_CONTENT, true);
|
||||||
// TODO This can't perform very well.
|
// TODO This can't perform very well. What this gets down to
|
||||||
setContentData(path, writer.getContentData());
|
// is that integration with ContentService is awkward.
|
||||||
|
// setContentData(path, writer.getContentData());
|
||||||
return writer;
|
return writer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -288,6 +288,10 @@ class PlainFileNodeImpl extends FileNodeImpl implements PlainFileNode
|
|||||||
*/
|
*/
|
||||||
private long getFileLength()
|
private long getFileLength()
|
||||||
{
|
{
|
||||||
|
if (fContentURL == null)
|
||||||
|
{
|
||||||
|
return 0L;
|
||||||
|
}
|
||||||
ContentReader reader = AVMContext.fgInstance.getContentStore().getReader(fContentURL);
|
ContentReader reader = AVMContext.fgInstance.getContentStore().getReader(fContentURL);
|
||||||
return reader.getSize();
|
return reader.getSize();
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user