Sonar - protected fields
This commit is contained in:
committed by
Artem Bilan
parent
37e49a23f4
commit
0d6faa2e34
@@ -44,7 +44,7 @@ public abstract class
|
||||
AmqpBaseOutboundEndpointSpec<S extends AmqpBaseOutboundEndpointSpec<S, E>, E extends AbstractAmqpOutboundEndpoint>
|
||||
extends MessageHandlerSpec<S, E> {
|
||||
|
||||
protected final DefaultAmqpHeaderMapper headerMapper = DefaultAmqpHeaderMapper.outboundMapper();
|
||||
protected final DefaultAmqpHeaderMapper headerMapper = DefaultAmqpHeaderMapper.outboundMapper(); // NOSONAR final
|
||||
|
||||
/**
|
||||
* Set a custom {@link AmqpHeaderMapper} for mapping request and reply headers.
|
||||
|
||||
@@ -40,7 +40,7 @@ public abstract class AmqpInboundChannelAdapterSpec
|
||||
extends AmqpBaseInboundChannelAdapterSpec<S>
|
||||
implements ComponentsRegistration {
|
||||
|
||||
protected final AbstractMessageListenerContainerSpec<?, C> listenerContainerSpec;
|
||||
protected final AbstractMessageListenerContainerSpec<?, C> listenerContainerSpec; // NOSONAR final
|
||||
|
||||
AmqpInboundChannelAdapterSpec(AbstractMessageListenerContainerSpec<?, C> listenerContainerSpec) {
|
||||
super(new AmqpInboundChannelAdapter(listenerContainerSpec.get()));
|
||||
|
||||
@@ -40,7 +40,7 @@ public abstract class AmqpInboundGatewaySpec
|
||||
extends AmqpBaseInboundGatewaySpec<S>
|
||||
implements ComponentsRegistration {
|
||||
|
||||
protected final AbstractMessageListenerContainerSpec<?, C> listenerContainerSpec;
|
||||
protected final AbstractMessageListenerContainerSpec<?, C> listenerContainerSpec; // NOSONAR final
|
||||
|
||||
AmqpInboundGatewaySpec(AbstractMessageListenerContainerSpec<?, C> listenerContainerSpec) {
|
||||
super(new AmqpInboundGateway(listenerContainerSpec.get()));
|
||||
|
||||
@@ -42,7 +42,7 @@ import org.springframework.util.Assert;
|
||||
public class AmqpPollableMessageChannelSpec<S extends AmqpPollableMessageChannelSpec<S>>
|
||||
extends MessageChannelSpec<S, AbstractAmqpChannel> {
|
||||
|
||||
protected final AmqpChannelFactoryBean amqpChannelFactoryBean;
|
||||
protected final AmqpChannelFactoryBean amqpChannelFactoryBean; // NOSONAR final
|
||||
|
||||
AmqpPollableMessageChannelSpec(ConnectionFactory connectionFactory) {
|
||||
this(new AmqpChannelFactoryBean(false), connectionFactory);
|
||||
|
||||
@@ -47,7 +47,7 @@ public class QueueChannel extends AbstractPollableChannel implements QueueChanne
|
||||
|
||||
private final Queue<Message<?>> queue;
|
||||
|
||||
protected final Semaphore queueSemaphore = new Semaphore(0);
|
||||
protected final Semaphore queueSemaphore = new Semaphore(0); // NOSONAR final
|
||||
|
||||
/**
|
||||
* Create a channel with the specified queue.
|
||||
|
||||
@@ -39,7 +39,7 @@ import com.esotericsoftware.kryo.pool.KryoPool;
|
||||
*/
|
||||
public abstract class AbstractKryoCodec implements Codec {
|
||||
|
||||
protected final KryoPool pool;
|
||||
protected final KryoPool pool; // NOSONAR final
|
||||
|
||||
protected AbstractKryoCodec() {
|
||||
KryoFactory factory = () -> {
|
||||
@@ -53,7 +53,7 @@ public abstract class AbstractKryoCodec implements Codec {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void encode(final Object object, OutputStream outputStream) throws IOException {
|
||||
public void encode(final Object object, OutputStream outputStream) {
|
||||
Assert.notNull(object, "cannot encode a null object");
|
||||
Assert.notNull(outputStream, "'outputSteam' cannot be null");
|
||||
final Output output = (outputStream instanceof Output ? (Output) outputStream : new Output(outputStream));
|
||||
@@ -77,7 +77,7 @@ public abstract class AbstractKryoCodec implements Codec {
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> T decode(InputStream inputStream, final Class<T> type) throws IOException {
|
||||
public <T> T decode(InputStream inputStream, final Class<T> type) {
|
||||
Assert.notNull(inputStream, "'inputStream' cannot be null");
|
||||
Assert.notNull(type, "'type' cannot be null");
|
||||
final Input input = (inputStream instanceof Input ? (Input) inputStream : new Input(inputStream));
|
||||
|
||||
@@ -46,7 +46,7 @@ public abstract class AbstractIntegrationNamespaceHandler implements NamespaceHa
|
||||
|
||||
private static final String VERSION = "5.2";
|
||||
|
||||
protected final Log logger = LogFactory.getLog(this.getClass());
|
||||
protected final Log logger = LogFactory.getLog(this.getClass()); // NOSONAR final
|
||||
|
||||
private final NamespaceHandlerDelegate delegate = new NamespaceHandlerDelegate();
|
||||
|
||||
|
||||
@@ -50,9 +50,9 @@ import org.springframework.util.Assert;
|
||||
*/
|
||||
public class ErrorMessagePublisher implements BeanFactoryAware {
|
||||
|
||||
protected final Log logger = LogFactory.getLog(getClass());
|
||||
protected final Log logger = LogFactory.getLog(getClass()); // NOSONAR final
|
||||
|
||||
protected final MessagingTemplate messagingTemplate = new MessagingTemplate();
|
||||
protected final MessagingTemplate messagingTemplate = new MessagingTemplate(); // NOSONAR final
|
||||
|
||||
private DestinationResolver<MessageChannel> channelResolver;
|
||||
|
||||
|
||||
@@ -43,7 +43,7 @@ import org.springframework.util.Assert;
|
||||
*/
|
||||
public abstract class AbstractDispatcher implements MessageDispatcher {
|
||||
|
||||
protected final Log logger = LogFactory.getLog(this.getClass());
|
||||
protected final Log logger = LogFactory.getLog(getClass()); // NOSONAR final
|
||||
|
||||
private volatile int maxSubscribers = Integer.MAX_VALUE;
|
||||
|
||||
|
||||
@@ -65,7 +65,7 @@ public class RoundRobinLoadBalancingStrategy implements LoadBalancingStrategy {
|
||||
|
||||
return new Iterator<MessageHandler>() {
|
||||
|
||||
int currentIndex = 0;
|
||||
private int currentIndex = 0;
|
||||
|
||||
public boolean hasNext() {
|
||||
return this.currentIndex < reorderedHandlers.length;
|
||||
|
||||
@@ -51,7 +51,7 @@ import reactor.util.function.Tuple2;
|
||||
public abstract class ConsumerEndpointSpec<S extends ConsumerEndpointSpec<S, H>, H extends MessageHandler>
|
||||
extends EndpointSpec<S, ConsumerEndpointFactoryBean, H> {
|
||||
|
||||
protected final List<Advice> adviceChain = new LinkedList<>();
|
||||
protected final List<Advice> adviceChain = new LinkedList<>(); // NOSONAR final
|
||||
|
||||
protected ConsumerEndpointSpec(H messageHandler) {
|
||||
super(messageHandler);
|
||||
|
||||
@@ -47,11 +47,11 @@ public abstract class EndpointSpec<S extends EndpointSpec<S, F, H>, F extends Be
|
||||
extends IntegrationComponentSpec<S, Tuple2<F, H>>
|
||||
implements ComponentsRegistration {
|
||||
|
||||
protected final Map<Object, String> componentsToRegister = new LinkedHashMap<>();
|
||||
protected final Map<Object, String> componentsToRegister = new LinkedHashMap<>(); // NOSONAR final
|
||||
|
||||
protected H handler;
|
||||
protected H handler; // NOSONAR final
|
||||
|
||||
protected F endpointFactoryBean;
|
||||
protected F endpointFactoryBean; // NOSONAR final
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
protected EndpointSpec(H handler) {
|
||||
|
||||
@@ -32,28 +32,28 @@ import org.springframework.integration.dispatcher.RoundRobinLoadBalancingStrateg
|
||||
public abstract class LoadBalancingChannelSpec<S extends MessageChannelSpec<S, C>, C extends AbstractMessageChannel>
|
||||
extends MessageChannelSpec<S, C> {
|
||||
|
||||
protected LoadBalancingStrategy loadBalancingStrategy = new RoundRobinLoadBalancingStrategy();
|
||||
protected LoadBalancingStrategy loadBalancingStrategy = new RoundRobinLoadBalancingStrategy(); // NOSONAR
|
||||
|
||||
protected Boolean failover;
|
||||
protected Boolean failover; // NOSONAR
|
||||
|
||||
protected Integer maxSubscribers;
|
||||
protected Integer maxSubscribers; // NOSONAR
|
||||
|
||||
protected LoadBalancingChannelSpec() {
|
||||
super();
|
||||
}
|
||||
|
||||
public S loadBalancer(LoadBalancingStrategy loadBalancingStrategy) {
|
||||
this.loadBalancingStrategy = loadBalancingStrategy;
|
||||
public S loadBalancer(LoadBalancingStrategy loadBalancingStrategyToSet) {
|
||||
this.loadBalancingStrategy = loadBalancingStrategyToSet;
|
||||
return _this();
|
||||
}
|
||||
|
||||
public S failover(Boolean failover) {
|
||||
this.failover = failover;
|
||||
public S failover(Boolean failoverToSet) {
|
||||
this.failover = failoverToSet;
|
||||
return _this();
|
||||
}
|
||||
|
||||
public S maxSubscribers(Integer maxSubscribers) {
|
||||
this.maxSubscribers = maxSubscribers;
|
||||
public S maxSubscribers(Integer maxSubscribersToSet) {
|
||||
this.maxSubscribers = maxSubscribersToSet;
|
||||
return _this();
|
||||
}
|
||||
|
||||
|
||||
@@ -49,7 +49,7 @@ public abstract class MessageChannelSpec<S extends MessageChannelSpec<S, C>, C e
|
||||
|
||||
private final List<ChannelInterceptor> interceptors = new LinkedList<>();
|
||||
|
||||
protected C channel;
|
||||
protected C channel; // NOSONAR
|
||||
|
||||
private MessageConverter messageConverter;
|
||||
|
||||
|
||||
@@ -31,9 +31,9 @@ import org.springframework.messaging.Message;
|
||||
*/
|
||||
public class QueueChannelSpec extends MessageChannelSpec<QueueChannelSpec, QueueChannel> {
|
||||
|
||||
protected Queue<Message<?>> queue;
|
||||
protected Queue<Message<?>> queue; // NOSONAR
|
||||
|
||||
protected Integer capacity;
|
||||
protected Integer capacity; // NOSONAR
|
||||
|
||||
QueueChannelSpec() {
|
||||
super();
|
||||
@@ -84,13 +84,13 @@ public class QueueChannelSpec extends MessageChannelSpec<QueueChannelSpec, Queue
|
||||
}
|
||||
|
||||
|
||||
public MessageStoreSpec capacity(Integer capacity) {
|
||||
this.capacity = capacity;
|
||||
public MessageStoreSpec capacity(Integer capacityToSet) {
|
||||
this.capacity = capacityToSet;
|
||||
return this;
|
||||
}
|
||||
|
||||
public MessageStoreSpec storeLock(Lock storeLock) {
|
||||
this.storeLock = storeLock;
|
||||
public MessageStoreSpec storeLock(Lock storeLockToSet) {
|
||||
this.storeLock = storeLockToSet;
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
@@ -801,7 +801,7 @@ public class GatewayProxyFactoryBean extends AbstractEndpoint
|
||||
|
||||
private static final class MethodInvocationGateway extends MessagingGatewaySupport {
|
||||
|
||||
Expression receiveTimeoutExpression;
|
||||
private Expression receiveTimeoutExpression;
|
||||
|
||||
MethodInvocationGateway(GatewayMethodInboundMessageMapper messageMapper) {
|
||||
setRequestMapper(messageMapper);
|
||||
|
||||
@@ -66,7 +66,7 @@ public abstract class AbstractHeaderMapper<T> implements RequestReplyHeaderMappe
|
||||
private static final Collection<String> TRANSIENT_HEADER_NAMES = Arrays.asList(
|
||||
MessageHeaders.ID, MessageHeaders.TIMESTAMP);
|
||||
|
||||
protected final Log logger = LogFactory.getLog(getClass());
|
||||
protected final Log logger = LogFactory.getLog(getClass()); // NOSONAR final
|
||||
|
||||
private final String standardHeaderPrefix;
|
||||
|
||||
|
||||
@@ -40,7 +40,7 @@ import org.springframework.messaging.Message;
|
||||
public abstract class AbstractMessageGroupStore extends AbstractBatchingMessageGroupStore
|
||||
implements MessageGroupStore, Iterable<MessageGroup> {
|
||||
|
||||
protected final Log logger = LogFactory.getLog(getClass());
|
||||
protected final Log logger = LogFactory.getLog(getClass()); // NOSONAR final
|
||||
|
||||
private final Collection<MessageGroupCallback> expiryCallbacks = new LinkedHashSet<>();
|
||||
|
||||
|
||||
@@ -29,6 +29,7 @@ import org.springframework.util.Assert;
|
||||
* to a {@link org.springframework.messaging.Message} with the specified payload type.
|
||||
*
|
||||
* @author Artem Bilan
|
||||
* @author Gary Russell
|
||||
* @since 3.0
|
||||
*
|
||||
* @see JsonInboundMessageMapper
|
||||
@@ -47,11 +48,11 @@ public abstract class AbstractJsonInboundMessageMapper<P> implements InboundMess
|
||||
DEFAULT_HEADER_TYPES.put(IntegrationMessageHeaderAccessor.SEQUENCE_NUMBER, Integer.class);
|
||||
}
|
||||
|
||||
protected final Type payloadType;
|
||||
protected final Type payloadType; // NOSONAR final
|
||||
|
||||
protected final Map<String, Class<?>> headerTypes = DEFAULT_HEADER_TYPES;
|
||||
protected final Map<String, Class<?>> headerTypes = DEFAULT_HEADER_TYPES; // NOSONAR final
|
||||
|
||||
protected volatile boolean mapToPayload = false;
|
||||
private boolean mapToPayload = false;
|
||||
|
||||
public AbstractJsonInboundMessageMapper(Type payloadType) {
|
||||
Assert.notNull(payloadType, "payloadType must not be null");
|
||||
@@ -66,6 +67,10 @@ public abstract class AbstractJsonInboundMessageMapper<P> implements InboundMess
|
||||
this.mapToPayload = mapToPayload;
|
||||
}
|
||||
|
||||
public boolean isMapToPayload() {
|
||||
return this.mapToPayload;
|
||||
}
|
||||
|
||||
protected abstract Object readPayload(P parser, String jsonMessage);
|
||||
|
||||
protected abstract Map<String, Object> readHeaders(P parser, String jsonMessage);
|
||||
|
||||
@@ -79,7 +79,7 @@ import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
*/
|
||||
public class EmbeddedJsonHeadersMessageMapper implements BytesMessageMapper {
|
||||
|
||||
protected final Log logger = LogFactory.getLog(getClass());
|
||||
protected final Log logger = LogFactory.getLog(getClass()); // NOSONAR final
|
||||
|
||||
private final ObjectMapper objectMapper;
|
||||
|
||||
|
||||
@@ -52,10 +52,6 @@ public class JsonInboundMessageMapper extends AbstractJsonInboundMessageMapper<J
|
||||
this.messageParser = messageParser;
|
||||
}
|
||||
|
||||
public boolean isMapToPayload() {
|
||||
return mapToPayload;
|
||||
}
|
||||
|
||||
public Type getPayloadType() {
|
||||
return payloadType;
|
||||
}
|
||||
|
||||
@@ -29,11 +29,11 @@ import org.apache.commons.logging.LogFactory;
|
||||
@SuppressWarnings("deprecation")
|
||||
public abstract class AbstractMessageHandlerMetrics implements ConfigurableMetrics {
|
||||
|
||||
protected final Log logger = LogFactory.getLog(getClass());
|
||||
protected final Log logger = LogFactory.getLog(getClass()); // NOSONAR final
|
||||
|
||||
protected final String name;
|
||||
protected final String name; // NOSONAR final
|
||||
|
||||
private volatile boolean fullStatsEnabled;
|
||||
private boolean fullStatsEnabled;
|
||||
|
||||
public AbstractMessageHandlerMetrics(String name) {
|
||||
this.name = name;
|
||||
|
||||
@@ -99,7 +99,7 @@ public class AggregatingMessageChannelMetrics extends DefaultMessageChannelMetri
|
||||
|
||||
protected static class AggregatingChannelMetricsContext extends DefaultChannelMetricsContext {
|
||||
|
||||
protected long newCount;
|
||||
protected long newCount; // NOSONAR
|
||||
|
||||
public AggregatingChannelMetricsContext(long start, long newCount) {
|
||||
super(start);
|
||||
|
||||
@@ -37,21 +37,21 @@ public class DefaultMessageChannelMetrics extends AbstractMessageChannelMetrics
|
||||
|
||||
public static final int DEFAULT_MOVING_AVERAGE_WINDOW = 10;
|
||||
|
||||
protected final ExponentialMovingAverage sendDuration;
|
||||
protected final ExponentialMovingAverage sendDuration; // NOSONAR final
|
||||
|
||||
protected final ExponentialMovingAverageRate sendErrorRate;
|
||||
protected final ExponentialMovingAverageRate sendErrorRate; // NOSONAR final
|
||||
|
||||
protected final ExponentialMovingAverageRatio sendSuccessRatio;
|
||||
protected final ExponentialMovingAverageRatio sendSuccessRatio; // NOSONAR final
|
||||
|
||||
protected final ExponentialMovingAverageRate sendRate;
|
||||
protected final ExponentialMovingAverageRate sendRate; // NOSONAR final
|
||||
|
||||
protected final AtomicLong sendCount = new AtomicLong();
|
||||
protected final AtomicLong sendCount = new AtomicLong(); // NOSONAR final
|
||||
|
||||
protected final AtomicLong sendErrorCount = new AtomicLong();
|
||||
protected final AtomicLong sendErrorCount = new AtomicLong(); // NOSONAR final
|
||||
|
||||
protected final AtomicLong receiveCount = new AtomicLong();
|
||||
protected final AtomicLong receiveCount = new AtomicLong(); // NOSONAR final
|
||||
|
||||
protected final AtomicLong receiveErrorCount = new AtomicLong();
|
||||
protected final AtomicLong receiveErrorCount = new AtomicLong(); // NOSONAR final
|
||||
|
||||
public DefaultMessageChannelMetrics() {
|
||||
this(null);
|
||||
@@ -256,7 +256,7 @@ public class DefaultMessageChannelMetrics extends AbstractMessageChannelMetrics
|
||||
|
||||
protected static class DefaultChannelMetricsContext implements MetricsContext {
|
||||
|
||||
protected final long start;
|
||||
protected final long start; // NOSONAR
|
||||
|
||||
protected DefaultChannelMetricsContext(long start) {
|
||||
this.start = start;
|
||||
|
||||
@@ -31,13 +31,13 @@ public class DefaultMessageHandlerMetrics extends AbstractMessageHandlerMetrics
|
||||
private static final int DEFAULT_MOVING_AVERAGE_WINDOW = 10;
|
||||
|
||||
|
||||
protected final AtomicLong activeCount = new AtomicLong();
|
||||
protected final AtomicLong activeCount = new AtomicLong(); // NOSONAR final
|
||||
|
||||
protected final AtomicLong handleCount = new AtomicLong();
|
||||
protected final AtomicLong handleCount = new AtomicLong(); // NOSONAR final
|
||||
|
||||
protected final AtomicLong errorCount = new AtomicLong();
|
||||
protected final AtomicLong errorCount = new AtomicLong(); // NOSONAR final
|
||||
|
||||
protected final ExponentialMovingAverage duration;
|
||||
protected final ExponentialMovingAverage duration; // NOSONAR final
|
||||
|
||||
public DefaultMessageHandlerMetrics() {
|
||||
this(null);
|
||||
@@ -153,7 +153,7 @@ public class DefaultMessageHandlerMetrics extends AbstractMessageHandlerMetrics
|
||||
|
||||
protected static class DefaultHandlerMetricsContext implements MetricsContext {
|
||||
|
||||
protected final long start;
|
||||
protected final long start; // NOSONAR final
|
||||
|
||||
protected DefaultHandlerMetricsContext(long start) {
|
||||
this.start = start;
|
||||
|
||||
@@ -85,13 +85,13 @@ public interface IntegrationManagement extends DisposableBean {
|
||||
*/
|
||||
class ManagementOverrides {
|
||||
|
||||
public boolean loggingConfigured;
|
||||
public boolean loggingConfigured; // NOSONAR
|
||||
|
||||
public boolean countsConfigured;
|
||||
public boolean countsConfigured; // NOSONAR
|
||||
|
||||
public boolean statsConfigured;
|
||||
public boolean statsConfigured; // NOSONAR
|
||||
|
||||
public boolean metricsConfigured;
|
||||
public boolean metricsConfigured; // NOSONAR
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -38,7 +38,7 @@ public class LifecycleMessageSourceMetrics implements MessageSourceMetrics, Life
|
||||
|
||||
private final Lifecycle lifecycle;
|
||||
|
||||
protected final MessageSourceMetrics delegate;
|
||||
protected final MessageSourceMetrics delegate; // NOSONAR final
|
||||
|
||||
|
||||
public LifecycleMessageSourceMetrics(Lifecycle lifecycle, MessageSourceMetrics delegate) {
|
||||
|
||||
@@ -29,7 +29,7 @@ import org.springframework.transaction.support.ResourceHolderSynchronization;
|
||||
public class IntegrationResourceHolderSynchronization
|
||||
extends ResourceHolderSynchronization<IntegrationResourceHolder, Object> {
|
||||
|
||||
protected final IntegrationResourceHolder resourceHolder;
|
||||
protected final IntegrationResourceHolder resourceHolder; // NOSONAR final
|
||||
|
||||
private boolean shouldUnbindAtCompletion = true;
|
||||
|
||||
|
||||
@@ -41,7 +41,7 @@ import org.springframework.util.Assert;
|
||||
*/
|
||||
public class SimplePool<T> implements Pool<T> {
|
||||
|
||||
protected final Log logger = LogFactory.getLog(this.getClass());
|
||||
protected final Log logger = LogFactory.getLog(getClass()); // NOSONAR final
|
||||
|
||||
private final Semaphore permits = new Semaphore(0);
|
||||
|
||||
|
||||
@@ -26,12 +26,13 @@ import java.util.concurrent.TimeUnit;
|
||||
* @author Mark Fisher
|
||||
* @author Iwein Fuld
|
||||
* @author Artem Bilan
|
||||
* @author Gary Russell
|
||||
*
|
||||
* @since 2.0
|
||||
*/
|
||||
public final class UpperBound {
|
||||
|
||||
public final Semaphore semaphore;
|
||||
private final Semaphore semaphore;
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@@ -47,7 +47,7 @@ public abstract class RemoteFileInboundChannelAdapterSpec<F, S extends RemoteFil
|
||||
extends MessageSourceSpec<S, MS>
|
||||
implements ComponentsRegistration {
|
||||
|
||||
protected final AbstractInboundFileSynchronizer<F> synchronizer;
|
||||
protected final AbstractInboundFileSynchronizer<F> synchronizer; // NOSONAR final
|
||||
|
||||
private ExpressionFileListFilter<F> expressionFileListFilter;
|
||||
|
||||
|
||||
@@ -117,9 +117,9 @@ public class RotatingServerAdvice extends AbstractMessageSourceAdvice {
|
||||
*/
|
||||
public static class StandardRotationPolicy implements RotationPolicy {
|
||||
|
||||
protected final Log logger = LogFactory.getLog(getClass());
|
||||
protected final Log logger = LogFactory.getLog(getClass()); // NOSONAR final
|
||||
|
||||
protected final DelegatingSessionFactory<?> factory;
|
||||
protected final DelegatingSessionFactory<?> factory; // NOSONAR final
|
||||
|
||||
private final List<KeyDirectory> keyDirectories = new ArrayList<>();
|
||||
|
||||
|
||||
@@ -42,23 +42,23 @@ public abstract class AbstractFtpSessionFactory<T extends FTPClient> implements
|
||||
|
||||
protected final Log logger = LogFactory.getLog(this.getClass()); // NOSONAR
|
||||
|
||||
protected FTPClientConfig config;
|
||||
private FTPClientConfig config;
|
||||
|
||||
protected String username;
|
||||
private String username;
|
||||
|
||||
protected String host;
|
||||
private String host;
|
||||
|
||||
protected String password;
|
||||
private String password;
|
||||
|
||||
protected int port = FTP.DEFAULT_PORT;
|
||||
private int port = FTP.DEFAULT_PORT;
|
||||
|
||||
protected int bufferSize = 2048; //see https://issues.apache.org/jira/browse/NET-207
|
||||
private int bufferSize = 2048; //see https://issues.apache.org/jira/browse/NET-207
|
||||
|
||||
protected int clientMode = FTPClient.ACTIVE_LOCAL_DATA_CONNECTION_MODE;
|
||||
private int clientMode = FTPClient.ACTIVE_LOCAL_DATA_CONNECTION_MODE;
|
||||
|
||||
protected int fileType = FTP.BINARY_FILE_TYPE;
|
||||
private int fileType = FTP.BINARY_FILE_TYPE;
|
||||
|
||||
protected String controlEncoding = FTP.DEFAULT_CONTROL_ENCODING;
|
||||
private String controlEncoding = FTP.DEFAULT_CONTROL_ENCODING;
|
||||
|
||||
private Integer connectTimeout;
|
||||
|
||||
|
||||
@@ -49,11 +49,11 @@ public abstract class HttpInboundEndpointSupportSpec<S extends HttpInboundEndpoi
|
||||
extends MessagingGatewaySpec<S, E>
|
||||
implements ComponentsRegistration {
|
||||
|
||||
protected final RequestMapping requestMapping = new RequestMapping();
|
||||
protected final RequestMapping requestMapping = new RequestMapping(); // NOSONAR final
|
||||
|
||||
protected final Map<String, Expression> headerExpressions = new HashMap<>();
|
||||
protected final Map<String, Expression> headerExpressions = new HashMap<>(); // NOSONAR final
|
||||
|
||||
protected final HeaderMapper<HttpHeaders> headerMapper = DefaultHttpHeaderMapper.inboundMapper();
|
||||
protected final HeaderMapper<HttpHeaders> headerMapper = DefaultHttpHeaderMapper.inboundMapper(); // NOSONAR final
|
||||
|
||||
private HeaderMapper<HttpHeaders> explicitHeaderMapper;
|
||||
|
||||
@@ -67,12 +67,12 @@ public abstract class HttpInboundEndpointSupportSpec<S extends HttpInboundEndpoi
|
||||
|
||||
/**
|
||||
* Provide a {@link Consumer} for configuring {@link RequestMapping} via {@link RequestMappingSpec}
|
||||
* @param requestMapping the {@link Consumer} to configure {@link RequestMappingSpec}.
|
||||
* @param mapping the {@link Consumer} to configure {@link RequestMappingSpec}.
|
||||
* @return the spec
|
||||
* @see RequestMapping
|
||||
*/
|
||||
public S requestMapping(Consumer<RequestMappingSpec> requestMapping) {
|
||||
requestMapping.accept(new RequestMappingSpec(this.requestMapping));
|
||||
public S requestMapping(Consumer<RequestMappingSpec> mapping) {
|
||||
mapping.accept(new RequestMappingSpec(this.requestMapping));
|
||||
return _this();
|
||||
}
|
||||
|
||||
@@ -123,14 +123,14 @@ public abstract class HttpInboundEndpointSupportSpec<S extends HttpInboundEndpoi
|
||||
|
||||
/**
|
||||
* Specify a Map of SpEL expressions to evaluate in order to generate the Message headers.
|
||||
* @param headerExpressions The {@link Map} of SpEL expressions for headers.
|
||||
* @param expressions The {@link Map} of SpEL expressions for headers.
|
||||
* @return the spec
|
||||
* @see org.springframework.integration.http.inbound.HttpRequestHandlingEndpointSupport#setHeaderExpressions(Map)
|
||||
*/
|
||||
public S headerExpressions(Map<String, Expression> headerExpressions) {
|
||||
Assert.notNull(headerExpressions, "'headerExpressions' must not be null");
|
||||
public S headerExpressions(Map<String, Expression> expressions) {
|
||||
Assert.notNull(expressions, "'headerExpressions' must not be null");
|
||||
this.headerExpressions.clear();
|
||||
this.headerExpressions.putAll(headerExpressions);
|
||||
this.headerExpressions.putAll(expressions);
|
||||
return _this();
|
||||
}
|
||||
|
||||
@@ -171,12 +171,12 @@ public abstract class HttpInboundEndpointSupportSpec<S extends HttpInboundEndpoi
|
||||
|
||||
/**
|
||||
* Set the {@link HeaderMapper} to use when mapping between HTTP headers and MessageHeaders.
|
||||
* @param headerMapper The header mapper.
|
||||
* @param mapper The header mapper.
|
||||
* @return the current Spec.
|
||||
*/
|
||||
public S headerMapper(HeaderMapper<HttpHeaders> headerMapper) {
|
||||
this.target.setHeaderMapper(headerMapper);
|
||||
this.explicitHeaderMapper = headerMapper;
|
||||
public S headerMapper(HeaderMapper<HttpHeaders> mapper) {
|
||||
this.target.setHeaderMapper(mapper);
|
||||
this.explicitHeaderMapper = mapper;
|
||||
return _this();
|
||||
}
|
||||
|
||||
|
||||
@@ -73,67 +73,67 @@ public abstract class AbstractConnectionFactory extends IntegrationObjectSupport
|
||||
|
||||
private static final int DEFAULT_READ_DELAY = 100;
|
||||
|
||||
private volatile String host;
|
||||
|
||||
private volatile int port;
|
||||
|
||||
private volatile TcpListener listener;
|
||||
|
||||
private volatile TcpSender sender;
|
||||
|
||||
private volatile int soTimeout = -1;
|
||||
|
||||
private volatile int soSendBufferSize;
|
||||
|
||||
private volatile int soReceiveBufferSize;
|
||||
|
||||
private volatile boolean soTcpNoDelay;
|
||||
|
||||
private volatile int soLinger = -1; // don't set by default
|
||||
|
||||
private volatile boolean soKeepAlive;
|
||||
|
||||
private volatile int soTrafficClass = -1; // don't set by default
|
||||
|
||||
private volatile Executor taskExecutor;
|
||||
|
||||
private volatile boolean privateExecutor;
|
||||
|
||||
private volatile Deserializer<?> deserializer = new ByteArrayCrLfSerializer();
|
||||
|
||||
private volatile boolean deserializerSet;
|
||||
|
||||
private volatile Serializer<?> serializer = new ByteArrayCrLfSerializer();
|
||||
|
||||
private volatile TcpMessageMapper mapper = new TcpMessageMapper();
|
||||
|
||||
private volatile boolean mapperSet;
|
||||
|
||||
private volatile boolean singleUse;
|
||||
|
||||
private volatile boolean active;
|
||||
|
||||
private volatile TcpConnectionInterceptorFactoryChain interceptorFactoryChain;
|
||||
|
||||
private volatile boolean lookupHost = true;
|
||||
protected final Object lifecycleMonitor = new Object(); // NOSONAR final
|
||||
|
||||
private final Map<String, TcpConnectionSupport> connections = new ConcurrentHashMap<String, TcpConnectionSupport>();
|
||||
|
||||
private volatile TcpSocketSupport tcpSocketSupport = new DefaultTcpSocketSupport();
|
||||
|
||||
protected final Object lifecycleMonitor = new Object();
|
||||
|
||||
private volatile long nextCheckForClosedNioConnections;
|
||||
|
||||
private volatile int nioHarvestInterval = DEFAULT_NIO_HARVEST_INTERVAL;
|
||||
|
||||
private volatile ApplicationEventPublisher applicationEventPublisher;
|
||||
|
||||
private final BlockingQueue<PendingIO> delayedReads = new LinkedBlockingQueue<AbstractConnectionFactory.PendingIO>();
|
||||
|
||||
private volatile long readDelay = DEFAULT_READ_DELAY;
|
||||
private String host;
|
||||
|
||||
private volatile Integer sslHandshakeTimeout;
|
||||
private int port;
|
||||
|
||||
private TcpListener listener;
|
||||
|
||||
private TcpSender sender;
|
||||
|
||||
private int soTimeout = -1;
|
||||
|
||||
private int soSendBufferSize;
|
||||
|
||||
private int soReceiveBufferSize;
|
||||
|
||||
private boolean soTcpNoDelay;
|
||||
|
||||
private int soLinger = -1; // don't set by default
|
||||
|
||||
private boolean soKeepAlive;
|
||||
|
||||
private int soTrafficClass = -1; // don't set by default
|
||||
|
||||
private Executor taskExecutor;
|
||||
|
||||
private boolean privateExecutor;
|
||||
|
||||
private Deserializer<?> deserializer = new ByteArrayCrLfSerializer();
|
||||
|
||||
private boolean deserializerSet;
|
||||
|
||||
private Serializer<?> serializer = new ByteArrayCrLfSerializer();
|
||||
|
||||
private TcpMessageMapper mapper = new TcpMessageMapper();
|
||||
|
||||
private boolean mapperSet;
|
||||
|
||||
private boolean singleUse;
|
||||
|
||||
private TcpConnectionInterceptorFactoryChain interceptorFactoryChain;
|
||||
|
||||
private boolean lookupHost = true;
|
||||
|
||||
private TcpSocketSupport tcpSocketSupport = new DefaultTcpSocketSupport();
|
||||
|
||||
private long nextCheckForClosedNioConnections;
|
||||
|
||||
private int nioHarvestInterval = DEFAULT_NIO_HARVEST_INTERVAL;
|
||||
|
||||
private ApplicationEventPublisher applicationEventPublisher;
|
||||
|
||||
private long readDelay = DEFAULT_READ_DELAY;
|
||||
|
||||
private Integer sslHandshakeTimeout;
|
||||
|
||||
private volatile boolean active;
|
||||
|
||||
public AbstractConnectionFactory(int port) {
|
||||
this.port = port;
|
||||
@@ -504,6 +504,10 @@ public abstract class AbstractConnectionFactory extends IntegrationObjectSupport
|
||||
this.readDelay = readDelay;
|
||||
}
|
||||
|
||||
protected Object getLifecycleMonitor() {
|
||||
return this.lifecycleMonitor;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onInit() {
|
||||
super.onInit();
|
||||
|
||||
@@ -52,7 +52,7 @@ import org.springframework.util.Assert;
|
||||
*/
|
||||
public abstract class TcpConnectionSupport implements TcpConnection {
|
||||
|
||||
protected final Log logger = LogFactory.getLog(this.getClass());
|
||||
protected final Log logger = LogFactory.getLog(this.getClass()); // NOSONAR final
|
||||
|
||||
private final CountDownLatch listenerRegisteredLatch = new CountDownLatch(1);
|
||||
|
||||
@@ -69,28 +69,28 @@ public abstract class TcpConnectionSupport implements TcpConnection {
|
||||
private final SocketInfo socketInfo;
|
||||
|
||||
@SuppressWarnings("rawtypes")
|
||||
private volatile Deserializer deserializer;
|
||||
private Deserializer deserializer;
|
||||
|
||||
@SuppressWarnings("rawtypes")
|
||||
private volatile Serializer serializer;
|
||||
private Serializer serializer;
|
||||
|
||||
private volatile TcpMessageMapper mapper;
|
||||
private TcpMessageMapper mapper;
|
||||
|
||||
private volatile TcpListener listener;
|
||||
private TcpListener listener;
|
||||
|
||||
private volatile TcpSender sender;
|
||||
private TcpSender sender;
|
||||
|
||||
private volatile String connectionId;
|
||||
private String connectionId;
|
||||
|
||||
private volatile String hostName = "unknown";
|
||||
private String hostName = "unknown";
|
||||
|
||||
private volatile String hostAddress = "unknown";
|
||||
private String hostAddress = "unknown";
|
||||
|
||||
private volatile String connectionFactoryName = "unknown";
|
||||
private String connectionFactoryName = "unknown";
|
||||
|
||||
private volatile boolean noReadErrorOnClose;
|
||||
private boolean noReadErrorOnClose;
|
||||
|
||||
private volatile boolean manualListenerRegistration;
|
||||
private boolean manualListenerRegistration;
|
||||
|
||||
public TcpConnectionSupport() {
|
||||
this(null);
|
||||
|
||||
@@ -65,21 +65,21 @@ public class TcpMessageMapper implements
|
||||
OutboundMessageMapper<Object>,
|
||||
BeanFactoryAware {
|
||||
|
||||
protected final Log logger = LogFactory.getLog(this.getClass());
|
||||
protected final Log logger = LogFactory.getLog(this.getClass()); // NOSONAR final
|
||||
|
||||
private volatile String charset = "UTF-8";
|
||||
private String charset = "UTF-8";
|
||||
|
||||
private volatile boolean stringToBytes = true;
|
||||
private boolean stringToBytes = true;
|
||||
|
||||
private volatile boolean applySequence = false;
|
||||
private boolean applySequence = false;
|
||||
|
||||
private volatile MessageBuilderFactory messageBuilderFactory = new DefaultMessageBuilderFactory();
|
||||
private MessageBuilderFactory messageBuilderFactory = new DefaultMessageBuilderFactory();
|
||||
|
||||
private volatile boolean messageBuilderFactorySet;
|
||||
private boolean messageBuilderFactorySet;
|
||||
|
||||
private volatile String contentType = "application/octet-stream;charset=" + this.charset;
|
||||
private String contentType = "application/octet-stream;charset=" + this.charset;
|
||||
|
||||
private volatile boolean addContentTypeHeader;
|
||||
private boolean addContentTypeHeader;
|
||||
|
||||
private BeanFactory beanFactory;
|
||||
|
||||
|
||||
@@ -66,7 +66,7 @@ public class ChannelPublishingJmsMessageListener
|
||||
implements SessionAwareMessageListener<javax.jms.Message>, InitializingBean,
|
||||
TrackableComponent, BeanFactoryAware {
|
||||
|
||||
protected final Log logger = LogFactory.getLog(getClass());
|
||||
protected final Log logger = LogFactory.getLog(getClass()); // NOSONAR final
|
||||
|
||||
private volatile boolean expectReply;
|
||||
|
||||
|
||||
@@ -42,7 +42,7 @@ import org.springframework.util.Assert;
|
||||
public class JmsInboundChannelAdapterSpec<S extends JmsInboundChannelAdapterSpec<S>>
|
||||
extends MessageSourceSpec<S, JmsDestinationPollingSource> {
|
||||
|
||||
protected final JmsTemplateSpec jmsTemplateSpec = new JmsTemplateSpec();
|
||||
protected final JmsTemplateSpec jmsTemplateSpec = new JmsTemplateSpec(); // NOSONAR final
|
||||
|
||||
JmsInboundChannelAdapterSpec(JmsTemplate jmsTemplate) {
|
||||
this.target = new JmsDestinationPollingSource(jmsTemplate);
|
||||
|
||||
@@ -44,7 +44,7 @@ import org.springframework.util.Assert;
|
||||
public class JmsOutboundChannelAdapterSpec<S extends JmsOutboundChannelAdapterSpec<S>>
|
||||
extends MessageHandlerSpec<S, JmsSendingMessageHandler> {
|
||||
|
||||
protected final JmsTemplateSpec jmsTemplateSpec = new JmsTemplateSpec();
|
||||
protected final JmsTemplateSpec jmsTemplateSpec = new JmsTemplateSpec(); // NOSONAR final
|
||||
|
||||
JmsOutboundChannelAdapterSpec(JmsTemplate jmsTemplate) {
|
||||
this.target = new JmsSendingMessageHandler(jmsTemplate);
|
||||
|
||||
@@ -41,7 +41,7 @@ import org.springframework.lang.Nullable;
|
||||
public class JmsPollableMessageChannelSpec<S extends JmsPollableMessageChannelSpec<S>>
|
||||
extends MessageChannelSpec<S, AbstractJmsChannel> {
|
||||
|
||||
protected final JmsChannelFactoryBean jmsChannelFactoryBean;
|
||||
protected final JmsChannelFactoryBean jmsChannelFactoryBean; // NOSONAR final
|
||||
|
||||
JmsPollableMessageChannelSpec(ConnectionFactory connectionFactory) {
|
||||
this(new JmsChannelFactoryBean(false), connectionFactory);
|
||||
|
||||
@@ -32,7 +32,7 @@ import org.springframework.util.Assert;
|
||||
*/
|
||||
abstract class AbstractJpaOperations implements JpaOperations, InitializingBean {
|
||||
|
||||
protected EntityManager entityManager;
|
||||
private EntityManager entityManager;
|
||||
|
||||
private EntityManagerFactory entityManagerFactory;
|
||||
|
||||
@@ -43,11 +43,18 @@ abstract class AbstractJpaOperations implements JpaOperations, InitializingBean
|
||||
}
|
||||
|
||||
|
||||
protected EntityManager getEntityManager() {
|
||||
return this.entityManager;
|
||||
}
|
||||
|
||||
|
||||
public void setEntityManagerFactory(EntityManagerFactory entityManagerFactory) {
|
||||
Assert.notNull(entityManagerFactory, "The provided entityManagerFactory must not be null.");
|
||||
this.entityManagerFactory = entityManagerFactory;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public final void afterPropertiesSet() {
|
||||
this.onInit();
|
||||
}
|
||||
|
||||
@@ -21,6 +21,7 @@ import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.persistence.EntityManager;
|
||||
import javax.persistence.Parameter;
|
||||
import javax.persistence.Query;
|
||||
|
||||
@@ -51,7 +52,7 @@ public class DefaultJpaOperations extends AbstractJpaOperations {
|
||||
@Override
|
||||
public void delete(Object entity) {
|
||||
Assert.notNull(entity, "The entity must not be null!");
|
||||
entityManager.remove(entity);
|
||||
getEntityManager().remove(entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -78,6 +79,7 @@ public class DefaultJpaOperations extends AbstractJpaOperations {
|
||||
}
|
||||
}
|
||||
|
||||
EntityManager entityManager = getEntityManager();
|
||||
final String entityName = JpaUtils.getEntityName(entityManager, entityClass);
|
||||
final String queryString = JpaUtils.getQueryString(JpaUtils.DELETE_ALL_QUERY_STRING, entityName);
|
||||
|
||||
@@ -88,32 +90,32 @@ public class DefaultJpaOperations extends AbstractJpaOperations {
|
||||
|
||||
@Override
|
||||
public int executeUpdate(String updateQuery, ParameterSource source) {
|
||||
Query query = entityManager.createQuery(updateQuery);
|
||||
Query query = getEntityManager().createQuery(updateQuery);
|
||||
setParametersIfRequired(updateQuery, source, query);
|
||||
return query.executeUpdate();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int executeUpdateWithNamedQuery(String updateQuery, ParameterSource source) {
|
||||
Query query = entityManager.createNamedQuery(updateQuery);
|
||||
Query query = getEntityManager().createNamedQuery(updateQuery);
|
||||
setParametersIfRequired(updateQuery, source, query);
|
||||
return query.executeUpdate();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int executeUpdateWithNativeQuery(String updateQuery, ParameterSource source) {
|
||||
Query query = entityManager.createNativeQuery(updateQuery);
|
||||
Query query = getEntityManager().createNativeQuery(updateQuery);
|
||||
setParametersIfRequired(updateQuery, source, query);
|
||||
return query.executeUpdate();
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> T find(Class<T> entityType, Object id) {
|
||||
return entityManager.find(entityType, id);
|
||||
return getEntityManager().find(entityType, id);
|
||||
}
|
||||
|
||||
private Query getQuery(String queryString, ParameterSource source) {
|
||||
Query query = entityManager.createQuery(queryString);
|
||||
Query query = getEntityManager().createQuery(queryString);
|
||||
setParametersIfRequired(queryString, source, query);
|
||||
return query;
|
||||
}
|
||||
@@ -122,8 +124,8 @@ public class DefaultJpaOperations extends AbstractJpaOperations {
|
||||
@Override
|
||||
public List<?> getResultListForClass(Class<?> entityClass, int firstResult, int maxNumberOfResults) {
|
||||
|
||||
final String entityName = JpaUtils.getEntityName(entityManager, entityClass);
|
||||
final Query query = entityManager.createQuery("select x from " + entityName + " x", entityClass);
|
||||
final String entityName = JpaUtils.getEntityName(getEntityManager(), entityClass);
|
||||
final Query query = getEntityManager().createQuery("select x from " + entityName + " x", entityClass);
|
||||
if (firstResult > 0) {
|
||||
query.setFirstResult(firstResult);
|
||||
}
|
||||
@@ -139,7 +141,7 @@ public class DefaultJpaOperations extends AbstractJpaOperations {
|
||||
public List<?> getResultListForNamedQuery(String selectNamedQuery,
|
||||
ParameterSource parameterSource, int firstResult, int maxNumberOfResults) {
|
||||
|
||||
final Query query = entityManager.createNamedQuery(selectNamedQuery);
|
||||
final Query query = getEntityManager().createNamedQuery(selectNamedQuery);
|
||||
setParametersIfRequired(selectNamedQuery, parameterSource, query);
|
||||
|
||||
if (firstResult > 0) {
|
||||
@@ -160,10 +162,10 @@ public class DefaultJpaOperations extends AbstractJpaOperations {
|
||||
final Query query;
|
||||
|
||||
if (entityClass == null) {
|
||||
query = entityManager.createNativeQuery(selectQuery);
|
||||
query = getEntityManager().createNativeQuery(selectQuery);
|
||||
}
|
||||
else {
|
||||
query = entityManager.createNativeQuery(selectQuery, entityClass);
|
||||
query = getEntityManager().createNativeQuery(selectQuery, entityClass);
|
||||
}
|
||||
|
||||
setParametersIfRequired(selectQuery, parameterSource, query);
|
||||
@@ -235,6 +237,7 @@ public class DefaultJpaOperations extends AbstractJpaOperations {
|
||||
private Object persistOrMerge(Object entity, boolean isMerge, int flushSize, boolean clearOnFlush) {
|
||||
Object result = null;
|
||||
|
||||
EntityManager entityManager = getEntityManager();
|
||||
if (entity instanceof Iterable) {
|
||||
result = persistOrMergeIterable(entity, isMerge, flushSize, clearOnFlush);
|
||||
}
|
||||
@@ -269,6 +272,7 @@ public class DefaultJpaOperations extends AbstractJpaOperations {
|
||||
|
||||
List<Object> mergedEntities = new ArrayList<Object>();
|
||||
|
||||
EntityManager entityManager = getEntityManager();
|
||||
for (Object iteratedEntity : entities) {
|
||||
if (iteratedEntity == null) {
|
||||
nullEntities++;
|
||||
|
||||
@@ -69,21 +69,6 @@ public abstract class AbstractConfigurableMongoDbMessageStore extends AbstractMe
|
||||
|
||||
public static final String SEQUENCE_NAME = "messagesSequence";
|
||||
|
||||
/**
|
||||
* The name of the message header that stores a flag to indicate that the message has been saved. This is an
|
||||
* optimization for the put method.
|
||||
* @deprecated since 5.0. This constant isn't used any more.
|
||||
*/
|
||||
@Deprecated
|
||||
public static final String SAVED_KEY = "MongoDbMessageStore.SAVED";
|
||||
|
||||
/**
|
||||
* The name of the message header that stores a timestamp for the time the message was inserted.
|
||||
* @deprecated since 5.0. This constant isn't used any more.
|
||||
*/
|
||||
@Deprecated
|
||||
public static final String CREATED_DATE_KEY = "MongoDbMessageStore.CREATED_DATE";
|
||||
|
||||
protected final Log logger = LogFactory.getLog(getClass()); // NOSONAR - final
|
||||
|
||||
private static final RuntimeException NOT_IMPLEMENTED =
|
||||
@@ -93,7 +78,7 @@ public abstract class AbstractConfigurableMongoDbMessageStore extends AbstractMe
|
||||
|
||||
protected final MongoDbFactory mongoDbFactory; // NOSONAR - final
|
||||
|
||||
protected MongoTemplate mongoTemplate;
|
||||
private MongoTemplate mongoTemplate;
|
||||
|
||||
private MappingMongoConverter mappingMongoConverter;
|
||||
|
||||
|
||||
@@ -200,7 +200,7 @@ public class ConfigurableMongoDbMessageStore extends AbstractConfigurableMongoDb
|
||||
|
||||
Sort sort = Sort.by(MessageDocumentFields.LAST_MODIFIED_TIME, MessageDocumentFields.SEQUENCE);
|
||||
Query query = groupIdQuery(groupId).with(sort);
|
||||
MessageDocument document = mongoTemplate.findAndRemove(query, MessageDocument.class, collectionName);
|
||||
MessageDocument document = getMongoTemplate().findAndRemove(query, MessageDocument.class, collectionName);
|
||||
Message<?> message = null;
|
||||
if (document != null) {
|
||||
message = document.getMessage();
|
||||
@@ -222,7 +222,7 @@ public class ConfigurableMongoDbMessageStore extends AbstractConfigurableMongoDb
|
||||
@Override
|
||||
public Iterator<MessageGroup> iterator() {
|
||||
Query query = Query.query(Criteria.where(MessageDocumentFields.GROUP_ID).exists(true));
|
||||
Iterable<String> groupIds = mongoTemplate.getCollection(collectionName)
|
||||
Iterable<String> groupIds = getMongoTemplate().getCollection(collectionName)
|
||||
.distinct(MessageDocumentFields.GROUP_ID, query.getQueryObject(), String.class);
|
||||
|
||||
return StreamSupport.stream(groupIds.spliterator(), false)
|
||||
|
||||
@@ -73,9 +73,9 @@ public abstract class AbstractStompSessionManager implements StompSessionManager
|
||||
|
||||
private static final long DEFAULT_RECOVERY_INTERVAL = 10000;
|
||||
|
||||
protected final Log logger = LogFactory.getLog(getClass());
|
||||
protected final Log logger = LogFactory.getLog(getClass()); // NOSONAR final
|
||||
|
||||
protected final StompClientSupport stompClient;
|
||||
protected final StompClientSupport stompClient; // NOSONAR final
|
||||
|
||||
private final CompositeStompSessionHandler compositeStompSessionHandler = new CompositeStompSessionHandler();
|
||||
|
||||
|
||||
@@ -38,7 +38,7 @@ public class RFC5424SyslogParser {
|
||||
|
||||
protected static final char SPACE = ' ';
|
||||
|
||||
protected final boolean retainOriginal;
|
||||
protected final boolean retainOriginal; // NOSONAR final
|
||||
|
||||
|
||||
/**
|
||||
@@ -161,7 +161,7 @@ public class RFC5424SyslogParser {
|
||||
}
|
||||
|
||||
if (!Character.isDigit(c)) {
|
||||
throw new IllegalStateException("Year expected @" + r.idx);
|
||||
throw new IllegalStateException("Year expected @" + r.getIndex());
|
||||
}
|
||||
|
||||
StringBuilder dateBuilder = new StringBuilder();
|
||||
@@ -209,6 +209,10 @@ public class RFC5424SyslogParser {
|
||||
this.line = l;
|
||||
}
|
||||
|
||||
public int getIndex() {
|
||||
return this.idx;
|
||||
}
|
||||
|
||||
public void mark() {
|
||||
this.mark = this.idx;
|
||||
}
|
||||
|
||||
@@ -16,9 +16,6 @@
|
||||
|
||||
package org.springframework.integration.syslog.inbound;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
|
||||
import org.springframework.integration.endpoint.MessageProducerSupport;
|
||||
import org.springframework.integration.syslog.DefaultMessageConverter;
|
||||
import org.springframework.integration.syslog.MessageConverter;
|
||||
@@ -39,11 +36,9 @@ public abstract class SyslogReceivingChannelAdapterSupport extends MessageProduc
|
||||
|
||||
private volatile int port = DEFAULT_PORT;
|
||||
|
||||
protected final Log logger = LogFactory.getLog(this.getClass());
|
||||
private MessageConverter converter = new DefaultMessageConverter();
|
||||
|
||||
private volatile MessageConverter converter = new DefaultMessageConverter();
|
||||
|
||||
private volatile boolean converterSet;
|
||||
private boolean converterSet;
|
||||
|
||||
/**
|
||||
* @return The port on which this adapter listens.
|
||||
|
||||
@@ -56,13 +56,13 @@ import org.springframework.messaging.Message;
|
||||
*/
|
||||
public class MockMessageHandler extends AbstractMessageProducingHandler {
|
||||
|
||||
protected final List<Function<Message<?>, ?>> messageFunctions = new LinkedList<>();
|
||||
protected final List<Function<Message<?>, ?>> messageFunctions = new LinkedList<>(); // NOSONAR final
|
||||
|
||||
private final CapturingMatcher<Message<?>> capturingMatcher;
|
||||
|
||||
protected Function<Message<?>, ?> lastFunction;
|
||||
protected Function<Message<?>, ?> lastFunction; // NOSONAR
|
||||
|
||||
protected boolean hasReplies;
|
||||
protected boolean hasReplies; // NOSONAR
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
protected MockMessageHandler(ArgumentCaptor<Message<?>> messageArgumentCaptor) {
|
||||
|
||||
@@ -66,17 +66,17 @@ public abstract class AbstractWebServiceOutboundGateway extends AbstractReplyPro
|
||||
|
||||
private final Map<String, Expression> uriVariableExpressions = new HashMap<String, Expression>();
|
||||
|
||||
private volatile StandardEvaluationContext evaluationContext;
|
||||
private StandardEvaluationContext evaluationContext;
|
||||
|
||||
private volatile WebServiceMessageCallback requestCallback;
|
||||
private WebServiceMessageCallback requestCallback;
|
||||
|
||||
private WebServiceTemplate webServiceTemplate;
|
||||
|
||||
private volatile boolean ignoreEmptyResponses = true;
|
||||
private boolean ignoreEmptyResponses = true;
|
||||
|
||||
private volatile boolean encodeUri = true;
|
||||
private boolean encodeUri = true;
|
||||
|
||||
protected volatile SoapHeaderMapper headerMapper = new DefaultSoapHeaderMapper();
|
||||
private SoapHeaderMapper headerMapper = new DefaultSoapHeaderMapper();
|
||||
|
||||
private boolean webServiceTemplateExplicitlySet;
|
||||
|
||||
@@ -143,9 +143,9 @@ public abstract class AbstractWebServiceOutboundGateway extends AbstractReplyPro
|
||||
doSetWebServiceTemplate(webServiceTemplate);
|
||||
}
|
||||
|
||||
protected final void doSetWebServiceTemplate(WebServiceTemplate webServiceTemplate) {
|
||||
Assert.notNull(webServiceTemplate, "'webServiceTemplate' must not be null");
|
||||
this.webServiceTemplate = webServiceTemplate;
|
||||
protected final void doSetWebServiceTemplate(WebServiceTemplate template) {
|
||||
Assert.notNull(template, "'webServiceTemplate' must not be null");
|
||||
this.webServiceTemplate = template;
|
||||
this.webServiceTemplateExplicitlySet = true;
|
||||
}
|
||||
|
||||
@@ -233,18 +233,18 @@ public abstract class AbstractWebServiceOutboundGateway extends AbstractReplyPro
|
||||
}
|
||||
|
||||
|
||||
protected abstract Object doHandle(String uri, Message<?> requestMessage,
|
||||
WebServiceMessageCallback requestCallback);
|
||||
protected abstract Object doHandle(String theUri, Message<?> requestMessage,
|
||||
WebServiceMessageCallback reqCallback);
|
||||
|
||||
protected abstract class RequestMessageCallback extends TransformerObjectSupport
|
||||
implements WebServiceMessageCallback {
|
||||
|
||||
private final WebServiceMessageCallback requestCallback;
|
||||
private final WebServiceMessageCallback reqCallback;
|
||||
|
||||
private final Message<?> requestMessage;
|
||||
|
||||
public RequestMessageCallback(WebServiceMessageCallback requestCallback, Message<?> requestMessage) {
|
||||
this.requestCallback = requestCallback;
|
||||
this.reqCallback = requestCallback;
|
||||
this.requestMessage = requestMessage;
|
||||
}
|
||||
|
||||
@@ -256,8 +256,8 @@ public abstract class AbstractWebServiceOutboundGateway extends AbstractReplyPro
|
||||
AbstractWebServiceOutboundGateway.this.headerMapper
|
||||
.fromHeadersToRequest(this.requestMessage.getHeaders(), (SoapMessage) message);
|
||||
}
|
||||
if (this.requestCallback != null) {
|
||||
this.requestCallback.doWithMessage(message);
|
||||
if (this.reqCallback != null) {
|
||||
this.reqCallback.doWithMessage(message);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -64,7 +64,7 @@ public class DefaultSoapHeaderMapper extends AbstractHeaderMapper<SoapMessage> i
|
||||
STANDARD_HEADER_NAMES.add(WebServiceHeaders.SOAP_ACTION);
|
||||
}
|
||||
|
||||
protected final TransformerHelper transformerHelper = new TransformerHelper();
|
||||
protected final TransformerHelper transformerHelper = new TransformerHelper(); // NOSONAR final
|
||||
|
||||
public DefaultSoapHeaderMapper() {
|
||||
super(WebServiceHeaders.PREFIX, STANDARD_HEADER_NAMES, Collections.<String>emptyList());
|
||||
|
||||
@@ -34,7 +34,7 @@ import org.springframework.util.StringUtils;
|
||||
*/
|
||||
public class WebServiceInboundGatewayParser extends AbstractInboundGatewayParser {
|
||||
|
||||
protected final Log logger = LogFactory.getLog(getClass());
|
||||
protected final Log logger = LogFactory.getLog(getClass()); // NOSONAR final
|
||||
|
||||
@Override
|
||||
protected String getBeanClassName(Element element) {
|
||||
@@ -75,6 +75,7 @@ public class WebServiceInboundGatewayParser extends AbstractInboundGatewayParser
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void doParse(Element element, ParserContext parserContext, BeanDefinitionBuilder builder) {
|
||||
super.doParse(element, parserContext, builder);
|
||||
IntegrationNamespaceUtils.configureHeaderMapper(element, builder, parserContext, DefaultSoapHeaderMapper.class, null);
|
||||
|
||||
@@ -30,9 +30,9 @@ import org.springframework.util.Assert;
|
||||
*/
|
||||
public abstract class AbstractXmppConnectionAwareEndpoint extends MessageProducerSupport {
|
||||
|
||||
protected volatile XMPPConnection xmppConnection;
|
||||
private XMPPConnection xmppConnection;
|
||||
|
||||
protected volatile boolean initialized;
|
||||
private boolean initialized;
|
||||
|
||||
|
||||
public AbstractXmppConnectionAwareEndpoint() {
|
||||
@@ -43,6 +43,15 @@ public abstract class AbstractXmppConnectionAwareEndpoint extends MessageProduce
|
||||
this.xmppConnection = xmppConnection;
|
||||
}
|
||||
|
||||
protected XMPPConnection getXmppConnection() {
|
||||
return this.xmppConnection;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean isInitialized() {
|
||||
return this.initialized;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onInit() {
|
||||
super.onInit();
|
||||
|
||||
@@ -30,9 +30,9 @@ import org.springframework.util.Assert;
|
||||
*/
|
||||
public abstract class AbstractXmppConnectionAwareMessageHandler extends AbstractMessageHandler {
|
||||
|
||||
protected volatile XMPPConnection xmppConnection;
|
||||
private XMPPConnection xmppConnection;
|
||||
|
||||
protected volatile boolean initialized;
|
||||
private volatile boolean initialized;
|
||||
|
||||
|
||||
public AbstractXmppConnectionAwareMessageHandler() {
|
||||
@@ -43,6 +43,14 @@ public abstract class AbstractXmppConnectionAwareMessageHandler extends Abstract
|
||||
this.xmppConnection = xmppConnection;
|
||||
}
|
||||
|
||||
protected XMPPConnection getXmppConnection() {
|
||||
return this.xmppConnection;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean isInitialized() {
|
||||
return this.initialized;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onInit() {
|
||||
|
||||
@@ -103,15 +103,16 @@ public class ChatMessageListeningEndpoint extends AbstractXmppConnectionAwareEnd
|
||||
|
||||
@Override
|
||||
protected void doStart() {
|
||||
Assert.isTrue(this.initialized, this.getComponentName() + " [" + this.getComponentType()
|
||||
Assert.isTrue(isInitialized(), this.getComponentName() + " [" + this.getComponentType()
|
||||
+ "] must be initialized");
|
||||
this.xmppConnection.addAsyncStanzaListener(this.stanzaListener, this.stanzaFilter);
|
||||
getXmppConnection().addAsyncStanzaListener(this.stanzaListener, this.stanzaFilter);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void doStop() {
|
||||
if (this.xmppConnection != null) {
|
||||
this.xmppConnection.removeAsyncStanzaListener(this.stanzaListener);
|
||||
XMPPConnection xmppConnection = getXmppConnection();
|
||||
if (xmppConnection != null) {
|
||||
xmppConnection.removeAsyncStanzaListener(this.stanzaListener);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -18,8 +18,6 @@ package org.springframework.integration.xmpp.inbound;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.jivesoftware.smack.XMPPConnection;
|
||||
import org.jivesoftware.smack.packet.Presence;
|
||||
import org.jivesoftware.smack.roster.Roster;
|
||||
@@ -44,9 +42,6 @@ import org.springframework.util.StringUtils;
|
||||
*/
|
||||
public class PresenceListeningEndpoint extends AbstractXmppConnectionAwareEndpoint {
|
||||
|
||||
private static final Log logger = LogFactory.getLog(PresenceListeningEndpoint.class);
|
||||
|
||||
|
||||
private final PresencePublishingRosterListener rosterListener = new PresencePublishingRosterListener();
|
||||
|
||||
|
||||
@@ -66,15 +61,16 @@ public class PresenceListeningEndpoint extends AbstractXmppConnectionAwareEndpoi
|
||||
|
||||
@Override
|
||||
protected void doStart() {
|
||||
Assert.isTrue(this.initialized, this.getComponentName() + " [" + this.getComponentType() + "] must be initialized");
|
||||
Roster roster = Roster.getInstanceFor(this.xmppConnection);
|
||||
Assert.isTrue(isInitialized(), this.getComponentName() + " [" + this.getComponentType() + "] must be initialized");
|
||||
Roster roster = Roster.getInstanceFor(getXmppConnection());
|
||||
roster.addRosterListener(this.rosterListener);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void doStop() {
|
||||
if (this.xmppConnection != null) {
|
||||
Roster.getInstanceFor(this.xmppConnection).removeRosterListener(this.rosterListener);
|
||||
XMPPConnection xmppConnection = getXmppConnection();
|
||||
if (xmppConnection != null) {
|
||||
Roster.getInstanceFor(xmppConnection).removeRosterListener(this.rosterListener);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -85,7 +85,7 @@ public class ChatMessageSendingMessageHandler extends AbstractXmppConnectionAwar
|
||||
|
||||
@Override
|
||||
protected void handleMessageInternal(Message<?> message) {
|
||||
Assert.isTrue(this.initialized, getComponentName() + "#" + this.getComponentType() + " must be initialized");
|
||||
Assert.isTrue(isInitialized(), getComponentName() + "#" + this.getComponentType() + " must be initialized");
|
||||
try {
|
||||
Object payload = message.getPayload();
|
||||
org.jivesoftware.smack.packet.Message xmppMessage = null;
|
||||
@@ -101,11 +101,11 @@ public class ChatMessageSendingMessageHandler extends AbstractXmppConnectionAwar
|
||||
if (this.headerMapper != null) {
|
||||
this.headerMapper.fromHeadersToRequest(message.getHeaders(), xmppMessage);
|
||||
}
|
||||
|
||||
if (!this.xmppConnection.isConnected() && this.xmppConnection instanceof AbstractXMPPConnection) {
|
||||
((AbstractXMPPConnection) this.xmppConnection).connect();
|
||||
XMPPConnection xmppConnection = getXmppConnection();
|
||||
if (!xmppConnection.isConnected() && xmppConnection instanceof AbstractXMPPConnection) {
|
||||
((AbstractXMPPConnection) xmppConnection).connect();
|
||||
}
|
||||
this.xmppConnection.sendStanza(xmppMessage);
|
||||
xmppConnection.sendStanza(xmppMessage);
|
||||
}
|
||||
catch (InterruptedException e) {
|
||||
Thread.currentThread().interrupt();
|
||||
|
||||
@@ -50,15 +50,16 @@ public class PresenceSendingMessageHandler extends AbstractXmppConnectionAwareMe
|
||||
|
||||
@Override
|
||||
protected void handleMessageInternal(Message<?> message) {
|
||||
Assert.state(this.initialized, this.getComponentName() + " must be initialized");
|
||||
Assert.state(isInitialized(), getComponentName() + " must be initialized");
|
||||
Object payload = message.getPayload();
|
||||
Assert.state(payload instanceof Presence,
|
||||
"Payload must be of type 'org.jivesoftware.smack.packet.Presence', was: " + payload.getClass().getName());
|
||||
try {
|
||||
if (!this.xmppConnection.isConnected() && this.xmppConnection instanceof AbstractXMPPConnection) {
|
||||
((AbstractXMPPConnection) this.xmppConnection).connect();
|
||||
XMPPConnection xmppConnection = getXmppConnection();
|
||||
if (!xmppConnection.isConnected() && xmppConnection instanceof AbstractXMPPConnection) {
|
||||
((AbstractXMPPConnection) xmppConnection).connect();
|
||||
}
|
||||
this.xmppConnection.sendStanza((Presence) payload);
|
||||
xmppConnection.sendStanza((Presence) payload);
|
||||
}
|
||||
catch (InterruptedException e) {
|
||||
Thread.currentThread().interrupt();
|
||||
|
||||
Reference in New Issue
Block a user