cleanup of the code: removing cyclic dependencies, cleaning out package hierarchy, etc, in support of INT-1548 INT-1549 INT-1547
This commit is contained in:
@@ -50,7 +50,7 @@ public class CycleDetectorTests {
|
||||
CycleDetector builder = new CycleDetector();
|
||||
builder.detectCycle(parent, "org.springframework.integration.transformer");
|
||||
// should not throw an exception, however if you remove additional package from
|
||||
// the above method there is a cycle in the domain model
|
||||
// the above method there is a cycle in the domain core
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
@@ -36,7 +36,7 @@ import org.springframework.web.servlet.mvc.Controller;
|
||||
* The {@link #setViewName(String) viewName} will be passed into the ModelAndView return value.
|
||||
* <p/>
|
||||
* This endpoint will have request/reply behavior by default. That can be overridden by passing <code>false</code> to
|
||||
* the constructor. In the request/reply case, the model map will be passed to the view, and it will contain either the
|
||||
* the constructor. In the request/reply case, the core map will be passed to the view, and it will contain either the
|
||||
* reply Message or payload depending on the value of {@link #extractReplyPayload} (true by default, meaning just the
|
||||
* payload). The corresponding key in the map is determined by the {@link #replyKey} property (with a default of
|
||||
* "reply").
|
||||
@@ -76,7 +76,7 @@ public class HttpRequestHandlingController extends HttpRequestHandlingEndpointSu
|
||||
}
|
||||
|
||||
/**
|
||||
* Specify the key to be used when adding the reply Message or payload to the model map (will be payload only unless
|
||||
* Specify the key to be used when adding the reply Message or payload to the core map (will be payload only unless
|
||||
* the value of {@link HttpRequestHandlingController#setExtractReplyPayload(boolean)} is <code>false</code>). The
|
||||
* default key is "reply".
|
||||
*/
|
||||
@@ -85,7 +85,7 @@ public class HttpRequestHandlingController extends HttpRequestHandlingEndpointSu
|
||||
}
|
||||
|
||||
/**
|
||||
* The key used to expose {@link Errors} in the model, in the case that message handling fails. Defaults to
|
||||
* The key used to expose {@link Errors} in the core, in the case that message handling fails. Defaults to
|
||||
* "errors".
|
||||
* @param errorsKey the key value to set
|
||||
*/
|
||||
|
||||
@@ -23,10 +23,10 @@ import org.w3c.dom.Element;
|
||||
|
||||
import static org.springframework.integration.twitter.config.TwitterNamespaceHandler.BASE_PACKAGE;
|
||||
|
||||
public class DirectMessageInboundEndpointParser extends AbstractSingleBeanDefinitionParser {
|
||||
public class InboundDirectMessageEndpointParser extends AbstractSingleBeanDefinitionParser {
|
||||
@Override
|
||||
protected String getBeanClassName(Element element) {
|
||||
return BASE_PACKAGE + ".InboundDirectMessageStatusEndpoint";
|
||||
return BASE_PACKAGE + ".inbound.InboundDirectMessageEndpoint";
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -23,10 +23,10 @@ import org.w3c.dom.Element;
|
||||
|
||||
import static org.springframework.integration.twitter.config.TwitterNamespaceHandler.BASE_PACKAGE;
|
||||
|
||||
public class MentionInboundEndpointParser extends AbstractSingleBeanDefinitionParser {
|
||||
public class InboundMentionEndpointParser extends AbstractSingleBeanDefinitionParser {
|
||||
@Override
|
||||
protected String getBeanClassName(Element element) {
|
||||
return BASE_PACKAGE + ".InboundMentionStatusEndpoint";
|
||||
return BASE_PACKAGE + ".inbound.InboundMentionEndpoint";
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -23,10 +23,10 @@ import org.w3c.dom.Element;
|
||||
|
||||
import static org.springframework.integration.twitter.config.TwitterNamespaceHandler.BASE_PACKAGE;
|
||||
|
||||
public class UpdatedStatusInboundEndpointParser extends AbstractSingleBeanDefinitionParser {
|
||||
public class InboundTimelineUpdateEndpointParser extends AbstractSingleBeanDefinitionParser {
|
||||
@Override
|
||||
protected String getBeanClassName(Element element) {
|
||||
return BASE_PACKAGE +".InboundUpdatedStatusEndpoint" ;
|
||||
return BASE_PACKAGE +".inbound.InboundTimelineUpdateEndpoint" ;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -23,10 +23,11 @@ import org.springframework.integration.config.xml.IntegrationNamespaceUtils;
|
||||
import org.w3c.dom.Element;
|
||||
|
||||
import static org.springframework.integration.twitter.config.TwitterNamespaceHandler.BASE_PACKAGE;
|
||||
public class DirectMessageOutboundEndpointParser extends AbstractOutboundChannelAdapterParser {
|
||||
public class OutboundDirectMessageEndpointParser extends AbstractOutboundChannelAdapterParser {
|
||||
@Override
|
||||
protected AbstractBeanDefinition parseConsumer(Element element, ParserContext parserContext) {
|
||||
BeanDefinitionBuilder builder = BeanDefinitionBuilder.genericBeanDefinition( BASE_PACKAGE + ".OutboundDirectMessageStatusMessageHandler" );
|
||||
BeanDefinitionBuilder builder = BeanDefinitionBuilder.genericBeanDefinition(
|
||||
BASE_PACKAGE + ".outbound.OutboundDirectMessageMessageHandler" );
|
||||
|
||||
IntegrationNamespaceUtils.setReferenceIfAttributeDefined(builder, element, "twitter-connection", "configuration");
|
||||
return builder.getBeanDefinition();
|
||||
@@ -24,12 +24,19 @@ import org.w3c.dom.Element;
|
||||
|
||||
import static org.springframework.integration.twitter.config.TwitterNamespaceHandler.BASE_PACKAGE;
|
||||
|
||||
public class UpdatedStatusOutboundEndpointParser extends AbstractOutboundChannelAdapterParser {
|
||||
/**
|
||||
*
|
||||
* this outbound adapter updates the twitter status for an account
|
||||
*
|
||||
* @author Josh Long
|
||||
* @since 2.0
|
||||
*/
|
||||
public class OutboundUpdatedStatusEndpointParser extends AbstractOutboundChannelAdapterParser {
|
||||
@Override
|
||||
protected AbstractBeanDefinition parseConsumer(Element element, ParserContext parserContext) {
|
||||
|
||||
BeanDefinitionBuilder builder = BeanDefinitionBuilder.genericBeanDefinition(
|
||||
BASE_PACKAGE + ".OutboundUpdatedStatusMessageHandler" );
|
||||
BASE_PACKAGE + ".outbound.OutboundTimelineUpdateMessageHandler" );
|
||||
|
||||
|
||||
IntegrationNamespaceUtils.setReferenceIfAttributeDefined(builder, element,
|
||||
@@ -36,13 +36,13 @@ public class TwitterNamespaceHandler extends org.springframework.beans.factory.x
|
||||
registerBeanDefinitionParser("twitter-connection", new ConnectionParser());
|
||||
|
||||
// inbound
|
||||
registerBeanDefinitionParser("inbound-update-channel-adapter", new UpdatedStatusInboundEndpointParser());
|
||||
registerBeanDefinitionParser("inbound-dm-channel-adapter", new DirectMessageInboundEndpointParser());
|
||||
registerBeanDefinitionParser("inbound-mention-channel-adapter", new MentionInboundEndpointParser());
|
||||
registerBeanDefinitionParser("inbound-update-channel-adapter", new InboundTimelineUpdateEndpointParser());
|
||||
registerBeanDefinitionParser("inbound-dm-channel-adapter", new InboundDirectMessageEndpointParser());
|
||||
registerBeanDefinitionParser("inbound-mention-channel-adapter", new InboundMentionEndpointParser());
|
||||
|
||||
// outbound
|
||||
registerBeanDefinitionParser("outbound-update-channel-adapter", new UpdatedStatusOutboundEndpointParser());
|
||||
registerBeanDefinitionParser("outbound-dm-channel-adapter", new DirectMessageOutboundEndpointParser());
|
||||
registerBeanDefinitionParser("outbound-update-channel-adapter", new OutboundUpdatedStatusEndpointParser());
|
||||
registerBeanDefinitionParser("outbound-dm-channel-adapter", new OutboundDirectMessageEndpointParser());
|
||||
}
|
||||
|
||||
public static void configureTwitterConnection(Element element, ParserContext parserContext, BeanDefinitionBuilder builder) {
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.springframework.integration.twitter.model;
|
||||
package org.springframework.integration.twitter.core;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
@@ -23,6 +23,7 @@ import java.util.Date;
|
||||
* these are messages sent privately to a user.
|
||||
*
|
||||
* @author Josh Long
|
||||
* @since 2.0
|
||||
*/
|
||||
public interface DirectMessage {
|
||||
int getId();
|
||||
@@ -13,12 +13,13 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.springframework.integration.twitter.model;
|
||||
package org.springframework.integration.twitter.core;
|
||||
|
||||
/**
|
||||
* interface for geo location records
|
||||
*
|
||||
* @author Josh Long
|
||||
* @since 2.0
|
||||
*
|
||||
*/
|
||||
public interface GeoLocation {
|
||||
@@ -13,7 +13,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.springframework.integration.twitter.model;
|
||||
package org.springframework.integration.twitter.core;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
@@ -23,6 +23,7 @@ import java.util.Date;
|
||||
*
|
||||
*
|
||||
* @author Josh Long
|
||||
* @since 2.0
|
||||
*/
|
||||
public interface Status {
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.springframework.integration.twitter;
|
||||
package org.springframework.integration.twitter.core;
|
||||
|
||||
|
||||
/**
|
||||
@@ -13,13 +13,14 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.springframework.integration.twitter.model;
|
||||
package org.springframework.integration.twitter.core;
|
||||
|
||||
|
||||
/**
|
||||
* describes the user producing or receiving messages
|
||||
*
|
||||
* @author Josh Long
|
||||
* @since 2.0
|
||||
*/
|
||||
public interface User {
|
||||
|
||||
@@ -13,20 +13,22 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.springframework.integration.twitter.model;
|
||||
package org.springframework.integration.twitter.core.twitter;
|
||||
|
||||
import org.springframework.integration.twitter.core.User;
|
||||
import twitter4j.DirectMessage;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
|
||||
/**
|
||||
* implementation of the {@link org.springframework.integration.twitter.model.DirectMessage} interface
|
||||
* implementation of the {@link org.springframework.integration.twitter.core.DirectMessage} interface
|
||||
* that wraps, and works with, a {@link twitter4j.DirectMessage} instance.
|
||||
*
|
||||
* @author Josh Long
|
||||
* @since 2.0
|
||||
*/
|
||||
public class Twitter4jDirectMessage implements org.springframework.integration.twitter.model.DirectMessage {
|
||||
public class Twitter4jDirectMessage implements org.springframework.integration.twitter.core.DirectMessage {
|
||||
private DirectMessage directMessage;
|
||||
|
||||
public Twitter4jDirectMessage(DirectMessage directMessage) {
|
||||
@@ -13,12 +13,15 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.springframework.integration.twitter.model;
|
||||
package org.springframework.integration.twitter.core.twitter;
|
||||
|
||||
import org.springframework.integration.twitter.core.GeoLocation;
|
||||
|
||||
/**
|
||||
* Implements a notion of GeoLocation that forwards calls to {@link twitter4j.GeoLocation} instance
|
||||
*
|
||||
* @author Josh Long
|
||||
* @since 2.0
|
||||
*/
|
||||
public class Twitter4jGeoLocation implements GeoLocation {
|
||||
|
||||
@@ -13,16 +13,20 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.springframework.integration.twitter.model;
|
||||
package org.springframework.integration.twitter.core.twitter;
|
||||
|
||||
import org.springframework.integration.twitter.core.Status;
|
||||
import org.springframework.integration.twitter.core.User;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
*
|
||||
* An implemention o the {@link org.springframework.integration.twitter.model.Status} interface that
|
||||
* An implemention o the {@link org.springframework.integration.twitter.core.Status} interface that
|
||||
* forwards requests to a {@link twitter4j.Status} implementation
|
||||
*
|
||||
* @author Josh Long
|
||||
* @since 2.0
|
||||
*/
|
||||
public class Twitter4jStatus implements Status {
|
||||
private twitter4j.Status status;
|
||||
@@ -13,7 +13,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.springframework.integration.twitter.model;
|
||||
package org.springframework.integration.twitter.core.twitter;
|
||||
|
||||
import twitter4j.User;
|
||||
|
||||
@@ -24,8 +24,9 @@ import java.net.URL;
|
||||
* implementation of the User interfce to represent Users in a Twitter application
|
||||
*
|
||||
* @author Josh Long
|
||||
* @since 2.0
|
||||
*/
|
||||
public class Twitter4jUser implements org.springframework.integration.twitter.model.User {
|
||||
public class Twitter4jUser implements org.springframework.integration.twitter.core.User {
|
||||
|
||||
private twitter4j.User user;
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.springframework.integration.twitter;
|
||||
package org.springframework.integration.twitter.inbound;
|
||||
|
||||
import org.apache.commons.lang.exception.ExceptionUtils;
|
||||
|
||||
@@ -42,7 +42,7 @@ import java.util.concurrent.ThreadFactory;
|
||||
/**
|
||||
* There are a lot of operations that are common to receiving the various types of messages when using the
|
||||
* Twitter API, and this class abstracts most of them for you. Implementers must take note of
|
||||
* {@link org.springframework.integration.twitter.AbstractInboundTwitterEndpointSupport#runAsAPIRateLimitsPermit(org.springframework.integration.twitter.AbstractInboundTwitterEndpointSupport.ApiCallback)}
|
||||
* {@link AbstractInboundTwitterEndpointSupport#runAsAPIRateLimitsPermit(AbstractInboundTwitterEndpointSupport.ApiCallback)}
|
||||
* which will invoke the instance of {@link AbstractInboundTwitterEndpointSupport.ApiCallback} when the
|
||||
* rate-limit API deems that its OK to do so. This class handles keeping tabs on that and on spacing out requests
|
||||
* as required.
|
||||
@@ -13,9 +13,9 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.springframework.integration.twitter;
|
||||
import org.springframework.integration.twitter.model.Status;
|
||||
import org.springframework.integration.twitter.model.Twitter4jStatus;
|
||||
package org.springframework.integration.twitter.inbound;
|
||||
import org.springframework.integration.twitter.core.Status;
|
||||
import org.springframework.integration.twitter.core.twitter.Twitter4jStatus;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
@@ -13,10 +13,10 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.springframework.integration.twitter;
|
||||
package org.springframework.integration.twitter.inbound;
|
||||
|
||||
import org.springframework.integration.twitter.model.DirectMessage;
|
||||
import org.springframework.integration.twitter.model.Twitter4jDirectMessage;
|
||||
import org.springframework.integration.twitter.core.DirectMessage;
|
||||
import org.springframework.integration.twitter.core.twitter.Twitter4jDirectMessage;
|
||||
import twitter4j.Paging;
|
||||
import twitter4j.Twitter;
|
||||
|
||||
@@ -31,7 +31,7 @@ import java.util.List;
|
||||
*
|
||||
* @author Josh Long
|
||||
*/
|
||||
public class InboundDirectMessageStatusEndpoint extends AbstractInboundTwitterEndpointSupport<DirectMessage> {
|
||||
public class InboundDirectMessageEndpoint extends AbstractInboundTwitterEndpointSupport<DirectMessage> {
|
||||
|
||||
private Comparator<DirectMessage> dmComparator = new Comparator<DirectMessage>() {
|
||||
public int compare(DirectMessage directMessage, DirectMessage directMessage1) {
|
||||
@@ -64,8 +64,8 @@ public class InboundDirectMessageStatusEndpoint extends AbstractInboundTwitterEn
|
||||
@Override
|
||||
protected void beginPolling() throws Exception {
|
||||
|
||||
this.runAsAPIRateLimitsPermit(new ApiCallback<InboundDirectMessageStatusEndpoint>() {
|
||||
public void run(InboundDirectMessageStatusEndpoint t, Twitter twitter)
|
||||
this.runAsAPIRateLimitsPermit(new ApiCallback<InboundDirectMessageEndpoint>() {
|
||||
public void run(InboundDirectMessageEndpoint t, Twitter twitter)
|
||||
throws Exception {
|
||||
|
||||
List<twitter4j.DirectMessage> dms = !hasMarkedStatus() ? t.twitter.getDirectMessages() : t.twitter.getDirectMessages(new Paging(t.getMarkerId()));
|
||||
@@ -13,7 +13,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.springframework.integration.twitter;
|
||||
package org.springframework.integration.twitter.inbound;
|
||||
|
||||
import twitter4j.Paging;
|
||||
import twitter4j.Twitter;
|
||||
@@ -26,7 +26,7 @@ import java.util.List;
|
||||
*
|
||||
* @author Josh Long
|
||||
*/
|
||||
public class InboundMentionStatusEndpoint extends AbstractInboundTwitterStatusEndpointSupport {
|
||||
public class InboundMentionEndpoint extends AbstractInboundTwitterStatusEndpointSupport {
|
||||
|
||||
@Override
|
||||
public String getComponentType() {
|
||||
@@ -35,9 +35,9 @@ public class InboundMentionStatusEndpoint extends AbstractInboundTwitterStatusEn
|
||||
|
||||
@Override
|
||||
protected void beginPolling() throws Exception {
|
||||
this.runAsAPIRateLimitsPermit(new ApiCallback<InboundMentionStatusEndpoint>() {
|
||||
this.runAsAPIRateLimitsPermit(new ApiCallback<InboundMentionEndpoint>() {
|
||||
|
||||
public void run(InboundMentionStatusEndpoint ctx, Twitter twitter) throws Exception {
|
||||
public void run(InboundMentionEndpoint ctx, Twitter twitter) throws Exception {
|
||||
List<twitter4j.Status> stats = (!hasMarkedStatus())
|
||||
? twitter.getMentions()
|
||||
: twitter.getMentions(new Paging(ctx.getMarkerId()));
|
||||
@@ -13,7 +13,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.springframework.integration.twitter;
|
||||
package org.springframework.integration.twitter.inbound;
|
||||
|
||||
import twitter4j.Paging;
|
||||
import twitter4j.Twitter;
|
||||
@@ -26,7 +26,7 @@ import twitter4j.Twitter;
|
||||
* @author Josh Long
|
||||
* @since 2.0
|
||||
*/
|
||||
public class InboundUpdatedStatusEndpoint extends AbstractInboundTwitterStatusEndpointSupport {
|
||||
public class InboundTimelineUpdateEndpoint extends AbstractInboundTwitterStatusEndpointSupport {
|
||||
|
||||
@Override
|
||||
public String getComponentType() {
|
||||
@@ -35,8 +35,8 @@ public class InboundUpdatedStatusEndpoint extends AbstractInboundTwitterStatusEn
|
||||
|
||||
@Override
|
||||
protected void beginPolling() throws Exception {
|
||||
this.runAsAPIRateLimitsPermit(new ApiCallback<InboundUpdatedStatusEndpoint>() {
|
||||
public void run(InboundUpdatedStatusEndpoint t, Twitter twitter)
|
||||
this.runAsAPIRateLimitsPermit(new ApiCallback<InboundTimelineUpdateEndpoint>() {
|
||||
public void run(InboundTimelineUpdateEndpoint t, Twitter twitter)
|
||||
throws Exception {
|
||||
forwardAll( fromTwitter4jStatuses(!t.hasMarkedStatus()
|
||||
? twitter.getFriendsTimeline() :
|
||||
@@ -27,7 +27,6 @@ import twitter4j.http.AccessToken;
|
||||
*/
|
||||
public interface AccessTokenInitialRequestProcessListener {
|
||||
|
||||
|
||||
String openUrlAndReturnPin(String urlToOpen) throws Exception;
|
||||
|
||||
void persistReturnedAccessToken(AccessToken accessToken) throws Exception;
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.springframework.integration.twitter;
|
||||
package org.springframework.integration.twitter.outbound;
|
||||
|
||||
import org.springframework.integration.handler.AbstractMessageHandler;
|
||||
import org.springframework.integration.twitter.oauth.OAuthConfiguration;
|
||||
@@ -30,7 +30,7 @@ import twitter4j.Twitter;
|
||||
public abstract class AbstractOutboundTwitterEndpointSupport extends AbstractMessageHandler {
|
||||
protected volatile OAuthConfiguration configuration;
|
||||
protected volatile Twitter twitter;
|
||||
protected final StatusUpdateOptboundMessageMapper statusUpdateSupport = new StatusUpdateOptboundMessageMapper();
|
||||
protected final OutboundStatusUpdateMessageMapper supportStatusUpdate = new OutboundStatusUpdateMessageMapper();
|
||||
|
||||
public void setConfiguration(OAuthConfiguration configuration) {
|
||||
this.configuration = configuration;
|
||||
@@ -13,9 +13,10 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.springframework.integration.twitter;
|
||||
package org.springframework.integration.twitter.outbound;
|
||||
|
||||
import org.springframework.integration.Message;
|
||||
import org.springframework.integration.twitter.core.TwitterHeaders;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
import twitter4j.TwitterException;
|
||||
@@ -25,11 +26,11 @@ import twitter4j.TwitterException;
|
||||
* Simple adapter to support sending outbound direct messages ("DM"s) using twitter
|
||||
*
|
||||
* @author Josh Long
|
||||
* @see org.springframework.integration.twitter.TwitterHeaders
|
||||
* @see org.springframework.integration.twitter.core.TwitterHeaders
|
||||
* @see twitter4j.Twitter
|
||||
* @since 2.0
|
||||
*/
|
||||
public class OutboundDirectMessageStatusMessageHandler extends AbstractOutboundTwitterEndpointSupport {
|
||||
public class OutboundDirectMessageMessageHandler extends AbstractOutboundTwitterEndpointSupport {
|
||||
|
||||
@Override
|
||||
protected void handleMessageInternal(Message<?> message) throws Exception {
|
||||
@@ -13,12 +13,13 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.springframework.integration.twitter;
|
||||
package org.springframework.integration.twitter.outbound;
|
||||
|
||||
import org.springframework.integration.Message;
|
||||
import org.springframework.integration.MessageHandlingException;
|
||||
import org.springframework.integration.mapping.OutboundMessageMapper;
|
||||
import org.springframework.integration.twitter.model.Twitter4jGeoLocation;
|
||||
import org.springframework.integration.twitter.core.TwitterHeaders;
|
||||
import org.springframework.integration.twitter.core.twitter.Twitter4jGeoLocation;
|
||||
import org.springframework.util.StringUtils;
|
||||
import twitter4j.StatusUpdate;
|
||||
|
||||
@@ -28,18 +29,18 @@ import twitter4j.StatusUpdate;
|
||||
*
|
||||
* @author Josh Long
|
||||
* @see twitter4j.StatusUpdate
|
||||
* @see org.springframework.integration.twitter.TwitterHeaders
|
||||
* @see org.springframework.integration.twitter.core.TwitterHeaders
|
||||
* @since 2.0
|
||||
*/
|
||||
public class StatusUpdateOptboundMessageMapper implements OutboundMessageMapper<StatusUpdate> {
|
||||
public class OutboundStatusUpdateMessageMapper implements OutboundMessageMapper<StatusUpdate> {
|
||||
/**
|
||||
* convenient, interf-ace-oriented way of obtaining a reference to a {@link org.springframework.integration.twitter.model.Twitter4jGeoLocation}
|
||||
* convenient, interface-oriented way of obtaining a reference to a {@link org.springframework.integration.twitter.core.twitter.Twitter4jGeoLocation}
|
||||
*
|
||||
* @param lat the latitude
|
||||
* @param lon the longitude
|
||||
* @return a {@link org.springframework.integration.twitter.model.GeoLocation} instance
|
||||
* @return a {@link org.springframework.integration.twitter.core.GeoLocation} instance
|
||||
*/
|
||||
public org.springframework.integration.twitter.model.GeoLocation fromLatitudeLongitudePair(double lat, double lon) {
|
||||
public org.springframework.integration.twitter.core.GeoLocation fromLatitudeLongitudePair(double lat, double lon) {
|
||||
return new Twitter4jGeoLocation(lat, lon);
|
||||
}
|
||||
|
||||
@@ -78,7 +79,7 @@ public class StatusUpdateOptboundMessageMapper implements OutboundMessageMapper<
|
||||
|
||||
if (message.getHeaders().containsKey(TwitterHeaders.TWITTER_GEOLOCATION)) {
|
||||
|
||||
org.springframework.integration.twitter.model.GeoLocation geoLocation = (org.springframework.integration.twitter.model.GeoLocation) message.getHeaders()
|
||||
org.springframework.integration.twitter.core.GeoLocation geoLocation = (org.springframework.integration.twitter.core.GeoLocation) message.getHeaders()
|
||||
.get(TwitterHeaders.TWITTER_GEOLOCATION);
|
||||
twitter4j.GeoLocation gl = null;
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.springframework.integration.twitter;
|
||||
package org.springframework.integration.twitter.outbound;
|
||||
|
||||
import org.springframework.integration.Message;
|
||||
import org.springframework.util.Assert;
|
||||
@@ -27,10 +27,10 @@ import twitter4j.StatusUpdate;
|
||||
* @author Josh Long
|
||||
* @since 2.0
|
||||
*/
|
||||
public class OutboundUpdatedStatusMessageHandler extends AbstractOutboundTwitterEndpointSupport {
|
||||
public class OutboundTimelineUpdateMessageHandler extends AbstractOutboundTwitterEndpointSupport {
|
||||
@Override
|
||||
protected void handleMessageInternal(Message<?> message) throws Exception {
|
||||
StatusUpdate statusUpdate = this.statusUpdateSupport.fromMessage(message);
|
||||
StatusUpdate statusUpdate = this.supportStatusUpdate.fromMessage(message);
|
||||
Assert.notNull(statusUpdate, "couldn't send message, unable to build a StatusUpdate instance correctly");
|
||||
this.twitter.updateStatus(statusUpdate);
|
||||
}
|
||||
@@ -23,7 +23,8 @@ import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.integration.MessageChannel;
|
||||
import org.springframework.integration.core.MessagingTemplate;
|
||||
import org.springframework.integration.support.MessageBuilder;
|
||||
import org.springframework.integration.twitter.model.Twitter4jGeoLocation;
|
||||
import org.springframework.integration.twitter.core.twitter.Twitter4jGeoLocation;
|
||||
import org.springframework.integration.twitter.core.TwitterHeaders;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.AbstractJUnit4SpringContextTests;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
@@ -23,7 +23,8 @@ import org.springframework.integration.Message;
|
||||
import org.springframework.integration.MessageChannel;
|
||||
import org.springframework.integration.core.MessagingTemplate;
|
||||
import org.springframework.integration.support.MessageBuilder;
|
||||
import org.springframework.integration.twitter.model.Twitter4jGeoLocation;
|
||||
import org.springframework.integration.twitter.core.twitter.Twitter4jGeoLocation;
|
||||
import org.springframework.integration.twitter.core.TwitterHeaders;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.AbstractJUnit4SpringContextTests;
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package org.springframework.integration.twitter;
|
||||
|
||||
import org.springframework.integration.twitter.model.DirectMessage;
|
||||
import org.springframework.integration.twitter.model.Status;
|
||||
import org.springframework.integration.twitter.core.DirectMessage;
|
||||
import org.springframework.integration.twitter.core.Status;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user