Example #1
0
  /**
   * Wraps the original starting point of the consumer route into a set of PIX/PDQ-specific
   * interceptors.
   *
   * @param originalProcessor The original consumer processor.
   */
  @Override
  public Consumer createConsumer(Processor originalProcessor) throws Exception {
    if (sslContext != null) {
      DefaultIoFilterChainBuilder filterChain =
          wrappedEndpoint.getAcceptorConfig().getFilterChain();
      if (!filterChain.contains("ssl")) {
        HandshakeCallbackSSLFilter filter = new HandshakeCallbackSSLFilter(sslContext);
        filter.setNeedClientAuth(clientAuthType == ClientAuthType.MUST);
        filter.setWantClientAuth(clientAuthType == ClientAuthType.WANT);
        filter.setHandshakeExceptionCallback(new HandshakeFailureCallback());
        filter.setEnabledProtocols(sslProtocols);
        filter.setEnabledCipherSuites(sslCiphers);
        filterChain.addFirst("ssl", filter);
      }
    }

    // configure interceptor chain
    List<Hl7v2Interceptor> chain = getConsumerInterceptorChain();
    Processor processor = originalProcessor;
    for (int i = chain.size() - 1; i >= 0; --i) {
      Hl7v2Interceptor interceptor = chain.get(i);
      interceptor.setConfigurationHolder(this);
      interceptor.setWrappedProcessor(processor);
      processor = interceptor;
    }

    return wrappedEndpoint.createConsumer(processor);
  }
Example #2
0
  /** Wraps the original camel-mina producer into a set of PIX/PDQ-specific ones. */
  @Override
  public Producer createProducer() throws Exception {
    if (sslContext != null) {
      DefaultIoFilterChainBuilder filterChain =
          wrappedEndpoint.getConnectorConfig().getFilterChain();
      if (!filterChain.contains("ssl")) {
        HandshakeCallbackSSLFilter filter = new HandshakeCallbackSSLFilter(sslContext);
        filter.setUseClientMode(true);
        filter.setHandshakeExceptionCallback(new HandshakeFailureCallback());
        filter.setEnabledProtocols(sslProtocols);
        filter.setEnabledCipherSuites(sslCiphers);
        filterChain.addFirst("ssl", filter);
      }
    }

    return Hl7v2InterceptorUtils.adaptProducerChain(
        getProducerInterceptorChain(), this, wrappedEndpoint.createProducer());
  }