org.codehaus.waffle.monitor
Class AbstractWritingMonitor

java.lang.Object
  extended by org.codehaus.waffle.monitor.AbstractWritingMonitor
All Implemented Interfaces:
ActionMonitor, BindMonitor, ContextMonitor, ControllerMonitor, Monitor, RegistrarMonitor, ServletMonitor, ValidationMonitor, ViewMonitor
Direct Known Subclasses:
CommonsLoggingMonitor, ConsoleMonitor, SilentMonitor

public abstract class AbstractWritingMonitor
extends java.lang.Object
implements ActionMonitor, BindMonitor, ContextMonitor, ControllerMonitor, RegistrarMonitor, ServletMonitor, ValidationMonitor, ViewMonitor

Abstract implementation of Monitor that delegates writing to concrete subclasses.

Author:
Mauro Talevi

Nested Class Summary
 
Nested classes/interfaces inherited from interface org.codehaus.waffle.monitor.Monitor
Monitor.Level
 
Nested classes/interfaces inherited from interface org.codehaus.waffle.monitor.Monitor
Monitor.Level
 
Nested classes/interfaces inherited from interface org.codehaus.waffle.monitor.Monitor
Monitor.Level
 
Nested classes/interfaces inherited from interface org.codehaus.waffle.monitor.Monitor
Monitor.Level
 
Nested classes/interfaces inherited from interface org.codehaus.waffle.monitor.Monitor
Monitor.Level
 
Nested classes/interfaces inherited from interface org.codehaus.waffle.monitor.Monitor
Monitor.Level
 
Nested classes/interfaces inherited from interface org.codehaus.waffle.monitor.Monitor
Monitor.Level
 
Nested classes/interfaces inherited from interface org.codehaus.waffle.monitor.Monitor
Monitor.Level
 
Constructor Summary
protected AbstractWritingMonitor()
           
 
Method Summary
 void actionMethodExecuted(ActionMethodResponse actionMethodResponse)
           
 void actionMethodExecutionFailed(java.lang.Exception exception)
           
 void actionMethodFound(MethodDefinition methodDefinition)
           
 void applicationContextContainerDestroyed()
           
 void applicationContextContainerStarted()
           
 void argumentNameNotMatched(java.lang.String name, java.lang.String pattern)
           
 void argumentNameResolved(java.lang.String name, java.lang.Object value, HierarchicalArgumentResolver.Scope scope)
           
 void bindFailedForController(java.lang.Object controller, java.lang.Throwable cause)
           
 void bindFailedForModel(java.lang.Object bindModel, BindErrorMessage errorMessage)
           
 void componentRegistered(java.lang.Object key, java.lang.Class<?> type, java.lang.Object[] parameters)
           
 void contextInitialized()
           
 void controllerNameResolved(java.lang.String name, java.lang.String path)
           
 void controllerNotFound(java.lang.String name)
           
 void controllerValidatorNotFound(java.lang.String controllerValidatorName, java.lang.String controllerName)
           
 void defaultActionMethodCached(java.lang.Class<?> controllerType, MethodDefinition methodDefinition)
           
 void defaultActionMethodFound(MethodDefinition methodDefinition)
           
protected  java.util.List<java.lang.Exception> findExceptions(java.lang.Object[] arguments)
           
 void instanceRegistered(java.lang.Object key, java.lang.Object instance)
           
 void methodDefinitionNotFound(ControllerDefinition controllerDefinition)
           
 void methodDefinitionNotFound(java.lang.String controllerName)
           
 void methodIntercepted(java.lang.reflect.Method method, java.lang.Object[] arguments, java.lang.Object returnValue)
           
 void methodNameResolved(java.lang.String methodName, java.lang.String methodKey, java.util.Set<java.lang.String> keys)
           
protected  java.util.Map<java.lang.String,Monitor.Level> monitorLevels()
          Creates the default map of monitor levels, keyed on the event name.
