From 255247ca9a977e717a5d8b732af0020bc503db3d Mon Sep 17 00:00:00 2001 From: Gary Russell Date: Thu, 3 Dec 2015 15:23:12 -0500 Subject: [PATCH] Code Polishing (Sonar) - remove redundant modifiers - overridable methods called from ctors Polishing - PR Comments --- .../AbstractSubscribableAmqpChannel.java | 4 +- .../amqp/outbound/AmqpOutboundEndpoint.java | 2 +- .../AbstractCorrelatingMessageHandler.java | 2 +- .../ResequencingMessageHandler.java | 2 +- .../integration/channel/PriorityChannel.java | 9 +- ...eadStatePropagationChannelInterceptor.java | 3 +- .../config/ChannelInitializer.java | 8 +- .../context/ConverterRegistrar.java | 5 +- .../integration/core/MessagingTemplate.java | 2 +- .../OrderedAwareCopyOnWriteArraySet.java | 498 +++++++++--------- .../endpoint/AbstractPollingEndpoint.java | 2 +- ...oadableResourceBundleExpressionSource.java | 7 +- ...ewayCompletableFutureProxyFactoryBean.java | 2 +- .../GatewayMethodInboundMessageMapper.java | 8 +- .../RequestReplyMessageHandlerAdapter.java | 12 +- .../integration/handler/LoggingHandler.java | 4 +- .../advice/AbstractRequestHandlerAdvice.java | 2 +- .../RequestHandlerCircuitBreakerAdvice.java | 12 +- .../json/ObjectToJsonTransformer.java | 6 +- .../selector/MessageSelectorChain.java | 5 +- .../support/SmartLifecycleRoleController.java | 2 +- .../converter/SimpleMessageConverter.java | 4 +- ...aultTransactionSynchronizationFactory.java | 5 +- .../file/HeadDirectoryScanner.java | 4 +- .../config/GroovyControlBusFactoryBean.java | 2 +- .../ip/tcp/TcpOutboundGateway.java | 2 +- .../CachingClientConnectionFactory.java | 2 +- .../FailoverClientConnectionFactory.java | 2 +- .../tcp/connection/TcpNioSSLConnection.java | 2 +- ...BeanPropertySqlParameterSourceFactory.java | 5 +- .../ChannelPublishingJmsMessageListener.java | 6 +- .../integration/jms/JmsOutboundGateway.java | 8 +- .../monitor/IntegrationMBeanExporter.java | 4 +- .../integration/jpa/support/JpaParameter.java | 5 +- .../BeanPropertyParameterSourceFactory.java | 8 +- .../mail/AbstractMailReceiver.java | 2 +- .../integration/mail/MailReceiver.java | 5 +- .../mongodb/store/MongoDbMessageStore.java | 4 +- ...stractMqttMessageDrivenChannelAdapter.java | 8 +- .../ScriptExecutingMessageSource.java | 4 +- .../jsr223/AbstractScriptExecutor.java | 4 +- .../jsr223/DefaultScriptExecutor.java | 6 +- .../jsr223/PythonScriptExecutor.java | 2 +- .../scripting/jsr223/RubyScriptExecutor.java | 12 +- .../ScriptExecutingMessageProcessor.java | 18 +- .../jsr223/ScriptExecutorFactory.java | 13 +- .../syslog/RFC5424SyslogParser.java | 4 +- .../inbound/AbstractTwitterMessageSource.java | 2 +- .../websocket/ClientWebSocketContainer.java | 3 +- ...etIntegrationConfigurationInitializer.java | 5 +- .../MarshallingWebServiceOutboundGateway.java | 28 +- .../ws/SimpleWebServiceOutboundGateway.java | 30 +- .../XmlValidatingMessageSelector.java | 4 +- .../xml/splitter/XPathMessageSplitter.java | 7 +- .../zookeeper/lock/ZookeeperLockRegistry.java | 4 +- .../metadata/ZookeeperMetadataStore.java | 7 +- 56 files changed, 447 insertions(+), 381 deletions(-) diff --git a/spring-integration-amqp/src/main/java/org/springframework/integration/amqp/channel/AbstractSubscribableAmqpChannel.java b/spring-integration-amqp/src/main/java/org/springframework/integration/amqp/channel/AbstractSubscribableAmqpChannel.java index 8a43f0c4be..883ef9278d 100644 --- a/spring-integration-amqp/src/main/java/org/springframework/integration/amqp/channel/AbstractSubscribableAmqpChannel.java +++ b/spring-integration-amqp/src/main/java/org/springframework/integration/amqp/channel/AbstractSubscribableAmqpChannel.java @@ -65,12 +65,12 @@ abstract class AbstractSubscribableAmqpChannel extends AbstractAmqpChannel private final ConnectionFactory connectionFactory; - public AbstractSubscribableAmqpChannel(String channelName, SimpleMessageListenerContainer container, + protected AbstractSubscribableAmqpChannel(String channelName, SimpleMessageListenerContainer container, AmqpTemplate amqpTemplate) { this(channelName, container, amqpTemplate, false); } - public AbstractSubscribableAmqpChannel(String channelName, + protected AbstractSubscribableAmqpChannel(String channelName, SimpleMessageListenerContainer container, AmqpTemplate amqpTemplate, boolean isPubSub) { super(amqpTemplate); diff --git a/spring-integration-amqp/src/main/java/org/springframework/integration/amqp/outbound/AmqpOutboundEndpoint.java b/spring-integration-amqp/src/main/java/org/springframework/integration/amqp/outbound/AmqpOutboundEndpoint.java index 0fbaed3c39..f5f9462cc2 100644 --- a/spring-integration-amqp/src/main/java/org/springframework/integration/amqp/outbound/AmqpOutboundEndpoint.java +++ b/spring-integration-amqp/src/main/java/org/springframework/integration/amqp/outbound/AmqpOutboundEndpoint.java @@ -450,7 +450,7 @@ public class AmqpOutboundEndpoint extends AbstractReplyProducingMessageHandler private final Object userData; - public CorrelationDataWrapper(String id, Object userData) { + private CorrelationDataWrapper(String id, Object userData) { super(id); this.userData = userData; } diff --git a/spring-integration-core/src/main/java/org/springframework/integration/aggregator/AbstractCorrelatingMessageHandler.java b/spring-integration-core/src/main/java/org/springframework/integration/aggregator/AbstractCorrelatingMessageHandler.java index 73534dbb65..d861ffd5b2 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/aggregator/AbstractCorrelatingMessageHandler.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/aggregator/AbstractCorrelatingMessageHandler.java @@ -155,7 +155,7 @@ public abstract class AbstractCorrelatingMessageHandler extends AbstractMessageP this.lockRegistrySet = true; } - public void setMessageStore(MessageGroupStore store) { + public final void setMessageStore(MessageGroupStore store) { this.messageStore = store; store.registerMessageGroupExpiryCallback(new MessageGroupCallback() { @Override diff --git a/spring-integration-core/src/main/java/org/springframework/integration/aggregator/ResequencingMessageHandler.java b/spring-integration-core/src/main/java/org/springframework/integration/aggregator/ResequencingMessageHandler.java index b56ecf2696..3e205354f3 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/aggregator/ResequencingMessageHandler.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/aggregator/ResequencingMessageHandler.java @@ -57,7 +57,7 @@ public class ResequencingMessageHandler extends AbstractCorrelatingMessageHandle * than waiting for the next timeout) */ @Override - public void setExpireGroupsUponTimeout(boolean expireGroupsUponTimeout) { + public final void setExpireGroupsUponTimeout(boolean expireGroupsUponTimeout) { super.setExpireGroupsUponTimeout(expireGroupsUponTimeout); } diff --git a/spring-integration-core/src/main/java/org/springframework/integration/channel/PriorityChannel.java b/spring-integration-core/src/main/java/org/springframework/integration/channel/PriorityChannel.java index 3132d92c01..40ac2295a5 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/channel/PriorityChannel.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/channel/PriorityChannel.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2014 the original author or authors. + * Copyright 2002-2015 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. @@ -31,6 +31,7 @@ import org.springframework.messaging.MessageHeaders; * * @author Mark Fisher * @author Oleg Zhurakousky + * @author Gary Russell */ public class PriorityChannel extends QueueChannel { @@ -106,7 +107,7 @@ public class PriorityChannel extends QueueChannel { private final Comparator> targetComparator; - public SequenceFallbackComparator(Comparator> targetComparator){ + private SequenceFallbackComparator(Comparator> targetComparator){ this.targetComparator = targetComparator; } @@ -135,11 +136,11 @@ public class PriorityChannel extends QueueChannel { } //we need this because of INT-2508 - private class MessageWrapper implements Message{ + private class MessageWrapper implements Message { private final Message rootMessage; private final long sequence; - public MessageWrapper(Message rootMessage){ + private MessageWrapper(Message rootMessage){ this.rootMessage = rootMessage; this.sequence = sequenceCounter.incrementAndGet(); } diff --git a/spring-integration-core/src/main/java/org/springframework/integration/channel/interceptor/ThreadStatePropagationChannelInterceptor.java b/spring-integration-core/src/main/java/org/springframework/integration/channel/interceptor/ThreadStatePropagationChannelInterceptor.java index bbef6aaa7a..23ef5d2108 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/channel/interceptor/ThreadStatePropagationChannelInterceptor.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/channel/interceptor/ThreadStatePropagationChannelInterceptor.java @@ -46,6 +46,7 @@ import org.springframework.messaging.support.ExecutorChannelInterceptor; * @param the propagated state object type. * * @author Artem Bilan + * @author Gary Russell * @since 4.2 */ public abstract class ThreadStatePropagationChannelInterceptor @@ -96,7 +97,7 @@ public abstract class ThreadStatePropagationChannelInterceptor private final S state; - public MessageWithThreadState(Message message, S state) { + private MessageWithThreadState(Message message, S state) { this.message = message; this.state = state; } diff --git a/spring-integration-core/src/main/java/org/springframework/integration/config/ChannelInitializer.java b/spring-integration-core/src/main/java/org/springframework/integration/config/ChannelInitializer.java index a9e15a4edb..930f373aa9 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/config/ChannelInitializer.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/config/ChannelInitializer.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2014 the original author or authors. + * Copyright 2002-2015 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. @@ -43,7 +43,7 @@ import org.springframework.util.Assert; */ final class ChannelInitializer implements BeanFactoryAware, InitializingBean { - private Log logger = LogFactory.getLog(this.getClass()); + private final Log logger = LogFactory.getLog(this.getClass()); private volatile BeanFactory beanFactory; @@ -54,10 +54,12 @@ final class ChannelInitializer implements BeanFactoryAware, InitializingBean { this.autoCreate = autoCreate; } + @Override public void setBeanFactory(BeanFactory beanFactory) throws BeansException { this.beanFactory = beanFactory; } + @Override public void afterPropertiesSet() throws Exception { Assert.notNull(this.beanFactory, "'beanFactory' must not be null"); if (!autoCreate){ @@ -89,7 +91,7 @@ final class ChannelInitializer implements BeanFactoryAware, InitializingBean { private final Collection channelNames; - public AutoCreateCandidatesCollector(Collection channelNames){ + AutoCreateCandidatesCollector(Collection channelNames){ this.channelNames = channelNames; } diff --git a/spring-integration-core/src/main/java/org/springframework/integration/context/ConverterRegistrar.java b/spring-integration-core/src/main/java/org/springframework/integration/context/ConverterRegistrar.java index ebd5198b97..1737ee0551 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/context/ConverterRegistrar.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/context/ConverterRegistrar.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2010 the original author or authors. + * Copyright 2002-2015 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. @@ -33,6 +33,7 @@ import org.springframework.util.Assert; * * @author Oleg Zhurakousky * @author Mark Fisher + * @author Gary Russell * @since 2.0 */ class ConverterRegistrar implements InitializingBean, BeanFactoryAware { @@ -42,7 +43,7 @@ class ConverterRegistrar implements InitializingBean, BeanFactoryAware { private BeanFactory beanFactory; - public ConverterRegistrar(Set converters) { + ConverterRegistrar(Set converters) { this.converters = converters; } diff --git a/spring-integration-core/src/main/java/org/springframework/integration/core/MessagingTemplate.java b/spring-integration-core/src/main/java/org/springframework/integration/core/MessagingTemplate.java index 35924dd6b1..e8620508e1 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/core/MessagingTemplate.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/core/MessagingTemplate.java @@ -53,7 +53,7 @@ public class MessagingTemplate extends GenericMessagingTemplate { * @param defaultChannel the default {@link MessageChannel} for {@code send} operations */ public MessagingTemplate(MessageChannel defaultChannel) { - this.setDefaultChannel(defaultChannel); + super.setDefaultDestination(defaultChannel); } /** diff --git a/spring-integration-core/src/main/java/org/springframework/integration/dispatcher/OrderedAwareCopyOnWriteArraySet.java b/spring-integration-core/src/main/java/org/springframework/integration/dispatcher/OrderedAwareCopyOnWriteArraySet.java index c4583f74c9..ab6525ebbf 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/dispatcher/OrderedAwareCopyOnWriteArraySet.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/dispatcher/OrderedAwareCopyOnWriteArraySet.java @@ -1,242 +1,256 @@ -/* - * Copyright 2002-2013 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 - * - * http://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.integration.dispatcher; - -import java.util.Collection; -import java.util.Collections; -import java.util.Comparator; -import java.util.Iterator; -import java.util.LinkedHashSet; -import java.util.Set; -import java.util.concurrent.CopyOnWriteArraySet; -import java.util.concurrent.locks.ReentrantReadWriteLock; -import java.util.concurrent.locks.ReentrantReadWriteLock.ReadLock; -import java.util.concurrent.locks.ReentrantReadWriteLock.WriteLock; - -import org.springframework.core.OrderComparator; -import org.springframework.core.Ordered; -import org.springframework.core.annotation.Order; -import org.springframework.util.Assert; -import org.springframework.util.CollectionUtils; -import org.springframework.util.StringUtils; - -/** - * Special Set that maintains the following semantics: - * All elements that are un-ordered (do not implement {@link Ordered} interface or annotated - * {@link Order} annotation) will be stored in the order in which they were added. - * However, for all {@link Ordered} elements a - * {@link Comparator} (instantiated by default) for this implementation of {@link Set}, will be - * used. Those elements will have precedence over un-ordered elements. If elements have the same - * order but themselves do not equal to one another the more recent addition will be placed to the - * right of (appended next to) the existing element with the same order, thus preserving the order - * of the insertion while maintaining the order of insertion for the un-ordered elements. - *

- * The class is package-protected and only intended for use by the AbstractDispatcher. It - * must enforce safe concurrent access for all usage by the dispatcher. - * - * @author Oleg Zhurakousky - * @author Mark Fisher - * @author Diego Belfer - * @since 1.0.3 - */ -@SuppressWarnings({"unchecked"}) -class OrderedAwareCopyOnWriteArraySet implements Set { - - private final OrderComparator comparator = new OrderComparator(); - - private final ReentrantReadWriteLock rwl = new ReentrantReadWriteLock(); - - private final ReadLock readLock = rwl.readLock(); - - private final WriteLock writeLock = rwl.writeLock(); - - private final CopyOnWriteArraySet elements; - - private final Set unmodifiableElements; - - public OrderedAwareCopyOnWriteArraySet() { - elements = new CopyOnWriteArraySet(); - unmodifiableElements = Collections.unmodifiableSet(elements); - } - - public Set asUnmodifiableSet() { - return unmodifiableElements; - } - - - /** - * Every time an Ordered element is added via this method this - * Set will be re-sorted, otherwise the element is simply added - * to the end. Added element must not be null. - */ - public boolean add(E o) { - Assert.notNull(o,"Can not add NULL object"); - writeLock.lock(); - try { - boolean present = false; - if (o instanceof Ordered){ - present = this.addOrderedElement((Ordered) o); - } - else { - present = elements.add(o); - } - return present; - } - finally { - writeLock.unlock(); - } - } - - /** - * Adds all elements in this Collection. - */ - public boolean addAll(Collection c) { - Assert.notNull(c,"Can not merge with NULL set"); - writeLock.lock(); - try { - for (E object : c) { - this.add(object); - } - return true; - } - finally { - writeLock.unlock(); - } - } - - /** - * {@inheritDoc} - */ - public boolean remove(Object o) { - writeLock.lock(); - try { - boolean removed = elements.remove(o); - //unmodifiableElements = Collections.unmodifiableSet(this); - return removed; - } - finally { - writeLock.unlock(); - } - } - - /** - * {@inheritDoc} - */ - public boolean removeAll(Collection c){ - if (CollectionUtils.isEmpty(c)){ - return false; - } - writeLock.lock(); - try { - return elements.removeAll(c); - } - finally { - writeLock.unlock(); - } - } - - public T[] toArray(T[] a) { - readLock.lock(); - try { - return elements.toArray(a); - } - finally { - readLock.unlock(); - } - } - - @Override - public String toString() { - readLock.lock(); - try { - return StringUtils.collectionToCommaDelimitedString(elements); - } - finally { - readLock.unlock(); - } - } - - @SuppressWarnings("rawtypes") - private boolean addOrderedElement(Ordered adding) { - boolean added = false; - E[] tempUnorderedElements = (E[]) elements.toArray(); - if (elements.contains(adding)) { - return false; - } - elements.clear(); - - if (tempUnorderedElements.length == 0) { - added = elements.add((E) adding); - } - else { - Set tempSet = new LinkedHashSet(); - for (E current : tempUnorderedElements) { - if (current instanceof Ordered) { - if (this.comparator.compare(adding, current) < 0) { - added = elements.add((E) adding); - elements.add(current); - } - else { - elements.add(current); - } - } - else { - tempSet.add(current); - } - } - if (!added) { - added = elements.add((E) adding); - } - for (Object object : tempSet) { - elements.add((E) object); - } - } - return added; - } - - public Iterator iterator() { - return this.elements.iterator(); - } - - public int size(){ - return this.elements.size(); - } - - public boolean isEmpty() { - return this.elements.isEmpty(); - } - - public boolean contains(Object o) { - return this.elements.contains(o); - } - - public Object[] toArray() { - return this.elements.toArray(); - } - - public boolean containsAll(Collection c) { - return this.elements.containsAll(c); - } - - public boolean retainAll(Collection c) { - return this.elements.retainAll(c); - } - - public void clear() { - this.elements.clear(); - } -} +/* + * Copyright 2002-2015 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 + * + * http://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.integration.dispatcher; + +import java.util.Collection; +import java.util.Collections; +import java.util.Comparator; +import java.util.Iterator; +import java.util.LinkedHashSet; +import java.util.Set; +import java.util.concurrent.CopyOnWriteArraySet; +import java.util.concurrent.locks.ReentrantReadWriteLock; +import java.util.concurrent.locks.ReentrantReadWriteLock.ReadLock; +import java.util.concurrent.locks.ReentrantReadWriteLock.WriteLock; + +import org.springframework.core.OrderComparator; +import org.springframework.core.Ordered; +import org.springframework.core.annotation.Order; +import org.springframework.util.Assert; +import org.springframework.util.CollectionUtils; +import org.springframework.util.StringUtils; + +/** + * Special Set that maintains the following semantics: + * All elements that are un-ordered (do not implement {@link Ordered} interface or annotated + * {@link Order} annotation) will be stored in the order in which they were added. + * However, for all {@link Ordered} elements a + * {@link Comparator} (instantiated by default) for this implementation of {@link Set}, will be + * used. Those elements will have precedence over un-ordered elements. If elements have the same + * order but themselves do not equal to one another the more recent addition will be placed to the + * right of (appended next to) the existing element with the same order, thus preserving the order + * of the insertion while maintaining the order of insertion for the un-ordered elements. + *

+ * The class is package-protected and only intended for use by the AbstractDispatcher. It + * must enforce safe concurrent access for all usage by the dispatcher. + * + * @author Oleg Zhurakousky + * @author Mark Fisher + * @author Diego Belfer + * @author Gary Russell + * @since 1.0.3 + */ +@SuppressWarnings({"unchecked"}) +class OrderedAwareCopyOnWriteArraySet implements Set { + + private final OrderComparator comparator = new OrderComparator(); + + private final ReentrantReadWriteLock rwl = new ReentrantReadWriteLock(); + + private final ReadLock readLock = rwl.readLock(); + + private final WriteLock writeLock = rwl.writeLock(); + + private final CopyOnWriteArraySet elements; + + private final Set unmodifiableElements; + + OrderedAwareCopyOnWriteArraySet() { + elements = new CopyOnWriteArraySet(); + unmodifiableElements = Collections.unmodifiableSet(elements); + } + + public Set asUnmodifiableSet() { + return unmodifiableElements; + } + + /** + * Every time an Ordered element is added via this method this + * Set will be re-sorted, otherwise the element is simply added + * to the end. Added element must not be null. + */ + @Override + public boolean add(E o) { + Assert.notNull(o,"Can not add NULL object"); + writeLock.lock(); + try { + boolean present = false; + if (o instanceof Ordered){ + present = this.addOrderedElement((Ordered) o); + } + else { + present = elements.add(o); + } + return present; + } + finally { + writeLock.unlock(); + } + } + + /** + * Adds all elements in this Collection. + */ + @Override + public boolean addAll(Collection c) { + Assert.notNull(c,"Can not merge with NULL set"); + writeLock.lock(); + try { + for (E object : c) { + this.add(object); + } + return true; + } + finally { + writeLock.unlock(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public boolean remove(Object o) { + writeLock.lock(); + try { + boolean removed = elements.remove(o); + //unmodifiableElements = Collections.unmodifiableSet(this); + return removed; + } + finally { + writeLock.unlock(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public boolean removeAll(Collection c){ + if (CollectionUtils.isEmpty(c)){ + return false; + } + writeLock.lock(); + try { + return elements.removeAll(c); + } + finally { + writeLock.unlock(); + } + } + + @Override + public T[] toArray(T[] a) { + readLock.lock(); + try { + return elements.toArray(a); + } + finally { + readLock.unlock(); + } + } + + @Override + public String toString() { + readLock.lock(); + try { + return StringUtils.collectionToCommaDelimitedString(elements); + } + finally { + readLock.unlock(); + } + } + + @SuppressWarnings("rawtypes") + private boolean addOrderedElement(Ordered adding) { + boolean added = false; + E[] tempUnorderedElements = (E[]) elements.toArray(); + if (elements.contains(adding)) { + return false; + } + elements.clear(); + + if (tempUnorderedElements.length == 0) { + added = elements.add((E) adding); + } + else { + Set tempSet = new LinkedHashSet(); + for (E current : tempUnorderedElements) { + if (current instanceof Ordered) { + if (this.comparator.compare(adding, current) < 0) { + added = elements.add((E) adding); + elements.add(current); + } + else { + elements.add(current); + } + } + else { + tempSet.add(current); + } + } + if (!added) { + added = elements.add((E) adding); + } + for (Object object : tempSet) { + elements.add((E) object); + } + } + return added; + } + + @Override + public Iterator iterator() { + return this.elements.iterator(); + } + + @Override + public int size(){ + return this.elements.size(); + } + + @Override + public boolean isEmpty() { + return this.elements.isEmpty(); + } + + @Override + public boolean contains(Object o) { + return this.elements.contains(o); + } + + @Override + public Object[] toArray() { + return this.elements.toArray(); + } + + @Override + public boolean containsAll(Collection c) { + return this.elements.containsAll(c); + } + + @Override + public boolean retainAll(Collection c) { + return this.elements.retainAll(c); + } + + @Override + public void clear() { + this.elements.clear(); + } + +} diff --git a/spring-integration-core/src/main/java/org/springframework/integration/endpoint/AbstractPollingEndpoint.java b/spring-integration-core/src/main/java/org/springframework/integration/endpoint/AbstractPollingEndpoint.java index cab86ed734..63ca6daa1a 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/endpoint/AbstractPollingEndpoint.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/endpoint/AbstractPollingEndpoint.java @@ -315,7 +315,7 @@ public abstract class AbstractPollingEndpoint extends AbstractEndpoint implement private final Callable pollingTask; - public Poller(Callable pollingTask) { + private Poller(Callable pollingTask) { this.pollingTask = pollingTask; } diff --git a/spring-integration-core/src/main/java/org/springframework/integration/expression/ReloadableResourceBundleExpressionSource.java b/spring-integration-core/src/main/java/org/springframework/integration/expression/ReloadableResourceBundleExpressionSource.java index 7b60795847..09f6cc56c4 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/expression/ReloadableResourceBundleExpressionSource.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/expression/ReloadableResourceBundleExpressionSource.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2014 the original author or authors. + * Copyright 2002-2015 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. @@ -50,6 +50,7 @@ import org.springframework.util.StringUtils; * * @author Juergen Hoeller * @author Mark Fisher + * @author Gary Russell * @since 2.0 * @see #setCacheSeconds * @see #setBasenames @@ -545,12 +546,12 @@ public class ReloadableResourceBundleExpressionSource implements ExpressionSourc private long refreshTimestamp = -1; - public PropertiesHolder(Properties properties, long fileTimestamp) { + private PropertiesHolder(Properties properties, long fileTimestamp) { this.properties = properties; this.fileTimestamp = fileTimestamp; } - public PropertiesHolder() { + private PropertiesHolder() { } public Properties getProperties() { diff --git a/spring-integration-core/src/main/java/org/springframework/integration/gateway/GatewayCompletableFutureProxyFactoryBean.java b/spring-integration-core/src/main/java/org/springframework/integration/gateway/GatewayCompletableFutureProxyFactoryBean.java index ddb9be23b6..c2a65b3fbe 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/gateway/GatewayCompletableFutureProxyFactoryBean.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/gateway/GatewayCompletableFutureProxyFactoryBean.java @@ -68,7 +68,7 @@ public class GatewayCompletableFutureProxyFactoryBean extends GatewayProxyFactor private final MethodInvocation invocation; - public Invoker(MethodInvocation methodInvocation) { + private Invoker(MethodInvocation methodInvocation) { this.invocation = methodInvocation; } diff --git a/spring-integration-core/src/main/java/org/springframework/integration/gateway/GatewayMethodInboundMessageMapper.java b/spring-integration-core/src/main/java/org/springframework/integration/gateway/GatewayMethodInboundMessageMapper.java index e686fc6d40..a2bfc00cdf 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/gateway/GatewayMethodInboundMessageMapper.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/gateway/GatewayMethodInboundMessageMapper.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2014 the original author or authors. + * Copyright 2002-2015 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. @@ -104,15 +104,15 @@ class GatewayMethodInboundMessageMapper implements InboundMessageMapper headerExpressions) { + GatewayMethodInboundMessageMapper(Method method, Map headerExpressions) { this(method, headerExpressions, null, null, null); } - public GatewayMethodInboundMessageMapper(Method method, Map headerExpressions, + GatewayMethodInboundMessageMapper(Method method, Map headerExpressions, Map globalHeaderExpressions, MethodArgsMessageMapper mapper, MessageBuilderFactory messageBuilderFactory) { Assert.notNull(method, "method must not be null"); diff --git a/spring-integration-core/src/main/java/org/springframework/integration/gateway/RequestReplyMessageHandlerAdapter.java b/spring-integration-core/src/main/java/org/springframework/integration/gateway/RequestReplyMessageHandlerAdapter.java index 4cce94cb89..0fbca43934 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/gateway/RequestReplyMessageHandlerAdapter.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/gateway/RequestReplyMessageHandlerAdapter.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2010 the original author or authors. + * Copyright 2002-2015 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. @@ -16,26 +16,27 @@ package org.springframework.integration.gateway; +import org.springframework.integration.handler.AbstractReplyProducingMessageHandler; import org.springframework.messaging.Message; import org.springframework.messaging.MessageHandler; -import org.springframework.integration.handler.AbstractReplyProducingMessageHandler; import org.springframework.util.Assert; /** * Adapts a {@link RequestReplyExchanger} to the {@link MessageHandler} interface. - * + * * @author Oleg Zhurakousky * @author Mark Fisher + * @author Gary Russell * @since 2.0 */ class RequestReplyMessageHandlerAdapter extends AbstractReplyProducingMessageHandler { - private RequestReplyExchanger exchanger; + private final RequestReplyExchanger exchanger; /** * @param exchanger */ - public RequestReplyMessageHandlerAdapter(RequestReplyExchanger exchanger) { + RequestReplyMessageHandlerAdapter(RequestReplyExchanger exchanger) { Assert.notNull(exchanger, "exchanger must not be null"); this.exchanger = exchanger; } @@ -43,6 +44,7 @@ class RequestReplyMessageHandlerAdapter extends AbstractReplyProducingMessageHan /** * Delegates to the exchanger. */ + @Override protected Object handleRequestMessage(Message requestMessage) { return exchanger.exchange(requestMessage); } diff --git a/spring-integration-core/src/main/java/org/springframework/integration/handler/LoggingHandler.java b/spring-integration-core/src/main/java/org/springframework/integration/handler/LoggingHandler.java index 42cff1b391..dbe88b6b9a 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/handler/LoggingHandler.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/handler/LoggingHandler.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2014 the original author or authors. + * Copyright 2002-2015 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 @@ -39,7 +39,7 @@ import org.springframework.util.StringUtils; */ public class LoggingHandler extends AbstractMessageHandler { - public static enum Level { + public enum Level { FATAL, ERROR, WARN, INFO, DEBUG, TRACE } diff --git a/spring-integration-core/src/main/java/org/springframework/integration/handler/advice/AbstractRequestHandlerAdvice.java b/spring-integration-core/src/main/java/org/springframework/integration/handler/advice/AbstractRequestHandlerAdvice.java index b66e8dccab..4e16ad8a74 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/handler/advice/AbstractRequestHandlerAdvice.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/handler/advice/AbstractRequestHandlerAdvice.java @@ -183,7 +183,7 @@ public abstract class AbstractRequestHandlerAdvice extends IntegrationObjectSupp @SuppressWarnings("serial") private class ThrowableHolderException extends RuntimeException { - public ThrowableHolderException(Throwable cause) { + private ThrowableHolderException(Throwable cause) { super(cause); } diff --git a/spring-integration-core/src/main/java/org/springframework/integration/handler/advice/RequestHandlerCircuitBreakerAdvice.java b/spring-integration-core/src/main/java/org/springframework/integration/handler/advice/RequestHandlerCircuitBreakerAdvice.java index cb080d1de3..efe6b85a6c 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/handler/advice/RequestHandlerCircuitBreakerAdvice.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/handler/advice/RequestHandlerCircuitBreakerAdvice.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2015 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. @@ -72,7 +72,7 @@ public class RequestHandlerCircuitBreakerAdvice extends AbstractRequestHandlerAd } } - private class AdvisedMetadata { + private static class AdvisedMetadata { private final AtomicInteger failures = new AtomicInteger(); @@ -91,13 +91,17 @@ public class RequestHandlerCircuitBreakerAdvice extends AbstractRequestHandlerAd } } - private class CircuitBreakerOpenException extends RuntimeException { + /** + * An exception thrown when the circuit breaker is in an open state. + */ + public static class CircuitBreakerOpenException extends RuntimeException { private static final long serialVersionUID = 1L; - public CircuitBreakerOpenException(String message) { + private CircuitBreakerOpenException(String message) { super(message); } + } } diff --git a/spring-integration-core/src/main/java/org/springframework/integration/json/ObjectToJsonTransformer.java b/spring-integration-core/src/main/java/org/springframework/integration/json/ObjectToJsonTransformer.java index ec9eedd97f..cef41b5021 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/json/ObjectToJsonTransformer.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/json/ObjectToJsonTransformer.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2014 the original author or authors. + * Copyright 2002-2015 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. @@ -16,8 +16,8 @@ package org.springframework.integration.json; import org.springframework.integration.support.AbstractIntegrationMessageBuilder; -import org.springframework.integration.support.json.JsonObjectMapperProvider; import org.springframework.integration.support.json.JsonObjectMapper; +import org.springframework.integration.support.json.JsonObjectMapperProvider; import org.springframework.integration.transformer.AbstractTransformer; import org.springframework.messaging.Message; import org.springframework.messaging.MessageHeaders; @@ -41,7 +41,7 @@ import org.springframework.util.StringUtils; */ public class ObjectToJsonTransformer extends AbstractTransformer { - public static enum ResultType { + public enum ResultType { STRING, NODE } diff --git a/spring-integration-core/src/main/java/org/springframework/integration/selector/MessageSelectorChain.java b/spring-integration-core/src/main/java/org/springframework/integration/selector/MessageSelectorChain.java index 56ffae7014..2064e44300 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/selector/MessageSelectorChain.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/selector/MessageSelectorChain.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2014 the original author or authors. + * Copyright 2002-2015 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. @@ -30,10 +30,11 @@ import org.springframework.util.Assert; * accordance with this chain's {@link VotingStrategy}. * * @author Mark Fisher + * @author Gary Russell */ public class MessageSelectorChain implements MessageSelector { - public static enum VotingStrategy { ALL, ANY, MAJORITY, MAJORITY_OR_TIE }; + public enum VotingStrategy { ALL, ANY, MAJORITY, MAJORITY_OR_TIE }; private volatile VotingStrategy votingStrategy = VotingStrategy.ALL; diff --git a/spring-integration-core/src/main/java/org/springframework/integration/support/SmartLifecycleRoleController.java b/spring-integration-core/src/main/java/org/springframework/integration/support/SmartLifecycleRoleController.java index 6cb7b75c41..476cea956b 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/support/SmartLifecycleRoleController.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/support/SmartLifecycleRoleController.java @@ -95,7 +95,7 @@ public class SmartLifecycleRoleController implements ApplicationListener inboundMessageMapper) { + public final void setInboundMessageMapper(InboundMessageMapper inboundMessageMapper) { this.inboundMessageMapper = (inboundMessageMapper != null) ? inboundMessageMapper : new DefaultInboundMessageMapper(); } - public void setOutboundMessageMapper(OutboundMessageMapper outboundMessageMapper) { + public final void setOutboundMessageMapper(OutboundMessageMapper outboundMessageMapper) { this.outboundMessageMapper = (outboundMessageMapper != null ? outboundMessageMapper : new DefaultOutboundMessageMapper()); diff --git a/spring-integration-core/src/main/java/org/springframework/integration/transaction/DefaultTransactionSynchronizationFactory.java b/spring-integration-core/src/main/java/org/springframework/integration/transaction/DefaultTransactionSynchronizationFactory.java index fe10f43163..bdf6716a38 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/transaction/DefaultTransactionSynchronizationFactory.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/transaction/DefaultTransactionSynchronizationFactory.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2014 the original author or authors. + * Copyright 2002-2015 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 @@ -39,6 +39,7 @@ public class DefaultTransactionSynchronizationFactory implements TransactionSync this.processor = processor; } + @Override public TransactionSynchronization create(Object key) { Assert.notNull(key, "'key' must not be null"); DefaultTransactionalResourceSynchronization synchronization = new DefaultTransactionalResourceSynchronization(key); @@ -50,7 +51,7 @@ public class DefaultTransactionSynchronizationFactory implements TransactionSync */ private class DefaultTransactionalResourceSynchronization extends IntegrationResourceHolderSynchronization { - public DefaultTransactionalResourceSynchronization(Object resourceKey) { + private DefaultTransactionalResourceSynchronization(Object resourceKey) { super(new IntegrationResourceHolder(), resourceKey); } diff --git a/spring-integration-file/src/main/java/org/springframework/integration/file/HeadDirectoryScanner.java b/spring-integration-file/src/main/java/org/springframework/integration/file/HeadDirectoryScanner.java index 38d8536922..32e9b40d4b 100644 --- a/spring-integration-file/src/main/java/org/springframework/integration/file/HeadDirectoryScanner.java +++ b/spring-integration-file/src/main/java/org/springframework/integration/file/HeadDirectoryScanner.java @@ -44,7 +44,7 @@ public class HeadDirectoryScanner extends DefaultDirectoryScanner { } @Override - public void setFilter(FileListFilter filter) { + public final void setFilter(FileListFilter filter) { if (filter instanceof CompositeFileListFilter) { ((CompositeFileListFilter) filter).addFilter(this.headFilter); super.setFilter(filter); @@ -61,7 +61,7 @@ public class HeadDirectoryScanner extends DefaultDirectoryScanner { private final int maxNumberOfFiles; - public HeadFilter(int maxNumberOfFiles) { + private HeadFilter(int maxNumberOfFiles) { this.maxNumberOfFiles = maxNumberOfFiles; } diff --git a/spring-integration-groovy/src/main/java/org/springframework/integration/groovy/config/GroovyControlBusFactoryBean.java b/spring-integration-groovy/src/main/java/org/springframework/integration/groovy/config/GroovyControlBusFactoryBean.java index bf329f67bc..e767a4ecf8 100644 --- a/spring-integration-groovy/src/main/java/org/springframework/integration/groovy/config/GroovyControlBusFactoryBean.java +++ b/spring-integration-groovy/src/main/java/org/springframework/integration/groovy/config/GroovyControlBusFactoryBean.java @@ -112,7 +112,7 @@ public class GroovyControlBusFactoryBean extends AbstractSimpleMessageHandlerFac private final ConfigurableListableBeanFactory beanFactory; - public ManagedBeansBinding(BeanFactory beanFactory) { + private ManagedBeansBinding(BeanFactory beanFactory) { this.beanFactory = (beanFactory instanceof ConfigurableListableBeanFactory) ? (ConfigurableListableBeanFactory) beanFactory : null; } diff --git a/spring-integration-ip/src/main/java/org/springframework/integration/ip/tcp/TcpOutboundGateway.java b/spring-integration-ip/src/main/java/org/springframework/integration/ip/tcp/TcpOutboundGateway.java index 4d12f7a1ee..78e7ae93a0 100644 --- a/spring-integration-ip/src/main/java/org/springframework/integration/ip/tcp/TcpOutboundGateway.java +++ b/spring-integration-ip/src/main/java/org/springframework/integration/ip/tcp/TcpOutboundGateway.java @@ -284,7 +284,7 @@ public class TcpOutboundGateway extends AbstractReplyProducingMessageHandler private volatile Message reply; - public AsyncReply(long remoteTimeout) { + private AsyncReply(long remoteTimeout) { this.latch = new CountDownLatch(1); this.secondChanceLatch = new CountDownLatch(1); this.remoteTimeout = remoteTimeout; diff --git a/spring-integration-ip/src/main/java/org/springframework/integration/ip/tcp/connection/CachingClientConnectionFactory.java b/spring-integration-ip/src/main/java/org/springframework/integration/ip/tcp/connection/CachingClientConnectionFactory.java index 759524e3a7..e26731bfbf 100644 --- a/spring-integration-ip/src/main/java/org/springframework/integration/ip/tcp/connection/CachingClientConnectionFactory.java +++ b/spring-integration-ip/src/main/java/org/springframework/integration/ip/tcp/connection/CachingClientConnectionFactory.java @@ -139,7 +139,7 @@ public class CachingClientConnectionFactory extends AbstractClientConnectionFact private volatile boolean released; - public CachedConnection(TcpConnectionSupport connection, TcpListener tcpListener) { + private CachedConnection(TcpConnectionSupport connection, TcpListener tcpListener) { super.setTheConnection(connection); registerListener(tcpListener); } diff --git a/spring-integration-ip/src/main/java/org/springframework/integration/ip/tcp/connection/FailoverClientConnectionFactory.java b/spring-integration-ip/src/main/java/org/springframework/integration/ip/tcp/connection/FailoverClientConnectionFactory.java index d98c2562ff..43a752051a 100644 --- a/spring-integration-ip/src/main/java/org/springframework/integration/ip/tcp/connection/FailoverClientConnectionFactory.java +++ b/spring-integration-ip/src/main/java/org/springframework/integration/ip/tcp/connection/FailoverClientConnectionFactory.java @@ -159,7 +159,7 @@ public class FailoverClientConnectionFactory extends AbstractClientConnectionFac private final AtomicLong epoch = new AtomicLong(); - public FailoverTcpConnection(List factories) throws Exception { + private FailoverTcpConnection(List factories) throws Exception { this.factories = factories; this.factoryIterator = factories.iterator(); findAConnection(); diff --git a/spring-integration-ip/src/main/java/org/springframework/integration/ip/tcp/connection/TcpNioSSLConnection.java b/spring-integration-ip/src/main/java/org/springframework/integration/ip/tcp/connection/TcpNioSSLConnection.java index 0338df9d20..c4d0d0e06e 100644 --- a/spring-integration-ip/src/main/java/org/springframework/integration/ip/tcp/connection/TcpNioSSLConnection.java +++ b/spring-integration-ip/src/main/java/org/springframework/integration/ip/tcp/connection/TcpNioSSLConnection.java @@ -281,7 +281,7 @@ public class TcpNioSSLConnection extends TcpNioConnection { private final ChannelOutputStream channelOutputStream; - public SSLChannelOutputStream(ChannelOutputStream channelOutputStream) { + private SSLChannelOutputStream(ChannelOutputStream channelOutputStream) { this.channelOutputStream = channelOutputStream; } diff --git a/spring-integration-jdbc/src/main/java/org/springframework/integration/jdbc/BeanPropertySqlParameterSourceFactory.java b/spring-integration-jdbc/src/main/java/org/springframework/integration/jdbc/BeanPropertySqlParameterSourceFactory.java index ce199126f2..ee7f094b72 100644 --- a/spring-integration-jdbc/src/main/java/org/springframework/integration/jdbc/BeanPropertySqlParameterSourceFactory.java +++ b/spring-integration-jdbc/src/main/java/org/springframework/integration/jdbc/BeanPropertySqlParameterSourceFactory.java @@ -46,6 +46,7 @@ public class BeanPropertySqlParameterSourceFactory implements SqlParameterSource this.staticParameters = staticParameters; } + @Override public SqlParameterSource createParameterSource(Object input) { SqlParameterSource toReturn = new StaticBeanPropertySqlParameterSource(input, staticParameters); return toReturn; @@ -58,16 +59,18 @@ public class BeanPropertySqlParameterSourceFactory implements SqlParameterSource private final Map staticParameters; - public StaticBeanPropertySqlParameterSource(Object input, Map staticParameters) { + private StaticBeanPropertySqlParameterSource(Object input, Map staticParameters) { this.input = new BeanPropertySqlParameterSource(input); this.staticParameters = staticParameters; } + @Override public Object getValue(String paramName) throws IllegalArgumentException { return staticParameters.containsKey(paramName) ? staticParameters.get(paramName) : input .getValue(paramName); } + @Override public boolean hasValue(String paramName) { return staticParameters.containsKey(paramName) || input.hasValue(paramName); } diff --git a/spring-integration-jms/src/main/java/org/springframework/integration/jms/ChannelPublishingJmsMessageListener.java b/spring-integration-jms/src/main/java/org/springframework/integration/jms/ChannelPublishingJmsMessageListener.java index 6ffc1fe7a5..eae6028b0c 100644 --- a/spring-integration-jms/src/main/java/org/springframework/integration/jms/ChannelPublishingJmsMessageListener.java +++ b/spring-integration-jms/src/main/java/org/springframework/integration/jms/ChannelPublishingJmsMessageListener.java @@ -481,11 +481,11 @@ public class ChannelPublishingJmsMessageListener */ private static class DestinationNameHolder { - public final String name; + private final String name; - public final boolean isTopic; + private final boolean isTopic; - public DestinationNameHolder(String name, boolean isTopic) { + private DestinationNameHolder(String name, boolean isTopic) { this.name = name; this.isTopic = isTopic; } diff --git a/spring-integration-jms/src/main/java/org/springframework/integration/jms/JmsOutboundGateway.java b/spring-integration-jms/src/main/java/org/springframework/integration/jms/JmsOutboundGateway.java index 1678ac4210..00a70e8bae 100644 --- a/spring-integration-jms/src/main/java/org/springframework/integration/jms/JmsOutboundGateway.java +++ b/spring-integration-jms/src/main/java/org/springframework/integration/jms/JmsOutboundGateway.java @@ -942,7 +942,7 @@ public class JmsOutboundGateway extends AbstractReplyProducingMessageHandler imp */ private javax.jms.Message retryableReceiveReply(Session session, Destination replyTo, String messageSelector) throws JMSException { - Connection consumerConnection = null; + Connection consumerConnection = null;//NOSONAR Session consumerSession = session; MessageConsumer messageConsumer = null; JMSException exception = null; @@ -1306,15 +1306,15 @@ public class JmsOutboundGateway extends AbstractReplyProducingMessageHandler imp private final javax.jms.Message reply; - public TimedReply(javax.jms.Message reply) { + private TimedReply(javax.jms.Message reply) { this.reply = reply; } - public long getTimeStamp() { + private long getTimeStamp() { return timeStamp; } - public javax.jms.Message getReply() { + private javax.jms.Message getReply() { return reply; } } diff --git a/spring-integration-jmx/src/main/java/org/springframework/integration/monitor/IntegrationMBeanExporter.java b/spring-integration-jmx/src/main/java/org/springframework/integration/monitor/IntegrationMBeanExporter.java index e66cc26c66..ef461376ec 100644 --- a/spring-integration-jmx/src/main/java/org/springframework/integration/monitor/IntegrationMBeanExporter.java +++ b/spring-integration-jmx/src/main/java/org/springframework/integration/monitor/IntegrationMBeanExporter.java @@ -1114,7 +1114,7 @@ public class IntegrationMBeanExporter extends MBeanExporter implements Applicati private static class IntegrationMetadataMBeanInfoAssembler extends MetadataMBeanInfoAssembler { - public IntegrationMetadataMBeanInfoAssembler(JmxAttributeSource attributeSource) { + private IntegrationMetadataMBeanInfoAssembler(JmxAttributeSource attributeSource) { super(attributeSource); } @@ -1132,7 +1132,7 @@ public class IntegrationMBeanExporter extends MBeanExporter implements Applicati private static class IntegrationMetadataNamingStrategy extends MetadataNamingStrategy { - public IntegrationMetadataNamingStrategy(JmxAttributeSource attributeSource) { + private IntegrationMetadataNamingStrategy(JmxAttributeSource attributeSource) { super(attributeSource); } diff --git a/spring-integration-jpa/src/main/java/org/springframework/integration/jpa/support/JpaParameter.java b/spring-integration-jpa/src/main/java/org/springframework/integration/jpa/support/JpaParameter.java index c65a77036f..fdcadb8f69 100644 --- a/spring-integration-jpa/src/main/java/org/springframework/integration/jpa/support/JpaParameter.java +++ b/spring-integration-jpa/src/main/java/org/springframework/integration/jpa/support/JpaParameter.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2013 the original author or authors. + * Copyright 2002-2015 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. @@ -28,6 +28,7 @@ import org.springframework.util.Assert; * * @author Gunnar Hillert * @author Artem Bilan + * @author Gary Russell * @since 2.2 * */ @@ -109,7 +110,7 @@ public class JpaParameter { return this.projectionExpression; } - public void setExpression(String expression) { + public final void setExpression(String expression) { this.expression = expression; this.spelExpression = PARSER.parseExpression(expression); this.projectionExpression = PARSER.parseExpression("#root.![" + expression + "]"); diff --git a/spring-integration-jpa/src/main/java/org/springframework/integration/jpa/support/parametersource/BeanPropertyParameterSourceFactory.java b/spring-integration-jpa/src/main/java/org/springframework/integration/jpa/support/parametersource/BeanPropertyParameterSourceFactory.java index 2a40040647..da55f761da 100644 --- a/spring-integration-jpa/src/main/java/org/springframework/integration/jpa/support/parametersource/BeanPropertyParameterSourceFactory.java +++ b/spring-integration-jpa/src/main/java/org/springframework/integration/jpa/support/parametersource/BeanPropertyParameterSourceFactory.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2015 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. @@ -22,6 +22,7 @@ import java.util.Map; /** * * @author Gunnar Hillert + * @author Gary Russell * @since 2.2 * */ @@ -43,6 +44,7 @@ public class BeanPropertyParameterSourceFactory implements ParameterSourceFactor this.staticParameters = staticParameters; } + @Override public ParameterSource createParameterSource(Object input) { ParameterSource toReturn = new StaticBeanPropertyParameterSource(input, staticParameters); return toReturn; @@ -55,16 +57,18 @@ public class BeanPropertyParameterSourceFactory implements ParameterSourceFactor private final Map staticParameters; - public StaticBeanPropertyParameterSource(Object input, Map staticParameters) { + private StaticBeanPropertyParameterSource(Object input, Map staticParameters) { this.input = new BeanPropertyParameterSource(input); this.staticParameters = staticParameters; } + @Override public Object getValue(String paramName) { return staticParameters.containsKey(paramName) ? staticParameters.get(paramName) : input .getValue(paramName); } + @Override public boolean hasValue(String paramName) { return staticParameters.containsKey(paramName) || input.hasValue(paramName); } diff --git a/spring-integration-mail/src/main/java/org/springframework/integration/mail/AbstractMailReceiver.java b/spring-integration-mail/src/main/java/org/springframework/integration/mail/AbstractMailReceiver.java index 56ae5ef7cc..ad24522c33 100755 --- a/spring-integration-mail/src/main/java/org/springframework/integration/mail/AbstractMailReceiver.java +++ b/spring-integration-mail/src/main/java/org/springframework/integration/mail/AbstractMailReceiver.java @@ -458,7 +458,7 @@ public abstract class AbstractMailReceiver extends IntegrationObjectSupport impl private final MimeMessage source; - public IntegrationMimeMessage(MimeMessage source) throws MessagingException { + private IntegrationMimeMessage(MimeMessage source) throws MessagingException { super(source); this.source = source; } diff --git a/spring-integration-mail/src/main/java/org/springframework/integration/mail/MailReceiver.java b/spring-integration-mail/src/main/java/org/springframework/integration/mail/MailReceiver.java index b06ad801bb..17b712149f 100644 --- a/spring-integration-mail/src/main/java/org/springframework/integration/mail/MailReceiver.java +++ b/spring-integration-mail/src/main/java/org/springframework/integration/mail/MailReceiver.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2015 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. @@ -32,7 +32,7 @@ public interface MailReceiver { javax.mail.Message[] receive() throws javax.mail.MessagingException; - public static class MailReceiverContext { + class MailReceiverContext { private final Folder folder; @@ -55,4 +55,5 @@ public interface MailReceiver { return folder; } } + } diff --git a/spring-integration-mongodb/src/main/java/org/springframework/integration/mongodb/store/MongoDbMessageStore.java b/spring-integration-mongodb/src/main/java/org/springframework/integration/mongodb/store/MongoDbMessageStore.java index 7645f4c458..b73bb42b6f 100644 --- a/spring-integration-mongodb/src/main/java/org/springframework/integration/mongodb/store/MongoDbMessageStore.java +++ b/spring-integration-mongodb/src/main/java/org/springframework/integration/mongodb/store/MongoDbMessageStore.java @@ -459,7 +459,7 @@ public class MongoDbMessageStore extends AbstractMessageGroupStore */ private class MessageReadingMongoConverter extends MappingMongoConverter { - public MessageReadingMongoConverter(MongoDbFactory mongoDbFactory, + private MessageReadingMongoConverter(MongoDbFactory mongoDbFactory, MappingContext, MongoPersistentProperty> mappingContext) { super(new DefaultDbRefResolver(mongoDbFactory), mappingContext); } @@ -789,7 +789,7 @@ public class MongoDbMessageStore extends AbstractMessageGroupStore @SuppressWarnings("unused") private int sequence; - public MessageWrapper(Message message) { + private MessageWrapper(Message message) { Assert.notNull(message, "'message' must not be null"); this.message = message; this._messageType = message.getClass().getName(); diff --git a/spring-integration-mqtt/src/main/java/org/springframework/integration/mqtt/inbound/AbstractMqttMessageDrivenChannelAdapter.java b/spring-integration-mqtt/src/main/java/org/springframework/integration/mqtt/inbound/AbstractMqttMessageDrivenChannelAdapter.java index e6b56cd1e4..ede2df8d90 100644 --- a/spring-integration-mqtt/src/main/java/org/springframework/integration/mqtt/inbound/AbstractMqttMessageDrivenChannelAdapter.java +++ b/spring-integration-mqtt/src/main/java/org/springframework/integration/mqtt/inbound/AbstractMqttMessageDrivenChannelAdapter.java @@ -258,20 +258,20 @@ public abstract class AbstractMqttMessageDrivenChannelAdapter extends MessagePro private volatile int qos; - public Topic(String topic, int qos) { + private Topic(String topic, int qos) { this.topic = topic; this.qos = qos; } - public int getQos() { + private int getQos() { return qos; } - public void setQos(int qos) { + private void setQos(int qos) { this.qos = qos; } - public String getTopic() { + private String getTopic() { return topic; } diff --git a/spring-integration-scripting/src/main/java/org/springframework/integration/scripting/ScriptExecutingMessageSource.java b/spring-integration-scripting/src/main/java/org/springframework/integration/scripting/ScriptExecutingMessageSource.java index 956793b105..a52bd2781b 100644 --- a/spring-integration-scripting/src/main/java/org/springframework/integration/scripting/ScriptExecutingMessageSource.java +++ b/spring-integration-scripting/src/main/java/org/springframework/integration/scripting/ScriptExecutingMessageSource.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2014 the original author or authors. + * Copyright 2013-2015 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. @@ -27,7 +27,7 @@ import org.springframework.integration.endpoint.AbstractMessageSource; * @author Gary Russell * @since 3.0 */ -class ScriptExecutingMessageSource extends AbstractMessageSource { +public class ScriptExecutingMessageSource extends AbstractMessageSource { private final AbstractScriptExecutingMessageProcessor scriptMessageProcessor; diff --git a/spring-integration-scripting/src/main/java/org/springframework/integration/scripting/jsr223/AbstractScriptExecutor.java b/spring-integration-scripting/src/main/java/org/springframework/integration/scripting/jsr223/AbstractScriptExecutor.java index 20ccad172c..da75696cca 100644 --- a/spring-integration-scripting/src/main/java/org/springframework/integration/scripting/jsr223/AbstractScriptExecutor.java +++ b/spring-integration-scripting/src/main/java/org/springframework/integration/scripting/jsr223/AbstractScriptExecutor.java @@ -37,7 +37,7 @@ import org.springframework.util.Assert; * @author Gary Russell * @since 2.1 */ -abstract class AbstractScriptExecutor implements ScriptExecutor { +public abstract class AbstractScriptExecutor implements ScriptExecutor { protected final Log logger = LogFactory.getLog(this.getClass()); @@ -45,7 +45,7 @@ abstract class AbstractScriptExecutor implements ScriptExecutor { protected final String language; - public AbstractScriptExecutor(String language) { + protected AbstractScriptExecutor(String language) { Assert.hasText(language, "language must not be empty"); this.language = language; diff --git a/spring-integration-scripting/src/main/java/org/springframework/integration/scripting/jsr223/DefaultScriptExecutor.java b/spring-integration-scripting/src/main/java/org/springframework/integration/scripting/jsr223/DefaultScriptExecutor.java index b5e092bd55..efb0ae2dba 100644 --- a/spring-integration-scripting/src/main/java/org/springframework/integration/scripting/jsr223/DefaultScriptExecutor.java +++ b/spring-integration-scripting/src/main/java/org/springframework/integration/scripting/jsr223/DefaultScriptExecutor.java @@ -25,12 +25,12 @@ import org.springframework.integration.scripting.ScriptExecutor; * @author Gary Russell * @since 2.1 */ - class DefaultScriptExecutor extends AbstractScriptExecutor { + public class DefaultScriptExecutor extends AbstractScriptExecutor { /** - * Create a DefaultScriptExceutor for the specified language name (JSR233 + * Create a DefaultScriptExecutor for the specified language name (JSR233 * alias). */ - public DefaultScriptExecutor(String language) { + DefaultScriptExecutor(String language) { super(language); } diff --git a/spring-integration-scripting/src/main/java/org/springframework/integration/scripting/jsr223/PythonScriptExecutor.java b/spring-integration-scripting/src/main/java/org/springframework/integration/scripting/jsr223/PythonScriptExecutor.java index 9080e2a6f3..1783a8079b 100644 --- a/spring-integration-scripting/src/main/java/org/springframework/integration/scripting/jsr223/PythonScriptExecutor.java +++ b/spring-integration-scripting/src/main/java/org/springframework/integration/scripting/jsr223/PythonScriptExecutor.java @@ -29,7 +29,7 @@ import org.springframework.integration.scripting.ScriptExecutor; * @since 2.1 * */ - class PythonScriptExecutor extends AbstractScriptExecutor { + public class PythonScriptExecutor extends AbstractScriptExecutor { /** * @param language */ diff --git a/spring-integration-scripting/src/main/java/org/springframework/integration/scripting/jsr223/RubyScriptExecutor.java b/spring-integration-scripting/src/main/java/org/springframework/integration/scripting/jsr223/RubyScriptExecutor.java index 8e7efb799e..6f501c45ba 100644 --- a/spring-integration-scripting/src/main/java/org/springframework/integration/scripting/jsr223/RubyScriptExecutor.java +++ b/spring-integration-scripting/src/main/java/org/springframework/integration/scripting/jsr223/RubyScriptExecutor.java @@ -1,11 +1,11 @@ /* - * Copyright 2002-2011 the original author or authors. - * + * Copyright 2002-2015 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 - * + * * http://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. @@ -20,7 +20,7 @@ import org.springframework.util.ClassUtils; * @since 2.1 * */ - class RubyScriptExecutor extends DefaultScriptExecutor { + public class RubyScriptExecutor extends DefaultScriptExecutor { static { if (ClassUtils.isPresent("org.jruby.embed.jsr223.JRubyEngine", System.class.getClassLoader())) { @@ -28,7 +28,7 @@ import org.springframework.util.ClassUtils; System.setProperty("org.jruby.embed.localcontext.scope", "threadsafe"); } } - + public RubyScriptExecutor() { super("ruby"); } diff --git a/spring-integration-scripting/src/main/java/org/springframework/integration/scripting/jsr223/ScriptExecutingMessageProcessor.java b/spring-integration-scripting/src/main/java/org/springframework/integration/scripting/jsr223/ScriptExecutingMessageProcessor.java index 384b7b2854..902f372dc7 100644 --- a/spring-integration-scripting/src/main/java/org/springframework/integration/scripting/jsr223/ScriptExecutingMessageProcessor.java +++ b/spring-integration-scripting/src/main/java/org/springframework/integration/scripting/jsr223/ScriptExecutingMessageProcessor.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2014 the original author or authors. + * Copyright 2002-2015 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 @@ -29,11 +29,13 @@ import org.springframework.util.Assert; public class ScriptExecutingMessageProcessor extends AbstractScriptExecutingMessageProcessor { private final ScriptExecutor scriptExecutor; + private volatile ScriptSource scriptSource; /** - * Create a processor for the {@link ScriptSource} using the provided {@link ScriptExecutor} using the DefaultScriptVariableGenerator + * Create a processor for the {@link ScriptSource} using the provided + * {@link ScriptExecutor} using the DefaultScriptVariableGenerator * * @param scriptSource The script source. * @param scriptExecutor The script executor. @@ -45,26 +47,30 @@ public class ScriptExecutingMessageProcessor extends AbstractScriptExecutingMess } /** - * Create a processor for the {@link ScriptSource} using the provided {@link ScriptExecutor} + * Create a processor for the {@link ScriptSource} using the provided + * {@link ScriptExecutor} * * @param scriptSource The script source. * @param scriptVariableGenerator The script variable generator. * @param scriptExecutor The script executor. */ - public ScriptExecutingMessageProcessor(ScriptSource scriptSource, ScriptVariableGenerator scriptVariableGenerator, ScriptExecutor scriptExecutor) { + public ScriptExecutingMessageProcessor(ScriptSource scriptSource, ScriptVariableGenerator scriptVariableGenerator, + ScriptExecutor scriptExecutor) { super(scriptVariableGenerator); this.scriptSource = scriptSource; this.scriptExecutor = scriptExecutor; } /** - * Create a processor for the {@link ScriptSource} using the provided {@link ScriptExecutor} using the DefaultScriptVariableGenerator + * Create a processor for the {@link ScriptSource} using the provided + * {@link ScriptExecutor} using the DefaultScriptVariableGenerator * * @param scriptSource The script source. * @param scriptExecutor The script executor. * @param variables The variables. */ - public ScriptExecutingMessageProcessor(ScriptSource scriptSource, ScriptExecutor scriptExecutor,Map variables ) { + public ScriptExecutingMessageProcessor(ScriptSource scriptSource, ScriptExecutor scriptExecutor, + Map variables) { super(new DefaultScriptVariableGenerator(variables)); this.scriptSource = scriptSource; this.scriptExecutor = scriptExecutor; diff --git a/spring-integration-scripting/src/main/java/org/springframework/integration/scripting/jsr223/ScriptExecutorFactory.java b/spring-integration-scripting/src/main/java/org/springframework/integration/scripting/jsr223/ScriptExecutorFactory.java index 95cfaba25d..fa42f60a43 100644 --- a/spring-integration-scripting/src/main/java/org/springframework/integration/scripting/jsr223/ScriptExecutorFactory.java +++ b/spring-integration-scripting/src/main/java/org/springframework/integration/scripting/jsr223/ScriptExecutorFactory.java @@ -1,11 +1,11 @@ /* - * Copyright 2002-2011 the original author or authors. - * + * Copyright 2002-2015 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 - * + * * http://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. @@ -19,14 +19,15 @@ import org.springframework.integration.scripting.ScriptExecutor; * @since 2.1 */ public abstract class ScriptExecutorFactory { - + public static ScriptExecutor getScriptExecutor(String language) { if (language.equalsIgnoreCase("python") || language.equalsIgnoreCase("jython")){ return new PythonScriptExecutor(); - } + } else if (language.equalsIgnoreCase("ruby") || language.equalsIgnoreCase("jruby")) { return new RubyScriptExecutor(); } return new DefaultScriptExecutor(language); } + } diff --git a/spring-integration-syslog/src/main/java/org/springframework/integration/syslog/RFC5424SyslogParser.java b/spring-integration-syslog/src/main/java/org/springframework/integration/syslog/RFC5424SyslogParser.java index c0b4cc2f8d..5bdaadbef8 100644 --- a/spring-integration-syslog/src/main/java/org/springframework/integration/syslog/RFC5424SyslogParser.java +++ b/spring-integration-syslog/src/main/java/org/springframework/integration/syslog/RFC5424SyslogParser.java @@ -1,5 +1,5 @@ /* - * Copyright 2014 the original author or authors. + * Copyright 2014-2015 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. @@ -339,7 +339,7 @@ public class RFC5424SyslogParser { private final String label; - private Severity(int level, String label) { + Severity(int level, String label) { this.level = level; this.label = label; } diff --git a/spring-integration-twitter/src/main/java/org/springframework/integration/twitter/inbound/AbstractTwitterMessageSource.java b/spring-integration-twitter/src/main/java/org/springframework/integration/twitter/inbound/AbstractTwitterMessageSource.java index 621cfea187..10ba551abb 100644 --- a/spring-integration-twitter/src/main/java/org/springframework/integration/twitter/inbound/AbstractTwitterMessageSource.java +++ b/spring-integration-twitter/src/main/java/org/springframework/integration/twitter/inbound/AbstractTwitterMessageSource.java @@ -81,7 +81,7 @@ abstract class AbstractTwitterMessageSource extends IntegrationObjectSupport private volatile int pageSize = DEFAULT_PAGE_SIZE; - public AbstractTwitterMessageSource(Twitter twitter, String metadataKey) { + protected AbstractTwitterMessageSource(Twitter twitter, String metadataKey) { Assert.notNull(twitter, "twitter must not be null"); Assert.notNull(metadataKey, "metadataKey must not be null"); this.twitter = twitter; diff --git a/spring-integration-websocket/src/main/java/org/springframework/integration/websocket/ClientWebSocketContainer.java b/spring-integration-websocket/src/main/java/org/springframework/integration/websocket/ClientWebSocketContainer.java index 5fea26c82f..648092471a 100644 --- a/spring-integration-websocket/src/main/java/org/springframework/integration/websocket/ClientWebSocketContainer.java +++ b/spring-integration-websocket/src/main/java/org/springframework/integration/websocket/ClientWebSocketContainer.java @@ -45,6 +45,7 @@ import org.springframework.web.socket.client.WebSocketClient; * event, which can be accessed from this container using {@link #getSession(String)}. * * @author Artem Bilan + * @author Gary Russell * @since 4.1 */ public final class ClientWebSocketContainer extends IntegrationWebSocketContainer implements SmartLifecycle { @@ -177,7 +178,7 @@ public final class ClientWebSocketContainer extends IntegrationWebSocketContaine private final boolean syncClientLifecycle; - public IntegrationWebSocketConnectionManager(WebSocketClient client, String uriTemplate, Object... uriVariables) { + private IntegrationWebSocketConnectionManager(WebSocketClient client, String uriTemplate, Object... uriVariables) { super(uriTemplate, uriVariables); this.client = client; this.syncClientLifecycle = ((client instanceof Lifecycle) && !((Lifecycle) client).isRunning()); diff --git a/spring-integration-websocket/src/main/java/org/springframework/integration/websocket/config/WebSocketIntegrationConfigurationInitializer.java b/spring-integration-websocket/src/main/java/org/springframework/integration/websocket/config/WebSocketIntegrationConfigurationInitializer.java index 27646dfa8d..25107abc77 100644 --- a/spring-integration-websocket/src/main/java/org/springframework/integration/websocket/config/WebSocketIntegrationConfigurationInitializer.java +++ b/spring-integration-websocket/src/main/java/org/springframework/integration/websocket/config/WebSocketIntegrationConfigurationInitializer.java @@ -1,5 +1,5 @@ /* - * Copyright 2014 the original author or authors. + * Copyright 2014-2015 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. @@ -43,6 +43,7 @@ import org.springframework.web.socket.config.annotation.WebSocketConfigurer; * The WebSocket Integration infrastructure {@code beanFactory} initializer. * * @author Artem Bilan + * @author Gary Russell * @since 4.1 */ public class WebSocketIntegrationConfigurationInitializer implements IntegrationConfigurationInitializer { @@ -114,7 +115,7 @@ public class WebSocketIntegrationConfigurationInitializer implements Integration private ApplicationContext applicationContext; - public WebSocketHandlerMappingFactoryBean(ThreadPoolTaskScheduler sockJsTaskScheduler) { + private WebSocketHandlerMappingFactoryBean(ThreadPoolTaskScheduler sockJsTaskScheduler) { this.registry = new ServletWebSocketHandlerRegistry(sockJsTaskScheduler); } diff --git a/spring-integration-ws/src/main/java/org/springframework/integration/ws/MarshallingWebServiceOutboundGateway.java b/spring-integration-ws/src/main/java/org/springframework/integration/ws/MarshallingWebServiceOutboundGateway.java index 2a6e3579d8..dfd5e71117 100644 --- a/spring-integration-ws/src/main/java/org/springframework/integration/ws/MarshallingWebServiceOutboundGateway.java +++ b/spring-integration-ws/src/main/java/org/springframework/integration/ws/MarshallingWebServiceOutboundGateway.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2014 the original author or authors. + * Copyright 2002-2015 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. @@ -34,6 +34,7 @@ import org.springframework.ws.support.MarshallingUtils; * * @author Mark Fisher * @author Oleg Zhurakousky + * @author Gary Russell * @see Marshaller * @see Unmarshaller */ @@ -42,16 +43,19 @@ public class MarshallingWebServiceOutboundGateway extends AbstractWebServiceOutb private volatile Marshaller marshaller; private volatile Unmarshaller unmarshaller; - public MarshallingWebServiceOutboundGateway(DestinationProvider destinationProvider, Marshaller marshaller, Unmarshaller unmarshaller, WebServiceMessageFactory messageFactory) { + public MarshallingWebServiceOutboundGateway(DestinationProvider destinationProvider, Marshaller marshaller, + Unmarshaller unmarshaller, WebServiceMessageFactory messageFactory) { super(destinationProvider, messageFactory); this.configureMarshallers(marshaller, unmarshaller); } - public MarshallingWebServiceOutboundGateway(DestinationProvider destinationProvider, Marshaller marshaller, Unmarshaller unmarshaller) { + public MarshallingWebServiceOutboundGateway(DestinationProvider destinationProvider, Marshaller marshaller, + Unmarshaller unmarshaller) { this(destinationProvider, marshaller, unmarshaller, null); } - public MarshallingWebServiceOutboundGateway(DestinationProvider destinationProvider, Marshaller marshaller, WebServiceMessageFactory messageFactory) { + public MarshallingWebServiceOutboundGateway(DestinationProvider destinationProvider, Marshaller marshaller, + WebServiceMessageFactory messageFactory) { this(destinationProvider, marshaller, null, messageFactory); } @@ -59,7 +63,8 @@ public class MarshallingWebServiceOutboundGateway extends AbstractWebServiceOutb this(destinationProvider, marshaller, (WebServiceMessageFactory) null); } - public MarshallingWebServiceOutboundGateway(String uri, Marshaller marshaller, Unmarshaller unmarshaller, WebServiceMessageFactory messageFactory) { + public MarshallingWebServiceOutboundGateway(String uri, Marshaller marshaller, Unmarshaller unmarshaller, + WebServiceMessageFactory messageFactory) { super(uri, messageFactory); this.configureMarshallers(marshaller, unmarshaller); } @@ -68,7 +73,8 @@ public class MarshallingWebServiceOutboundGateway extends AbstractWebServiceOutb this(uri, marshaller, unmarshaller, null); } - public MarshallingWebServiceOutboundGateway(String uri, Marshaller marshaller, WebServiceMessageFactory messageFactory) { + public MarshallingWebServiceOutboundGateway(String uri, Marshaller marshaller, + WebServiceMessageFactory messageFactory) { this(uri, marshaller, null, messageFactory); } @@ -79,7 +85,8 @@ public class MarshallingWebServiceOutboundGateway extends AbstractWebServiceOutb @Override protected Object doHandle(String uri, Message requestMessage, WebServiceMessageCallback requestCallback) { Object reply = this.getWebServiceTemplate().sendAndReceive(uri, - new MarshallingRequestMessageCallback(requestCallback, requestMessage), new MarshallingResponseMessageExtractor()); + new MarshallingRequestMessageCallback(requestCallback, requestMessage), + new MarshallingResponseMessageExtractor()); return reply; } @@ -112,12 +119,13 @@ public class MarshallingWebServiceOutboundGateway extends AbstractWebServiceOutb private class MarshallingRequestMessageCallback extends RequestMessageCallback { - public MarshallingRequestMessageCallback(WebServiceMessageCallback requestCallback, Message requestMessage){ + private MarshallingRequestMessageCallback(WebServiceMessageCallback requestCallback, + Message requestMessage) { super(requestCallback, requestMessage); } @Override - public void doWithMessageInternal(WebServiceMessage message, Object payload) throws IOException{ + public void doWithMessageInternal(WebServiceMessage message, Object payload) throws IOException { MarshallingUtils.marshal(marshaller, payload, message); } } @@ -125,7 +133,7 @@ public class MarshallingWebServiceOutboundGateway extends AbstractWebServiceOutb private class MarshallingResponseMessageExtractor extends ResponseMessageExtractor { @Override - public Object doExtractData(WebServiceMessage message) throws IOException{ + public Object doExtractData(WebServiceMessage message) throws IOException { return MarshallingUtils.unmarshal(unmarshaller, message); } } diff --git a/spring-integration-ws/src/main/java/org/springframework/integration/ws/SimpleWebServiceOutboundGateway.java b/spring-integration-ws/src/main/java/org/springframework/integration/ws/SimpleWebServiceOutboundGateway.java index 52ffdbb2fd..1dac80b1d5 100644 --- a/spring-integration-ws/src/main/java/org/springframework/integration/ws/SimpleWebServiceOutboundGateway.java +++ b/spring-integration-ws/src/main/java/org/springframework/integration/ws/SimpleWebServiceOutboundGateway.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2014 the original author or authors. + * Copyright 2002-2015 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. @@ -44,6 +44,7 @@ import org.springframework.xml.transform.TransformerObjectSupport; * @author Mark Fisher * @author Oleg Zhurakousky * @author Artem Bilan + * @author Gary Russell */ public class SimpleWebServiceOutboundGateway extends AbstractWebServiceOutboundGateway { @@ -53,11 +54,13 @@ public class SimpleWebServiceOutboundGateway extends AbstractWebServiceOutboundG this(destinationProvider, null, null); } - public SimpleWebServiceOutboundGateway(DestinationProvider destinationProvider, SourceExtractor sourceExtractor) { + public SimpleWebServiceOutboundGateway(DestinationProvider destinationProvider, + SourceExtractor sourceExtractor) { this(destinationProvider, sourceExtractor, (WebServiceMessageFactory) null); } - public SimpleWebServiceOutboundGateway(DestinationProvider destinationProvider, SourceExtractor sourceExtractor, WebServiceMessageFactory messageFactory) { + public SimpleWebServiceOutboundGateway(DestinationProvider destinationProvider, SourceExtractor sourceExtractor, + WebServiceMessageFactory messageFactory) { super(destinationProvider, messageFactory); this.sourceExtractor = (sourceExtractor != null) ? sourceExtractor : new DefaultSourceExtractor(); } @@ -70,7 +73,8 @@ public class SimpleWebServiceOutboundGateway extends AbstractWebServiceOutboundG this(uri, sourceExtractor, (WebServiceMessageFactory) null); } - public SimpleWebServiceOutboundGateway(String uri, SourceExtractor sourceExtractor, WebServiceMessageFactory messageFactory) { + public SimpleWebServiceOutboundGateway(String uri, SourceExtractor sourceExtractor, + WebServiceMessageFactory messageFactory) { super(uri, messageFactory); this.sourceExtractor = (sourceExtractor != null) ? sourceExtractor : new DefaultSourceExtractor(); } @@ -81,7 +85,8 @@ public class SimpleWebServiceOutboundGateway extends AbstractWebServiceOutboundG } @Override - protected Object doHandle(String uri, final Message requestMessage, final WebServiceMessageCallback requestCallback) { + protected Object doHandle(String uri, final Message requestMessage, + final WebServiceMessageCallback requestCallback) { Object requestPayload = requestMessage.getPayload(); Result responseResultInstance = null; if (requestPayload instanceof String) { @@ -91,17 +96,19 @@ public class SimpleWebServiceOutboundGateway extends AbstractWebServiceOutboundG responseResultInstance = new DOMResult(); } return this.getWebServiceTemplate().sendAndReceive(uri, - new SimpleRequestMessageCallback(requestCallback, requestMessage), new SimpleResponseMessageExtractor(responseResultInstance)); + new SimpleRequestMessageCallback(requestCallback, requestMessage), + new SimpleResponseMessageExtractor(responseResultInstance)); } private class SimpleRequestMessageCallback extends RequestMessageCallback { - public SimpleRequestMessageCallback(WebServiceMessageCallback requestCallback, Message requestMessage){ + private SimpleRequestMessageCallback(WebServiceMessageCallback requestCallback, Message requestMessage) { super(requestCallback, requestMessage); } @Override - public void doWithMessageInternal(WebServiceMessage message, Object payload) throws IOException, TransformerException { + public void doWithMessageInternal(WebServiceMessage message, Object payload) + throws IOException, TransformerException { Source source = this.extractSource(payload); this.transform(source, message.getPayloadResult()); } @@ -123,7 +130,8 @@ public class SimpleWebServiceOutboundGateway extends AbstractWebServiceOutboundG } else { throw new MessagingException("Unsupported payload type '" + requestPayload.getClass() + - "'. " + this.getClass().getName() + " only supports 'java.lang.String', '" + Source.class.getName() + + "'. " + this.getClass().getName() + " only supports 'java.lang.String', '" + + Source.class.getName() + "', and '" + Document.class.getName() + "'. Consider either using the '" + MarshallingWebServiceOutboundGateway.class.getName() + "' or a Message Transformer."); } @@ -137,13 +145,13 @@ public class SimpleWebServiceOutboundGateway extends AbstractWebServiceOutboundG private final Result result; - public SimpleResponseMessageExtractor(Result result){ + private SimpleResponseMessageExtractor(Result result) { super(); this.result = result; } @Override - public Object doExtractData(WebServiceMessage message) throws IOException, TransformerException{ + public Object doExtractData(WebServiceMessage message) throws IOException, TransformerException { Source payloadSource = message.getPayloadSource(); if (payloadSource != null && this.result != null) { diff --git a/spring-integration-xml/src/main/java/org/springframework/integration/xml/selector/XmlValidatingMessageSelector.java b/spring-integration-xml/src/main/java/org/springframework/integration/xml/selector/XmlValidatingMessageSelector.java index b1ec2c4a1e..92fb1a1c2e 100644 --- a/spring-integration-xml/src/main/java/org/springframework/integration/xml/selector/XmlValidatingMessageSelector.java +++ b/spring-integration-xml/src/main/java/org/springframework/integration/xml/selector/XmlValidatingMessageSelector.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2014 the original author or authors. + * Copyright 2002-2015 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. @@ -53,7 +53,7 @@ public class XmlValidatingMessageSelector implements MessageSelector { private final String url; - private SchemaType(String url) { + SchemaType(String url) { this.url = url; } diff --git a/spring-integration-xml/src/main/java/org/springframework/integration/xml/splitter/XPathMessageSplitter.java b/spring-integration-xml/src/main/java/org/springframework/integration/xml/splitter/XPathMessageSplitter.java index 28870f392f..b1d6188778 100644 --- a/spring-integration-xml/src/main/java/org/springframework/integration/xml/splitter/XPathMessageSplitter.java +++ b/spring-integration-xml/src/main/java/org/springframework/integration/xml/splitter/XPathMessageSplitter.java @@ -65,6 +65,7 @@ import org.springframework.xml.xpath.XPathExpressionFactory; * @author Jonas Partner * @author Mark Fisher * @author Artem Bilan + * @author Gary Russell */ public class XPathMessageSplitter extends AbstractMessageSplitter { @@ -118,6 +119,7 @@ public class XPathMessageSplitter extends AbstractMessageSplitter { this.createDocuments = createDocuments; } + @Override public String getComponentType() { return "xml:xpath-splitter"; } @@ -275,7 +277,7 @@ public class XPathMessageSplitter extends AbstractMessageSplitter { private int index; - public NodeListIterator(NodeList nodeList) throws ParserConfigurationException { + private NodeListIterator(NodeList nodeList) throws ParserConfigurationException { this.nodeList = nodeList; if (XPathMessageSplitter.this.createDocuments) { this.documentBuilder = getNewDocumentBuilder(); @@ -292,8 +294,9 @@ public class XPathMessageSplitter extends AbstractMessageSplitter { @Override public Node next() { - if (!hasNext()) + if (!hasNext()) { return null; + } Node node = nodeList.item(index++); if (this.documentBuilder != null) { diff --git a/spring-integration-zookeeper/src/main/java/org/springframework/integration/zookeeper/lock/ZookeeperLockRegistry.java b/spring-integration-zookeeper/src/main/java/org/springframework/integration/zookeeper/lock/ZookeeperLockRegistry.java index 7b96d98f18..7cdca1ef56 100644 --- a/spring-integration-zookeeper/src/main/java/org/springframework/integration/zookeeper/lock/ZookeeperLockRegistry.java +++ b/spring-integration-zookeeper/src/main/java/org/springframework/integration/zookeeper/lock/ZookeeperLockRegistry.java @@ -154,7 +154,7 @@ public class ZookeeperLockRegistry implements ExpirableLockRegistry { private final String root; - public DefaultKeyToPathStrategy(String rootPath) { + private DefaultKeyToPathStrategy(String rootPath) { Assert.notNull(rootPath, "'rootPath' cannot be null"); if (!rootPath.endsWith("/")) { this.root = rootPath + "/"; @@ -184,7 +184,7 @@ public class ZookeeperLockRegistry implements ExpirableLockRegistry { private long lastUsed; - public ZkLock(CuratorFramework client, String path) { + private ZkLock(CuratorFramework client, String path) { this.mutex = new InterProcessMutex(client, path); this.path = path; } diff --git a/spring-integration-zookeeper/src/main/java/org/springframework/integration/zookeeper/metadata/ZookeeperMetadataStore.java b/spring-integration-zookeeper/src/main/java/org/springframework/integration/zookeeper/metadata/ZookeeperMetadataStore.java index 02a75797ed..1e3fc3ee4f 100644 --- a/spring-integration-zookeeper/src/main/java/org/springframework/integration/zookeeper/metadata/ZookeeperMetadataStore.java +++ b/spring-integration-zookeeper/src/main/java/org/springframework/integration/zookeeper/metadata/ZookeeperMetadataStore.java @@ -42,6 +42,7 @@ import org.springframework.util.Assert; * the names of which are stored as keys. * * @author Marius Bogoevici + * @author Gary Russell * @since 4.2 */ public class ZookeeperMetadataStore implements ListenableMetadataStore, SmartLifecycle { @@ -325,16 +326,16 @@ public class ZookeeperMetadataStore implements ListenableMetadataStore, SmartLif private final int version; - public LocalChildData(String value, int version) { + private LocalChildData(String value, int version) { this.value = value; this.version = version; } - public String getValue() { + private String getValue() { return this.value; } - public int getVersion() { + private int getVersion() { return this.version; } }