Tabnine Logo
InvocationChain.addInterceptor
Code IndexAdd Tabnine to your IDE (free)

How to use
addInterceptor
method
in
org.fabric3.spi.container.wire.InvocationChain

Best Java code snippets using org.fabric3.spi.container.wire.InvocationChain.addInterceptor (Showing top 19 results out of 315)

origin: com.carecon.fabric3/fabric3-binding-zeromq

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);
  }
}
origin: com.carecon.fabric3/fabric3-binding-jms

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);
}
origin: com.carecon.fabric3/fabric3-binding-zeromq

public void connectToSender(String id, URI uri, List<InvocationChain> chains, ZeroMQMetadata metadata, ClassLoader loader) throws Fabric3Exception {
  SenderHolder holder;
  if (ZMQ.equals(uri.getScheme())) {
    DelegatingOneWaySender sender = new DelegatingOneWaySender(id, this, metadata);
    holder = new SenderHolder(sender);
  } else {
    holder = senders.get(uri.toString());
  }
  if (holder == null) {
    boolean oneWay = isOneWay(chains, uri);
    holder = createSender(uri.toString(), oneWay, metadata);
    managementService.registerSender(id, holder.getSender());
  }
  for (int i = 0, chainsSize = chains.size(); i < chainsSize; i++) {
    InvocationChain chain = chains.get(i);
    PhysicalOperation physicalOperation = chain.getPhysicalOperation();
    List<DataType> sourceTypes = createTypes(physicalOperation);
    Interceptor interceptor = interceptorFactory.createInterceptor(physicalOperation, sourceTypes, TRANSPORT_TYPES, loader, loader);
    chain.addInterceptor(interceptor);
    chain.addInterceptor(new UnwrappingInterceptor());
    interceptor = createInterceptor(holder, i);
    chain.addInterceptor(interceptor);
  }
  holder.getIds().add(id);
}
origin: com.carecon.fabric3/fabric3-binding-file

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);
  }
}
origin: com.carecon.fabric3/fabric3-binding-ws

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);
  }
}
origin: org.fabric3/fabric3-binding-ws-metro

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);
  }
}
origin: com.carecon.fabric3/fabric3-binding-jms

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);
}
origin: org.fabric3/fabric3-fabric

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;
}
origin: com.carecon.fabric3/fabric3-fabric

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;
}
origin: org.fabric3/fabric3-binding-ftp

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);
  }
}
origin: com.carecon.fabric3/fabric3-system

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);
  }
}
origin: org.fabric3/fabric3-spring

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);
  }
}
origin: org.fabric3/fabric3-binding-rs-jersey

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);
  }
}
origin: com.carecon.fabric3/fabric3-spring

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);
  }
}
origin: com.carecon.fabric3/fabric3-binding-rs-jersey

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);
  }
}
origin: org.fabric3/fabric3-binding-ws-metro

public void attach(PhysicalWireSourceDefinition source, MetroWsdlWireTargetDefinition target, Wire wire) throws ContainerException {
  ReferenceEndpointDefinition endpointDefinition = target.getEndpointDefinition();
  List<QName> requestedIntents = target.getIntents();
  WebServiceFeature[] features = resolver.getFeatures(requestedIntents);
  String wsdl = target.getWsdl();
  URL wsdlLocation;
  try {
    URI servicePath = target.getEndpointDefinition().getUrl().toURI();
    wsdlLocation = cache.cache(servicePath, new ByteArrayInputStream(wsdl.getBytes()));
  } catch (CacheException | URISyntaxException e) {
    throw new ContainerException(e);
  }
  SecurityConfiguration securityConfiguration = target.getSecurityConfiguration();
  ConnectionConfiguration connectionConfiguration = target.getConnectionConfiguration();
  List<Handler> handlers = createHandlers(target);
  MetroDispatchObjectFactory proxyFactory = new MetroDispatchObjectFactory(endpointDefinition,
                                       wsdlLocation,
                                       null,
                                       securityConfiguration,
                                       connectionConfiguration,
                                       handlers,
                                       features,
                                       executorService,
                                       securityEnvironment);
  for (InvocationChain chain : wire.getInvocationChains()) {
    boolean oneWay = chain.getPhysicalOperation().isOneWay();
    MetroDispatchTargetInterceptor targetInterceptor = new MetroDispatchTargetInterceptor(proxyFactory, oneWay);
    chain.addInterceptor(targetInterceptor);
  }
}
origin: com.carecon.fabric3/fabric3-binding-file