protected  java.util.Map<java.lang.String,java.lang.String> monitorMessages()
          Creates the default map of monitor message templates, keyed on the event name.
 void nonCachingComponentRegistered(java.lang.Object key, java.lang.Class<?> type, java.lang.Object[] parameters)
           
 void pragmaticActionMethodFound(MethodDefinition methodDefinition)
           
 void registrarCreated(Registrar registrar, RegistrarMonitor registrarMonitor)
           
 void registrarNotFound(java.lang.String registrarClassName)
           
 void requestContextContainerCreated(ContextContainer sessionContextContainer)
           
 void requestContextContainerNotFound()
           
 void responseIsCommitted(javax.servlet.http.HttpServletResponse response)
           
 void servletServiceFailed(java.lang.Exception cause)
           
 void sessionContextContainerCreated(ContextContainer applicationContextContainer)
           
protected abstract  void trace(java.lang.Throwable exception)
          Traces an exception.
 void validationFailed(java.lang.Exception cause)
           
 void viewDispatched(View view)
           
 void viewForwarded(java.lang.String path)
           
 void viewRedirected(RedirectView redirectView)
           
 void viewResponded(ResponderView responderView)
           
protected abstract  void write(Monitor.Level level, java.lang.String message)
          Writes message for a given level.
protected  void write(java.lang.String event, java.lang.Object... arguments)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractWritingMonitor

protected AbstractWritingMonitor()
Method Detail

monitorLevels

protected java.util.Map<java.lang.String,Monitor.Level> monitorLevels()
Creates the default map of monitor levels, keyed on the event name. Subclasses may override any of these by retrieving the levels via super.monitorLevels(), overwriting any entry and returning the map.

Returns:
A Map

monitorMessages

protected java.util.Map<java.lang.String,java.lang.String> monitorMessages()
Creates the default map of monitor message templates, keyed on the event name. Subclasses may override any of these by retrieving the messages via super.monitorMessages(), overwriting any entry and returning the map. Message templates need to be maintained in a format compatible with MessageFormat and will expect the same number of arguments as the event (with the argument index reflecting the argument order of the event).

Returns:
A Map

write

protected void write(java.lang.String event,
                     java.lang.Object... arguments)

findExceptions

protected java.util.List<java.lang.Exception> findExceptions(java.lang.Object[] arguments)

write

protected abstract void write(Monitor.Level level,
                              java.lang.String message)
Writes message for a given level. Concrete implementations should provide writing functionality.

Parameters:
level - the Level
message - the message to write

trace

protected abstract void trace(java.lang.Throwable exception)
Traces an exception. Concrete implementations should provide writing functionality.

Parameters:
exception - the Throwable to trace

defaultActionMethodFound

public void defaultActionMethodFound(MethodDefinition methodDefinition)
Specified by:
defaultActionMethodFound in interface ActionMonitor

defaultActionMethodCached

public void defaultActionMethodCached(java.lang.Class<?> controllerType,
                                      MethodDefinition methodDefinition)
Specified by:
defaultActionMethodCached in interface ActionMonitor

pragmaticActionMethodFound

public void pragmaticActionMethodFound(MethodDefinition methodDefinition)
Specified by:
pragmaticActionMethodFound in interface ActionMonitor

actionMethodFound

public void actionMethodFound(MethodDefinition methodDefinition)
Specified by:
actionMethodFound in interface ActionMonitor

actionMethodExecuted

public void actionMethodExecuted(ActionMethodResponse actionMethodResponse)
Specified by:
actionMethodExecuted in interface ActionMonitor

actionMethodExecutionFailed

public void actionMethodExecutionFailed(java.lang.Exception exception)
Specified by:
actionMethodExecutionFailed in interface ActionMonitor

methodNameResolved

public void methodNameResolved(java.lang.String methodName,
                               java.lang.String methodKey,
                               java.util.Set<java.lang.String> keys)
Specified by:
methodNameResolved in interface ActionMonitor

methodIntercepted

public void methodIntercepted(java.lang.reflect.Method method,
                              java.lang.Object[] arguments,
                              java.lang.Object returnValue)
Specified by:
methodIntercepted in interface ActionMonitor

argumentNameResolved

public void argumentNameResolved(java.lang.String name,
                                 java.lang.Object value,
                                 HierarchicalArgumentResolver.Scope scope)
Specified by:
argumentNameResolved in interface ActionMonitor

argumentNameNotMatched

