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; } }
Wire createWire(PhysicalWire physicalWire) throws Fabric3Exception { Wire wire = new WireImpl(); for (PhysicalOperation operation : physicalWire.getOperations()) { InvocationChain chain = new InvocationChainImpl(operation); for (PhysicalInterceptor physicalInterceptor : operation.getInterceptors()) { InterceptorBuilder<? super PhysicalInterceptor> builder = Cast.cast(interceptorBuilders.get(physicalInterceptor.getClass())); Interceptor interceptor = builder.build(physicalInterceptor); chain.addInterceptor(interceptor); } wire.addInvocationChain(chain); } return wire; }
/** * 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; }
Wire createWire(PhysicalWire physicalWire) throws Fabric3Exception { Wire wire = new WireImpl(); for (PhysicalOperation operation : physicalWire.getOperations()) { InvocationChain chain = new InvocationChainImpl(operation); for (PhysicalInterceptor physicalInterceptor : operation.getInterceptors()) { InterceptorBuilder<? super PhysicalInterceptor> builder = Cast.cast(interceptorBuilders.get(physicalInterceptor.getClass())); Interceptor interceptor = builder.build(physicalInterceptor); chain.addInterceptor(interceptor); } wire.addInvocationChain(chain); } return wire; }
private Map<Method, InvocationChain> createInterfaceToWireMapping(Class<?> interfaze, Wire wire) { List<InvocationChain> invocationChains = wire.getInvocationChains(); Map<Method, InvocationChain> chains = new HashMap<>(invocationChains.size()); for (InvocationChain chain : invocationChains) { PhysicalOperation operation = chain.getPhysicalOperation(); try { Method method = findMethod(interfaze, operation); chains.put(method, chain); } catch (NoSuchMethodException e) { throw new Fabric3Exception(operation.getName()); } catch (ClassNotFoundException e) { throw new Fabric3Exception(e); } } return chains; }
private Map<Method, InvocationChain> createInterfaceToWireMapping(Class<?> interfaze, Wire wire) { List<InvocationChain> invocationChains = wire.getInvocationChains(); Map<Method, InvocationChain> chains = new HashMap<>(invocationChains.size()); for (InvocationChain chain : invocationChains) { PhysicalOperation operation = chain.getPhysicalOperation(); try { Method method = findMethod(interfaze, operation); chains.put(method, chain); } catch (NoSuchMethodException e) { throw new Fabric3Exception(operation.getName()); } catch (ClassNotFoundException e) { throw new Fabric3Exception(e); } } return chains; }
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 attachInterceptors(Class<?> seiClass, MetroJavaWireTarget target, Wire wire, Supplier<?> factory) { Method[] methods = seiClass.getMethods(); int retries = target.getRetries(); for (InvocationChain chain : wire.getInvocationChains()) { Method method = null; for (Method m : methods) { if (chain.getPhysicalOperation().getName().equals(m.getName())) { method = m; break; } } boolean oneWay = chain.getPhysicalOperation().isOneWay(); MetroJavaTargetInterceptor targetInterceptor = new MetroJavaTargetInterceptor(factory, method, oneWay, retries, monitor); chain.addInterceptor(targetInterceptor); } }
private void attachInterceptors(Class<?> seiClass, MetroJavaWireTargetDefinition target, Wire wire, ObjectFactory<?> factory) { Method[] methods = seiClass.getMethods(); int retries = target.getRetries(); for (InvocationChain chain : wire.getInvocationChains()) { Method method = null; for (Method m : methods) { if (chain.getPhysicalOperation().getName().equals(m.getName())) { method = m; break; } } boolean oneWay = chain.getPhysicalOperation().isOneWay(); MetroJavaTargetInterceptor targetInterceptor = new MetroJavaTargetInterceptor(factory, method, oneWay, retries, monitor); chain.addInterceptor(targetInterceptor); } }
for (InvocationChain chain : wire.getInvocationChains()) { PhysicalOperation operation = chain.getPhysicalOperation(); invocationChains.put(operation.getName(), chain);
for (InvocationChain chain : wire.getInvocationChains()) { PhysicalOperation operation = chain.getPhysicalOperation(); invocationChains.put(operation.getName(), chain);
public void attach(PhysicalWireSourceDefinition source, FtpWireTargetDefinition target, Wire wire) throws ContainerException { InvocationChain invocationChain = wire.getInvocationChains().iterator().next(); URI uri = target.getUri(); try { String host = uri.getHost(); int port = uri.getPort() == -1 ? 23 : uri.getPort(); InetAddress hostAddress = "localhost".equals(host) ? InetAddress.getLocalHost() : InetAddress.getByName(host); String remotePath = uri.getPath(); String tmpFileSuffix = target.getTmpFileSuffix(); FtpSecurity security = target.getSecurity(); boolean active = target.isActive(); int connectTimeout = target.getConectTimeout(); SocketFactory factory = new ExpiringSocketFactory(connectTimeout); int socketTimeout = target.getSocketTimeout(); List<String> cmds = target.getSTORCommands(); FtpTargetInterceptor targetInterceptor = new FtpTargetInterceptor(hostAddress, port, security, active, socketTimeout, factory, cmds, monitor); targetInterceptor.setTmpFileSuffix(tmpFileSuffix); targetInterceptor.setRemotePath(remotePath); invocationChain.addInterceptor(targetInterceptor); } catch (UnknownHostException e) { throw new ContainerException(e); } }
QName portName = endpointDefinition.getPortName(); URI servicePath = endpointDefinition.getServicePath(); List<InvocationChain> invocationChains = wire.getInvocationChains(); List<QName> requestedIntents = source.getIntents();
QName portName = endpointDefinition.getPortName(); URI servicePath = endpointDefinition.getServicePath(); List<InvocationChain> invocationChains = wire.getInvocationChains(); URL wsdlLocation = source.getWsdlLocation();
public void attach(PhysicalWireSource source, SystemWireTarget target, Wire wire) throws Fabric3Exception { URI targetId = UriHelper.getDefragmentedName(target.getUri()); SystemComponent targetComponent = (SystemComponent) manager.getComponent(targetId); Class<?> implementationClass = targetComponent.getImplementationClass(); for (InvocationChain chain : wire.getInvocationChains()) { PhysicalOperation operation = chain.getPhysicalOperation(); List<Class<?>> params = operation.getSourceParameterTypes(); Method method; try { method = implementationClass.getMethod(operation.getName(), params.toArray(new Class[params.size()])); } catch (NoSuchMethodException e) { throw new Fabric3Exception("No matching method found", e); } SystemInvokerInterceptor interceptor = new SystemInvokerInterceptor(method, targetComponent); chain.addInterceptor(interceptor); } }
private WireHolder createWireHolder(Wire wire, JmsWireSource source, PhysicalWireTarget target) throws Fabric3Exception { JmsBindingMetadata metadata = source.getMetadata(); List<OperationPayloadTypes> types = source.getPayloadTypes(); CorrelationScheme correlationScheme = metadata.getCorrelationScheme(); List<InvocationChainHolder> chainHolders = new ArrayList<>(); for (InvocationChain chain : wire.getInvocationChains()) { PhysicalOperation physicalOperation = chain.getPhysicalOperation(); OperationPayloadTypes payloadType = resolveOperation(physicalOperation.getName(), types); if (payloadType == null) { throw new Fabric3Exception("Payload type not found for operation: " + physicalOperation.getName()); } if (source.getDataTypes().contains(PhysicalDataTypes.JAXB)) { addJAXBInterceptor(source, target, physicalOperation, chain); } chainHolders.add(new InvocationChainHolder(chain, payloadType)); } return new WireHolder(chainHolders, correlationScheme); }
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); } }
public void attach(PhysicalWireSource source, SpringWireTarget target, Wire wire) throws Fabric3Exception { String beanName = target.getBeanName(); ClassLoader loader = target.getClassLoader(); Class<?> interfaze; try { interfaze = loader.loadClass(target.getBeanInterface()); } catch (ClassNotFoundException e) { throw new Fabric3Exception(e); } for (WireListener listener : listeners) { listener.onAttach(wire); } SpringComponent component = getComponent(target); for (InvocationChain chain : wire.getInvocationChains()) { PhysicalOperation operation = chain.getPhysicalOperation(); Method beanMethod = MethodUtils.findMethod(source, target, operation, interfaze, loader); SpringInvoker invoker = new SpringInvoker(beanName, beanMethod, component); chain.addInterceptor(invoker); } }
public void attach(PhysicalWireSource source, SpringWireTarget target, Wire wire) throws Fabric3Exception { String beanName = target.getBeanName(); ClassLoader loader = target.getClassLoader(); Class<?> interfaze; try { interfaze = loader.loadClass(target.getBeanInterface()); } catch (ClassNotFoundException e) { throw new Fabric3Exception(e); } for (WireListener listener : listeners) { listener.onAttach(wire); } SpringComponent component = getComponent(target); for (InvocationChain chain : wire.getInvocationChains()) { PhysicalOperation operation = chain.getPhysicalOperation(); Method beanMethod = MethodUtils.findMethod(source, target, operation, interfaze, loader); SpringInvoker invoker = new SpringInvoker(beanName, beanMethod, component); chain.addInterceptor(invoker); } }
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); } }