INT-1553, more polishing on Twitter

This commit is contained in:
Oleg Zhurakousky
2010-11-06 08:11:11 -04:00
parent 172d97ddeb
commit 16458de1f5
3 changed files with 4 additions and 22 deletions

View File

@@ -37,23 +37,9 @@ public class ConnectionParser extends AbstractSingleBeanDefinitionParser {
return BASE_PACKAGE + ".oauth.OAuthTwitterFactoryBean";
}
@Override
protected boolean shouldGenerateIdAsFallback() {
return true;
}
@Override
protected void doParse(Element element, ParserContext parserContext, BeanDefinitionBuilder builder) {
// String ref = element.getAttribute("twitter-connection");
// if (StringUtils.hasText(ref)) {
// builder.addPropertyReference("twitterConnection", ref);
// }
// else {
// for (String attribute : new String[] { "consumer-key", "consumer-secret", "access-token", "access-token-secret" }) {
// IntegrationNamespaceUtils.setValueIfAttributeDefined(builder, element, attribute);
// }
// }
BeanDefinitionBuilder accessTokenBuilder = BeanDefinitionBuilder.genericBeanDefinition("twitter4j.http.AccessToken");
accessTokenBuilder.addConstructorArgValue(element.getAttribute("access-token"));
accessTokenBuilder.addConstructorArgValue(element.getAttribute("access-token-secret"));

View File

@@ -18,13 +18,11 @@ package org.springframework.integration.twitter.config;
import static org.springframework.integration.twitter.config.TwitterNamespaceHandler.BASE_PACKAGE;
import org.w3c.dom.Element;
import org.springframework.beans.factory.support.AbstractBeanDefinition;
import org.springframework.beans.factory.support.BeanDefinitionBuilder;
import org.springframework.beans.factory.xml.ParserContext;
import org.springframework.integration.config.xml.AbstractOutboundChannelAdapterParser;
import org.springframework.integration.config.xml.IntegrationNamespaceUtils;
import org.w3c.dom.Element;
/**
* Parser for all outbound Twitter adapters

View File

@@ -33,8 +33,6 @@ import org.springframework.integration.history.TrackableComponent;
import org.springframework.integration.store.MetadataStore;
import org.springframework.integration.store.SimpleMetadataStore;
import org.springframework.integration.support.MessageBuilder;
import org.springframework.scheduling.TaskScheduler;
import org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler;
import org.springframework.util.Assert;
import org.springframework.util.StringUtils;
@@ -47,7 +45,7 @@ import twitter4j.Twitter;
* messages when using the Twitter API. This class also handles keeping track of
* the latest inbound message it has received and avoiding, where possible,
* redelivery of common messages. This functionality is enabled using the
* {@link org.springframework.integration.store.MetadataStore}
* {@link org.springframework.integration.store.MetadataStore}
* strategy.
*
* @author Josh Long
@@ -129,7 +127,6 @@ public abstract class AbstractTwitterMessageSource<T> extends AbstractEndpoint
@SuppressWarnings("unchecked")
protected void forwardAll(List<T> tResponses) {
Object o = tResponses.iterator();
Collections.sort(tResponses, this.getComparator());
for (T twitterResponse : tResponses) {
forward(twitterResponse);
@@ -195,6 +192,7 @@ public abstract class AbstractTwitterMessageSource<T> extends AbstractEndpoint
}
protected void markLastStatusId(long statusId) {
this.markerId = statusId;
this.metadataStore.put(this.metadataKey, String.valueOf(statusId));
}
}