1 10 11 package org.mule.impl; 12 13 import org.mule.umo.Invocation; 14 import org.mule.umo.UMOException; 15 import org.mule.umo.UMOImmutableDescriptor; 16 import org.mule.umo.UMOInterceptor; 17 import org.mule.umo.UMOMessage; 18 19 import java.util.List ; 20 21 24 25 public class InterceptorsInvoker extends Invocation 26 { 27 private final List interceptors; 28 private int cursor = 0; 29 30 public InterceptorsInvoker(List interceptors, MuleDescriptor descriptor, UMOMessage message) 31 { 32 this(interceptors, new ImmutableMuleDescriptor(descriptor), message); 33 } 34 35 public InterceptorsInvoker(List interceptors, UMOImmutableDescriptor descriptor, UMOMessage message) 36 { 37 super(descriptor, message, null); 38 this.interceptors = interceptors; 39 } 40 41 public UMOMessage execute() throws UMOException 42 { 43 if (cursor < interceptors.size()) 44 { 45 UMOInterceptor interceptor = (UMOInterceptor)interceptors.get(cursor); 46 incCursor(); 47 return interceptor.intercept(this); 48 } 49 return getMessage(); 50 } 51 52 private synchronized void incCursor() 53 { 54 cursor++; 55 } 56 57 } 58 | Popular Tags |