Code Polishing (Sonar)

- remove redundant modifiers
- overridable methods called from ctors

Polishing - PR Comments
This commit is contained in:
Gary Russell
2015-12-03 15:23:12 -05:00
committed by Artem Bilan
parent ddb4321e1d
commit 255247ca9a
56 changed files with 447 additions and 381 deletions

View File

@@ -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);

View File

@@ -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;
}

View File

@@ -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

View File

@@ -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);
}

View File

@@ -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<Message<?>> targetComparator;
public SequenceFallbackComparator(Comparator<Message<?>> targetComparator){
private SequenceFallbackComparator(Comparator<Message<?>> 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<Object>{
private class MessageWrapper implements Message<Object> {
private final Message<?> rootMessage;
private final long sequence;
public MessageWrapper(Message<?> rootMessage){
private MessageWrapper(Message<?> rootMessage){
this.rootMessage = rootMessage;
this.sequence = sequenceCounter.incrementAndGet();
}

View File

@@ -46,6 +46,7 @@ import org.springframework.messaging.support.ExecutorChannelInterceptor;
* @param <S> the propagated state object type.
*
* @author Artem Bilan
* @author Gary Russell
* @since 4.2
*/
public abstract class ThreadStatePropagationChannelInterceptor<S>
@@ -96,7 +97,7 @@ public abstract class ThreadStatePropagationChannelInterceptor<S>
private final S state;
public MessageWithThreadState(Message<?> message, S state) {
private MessageWithThreadState(Message<?> message, S state) {
this.message = message;
this.state = state;
}

View File

@@ -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<String> channelNames;
public AutoCreateCandidatesCollector(Collection<String> channelNames){
AutoCreateCandidatesCollector(Collection<String> channelNames){
this.channelNames = channelNames;
}

View File

@@ -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;
}

View File

@@ -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);
}
/**

View File

@@ -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.
* <p>
* The class is package-protected and only intended for use by the AbstractDispatcher. It
* <em>must</em> 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<E> implements Set<E> {
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<E> elements;
private final Set<E> unmodifiableElements;
public OrderedAwareCopyOnWriteArraySet() {
elements = new CopyOnWriteArraySet<E>();
unmodifiableElements = Collections.unmodifiableSet(elements);
}
public Set<E> 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<? extends E> 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> 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<E> 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.
* <p>
* The class is package-protected and only intended for use by the AbstractDispatcher. It
* <em>must</em> 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<E> implements Set<E> {
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<E> elements;
private final Set<E> unmodifiableElements;
OrderedAwareCopyOnWriteArraySet() {
elements = new CopyOnWriteArraySet<E>();
unmodifiableElements = Collections.unmodifiableSet(elements);
}
public Set<E> 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<? extends E> 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> 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<E> 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();
}
}

View File

@@ -315,7 +315,7 @@ public abstract class AbstractPollingEndpoint extends AbstractEndpoint implement
private final Callable<Boolean> pollingTask;
public Poller(Callable<Boolean> pollingTask) {
private Poller(Callable<Boolean> pollingTask) {
this.pollingTask = pollingTask;
}

View File

@@ -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() {

View File

@@ -68,7 +68,7 @@ public class GatewayCompletableFutureProxyFactoryBean extends GatewayProxyFactor
private final MethodInvocation invocation;
public Invoker(MethodInvocation methodInvocation) {
private Invoker(MethodInvocation methodInvocation) {
this.invocation = methodInvocation;
}

View File

@@ -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<Object[]
private final MessageBuilderFactory messageBuilderFactory;
public GatewayMethodInboundMessageMapper(Method method) {
GatewayMethodInboundMessageMapper(Method method) {
this(method, null);
}
public GatewayMethodInboundMessageMapper(Method method, Map<String, Expression> headerExpressions) {
GatewayMethodInboundMessageMapper(Method method, Map<String, Expression> headerExpressions) {
this(method, headerExpressions, null, null, null);
}
public GatewayMethodInboundMessageMapper(Method method, Map<String, Expression> headerExpressions,
GatewayMethodInboundMessageMapper(Method method, Map<String, Expression> headerExpressions,
Map<String, Expression> globalHeaderExpressions, MethodArgsMessageMapper mapper,
MessageBuilderFactory messageBuilderFactory) {
Assert.notNull(method, "method must not be null");

View File

@@ -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);
}

View File

@@ -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
}

View File

@@ -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);
}

View File

@@ -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);
}
}
}

View File

@@ -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
}

View File

@@ -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;

View File

@@ -95,7 +95,7 @@ public class SmartLifecycleRoleController implements ApplicationListener<Abstrac
* @param role the role.
* @param lifecycle the {@link SmartLifecycle}.
*/
public void addLifecycleToRole(String role, SmartLifecycle lifecycle) {
public final void addLifecycleToRole(String role, SmartLifecycle lifecycle) {
this.lifecycles.add(role, lifecycle);
}

View File

@@ -73,13 +73,13 @@ public class SimpleMessageConverter implements MessageConverter, BeanFactoryAwar
}
public void setInboundMessageMapper(InboundMessageMapper<?> 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());

View File

@@ -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);
}

View File

@@ -44,7 +44,7 @@ public class HeadDirectoryScanner extends DefaultDirectoryScanner {
}
@Override
public void setFilter(FileListFilter<File> filter) {
public final void setFilter(FileListFilter<File> filter) {
if (filter instanceof CompositeFileListFilter) {
((CompositeFileListFilter<File>) 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;
}

View File

@@ -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;
}

View File

@@ -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;

View File

@@ -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);
}

View File

@@ -159,7 +159,7 @@ public class FailoverClientConnectionFactory extends AbstractClientConnectionFac
private final AtomicLong epoch = new AtomicLong();
public FailoverTcpConnection(List<AbstractClientConnectionFactory> factories) throws Exception {
private FailoverTcpConnection(List<AbstractClientConnectionFactory> factories) throws Exception {
this.factories = factories;
this.factoryIterator = factories.iterator();
findAConnection();

View File

@@ -281,7 +281,7 @@ public class TcpNioSSLConnection extends TcpNioConnection {
private final ChannelOutputStream channelOutputStream;
public SSLChannelOutputStream(ChannelOutputStream channelOutputStream) {
private SSLChannelOutputStream(ChannelOutputStream channelOutputStream) {
this.channelOutputStream = channelOutputStream;
}

View File

@@ -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<String, Object> staticParameters;
public StaticBeanPropertySqlParameterSource(Object input, Map<String, Object> staticParameters) {
private StaticBeanPropertySqlParameterSource(Object input, Map<String, Object> 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);
}

View File

@@ -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;
}

View File

@@ -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;
}
}

View File

@@ -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);
}

View File

@@ -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 + "]");

