org.apache.fulcrum.yaafi.interceptor.logging
Class LoggingInterceptorServiceImpl

java.lang.Object
  extended by org.apache.avalon.framework.logger.AbstractLogEnabled
      extended by org.apache.fulcrum.yaafi.interceptor.baseservice.BaseInterceptorServiceImpl
          extended by org.apache.fulcrum.yaafi.interceptor.logging.LoggingInterceptorServiceImpl
All Implemented Interfaces:
org.apache.avalon.framework.activity.Initializable, org.apache.avalon.framework.configuration.Configurable, org.apache.avalon.framework.configuration.Reconfigurable, org.apache.avalon.framework.context.Contextualizable, org.apache.avalon.framework.logger.LogEnabled, AvalonInterceptorService, LoggingInterceptorService

public class LoggingInterceptorServiceImpl
extends BaseInterceptorServiceImpl
implements LoggingInterceptorService, org.apache.avalon.framework.configuration.Reconfigurable, org.apache.avalon.framework.activity.Initializable

A service logging of service invocations. The service allows to monitor a list of services defined in the configuration.

Author:
Siegfried Goeschl

Field Summary
 
Fields inherited from interface org.apache.fulcrum.yaafi.framework.interceptor.AvalonInterceptorService
ON_ENTRY, ON_ERROR, ON_EXIT
 
Constructor Summary
LoggingInterceptorServiceImpl()
          Constructor
 
Method Summary
 void configure(org.apache.avalon.framework.configuration.Configuration configuration)
           
protected  InterceptorToStringBuilder createArgumentToStringBuilder(java.lang.Object target)
          Create an instance of an InterceptorToStringBuilder
protected  void createStopWatch(AvalonInterceptorContext interceptorContext)
          Creates a stop watch
protected  int getMaxArgLength()
           
protected  StopWatch getStopWatch(AvalonInterceptorContext interceptorContext)
          Gets the stop watch.
protected  java.lang.Class getToStringBuilderClass()
           
protected  java.lang.String getToStringBuilderClassName()
           
 void initialize()
           
protected  boolean isMonitorAllExceptions()
           
 void onEntry(AvalonInterceptorContext interceptorContext)
          Called before a service method is invoked.
 void onError(AvalonInterceptorContext interceptorContext, java.lang.Throwable t)
          Called when a service method throws an exeption
 void onExit(AvalonInterceptorContext interceptorContext, java.lang.Object result)
          Called after a service method was invoked.
 void reconfigure(org.apache.avalon.framework.configuration.Configuration configuration)
           
protected  java.lang.String toString(AvalonInterceptorContext interceptorContext, StopWatch stopWatch, int mode)
          Create a method signature.
protected  java.lang.String toString(AvalonInterceptorContext avalonInterceptorContext, StopWatch stopWatch, java.lang.Object result)
          Create a string representation of a service invocation returning a result.
protected  java.lang.String toString(AvalonInterceptorContext avalonInterceptorContext, StopWatch stopWatch, java.lang.Throwable throwable)
          Create a string representation of a service invocation throwing a Throwable
 
Methods inherited from class org.apache.fulcrum.yaafi.interceptor.baseservice.BaseInterceptorServiceImpl
contextualize, getClassLoader, getServiceApplicationDir, getServiceManager, getServiceName, getServiceTempDir, isEnabled, isServiceMonitored, makeAbsoluteFile
 
Methods inherited from class org.apache.avalon.framework.logger.AbstractLogEnabled
enableLogging, getLogger, setupLogger, setupLogger, setupLogger
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LoggingInterceptorServiceImpl

public LoggingInterceptorServiceImpl()
Constructor

Method Detail

configure

public void configure(org.apache.avalon.framework.configuration.Configuration configuration)
               throws org.apache.avalon.framework.configuration.ConfigurationException
Specified by:
configure in interface org.apache.avalon.framework.configuration.Configurable
Overrides:
configure in class BaseInterceptorServiceImpl
Throws:
org.apache.avalon.framework.configuration.ConfigurationException
See Also:
Configurable.configure(org.apache.avalon.framework.configuration.Configuration)

initialize

public void initialize()
                throws java.lang.Exception
Specified by:
initialize in interface org.apache.avalon.framework.activity.Initializable
Throws:
java.lang.Exception
See Also:
Initializable.initialize()

reconfigure

