FileDocCategorySizeDatePackage
InvocationLogClientInterceptor.javaAPI DocJBoss 4.2.13323Fri Jul 13 21:02:26 BST 2007org.jboss.aspects.logging

InvocationLogClientInterceptor

public class InvocationLogClientInterceptor extends Object implements Serializable, org.jboss.aop.advice.Interceptor
An interceptor that tests dumps any logging into the invocation response
author
Adrian Brock.
version
$Revision: 57186 $

Fields Summary
private static final long
serialVersionUID
Constructors Summary
Methods Summary
public voiddumpLog(org.jboss.aop.joinpoint.Invocation invocation)

      Logger root = Logger.getRootLogger();
      ArrayList list = (ArrayList) invocation.getResponseAttachment(ThreadLocalAppender.LOG);
      for (Iterator i = list.iterator(); i.hasNext();)
          root.callAppenders((LoggingEvent) i.next());
   
public java.lang.StringgetName()


   // Attributes ----------------------------------------------------

   // Static --------------------------------------------------------

   // Constructors --------------------------------------------------

   // Public --------------------------------------------------------

   // Interceptor Implementation ------------------------------------

     
   
      return "InvocationLogClientInterceptor";
   
public java.lang.Objectinvoke(org.jboss.aop.joinpoint.Invocation invocation)

todo
remove the hardwiring of the meta data (needs next invocation metadata)

      // TODO: This should be set by the caller when required
      invocation.getMetaData().addMetaData(ThreadLocalAppender.LOG, ThreadLocalAppender.LOG, "Log", PayloadKey.AS_IS);

      // Perform the invocation and dump any attached log
      Object response = invocation.invokeNext();
      if (response != null)
         dumpLog(invocation);
      return response;