diff --git a/org.springframework.integration.adapter/src/main/java/org/springframework/integration/adapter/RemoteMessageHandler.java b/org.springframework.integration.adapter/src/main/java/org/springframework/integration/adapter/RemoteMessageHandler.java deleted file mode 100644 index 8f8681e8ac..0000000000 --- a/org.springframework.integration.adapter/src/main/java/org/springframework/integration/adapter/RemoteMessageHandler.java +++ /dev/null @@ -1,31 +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.adapter; - -import org.springframework.integration.core.Message; - -/** - * Interface used for proxy-based remoting adapters (e.g. RMI and HttpInvoker). - * Enables serializable Messages to be exchanged across a remote invocation. - * - * @author Mark Fisher - */ -public interface RemoteMessageHandler { - - Message handle(Message message); - -} diff --git a/org.springframework.integration.httpinvoker/src/main/java/org/springframework/integration/httpinvoker/HttpInvokerInboundGateway.java b/org.springframework.integration.httpinvoker/src/main/java/org/springframework/integration/httpinvoker/HttpInvokerInboundGateway.java index 613cea2227..3b7413c9dd 100644 --- a/org.springframework.integration.httpinvoker/src/main/java/org/springframework/integration/httpinvoker/HttpInvokerInboundGateway.java +++ b/org.springframework.integration.httpinvoker/src/main/java/org/springframework/integration/httpinvoker/HttpInvokerInboundGateway.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2010 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,9 +22,9 @@ import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import org.springframework.integration.adapter.RemoteMessageHandler; -import org.springframework.integration.adapter.RemotingInboundGatewaySupport; import org.springframework.integration.core.MessagingException; +import org.springframework.integration.gateway.RemotingInboundGatewaySupport; +import org.springframework.integration.gateway.RequestReplyExchanger; import org.springframework.remoting.httpinvoker.HttpInvokerServiceExporter; import org.springframework.web.HttpRequestHandler; @@ -74,7 +74,7 @@ public class HttpInvokerInboundGateway extends RemotingInboundGatewaySupport imp if (this.exporter == null) { HttpInvokerServiceExporter exporter = new HttpInvokerServiceExporter(); exporter.setService(this); - exporter.setServiceInterface(RemoteMessageHandler.class); + exporter.setServiceInterface(RequestReplyExchanger.class); exporter.afterPropertiesSet(); this.exporter = exporter; } diff --git a/org.springframework.integration.httpinvoker/src/main/java/org/springframework/integration/httpinvoker/HttpInvokerOutboundGateway.java b/org.springframework.integration.httpinvoker/src/main/java/org/springframework/integration/httpinvoker/HttpInvokerOutboundGateway.java index 41325a9973..7e6b007fad 100644 --- a/org.springframework.integration.httpinvoker/src/main/java/org/springframework/integration/httpinvoker/HttpInvokerOutboundGateway.java +++ b/org.springframework.integration.httpinvoker/src/main/java/org/springframework/integration/httpinvoker/HttpInvokerOutboundGateway.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2010 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.httpinvoker; -import org.springframework.integration.adapter.AbstractRemotingOutboundGateway; -import org.springframework.integration.adapter.RemoteMessageHandler; +import org.springframework.integration.gateway.AbstractRemotingOutboundGateway; +import org.springframework.integration.gateway.RequestReplyExchanger; import org.springframework.remoting.httpinvoker.HttpInvokerProxyFactoryBean; /** @@ -36,12 +36,12 @@ public class HttpInvokerOutboundGateway extends AbstractRemotingOutboundGateway @Override - protected RemoteMessageHandler createHandlerProxy(String url) { + protected RequestReplyExchanger createProxy(String url) { HttpInvokerProxyFactoryBean proxyFactory = new HttpInvokerProxyFactoryBean(); - proxyFactory.setServiceInterface(RemoteMessageHandler.class); + proxyFactory.setServiceInterface(RequestReplyExchanger.class); proxyFactory.setServiceUrl(url); proxyFactory.afterPropertiesSet(); - return (RemoteMessageHandler) proxyFactory.getObject(); + return (RequestReplyExchanger) proxyFactory.getObject(); } } diff --git a/org.springframework.integration.httpinvoker/src/test/java/org/springframework/integration/httpinvoker/HttpInvokerInboundGatewayTests.java b/org.springframework.integration.httpinvoker/src/test/java/org/springframework/integration/httpinvoker/HttpInvokerInboundGatewayTests.java index 339eaeec65..121e488e51 100644 --- a/org.springframework.integration.httpinvoker/src/test/java/org/springframework/integration/httpinvoker/HttpInvokerInboundGatewayTests.java +++ b/org.springframework.integration.httpinvoker/src/test/java/org/springframework/integration/httpinvoker/HttpInvokerInboundGatewayTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2010 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. @@ -85,7 +85,7 @@ public class HttpInvokerInboundGatewayTests { private static byte[] createRequestContent(Message message) throws IOException { RemoteInvocation invocation = new RemoteInvocation( - "handle", new Class[] { Message.class }, new Object[] { message }); + "exchange", new Class[] { Message.class }, new Object[] { message }); ByteArrayOutputStream baos = new ByteArrayOutputStream(1024); ObjectOutputStream oos = new ObjectOutputStream(baos); try { diff --git a/org.springframework.integration.rmi/src/main/java/org/springframework/integration/rmi/RmiInboundGateway.java b/org.springframework.integration.rmi/src/main/java/org/springframework/integration/rmi/RmiInboundGateway.java index d843b8453d..35dc80a2af 100644 --- a/org.springframework.integration.rmi/src/main/java/org/springframework/integration/rmi/RmiInboundGateway.java +++ b/org.springframework.integration.rmi/src/main/java/org/springframework/integration/rmi/RmiInboundGateway.java @@ -19,10 +19,10 @@ package org.springframework.integration.rmi; import java.rmi.registry.Registry; import org.springframework.beans.factory.InitializingBean; -import org.springframework.integration.adapter.RemoteMessageHandler; -import org.springframework.integration.adapter.RemotingInboundGatewaySupport; import org.springframework.integration.context.NamedComponent; import org.springframework.integration.core.MessageChannel; +import org.springframework.integration.gateway.RemotingInboundGatewaySupport; +import org.springframework.integration.gateway.RequestReplyExchanger; import org.springframework.remoting.rmi.RmiServiceExporter; import org.springframework.remoting.support.RemoteInvocationExecutor; import org.springframework.util.Assert; @@ -91,7 +91,7 @@ public class RmiInboundGateway extends RemotingInboundGatewaySupport implements exporter.setRemoteInvocationExecutor(this.remoteInvocationExecutor); } exporter.setService(this); - exporter.setServiceInterface(RemoteMessageHandler.class); + exporter.setServiceInterface(RequestReplyExchanger.class); exporter.setServiceName(SERVICE_NAME_PREFIX + this.requestChannelName); exporter.afterPropertiesSet(); this.exporter = exporter; diff --git a/org.springframework.integration.rmi/src/main/java/org/springframework/integration/rmi/RmiOutboundGateway.java b/org.springframework.integration.rmi/src/main/java/org/springframework/integration/rmi/RmiOutboundGateway.java index d8a4e08d26..cba0a96bf7 100644 --- a/org.springframework.integration.rmi/src/main/java/org/springframework/integration/rmi/RmiOutboundGateway.java +++ b/org.springframework.integration.rmi/src/main/java/org/springframework/integration/rmi/RmiOutboundGateway.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2010 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.rmi; -import org.springframework.integration.adapter.AbstractRemotingOutboundGateway; -import org.springframework.integration.adapter.RemoteMessageHandler; +import org.springframework.integration.gateway.AbstractRemotingOutboundGateway; +import org.springframework.integration.gateway.RequestReplyExchanger; import org.springframework.remoting.rmi.RmiProxyFactoryBean; /** @@ -33,14 +33,14 @@ public class RmiOutboundGateway extends AbstractRemotingOutboundGateway { @Override - public RemoteMessageHandler createHandlerProxy(String url) { + public RequestReplyExchanger createProxy(String url) { RmiProxyFactoryBean proxyFactory = new RmiProxyFactoryBean(); - proxyFactory.setServiceInterface(RemoteMessageHandler.class); + proxyFactory.setServiceInterface(RequestReplyExchanger.class); proxyFactory.setServiceUrl(url); proxyFactory.setLookupStubOnStartup(false); proxyFactory.setRefreshStubOnConnectFailure(true); proxyFactory.afterPropertiesSet(); - return (RemoteMessageHandler) proxyFactory.getObject(); + return (RequestReplyExchanger) proxyFactory.getObject(); } } diff --git a/org.springframework.integration.rmi/src/test/java/org/springframework/integration/rmi/RmiOutboundGatewayTests.java b/org.springframework.integration.rmi/src/test/java/org/springframework/integration/rmi/RmiOutboundGatewayTests.java index 0ac19c563a..a44c6de4e6 100644 --- a/org.springframework.integration.rmi/src/test/java/org/springframework/integration/rmi/RmiOutboundGatewayTests.java +++ b/org.springframework.integration.rmi/src/test/java/org/springframework/integration/rmi/RmiOutboundGatewayTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2010 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. @@ -25,9 +25,9 @@ import java.rmi.RemoteException; import org.junit.Before; import org.junit.Test; -import org.springframework.integration.adapter.RemoteMessageHandler; import org.springframework.integration.channel.QueueChannel; import org.springframework.integration.core.Message; +import org.springframework.integration.gateway.RequestReplyExchanger; import org.springframework.integration.message.GenericMessage; import org.springframework.integration.message.MessageBuilder; import org.springframework.integration.message.MessageHandlingException; @@ -54,8 +54,8 @@ public class RmiOutboundGatewayTests { @Before public void createExporter() throws RemoteException { RmiServiceExporter exporter = new RmiServiceExporter(); - exporter.setService(new TestHandler()); - exporter.setServiceInterface(RemoteMessageHandler.class); + exporter.setService(new TestExchanger()); + exporter.setServiceInterface(RequestReplyExchanger.class); exporter.setServiceName("testRemoteHandler"); exporter.afterPropertiesSet(); } @@ -139,9 +139,9 @@ public class RmiOutboundGatewayTests { } - private static class TestHandler implements RemoteMessageHandler { + private static class TestExchanger implements RequestReplyExchanger { - public Message handle(Message message) { + public Message exchange(Message message) { return new GenericMessage(message.getPayload().toString().toUpperCase(), message.getHeaders()); } } diff --git a/org.springframework.integration.adapter/src/main/java/org/springframework/integration/adapter/AbstractRemotingOutboundGateway.java b/org.springframework.integration/src/main/java/org/springframework/integration/gateway/AbstractRemotingOutboundGateway.java similarity index 78% rename from org.springframework.integration.adapter/src/main/java/org/springframework/integration/adapter/AbstractRemotingOutboundGateway.java rename to org.springframework.integration/src/main/java/org/springframework/integration/gateway/AbstractRemotingOutboundGateway.java index e3f188fcc5..5f21f31b91 100644 --- a/org.springframework.integration.adapter/src/main/java/org/springframework/integration/adapter/AbstractRemotingOutboundGateway.java +++ b/org.springframework.integration/src/main/java/org/springframework/integration/gateway/AbstractRemotingOutboundGateway.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2010 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. @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.integration.adapter; +package org.springframework.integration.gateway; import java.io.Serializable; @@ -26,17 +26,17 @@ import org.springframework.integration.message.MessageHandlingException; import org.springframework.remoting.RemoteAccessException; /** - * A base class for outbound Messaging Gateways that use url-based remoting. + * A base class for outbound URL-based Messaging Gateways. * * @author Mark Fisher */ public abstract class AbstractRemotingOutboundGateway extends AbstractReplyProducingMessageHandler { - private final RemoteMessageHandler handlerProxy; + private final RequestReplyExchanger proxy; public AbstractRemotingOutboundGateway(String url) { - this.handlerProxy = this.createHandlerProxy(url); + this.proxy = this.createProxy(url); } @@ -47,7 +47,7 @@ public abstract class AbstractRemotingOutboundGateway extends AbstractReplyProdu /** * Subclasses must implement this method. It will be invoked from the constructor. */ - protected abstract RemoteMessageHandler createHandlerProxy(String url); + protected abstract RequestReplyExchanger createProxy(String url); @Override @@ -59,10 +59,10 @@ public abstract class AbstractRemotingOutboundGateway extends AbstractReplyProdu } Message requestMessage = MessageBuilder.fromMessage(message).build(); try { - return this.handlerProxy.handle(requestMessage); + return this.proxy.exchange(requestMessage); } catch (RemoteAccessException e) { - throw new MessageHandlingException(message, "unable to handle message remotely", e); + throw new MessageHandlingException(message, "remote failure in Messaging Gateway", e); } } diff --git a/org.springframework.integration.adapter/src/main/java/org/springframework/integration/adapter/RemotingInboundGatewaySupport.java b/org.springframework.integration/src/main/java/org/springframework/integration/gateway/RemotingInboundGatewaySupport.java similarity index 80% rename from org.springframework.integration.adapter/src/main/java/org/springframework/integration/adapter/RemotingInboundGatewaySupport.java rename to org.springframework.integration/src/main/java/org/springframework/integration/gateway/RemotingInboundGatewaySupport.java index c58ebefe22..6b57aa8662 100644 --- a/org.springframework.integration.adapter/src/main/java/org/springframework/integration/adapter/RemotingInboundGatewaySupport.java +++ b/org.springframework.integration/src/main/java/org/springframework/integration/gateway/RemotingInboundGatewaySupport.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2010 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. @@ -14,17 +14,16 @@ * limitations under the License. */ -package org.springframework.integration.adapter; +package org.springframework.integration.gateway; import org.springframework.integration.core.Message; -import org.springframework.integration.gateway.SimpleMessagingGateway; /** * Support class for inbound Messaging Gateways. * * @author Mark Fisher */ -public abstract class RemotingInboundGatewaySupport extends SimpleMessagingGateway implements RemoteMessageHandler { +public abstract class RemotingInboundGatewaySupport extends SimpleMessagingGateway implements RequestReplyExchanger { private volatile boolean expectReply = true; @@ -37,7 +36,7 @@ public abstract class RemotingInboundGatewaySupport extends SimpleMessagingGatew this.expectReply = expectReply; } - public Message handle(Message message) { + public Message exchange(Message message) { if (this.expectReply) { return this.sendAndReceiveMessage(message); } diff --git a/org.springframework.integration/src/main/java/org/springframework/integration/gateway/RequestReplyExchanger.java b/org.springframework.integration/src/main/java/org/springframework/integration/gateway/RequestReplyExchanger.java index 12d805c574..0ae0809c58 100644 --- a/org.springframework.integration/src/main/java/org/springframework/integration/gateway/RequestReplyExchanger.java +++ b/org.springframework.integration/src/main/java/org/springframework/integration/gateway/RequestReplyExchanger.java @@ -26,8 +26,8 @@ import org.springframework.integration.core.Message; * @author Mark Fisher * @since 2.0 */ -interface RequestReplyExchanger { +public interface RequestReplyExchanger { - public Message exchange(Message request); + Message exchange(Message request); }