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>

View File

@@ -21,25 +21,25 @@
<channel id="inbound_mentions"/>
<twitter:inbound-mention-channel-adapter id="mentionAdapter"
<twitter:mentions-inbound-channel-adapter id="mentionAdapter"
twitter-template="twitter"
channel="inbound_mentions"
auto-startup="false">
<poller fixed-rate="5000" max-messages-per-poll="3"/>
</twitter:inbound-mention-channel-adapter>
</twitter:mentions-inbound-channel-adapter>
<twitter:inbound-dm-channel-adapter id="dmAdapter"
<twitter:dm-inbound-channel-adapter id="dmAdapter"
twitter-template="twitter"
channel="inbound_mentions"
auto-startup="false">
<poller fixed-rate="5000" max-messages-per-poll="3"/>
</twitter:inbound-dm-channel-adapter>
<twitter:inbound-update-channel-adapter id="updateAdapter"
</twitter:dm-inbound-channel-adapter>
<twitter:inbound-channel-adapter id="updateAdapter"
twitter-template="twitter"
channel="inbound_mentions"
auto-startup="false">
<poller fixed-rate="5000" max-messages-per-poll="3"/>
</twitter:inbound-update-channel-adapter>
</twitter:inbound-channel-adapter>
</beans:beans>

View File

@@ -24,9 +24,9 @@
<channel id="inputChannel"/>
<twitter:outbound-dm-channel-adapter twitter-template="twitter" channel="inputChannel" />
<twitter:dm-outbound-channel-adapter twitter-template="twitter" channel="inputChannel" />
<twitter:outbound-update-channel-adapter twitter-template="twitter" channel="inputChannel" />
<twitter:outbound-channel-adapter twitter-template="twitter" channel="inputChannel" />
</beans:beans>

View File

@@ -33,20 +33,19 @@
<beans:constructor-arg value="${twitter.oauth.accessTokenSecret}"/>
</beans:bean>
<twitter:inbound-mention-channel-adapter twitter-template="twitterTemplate" channel="inbound_mentions">
<twitter:mentions-inbound-channel-adapter twitter-template="twitterTemplate" channel="inbound_mentions">
<poller fixed-rate="5000" max-messages-per-poll="3"/>
</twitter:inbound-mention-channel-adapter>
</twitter:mentions-inbound-channel-adapter>
<service-activator input-channel="inbound_mentions" ref="twitterAnnouncer" method="mention"/>
<twitter:inbound-dm-channel-adapter twitter-template="twitterTemplate" channel="inbound_dm">
<twitter:dm-inbound-channel-adapter twitter-template="twitterTemplate" channel="inbound_dm">
<poller fixed-rate="5000" max-messages-per-poll="3"/>
</twitter:inbound-dm-channel-adapter>
</twitter:dm-inbound-channel-adapter>
<service-activator input-channel="inbound_dm" ref="twitterAnnouncer" method="dm"/>
<twitter:inbound-update-channel-adapter id="twitterInbound" twitter-template="twitterTemplate" channel="inbound_updates">
<twitter:inbound-channel-adapter id="twitterInbound" twitter-template="twitterTemplate" channel="inbound_updates">
<poller fixed-rate="5000" max-messages-per-poll="3"/>
</twitter:inbound-update-channel-adapter>
</twitter:inbound-channel-adapter>
<service-activator input-channel="inbound_updates" ref="twitterAnnouncer" method="updates"/>
<beans:bean id="twitterAnnouncer" class="org.springframework.integration.twitter.ignored.TwitterAnnouncer"/>

View File

@@ -31,7 +31,7 @@
<channel id="inputChannel"/>
<twitter:outbound-dm-channel-adapter twitter-template="twitterTemplate" channel="inputChannel"/>
<twitter:dm-outbound-channel-adapter twitter-template="twitterTemplate" channel="inputChannel"/>
</beans:beans>

View File

@@ -31,7 +31,7 @@
<channel id="out"/>
<twitter:outbound-update-channel-adapter twitter-template="twitterTemplate" channel="out"/>
<twitter:outbound-channel-adapter twitter-template="twitterTemplate" channel="out"/>
</beans:beans>