doUnregister(objectName); if (bean instanceof AbstractEndpoint) { this.endpointNames.remove(((AbstractEndpoint) bean).getComponentName());
private void registerEndpoint(AbstractEndpoint endpoint) { String beanKey; String name = endpoint.getComponentName(); String source; if (name.startsWith('_' + SI_PACKAGE)) { name = getInternalComponentName(name); source = "internal"; } else { source = "endpoint"; } if (matches(this.componentNamePatterns, name)) { if (this.endpointNames.contains(name)) { int count = 0; String unique = name + "#" + count; while (this.endpointNames.contains(unique)) { unique = name + "#" + (++count); } name = unique; } this.endpointNames.add(name); beanKey = getEndpointBeanKey(name, source); ObjectName objectName = registerBeanInstance(new ManagedEndpoint(endpoint), beanKey); this.objectNames.put(endpoint, objectName); if (logger.isInfoEnabled()) { logger.info("Registered endpoint without MessageSource: " + objectName); } } }
@Override protected void onInit() { super.onInit(); if (!this.autoStartupSetExplicitly) { String[] endpointNamePatterns = getIntegrationProperty(IntegrationProperties.ENDPOINTS_NO_AUTO_STARTUP, String[].class); for (String pattern : endpointNamePatterns) { if (PatternMatchUtils.simpleMatch(pattern, getComponentName())) { this.autoStartup = false; break; } } } if (StringUtils.hasText(this.role)) { try { this.roleController = getBeanFactory() .getBean(IntegrationContextUtils.INTEGRATION_LIFECYCLE_ROLE_CONTROLLER, SmartLifecycleRoleController.class); this.roleController.addLifecycleToRole(this.role, this); } catch (NoSuchBeanDefinitionException e) { this.logger.trace("No LifecycleRoleController in the context"); } } }
@Override public String toString() { return type + " Binding [name=" + name + ", channel=" + channel + ", endpoint=" + endpoint.getComponentName() + "]"; }
protected void deleteBindings(String name) { Assert.hasText(name, "a valid name is required to remove bindings"); List<Binding> bindingsToRemove = new ArrayList<Binding>(); synchronized (this.bindings) { Iterator<Binding> iterator = this.bindings.iterator(); while (iterator.hasNext()) { Binding binding = iterator.next(); if (binding.getEndpoint().getComponentName().equals(name)) { bindingsToRemove.add(binding); } } for (Binding binding : bindingsToRemove) { doDeleteBinding(binding); } } }
protected void deleteBinding(String name, MessageChannel channel) { Assert.hasText(name, "a valid name is required to remove a binding"); Assert.notNull(channel, "a valid channel is required to remove a binding"); Binding bindingToRemove = null; synchronized (this.bindings) { Iterator<Binding> iterator = this.bindings.iterator(); while (iterator.hasNext()) { Binding binding = iterator.next(); if (binding.getChannel().equals(channel) && binding.getEndpoint().getComponentName().equals(name)) { bindingToRemove = binding; break; } } if (bindingToRemove != null) { doDeleteBinding(bindingToRemove); } } }
@Override protected void onInit() { super.onInit(); if (!this.autoStartupSetExplicitly) { String[] endpointNamePatterns = getIntegrationProperty(IntegrationProperties.ENDPOINTS_NO_AUTO_STARTUP, String[].class); for (String pattern : endpointNamePatterns) { if (PatternMatchUtils.simpleMatch(pattern, getComponentName())) { this.autoStartup = false; break; } } } if (StringUtils.hasText(this.role)) { try { this.roleController = getBeanFactory() .getBean(IntegrationContextUtils.INTEGRATION_LIFECYCLE_ROLE_CONTROLLER, SmartLifecycleRoleController.class); this.roleController.addLifecycleToRole(this.role, this); } catch (NoSuchBeanDefinitionException e) { this.logger.trace("No LifecycleRoleController in the context"); } } }