cleaned up the naming of the parsers and endpoints/message handlers
This commit is contained in:
@@ -23,6 +23,12 @@ import org.w3c.dom.Element;
|
||||
|
||||
import static org.springframework.integration.twitter.config.TwitterNamespaceHandler.BASE_PACKAGE;
|
||||
|
||||
/**
|
||||
* A parser for a {@link org.springframework.integration.twitter.inbound.InboundDirectMessageEndpoint} instance.
|
||||
*
|
||||
* @author Josh Long
|
||||
* @since 2.0
|
||||
*/
|
||||
public class InboundDirectMessageEndpointParser extends AbstractSingleBeanDefinitionParser {
|
||||
@Override
|
||||
protected String getBeanClassName(Element element) {
|
||||
|
||||
@@ -23,6 +23,14 @@ import org.w3c.dom.Element;
|
||||
|
||||
import static org.springframework.integration.twitter.config.TwitterNamespaceHandler.BASE_PACKAGE;
|
||||
|
||||
/**
|
||||
* a parser for the {@link org.springframework.integration.twitter.inbound.InboundMentionEndpoint} endpoint.
|
||||
* The parser exepcts an outbound channel and a reference to a connection, as typically factoried by a
|
||||
* {@link org.springframework.integration.twitter.config.ConnectionParser}
|
||||
*
|
||||
* @author Josh Long
|
||||
* @since 2.0
|
||||
*/
|
||||
public class InboundMentionEndpointParser extends AbstractSingleBeanDefinitionParser {
|
||||
@Override
|
||||
protected String getBeanClassName(Element element) {
|
||||
|
||||
@@ -23,6 +23,13 @@ import org.w3c.dom.Element;
|
||||
|
||||
import static org.springframework.integration.twitter.config.TwitterNamespaceHandler.BASE_PACKAGE;
|
||||
|
||||
/**
|
||||
* A parser for the {@link org.springframework.integration.twitter.inbound.InboundTimelineUpdateEndpoint} endpoint. The endpoint takes a channel and a reference to
|
||||
* the appropriate connection, typically factoried by {@link org.springframework.integration.twitter.config.ConnectionParser}
|
||||
*
|
||||
* @author Josh Long
|
||||
* @since 2.0
|
||||
*/
|
||||
public class InboundTimelineUpdateEndpointParser extends AbstractSingleBeanDefinitionParser {
|
||||
@Override
|
||||
protected String getBeanClassName(Element element) {
|
||||
@@ -36,9 +43,7 @@ public class InboundTimelineUpdateEndpointParser extends AbstractSingleBeanDefin
|
||||
|
||||
@Override
|
||||
protected void doParse(Element element, ParserContext parserContext, BeanDefinitionBuilder builder) {
|
||||
IntegrationNamespaceUtils.setReferenceIfAttributeDefined(builder, element,
|
||||
"channel", "outputChannel");
|
||||
IntegrationNamespaceUtils.setReferenceIfAttributeDefined(builder, element,
|
||||
"twitter-connection", "configuration");
|
||||
IntegrationNamespaceUtils.setReferenceIfAttributeDefined(builder, element, "channel", "outputChannel");
|
||||
IntegrationNamespaceUtils.setReferenceIfAttributeDefined(builder, element, "twitter-connection", "configuration");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,7 +23,16 @@ import org.springframework.integration.config.xml.IntegrationNamespaceUtils;
|
||||
import org.w3c.dom.Element;
|
||||
|
||||
import static org.springframework.integration.twitter.config.TwitterNamespaceHandler.BASE_PACKAGE;
|
||||
public class OutboundDirectMessageEndpointParser extends AbstractOutboundChannelAdapterParser {
|
||||
|
||||
/**
|
||||
* a parser for a {@link org.springframework.integration.twitter.outbound.OutboundDirectMessageMessageHandler} instance.
|
||||
* The parser expects a reference to a Twitter connection, as typically factoried by a {@link org.springframework.integration.twitter.config.ConnectionParser}.
|
||||
*
|
||||
* @author Josh Long
|
||||
* @since 2.0
|
||||
*
|
||||
*/
|
||||
public class OutboundDirectMessageMessageHandlerParser extends AbstractOutboundChannelAdapterParser {
|
||||
@Override
|
||||
protected AbstractBeanDefinition parseConsumer(Element element, ParserContext parserContext) {
|
||||
BeanDefinitionBuilder builder = BeanDefinitionBuilder.genericBeanDefinition(
|
||||
@@ -31,7 +31,7 @@ import static org.springframework.integration.twitter.config.TwitterNamespaceHan
|
||||
* @author Josh Long
|
||||
* @since 2.0
|
||||
*/
|
||||
public class OutboundUpdatedStatusEndpointParser extends AbstractOutboundChannelAdapterParser {
|
||||
public class OutboundTimelineUpdateMessageHandlerParser extends AbstractOutboundChannelAdapterParser {
|
||||
@Override
|
||||
protected AbstractBeanDefinition parseConsumer(Element element, ParserContext parserContext) {
|
||||
|
||||
@@ -41,8 +41,8 @@ public class TwitterNamespaceHandler extends org.springframework.beans.factory.x
|
||||
registerBeanDefinitionParser("inbound-mention-channel-adapter", new InboundMentionEndpointParser());
|
||||
|
||||
// outbound
|
||||
registerBeanDefinitionParser("outbound-update-channel-adapter", new OutboundUpdatedStatusEndpointParser());
|
||||
registerBeanDefinitionParser("outbound-dm-channel-adapter", new OutboundDirectMessageEndpointParser());
|
||||
registerBeanDefinitionParser("outbound-update-channel-adapter", new OutboundTimelineUpdateMessageHandlerParser());
|
||||
registerBeanDefinitionParser("outbound-dm-channel-adapter", new OutboundDirectMessageMessageHandlerParser());
|
||||
}
|
||||
|
||||
public static void configureTwitterConnection(Element element, ParserContext parserContext, BeanDefinitionBuilder builder) {
|
||||
|
||||
@@ -58,7 +58,7 @@ public class InboundDirectMessageEndpoint extends AbstractInboundTwitterEndpoint
|
||||
|
||||
@Override
|
||||
public String getComponentType() {
|
||||
return null;
|
||||
return "twitter:inbound-dm-channel-adapter";
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -30,7 +30,7 @@ public class InboundMentionEndpoint extends AbstractInboundTwitterStatusEndpoint
|
||||
|
||||
@Override
|
||||
public String getComponentType() {
|
||||
return null;
|
||||
return "twitter:inbound-mention-channel-adapter";
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -30,7 +30,7 @@ public class InboundTimelineUpdateEndpoint extends AbstractInboundTwitterStatusE
|
||||
|
||||
@Override
|
||||
public String getComponentType() {
|
||||
return null;
|
||||
return "twitter:inbound-update-channel-adapter";
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -42,5 +42,6 @@ public class InboundTimelineUpdateEndpoint extends AbstractInboundTwitterStatusE
|
||||
? twitter.getFriendsTimeline() :
|
||||
twitter.getFriendsTimeline(new Paging(t.getMarkerId()))));
|
||||
}
|
||||
}); }
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user