public void argumentNameNotMatched(java.lang.String name,
                                   java.lang.String pattern)
Specified by:
argumentNameNotMatched in interface ActionMonitor

responseIsCommitted

public void responseIsCommitted(javax.servlet.http.HttpServletResponse response)
Specified by:
responseIsCommitted in interface ActionMonitor

viewDispatched

public void viewDispatched(View view)
Specified by:
viewDispatched in interface ActionMonitor

bindFailedForModel

public void bindFailedForModel(java.lang.Object bindModel,
                               BindErrorMessage errorMessage)
Specified by:
bindFailedForModel in interface BindMonitor

bindFailedForController

public void bindFailedForController(java.lang.Object controller,
                                    java.lang.Throwable cause)
Specified by:
bindFailedForController in interface BindMonitor

registrarCreated

public void registrarCreated(Registrar registrar,
                             RegistrarMonitor registrarMonitor)
Specified by:
registrarCreated in interface ContextMonitor

registrarNotFound

public void registrarNotFound(java.lang.String registrarClassName)
Specified by:
registrarNotFound in interface ContextMonitor

contextInitialized

public void contextInitialized()
Specified by:
contextInitialized in interface ContextMonitor

applicationContextContainerStarted

public void applicationContextContainerStarted()
Specified by:
applicationContextContainerStarted in interface ContextMonitor

applicationContextContainerDestroyed

public void applicationContextContainerDestroyed()
Specified by:
applicationContextContainerDestroyed in interface ContextMonitor

sessionContextContainerCreated

public void sessionContextContainerCreated(ContextContainer applicationContextContainer)
Specified by:
sessionContextContainerCreated in interface ContextMonitor

requestContextContainerCreated

public void requestContextContainerCreated(ContextContainer sessionContextContainer)
Specified by:
requestContextContainerCreated in interface ContextMonitor

controllerNameResolved

public void controllerNameResolved(java.lang.String name,
                                   java.lang.String path)
Specified by:
controllerNameResolved in interface ControllerMonitor

controllerNotFound

public void controllerNotFound(java.lang.String name)
Specified by:
controllerNotFound in interface ControllerMonitor

methodDefinitionNotFound

public void methodDefinitionNotFound(java.lang.String controllerName)
Specified by:
methodDefinitionNotFound in interface ControllerMonitor

requestContextContainerNotFound

public void requestContextContainerNotFound()
Specified by:
requestContextContainerNotFound in interface ControllerMonitor

componentRegistered

public void componentRegistered(java.lang.Object key,
                                java.lang.Class<?> type,
                                java.lang.Object[] parameters)
Specified by:
componentRegistered in interface RegistrarMonitor

instanceRegistered

public void instanceRegistered(java.lang.Object key,
                               java.lang.Object instance)
Specified by:
instanceRegistered in interface RegistrarMonitor

nonCachingComponentRegistered

public void nonCachingComponentRegistered(java.lang.Object key,
                                          java.lang.Class<?> type,
                                          java.lang.Object[] parameters)
Specified by:
nonCachingComponentRegistered in interface RegistrarMonitor

servletServiceFailed

public void servletServiceFailed(java.lang.Exception cause)
Specified by:
servletServiceFailed in interface ServletMonitor

controllerValidatorNotFound

public void controllerValidatorNotFound(java.lang.String controllerValidatorName,
                                        java.lang.String controllerName)
Specified by:
controllerValidatorNotFound in interface ValidationMonitor

methodDefinitionNotFound

public void methodDefinitionNotFound(ControllerDefinition controllerDefinition)
Specified by:
methodDefinitionNotFound in interface ValidationMonitor

validationFailed

public void validationFailed(java.lang.Exception cause)
Specified by:
validationFailed in interface ValidationMonitor

viewForwarded

public void viewForwarded(java.lang.String path)
Specified by:
viewForwarded in interface ViewMonitor

viewRedirected

public void viewRedirected(RedirectView redirectView)
Specified by:
viewRedirected in interface ViewMonitor

viewResponded

public void viewResponded(ResponderView responderView)
Specified by:
viewResponded in interface ViewMonitor


Copyright © 2008. All Rights Reserved.