Search in sources :

Example 1 with LineDelimiter

use of org.apache.mina.filter.codec.textline.LineDelimiter in project camel by apache.

the class MinaComponent method configureDefaultCodecFactory.

protected void configureDefaultCodecFactory(String type, IoServiceConfig config, MinaConfiguration configuration) {
    if (configuration.isTextline()) {
        Charset charset = getEncodingParameter(type, configuration);
        LineDelimiter delimiter = getLineDelimiterParameter(configuration.getTextlineDelimiter());
        TextLineCodecFactory codecFactory = new TextLineCodecFactory(charset, delimiter);
        if (configuration.getEncoderMaxLineLength() > 0) {
            codecFactory.setEncoderMaxLineLength(configuration.getEncoderMaxLineLength());
        }
        if (configuration.getDecoderMaxLineLength() > 0) {
            codecFactory.setDecoderMaxLineLength(configuration.getDecoderMaxLineLength());
        }
        addCodecFactory(config, codecFactory);
        if (LOG.isDebugEnabled()) {
            LOG.debug("{}: Using TextLineCodecFactory: {} using encoding: {} line delimiter: {}({})", new Object[] { type, codecFactory, charset, configuration.getTextlineDelimiter(), delimiter });
            LOG.debug("Encoder maximum line length: {}. Decoder maximum line length: {}", codecFactory.getEncoderMaxLineLength(), codecFactory.getDecoderMaxLineLength());
        }
    } else {
        ObjectSerializationCodecFactory codecFactory = new ObjectSerializationCodecFactory();
        addCodecFactory(config, codecFactory);
        LOG.debug("{}: Using ObjectSerializationCodecFactory: {}", type, codecFactory);
    }
}
Also used : ObjectSerializationCodecFactory(org.apache.mina.filter.codec.serialization.ObjectSerializationCodecFactory) LineDelimiter(org.apache.mina.filter.codec.textline.LineDelimiter) Charset(java.nio.charset.Charset)

Example 2 with LineDelimiter

use of org.apache.mina.filter.codec.textline.LineDelimiter in project camel by apache.

the class Mina2Consumer method configureDefaultCodecFactory.

protected void configureDefaultCodecFactory(String type, IoService service, Mina2Configuration configuration) {
    if (configuration.isTextline()) {
        Charset charset = getEncodingParameter(type, configuration);
        LineDelimiter delimiter = getLineDelimiterParameter(configuration.getTextlineDelimiter());
        Mina2TextLineCodecFactory codecFactory = new Mina2TextLineCodecFactory(charset, delimiter);
        if (configuration.getEncoderMaxLineLength() > 0) {
            codecFactory.setEncoderMaxLineLength(configuration.getEncoderMaxLineLength());
        }
        if (configuration.getDecoderMaxLineLength() > 0) {
            codecFactory.setDecoderMaxLineLength(configuration.getDecoderMaxLineLength());
        }
        addCodecFactory(service, codecFactory);
        if (LOG.isDebugEnabled()) {
            LOG.debug("{}: Using TextLineCodecFactory: {} using encoding: {} line delimiter: {}({})", new Object[] { type, codecFactory, charset, configuration.getTextlineDelimiter(), delimiter });
            LOG.debug("Encoder maximum line length: {}. Decoder maximum line length: {}", codecFactory.getEncoderMaxLineLength(), codecFactory.getDecoderMaxLineLength());
        }
    } else {
        ObjectSerializationCodecFactory codecFactory = new ObjectSerializationCodecFactory();
        addCodecFactory(service, codecFactory);
        LOG.debug("{}: Using ObjectSerializationCodecFactory: {}", type, codecFactory);
    }
}
Also used : ObjectSerializationCodecFactory(org.apache.mina.filter.codec.serialization.ObjectSerializationCodecFactory) LineDelimiter(org.apache.mina.filter.codec.textline.LineDelimiter) Charset(java.nio.charset.Charset)

Example 3 with LineDelimiter

use of org.apache.mina.filter.codec.textline.LineDelimiter in project camel by apache.

the class Mina2Producer method configureDefaultCodecFactory.

protected void configureDefaultCodecFactory(String type, IoService service) {
    if (configuration.isTextline()) {
        Charset charset = getEncodingParameter(type, configuration);
        LineDelimiter delimiter = getLineDelimiterParameter(configuration.getTextlineDelimiter());
        Mina2TextLineCodecFactory codecFactory = new Mina2TextLineCodecFactory(charset, delimiter);
        if (configuration.getEncoderMaxLineLength() > 0) {
            codecFactory.setEncoderMaxLineLength(configuration.getEncoderMaxLineLength());
        }
        if (configuration.getDecoderMaxLineLength() > 0) {
            codecFactory.setDecoderMaxLineLength(configuration.getDecoderMaxLineLength());
        }
        addCodecFactory(service, codecFactory);
        LOG.debug("{}: Using TextLineCodecFactory: {} using encoding: {} line delimiter: {}({})", type, codecFactory, charset, configuration.getTextlineDelimiter(), delimiter);
        LOG.debug("Encoder maximum line length: {}. Decoder maximum line length: {}", codecFactory.getEncoderMaxLineLength(), codecFactory.getDecoderMaxLineLength());
    } else {
        ObjectSerializationCodecFactory codecFactory = new ObjectSerializationCodecFactory();
        addCodecFactory(service, codecFactory);
        LOG.debug("{}: Using ObjectSerializationCodecFactory: {}", type, codecFactory);
    }
}
Also used : ObjectSerializationCodecFactory(org.apache.mina.filter.codec.serialization.ObjectSerializationCodecFactory) LineDelimiter(org.apache.mina.filter.codec.textline.LineDelimiter) Charset(java.nio.charset.Charset)

Aggregations

Charset (java.nio.charset.Charset)3 ObjectSerializationCodecFactory (org.apache.mina.filter.codec.serialization.ObjectSerializationCodecFactory)3 LineDelimiter (org.apache.mina.filter.codec.textline.LineDelimiter)3