Example usage for org.springframework.integration.channel AbstractMessageChannel getComponentName

List of usage examples for org.springframework.integration.channel AbstractMessageChannel getComponentName

Introduction

In this page you can find the example usage for org.springframework.integration.channel AbstractMessageChannel getComponentName.

Prototype

@Override
public String getComponentName() 

Source Link

Document

Will return the name of this component identified by #componentName field.

Usage

From source file:org.opencredo.esper.integration.config.xml.EsperWireTapChannelsBeanPostProcessor.java

@SuppressWarnings({ "rawtypes", "unchecked" })
private void addMatchingWireTaps(AbstractMessageChannel channel) {

    Assert.notNull(channel.getComponentName(), "channel name must not be null");

    Set<Entry> patternWireTapEntries = this.channelPatternMappings.entrySet();

    for (Entry patternWireTapEntry : patternWireTapEntries) {
        if (((Pattern) patternWireTapEntry.getKey()).matcher(channel.getComponentName()).matches()) {
            channel.addInterceptor((EsperWireTap) patternWireTapEntry.getValue());
        }//from www .ja v  a 2 s .  c o  m
    }
}

From source file:sipackage.config.xml.SIAdapterUpperPrefixMessageHandlerParserTests.java

@Test
public void testMessageHandlerParser() throws Exception {
    setUp("SIAdapterUpperPrefixMessageHandlerParserTests.xml", getClass());

    final AbstractMessageChannel inputChannel = TestUtils.getPropertyValue(this.consumer, "inputChannel",
            AbstractMessageChannel.class);

    assertEquals("target", inputChannel.getComponentName());

    final SIAdapterUpperPrefixExecutor siAdapterLowerPrefixExecutor = TestUtils.getPropertyValue(this.consumer,
            "handler.siAdapterLowerPrefixExecutor", SIAdapterUpperPrefixExecutor.class);

    assertNotNull(siAdapterLowerPrefixExecutor);

    final String exsampleProperty = TestUtils.getPropertyValue(siAdapterLowerPrefixExecutor, "exampleProperty",
            String.class);

    assertEquals("I am a sample property", exsampleProperty);

}

From source file:sipackage.config.xml.SIAdapterUpperPrefixOutboundGatewayParserTests.java

@Test
public void testOutboundGatewayParser() throws Exception {
    setUp("SIAdapterUpperPrefixOutboundGatewayParserTests.xml", getClass(),
            "siAdapterLowerPrefixOutboundGateway");

    final AbstractMessageChannel inputChannel = TestUtils.getPropertyValue(this.consumer, "inputChannel",
            AbstractMessageChannel.class);

    assertEquals("in", inputChannel.getComponentName());

    final SIAdapterUpperPrefixOutboundGateway siAdapterLowerPrefixOutboundGateway = TestUtils
            .getPropertyValue(this.consumer, "handler", SIAdapterUpperPrefixOutboundGateway.class);

    long sendTimeout = TestUtils.getPropertyValue(siAdapterLowerPrefixOutboundGateway,
            "messagingTemplate.sendTimeout", Long.class);

    assertEquals(100, sendTimeout);/*w  w w .  j  a v  a2 s. c  o  m*/

    final SIAdapterUpperPrefixExecutor siAdapterLowerPrefixExecutor = TestUtils.getPropertyValue(this.consumer,
            "handler.siAdapterLowerPrefixExecutor", SIAdapterUpperPrefixExecutor.class);

    assertNotNull(siAdapterLowerPrefixExecutor);

    final String exsampleProperty = TestUtils.getPropertyValue(siAdapterLowerPrefixExecutor, "exampleProperty",
            String.class);

    assertEquals("I am a sample property", exsampleProperty);

}

From source file:sipackage.config.xml.SIAdapterUpperPrefixInboundChannelAdapterParserTests.java

@Test
public void testInboundChannelAdapterParser() throws Exception {

    setUp("SIAdapterUpperPrefixInboundChannelAdapterParserTests.xml", getClass(),
            "siAdapterLowerPrefixInboundChannelAdapter");

    final AbstractMessageChannel outputChannel = TestUtils.getPropertyValue(this.consumer, "outputChannel",
            AbstractMessageChannel.class);

    assertEquals("out", outputChannel.getComponentName());

    final SIAdapterUpperPrefixExecutor siAdapterLowerPrefixExecutor = TestUtils.getPropertyValue(this.consumer,
            "source.siAdapterLowerPrefixExecutor", SIAdapterUpperPrefixExecutor.class);

    assertNotNull(siAdapterLowerPrefixExecutor);

    final String exsampleProperty = TestUtils.getPropertyValue(siAdapterLowerPrefixExecutor, "exampleProperty",
            String.class);

    assertEquals("I am a sample property", exsampleProperty);

}

From source file:org.springframework.xd.dirt.plugins.stream.ModuleTypeConversionSupport.java

/**
 * Configure the message converters for the given message channel and content type.
 * Detect the data types from the provided class loader.
 *
 * @param channel the message channel to configure the message converters
 * @param contentType the content type to use
 * @param classLoader the classloader to search the dataType(s) classes
 */// w  ww  . j a va 2 s .co m
public void configureMessageConverters(AbstractMessageChannel channel, MimeType contentType,
        ClassLoader classLoader) {
    CompositeMessageConverter converters = null;
    try {
        converters = converterFactory.newInstance(contentType);
    } catch (ConversionException e) {
        throw new ModuleConfigurationException(
                e.getMessage() + "(" + channel.getComponentName() + "Type=" + contentType + ")");
    }

    Class<?> dataType = MessageConverterUtils.getJavaTypeForContentType(contentType, classLoader);
    if (dataType == null) {
        throw new ModuleConfigurationException(
                "Content type is not supported for " + channel.getComponentName() + "Type=" + contentType);
    } else {
        channel.setDatatypes(dataType);
        channel.setMessageConverter(converters);
    }

}