4.0 related cleanup
- Remove InternalPropertyNames class - Cleanup in AbstractBindableProxyFactory
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2019-2021 the original author or authors.
|
||||
* Copyright 2019-2022 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -23,14 +23,9 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
|
||||
import org.springframework.beans.factory.BeanFactory;
|
||||
import org.springframework.beans.factory.ListableBeanFactory;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.cloud.stream.binder.Binding;
|
||||
import org.springframework.cloud.stream.internal.InternalPropertyNames;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
/**
|
||||
@@ -44,11 +39,6 @@ import org.springframework.util.StringUtils;
|
||||
*/
|
||||
public class AbstractBindableProxyFactory implements Bindable {
|
||||
|
||||
private static Log log = LogFactory.getLog(AbstractBindableProxyFactory.class);
|
||||
|
||||
@Value("${" + InternalPropertyNames.NAMESPACE_PROPERTY_NAME + ":}")
|
||||
private String namespace;
|
||||
|
||||
protected Map<String, BindingTargetFactory> bindingTargetFactories;
|
||||
|
||||
protected Map<String, BoundTargetHolder> inputHolders = new LinkedHashMap<>();
|
||||
@@ -100,19 +90,11 @@ public class AbstractBindableProxyFactory implements Bindable {
|
||||
public Collection<Binding<Object>> createAndBindInputs(
|
||||
BindingService bindingService) {
|
||||
List<Binding<Object>> bindings = new ArrayList<>();
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug(
|
||||
String.format("Binding inputs for %s:%s", this.namespace, this.type));
|
||||
}
|
||||
for (Map.Entry<String, BoundTargetHolder> boundTargetHolderEntry : this.inputHolders
|
||||
.entrySet()) {
|
||||
String inputTargetName = boundTargetHolderEntry.getKey();
|
||||
BoundTargetHolder boundTargetHolder = boundTargetHolderEntry.getValue();
|
||||
if (boundTargetHolder.isBindable()) {
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug(String.format("Binding %s:%s:%s", this.namespace, this.type,
|
||||
inputTargetName));
|
||||
}
|
||||
bindings.addAll(bindingService.bindConsumer(
|
||||
boundTargetHolder.getBoundTarget(), inputTargetName));
|
||||
}
|
||||
@@ -124,19 +106,12 @@ public class AbstractBindableProxyFactory implements Bindable {
|
||||
public Collection<Binding<Object>> createAndBindOutputs(
|
||||
BindingService bindingService) {
|
||||
List<Binding<Object>> bindings = new ArrayList<>();
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug(String.format("Binding outputs for %s:%s", this.namespace,
|
||||
this.type));
|
||||
}
|
||||
|
||||
for (Map.Entry<String, BoundTargetHolder> boundTargetHolderEntry : this.outputHolders
|
||||
.entrySet()) {
|
||||
BoundTargetHolder boundTargetHolder = boundTargetHolderEntry.getValue();
|
||||
String outputTargetName = boundTargetHolderEntry.getKey();
|
||||
if (boundTargetHolderEntry.getValue().isBindable()) {
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug(String.format("Binding %s:%s:%s", this.namespace, this.type,
|
||||
outputTargetName));
|
||||
}
|
||||
bindings.add(bindingService.bindProducer(
|
||||
boundTargetHolder.getBoundTarget(), outputTargetName));
|
||||
}
|
||||
@@ -146,17 +121,9 @@ public class AbstractBindableProxyFactory implements Bindable {
|
||||
|
||||
@Override
|
||||
public void unbindInputs(BindingService bindingService) {
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug(String.format("Unbinding inputs for %s:%s", this.namespace,
|
||||
this.type));
|
||||
}
|
||||
for (Map.Entry<String, BoundTargetHolder> boundTargetHolderEntry : this.inputHolders
|
||||
.entrySet()) {
|
||||
if (boundTargetHolderEntry.getValue().isBindable()) {
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug(String.format("Unbinding %s:%s:%s", this.namespace,
|
||||
this.type, boundTargetHolderEntry.getKey()));
|
||||
}
|
||||
bindingService.unbindConsumers(boundTargetHolderEntry.getKey());
|
||||
}
|
||||
}
|
||||
@@ -164,17 +131,9 @@ public class AbstractBindableProxyFactory implements Bindable {
|
||||
|
||||
@Override
|
||||
public void unbindOutputs(BindingService bindingService) {
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug(String.format("Unbinding outputs for %s:%s", this.namespace,
|
||||
this.type));
|
||||
}
|
||||
for (Map.Entry<String, BoundTargetHolder> boundTargetHolderEntry : this.outputHolders
|
||||
.entrySet()) {
|
||||
if (boundTargetHolderEntry.getValue().isBindable()) {
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug(String.format("Binding %s:%s:%s", this.namespace, this.type,
|
||||
boundTargetHolderEntry.getKey()));
|
||||
}
|
||||
bindingService.unbindProducers(boundTargetHolderEntry.getKey());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,43 +0,0 @@
|
||||
/*
|
||||
* Copyright 2016-2019 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.cloud.stream.internal;
|
||||
|
||||
/**
|
||||
* Contains the names of properties for the internal use of Spring Cloud Stream.
|
||||
*
|
||||
* @author Marius Bogoevici
|
||||
*/
|
||||
public abstract class InternalPropertyNames {
|
||||
|
||||
/**
|
||||
* Prefix for internal Spring Cloud Stream properties.
|
||||
*/
|
||||
public static final String SPRING_CLOUD_STREAM_INTERNAL_PREFIX = "spring.cloud.stream.internal";
|
||||
|
||||
/**
|
||||
* Namespace property for internal Spring Cloud Stream properties.
|
||||
*/
|
||||
public static final String NAMESPACE_PROPERTY_NAME = SPRING_CLOUD_STREAM_INTERNAL_PREFIX
|
||||
+ ".namespace";
|
||||
|
||||
/**
|
||||
* Self contained property for internal Spring Cloud Stream properties.
|
||||
*/
|
||||
public static final String SELF_CONTAINED_APP_PROPERTY_NAME = SPRING_CLOUD_STREAM_INTERNAL_PREFIX
|
||||
+ ".selfContained";
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user