/** * Constructor. * * @param chains Invocation chains. */ public JaxbInvoker(List<InvocationChain> chains) { for (InvocationChain chain : chains) { this.chains.put(chain.getPhysicalOperation().getName(), chain); } }
/** * Returns the matching method from the class for a given operation. * * @param clazz the class to introspect * @param operation the operation to match * @return a matching method * @throws NoSuchMethodException if a matching method is not found * @throws ClassNotFoundException if a parameter type specified in the operation is not found */ private Method findMethod(Class<?> clazz, PhysicalOperation operation) throws NoSuchMethodException, ClassNotFoundException { String name = operation.getName(); List<Class<?>> params = operation.getSourceParameterTypes(); return clazz.getMethod(name, params.toArray(new Class[params.size()])); }
/** * Returns the matching method from the class for a given operation. * * @param clazz the class to introspect * @param operation the operation to match * @return a matching method * @throws NoSuchMethodException if a matching method is not found * @throws ClassNotFoundException if a parameter type specified in the operation is not found */ private Method findMethod(Class<?> clazz, PhysicalOperation operation) throws NoSuchMethodException, ClassNotFoundException { String name = operation.getName(); List<Class<?>> params = operation.getSourceParameterTypes(); return clazz.getMethod(name, params.toArray(new Class[params.size()])); }
public ServiceListener(WireHolder wireHolder, Destination defaultResponseDestination, ConnectionFactory responseFactory, SessionType sessionType, ClassLoader classLoader, List<BindingHandler<Message>> handlers, ListenerMonitor monitor) { this.wireHolder = wireHolder; this.defaultResponseDestination = defaultResponseDestination; this.responseFactory = responseFactory; this.sessionType = sessionType; this.classLoader = classLoader; this.handlers = handlers; this.monitor = monitor; invocationChainMap = new HashMap<>(); for (InvocationChainHolder chainHolder : wireHolder.getInvocationChains()) { String name = chainHolder.getChain().getPhysicalOperation().getName(); if ("onMessage".equals(name)) { onMessageHolder = chainHolder; } invocationChainMap.put(name, chainHolder); } }
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; }
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); } }
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);
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, 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); } }
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); } }
throw new Fabric3Exception("No transformer found for operation: " + definition.getName());
throw new Fabric3Exception("No transformer found for operation: " + definition.getName());
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); } }
String operationName = physicalOperation.getName(); configuration.setOperationName(operationName); configuration.setOneWay(physicalOperation.isOneWay());