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(int pos, Advice advice) throws AopConfigException 

Source Link

Document

Cannot add introductions this way unless the advice implements IntroductionInfo.

Usage

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

/**
 * {@inheritDoc}//w w w  . jav  a 2  s .  co  m
 */
@Override
public BpmnNodeEntity beforeExecution(Execution execution, BpmnNodeEntity entity) {

    BoundaryEventAware bea = (BoundaryEventAware) entity;

    ProxyFactory factory = new ProxyFactory(bea);
    if (hasErrorEventDefinition(bea)) {
        factory.addAdvice(0, new PublishErrorEventMethodInterceptor());
    }

    return (BpmnNodeEntity) factory.getProxy();
}

From source file:ome.services.blitz.impl.AbstractAmdServant.java

/**
 * Applies the hard-wired intercepting to this instance. It is not possible
 * to configure hard-wired interceptors in Spring, instead they must be
 * passed in at runtime from a properly compiled class.
 *//*  w  w  w.  ja v  a 2 s.c om*/
public final void applyHardWiredInterceptors(List<HardWiredInterceptor> cptors,
        AopContextInitializer initializer) {

    if (service != null) {
        ProxyFactory wiredService = new ProxyFactory();
        wiredService.setInterfaces(service.getClass().getInterfaces());
        wiredService.setTarget(service);

        List<HardWiredInterceptor> reversed = new ArrayList<HardWiredInterceptor>(cptors);
        Collections.reverse(reversed);
        for (HardWiredInterceptor hwi : reversed) {
            wiredService.addAdvice(0, hwi);
        }
        wiredService.addAdvice(0, initializer);
        service = (ServiceInterface) wiredService.getProxy();
    }
}

From source file:omero.cmd.SessionI.java

protected Ice.Object callContextWrapper(Ice.Object servant) {
    // If this isn't a tie, then we can't do any wrapping.
    if (!(Ice.TieBase.class.isAssignableFrom(servant.getClass()))) {
        return servant;
    }//from w w w .  j a  v a  2  s . c  o m

    Ice.TieBase tie = (Ice.TieBase) servant;
    Object delegate = tie.ice_delegate();

    ProxyFactory wrapper = new ProxyFactory(delegate);
    wrapper.addAdvice(0, new CallContext(context));
    tie.ice_delegate(wrapper.getProxy());
    return servant;
}