Migrated RMI adapter and parser code from "org.springframework.integration.adapter" to the new "org.springframework.integration.rmi" module, and added a dedicated spring-integration-rmi-1.0.xsd schema and RmiNamespaceHandler.

This commit is contained in:
Mark Fisher
2008-09-20 16:36:50 +00:00
parent 65e0ecc12f
commit 6ed4c1d7bf
16 changed files with 138 additions and 45 deletions

View File

@@ -6,5 +6,3 @@ httpinvoker-handler=org.springframework.integration.adapter.httpinvoker.config.H
mail-target=org.springframework.integration.adapter.mail.config.MailTargetParser
polling-mail-source=org.springframework.integration.adapter.mail.config.PollingMailSourceParser
imap-idle-mail-source=org.springframework.integration.adapter.mail.config.SubscribableImapIdleMailSourceParser
rmi-gateway=org.springframework.integration.adapter.rmi.config.RmiGatewayParser
rmi-handler=org.springframework.integration.adapter.rmi.config.RmiHandlerParser

View File

@@ -1,27 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<beans:beans xmlns="http://www.springframework.org/schema/integration"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:beans="http://www.springframework.org/schema/beans"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://www.springframework.org/schema/integration
http://www.springframework.org/schema/integration/spring-integration-1.0.xsd">
<message-bus/>
<channel id="testChannel"/>
<rmi-gateway id="gatewayWithDefaults" request-channel="testChannel"/>
<rmi-gateway id="gatewayWithCustomProperties" request-channel="testChannel"
expect-reply="false" request-timeout="123" reply-timeout="456"/>
<rmi-gateway id="gatewayWithHost" request-channel="testChannel" registry-host="localhost"/>
<rmi-gateway id="gatewayWithPort" request-channel="testChannel" registry-port="1234"/>
<rmi-gateway id="gatewayWithExecutorRef" request-channel="testChannel" remote-invocation-executor="invocationExecutor"/>
<beans:bean id="invocationExecutor" class="org.springframework.integration.adapter.rmi.config.StubRemoteInvocationExecutor"/>
</beans:beans>

View File

@@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.integration.adapter.rmi;
package org.springframework.integration.rmi;
import java.rmi.RemoteException;
import java.rmi.registry.Registry;

View File

@@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.integration.adapter.rmi;
package org.springframework.integration.rmi;
import org.springframework.integration.adapter.AbstractRemotingHandler;
import org.springframework.integration.handler.MessageHandler;

View File

@@ -14,13 +14,13 @@
* limitations under the License.
*/
package org.springframework.integration.adapter.rmi.config;
package org.springframework.integration.rmi.config;
import org.w3c.dom.Element;
import org.springframework.beans.factory.support.BeanDefinitionBuilder;
import org.springframework.integration.adapter.config.AbstractRemotingGatewayParser;
import org.springframework.integration.adapter.rmi.RmiGateway;
import org.springframework.integration.rmi.RmiGateway;
import org.springframework.util.StringUtils;
/**

View File

@@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.integration.adapter.rmi.config;
package org.springframework.integration.rmi.config;
import java.rmi.registry.Registry;
@@ -23,8 +23,8 @@ import org.w3c.dom.Element;
import org.springframework.beans.factory.support.BeanDefinitionBuilder;
import org.springframework.beans.factory.xml.AbstractSingleBeanDefinitionParser;
import org.springframework.integration.ConfigurationException;
import org.springframework.integration.adapter.rmi.RmiGateway;
import org.springframework.integration.adapter.rmi.RmiHandler;
import org.springframework.integration.rmi.RmiGateway;
import org.springframework.integration.rmi.RmiHandler;
import org.springframework.util.StringUtils;
/**

View File

@@ -0,0 +1,33 @@
/*
* 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.rmi.config;
import org.springframework.beans.factory.xml.NamespaceHandlerSupport;
/**
* Namespace handler for Spring Integration's <em>rmi</em> namespace.
*
* @author Mark Fisher
*/
public class RmiNamespaceHandler extends NamespaceHandlerSupport {
public void init() {
this.registerBeanDefinitionParser("rmi-gateway", new RmiGatewayParser());
this.registerBeanDefinitionParser("rmi-handler", new RmiHandlerParser());
}
}

View File

@@ -0,0 +1,53 @@
<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema xmlns="http://www.springframework.org/schema/integration/rmi"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:beans="http://www.springframework.org/schema/beans"
xmlns:tool="http://www.springframework.org/schema/tool"
targetNamespace="http://www.springframework.org/schema/integration/rmi"
elementFormDefault="qualified"
attributeFormDefault="unqualified">
<xsd:import namespace="http://www.springframework.org/schema/beans"/>
<xsd:import namespace="http://www.springframework.org/schema/tool"/>
<xsd:annotation>
<xsd:documentation><![CDATA[
Defines the configuration elements for Spring Integration's RMI adapters.
]]></xsd:documentation>
</xsd:annotation>
<xsd:element name="rmi-gateway">
<xsd:complexType>
<xsd:annotation>
<xsd:documentation>
Defines an RMI-based gateway adapter.
</xsd:documentation>
</xsd:annotation>
<xsd:attribute name="id" type="xsd:ID"/>
<xsd:attribute name="name" type="xsd:string"/>
<xsd:attribute name="expect-reply" type="xsd:boolean" default="true"/>
<xsd:attribute name="request-channel" type="xsd:string" use="required"/>
<xsd:attribute name="reply-channel" type="xsd:string"/>
<xsd:attribute name="request-timeout" type="xsd:long"/>
<xsd:attribute name="reply-timeout" type="xsd:long"/>
<xsd:attribute name="registry-host" type="xsd:string"/>
<xsd:attribute name="registry-port" type="xsd:integer"/>
<xsd:attribute name="remote-invocation-executor" type="xsd:string"/>
</xsd:complexType>
</xsd:element>
<xsd:element name="rmi-handler">
<xsd:complexType>
<xsd:annotation>
<xsd:documentation>
Defines an RMI-based MessageHandler adapter.
</xsd:documentation>
</xsd:annotation>
<xsd:attribute name="id" type="xsd:string"/>
<xsd:attribute name="host" type="xsd:string" use="required"/>
<xsd:attribute name="port" type="xsd:integer"/>
<xsd:attribute name="remote-channel" type="xsd:string" use="required"/>
</xsd:complexType>
</xsd:element>
</xsd:schema>

