Example usage for org.springframework.aop.framework ProxyFactory addAdvice

List of usage examples for org.springframework.aop.framework ProxyFactory addAdvice

Introduction

In this page you can find the example usage for org.springframework.aop.framework ProxyFactory addAdvice.

Prototype

@Override
    public void addAdvice(Advice advice) throws AopConfigException 

Source Link

Usage

From source file:oz.hadoop.yarn.api.YarnAssembly.java

/**
 * /*  ww  w.ja  v  a2s .  c  o m*/
 */
@SuppressWarnings("unchecked")
private static WithVcPrMemCount<DataProcessor> createC(String command,
        Class<? extends ApplicationContainerProcessor> applicationContainer, ByteBuffer arguments,
        String javaShellPath) {
    ProxyFactory pf = new ProxyFactory();
    pf.setInterfaces(WithVcPrMemCount.class);
    AssemblyAdvice assemblyAdvice = new AssemblyAdvice(command, applicationContainer, arguments, javaShellPath);
    pf.addAdvice(assemblyAdvice);
    WithVcPrMemCount<DataProcessor> builder = (WithVcPrMemCount<DataProcessor>) pf.getProxy();
    return builder;
}

From source file:net.bioclipse.recording.WrapInProxyAdvice.java

public Object invoke(MethodInvocation invocation) throws Throwable {
    Object returnValue = invocation.proceed();
    if (returnValue instanceof IBioObject && !(returnValue instanceof net.sf.cglib.proxy.Factory)) {
        ProxyFactory pf = new ProxyFactory();
        pf.addAdvice(this);
        //            pf.addAdvice(Activator.getDefault().getRecordingAdvice());
        pf.setTarget(returnValue);/* ww w .  ja v a2  s .  co  m*/
        returnValue = pf.getProxy();
    }
    return returnValue;
}

From source file:tnt.common.monitoring.GuardedByAnnotationBeanPostProcessor.java

protected Object createProxy(Object target, List<Method> methods) {
    ProxyFactory proxyFactory = new ProxyFactory(target);
    proxyFactory.addAdvice(new HystrixInterceptor());
    return proxyFactory.getProxy();
}

From source file:org.arrow.data.neo4j.postprocess.infrastructure.GraphRepositoryBeanPostProcessor.java

/**
 * {@inheritDoc}//from   w w w. ja v  a2s .  c om
 */
@Override
public Object postProcessAfterInitialization(Object bean, String beanName) {

    if (bean instanceof GraphRepository<?>) {
        ProxyFactory factory = new ProxyFactory(bean);
        factory.addAdvice(new QueryPostProcessorAdvice());
        return factory.getProxy();
    }
    return bean;
}

From source file:org.ext4spring.parameter.ParameterBeanFactory.java

@Override
public Object getObject() throws Exception {
    ProxyFactory proxyFactory = new ProxyFactory(parameterBean);
    proxyFactory.addAdvice(parameterAdvice);
    proxyFactory.setProxyTargetClass(!parameterBean.getClass().isInterface());
    return proxyFactory.getProxy();
}

From source file:no.abakus.bedcard.storage.ws.XFireAcegiWSSPropagatingClientFactoryBean.java

@Override
public void afterPropertiesSet() throws Exception {
    super.afterPropertiesSet();

    // ?? myServiceProxy = ProxyFactory.getProxy(getServiceClass(), interceptor);
    Object client = super.getObject();
    Advice advice = new WSSAcegiPropagationAdvice(username, password);
    addOutHandlers(client);/*from  w  w  w  .j a  v  a2s.c o  m*/

    ProxyFactory proxyFactory = new ProxyFactory(client);
    proxyFactory.addAdvice(advice);
    myServiceProxy = proxyFactory.getProxy();
}

From source file:org.arrow.service.engine.execution.interceptor.impl.EventBasedGatewayEventInitializer.java

/**
 * {@inheritDoc}//  ww  w.ja va  2s.  c o m
 */
@Override
public BpmnNodeEntity beforeExecution(Execution execution, BpmnNodeEntity entity) {

    ProxyFactory factory = new ProxyFactory(entity);
    factory.addAdvice(new NotifyEventBasedGatewayAdvice());

    return (BpmnNodeEntity) factory.getProxy();
}

From source file:org.arrow.service.engine.config.BusinessConditionBeanPostProcessor.java

/**
 * {@inheritDoc}//from   www. j ava  2  s  .c  om
 */
@Override
public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException {

    if (!(bean instanceof BusinessCondition)) {
        return bean;
    }

    if (AnnotationUtils.findAnnotation(bean.getClass(), EventTrigger.class) == null) {
        return bean;
    }

    ProxyFactory factory = new ProxyFactory(bean);
    factory.addAdvice(new BusinessConditionMethodInterceptor(beanName));

    return factory.getProxy();
}

From source file:org.jdal.remoting.caucho.HessianProxyFactoryBean.java

@Override
public void afterPropertiesSet() {
    super.afterPropertiesSet();
    ProxyFactory pf = new ProxyFactory(new Class[] { getServiceInterface(), RemoteClient.class });
    pf.addAdvisor(new RemoteClientAdvisor(this));
    pf.addAdvice(this);
    this.serviceProxy = pf.getProxy(getBeanClassLoader());
}

From source file:org.arrow.service.engine.execution.interceptor.impl.CompensateTaskInitializer.java

/**
 * {@inheritDoc}/*  w w w .j  a v  a 2 s .com*/
 */
@Override
public BpmnNodeEntity beforeExecution(Execution execution, BpmnNodeEntity entity) {

    ProxyFactory factory = new ProxyFactory(entity);
    factory.addAdvice(new CompensateTaskAdvice());

    return (BpmnNodeEntity) factory.getProxy();
}