org.apache.fulcrum.yaafi.interceptor.jamon
Class JamonInterceptorServiceImpl

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.jamon.JamonInterceptorServiceImpl
All Implemented Interfaces:
java.lang.Runnable, org.apache.avalon.framework.activity.Disposable, 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, org.apache.avalon.framework.thread.ThreadSafe, AvalonInterceptorService, JamonInterceptorService

public class JamonInterceptorServiceImpl
extends BaseInterceptorServiceImpl
implements JamonInterceptorService, org.apache.avalon.framework.configuration.Reconfigurable, org.apache.avalon.framework.thread.ThreadSafe, org.apache.avalon.framework.activity.Disposable, org.apache.avalon.framework.activity.Initializable

A service using JAMon for performance monitoring. The implementation relies on reflection to invoke JAMON to avoid compile-time coupling.

Author:
Siegfried Goeschl

Field Summary
 
Fields inherited from interface org.apache.fulcrum.yaafi.framework.interceptor.AvalonInterceptorService
ON_ENTRY, ON_ERROR, ON_EXIT
 
Constructor Summary
JamonInterceptorServiceImpl()
          Constructor
 
Method Summary
 void configure(org.apache.avalon.framework.configuration.Configuration configuration)
           
protected  JamonPerformanceMonitor createJamonPerformanceMonitor(java.lang.String serviceName, java.lang.reflect.Method method, boolean isEnabled)
          Factory method for creating an implementation of a JamonPerformanceMonitor.
 void dispose()
           
 void initialize()
           
protected  boolean isJamonAvailable()
           
 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)
           
 void run()
          Writes the JAMON report to the file system.
protected  void writeReport()
          Write a report file
protected  void writeReport(java.io.File reportFile)
          Write the HTML report to the given destination.
 
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

JamonInterceptorServiceImpl

public JamonInterceptorServiceImpl()
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)

dispose

public void dispose()
Specified by:
dispose in interface org.apache.avalon.framework.activity.Disposable
See Also:
Disposable.dispose()

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)

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)

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)

run

public void run()
Writes the JAMON report to the file system.

Specified by:
run in interface java.lang.Runnable
See Also:
Runnable.run()

isJamonAvailable

protected final boolean isJamonAvailable()
Returns:
Returns the isJamonAvailable.

createJamonPerformanceMonitor

protected JamonPerformanceMonitor createJamonPerformanceMonitor(java.lang.String serviceName,
                                                                java.lang.reflect.Method method,
                                                                boolean isEnabled)
Factory method for creating an implementation of a JamonPerformanceMonitor.

Parameters:
serviceName - the service name
method - the method
isEnabled - is the monitor enabled
Returns:
the instance or null if the creation failed

writeReport

protected void writeReport()
Write a report file


writeReport

protected void writeReport(java.io.File reportFile)
Write the HTML report to the given destination.

Parameters:
reportFile - the report destination


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