INT-1600 polished namespace elements t be more consistent

This commit is contained in:
Oleg Zhurakousky
2010-11-11 09:53:44 -05:00
parent 35c767a93b
commit 834f6ca265
9 changed files with 101 additions and 149 deletions

View File

@@ -31,13 +31,13 @@ public class TwitterNamespaceHandler extends AbstractIntegrationNamespaceHandler
public void init() {
// inbound
registerBeanDefinitionParser("inbound-update-channel-adapter", new TwitterReceivingMessageSourceParser());
registerBeanDefinitionParser("inbound-dm-channel-adapter", new TwitterReceivingMessageSourceParser());
registerBeanDefinitionParser("inbound-mention-channel-adapter", new TwitterReceivingMessageSourceParser());
registerBeanDefinitionParser("inbound-channel-adapter", new TwitterReceivingMessageSourceParser());
registerBeanDefinitionParser("dm-inbound-channel-adapter", new TwitterReceivingMessageSourceParser());
registerBeanDefinitionParser("mentions-inbound-channel-adapter", new TwitterReceivingMessageSourceParser());
// outbound
registerBeanDefinitionParser("outbound-update-channel-adapter", new TwitterSendingMessageHandlerParser());
registerBeanDefinitionParser("outbound-dm-channel-adapter", new TwitterSendingMessageHandlerParser());
registerBeanDefinitionParser("outbound-channel-adapter", new TwitterSendingMessageHandlerParser());
registerBeanDefinitionParser("dm-outbound-channel-adapter", new TwitterSendingMessageHandlerParser());
}
}

View File

