Improved debug logging for AVMRemoteStore.

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@12585 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Kevin Roast
2009-01-07 11:16:52 +00:00
parent c15f4dd736
commit 11ee05b4c8
2 changed files with 26 additions and 12 deletions

View File

@@ -121,6 +121,9 @@ public class AVMRemoteStore extends BaseRemoteStore
Writer out = res.getWriter();
out.write(Long.toString(desc.getModDate()));
out.close();
if (logger.isDebugEnabled())
logger.debug("AVMRemoteStore.lastModified() " + Long.toString(desc.getModDate()));
}
/* (non-Javadoc)
@@ -146,7 +149,7 @@ public class AVMRemoteStore extends BaseRemoteStore
try
{
reader = avmService.getContentReader(-1, avmPath);
if (reader == null)
{
throw new WebScriptException("No content found for AVM file: " + avmPath);
@@ -168,7 +171,7 @@ public class AVMRemoteStore extends BaseRemoteStore
}
}
}
// set mimetype for the content and the character encoding + length for the stream
WebScriptServletResponse httpRes = (WebScriptServletResponse)res;
httpRes.setContentType(mimetype);
@@ -176,6 +179,9 @@ public class AVMRemoteStore extends BaseRemoteStore
httpRes.getHttpServletResponse().setDateHeader("Last-Modified", desc.getModDate());
httpRes.setHeader("Content-Length", Long.toString(reader.getSize()));
if (logger.isDebugEnabled())
logger.debug("AVMRemoteStore.getDocument() " + mimetype + " of size: " + reader.getSize());
// get the content and stream directly to the response output stream
// assuming the repository is capable of streaming in chunks, this should allow large files
// to be streamed directly to the browser response stream.
@@ -220,6 +226,9 @@ public class AVMRemoteStore extends BaseRemoteStore
Writer out = res.getWriter();
out.write(Boolean.toString(desc != null));
out.close();
if (logger.isDebugEnabled())
logger.debug("AVMRemoteStore.hasDocument() " + Boolean.toString(desc != null));
}
/* (non-Javadoc)
@@ -252,6 +261,9 @@ public class AVMRemoteStore extends BaseRemoteStore
}
avmService.createFile(parts[0], parts[1], content);
if (logger.isDebugEnabled())
logger.debug("AVMRemoteStore.createDocument() " + avmPath);
}
catch (AccessDeniedException ae)
{
@@ -289,6 +301,9 @@ public class AVMRemoteStore extends BaseRemoteStore
{
ContentWriter writer = avmService.getContentWriter(avmPath);
writer.putContent(content);
if (logger.isDebugEnabled())
logger.debug("AVMRemoteStore.updateDocument() " + avmPath);
}
catch (AccessDeniedException ae)
{
@@ -321,6 +336,9 @@ public class AVMRemoteStore extends BaseRemoteStore
try
{
avmService.removeNode(avmPath);
if (logger.isDebugEnabled())
logger.debug("AVMRemoteStore.deleteDocument() " + avmPath);
}
catch (AccessDeniedException ae)
{
@@ -348,6 +366,8 @@ public class AVMRemoteStore extends BaseRemoteStore
try
{
traverseNode(res.getWriter(), store, node, null, recurse);
if (logger.isDebugEnabled())
logger.debug("AVMRemoteStore.listDocuments() " + path + " Recursive: " + recurse);
}
catch (AccessDeniedException ae)
{
@@ -383,6 +403,8 @@ public class AVMRemoteStore extends BaseRemoteStore
try
{
traverseNode(res.getWriter(), store, node, Pattern.compile(matcher), true);
if (logger.isDebugEnabled())
logger.debug("AVMRemoteStore.listDocuments() " + path + " Pattern: " + pattern);
}
catch (AccessDeniedException ae)
{

View File

@@ -206,9 +206,7 @@ public abstract class BaseRemoteStore extends AbstractWebScript
if (store == null)
{
// not good, we should have a store by this point
// this means that a store was not passed in and that we
// also didn't have a configured store
// this means that a store was not passed in and that we also didn't have a configured store
throw new WebScriptException("Unable to determine which store to operate against." +
" A store was not specified and a default was not provided.");
}
@@ -226,16 +224,10 @@ public abstract class BaseRemoteStore extends AbstractWebScript
pathBuilder.insert(0, "/www/avm_webapps/" + webapp);
}
// convert down to the path
String path = pathBuilder.toString();
// debugger information
if (logger.isDebugEnabled())
{
logger.debug("Remote method: " + methodName);
logger.debug("Remote store id: " + store);
logger.debug("Remote path: " + path);
}
logger.debug("Remote method: " + methodName + " Store Id: " + store + " Path: " + path);
try
{