org.wanghy.cache.interceptor.flush
Class CacheFlushInterceptor

java.lang.Object
  extended byorg.wanghy.cache.interceptor.flush.CacheFlushAspectSupport
      extended byorg.wanghy.cache.interceptor.flush.CacheFlushInterceptor
All Implemented Interfaces:
Advice, Interceptor, MethodInterceptor

public final class CacheFlushInterceptor
extends CacheFlushAspectSupport
implements MethodInterceptor

Flushes part(s) of the cache when the intercepted method is executed.

Version:
$Revision: 1.7 $ $Date: 2005/03/03 02:06:28 $
Author:
Alex Ruiz

Field Summary
private  CacheProviderFacade cacheProviderFacade
          Cache provider.
 
Fields inherited from class org.wanghy.cache.interceptor.flush.CacheFlushAspectSupport
 
Constructor Summary
CacheFlushInterceptor()
          Constructor.
 
Method Summary
protected  FlushCache getCacheFlushAttribute(MethodInvocation methodInvocation)
          Returns the metadata attribute of the intercepted method.
 Object invoke(MethodInvocation methodInvocation)
          Flushes the part(s) of the cache.
 void setCacheFlushAttributes(Properties cacheFlushAttributes)
          Set properties with method names as keys and caching-attribute descriptors (parsed via CacheFlushAttributeEditor) as values.
 void setCacheProviderFacade(CacheProviderFacade cacheProviderFacade)
          Setter for the field cacheProviderFacade.
 
Methods inherited from class org.wanghy.cache.interceptor.flush.CacheFlushAspectSupport
getCacheFlushAttributeSource, setCacheFlushAttributeSource
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

cacheProviderFacade

private CacheProviderFacade cacheProviderFacade
Cache provider.

Constructor Detail

CacheFlushInterceptor

public CacheFlushInterceptor()
Constructor.

Method Detail

getCacheFlushAttribute

protected FlushCache getCacheFlushAttribute(MethodInvocation methodInvocation)
Returns the metadata attribute of the intercepted method.

Parameters:
methodInvocation - the description of an invocation to the method.
Returns:
the metadata attribute of the intercepted method.

invoke

public Object invoke(MethodInvocation methodInvocation)
              throws Throwable
Flushes the part(s) of the cache.

Specified by:
invoke in interface MethodInterceptor
Parameters:
methodInvocation - the description of the intercepted method.
Returns:
the return value of the intercepted method.
Throws:
Throwable

setCacheFlushAttributes

public void setCacheFlushAttributes(Properties cacheFlushAttributes)
Set properties with method names as keys and caching-attribute descriptors (parsed via CacheFlushAttributeEditor) as values.

Note: Method names are always applied to the target class, no matter if defined in an interface or the class itself.

Internally, a NameMatchCacheFlushAttributeSource will be created from the given properties.

See Also:
NameMatchCacheFlushAttributeSource

setCacheProviderFacade

public final void setCacheProviderFacade(CacheProviderFacade cacheProviderFacade)
Setter for the field cacheProviderFacade.

Parameters:
cacheProviderFacade - the new value to set


Copyright © 2004-2005 Alex Ruiz. All Rights Reserved.