@@ -40,13 +40,13 @@ public class TwitterReceivingMessageSourceParser extends AbstractPollingInboundC
protected BeanMetadataElement parseSource(Element element, ParserContext parserContext) {
String elementName = element.getLocalName().trim();
String className = null;
if ("inbound-update-channel-adapter".equals(elementName)) {
if ("inbound-channel-adapter".equals(elementName)) {
className = BASE_PACKAGE + ".inbound.TimelineUpdateReceivingMessageSource";
}
else if ("inbound-dm-channel-adapter".equals(elementName)) {
else if ("dm-inbound-channel-adapter".equals(elementName)) {
className = BASE_PACKAGE + ".inbound.DirectMessageReceivingMessageSource";
}
else if ("inbound-mention-channel-adapter".equals(elementName)) {
else if ("mentions-inbound-channel-adapter".equals(elementName)) {
className = BASE_PACKAGE + ".inbound.MentionReceivingMessageSource";
}
else {

View File

@@ -37,10 +37,10 @@ public class TwitterSendingMessageHandlerParser extends AbstractOutboundChannelA
protected AbstractBeanDefinition parseConsumer(Element element, ParserContext parserContext) {
String elementName = element.getLocalName().trim();
String className = null;
if ("outbound-update-channel-adapter".equals(elementName)) {
if ("outbound-channel-adapter".equals(elementName)) {
className = BASE_PACKAGE + ".outbound.TimelineUpdateSendingMessageHandler";
}
else if ("outbound-dm-channel-adapter".equals(elementName)) {
else if ("dm-outbound-channel-adapter".equals(elementName)) {
className = BASE_PACKAGE + ".outbound.DirectMessageSendingMessageHandler";
}
BeanDefinitionBuilder builder = BeanDefinitionBuilder.rootBeanDefinition(className);

View File

@@ -14,9 +14,23 @@
schemaLocation="http://www.springframework.org/schema/integration/spring-integration-2.0.xsd"/>
<!--
This defines the beans we have for working with Twitter
INBOUND
-->
<xsd:element name="inbound-mention-channel-adapter">
<xsd:element name="inbound-channel-adapter">
<xsd:annotation>
<xsd:documentation>
Configures an inbound channel adapter that consumes message (representing your friends' timeline updates)
from twitter and sends Messages whose payloads are Tweet objects.
</xsd:documentation>
</xsd:annotation>
<xsd:complexType >
<xsd:complexContent>
<xsd:extension base="inbound-twitter-type"/>
</xsd:complexContent>
</xsd:complexType>
</xsd:element>
<xsd:element name="mentions-inbound-channel-adapter">
<xsd:annotation>
<xsd:documentation>
Configures an inbound channel adapter that consumes message (representing mentions of your handle)
@@ -24,105 +38,30 @@
</xsd:documentation>
</xsd:annotation>
<xsd:complexType>
<xsd:sequence>
<xsd:element ref="integration:poller" minOccurs="0" maxOccurs="1" />
</xsd:sequence>
<xsd:attribute name="id" type="xsd:string"/>
<xsd:attribute name="auto-startup" type="xsd:string" default="true"/>
<xsd:attribute name="channel" type="xsd:string">
<xsd:annotation>
<xsd:appinfo>
<tool:annotation kind="ref">
<tool:expected-type type="org.springframework.integration.core.MessageChannel"/>
</tool:annotation>
</xsd:appinfo>
</xsd:annotation>
</xsd:attribute>
<xsd:attribute use="required" name="twitter-template" type="xsd:string">
<xsd:annotation>
<xsd:appinfo>
<tool:annotation kind="ref">
<tool:expected-type type="org.springframework.integration.twitter.oauth.OAuthConfiguration"/>
</tool:annotation>
</xsd:appinfo>
</xsd:annotation>
</xsd:attribute>
<xsd:complexContent>
<xsd:extension base="inbound-twitter-type"/>
</xsd:complexContent>
</xsd:complexType>
</xsd:element>
<xsd:element name="inbound-dm-channel-adapter">
<xsd:element name="dm-inbound-channel-adapter">
<xsd:annotation>
<xsd:documentation>
Configures an inbound channel adapter that consumes direct messages and forwards them to Spring Integration
</xsd:documentation>
</xsd:annotation>
<xsd:complexType>
<xsd:sequence>
<xsd:element ref="integration:poller" minOccurs="0" maxOccurs="1" />
</xsd:sequence>
<xsd:attribute name="twitter-template" use="required" type="xsd:string">
<xsd:annotation>
<xsd:appinfo>
<tool:annotation kind="ref">
<tool:expected-type type="org.springframework.integration.twitter.oauth.OAuthConfiguration"/>
</tool:annotation>
</xsd:appinfo>
</xsd:annotation>
</xsd:attribute>
<xsd:attribute name="id" type="xsd:string"/>
<xsd:attribute name="auto-startup" type="xsd:string" default="true"/>
<xsd:attribute name="channel" type="xsd:string">
<xsd:annotation>
<xsd:appinfo>
<tool:annotation kind="ref">
<tool:expected-type type="org.springframework.integration.core.MessageChannel"/>
</tool:annotation>
</xsd:appinfo>
</xsd:annotation>
</xsd:attribute>
<xsd:complexContent>
<xsd:extension base="inbound-twitter-type"/>
</xsd:complexContent>
</xsd:complexType>
</xsd:element>
<xsd:element name="inbound-update-channel-adapter">
<xsd:annotation>
<xsd:documentation>
Configures an inbound channel adapter that consumes message (representing your friends' timeline updates)
from twitter and sends Messages whose payloads are Tweet objects.
</xsd:documentation>
</xsd:annotation>
<xsd:complexType>
<xsd:sequence>
<xsd:element ref="integration:poller" minOccurs="0" maxOccurs="1" />
</xsd:sequence>
<xsd:attribute name="id" type="xsd:string"/>
<xsd:attribute name="twitter-template" use="required" type="xsd:string">
<xsd:annotation>
<xsd:appinfo>
<tool:annotation kind="ref">
<tool:expected-type type="org.springframework.integration.twitter.oauth.OAuthConfiguration"/>
</tool:annotation>
</xsd:appinfo>
</xsd:annotation>
</xsd:attribute>
<xsd:attribute name="auto-startup" type="xsd:string" default="true"/>
<xsd:attribute name="channel" type="xsd:string">
<xsd:annotation>
<xsd:appinfo>
<tool:annotation kind="ref">
<tool:expected-type type="org.springframework.integration.core.MessageChannel"/>
</tool:annotation>
</xsd:appinfo>
</xsd:annotation>
</xsd:attribute>
</xsd:complexType>
</xsd:element>
<!--
OUTBOUND
-->
<xsd:element name="outbound-dm-channel-adapter">
<xsd:element name="dm-outbound-channel-adapter">
<xsd:annotation>
<xsd:documentation>
Configures an inbound channel adapter that consumes message (representing your friends' timeline updates)
@@ -130,12 +69,60 @@
</xsd:documentation>
</xsd:annotation>
<xsd:complexType>
<xsd:attribute name="id" type="xsd:string"/>
<xsd:complexContent>
<xsd:extension base="outbound-twitter-type"/>
</xsd:complexContent>
</xsd:complexType>
</xsd:element>
<xsd:element name="outbound-channel-adapter">
<xsd:annotation>
<xsd:documentation>
Configures an inbound channel adapter that consumes message (representing your friends' timeline updates)
from twitter and sends Messages whose payloads are Tweet objects.
</xsd:documentation>
</xsd:annotation>
<xsd:complexType>
<xsd:complexContent>
<xsd:extension base="outbound-twitter-type"/>
</xsd:complexContent>
</xsd:complexType>
</xsd:element>
<xsd:complexType name="inbound-twitter-type">
<xsd:sequence>
<xsd:element ref="integration:poller" minOccurs="0" maxOccurs="1" />
</xsd:sequence>
<xsd:attribute name="id" type="xsd:string"/>
<xsd:attribute name="twitter-template" use="required" type="xsd:string">
<xsd:annotation>
<xsd:appinfo>
<tool:annotation kind="ref">
<tool:expected-type type="org.springframework.integration.twitter.core.TwitterOperations"/>
</tool:annotation>
</xsd:appinfo>
</xsd:annotation>
</xsd:attribute>
<xsd:attribute name="auto-startup" type="xsd:string" default="true"/>
<xsd:attribute name="channel" type="xsd:string">
<xsd:annotation>
<xsd:appinfo>
<tool:annotation kind="ref">
<tool:expected-type type="org.springframework.integration.core.MessageChannel"/>
</tool:annotation>
</xsd:appinfo>
</xsd:annotation>
</xsd:attribute>
</xsd:complexType>
<xsd:complexType name="outbound-twitter-type">
<xsd:attribute name="id" type="xsd:string"/>
<xsd:attribute name="twitter-template" use="required" type="xsd:string">
<xsd:annotation>
<xsd:appinfo>
<tool:annotation kind="ref">
<tool:expected-type type="org.springframework.integration.twitter.oauth.OAuthConfiguration"/>
<tool:expected-type type="org.springframework.integration.twitter.core.TwitterOperations"/>
</tool:annotation>
</xsd:appinfo>
</xsd:annotation>
@@ -149,39 +136,5 @@
</xsd:appinfo>
</xsd:annotation>
</xsd:attribute>
</xsd:complexType>
</xsd:element>
<xsd:element name="outbound-update-channel-adapter">
<xsd:annotation>
<xsd:documentation>
Configures an inbound channel adapter that consumes message (representing your friends' timeline updates)
from twitter and sends Messages whose payloads are Tweet objects.
</xsd:documentation>
</xsd:annotation>
<xsd:complexType>
<xsd:attribute name="id" type="xsd:string"/>
<xsd:attribute name="twitter-template" use="required" type="xsd:string">
<xsd:annotation>
<xsd:appinfo>
<tool:annotation kind="ref">
<tool:expected-type type="org.springframework.integration.twitter.oauth.OAuthConfiguration"/>
</tool:annotation>
</xsd:appinfo>
</xsd:annotation>
</xsd:attribute>
<xsd:attribute name="channel" type="xsd:string">
<xsd:annotation>
<xsd:appinfo>
<tool:annotation kind="ref">
<tool:expected-type type="org.springframework.integration.core.MessageChannel"/>
</tool:annotation>
</xsd:appinfo>
</xsd:annotation>
</xsd:attribute>
</xsd:complexType>
</xsd:element>
</xsd:complexType>
</xsd:schema>