public void addInterceptor(Interceptor interceptor) { if (interceptorChainHead == null) { interceptorChainHead = interceptor; } else { interceptorChainTail.setNext(interceptor); } interceptorChainTail = interceptor; }
public Message invoke(Message msg) { return next.invoke(msg); }
private Interceptor getInterceptor() { // lazy load the interceptor as it may not have been added when the instance was created in the wire attacher if (interceptor == null) { interceptor = wire.getInvocationChains().iterator().next().getHeadInterceptor(); } return interceptor; } }
public void attach(PhysicalWireSource source, RsWireTarget target, Wire wire) throws Fabric3Exception { List<InvocationChain> invocationChains = wire.getInvocationChains(); URI uri = target.getUri(); Class<?> interfaceClass = target.getProxyInterface(); try { for (InvocationChain chain : invocationChains) { PhysicalOperation operation = chain.getPhysicalOperation(); String operationName = operation.getName(); List<Class<?>> targetParameterTypes = operation.getTargetParameterTypes(); chain.addInterceptor(new RsClientInterceptor(operationName, interfaceClass, uri, targetParameterTypes)); } } catch (Exception e) { throw new Fabric3Exception(e); } }
private void addTransformer(List<InvocationChain> chains, ClassLoader loader) throws Fabric3Exception { for (InvocationChain chain : chains) { PhysicalOperation physicalOperation = chain.getPhysicalOperation(); List<DataType> targetTypes = createTypes(physicalOperation); Interceptor interceptor = interceptorFactory.createInterceptor(physicalOperation, TRANSPORT_TYPES, targetTypes, loader, loader); chain.addInterceptor(new WrappingInterceptor()); chain.addInterceptor(interceptor); } }
/** * Returns the invocation chains for a wire in their natural order. * * @param wire the wire * @return the invocation chains */ public static List<InvocationChain> sortChains(Wire wire) { TreeMap<PhysicalOperation, InvocationChain> map = new TreeMap<>(); for (InvocationChain chain : wire.getInvocationChains()) { map.put(chain.getPhysicalOperation(), chain); } List<InvocationChain> sorted = new ArrayList<>(); sorted.addAll(map.values()); return sorted; }
public void attach(PhysicalWireSource source, FileBindingWireTarget target, Wire wire) throws Fabric3Exception { File location = resolve(target.getLocation()); location.mkdirs(); ReferenceAdapter adapter = getAdaptor(target); FileSystemInterceptor interceptor = new FileSystemInterceptor(location, adapter); for (InvocationChain chain : wire.getInvocationChains()) { chain.addInterceptor(interceptor); } }
private void addJAXBInterceptor(PhysicalWireSource source, PhysicalOperation op, InvocationChain chain, ClassLoader targetClassLoader) { ClassLoader sourceClassLoader = source.getClassLoader(); List<DataType> jaxTypes = DataTypeHelper.createTypes(op); Interceptor jaxbInterceptor = interceptorFactory.createInterceptor(op, jaxTypes, DataTypeHelper.JAXB_TYPES, targetClassLoader, sourceClassLoader); chain.addInterceptor(jaxbInterceptor); }
/** * Constructor. * * @param chains Invocation chains. */ public JaxbInvoker(List<InvocationChain> chains) { for (InvocationChain chain : chains) { this.chains.put(chain.getPhysicalOperation().getName(), chain); } }
public Message invoke(Message msg) { Object instance; try { instance = component.getInstance(); } catch (Fabric3Exception e) { throw new InvocationRuntimeException(e); } try { return invoke(msg, instance); } finally { try { component.releaseInstance(instance); } catch (Fabric3Exception e) { throw new InvocationRuntimeException(e); } } }
public void addInterceptor(int index, Interceptor interceptor) { int i = 0; Interceptor next = interceptorChainHead; Interceptor prev = null; while (next != null && i < index) { prev = next; next = next.getNext(); i++; } if (i == index) { if (prev != null) { prev.setNext(interceptor); } else { interceptorChainHead = interceptor; } interceptor.setNext(next); if (next == null) { interceptorChainTail = interceptor; } } else { throw new ArrayIndexOutOfBoundsException(index); } }
public void attach(PhysicalWireSource source, RsWireTarget target, Wire wire) throws Fabric3Exception { List<InvocationChain> invocationChains = wire.getInvocationChains(); URI uri = target.getUri(); Class<?> interfaceClass = target.getProxyInterface(); try { for (InvocationChain chain : invocationChains) { PhysicalOperation operation = chain.getPhysicalOperation(); String operationName = operation.getName(); List<Class<?>> targetParameterTypes = operation.getTargetParameterTypes(); chain.addInterceptor(new RsClientInterceptor(operationName, interfaceClass, uri, targetParameterTypes)); } } catch (Exception e) { throw new Fabric3Exception(e); } }
private Message dispatch(Object[] payload, Message message) { message.setBody(payload); return interceptor.invoke(message); }
private void addJAXBInterceptor(JmsWireSource source, PhysicalWireTarget target, PhysicalOperation op, InvocationChain chain) { ClassLoader sourceClassLoader = source.getClassLoader(); ClassLoader targetClassLoader = target.getClassLoader(); List<DataType> jaxTypes = DataTypeHelper.createTypes(op); Interceptor jaxbInterceptor = interceptorFactory.createInterceptor(op, DataTypeHelper.JAXB_TYPES, jaxTypes, targetClassLoader, sourceClassLoader); chain.addInterceptor(jaxbInterceptor); }
/** * Constructor. * * @param chains Invocation chains. */ public JaxbInvoker(List<InvocationChain> chains) { for (InvocationChain chain : chains) { this.chains.put(chain.getPhysicalOperation().getName(), chain); } }
public void addInterceptor(int index, Interceptor interceptor) { int i = 0; Interceptor next = interceptorChainHead; Interceptor prev = null; while (next != null && i < index) { prev = next; next = next.getNext(); i++; } if (i == index) { if (prev != null) { prev.setNext(interceptor); } else { interceptorChainHead = interceptor; } interceptor.setNext(next); if (next == null) { interceptorChainTail = interceptor; } } else { throw new ArrayIndexOutOfBoundsException(index); } }
public void addInterceptor(Interceptor interceptor) { if (interceptorChainHead == null) { interceptorChainHead = interceptor; } else { interceptorChainTail.setNext(interceptor); } interceptorChainTail = interceptor; }
public Message invoke(Message msg) { transformInput(msg); Message ret = next.invoke(msg); return transformOutput(ret); }
public Message invoke(Message msg) { transformInput(msg); Message ret = next.invoke(msg); return transformOutput(ret); }
public Message invoke(Message msg) { msg.setBody(new Object[]{msg.getBody()}); return next.invoke(msg); }