org.apache.fulcrum.yaafi.interceptor.baseservice
Class BaseInterceptorServiceImpl

java.lang.Object
  extended by org.apache.avalon.framework.logger.AbstractLogEnabled
      extended by org.apache.fulcrum.yaafi.interceptor.baseservice.BaseInterceptorServiceImpl
All Implemented Interfaces:
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
Direct Known Subclasses:
JamonInterceptorServiceImpl, LoggingInterceptorServiceImpl, PerformanceInterceptorServiceImpl

public class BaseInterceptorServiceImpl
extends org.apache.avalon.framework.logger.AbstractLogEnabled
implements AvalonInterceptorService, org.apache.avalon.framework.context.Contextualizable, org.apache.avalon.framework.configuration.Reconfigurable

A base service providing common functionality for interceptors

Author:
Siegfried Goeschl

Field Summary
 
Fields inherited from interface org.apache.fulcrum.yaafi.framework.interceptor.AvalonInterceptorService
ON_ENTRY, ON_ERROR, ON_EXIT
 
Constructor Summary
BaseInterceptorServiceImpl()
          Constructor
 
Method Summary
 void configure(org.apache.avalon.framework.configuration.Configuration configuration)
           
 void contextualize(org.apache.avalon.framework.context.Context context)
           
protected  java.lang.ClassLoader getClassLoader()
           
protected  java.io.File getServiceApplicationDir()
           
protected  org.apache.avalon.framework.service.ServiceManager getServiceManager()
           
protected  java.lang.String getServiceName()
           
protected  java.io.File getServiceTempDir()
           
protected  boolean isEnabled()
           
protected  boolean isServiceMonitored(AvalonInterceptorContext avalonInterceptorContext)
          Determine if the given service is monitored.
protected  java.io.File makeAbsoluteFile(java.lang.String name)
          Determines the file location of the given name.
 void onEntry(AvalonInterceptorContext avalonInterceptorContext)
          Called before a service method is invoked.
 void onError(AvalonInterceptorContext avalonInterceptorContext, java.lang.Throwable t)
          Called when a service method throws an exeption
 void onExit(AvalonInterceptorContext avalonInterceptorContext, java.lang.Object result)
          Called after a service method was invoked.
 void reconfigure(org.apache.avalon.framework.configuration.Configuration configuration)
           
 
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

BaseInterceptorServiceImpl

public BaseInterceptorServiceImpl()
Constructor

Method Detail

contextualize

public void contextualize(org.apache.avalon.framework.context.Context context)
                   throws org.apache.avalon.framework.context.ContextException
Specified by:
contextualize in interface org.apache.avalon.framework.context.Contextualizable
Throws:
org.apache.avalon.framework.context.ContextException
See Also:
Contextualizable.contextualize(org.apache.avalon.framework.context.Context)

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
Throws:
org.apache.avalon.framework.configuration.ConfigurationException
See Also:
Configurable.configure(org.apache.avalon.framework.configuration.Configuration)

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
Throws:
org.apache.avalon.framework.configuration.ConfigurationException
See Also:
Reconfigurable.reconfigure(org.apache.avalon.framework.configuration.Configuration)

onEntry

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

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

onError

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

Specified by:
onError in interface AvalonInterceptorService
Parameters:
avalonInterceptorContext - 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 avalonInterceptorContext,
                   java.lang.Object result)
Description copied from interface: AvalonInterceptorService
Called after a service method was invoked.

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

isEnabled

protected boolean isEnabled()
Returns:
Returns the isEnabled.

isServiceMonitored

protected boolean isServiceMonitored(AvalonInterceptorContext avalonInterceptorContext)
Determine if the given service is monitored.

Parameters:
avalonInterceptorContext - interceptor context
Returns:
true if the service is monitored or false otherwise

getServiceApplicationDir

protected java.io.File getServiceApplicationDir()
Returns:
Returns the serviceApplicationDir.

getServiceManager

protected org.apache.avalon.framework.service.ServiceManager getServiceManager()
Returns:
Returns the serviceManager.

getServiceName

protected java.lang.String getServiceName()
Returns:
Returns the serviceName.

getServiceTempDir

protected java.io.File getServiceTempDir()
Returns:
Returns the serviceTempDir.

getClassLoader

protected java.lang.ClassLoader getClassLoader()
Returns:
Returns the classLoader.

makeAbsoluteFile

protected java.io.File makeAbsoluteFile(java.lang.String name)
Determines the file location of the given name. If the name denotes a relative file location it will be resolved using the application home directory.

Parameters:
name - the filename
Returns:
the file


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