public void attach(FileBindingWireSource source, PhysicalWireTarget target, Wire wire) {
  String id = source.getUri().toString();
  File location = getLocation(source);
  File errorLocation = getErrorLocation(source);
  File archiveLocation = getArchiveLocation(source);
  String pattern = source.getPattern();
  Strategy strategy = source.getStrategy();
  Interceptor interceptor = new PassThroughInterceptor();
  for (InvocationChain chain : wire.getInvocationChains()) {
    chain.addInterceptor(interceptor);
  }
  ServiceAdapter adapter = getAdaptor(source);
  long delay = source.getDelay();
  ReceiverConfiguration configuration = new ReceiverConfiguration(id,
                                  location,
                                  pattern,
                                  strategy,
                                  errorLocation,
                                  archiveLocation,
                                  interceptor,
                                  adapter,
                                  delay,
                                  monitor);
  receiverManager.create(configuration);
}
origin: com.carecon.fabric3/fabric3-java

public void attach(PhysicalWireSource source, JavaWireTarget target, Wire wire) {
  URI targetName = UriHelper.getDefragmentedName(target.getUri());
  Component component = manager.getComponent(targetName);
  if (component == null) {
    throw new Fabric3Exception("Target not found: " + targetName);
  }
  JavaComponent javaComponent = (JavaComponent) component;
  Class<?> implementationClass = javaComponent.getImplementationClass();
  ClassLoader loader = target.getClassLoader();
  // attach the invoker interceptor to forward invocation chains
  for (InvocationChain chain : wire.getInvocationChains()) {
    PhysicalOperation operation = chain.getPhysicalOperation();
    Method method = MethodUtils.findMethod(source, target, operation, implementationClass, loader);
    ServiceInvoker invoker = reflectionFactory.createServiceInvoker(method);
    InvokerInterceptor interceptor;
    if (source instanceof PojoWireSource && target.getClassLoader().equals(source.getClassLoader())) {
      // if the source is Java and target classloaders are equal, do not set the TCCL
      interceptor = new InvokerInterceptor(invoker, javaComponent);
    } else {
      // If the source and target classloaders are not equal, configure the interceptor to set the TCCL to the target classloader
      // when dispatching to a target instance. This guarantees when application code executes, it does so with the TCCL set to the
      // target component's classloader.
      interceptor = new InvokerInterceptor(invoker, javaComponent, loader);
    }
    chain.addInterceptor(interceptor);
  }
}
origin: com.carecon.fabric3/fabric3-binding-jms

chain.addInterceptor(interceptor);
org.fabric3.spi.container.wireInvocationChainaddInterceptor

Javadoc

Adds an interceptor at the given position in the interceptor stack

Popular methods of InvocationChain

  • getPhysicalOperation
  • getHeadInterceptor
    Returns the first interceptor in the chain.

Popular in Java

  • Running tasks concurrently on multiple threads
  • getResourceAsStream (ClassLoader)
  • getExternalFilesDir (Context)
  • getSupportFragmentManager (FragmentActivity)
  • Deque (java.util)
    A linear collection that supports element insertion and removal at both ends. The name deque is shor
  • Map (java.util)
    A Map is a data structure consisting of a set of keys and values in which each key is mapped to a si
  • ZipFile (java.util.zip)
    This class provides random read access to a zip file. You pay more to read the zip file's central di
  • HttpServlet (javax.servlet.http)
    Provides an abstract class to be subclassed to create an HTTP servlet suitable for a Web site. A sub
  • JButton (javax.swing)
  • FileUtils (org.apache.commons.io)
    General file manipulation utilities. Facilities are provided in the following areas: * writing to a
  • Top Sublime Text plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now