Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

StringUtil.split() の修正案 #4

Merged
5 commits merged into from Nov 17, 2010
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
@@ -1,4 +1,5 @@
target/*
twitter4j.properties
twitter4j-httpclient-support/target/*
twitter4j-core/target/*
twitter4j-core/src/test/resources/xauth-test.properties
Expand Down
9 changes: 9 additions & 0 deletions twitter4j-core/src/main/java/twitter4j/AsyncTwitter.java
Expand Up @@ -1727,6 +1727,15 @@ public void invoke(TwitterListener listener) throws TwitterException {
}
});
}

public void createPlace(final String name, final String containedWithin, final String token
, final GeoLocation location, final String streetAddress) {
getDispatcher().invokeLater(new AsyncTask(CREATE_PLACE, listener) {
public void invoke(TwitterListener listener) throws TwitterException {
listener.createdPlace(twitter.createPlace(name, containedWithin, token, location, streetAddress));
}
});
}
/* Leagl Resources */
/**
* {@inheritDoc}
Expand Down
20 changes: 19 additions & 1 deletion twitter4j-core/src/main/java/twitter4j/Twitter.java
Expand Up @@ -1613,7 +1613,7 @@ public ResponseList<Place> getSimilarPlaces(GeoLocation location, String name, S
if (null != containedWithin) {
params.add(new HttpParameter("contained_within", containedWithin));
}
if (null != containedWithin) {
if (null != streetAddress) {
params.add(new HttpParameter("attribute:street_address", streetAddress));
}
try {
Expand Down Expand Up @@ -1668,6 +1668,24 @@ public Place getGeoDetails(String id) throws TwitterException {
+ ".json", auth));
}

/**
* {@inheritDoc}
*/
public Place createPlace(String name, String containedWithin, String token, GeoLocation location, String streetAddress) throws TwitterException {
ensureAuthorizationEnabled();
List<HttpParameter> params = new ArrayList<HttpParameter>(3);
params.add(new HttpParameter("name", name));
params.add(new HttpParameter("contained_within", containedWithin));
params.add(new HttpParameter("token", token));
params.add(new HttpParameter("lat", location.getLatitude()));
params.add(new HttpParameter("long", location.getLongitude()));
if (null != streetAddress) {
params.add(new HttpParameter("attribute:street_address", streetAddress));
}
return new PlaceJSONImpl(http.get(conf.getRestBaseURL() + "geo/place.json"
, params.toArray(new HttpParameter[params.size()]), auth));
}

/* Legal Resources */
/**
* {@inheritDoc}
Expand Down
5 changes: 5 additions & 0 deletions twitter4j-core/src/main/java/twitter4j/TwitterAdapter.java
Expand Up @@ -418,6 +418,11 @@ public void gotReverseGeoCode(ResponseList<Place> places){
}
public void gotGeoDetails(Place place) {
}
/**
* @since Twitter4J 2.1.7
*/
public void createdPlace(Place place) {
}

/* Legal Resources*/
/**
Expand Down
4 changes: 2 additions & 2 deletions twitter4j-core/src/main/java/twitter4j/TwitterBase.java
Expand Up @@ -76,14 +76,14 @@ public final boolean isBasicAuthEnabled() {
protected final void ensureAuthorizationEnabled() {
if (!auth.isEnabled()) {
throw new IllegalStateException(
"Neither user ID/password combination nor OAuth consumer key/secret combination supplied");
"Neither user ID/password combination nor OAuth consumer key/secret combination supplied. See http://twitter4j.org/configuration.html for the detail.");
}
}

protected final void ensureBasicEnabled() {
if (!(auth instanceof BasicAuthorization)) {
throw new IllegalStateException(
"user ID/password combination not supplied");
"user ID/password combination not supplied. See http://twitter4j.org/configuration.html for the detail.");
}
}

Expand Down
2 changes: 2 additions & 0 deletions twitter4j-core/src/main/java/twitter4j/TwitterListener.java
Expand Up @@ -371,6 +371,7 @@ public interface TwitterListener {
void gotNearByPlaces(ResponseList<Place> places);
void gotReverseGeoCode(ResponseList<Place> places);
void gotGeoDetails(Place place);
void createdPlace(Place place);

/* Legal Resources*/

