From 19871a44845e92e349bcf358c9509991d1e9e75b Mon Sep 17 00:00:00 2001 From: Josh Long Date: Sat, 23 Oct 2010 16:23:01 -0700 Subject: [PATCH] cleanup. --- ...ctInboundTwitterStatusEndpointSupport.java | 13 +----- .../InboundDirectMessageStatusEndpoint.java | 10 +---- ...oundDirectMessageStatusMessageHandler.java | 1 + .../StatusUpdateOptboundMessageMapper.java | 10 ++--- .../twitter/config/ConnectionParser.java | 15 +++++++ .../DirectMessageInboundEndpointParser.java | 15 +++++++ .../DirectMessageOutboundEndpointParser.java | 15 +++++++ .../config/MentionInboundEndpointParser.java | 15 +++++++ .../UpdatedStatusInboundEndpointParser.java | 15 +++++++ .../UpdatedStatusOutboundEndpointParser.java | 15 +++++++ .../twitter/model/DirectMessage.java | 21 ++++++++- .../twitter/model/GeoLocation.java | 15 +++++++ .../integration/twitter/model/Status.java | 25 +++++++++-- ...eImpl.java => Twitter4jDirectMessage.java} | 23 ++++++++-- .../twitter/model/Twitter4jGeoLocation.java | 45 +++++++++++++++++++ .../model/Twitter4jGeoLocationImpl.java | 30 ------------- ...4jStatusImpl.java => Twitter4jStatus.java} | 23 ++++++++-- ...tter4jUserImpl.java => Twitter4jUser.java} | 19 +++++++- .../integration/twitter/model/User.java | 15 +++++++ .../twitter/TestSendingDMsUsingNamespace.java | 5 +-- .../TestSendingUpdatesUsingNamespace.java | 4 +- 21 files changed, 274 insertions(+), 75 deletions(-) rename spring-integration-twitter/src/main/java/org/springframework/integration/twitter/model/{Twitter4jDirectMessageImpl.java => Twitter4jDirectMessage.java} (53%) create mode 100644 spring-integration-twitter/src/main/java/org/springframework/integration/twitter/model/Twitter4jGeoLocation.java delete mode 100644 spring-integration-twitter/src/main/java/org/springframework/integration/twitter/model/Twitter4jGeoLocationImpl.java rename spring-integration-twitter/src/main/java/org/springframework/integration/twitter/model/{Twitter4jStatusImpl.java => Twitter4jStatus.java} (58%) rename spring-integration-twitter/src/main/java/org/springframework/integration/twitter/model/{Twitter4jUserImpl.java => Twitter4jUser.java} (55%) diff --git a/spring-integration-twitter/src/main/java/org/springframework/integration/twitter/AbstractInboundTwitterStatusEndpointSupport.java b/spring-integration-twitter/src/main/java/org/springframework/integration/twitter/AbstractInboundTwitterStatusEndpointSupport.java index 7ff9e4393b..6b365ae75f 100644 --- a/spring-integration-twitter/src/main/java/org/springframework/integration/twitter/AbstractInboundTwitterStatusEndpointSupport.java +++ b/spring-integration-twitter/src/main/java/org/springframework/integration/twitter/AbstractInboundTwitterStatusEndpointSupport.java @@ -14,22 +14,13 @@ * limitations under the License. */ package org.springframework.integration.twitter; - -//import twitter4j.Status; - -//import twitter4j.Status; - -import org.springframework.core.task.TaskExecutor; import org.springframework.integration.twitter.model.Status; -import org.springframework.integration.twitter.model.Twitter4jStatusImpl; +import org.springframework.integration.twitter.model.Twitter4jStatus; import java.util.ArrayList; import java.util.Collections; import java.util.Comparator; import java.util.List; -import java.util.concurrent.Executor; -import java.util.concurrent.Executors; -import java.util.concurrent.ThreadFactory; /** @@ -51,7 +42,7 @@ abstract public class AbstractInboundTwitterStatusEndpointSupport extends Abstra protected List fromTwitter4jStatuses(List stats) { List fwd = new ArrayList(); for (twitter4j.Status s : stats) - fwd.add(new Twitter4jStatusImpl(s)); + fwd.add(new Twitter4jStatus(s)); return fwd; } diff --git a/spring-integration-twitter/src/main/java/org/springframework/integration/twitter/InboundDirectMessageStatusEndpoint.java b/spring-integration-twitter/src/main/java/org/springframework/integration/twitter/InboundDirectMessageStatusEndpoint.java index 3cdc2786bd..b04d671400 100644 --- a/spring-integration-twitter/src/main/java/org/springframework/integration/twitter/InboundDirectMessageStatusEndpoint.java +++ b/spring-integration-twitter/src/main/java/org/springframework/integration/twitter/InboundDirectMessageStatusEndpoint.java @@ -15,21 +15,15 @@ */ package org.springframework.integration.twitter; -//import twitter4j.DirectMessage; import org.springframework.integration.twitter.model.DirectMessage; -import org.springframework.integration.twitter.model.Twitter4jDirectMessageImpl; +import org.springframework.integration.twitter.model.Twitter4jDirectMessage; import twitter4j.Paging; - - import twitter4j.Twitter; import java.util.ArrayList; import java.util.Collections; import java.util.Comparator; import java.util.List; -import java.util.concurrent.Executor; -import java.util.concurrent.Executors; -import java.util.concurrent.ThreadFactory; /** @@ -79,7 +73,7 @@ public class InboundDirectMessageStatusEndpoint extends AbstractInboundTwitterEn List dmsToFwd = new ArrayList(); for( twitter4j.DirectMessage dm : dms) - dmsToFwd.add( new Twitter4jDirectMessageImpl( dm)); + dmsToFwd.add( new Twitter4jDirectMessage( dm)); forwardAll( dmsToFwd ); } diff --git a/spring-integration-twitter/src/main/java/org/springframework/integration/twitter/OutboundDirectMessageStatusMessageHandler.java b/spring-integration-twitter/src/main/java/org/springframework/integration/twitter/OutboundDirectMessageStatusMessageHandler.java index ca614f7f4a..91e0014df2 100644 --- a/spring-integration-twitter/src/main/java/org/springframework/integration/twitter/OutboundDirectMessageStatusMessageHandler.java +++ b/spring-integration-twitter/src/main/java/org/springframework/integration/twitter/OutboundDirectMessageStatusMessageHandler.java @@ -27,6 +27,7 @@ import twitter4j.TwitterException; * @author Josh Long * @see org.springframework.integration.twitter.TwitterHeaders * @see twitter4j.Twitter + * @since 2.0 */ public class OutboundDirectMessageStatusMessageHandler extends AbstractOutboundTwitterEndpointSupport { diff --git a/spring-integration-twitter/src/main/java/org/springframework/integration/twitter/StatusUpdateOptboundMessageMapper.java b/spring-integration-twitter/src/main/java/org/springframework/integration/twitter/StatusUpdateOptboundMessageMapper.java index 55eb51c9ce..15ea67b265 100644 --- a/spring-integration-twitter/src/main/java/org/springframework/integration/twitter/StatusUpdateOptboundMessageMapper.java +++ b/spring-integration-twitter/src/main/java/org/springframework/integration/twitter/StatusUpdateOptboundMessageMapper.java @@ -18,7 +18,7 @@ package org.springframework.integration.twitter; import org.springframework.integration.Message; import org.springframework.integration.MessageHandlingException; import org.springframework.integration.mapping.OutboundMessageMapper; -import org.springframework.integration.twitter.model.Twitter4jGeoLocationImpl; +import org.springframework.integration.twitter.model.Twitter4jGeoLocation; import org.springframework.util.StringUtils; import twitter4j.StatusUpdate; @@ -33,14 +33,14 @@ import twitter4j.StatusUpdate; */ public class StatusUpdateOptboundMessageMapper implements OutboundMessageMapper { /** - * convenient, interf-ace-oriented way of obtaining a reference to a {@link org.springframework.integration.twitter.model.Twitter4jGeoLocationImpl} + * convenient, interf-ace-oriented way of obtaining a reference to a {@link org.springframework.integration.twitter.model.Twitter4jGeoLocation} * * @param lat the latitude * @param lon the longitude * @return a {@link org.springframework.integration.twitter.model.GeoLocation} instance */ public org.springframework.integration.twitter.model.GeoLocation fromLatitudeLongitudePair(double lat, double lon) { - return new Twitter4jGeoLocationImpl(lat, lon); + return new Twitter4jGeoLocation(lat, lon); } /** @@ -82,8 +82,8 @@ public class StatusUpdateOptboundMessageMapper implements OutboundMessageMapper< .get(TwitterHeaders.TWITTER_GEOLOCATION); twitter4j.GeoLocation gl = null; - if (geoLocation instanceof Twitter4jGeoLocationImpl) { - gl = ((Twitter4jGeoLocationImpl) geoLocation).getGeoLocation(); + if (geoLocation instanceof Twitter4jGeoLocation) { + gl = ((Twitter4jGeoLocation) geoLocation).getGeoLocation(); if (null != gl) { statusUpdate.location(gl); } diff --git a/spring-integration-twitter/src/main/java/org/springframework/integration/twitter/config/ConnectionParser.java b/spring-integration-twitter/src/main/java/org/springframework/integration/twitter/config/ConnectionParser.java index b0ccedc80d..f50cb2c758 100644 --- a/spring-integration-twitter/src/main/java/org/springframework/integration/twitter/config/ConnectionParser.java +++ b/spring-integration-twitter/src/main/java/org/springframework/integration/twitter/config/ConnectionParser.java @@ -1,3 +1,18 @@ +/* + * Copyright 2010 the original author or authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.integration.twitter.config; import org.springframework.beans.factory.support.BeanDefinitionBuilder; diff --git a/spring-integration-twitter/src/main/java/org/springframework/integration/twitter/config/DirectMessageInboundEndpointParser.java b/spring-integration-twitter/src/main/java/org/springframework/integration/twitter/config/DirectMessageInboundEndpointParser.java index e8689282d7..5f8d48c739 100644 --- a/spring-integration-twitter/src/main/java/org/springframework/integration/twitter/config/DirectMessageInboundEndpointParser.java +++ b/spring-integration-twitter/src/main/java/org/springframework/integration/twitter/config/DirectMessageInboundEndpointParser.java @@ -1,3 +1,18 @@ +/* + * Copyright 2010 the original author or authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.integration.twitter.config; import org.springframework.beans.factory.support.BeanDefinitionBuilder; diff --git a/spring-integration-twitter/src/main/java/org/springframework/integration/twitter/config/DirectMessageOutboundEndpointParser.java b/spring-integration-twitter/src/main/java/org/springframework/integration/twitter/config/DirectMessageOutboundEndpointParser.java index ff26319eef..5aa1b60c99 100644 --- a/spring-integration-twitter/src/main/java/org/springframework/integration/twitter/config/DirectMessageOutboundEndpointParser.java +++ b/spring-integration-twitter/src/main/java/org/springframework/integration/twitter/config/DirectMessageOutboundEndpointParser.java @@ -1,3 +1,18 @@ +/* + * Copyright 2010 the original author or authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.integration.twitter.config; import org.springframework.beans.factory.support.AbstractBeanDefinition; diff --git a/spring-integration-twitter/src/main/java/org/springframework/integration/twitter/config/MentionInboundEndpointParser.java b/spring-integration-twitter/src/main/java/org/springframework/integration/twitter/config/MentionInboundEndpointParser.java index dec4eef6e0..51f14c46d2 100644 --- a/spring-integration-twitter/src/main/java/org/springframework/integration/twitter/config/MentionInboundEndpointParser.java +++ b/spring-integration-twitter/src/main/java/org/springframework/integration/twitter/config/MentionInboundEndpointParser.java @@ -1,3 +1,18 @@ +/* + * Copyright 2010 the original author or authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.integration.twitter.config; import org.springframework.beans.factory.support.BeanDefinitionBuilder; diff --git a/spring-integration-twitter/src/main/java/org/springframework/integration/twitter/config/UpdatedStatusInboundEndpointParser.java b/spring-integration-twitter/src/main/java/org/springframework/integration/twitter/config/UpdatedStatusInboundEndpointParser.java index 644c3e347b..9432db6a15 100644 --- a/spring-integration-twitter/src/main/java/org/springframework/integration/twitter/config/UpdatedStatusInboundEndpointParser.java +++ b/spring-integration-twitter/src/main/java/org/springframework/integration/twitter/config/UpdatedStatusInboundEndpointParser.java @@ -1,3 +1,18 @@ +/* + * Copyright 2010 the original author or authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.integration.twitter.config; import org.springframework.beans.factory.support.BeanDefinitionBuilder; diff --git a/spring-integration-twitter/src/main/java/org/springframework/integration/twitter/config/UpdatedStatusOutboundEndpointParser.java b/spring-integration-twitter/src/main/java/org/springframework/integration/twitter/config/UpdatedStatusOutboundEndpointParser.java index e774aea9df..4ecbfff925 100644 --- a/spring-integration-twitter/src/main/java/org/springframework/integration/twitter/config/UpdatedStatusOutboundEndpointParser.java +++ b/spring-integration-twitter/src/main/java/org/springframework/integration/twitter/config/UpdatedStatusOutboundEndpointParser.java @@ -1,3 +1,18 @@ +/* + * Copyright 2010 the original author or authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.integration.twitter.config; import org.springframework.beans.factory.support.AbstractBeanDefinition; diff --git a/spring-integration-twitter/src/main/java/org/springframework/integration/twitter/model/DirectMessage.java b/spring-integration-twitter/src/main/java/org/springframework/integration/twitter/model/DirectMessage.java index 8cdb6e87fd..71c975f249 100644 --- a/spring-integration-twitter/src/main/java/org/springframework/integration/twitter/model/DirectMessage.java +++ b/spring-integration-twitter/src/main/java/org/springframework/integration/twitter/model/DirectMessage.java @@ -1,5 +1,22 @@ +/* + * Copyright 2010 the original author or authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.integration.twitter.model; +import java.util.Date; + /** * Describes a direct-message in twitter. (Also known as a "DM"). *