public void reconfigure(org.apache.avalon.framework.configuration.Configuration configuration)
                 throws org.apache.avalon.framework.configuration.ConfigurationException
Specified by:
reconfigure in interface org.apache.avalon.framework.configuration.Reconfigurable
Overrides:
reconfigure in class BaseInterceptorServiceImpl
Throws:
org.apache.avalon.framework.configuration.ConfigurationException
See Also:
Reconfigurable.reconfigure(org.apache.avalon.framework.configuration.Configuration)

onEntry

public void onEntry(AvalonInterceptorContext interceptorContext)
Description copied from interface: AvalonInterceptorService
Called before a service method is invoked.

Specified by:
onEntry in interface AvalonInterceptorService
Overrides:
onEntry in class BaseInterceptorServiceImpl
Parameters:
interceptorContext - shared interceptor context
See Also:
AvalonInterceptorService.onEntry(org.apache.fulcrum.yaafi.framework.interceptor.AvalonInterceptorContext)

onError

public void onError(AvalonInterceptorContext interceptorContext,
                    java.lang.Throwable t)
Description copied from interface: AvalonInterceptorService
Called when a service method throws an exeption

Specified by:
onError in interface AvalonInterceptorService
Overrides:
onError in class BaseInterceptorServiceImpl
Parameters:
interceptorContext - shared interceptor context
t - the resulting exception
See Also:
AvalonInterceptorService.onError(org.apache.fulcrum.yaafi.framework.interceptor.AvalonInterceptorContext, java.lang.Throwable)

onExit

public void onExit(AvalonInterceptorContext interceptorContext,
                   java.lang.Object result)
Description copied from interface: AvalonInterceptorService
Called after a service method was invoked.

Specified by:
onExit in interface AvalonInterceptorService
Overrides:
onExit in class BaseInterceptorServiceImpl
Parameters:
interceptorContext - shared interceptor context
result - the result of the invocation
See Also:
AvalonInterceptorService.onExit(org.apache.fulcrum.yaafi.framework.interceptor.AvalonInterceptorContext, java.lang.Object)

createStopWatch

protected void createStopWatch(AvalonInterceptorContext interceptorContext)
Creates a stop watch

Parameters:
interceptorContext - the current interceptor context

getStopWatch

protected StopWatch getStopWatch(AvalonInterceptorContext interceptorContext)
Gets the stop watch. Even if none is defined we return one in a proper state.

Parameters:
interceptorContext - the current interceptor context
Returns:
the stop watch

getMaxArgLength

protected int getMaxArgLength()
Returns:
Returns the maxLineLength.

isMonitorAllExceptions

protected boolean isMonitorAllExceptions()
Returns:
Returns the monitorAllExceptions.

getToStringBuilderClass

protected java.lang.Class getToStringBuilderClass()
Returns:
Returns the toStringBuilderClass.

getToStringBuilderClassName

protected java.lang.String getToStringBuilderClassName()
Returns:
Returns the toStringBuilderClassName.

createArgumentToStringBuilder

protected InterceptorToStringBuilder createArgumentToStringBuilder(java.lang.Object target)
Create an instance of an InterceptorToStringBuilder

Parameters:
target - the object to stringify
Returns:
the string builder

toString

protected java.lang.String toString(AvalonInterceptorContext avalonInterceptorContext,
                                    StopWatch stopWatch,
                                    java.lang.Object result)
Create a string representation of a service invocation returning a result.

Parameters:
avalonInterceptorContext - the interceptor context
stopWatch - the stopwatch for the execution time
result - the result of the service invocation
Returns:
the string representation of the result

toString

protected java.lang.String toString(AvalonInterceptorContext avalonInterceptorContext,
                                    StopWatch stopWatch,
                                    java.lang.Throwable throwable)
Create a string representation of a service invocation throwing a Throwable

Parameters:
avalonInterceptorContext - the interceptor context
stopWatch - the stopwatch for the execution time
throwable - the result of the service invocation
Returns:
the string representation of the result

toString

protected java.lang.String toString(AvalonInterceptorContext interceptorContext,
                                    StopWatch stopWatch,
                                    int mode)
Create a method signature.

Parameters:
interceptorContext - the avalonInterceptorContext
stopWatch - the stopwatch for the execution time
mode - the mode (onEntry, onExit, onError)
Returns:
the debug output


Copyright © 2000-2008 Apache Software Foundation. All Rights Reserved.