X-Git-Url: http://git.argeo.org/?a=blobdiff_plain;ds=inline;f=org.argeo.slc.spring%2Fsrc%2Forg%2Fargeo%2Fslc%2Fcore%2Fexecution%2Fxml%2FExecutionScopeDecorator.java;fp=org.argeo.slc.spring%2Fsrc%2Forg%2Fargeo%2Fslc%2Fcore%2Fexecution%2Fxml%2FExecutionScopeDecorator.java;h=0000000000000000000000000000000000000000;hb=ecc22e604e47533c79de9cecdcdeacbc752cbff1;hp=b756381ef036fc70a99188c384a359b53b8ddd8a;hpb=e07ded4632e53f8b8869763bc1f1f4091361e76e;p=gpl%2Fargeo-slc.git diff --git a/org.argeo.slc.spring/src/org/argeo/slc/core/execution/xml/ExecutionScopeDecorator.java b/org.argeo.slc.spring/src/org/argeo/slc/core/execution/xml/ExecutionScopeDecorator.java deleted file mode 100644 index b756381ef..000000000 --- a/org.argeo.slc.spring/src/org/argeo/slc/core/execution/xml/ExecutionScopeDecorator.java +++ /dev/null @@ -1,37 +0,0 @@ -package org.argeo.slc.core.execution.xml; - -import org.springframework.aop.scope.ScopedProxyUtils; -import org.springframework.beans.factory.config.BeanDefinitionHolder; -import org.springframework.beans.factory.parsing.BeanComponentDefinition; -import org.springframework.beans.factory.xml.BeanDefinitionDecorator; -import org.springframework.beans.factory.xml.ParserContext; -import org.w3c.dom.Element; -import org.w3c.dom.Node; - -/** - * Inspired by org.springframework.aop.config.ScopedProxyBeanDefinitionDecorator - */ -public class ExecutionScopeDecorator implements BeanDefinitionDecorator { - private static final String PROXY_TARGET_CLASS = "proxy-target-class"; - - public BeanDefinitionHolder decorate(Node node, - BeanDefinitionHolder definition, ParserContext parserContext) { - - definition.getBeanDefinition().setScope("execution"); - - // Default: CGLib not used - boolean proxyTargetClass = false; - if (node instanceof Element) { - Element ele = (Element) node; - if (ele.hasAttribute(PROXY_TARGET_CLASS)) { - proxyTargetClass = Boolean.valueOf(ele.getAttribute(PROXY_TARGET_CLASS)).booleanValue(); - } - } - - // Register the original bean definition as it will be referenced by the scoped proxy and is relevant for tooling (validation, navigation). - String targetBeanName = ScopedProxyUtils.getTargetBeanName(definition.getBeanName()); - parserContext.getReaderContext().fireComponentRegistered(new BeanComponentDefinition(definition.getBeanDefinition(), targetBeanName)); - - return ScopedProxyUtils.createScopedProxy(definition, parserContext.getRegistry(), proxyTargetClass); - } -}