Removed EndpointInterceptor.
This commit is contained in:
@@ -18,7 +18,6 @@ package org.springframework.integration.endpoint;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.CopyOnWriteArrayList;
|
||||
|
||||
import org.springframework.integration.channel.ChannelRegistry;
|
||||
import org.springframework.integration.channel.ChannelRegistryAware;
|
||||
@@ -45,8 +44,6 @@ public abstract class AbstractMessageHandlingEndpoint extends AbstractMessageCon
|
||||
|
||||
private volatile boolean requiresReply = false;
|
||||
|
||||
private final List<EndpointInterceptor> interceptors = new CopyOnWriteArrayList<EndpointInterceptor>();
|
||||
|
||||
|
||||
public void setOutputChannel(MessageChannel outputChannel) {
|
||||
this.outputChannel = outputChannel;
|
||||
@@ -68,25 +65,9 @@ public abstract class AbstractMessageHandlingEndpoint extends AbstractMessageCon
|
||||
this.requiresReply = requiresReply;
|
||||
}
|
||||
|
||||
public void addInterceptor(EndpointInterceptor interceptor) {
|
||||
this.interceptors.add(interceptor);
|
||||
}
|
||||
|
||||
public void setInterceptors(List<EndpointInterceptor> interceptors) {
|
||||
this.interceptors.clear();
|
||||
for (EndpointInterceptor interceptor : interceptors) {
|
||||
this.addInterceptor(interceptor);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onMessageInternal(Message<?> message) {
|
||||
for (EndpointInterceptor interceptor : this.interceptors) {
|
||||
message = interceptor.preHandle(message);
|
||||
if (message == null) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (!this.supports(message)) {
|
||||
throw new MessageRejectedException(message, "unsupported message");
|
||||
}
|
||||
@@ -136,15 +117,6 @@ public abstract class AbstractMessageHandlingEndpoint extends AbstractMessageCon
|
||||
}
|
||||
|
||||
private boolean sendReplyMessage(Message<?> replyMessage, MessageChannel replyChannel) {
|
||||
for (int i = this.interceptors.size() - 1; i >= 0; i--) {
|
||||
EndpointInterceptor interceptor = this.interceptors.get(i);
|
||||
if (interceptor != null) {
|
||||
replyMessage = interceptor.postHandle(replyMessage);
|
||||
if (replyMessage == null) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
return this.getChannelTemplate().send(replyMessage, replyChannel);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,30 +0,0 @@
|
||||
/*
|
||||
* Copyright 2002-2008 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.endpoint;
|
||||
|
||||
import org.springframework.integration.message.Message;
|
||||
|
||||
/**
|
||||
* @author Mark Fisher
|
||||
*/
|
||||
public interface EndpointInterceptor {
|
||||
|
||||
Message<?> preHandle(Message<?> requestMessage);
|
||||
|
||||
Message<?> postHandle(Message<?> replyMessage);
|
||||
|
||||
}
|
||||
@@ -1,37 +0,0 @@
|
||||
/*
|
||||
* Copyright 2002-2008 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.endpoint.interceptor;
|
||||
|
||||
import org.springframework.integration.endpoint.EndpointInterceptor;
|
||||
import org.springframework.integration.message.Message;
|
||||
|
||||
/**
|
||||
* A convenience base class for implementing {@link EndpointInterceptor EndpointInterceptors}.
|
||||
*
|
||||
* @author Mark Fisher
|
||||
*/
|
||||
public class EndpointInterceptorAdapter implements EndpointInterceptor {
|
||||
|
||||
public Message<?> preHandle(Message<?> requestMessage) {
|
||||
return requestMessage;
|
||||
}
|
||||
|
||||
public Message<?> postHandle(Message<?> replyMessage) {
|
||||
return replyMessage;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user