use of org.springframework.aop.framework.ProxyFactory in project ignite by apache.
the class GridifySpringEnhancer method enhance.
/**
* Enhances the object on load.
*
* @param <T> Type of the object to enhance.
* @param obj Object to augment/enhance.
* @return Enhanced object.
*/
@SuppressWarnings({ "unchecked" })
public static <T> T enhance(T obj) {
ProxyFactory proxyFac = new ProxyFactory(obj);
proxyFac.addAdvice(dfltAsp);
proxyFac.addAdvice(setToValAsp);
proxyFac.addAdvice(setToSetAsp);
while (proxyFac.getAdvisors().length > 0) proxyFac.removeAdvisor(0);
proxyFac.addAdvisor(new DefaultPointcutAdvisor(new GridifySpringPointcut(GridifySpringPointcut.GridifySpringPointcutType.DFLT), dfltAsp));
proxyFac.addAdvisor(new DefaultPointcutAdvisor(new GridifySpringPointcut(GridifySpringPointcut.GridifySpringPointcutType.SET_TO_VALUE), setToValAsp));
proxyFac.addAdvisor(new DefaultPointcutAdvisor(new GridifySpringPointcut(GridifySpringPointcut.GridifySpringPointcutType.SET_TO_SET), setToSetAsp));
return (T) proxyFac.getProxy();
}
use of org.springframework.aop.framework.ProxyFactory in project spring-framework by spring-projects.
the class JaxWsPortProxyFactoryBean method afterPropertiesSet.
@Override
public void afterPropertiesSet() {
super.afterPropertiesSet();
// Build a proxy that also exposes the JAX-WS BindingProvider interface.
ProxyFactory pf = new ProxyFactory();
pf.addInterface(getServiceInterface());
pf.addInterface(BindingProvider.class);
pf.addAdvice(this);
this.serviceProxy = pf.getProxy(getBeanClassLoader());
}
use of org.springframework.aop.framework.ProxyFactory in project spring-framework by spring-projects.
the class PersistenceExceptionTranslationAdvisorTests method createProxy.
protected RepositoryInterface createProxy(RepositoryInterfaceImpl target) {
MapPersistenceExceptionTranslator mpet = new MapPersistenceExceptionTranslator();
mpet.addTranslation(persistenceException1, new InvalidDataAccessApiUsageException("", persistenceException1));
ProxyFactory pf = new ProxyFactory(target);
pf.addInterface(RepositoryInterface.class);
addPersistenceExceptionTranslation(pf, mpet);
return (RepositoryInterface) pf.getProxy();
}
use of org.springframework.aop.framework.ProxyFactory in project spring-framework by spring-projects.
the class GenericMessageEndpointFactory method createEndpoint.
/**
* Wrap each concrete endpoint instance with an AOP proxy,
* exposing the message listener's interfaces as well as the
* endpoint SPI through an AOP introduction.
*/
@Override
public MessageEndpoint createEndpoint(XAResource xaResource) throws UnavailableException {
GenericMessageEndpoint endpoint = (GenericMessageEndpoint) super.createEndpoint(xaResource);
ProxyFactory proxyFactory = new ProxyFactory(this.messageListener);
DelegatingIntroductionInterceptor introduction = new DelegatingIntroductionInterceptor(endpoint);
introduction.suppressInterface(MethodInterceptor.class);
proxyFactory.addAdvice(introduction);
return (MessageEndpoint) proxyFactory.getProxy();
}
use of org.springframework.aop.framework.ProxyFactory in project spring-framework by spring-projects.
the class ScriptFactoryPostProcessor method createRefreshableProxy.
/**
* Create a refreshable proxy for the given AOP TargetSource.
* @param ts the refreshable TargetSource
* @param interfaces the proxy interfaces (may be {@code null} to
* indicate proxying of all interfaces implemented by the target class)
* @return the generated proxy
* @see RefreshableScriptTargetSource
*/
protected Object createRefreshableProxy(TargetSource ts, Class<?>[] interfaces, boolean proxyTargetClass) {
ProxyFactory proxyFactory = new ProxyFactory();
proxyFactory.setTargetSource(ts);
ClassLoader classLoader = this.beanClassLoader;
if (interfaces == null) {
interfaces = ClassUtils.getAllInterfacesForClass(ts.getTargetClass(), this.beanClassLoader);
}
proxyFactory.setInterfaces(interfaces);
if (proxyTargetClass) {
// force use of Class.getClassLoader()
classLoader = null;
proxyFactory.setProxyTargetClass(true);
}
DelegatingIntroductionInterceptor introduction = new DelegatingIntroductionInterceptor(ts);
introduction.suppressInterface(TargetSource.class);
proxyFactory.addAdvice(introduction);
return proxyFactory.getProxy(classLoader);
}
Aggregations