Expand Down Expand Up @@ -515,6 +516,7 @@ public interface TwitterListener {
TwitterMethod NEAR_BY_PLACES = TwitterMethod.NEAR_BY_PLACES;
TwitterMethod REVERSE_GEO_CODE = TwitterMethod.REVERSE_GEO_CODE;
TwitterMethod GEO_DETAILS = TwitterMethod.GEO_DETAILS;
TwitterMethod CREATE_PLACE = TwitterMethod.CREATE_PLACE;

/* Regal Resources */
TwitterMethod TERMS_OF_SERVICE = TwitterMethod.TERMS_OF_SERVICE;
Expand Down
1 change: 1 addition & 0 deletions twitter4j-core/src/main/java/twitter4j/TwitterMethod.java
Expand Up @@ -207,6 +207,7 @@ private Object readResolve() throws ObjectStreamException {
public static final TwitterMethod NEAR_BY_PLACES = new TwitterMethod("NEAR_BY_PLACES");
public static final TwitterMethod REVERSE_GEO_CODE = new TwitterMethod("REVERSE_GEO_CODE");
public static final TwitterMethod GEO_DETAILS = new TwitterMethod("GEO_DETAILS");
public static final TwitterMethod CREATE_PLACE = new TwitterMethod("CREATE_PLACE");

/* Legal Resources */
public static final TwitterMethod TERMS_OF_SERVICE = new TwitterMethod("TERMS_OF_SERVICE");
Expand Down
Binary file not shown.
16 changes: 16 additions & 0 deletions twitter4j-core/src/main/java/twitter4j/api/GeoMethods.java
Expand Up @@ -96,4 +96,20 @@ public interface GeoMethods {
* @since Twitter4J 2.1.1
*/
Place getGeoDetails(String id) throws TwitterException;

/**
* Creates a new place at the given latitude and longitude.
* <br>This method calls http://api.twitter.com/1/geo/place.json
* @param name The name a place is known as.
* @param containedWithin The place_id within which the new place can be found. Try and be as close as possible with the containing place. For example, for a room in a building, set the contained_within as the building place_id.
* @param token The token found in the response from geo/similar_places.
* @param location The latitude and longitude the place is located at.
* @param streetAddress optional: This parameter searches for places which have this given street address. There are other well-known, and application specific attributes available. Custom attributes are also permitted. Learn more about Place Attributes.
* @return the created place
* @throws TwitterException when Twitter service or network is unavailable
* @see <a href="http://dev.twitter.com/doc/post/geo/place">POST geo/place | dev.twitter.com</a>
* @since Twitter4J 2.1.7
*/
Place createPlace(String name, String containedWithin, String token, GeoLocation location, String streetAddress)
throws TwitterException;
}
Binary file modified twitter4j-core/src/main/java/twitter4j/api/GeoMethodsAsync.java
Binary file not shown.
Binary file not shown.
5 changes: 5 additions & 0 deletions twitter4j-core/src/test/java/twitter4j/AsyncTwitterTest.java
Expand Up @@ -919,6 +919,11 @@ public void gotGeoDetails(Place place){
notifyResponse();
}

public void createdPlace(Place place) {
this.place = place;
notifyResponse();
}

/* Legal Resources */
/**
* @since Twitter4J 2.1.7
Expand Down
4 changes: 2 additions & 2 deletions twitter4j-examples/bin/asyncUpdate.cmd
Expand Up @@ -2,7 +2,7 @@ echo off
SETLOCAL enabledelayedexpansion
call setEnv.cmd

echo %JAVA% %MEM_ARGS% -classpath "%CLASSPATH%" twitter4j.examples.AsyncUpdate %*
"%JAVA%" %MEM_ARGS% -classpath "%CLASSPATH%" twitter4j.examples.AsyncUpdate %*
echo %JAVA% %MEM_ARGS% -classpath "%CLASSPATH%" twitter4j.examples.async.AsyncUpdate %*
"%JAVA%" %MEM_ARGS% -classpath "%CLASSPATH%" twitter4j.examples.async.AsyncUpdate %*

ENDLOCAL
4 changes: 2 additions & 2 deletions twitter4j-examples/bin/asyncUpdate.sh
@@ -1,5 +1,5 @@
#/bin/sh
. ./setEnv.sh

echo $JAVA_HOME/bin/java $MEM_ARGS -cp $CLASSPATH twitter4j.examples.AsyncUpdate "$@"
$JAVA_HOME/bin/java $MEM_ARGS -cp $CLASSPATH twitter4j.examples.AsyncUpdate "$@"
echo $JAVA_HOME/bin/java $MEM_ARGS -cp $CLASSPATH twitter4j.examples.async.AsyncUpdate "$@"
$JAVA_HOME/bin/java $MEM_ARGS -cp $CLASSPATH twitter4j.examples.async.AsyncUpdate "$@"
4 changes: 2 additions & 2 deletions twitter4j-examples/bin/feedMonitor.cmd
Expand Up @@ -2,7 +2,7 @@ echo off
SETLOCAL enabledelayedexpansion
call setEnv.cmd

echo %JAVA% %MEM_ARGS% -classpath "%CLASSPATH%" twitter4j.examples.FeedMonitor %*
"%JAVA%" %MEM_ARGS% -classpath "%CLASSPATH%" twitter4j.examples.FeedMonitor %*
echo %JAVA% %MEM_ARGS% -classpath "%CLASSPATH%" twitter4j.examples.misc.FeedMonitor %*
"%JAVA%" %MEM_ARGS% -classpath "%CLASSPATH%" twitter4j.examples.misc.FeedMonitor %*

ENDLOCAL
4 changes: 2 additions & 2 deletions twitter4j-examples/bin/feedMonitor.sh
@@ -1,5 +1,5 @@
#/bin/sh
. ./setEnv.sh

echo $JAVA_HOME/bin/java $MEM_ARGS -cp $CLASSPATH twitter4j.examples.FeedMonitor "$@"
$JAVA_HOME/bin/java $MEM_ARGS -cp $CLASSPATH twitter4j.examples.FeedMonitor "$@"
echo $JAVA_HOME/bin/java $MEM_ARGS -cp $CLASSPATH twitter4j.examples.misc.FeedMonitor "$@"
$JAVA_HOME/bin/java $MEM_ARGS -cp $CLASSPATH twitter4j.examples.misc.FeedMonitor "$@"
Expand Up @@ -2,7 +2,7 @@ echo off
SETLOCAL enabledelayedexpansion
call setEnv.cmd

echo %JAVA% %MEM_ARGS% -classpath "%CLASSPATH%" twitter4j.examples.GetTimelines %*
"%JAVA%" %MEM_ARGS% -classpath "%CLASSPATH%" twitter4j.examples.GetTimelines %*
echo %JAVA% %MEM_ARGS% -classpath "%CLASSPATH%" twitter4j.examples.oauth.GetAccessToken %*
"%JAVA%" %MEM_ARGS% -classpath "%CLASSPATH%" twitter4j.examples.oauth.GetAccessToken %*

ENDLOCAL
@@ -1,5 +1,5 @@
#/bin/sh
. ./setEnv.sh

echo $JAVA_HOME/bin/java $MEM_ARGS -cp $CLASSPATH twitter4j.examples.GetTimelines "$@"
$JAVA_HOME/bin/java $MEM_ARGS -cp $CLASSPATH twitter4j.examples.GetTimelines "$@"
echo $JAVA_HOME/bin/java $MEM_ARGS -cp $CLASSPATH twitter4j.examples.oauth.GetAccessToken "$@"
$JAVA_HOME/bin/java $MEM_ARGS -cp $CLASSPATH twitter4j.examples.oauth.GetAccessToken "$@"
4 changes: 2 additions & 2 deletions twitter4j-examples/bin/getDirectMessages.cmd
Expand Up @@ -2,7 +2,7 @@ echo off
SETLOCAL enabledelayedexpansion
call setEnv.cmd

echo %JAVA% %MEM_ARGS% -classpath "%CLASSPATH%" twitter4j.examples.GetDirectMessages %*
"%JAVA%" %MEM_ARGS% -classpath "%CLASSPATH%" twitter4j.examples.GetDirectMessages %*
echo %JAVA% %MEM_ARGS% -classpath "%CLASSPATH%" twitter4j.examples.directmessage.GetDirectMessages %*
"%JAVA%" %MEM_ARGS% -classpath "%CLASSPATH%" twitter4j.examples.directmessage.GetDirectMessages %*

ENDLOCAL
4 changes: 2 additions & 2 deletions twitter4j-examples/bin/getDirectMessages.sh
@@ -1,5 +1,5 @@
#/bin/sh
. ./setEnv.sh

echo $JAVA_HOME/bin/java $MEM_ARGS -cp $CLASSPATH twitter4j.examples.GetDirectMessages "$@"
$JAVA_HOME/bin/java $MEM_ARGS -cp $CLASSPATH twitter4j.examples.GetDirectMessages "$@"
echo $JAVA_HOME/bin/java $MEM_ARGS -cp $CLASSPATH twitter4j.examples.directmessage.GetDirectMessages "$@"
$JAVA_HOME/bin/java $MEM_ARGS -cp $CLASSPATH twitter4j.examples.directmessage.GetDirectMessages "$@"
8 changes: 8 additions & 0 deletions twitter4j-examples/bin/getHomeTimeline.cmd
@@ -0,0 +1,8 @@
echo off
SETLOCAL enabledelayedexpansion
call setEnv.cmd

echo %JAVA% %MEM_ARGS% -classpath "%CLASSPATH%" twitter4j.examples.timeline.GetHomeTimeline %*
"%JAVA%" %MEM_ARGS% -classpath "%CLASSPATH%" twitter4j.examples.timeline.GetHomeTimeline %*

ENDLOCAL
5 changes: 5 additions & 0 deletions twitter4j-examples/bin/getHomeTimeline.sh
@@ -0,0 +1,5 @@
#/bin/sh
. ./setEnv.sh

echo $JAVA_HOME/bin/java $MEM_ARGS -cp $CLASSPATH twitter4j.examples.timeline.GetHomeTimeline "$@"
$JAVA_HOME/bin/java $MEM_ARGS -cp $CLASSPATH twitter4j.examples.timeline.GetHomeTimeline "$@"
8 changes: 8 additions & 0 deletions twitter4j-examples/bin/getMentions.cmd
@@ -0,0 +1,8 @@
echo off
SETLOCAL enabledelayedexpansion
call setEnv.cmd

echo %JAVA% %MEM_ARGS% -classpath "%CLASSPATH%" twitter4j.examples.timeline.GetMentions %*
"%JAVA%" %MEM_ARGS% -classpath "%CLASSPATH%" twitter4j.examples.timeline.GetMentions %*

ENDLOCAL
5 changes: 5 additions & 0 deletions twitter4j-examples/bin/getMentions.sh
@@ -0,0 +1,5 @@
#/bin/sh
. ./setEnv.sh

echo $JAVA_HOME/bin/java $MEM_ARGS -cp $CLASSPATH twitter4j.examples.timeline.GetMentions "$@"
$JAVA_HOME/bin/java $MEM_ARGS -cp $CLASSPATH twitter4j.examples.timeline.GetMentions "$@"
8 changes: 8 additions & 0 deletions twitter4j-examples/bin/getPublicTimeline.cmd
@@ -0,0 +1,8 @@
echo off
SETLOCAL enabledelayedexpansion
call setEnv.cmd

echo %JAVA% %MEM_ARGS% -classpath "%CLASSPATH%" twitter4j.examples.timeline.GetPublicTimeline %*
"%JAVA%" %MEM_ARGS% -classpath "%CLASSPATH%" twitter4j.examples.timeline.GetPublicTimeline %*

ENDLOCAL
5 changes: 5 additions & 0 deletions twitter4j-examples/bin/getPublicTimeline.sh
@@ -0,0 +1,5 @@
#/bin/sh
. ./setEnv.sh

echo $JAVA_HOME/bin/java $MEM_ARGS -cp $CLASSPATH twitter4j.examples.timeline.GetPublicTimeline "$@"
$JAVA_HOME/bin/java $MEM_ARGS -cp $CLASSPATH twitter4j.examples.timeline.GetPublicTimeline "$@"
8 changes: 8 additions & 0 deletions twitter4j-examples/bin/getRetweetedByMe.cmd
@@ -0,0 +1,8 @@
echo off
SETLOCAL enabledelayedexpansion
call setEnv.cmd

echo %JAVA% %MEM_ARGS% -classpath "%CLASSPATH%" twitter4j.examples.timeline.GetRetweetedByMe %*
"%JAVA%" %MEM_ARGS% -classpath "%CLASSPATH%" twitter4j.examples.timeline.GetRetweetedByMe %*

ENDLOCAL
5 changes: 5 additions & 0 deletions twitter4j-examples/bin/getRetweetedByMe.sh
@@ -0,0 +1,5 @@
#/bin/sh
. ./setEnv.sh

echo $JAVA_HOME/bin/java $MEM_ARGS -cp $CLASSPATH twitter4j.examples.timeline.GetRetweetedByMe "$@"
$JAVA_HOME/bin/java $MEM_ARGS -cp $CLASSPATH twitter4j.examples.timeline.GetRetweetedByMe "$@"
8 changes: 8 additions & 0 deletions twitter4j-examples/bin/getRetweetsOfMe.cmd
@@ -0,0 +1,8 @@
echo off
SETLOCAL enabledelayedexpansion
call setEnv.cmd

echo %JAVA% %MEM_ARGS% -classpath "%CLASSPATH%" twitter4j.examples.timeline.GetRetweetsOfMe %*
"%JAVA%" %MEM_ARGS% -classpath "%CLASSPATH%" twitter4j.examples.timeline.GetRetweetsOfMe %*

ENDLOCAL
5 changes: 5 additions & 0 deletions twitter4j-examples/bin/getRetweetsOfMe.sh
@@ -0,0 +1,5 @@
#/bin/sh
. ./setEnv.sh

echo $JAVA_HOME/bin/java $MEM_ARGS -cp $CLASSPATH twitter4j.examples.timeline.GetRetweetsOfMe "$@"
$JAVA_HOME/bin/java $MEM_ARGS -cp $CLASSPATH twitter4j.examples.timeline.GetRetweetsOfMe "$@"
8 changes: 8 additions & 0 deletions twitter4j-examples/bin/getUserTimeline.cmd
@@ -0,0 +1,8 @@
echo off
SETLOCAL enabledelayedexpansion
call setEnv.cmd

echo %JAVA% %MEM_ARGS% -classpath "%CLASSPATH%" twitter4j.examples.timeline.GetUserTimeline %*
"%JAVA%" %MEM_ARGS% -classpath "%CLASSPATH%" twitter4j.examples.timeline.GetUserTimeline %*

ENDLOCAL
5 changes: 5 additions & 0 deletions twitter4j-examples/bin/getUserTimeline.sh
@@ -0,0 +1,5 @@
#/bin/sh
. ./setEnv.sh

echo $JAVA_HOME/bin/java $MEM_ARGS -cp $CLASSPATH twitter4j.examples.timeline.GetUserTimeline "$@"
$JAVA_HOME/bin/java $MEM_ARGS -cp $CLASSPATH twitter4j.examples.timeline.GetUserTimeline "$@"
32 changes: 32 additions & 0 deletions twitter4j-examples/bin/logback.xml
@@ -0,0 +1,32 @@
<configuration>
<appender name="LOG" class="ch.qos.logback.core.rolling.RollingFileAppender">
<File>./twitter4j.log</File>
<Append>false</Append>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<FileNamePattern>twitter4j.%d{yyyy-MM-dd}.log</FileNamePattern>
</rollingPolicy>
<MinIndex>1</MinIndex>
<MaxIndex>10</MaxIndex>
<!--triggeringPolicy class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy">
<MaxFileSize>10MB</MaxFileSize>
</triggeringPolicy-->
<ImmediateFlush>true</ImmediateFlush>
<layout class="ch.qos.logback.classic.PatternLayout">
<pattern>%d{HH:mm:ss} [%thread] %-5level %logger %msg%n</pattern>
</layout>
</appender>

<appender name="STDOUT"
class="ch.qos.logback.core.ConsoleAppender">
<layout class="ch.qos.logback.classic.PatternLayout">
<pattern>%d{HH:mm:ss} [%thread] %-5level %logger %msg%n</pattern>
</layout>
</appender>
<root>
<level value="info" />
<!--
<appender-ref ref="LOG" />
-->
<appender-ref ref="STDOUT" />
</root>
</configuration>
4 changes: 2 additions & 2 deletions twitter4j-examples/bin/printFilterStream.cmd
Expand Up @@ -2,7 +2,7 @@ echo off
SETLOCAL enabledelayedexpansion
call setEnv.cmd

echo %JAVA% %MEM_ARGS% -classpath "%CLASSPATH%" twitter4j.examples.PrintFiltetrStream %*
"%JAVA%" %MEM_ARGS% -classpath "%CLASSPATH%" twitter4j.examples.PrintFilterStream %*
echo %JAVA% %MEM_ARGS% -classpath "%CLASSPATH%" twitter4j.examples.stream.PrintFiltetrStream %*
"%JAVA%" %MEM_ARGS% -classpath "%CLASSPATH%" twitter4j.examples.stream.PrintFilterStream %*

ENDLOCAL
4 changes: 2 additions & 2 deletions twitter4j-examples/bin/printFilterStream.sh
@@ -1,5 +1,5 @@
#/bin/sh
. ./setEnv.sh

echo $JAVA_HOME/bin/java $MEM_ARGS -cp $CLASSPATH twitter4j.examples.PrintFilterStream $@
$JAVA_HOME/bin/java $MEM_ARGS -cp $CLASSPATH twitter4j.examples.PrintFilterStream $@
echo $JAVA_HOME/bin/java $MEM_ARGS -cp $CLASSPATH twitter4j.examples.stream.PrintFilterStream $@
$JAVA_HOME/bin/java $MEM_ARGS -cp $CLASSPATH twitter4j.examples.stream.PrintFilterStream $@
4 changes: 2 additions & 2 deletions twitter4j-examples/bin/printSampleStream.cmd
Expand Up @@ -2,7 +2,7 @@ echo off
SETLOCAL enabledelayedexpansion
call setEnv.cmd

echo %JAVA% %MEM_ARGS% -classpath "%CLASSPATH%" twitter4j.examples.PrintSampleStream %*
"%JAVA%" %MEM_ARGS% -classpath "%CLASSPATH%" twitter4j.examples.PrintSampleStream %*
echo %JAVA% %MEM_ARGS% -classpath "%CLASSPATH%" twitter4j.examples.stream.PrintSampleStream %*
"%JAVA%" %MEM_ARGS% -classpath "%CLASSPATH%" twitter4j.examples.stream.PrintSampleStream %*

ENDLOCAL