View File

@@ -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<String, Object> staticParameters;
public StaticBeanPropertyParameterSource(Object input, Map<String, Object> staticParameters) {
private StaticBeanPropertyParameterSource(Object input, Map<String, Object> 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);
}

View File

@@ -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;
}

View File

@@ -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;
}
}
}

View File

@@ -459,7 +459,7 @@ public class MongoDbMessageStore extends AbstractMessageGroupStore
*/
private class MessageReadingMongoConverter extends MappingMongoConverter {
public MessageReadingMongoConverter(MongoDbFactory mongoDbFactory,
private MessageReadingMongoConverter(MongoDbFactory mongoDbFactory,
MappingContext<? extends MongoPersistentEntity<?>, 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();

View File

@@ -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;
}

View File

@@ -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<Object> {
public class ScriptExecutingMessageSource extends AbstractMessageSource<Object> {
private final AbstractScriptExecutingMessageProcessor<?> scriptMessageProcessor;

View File

@@ -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;

View File

@@ -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);
}

View File

@@ -29,7 +29,7 @@ import org.springframework.integration.scripting.ScriptExecutor;
* @since 2.1
*
*/
class PythonScriptExecutor extends AbstractScriptExecutor {
public class PythonScriptExecutor extends AbstractScriptExecutor {
/**
* @param language
*/

View File

@@ -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");
}

View File

@@ -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<Object> {
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<String,Object> variables ) {
public ScriptExecutingMessageProcessor(ScriptSource scriptSource, ScriptExecutor scriptExecutor,
Map<String, Object> variables) {
super(new DefaultScriptVariableGenerator(variables));
this.scriptSource = scriptSource;
this.scriptExecutor = scriptExecutor;

View File

@@ -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);
}
}

View File

@@ -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;
}

View File

@@ -81,7 +81,7 @@ abstract class AbstractTwitterMessageSource<T> 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;

View File

@@ -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());

View File

@@ -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);
}

View File

@@ -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);
}
}

View File

@@ -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) {

View File

@@ -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;
}

View File

@@ -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) {

View File

@@ -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;
}

View File

@@ -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;
}
}