View File

@@ -0,0 +1 @@
http\://www.springframework.org/schema/integration/rmi=org.springframework.integration.rmi.config.RmiNamespaceHandler

View File

@@ -0,0 +1 @@
http\://www.springframework.org/schema/integration/rmi/spring-integration-rmi-1.0.xsd=org/springframework/integration/rmi/config/spring-integration-rmi-1.0.xsd

View File

@@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.integration.adapter.rmi;
package org.springframework.integration.rmi;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
@@ -31,6 +31,7 @@ import org.springframework.integration.message.Message;
import org.springframework.integration.message.MessageBuilder;
import org.springframework.integration.message.MessageHandlingException;
import org.springframework.integration.message.StringMessage;
import org.springframework.integration.rmi.RmiHandler;
import org.springframework.remoting.RemoteLookupFailureException;
import org.springframework.remoting.rmi.RmiServiceExporter;

View File

@@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.integration.adapter.rmi.config;
package org.springframework.integration.rmi.config;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
@@ -24,9 +24,9 @@ import org.junit.Test;
import org.springframework.beans.DirectFieldAccessor;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.integration.adapter.rmi.RmiGateway;
import org.springframework.integration.channel.MessageChannel;
import org.springframework.integration.message.MessageChannelTemplate;
import org.springframework.integration.rmi.RmiGateway;
/**
* @author Mark Fisher

View File

@@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.integration.adapter.rmi.config;
package org.springframework.integration.rmi.config;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
@@ -24,12 +24,12 @@ import org.junit.Test;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.integration.adapter.rmi.RmiGateway;
import org.springframework.integration.adapter.rmi.RmiHandler;
import org.springframework.integration.channel.MessageChannel;
import org.springframework.integration.channel.QueueChannel;
import org.springframework.integration.message.Message;
import org.springframework.integration.message.StringMessage;
import org.springframework.integration.rmi.RmiGateway;
import org.springframework.integration.rmi.RmiHandler;
/**
* @author Mark Fisher

View File

@@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.integration.adapter.rmi.config;
package org.springframework.integration.rmi.config;
import org.springframework.remoting.support.DefaultRemoteInvocationExecutor;

View File

@@ -0,0 +1,30 @@
<?xml version="1.0" encoding="UTF-8"?>
<beans:beans xmlns="http://www.springframework.org/schema/integration"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:beans="http://www.springframework.org/schema/beans"
xmlns:rmi="http://www.springframework.org/schema/integration/rmi"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://www.springframework.org/schema/integration
http://www.springframework.org/schema/integration/spring-integration-1.0.xsd
http://www.springframework.org/schema/integration/rmi
http://www.springframework.org/schema/integration/rmi/spring-integration-rmi-1.0.xsd">
<message-bus/>
<channel id="testChannel"/>
<rmi:rmi-gateway id="gatewayWithDefaults" request-channel="testChannel"/>
<rmi:rmi-gateway id="gatewayWithCustomProperties" request-channel="testChannel"
expect-reply="false" request-timeout="123" reply-timeout="456"/>
<rmi:rmi-gateway id="gatewayWithHost" request-channel="testChannel" registry-host="localhost"/>
<rmi:rmi-gateway id="gatewayWithPort" request-channel="testChannel" registry-port="1234"/>
<rmi:rmi-gateway id="gatewayWithExecutorRef" request-channel="testChannel" remote-invocation-executor="invocationExecutor"/>
<beans:bean id="invocationExecutor" class="org.springframework.integration.rmi.config.StubRemoteInvocationExecutor"/>
</beans:beans>

View File

@@ -2,10 +2,13 @@
<beans:beans xmlns="http://www.springframework.org/schema/integration"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:beans="http://www.springframework.org/schema/beans"
xmlns:rmi="http://www.springframework.org/schema/integration/rmi"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://www.springframework.org/schema/integration
http://www.springframework.org/schema/integration/spring-integration-1.0.xsd">
http://www.springframework.org/schema/integration/spring-integration-1.0.xsd
http://www.springframework.org/schema/integration/rmi
http://www.springframework.org/schema/integration/rmi/spring-integration-rmi-1.0.xsd">
<message-bus/>
@@ -13,6 +16,6 @@
<service-activator input-channel="localChannel" ref="handler"/>
<rmi-handler id="handler" remote-channel="testChannel" host="localhost"/>
<rmi:rmi-handler id="handler" remote-channel="testChannel" host="localhost"/>
</beans:beans>