|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object net.sf.sasl.aop.AbstractRootAspect net.sf.sasl.aop.exception.handling.ServiceExceptionFirewallAspect
public class ServiceExceptionFirewallAspect
The task that this aspect addresses is to prune exceptions that have been
thrown by join points (target methods). It could be configured via a list of
configurations to return the well known return type of a target method,
instead of the thrown exceptions. In the instantiated return type of a target
method it can set some properties so that a caller of a target method can
later determine that his call did not succeeded. To know which properties
must be set with which values for a return type the aspect needs a list of
configurations. If the aspect can not find a configuration for a return type
or a configuration for one of the return types super classes, the aspect
fails and will just rethrow the exception. The aspect also supports a special
"error detail message" property in which it can fills the string
representation of the stack trace of an exception.
The environment in which this aspect may be useful is for example a web
service landscape.
Normally a web service must forfill a declared "contract". On the other hand
some aspects only work correctly (like for example a transactional aspect) if
service methods can throw any exceptions. This behavior breaks the contract.
Secondly transforming such exceptions into declared service exceptions might
not always work very well in a heterogeneous technology environment. Thats
why exceptions get sometimes transformed from the sender to the receiver into
something very strange that was not expected and never declared. Some older
formal languages - like C - are also not supporting the concept of an
exception natively. So all in all it should be avoided to throw exceptions in
the communication between heterogeneous systems.
The aspect could be also used on the callers side to protect versus
exceptions.
ServiceExceptionFirewallAspectConfigBean
Field Summary |
---|
Fields inherited from class net.sf.sasl.aop.AbstractRootAspect |
---|
logger |
Fields inherited from interface org.springframework.core.Ordered |
---|
HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE |
Constructor Summary | |
---|---|
ServiceExceptionFirewallAspect()
Default constructor, setting the order to the highest priority. |
Method Summary | |
---|---|
void |
afterPropertiesSet()
Throws an illegal state exception if no config beans have been set. |
protected Object |
constructReturnValue(org.aopalliance.intercept.MethodInvocation invocation,
Throwable throwable)
See the see-tag for more informations what this method does. |
protected ReflectionHelper |
getReflectionHelper()
Returns the reflection helper which will be used by this class for reflection operations. |
protected StackTraceHelper |
getStackTraceHelper()
Returns the stack trace helper which will be used by this class for stack trace transformation operations. |
Object |
invoke(org.aopalliance.intercept.MethodInvocation invocation)
Around aspect method for a method invocation. |
protected void |
logPropertySetFailure(Class<?> targetClass,
String propertyName)
Logs a property set failure over the logger. |
protected ServiceExceptionFirewallAspectConfigBean |
lookupConfigForClass(Class<?> clazz)
Tries to find a config bean for the given class in the setted config bean list. |
void |
setConfigBeanList(List<ServiceExceptionFirewallAspectConfigBean> configBeanList)
Sets a list of configurations which will be used by this "firewall". |
protected void |
setReflectionHelper(ReflectionHelper reflectionHelper)
Sets the reflection helper which will be used by this class for reflection operations. |
protected void |
setStackTraceHelper(StackTraceHelper stackTraceHelper)
Sets the stack trace helper which will be used by this class for stack trace transformation operations. |
Methods inherited from class net.sf.sasl.aop.AbstractRootAspect |
---|
getLogger, getOrder, setLogger, setLoggerByName, setOrder |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ServiceExceptionFirewallAspect()
Method Detail |
---|
public Object invoke(org.aopalliance.intercept.MethodInvocation invocation) throws Throwable
setConfigBeanList(List)
and the introduction of the class for
more informations what this around aspect does and how it could be
configured.
invoke
in interface org.aopalliance.intercept.MethodInterceptor
Throwable
MethodInterceptor
protected Object constructReturnValue(org.aopalliance.intercept.MethodInvocation invocation, Throwable throwable)
invocation
- non null
setConfigBeanList(List)
protected void logPropertySetFailure(Class<?> targetClass, String propertyName)
targetClass
- non nullpropertyName
- non nullprotected ServiceExceptionFirewallAspectConfigBean lookupConfigForClass(Class<?> clazz)
clazz
- null or non null
public void setConfigBeanList(List<ServiceExceptionFirewallAspectConfigBean> configBeanList) throws IllegalArgumentException
configBeanList
- null or non null
IllegalArgumentException
- protected void setReflectionHelper(ReflectionHelper reflectionHelper)
reflectionHelper
- non nullprotected ReflectionHelper getReflectionHelper()
protected void setStackTraceHelper(StackTraceHelper stackTraceHelper)
stackTraceHelper
- non nullprotected StackTraceHelper getStackTraceHelper()
public void afterPropertiesSet() throws Exception
afterPropertiesSet
in interface org.springframework.beans.factory.InitializingBean
Exception
InitializingBean.afterPropertiesSet()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |