Example usage for org.springframework.integration.endpoint AbstractEndpoint getComponentName

List of usage examples for org.springframework.integration.endpoint AbstractEndpoint getComponentName

Introduction

In this page you can find the example usage for org.springframework.integration.endpoint AbstractEndpoint getComponentName.

Prototype

@Override
public String getComponentName() 

Source Link

Document

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

Usage

From source file:hello.MetricsActivator.java

private Map<String, AbstractEndpoint> registerEndpoints() {
    final Map<String, AbstractEndpoint> metricsEnabledEndpoints = new HashMap<String, AbstractEndpoint>();
    String[] names = this.applicationContext.getBeanNamesForType(AbstractEndpoint.class);
    Set<String> endpointNames = new HashSet<String>();
    for (String name : names) {
        if (!beansByEndpointName.values().contains(name)) {
            AbstractEndpoint endpoint = this.applicationContext.getBean(name, AbstractEndpoint.class);
            String beanKey;//from ww w . j  a v  a2 s  .c o m
            name = endpoint.getComponentName();
            String source;
            if (name.startsWith("_org.springframework.integration")) {
                name = getInternalComponentName(name);
                source = "internal";
            } else {
                name = endpoint.getComponentName();
                source = "endpoint";
            }
            if (!matches(this.componentNamePatterns, name)) {
                continue;
            }
            if (endpointNames.contains(name)) {
                int count = 0;
                String unique = name + "#" + count;
                while (endpointNames.contains(unique)) {
                    unique = name + "#" + (++count);
                }
                name = unique;
            }
            endpointNames.add(name);
            beanKey = getEndpointBeanKey(endpoint, name, source);
            metricsEnabledEndpoints.put(beanKey, endpoint);
        }
    }
    return metricsEnabledEndpoints;
}

From source file:org.springframework.integration.monitor.IntegrationMBeanExporter.java

private void registerEndpoints() {
    String[] names = beanFactory.getBeanNamesForType(AbstractEndpoint.class);
    Set<String> endpointNames = new HashSet<String>();
    for (String name : names) {
        if (!beansByEndpointName.values().contains(name)) {
            AbstractEndpoint endpoint = beanFactory.getBean(name, AbstractEndpoint.class);
            String beanKey;/*from  www  .  ja va 2 s  .c o  m*/
            name = endpoint.getComponentName();
            String source;
            if (name.startsWith("_org.springframework.integration")) {
                name = getInternalComponentName(name);
                source = "internal";
            } else {
                name = endpoint.getComponentName();
                source = "endpoint";
            }
            if (!PatternMatchUtils.simpleMatch(this.componentNamePatterns, name)) {
                continue;
            }
            if (endpointNames.contains(name)) {
                int count = 0;
                String unique = name + "#" + count;
                while (endpointNames.contains(unique)) {
                    unique = name + "#" + (++count);
                }
                name = unique;
            }
            endpointNames.add(name);
            beanKey = getEndpointBeanKey(endpoint, name, source);
            ObjectName objectName = registerBeanInstance(new ManagedEndpoint(endpoint), beanKey);
            logger.info("Registered endpoint without MessageSource: " + objectName);
        }
    }
}