Search in sources :

Example 1 with VmPipeAcceptor

use of org.apache.mina.transport.vmpipe.VmPipeAcceptor in project camel by apache.

the class MinaComponent method createVmEndpoint.

// Implementation methods
//-------------------------------------------------------------------------
protected MinaEndpoint createVmEndpoint(String uri, MinaConfiguration configuration) {
    boolean minaLogger = configuration.isMinaLogger();
    boolean sync = configuration.isSync();
    List<IoFilter> filters = configuration.getFilters();
    IoAcceptor acceptor = new VmPipeAcceptor();
    SocketAddress address = new VmPipeAddress(configuration.getPort());
    IoConnector connector = new VmPipeConnector();
    // connector config
    configureCodecFactory("MinaProducer", connector.getDefaultConfig(), configuration);
    if (minaLogger) {
        connector.getFilterChain().addLast("logger", new LoggingFilter());
    }
    appendIoFiltersToChain(filters, connector.getFilterChain());
    // acceptor connectorConfig
    configureCodecFactory("MinaConsumer", acceptor.getDefaultConfig(), configuration);
    if (minaLogger) {
        acceptor.getFilterChain().addLast("logger", new LoggingFilter());
    }
    appendIoFiltersToChain(filters, acceptor.getFilterChain());
    MinaEndpoint endpoint = new MinaEndpoint(uri, this);
    endpoint.setAddress(address);
    endpoint.setAcceptor(acceptor);
    endpoint.setConnector(connector);
    endpoint.setConfiguration(configuration);
    // set sync or async mode after endpoint is created
    if (sync) {
        endpoint.setExchangePattern(ExchangePattern.InOut);
    } else {
        endpoint.setExchangePattern(ExchangePattern.InOnly);
    }
    return endpoint;
}
Also used : VmPipeAcceptor(org.apache.mina.transport.vmpipe.VmPipeAcceptor) IoAcceptor(org.apache.mina.common.IoAcceptor) LoggingFilter(org.apache.mina.filter.LoggingFilter) IoFilter(org.apache.mina.common.IoFilter) VmPipeAddress(org.apache.mina.transport.vmpipe.VmPipeAddress) SocketAddress(java.net.SocketAddress) InetSocketAddress(java.net.InetSocketAddress) IoConnector(org.apache.mina.common.IoConnector) VmPipeConnector(org.apache.mina.transport.vmpipe.VmPipeConnector)

Example 2 with VmPipeAcceptor

use of org.apache.mina.transport.vmpipe.VmPipeAcceptor in project camel by apache.

the class Mina2Consumer method setupVmProtocol.

// Implementation methods
//-------------------------------------------------------------------------
protected void setupVmProtocol(String uri, Mina2Configuration configuration) {
    boolean minaLogger = configuration.isMinaLogger();
    List<IoFilter> filters = configuration.getFilters();
    address = new VmPipeAddress(configuration.getPort());
    acceptor = new VmPipeAcceptor();
    // acceptor connectorConfig
    configureCodecFactory("Mina2Consumer", acceptor, configuration);
    if (minaLogger) {
        acceptor.getFilterChain().addLast("logger", new LoggingFilter());
    }
    appendIoFiltersToChain(filters, acceptor.getFilterChain());
    if (configuration.getSslContextParameters() != null) {
        LOG.warn("Using vm protocol" + ", but an SSLContextParameters instance was provided.  SSLContextParameters is only supported on the TCP protocol.");
    }
}
Also used : VmPipeAcceptor(org.apache.mina.transport.vmpipe.VmPipeAcceptor) LoggingFilter(org.apache.mina.filter.logging.LoggingFilter) IoFilter(org.apache.mina.core.filterchain.IoFilter) VmPipeAddress(org.apache.mina.transport.vmpipe.VmPipeAddress)

Aggregations

VmPipeAcceptor (org.apache.mina.transport.vmpipe.VmPipeAcceptor)2 VmPipeAddress (org.apache.mina.transport.vmpipe.VmPipeAddress)2 InetSocketAddress (java.net.InetSocketAddress)1 SocketAddress (java.net.SocketAddress)1 IoAcceptor (org.apache.mina.common.IoAcceptor)1 IoConnector (org.apache.mina.common.IoConnector)1 IoFilter (org.apache.mina.common.IoFilter)1 IoFilter (org.apache.mina.core.filterchain.IoFilter)1 LoggingFilter (org.apache.mina.filter.LoggingFilter)1 LoggingFilter (org.apache.mina.filter.logging.LoggingFilter)1 VmPipeConnector (org.apache.mina.transport.vmpipe.VmPipeConnector)1