INT-842 moved gateway support base classes to core gateway package

This commit is contained in:
Mark Fisher
2010-04-30 23:03:54 +00:00
parent 2eda315aa6
commit e0cc920d56
10 changed files with 41 additions and 73 deletions

View File

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

View File

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

View File

@@ -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<String>(message.getPayload().toString().toUpperCase(), message.getHeaders());
}
}