INT-1471, more polishing, renamed Inbound adapters to be consistent with MessageSource pattern
This commit is contained in:
committed by
Chris Beams
parent
2aa39a2d64
commit
1cfdddd651
@@ -32,20 +32,20 @@ import org.w3c.dom.Element;
|
||||
* @author Oleg Zhurakousky
|
||||
* @since 2.0
|
||||
*/
|
||||
public class UpdateEndpointParser extends AbstractPollingInboundChannelAdapterParser {
|
||||
public class InboundMessageSourceParser extends AbstractPollingInboundChannelAdapterParser {
|
||||
|
||||
@Override
|
||||
protected BeanMetadataElement parseSource(Element element, ParserContext parserContext) {
|
||||
String elementName = element.getLocalName().trim();
|
||||
String className = null;
|
||||
if ("inbound-update-channel-adapter".equals(elementName)){
|
||||
className = BASE_PACKAGE +".inbound.InboundTimelineUpdateEndpoint" ;
|
||||
className = BASE_PACKAGE +".inbound.TimelineUpdateMessageSource" ;
|
||||
}
|
||||
else if ("inbound-dm-channel-adapter".equals(elementName)){
|
||||
className = BASE_PACKAGE + ".inbound.InboundDirectMessageEndpoint";
|
||||
className = BASE_PACKAGE + ".inbound.DirectMessageMessageSource";
|
||||
}
|
||||
else if ("inbound-mention-channel-adapter".equals(elementName)){
|
||||
className = BASE_PACKAGE + ".inbound.InboundMentionEndpoint";
|
||||
className = BASE_PACKAGE + ".inbound.MentionMessageSource";
|
||||
}
|
||||
else {
|
||||
throw new IllegalArgumentException("Element '" + elementName + "' is not supported by this parser");
|
||||
@@ -36,9 +36,9 @@ public class TwitterNamespaceHandler extends org.springframework.beans.factory.x
|
||||
registerBeanDefinitionParser("twitter-connection", new ConnectionParser());
|
||||
|
||||
// inbound
|
||||
registerBeanDefinitionParser("inbound-update-channel-adapter", new UpdateEndpointParser());
|
||||
registerBeanDefinitionParser("inbound-dm-channel-adapter", new UpdateEndpointParser());
|
||||
registerBeanDefinitionParser("inbound-mention-channel-adapter", new UpdateEndpointParser());
|
||||
registerBeanDefinitionParser("inbound-update-channel-adapter", new InboundMessageSourceParser());
|
||||
registerBeanDefinitionParser("inbound-dm-channel-adapter", new InboundMessageSourceParser());
|
||||
registerBeanDefinitionParser("inbound-mention-channel-adapter", new InboundMessageSourceParser());
|
||||
|
||||
// outbound
|
||||
registerBeanDefinitionParser("outbound-update-channel-adapter", new OutboundTimelineUpdateMessageHandlerParser());
|
||||
|
||||
@@ -55,7 +55,7 @@ import twitter4j.Twitter;
|
||||
* @since 2.0
|
||||
*/
|
||||
@SuppressWarnings("rawtypes")
|
||||
public abstract class AbstractInboundTwitterEndpointSupport<T> extends AbstractEndpoint
|
||||
public abstract class AbstractTwitterMessageSource<T> extends AbstractEndpoint
|
||||
implements MessageSource, TrackableComponent {
|
||||
|
||||
private volatile MetadataStore metadataStore;
|
||||
@@ -30,7 +30,7 @@ import twitter4j.Paging;
|
||||
* @author Oleg Zhurakousky
|
||||
* @since 2.0
|
||||
*/
|
||||
public class InboundDirectMessageEndpoint extends AbstractInboundTwitterEndpointSupport<DirectMessage> {
|
||||
public class DirectMessageMessageSource extends AbstractTwitterMessageSource<DirectMessage> {
|
||||
|
||||
@Override
|
||||
public String getComponentType() {
|
||||
@@ -44,7 +44,6 @@ public class InboundDirectMessageEndpoint extends AbstractInboundTwitterEndpoint
|
||||
try {
|
||||
long sinceId = getMarkerId();
|
||||
if (tweets.size() <= prefetchThreshold){
|
||||
System.out.println("Polling");
|
||||
List<twitter4j.DirectMessage> dms = !hasMarkedStatus()
|
||||
? twitter.getDirectMessages()
|
||||
: twitter.getDirectMessages(new Paging(sinceId));
|
||||
@@ -28,7 +28,7 @@ import twitter4j.Status;
|
||||
* @author Josh Long
|
||||
* @author Oleg Zhurakousky
|
||||
*/
|
||||
public class InboundMentionEndpoint extends AbstractInboundTwitterEndpointSupport<Status> {
|
||||
public class MentionMessageSource extends AbstractTwitterMessageSource<Status> {
|
||||
|
||||
@Override
|
||||
public String getComponentType() {
|
||||
@@ -29,7 +29,7 @@ import twitter4j.Status;
|
||||
* @author Oleg Zhurakousky
|
||||
* @since 2.0
|
||||
*/
|
||||
public class InboundTimelineUpdateEndpoint extends AbstractInboundTwitterEndpointSupport<Status> {
|
||||
public class TimelineUpdateMessageSource extends AbstractTwitterMessageSource<Status> {
|
||||
|
||||
@Override
|
||||
public String getComponentType() {
|
||||
Reference in New Issue
Block a user