@@ -10,9 +27,9 @@ package org.springframework.integration.twitter.model; public interface DirectMessage { int getId(); - java.lang.String getText(); + String getText(); - java.util.Date getCreatedAt(); + Date getCreatedAt(); User getSender() ; diff --git a/spring-integration-twitter/src/main/java/org/springframework/integration/twitter/model/GeoLocation.java b/spring-integration-twitter/src/main/java/org/springframework/integration/twitter/model/GeoLocation.java index cebf2b652d..d325c2e447 100644 --- a/spring-integration-twitter/src/main/java/org/springframework/integration/twitter/model/GeoLocation.java +++ b/spring-integration-twitter/src/main/java/org/springframework/integration/twitter/model/GeoLocation.java @@ -1,3 +1,18 @@ +/* + * Copyright 2010 the original author or authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.integration.twitter.model; /** diff --git a/spring-integration-twitter/src/main/java/org/springframework/integration/twitter/model/Status.java b/spring-integration-twitter/src/main/java/org/springframework/integration/twitter/model/Status.java index c740e3fa3b..7cb9f6604d 100644 --- a/spring-integration-twitter/src/main/java/org/springframework/integration/twitter/model/Status.java +++ b/spring-integration-twitter/src/main/java/org/springframework/integration/twitter/model/Status.java @@ -1,5 +1,22 @@ +/* + * Copyright 2010 the original author or authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.integration.twitter.model; +import java.util.Date; + /** * describes a simple status message on twitter. this could be a message * that updates a timeline on behalf of a user, or it could be a message that contains a reply. @@ -9,13 +26,13 @@ package org.springframework.integration.twitter.model; */ public interface Status { - java.util.Date getCreatedAt(); + Date getCreatedAt(); long getId(); - java.lang.String getText(); + String getText(); - java.lang.String getSource(); + String getSource(); boolean isTruncated(); @@ -33,6 +50,6 @@ public interface Status { Status getRetweetedStatus(); - java.lang.String[] getContributors(); + String[] getContributors(); } diff --git a/spring-integration-twitter/src/main/java/org/springframework/integration/twitter/model/Twitter4jDirectMessageImpl.java b/spring-integration-twitter/src/main/java/org/springframework/integration/twitter/model/Twitter4jDirectMessage.java similarity index 53% rename from spring-integration-twitter/src/main/java/org/springframework/integration/twitter/model/Twitter4jDirectMessageImpl.java rename to spring-integration-twitter/src/main/java/org/springframework/integration/twitter/model/Twitter4jDirectMessage.java index f772190886..f172fcd50d 100644 --- a/spring-integration-twitter/src/main/java/org/springframework/integration/twitter/model/Twitter4jDirectMessageImpl.java +++ b/spring-integration-twitter/src/main/java/org/springframework/integration/twitter/model/Twitter4jDirectMessage.java @@ -1,3 +1,18 @@ +/* + * Copyright 2010 the original author or authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.integration.twitter.model; import twitter4j.DirectMessage; @@ -11,10 +26,10 @@ import java.util.Date; * * @author Josh Long */ -public class Twitter4jDirectMessageImpl implements org.springframework.integration.twitter.model.DirectMessage { +public class Twitter4jDirectMessage implements org.springframework.integration.twitter.model.DirectMessage { private DirectMessage directMessage; - public Twitter4jDirectMessageImpl(DirectMessage directMessage) { + public Twitter4jDirectMessage(DirectMessage directMessage) { this.directMessage = directMessage; } @@ -27,11 +42,11 @@ public class Twitter4jDirectMessageImpl implements org.springframework.integrati } public User getSender() { - return new Twitter4jUserImpl(this.directMessage.getSender()); + return new Twitter4jUser(this.directMessage.getSender()); } public User getRecipient() { - return new Twitter4jUserImpl(this.directMessage.getRecipient()); + return new Twitter4jUser(this.directMessage.getRecipient()); } public String getText() { diff --git a/spring-integration-twitter/src/main/java/org/springframework/integration/twitter/model/Twitter4jGeoLocation.java b/spring-integration-twitter/src/main/java/org/springframework/integration/twitter/model/Twitter4jGeoLocation.java new file mode 100644 index 0000000000..8c7ed1108b --- /dev/null +++ b/spring-integration-twitter/src/main/java/org/springframework/integration/twitter/model/Twitter4jGeoLocation.java @@ -0,0 +1,45 @@ +/* + * Copyright 2010 the original author or authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.springframework.integration.twitter.model; + +/** + * Implements a notion of GeoLocation that forwards calls to {@link twitter4j.GeoLocation} instance + * + * @author Josh Long + */ +public class Twitter4jGeoLocation implements GeoLocation { + + private twitter4j.GeoLocation geoLocation; + + public twitter4j.GeoLocation getGeoLocation() { + return this.geoLocation; + } + public Twitter4jGeoLocation(double lat, double lon){ + this.geoLocation = new twitter4j.GeoLocation(lat,lon); + } + public Twitter4jGeoLocation(twitter4j.GeoLocation gl) { + this.geoLocation = gl; + } + + public double getLongitude() { + return this.geoLocation.getLongitude(); + } + + public double getLatitude() { + return this.geoLocation.getLatitude(); + } + +} diff --git a/spring-integration-twitter/src/main/java/org/springframework/integration/twitter/model/Twitter4jGeoLocationImpl.java b/spring-integration-twitter/src/main/java/org/springframework/integration/twitter/model/Twitter4jGeoLocationImpl.java deleted file mode 100644 index 35414a201f..0000000000 --- a/spring-integration-twitter/src/main/java/org/springframework/integration/twitter/model/Twitter4jGeoLocationImpl.java +++ /dev/null @@ -1,30 +0,0 @@ -package org.springframework.integration.twitter.model; - -/** - * Implements a notion of GeoLocation that forwards calls to {@link twitter4j.GeoLocation} instance - * - * @author Josh Long - */ -public class Twitter4jGeoLocationImpl implements GeoLocation { - - private twitter4j.GeoLocation geoLocation; - - public twitter4j.GeoLocation getGeoLocation() { - return this.geoLocation; - } - public Twitter4jGeoLocationImpl(double lat, double lon){ - this.geoLocation = new twitter4j.GeoLocation(lat,lon); - } - public Twitter4jGeoLocationImpl(twitter4j.GeoLocation gl) { - this.geoLocation = gl; - } - - public double getLongitude() { - return this.geoLocation.getLongitude(); - } - - public double getLatitude() { - return this.geoLocation.getLatitude(); - } - -} diff --git a/spring-integration-twitter/src/main/java/org/springframework/integration/twitter/model/Twitter4jStatusImpl.java b/spring-integration-twitter/src/main/java/org/springframework/integration/twitter/model/Twitter4jStatus.java similarity index 58% rename from spring-integration-twitter/src/main/java/org/springframework/integration/twitter/model/Twitter4jStatusImpl.java rename to spring-integration-twitter/src/main/java/org/springframework/integration/twitter/model/Twitter4jStatus.java index 8f67168377..5de0d327d3 100644 --- a/spring-integration-twitter/src/main/java/org/springframework/integration/twitter/model/Twitter4jStatusImpl.java +++ b/spring-integration-twitter/src/main/java/org/springframework/integration/twitter/model/Twitter4jStatus.java @@ -1,3 +1,18 @@ +/* + * Copyright 2010 the original author or authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.integration.twitter.model; import java.util.Date; @@ -9,10 +24,10 @@ import java.util.Date; * * @author Josh Long */ -public class Twitter4jStatusImpl implements Status { +public class Twitter4jStatus implements Status { private twitter4j.Status status; - public Twitter4jStatusImpl(twitter4j.Status s) { + public Twitter4jStatus(twitter4j.Status s) { this.status = s; } @@ -53,7 +68,7 @@ public class Twitter4jStatusImpl implements Status { } public User getUser() { - return new Twitter4jUserImpl(this.status.getUser()); + return new Twitter4jUser(this.status.getUser()); } public boolean isRetweet() { @@ -61,7 +76,7 @@ public class Twitter4jStatusImpl implements Status { } public Status getRetweetedStatus() { - return new Twitter4jStatusImpl(this.status.getRetweetedStatus()); + return new Twitter4jStatus(this.status.getRetweetedStatus()); } public String[] getContributors() { diff --git a/spring-integration-twitter/src/main/java/org/springframework/integration/twitter/model/Twitter4jUserImpl.java b/spring-integration-twitter/src/main/java/org/springframework/integration/twitter/model/Twitter4jUser.java similarity index 55% rename from spring-integration-twitter/src/main/java/org/springframework/integration/twitter/model/Twitter4jUserImpl.java rename to spring-integration-twitter/src/main/java/org/springframework/integration/twitter/model/Twitter4jUser.java index d7629c2b70..e85e17f0d9 100644 --- a/spring-integration-twitter/src/main/java/org/springframework/integration/twitter/model/Twitter4jUserImpl.java +++ b/spring-integration-twitter/src/main/java/org/springframework/integration/twitter/model/Twitter4jUser.java @@ -1,3 +1,18 @@ +/* + * Copyright 2010 the original author or authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.integration.twitter.model; import twitter4j.User; @@ -10,11 +25,11 @@ import java.net.URL; * * @author Josh Long */ -public class Twitter4jUserImpl implements org.springframework.integration.twitter.model.User { +public class Twitter4jUser implements org.springframework.integration.twitter.model.User { private twitter4j.User user; - public Twitter4jUserImpl(User u) { + public Twitter4jUser(User u) { this.user = u; } diff --git a/spring-integration-twitter/src/main/java/org/springframework/integration/twitter/model/User.java b/spring-integration-twitter/src/main/java/org/springframework/integration/twitter/model/User.java index 09eae8f495..c8a927a059 100644 --- a/spring-integration-twitter/src/main/java/org/springframework/integration/twitter/model/User.java +++ b/spring-integration-twitter/src/main/java/org/springframework/integration/twitter/model/User.java @@ -1,3 +1,18 @@ +/* + * Copyright 2010 the original author or authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.springframework.integration.twitter.model; diff --git a/spring-integration-twitter/src/test/java/org/springframework/integration/twitter/TestSendingDMsUsingNamespace.java b/spring-integration-twitter/src/test/java/org/springframework/integration/twitter/TestSendingDMsUsingNamespace.java index 6a1e14b968..a55fb942b2 100644 --- a/spring-integration-twitter/src/test/java/org/springframework/integration/twitter/TestSendingDMsUsingNamespace.java +++ b/spring-integration-twitter/src/test/java/org/springframework/integration/twitter/TestSendingDMsUsingNamespace.java @@ -20,11 +20,10 @@ import org.junit.Ignore; import org.junit.Test; import org.springframework.beans.factory.annotation.Value; -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.Twitter4jGeoLocationImpl; +import org.springframework.integration.twitter.model.Twitter4jGeoLocation; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.AbstractJUnit4SpringContextTests; import org.springframework.util.Assert; @@ -48,7 +47,7 @@ public class TestSendingDMsUsingNamespace extends AbstractJUnit4SpringContextTes String dmUsr = System.getProperties().getProperty("twitter.dm.user"); Assert.notNull( dmUsr , "the DM user's null"); MessageBuilder mb = MessageBuilder.withPayload("'Hello world!', from the Spring Integration outbound Twitter adapter") - .setHeader(TwitterHeaders.TWITTER_GEOLOCATION, new Twitter4jGeoLocationImpl(-76.226823, 23.642465)) // antarctica + .setHeader(TwitterHeaders.TWITTER_GEOLOCATION, new Twitter4jGeoLocation(-76.226823, 23.642465)) // antarctica .setHeader(TwitterHeaders.TWITTER_DISPLAY_COORDINATES, true); if (StringUtils.hasText(dmUsr)) { diff --git a/spring-integration-twitter/src/test/java/org/springframework/integration/twitter/TestSendingUpdatesUsingNamespace.java b/spring-integration-twitter/src/test/java/org/springframework/integration/twitter/TestSendingUpdatesUsingNamespace.java index 4788fddde5..385b99c2c0 100644 --- a/spring-integration-twitter/src/test/java/org/springframework/integration/twitter/TestSendingUpdatesUsingNamespace.java +++ b/spring-integration-twitter/src/test/java/org/springframework/integration/twitter/TestSendingUpdatesUsingNamespace.java @@ -23,7 +23,7 @@ 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.Twitter4jGeoLocationImpl; +import org.springframework.integration.twitter.model.Twitter4jGeoLocation; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.AbstractJUnit4SpringContextTests; @@ -42,7 +42,7 @@ public class TestSendingUpdatesUsingNamespace extends AbstractJUnit4SpringContex public void testSendingATweet() throws Throwable { MessageBuilder mb = MessageBuilder.withPayload("simple test demonstrating the ability to encode location information") .setHeader(TwitterHeaders.TWITTER_IN_REPLY_TO_STATUS_ID, 21927437001L) - .setHeader(TwitterHeaders.TWITTER_GEOLOCATION, new Twitter4jGeoLocationImpl(-76.226823, 23.642465)) // antarctica + .setHeader(TwitterHeaders.TWITTER_GEOLOCATION, new Twitter4jGeoLocation(-76.226823, 23.642465)) // antarctica .setHeader(TwitterHeaders.TWITTER_DISPLAY_COORDINATES, true); Message m = mb.build(); this.messagingTemplate.send(this.channel, m);