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

View File

@@ -206,9 +206,7 @@ public abstract class BaseRemoteStore extends AbstractWebScript
if (store == null) if (store == null)
{ {
// not good, we should have a store by this point // 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." + throw new WebScriptException("Unable to determine which store to operate against." +
" A store was not specified and a default was not provided."); " 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); pathBuilder.insert(0, "/www/avm_webapps/" + webapp);
} }
// convert down to the path
String path = pathBuilder.toString(); String path = pathBuilder.toString();
// debugger information
if (logger.isDebugEnabled()) if (logger.isDebugEnabled())
{ logger.debug("Remote method: " + methodName + " Store Id: " + store + " Path: " + path);
logger.debug("Remote method: " + methodName);
logger.debug("Remote store id: " + store);
logger.debug("Remote path: " + path);
}
try try
{ {