Remove dead classes
This commit is contained in:
@@ -57,8 +57,6 @@ public class AbstractBindableProxyFactory implements Bindable {
|
||||
|
||||
protected Class<?> type;
|
||||
|
||||
private BeanFactory beanFactory;
|
||||
|
||||
public AbstractBindableProxyFactory(Class<?> type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
@@ -1,125 +0,0 @@
|
||||
/*
|
||||
* Copyright 2015-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.binding;
|
||||
|
||||
import java.lang.annotation.Annotation;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.Map;
|
||||
|
||||
import org.springframework.beans.factory.BeanDefinitionStoreException;
|
||||
import org.springframework.beans.factory.support.AutowireCandidateQualifier;
|
||||
import org.springframework.beans.factory.support.BeanDefinitionRegistry;
|
||||
import org.springframework.beans.factory.support.RootBeanDefinition;
|
||||
import org.springframework.core.annotation.AnnotationUtils;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
/**
|
||||
* Utility class for registering bean definitions for binding targets.
|
||||
*
|
||||
* @author Marius Bogoevici
|
||||
* @author Dave Syer
|
||||
* @author Artem Bilan
|
||||
*/
|
||||
public abstract class BindingBeanDefinitionRegistryUtils {
|
||||
|
||||
public static void registerInputBindingTargetBeanDefinition(String qualifierValue,
|
||||
String name, String bindingTargetInterfaceBeanName,
|
||||
String bindingTargetInterfaceMethodName, BeanDefinitionRegistry registry) {
|
||||
System.out.println();
|
||||
// registerBindingTargetBeanDefinition(Input.class, qualifierValue, name,
|
||||
// bindingTargetInterfaceBeanName, bindingTargetInterfaceMethodName,
|
||||
// registry);
|
||||
}
|
||||
|
||||
public static void registerOutputBindingTargetBeanDefinition(String qualifierValue,
|
||||
String name, String bindingTargetInterfaceBeanName,
|
||||
String bindingTargetInterfaceMethodName, BeanDefinitionRegistry registry) {
|
||||
System.out.println();
|
||||
// registerBindingTargetBeanDefinition(Output.class, qualifierValue, name,
|
||||
// bindingTargetInterfaceBeanName, bindingTargetInterfaceMethodName,
|
||||
// registry);
|
||||
}
|
||||
|
||||
private static void registerBindingTargetBeanDefinition(
|
||||
Class<? extends Annotation> qualifier, String qualifierValue, String name,
|
||||
String bindingTargetInterfaceBeanName,
|
||||
String bindingTargetInterfaceMethodName, BeanDefinitionRegistry registry) {
|
||||
|
||||
if (registry.containsBeanDefinition(name)) {
|
||||
throw new BeanDefinitionStoreException(bindingTargetInterfaceBeanName, name,
|
||||
"bean definition with this name already exists - "
|
||||
+ registry.getBeanDefinition(name));
|
||||
}
|
||||
|
||||
RootBeanDefinition rootBeanDefinition = new RootBeanDefinition();
|
||||
rootBeanDefinition.setFactoryBeanName(bindingTargetInterfaceBeanName);
|
||||
rootBeanDefinition.setUniqueFactoryMethodName(bindingTargetInterfaceMethodName);
|
||||
rootBeanDefinition
|
||||
.addQualifier(new AutowireCandidateQualifier(qualifier, qualifierValue));
|
||||
registry.registerBeanDefinition(name, rootBeanDefinition);
|
||||
}
|
||||
|
||||
public static void registerBindingTargetBeanDefinitions(Class<?> type,
|
||||
final String bindingTargetInterfaceBeanName,
|
||||
final BeanDefinitionRegistry registry) {
|
||||
// ReflectionUtils.doWithMethods(type, method -> {
|
||||
// Input input = AnnotationUtils.findAnnotation(method, Input.class);
|
||||
// if (input != null) {
|
||||
// String name = getBindingTargetName(input, method);
|
||||
// if (!registry.containsBeanDefinition(name)) {
|
||||
// registerInputBindingTargetBeanDefinition(input.value(), name,
|
||||
// bindingTargetInterfaceBeanName, method.getName(), registry);
|
||||
// }
|
||||
// }
|
||||
// Output output = AnnotationUtils.findAnnotation(method, Output.class);
|
||||
// if (output != null) {
|
||||
// String name = getBindingTargetName(output, method);
|
||||
// if (!registry.containsBeanDefinition(name)) {
|
||||
// registerOutputBindingTargetBeanDefinition(output.value(), name,
|
||||
// bindingTargetInterfaceBeanName, method.getName(), registry);
|
||||
// }
|
||||
// }
|
||||
// });
|
||||
}
|
||||
|
||||
public static void registerBindingTargetsQualifiedBeanDefinitions(Class<?> parent,
|
||||
Class<?> type, final BeanDefinitionRegistry registry) {
|
||||
|
||||
if (type.isInterface()) {
|
||||
RootBeanDefinition rootBeanDefinition = new RootBeanDefinition(
|
||||
BindableProxyFactory.class);
|
||||
rootBeanDefinition.getConstructorArgumentValues()
|
||||
.addGenericArgumentValue(type);
|
||||
registry.registerBeanDefinition(type.getName(), rootBeanDefinition);
|
||||
}
|
||||
else {
|
||||
RootBeanDefinition rootBeanDefinition = new RootBeanDefinition(type);
|
||||
registry.registerBeanDefinition(type.getName(), rootBeanDefinition);
|
||||
}
|
||||
}
|
||||
|
||||
public static String getBindingTargetName(Annotation annotation, Method method) {
|
||||
Map<String, Object> attrs = AnnotationUtils.getAnnotationAttributes(annotation,
|
||||
false);
|
||||
if (attrs.containsKey("value")
|
||||
&& StringUtils.hasText((CharSequence) attrs.get("value"))) {
|
||||
return (String) attrs.get("value");
|
||||
}
|
||||
return method.getName();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,68 +0,0 @@
|
||||
/*
|
||||
* Copyright 2016-2017 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.binding;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
|
||||
import org.springframework.core.MethodParameter;
|
||||
import org.springframework.core.annotation.AnnotationUtils;
|
||||
import org.springframework.messaging.handler.annotation.SendTo;
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.util.ObjectUtils;
|
||||
|
||||
/**
|
||||
* Common methods that can be used across various Stream annotations.
|
||||
*
|
||||
* @author Soby Chacko
|
||||
* @since 1.3.0
|
||||
*/
|
||||
public abstract class StreamAnnotationCommonMethodUtils {
|
||||
|
||||
public static String getOutboundBindingTargetName(Method method) {
|
||||
SendTo sendTo = AnnotationUtils.findAnnotation(method, SendTo.class);
|
||||
if (sendTo != null) {
|
||||
Assert.isTrue(!ObjectUtils.isEmpty(sendTo.value()),
|
||||
StreamAnnotationErrorMessages.ATLEAST_ONE_OUTPUT);
|
||||
Assert.isTrue(sendTo.value().length == 1,
|
||||
StreamAnnotationErrorMessages.SEND_TO_MULTIPLE_DESTINATIONS);
|
||||
Assert.hasText(sendTo.value()[0],
|
||||
StreamAnnotationErrorMessages.SEND_TO_EMPTY_DESTINATION);
|
||||
return sendTo.value()[0];
|
||||
}
|
||||
// Output output = AnnotationUtils.findAnnotation(method, Output.class);
|
||||
// if (output != null) {
|
||||
// Assert.isTrue(StringUtils.hasText(output.value()),
|
||||
// StreamAnnotationErrorMessages.ATLEAST_ONE_OUTPUT);
|
||||
// return output.value();
|
||||
// }
|
||||
return null;
|
||||
}
|
||||
|
||||
public static int outputAnnotationCount(Method method) {
|
||||
int outputAnnotationCount = 0;
|
||||
for (int parameterIndex = 0; parameterIndex < method
|
||||
.getParameterTypes().length; parameterIndex++) {
|
||||
MethodParameter methodParameter = MethodParameter.forExecutable(method,
|
||||
parameterIndex);
|
||||
// if (methodParameter.hasParameterAnnotation(Output.class)) {
|
||||
// outputAnnotationCount++;
|
||||
// }
|
||||
}
|
||||
return outputAnnotationCount;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -28,7 +28,6 @@ import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import org.springframework.beans.BeansException;
|
||||
import org.springframework.beans.factory.ObjectProvider;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.beans.factory.config.BeanDefinition;
|
||||
import org.springframework.beans.factory.config.BeanPostProcessor;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
|
||||
@@ -43,7 +42,6 @@ import org.springframework.cloud.stream.binder.BinderType;
|
||||
import org.springframework.cloud.stream.binder.BinderTypeRegistry;
|
||||
import org.springframework.cloud.stream.binder.DefaultBinderFactory;
|
||||
import org.springframework.cloud.stream.binding.Bindable;
|
||||
import org.springframework.cloud.stream.binding.BinderAwareRouter;
|
||||
import org.springframework.cloud.stream.binding.BindingService;
|
||||
import org.springframework.cloud.stream.binding.BindingsLifecycleController;
|
||||
import org.springframework.cloud.stream.binding.ContextStartAfterRefreshListener;
|
||||
@@ -62,13 +60,10 @@ import org.springframework.context.annotation.Role;
|
||||
import org.springframework.context.event.ContextRefreshedEvent;
|
||||
import org.springframework.integration.channel.PublishSubscribeChannel;
|
||||
import org.springframework.integration.handler.AbstractReplyProducingMessageHandler;
|
||||
import org.springframework.integration.router.AbstractMappingMessageRouter;
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.messaging.MessageChannel;
|
||||
import org.springframework.messaging.core.DestinationResolver;
|
||||
import org.springframework.scheduling.TaskScheduler;
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.util.ObjectUtils;
|
||||
|
||||
/**
|
||||
@@ -84,7 +79,6 @@ import org.springframework.util.ObjectUtils;
|
||||
* @author Oleg Zhurakousky
|
||||
* @author Soby Chacko
|
||||
*/
|
||||
@SuppressWarnings("deprecation")
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
@EnableConfigurationProperties({ BindingServiceProperties.class,
|
||||
SpringIntegrationProperties.class, StreamFunctionProperties.class })
|
||||
@@ -243,16 +237,16 @@ public class BindingServiceConfiguration {
|
||||
return new DynamicDestinationsBindable();
|
||||
}
|
||||
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
public BinderAwareRouter binderAwareRouterBeanPostProcessor(
|
||||
@Autowired(required = false) List<AbstractMappingMessageRouter> routers,
|
||||
@Autowired(required = false) @Qualifier("binderAwareChannelResolver")
|
||||
DestinationResolver<MessageChannel> channelResolver) {
|
||||
final AbstractMappingMessageRouter[] routersArray = CollectionUtils.isEmpty(routers) ?
|
||||
new AbstractMappingMessageRouter[]{} : routers.toArray(new AbstractMappingMessageRouter[]{});
|
||||
return new BinderAwareRouter(routersArray, channelResolver);
|
||||
}
|
||||
// @Bean
|
||||
// @ConditionalOnMissingBean
|
||||
// public BinderAwareRouter binderAwareRouterBeanPostProcessor(
|
||||
// @Autowired(required = false) List<AbstractMappingMessageRouter> routers,
|
||||
// @Autowired(required = false) @Qualifier("binderAwareChannelResolver")
|
||||
// DestinationResolver<MessageChannel> channelResolver) {
|
||||
// final AbstractMappingMessageRouter[] routersArray = CollectionUtils.isEmpty(routers) ?
|
||||
// new AbstractMappingMessageRouter[]{} : routers.toArray(new AbstractMappingMessageRouter[]{});
|
||||
// return new BinderAwareRouter(routersArray, channelResolver);
|
||||
// }
|
||||
|
||||
@Bean
|
||||
public ApplicationListener<ContextRefreshedEvent> appListener(
|
||||
|
||||
@@ -70,7 +70,7 @@ import org.springframework.util.StringUtils;
|
||||
* @since 3.0.3
|
||||
*
|
||||
*/
|
||||
@SuppressWarnings("deprecation")
|
||||
@SuppressWarnings("rawtypes")
|
||||
public final class StreamBridge implements SmartInitializingSingleton {
|
||||
|
||||
private static String STREAM_BRIDGE_FUNC_NAME = "streamBridge";
|
||||
@@ -202,7 +202,7 @@ public final class StreamBridge implements SmartInitializingSingleton {
|
||||
* @param outputContentType content type to be used to deal with output type conversion
|
||||
* @return true if data was sent successfully, otherwise false or throws an exception.
|
||||
*/
|
||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
||||
@SuppressWarnings({ "unchecked"})
|
||||
public boolean send(String bindingName, @Nullable String binderName, Object data, MimeType outputContentType) {
|
||||
if (!(data instanceof Message)) {
|
||||
data = MessageBuilder.withPayload(data).build();
|
||||
@@ -253,7 +253,7 @@ public final class StreamBridge implements SmartInitializingSingleton {
|
||||
this.initialized = true;
|
||||
}
|
||||
|
||||
@SuppressWarnings({ "unchecked", "rawtypes"})
|
||||
@SuppressWarnings({ "unchecked"})
|
||||
synchronized MessageChannel resolveDestination(String destinationName, ProducerProperties producerProperties, String binderName) {
|
||||
MessageChannel messageChannel = this.channelCache.get(destinationName);
|
||||
if (messageChannel == null && this.applicationContext.containsBean(destinationName)) {
|
||||
|
||||
Reference in New Issue
Block a user