http://android.keicode.com/basics/ui-listview-item-color.php
-[\8b\9e\95l\8b}\8ds\90ü] 00:27
- \92x\89\84\82È\82µ 2012/03/15 :08
-\81\9bBigTable
-http://www.atmarkit.co.jp/fjava/rensai4/gaej02/gaej02_3.html
+
+== \83L\83\83\83v\83`\83\83
+[\83L\83\83\83v\83`\83\83]\82ð\8c©\82é\81B
\ No newline at end of file
!ENTRY com.google.appengine.eclipse.core 1 0 2012-03-24 18:06:33.226
!MESSAGE TrainDelayBot successfully deployed to Google App Engine
+!SESSION 2012-04-09 19:40:26.250 -----------------------------------------------
+eclipse.buildId=I20110613-1736
+java.version=1.6.0_29
+java.vendor=Apple Inc.
+BootLoader constants: OS=macosx, ARCH=x86_64, WS=cocoa, NL=ja_JP
+Framework arguments: -product org.eclipse.epp.package.java.product -product org.eclipse.epp.package.java.product -keyring /Users/yuji/.eclipse_keyring -showlocation
+Command-line arguments: -os macosx -ws cocoa -arch x86_64 -product org.eclipse.epp.package.java.product -data /Users/yuji/prog/workspaces/TrainDelayBot/source/workspace -product org.eclipse.epp.package.java.product -keyring /Users/yuji/.eclipse_keyring -showlocation
+
+!ENTRY org.eclipse.core.net 1 0 2012-04-09 19:40:29.301
+!MESSAGE System property http.nonProxyHosts has been set to local|*.local|169.254/16|*.169.254/16 by an external source. This value will be overwritten using the values from the preferences
+
+!ENTRY com.google.gwt.eclipse.core 2 0 2012-04-09 19:40:34.875
+!MESSAGE Could not check whether the launch configuration "Test" needs the -XstartOnFirstThread argument, assuming it does
+
+!ENTRY com.google.gwt.eclipse.core 2 0 2012-04-09 19:40:34.966
+!MESSAGE Could not check whether the launch configuration "Test" needs the -XstartOnFirstThread argument, assuming it does
+
+!ENTRY com.google.gwt.eclipse.core 2 0 2012-04-09 19:40:35.063
+!MESSAGE Could not check whether the launch configuration "TrainDelayBot" needs the -XstartOnFirstThread argument, assuming it does
+
+!ENTRY com.google.gwt.eclipse.core 2 0 2012-04-09 19:40:35.118
+!MESSAGE Could not check whether the launch configuration "TrainDelayBot" needs the -XstartOnFirstThread argument, assuming it does
+
+!ENTRY org.eclipse.epp.usagedata.recording 1 0 2012-04-09 19:40:40.532
+!MESSAGE Usage data uploaded to http://udc.eclipse.org/upload.php in 2425 milliseconds.
+!SESSION 2012-04-14 11:30:51.761 -----------------------------------------------
+eclipse.buildId=I20110613-1736
+java.version=1.6.0_31
+java.vendor=Apple Inc.
+BootLoader constants: OS=macosx, ARCH=x86_64, WS=cocoa, NL=ja_JP
+Framework arguments: -product org.eclipse.epp.package.java.product -keyring /Users/yuji/.eclipse_keyring -showlocation
+Command-line arguments: -os macosx -ws cocoa -arch x86_64 -product org.eclipse.epp.package.java.product -keyring /Users/yuji/.eclipse_keyring -showlocation
+
+!ENTRY org.eclipse.core.net 1 0 2012-04-14 11:31:01.499
+!MESSAGE System property http.nonProxyHosts has been set to local|*.local|169.254/16|*.169.254/16 by an external source. This value will be overwritten using the values from the preferences
+
+!ENTRY com.google.gwt.eclipse.core 2 0 2012-04-14 11:31:24.811
+!MESSAGE Could not check whether the launch configuration "Test" needs the -XstartOnFirstThread argument, assuming it does
+
+!ENTRY com.google.gwt.eclipse.core 2 0 2012-04-14 11:31:24.890
+!MESSAGE Could not check whether the launch configuration "Test" needs the -XstartOnFirstThread argument, assuming it does
+
+!ENTRY com.google.gwt.eclipse.core 2 0 2012-04-14 11:31:24.928
+!MESSAGE Could not check whether the launch configuration "TrainDelayBot" needs the -XstartOnFirstThread argument, assuming it does
+
+!ENTRY com.google.gwt.eclipse.core 2 0 2012-04-14 11:31:24.945
+!MESSAGE Could not check whether the launch configuration "TrainDelayBot" needs the -XstartOnFirstThread argument, assuming it does
+
+!ENTRY com.google.appengine.eclipse.core 1 0 2012-04-14 11:33:01.208
+!MESSAGE TrainDelayBot successfully deployed to Google App Engine
--- /dev/null
+{"http://www.google.com/images/icons/product/moderator-32.png":"cache_12","http://api-directory.googleapis.com/icons/gdata-webmaster-32.png":"cache_10","http://api-directory.googleapis.com/icons/gdata-books-32.png":"cache_3","http://www.google.com/images/icons/product/analytics-32.png":"cache_1","http://www.google.com/images/icons/product/customsearch-32.png":"cache_0","http://api-directory.googleapis.com/icons/gdata-spreadsheet-32.png":"cache_9","http://api-directory.googleapis.com/icons/google_calendar_data_lb32.png":"cache_4","http://api-directory.googleapis.com/icons/search-32.png":"cache_15","http://www.google.com/images/icons/product/translate-32.png":"cache_14","http://api-directory.googleapis.com/icons/gdata-contacts-32.png":"cache_6","http://www.google.com/images/icons/product/projecthosting-32.png":"cache_8","http://api-directory.googleapis.com/icons/gdata-finance-32.png":"cache_7"}
+++ /dev/null
-package com.yuji.tdb.twitter;\r
-\r
-import java.text.DateFormat;\r
-import java.text.SimpleDateFormat;\r
-import java.util.ArrayList;\r
-import java.util.Calendar;\r
-import java.util.Date;\r
-import java.util.HashMap;\r
-import java.util.List;\r
-import java.util.Map;\r
-import java.util.TimeZone;\r
-import java.util.logging.Logger;\r
-\r
-import twitter4j.Query;\r
-import twitter4j.QueryResult;\r
-import twitter4j.Status;\r
-import twitter4j.Tweet;\r
-import twitter4j.Twitter;\r
-import twitter4j.TwitterException;\r
-import twitter4j.TwitterFactory;\r
-import twitter4j.auth.AccessToken;\r
-import twitter4j.conf.ConfigurationBuilder;\r
-\r
-import com.yuji.tdb.common.CommonUtil;\r
-import com.yuji.tdb.db.KeyValueDao;\r
-import com.yuji.tdb.db.Train;\r
-import com.yuji.tdb.db.TrainDao;\r
-import com.yuji.tdb.debug.Debug;\r
-import com.yuji.tdb.utility.StringUtility;\r
-\r
-public class TwitterUtil {\r
- private static final Logger log = Logger\r
- .getLogger(TwitterUtil.class.getName());\r
- private static TwitterUtil instance = null;\r
- private static Object obj = new Object();\r
- //private DateFormat df = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");\r
- private DateFormat df = new SimpleDateFormat("HH:mm");\r
- private static List<String> keywords = null;\r
- private int period = 0;\r
- private Map<String, Long> twitTimeList = new HashMap<String, Long>();\r
- \r
- public static TwitterUtil getInstance() {\r
- if (instance == null) {\r
- synchronized (obj) {\r
- if (instance == null) {\r
- instance = new TwitterUtil();\r
- }\r
- }\r
- }\r
- return instance;\r
- }\r
-\r
- private TwitterUtil() {\r
- df.setTimeZone(TimeZone.getTimeZone("JST")); \r
- }\r
-\r
- public void main(String consumerKey, String consumerSecret, AccessToken accessToken) {\r
- try {\r
- ConfigurationBuilder confBuilder = new ConfigurationBuilder();\r
- confBuilder.setDebugEnabled(true).setOAuthConsumerKey(consumerKey)\r
- .setOAuthConsumerSecret(consumerSecret);\r
- TwitterFactory factory = new TwitterFactory(confBuilder.build());\r
- Twitter twitter = factory.getInstance(accessToken);\r
-\r
- List<Train> list = getTrainList();\r
- for (Train train : list){\r
- twite(twitter, train);\r
- }\r
- } catch (TwitterException e) {\r
- // TODO Auto-generated catch block\r
- e.printStackTrace();\r
- log.severe(e.toString());\r
- }\r
- }\r
-\r
- private void twite(Twitter twitter, Train train) throws TwitterException {\r
- Query query = new Query();\r
- //query.setRpp(1000); // TODO\r
- query.setQuery(train.getSearchWord());\r
- QueryResult result = null;\r
- try {\r
- result = twitter.search(query);\r
- }\r
- catch (TwitterException e){\r
- log.severe("" + Debug.getLineNo());\r
- throw e;\r
- }\r
- List<Tweet> tweets = result.getTweets();\r
- \r
- Calendar cal = Calendar.getInstance();\r
- Date date = cal.getTime();\r
- long cur = date.getTime();\r
-\r
- int count = 0;\r
- int hit = 0;\r
- int mhit = 0;\r
- int period = getPeriod();\r
- \r
- int index;\r
- int mindex = 0;\r
- int size = tweets.size();\r
- for (index = 0; index < size; index++) {\r
- Tweet tweet = tweets.get(index);\r
- \r
- Date at = tweet.getCreatedAt();\r
- long t = at.getTime();\r
- \r
- String message = tweet.getText();\r
- \r
- if (t < cur - period * 60 * 1000){\r
- System.out.println("\81~" + tweet.getFromUser() + " - "\r
- + tweet.getText() + at);\r
- continue;\r
- }\r
- hit = filter(message);\r
- if (hit <= 0) {\r
- System.out.println("\81¢" + tweet.getFromUser() + " - "\r
- + tweet.getText() + at);\r
- // \92x\89\84\88È\8aO\82Ì\8f\91\82«\8d\9e\82Ý\r
- continue;\r
- }\r
- if (hit > mhit){\r
- hit = mhit;\r
- mindex = index;\r
- }\r
-\r
- System.out.println("@" + tweet.getFromUser() + " - "\r
- + tweet.getText() + at);\r
- count++;\r
- }\r
-\r
- String message = "[" + train.getName() + "] ";\r
- if (count < train.getCount()){\r
- message += df.format(date) + " \92x\89\84\82È\82µ"; \r
- }\r
- else {\r
- int N = 100;\r
- \r
- String sample = tweets.get(mindex).getText();\r
- sample = CommonUtil.replaceString(sample, "@", "(a)");\r
- sample = StringUtility.parseSubstring(sample, N);\r
- message += df.format(date) + " " + sample + " count=" + count; \r
- }\r
- System.out.println(message); //TODO\r
- \r
- Status status = null;\r
- try {\r
- status = twitter.updateStatus(message); //TODO\r
- }\r
- catch (TwitterException e){\r
- log.severe(Debug.getLineNo() + " " + message);\r
- throw e;\r
- }\r
- }\r
- \r
- private List<Train> getTrainList(){\r
- TrainDao dao = TrainDao.getInstance();\r
- List<Train> list = dao.search();\r
- if (list.size() <= 0){\r
- Train train;\r
- \r
- train = new Train("\8b\9e\95l\93\8c\96k\90ü", "\8b\9e\95l\93\8c\96k", 5);\r
- dao.put(train);\r
- train = new Train("\93\8c\8aC\93¹\90ü", "\93\8c\8aC\93¹", 5);\r
- dao.put(train);\r
- train = new Train("\8b\9e\95l\8b}\8ds\90ü", "\8b\9e\8b}", 5);\r
- dao.put(train);\r
- list = dao.search();\r
- }\r
- return list;\r
- }\r
- \r
- public int filter(String text) {\r
- if (keywords == null) {\r
- keywords = new ArrayList<String>();\r
- keywords.add("\92x\89\84");\r
- keywords.add("\92x\82ê");\r
- keywords.add("\90U\82è\91Ö\82¦");\r
- keywords.add("\90U\91Ö");\r
- keywords.add("\92â\8e~");\r
- keywords.add("\8e\96\8cÌ");\r
- }\r
-\r
- int count = 0;\r
- for (String keyword : keywords) {\r
- if (text.indexOf(keyword) >= 0) {\r
- count++;\r
- }\r
- }\r
- return count;\r
- }\r
- \r
- public int getPeriod(){\r
- if (period <= 0){\r
- KeyValueDao dao = KeyValueDao.getInstance();\r
- period = dao.getInt(KeyValueDao.KEY_SEARCH_PERIOD, 5);\r
- }\r
- return period;\r
- }\r
- \r
- private int getTwitTime(long id){\r
- String key = KeyValueDao.KEY_TWIT_TIME + id;\r
- Long value = (long)twitTimeList.get(key);\r
- if (value == null){\r
- value = 0;\r
- twitTimeList.put(key, value);\r
- }\r
- return value;\r
- }\r
-}\r
+++ /dev/null
-package com.yuji.tdb.twitter;\r
-\r
-import java.text.DateFormat;\r
-import java.text.SimpleDateFormat;\r
-import java.util.ArrayList;\r
-import java.util.Calendar;\r
-import java.util.Date;\r
-import java.util.HashMap;\r
-import java.util.List;\r
-import java.util.Map;\r
-import java.util.TimeZone;\r
-import java.util.logging.Logger;\r
-\r
-import twitter4j.Query;\r
-import twitter4j.QueryResult;\r
-import twitter4j.Status;\r
-import twitter4j.Tweet;\r
-import twitter4j.Twitter;\r
-import twitter4j.TwitterException;\r
-import twitter4j.TwitterFactory;\r
-import twitter4j.auth.AccessToken;\r
-import twitter4j.conf.ConfigurationBuilder;\r
-\r
-import com.yuji.tdb.common.CommonUtil;\r
-import com.yuji.tdb.db.KeyValueDao;\r
-import com.yuji.tdb.db.Train;\r
-import com.yuji.tdb.db.TrainDao;\r
-import com.yuji.tdb.debug.Debug;\r
-import com.yuji.tdb.utility.StringUtility;\r
-\r
-public class TwitterUtil {\r
- private static final Logger log = Logger\r
- .getLogger(TwitterUtil.class.getName());\r
- private static TwitterUtil instance = null;\r
- private static Object obj = new Object();\r
- //private DateFormat df = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");\r
- private DateFormat df = new SimpleDateFormat("HH:mm");\r
- private static List<String> keywords = null;\r
- private long searchPeriod = 0;\r
- private long twitPeriod = 0;\r
- private Map<String, Long> twitTimeList = new HashMap<String, Long>();\r
- \r
- public static TwitterUtil getInstance() {\r
- if (instance == null) {\r
- synchronized (obj) {\r
- if (instance == null) {\r
- instance = new TwitterUtil();\r
- }\r
- }\r
- }\r
- return instance;\r
- }\r
-\r
- private TwitterUtil() {\r
- df.setTimeZone(TimeZone.getTimeZone("JST")); \r
- }\r
-\r
- public void main(String consumerKey, String consumerSecret, AccessToken accessToken) {\r
- try {\r
- ConfigurationBuilder confBuilder = new ConfigurationBuilder();\r
- confBuilder.setDebugEnabled(true).setOAuthConsumerKey(consumerKey)\r
- .setOAuthConsumerSecret(consumerSecret);\r
- TwitterFactory factory = new TwitterFactory(confBuilder.build());\r
- Twitter twitter = factory.getInstance(accessToken);\r
-\r
- List<Train> list = getTrainList();\r
- for (Train train : list){\r
- Calendar cal = Calendar.getInstance();\r
- Date date = cal.getTime();\r
- long cur = date.getTime();\r
-\r
- long id = train.getId();\r
- long t = getTwitTime(id);\r
- long period = getTwitPeriod();\r
-\r
- if (t > 0 && t + period * 60 * 1000 < cur){\r
- continue;\r
- }\r
- twite(twitter, train);\r
- }\r
- } catch (TwitterException e) {\r
- // TODO Auto-generated catch block\r
- e.printStackTrace();\r
- log.severe(e.toString());\r
- }\r
- }\r
-\r
- private void twite(Twitter twitter, Train train) throws TwitterException {\r
- Query query = new Query();\r
- //query.setRpp(1000); // TODO\r
- query.setQuery(train.getSearchWord());\r
- QueryResult result = null;\r
- try {\r
- result = twitter.search(query);\r
- }\r
- catch (TwitterException e){\r
- log.severe("" + Debug.getLineNo());\r
- throw e;\r
- }\r
- List<Tweet> tweets = result.getTweets();\r
- \r
- Calendar cal = Calendar.getInstance();\r
- Date date = cal.getTime();\r
- long cur = date.getTime();\r
-\r
- int count = 0;\r
- int hit = 0;\r
- int mhit = 0;\r
- long period = getSearchPeriod();\r
- long id = train.getId();\r
- \r
- int index;\r
- int mindex = 0;\r
- int size = tweets.size();\r
- for (index = 0; index < size; index++) {\r
- Tweet tweet = tweets.get(index);\r
- \r
- Date at = tweet.getCreatedAt();\r
- long t = at.getTime();\r
- \r
- String message = tweet.getText();\r
- \r
- if (t < cur - period * 60 * 1000){\r
- System.out.println("\81~" + tweet.getFromUser() + " - "\r
- + tweet.getText() + at);\r
- continue;\r
- }\r
- hit = filter(message);\r
- if (hit <= 0) {\r
- System.out.println("\81¢" + tweet.getFromUser() + " - "\r
- + tweet.getText() + at);\r
- // \92x\89\84\88È\8aO\82Ì\8f\91\82«\8d\9e\82Ý\r
- continue;\r
- }\r
- if (hit > mhit){\r
- hit = mhit;\r
- mindex = index;\r
- }\r
-\r
- System.out.println("@" + tweet.getFromUser() + " - "\r
- + tweet.getText() + at);\r
- count++;\r
- }\r
-\r
- String message = "[" + train.getName() + "] ";\r
- if (count < train.getCount()){\r
- message += df.format(date) + " \92x\89\84\82È\82µ"; \r
- }\r
- else {\r
- int N = 100;\r
- \r
- String sample = tweets.get(mindex).getText();\r
- sample = CommonUtil.replaceString(sample, "@", "(a)");\r
- sample = StringUtility.parseSubstring(sample, N);\r
- message += df.format(date) + " " + sample + " count=" + count; \r
- }\r
- System.out.println(message); //TODO\r
- \r
-// Status status = null;\r
-// try {\r
-// status = twitter.updateStatus(message); //TODO\r
-// setTwitTime(id, cur);\r
-// }\r
-// catch (TwitterException e){\r
-// log.severe(Debug.getLineNo() + " " + message);\r
-// log.severe(Debug.getLineNo() + " " + status);\r
-// throw e;\r
-// }\r
- }\r
- \r
- private List<Train> getTrainList(){\r
- TrainDao dao = TrainDao.getInstance();\r
- List<Train> list = dao.search();\r
- if (list.size() <= 0){\r
- Train train;\r
- \r
- train = new Train("\8b\9e\95l\93\8c\96k\90ü", "\8b\9e\95l\93\8c\96k", 5);\r
- dao.put(train);\r
- train = new Train("\93\8c\8aC\93¹\90ü", "\93\8c\8aC\93¹", 5);\r
- dao.put(train);\r
- train = new Train("\8b\9e\95l\8b}\8ds\90ü", "\8b\9e\8b}", 5);\r
- dao.put(train);\r
- list = dao.search();\r
- }\r
- return list;\r
- }\r
- \r
- public int filter(String text) {\r
- if (keywords == null) {\r
- keywords = new ArrayList<String>();\r
- keywords.add("\92x\89\84");\r
- keywords.add("\92x\82ê");\r
- keywords.add("\90U\82è\91Ö\82¦");\r
- keywords.add("\90U\91Ö");\r
- keywords.add("\92â\8e~");\r
- keywords.add("\8e\96\8cÌ");\r
- }\r
-\r
- int count = 0;\r
- for (String keyword : keywords) {\r
- if (text.indexOf(keyword) >= 0) {\r
- count++;\r
- }\r
- }\r
- return count;\r
- }\r
- \r
- public long getSearchPeriod(){\r
- if (searchPeriod <= 0){\r
- KeyValueDao dao = KeyValueDao.getInstance();\r
- searchPeriod = dao.getInt(KeyValueDao.KEY_SEARCH_PERIOD, 5);\r
- }\r
- return searchPeriod;\r
- }\r
- \r
- public long getTwitPeriod(){\r
- if (twitPeriod <= 0){\r
- KeyValueDao dao = KeyValueDao.getInstance();\r
- twitPeriod = dao.getInt(KeyValueDao.KEY_TWIT_PERIOD, 5);\r
- }\r
- return twitPeriod;\r
- }\r
- \r
- private long getTwitTime(long id){\r
- String key = KeyValueDao.KEY_TWIT_TIME + id;\r
- Long value = twitTimeList.get(key);\r
- if (value == null){\r
- value = 0L;\r
- twitTimeList.put(key, value);\r
- }\r
- return value;\r
- }\r
- \r
- private void setTwitTime(long id, long value){\r
- String key = KeyValueDao.KEY_TWIT_TIME + id;\r
- twitTimeList.put(key, value);\r
- }\r
-}\r
+++ /dev/null
-package com.yuji.tdb.twitter;\r
-\r
-import java.text.DateFormat;\r
-import java.text.SimpleDateFormat;\r
-import java.util.ArrayList;\r
-import java.util.Calendar;\r
-import java.util.Date;\r
-import java.util.List;\r
-import java.util.TimeZone;\r
-import java.util.logging.Logger;\r
-\r
-import twitter4j.Query;\r
-import twitter4j.QueryResult;\r
-import twitter4j.Status;\r
-import twitter4j.Tweet;\r
-import twitter4j.Twitter;\r
-import twitter4j.TwitterException;\r
-import twitter4j.TwitterFactory;\r
-import twitter4j.auth.AccessToken;\r
-import twitter4j.conf.ConfigurationBuilder;\r
-\r
-import com.yuji.tdb.common.CommonUtil;\r
-import com.yuji.tdb.db.KeyValueDao;\r
-import com.yuji.tdb.db.Train;\r
-import com.yuji.tdb.db.TrainDao;\r
-import com.yuji.tdb.debug.Debug;\r
-import com.yuji.tdb.utility.StringUtility;\r
-\r
-public class TwitterUtil {\r
- private static final Logger log = Logger\r
- .getLogger(TwitterUtil.class.getName());\r
- private static TwitterUtil instance = null;\r
- private static Object obj = new Object();\r
- //private DateFormat df = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");\r
- private DateFormat df = new SimpleDateFormat("HH:mm");\r
- private static List<String> keywords = null;\r
- private int period = 0;\r
- \r
- public static TwitterUtil getInstance() {\r
- if (instance == null) {\r
- synchronized (obj) {\r
- if (instance == null) {\r
- instance = new TwitterUtil();\r
- }\r
- }\r
- }\r
- return instance;\r
- }\r
-\r
- private TwitterUtil() {\r
- df.setTimeZone(TimeZone.getTimeZone("JST")); \r
- }\r
-\r
- public void main(String consumerKey, String consumerSecret, AccessToken accessToken) {\r
- try {\r
- ConfigurationBuilder confBuilder = new ConfigurationBuilder();\r
- confBuilder.setDebugEnabled(true).setOAuthConsumerKey(consumerKey)\r
- .setOAuthConsumerSecret(consumerSecret);\r
- TwitterFactory factory = new TwitterFactory(confBuilder.build());\r
- Twitter twitter = factory.getInstance(accessToken);\r
-\r
- List<Train> list = getTrainList();\r
- for (Train train : list){\r
- twite(twitter, train);\r
- }\r
- } catch (TwitterException e) {\r
- // TODO Auto-generated catch block\r
- e.printStackTrace();\r
- log.severe(e.toString());\r
- }\r
- }\r
-\r
- private void twite(Twitter twitter, Train train) throws TwitterException {\r
- Query query = new Query();\r
- //query.setRpp(1000); // TODO\r
- query.setQuery(train.getSearchWord());\r
- QueryResult result = null;\r
- try {\r
- result = twitter.search(query);\r
- }\r
- catch (TwitterException e){\r
- log.severe("" + Debug.getLineNo());\r
- throw e;\r
- }\r
- List<Tweet> tweets = result.getTweets();\r
- \r
- Calendar cal = Calendar.getInstance();\r
- Date date = cal.getTime();\r
- long cur = date.getTime();\r
-\r
- int count = 0;\r
- int hit = 0;\r
- int mhit = 0;\r
- int period = getPeriod();\r
- \r
- int index;\r
- int mindex = 0;\r
- int size = tweets.size();\r
- for (index = 0; index < size; index++) {\r
- Tweet tweet = tweets.get(index);\r
- \r
- Date at = tweet.getCreatedAt();\r
- long t = at.getTime();\r
- \r
- String message = tweet.getText();\r
- \r
- if (t < cur - period * 60 * 1000){\r
- System.out.println("\81~" + tweet.getFromUser() + " - "\r
- + tweet.getText() + at);\r
- continue;\r
- }\r
- hit = filter(message);\r
- if (hit <= 0) {\r
- System.out.println("\81¢" + tweet.getFromUser() + " - "\r
- + tweet.getText() + at);\r
- // \92x\89\84\88È\8aO\82Ì\8f\91\82«\8d\9e\82Ý\r
- continue;\r
- }\r
- if (hit > mhit){\r
- hit = mhit;\r
- mindex = index;\r
- }\r
-\r
- System.out.println("@" + tweet.getFromUser() + " - "\r
- + tweet.getText() + at);\r
- count++;\r
- }\r
-\r
- String message = "[" + train.getName() + "] ";\r
- if (count < train.getCount()){\r
- message += df.format(date) + " \92x\89\84\82È\82µ"; \r
- }\r
- else {\r
- int N = 100;\r
- \r
- String sample = tweets.get(mindex).getText();\r
- sample = CommonUtil.replaceString(sample, "@", "(a)");\r
- sample = StringUtility.parseSubstring(sample, N);\r
- message += df.format(date) + " " + sample + " count=" + count; \r
- }\r
- System.out.println(message); //TODO\r
- \r
- Status status = null;\r
- try {\r
- status = twitter.updateStatus(message); //TODO\r
- }\r
- catch (TwitterException e){\r
- log.severe(Debug.getLineNo() + " " + message);\r
- throw e;\r
- }\r
- }\r
- \r
- private List<Train> getTrainList(){\r
- TrainDao dao = TrainDao.getInstance();\r
- List<Train> list = dao.search();\r
- if (list.size() <= 0){\r
- Train train;\r
- \r
- train = new Train("\8b\9e\95l\93\8c\96k\90ü", "\8b\9e\95l\93\8c\96k", 5);\r
- dao.put(train);\r
- train = new Train("\93\8c\8aC\93¹\90ü", "\93\8c\8aC\93¹", 5);\r
- dao.put(train);\r
- train = new Train("\8b\9e\95l\8b}\8ds\90ü", "\8b\9e\8b}", 5);\r
- dao.put(train);\r
- list = dao.search();\r
- }\r
- return list;\r
- }\r
- \r
- public int filter(String text) {\r
- if (keywords == null) {\r
- keywords = new ArrayList<String>();\r
- keywords.add("\92x\89\84");\r
- keywords.add("\92x\82ê");\r
- keywords.add("\90U\82è\91Ö\82¦");\r
- keywords.add("\90U\91Ö");\r
- keywords.add("\92â\8e~");\r
- keywords.add("\8e\96\8cÌ");\r
- }\r
-\r
- int count = 0;\r
- for (String keyword : keywords) {\r
- if (text.indexOf(keyword) >= 0) {\r
- count++;\r
- }\r
- }\r
- return count;\r
- }\r
- \r
- public int getPeriod(){\r
- if (period <= 0){\r
- KeyValueDao dao = KeyValueDao.getInstance();\r
- period = dao.getInt(KeyValueDao.KEY_SEARCH_PERIOD, 5);\r
- }\r
- return period;\r
- }\r
- \r
- private List<String, Integer> twitTimeList = new ArrayList();\r
- private int getTwitTime(long id){\r
- \r
- }\r
-}\r
+++ /dev/null
-package com.yuji.tdb.twitter;\r
-\r
-import java.text.DateFormat;\r
-import java.text.SimpleDateFormat;\r
-import java.util.ArrayList;\r
-import java.util.Calendar;\r
-import java.util.Date;\r
-import java.util.HashMap;\r
-import java.util.List;\r
-import java.util.Map;\r
-import java.util.TimeZone;\r
-import java.util.logging.Logger;\r
-\r
-import twitter4j.Query;\r
-import twitter4j.QueryResult;\r
-import twitter4j.Status;\r
-import twitter4j.Tweet;\r
-import twitter4j.Twitter;\r
-import twitter4j.TwitterException;\r
-import twitter4j.TwitterFactory;\r
-import twitter4j.auth.AccessToken;\r
-import twitter4j.conf.ConfigurationBuilder;\r
-\r
-import com.yuji.tdb.common.CommonUtil;\r
-import com.yuji.tdb.db.KeyValueDao;\r
-import com.yuji.tdb.db.Train;\r
-import com.yuji.tdb.db.TrainDao;\r
-import com.yuji.tdb.debug.Debug;\r
-import com.yuji.tdb.utility.StringUtility;\r
-\r
-public class TwitterUtil {\r
- private static final Logger log = Logger\r
- .getLogger(TwitterUtil.class.getName());\r
- private static TwitterUtil instance = null;\r
- private static Object obj = new Object();\r
- //private DateFormat df = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");\r
- private DateFormat df = new SimpleDateFormat("HH:mm");\r
- private static List<String> keywords = null;\r
- private long searchPeriod = 0;\r
- private long twitPeriod = 0;\r
- private Map<String, Long> twitTimeList = new HashMap<String, Long>();\r
- \r
- public static TwitterUtil getInstance() {\r
- if (instance == null) {\r
- synchronized (obj) {\r
- if (instance == null) {\r
- instance = new TwitterUtil();\r
- }\r
- }\r
- }\r
- return instance;\r
- }\r
-\r
- private TwitterUtil() {\r
- df.setTimeZone(TimeZone.getTimeZone("JST")); \r
- }\r
-\r
- public void main(String consumerKey, String consumerSecret, AccessToken accessToken) {\r
- try {\r
- ConfigurationBuilder confBuilder = new ConfigurationBuilder();\r
- confBuilder.setDebugEnabled(true).setOAuthConsumerKey(consumerKey)\r
- .setOAuthConsumerSecret(consumerSecret);\r
- TwitterFactory factory = new TwitterFactory(confBuilder.build());\r
- Twitter twitter = factory.getInstance(accessToken);\r
-\r
- List<Train> list = getTrainList();\r
- for (Train train : list){\r
- Calendar cal = Calendar.getInstance();\r
- Date date = cal.getTime();\r
- long cur = date.getTime();\r
-\r
- long id = train.getId();\r
- long t = getTwitTime(id);\r
- long period = getTwitPeriod();\r
-\r
- if (t > 0 && cur < t + period * 60 * 1000){\r
- continue;\r
- }\r
- twite(twitter, train);\r
- }\r
- } catch (TwitterException e) {\r
- // TODO Auto-generated catch block\r
- e.printStackTrace();\r
- log.severe(e.toString());\r
- }\r
- }\r
-\r
- private void twite(Twitter twitter, Train train) throws TwitterException {\r
- Query query = new Query();\r
- //query.setRpp(1000); // TODO\r
- query.setQuery(train.getSearchWord());\r
- QueryResult result = null;\r
- try {\r
- result = twitter.search(query);\r
- }\r
- catch (TwitterException e){\r
- log.severe("" + Debug.getLineNo());\r
- throw e;\r
- }\r
- List<Tweet> tweets = result.getTweets();\r
- \r
- Calendar cal = Calendar.getInstance();\r
- Date date = cal.getTime();\r
- long cur = date.getTime();\r
-\r
- int count = 0;\r
- int hit = 0;\r
- int mhit = 0;\r
- long period = getSearchPeriod();\r
- long id = train.getId();\r
- \r
- int index;\r
- int mindex = 0;\r
- int size = tweets.size();\r
- for (index = 0; index < size; index++) {\r
- Tweet tweet = tweets.get(index);\r
- \r
- Date at = tweet.getCreatedAt();\r
- long t = at.getTime();\r
- \r
- String message = tweet.getText();\r
- \r
- if (t < cur - period * 60 * 1000){\r
- System.out.println("\81~" + tweet.getFromUser() + " - "\r
- + tweet.getText() + at);\r
- continue;\r
- }\r
- hit = filter(message);\r
- if (hit <= 0) {\r
- System.out.println("\81¢" + tweet.getFromUser() + " - "\r
- + tweet.getText() + at);\r
- // \92x\89\84\88È\8aO\82Ì\8f\91\82«\8d\9e\82Ý\r
- continue;\r
- }\r
- if (hit > mhit){\r
- hit = mhit;\r
- mindex = index;\r
- }\r
-\r
- System.out.println("@" + tweet.getFromUser() + " - "\r
- + tweet.getText() + at);\r
- count++;\r
- }\r
-\r
- String message = "[" + train.getName() + "] ";\r
- if (count < train.getCount()){\r
- message += df.format(date) + " \92x\89\84\82È\82µ"; \r
- }\r
- else {\r
- int N = 100;\r
- \r
- String sample = tweets.get(mindex).getText();\r
- //sample = CommonUtil.replaceString(sample, "@", "(a)");\r
- sample = StringUtility.parseSubstring(sample, N);\r
- message += df.format(date) + " " + sample + " count=" + count; \r
- }\r
- System.out.println(message); //TODO\r
- \r
- Status status = null;\r
- try {\r
- status = twitter.updateStatus(message); //TODO\r
- if (count < train.getCount()){\r
- setTwitTime(id, cur); // TODO \92x\89\84\82È\82µ\82Ì\8e\9e\82Ì\82Ý\r
- }\r
- }\r
- catch (TwitterException e){\r
- log.severe(Debug.getLineNo() + " " + message);\r
- log.severe(Debug.getLineNo() + " " + status);\r
- throw e;\r
- }\r
- }\r
- \r
- private List<Train> getTrainList(){\r
- TrainDao dao = TrainDao.getInstance();\r
- List<Train> list = dao.search();\r
- if (list.size() <= 0){\r
- Train train;\r
- \r
- train = new Train("\8b\9e\95l\93\8c\96k\90ü", "\8b\9e\95l\93\8c\96k", 5);\r
- dao.put(train);\r
- train = new Train("\93\8c\8aC\93¹\90ü", "\93\8c\8aC\93¹", 5);\r
- dao.put(train);\r
- train = new Train("\8b\9e\95l\8b}\8ds\90ü", "\8b\9e\8b}", 5);\r
- dao.put(train);\r
- list = dao.search();\r
- }\r
- return list;\r
- }\r
- \r
- public int filter(String text) {\r
- if (keywords == null) {\r
- keywords = new ArrayList<String>();\r
- keywords.add("\92x\89\84");\r
- keywords.add("\92x\82ê");\r
- keywords.add("\90U\82è\91Ö\82¦");\r
- keywords.add("\90U\91Ö");\r
- keywords.add("\92â\8e~");\r
- keywords.add("\8e\96\8cÌ");\r
- }\r
-\r
- int count = 0;\r
- for (String keyword : keywords) {\r
- if (text.indexOf(keyword) >= 0) {\r
- count++;\r
- }\r
- }\r
- return count;\r
- }\r
- \r
- public long getSearchPeriod(){\r
- if (searchPeriod <= 0){\r
- KeyValueDao dao = KeyValueDao.getInstance();\r
- searchPeriod = dao.getInt(KeyValueDao.KEY_SEARCH_PERIOD, 5);\r
- }\r
- return searchPeriod;\r
- }\r
- \r
- public long getTwitPeriod(){\r
- if (twitPeriod <= 0){\r
- KeyValueDao dao = KeyValueDao.getInstance();\r
- twitPeriod = dao.getInt(KeyValueDao.KEY_TWIT_PERIOD, 60);\r
- }\r
- return twitPeriod;\r
- }\r
- \r
- private long getTwitTime(long id){\r
- String key = KeyValueDao.KEY_TWIT_TIME + id;\r
- Long value = twitTimeList.get(key);\r
- if (value == null){\r
- value = 0L;\r
- setTwitTime(id, value);\r
- }\r
- return value;\r
- }\r
- \r
- private void setTwitTime(long id, long value){\r
- String key = KeyValueDao.KEY_TWIT_TIME + id;\r
- twitTimeList.put(key, value);\r
- KeyValueDao dao = KeyValueDao.getInstance();\r
- dao.put(key, String.valueOf(value));\r
- }\r
-}\r
+++ /dev/null
-package com.yuji.tdb.twitter;\r
-\r
-import java.text.DateFormat;\r
-import java.text.SimpleDateFormat;\r
-import java.util.ArrayList;\r
-import java.util.Calendar;\r
-import java.util.Date;\r
-import java.util.HashMap;\r
-import java.util.List;\r
-import java.util.Map;\r
-import java.util.TimeZone;\r
-import java.util.logging.Logger;\r
-\r
-import twitter4j.Query;\r
-import twitter4j.QueryResult;\r
-import twitter4j.Status;\r
-import twitter4j.Tweet;\r
-import twitter4j.Twitter;\r
-import twitter4j.TwitterException;\r
-import twitter4j.TwitterFactory;\r
-import twitter4j.auth.AccessToken;\r
-import twitter4j.conf.ConfigurationBuilder;\r
-\r
-import com.yuji.tdb.common.CommonUtil;\r
-import com.yuji.tdb.db.KeyValueDao;\r
-import com.yuji.tdb.db.Train;\r
-import com.yuji.tdb.db.TrainDao;\r
-import com.yuji.tdb.debug.Debug;\r
-import com.yuji.tdb.utility.StringUtility;\r
-\r
-public class TwitterUtil {\r
- private static final Logger log = Logger\r
- .getLogger(TwitterUtil.class.getName());\r
- private static TwitterUtil instance = null;\r
- private static Object obj = new Object();\r
- //private DateFormat df = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");\r
- private DateFormat df = new SimpleDateFormat("HH:mm");\r
- private static List<String> keywords = null;\r
- private long searchPeriod = 0;\r
- private long twitPeriod = 0;\r
- private Map<String, Long> twitTimeList = new HashMap<String, Long>();\r
- \r
- public static TwitterUtil getInstance() {\r
- if (instance == null) {\r
- synchronized (obj) {\r
- if (instance == null) {\r
- instance = new TwitterUtil();\r
- }\r
- }\r
- }\r
- return instance;\r
- }\r
-\r
- private TwitterUtil() {\r
- df.setTimeZone(TimeZone.getTimeZone("JST")); \r
- }\r
-\r
- public void main(String consumerKey, String consumerSecret, AccessToken accessToken) {\r
- try {\r
- ConfigurationBuilder confBuilder = new ConfigurationBuilder();\r
- confBuilder.setDebugEnabled(true).setOAuthConsumerKey(consumerKey)\r
- .setOAuthConsumerSecret(consumerSecret);\r
- TwitterFactory factory = new TwitterFactory(confBuilder.build());\r
- Twitter twitter = factory.getInstance(accessToken);\r
-\r
- List<Train> list = getTrainList();\r
- for (Train train : list){\r
- Calendar cal = Calendar.getInstance();\r
- Date date = cal.getTime();\r
- long cur = date.getTime();\r
-\r
- long id = train.getId();\r
- long t = getTwitTime(id);\r
- long period = getTwitPeriod();\r
-\r
- if (t > 0 && t + period * 60 * 1000 < cur){\r
- continue;\r
- }\r
- twite(twitter, train);\r
- }\r
- } catch (TwitterException e) {\r
- // TODO Auto-generated catch block\r
- e.printStackTrace();\r
- log.severe(e.toString());\r
- }\r
- }\r
-\r
- private void twite(Twitter twitter, Train train) throws TwitterException {\r
- Query query = new Query();\r
- //query.setRpp(1000); // TODO\r
- query.setQuery(train.getSearchWord());\r
- QueryResult result = null;\r
- try {\r
- result = twitter.search(query);\r
- }\r
- catch (TwitterException e){\r
- log.severe("" + Debug.getLineNo());\r
- throw e;\r
- }\r
- List<Tweet> tweets = result.getTweets();\r
- \r
- Calendar cal = Calendar.getInstance();\r
- Date date = cal.getTime();\r
- long cur = date.getTime();\r
-\r
- int count = 0;\r
- int hit = 0;\r
- int mhit = 0;\r
- long period = getSearchPeriod();\r
- long id = train.getId();\r
- \r
- int index;\r
- int mindex = 0;\r
- int size = tweets.size();\r
- for (index = 0; index < size; index++) {\r
- Tweet tweet = tweets.get(index);\r
- \r
- Date at = tweet.getCreatedAt();\r
- long t = at.getTime();\r
- \r
- String message = tweet.getText();\r
- \r
- if (t < cur - period * 60 * 1000){\r
- System.out.println("\81~" + tweet.getFromUser() + " - "\r
- + tweet.getText() + at);\r
- continue;\r
- }\r
- hit = filter(message);\r
- if (hit <= 0) {\r
- System.out.println("\81¢" + tweet.getFromUser() + " - "\r
- + tweet.getText() + at);\r
- // \92x\89\84\88È\8aO\82Ì\8f\91\82«\8d\9e\82Ý\r
- continue;\r
- }\r
- if (hit > mhit){\r
- hit = mhit;\r
- mindex = index;\r
- }\r
-\r
- System.out.println("@" + tweet.getFromUser() + " - "\r
- + tweet.getText() + at);\r
- count++;\r
- }\r
-\r
- String message = "[" + train.getName() + "] ";\r
- if (count < train.getCount()){\r
- message += df.format(date) + " \92x\89\84\82È\82µ"; \r
- }\r
- else {\r
- int N = 100;\r
- \r
- String sample = tweets.get(mindex).getText();\r
- sample = CommonUtil.replaceString(sample, "@", "(a)");\r
- sample = StringUtility.parseSubstring(sample, N);\r
- message += df.format(date) + " " + sample + " count=" + count; \r
- }\r
- System.out.println(message); //TODO\r
- \r
-// Status status = null;\r
-// try {\r
-// status = twitter.updateStatus(message); //TODO\r
-// setTwitTime(id, cur);\r
-// }\r
-// catch (TwitterException e){\r
-// log.severe(Debug.getLineNo() + " " + message);\r
-// log.severe(Debug.getLineNo() + " " + status);\r
-// throw e;\r
-// }\r
- setTwitTime(id, cur); // TODO\r
- }\r
- \r
- private List<Train> getTrainList(){\r
- TrainDao dao = TrainDao.getInstance();\r
- List<Train> list = dao.search();\r
- if (list.size() <= 0){\r
- Train train;\r
- \r
- train = new Train("\8b\9e\95l\93\8c\96k\90ü", "\8b\9e\95l\93\8c\96k", 5);\r
- dao.put(train);\r
- train = new Train("\93\8c\8aC\93¹\90ü", "\93\8c\8aC\93¹", 5);\r
- dao.put(train);\r
- train = new Train("\8b\9e\95l\8b}\8ds\90ü", "\8b\9e\8b}", 5);\r
- dao.put(train);\r
- list = dao.search();\r
- }\r
- return list;\r
- }\r
- \r
- public int filter(String text) {\r
- if (keywords == null) {\r
- keywords = new ArrayList<String>();\r
- keywords.add("\92x\89\84");\r
- keywords.add("\92x\82ê");\r
- keywords.add("\90U\82è\91Ö\82¦");\r
- keywords.add("\90U\91Ö");\r
- keywords.add("\92â\8e~");\r
- keywords.add("\8e\96\8cÌ");\r
- }\r
-\r
- int count = 0;\r
- for (String keyword : keywords) {\r
- if (text.indexOf(keyword) >= 0) {\r
- count++;\r
- }\r
- }\r
- return count;\r
- }\r
- \r
- public long getSearchPeriod(){\r
- if (searchPeriod <= 0){\r
- KeyValueDao dao = KeyValueDao.getInstance();\r
- searchPeriod = dao.getInt(KeyValueDao.KEY_SEARCH_PERIOD, 5);\r
- }\r
- return searchPeriod;\r
- }\r
- \r
- public long getTwitPeriod(){\r
- if (twitPeriod <= 0){\r
- KeyValueDao dao = KeyValueDao.getInstance();\r
- twitPeriod = dao.getInt(KeyValueDao.KEY_TWIT_PERIOD, 5);\r
- }\r
- return twitPeriod;\r
- }\r
- \r
- private long getTwitTime(long id){\r
- String key = KeyValueDao.KEY_TWIT_TIME + id;\r
- Long value = twitTimeList.get(key);\r
- if (value == null){\r
- value = 0L;\r
- setTwitTime(id, value);\r
- }\r
- return value;\r
- }\r
- \r
- private void setTwitTime(long id, long value){\r
- String key = KeyValueDao.KEY_TWIT_TIME + id;\r
- twitTimeList.put(key, value);\r
- }\r
-}\r
+++ /dev/null
-package com.yuji.tdb.twitter;\r
-\r
-import java.text.DateFormat;\r
-import java.text.SimpleDateFormat;\r
-import java.util.ArrayList;\r
-import java.util.Calendar;\r
-import java.util.Date;\r
-import java.util.HashMap;\r
-import java.util.List;\r
-import java.util.Map;\r
-import java.util.TimeZone;\r
-import java.util.logging.Logger;\r
-\r
-import twitter4j.Query;\r
-import twitter4j.QueryResult;\r
-import twitter4j.Status;\r
-import twitter4j.Tweet;\r
-import twitter4j.Twitter;\r
-import twitter4j.TwitterException;\r
-import twitter4j.TwitterFactory;\r
-import twitter4j.auth.AccessToken;\r
-import twitter4j.conf.ConfigurationBuilder;\r
-\r
-import com.yuji.tdb.common.CommonUtil;\r
-import com.yuji.tdb.db.KeyValueDao;\r
-import com.yuji.tdb.db.Train;\r
-import com.yuji.tdb.db.TrainDao;\r
-import com.yuji.tdb.debug.Debug;\r
-import com.yuji.tdb.utility.StringUtility;\r
-\r
-public class TwitterUtil {\r
- private static final Logger log = Logger\r
- .getLogger(TwitterUtil.class.getName());\r
- private static TwitterUtil instance = null;\r
- private static Object obj = new Object();\r
- //private DateFormat df = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");\r
- private DateFormat df = new SimpleDateFormat("HH:mm");\r
- private static List<String> keywords = null;\r
- private long searchPeriod = 0;\r
- private long twitPeriod = 0;\r
- private Map<String, Long> twitTimeList = new HashMap<String, Long>();\r
- \r
- public static TwitterUtil getInstance() {\r
- if (instance == null) {\r
- synchronized (obj) {\r
- if (instance == null) {\r
- instance = new TwitterUtil();\r
- }\r
- }\r
- }\r
- return instance;\r
- }\r
-\r
- private TwitterUtil() {\r
- df.setTimeZone(TimeZone.getTimeZone("JST")); \r
- }\r
-\r
- public void main(String consumerKey, String consumerSecret, AccessToken accessToken) {\r
- try {\r
- ConfigurationBuilder confBuilder = new ConfigurationBuilder();\r
- confBuilder.setDebugEnabled(true).setOAuthConsumerKey(consumerKey)\r
- .setOAuthConsumerSecret(consumerSecret);\r
- TwitterFactory factory = new TwitterFactory(confBuilder.build());\r
- Twitter twitter = factory.getInstance(accessToken);\r
-\r
- List<Train> list = getTrainList();\r
- for (Train train : list){\r
- Calendar cal = Calendar.getInstance();\r
- Date date = cal.getTime();\r
- long cur = date.getTime();\r
-\r
- long id = train.getId();\r
- long t = getTwitTime(id);\r
- long period = getTwitPeriod();\r
-\r
- if (t > 0 && cur < t + period * 60 * 1000){\r
- continue;\r
- }\r
- twite(twitter, train);\r
- }\r
- } catch (TwitterException e) {\r
- // TODO Auto-generated catch block\r
- e.printStackTrace();\r
- log.severe(e.toString());\r
- }\r
- }\r
-\r
- private void twite(Twitter twitter, Train train) throws TwitterException {\r
- Query query = new Query();\r
- //query.setRpp(1000); // TODO\r
- query.setQuery(train.getSearchWord());\r
- QueryResult result = null;\r
- try {\r
- result = twitter.search(query);\r
- }\r
- catch (TwitterException e){\r
- log.severe("" + Debug.getLineNo());\r
- throw e;\r
- }\r
- List<Tweet> tweets = result.getTweets();\r
- \r
- Calendar cal = Calendar.getInstance();\r
- Date date = cal.getTime();\r
- long cur = date.getTime();\r
-\r
- int count = 0;\r
- int hit = 0;\r
- int mhit = 0;\r
- long period = getSearchPeriod();\r
- long id = train.getId();\r
- \r
- int index;\r
- int mindex = 0;\r
- int size = tweets.size();\r
- for (index = 0; index < size; index++) {\r
- Tweet tweet = tweets.get(index);\r
- \r
- Date at = tweet.getCreatedAt();\r
- long t = at.getTime();\r
- \r
- String message = tweet.getText();\r
- \r
- if (t < cur - period * 60 * 1000){\r
- System.out.println("\81~" + tweet.getFromUser() + " - "\r
- + tweet.getText() + at);\r
- continue;\r
- }\r
- hit = filter(message);\r
- if (hit <= 0) {\r
- System.out.println("\81¢" + tweet.getFromUser() + " - "\r
- + tweet.getText() + at);\r
- // \92x\89\84\88È\8aO\82Ì\8f\91\82«\8d\9e\82Ý\r
- continue;\r
- }\r
- if (hit > mhit){\r
- hit = mhit;\r
- mindex = index;\r
- }\r
-\r
- System.out.println("@" + tweet.getFromUser() + " - "\r
- + tweet.getText() + at);\r
- count++;\r
- }\r
-\r
- String message = "[" + train.getName() + "] ";\r
- if (count < train.getCount()){\r
- message += df.format(date) + " \92x\89\84\82È\82µ"; \r
- }\r
- else {\r
- int N = 100;\r
- \r
- String sample = tweets.get(mindex).getText();\r
- sample = CommonUtil.replaceString(sample, "@", "(a)");\r
- sample = StringUtility.parseSubstring(sample, N);\r
- message += df.format(date) + " " + sample + " count=" + count; \r
- }\r
- System.out.println(message); //TODO\r
- \r
- Status status = null;\r
- try {\r
- status = twitter.updateStatus(message); //TODO\r
- if (count < train.getCount()){\r
- setTwitTime(id, cur);\r
- }\r
- }\r
- catch (TwitterException e){\r
- log.severe(Debug.getLineNo() + " " + message);\r
- log.severe(Debug.getLineNo() + " " + status);\r
- throw e;\r
- }\r
- }\r
- \r
- private List<Train> getTrainList(){\r
- TrainDao dao = TrainDao.getInstance();\r
- List<Train> list = dao.search();\r
- if (list.size() <= 0){\r
- Train train;\r
- \r
- train = new Train("\8b\9e\95l\93\8c\96k\90ü", "\8b\9e\95l\93\8c\96k", 5);\r
- dao.put(train);\r
- train = new Train("\93\8c\8aC\93¹\90ü", "\93\8c\8aC\93¹", 5);\r
- dao.put(train);\r
- train = new Train("\8b\9e\95l\8b}\8ds\90ü", "\8b\9e\8b}", 5);\r
- dao.put(train);\r
- list = dao.search();\r
- }\r
- return list;\r
- }\r
- \r
- public int filter(String text) {\r
- if (keywords == null) {\r
- keywords = new ArrayList<String>();\r
- keywords.add("\92x\89\84");\r
- keywords.add("\92x\82ê");\r
- keywords.add("\90U\82è\91Ö\82¦");\r
- keywords.add("\90U\91Ö");\r
- keywords.add("\92â\8e~");\r
- keywords.add("\8e\96\8cÌ");\r
- }\r
-\r
- int count = 0;\r
- for (String keyword : keywords) {\r
- if (text.indexOf(keyword) >= 0) {\r
- count++;\r
- }\r
- }\r
- return count;\r
- }\r
- \r
- public long getSearchPeriod(){\r
- if (searchPeriod <= 0){\r
- KeyValueDao dao = KeyValueDao.getInstance();\r
- searchPeriod = dao.getInt(KeyValueDao.KEY_SEARCH_PERIOD, 5);\r
- }\r
- return searchPeriod;\r
- }\r
- \r
- public long getTwitPeriod(){\r
- if (twitPeriod <= 0){\r
- KeyValueDao dao = KeyValueDao.getInstance();\r
- twitPeriod = dao.getInt(KeyValueDao.KEY_TWIT_PERIOD, 60);\r
- }\r
- return twitPeriod;\r
- }\r
- \r
- private long getTwitTime(long id){\r
- String key = KeyValueDao.KEY_TWIT_TIME + id;\r
- Long value = twitTimeList.get(key);\r
- if (value == null){\r
- value = 0L;\r
- setTwitTime(id, value);\r
- }\r
- return value;\r
- }\r
- \r
- private void setTwitTime(long id, long value){\r
- String key = KeyValueDao.KEY_TWIT_TIME + id;\r
- twitTimeList.put(key, value);\r
- KeyValueDao dao = KeyValueDao.getInstance();\r
- dao.put(key, String.valueOf(value));\r
- }\r
-}\r
+++ /dev/null
-package com.yuji.tdb.twitter;\r
-\r
-import java.text.DateFormat;\r
-import java.text.SimpleDateFormat;\r
-import java.util.ArrayList;\r
-import java.util.Calendar;\r
-import java.util.Date;\r
-import java.util.HashMap;\r
-import java.util.List;\r
-import java.util.Map;\r
-import java.util.TimeZone;\r
-import java.util.logging.Logger;\r
-\r
-import twitter4j.Query;\r
-import twitter4j.QueryResult;\r
-import twitter4j.Status;\r
-import twitter4j.Tweet;\r
-import twitter4j.Twitter;\r
-import twitter4j.TwitterException;\r
-import twitter4j.TwitterFactory;\r
-import twitter4j.auth.AccessToken;\r
-import twitter4j.conf.ConfigurationBuilder;\r
-\r
-import com.yuji.tdb.common.CommonUtil;\r
-import com.yuji.tdb.db.KeyValueDao;\r
-import com.yuji.tdb.db.Train;\r
-import com.yuji.tdb.db.TrainDao;\r
-import com.yuji.tdb.debug.Debug;\r
-import com.yuji.tdb.utility.StringUtility;\r
-\r
-public class TwitterUtil {\r
- private static final Logger log = Logger\r
- .getLogger(TwitterUtil.class.getName());\r
- private static TwitterUtil instance = null;\r
- private static Object obj = new Object();\r
- //private DateFormat df = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");\r
- private DateFormat df = new SimpleDateFormat("HH:mm");\r
- private static List<String> keywords = null;\r
- private long searchPeriod = 0;\r
- private long twitPeriod = 0;\r
- private Map<String, Long> twitTimeList = new HashMap<String, Long>();\r
- \r
- public static TwitterUtil getInstance() {\r
- if (instance == null) {\r
- synchronized (obj) {\r
- if (instance == null) {\r
- instance = new TwitterUtil();\r
- }\r
- }\r
- }\r
- return instance;\r
- }\r
-\r
- private TwitterUtil() {\r
- df.setTimeZone(TimeZone.getTimeZone("JST")); \r
- }\r
-\r
- public void main(String consumerKey, String consumerSecret, AccessToken accessToken) {\r
- try {\r
- ConfigurationBuilder confBuilder = new ConfigurationBuilder();\r
- confBuilder.setDebugEnabled(true).setOAuthConsumerKey(consumerKey)\r
- .setOAuthConsumerSecret(consumerSecret);\r
- TwitterFactory factory = new TwitterFactory(confBuilder.build());\r
- Twitter twitter = factory.getInstance(accessToken);\r
-\r
- List<Train> list = getTrainList();\r
- for (Train train : list){\r
- Calendar cal = Calendar.getInstance();\r
- Date date = cal.getTime();\r
- long cur = date.getTime();\r
-\r
- long id = train.getId();\r
- long t = getTwitTime(id);\r
- long period = getTwitPeriod();\r
-\r
- if (t > 0 && cur < t + period * 60 * 1000){\r
- continue;\r
- }\r
- twite(twitter, train);\r
- }\r
- } catch (TwitterException e) {\r
- // TODO Auto-generated catch block\r
- e.printStackTrace();\r
- log.severe(e.toString());\r
- }\r
- }\r
-\r
- private void twite(Twitter twitter, Train train) throws TwitterException {\r
- Query query = new Query();\r
- //query.setRpp(1000); // TODO\r
- query.setQuery(train.getSearchWord());\r
- QueryResult result = null;\r
- try {\r
- result = twitter.search(query);\r
- }\r
- catch (TwitterException e){\r
- log.severe("" + Debug.getLineNo());\r
- throw e;\r
- }\r
- List<Tweet> tweets = result.getTweets();\r
- \r
- Calendar cal = Calendar.getInstance();\r
- Date date = cal.getTime();\r
- long cur = date.getTime();\r
-\r
- int count = 0;\r
- int hit = 0;\r
- int mhit = 0;\r
- long period = getSearchPeriod();\r
- long id = train.getId();\r
- \r
- int index;\r
- int mindex = 0;\r
- int size = tweets.size();\r
- for (index = 0; index < size; index++) {\r
- Tweet tweet = tweets.get(index);\r
- \r
- Date at = tweet.getCreatedAt();\r
- long t = at.getTime();\r
- \r
- String message = tweet.getText();\r
- \r
- if (t < cur - period * 60 * 1000){\r
- System.out.println("\81~" + tweet.getFromUser() + " - "\r
- + tweet.getText() + at);\r
- continue;\r
- }\r
- hit = filter(message);\r
- if (hit <= 0) {\r
- System.out.println("\81¢" + tweet.getFromUser() + " - "\r
- + tweet.getText() + at);\r
- // \92x\89\84\88È\8aO\82Ì\8f\91\82«\8d\9e\82Ý\r
- continue;\r
- }\r
- if (hit > mhit){\r
- hit = mhit;\r
- mindex = index;\r
- }\r
-\r
- System.out.println("@" + tweet.getFromUser() + " - "\r
- + tweet.getText() + at);\r
- count++;\r
- }\r
-\r
- String message = "[" + train.getName() + "] ";\r
- if (count < train.getCount()){\r
- message += df.format(date) + " \92x\89\84\82È\82µ"; \r
- }\r
- else {\r
- int N = 100;\r
- \r
- String sample = tweets.get(mindex).getText();\r
- sample = CommonUtil.replaceString(sample, "@", "(a)");\r
- sample = StringUtility.parseSubstring(sample, N);\r
- message += df.format(date) + " " + sample + " count=" + count; \r
- }\r
- System.out.println(message); //TODO\r
- \r
- Status status = null;\r
- try {\r
- status = twitter.updateStatus(message); //TODO\r
- if (count < train.getCount()){\r
- setTwitTime(id, cur); // TODO \92x\89\84\82È\82µ\82Ì\8e\9e\82Ì\82Ý\r
- }\r
- }\r
- catch (TwitterException e){\r
- log.severe(Debug.getLineNo() + " " + message);\r
- log.severe(Debug.getLineNo() + " " + status);\r
- throw e;\r
- }\r
- }\r
- \r
- private List<Train> getTrainList(){\r
- TrainDao dao = TrainDao.getInstance();\r
- List<Train> list = dao.search();\r
- if (list.size() <= 0){\r
- Train train;\r
- \r
- train = new Train("\8b\9e\95l\93\8c\96k\90ü", "\8b\9e\95l\93\8c\96k", 5);\r
- dao.put(train);\r
- train = new Train("\93\8c\8aC\93¹\90ü", "\93\8c\8aC\93¹", 5);\r
- dao.put(train);\r
- train = new Train("\8b\9e\95l\8b}\8ds\90ü", "\8b\9e\8b}", 5);\r
- dao.put(train);\r
- list = dao.search();\r
- }\r
- return list;\r
- }\r
- \r
- public int filter(String text) {\r
- if (keywords == null) {\r
- keywords = new ArrayList<String>();\r
- keywords.add("\92x\89\84");\r
- keywords.add("\92x\82ê");\r
- keywords.add("\90U\82è\91Ö\82¦");\r
- keywords.add("\90U\91Ö");\r
- keywords.add("\92â\8e~");\r
- keywords.add("\8e\96\8cÌ");\r
- }\r
-\r
- int count = 0;\r
- for (String keyword : keywords) {\r
- if (text.indexOf(keyword) >= 0) {\r
- count++;\r
- }\r
- }\r
- return count;\r
- }\r
- \r
- public long getSearchPeriod(){\r
- if (searchPeriod <= 0){\r
- KeyValueDao dao = KeyValueDao.getInstance();\r
- searchPeriod = dao.getInt(KeyValueDao.KEY_SEARCH_PERIOD, 5);\r
- }\r
- return searchPeriod;\r
- }\r
- \r
- public long getTwitPeriod(){\r
- if (twitPeriod <= 0){\r
- KeyValueDao dao = KeyValueDao.getInstance();\r
- twitPeriod = dao.getInt(KeyValueDao.KEY_TWIT_PERIOD, 60);\r
- }\r
- return twitPeriod;\r
- }\r
- \r
- private long getTwitTime(long id){\r
- String key = KeyValueDao.KEY_TWIT_TIME + id;\r
- Long value = twitTimeList.get(key);\r
- if (value == null){\r
- value = 0L;\r
- setTwitTime(id, value);\r
- }\r
- return value;\r
- }\r
- \r
- private void setTwitTime(long id, long value){\r
- String key = KeyValueDao.KEY_TWIT_TIME + id;\r
- twitTimeList.put(key, value);\r
- KeyValueDao dao = KeyValueDao.getInstance();\r
- dao.put(key, String.valueOf(value));\r
- }\r
-}\r
+++ /dev/null
-package com.yuji.tdb.twitter;\r
-\r
-import java.text.DateFormat;\r
-import java.text.SimpleDateFormat;\r
-import java.util.ArrayList;\r
-import java.util.Calendar;\r
-import java.util.Date;\r
-import java.util.HashMap;\r
-import java.util.List;\r
-import java.util.Map;\r
-import java.util.TimeZone;\r
-import java.util.logging.Logger;\r
-\r
-import twitter4j.Query;\r
-import twitter4j.QueryResult;\r
-import twitter4j.Status;\r
-import twitter4j.Tweet;\r
-import twitter4j.Twitter;\r
-import twitter4j.TwitterException;\r
-import twitter4j.TwitterFactory;\r
-import twitter4j.auth.AccessToken;\r
-import twitter4j.conf.ConfigurationBuilder;\r
-\r
-import com.yuji.tdb.common.CommonUtil;\r
-import com.yuji.tdb.db.KeyValueDao;\r
-import com.yuji.tdb.db.Train;\r
-import com.yuji.tdb.db.TrainDao;\r
-import com.yuji.tdb.debug.Debug;\r
-import com.yuji.tdb.utility.StringUtility;\r
-\r
-public class TwitterUtil {\r
- private static final Logger log = Logger\r
- .getLogger(TwitterUtil.class.getName());\r
- private static TwitterUtil instance = null;\r
- private static Object obj = new Object();\r
- //private DateFormat df = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");\r
- private DateFormat df = new SimpleDateFormat("HH:mm");\r
- private static List<String> keywords = null;\r
- private int period = 0;\r
- private Map<String, Integer> twitTimeList = new HashMap<String, Integer>();\r
- \r
- public static TwitterUtil getInstance() {\r
- if (instance == null) {\r
- synchronized (obj) {\r
- if (instance == null) {\r
- instance = new TwitterUtil();\r
- }\r
- }\r
- }\r
- return instance;\r
- }\r
-\r
- private TwitterUtil() {\r
- df.setTimeZone(TimeZone.getTimeZone("JST")); \r
- }\r
-\r
- public void main(String consumerKey, String consumerSecret, AccessToken accessToken) {\r
- try {\r
- ConfigurationBuilder confBuilder = new ConfigurationBuilder();\r
- confBuilder.setDebugEnabled(true).setOAuthConsumerKey(consumerKey)\r
- .setOAuthConsumerSecret(consumerSecret);\r
- TwitterFactory factory = new TwitterFactory(confBuilder.build());\r
- Twitter twitter = factory.getInstance(accessToken);\r
-\r
- List<Train> list = getTrainList();\r
- for (Train train : list){\r
- twite(twitter, train);\r
- }\r
- } catch (TwitterException e) {\r
- // TODO Auto-generated catch block\r
- e.printStackTrace();\r
- log.severe(e.toString());\r
- }\r
- }\r
-\r
- private void twite(Twitter twitter, Train train) throws TwitterException {\r
- Query query = new Query();\r
- //query.setRpp(1000); // TODO\r
- query.setQuery(train.getSearchWord());\r
- QueryResult result = null;\r
- try {\r
- result = twitter.search(query);\r
- }\r
- catch (TwitterException e){\r
- log.severe("" + Debug.getLineNo());\r
- throw e;\r
- }\r
- List<Tweet> tweets = result.getTweets();\r
- \r
- Calendar cal = Calendar.getInstance();\r
- Date date = cal.getTime();\r
- long cur = date.getTime();\r
-\r
- int count = 0;\r
- int hit = 0;\r
- int mhit = 0;\r
- int period = getPeriod();\r
- \r
- int index;\r
- int mindex = 0;\r
- int size = tweets.size();\r
- for (index = 0; index < size; index++) {\r
- Tweet tweet = tweets.get(index);\r
- \r
- Date at = tweet.getCreatedAt();\r
- long t = at.getTime();\r
- \r
- String message = tweet.getText();\r
- \r
- if (t < cur - period * 60 * 1000){\r
- System.out.println("\81~" + tweet.getFromUser() + " - "\r
- + tweet.getText() + at);\r
- continue;\r
- }\r
- hit = filter(message);\r
- if (hit <= 0) {\r
- System.out.println("\81¢" + tweet.getFromUser() + " - "\r
- + tweet.getText() + at);\r
- // \92x\89\84\88È\8aO\82Ì\8f\91\82«\8d\9e\82Ý\r
- continue;\r
- }\r
- if (hit > mhit){\r
- hit = mhit;\r
- mindex = index;\r
- }\r
-\r
- System.out.println("@" + tweet.getFromUser() + " - "\r
- + tweet.getText() + at);\r
- count++;\r
- }\r
-\r
- String message = "[" + train.getName() + "] ";\r
- if (count < train.getCount()){\r
- message += df.format(date) + " \92x\89\84\82È\82µ"; \r
- }\r
- else {\r
- int N = 100;\r
- \r
- String sample = tweets.get(mindex).getText();\r
- sample = CommonUtil.replaceString(sample, "@", "(a)");\r
- sample = StringUtility.parseSubstring(sample, N);\r
- message += df.format(date) + " " + sample + " count=" + count; \r
- }\r
- System.out.println(message); //TODO\r
- \r
- Status status = null;\r
- try {\r
- status = twitter.updateStatus(message); //TODO\r
- }\r
- catch (TwitterException e){\r
- log.severe(Debug.getLineNo() + " " + message);\r
- throw e;\r
- }\r
- }\r
- \r
- private List<Train> getTrainList(){\r
- TrainDao dao = TrainDao.getInstance();\r
- List<Train> list = dao.search();\r
- if (list.size() <= 0){\r
- Train train;\r
- \r
- train = new Train("\8b\9e\95l\93\8c\96k\90ü", "\8b\9e\95l\93\8c\96k", 5);\r
- dao.put(train);\r
- train = new Train("\93\8c\8aC\93¹\90ü", "\93\8c\8aC\93¹", 5);\r
- dao.put(train);\r
- train = new Train("\8b\9e\95l\8b}\8ds\90ü", "\8b\9e\8b}", 5);\r
- dao.put(train);\r
- list = dao.search();\r
- }\r
- return list;\r
- }\r
- \r
- public int filter(String text) {\r
- if (keywords == null) {\r
- keywords = new ArrayList<String>();\r
- keywords.add("\92x\89\84");\r
- keywords.add("\92x\82ê");\r
- keywords.add("\90U\82è\91Ö\82¦");\r
- keywords.add("\90U\91Ö");\r
- keywords.add("\92â\8e~");\r
- keywords.add("\8e\96\8cÌ");\r
- }\r
-\r
- int count = 0;\r
- for (String keyword : keywords) {\r
- if (text.indexOf(keyword) >= 0) {\r
- count++;\r
- }\r
- }\r
- return count;\r
- }\r
- \r
- public int getPeriod(){\r
- if (period <= 0){\r
- KeyValueDao dao = KeyValueDao.getInstance();\r
- period = dao.getInt(KeyValueDao.KEY_SEARCH_PERIOD, 5);\r
- }\r
- return period;\r
- }\r
- \r
- private int getTwitTime(long id){\r
- String key = KeyValueDao.KEY_TWIT_TIME + id;\r
- Integer value = twitTimeList.get(key);\r
- if (value == null){\r
- value = 0;\r
- twitTimeList.put(key, value);\r
- }\r
- return value;\r
- }\r
-}\r
+++ /dev/null
-package com.yuji.tdb.twitter;\r
-\r
-import java.text.DateFormat;\r
-import java.text.SimpleDateFormat;\r
-import java.util.ArrayList;\r
-import java.util.Calendar;\r
-import java.util.Date;\r
-import java.util.HashMap;\r
-import java.util.List;\r
-import java.util.Map;\r
-import java.util.TimeZone;\r
-import java.util.logging.Logger;\r
-\r
-import twitter4j.Query;\r
-import twitter4j.QueryResult;\r
-import twitter4j.Status;\r
-import twitter4j.Tweet;\r
-import twitter4j.Twitter;\r
-import twitter4j.TwitterException;\r
-import twitter4j.TwitterFactory;\r
-import twitter4j.auth.AccessToken;\r
-import twitter4j.conf.ConfigurationBuilder;\r
-\r
-import com.yuji.tdb.common.CommonUtil;\r
-import com.yuji.tdb.db.KeyValueDao;\r
-import com.yuji.tdb.db.Train;\r
-import com.yuji.tdb.db.TrainDao;\r
-import com.yuji.tdb.debug.Debug;\r
-import com.yuji.tdb.utility.StringUtility;\r
-\r
-public class TwitterUtil {\r
- private static final Logger log = Logger\r
- .getLogger(TwitterUtil.class.getName());\r
- private static TwitterUtil instance = null;\r
- private static Object obj = new Object();\r
- //private DateFormat df = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");\r
- private DateFormat df = new SimpleDateFormat("HH:mm");\r
- private static List<String> keywords = null;\r
- private int period = 0;\r
- private Map<String, Long> twitTimeList = new HashMap<String, Long>();\r
- \r
- public static TwitterUtil getInstance() {\r
- if (instance == null) {\r
- synchronized (obj) {\r
- if (instance == null) {\r
- instance = new TwitterUtil();\r
- }\r
- }\r
- }\r
- return instance;\r
- }\r
-\r
- private TwitterUtil() {\r
- df.setTimeZone(TimeZone.getTimeZone("JST")); \r
- }\r
-\r
- public void main(String consumerKey, String consumerSecret, AccessToken accessToken) {\r
- try {\r
- ConfigurationBuilder confBuilder = new ConfigurationBuilder();\r
- confBuilder.setDebugEnabled(true).setOAuthConsumerKey(consumerKey)\r
- .setOAuthConsumerSecret(consumerSecret);\r
- TwitterFactory factory = new TwitterFactory(confBuilder.build());\r
- Twitter twitter = factory.getInstance(accessToken);\r
-\r
- List<Train> list = getTrainList();\r
- for (Train train : list){\r
- Calendar cal = Calendar.getInstance();\r
- Date date = cal.getTime();\r
- long cur = date.getTime();\r
-\r
- long id = train.getId();\r
- long t = getTwitTime(id);\r
- \r
- \r
- twite(twitter, train);\r
- }\r
- } catch (TwitterException e) {\r
- // TODO Auto-generated catch block\r
- e.printStackTrace();\r
- log.severe(e.toString());\r
- }\r
- }\r
-\r
- private void twite(Twitter twitter, Train train) throws TwitterException {\r
- Query query = new Query();\r
- //query.setRpp(1000); // TODO\r
- query.setQuery(train.getSearchWord());\r
- QueryResult result = null;\r
- try {\r
- result = twitter.search(query);\r
- }\r
- catch (TwitterException e){\r
- log.severe("" + Debug.getLineNo());\r
- throw e;\r
- }\r
- List<Tweet> tweets = result.getTweets();\r
- \r
- Calendar cal = Calendar.getInstance();\r
- Date date = cal.getTime();\r
- long cur = date.getTime();\r
-\r
- int count = 0;\r
- int hit = 0;\r
- int mhit = 0;\r
- int period = getPeriod();\r
- \r
- int index;\r
- int mindex = 0;\r
- int size = tweets.size();\r
- for (index = 0; index < size; index++) {\r
- Tweet tweet = tweets.get(index);\r
- \r
- Date at = tweet.getCreatedAt();\r
- long t = at.getTime();\r
- \r
- String message = tweet.getText();\r
- \r
- if (t < cur - period * 60 * 1000){\r
- System.out.println("\81~" + tweet.getFromUser() + " - "\r
- + tweet.getText() + at);\r
- continue;\r
- }\r
- hit = filter(message);\r
- if (hit <= 0) {\r
- System.out.println("\81¢" + tweet.getFromUser() + " - "\r
- + tweet.getText() + at);\r
- // \92x\89\84\88È\8aO\82Ì\8f\91\82«\8d\9e\82Ý\r
- continue;\r
- }\r
- if (hit > mhit){\r
- hit = mhit;\r
- mindex = index;\r
- }\r
-\r
- System.out.println("@" + tweet.getFromUser() + " - "\r
- + tweet.getText() + at);\r
- count++;\r
- }\r
-\r
- String message = "[" + train.getName() + "] ";\r
- if (count < train.getCount()){\r
- message += df.format(date) + " \92x\89\84\82È\82µ"; \r
- }\r
- else {\r
- int N = 100;\r
- \r
- String sample = tweets.get(mindex).getText();\r
- sample = CommonUtil.replaceString(sample, "@", "(a)");\r
- sample = StringUtility.parseSubstring(sample, N);\r
- message += df.format(date) + " " + sample + " count=" + count; \r
- }\r
- System.out.println(message); //TODO\r
- \r
- Status status = null;\r
- try {\r
- status = twitter.updateStatus(message); //TODO\r
- }\r
- catch (TwitterException e){\r
- log.severe(Debug.getLineNo() + " " + message);\r
- throw e;\r
- }\r
- }\r
- \r
- private List<Train> getTrainList(){\r
- TrainDao dao = TrainDao.getInstance();\r
- List<Train> list = dao.search();\r
- if (list.size() <= 0){\r
- Train train;\r
- \r
- train = new Train("\8b\9e\95l\93\8c\96k\90ü", "\8b\9e\95l\93\8c\96k", 5);\r
- dao.put(train);\r
- train = new Train("\93\8c\8aC\93¹\90ü", "\93\8c\8aC\93¹", 5);\r
- dao.put(train);\r
- train = new Train("\8b\9e\95l\8b}\8ds\90ü", "\8b\9e\8b}", 5);\r
- dao.put(train);\r
- list = dao.search();\r
- }\r
- return list;\r
- }\r
- \r
- public int filter(String text) {\r
- if (keywords == null) {\r
- keywords = new ArrayList<String>();\r
- keywords.add("\92x\89\84");\r
- keywords.add("\92x\82ê");\r
- keywords.add("\90U\82è\91Ö\82¦");\r
- keywords.add("\90U\91Ö");\r
- keywords.add("\92â\8e~");\r
- keywords.add("\8e\96\8cÌ");\r
- }\r
-\r
- int count = 0;\r
- for (String keyword : keywords) {\r
- if (text.indexOf(keyword) >= 0) {\r
- count++;\r
- }\r
- }\r
- return count;\r
- }\r
- \r
- public int getPeriod(){\r
- if (period <= 0){\r
- KeyValueDao dao = KeyValueDao.getInstance();\r
- period = dao.getInt(KeyValueDao.KEY_SEARCH_PERIOD, 5);\r
- }\r
- return period;\r
- }\r
- \r
- private long getTwitTime(long id){\r
- String key = KeyValueDao.KEY_TWIT_TIME + id;\r
- Long value = (long)twitTimeList.get(key);\r
- if (value == null){\r
- value = 0L;\r
- twitTimeList.put(key, value);\r
- }\r
- return value;\r
- }\r
-}\r
+++ /dev/null
-package com.yuji.tdb.db;\r
-\r
-import javax.jdo.PersistenceManager;\r
-\r
-public class KeyValueDao {\r
- public static final String KEY_CONSUMER_KEY = "CONSUMER_KEY";\r
- public static final String KEY_CONSUMER_SECRET = "CONSUMER_SECRET";\r
- public static final String KEY_REQUEST_TOKEN = "REQUEST_TOKEN";\r
- public static final String KEY_REQUEST_TOKEN_SECRET = "REQUEST_TOKEN_SECRET";\r
- public static final String KEY_ACCESS_TOKEN = "ACCESS_TOKEN";\r
- public static final String KEY_ACCESS_TOKEN_SECRET = "ACCESS_TOKEN_SECRET";\r
-\r
- public static final String KEY_SEARCH_PERIOD = "SEARCH_PERIOD";\r
-\r
- private static KeyValueDao instance = null;\r
- private PersistenceManager pm = PMFactory.get().getPersistenceManager();\r
- \r
- public static KeyValueDao getInstance(){\r
- if (instance == null){\r
- instance = new KeyValueDao();\r
- }\r
- return instance;\r
- }\r
- \r
- private KeyValueDao(){\r
- \r
- }\r
- \r
- public String get(String key){\r
- KeyValue keyValue = pm.getObjectById(KeyValue.class, key);\r
- if (keyValue == null){\r
- return null;\r
- }\r
- return keyValue.getValue();\r
- }\r
- \r
- public int getInt(String key){\r
- String value = get(key);\r
- return Integer.valueOf(value).intValue();\r
- }\r
- \r
- public void put(String key, String value){\r
- KeyValue keyValue = new KeyValue(key, value);\r
- pm.makePersistent(keyValue);\r
- }\r
-\r
- public void put(String key, int value){\r
- put(key, String.valueOf(value));\r
- }\r
-}\r
+++ /dev/null
-package com.yuji.tdb.twitter;\r
-\r
-import java.text.DateFormat;\r
-import java.text.SimpleDateFormat;\r
-import java.util.ArrayList;\r
-import java.util.Calendar;\r
-import java.util.Date;\r
-import java.util.HashMap;\r
-import java.util.List;\r
-import java.util.Map;\r
-import java.util.TimeZone;\r
-import java.util.logging.Logger;\r
-\r
-import twitter4j.Query;\r
-import twitter4j.QueryResult;\r
-import twitter4j.Status;\r
-import twitter4j.Tweet;\r
-import twitter4j.Twitter;\r
-import twitter4j.TwitterException;\r
-import twitter4j.TwitterFactory;\r
-import twitter4j.auth.AccessToken;\r
-import twitter4j.conf.ConfigurationBuilder;\r
-\r
-import com.yuji.tdb.common.CommonUtil;\r
-import com.yuji.tdb.db.KeyValueDao;\r
-import com.yuji.tdb.db.Train;\r
-import com.yuji.tdb.db.TrainDao;\r
-import com.yuji.tdb.debug.Debug;\r
-import com.yuji.tdb.utility.StringUtility;\r
-\r
-public class TwitterUtil {\r
- private static final Logger log = Logger\r
- .getLogger(TwitterUtil.class.getName());\r
- private static TwitterUtil instance = null;\r
- private static Object obj = new Object();\r
- //private DateFormat df = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");\r
- private DateFormat df = new SimpleDateFormat("HH:mm");\r
- private static List<String> keywords = null;\r
- private long searchPeriod = 0;\r
- private long twitPeriod = 0;\r
- private Map<String, Long> twitTimeList = new HashMap<String, Long>();\r
- \r
- public static TwitterUtil getInstance() {\r
- if (instance == null) {\r
- synchronized (obj) {\r
- if (instance == null) {\r
- instance = new TwitterUtil();\r
- }\r
- }\r
- }\r
- return instance;\r
- }\r
-\r
- private TwitterUtil() {\r
- df.setTimeZone(TimeZone.getTimeZone("JST")); \r
- }\r
-\r
- public void main(String consumerKey, String consumerSecret, AccessToken accessToken) {\r
- try {\r
- ConfigurationBuilder confBuilder = new ConfigurationBuilder();\r
- confBuilder.setDebugEnabled(true).setOAuthConsumerKey(consumerKey)\r
- .setOAuthConsumerSecret(consumerSecret);\r
- TwitterFactory factory = new TwitterFactory(confBuilder.build());\r
- Twitter twitter = factory.getInstance(accessToken);\r
-\r
- List<Train> list = getTrainList();\r
- for (Train train : list){\r
- Calendar cal = Calendar.getInstance();\r
- Date date = cal.getTime();\r
- long cur = date.getTime();\r
-\r
- long id = train.getId();\r
- long t = getTwitTime(id);\r
- long period = getTwitPeriod();\r
- \r
- if (t > 0 && t + period < cur){\r
- continue;\r
- }\r
-// twite(twitter, train);\r
- }\r
- } catch (TwitterException e) {\r
- // TODO Auto-generated catch block\r
- e.printStackTrace();\r
- log.severe(e.toString());\r
- }\r
- }\r
-\r
- private void twite(Twitter twitter, Train train) throws TwitterException {\r
- Query query = new Query();\r
- //query.setRpp(1000); // TODO\r
- query.setQuery(train.getSearchWord());\r
- QueryResult result = null;\r
- try {\r
- result = twitter.search(query);\r
- }\r
- catch (TwitterException e){\r
- log.severe("" + Debug.getLineNo());\r
- throw e;\r
- }\r
- List<Tweet> tweets = result.getTweets();\r
- \r
- Calendar cal = Calendar.getInstance();\r
- Date date = cal.getTime();\r
- long cur = date.getTime();\r
-\r
- int count = 0;\r
- int hit = 0;\r
- int mhit = 0;\r
- long period = getSearchPeriod();\r
- long id = train.getId();\r
- \r
- int index;\r
- int mindex = 0;\r
- int size = tweets.size();\r
- for (index = 0; index < size; index++) {\r
- Tweet tweet = tweets.get(index);\r
- \r
- Date at = tweet.getCreatedAt();\r
- long t = at.getTime();\r
- \r
- String message = tweet.getText();\r
- \r
- if (t < cur - period * 60 * 1000){\r
- System.out.println("\81~" + tweet.getFromUser() + " - "\r
- + tweet.getText() + at);\r
- continue;\r
- }\r
- hit = filter(message);\r
- if (hit <= 0) {\r
- System.out.println("\81¢" + tweet.getFromUser() + " - "\r
- + tweet.getText() + at);\r
- // \92x\89\84\88È\8aO\82Ì\8f\91\82«\8d\9e\82Ý\r
- continue;\r
- }\r
- if (hit > mhit){\r
- hit = mhit;\r
- mindex = index;\r
- }\r
-\r
- System.out.println("@" + tweet.getFromUser() + " - "\r
- + tweet.getText() + at);\r
- count++;\r
- }\r
-\r
- String message = "[" + train.getName() + "] ";\r
- if (count < train.getCount()){\r
- message += df.format(date) + " \92x\89\84\82È\82µ"; \r
- }\r
- else {\r
- int N = 100;\r
- \r
- String sample = tweets.get(mindex).getText();\r
- sample = CommonUtil.replaceString(sample, "@", "(a)");\r
- sample = StringUtility.parseSubstring(sample, N);\r
- message += df.format(date) + " " + sample + " count=" + count; \r
- }\r
- System.out.println(message); //TODO\r
- \r
- Status status = null;\r
- try {\r
- status = twitter.updateStatus(message); //TODO\r
- setTwitTime(id, cur);\r
- }\r
- catch (TwitterException e){\r
- log.severe(Debug.getLineNo() + " " + message);\r
- log.severe(Debug.getLineNo() + " " + status);\r
- throw e;\r
- }\r
- }\r
- \r
- private List<Train> getTrainList(){\r
- TrainDao dao = TrainDao.getInstance();\r
- List<Train> list = dao.search();\r
- if (list.size() <= 0){\r
- Train train;\r
- \r
- train = new Train("\8b\9e\95l\93\8c\96k\90ü", "\8b\9e\95l\93\8c\96k", 5);\r
- dao.put(train);\r
- train = new Train("\93\8c\8aC\93¹\90ü", "\93\8c\8aC\93¹", 5);\r
- dao.put(train);\r
- train = new Train("\8b\9e\95l\8b}\8ds\90ü", "\8b\9e\8b}", 5);\r
- dao.put(train);\r
- list = dao.search();\r
- }\r
- return list;\r
- }\r
- \r
- public int filter(String text) {\r
- if (keywords == null) {\r
- keywords = new ArrayList<String>();\r
- keywords.add("\92x\89\84");\r
- keywords.add("\92x\82ê");\r
- keywords.add("\90U\82è\91Ö\82¦");\r
- keywords.add("\90U\91Ö");\r
- keywords.add("\92â\8e~");\r
- keywords.add("\8e\96\8cÌ");\r
- }\r
-\r
- int count = 0;\r
- for (String keyword : keywords) {\r
- if (text.indexOf(keyword) >= 0) {\r
- count++;\r
- }\r
- }\r
- return count;\r
- }\r
- \r
- public long getSearchPeriod(){\r
- if (searchPeriod <= 0){\r
- KeyValueDao dao = KeyValueDao.getInstance();\r
- searchPeriod = dao.getInt(KeyValueDao.KEY_SEARCH_PERIOD, 5);\r
- }\r
- return searchPeriod;\r
- }\r
- \r
- public long getTwitPeriod(){\r
- if (twitPeriod <= 0){\r
- KeyValueDao dao = KeyValueDao.getInstance();\r
- twitPeriod = dao.getInt(KeyValueDao.KEY_TWIT_PERIOD, 5);\r
- }\r
- return twitPeriod;\r
- }\r
- \r
- private long getTwitTime(long id){\r
- String key = KeyValueDao.KEY_TWIT_TIME + id;\r
- Long value = twitTimeList.get(key);\r
- if (value == null){\r
- value = 0L;\r
- twitTimeList.put(key, value);\r
- }\r
- return value;\r
- }\r
- \r
- private void setTwitTime(long id, long value){\r
- String key = KeyValueDao.KEY_TWIT_TIME + id;\r
- twitTimeList.put(key, value);\r
- }\r
-}\r
+++ /dev/null
-package com.yuji.tdb.db;\r
-\r
-import javax.jdo.JDOObjectNotFoundException;\r
-import javax.jdo.PersistenceManager;\r
-\r
-public class KeyValueDao {\r
- public static final String KEY_CONSUMER_KEY = "CONSUMER_KEY";\r
- public static final String KEY_CONSUMER_SECRET = "CONSUMER_SECRET";\r
- public static final String KEY_REQUEST_TOKEN = "REQUEST_TOKEN";\r
- public static final String KEY_REQUEST_TOKEN_SECRET = "REQUEST_TOKEN_SECRET";\r
- public static final String KEY_ACCESS_TOKEN = "ACCESS_TOKEN";\r
- public static final String KEY_ACCESS_TOKEN_SECRET = "ACCESS_TOKEN_SECRET";\r
-\r
- public static final String KEY_SEARCH_PERIOD = "SEARCH_PERIOD";\r
- public static final String KEY_TWIT_PERIOD = "TWIT_PERIOD";\r
- public static final String KEY_TWIT_TIME = "TWIT_TIME_";\r
-\r
- private static KeyValueDao instance = null;\r
- private PersistenceManager pm = PMFactory.get().getPersistenceManager();\r
- \r
- public static KeyValueDao getInstance(){\r
- if (instance == null){\r
- instance = new KeyValueDao();\r
- }\r
- return instance;\r
- }\r
- \r
- private KeyValueDao(){\r
- \r
- }\r
- \r
- public String get(String key){\r
- KeyValue keyValue = null;\r
- \r
- try {\r
- keyValue = pm.getObjectById(KeyValue.class, key);\r
- }\r
- catch (JDOObjectNotFoundException e){\r
- return null; \r
- }\r
- return keyValue.getValue();\r
- }\r
- \r
- public int getInt(String key){\r
- String value = get(key);\r
- return Integer.valueOf(value).intValue();\r
- }\r
- \r
- public void put(String key, String value){\r
- KeyValue keyValue = new KeyValue(key, value);\r
- pm.makePersistent(keyValue);\r
- }\r
-\r
- public void put(String key, int value){\r
- put(key, String.valueOf(value));\r
- }\r
-\r
- public String get(String key, String initValue){\r
- String value = get(key);\r
- if (value == null){\r
- put(key, initValue);\r
- value = initValue;\r
- }\r
- return value;\r
- }\r
-\r
- public int getInt(String key, int initValue){\r
- String value = get(key);\r
- if (value == null){\r
- put(key, initValue);\r
- }\r
- return Integer.valueOf(value).intValue();\r
- }\r
-}\r
+++ /dev/null
-package com.yuji.tdb.twitter;\r
-\r
-import java.text.DateFormat;\r
-import java.text.SimpleDateFormat;\r
-import java.util.ArrayList;\r
-import java.util.Calendar;\r
-import java.util.Date;\r
-import java.util.HashMap;\r
-import java.util.List;\r
-import java.util.Map;\r
-import java.util.TimeZone;\r
-import java.util.logging.Logger;\r
-\r
-import twitter4j.Query;\r
-import twitter4j.QueryResult;\r
-import twitter4j.Status;\r
-import twitter4j.Tweet;\r
-import twitter4j.Twitter;\r
-import twitter4j.TwitterException;\r
-import twitter4j.TwitterFactory;\r
-import twitter4j.auth.AccessToken;\r
-import twitter4j.conf.ConfigurationBuilder;\r
-\r
-import com.yuji.tdb.common.CommonUtil;\r
-import com.yuji.tdb.db.KeyValueDao;\r
-import com.yuji.tdb.db.Train;\r
-import com.yuji.tdb.db.TrainDao;\r
-import com.yuji.tdb.debug.Debug;\r
-import com.yuji.tdb.utility.StringUtility;\r
-\r
-public class TwitterUtil {\r
- private static final Logger log = Logger\r
- .getLogger(TwitterUtil.class.getName());\r
- private static TwitterUtil instance = null;\r
- private static Object obj = new Object();\r
- //private DateFormat df = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");\r
- private DateFormat df = new SimpleDateFormat("HH:mm");\r
- private static List<String> keywords = null;\r
- private long searchPeriod = 0;\r
- private long twitPeriod = 0;\r
- private Map<String, Long> twitTimeList = new HashMap<String, Long>();\r
- \r
- public static TwitterUtil getInstance() {\r
- if (instance == null) {\r
- synchronized (obj) {\r
- if (instance == null) {\r
- instance = new TwitterUtil();\r
- }\r
- }\r
- }\r
- return instance;\r
- }\r
-\r
- private TwitterUtil() {\r
- df.setTimeZone(TimeZone.getTimeZone("JST")); \r
- }\r
-\r
- public void main(String consumerKey, String consumerSecret, AccessToken accessToken) {\r
- try {\r
- ConfigurationBuilder confBuilder = new ConfigurationBuilder();\r
- confBuilder.setDebugEnabled(true).setOAuthConsumerKey(consumerKey)\r
- .setOAuthConsumerSecret(consumerSecret);\r
- TwitterFactory factory = new TwitterFactory(confBuilder.build());\r
- Twitter twitter = factory.getInstance(accessToken);\r
-\r
- List<Train> list = getTrainList();\r
- for (Train train : list){\r
- Calendar cal = Calendar.getInstance();\r
- Date date = cal.getTime();\r
- long cur = date.getTime();\r
-\r
- long id = train.getId();\r
- long t = getTwitTime(id);\r
- long period = getTwitPeriod();\r
-\r
- if (t > 0 && t + period * 60 * 1000 < cur){\r
- continue;\r
- }\r
- twite(twitter, train);\r
- }\r
- } catch (TwitterException e) {\r
- // TODO Auto-generated catch block\r
- e.printStackTrace();\r
- log.severe(e.toString());\r
- }\r
- }\r
-\r
- private void twite(Twitter twitter, Train train) throws TwitterException {\r
- Query query = new Query();\r
- //query.setRpp(1000); // TODO\r
- query.setQuery(train.getSearchWord());\r
- QueryResult result = null;\r
- try {\r
- result = twitter.search(query);\r
- }\r
- catch (TwitterException e){\r
- log.severe("" + Debug.getLineNo());\r
- throw e;\r
- }\r
- List<Tweet> tweets = result.getTweets();\r
- \r
- Calendar cal = Calendar.getInstance();\r
- Date date = cal.getTime();\r
- long cur = date.getTime();\r
-\r
- int count = 0;\r
- int hit = 0;\r
- int mhit = 0;\r
- long period = getSearchPeriod();\r
- long id = train.getId();\r
- \r
- int index;\r
- int mindex = 0;\r
- int size = tweets.size();\r
- for (index = 0; index < size; index++) {\r
- Tweet tweet = tweets.get(index);\r
- \r
- Date at = tweet.getCreatedAt();\r
- long t = at.getTime();\r
- \r
- String message = tweet.getText();\r
- \r
- if (t < cur - period * 60 * 1000){\r
- System.out.println("\81~" + tweet.getFromUser() + " - "\r
- + tweet.getText() + at);\r
- continue;\r
- }\r
- hit = filter(message);\r
- if (hit <= 0) {\r
- System.out.println("\81¢" + tweet.getFromUser() + " - "\r
- + tweet.getText() + at);\r
- // \92x\89\84\88È\8aO\82Ì\8f\91\82«\8d\9e\82Ý\r
- continue;\r
- }\r
- if (hit > mhit){\r
- hit = mhit;\r
- mindex = index;\r
- }\r
-\r
- System.out.println("@" + tweet.getFromUser() + " - "\r
- + tweet.getText() + at);\r
- count++;\r
- }\r
-\r
- String message = "[" + train.getName() + "] ";\r
- if (count < train.getCount()){\r
- message += df.format(date) + " \92x\89\84\82È\82µ"; \r
- }\r
- else {\r
- int N = 100;\r
- \r
- String sample = tweets.get(mindex).getText();\r
- sample = CommonUtil.replaceString(sample, "@", "(a)");\r
- sample = StringUtility.parseSubstring(sample, N);\r
- message += df.format(date) + " " + sample + " count=" + count; \r
- }\r
- System.out.println(message); //TODO\r
- \r
-// Status status = null;\r
-// try {\r
-// status = twitter.updateStatus(message); //TODO\r
-// setTwitTime(id, cur);\r
-// }\r
-// catch (TwitterException e){\r
-// log.severe(Debug.getLineNo() + " " + message);\r
-// log.severe(Debug.getLineNo() + " " + status);\r
-// throw e;\r
-// }\r
- setTwitTime(id, cur); // TODO\r
- }\r
- \r
- private List<Train> getTrainList(){\r
- TrainDao dao = TrainDao.getInstance();\r
- List<Train> list = dao.search();\r
- if (list.size() <= 0){\r
- Train train;\r
- \r
- train = new Train("\8b\9e\95l\93\8c\96k\90ü", "\8b\9e\95l\93\8c\96k", 5);\r
- dao.put(train);\r
- train = new Train("\93\8c\8aC\93¹\90ü", "\93\8c\8aC\93¹", 5);\r
- dao.put(train);\r
- train = new Train("\8b\9e\95l\8b}\8ds\90ü", "\8b\9e\8b}", 5);\r
- dao.put(train);\r
- list = dao.search();\r
- }\r
- return list;\r
- }\r
- \r
- public int filter(String text) {\r
- if (keywords == null) {\r
- keywords = new ArrayList<String>();\r
- keywords.add("\92x\89\84");\r
- keywords.add("\92x\82ê");\r
- keywords.add("\90U\82è\91Ö\82¦");\r
- keywords.add("\90U\91Ö");\r
- keywords.add("\92â\8e~");\r
- keywords.add("\8e\96\8cÌ");\r
- }\r
-\r
- int count = 0;\r
- for (String keyword : keywords) {\r
- if (text.indexOf(keyword) >= 0) {\r
- count++;\r
- }\r
- }\r
- return count;\r
- }\r
- \r
- public long getSearchPeriod(){\r
- if (searchPeriod <= 0){\r
- KeyValueDao dao = KeyValueDao.getInstance();\r
- searchPeriod = dao.getInt(KeyValueDao.KEY_SEARCH_PERIOD, 5);\r
- }\r
- return searchPeriod;\r
- }\r
- \r
- public long getTwitPeriod(){\r
- if (twitPeriod <= 0){\r
- KeyValueDao dao = KeyValueDao.getInstance();\r
- twitPeriod = dao.getInt(KeyValueDao.KEY_TWIT_PERIOD, 5);\r
- }\r
- return twitPeriod;\r
- }\r
- \r
- private long getTwitTime(long id){\r
- String key = KeyValueDao.KEY_TWIT_TIME + id;\r
- Long value = twitTimeList.get(key);\r
- if (value == null){\r
- value = 0L;\r
- setTwitTime(id, value);\r
- }\r
- return value;\r
- }\r
- \r
- private void setTwitTime(long id, long value){\r
- String key = KeyValueDao.KEY_TWIT_TIME + id;\r
- twitTimeList.put(key, value);\r
- KeyValueDao dao = KeyValueDao.getInstance();\r
- dao.put(key, String.valueOf(value));\r
- }\r
-}\r
+++ /dev/null
-package com.yuji.tdb.twitter;\r
-\r
-import java.text.DateFormat;\r
-import java.text.SimpleDateFormat;\r
-import java.util.ArrayList;\r
-import java.util.Calendar;\r
-import java.util.Date;\r
-import java.util.HashMap;\r
-import java.util.List;\r
-import java.util.Map;\r
-import java.util.TimeZone;\r
-import java.util.logging.Logger;\r
-\r
-import twitter4j.Query;\r
-import twitter4j.QueryResult;\r
-import twitter4j.Status;\r
-import twitter4j.Tweet;\r
-import twitter4j.Twitter;\r
-import twitter4j.TwitterException;\r
-import twitter4j.TwitterFactory;\r
-import twitter4j.auth.AccessToken;\r
-import twitter4j.conf.ConfigurationBuilder;\r
-\r
-import com.yuji.tdb.common.CommonUtil;\r
-import com.yuji.tdb.db.KeyValueDao;\r
-import com.yuji.tdb.db.Train;\r
-import com.yuji.tdb.db.TrainDao;\r
-import com.yuji.tdb.debug.Debug;\r
-import com.yuji.tdb.utility.StringUtility;\r
-\r
-public class TwitterUtil {\r
- private static final Logger log = Logger\r
- .getLogger(TwitterUtil.class.getName());\r
- private static TwitterUtil instance = null;\r
- private static Object obj = new Object();\r
- //private DateFormat df = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");\r
- private DateFormat df = new SimpleDateFormat("HH:mm");\r
- private static List<String> keywords = null;\r
- private int period = 0;\r
- \r
- public static TwitterUtil getInstance() {\r
- if (instance == null) {\r
- synchronized (obj) {\r
- if (instance == null) {\r
- instance = new TwitterUtil();\r
- }\r
- }\r
- }\r
- return instance;\r
- }\r
-\r
- private TwitterUtil() {\r
- df.setTimeZone(TimeZone.getTimeZone("JST")); \r
- }\r
-\r
- public void main(String consumerKey, String consumerSecret, AccessToken accessToken) {\r
- try {\r
- ConfigurationBuilder confBuilder = new ConfigurationBuilder();\r
- confBuilder.setDebugEnabled(true).setOAuthConsumerKey(consumerKey)\r
- .setOAuthConsumerSecret(consumerSecret);\r
- TwitterFactory factory = new TwitterFactory(confBuilder.build());\r
- Twitter twitter = factory.getInstance(accessToken);\r
-\r
- List<Train> list = getTrainList();\r
- for (Train train : list){\r
- twite(twitter, train);\r
- }\r
- } catch (TwitterException e) {\r
- // TODO Auto-generated catch block\r
- e.printStackTrace();\r
- log.severe(e.toString());\r
- }\r
- }\r
-\r
- private void twite(Twitter twitter, Train train) throws TwitterException {\r
- Query query = new Query();\r
- //query.setRpp(1000); // TODO\r
- query.setQuery(train.getSearchWord());\r
- QueryResult result = null;\r
- try {\r
- result = twitter.search(query);\r
- }\r
- catch (TwitterException e){\r
- log.severe("" + Debug.getLineNo());\r
- throw e;\r
- }\r
- List<Tweet> tweets = result.getTweets();\r
- \r
- Calendar cal = Calendar.getInstance();\r
- Date date = cal.getTime();\r
- long cur = date.getTime();\r
-\r
- int count = 0;\r
- int hit = 0;\r
- int mhit = 0;\r
- int period = getPeriod();\r
- \r
- int index;\r
- int mindex = 0;\r
- int size = tweets.size();\r
- for (index = 0; index < size; index++) {\r
- Tweet tweet = tweets.get(index);\r
- \r
- Date at = tweet.getCreatedAt();\r
- long t = at.getTime();\r
- \r
- String message = tweet.getText();\r
- \r
- if (t < cur - period * 60 * 1000){\r
- System.out.println("\81~" + tweet.getFromUser() + " - "\r
- + tweet.getText() + at);\r
- continue;\r
- }\r
- hit = filter(message);\r
- if (hit <= 0) {\r
- System.out.println("\81¢" + tweet.getFromUser() + " - "\r
- + tweet.getText() + at);\r
- // \92x\89\84\88È\8aO\82Ì\8f\91\82«\8d\9e\82Ý\r
- continue;\r
- }\r
- if (hit > mhit){\r
- hit = mhit;\r
- mindex = index;\r
- }\r
-\r
- System.out.println("@" + tweet.getFromUser() + " - "\r
- + tweet.getText() + at);\r
- count++;\r
- }\r
-\r
- String message = "[" + train.getName() + "] ";\r
- if (count < train.getCount()){\r
- message += df.format(date) + " \92x\89\84\82È\82µ"; \r
- }\r
- else {\r
- int N = 100;\r
- \r
- String sample = tweets.get(mindex).getText();\r
- sample = CommonUtil.replaceString(sample, "@", "(a)");\r
- sample = StringUtility.parseSubstring(sample, N);\r
- message += df.format(date) + " " + sample + " count=" + count; \r
- }\r
- System.out.println(message); //TODO\r
- \r
- Status status = null;\r
- try {\r
- status = twitter.updateStatus(message); //TODO\r
- }\r
- catch (TwitterException e){\r
- log.severe(Debug.getLineNo() + " " + message);\r
- throw e;\r
- }\r
- }\r
- \r
- private List<Train> getTrainList(){\r
- TrainDao dao = TrainDao.getInstance();\r
- List<Train> list = dao.search();\r
- if (list.size() <= 0){\r
- Train train;\r
- \r
- train = new Train("\8b\9e\95l\93\8c\96k\90ü", "\8b\9e\95l\93\8c\96k", 5);\r
- dao.put(train);\r
- train = new Train("\93\8c\8aC\93¹\90ü", "\93\8c\8aC\93¹", 5);\r
- dao.put(train);\r
- train = new Train("\8b\9e\95l\8b}\8ds\90ü", "\8b\9e\8b}", 5);\r
- dao.put(train);\r
- list = dao.search();\r
- }\r
- return list;\r
- }\r
- \r
- public int filter(String text) {\r
- if (keywords == null) {\r
- keywords = new ArrayList<String>();\r
- keywords.add("\92x\89\84");\r
- keywords.add("\92x\82ê");\r
- keywords.add("\90U\82è\91Ö\82¦");\r
- keywords.add("\90U\91Ö");\r
- keywords.add("\92â\8e~");\r
- keywords.add("\8e\96\8cÌ");\r
- }\r
-\r
- int count = 0;\r
- for (String keyword : keywords) {\r
- if (text.indexOf(keyword) >= 0) {\r
- count++;\r
- }\r
- }\r
- return count;\r
- }\r
- \r
- public int getPeriod(){\r
- if (period <= 0){\r
- KeyValueDao dao = KeyValueDao.getInstance();\r
- period = dao.getInt(KeyValueDao.KEY_SEARCH_PERIOD, 5);\r
- }\r
- return period;\r
- }\r
- \r
- private Map<String, Integer> twitTimeList = new HashMap<String, Integer>();\r
- private int getTwitTime(long id){\r
- String key = KeyValueDao.KEY_TWIT_TIME + id;\r
- }\r
-}\r
+++ /dev/null
-package com.yuji.tdb.db;\r
-\r
-import javax.jdo.JDOObjectNotFoundException;\r
-import javax.jdo.PersistenceManager;\r
-\r
-public class KeyValueDao {\r
- public static final String KEY_CONSUMER_KEY = "CONSUMER_KEY";\r
- public static final String KEY_CONSUMER_SECRET = "CONSUMER_SECRET";\r
- public static final String KEY_REQUEST_TOKEN = "REQUEST_TOKEN";\r
- public static final String KEY_REQUEST_TOKEN_SECRET = "REQUEST_TOKEN_SECRET";\r
- public static final String KEY_ACCESS_TOKEN = "ACCESS_TOKEN";\r
- public static final String KEY_ACCESS_TOKEN_SECRET = "ACCESS_TOKEN_SECRET";\r
-\r
- public static final String KEY_SEARCH_PERIOD = "SEARCH_PERIOD";\r
- public static final String KEY_TWIT_PERIOD = "TWIT_PERIOD";\r
- public static final String KEY_TWIT_TIME = "TWIT_TIME_";\r
-\r
- private static KeyValueDao instance = null;\r
- private PersistenceManager pm = PMFactory.get().getPersistenceManager();\r
- \r
- public static KeyValueDao getInstance(){\r
- if (instance == null){\r
- instance = new KeyValueDao();\r
- }\r
- return instance;\r
- }\r
- \r
- private KeyValueDao(){\r
- \r
- }\r
- \r
- public String get(String key){\r
- KeyValue keyValue = null;\r
- \r
- try {\r
- keyValue = pm.getObjectById(KeyValue.class, key);\r
- }\r
- catch (JDOObjectNotFoundException e){\r
- return null; \r
- }\r
- return keyValue.getValue();\r
- }\r
- \r
- public int getInt(String key){\r
- String value = get(key);\r
- return Integer.valueOf(value).intValue();\r
- }\r
- \r
- public void put(String key, String value){\r
- KeyValue keyValue = new KeyValue(key, value);\r
- pm.makePersistent(keyValue);\r
- }\r
-\r
- public void put(String key, int value){\r
- put(key, String.valueOf(value));\r
- }\r
-\r
- public String get(String key, String initValue){\r
- String value = get(key);\r
- if (value == null){\r
- put(key, initValue);\r
- value = initValue;\r
- }\r
- return value;\r
- }\r
-\r
- public int getInt(String key, int initValue){\r
- String value = get(key);\r
- if (value == null){\r
- value = initValue;\r
- put(key, value);\r
- }\r
- return Integer.valueOf(value).intValue();\r
- }\r
-}\r
+++ /dev/null
-package com.yuji.tdb.twitter;\r
-\r
-import java.text.DateFormat;\r
-import java.text.SimpleDateFormat;\r
-import java.util.ArrayList;\r
-import java.util.Calendar;\r
-import java.util.Date;\r
-import java.util.HashMap;\r
-import java.util.List;\r
-import java.util.Map;\r
-import java.util.TimeZone;\r
-import java.util.logging.Logger;\r
-\r
-import twitter4j.Query;\r
-import twitter4j.QueryResult;\r
-import twitter4j.Status;\r
-import twitter4j.Tweet;\r
-import twitter4j.Twitter;\r
-import twitter4j.TwitterException;\r
-import twitter4j.TwitterFactory;\r
-import twitter4j.auth.AccessToken;\r
-import twitter4j.conf.ConfigurationBuilder;\r
-\r
-import com.yuji.tdb.common.CommonUtil;\r
-import com.yuji.tdb.db.KeyValueDao;\r
-import com.yuji.tdb.db.Train;\r
-import com.yuji.tdb.db.TrainDao;\r
-import com.yuji.tdb.debug.Debug;\r
-import com.yuji.tdb.utility.StringUtility;\r
-\r
-public class TwitterUtil {\r
- private static final Logger log = Logger\r
- .getLogger(TwitterUtil.class.getName());\r
- private static TwitterUtil instance = null;\r
- private static Object obj = new Object();\r
- //private DateFormat df = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");\r
- private DateFormat df = new SimpleDateFormat("HH:mm");\r
- private static List<String> keywords = null;\r
- private int period = 0;\r
- \r
- public static TwitterUtil getInstance() {\r
- if (instance == null) {\r
- synchronized (obj) {\r
- if (instance == null) {\r
- instance = new TwitterUtil();\r
- }\r
- }\r
- }\r
- return instance;\r
- }\r
-\r
- private TwitterUtil() {\r
- df.setTimeZone(TimeZone.getTimeZone("JST")); \r
- }\r
-\r
- public void main(String consumerKey, String consumerSecret, AccessToken accessToken) {\r
- try {\r
- ConfigurationBuilder confBuilder = new ConfigurationBuilder();\r
- confBuilder.setDebugEnabled(true).setOAuthConsumerKey(consumerKey)\r
- .setOAuthConsumerSecret(consumerSecret);\r
- TwitterFactory factory = new TwitterFactory(confBuilder.build());\r
- Twitter twitter = factory.getInstance(accessToken);\r
-\r
- List<Train> list = getTrainList();\r
- for (Train train : list){\r
- twite(twitter, train);\r
- }\r
- } catch (TwitterException e) {\r
- // TODO Auto-generated catch block\r
- e.printStackTrace();\r
- log.severe(e.toString());\r
- }\r
- }\r
-\r
- private void twite(Twitter twitter, Train train) throws TwitterException {\r
- Query query = new Query();\r
- //query.setRpp(1000); // TODO\r
- query.setQuery(train.getSearchWord());\r
- QueryResult result = null;\r
- try {\r
- result = twitter.search(query);\r
- }\r
- catch (TwitterException e){\r
- log.severe("" + Debug.getLineNo());\r
- throw e;\r
- }\r
- List<Tweet> tweets = result.getTweets();\r
- \r
- Calendar cal = Calendar.getInstance();\r
- Date date = cal.getTime();\r
- long cur = date.getTime();\r
-\r
- int count = 0;\r
- int hit = 0;\r
- int mhit = 0;\r
- int period = getPeriod();\r
- \r
- int index;\r
- int mindex = 0;\r
- int size = tweets.size();\r
- for (index = 0; index < size; index++) {\r
- Tweet tweet = tweets.get(index);\r
- \r
- Date at = tweet.getCreatedAt();\r
- long t = at.getTime();\r
- \r
- String message = tweet.getText();\r
- \r
- if (t < cur - period * 60 * 1000){\r
- System.out.println("\81~" + tweet.getFromUser() + " - "\r
- + tweet.getText() + at);\r
- continue;\r
- }\r
- hit = filter(message);\r
- if (hit <= 0) {\r
- System.out.println("\81¢" + tweet.getFromUser() + " - "\r
- + tweet.getText() + at);\r
- // \92x\89\84\88È\8aO\82Ì\8f\91\82«\8d\9e\82Ý\r
- continue;\r
- }\r
- if (hit > mhit){\r
- hit = mhit;\r
- mindex = index;\r
- }\r
-\r
- System.out.println("@" + tweet.getFromUser() + " - "\r
- + tweet.getText() + at);\r
- count++;\r
- }\r
-\r
- String message = "[" + train.getName() + "] ";\r
- if (count < train.getCount()){\r
- message += df.format(date) + " \92x\89\84\82È\82µ"; \r
- }\r
- else {\r
- int N = 100;\r
- \r
- String sample = tweets.get(mindex).getText();\r
- sample = CommonUtil.replaceString(sample, "@", "(a)");\r
- sample = StringUtility.parseSubstring(sample, N);\r
- message += df.format(date) + " " + sample + " count=" + count; \r
- }\r
- System.out.println(message); //TODO\r
- \r
- Status status = null;\r
- try {\r
- status = twitter.updateStatus(message); //TODO\r
- }\r
- catch (TwitterException e){\r
- log.severe(Debug.getLineNo() + " " + message);\r
- throw e;\r
- }\r
- }\r
- \r
- private List<Train> getTrainList(){\r
- TrainDao dao = TrainDao.getInstance();\r
- List<Train> list = dao.search();\r
- if (list.size() <= 0){\r
- Train train;\r
- \r
- train = new Train("\8b\9e\95l\93\8c\96k\90ü", "\8b\9e\95l\93\8c\96k", 5);\r
- dao.put(train);\r
- train = new Train("\93\8c\8aC\93¹\90ü", "\93\8c\8aC\93¹", 5);\r
- dao.put(train);\r
- train = new Train("\8b\9e\95l\8b}\8ds\90ü", "\8b\9e\8b}", 5);\r
- dao.put(train);\r
- list = dao.search();\r
- }\r
- return list;\r
- }\r
- \r
- public int filter(String text) {\r
- if (keywords == null) {\r
- keywords = new ArrayList<String>();\r
- keywords.add("\92x\89\84");\r
- keywords.add("\92x\82ê");\r
- keywords.add("\90U\82è\91Ö\82¦");\r
- keywords.add("\90U\91Ö");\r
- keywords.add("\92â\8e~");\r
- keywords.add("\8e\96\8cÌ");\r
- }\r
-\r
- int count = 0;\r
- for (String keyword : keywords) {\r
- if (text.indexOf(keyword) >= 0) {\r
- count++;\r
- }\r
- }\r
- return count;\r
- }\r
- \r
- public int getPeriod(){\r
- if (period <= 0){\r
- KeyValueDao dao = KeyValueDao.getInstance();\r
- period = dao.getInt(KeyValueDao.KEY_SEARCH_PERIOD, 5);\r
- }\r
- return period;\r
- }\r
- \r
- private Map<String, Integer> twitTimeList = new HashMap<String, Integer>();\r
- private int getTwitTime(long id){\r
- String key = KeyValueDao.KEY_TWIT_TIME + id;\r
- Integer value = twitTimeList.get(key);\r
- if (value == null){\r
- value = 0;\r
- twitTimeList.put(key, value);\r
- }\r
- return value;\r
- }\r
-}\r
+++ /dev/null
-package com.yuji.tdb.twitter;\r
-\r
-import java.text.DateFormat;\r
-import java.text.SimpleDateFormat;\r
-import java.util.ArrayList;\r
-import java.util.Calendar;\r
-import java.util.Date;\r
-import java.util.HashMap;\r
-import java.util.List;\r
-import java.util.Map;\r
-import java.util.TimeZone;\r
-import java.util.logging.Logger;\r
-\r
-import twitter4j.Query;\r
-import twitter4j.QueryResult;\r
-import twitter4j.Status;\r
-import twitter4j.Tweet;\r
-import twitter4j.Twitter;\r
-import twitter4j.TwitterException;\r
-import twitter4j.TwitterFactory;\r
-import twitter4j.auth.AccessToken;\r
-import twitter4j.conf.ConfigurationBuilder;\r
-\r
-import com.yuji.tdb.common.CommonUtil;\r
-import com.yuji.tdb.db.KeyValueDao;\r
-import com.yuji.tdb.db.Train;\r
-import com.yuji.tdb.db.TrainDao;\r
-import com.yuji.tdb.debug.Debug;\r
-import com.yuji.tdb.utility.StringUtility;\r
-\r
-public class TwitterUtil {\r
- private static final Logger log = Logger\r
- .getLogger(TwitterUtil.class.getName());\r
- private static TwitterUtil instance = null;\r
- private static Object obj = new Object();\r
- //private DateFormat df = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");\r
- private DateFormat df = new SimpleDateFormat("HH:mm");\r
- private static List<String> keywords = null;\r
- private long searchPeriod = 0;\r
- private long twitPeriod = 0;\r
- private Map<String, Long> twitTimeList = new HashMap<String, Long>();\r
- \r
- public static TwitterUtil getInstance() {\r
- if (instance == null) {\r
- synchronized (obj) {\r
- if (instance == null) {\r
- instance = new TwitterUtil();\r
- }\r
- }\r
- }\r
- return instance;\r
- }\r
-\r
- private TwitterUtil() {\r
- df.setTimeZone(TimeZone.getTimeZone("JST")); \r
- }\r
-\r
- public void main(String consumerKey, String consumerSecret, AccessToken accessToken) {\r
- try {\r
- ConfigurationBuilder confBuilder = new ConfigurationBuilder();\r
- confBuilder.setDebugEnabled(true).setOAuthConsumerKey(consumerKey)\r
- .setOAuthConsumerSecret(consumerSecret);\r
- TwitterFactory factory = new TwitterFactory(confBuilder.build());\r
- Twitter twitter = factory.getInstance(accessToken);\r
-\r
- List<Train> list = getTrainList();\r
- for (Train train : list){\r
- Calendar cal = Calendar.getInstance();\r
- Date date = cal.getTime();\r
- long cur = date.getTime();\r
-\r
- long id = train.getId();\r
- long t = getTwitTime(id);\r
- long period = getTwitPeriod();\r
- \r
- if (t + period < cur){\r
- continue;\r
- }\r
- twite(twitter, train);\r
- }\r
- } catch (TwitterException e) {\r
- // TODO Auto-generated catch block\r
- e.printStackTrace();\r
- log.severe(e.toString());\r
- }\r
- }\r
-\r
- private void twite(Twitter twitter, Train train) throws TwitterException {\r
- Query query = new Query();\r
- //query.setRpp(1000); // TODO\r
- query.setQuery(train.getSearchWord());\r
- QueryResult result = null;\r
- try {\r
- result = twitter.search(query);\r
- }\r
- catch (TwitterException e){\r
- log.severe("" + Debug.getLineNo());\r
- throw e;\r
- }\r
- List<Tweet> tweets = result.getTweets();\r
- \r
- Calendar cal = Calendar.getInstance();\r
- Date date = cal.getTime();\r
- long cur = date.getTime();\r
-\r
- int count = 0;\r
- int hit = 0;\r
- int mhit = 0;\r
- long period = getSearchPeriod();\r
- long id = train.getId();\r
- \r
- int index;\r
- int mindex = 0;\r
- int size = tweets.size();\r
- for (index = 0; index < size; index++) {\r
- Tweet tweet = tweets.get(index);\r
- \r
- Date at = tweet.getCreatedAt();\r
- long t = at.getTime();\r
- \r
- String message = tweet.getText();\r
- \r
- if (t < cur - period * 60 * 1000){\r
- System.out.println("\81~" + tweet.getFromUser() + " - "\r
- + tweet.getText() + at);\r
- continue;\r
- }\r
- hit = filter(message);\r
- if (hit <= 0) {\r
- System.out.println("\81¢" + tweet.getFromUser() + " - "\r
- + tweet.getText() + at);\r
- // \92x\89\84\88È\8aO\82Ì\8f\91\82«\8d\9e\82Ý\r
- continue;\r
- }\r
- if (hit > mhit){\r
- hit = mhit;\r
- mindex = index;\r
- }\r
-\r
- System.out.println("@" + tweet.getFromUser() + " - "\r
- + tweet.getText() + at);\r
- count++;\r
- }\r
-\r
- String message = "[" + train.getName() + "] ";\r
- if (count < train.getCount()){\r
- message += df.format(date) + " \92x\89\84\82È\82µ"; \r
- }\r
- else {\r
- int N = 100;\r
- \r
- String sample = tweets.get(mindex).getText();\r
- sample = CommonUtil.replaceString(sample, "@", "(a)");\r
- sample = StringUtility.parseSubstring(sample, N);\r
- message += df.format(date) + " " + sample + " count=" + count; \r
- }\r
- System.out.println(message); //TODO\r
- \r
- Status status = null;\r
- try {\r
- status = twitter.updateStatus(message); //TODO\r
- setTwitTime(id, cur);\r
- }\r
- catch (TwitterException e){\r
- log.severe(Debug.getLineNo() + " " + message);\r
- log.severe(Debug.getLineNo() + " " + status);\r
- throw e;\r
- }\r
- }\r
- \r
- private List<Train> getTrainList(){\r
- TrainDao dao = TrainDao.getInstance();\r
- List<Train> list = dao.search();\r
- if (list.size() <= 0){\r
- Train train;\r
- \r
- train = new Train("\8b\9e\95l\93\8c\96k\90ü", "\8b\9e\95l\93\8c\96k", 5);\r
- dao.put(train);\r
- train = new Train("\93\8c\8aC\93¹\90ü", "\93\8c\8aC\93¹", 5);\r
- dao.put(train);\r
- train = new Train("\8b\9e\95l\8b}\8ds\90ü", "\8b\9e\8b}", 5);\r
- dao.put(train);\r
- list = dao.search();\r
- }\r
- return list;\r
- }\r
- \r
- public int filter(String text) {\r
- if (keywords == null) {\r
- keywords = new ArrayList<String>();\r
- keywords.add("\92x\89\84");\r
- keywords.add("\92x\82ê");\r
- keywords.add("\90U\82è\91Ö\82¦");\r
- keywords.add("\90U\91Ö");\r
- keywords.add("\92â\8e~");\r
- keywords.add("\8e\96\8cÌ");\r
- }\r
-\r
- int count = 0;\r
- for (String keyword : keywords) {\r
- if (text.indexOf(keyword) >= 0) {\r
- count++;\r
- }\r
- }\r
- return count;\r
- }\r
- \r
- public long getSearchPeriod(){\r
- if (searchPeriod <= 0){\r
- KeyValueDao dao = KeyValueDao.getInstance();\r
- searchPeriod = dao.getInt(KeyValueDao.KEY_SEARCH_PERIOD, 5);\r
- }\r
- return searchPeriod;\r
- }\r
- \r
- public long getTwitPeriod(){\r
- if (twitPeriod <= 0){\r
- KeyValueDao dao = KeyValueDao.getInstance();\r
- twitPeriod = dao.getInt(KeyValueDao.KEY_TWIT_PERIOD, 5);\r
- }\r
- return twitPeriod;\r
- }\r
- \r
- private long getTwitTime(long id){\r
- String key = KeyValueDao.KEY_TWIT_TIME + id;\r
- Long value = (long)twitTimeList.get(key);\r
- if (value == null){\r
- value = 0L;\r
- twitTimeList.put(key, value);\r
- }\r
- return value;\r
- }\r
- \r
- private void setTwitTime(long id, long value){\r
- String key = KeyValueDao.KEY_TWIT_TIME + id;\r
- twitTimeList.put(key, value);\r
- }\r
-}\r
+++ /dev/null
-package com.yuji.tdb;
-
-public class Debug {
- public static int getLineNo() {
- StackTraceElement[] stackTrace = new Exception().getStackTrace();
- StackTraceElement info = stackTrace[stackTrace.length - 1];
- return info.getLineNumber();
- }
-}
+++ /dev/null
-package com.yuji.tdb.db;\r
-\r
-import javax.jdo.PersistenceManager;\r
-\r
-public class KeyValueDao {\r
- public static final String KEY_CONSUMER_KEY = "CONSUMER_KEY";\r
- public static final String KEY_CONSUMER_SECRET = "CONSUMER_SECRET";\r
- public static final String KEY_REQUEST_TOKEN = "REQUEST_TOKEN";\r
- public static final String KEY_REQUEST_TOKEN_SECRET = "REQUEST_TOKEN_SECRET";\r
- public static final String KEY_ACCESS_TOKEN = "ACCESS_TOKEN";\r
- public static final String KEY_ACCESS_TOKEN_SECRET = "ACCESS_TOKEN_SECRET";\r
-\r
- public static final String KEY_SEARCH_PERIOD = "SEARCH_PERIOD";\r
-\r
- private static KeyValueDao instance = null;\r
- private PersistenceManager pm = PMFactory.get().getPersistenceManager();\r
- \r
- public static KeyValueDao getInstance(){\r
- if (instance == null){\r
- instance = new KeyValueDao();\r
- }\r
- return instance;\r
- }\r
- \r
- private KeyValueDao(){\r
- \r
- }\r
- \r
- public String get(String key){\r
- KeyValue keyValue = pm.getObjectById(KeyValue.class, key);\r
- if (keyValue == null){\r
- return null;\r
- }\r
- return keyValue.getValue();\r
- }\r
- \r
- public int getInt(String key){\r
- String value = get(key);\r
- return Integer.valueOf(value).intValue();\r
- }\r
- \r
- public void put(String key, String value){\r
- KeyValue keyValue = new KeyValue(key, value);\r
- pm.makePersistent(keyValue);\r
- }\r
-\r
- public void put(String key, int value){\r
- put(key, String.valueOf(value));\r
- }\r
-\r
- public String get(String key, String initValue){\r
- String value = get(key);\r
- if (value == null){\r
- put(key, initValue);\r
- value = initValue;\r
- }\r
- return value;\r
- }\r
-}\r
+++ /dev/null
-package com.yuji.tdb.twitter;\r
-\r
-import java.text.DateFormat;\r
-import java.text.SimpleDateFormat;\r
-import java.util.ArrayList;\r
-import java.util.Calendar;\r
-import java.util.Date;\r
-import java.util.HashMap;\r
-import java.util.List;\r
-import java.util.Map;\r
-import java.util.TimeZone;\r
-import java.util.logging.Logger;\r
-\r
-import twitter4j.Query;\r
-import twitter4j.QueryResult;\r
-import twitter4j.Status;\r
-import twitter4j.Tweet;\r
-import twitter4j.Twitter;\r
-import twitter4j.TwitterException;\r
-import twitter4j.TwitterFactory;\r
-import twitter4j.auth.AccessToken;\r
-import twitter4j.conf.ConfigurationBuilder;\r
-\r
-import com.yuji.tdb.common.CommonUtil;\r
-import com.yuji.tdb.db.KeyValueDao;\r
-import com.yuji.tdb.db.Train;\r
-import com.yuji.tdb.db.TrainDao;\r
-import com.yuji.tdb.debug.Debug;\r
-import com.yuji.tdb.utility.StringUtility;\r
-\r
-public class TwitterUtil {\r
- private static final Logger log = Logger\r
- .getLogger(TwitterUtil.class.getName());\r
- private static TwitterUtil instance = null;\r
- private static Object obj = new Object();\r
- //private DateFormat df = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");\r
- private DateFormat df = new SimpleDateFormat("HH:mm");\r
- private static List<String> keywords = null;\r
- private long searchPeriod = 0;\r
- private long twitPeriod = 0;\r
- private Map<String, Long> twitTimeList = new HashMap<String, Long>();\r
- \r
- public static TwitterUtil getInstance() {\r
- if (instance == null) {\r
- synchronized (obj) {\r
- if (instance == null) {\r
- instance = new TwitterUtil();\r
- }\r
- }\r
- }\r
- return instance;\r
- }\r
-\r
- private TwitterUtil() {\r
- df.setTimeZone(TimeZone.getTimeZone("JST")); \r
- }\r
-\r
- public void main(String consumerKey, String consumerSecret, AccessToken accessToken) {\r
- try {\r
- ConfigurationBuilder confBuilder = new ConfigurationBuilder();\r
- confBuilder.setDebugEnabled(true).setOAuthConsumerKey(consumerKey)\r
- .setOAuthConsumerSecret(consumerSecret);\r
- TwitterFactory factory = new TwitterFactory(confBuilder.build());\r
- Twitter twitter = factory.getInstance(accessToken);\r
-\r
- List<Train> list = getTrainList();\r
- for (Train train : list){\r
- Calendar cal = Calendar.getInstance();\r
- Date date = cal.getTime();\r
- long cur = date.getTime();\r
-\r
- long id = train.getId();\r
- long t = getTwitTime(id);\r
- long period = getTwitPeriod();\r
- \r
- if (t > 0 && t + period < cur){\r
- continue;\r
- }\r
- twite(twitter, train);\r
- }\r
- } catch (TwitterException e) {\r
- // TODO Auto-generated catch block\r
- e.printStackTrace();\r
- log.severe(e.toString());\r
- }\r
- }\r
-\r
- private void twite(Twitter twitter, Train train) throws TwitterException {\r
- Query query = new Query();\r
- //query.setRpp(1000); // TODO\r
- query.setQuery(train.getSearchWord());\r
- QueryResult result = null;\r
- try {\r
- result = twitter.search(query);\r
- }\r
- catch (TwitterException e){\r
- log.severe("" + Debug.getLineNo());\r
- throw e;\r
- }\r
- List<Tweet> tweets = result.getTweets();\r
- \r
- Calendar cal = Calendar.getInstance();\r
- Date date = cal.getTime();\r
- long cur = date.getTime();\r
-\r
- int count = 0;\r
- int hit = 0;\r
- int mhit = 0;\r
- long period = getSearchPeriod();\r
- long id = train.getId();\r
- \r
- int index;\r
- int mindex = 0;\r
- int size = tweets.size();\r
- for (index = 0; index < size; index++) {\r
- Tweet tweet = tweets.get(index);\r
- \r
- Date at = tweet.getCreatedAt();\r
- long t = at.getTime();\r
- \r
- String message = tweet.getText();\r
- \r
- if (t < cur - period * 60 * 1000){\r
- System.out.println("\81~" + tweet.getFromUser() + " - "\r
- + tweet.getText() + at);\r
- continue;\r
- }\r
- hit = filter(message);\r
- if (hit <= 0) {\r
- System.out.println("\81¢" + tweet.getFromUser() + " - "\r
- + tweet.getText() + at);\r
- // \92x\89\84\88È\8aO\82Ì\8f\91\82«\8d\9e\82Ý\r
- continue;\r
- }\r
- if (hit > mhit){\r
- hit = mhit;\r
- mindex = index;\r
- }\r
-\r
- System.out.println("@" + tweet.getFromUser() + " - "\r
- + tweet.getText() + at);\r
- count++;\r
- }\r
-\r
- String message = "[" + train.getName() + "] ";\r
- if (count < train.getCount()){\r
- message += df.format(date) + " \92x\89\84\82È\82µ"; \r
- }\r
- else {\r
- int N = 100;\r
- \r
- String sample = tweets.get(mindex).getText();\r
- sample = CommonUtil.replaceString(sample, "@", "(a)");\r
- sample = StringUtility.parseSubstring(sample, N);\r
- message += df.format(date) + " " + sample + " count=" + count; \r
- }\r
- System.out.println(message); //TODO\r
- \r
- Status status = null;\r
- try {\r
- status = twitter.updateStatus(message); //TODO\r
- setTwitTime(id, cur);\r
- }\r
- catch (TwitterException e){\r
- log.severe(Debug.getLineNo() + " " + message);\r
- log.severe(Debug.getLineNo() + " " + status);\r
- throw e;\r
- }\r
- }\r
- \r
- private List<Train> getTrainList(){\r
- TrainDao dao = TrainDao.getInstance();\r
- List<Train> list = dao.search();\r
- if (list.size() <= 0){\r
- Train train;\r
- \r
- train = new Train("\8b\9e\95l\93\8c\96k\90ü", "\8b\9e\95l\93\8c\96k", 5);\r
- dao.put(train);\r
- train = new Train("\93\8c\8aC\93¹\90ü", "\93\8c\8aC\93¹", 5);\r
- dao.put(train);\r
- train = new Train("\8b\9e\95l\8b}\8ds\90ü", "\8b\9e\8b}", 5);\r
- dao.put(train);\r
- list = dao.search();\r
- }\r
- return list;\r
- }\r
- \r
- public int filter(String text) {\r
- if (keywords == null) {\r
- keywords = new ArrayList<String>();\r
- keywords.add("\92x\89\84");\r
- keywords.add("\92x\82ê");\r
- keywords.add("\90U\82è\91Ö\82¦");\r
- keywords.add("\90U\91Ö");\r
- keywords.add("\92â\8e~");\r
- keywords.add("\8e\96\8cÌ");\r
- }\r
-\r
- int count = 0;\r
- for (String keyword : keywords) {\r
- if (text.indexOf(keyword) >= 0) {\r
- count++;\r
- }\r
- }\r
- return count;\r
- }\r
- \r
- public long getSearchPeriod(){\r
- if (searchPeriod <= 0){\r
- KeyValueDao dao = KeyValueDao.getInstance();\r
- searchPeriod = dao.getInt(KeyValueDao.KEY_SEARCH_PERIOD, 5);\r
- }\r
- return searchPeriod;\r
- }\r
- \r
- public long getTwitPeriod(){\r
- if (twitPeriod <= 0){\r
- KeyValueDao dao = KeyValueDao.getInstance();\r
- twitPeriod = dao.getInt(KeyValueDao.KEY_TWIT_PERIOD, 5);\r
- }\r
- return twitPeriod;\r
- }\r
- \r
- private long getTwitTime(long id){\r
- String key = KeyValueDao.KEY_TWIT_TIME + id;\r
- Long value = twitTimeList.get(key);\r
- if (value == null){\r
- value = 0L;\r
- twitTimeList.put(key, value);\r
- }\r
- return value;\r
- }\r
- \r
- private void setTwitTime(long id, long value){\r
- String key = KeyValueDao.KEY_TWIT_TIME + id;\r
- twitTimeList.put(key, value);\r
- }\r
-}\r
+++ /dev/null
-package com.yuji.tdb.twitter;\r
-\r
-import java.text.DateFormat;\r
-import java.text.SimpleDateFormat;\r
-import java.util.ArrayList;\r
-import java.util.Calendar;\r
-import java.util.Date;\r
-import java.util.HashMap;\r
-import java.util.List;\r
-import java.util.Map;\r
-import java.util.TimeZone;\r
-import java.util.logging.Logger;\r
-\r
-import twitter4j.Query;\r
-import twitter4j.QueryResult;\r
-import twitter4j.Status;\r
-import twitter4j.Tweet;\r
-import twitter4j.Twitter;\r
-import twitter4j.TwitterException;\r
-import twitter4j.TwitterFactory;\r
-import twitter4j.auth.AccessToken;\r
-import twitter4j.conf.ConfigurationBuilder;\r
-\r
-import com.yuji.tdb.common.CommonUtil;\r
-import com.yuji.tdb.db.KeyValueDao;\r
-import com.yuji.tdb.db.Train;\r
-import com.yuji.tdb.db.TrainDao;\r
-import com.yuji.tdb.debug.Debug;\r
-import com.yuji.tdb.utility.StringUtility;\r
-\r
-public class TwitterUtil {\r
- private static final Logger log = Logger\r
- .getLogger(TwitterUtil.class.getName());\r
- private static TwitterUtil instance = null;\r
- private static Object obj = new Object();\r
- //private DateFormat df = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");\r
- private DateFormat df = new SimpleDateFormat("HH:mm");\r
- private static List<String> keywords = null;\r
- private long searchPeriod = 0;\r
- private long twitPeriod = 0;\r
- private Map<String, Long> twitTimeList = new HashMap<String, Long>();\r
- \r
- public static TwitterUtil getInstance() {\r
- if (instance == null) {\r
- synchronized (obj) {\r
- if (instance == null) {\r
- instance = new TwitterUtil();\r
- }\r
- }\r
- }\r
- return instance;\r
- }\r
-\r
- private TwitterUtil() {\r
- df.setTimeZone(TimeZone.getTimeZone("JST")); \r
- }\r
-\r
- public void main(String consumerKey, String consumerSecret, AccessToken accessToken) {\r
- try {\r
- ConfigurationBuilder confBuilder = new ConfigurationBuilder();\r
- confBuilder.setDebugEnabled(true).setOAuthConsumerKey(consumerKey)\r
- .setOAuthConsumerSecret(consumerSecret);\r
- TwitterFactory factory = new TwitterFactory(confBuilder.build());\r
- Twitter twitter = factory.getInstance(accessToken);\r
-\r
- List<Train> list = getTrainList();\r
- for (Train train : list){\r
- Calendar cal = Calendar.getInstance();\r
- Date date = cal.getTime();\r
- long cur = date.getTime();\r
-\r
- long id = train.getId();\r
- long t = getTwitTime(id);\r
- long period = getTwitPeriod();\r
-\r
- if (t > 0 && cur < t + period * 60 * 1000){\r
- continue;\r
- }\r
- twite(twitter, train);\r
- }\r
- } catch (TwitterException e) {\r
- // TODO Auto-generated catch block\r
- e.printStackTrace();\r
- log.severe(e.toString());\r
- }\r
- }\r
-\r
- private void twite(Twitter twitter, Train train) throws TwitterException {\r
- Query query = new Query();\r
- //query.setRpp(1000); // TODO\r
- query.setQuery(train.getSearchWord());\r
- QueryResult result = null;\r
- try {\r
- result = twitter.search(query);\r
- }\r
- catch (TwitterException e){\r
- log.severe("" + Debug.getLineNo());\r
- throw e;\r
- }\r
- List<Tweet> tweets = result.getTweets();\r
- \r
- Calendar cal = Calendar.getInstance();\r
- Date date = cal.getTime();\r
- long cur = date.getTime();\r
-\r
- int count = 0;\r
- int hit = 0;\r
- int mhit = 0;\r
- long period = getSearchPeriod();\r
- long id = train.getId();\r
- \r
- int index;\r
- int mindex = 0;\r
- int size = tweets.size();\r
- for (index = 0; index < size; index++) {\r
- Tweet tweet = tweets.get(index);\r
- \r
- Date at = tweet.getCreatedAt();\r
- long t = at.getTime();\r
- \r
- String message = tweet.getText();\r
- \r
- if (t < cur - period * 60 * 1000){\r
- System.out.println("\81~" + tweet.getFromUser() + " - "\r
- + tweet.getText() + at);\r
- continue;\r
- }\r
- hit = filter(message);\r
- if (hit <= 0) {\r
- System.out.println("\81¢" + tweet.getFromUser() + " - "\r
- + tweet.getText() + at);\r
- // \92x\89\84\88È\8aO\82Ì\8f\91\82«\8d\9e\82Ý\r
- continue;\r
- }\r
- if (hit > mhit){\r
- hit = mhit;\r
- mindex = index;\r
- }\r
-\r
- System.out.println("@" + tweet.getFromUser() + " - "\r
- + tweet.getText() + at);\r
- count++;\r
- }\r
-\r
- String message = "[" + train.getName() + "] ";\r
- if (count < train.getCount()){\r
- message += df.format(date) + " \92x\89\84\82È\82µ"; \r
- }\r
- else {\r
- int N = 100;\r
- \r
- String sample = tweets.get(mindex).getText();\r
- sample = CommonUtil.replaceString(sample, "@", "(a)");\r
- sample = StringUtility.parseSubstring(sample, N);\r
- message += df.format(date) + " " + sample + " count=" + count; \r
- }\r
- System.out.println(message); //TODO\r
- \r
- Status status = null;\r
- try {\r
- status = twitter.updateStatus(message); //TODO\r
- setTwitTime(id, cur);\r
- }\r
- catch (TwitterException e){\r
- log.severe(Debug.getLineNo() + " " + message);\r
- log.severe(Debug.getLineNo() + " " + status);\r
- throw e;\r
- }\r
- }\r
- \r
- private List<Train> getTrainList(){\r
- TrainDao dao = TrainDao.getInstance();\r
- List<Train> list = dao.search();\r
- if (list.size() <= 0){\r
- Train train;\r
- \r
- train = new Train("\8b\9e\95l\93\8c\96k\90ü", "\8b\9e\95l\93\8c\96k", 5);\r
- dao.put(train);\r
- train = new Train("\93\8c\8aC\93¹\90ü", "\93\8c\8aC\93¹", 5);\r
- dao.put(train);\r
- train = new Train("\8b\9e\95l\8b}\8ds\90ü", "\8b\9e\8b}", 5);\r
- dao.put(train);\r
- list = dao.search();\r
- }\r
- return list;\r
- }\r
- \r
- public int filter(String text) {\r
- if (keywords == null) {\r
- keywords = new ArrayList<String>();\r
- keywords.add("\92x\89\84");\r
- keywords.add("\92x\82ê");\r
- keywords.add("\90U\82è\91Ö\82¦");\r
- keywords.add("\90U\91Ö");\r
- keywords.add("\92â\8e~");\r
- keywords.add("\8e\96\8cÌ");\r
- }\r
-\r
- int count = 0;\r
- for (String keyword : keywords) {\r
- if (text.indexOf(keyword) >= 0) {\r
- count++;\r
- }\r
- }\r
- return count;\r
- }\r
- \r
- public long getSearchPeriod(){\r
- if (searchPeriod <= 0){\r
- KeyValueDao dao = KeyValueDao.getInstance();\r
- searchPeriod = dao.getInt(KeyValueDao.KEY_SEARCH_PERIOD, 5);\r
- }\r
- return searchPeriod;\r
- }\r
- \r
- public long getTwitPeriod(){\r
- if (twitPeriod <= 0){\r
- KeyValueDao dao = KeyValueDao.getInstance();\r
- twitPeriod = dao.getInt(KeyValueDao.KEY_TWIT_PERIOD, 10);\r
- }\r
- return twitPeriod;\r
- }\r
- \r
- private long getTwitTime(long id){\r
- String key = KeyValueDao.KEY_TWIT_TIME + id;\r
- Long value = twitTimeList.get(key);\r
- if (value == null){\r
- value = 0L;\r
- setTwitTime(id, value);\r
- }\r
- return value;\r
- }\r
- \r
- private void setTwitTime(long id, long value){\r
- String key = KeyValueDao.KEY_TWIT_TIME + id;\r
- twitTimeList.put(key, value);\r
- KeyValueDao dao = KeyValueDao.getInstance();\r
- dao.put(key, String.valueOf(value));\r
- }\r
-}\r
+++ /dev/null
-package com.yuji.tdb.twitter;\r
-\r
-import java.text.DateFormat;\r
-import java.text.SimpleDateFormat;\r
-import java.util.ArrayList;\r
-import java.util.Calendar;\r
-import java.util.Date;\r
-import java.util.List;\r
-import java.util.TimeZone;\r
-import java.util.logging.Logger;\r
-\r
-import twitter4j.Query;\r
-import twitter4j.QueryResult;\r
-import twitter4j.Status;\r
-import twitter4j.Tweet;\r
-import twitter4j.Twitter;\r
-import twitter4j.TwitterException;\r
-import twitter4j.TwitterFactory;\r
-import twitter4j.auth.AccessToken;\r
-import twitter4j.conf.ConfigurationBuilder;\r
-\r
-import com.yuji.tdb.common.CommonUtil;\r
-import com.yuji.tdb.db.KeyValueDao;\r
-import com.yuji.tdb.db.Train;\r
-import com.yuji.tdb.db.TrainDao;\r
-import com.yuji.tdb.debug.Debug;\r
-import com.yuji.tdb.utility.StringUtility;\r
-\r
-public class TwitterUtil {\r
- private static final Logger log = Logger\r
- .getLogger(TwitterUtil.class.getName());\r
- private static TwitterUtil instance = null;\r
- private static Object obj = new Object();\r
- //private DateFormat df = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");\r
- private DateFormat df = new SimpleDateFormat("HH:mm");\r
- private static List<String> keywords = null;\r
- private int period = 0;\r
- \r
- public static TwitterUtil getInstance() {\r
- if (instance == null) {\r
- synchronized (obj) {\r
- if (instance == null) {\r
- instance = new TwitterUtil();\r
- }\r
- }\r
- }\r
- return instance;\r
- }\r
-\r
- private TwitterUtil() {\r
- df.setTimeZone(TimeZone.getTimeZone("JST")); \r
- }\r
-\r
- public void main(String consumerKey, String consumerSecret, AccessToken accessToken) {\r
- try {\r
- ConfigurationBuilder confBuilder = new ConfigurationBuilder();\r
- confBuilder.setDebugEnabled(true).setOAuthConsumerKey(consumerKey)\r
- .setOAuthConsumerSecret(consumerSecret);\r
- TwitterFactory factory = new TwitterFactory(confBuilder.build());\r
- Twitter twitter = factory.getInstance(accessToken);\r
-\r
- List<Train> list = getTrainList();\r
- for (Train train : list){\r
- twite(twitter, train);\r
- }\r
- } catch (TwitterException e) {\r
- // TODO Auto-generated catch block\r
- e.printStackTrace();\r
- log.severe(e.toString());\r
- }\r
- }\r
-\r
- private void twite(Twitter twitter, Train train) throws TwitterException {\r
- Query query = new Query();\r
- //query.setRpp(1000); // TODO\r
- query.setQuery(train.getSearchWord());\r
- QueryResult result = null;\r
- try {\r
- result = twitter.search(query);\r
- }\r
- catch (TwitterException e){\r
- log.severe("" + Debug.getLineNo());\r
- throw e;\r
- }\r
- List<Tweet> tweets = result.getTweets();\r
- \r
- Calendar cal = Calendar.getInstance();\r
- Date date = cal.getTime();\r
- long cur = date.getTime();\r
-\r
- int count = 0;\r
- int hit = 0;\r
- int mhit = 0;\r
- int period = getPeriod();\r
- \r
- int index;\r
- int mindex = 0;\r
- int size = tweets.size();\r
- for (index = 0; index < size; index++) {\r
- Tweet tweet = tweets.get(index);\r
- \r
- Date at = tweet.getCreatedAt();\r
- long t = at.getTime();\r
- \r
- String message = tweet.getText();\r
- \r
- if (t < cur - period * 60 * 1000){\r
- System.out.println("\81~" + tweet.getFromUser() + " - "\r
- + tweet.getText() + at);\r
- continue;\r
- }\r
- hit = filter(message);\r
- if (hit <= 0) {\r
- System.out.println("\81¢" + tweet.getFromUser() + " - "\r
- + tweet.getText() + at);\r
- // \92x\89\84\88È\8aO\82Ì\8f\91\82«\8d\9e\82Ý\r
- continue;\r
- }\r
- if (hit > mhit){\r
- hit = mhit;\r
- mindex = index;\r
- }\r
-\r
- System.out.println("@" + tweet.getFromUser() + " - "\r
- + tweet.getText() + at);\r
- count++;\r
- }\r
-\r
- String message = "[" + train.getName() + "] ";\r
- if (count < train.getCount()){\r
- message += df.format(date) + " \92x\89\84\82È\82µ"; \r
- }\r
- else {\r
- int N = 100;\r
- \r
- String sample = tweets.get(mindex).getText();\r
- sample = CommonUtil.replaceString(sample, "@", "(a)");\r
- sample = StringUtility.parseSubstring(sample, N);\r
- message += df.format(date) + " " + sample + " count=" + count; \r
- }\r
- System.out.println(message); //TODO\r
- \r
- Status status = null;\r
- try {\r
- status = twitter.updateStatus(message); //TODO\r
- }\r
- catch (TwitterException e){\r
- log.severe(Debug.getLineNo() + " " + message);\r
- throw e;\r
- }\r
- }\r
- \r
- private List<Train> getTrainList(){\r
- TrainDao dao = TrainDao.getInstance();\r
- List<Train> list = dao.search();\r
- if (list.size() <= 0){\r
- Train train;\r
- \r
- train = new Train("\8b\9e\95l\93\8c\96k\90ü", "\8b\9e\95l\93\8c\96k", 5);\r
- dao.put(train);\r
- train = new Train("\93\8c\8aC\93¹\90ü", "\93\8c\8aC\93¹", 5);\r
- dao.put(train);\r
- train = new Train("\8b\9e\95l\8b}\8ds\90ü", "\8b\9e\8b}", 5);\r
- dao.put(train);\r
- list = dao.search();\r
- }\r
- return list;\r
- }\r
- \r
- public int filter(String text) {\r
- if (keywords == null) {\r
- keywords = new ArrayList<String>();\r
- keywords.add("\92x\89\84");\r
- keywords.add("\92x\82ê");\r
- keywords.add("\90U\82è\91Ö\82¦");\r
- keywords.add("\90U\91Ö");\r
- keywords.add("\92â\8e~");\r
- keywords.add("\8e\96\8cÌ");\r
- }\r
-\r
- int count = 0;\r
- for (String keyword : keywords) {\r
- if (text.indexOf(keyword) >= 0) {\r
- count++;\r
- }\r
- }\r
- return count;\r
- }\r
- \r
- public int getPeriod(){\r
- if (period <= 0){\r
- KeyValueDao dao = KeyValueDao.getInstance();\r
- period = dao.getInt(KeyValueDao.KEY_SEARCH_PERIOD, 5);\r
- }\r
- return period;\r
- }\r
- \r
- private Map<String, Integer> twitTimeList = new HashMap<String, Integer>();\r
- private int getTwitTime(long id){\r
- \r
- }\r
-}\r
+++ /dev/null
-package com.yuji.tdb.db;\r
-\r
-import javax.jdo.JDOObjectNotFoundException;\r
-import javax.jdo.PersistenceManager;\r
-\r
-public class KeyValueDao {\r
- public static final String KEY_CONSUMER_KEY = "CONSUMER_KEY";\r
- public static final String KEY_CONSUMER_SECRET = "CONSUMER_SECRET";\r
- public static final String KEY_REQUEST_TOKEN = "REQUEST_TOKEN";\r
- public static final String KEY_REQUEST_TOKEN_SECRET = "REQUEST_TOKEN_SECRET";\r
- public static final String KEY_ACCESS_TOKEN = "ACCESS_TOKEN";\r
- public static final String KEY_ACCESS_TOKEN_SECRET = "ACCESS_TOKEN_SECRET";\r
-\r
- public static final String KEY_SEARCH_PERIOD = "SEARCH_PERIOD";\r
- public static final String KEY_TWIT_PERIOD = "TWIT_PERIOD";\r
- public static final String KEY_TWIT_TIME = "TWIT_TIME_";\r
-\r
- private static KeyValueDao instance = null;\r
- private PersistenceManager pm = PMFactory.get().getPersistenceManager();\r
- \r
- public static KeyValueDao getInstance(){\r
- if (instance == null){\r
- instance = new KeyValueDao();\r
- }\r
- return instance;\r
- }\r
- \r
- private KeyValueDao(){\r
- \r
- }\r
- \r
- public String get(String key){\r
- KeyValue keyValue = null;\r
- \r
- try {\r
- keyValue = pm.getObjectById(KeyValue.class, key);\r
- }\r
- catch (JDOObjectNotFoundException e){\r
- return null; \r
- }\r
- return keyValue.getValue();\r
- }\r
- \r
- public int getInt(String key){\r
- String value = get(key);\r
- return Integer.valueOf(value).intValue();\r
- }\r
- \r
- public void put(String key, String value){\r
- KeyValue keyValue = new KeyValue(key, value);\r
- pm.makePersistent(keyValue);\r
- }\r
-\r
- public void put(String key, int value){\r
- put(key, String.valueOf(value));\r
- }\r
-\r
- public String get(String key, String initValue){\r
- String value = get(key);\r
- if (value == null){\r
- put(key, initValue);\r
- value = initValue;\r
- }\r
- return value;\r
- }\r
-\r
- public int getInt(String key, int initValue){\r
- String value = get(key);\r
- if (value == null){\r
- value = initValue;\r
- putInt(key, value);\r
- }\r
- return Integer.valueOf(value).intValue();\r
- }\r
-}\r
+++ /dev/null
-package com.yuji.tdb;
-
-public class Debug {
- public static int getLine() {
- StackTraceElement[] stackTrace = new Exception().getStackTrace();
- StackTraceElement info = stackTrace[stackTrace.length - 1];
- return info.getLineNumber();
- }
-}
+++ /dev/null
-package com.yuji.tdb.db;\r
-\r
-import javax.jdo.PersistenceManager;\r
-\r
-public class KeyValueDao {\r
- public static final String KEY_CONSUMER_KEY = "CONSUMER_KEY";\r
- public static final String KEY_CONSUMER_SECRET = "CONSUMER_SECRET";\r
- public static final String KEY_REQUEST_TOKEN = "REQUEST_TOKEN";\r
- public static final String KEY_REQUEST_TOKEN_SECRET = "REQUEST_TOKEN_SECRET";\r
- public static final String KEY_ACCESS_TOKEN = "ACCESS_TOKEN";\r
- public static final String KEY_ACCESS_TOKEN_SECRET = "ACCESS_TOKEN_SECRET";\r
-\r
- public static final String KEY_SEARCH_PERIOD = "SEARCH_PERIOD";\r
- public static final String KEY_TWIT_PERIOD = "TWIT_PERIOD";\r
- public static final String KEY_TWIT_TIME = "TWIT_TIME_";\r
-\r
- private static KeyValueDao instance = null;\r
- private PersistenceManager pm = PMFactory.get().getPersistenceManager();\r
- \r
- public static KeyValueDao getInstance(){\r
- if (instance == null){\r
- instance = new KeyValueDao();\r
- }\r
- return instance;\r
- }\r
- \r
- private KeyValueDao(){\r
- \r
- }\r
- \r
- public String get(String key){\r
- KeyValue keyValue = null;\r
- \r
- try {\r
- keyValue = pm.getObjectById(KeyValue.class, key);\r
- }\r
- catch (JDOObjectNotFoundException e){\r
- \r
- }\r
- if (keyValue == null){\r
- return null;\r
- }\r
- return keyValue.getValue();\r
- }\r
- \r
- public int getInt(String key){\r
- String value = get(key);\r
- return Integer.valueOf(value).intValue();\r
- }\r
- \r
- public void put(String key, String value){\r
- KeyValue keyValue = new KeyValue(key, value);\r
- pm.makePersistent(keyValue);\r
- }\r
-\r
- public void put(String key, int value){\r
- put(key, String.valueOf(value));\r
- }\r
-\r
- public String get(String key, String initValue){\r
- String value = get(key);\r
- if (value == null){\r
- put(key, initValue);\r
- value = initValue;\r
- }\r
- return value;\r
- }\r
-\r
- public int getInt(String key, int initValue){\r
- String value = get(key);\r
- if (value == null){\r
- put(key, initValue);\r
- }\r
- return Integer.valueOf(value).intValue();\r
- }\r
-}\r
+++ /dev/null
-package com.yuji.tdb.twitter;\r
-\r
-import java.text.DateFormat;\r
-import java.text.SimpleDateFormat;\r
-import java.util.ArrayList;\r
-import java.util.Calendar;\r
-import java.util.Date;\r
-import java.util.HashMap;\r
-import java.util.List;\r
-import java.util.Map;\r
-import java.util.TimeZone;\r
-import java.util.logging.Logger;\r
-\r
-import twitter4j.Query;\r
-import twitter4j.QueryResult;\r
-import twitter4j.Status;\r
-import twitter4j.Tweet;\r
-import twitter4j.Twitter;\r
-import twitter4j.TwitterException;\r
-import twitter4j.TwitterFactory;\r
-import twitter4j.auth.AccessToken;\r
-import twitter4j.conf.ConfigurationBuilder;\r
-\r
-import com.yuji.tdb.common.CommonUtil;\r
-import com.yuji.tdb.db.KeyValueDao;\r
-import com.yuji.tdb.db.Train;\r
-import com.yuji.tdb.db.TrainDao;\r
-import com.yuji.tdb.debug.Debug;\r
-import com.yuji.tdb.utility.StringUtility;\r
-\r
-public class TwitterUtil {\r
- private static final Logger log = Logger\r
- .getLogger(TwitterUtil.class.getName());\r
- private static TwitterUtil instance = null;\r
- private static Object obj = new Object();\r
- //private DateFormat df = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");\r
- private DateFormat df = new SimpleDateFormat("HH:mm");\r
- private static List<String> keywords = null;\r
- private long searchPeriod = 0;\r
- private long twitPeriod = 0;\r
- private Map<String, Long> twitTimeList = new HashMap<String, Long>();\r
- \r
- public static TwitterUtil getInstance() {\r
- if (instance == null) {\r
- synchronized (obj) {\r
- if (instance == null) {\r
- instance = new TwitterUtil();\r
- }\r
- }\r
- }\r
- return instance;\r
- }\r
-\r
- private TwitterUtil() {\r
- df.setTimeZone(TimeZone.getTimeZone("JST")); \r
- }\r
-\r
- public void main(String consumerKey, String consumerSecret, AccessToken accessToken) {\r
- try {\r
- ConfigurationBuilder confBuilder = new ConfigurationBuilder();\r
- confBuilder.setDebugEnabled(true).setOAuthConsumerKey(consumerKey)\r
- .setOAuthConsumerSecret(consumerSecret);\r
- TwitterFactory factory = new TwitterFactory(confBuilder.build());\r
- Twitter twitter = factory.getInstance(accessToken);\r
-\r
- List<Train> list = getTrainList();\r
- for (Train train : list){\r
- Calendar cal = Calendar.getInstance();\r
- Date date = cal.getTime();\r
- long cur = date.getTime();\r
-\r
- long id = train.getId();\r
- long t = getTwitTime(id);\r
- long period = getTwitPeriod();\r
- \r
- if (t + period < cur){\r
- continue;\r
- }\r
- twite(twitter, train);\r
- }\r
- } catch (TwitterException e) {\r
- // TODO Auto-generated catch block\r
- e.printStackTrace();\r
- log.severe(e.toString());\r
- }\r
- }\r
-\r
- private void twite(Twitter twitter, Train train) throws TwitterException {\r
- Query query = new Query();\r
- //query.setRpp(1000); // TODO\r
- query.setQuery(train.getSearchWord());\r
- QueryResult result = null;\r
- try {\r
- result = twitter.search(query);\r
- }\r
- catch (TwitterException e){\r
- log.severe("" + Debug.getLineNo());\r
- throw e;\r
- }\r
- List<Tweet> tweets = result.getTweets();\r
- \r
- Calendar cal = Calendar.getInstance();\r
- Date date = cal.getTime();\r
- long cur = date.getTime();\r
-\r
- int count = 0;\r
- int hit = 0;\r
- int mhit = 0;\r
- int period = getSearchPeriod();\r
- \r
- int index;\r
- int mindex = 0;\r
- int size = tweets.size();\r
- for (index = 0; index < size; index++) {\r
- Tweet tweet = tweets.get(index);\r
- \r
- Date at = tweet.getCreatedAt();\r
- long t = at.getTime();\r
- \r
- String message = tweet.getText();\r
- \r
- if (t < cur - period * 60 * 1000){\r
- System.out.println("\81~" + tweet.getFromUser() + " - "\r
- + tweet.getText() + at);\r
- continue;\r
- }\r
- hit = filter(message);\r
- if (hit <= 0) {\r
- System.out.println("\81¢" + tweet.getFromUser() + " - "\r
- + tweet.getText() + at);\r
- // \92x\89\84\88È\8aO\82Ì\8f\91\82«\8d\9e\82Ý\r
- continue;\r
- }\r
- if (hit > mhit){\r
- hit = mhit;\r
- mindex = index;\r
- }\r
-\r
- System.out.println("@" + tweet.getFromUser() + " - "\r
- + tweet.getText() + at);\r
- count++;\r
- }\r
-\r
- String message = "[" + train.getName() + "] ";\r
- if (count < train.getCount()){\r
- message += df.format(date) + " \92x\89\84\82È\82µ"; \r
- }\r
- else {\r
- int N = 100;\r
- \r
- String sample = tweets.get(mindex).getText();\r
- sample = CommonUtil.replaceString(sample, "@", "(a)");\r
- sample = StringUtility.parseSubstring(sample, N);\r
- message += df.format(date) + " " + sample + " count=" + count; \r
- }\r
- System.out.println(message); //TODO\r
- \r
- Status status = null;\r
- try {\r
- status = twitter.updateStatus(message); //TODO\r
- }\r
- catch (TwitterException e){\r
- log.severe(Debug.getLineNo() + " " + message);\r
- throw e;\r
- }\r
- }\r
- \r
- private List<Train> getTrainList(){\r
- TrainDao dao = TrainDao.getInstance();\r
- List<Train> list = dao.search();\r
- if (list.size() <= 0){\r
- Train train;\r
- \r
- train = new Train("\8b\9e\95l\93\8c\96k\90ü", "\8b\9e\95l\93\8c\96k", 5);\r
- dao.put(train);\r
- train = new Train("\93\8c\8aC\93¹\90ü", "\93\8c\8aC\93¹", 5);\r
- dao.put(train);\r
- train = new Train("\8b\9e\95l\8b}\8ds\90ü", "\8b\9e\8b}", 5);\r
- dao.put(train);\r
- list = dao.search();\r
- }\r
- return list;\r
- }\r
- \r
- public int filter(String text) {\r
- if (keywords == null) {\r
- keywords = new ArrayList<String>();\r
- keywords.add("\92x\89\84");\r
- keywords.add("\92x\82ê");\r
- keywords.add("\90U\82è\91Ö\82¦");\r
- keywords.add("\90U\91Ö");\r
- keywords.add("\92â\8e~");\r
- keywords.add("\8e\96\8cÌ");\r
- }\r
-\r
- int count = 0;\r
- for (String keyword : keywords) {\r
- if (text.indexOf(keyword) >= 0) {\r
- count++;\r
- }\r
- }\r
- return count;\r
- }\r
- \r
- public long getSearchPeriod(){\r
- if (searchPeriod <= 0){\r
- KeyValueDao dao = KeyValueDao.getInstance();\r
- searchPeriod = dao.getInt(KeyValueDao.KEY_SEARCH_PERIOD, 5);\r
- }\r
- return searchPeriod;\r
- }\r
- \r
- public long getTwitPeriod(){\r
- if (twitPeriod <= 0){\r
- KeyValueDao dao = KeyValueDao.getInstance();\r
- twitPeriod = dao.getInt(KeyValueDao.KEY_TWIT_PERIOD, 5);\r
- }\r
- return twitPeriod;\r
- }\r
- \r
- private long getTwitTime(long id){\r
- String key = KeyValueDao.KEY_TWIT_TIME + id;\r
- Long value = (long)twitTimeList.get(key);\r
- if (value == null){\r
- value = 0L;\r
- twitTimeList.put(key, value);\r
- }\r
- return value;\r
- }\r
-}\r
+++ /dev/null
-package com.yuji.tdb.twitter;\r
-\r
-import java.text.DateFormat;\r
-import java.text.SimpleDateFormat;\r
-import java.util.ArrayList;\r
-import java.util.Calendar;\r
-import java.util.Date;\r
-import java.util.HashMap;\r
-import java.util.List;\r
-import java.util.Map;\r
-import java.util.TimeZone;\r
-import java.util.logging.Logger;\r
-\r
-import twitter4j.Query;\r
-import twitter4j.QueryResult;\r
-import twitter4j.Status;\r
-import twitter4j.Tweet;\r
-import twitter4j.Twitter;\r
-import twitter4j.TwitterException;\r
-import twitter4j.TwitterFactory;\r
-import twitter4j.auth.AccessToken;\r
-import twitter4j.conf.ConfigurationBuilder;\r
-\r
-import com.yuji.tdb.common.CommonUtil;\r
-import com.yuji.tdb.db.KeyValueDao;\r
-import com.yuji.tdb.db.Train;\r
-import com.yuji.tdb.db.TrainDao;\r
-import com.yuji.tdb.debug.Debug;\r
-import com.yuji.tdb.utility.StringUtility;\r
-\r
-public class TwitterUtil {\r
- private static final Logger log = Logger\r
- .getLogger(TwitterUtil.class.getName());\r
- private static TwitterUtil instance = null;\r
- private static Object obj = new Object();\r
- //private DateFormat df = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");\r
- private DateFormat df = new SimpleDateFormat("HH:mm");\r
- private static List<String> keywords = null;\r
- private int period = 0;\r
- private Map<String, Long> twitTimeList = new HashMap<String, Long>();\r
- \r
- public static TwitterUtil getInstance() {\r
- if (instance == null) {\r
- synchronized (obj) {\r
- if (instance == null) {\r
- instance = new TwitterUtil();\r
- }\r
- }\r
- }\r
- return instance;\r
- }\r
-\r
- private TwitterUtil() {\r
- df.setTimeZone(TimeZone.getTimeZone("JST")); \r
- }\r
-\r
- public void main(String consumerKey, String consumerSecret, AccessToken accessToken) {\r
- try {\r
- ConfigurationBuilder confBuilder = new ConfigurationBuilder();\r
- confBuilder.setDebugEnabled(true).setOAuthConsumerKey(consumerKey)\r
- .setOAuthConsumerSecret(consumerSecret);\r
- TwitterFactory factory = new TwitterFactory(confBuilder.build());\r
- Twitter twitter = factory.getInstance(accessToken);\r
-\r
- List<Train> list = getTrainList();\r
- for (Train train : list){\r
- long id = train.getId();\r
- long t = getTwitTime(id);\r
- \r
- \r
- twite(twitter, train);\r
- }\r
- } catch (TwitterException e) {\r
- // TODO Auto-generated catch block\r
- e.printStackTrace();\r
- log.severe(e.toString());\r
- }\r
- }\r
-\r
- private void twite(Twitter twitter, Train train) throws TwitterException {\r
- Query query = new Query();\r
- //query.setRpp(1000); // TODO\r
- query.setQuery(train.getSearchWord());\r
- QueryResult result = null;\r
- try {\r
- result = twitter.search(query);\r
- }\r
- catch (TwitterException e){\r
- log.severe("" + Debug.getLineNo());\r
- throw e;\r
- }\r
- List<Tweet> tweets = result.getTweets();\r
- \r
- Calendar cal = Calendar.getInstance();\r
- Date date = cal.getTime();\r
- long cur = date.getTime();\r
-\r
- int count = 0;\r
- int hit = 0;\r
- int mhit = 0;\r
- int period = getPeriod();\r
- \r
- int index;\r
- int mindex = 0;\r
- int size = tweets.size();\r
- for (index = 0; index < size; index++) {\r
- Tweet tweet = tweets.get(index);\r
- \r
- Date at = tweet.getCreatedAt();\r
- long t = at.getTime();\r
- \r
- String message = tweet.getText();\r
- \r
- if (t < cur - period * 60 * 1000){\r
- System.out.println("\81~" + tweet.getFromUser() + " - "\r
- + tweet.getText() + at);\r
- continue;\r
- }\r
- hit = filter(message);\r
- if (hit <= 0) {\r
- System.out.println("\81¢" + tweet.getFromUser() + " - "\r
- + tweet.getText() + at);\r
- // \92x\89\84\88È\8aO\82Ì\8f\91\82«\8d\9e\82Ý\r
- continue;\r
- }\r
- if (hit > mhit){\r
- hit = mhit;\r
- mindex = index;\r
- }\r
-\r
- System.out.println("@" + tweet.getFromUser() + " - "\r
- + tweet.getText() + at);\r
- count++;\r
- }\r
-\r
- String message = "[" + train.getName() + "] ";\r
- if (count < train.getCount()){\r
- message += df.format(date) + " \92x\89\84\82È\82µ"; \r
- }\r
- else {\r
- int N = 100;\r
- \r
- String sample = tweets.get(mindex).getText();\r
- sample = CommonUtil.replaceString(sample, "@", "(a)");\r
- sample = StringUtility.parseSubstring(sample, N);\r
- message += df.format(date) + " " + sample + " count=" + count; \r
- }\r
- System.out.println(message); //TODO\r
- \r
- Status status = null;\r
- try {\r
- status = twitter.updateStatus(message); //TODO\r
- }\r
- catch (TwitterException e){\r
- log.severe(Debug.getLineNo() + " " + message);\r
- throw e;\r
- }\r
- }\r
- \r
- private List<Train> getTrainList(){\r
- TrainDao dao = TrainDao.getInstance();\r
- List<Train> list = dao.search();\r
- if (list.size() <= 0){\r
- Train train;\r
- \r
- train = new Train("\8b\9e\95l\93\8c\96k\90ü", "\8b\9e\95l\93\8c\96k", 5);\r
- dao.put(train);\r
- train = new Train("\93\8c\8aC\93¹\90ü", "\93\8c\8aC\93¹", 5);\r
- dao.put(train);\r
- train = new Train("\8b\9e\95l\8b}\8ds\90ü", "\8b\9e\8b}", 5);\r
- dao.put(train);\r
- list = dao.search();\r
- }\r
- return list;\r
- }\r
- \r
- public int filter(String text) {\r
- if (keywords == null) {\r
- keywords = new ArrayList<String>();\r
- keywords.add("\92x\89\84");\r
- keywords.add("\92x\82ê");\r
- keywords.add("\90U\82è\91Ö\82¦");\r
- keywords.add("\90U\91Ö");\r
- keywords.add("\92â\8e~");\r
- keywords.add("\8e\96\8cÌ");\r
- }\r
-\r
- int count = 0;\r
- for (String keyword : keywords) {\r
- if (text.indexOf(keyword) >= 0) {\r
- count++;\r
- }\r
- }\r
- return count;\r
- }\r
- \r
- public int getPeriod(){\r
- if (period <= 0){\r
- KeyValueDao dao = KeyValueDao.getInstance();\r
- period = dao.getInt(KeyValueDao.KEY_SEARCH_PERIOD, 5);\r
- }\r
- return period;\r
- }\r
- \r
- private long getTwitTime(long id){\r
- String key = KeyValueDao.KEY_TWIT_TIME + id;\r
- Long value = (long)twitTimeList.get(key);\r
- if (value == null){\r
- value = 0L;\r
- twitTimeList.put(key, value);\r
- }\r
- return value;\r
- }\r
-}\r
+++ /dev/null
-package com.yuji.tdb.twitter;\r
-\r
-import java.text.DateFormat;\r
-import java.text.SimpleDateFormat;\r
-import java.util.ArrayList;\r
-import java.util.Calendar;\r
-import java.util.Date;\r
-import java.util.HashMap;\r
-import java.util.List;\r
-import java.util.Map;\r
-import java.util.TimeZone;\r
-import java.util.logging.Logger;\r
-\r
-import twitter4j.Query;\r
-import twitter4j.QueryResult;\r
-import twitter4j.Status;\r
-import twitter4j.Tweet;\r
-import twitter4j.Twitter;\r
-import twitter4j.TwitterException;\r
-import twitter4j.TwitterFactory;\r
-import twitter4j.auth.AccessToken;\r
-import twitter4j.conf.ConfigurationBuilder;\r
-\r
-import com.yuji.tdb.common.CommonUtil;\r
-import com.yuji.tdb.db.KeyValueDao;\r
-import com.yuji.tdb.db.Train;\r
-import com.yuji.tdb.db.TrainDao;\r
-import com.yuji.tdb.debug.Debug;\r
-import com.yuji.tdb.utility.StringUtility;\r
-\r
-public class TwitterUtil {\r
- private static final Logger log = Logger\r
- .getLogger(TwitterUtil.class.getName());\r
- private static TwitterUtil instance = null;\r
- private static Object obj = new Object();\r
- //private DateFormat df = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");\r
- private DateFormat df = new SimpleDateFormat("HH:mm");\r
- private static List<String> keywords = null;\r
- private int period = 0;\r
- \r
- public static TwitterUtil getInstance() {\r
- if (instance == null) {\r
- synchronized (obj) {\r
- if (instance == null) {\r
- instance = new TwitterUtil();\r
- }\r
- }\r
- }\r
- return instance;\r
- }\r
-\r
- private TwitterUtil() {\r
- df.setTimeZone(TimeZone.getTimeZone("JST")); \r
- }\r
-\r
- public void main(String consumerKey, String consumerSecret, AccessToken accessToken) {\r
- try {\r
- ConfigurationBuilder confBuilder = new ConfigurationBuilder();\r
- confBuilder.setDebugEnabled(true).setOAuthConsumerKey(consumerKey)\r
- .setOAuthConsumerSecret(consumerSecret);\r
- TwitterFactory factory = new TwitterFactory(confBuilder.build());\r
- Twitter twitter = factory.getInstance(accessToken);\r
-\r
- List<Train> list = getTrainList();\r
- for (Train train : list){\r
- twite(twitter, train);\r
- }\r
- } catch (TwitterException e) {\r
- // TODO Auto-generated catch block\r
- e.printStackTrace();\r
- log.severe(e.toString());\r
- }\r
- }\r
-\r
- private void twite(Twitter twitter, Train train) throws TwitterException {\r
- Query query = new Query();\r
- //query.setRpp(1000); // TODO\r
- query.setQuery(train.getSearchWord());\r
- QueryResult result = null;\r
- try {\r
- result = twitter.search(query);\r
- }\r
- catch (TwitterException e){\r
- log.severe("" + Debug.getLineNo());\r
- throw e;\r
- }\r
- List<Tweet> tweets = result.getTweets();\r
- \r
- Calendar cal = Calendar.getInstance();\r
- Date date = cal.getTime();\r
- long cur = date.getTime();\r
-\r
- int count = 0;\r
- int hit = 0;\r
- int mhit = 0;\r
- int period = getPeriod();\r
- \r
- int index;\r
- int mindex = 0;\r
- int size = tweets.size();\r
- for (index = 0; index < size; index++) {\r
- Tweet tweet = tweets.get(index);\r
- \r
- Date at = tweet.getCreatedAt();\r
- long t = at.getTime();\r
- \r
- String message = tweet.getText();\r
- \r
- if (t < cur - period * 60 * 1000){\r
- System.out.println("\81~" + tweet.getFromUser() + " - "\r
- + tweet.getText() + at);\r
- continue;\r
- }\r
- hit = filter(message);\r
- if (hit <= 0) {\r
- System.out.println("\81¢" + tweet.getFromUser() + " - "\r
- + tweet.getText() + at);\r
- // \92x\89\84\88È\8aO\82Ì\8f\91\82«\8d\9e\82Ý\r
- continue;\r
- }\r
- if (hit > mhit){\r
- hit = mhit;\r
- mindex = index;\r
- }\r
-\r
- System.out.println("@" + tweet.getFromUser() + " - "\r
- + tweet.getText() + at);\r
- count++;\r
- }\r
-\r
- String message = "[" + train.getName() + "] ";\r
- if (count < train.getCount()){\r
- message += df.format(date) + " \92x\89\84\82È\82µ"; \r
- }\r
- else {\r
- int N = 100;\r
- \r
- String sample = tweets.get(mindex).getText();\r
- sample = CommonUtil.replaceString(sample, "@", "(a)");\r
- sample = StringUtility.parseSubstring(sample, N);\r
- message += df.format(date) + " " + sample + " count=" + count; \r
- }\r
- System.out.println(message); //TODO\r
- \r
- Status status = null;\r
- try {\r
- status = twitter.updateStatus(message); //TODO\r
- }\r
- catch (TwitterException e){\r
- log.severe(Debug.getLineNo() + " " + message);\r
- throw e;\r
- }\r
- }\r
- \r
- private List<Train> getTrainList(){\r
- TrainDao dao = TrainDao.getInstance();\r
- List<Train> list = dao.search();\r
- if (list.size() <= 0){\r
- Train train;\r
- \r
- train = new Train("\8b\9e\95l\93\8c\96k\90ü", "\8b\9e\95l\93\8c\96k", 5);\r
- dao.put(train);\r
- train = new Train("\93\8c\8aC\93¹\90ü", "\93\8c\8aC\93¹", 5);\r
- dao.put(train);\r
- train = new Train("\8b\9e\95l\8b}\8ds\90ü", "\8b\9e\8b}", 5);\r
- dao.put(train);\r
- list = dao.search();\r
- }\r
- return list;\r
- }\r
- \r
- public int filter(String text) {\r
- if (keywords == null) {\r
- keywords = new ArrayList<String>();\r
- keywords.add("\92x\89\84");\r
- keywords.add("\92x\82ê");\r
- keywords.add("\90U\82è\91Ö\82¦");\r
- keywords.add("\90U\91Ö");\r
- keywords.add("\92â\8e~");\r
- keywords.add("\8e\96\8cÌ");\r
- }\r
-\r
- int count = 0;\r
- for (String keyword : keywords) {\r
- if (text.indexOf(keyword) >= 0) {\r
- count++;\r
- }\r
- }\r
- return count;\r
- }\r
- \r
- public int getPeriod(){\r
- if (period <= 0){\r
- KeyValueDao dao = KeyValueDao.getInstance();\r
- period = dao.getInt(KeyValueDao.KEY_SEARCH_PERIOD, 5);\r
- }\r
- return period;\r
- }\r
- \r
- private Map<String, Integer> twitTimeList = new HashMap<String, Integer>();\r
- private int getTwitTime(long id){\r
- String key = KeyValueDao.KEY_TWIT_TIME + id;\r
- Integer value = twitTimeList.get(key);\r
- }\r
-}\r
+++ /dev/null
-package com.yuji.tdb.twitter;\r
-\r
-import java.text.DateFormat;\r
-import java.text.SimpleDateFormat;\r
-import java.util.ArrayList;\r
-import java.util.Calendar;\r
-import java.util.Date;\r
-import java.util.HashMap;\r
-import java.util.List;\r
-import java.util.Map;\r
-import java.util.TimeZone;\r
-import java.util.logging.Logger;\r
-\r
-import twitter4j.Query;\r
-import twitter4j.QueryResult;\r
-import twitter4j.Status;\r
-import twitter4j.Tweet;\r
-import twitter4j.Twitter;\r
-import twitter4j.TwitterException;\r
-import twitter4j.TwitterFactory;\r
-import twitter4j.auth.AccessToken;\r
-import twitter4j.conf.ConfigurationBuilder;\r
-\r
-import com.yuji.tdb.common.CommonUtil;\r
-import com.yuji.tdb.db.KeyValueDao;\r
-import com.yuji.tdb.db.Train;\r
-import com.yuji.tdb.db.TrainDao;\r
-import com.yuji.tdb.debug.Debug;\r
-import com.yuji.tdb.utility.StringUtility;\r
-\r
-public class TwitterUtil {\r
- private static final Logger log = Logger\r
- .getLogger(TwitterUtil.class.getName());\r
- private static TwitterUtil instance = null;\r
- private static Object obj = new Object();\r
- //private DateFormat df = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");\r
- private DateFormat df = new SimpleDateFormat("HH:mm");\r
- private static List<String> keywords = null;\r
- private long searchPeriod = 0;\r
- private long twitPeriod = 0;\r
- private Map<String, Long> twitTimeList = new HashMap<String, Long>();\r
- \r
- public static TwitterUtil getInstance() {\r
- if (instance == null) {\r
- synchronized (obj) {\r
- if (instance == null) {\r
- instance = new TwitterUtil();\r
- }\r
- }\r
- }\r
- return instance;\r
- }\r
-\r
- private TwitterUtil() {\r
- df.setTimeZone(TimeZone.getTimeZone("JST")); \r
- }\r
-\r
- public void main(String consumerKey, String consumerSecret, AccessToken accessToken) {\r
- try {\r
- ConfigurationBuilder confBuilder = new ConfigurationBuilder();\r
- confBuilder.setDebugEnabled(true).setOAuthConsumerKey(consumerKey)\r
- .setOAuthConsumerSecret(consumerSecret);\r
- TwitterFactory factory = new TwitterFactory(confBuilder.build());\r
- Twitter twitter = factory.getInstance(accessToken);\r
-\r
- List<Train> list = getTrainList();\r
- for (Train train : list){\r
- Calendar cal = Calendar.getInstance();\r
- Date date = cal.getTime();\r
- long cur = date.getTime();\r
-\r
- long id = train.getId();\r
- long t = getTwitTime(id);\r
- long period = getTwitPeriod();\r
- \r
- if (t + period < cur){\r
- contimue;\r
- }\r
- \r
- \r
- \r
- twite(twitter, train);\r
- }\r
- } catch (TwitterException e) {\r
- // TODO Auto-generated catch block\r
- e.printStackTrace();\r
- log.severe(e.toString());\r
- }\r
- }\r
-\r
- private void twite(Twitter twitter, Train train) throws TwitterException {\r
- Query query = new Query();\r
- //query.setRpp(1000); // TODO\r
- query.setQuery(train.getSearchWord());\r
- QueryResult result = null;\r
- try {\r
- result = twitter.search(query);\r
- }\r
- catch (TwitterException e){\r
- log.severe("" + Debug.getLineNo());\r
- throw e;\r
- }\r
- List<Tweet> tweets = result.getTweets();\r
- \r
- Calendar cal = Calendar.getInstance();\r
- Date date = cal.getTime();\r
- long cur = date.getTime();\r
-\r
- int count = 0;\r
- int hit = 0;\r
- int mhit = 0;\r
- int period = getSearchPeriod();\r
- \r
- int index;\r
- int mindex = 0;\r
- int size = tweets.size();\r
- for (index = 0; index < size; index++) {\r
- Tweet tweet = tweets.get(index);\r
- \r
- Date at = tweet.getCreatedAt();\r
- long t = at.getTime();\r
- \r
- String message = tweet.getText();\r
- \r
- if (t < cur - period * 60 * 1000){\r
- System.out.println("\81~" + tweet.getFromUser() + " - "\r
- + tweet.getText() + at);\r
- continue;\r
- }\r
- hit = filter(message);\r
- if (hit <= 0) {\r
- System.out.println("\81¢" + tweet.getFromUser() + " - "\r
- + tweet.getText() + at);\r
- // \92x\89\84\88È\8aO\82Ì\8f\91\82«\8d\9e\82Ý\r
- continue;\r
- }\r
- if (hit > mhit){\r
- hit = mhit;\r
- mindex = index;\r
- }\r
-\r
- System.out.println("@" + tweet.getFromUser() + " - "\r
- + tweet.getText() + at);\r
- count++;\r
- }\r
-\r
- String message = "[" + train.getName() + "] ";\r
- if (count < train.getCount()){\r
- message += df.format(date) + " \92x\89\84\82È\82µ"; \r
- }\r
- else {\r
- int N = 100;\r
- \r
- String sample = tweets.get(mindex).getText();\r
- sample = CommonUtil.replaceString(sample, "@", "(a)");\r
- sample = StringUtility.parseSubstring(sample, N);\r
- message += df.format(date) + " " + sample + " count=" + count; \r
- }\r
- System.out.println(message); //TODO\r
- \r
- Status status = null;\r
- try {\r
- status = twitter.updateStatus(message); //TODO\r
- }\r
- catch (TwitterException e){\r
- log.severe(Debug.getLineNo() + " " + message);\r
- throw e;\r
- }\r
- }\r
- \r
- private List<Train> getTrainList(){\r
- TrainDao dao = TrainDao.getInstance();\r
- List<Train> list = dao.search();\r
- if (list.size() <= 0){\r
- Train train;\r
- \r
- train = new Train("\8b\9e\95l\93\8c\96k\90ü", "\8b\9e\95l\93\8c\96k", 5);\r
- dao.put(train);\r
- train = new Train("\93\8c\8aC\93¹\90ü", "\93\8c\8aC\93¹", 5);\r
- dao.put(train);\r
- train = new Train("\8b\9e\95l\8b}\8ds\90ü", "\8b\9e\8b}", 5);\r
- dao.put(train);\r
- list = dao.search();\r
- }\r
- return list;\r
- }\r
- \r
- public int filter(String text) {\r
- if (keywords == null) {\r
- keywords = new ArrayList<String>();\r
- keywords.add("\92x\89\84");\r
- keywords.add("\92x\82ê");\r
- keywords.add("\90U\82è\91Ö\82¦");\r
- keywords.add("\90U\91Ö");\r
- keywords.add("\92â\8e~");\r
- keywords.add("\8e\96\8cÌ");\r
- }\r
-\r
- int count = 0;\r
- for (String keyword : keywords) {\r
- if (text.indexOf(keyword) >= 0) {\r
- count++;\r
- }\r
- }\r
- return count;\r
- }\r
- \r
- public int getSearchPeriod(){\r
- if (searchPeriod <= 0){\r
- KeyValueDao dao = KeyValueDao.getInstance();\r
- searchPeriod = dao.getInt(KeyValueDao.KEY_SEARCH_PERIOD, 5);\r
- }\r
- return searchPeriod;\r
- }\r
- \r
- public int getTwitPeriod(){\r
- if (twitPeriod <= 0){\r
- KeyValueDao dao = KeyValueDao.getInstance();\r
- twitPeriod = dao.getInt(KeyValueDao.KEY_TWIT_PERIOD, 5);\r
- }\r
- return searchPeriod;\r
- }\r
- \r
- private long getTwitTime(long id){\r
- String key = KeyValueDao.KEY_TWIT_TIME + id;\r
- Long value = (long)twitTimeList.get(key);\r
- if (value == null){\r
- value = 0L;\r
- twitTimeList.put(key, value);\r
- }\r
- return value;\r
- }\r
-}\r
+++ /dev/null
-package com.yuji.tdb.twitter;\r
-\r
-import java.text.DateFormat;\r
-import java.text.SimpleDateFormat;\r
-import java.util.ArrayList;\r
-import java.util.Calendar;\r
-import java.util.Date;\r
-import java.util.HashMap;\r
-import java.util.List;\r
-import java.util.Map;\r
-import java.util.TimeZone;\r
-import java.util.logging.Logger;\r
-\r
-import twitter4j.Query;\r
-import twitter4j.QueryResult;\r
-import twitter4j.Status;\r
-import twitter4j.Tweet;\r
-import twitter4j.Twitter;\r
-import twitter4j.TwitterException;\r
-import twitter4j.TwitterFactory;\r
-import twitter4j.auth.AccessToken;\r
-import twitter4j.conf.ConfigurationBuilder;\r
-\r
-import com.yuji.tdb.common.CommonUtil;\r
-import com.yuji.tdb.db.KeyValueDao;\r
-import com.yuji.tdb.db.Train;\r
-import com.yuji.tdb.db.TrainDao;\r
-import com.yuji.tdb.debug.Debug;\r
-import com.yuji.tdb.utility.StringUtility;\r
-\r
-public class TwitterUtil {\r
- private static final Logger log = Logger\r
- .getLogger(TwitterUtil.class.getName());\r
- private static TwitterUtil instance = null;\r
- private static Object obj = new Object();\r
- //private DateFormat df = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");\r
- private DateFormat df = new SimpleDateFormat("HH:mm");\r
- private static List<String> keywords = null;\r
- private long searchPeriod = 0;\r
- private long twitPeriod = 0;\r
- private Map<String, Long> twitTimeList = new HashMap<String, Long>();\r
- \r
- public static TwitterUtil getInstance() {\r
- if (instance == null) {\r
- synchronized (obj) {\r
- if (instance == null) {\r
- instance = new TwitterUtil();\r
- }\r
- }\r
- }\r
- return instance;\r
- }\r
-\r
- private TwitterUtil() {\r
- df.setTimeZone(TimeZone.getTimeZone("JST")); \r
- }\r
-\r
- public void main(String consumerKey, String consumerSecret, AccessToken accessToken) {\r
- try {\r
- ConfigurationBuilder confBuilder = new ConfigurationBuilder();\r
- confBuilder.setDebugEnabled(true).setOAuthConsumerKey(consumerKey)\r
- .setOAuthConsumerSecret(consumerSecret);\r
- TwitterFactory factory = new TwitterFactory(confBuilder.build());\r
- Twitter twitter = factory.getInstance(accessToken);\r
-\r
- List<Train> list = getTrainList();\r
- for (Train train : list){\r
- Calendar cal = Calendar.getInstance();\r
- Date date = cal.getTime();\r
- long cur = date.getTime();\r
-\r
- long id = train.getId();\r
- long t = getTwitTime(id);\r
- long period = getTwitPeriod();\r
- \r
- \r
- \r
- twite(twitter, train);\r
- }\r
- } catch (TwitterException e) {\r
- // TODO Auto-generated catch block\r
- e.printStackTrace();\r
- log.severe(e.toString());\r
- }\r
- }\r
-\r
- private void twite(Twitter twitter, Train train) throws TwitterException {\r
- Query query = new Query();\r
- //query.setRpp(1000); // TODO\r
- query.setQuery(train.getSearchWord());\r
- QueryResult result = null;\r
- try {\r
- result = twitter.search(query);\r
- }\r
- catch (TwitterException e){\r
- log.severe("" + Debug.getLineNo());\r
- throw e;\r
- }\r
- List<Tweet> tweets = result.getTweets();\r
- \r
- Calendar cal = Calendar.getInstance();\r
- Date date = cal.getTime();\r
- long cur = date.getTime();\r
-\r
- int count = 0;\r
- int hit = 0;\r
- int mhit = 0;\r
- int period = getSearchPeriod();\r
- \r
- int index;\r
- int mindex = 0;\r
- int size = tweets.size();\r
- for (index = 0; index < size; index++) {\r
- Tweet tweet = tweets.get(index);\r
- \r
- Date at = tweet.getCreatedAt();\r
- long t = at.getTime();\r
- \r
- String message = tweet.getText();\r
- \r
- if (t < cur - period * 60 * 1000){\r
- System.out.println("\81~" + tweet.getFromUser() + " - "\r
- + tweet.getText() + at);\r
- continue;\r
- }\r
- hit = filter(message);\r
- if (hit <= 0) {\r
- System.out.println("\81¢" + tweet.getFromUser() + " - "\r
- + tweet.getText() + at);\r
- // \92x\89\84\88È\8aO\82Ì\8f\91\82«\8d\9e\82Ý\r
- continue;\r
- }\r
- if (hit > mhit){\r
- hit = mhit;\r
- mindex = index;\r
- }\r
-\r
- System.out.println("@" + tweet.getFromUser() + " - "\r
- + tweet.getText() + at);\r
- count++;\r
- }\r
-\r
- String message = "[" + train.getName() + "] ";\r
- if (count < train.getCount()){\r
- message += df.format(date) + " \92x\89\84\82È\82µ"; \r
- }\r
- else {\r
- int N = 100;\r
- \r
- String sample = tweets.get(mindex).getText();\r
- sample = CommonUtil.replaceString(sample, "@", "(a)");\r
- sample = StringUtility.parseSubstring(sample, N);\r
- message += df.format(date) + " " + sample + " count=" + count; \r
- }\r
- System.out.println(message); //TODO\r
- \r
- Status status = null;\r
- try {\r
- status = twitter.updateStatus(message); //TODO\r
- }\r
- catch (TwitterException e){\r
- log.severe(Debug.getLineNo() + " " + message);\r
- throw e;\r
- }\r
- }\r
- \r
- private List<Train> getTrainList(){\r
- TrainDao dao = TrainDao.getInstance();\r
- List<Train> list = dao.search();\r
- if (list.size() <= 0){\r
- Train train;\r
- \r
- train = new Train("\8b\9e\95l\93\8c\96k\90ü", "\8b\9e\95l\93\8c\96k", 5);\r
- dao.put(train);\r
- train = new Train("\93\8c\8aC\93¹\90ü", "\93\8c\8aC\93¹", 5);\r
- dao.put(train);\r
- train = new Train("\8b\9e\95l\8b}\8ds\90ü", "\8b\9e\8b}", 5);\r
- dao.put(train);\r
- list = dao.search();\r
- }\r
- return list;\r
- }\r
- \r
- public int filter(String text) {\r
- if (keywords == null) {\r
- keywords = new ArrayList<String>();\r
- keywords.add("\92x\89\84");\r
- keywords.add("\92x\82ê");\r
- keywords.add("\90U\82è\91Ö\82¦");\r
- keywords.add("\90U\91Ö");\r
- keywords.add("\92â\8e~");\r
- keywords.add("\8e\96\8cÌ");\r
- }\r
-\r
- int count = 0;\r
- for (String keyword : keywords) {\r
- if (text.indexOf(keyword) >= 0) {\r
- count++;\r
- }\r
- }\r
- return count;\r
- }\r
- \r
- public int getSearchPeriod(){\r
- if (searchPeriod <= 0){\r
- KeyValueDao dao = KeyValueDao.getInstance();\r
- searchPeriod = dao.getInt(KeyValueDao.KEY_SEARCH_PERIOD, 5);\r
- }\r
- return searchPeriod;\r
- }\r
- \r
- public int getTwitPeriod(){\r
- if (twitPeriod <= 0){\r
- KeyValueDao dao = KeyValueDao.getInstance();\r
- twitPeriod = dao.getInt(KeyValueDao.KEY_TWIT_PERIOD, 5);\r
- }\r
- return searchPeriod;\r
- }\r
- \r
- private long getTwitTime(long id){\r
- String key = KeyValueDao.KEY_TWIT_TIME + id;\r
- Long value = (long)twitTimeList.get(key);\r
- if (value == null){\r
- value = 0L;\r
- twitTimeList.put(key, value);\r
- }\r
- return value;\r
- }\r
-}\r
+++ /dev/null
-package com.yuji.tdb.twitter;\r
-\r
-import java.text.DateFormat;\r
-import java.text.SimpleDateFormat;\r
-import java.util.ArrayList;\r
-import java.util.Calendar;\r
-import java.util.Date;\r
-import java.util.HashMap;\r
-import java.util.List;\r
-import java.util.Map;\r
-import java.util.TimeZone;\r
-import java.util.logging.Logger;\r
-\r
-import twitter4j.Query;\r
-import twitter4j.QueryResult;\r
-import twitter4j.Status;\r
-import twitter4j.Tweet;\r
-import twitter4j.Twitter;\r
-import twitter4j.TwitterException;\r
-import twitter4j.TwitterFactory;\r
-import twitter4j.auth.AccessToken;\r
-import twitter4j.conf.ConfigurationBuilder;\r
-\r
-import com.yuji.tdb.common.CommonUtil;\r
-import com.yuji.tdb.db.KeyValueDao;\r
-import com.yuji.tdb.db.Train;\r
-import com.yuji.tdb.db.TrainDao;\r
-import com.yuji.tdb.debug.Debug;\r
-import com.yuji.tdb.utility.StringUtility;\r
-\r
-public class TwitterUtil {\r
- private static final Logger log = Logger\r
- .getLogger(TwitterUtil.class.getName());\r
- private static TwitterUtil instance = null;\r
- private static Object obj = new Object();\r
- //private DateFormat df = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");\r
- private DateFormat df = new SimpleDateFormat("HH:mm");\r
- private static List<String> keywords = null;\r
- private long searchPeriod = 0;\r
- private long twitPeriod = 0;\r
- private Map<String, Long> twitTimeList = new HashMap<String, Long>();\r
- \r
- public static TwitterUtil getInstance() {\r
- if (instance == null) {\r
- synchronized (obj) {\r
- if (instance == null) {\r
- instance = new TwitterUtil();\r
- }\r
- }\r
- }\r
- return instance;\r
- }\r
-\r
- private TwitterUtil() {\r
- df.setTimeZone(TimeZone.getTimeZone("JST")); \r
- }\r
-\r
- public void main(String consumerKey, String consumerSecret, AccessToken accessToken) {\r
- try {\r
- ConfigurationBuilder confBuilder = new ConfigurationBuilder();\r
- confBuilder.setDebugEnabled(true).setOAuthConsumerKey(consumerKey)\r
- .setOAuthConsumerSecret(consumerSecret);\r
- TwitterFactory factory = new TwitterFactory(confBuilder.build());\r
- Twitter twitter = factory.getInstance(accessToken);\r
-\r
- List<Train> list = getTrainList();\r
- for (Train train : list){\r
- Calendar cal = Calendar.getInstance();\r
- Date date = cal.getTime();\r
- long cur = date.getTime();\r
-\r
- long id = train.getId();\r
- long t = getTwitTime(id);\r
- long period = getTwitPeriod();\r
-\r
- if (t > 0 && t + period < cur){\r
- continue;\r
- }\r
- twite(twitter, train);\r
- }\r
- } catch (TwitterException e) {\r
- // TODO Auto-generated catch block\r
- e.printStackTrace();\r
- log.severe(e.toString());\r
- }\r
- }\r
-\r
- private void twite(Twitter twitter, Train train) throws TwitterException {\r
- Query query = new Query();\r
- //query.setRpp(1000); // TODO\r
- query.setQuery(train.getSearchWord());\r
- QueryResult result = null;\r
- try {\r
- result = twitter.search(query);\r
- }\r
- catch (TwitterException e){\r
- log.severe("" + Debug.getLineNo());\r
- throw e;\r
- }\r
- List<Tweet> tweets = result.getTweets();\r
- \r
- Calendar cal = Calendar.getInstance();\r
- Date date = cal.getTime();\r
- long cur = date.getTime();\r
-\r
- int count = 0;\r
- int hit = 0;\r
- int mhit = 0;\r
- long period = getSearchPeriod();\r
- long id = train.getId();\r
- \r
- int index;\r
- int mindex = 0;\r
- int size = tweets.size();\r
- for (index = 0; index < size; index++) {\r
- Tweet tweet = tweets.get(index);\r
- \r
- Date at = tweet.getCreatedAt();\r
- long t = at.getTime();\r
- \r
- String message = tweet.getText();\r
- \r
- if (t < cur - period * 60 * 1000){\r
- System.out.println("\81~" + tweet.getFromUser() + " - "\r
- + tweet.getText() + at);\r
- continue;\r
- }\r
- hit = filter(message);\r
- if (hit <= 0) {\r
- System.out.println("\81¢" + tweet.getFromUser() + " - "\r
- + tweet.getText() + at);\r
- // \92x\89\84\88È\8aO\82Ì\8f\91\82«\8d\9e\82Ý\r
- continue;\r
- }\r
- if (hit > mhit){\r
- hit = mhit;\r
- mindex = index;\r
- }\r
-\r
- System.out.println("@" + tweet.getFromUser() + " - "\r
- + tweet.getText() + at);\r
- count++;\r
- }\r
-\r
- String message = "[" + train.getName() + "] ";\r
- if (count < train.getCount()){\r
- message += df.format(date) + " \92x\89\84\82È\82µ"; \r
- }\r
- else {\r
- int N = 100;\r
- \r
- String sample = tweets.get(mindex).getText();\r
- sample = CommonUtil.replaceString(sample, "@", "(a)");\r
- sample = StringUtility.parseSubstring(sample, N);\r
- message += df.format(date) + " " + sample + " count=" + count; \r
- }\r
- System.out.println(message); //TODO\r
- \r
- Status status = null;\r
- try {\r
- status = twitter.updateStatus(message); //TODO\r
- setTwitTime(id, cur);\r
- }\r
- catch (TwitterException e){\r
- log.severe(Debug.getLineNo() + " " + message);\r
- log.severe(Debug.getLineNo() + " " + status);\r
- throw e;\r
- }\r
- }\r
- \r
- private List<Train> getTrainList(){\r
- TrainDao dao = TrainDao.getInstance();\r
- List<Train> list = dao.search();\r
- if (list.size() <= 0){\r
- Train train;\r
- \r
- train = new Train("\8b\9e\95l\93\8c\96k\90ü", "\8b\9e\95l\93\8c\96k", 5);\r
- dao.put(train);\r
- train = new Train("\93\8c\8aC\93¹\90ü", "\93\8c\8aC\93¹", 5);\r
- dao.put(train);\r
- train = new Train("\8b\9e\95l\8b}\8ds\90ü", "\8b\9e\8b}", 5);\r
- dao.put(train);\r
- list = dao.search();\r
- }\r
- return list;\r
- }\r
- \r
- public int filter(String text) {\r
- if (keywords == null) {\r
- keywords = new ArrayList<String>();\r
- keywords.add("\92x\89\84");\r
- keywords.add("\92x\82ê");\r
- keywords.add("\90U\82è\91Ö\82¦");\r
- keywords.add("\90U\91Ö");\r
- keywords.add("\92â\8e~");\r
- keywords.add("\8e\96\8cÌ");\r
- }\r
-\r
- int count = 0;\r
- for (String keyword : keywords) {\r
- if (text.indexOf(keyword) >= 0) {\r
- count++;\r
- }\r
- }\r
- return count;\r
- }\r
- \r
- public long getSearchPeriod(){\r
- if (searchPeriod <= 0){\r
- KeyValueDao dao = KeyValueDao.getInstance();\r
- searchPeriod = dao.getInt(KeyValueDao.KEY_SEARCH_PERIOD, 5);\r
- }\r
- return searchPeriod;\r
- }\r
- \r
- public long getTwitPeriod(){\r
- if (twitPeriod <= 0){\r
- KeyValueDao dao = KeyValueDao.getInstance();\r
- twitPeriod = dao.getInt(KeyValueDao.KEY_TWIT_PERIOD, 5);\r
- }\r
- return twitPeriod;\r
- }\r
- \r
- private long getTwitTime(long id){\r
- String key = KeyValueDao.KEY_TWIT_TIME + id;\r
- Long value = twitTimeList.get(key);\r
- if (value == null){\r
- value = 0L;\r
- twitTimeList.put(key, value);\r
- }\r
- return value;\r
- }\r
- \r
- private void setTwitTime(long id, long value){\r
- String key = KeyValueDao.KEY_TWIT_TIME + id;\r
- twitTimeList.put(key, value);\r
- }\r
-}\r
+++ /dev/null
-package com.yuji.tdb.twitter;\r
-\r
-import java.text.DateFormat;\r
-import java.text.SimpleDateFormat;\r
-import java.util.ArrayList;\r
-import java.util.Calendar;\r
-import java.util.Date;\r
-import java.util.HashMap;\r
-import java.util.List;\r
-import java.util.Map;\r
-import java.util.TimeZone;\r
-import java.util.logging.Logger;\r
-\r
-import twitter4j.Query;\r
-import twitter4j.QueryResult;\r
-import twitter4j.Status;\r
-import twitter4j.Tweet;\r
-import twitter4j.Twitter;\r
-import twitter4j.TwitterException;\r
-import twitter4j.TwitterFactory;\r
-import twitter4j.auth.AccessToken;\r
-import twitter4j.conf.ConfigurationBuilder;\r
-\r
-import com.yuji.tdb.common.CommonUtil;\r
-import com.yuji.tdb.db.KeyValueDao;\r
-import com.yuji.tdb.db.Train;\r
-import com.yuji.tdb.db.TrainDao;\r
-import com.yuji.tdb.debug.Debug;\r
-import com.yuji.tdb.utility.StringUtility;\r
-\r
-public class TwitterUtil {\r
- private static final Logger log = Logger\r
- .getLogger(TwitterUtil.class.getName());\r
- private static TwitterUtil instance = null;\r
- private static Object obj = new Object();\r
- //private DateFormat df = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");\r
- private DateFormat df = new SimpleDateFormat("HH:mm");\r
- private static List<String> keywords = null;\r
- private int period = 0;\r
- private Map<String, Long> twitTimeList = new HashMap<String, Long>();\r
- \r
- public static TwitterUtil getInstance() {\r
- if (instance == null) {\r
- synchronized (obj) {\r
- if (instance == null) {\r
- instance = new TwitterUtil();\r
- }\r
- }\r
- }\r
- return instance;\r
- }\r
-\r
- private TwitterUtil() {\r
- df.setTimeZone(TimeZone.getTimeZone("JST")); \r
- }\r
-\r
- public void main(String consumerKey, String consumerSecret, AccessToken accessToken) {\r
- try {\r
- ConfigurationBuilder confBuilder = new ConfigurationBuilder();\r
- confBuilder.setDebugEnabled(true).setOAuthConsumerKey(consumerKey)\r
- .setOAuthConsumerSecret(consumerSecret);\r
- TwitterFactory factory = new TwitterFactory(confBuilder.build());\r
- Twitter twitter = factory.getInstance(accessToken);\r
-\r
- List<Train> list = getTrainList();\r
- for (Train train : list){\r
- twite(twitter, train);\r
- }\r
- } catch (TwitterException e) {\r
- // TODO Auto-generated catch block\r
- e.printStackTrace();\r
- log.severe(e.toString());\r
- }\r
- }\r
-\r
- private void twite(Twitter twitter, Train train) throws TwitterException {\r
- Query query = new Query();\r
- //query.setRpp(1000); // TODO\r
- query.setQuery(train.getSearchWord());\r
- QueryResult result = null;\r
- try {\r
- result = twitter.search(query);\r
- }\r
- catch (TwitterException e){\r
- log.severe("" + Debug.getLineNo());\r
- throw e;\r
- }\r
- List<Tweet> tweets = result.getTweets();\r
- \r
- Calendar cal = Calendar.getInstance();\r
- Date date = cal.getTime();\r
- long cur = date.getTime();\r
-\r
- int count = 0;\r
- int hit = 0;\r
- int mhit = 0;\r
- int period = getPeriod();\r
- \r
- int index;\r
- int mindex = 0;\r
- int size = tweets.size();\r
- for (index = 0; index < size; index++) {\r
- Tweet tweet = tweets.get(index);\r
- \r
- Date at = tweet.getCreatedAt();\r
- long t = at.getTime();\r
- \r
- String message = tweet.getText();\r
- \r
- if (t < cur - period * 60 * 1000){\r
- System.out.println("\81~" + tweet.getFromUser() + " - "\r
- + tweet.getText() + at);\r
- continue;\r
- }\r
- hit = filter(message);\r
- if (hit <= 0) {\r
- System.out.println("\81¢" + tweet.getFromUser() + " - "\r
- + tweet.getText() + at);\r
- // \92x\89\84\88È\8aO\82Ì\8f\91\82«\8d\9e\82Ý\r
- continue;\r
- }\r
- if (hit > mhit){\r
- hit = mhit;\r
- mindex = index;\r
- }\r
-\r
- System.out.println("@" + tweet.getFromUser() + " - "\r
- + tweet.getText() + at);\r
- count++;\r
- }\r
-\r
- String message = "[" + train.getName() + "] ";\r
- if (count < train.getCount()){\r
- message += df.format(date) + " \92x\89\84\82È\82µ"; \r
- }\r
- else {\r
- int N = 100;\r
- \r
- String sample = tweets.get(mindex).getText();\r
- sample = CommonUtil.replaceString(sample, "@", "(a)");\r
- sample = StringUtility.parseSubstring(sample, N);\r
- message += df.format(date) + " " + sample + " count=" + count; \r
- }\r
- System.out.println(message); //TODO\r
- \r
- Status status = null;\r
- try {\r
- status = twitter.updateStatus(message); //TODO\r
- }\r
- catch (TwitterException e){\r
- log.severe(Debug.getLineNo() + " " + message);\r
- throw e;\r
- }\r
- }\r
- \r
- private List<Train> getTrainList(){\r
- TrainDao dao = TrainDao.getInstance();\r
- List<Train> list = dao.search();\r
- if (list.size() <= 0){\r
- Train train;\r
- \r
- train = new Train("\8b\9e\95l\93\8c\96k\90ü", "\8b\9e\95l\93\8c\96k", 5);\r
- dao.put(train);\r
- train = new Train("\93\8c\8aC\93¹\90ü", "\93\8c\8aC\93¹", 5);\r
- dao.put(train);\r
- train = new Train("\8b\9e\95l\8b}\8ds\90ü", "\8b\9e\8b}", 5);\r
- dao.put(train);\r
- list = dao.search();\r
- }\r
- return list;\r
- }\r
- \r
- public int filter(String text) {\r
- if (keywords == null) {\r
- keywords = new ArrayList<String>();\r
- keywords.add("\92x\89\84");\r
- keywords.add("\92x\82ê");\r
- keywords.add("\90U\82è\91Ö\82¦");\r
- keywords.add("\90U\91Ö");\r
- keywords.add("\92â\8e~");\r
- keywords.add("\8e\96\8cÌ");\r
- }\r
-\r
- int count = 0;\r
- for (String keyword : keywords) {\r
- if (text.indexOf(keyword) >= 0) {\r
- count++;\r
- }\r
- }\r
- return count;\r
- }\r
- \r
- public int getPeriod(){\r
- if (period <= 0){\r
- KeyValueDao dao = KeyValueDao.getInstance();\r
- period = dao.getInt(KeyValueDao.KEY_SEARCH_PERIOD, 5);\r
- }\r
- return period;\r
- }\r
- \r
- private int getTwitTime(long id){\r
- String key = KeyValueDao.KEY_TWIT_TIME + id;\r
- Integer value = twitTimeList.get(key);\r
- if (value == null){\r
- value = 0;\r
- twitTimeList.put(key, value);\r
- }\r
- return value;\r
- }\r
-}\r
+++ /dev/null
-package com.yuji.tdb.debug;
-
-public class Debug {
- public static int getLineNo() {
- StackTraceElement[] stackTrace = new Exception().getStackTrace();
- StackTraceElement info = stackTrace[stackTrace.length - 1];
- return info.getLineNumber();
- }
-}
+++ /dev/null
-package com.yuji.tdb.twitter;\r
-\r
-import java.text.DateFormat;\r
-import java.text.SimpleDateFormat;\r
-import java.util.ArrayList;\r
-import java.util.Calendar;\r
-import java.util.Date;\r
-import java.util.HashMap;\r
-import java.util.List;\r
-import java.util.Map;\r
-import java.util.TimeZone;\r
-import java.util.logging.Logger;\r
-\r
-import twitter4j.Query;\r
-import twitter4j.QueryResult;\r
-import twitter4j.Status;\r
-import twitter4j.Tweet;\r
-import twitter4j.Twitter;\r
-import twitter4j.TwitterException;\r
-import twitter4j.TwitterFactory;\r
-import twitter4j.auth.AccessToken;\r
-import twitter4j.conf.ConfigurationBuilder;\r
-\r
-import com.yuji.tdb.common.CommonUtil;\r
-import com.yuji.tdb.db.KeyValueDao;\r
-import com.yuji.tdb.db.Train;\r
-import com.yuji.tdb.db.TrainDao;\r
-import com.yuji.tdb.debug.Debug;\r
-import com.yuji.tdb.utility.StringUtility;\r
-\r
-public class TwitterUtil {\r
- private static final Logger log = Logger\r
- .getLogger(TwitterUtil.class.getName());\r
- private static TwitterUtil instance = null;\r
- private static Object obj = new Object();\r
- //private DateFormat df = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");\r
- private DateFormat df = new SimpleDateFormat("HH:mm");\r
- private static List<String> keywords = null;\r
- private long searchPeriod = 0;\r
- private long twitPeriod = 0;\r
- private Map<String, Long> twitTimeList = new HashMap<String, Long>();\r
- \r
- public static TwitterUtil getInstance() {\r
- if (instance == null) {\r
- synchronized (obj) {\r
- if (instance == null) {\r
- instance = new TwitterUtil();\r
- }\r
- }\r
- }\r
- return instance;\r
- }\r
-\r
- private TwitterUtil() {\r
- df.setTimeZone(TimeZone.getTimeZone("JST")); \r
- }\r
-\r
- public void main(String consumerKey, String consumerSecret, AccessToken accessToken) {\r
- try {\r
- ConfigurationBuilder confBuilder = new ConfigurationBuilder();\r
- confBuilder.setDebugEnabled(true).setOAuthConsumerKey(consumerKey)\r
- .setOAuthConsumerSecret(consumerSecret);\r
- TwitterFactory factory = new TwitterFactory(confBuilder.build());\r
- Twitter twitter = factory.getInstance(accessToken);\r
-\r
- List<Train> list = getTrainList();\r
- for (Train train : list){\r
- Calendar cal = Calendar.getInstance();\r
- Date date = cal.getTime();\r
- long cur = date.getTime();\r
-\r
- long id = train.getId();\r
- long t = getTwitTime(id);\r
- long period = getTwitPeriod();\r
- \r
- if (t > 0 && t + period < cur){\r
- continue;\r
- }\r
-// twite(twitter, train);\r
- }\r
-// } catch (TwitterException e) {\r
-// // TODO Auto-generated catch block\r
-// e.printStackTrace();\r
-// log.severe(e.toString());\r
-// }\r
- }\r
-\r
- private void twite(Twitter twitter, Train train) throws TwitterException {\r
- Query query = new Query();\r
- //query.setRpp(1000); // TODO\r
- query.setQuery(train.getSearchWord());\r
- QueryResult result = null;\r
- try {\r
- result = twitter.search(query);\r
- }\r
- catch (TwitterException e){\r
- log.severe("" + Debug.getLineNo());\r
- throw e;\r
- }\r
- List<Tweet> tweets = result.getTweets();\r
- \r
- Calendar cal = Calendar.getInstance();\r
- Date date = cal.getTime();\r
- long cur = date.getTime();\r
-\r
- int count = 0;\r
- int hit = 0;\r
- int mhit = 0;\r
- long period = getSearchPeriod();\r
- long id = train.getId();\r
- \r
- int index;\r
- int mindex = 0;\r
- int size = tweets.size();\r
- for (index = 0; index < size; index++) {\r
- Tweet tweet = tweets.get(index);\r
- \r
- Date at = tweet.getCreatedAt();\r
- long t = at.getTime();\r
- \r
- String message = tweet.getText();\r
- \r
- if (t < cur - period * 60 * 1000){\r
- System.out.println("\81~" + tweet.getFromUser() + " - "\r
- + tweet.getText() + at);\r
- continue;\r
- }\r
- hit = filter(message);\r
- if (hit <= 0) {\r
- System.out.println("\81¢" + tweet.getFromUser() + " - "\r
- + tweet.getText() + at);\r
- // \92x\89\84\88È\8aO\82Ì\8f\91\82«\8d\9e\82Ý\r
- continue;\r
- }\r
- if (hit > mhit){\r
- hit = mhit;\r
- mindex = index;\r
- }\r
-\r
- System.out.println("@" + tweet.getFromUser() + " - "\r
- + tweet.getText() + at);\r
- count++;\r
- }\r
-\r
- String message = "[" + train.getName() + "] ";\r
- if (count < train.getCount()){\r
- message += df.format(date) + " \92x\89\84\82È\82µ"; \r
- }\r
- else {\r
- int N = 100;\r
- \r
- String sample = tweets.get(mindex).getText();\r
- sample = CommonUtil.replaceString(sample, "@", "(a)");\r
- sample = StringUtility.parseSubstring(sample, N);\r
- message += df.format(date) + " " + sample + " count=" + count; \r
- }\r
- System.out.println(message); //TODO\r
- \r
- Status status = null;\r
- try {\r
- status = twitter.updateStatus(message); //TODO\r
- setTwitTime(id, cur);\r
- }\r
- catch (TwitterException e){\r
- log.severe(Debug.getLineNo() + " " + message);\r
- log.severe(Debug.getLineNo() + " " + status);\r
- throw e;\r
- }\r
- }\r
- \r
- private List<Train> getTrainList(){\r
- TrainDao dao = TrainDao.getInstance();\r
- List<Train> list = dao.search();\r
- if (list.size() <= 0){\r
- Train train;\r
- \r
- train = new Train("\8b\9e\95l\93\8c\96k\90ü", "\8b\9e\95l\93\8c\96k", 5);\r
- dao.put(train);\r
- train = new Train("\93\8c\8aC\93¹\90ü", "\93\8c\8aC\93¹", 5);\r
- dao.put(train);\r
- train = new Train("\8b\9e\95l\8b}\8ds\90ü", "\8b\9e\8b}", 5);\r
- dao.put(train);\r
- list = dao.search();\r
- }\r
- return list;\r
- }\r
- \r
- public int filter(String text) {\r
- if (keywords == null) {\r
- keywords = new ArrayList<String>();\r
- keywords.add("\92x\89\84");\r
- keywords.add("\92x\82ê");\r
- keywords.add("\90U\82è\91Ö\82¦");\r
- keywords.add("\90U\91Ö");\r
- keywords.add("\92â\8e~");\r
- keywords.add("\8e\96\8cÌ");\r
- }\r
-\r
- int count = 0;\r
- for (String keyword : keywords) {\r
- if (text.indexOf(keyword) >= 0) {\r
- count++;\r
- }\r
- }\r
- return count;\r
- }\r
- \r
- public long getSearchPeriod(){\r
- if (searchPeriod <= 0){\r
- KeyValueDao dao = KeyValueDao.getInstance();\r
- searchPeriod = dao.getInt(KeyValueDao.KEY_SEARCH_PERIOD, 5);\r
- }\r
- return searchPeriod;\r
- }\r
- \r
- public long getTwitPeriod(){\r
- if (twitPeriod <= 0){\r
- KeyValueDao dao = KeyValueDao.getInstance();\r
- twitPeriod = dao.getInt(KeyValueDao.KEY_TWIT_PERIOD, 5);\r
- }\r
- return twitPeriod;\r
- }\r
- \r
- private long getTwitTime(long id){\r
- String key = KeyValueDao.KEY_TWIT_TIME + id;\r
- Long value = twitTimeList.get(key);\r
- if (value == null){\r
- value = 0L;\r
- twitTimeList.put(key, value);\r
- }\r
- return value;\r
- }\r
- \r
- private void setTwitTime(long id, long value){\r
- String key = KeyValueDao.KEY_TWIT_TIME + id;\r
- twitTimeList.put(key, value);\r
- }\r
-}\r
+++ /dev/null
-package com.yuji.tdb.db;\r
-\r
-import javax.jdo.JDOObjectNotFoundException;\r
-import javax.jdo.PersistenceManager;\r
-\r
-public class KeyValueDao {\r
- public static final String KEY_CONSUMER_KEY = "CONSUMER_KEY";\r
- public static final String KEY_CONSUMER_SECRET = "CONSUMER_SECRET";\r
- public static final String KEY_REQUEST_TOKEN = "REQUEST_TOKEN";\r
- public static final String KEY_REQUEST_TOKEN_SECRET = "REQUEST_TOKEN_SECRET";\r
- public static final String KEY_ACCESS_TOKEN = "ACCESS_TOKEN";\r
- public static final String KEY_ACCESS_TOKEN_SECRET = "ACCESS_TOKEN_SECRET";\r
-\r
- public static final String KEY_SEARCH_PERIOD = "SEARCH_PERIOD";\r
- public static final String KEY_TWIT_PERIOD = "TWIT_PERIOD";\r
- public static final String KEY_TWIT_TIME = "TWIT_TIME_";\r
-\r
- private static KeyValueDao instance = null;\r
- private PersistenceManager pm = PMFactory.get().getPersistenceManager();\r
- \r
- public static KeyValueDao getInstance(){\r
- if (instance == null){\r
- instance = new KeyValueDao();\r
- }\r
- return instance;\r
- }\r
- \r
- private KeyValueDao(){\r
- \r
- }\r
- \r
- public String get(String key){\r
- KeyValue keyValue = null;\r
- \r
- try {\r
- keyValue = pm.getObjectById(KeyValue.class, key);\r
- }\r
- catch (JDOObjectNotFoundException e){\r
- return null; \r
- }\r
- return keyValue.getValue();\r
- }\r
- \r
- public int getInt(String key){\r
- String value = get(key);\r
- return Integer.valueOf(value).intValue();\r
- }\r
- \r
- public void put(String key, String value){\r
- KeyValue keyValue = new KeyValue(key, value);\r
- pm.makePersistent(keyValue);\r
- }\r
-\r
- public void put(String key, int value){\r
- put(key, String.valueOf(value));\r
- }\r
-\r
- public String get(String key, String initValue){\r
- String value = get(key);\r
- if (value == null){\r
- put(key, initValue);\r
- value = initValue;\r
- }\r
- return value;\r
- }\r
-\r
- public int getInt(String key, int initValue){\r
- String value = get(key);\r
- if (value == null){\r
- value = initValue;\r
- put(key, value);\r
- }\r
- return Integer.valueOf(value).intValue();\r
- }\r
-}\r
+++ /dev/null
-package com.yuji.tdb.twitter;\r
-\r
-import java.text.DateFormat;\r
-import java.text.SimpleDateFormat;\r
-import java.util.ArrayList;\r
-import java.util.Calendar;\r
-import java.util.Date;\r
-import java.util.List;\r
-import java.util.TimeZone;\r
-import java.util.logging.Logger;\r
-\r
-import twitter4j.Query;\r
-import twitter4j.QueryResult;\r
-import twitter4j.Status;\r
-import twitter4j.Tweet;\r
-import twitter4j.Twitter;\r
-import twitter4j.TwitterException;\r
-import twitter4j.TwitterFactory;\r
-import twitter4j.auth.AccessToken;\r
-import twitter4j.conf.ConfigurationBuilder;\r
-\r
-import com.yuji.tdb.common.CommonUtil;\r
-import com.yuji.tdb.db.KeyValueDao;\r
-import com.yuji.tdb.db.Train;\r
-import com.yuji.tdb.db.TrainDao;\r
-import com.yuji.tdb.debug.Debug;\r
-import com.yuji.tdb.utility.StringUtility;\r
-\r
-public class TwitterUtil {\r
- private static final Logger log = Logger\r
- .getLogger(TwitterUtil.class.getName());\r
- private static TwitterUtil instance = null;\r
- private static Object obj = new Object();\r
- //private DateFormat df = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");\r
- private DateFormat df = new SimpleDateFormat("HH:mm");\r
- private static List<String> keywords = null;\r
- private int period = 0;\r
- \r
- public static TwitterUtil getInstance() {\r
- if (instance == null) {\r
- synchronized (obj) {\r
- if (instance == null) {\r
- instance = new TwitterUtil();\r
- }\r
- }\r
- }\r
- return instance;\r
- }\r
-\r
- private TwitterUtil() {\r
- df.setTimeZone(TimeZone.getTimeZone("JST")); \r
- }\r
-\r
- public void main(String consumerKey, String consumerSecret, AccessToken accessToken) {\r
- try {\r
- ConfigurationBuilder confBuilder = new ConfigurationBuilder();\r
- confBuilder.setDebugEnabled(true).setOAuthConsumerKey(consumerKey)\r
- .setOAuthConsumerSecret(consumerSecret);\r
- TwitterFactory factory = new TwitterFactory(confBuilder.build());\r
- Twitter twitter = factory.getInstance(accessToken);\r
-\r
- List<Train> list = getTrainList();\r
- for (Train train : list){\r
- twite(twitter, train);\r
- }\r
- } catch (TwitterException e) {\r
- // TODO Auto-generated catch block\r
- e.printStackTrace();\r
- log.severe(e.toString());\r
- }\r
- }\r
-\r
- private void twite(Twitter twitter, Train train) throws TwitterException {\r
- Query query = new Query();\r
- //query.setRpp(1000); // TODO\r
- query.setQuery(train.getSearchWord());\r
- QueryResult result = null;\r
- try {\r
- result = twitter.search(query);\r
- }\r
- catch (TwitterException e){\r
- log.severe("" + Debug.getLineNo());\r
- throw e;\r
- }\r
- List<Tweet> tweets = result.getTweets();\r
- \r
- Calendar cal = Calendar.getInstance();\r
- Date date = cal.getTime();\r
- long cur = date.getTime();\r
-\r
- int count = 0;\r
- int hit = 0;\r
- int mhit = 0;\r
- int period = getPeriod();\r
- \r
- int index;\r
- int mindex = 0;\r
- int size = tweets.size();\r
- for (index = 0; index < size; index++) {\r
- Tweet tweet = tweets.get(index);\r
- \r
- Date at = tweet.getCreatedAt();\r
- long t = at.getTime();\r
- \r
- String message = tweet.getText();\r
- \r
- if (t < cur - period * 60 * 1000){\r
- System.out.println("\81~" + tweet.getFromUser() + " - "\r
- + tweet.getText() + at);\r
- continue;\r
- }\r
- hit = filter(message);\r
- if (hit <= 0) {\r
- System.out.println("\81¢" + tweet.getFromUser() + " - "\r
- + tweet.getText() + at);\r
- // \92x\89\84\88È\8aO\82Ì\8f\91\82«\8d\9e\82Ý\r
- continue;\r
- }\r
- if (hit > mhit){\r
- hit = mhit;\r
- mindex = index;\r
- }\r
-\r
- System.out.println("@" + tweet.getFromUser() + " - "\r
- + tweet.getText() + at);\r
- count++;\r
- }\r
-\r
- String message = "[" + train.getName() + "] ";\r
- if (count < train.getCount()){\r
- message += df.format(date) + " \92x\89\84\82È\82µ"; \r
- }\r
- else {\r
- int N = 100;\r
- \r
- String sample = tweets.get(mindex).getText();\r
- sample = CommonUtil.replaceString(sample, "@", "(a)");\r
- sample = StringUtility.parseSubstring(sample, N);\r
- message += df.format(date) + " " + sample + " count=" + count; \r
- }\r
- System.out.println(message); //TODO\r
- \r
- Status status = null;\r
- try {\r
- status = twitter.updateStatus(message); //TODO\r
- }\r
- catch (TwitterException e){\r
- log.severe(Debug.getLineNo() + " " + message);\r
- throw e;\r
- }\r
- }\r
- \r
- private List<Train> getTrainList(){\r
- TrainDao dao = TrainDao.getInstance();\r
- List<Train> list = dao.search();\r
- if (list.size() <= 0){\r
- Train train;\r
- \r
- train = new Train("\8b\9e\95l\93\8c\96k\90ü", "\8b\9e\95l\93\8c\96k", 5);\r
- dao.put(train);\r
- train = new Train("\93\8c\8aC\93¹\90ü", "\93\8c\8aC\93¹", 5);\r
- dao.put(train);\r
- train = new Train("\8b\9e\95l\8b}\8ds\90ü", "\8b\9e\8b}", 5);\r
- dao.put(train);\r
- list = dao.search();\r
- }\r
- return list;\r
- }\r
- \r
- public int filter(String text) {\r
- if (keywords == null) {\r
- keywords = new ArrayList<String>();\r
- keywords.add("\92x\89\84");\r
- keywords.add("\92x\82ê");\r
- keywords.add("\90U\82è\91Ö\82¦");\r
- keywords.add("\90U\91Ö");\r
- keywords.add("\92â\8e~");\r
- keywords.add("\8e\96\8cÌ");\r
- }\r
-\r
- int count = 0;\r
- for (String keyword : keywords) {\r
- if (text.indexOf(keyword) >= 0) {\r
- count++;\r
- }\r
- }\r
- return count;\r
- }\r
- \r
- public int getPeriod(){\r
- if (period <= 0){\r
- KeyValueDao dao = KeyValueDao.getInstance();\r
- period = dao.getInt(KeyValueDao.KEY_SEARCH_PERIOD, 5);\r
- }\r
- return period;\r
- }\r
- \r
- private List<String, Integer> twitTimeList = new ArrayList<String, Integer>();\r
- private int getTwitTime(long id){\r
- \r
- }\r
-}\r
+++ /dev/null
-package com.yuji.tdb.twitter;\r
-\r
-import java.text.DateFormat;\r
-import java.text.SimpleDateFormat;\r
-import java.util.ArrayList;\r
-import java.util.Calendar;\r
-import java.util.Date;\r
-import java.util.HashMap;\r
-import java.util.List;\r
-import java.util.Map;\r
-import java.util.TimeZone;\r
-import java.util.logging.Logger;\r
-\r
-import twitter4j.Query;\r
-import twitter4j.QueryResult;\r
-import twitter4j.Status;\r
-import twitter4j.Tweet;\r
-import twitter4j.Twitter;\r
-import twitter4j.TwitterException;\r
-import twitter4j.TwitterFactory;\r
-import twitter4j.auth.AccessToken;\r
-import twitter4j.conf.ConfigurationBuilder;\r
-\r
-import com.yuji.tdb.common.CommonUtil;\r
-import com.yuji.tdb.db.KeyValueDao;\r
-import com.yuji.tdb.db.Train;\r
-import com.yuji.tdb.db.TrainDao;\r
-import com.yuji.tdb.debug.Debug;\r
-import com.yuji.tdb.utility.StringUtility;\r
-\r
-public class TwitterUtil {\r
- private static final Logger log = Logger\r
- .getLogger(TwitterUtil.class.getName());\r
- private static TwitterUtil instance = null;\r
- private static Object obj = new Object();\r
- //private DateFormat df = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");\r
- private DateFormat df = new SimpleDateFormat("HH:mm");\r
- private static List<String> keywords = null;\r
- private long searchPeriod = 0;\r
- private long twitPeriod = 0;\r
- private Map<String, Long> twitTimeList = new HashMap<String, Long>();\r
- \r
- public static TwitterUtil getInstance() {\r
- if (instance == null) {\r
- synchronized (obj) {\r
- if (instance == null) {\r
- instance = new TwitterUtil();\r
- }\r
- }\r
- }\r
- return instance;\r
- }\r
-\r
- private TwitterUtil() {\r
- df.setTimeZone(TimeZone.getTimeZone("JST")); \r
- }\r
-\r
- public void main(String consumerKey, String consumerSecret, AccessToken accessToken) {\r
- try {\r
- ConfigurationBuilder confBuilder = new ConfigurationBuilder();\r
- confBuilder.setDebugEnabled(true).setOAuthConsumerKey(consumerKey)\r
- .setOAuthConsumerSecret(consumerSecret);\r
- TwitterFactory factory = new TwitterFactory(confBuilder.build());\r
- Twitter twitter = factory.getInstance(accessToken);\r
-\r
- List<Train> list = getTrainList();\r
- for (Train train : list){\r
- Calendar cal = Calendar.getInstance();\r
- Date date = cal.getTime();\r
- long cur = date.getTime();\r
-\r
- long id = train.getId();\r
- long t = getTwitTime(id);\r
- long period = getTwitPeriod();\r
- \r
- if (t + period < cur){\r
- continue;\r
- }\r
- twite(twitter, train);\r
- }\r
- } catch (TwitterException e) {\r
- // TODO Auto-generated catch block\r
- e.printStackTrace();\r
- log.severe(e.toString());\r
- }\r
- }\r
-\r
- private void twite(Twitter twitter, Train train) throws TwitterException {\r
- Query query = new Query();\r
- //query.setRpp(1000); // TODO\r
- query.setQuery(train.getSearchWord());\r
- QueryResult result = null;\r
- try {\r
- result = twitter.search(query);\r
- }\r
- catch (TwitterException e){\r
- log.severe("" + Debug.getLineNo());\r
- throw e;\r
- }\r
- List<Tweet> tweets = result.getTweets();\r
- \r
- Calendar cal = Calendar.getInstance();\r
- Date date = cal.getTime();\r
- long cur = date.getTime();\r
-\r
- int count = 0;\r
- int hit = 0;\r
- int mhit = 0;\r
- long period = getSearchPeriod();\r
- long id = train.getId();\r
- \r
- int index;\r
- int mindex = 0;\r
- int size = tweets.size();\r
- for (index = 0; index < size; index++) {\r
- Tweet tweet = tweets.get(index);\r
- \r
- Date at = tweet.getCreatedAt();\r
- long t = at.getTime();\r
- \r
- String message = tweet.getText();\r
- \r
- if (t < cur - period * 60 * 1000){\r
- System.out.println("\81~" + tweet.getFromUser() + " - "\r
- + tweet.getText() + at);\r
- continue;\r
- }\r
- hit = filter(message);\r
- if (hit <= 0) {\r
- System.out.println("\81¢" + tweet.getFromUser() + " - "\r
- + tweet.getText() + at);\r
- // \92x\89\84\88È\8aO\82Ì\8f\91\82«\8d\9e\82Ý\r
- continue;\r
- }\r
- if (hit > mhit){\r
- hit = mhit;\r
- mindex = index;\r
- }\r
-\r
- System.out.println("@" + tweet.getFromUser() + " - "\r
- + tweet.getText() + at);\r
- count++;\r
- }\r
-\r
- String message = "[" + train.getName() + "] ";\r
- if (count < train.getCount()){\r
- message += df.format(date) + " \92x\89\84\82È\82µ"; \r
- }\r
- else {\r
- int N = 100;\r
- \r
- String sample = tweets.get(mindex).getText();\r
- sample = CommonUtil.replaceString(sample, "@", "(a)");\r
- sample = StringUtility.parseSubstring(sample, N);\r
- message += df.format(date) + " " + sample + " count=" + count; \r
- }\r
- System.out.println(message); //TODO\r
- \r
- Status status = null;\r
- try {\r
- status = twitter.updateStatus(message); //TODO\r
- setTwitTime(id, cur);\r
- }\r
- catch (TwitterException e){\r
- log.severe(Debug.getLineNo() + " " + message);\r
- throw e;\r
- }\r
- }\r
- \r
- private List<Train> getTrainList(){\r
- TrainDao dao = TrainDao.getInstance();\r
- List<Train> list = dao.search();\r
- if (list.size() <= 0){\r
- Train train;\r
- \r
- train = new Train("\8b\9e\95l\93\8c\96k\90ü", "\8b\9e\95l\93\8c\96k", 5);\r
- dao.put(train);\r
- train = new Train("\93\8c\8aC\93¹\90ü", "\93\8c\8aC\93¹", 5);\r
- dao.put(train);\r
- train = new Train("\8b\9e\95l\8b}\8ds\90ü", "\8b\9e\8b}", 5);\r
- dao.put(train);\r
- list = dao.search();\r
- }\r
- return list;\r
- }\r
- \r
- public int filter(String text) {\r
- if (keywords == null) {\r
- keywords = new ArrayList<String>();\r
- keywords.add("\92x\89\84");\r
- keywords.add("\92x\82ê");\r
- keywords.add("\90U\82è\91Ö\82¦");\r
- keywords.add("\90U\91Ö");\r
- keywords.add("\92â\8e~");\r
- keywords.add("\8e\96\8cÌ");\r
- }\r
-\r
- int count = 0;\r
- for (String keyword : keywords) {\r
- if (text.indexOf(keyword) >= 0) {\r
- count++;\r
- }\r
- }\r
- return count;\r
- }\r
- \r
- public long getSearchPeriod(){\r
- if (searchPeriod <= 0){\r
- KeyValueDao dao = KeyValueDao.getInstance();\r
- searchPeriod = dao.getInt(KeyValueDao.KEY_SEARCH_PERIOD, 5);\r
- }\r
- return searchPeriod;\r
- }\r
- \r
- public long getTwitPeriod(){\r
- if (twitPeriod <= 0){\r
- KeyValueDao dao = KeyValueDao.getInstance();\r
- twitPeriod = dao.getInt(KeyValueDao.KEY_TWIT_PERIOD, 5);\r
- }\r
- return twitPeriod;\r
- }\r
- \r
- private long getTwitTime(long id){\r
- String key = KeyValueDao.KEY_TWIT_TIME + id;\r
- Long value = (long)twitTimeList.get(key);\r
- if (value == null){\r
- value = 0L;\r
- twitTimeList.put(key, value);\r
- }\r
- return value;\r
- }\r
- \r
- private void setTwitTime(long id, long value){\r
- String key = KeyValueDao.KEY_TWIT_TIME + id;\r
- twitTimeList.put(key, value);\r
- }\r
-}\r
+++ /dev/null
-package com.yuji.tdb.twitter;\r
-\r
-import java.text.DateFormat;\r
-import java.text.SimpleDateFormat;\r
-import java.util.ArrayList;\r
-import java.util.Calendar;\r
-import java.util.Date;\r
-import java.util.HashMap;\r
-import java.util.List;\r
-import java.util.Map;\r
-import java.util.TimeZone;\r
-import java.util.logging.Logger;\r
-\r
-import twitter4j.Query;\r
-import twitter4j.QueryResult;\r
-import twitter4j.Status;\r
-import twitter4j.Tweet;\r
-import twitter4j.Twitter;\r
-import twitter4j.TwitterException;\r
-import twitter4j.TwitterFactory;\r
-import twitter4j.auth.AccessToken;\r
-import twitter4j.conf.ConfigurationBuilder;\r
-\r
-import com.yuji.tdb.common.CommonUtil;\r
-import com.yuji.tdb.db.KeyValueDao;\r
-import com.yuji.tdb.db.Train;\r
-import com.yuji.tdb.db.TrainDao;\r
-import com.yuji.tdb.debug.Debug;\r
-import com.yuji.tdb.utility.StringUtility;\r
-\r
-public class TwitterUtil {\r
- private static final Logger log = Logger\r
- .getLogger(TwitterUtil.class.getName());\r
- private static TwitterUtil instance = null;\r
- private static Object obj = new Object();\r
- //private DateFormat df = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");\r
- private DateFormat df = new SimpleDateFormat("HH:mm");\r
- private static List<String> keywords = null;\r
- private long searchPeriod = 0;\r
- private long twitPeriod = 0;\r
- private Map<String, Long> twitTimeList = new HashMap<String, Long>();\r
- \r
- public static TwitterUtil getInstance() {\r
- if (instance == null) {\r
- synchronized (obj) {\r
- if (instance == null) {\r
- instance = new TwitterUtil();\r
- }\r
- }\r
- }\r
- return instance;\r
- }\r
-\r
- private TwitterUtil() {\r
- df.setTimeZone(TimeZone.getTimeZone("JST")); \r
- }\r
-\r
- public void main(String consumerKey, String consumerSecret, AccessToken accessToken) {\r
- try {\r
- ConfigurationBuilder confBuilder = new ConfigurationBuilder();\r
- confBuilder.setDebugEnabled(true).setOAuthConsumerKey(consumerKey)\r
- .setOAuthConsumerSecret(consumerSecret);\r
- TwitterFactory factory = new TwitterFactory(confBuilder.build());\r
- Twitter twitter = factory.getInstance(accessToken);\r
-\r
- List<Train> list = getTrainList();\r
- for (Train train : list){\r
- Calendar cal = Calendar.getInstance();\r
- Date date = cal.getTime();\r
- long cur = date.getTime();\r
-\r
- long id = train.getId();\r
- long t = getTwitTime(id);\r
- long period = getTwitPeriod();\r
-\r
- if (t > 0 && cur < t + period * 60 * 1000){\r
- continue;\r
- }\r
- twite(twitter, train);\r
- }\r
- } catch (TwitterException e) {\r
- // TODO Auto-generated catch block\r
- e.printStackTrace();\r
- log.severe(e.toString());\r
- }\r
- }\r
-\r
- private void twite(Twitter twitter, Train train) throws TwitterException {\r
- Query query = new Query();\r
- //query.setRpp(1000); // TODO\r
- query.setQuery(train.getSearchWord());\r
- QueryResult result = null;\r
- try {\r
- result = twitter.search(query);\r
- }\r
- catch (TwitterException e){\r
- log.severe("" + Debug.getLineNo());\r
- throw e;\r
- }\r
- List<Tweet> tweets = result.getTweets();\r
- \r
- Calendar cal = Calendar.getInstance();\r
- Date date = cal.getTime();\r
- long cur = date.getTime();\r
-\r
- int count = 0;\r
- int hit = 0;\r
- int mhit = 0;\r
- long period = getSearchPeriod();\r
- long id = train.getId();\r
- \r
- int index;\r
- int mindex = 0;\r
- int size = tweets.size();\r
- for (index = 0; index < size; index++) {\r
- Tweet tweet = tweets.get(index);\r
- \r
- Date at = tweet.getCreatedAt();\r
- long t = at.getTime();\r
- \r
- String message = tweet.getText();\r
- \r
- if (t < cur - period * 60 * 1000){\r
- System.out.println("\81~" + tweet.getFromUser() + " - "\r
- + tweet.getText() + at);\r
- continue;\r
- }\r
- hit = filter(message);\r
- if (hit <= 0) {\r
- System.out.println("\81¢" + tweet.getFromUser() + " - "\r
- + tweet.getText() + at);\r
- // \92x\89\84\88È\8aO\82Ì\8f\91\82«\8d\9e\82Ý\r
- continue;\r
- }\r
- if (hit > mhit){\r
- hit = mhit;\r
- mindex = index;\r
- }\r
-\r
- System.out.println("@" + tweet.getFromUser() + " - "\r
- + tweet.getText() + at);\r
- count++;\r
- }\r
-\r
- String message = "[" + train.getName() + "] ";\r
- if (count < train.getCount()){\r
- message += df.format(date) + " \92x\89\84\82È\82µ"; \r
- }\r
- else {\r
- int N = 100;\r
- \r
- String sample = tweets.get(mindex).getText();\r
- sample = CommonUtil.replaceString(sample, "@", "(a)");\r
- sample = StringUtility.parseSubstring(sample, N);\r
- message += df.format(date) + " " + sample + " count=" + count; \r
- }\r
- System.out.println(message); //TODO\r
- \r
-// Status status = null;\r
-// try {\r
-// status = twitter.updateStatus(message); //TODO\r
-// setTwitTime(id, cur);\r
-// }\r
-// catch (TwitterException e){\r
-// log.severe(Debug.getLineNo() + " " + message);\r
-// log.severe(Debug.getLineNo() + " " + status);\r
-// throw e;\r
-// }\r
- setTwitTime(id, cur); // TODO\r
- }\r
- \r
- private List<Train> getTrainList(){\r
- TrainDao dao = TrainDao.getInstance();\r
- List<Train> list = dao.search();\r
- if (list.size() <= 0){\r
- Train train;\r
- \r
- train = new Train("\8b\9e\95l\93\8c\96k\90ü", "\8b\9e\95l\93\8c\96k", 5);\r
- dao.put(train);\r
- train = new Train("\93\8c\8aC\93¹\90ü", "\93\8c\8aC\93¹", 5);\r
- dao.put(train);\r
- train = new Train("\8b\9e\95l\8b}\8ds\90ü", "\8b\9e\8b}", 5);\r
- dao.put(train);\r
- list = dao.search();\r
- }\r
- return list;\r
- }\r
- \r
- public int filter(String text) {\r
- if (keywords == null) {\r
- keywords = new ArrayList<String>();\r
- keywords.add("\92x\89\84");\r
- keywords.add("\92x\82ê");\r
- keywords.add("\90U\82è\91Ö\82¦");\r
- keywords.add("\90U\91Ö");\r
- keywords.add("\92â\8e~");\r
- keywords.add("\8e\96\8cÌ");\r
- }\r
-\r
- int count = 0;\r
- for (String keyword : keywords) {\r
- if (text.indexOf(keyword) >= 0) {\r
- count++;\r
- }\r
- }\r
- return count;\r
- }\r
- \r
- public long getSearchPeriod(){\r
- if (searchPeriod <= 0){\r
- KeyValueDao dao = KeyValueDao.getInstance();\r
- searchPeriod = dao.getInt(KeyValueDao.KEY_SEARCH_PERIOD, 5);\r
- }\r
- return searchPeriod;\r
- }\r
- \r
- public long getTwitPeriod(){\r
- if (twitPeriod <= 0){\r
- KeyValueDao dao = KeyValueDao.getInstance();\r
- twitPeriod = dao.getInt(KeyValueDao.KEY_TWIT_PERIOD, 5);\r
- }\r
- return twitPeriod;\r
- }\r
- \r
- private long getTwitTime(long id){\r
- String key = KeyValueDao.KEY_TWIT_TIME + id;\r
- Long value = twitTimeList.get(key);\r
- if (value == null){\r
- value = 0L;\r
- setTwitTime(id, value);\r
- }\r
- return value;\r
- }\r
- \r
- private void setTwitTime(long id, long value){\r
- String key = KeyValueDao.KEY_TWIT_TIME + id;\r
- twitTimeList.put(key, value);\r
- KeyValueDao dao = KeyValueDao.getInstance();\r
- dao.put(key, String.valueOf(value));\r
- }\r
-}\r
+++ /dev/null
-package com.yuji.tdb.twitter;\r
-\r
-import java.text.DateFormat;\r
-import java.text.SimpleDateFormat;\r
-import java.util.ArrayList;\r
-import java.util.Calendar;\r
-import java.util.Date;\r
-import java.util.HashMap;\r
-import java.util.List;\r
-import java.util.Map;\r
-import java.util.TimeZone;\r
-import java.util.logging.Logger;\r
-\r
-import twitter4j.Query;\r
-import twitter4j.QueryResult;\r
-import twitter4j.Status;\r
-import twitter4j.Tweet;\r
-import twitter4j.Twitter;\r
-import twitter4j.TwitterException;\r
-import twitter4j.TwitterFactory;\r
-import twitter4j.auth.AccessToken;\r
-import twitter4j.conf.ConfigurationBuilder;\r
-\r
-import com.yuji.tdb.common.CommonUtil;\r
-import com.yuji.tdb.db.KeyValueDao;\r
-import com.yuji.tdb.db.Train;\r
-import com.yuji.tdb.db.TrainDao;\r
-import com.yuji.tdb.debug.Debug;\r
-import com.yuji.tdb.utility.StringUtility;\r
-\r
-public class TwitterUtil {\r
- private static final Logger log = Logger\r
- .getLogger(TwitterUtil.class.getName());\r
- private static TwitterUtil instance = null;\r
- private static Object obj = new Object();\r
- //private DateFormat df = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");\r
- private DateFormat df = new SimpleDateFormat("HH:mm");\r
- private static List<String> keywords = null;\r
- private long searchPeriod = 0;\r
- private long twitPeriod = 0;\r
- private Map<String, Long> twitTimeList = new HashMap<String, Long>();\r
- \r
- public static TwitterUtil getInstance() {\r
- if (instance == null) {\r
- synchronized (obj) {\r
- if (instance == null) {\r
- instance = new TwitterUtil();\r
- }\r
- }\r
- }\r
- return instance;\r
- }\r
-\r
- private TwitterUtil() {\r
- df.setTimeZone(TimeZone.getTimeZone("JST")); \r
- }\r
-\r
- public void main(String consumerKey, String consumerSecret, AccessToken accessToken) {\r
- try {\r
- ConfigurationBuilder confBuilder = new ConfigurationBuilder();\r
- confBuilder.setDebugEnabled(true).setOAuthConsumerKey(consumerKey)\r
- .setOAuthConsumerSecret(consumerSecret);\r
- TwitterFactory factory = new TwitterFactory(confBuilder.build());\r
- Twitter twitter = factory.getInstance(accessToken);\r
-\r
- List<Train> list = getTrainList();\r
- for (Train train : list){\r
- Calendar cal = Calendar.getInstance();\r
- Date date = cal.getTime();\r
- long cur = date.getTime();\r
-\r
- long id = train.getId();\r
- long t = getTwitTime(id);\r
- long period = getTwitPeriod();\r
-\r
- if (t > 0 && t + period * 60 * 1000 < cur){\r
- continue;\r
- }\r
- twite(twitter, train);\r
- }\r
- } catch (TwitterException e) {\r
- // TODO Auto-generated catch block\r
- e.printStackTrace();\r
- log.severe(e.toString());\r
- }\r
- }\r
-\r
- private void twite(Twitter twitter, Train train) throws TwitterException {\r
- Query query = new Query();\r
- //query.setRpp(1000); // TODO\r
- query.setQuery(train.getSearchWord());\r
- QueryResult result = null;\r
- try {\r
- result = twitter.search(query);\r
- }\r
- catch (TwitterException e){\r
- log.severe("" + Debug.getLineNo());\r
- throw e;\r
- }\r
- List<Tweet> tweets = result.getTweets();\r
- \r
- Calendar cal = Calendar.getInstance();\r
- Date date = cal.getTime();\r
- long cur = date.getTime();\r
-\r
- int count = 0;\r
- int hit = 0;\r
- int mhit = 0;\r
- long period = getSearchPeriod();\r
- long id = train.getId();\r
- \r
- int index;\r
- int mindex = 0;\r
- int size = tweets.size();\r
- for (index = 0; index < size; index++) {\r
- Tweet tweet = tweets.get(index);\r
- \r
- Date at = tweet.getCreatedAt();\r
- long t = at.getTime();\r
- \r
- String message = tweet.getText();\r
- \r
- if (t < cur - period * 60 * 1000){\r
- System.out.println("\81~" + tweet.getFromUser() + " - "\r
- + tweet.getText() + at);\r
- continue;\r
- }\r
- hit = filter(message);\r
- if (hit <= 0) {\r
- System.out.println("\81¢" + tweet.getFromUser() + " - "\r
- + tweet.getText() + at);\r
- // \92x\89\84\88È\8aO\82Ì\8f\91\82«\8d\9e\82Ý\r
- continue;\r
- }\r
- if (hit > mhit){\r
- hit = mhit;\r
- mindex = index;\r
- }\r
-\r
- System.out.println("@" + tweet.getFromUser() + " - "\r
- + tweet.getText() + at);\r
- count++;\r
- }\r
-\r
- String message = "[" + train.getName() + "] ";\r
- if (count < train.getCount()){\r
- message += df.format(date) + " \92x\89\84\82È\82µ"; \r
- }\r
- else {\r
- int N = 100;\r
- \r
- String sample = tweets.get(mindex).getText();\r
- sample = CommonUtil.replaceString(sample, "@", "(a)");\r
- sample = StringUtility.parseSubstring(sample, N);\r
- message += df.format(date) + " " + sample + " count=" + count; \r
- }\r
- System.out.println(message); //TODO\r
- \r
-// Status status = null;\r
-// try {\r
-// status = twitter.updateStatus(message); //TODO\r
-// setTwitTime(id, cur);\r
-// }\r
-// catch (TwitterException e){\r
-// log.severe(Debug.getLineNo() + " " + message);\r
-// log.severe(Debug.getLineNo() + " " + status);\r
-// throw e;\r
-// }\r
- setTwitTime(id, cur); // TODO\r
- }\r
- \r
- private List<Train> getTrainList(){\r
- TrainDao dao = TrainDao.getInstance();\r
- List<Train> list = dao.search();\r
- if (list.size() <= 0){\r
- Train train;\r
- \r
- train = new Train("\8b\9e\95l\93\8c\96k\90ü", "\8b\9e\95l\93\8c\96k", 5);\r
- dao.put(train);\r
- train = new Train("\93\8c\8aC\93¹\90ü", "\93\8c\8aC\93¹", 5);\r
- dao.put(train);\r
- train = new Train("\8b\9e\95l\8b}\8ds\90ü", "\8b\9e\8b}", 5);\r
- dao.put(train);\r
- list = dao.search();\r
- }\r
- return list;\r
- }\r
- \r
- public int filter(String text) {\r
- if (keywords == null) {\r
- keywords = new ArrayList<String>();\r
- keywords.add("\92x\89\84");\r
- keywords.add("\92x\82ê");\r
- keywords.add("\90U\82è\91Ö\82¦");\r
- keywords.add("\90U\91Ö");\r
- keywords.add("\92â\8e~");\r
- keywords.add("\8e\96\8cÌ");\r
- }\r
-\r
- int count = 0;\r
- for (String keyword : keywords) {\r
- if (text.indexOf(keyword) >= 0) {\r
- count++;\r
- }\r
- }\r
- return count;\r
- }\r
- \r
- public long getSearchPeriod(){\r
- if (searchPeriod <= 0){\r
- KeyValueDao dao = KeyValueDao.getInstance();\r
- searchPeriod = dao.getInt(KeyValueDao.KEY_SEARCH_PERIOD, 5);\r
- }\r
- return searchPeriod;\r
- }\r
- \r
- public long getTwitPeriod(){\r
- if (twitPeriod <= 0){\r
- KeyValueDao dao = KeyValueDao.getInstance();\r
- twitPeriod = dao.getInt(KeyValueDao.KEY_TWIT_PERIOD, 5);\r
- }\r
- return twitPeriod;\r
- }\r
- \r
- private long getTwitTime(long id){\r
- String key = KeyValueDao.KEY_TWIT_TIME + id;\r
- Long value = twitTimeList.get(key);\r
- if (value == null){\r
- value = 0L;\r
- twitTimeList.put(key, value);\r
- }\r
- return value;\r
- }\r
- \r
- private void setTwitTime(long id, long value){\r
- String key = KeyValueDao.KEY_TWIT_TIME + id;\r
- twitTimeList.put(key, value);\r
- }\r
-}\r
+++ /dev/null
-package com.yuji.tdb.twitter;\r
-\r
-import java.text.DateFormat;\r
-import java.text.SimpleDateFormat;\r
-import java.util.ArrayList;\r
-import java.util.Calendar;\r
-import java.util.Date;\r
-import java.util.List;\r
-import java.util.TimeZone;\r
-import java.util.logging.Logger;\r
-\r
-import twitter4j.Query;\r
-import twitter4j.QueryResult;\r
-import twitter4j.Status;\r
-import twitter4j.Tweet;\r
-import twitter4j.Twitter;\r
-import twitter4j.TwitterException;\r
-import twitter4j.TwitterFactory;\r
-import twitter4j.auth.AccessToken;\r
-import twitter4j.conf.ConfigurationBuilder;\r
-\r
-import com.yuji.tdb.common.CommonUtil;\r
-import com.yuji.tdb.db.KeyValueDao;\r
-import com.yuji.tdb.db.Train;\r
-import com.yuji.tdb.db.TrainDao;\r
-import com.yuji.tdb.debug.Debug;\r
-import com.yuji.tdb.utility.StringUtility;\r
-\r
-public class TwitterUtil {\r
- private static final Logger log = Logger\r
- .getLogger(TwitterUtil.class.getName());\r
- private static TwitterUtil instance = null;\r
- private static Object obj = new Object();\r
- //private DateFormat df = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");\r
- private DateFormat df = new SimpleDateFormat("HH:mm");\r
- private int period = 0;\r
- \r
- public static TwitterUtil getInstance() {\r
- if (instance == null) {\r
- synchronized (obj) {\r
- if (instance == null) {\r
- instance = new TwitterUtil();\r
- }\r
- }\r
- }\r
- return instance;\r
- }\r
-\r
- private TwitterUtil() {\r
- df.setTimeZone(TimeZone.getTimeZone("JST")); \r
- }\r
-\r
- public void main(String consumerKey, String consumerSecret, AccessToken accessToken) {\r
- try {\r
- ConfigurationBuilder confBuilder = new ConfigurationBuilder();\r
- confBuilder.setDebugEnabled(true).setOAuthConsumerKey(consumerKey)\r
- .setOAuthConsumerSecret(consumerSecret);\r
- TwitterFactory factory = new TwitterFactory(confBuilder.build());\r
- Twitter twitter = factory.getInstance(accessToken);\r
-\r
- List<Train> list = getTrainList();\r
- for (Train train : list){\r
- twite(twitter, train);\r
- }\r
- } catch (TwitterException e) {\r
- // TODO Auto-generated catch block\r
- e.printStackTrace();\r
- log.severe(e.toString());\r
- }\r
- }\r
-\r
- private void twite(Twitter twitter, Train train) throws TwitterException {\r
- Query query = new Query();\r
- //query.setRpp(1000); // TODO\r
- query.setQuery(train.getSearchWord());\r
- QueryResult result = null;\r
- try {\r
- result = twitter.search(query);\r
- }\r
- catch (TwitterException e){\r
- log.severe("" + Debug.getLineNo());\r
- throw e;\r
- }\r
- List<Tweet> tweets = result.getTweets();\r
- \r
- Calendar cal = Calendar.getInstance();\r
- Date date = cal.getTime();\r
- long cur = date.getTime();\r
-\r
- int count = 0;\r
- int hit = 0;\r
- int mhit = 0;\r
- int period = getPeriod();\r
- \r
- int index;\r
- int mindex = 0;\r
- int size = tweets.size();\r
- for (index = 0; index < size; index++) {\r
- Tweet tweet = tweets.get(index);\r
- \r
- Date at = tweet.getCreatedAt();\r
- long t = at.getTime();\r
- \r
- String message = tweet.getText();\r
- \r
- if (t < cur - period * 60 * 1000){\r
- System.out.println("\81~" + tweet.getFromUser() + " - "\r
- + tweet.getText() + at);\r
- continue;\r
- }\r
- hit = filter(message);\r
- if (hit <= 0) {\r
- System.out.println("\81¢" + tweet.getFromUser() + " - "\r
- + tweet.getText() + at);\r
- // \92x\89\84\88È\8aO\82Ì\8f\91\82«\8d\9e\82Ý\r
- continue;\r
- }\r
- if (hit > mhit){\r
- hit = mhit;\r
- mindex = index;\r
- }\r
-\r
- System.out.println("@" + tweet.getFromUser() + " - "\r
- + tweet.getText() + at);\r
- count++;\r
- }\r
-\r
- String message = "[" + train.getName() + "] ";\r
- if (count < train.getCount()){\r
- message += df.format(date) + " \92x\89\84\82È\82µ"; \r
- }\r
- else {\r
- int N = 100;\r
- \r
- String sample = tweets.get(mindex).getText();\r
- sample = CommonUtil.replaceString(sample, "@", "(a)");\r
- sample = StringUtility.parseSubstring(sample, N);\r
- message += df.format(date) + " " + sample + " count=" + count; \r
- }\r
- System.out.println(message); //TODO\r
- \r
- Status status = null;\r
- try {\r
- status = twitter.updateStatus(message); //TODO\r
- }\r
- catch (TwitterException e){\r
- log.severe(Debug.getLineNo() + " " + message);\r
- throw e;\r
- }\r
- }\r
- \r
- private List<Train> getTrainList(){\r
- TrainDao dao = TrainDao.getInstance();\r
- List<Train> list = dao.search();\r
- if (list.size() <= 0){\r
- Train train;\r
- \r
- train = new Train("\8b\9e\95l\93\8c\96k\90ü", "\8b\9e\95l\93\8c\96k", 5);\r
- dao.put(train);\r
- train = new Train("\93\8c\8aC\93¹\90ü", "\93\8c\8aC\93¹", 5);\r
- dao.put(train);\r
- train = new Train("\8b\9e\95l\8b}\8ds\90ü", "\8b\9e\8b}", 5);\r
- dao.put(train);\r
- list = dao.search();\r
- }\r
- return list;\r
- }\r
- \r
- private static List<String> keywords = null;\r
-\r
- public int filter(String text) {\r
- if (keywords == null) {\r
- keywords = new ArrayList<String>();\r
- keywords.add("\92x\89\84");\r
- keywords.add("\92x\82ê");\r
- keywords.add("\90U\82è\91Ö\82¦");\r
- keywords.add("\90U\91Ö");\r
- keywords.add("\92â\8e~");\r
- keywords.add("\8e\96\8cÌ");\r
- }\r
-\r
- int count = 0;\r
- for (String keyword : keywords) {\r
- if (text.indexOf(keyword) >= 0) {\r
- count++;\r
- }\r
- }\r
- return count;\r
- }\r
- \r
- public int getPeriod(){\r
- if (period <= 0){\r
- KeyValueDao dao = KeyValueDao.getInstance();\r
- period = dao.getInt(KeyValueDao.KEY_SEARCH_PERIOD);\r
- if (period <= 0){\r
- period = 5;\r
- dao.put(KeyValueDao.KEY_SEARCH_PERIOD, period);\r
- }\r
- }\r
- return period;\r
- }\r
-}\r
+++ /dev/null
-package com.yuji.tdb.db;\r
-\r
-import javax.jdo.PersistenceManager;\r
-\r
-public class KeyValueDao {\r
- public static final String KEY_CONSUMER_KEY = "CONSUMER_KEY";\r
- public static final String KEY_CONSUMER_SECRET = "CONSUMER_SECRET";\r
- public static final String KEY_REQUEST_TOKEN = "REQUEST_TOKEN";\r
- public static final String KEY_REQUEST_TOKEN_SECRET = "REQUEST_TOKEN_SECRET";\r
- public static final String KEY_ACCESS_TOKEN = "ACCESS_TOKEN";\r
- public static final String KEY_ACCESS_TOKEN_SECRET = "ACCESS_TOKEN_SECRET";\r
-\r
- public static final String KEY_SEARCH_PERIOD = "SEARCH_PERIOD";\r
- public static final String KEY_TWIT_PERIOD = "TWIT_PERIOD_";\r
-\r
- private static KeyValueDao instance = null;\r
- private PersistenceManager pm = PMFactory.get().getPersistenceManager();\r
- \r
- public static KeyValueDao getInstance(){\r
- if (instance == null){\r
- instance = new KeyValueDao();\r
- }\r
- return instance;\r
- }\r
- \r
- private KeyValueDao(){\r
- \r
- }\r
- \r
- public String get(String key){\r
- KeyValue keyValue = pm.getObjectById(KeyValue.class, key);\r
- if (keyValue == null){\r
- return null;\r
- }\r
- return keyValue.getValue();\r
- }\r
- \r
- public int getInt(String key){\r
- String value = get(key);\r
- return Integer.valueOf(value).intValue();\r
- }\r
- \r
- public void put(String key, String value){\r
- KeyValue keyValue = new KeyValue(key, value);\r
- pm.makePersistent(keyValue);\r
- }\r
-\r
- public void put(String key, int value){\r
- put(key, String.valueOf(value));\r
- }\r
-\r
- public String get(String key, String initValue){\r
- String value = get(key);\r
- if (value == null){\r
- put(key, initValue);\r
- value = initValue;\r
- }\r
- return value;\r
- }\r
-\r
- public int getInt(String key, int initValue){\r
- String value = get(key);\r
- if (value == null){\r
- put(key, initValue);\r
- }\r
- return Integer.valueOf(value).intValue();\r
- }\r
-}\r
+++ /dev/null
-package com.yuji.tdb.twitter;\r
-\r
-import java.text.DateFormat;\r
-import java.text.SimpleDateFormat;\r
-import java.util.ArrayList;\r
-import java.util.Calendar;\r
-import java.util.Date;\r
-import java.util.HashMap;\r
-import java.util.List;\r
-import java.util.Map;\r
-import java.util.TimeZone;\r
-import java.util.logging.Logger;\r
-\r
-import twitter4j.Query;\r
-import twitter4j.QueryResult;\r
-import twitter4j.Status;\r
-import twitter4j.Tweet;\r
-import twitter4j.Twitter;\r
-import twitter4j.TwitterException;\r
-import twitter4j.TwitterFactory;\r
-import twitter4j.auth.AccessToken;\r
-import twitter4j.conf.ConfigurationBuilder;\r
-\r
-import com.yuji.tdb.common.CommonUtil;\r
-import com.yuji.tdb.db.KeyValueDao;\r
-import com.yuji.tdb.db.Train;\r
-import com.yuji.tdb.db.TrainDao;\r
-import com.yuji.tdb.debug.Debug;\r
-import com.yuji.tdb.utility.StringUtility;\r
-\r
-public class TwitterUtil {\r
- private static final Logger log = Logger\r
- .getLogger(TwitterUtil.class.getName());\r
- private static TwitterUtil instance = null;\r
- private static Object obj = new Object();\r
- //private DateFormat df = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");\r
- private DateFormat df = new SimpleDateFormat("HH:mm");\r
- private static List<String> keywords = null;\r
- private long searchPeriod = 0;\r
- private long twitPeriod = 0;\r
- private Map<String, Long> twitTimeList = new HashMap<String, Long>();\r
- \r
- public static TwitterUtil getInstance() {\r
- if (instance == null) {\r
- synchronized (obj) {\r
- if (instance == null) {\r
- instance = new TwitterUtil();\r
- }\r
- }\r
- }\r
- return instance;\r
- }\r
-\r
- private TwitterUtil() {\r
- df.setTimeZone(TimeZone.getTimeZone("JST")); \r
- }\r
-\r
- public void main(String consumerKey, String consumerSecret, AccessToken accessToken) {\r
- try {\r
- ConfigurationBuilder confBuilder = new ConfigurationBuilder();\r
- confBuilder.setDebugEnabled(true).setOAuthConsumerKey(consumerKey)\r
- .setOAuthConsumerSecret(consumerSecret);\r
- TwitterFactory factory = new TwitterFactory(confBuilder.build());\r
- Twitter twitter = factory.getInstance(accessToken);\r
-\r
- List<Train> list = getTrainList();\r
- for (Train train : list){\r
- Calendar cal = Calendar.getInstance();\r
- Date date = cal.getTime();\r
- long cur = date.getTime();\r
-\r
- long id = train.getId();\r
- long t = getTwitTime(id);\r
- long period = getTwitPeriod();\r
-\r
- if (t > 0 && cur < t + period * 60 * 1000){\r
- continue;\r
- }\r
- twite(twitter, train);\r
- }\r
- } catch (TwitterException e) {\r
- // TODO Auto-generated catch block\r
- e.printStackTrace();\r
- log.severe(e.toString());\r
- }\r
- }\r
-\r
- private void twite(Twitter twitter, Train train) throws TwitterException {\r
- Query query = new Query();\r
- //query.setRpp(1000); // TODO\r
- query.setQuery(train.getSearchWord());\r
- QueryResult result = null;\r
- try {\r
- result = twitter.search(query);\r
- }\r
- catch (TwitterException e){\r
- log.severe("" + Debug.getLineNo());\r
- throw e;\r
- }\r
- List<Tweet> tweets = result.getTweets();\r
- \r
- Calendar cal = Calendar.getInstance();\r
- Date date = cal.getTime();\r
- long cur = date.getTime();\r
-\r
- int count = 0;\r
- int hit = 0;\r
- int mhit = 0;\r
- long period = getSearchPeriod();\r
- long id = train.getId();\r
- \r
- int index;\r
- int mindex = 0;\r
- int size = tweets.size();\r
- for (index = 0; index < size; index++) {\r
- Tweet tweet = tweets.get(index);\r
- \r
- Date at = tweet.getCreatedAt();\r
- long t = at.getTime();\r
- \r
- String message = tweet.getText();\r
- \r
- if (t < cur - period * 60 * 1000){\r
- System.out.println("\81~" + tweet.getFromUser() + " - "\r
- + tweet.getText() + at);\r
- continue;\r
- }\r
- hit = filter(message);\r
- if (hit <= 0) {\r
- System.out.println("\81¢" + tweet.getFromUser() + " - "\r
- + tweet.getText() + at);\r
- // \92x\89\84\88È\8aO\82Ì\8f\91\82«\8d\9e\82Ý\r
- continue;\r
- }\r
- if (hit > mhit){\r
- hit = mhit;\r
- mindex = index;\r
- }\r
-\r
- System.out.println("@" + tweet.getFromUser() + " - "\r
- + tweet.getText() + at);\r
- count++;\r
- }\r
-\r
- String message = "[" + train.getName() + "] ";\r
- if (count < train.getCount()){\r
- message += df.format(date) + " \92x\89\84\82È\82µ"; \r
- }\r
- else {\r
- int N = 100;\r
- \r
- String sample = tweets.get(mindex).getText();\r
- sample = CommonUtil.replaceString(sample, "@", "(a)");\r
- sample = StringUtility.parseSubstring(sample, N);\r
- message += df.format(date) + " " + sample + " count=" + count; \r
- }\r
- System.out.println(message); //TODO\r
- \r
- Status status = null;\r
- try {\r
- status = twitter.updateStatus(message); //TODO\r
- setTwitTime(id, cur);\r
- }\r
- catch (TwitterException e){\r
- log.severe(Debug.getLineNo() + " " + message);\r
- log.severe(Debug.getLineNo() + " " + status);\r
- throw e;\r
- }\r
- }\r
- \r
- private List<Train> getTrainList(){\r
- TrainDao dao = TrainDao.getInstance();\r
- List<Train> list = dao.search();\r
- if (list.size() <= 0){\r
- Train train;\r
- \r
- train = new Train("\8b\9e\95l\93\8c\96k\90ü", "\8b\9e\95l\93\8c\96k", 5);\r
- dao.put(train);\r
- train = new Train("\93\8c\8aC\93¹\90ü", "\93\8c\8aC\93¹", 5);\r
- dao.put(train);\r
- train = new Train("\8b\9e\95l\8b}\8ds\90ü", "\8b\9e\8b}", 5);\r
- dao.put(train);\r
- list = dao.search();\r
- }\r
- return list;\r
- }\r
- \r
- public int filter(String text) {\r
- if (keywords == null) {\r
- keywords = new ArrayList<String>();\r
- keywords.add("\92x\89\84");\r
- keywords.add("\92x\82ê");\r
- keywords.add("\90U\82è\91Ö\82¦");\r
- keywords.add("\90U\91Ö");\r
- keywords.add("\92â\8e~");\r
- keywords.add("\8e\96\8cÌ");\r
- }\r
-\r
- int count = 0;\r
- for (String keyword : keywords) {\r
- if (text.indexOf(keyword) >= 0) {\r
- count++;\r
- }\r
- }\r
- return count;\r
- }\r
- \r
- public long getSearchPeriod(){\r
- if (searchPeriod <= 0){\r
- KeyValueDao dao = KeyValueDao.getInstance();\r
- searchPeriod = dao.getInt(KeyValueDao.KEY_SEARCH_PERIOD, 5);\r
- }\r
- return searchPeriod;\r
- }\r
- \r
- public long getTwitPeriod(){\r
- if (twitPeriod <= 0){\r
- KeyValueDao dao = KeyValueDao.getInstance();\r
- twitPeriod = dao.getInt(KeyValueDao.KEY_TWIT_PERIOD, 5);\r
- }\r
- return twitPeriod;\r
- }\r
- \r
- private long getTwitTime(long id){\r
- String key = KeyValueDao.KEY_TWIT_TIME + id;\r
- Long value = twitTimeList.get(key);\r
- if (value == null){\r
- value = 0L;\r
- setTwitTime(id, value);\r
- }\r
- return value;\r
- }\r
- \r
- private void setTwitTime(long id, long value){\r
- String key = KeyValueDao.KEY_TWIT_TIME + id;\r
- twitTimeList.put(key, value);\r
- KeyValueDao dao = KeyValueDao.getInstance();\r
- dao.put(key, String.valueOf(value));\r
- }\r
-}\r
+++ /dev/null
-package com.yuji.tdb.twitter;\r
-\r
-import java.text.DateFormat;\r
-import java.text.SimpleDateFormat;\r
-import java.util.ArrayList;\r
-import java.util.Calendar;\r
-import java.util.Date;\r
-import java.util.List;\r
-import java.util.TimeZone;\r
-import java.util.logging.Logger;\r
-\r
-import twitter4j.Query;\r
-import twitter4j.QueryResult;\r
-import twitter4j.Status;\r
-import twitter4j.Tweet;\r
-import twitter4j.Twitter;\r
-import twitter4j.TwitterException;\r
-import twitter4j.TwitterFactory;\r
-import twitter4j.auth.AccessToken;\r
-import twitter4j.conf.ConfigurationBuilder;\r
-\r
-import com.yuji.tdb.common.CommonUtil;\r
-import com.yuji.tdb.db.KeyValueDao;\r
-import com.yuji.tdb.db.Train;\r
-import com.yuji.tdb.db.TrainDao;\r
-import com.yuji.tdb.debug.Debug;\r
-import com.yuji.tdb.utility.StringUtility;\r
-\r
-public class TwitterUtil {\r
- private static final Logger log = Logger\r
- .getLogger(TwitterUtil.class.getName());\r
- private static TwitterUtil instance = null;\r
- private static Object obj = new Object();\r
- //private DateFormat df = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");\r
- private DateFormat df = new SimpleDateFormat("HH:mm");\r
- private static List<String> keywords = null;\r
- private int period = 0;\r
- \r
- public static TwitterUtil getInstance() {\r
- if (instance == null) {\r
- synchronized (obj) {\r
- if (instance == null) {\r
- instance = new TwitterUtil();\r
- }\r
- }\r
- }\r
- return instance;\r
- }\r
-\r
- private TwitterUtil() {\r
- df.setTimeZone(TimeZone.getTimeZone("JST")); \r
- }\r
-\r
- public void main(String consumerKey, String consumerSecret, AccessToken accessToken) {\r
- try {\r
- ConfigurationBuilder confBuilder = new ConfigurationBuilder();\r
- confBuilder.setDebugEnabled(true).setOAuthConsumerKey(consumerKey)\r
- .setOAuthConsumerSecret(consumerSecret);\r
- TwitterFactory factory = new TwitterFactory(confBuilder.build());\r
- Twitter twitter = factory.getInstance(accessToken);\r
-\r
- List<Train> list = getTrainList();\r
- for (Train train : list){\r
- twite(twitter, train);\r
- }\r
- } catch (TwitterException e) {\r
- // TODO Auto-generated catch block\r
- e.printStackTrace();\r
- log.severe(e.toString());\r
- }\r
- }\r
-\r
- private void twite(Twitter twitter, Train train) throws TwitterException {\r
- Query query = new Query();\r
- //query.setRpp(1000); // TODO\r
- query.setQuery(train.getSearchWord());\r
- QueryResult result = null;\r
- try {\r
- result = twitter.search(query);\r
- }\r
- catch (TwitterException e){\r
- log.severe("" + Debug.getLineNo());\r
- throw e;\r
- }\r
- List<Tweet> tweets = result.getTweets();\r
- \r
- Calendar cal = Calendar.getInstance();\r
- Date date = cal.getTime();\r
- long cur = date.getTime();\r
-\r
- int count = 0;\r
- int hit = 0;\r
- int mhit = 0;\r
- int period = getPeriod();\r
- \r
- int index;\r
- int mindex = 0;\r
- int size = tweets.size();\r
- for (index = 0; index < size; index++) {\r
- Tweet tweet = tweets.get(index);\r
- \r
- Date at = tweet.getCreatedAt();\r
- long t = at.getTime();\r
- \r
- String message = tweet.getText();\r
- \r
- if (t < cur - period * 60 * 1000){\r
- System.out.println("\81~" + tweet.getFromUser() + " - "\r
- + tweet.getText() + at);\r
- continue;\r
- }\r
- hit = filter(message);\r
- if (hit <= 0) {\r
- System.out.println("\81¢" + tweet.getFromUser() + " - "\r
- + tweet.getText() + at);\r
- // \92x\89\84\88È\8aO\82Ì\8f\91\82«\8d\9e\82Ý\r
- continue;\r
- }\r
- if (hit > mhit){\r
- hit = mhit;\r
- mindex = index;\r
- }\r
-\r
- System.out.println("@" + tweet.getFromUser() + " - "\r
- + tweet.getText() + at);\r
- count++;\r
- }\r
-\r
- String message = "[" + train.getName() + "] ";\r
- if (count < train.getCount()){\r
- message += df.format(date) + " \92x\89\84\82È\82µ"; \r
- }\r
- else {\r
- int N = 100;\r
- \r
- String sample = tweets.get(mindex).getText();\r
- sample = CommonUtil.replaceString(sample, "@", "(a)");\r
- sample = StringUtility.parseSubstring(sample, N);\r
- message += df.format(date) + " " + sample + " count=" + count; \r
- }\r
- System.out.println(message); //TODO\r
- \r
- Status status = null;\r
- try {\r
- status = twitter.updateStatus(message); //TODO\r
- }\r
- catch (TwitterException e){\r
- log.severe(Debug.getLineNo() + " " + message);\r
- throw e;\r
- }\r
- }\r
- \r
- private List<Train> getTrainList(){\r
- TrainDao dao = TrainDao.getInstance();\r
- List<Train> list = dao.search();\r
- if (list.size() <= 0){\r
- Train train;\r
- \r
- train = new Train("\8b\9e\95l\93\8c\96k\90ü", "\8b\9e\95l\93\8c\96k", 5);\r
- dao.put(train);\r
- train = new Train("\93\8c\8aC\93¹\90ü", "\93\8c\8aC\93¹", 5);\r
- dao.put(train);\r
- train = new Train("\8b\9e\95l\8b}\8ds\90ü", "\8b\9e\8b}", 5);\r
- dao.put(train);\r
- list = dao.search();\r
- }\r
- return list;\r
- }\r
- \r
- public int filter(String text) {\r
- if (keywords == null) {\r
- keywords = new ArrayList<String>();\r
- keywords.add("\92x\89\84");\r
- keywords.add("\92x\82ê");\r
- keywords.add("\90U\82è\91Ö\82¦");\r
- keywords.add("\90U\91Ö");\r
- keywords.add("\92â\8e~");\r
- keywords.add("\8e\96\8cÌ");\r
- }\r
-\r
- int count = 0;\r
- for (String keyword : keywords) {\r
- if (text.indexOf(keyword) >= 0) {\r
- count++;\r
- }\r
- }\r
- return count;\r
- }\r
- \r
- public int getPeriod(){\r
- if (period <= 0){\r
- KeyValueDao dao = KeyValueDao.getInstance();\r
- period = dao.getInt(KeyValueDao.KEY_SEARCH_PERIOD);\r
- if (period <= 0){\r
- period = 5;\r
- dao.put(KeyValueDao.KEY_SEARCH_PERIOD, period);\r
- }\r
- }\r
- return period;\r
- }\r
-}\r
+++ /dev/null
-package com.yuji.tdb.twitter;\r
-\r
-import java.text.DateFormat;\r
-import java.text.SimpleDateFormat;\r
-import java.util.ArrayList;\r
-import java.util.Calendar;\r
-import java.util.Date;\r
-import java.util.HashMap;\r
-import java.util.List;\r
-import java.util.Map;\r
-import java.util.TimeZone;\r
-import java.util.logging.Logger;\r
-\r
-import twitter4j.Query;\r
-import twitter4j.QueryResult;\r
-import twitter4j.Status;\r
-import twitter4j.Tweet;\r
-import twitter4j.Twitter;\r
-import twitter4j.TwitterException;\r
-import twitter4j.TwitterFactory;\r
-import twitter4j.auth.AccessToken;\r
-import twitter4j.conf.ConfigurationBuilder;\r
-\r
-import com.yuji.tdb.common.CommonUtil;\r
-import com.yuji.tdb.db.KeyValueDao;\r
-import com.yuji.tdb.db.Train;\r
-import com.yuji.tdb.db.TrainDao;\r
-import com.yuji.tdb.debug.Debug;\r
-import com.yuji.tdb.utility.StringUtility;\r
-\r
-public class TwitterUtil {\r
- private static final Logger log = Logger\r
- .getLogger(TwitterUtil.class.getName());\r
- private static TwitterUtil instance = null;\r
- private static Object obj = new Object();\r
- //private DateFormat df = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");\r
- private DateFormat df = new SimpleDateFormat("HH:mm");\r
- private static List<String> keywords = null;\r
- private int period = 0;\r
- private Map<String, Long> twitTimeList = new HashMap<String, Long>();\r
- \r
- public static TwitterUtil getInstance() {\r
- if (instance == null) {\r
- synchronized (obj) {\r
- if (instance == null) {\r
- instance = new TwitterUtil();\r
- }\r
- }\r
- }\r
- return instance;\r
- }\r
-\r
- private TwitterUtil() {\r
- df.setTimeZone(TimeZone.getTimeZone("JST")); \r
- }\r
-\r
- public void main(String consumerKey, String consumerSecret, AccessToken accessToken) {\r
- try {\r
- ConfigurationBuilder confBuilder = new ConfigurationBuilder();\r
- confBuilder.setDebugEnabled(true).setOAuthConsumerKey(consumerKey)\r
- .setOAuthConsumerSecret(consumerSecret);\r
- TwitterFactory factory = new TwitterFactory(confBuilder.build());\r
- Twitter twitter = factory.getInstance(accessToken);\r
-\r
- List<Train> list = getTrainList();\r
- for (Train train : list){\r
- twite(twitter, train);\r
- }\r
- } catch (TwitterException e) {\r
- // TODO Auto-generated catch block\r
- e.printStackTrace();\r
- log.severe(e.toString());\r
- }\r
- }\r
-\r
- private void twite(Twitter twitter, Train train) throws TwitterException {\r
- Query query = new Query();\r
- //query.setRpp(1000); // TODO\r
- query.setQuery(train.getSearchWord());\r
- QueryResult result = null;\r
- try {\r
- result = twitter.search(query);\r
- }\r
- catch (TwitterException e){\r
- log.severe("" + Debug.getLineNo());\r
- throw e;\r
- }\r
- List<Tweet> tweets = result.getTweets();\r
- \r
- Calendar cal = Calendar.getInstance();\r
- Date date = cal.getTime();\r
- long cur = date.getTime();\r
-\r
- int count = 0;\r
- int hit = 0;\r
- int mhit = 0;\r
- int period = getPeriod();\r
- \r
- int index;\r
- int mindex = 0;\r
- int size = tweets.size();\r
- for (index = 0; index < size; index++) {\r
- Tweet tweet = tweets.get(index);\r
- \r
- Date at = tweet.getCreatedAt();\r
- long t = at.getTime();\r
- \r
- String message = tweet.getText();\r
- \r
- if (t < cur - period * 60 * 1000){\r
- System.out.println("\81~" + tweet.getFromUser() + " - "\r
- + tweet.getText() + at);\r
- continue;\r
- }\r
- hit = filter(message);\r
- if (hit <= 0) {\r
- System.out.println("\81¢" + tweet.getFromUser() + " - "\r
- + tweet.getText() + at);\r
- // \92x\89\84\88È\8aO\82Ì\8f\91\82«\8d\9e\82Ý\r
- continue;\r
- }\r
- if (hit > mhit){\r
- hit = mhit;\r
- mindex = index;\r
- }\r
-\r
- System.out.println("@" + tweet.getFromUser() + " - "\r
- + tweet.getText() + at);\r
- count++;\r
- }\r
-\r
- String message = "[" + train.getName() + "] ";\r
- if (count < train.getCount()){\r
- message += df.format(date) + " \92x\89\84\82È\82µ"; \r
- }\r
- else {\r
- int N = 100;\r
- \r
- String sample = tweets.get(mindex).getText();\r
- sample = CommonUtil.replaceString(sample, "@", "(a)");\r
- sample = StringUtility.parseSubstring(sample, N);\r
- message += df.format(date) + " " + sample + " count=" + count; \r
- }\r
- System.out.println(message); //TODO\r
- \r
- Status status = null;\r
- try {\r
- status = twitter.updateStatus(message); //TODO\r
- }\r
- catch (TwitterException e){\r
- log.severe(Debug.getLineNo() + " " + message);\r
- throw e;\r
- }\r
- }\r
- \r
- private List<Train> getTrainList(){\r
- TrainDao dao = TrainDao.getInstance();\r
- List<Train> list = dao.search();\r
- if (list.size() <= 0){\r
- Train train;\r
- \r
- train = new Train("\8b\9e\95l\93\8c\96k\90ü", "\8b\9e\95l\93\8c\96k", 5);\r
- dao.put(train);\r
- train = new Train("\93\8c\8aC\93¹\90ü", "\93\8c\8aC\93¹", 5);\r
- dao.put(train);\r
- train = new Train("\8b\9e\95l\8b}\8ds\90ü", "\8b\9e\8b}", 5);\r
- dao.put(train);\r
- list = dao.search();\r
- }\r
- return list;\r
- }\r
- \r
- public int filter(String text) {\r
- if (keywords == null) {\r
- keywords = new ArrayList<String>();\r
- keywords.add("\92x\89\84");\r
- keywords.add("\92x\82ê");\r
- keywords.add("\90U\82è\91Ö\82¦");\r
- keywords.add("\90U\91Ö");\r
- keywords.add("\92â\8e~");\r
- keywords.add("\8e\96\8cÌ");\r
- }\r
-\r
- int count = 0;\r
- for (String keyword : keywords) {\r
- if (text.indexOf(keyword) >= 0) {\r
- count++;\r
- }\r
- }\r
- return count;\r
- }\r
- \r
- public int getPeriod(){\r
- if (period <= 0){\r
- KeyValueDao dao = KeyValueDao.getInstance();\r
- period = dao.getInt(KeyValueDao.KEY_SEARCH_PERIOD, 5);\r
- }\r
- return period;\r
- }\r
- \r
- private long getTwitTime(long id){\r
- String key = KeyValueDao.KEY_TWIT_TIME + id;\r
- Long value = (long)twitTimeList.get(key);\r
- if (value == null){\r
- value = 0L;\r
- twitTimeList.put(key, value);\r
- }\r
- return value;\r
- }\r
-}\r
+++ /dev/null
-package com.yuji.tdb.twitter;\r
-\r
-import java.text.DateFormat;\r
-import java.text.SimpleDateFormat;\r
-import java.util.ArrayList;\r
-import java.util.Calendar;\r
-import java.util.Date;\r
-import java.util.HashMap;\r
-import java.util.List;\r
-import java.util.Map;\r
-import java.util.TimeZone;\r
-import java.util.logging.Logger;\r
-\r
-import twitter4j.Query;\r
-import twitter4j.QueryResult;\r
-import twitter4j.Status;\r
-import twitter4j.Tweet;\r
-import twitter4j.Twitter;\r
-import twitter4j.TwitterException;\r
-import twitter4j.TwitterFactory;\r
-import twitter4j.auth.AccessToken;\r
-import twitter4j.conf.ConfigurationBuilder;\r
-\r
-import com.yuji.tdb.common.CommonUtil;\r
-import com.yuji.tdb.db.KeyValueDao;\r
-import com.yuji.tdb.db.Train;\r
-import com.yuji.tdb.db.TrainDao;\r
-import com.yuji.tdb.debug.Debug;\r
-import com.yuji.tdb.utility.StringUtility;\r
-\r
-public class TwitterUtil {\r
- private static final Logger log = Logger\r
- .getLogger(TwitterUtil.class.getName());\r
- private static TwitterUtil instance = null;\r
- private static Object obj = new Object();\r
- //private DateFormat df = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");\r
- private DateFormat df = new SimpleDateFormat("HH:mm");\r
- private static List<String> keywords = null;\r
- private long searchPeriod = 0;\r
- private long twitPeriod = 0;\r
- private Map<String, Long> twitTimeList = new HashMap<String, Long>();\r
- \r
- public static TwitterUtil getInstance() {\r
- if (instance == null) {\r
- synchronized (obj) {\r
- if (instance == null) {\r
- instance = new TwitterUtil();\r
- }\r
- }\r
- }\r
- return instance;\r
- }\r
-\r
- private TwitterUtil() {\r
- df.setTimeZone(TimeZone.getTimeZone("JST")); \r
- }\r
-\r
- public void main(String consumerKey, String consumerSecret, AccessToken accessToken) {\r
- try {\r
- ConfigurationBuilder confBuilder = new ConfigurationBuilder();\r
- confBuilder.setDebugEnabled(true).setOAuthConsumerKey(consumerKey)\r
- .setOAuthConsumerSecret(consumerSecret);\r
- TwitterFactory factory = new TwitterFactory(confBuilder.build());\r
- Twitter twitter = factory.getInstance(accessToken);\r
-\r
- List<Train> list = getTrainList();\r
- for (Train train : list){\r
- Calendar cal = Calendar.getInstance();\r
- Date date = cal.getTime();\r
- long cur = date.getTime();\r
-\r
- long id = train.getId();\r
- long t = getTwitTime(id);\r
- long period = getTwitPeriod();\r
- \r
- if (t + period < cur){\r
- continue;\r
- }\r
- twite(twitter, train);\r
- }\r
- } catch (TwitterException e) {\r
- // TODO Auto-generated catch block\r
- e.printStackTrace();\r
- log.severe(e.toString());\r
- }\r
- }\r
-\r
- private void twite(Twitter twitter, Train train) throws TwitterException {\r
- Query query = new Query();\r
- //query.setRpp(1000); // TODO\r
- query.setQuery(train.getSearchWord());\r
- QueryResult result = null;\r
- try {\r
- result = twitter.search(query);\r
- }\r
- catch (TwitterException e){\r
- log.severe("" + Debug.getLineNo());\r
- throw e;\r
- }\r
- List<Tweet> tweets = result.getTweets();\r
- \r
- Calendar cal = Calendar.getInstance();\r
- Date date = cal.getTime();\r
- long cur = date.getTime();\r
-\r
- int count = 0;\r
- int hit = 0;\r
- int mhit = 0;\r
- int period = getSearchPeriod();\r
- \r
- int index;\r
- int mindex = 0;\r
- int size = tweets.size();\r
- for (index = 0; index < size; index++) {\r
- Tweet tweet = tweets.get(index);\r
- \r
- Date at = tweet.getCreatedAt();\r
- long t = at.getTime();\r
- \r
- String message = tweet.getText();\r
- \r
- if (t < cur - period * 60 * 1000){\r
- System.out.println("\81~" + tweet.getFromUser() + " - "\r
- + tweet.getText() + at);\r
- continue;\r
- }\r
- hit = filter(message);\r
- if (hit <= 0) {\r
- System.out.println("\81¢" + tweet.getFromUser() + " - "\r
- + tweet.getText() + at);\r
- // \92x\89\84\88È\8aO\82Ì\8f\91\82«\8d\9e\82Ý\r
- continue;\r
- }\r
- if (hit > mhit){\r
- hit = mhit;\r
- mindex = index;\r
- }\r
-\r
- System.out.println("@" + tweet.getFromUser() + " - "\r
- + tweet.getText() + at);\r
- count++;\r
- }\r
-\r
- String message = "[" + train.getName() + "] ";\r
- if (count < train.getCount()){\r
- message += df.format(date) + " \92x\89\84\82È\82µ"; \r
- }\r
- else {\r
- int N = 100;\r
- \r
- String sample = tweets.get(mindex).getText();\r
- sample = CommonUtil.replaceString(sample, "@", "(a)");\r
- sample = StringUtility.parseSubstring(sample, N);\r
- message += df.format(date) + " " + sample + " count=" + count; \r
- }\r
- System.out.println(message); //TODO\r
- \r
- Status status = null;\r
- try {\r
- status = twitter.updateStatus(message); //TODO\r
- }\r
- catch (TwitterException e){\r
- log.severe(Debug.getLineNo() + " " + message);\r
- throw e;\r
- }\r
- }\r
- \r
- private List<Train> getTrainList(){\r
- TrainDao dao = TrainDao.getInstance();\r
- List<Train> list = dao.search();\r
- if (list.size() <= 0){\r
- Train train;\r
- \r
- train = new Train("\8b\9e\95l\93\8c\96k\90ü", "\8b\9e\95l\93\8c\96k", 5);\r
- dao.put(train);\r
- train = new Train("\93\8c\8aC\93¹\90ü", "\93\8c\8aC\93¹", 5);\r
- dao.put(train);\r
- train = new Train("\8b\9e\95l\8b}\8ds\90ü", "\8b\9e\8b}", 5);\r
- dao.put(train);\r
- list = dao.search();\r
- }\r
- return list;\r
- }\r
- \r
- public int filter(String text) {\r
- if (keywords == null) {\r
- keywords = new ArrayList<String>();\r
- keywords.add("\92x\89\84");\r
- keywords.add("\92x\82ê");\r
- keywords.add("\90U\82è\91Ö\82¦");\r
- keywords.add("\90U\91Ö");\r
- keywords.add("\92â\8e~");\r
- keywords.add("\8e\96\8cÌ");\r
- }\r
-\r
- int count = 0;\r
- for (String keyword : keywords) {\r
- if (text.indexOf(keyword) >= 0) {\r
- count++;\r
- }\r
- }\r
- return count;\r
- }\r
- \r
- public long getSearchPeriod(){\r
- if (searchPeriod <= 0){\r
- KeyValueDao dao = KeyValueDao.getInstance();\r
- searchPeriod = dao.getInt(KeyValueDao.KEY_SEARCH_PERIOD, 5);\r
- }\r
- return searchPeriod;\r
- }\r
- \r
- public long getTwitPeriod(){\r
- if (twitPeriod <= 0){\r
- KeyValueDao dao = KeyValueDao.getInstance();\r
- twitPeriod = dao.getInt(KeyValueDao.KEY_TWIT_PERIOD, 5);\r
- }\r
- return twitPeriod;\r
- }\r
- \r
- private long getTwitTime(long id){\r
- String key = KeyValueDao.KEY_TWIT_TIME + id;\r
- Long value = (long)twitTimeList.get(key);\r
- if (value == null){\r
- value = 0L;\r
- twitTimeList.put(key, value);\r
- }\r
- return value;\r
- }\r
- \r
- private void setTwitTime(long id, long value){\r
- String key = KeyValueDao.KEY_TWIT_TIME + id;\r
- twitTimeList.put(key, value);\r
- }\r
-}\r
+++ /dev/null
-package com.yuji.tdb.twitter;\r
-\r
-import java.text.DateFormat;\r
-import java.text.SimpleDateFormat;\r
-import java.util.ArrayList;\r
-import java.util.Calendar;\r
-import java.util.Date;\r
-import java.util.HashMap;\r
-import java.util.List;\r
-import java.util.Map;\r
-import java.util.TimeZone;\r
-import java.util.logging.Logger;\r
-\r
-import twitter4j.Query;\r
-import twitter4j.QueryResult;\r
-import twitter4j.Status;\r
-import twitter4j.Tweet;\r
-import twitter4j.Twitter;\r
-import twitter4j.TwitterException;\r
-import twitter4j.TwitterFactory;\r
-import twitter4j.auth.AccessToken;\r
-import twitter4j.conf.ConfigurationBuilder;\r
-\r
-import com.yuji.tdb.common.CommonUtil;\r
-import com.yuji.tdb.db.KeyValueDao;\r
-import com.yuji.tdb.db.Train;\r
-import com.yuji.tdb.db.TrainDao;\r
-import com.yuji.tdb.debug.Debug;\r
-import com.yuji.tdb.utility.StringUtility;\r
-\r
-public class TwitterUtil {\r
- private static final Logger log = Logger\r
- .getLogger(TwitterUtil.class.getName());\r
- private static TwitterUtil instance = null;\r
- private static Object obj = new Object();\r
- //private DateFormat df = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");\r
- private DateFormat df = new SimpleDateFormat("HH:mm");\r
- private static List<String> keywords = null;\r
- private long searchPeriod = 0;\r
- private long twitPeriod = 0;\r
- private Map<String, Long> twitTimeList = new HashMap<String, Long>();\r
- \r
- public static TwitterUtil getInstance() {\r
- if (instance == null) {\r
- synchronized (obj) {\r
- if (instance == null) {\r
- instance = new TwitterUtil();\r
- }\r
- }\r
- }\r
- return instance;\r
- }\r
-\r
- private TwitterUtil() {\r
- df.setTimeZone(TimeZone.getTimeZone("JST")); \r
- }\r
-\r
- public void main(String consumerKey, String consumerSecret, AccessToken accessToken) {\r
- try {\r
- ConfigurationBuilder confBuilder = new ConfigurationBuilder();\r
- confBuilder.setDebugEnabled(true).setOAuthConsumerKey(consumerKey)\r
- .setOAuthConsumerSecret(consumerSecret);\r
- TwitterFactory factory = new TwitterFactory(confBuilder.build());\r
- Twitter twitter = factory.getInstance(accessToken);\r
-\r
- List<Train> list = getTrainList();\r
- for (Train train : list){\r
- Calendar cal = Calendar.getInstance();\r
- Date date = cal.getTime();\r
- long cur = date.getTime();\r
-\r
- long id = train.getId();\r
- long t = getTwitTime(id);\r
- long period = getTwitPeriod();\r
- \r
- if (t + period < cur){\r
- continue;\r
- }\r
- twite(twitter, train);\r
- }\r
- } catch (TwitterException e) {\r
- // TODO Auto-generated catch block\r
- e.printStackTrace();\r
- log.severe(e.toString());\r
- }\r
- }\r
-\r
- private void twite(Twitter twitter, Train train) throws TwitterException {\r
- Query query = new Query();\r
- //query.setRpp(1000); // TODO\r
- query.setQuery(train.getSearchWord());\r
- QueryResult result = null;\r
- try {\r
- result = twitter.search(query);\r
- }\r
- catch (TwitterException e){\r
- log.severe("" + Debug.getLineNo());\r
- throw e;\r
- }\r
- List<Tweet> tweets = result.getTweets();\r
- \r
- Calendar cal = Calendar.getInstance();\r
- Date date = cal.getTime();\r
- long cur = date.getTime();\r
-\r
- int count = 0;\r
- int hit = 0;\r
- int mhit = 0;\r
- int period = getSearchPeriod();\r
- \r
- int index;\r
- int mindex = 0;\r
- int size = tweets.size();\r
- for (index = 0; index < size; index++) {\r
- Tweet tweet = tweets.get(index);\r
- \r
- Date at = tweet.getCreatedAt();\r
- long t = at.getTime();\r
- \r
- String message = tweet.getText();\r
- \r
- if (t < cur - period * 60 * 1000){\r
- System.out.println("\81~" + tweet.getFromUser() + " - "\r
- + tweet.getText() + at);\r
- continue;\r
- }\r
- hit = filter(message);\r
- if (hit <= 0) {\r
- System.out.println("\81¢" + tweet.getFromUser() + " - "\r
- + tweet.getText() + at);\r
- // \92x\89\84\88È\8aO\82Ì\8f\91\82«\8d\9e\82Ý\r
- continue;\r
- }\r
- if (hit > mhit){\r
- hit = mhit;\r
- mindex = index;\r
- }\r
-\r
- System.out.println("@" + tweet.getFromUser() + " - "\r
- + tweet.getText() + at);\r
- count++;\r
- }\r
-\r
- String message = "[" + train.getName() + "] ";\r
- if (count < train.getCount()){\r
- message += df.format(date) + " \92x\89\84\82È\82µ"; \r
- }\r
- else {\r
- int N = 100;\r
- \r
- String sample = tweets.get(mindex).getText();\r
- sample = CommonUtil.replaceString(sample, "@", "(a)");\r
- sample = StringUtility.parseSubstring(sample, N);\r
- message += df.format(date) + " " + sample + " count=" + count; \r
- }\r
- System.out.println(message); //TODO\r
- \r
- Status status = null;\r
- try {\r
- status = twitter.updateStatus(message); //TODO\r
- setTwitTime(id, cur);\r
- }\r
- catch (TwitterException e){\r
- log.severe(Debug.getLineNo() + " " + message);\r
- throw e;\r
- }\r
- }\r
- \r
- private List<Train> getTrainList(){\r
- TrainDao dao = TrainDao.getInstance();\r
- List<Train> list = dao.search();\r
- if (list.size() <= 0){\r
- Train train;\r
- \r
- train = new Train("\8b\9e\95l\93\8c\96k\90ü", "\8b\9e\95l\93\8c\96k", 5);\r
- dao.put(train);\r
- train = new Train("\93\8c\8aC\93¹\90ü", "\93\8c\8aC\93¹", 5);\r
- dao.put(train);\r
- train = new Train("\8b\9e\95l\8b}\8ds\90ü", "\8b\9e\8b}", 5);\r
- dao.put(train);\r
- list = dao.search();\r
- }\r
- return list;\r
- }\r
- \r
- public int filter(String text) {\r
- if (keywords == null) {\r
- keywords = new ArrayList<String>();\r
- keywords.add("\92x\89\84");\r
- keywords.add("\92x\82ê");\r
- keywords.add("\90U\82è\91Ö\82¦");\r
- keywords.add("\90U\91Ö");\r
- keywords.add("\92â\8e~");\r
- keywords.add("\8e\96\8cÌ");\r
- }\r
-\r
- int count = 0;\r
- for (String keyword : keywords) {\r
- if (text.indexOf(keyword) >= 0) {\r
- count++;\r
- }\r
- }\r
- return count;\r
- }\r
- \r
- public long getSearchPeriod(){\r
- if (searchPeriod <= 0){\r
- KeyValueDao dao = KeyValueDao.getInstance();\r
- searchPeriod = dao.getInt(KeyValueDao.KEY_SEARCH_PERIOD, 5);\r
- }\r
- return searchPeriod;\r
- }\r
- \r
- public long getTwitPeriod(){\r
- if (twitPeriod <= 0){\r
- KeyValueDao dao = KeyValueDao.getInstance();\r
- twitPeriod = dao.getInt(KeyValueDao.KEY_TWIT_PERIOD, 5);\r
- }\r
- return twitPeriod;\r
- }\r
- \r
- private long getTwitTime(long id){\r
- String key = KeyValueDao.KEY_TWIT_TIME + id;\r
- Long value = (long)twitTimeList.get(key);\r
- if (value == null){\r
- value = 0L;\r
- twitTimeList.put(key, value);\r
- }\r
- return value;\r
- }\r
- \r
- private void setTwitTime(long id, long value){\r
- String key = KeyValueDao.KEY_TWIT_TIME + id;\r
- twitTimeList.put(key, value);\r
- }\r
-}\r
+++ /dev/null
-package com.yuji.tdb.twitter;\r
-\r
-import java.text.DateFormat;\r
-import java.text.SimpleDateFormat;\r
-import java.util.ArrayList;\r
-import java.util.Calendar;\r
-import java.util.Date;\r
-import java.util.HashMap;\r
-import java.util.List;\r
-import java.util.Map;\r
-import java.util.TimeZone;\r
-import java.util.logging.Logger;\r
-\r
-import twitter4j.Query;\r
-import twitter4j.QueryResult;\r
-import twitter4j.Status;\r
-import twitter4j.Tweet;\r
-import twitter4j.Twitter;\r
-import twitter4j.TwitterException;\r
-import twitter4j.TwitterFactory;\r
-import twitter4j.auth.AccessToken;\r
-import twitter4j.conf.ConfigurationBuilder;\r
-\r
-import com.yuji.tdb.common.CommonUtil;\r
-import com.yuji.tdb.db.KeyValueDao;\r
-import com.yuji.tdb.db.Train;\r
-import com.yuji.tdb.db.TrainDao;\r
-import com.yuji.tdb.debug.Debug;\r
-import com.yuji.tdb.utility.StringUtility;\r
-\r
-public class TwitterUtil {\r
- private static final Logger log = Logger\r
- .getLogger(TwitterUtil.class.getName());\r
- private static TwitterUtil instance = null;\r
- private static Object obj = new Object();\r
- //private DateFormat df = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");\r
- private DateFormat df = new SimpleDateFormat("HH:mm");\r
- private static List<String> keywords = null;\r
- private long searchPeriod = 0;\r
- private long twitPeriod = 0;\r
- private Map<String, Long> twitTimeList = new HashMap<String, Long>();\r
- \r
- public static TwitterUtil getInstance() {\r
- if (instance == null) {\r
- synchronized (obj) {\r
- if (instance == null) {\r
- instance = new TwitterUtil();\r
- }\r
- }\r
- }\r
- return instance;\r
- }\r
-\r
- private TwitterUtil() {\r
- df.setTimeZone(TimeZone.getTimeZone("JST")); \r
- }\r
-\r
- public void main(String consumerKey, String consumerSecret, AccessToken accessToken) {\r
- try {\r
- ConfigurationBuilder confBuilder = new ConfigurationBuilder();\r
- confBuilder.setDebugEnabled(true).setOAuthConsumerKey(consumerKey)\r
- .setOAuthConsumerSecret(consumerSecret);\r
- TwitterFactory factory = new TwitterFactory(confBuilder.build());\r
- Twitter twitter = factory.getInstance(accessToken);\r
-\r
- List<Train> list = getTrainList();\r
- for (Train train : list){\r
- Calendar cal = Calendar.getInstance();\r
- Date date = cal.getTime();\r
- long cur = date.getTime();\r
-\r
- long id = train.getId();\r
- long t = getTwitTime(id);\r
- \r
- \r
- \r
- \r
- twite(twitter, train);\r
- }\r
- } catch (TwitterException e) {\r
- // TODO Auto-generated catch block\r
- e.printStackTrace();\r
- log.severe(e.toString());\r
- }\r
- }\r
-\r
- private void twite(Twitter twitter, Train train) throws TwitterException {\r
- Query query = new Query();\r
- //query.setRpp(1000); // TODO\r
- query.setQuery(train.getSearchWord());\r
- QueryResult result = null;\r
- try {\r
- result = twitter.search(query);\r
- }\r
- catch (TwitterException e){\r
- log.severe("" + Debug.getLineNo());\r
- throw e;\r
- }\r
- List<Tweet> tweets = result.getTweets();\r
- \r
- Calendar cal = Calendar.getInstance();\r
- Date date = cal.getTime();\r
- long cur = date.getTime();\r
-\r
- int count = 0;\r
- int hit = 0;\r
- int mhit = 0;\r
- int period = getSearchPeriod();\r
- \r
- int index;\r
- int mindex = 0;\r
- int size = tweets.size();\r
- for (index = 0; index < size; index++) {\r
- Tweet tweet = tweets.get(index);\r
- \r
- Date at = tweet.getCreatedAt();\r
- long t = at.getTime();\r
- \r
- String message = tweet.getText();\r
- \r
- if (t < cur - period * 60 * 1000){\r
- System.out.println("\81~" + tweet.getFromUser() + " - "\r
- + tweet.getText() + at);\r
- continue;\r
- }\r
- hit = filter(message);\r
- if (hit <= 0) {\r
- System.out.println("\81¢" + tweet.getFromUser() + " - "\r
- + tweet.getText() + at);\r
- // \92x\89\84\88È\8aO\82Ì\8f\91\82«\8d\9e\82Ý\r
- continue;\r
- }\r
- if (hit > mhit){\r
- hit = mhit;\r
- mindex = index;\r
- }\r
-\r
- System.out.println("@" + tweet.getFromUser() + " - "\r
- + tweet.getText() + at);\r
- count++;\r
- }\r
-\r
- String message = "[" + train.getName() + "] ";\r
- if (count < train.getCount()){\r
- message += df.format(date) + " \92x\89\84\82È\82µ"; \r
- }\r
- else {\r
- int N = 100;\r
- \r
- String sample = tweets.get(mindex).getText();\r
- sample = CommonUtil.replaceString(sample, "@", "(a)");\r
- sample = StringUtility.parseSubstring(sample, N);\r
- message += df.format(date) + " " + sample + " count=" + count; \r
- }\r
- System.out.println(message); //TODO\r
- \r
- Status status = null;\r
- try {\r
- status = twitter.updateStatus(message); //TODO\r
- }\r
- catch (TwitterException e){\r
- log.severe(Debug.getLineNo() + " " + message);\r
- throw e;\r
- }\r
- }\r
- \r
- private List<Train> getTrainList(){\r
- TrainDao dao = TrainDao.getInstance();\r
- List<Train> list = dao.search();\r
- if (list.size() <= 0){\r
- Train train;\r
- \r
- train = new Train("\8b\9e\95l\93\8c\96k\90ü", "\8b\9e\95l\93\8c\96k", 5);\r
- dao.put(train);\r
- train = new Train("\93\8c\8aC\93¹\90ü", "\93\8c\8aC\93¹", 5);\r
- dao.put(train);\r
- train = new Train("\8b\9e\95l\8b}\8ds\90ü", "\8b\9e\8b}", 5);\r
- dao.put(train);\r
- list = dao.search();\r
- }\r
- return list;\r
- }\r
- \r
- public int filter(String text) {\r
- if (keywords == null) {\r
- keywords = new ArrayList<String>();\r
- keywords.add("\92x\89\84");\r
- keywords.add("\92x\82ê");\r
- keywords.add("\90U\82è\91Ö\82¦");\r
- keywords.add("\90U\91Ö");\r
- keywords.add("\92â\8e~");\r
- keywords.add("\8e\96\8cÌ");\r
- }\r
-\r
- int count = 0;\r
- for (String keyword : keywords) {\r
- if (text.indexOf(keyword) >= 0) {\r
- count++;\r
- }\r
- }\r
- return count;\r
- }\r
- \r
- public int getSearchPeriod(){\r
- if (searchPeriod <= 0){\r
- KeyValueDao dao = KeyValueDao.getInstance();\r
- searchPeriod = dao.getInt(KeyValueDao.KEY_SEARCH_PERIOD, 5);\r
- }\r
- return searchPeriod;\r
- }\r
- \r
- public int getTwitPeriod(){\r
- if (twitPeriod <= 0){\r
- KeyValueDao dao = KeyValueDao.getInstance();\r
- twitPeriod = dao.getInt(KeyValueDao.KEY_TWIT_PERIOD, 5);\r
- }\r
- return searchPeriod;\r
- }\r
- \r
- private long getTwitTime(long id){\r
- String key = KeyValueDao.KEY_TWIT_TIME + id;\r
- Long value = (long)twitTimeList.get(key);\r
- if (value == null){\r
- value = 0L;\r
- twitTimeList.put(key, value);\r
- }\r
- return value;\r
- }\r
-}\r
+++ /dev/null
-package com.yuji.tdb.twitter;\r
-\r
-import java.text.DateFormat;\r
-import java.text.SimpleDateFormat;\r
-import java.util.ArrayList;\r
-import java.util.Calendar;\r
-import java.util.Date;\r
-import java.util.HashMap;\r
-import java.util.List;\r
-import java.util.Map;\r
-import java.util.TimeZone;\r
-import java.util.logging.Logger;\r
-\r
-import twitter4j.Query;\r
-import twitter4j.QueryResult;\r
-import twitter4j.Status;\r
-import twitter4j.Tweet;\r
-import twitter4j.Twitter;\r
-import twitter4j.TwitterException;\r
-import twitter4j.TwitterFactory;\r
-import twitter4j.auth.AccessToken;\r
-import twitter4j.conf.ConfigurationBuilder;\r
-\r
-import com.yuji.tdb.common.CommonUtil;\r
-import com.yuji.tdb.db.KeyValueDao;\r
-import com.yuji.tdb.db.Train;\r
-import com.yuji.tdb.db.TrainDao;\r
-import com.yuji.tdb.debug.Debug;\r
-import com.yuji.tdb.utility.StringUtility;\r
-\r
-public class TwitterUtil {\r
- private static final Logger log = Logger\r
- .getLogger(TwitterUtil.class.getName());\r
- private static TwitterUtil instance = null;\r
- private static Object obj = new Object();\r
- //private DateFormat df = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");\r
- private DateFormat df = new SimpleDateFormat("HH:mm");\r
- private static List<String> keywords = null;\r
- private long searchPeriod = 0;\r
- private long twitPeriod = 0;\r
- private Map<String, Long> twitTimeList = new HashMap<String, Long>();\r
- \r
- public static TwitterUtil getInstance() {\r
- if (instance == null) {\r
- synchronized (obj) {\r
- if (instance == null) {\r
- instance = new TwitterUtil();\r
- }\r
- }\r
- }\r
- return instance;\r
- }\r
-\r
- private TwitterUtil() {\r
- df.setTimeZone(TimeZone.getTimeZone("JST")); \r
- }\r
-\r
- public void main(String consumerKey, String consumerSecret, AccessToken accessToken) {\r
- try {\r
- ConfigurationBuilder confBuilder = new ConfigurationBuilder();\r
- confBuilder.setDebugEnabled(true).setOAuthConsumerKey(consumerKey)\r
- .setOAuthConsumerSecret(consumerSecret);\r
- TwitterFactory factory = new TwitterFactory(confBuilder.build());\r
- Twitter twitter = factory.getInstance(accessToken);\r
-\r
- List<Train> list = getTrainList();\r
- for (Train train : list){\r
- Calendar cal = Calendar.getInstance();\r
- Date date = cal.getTime();\r
- long cur = date.getTime();\r
-\r
- long id = train.getId();\r
- long t = getTwitTime(id);\r
- long period = getTwitPeriod();\r
- \r
- if (t + period < cur){\r
- continue;\r
- }\r
- twite(twitter, train);\r
- }\r
- } catch (TwitterException e) {\r
- // TODO Auto-generated catch block\r
- e.printStackTrace();\r
- log.severe(e.toString());\r
- }\r
- }\r
-\r
- private void twite(Twitter twitter, Train train) throws TwitterException {\r
- Query query = new Query();\r
- //query.setRpp(1000); // TODO\r
- query.setQuery(train.getSearchWord());\r
- QueryResult result = null;\r
- try {\r
- result = twitter.search(query);\r
- }\r
- catch (TwitterException e){\r
- log.severe("" + Debug.getLineNo());\r
- throw e;\r
- }\r
- List<Tweet> tweets = result.getTweets();\r
- \r
- Calendar cal = Calendar.getInstance();\r
- Date date = cal.getTime();\r
- long cur = date.getTime();\r
-\r
- int count = 0;\r
- int hit = 0;\r
- int mhit = 0;\r
- int period = getSearchPeriod();\r
- \r
- int index;\r
- int mindex = 0;\r
- int size = tweets.size();\r
- for (index = 0; index < size; index++) {\r
- Tweet tweet = tweets.get(index);\r
- \r
- Date at = tweet.getCreatedAt();\r
- long t = at.getTime();\r
- \r
- String message = tweet.getText();\r
- \r
- if (t < cur - period * 60 * 1000){\r
- System.out.println("\81~" + tweet.getFromUser() + " - "\r
- + tweet.getText() + at);\r
- continue;\r
- }\r
- hit = filter(message);\r
- if (hit <= 0) {\r
- System.out.println("\81¢" + tweet.getFromUser() + " - "\r
- + tweet.getText() + at);\r
- // \92x\89\84\88È\8aO\82Ì\8f\91\82«\8d\9e\82Ý\r
- continue;\r
- }\r
- if (hit > mhit){\r
- hit = mhit;\r
- mindex = index;\r
- }\r
-\r
- System.out.println("@" + tweet.getFromUser() + " - "\r
- + tweet.getText() + at);\r
- count++;\r
- }\r
-\r
- String message = "[" + train.getName() + "] ";\r
- if (count < train.getCount()){\r
- message += df.format(date) + " \92x\89\84\82È\82µ"; \r
- }\r
- else {\r
- int N = 100;\r
- \r
- String sample = tweets.get(mindex).getText();\r
- sample = CommonUtil.replaceString(sample, "@", "(a)");\r
- sample = StringUtility.parseSubstring(sample, N);\r
- message += df.format(date) + " " + sample + " count=" + count; \r
- }\r
- System.out.println(message); //TODO\r
- \r
- Status status = null;\r
- try {\r
- status = twitter.updateStatus(message); //TODO\r
- }\r
- catch (TwitterException e){\r
- log.severe(Debug.getLineNo() + " " + message);\r
- throw e;\r
- }\r
- }\r
- \r
- private List<Train> getTrainList(){\r
- TrainDao dao = TrainDao.getInstance();\r
- List<Train> list = dao.search();\r
- if (list.size() <= 0){\r
- Train train;\r
- \r
- train = new Train("\8b\9e\95l\93\8c\96k\90ü", "\8b\9e\95l\93\8c\96k", 5);\r
- dao.put(train);\r
- train = new Train("\93\8c\8aC\93¹\90ü", "\93\8c\8aC\93¹", 5);\r
- dao.put(train);\r
- train = new Train("\8b\9e\95l\8b}\8ds\90ü", "\8b\9e\8b}", 5);\r
- dao.put(train);\r
- list = dao.search();\r
- }\r
- return list;\r
- }\r
- \r
- public int filter(String text) {\r
- if (keywords == null) {\r
- keywords = new ArrayList<String>();\r
- keywords.add("\92x\89\84");\r
- keywords.add("\92x\82ê");\r
- keywords.add("\90U\82è\91Ö\82¦");\r
- keywords.add("\90U\91Ö");\r
- keywords.add("\92â\8e~");\r
- keywords.add("\8e\96\8cÌ");\r
- }\r
-\r
- int count = 0;\r
- for (String keyword : keywords) {\r
- if (text.indexOf(keyword) >= 0) {\r
- count++;\r
- }\r
- }\r
- return count;\r
- }\r
- \r
- public int getSearchPeriod(){\r
- if (searchPeriod <= 0){\r
- KeyValueDao dao = KeyValueDao.getInstance();\r
- searchPeriod = dao.getInt(KeyValueDao.KEY_SEARCH_PERIOD, 5);\r
- }\r
- return searchPeriod;\r
- }\r
- \r
- public int getTwitPeriod(){\r
- if (twitPeriod <= 0){\r
- KeyValueDao dao = KeyValueDao.getInstance();\r
- twitPeriod = dao.getInt(KeyValueDao.KEY_TWIT_PERIOD, 5);\r
- }\r
- return searchPeriod;\r
- }\r
- \r
- private long getTwitTime(long id){\r
- String key = KeyValueDao.KEY_TWIT_TIME + id;\r
- Long value = (long)twitTimeList.get(key);\r
- if (value == null){\r
- value = 0L;\r
- twitTimeList.put(key, value);\r
- }\r
- return value;\r
- }\r
-}\r
+++ /dev/null
-package com.yuji.tdb.twitter;\r
-\r
-import java.text.DateFormat;\r
-import java.text.SimpleDateFormat;\r
-import java.util.ArrayList;\r
-import java.util.Calendar;\r
-import java.util.Date;\r
-import java.util.HashMap;\r
-import java.util.List;\r
-import java.util.Map;\r
-import java.util.TimeZone;\r
-import java.util.logging.Logger;\r
-\r
-import twitter4j.Query;\r
-import twitter4j.QueryResult;\r
-import twitter4j.Status;\r
-import twitter4j.Tweet;\r
-import twitter4j.Twitter;\r
-import twitter4j.TwitterException;\r
-import twitter4j.TwitterFactory;\r
-import twitter4j.auth.AccessToken;\r
-import twitter4j.conf.ConfigurationBuilder;\r
-\r
-import com.yuji.tdb.common.CommonUtil;\r
-import com.yuji.tdb.db.KeyValueDao;\r
-import com.yuji.tdb.db.Train;\r
-import com.yuji.tdb.db.TrainDao;\r
-import com.yuji.tdb.debug.Debug;\r
-import com.yuji.tdb.utility.StringUtility;\r
-\r
-public class TwitterUtil {\r
- private static final Logger log = Logger\r
- .getLogger(TwitterUtil.class.getName());\r
- private static TwitterUtil instance = null;\r
- private static Object obj = new Object();\r
- //private DateFormat df = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");\r
- private DateFormat df = new SimpleDateFormat("HH:mm");\r
- private static List<String> keywords = null;\r
- private long searchPeriod = 0;\r
- private long twitPeriod = 0;\r
- private Map<String, Long> twitTimeList = new HashMap<String, Long>();\r
- \r
- public static TwitterUtil getInstance() {\r
- if (instance == null) {\r
- synchronized (obj) {\r
- if (instance == null) {\r
- instance = new TwitterUtil();\r
- }\r
- }\r
- }\r
- return instance;\r
- }\r
-\r
- private TwitterUtil() {\r
- df.setTimeZone(TimeZone.getTimeZone("JST")); \r
- }\r
-\r
- public void main(String consumerKey, String consumerSecret, AccessToken accessToken) {\r
- try {\r
- ConfigurationBuilder confBuilder = new ConfigurationBuilder();\r
- confBuilder.setDebugEnabled(true).setOAuthConsumerKey(consumerKey)\r
- .setOAuthConsumerSecret(consumerSecret);\r
- TwitterFactory factory = new TwitterFactory(confBuilder.build());\r
- Twitter twitter = factory.getInstance(accessToken);\r
-\r
- List<Train> list = getTrainList();\r
- for (Train train : list){\r
- Calendar cal = Calendar.getInstance();\r
- Date date = cal.getTime();\r
- long cur = date.getTime();\r
-\r
- long id = train.getId();\r
- long t = getTwitTime(id);\r
- long period = getTwitPeriod();\r
-\r
- if (t > 0 && t + period * 60 * 1000 < cur){\r
- continue;\r
- }\r
- twite(twitter, train);\r
- }\r
- } catch (TwitterException e) {\r
- // TODO Auto-generated catch block\r
- e.printStackTrace();\r
- log.severe(e.toString());\r
- }\r
- }\r
-\r
- private void twite(Twitter twitter, Train train) throws TwitterException {\r
- Query query = new Query();\r
- //query.setRpp(1000); // TODO\r
- query.setQuery(train.getSearchWord());\r
- QueryResult result = null;\r
- try {\r
- result = twitter.search(query);\r
- }\r
- catch (TwitterException e){\r
- log.severe("" + Debug.getLineNo());\r
- throw e;\r
- }\r
- List<Tweet> tweets = result.getTweets();\r
- \r
- Calendar cal = Calendar.getInstance();\r
- Date date = cal.getTime();\r
- long cur = date.getTime();\r
-\r
- int count = 0;\r
- int hit = 0;\r
- int mhit = 0;\r
- long period = getSearchPeriod();\r
- long id = train.getId();\r
- \r
- int index;\r
- int mindex = 0;\r
- int size = tweets.size();\r
- for (index = 0; index < size; index++) {\r
- Tweet tweet = tweets.get(index);\r
- \r
- Date at = tweet.getCreatedAt();\r
- long t = at.getTime();\r
- \r
- String message = tweet.getText();\r
- \r
- if (t < cur - period * 60 * 1000){\r
- System.out.println("\81~" + tweet.getFromUser() + " - "\r
- + tweet.getText() + at);\r
- continue;\r
- }\r
- hit = filter(message);\r
- if (hit <= 0) {\r
- System.out.println("\81¢" + tweet.getFromUser() + " - "\r
- + tweet.getText() + at);\r
- // \92x\89\84\88È\8aO\82Ì\8f\91\82«\8d\9e\82Ý\r
- continue;\r
- }\r
- if (hit > mhit){\r
- hit = mhit;\r
- mindex = index;\r
- }\r
-\r
- System.out.println("@" + tweet.getFromUser() + " - "\r
- + tweet.getText() + at);\r
- count++;\r
- }\r
-\r
- String message = "[" + train.getName() + "] ";\r
- if (count < train.getCount()){\r
- message += df.format(date) + " \92x\89\84\82È\82µ"; \r
- }\r
- else {\r
- int N = 100;\r
- \r
- String sample = tweets.get(mindex).getText();\r
- sample = CommonUtil.replaceString(sample, "@", "(a)");\r
- sample = StringUtility.parseSubstring(sample, N);\r
- message += df.format(date) + " " + sample + " count=" + count; \r
- }\r
- System.out.println(message); //TODO\r
- \r
-// Status status = null;\r
-// try {\r
-// status = twitter.updateStatus(message); //TODO\r
-// setTwitTime(id, cur);\r
-// }\r
-// catch (TwitterException e){\r
-// log.severe(Debug.getLineNo() + " " + message);\r
-// log.severe(Debug.getLineNo() + " " + status);\r
-// throw e;\r
-// }\r
- setTwitTime(id, cur); // TODO\r
- }\r
- \r
- private List<Train> getTrainList(){\r
- TrainDao dao = TrainDao.getInstance();\r
- List<Train> list = dao.search();\r
- if (list.size() <= 0){\r
- Train train;\r
- \r
- train = new Train("\8b\9e\95l\93\8c\96k\90ü", "\8b\9e\95l\93\8c\96k", 5);\r
- dao.put(train);\r
- train = new Train("\93\8c\8aC\93¹\90ü", "\93\8c\8aC\93¹", 5);\r
- dao.put(train);\r
- train = new Train("\8b\9e\95l\8b}\8ds\90ü", "\8b\9e\8b}", 5);\r
- dao.put(train);\r
- list = dao.search();\r
- }\r
- return list;\r
- }\r
- \r
- public int filter(String text) {\r
- if (keywords == null) {\r
- keywords = new ArrayList<String>();\r
- keywords.add("\92x\89\84");\r
- keywords.add("\92x\82ê");\r
- keywords.add("\90U\82è\91Ö\82¦");\r
- keywords.add("\90U\91Ö");\r
- keywords.add("\92â\8e~");\r
- keywords.add("\8e\96\8cÌ");\r
- }\r
-\r
- int count = 0;\r
- for (String keyword : keywords) {\r
- if (text.indexOf(keyword) >= 0) {\r
- count++;\r
- }\r
- }\r
- return count;\r
- }\r
- \r
- public long getSearchPeriod(){\r
- if (searchPeriod <= 0){\r
- KeyValueDao dao = KeyValueDao.getInstance();\r
- searchPeriod = dao.getInt(KeyValueDao.KEY_SEARCH_PERIOD, 5);\r
- }\r
- return searchPeriod;\r
- }\r
- \r
- public long getTwitPeriod(){\r
- if (twitPeriod <= 0){\r
- KeyValueDao dao = KeyValueDao.getInstance();\r
- twitPeriod = dao.getInt(KeyValueDao.KEY_TWIT_PERIOD, 5);\r
- }\r
- return twitPeriod;\r
- }\r
- \r
- private long getTwitTime(long id){\r
- String key = KeyValueDao.KEY_TWIT_TIME + id;\r
- Long value = twitTimeList.get(key);\r
- if (value == null){\r
- value = 0L;\r
- setTwitTime(id, value);\r
- }\r
- return value;\r
- }\r
- \r
- private void setTwitTime(long id, long value){\r
- String key = KeyValueDao.KEY_TWIT_TIME + id;\r
- twitTimeList.put(key, value);\r
- KeyValueDao dao = KeyValueDao.getInstance();\r
- dao.put(key, value);\r
- }\r
-}\r
+++ /dev/null
-package com.yuji.tdb.db;\r
-\r
-import javax.jdo.PersistenceManager;\r
-\r
-public class KeyValueDao {\r
- public static final String KEY_CONSUMER_KEY = "CONSUMER_KEY";\r
- public static final String KEY_CONSUMER_SECRET = "CONSUMER_SECRET";\r
- public static final String KEY_REQUEST_TOKEN = "REQUEST_TOKEN";\r
- public static final String KEY_REQUEST_TOKEN_SECRET = "REQUEST_TOKEN_SECRET";\r
- public static final String KEY_ACCESS_TOKEN = "ACCESS_TOKEN";\r
- public static final String KEY_ACCESS_TOKEN_SECRET = "ACCESS_TOKEN_SECRET";\r
-\r
- public static final String KEY_SEARCH_PERIOD = "SEARCH_PERIOD";\r
- public static final String KEY_TWIT_PERIOD = "TWIT_PERIOD";\r
- public static final String KEY_TWIT_TIME = "TWIT_TIME_";\r
-\r
- private static KeyValueDao instance = null;\r
- private PersistenceManager pm = PMFactory.get().getPersistenceManager();\r
- \r
- public static KeyValueDao getInstance(){\r
- if (instance == null){\r
- instance = new KeyValueDao();\r
- }\r
- return instance;\r
- }\r
- \r
- private KeyValueDao(){\r
- \r
- }\r
- \r
- public String get(String key){\r
- KeyValue keyValue = pm.getObjectById(KeyValue.class, key);\r
- if (keyValue == null){\r
- return null;\r
- }\r
- return keyValue.getValue();\r
- }\r
- \r
- public int getInt(String key){\r
- String value = get(key);\r
- return Integer.valueOf(value).intValue();\r
- }\r
- \r
- public void put(String key, String value){\r
- KeyValue keyValue = new KeyValue(key, value);\r
- pm.makePersistent(keyValue);\r
- }\r
-\r
- public void put(String key, int value){\r
- put(key, String.valueOf(value));\r
- }\r
-\r
- public String get(String key, String initValue){\r
- String value = get(key);\r
- if (value == null){\r
- put(key, initValue);\r
- value = initValue;\r
- }\r
- return value;\r
- }\r
-\r
- public int getInt(String key, int initValue){\r
- String value = get(key);\r
- if (value == null){\r
- put(key, initValue);\r
- }\r
- return Integer.valueOf(value).intValue();\r
- }\r
-}\r
+++ /dev/null
-package com.yuji.tdb.twitter;\r
-\r
-import java.text.DateFormat;\r
-import java.text.SimpleDateFormat;\r
-import java.util.ArrayList;\r
-import java.util.Calendar;\r
-import java.util.Date;\r
-import java.util.List;\r
-import java.util.TimeZone;\r
-import java.util.logging.Logger;\r
-\r
-import twitter4j.Query;\r
-import twitter4j.QueryResult;\r
-import twitter4j.Status;\r
-import twitter4j.Tweet;\r
-import twitter4j.Twitter;\r
-import twitter4j.TwitterException;\r
-import twitter4j.TwitterFactory;\r
-import twitter4j.auth.AccessToken;\r
-import twitter4j.conf.ConfigurationBuilder;\r
-\r
-import com.yuji.tdb.common.CommonUtil;\r
-import com.yuji.tdb.db.KeyValueDao;\r
-import com.yuji.tdb.db.Train;\r
-import com.yuji.tdb.db.TrainDao;\r
-import com.yuji.tdb.debug.Debug;\r
-import com.yuji.tdb.utility.StringUtility;\r
-\r
-public class TwitterUtil {\r
- private static final Logger log = Logger\r
- .getLogger(TwitterUtil.class.getName());\r
- private static TwitterUtil instance = null;\r
- private static Object obj = new Object();\r
- //private DateFormat df = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");\r
- private DateFormat df = new SimpleDateFormat("HH:mm");\r
- private int period = 0;\r
- \r
- public static TwitterUtil getInstance() {\r
- if (instance == null) {\r
- synchronized (obj) {\r
- if (instance == null) {\r
- instance = new TwitterUtil();\r
- }\r
- }\r
- }\r
- return instance;\r
- }\r
-\r
- private TwitterUtil() {\r
- df.setTimeZone(TimeZone.getTimeZone("JST")); \r
- }\r
-\r
- public void main(String consumerKey, String consumerSecret, AccessToken accessToken) {\r
- try {\r
- ConfigurationBuilder confBuilder = new ConfigurationBuilder();\r
- confBuilder.setDebugEnabled(true).setOAuthConsumerKey(consumerKey)\r
- .setOAuthConsumerSecret(consumerSecret);\r
- TwitterFactory factory = new TwitterFactory(confBuilder.build());\r
- Twitter twitter = factory.getInstance(accessToken);\r
-\r
- List<Train> list = getTrainList();\r
- for (Train train : list){\r
- twite(twitter, train);\r
- }\r
- } catch (TwitterException e) {\r
- // TODO Auto-generated catch block\r
- e.printStackTrace();\r
- log.severe(e.toString());\r
- }\r
- }\r
-\r
- private void twite(Twitter twitter, Train train) throws TwitterException {\r
- Query query = new Query();\r
- //query.setRpp(1000); // TODO\r
- query.setQuery(train.getSearchWord());\r
- QueryResult result = null;\r
- try {\r
- result = twitter.search(query);\r
- }\r
- catch (TwitterException e){\r
- log.severe("" + Debug.getLineNo());\r
- throw e;\r
- }\r
- List<Tweet> tweets = result.getTweets();\r
- \r
- Calendar cal = Calendar.getInstance();\r
- Date date = cal.getTime();\r
- long cur = date.getTime();\r
-\r
- int count = 0;\r
- int hit = 0;\r
- int mhit = 0;\r
- int period = getPeriod;\r
- \r
- int index;\r
- int mindex = 0;\r
- int size = tweets.size();\r
- for (index = 0; index < size; index++) {\r
- Tweet tweet = tweets.get(index);\r
- \r
- Date at = tweet.getCreatedAt();\r
- long t = at.getTime();\r
- \r
- String message = tweet.getText();\r
- \r
- if (t < cur - 5 * 60 * 1000){\r
- System.out.println("\81~" + tweet.getFromUser() + " - "\r
- + tweet.getText() + at);\r
- continue;\r
- }\r
- hit = filter(message);\r
- if (hit <= 0) {\r
- System.out.println("\81¢" + tweet.getFromUser() + " - "\r
- + tweet.getText() + at);\r
- // \92x\89\84\88È\8aO\82Ì\8f\91\82«\8d\9e\82Ý\r
- continue;\r
- }\r
- if (hit > mhit){\r
- hit = mhit;\r
- mindex = index;\r
- }\r
-\r
- System.out.println("@" + tweet.getFromUser() + " - "\r
- + tweet.getText() + at);\r
- count++;\r
- }\r
-\r
- String message = "[" + train.getName() + "] ";\r
- if (count < train.getCount()){\r
- message += df.format(date) + " \92x\89\84\82È\82µ"; \r
- }\r
- else {\r
- int N = 100;\r
- \r
- String sample = tweets.get(mindex).getText();\r
- sample = CommonUtil.replaceString(sample, "@", "(a)");\r
- sample = StringUtility.parseSubstring(sample, N);\r
- message += df.format(date) + " " + sample + " count=" + count; \r
- }\r
- System.out.println(message); //TODO\r
- \r
- Status status = null;\r
- try {\r
- status = twitter.updateStatus(message); //TODO\r
- }\r
- catch (TwitterException e){\r
- log.severe(Debug.getLineNo() + " " + message);\r
- throw e;\r
- }\r
- }\r
- \r
- private List<Train> getTrainList(){\r
- TrainDao dao = TrainDao.getInstance();\r
- List<Train> list = dao.search();\r
- if (list.size() <= 0){\r
- Train train;\r
- \r
- train = new Train("\8b\9e\95l\93\8c\96k\90ü", "\8b\9e\95l\93\8c\96k", 5);\r
- dao.put(train);\r
- train = new Train("\93\8c\8aC\93¹\90ü", "\93\8c\8aC\93¹", 5);\r
- dao.put(train);\r
- train = new Train("\8b\9e\95l\8b}\8ds\90ü", "\8b\9e\8b}", 5);\r
- dao.put(train);\r
- list = dao.search();\r
- }\r
- return list;\r
- }\r
- \r
- private static List<String> keywords = null;\r
-\r
- public int filter(String text) {\r
- if (keywords == null) {\r
- keywords = new ArrayList<String>();\r
- keywords.add("\92x\89\84");\r
- keywords.add("\92x\82ê");\r
- keywords.add("\90U\82è\91Ö\82¦");\r
- keywords.add("\90U\91Ö");\r
- keywords.add("\92â\8e~");\r
- keywords.add("\8e\96\8cÌ");\r
- }\r
-\r
- int count = 0;\r
- for (String keyword : keywords) {\r
- if (text.indexOf(keyword) >= 0) {\r
- count++;\r
- }\r
- }\r
- return count;\r
- }\r
- \r
- public int getPeriod(){\r
- if (period <= 0){\r
- KeyValueDao dao = KeyValueDao.getInstance();\r
- period = dao.getInt(KeyValueDao.KEY_SEARCH_PERIOD);\r
- if (period <= 0){\r
- period = 5;\r
- dao.put(KeyValueDao.KEY_SEARCH_PERIOD, period);\r
- }\r
- }\r
- return period;\r
- }\r
-}\r
+++ /dev/null
-package com.yuji.tdb;\r
-\r
-import java.io.IOException;\r
-import java.util.logging.Logger;\r
-\r
-import javax.servlet.http.HttpServlet;\r
-import javax.servlet.http.HttpServletRequest;\r
-import javax.servlet.http.HttpServletResponse;\r
-\r
-import twitter4j.Twitter;\r
-import twitter4j.TwitterException;\r
-import twitter4j.TwitterFactory;\r
-import twitter4j.auth.AccessToken;\r
-import twitter4j.auth.OAuthAuthorization;\r
-import twitter4j.auth.RequestToken;\r
-import twitter4j.conf.Configuration;\r
-import twitter4j.conf.ConfigurationBuilder;\r
-\r
-import com.yuji.tdb.common.CommonUtil;\r
-import com.yuji.tdb.db.KeyValueDao;\r
-import com.yuji.tdb.twitter.TwitterUtil;\r
-\r
-@SuppressWarnings("serial")\r
-public class TrainDelayBotServlet extends HttpServlet {\r
- private static final Logger log = Logger\r
- .getLogger(TrainDelayBotServlet.class.getName());\r
- // private static RequestToken requestToken = null;\r
- // private static AccessToken accessToken = null;\r
- // private static String consumerKey = null;\r
- // private static String consumerSecret = null;\r
-\r
- private KeyValueDao dao = KeyValueDao.getInstance();\r
-\r
- public void doGet(HttpServletRequest req, HttpServletResponse resp)\r
- throws IOException {\r
- try {\r
- log.info("start");\r
-\r
- resp.setContentType("text/plain");\r
- resp.getWriter().println("<h3>traindelaybot Hello, world</h3>");\r
-\r
- String parmConsumerKey = req.getParameter("key");\r
- String parmConsumerSecret = req.getParameter("secret");\r
- String parmResult = req.getParameter("result");\r
- if (!CommonUtil.isNull(parmConsumerKey)\r
- && !CommonUtil.isNull(parmConsumerSecret)) {\r
- setOAuthAuthorization(req, resp, parmConsumerKey,\r
- parmConsumerSecret);\r
- return;\r
- }\r
-\r
- String consumerKey = dao.get(KeyValueDao.KEY_CONSUMER_KEY);\r
- String consumerSecret = dao.get(KeyValueDao.KEY_CONSUMER_SECRET);\r
- if (CommonUtil.isNull(consumerKey)\r
- || CommonUtil.isNull(consumerSecret)) {\r
- log.warning("" + Debug.getLineNo());\r
- return;\r
- }\r
-\r
- if (!CommonUtil.isNull(parmResult)) {\r
- String requestTokenKey = dao.get(KeyValueDao.KEY_REQUEST_TOKEN);\r
- String requestTokenSecret = dao\r
- .get(KeyValueDao.KEY_REQUEST_TOKEN_SECRET);\r
-\r
- if (CommonUtil.isNull(requestTokenKey)\r
- || CommonUtil.isNull(requestTokenSecret)) {\r
- log.warning("" + Debug.getLineNo());\r
- return;\r
- }\r
- RequestToken requestToken = new RequestToken(requestTokenKey,\r
- requestTokenSecret);\r
- resultOAuthAuthorization(consumerKey, consumerSecret,\r
- requestToken);\r
- return;\r
- }\r
-\r
- String accessTokenKey = dao.get(KeyValueDao.KEY_ACCESS_TOKEN);\r
- String accessTokenSecret = dao\r
- .get(KeyValueDao.KEY_ACCESS_TOKEN_SECRET);\r
- if (CommonUtil.isNull(accessTokenKey)\r
- || CommonUtil.isNull(accessTokenSecret)) {\r
- log.warning("" + Debug.getLineNo());\r
- return;\r
- }\r
-\r
- AccessToken accessToken = new AccessToken(accessTokenKey,\r
- accessTokenSecret);\r
- TwitterUtil util = TwitterUtil.getInstance();\r
- util.main(consumerKey, consumerSecret, accessToken);\r
- } finally {\r
- log.info("end");\r
- }\r
-\r
- }\r
-\r
- private void setOAuthAuthorization(HttpServletRequest req,\r
- HttpServletResponse resp, String parmConsumerKey,\r
- String parmConsumerSecret) {\r
- try {\r
- ConfigurationBuilder confBuilder = new ConfigurationBuilder();\r
-\r
- confBuilder.setDebugEnabled(true);\r
- confBuilder.setOAuthConsumerKey(parmConsumerKey);\r
- confBuilder.setOAuthConsumerSecret(parmConsumerSecret);\r
- Configuration conf = confBuilder.build();\r
-\r
- String url = req.getRequestURL().toString();\r
-\r
- OAuthAuthorization oauth = new OAuthAuthorization(conf);\r
- // Twitter\82Ì\94F\8fØ\89æ\96Ê\82©\82ç\82Ì\96ß\82è\90æ\82ð\8ew\92è\82µ\82Ü\82·\81B\r
- // AccessToken\83R\83\93\83g\83\8d\81[\83\89\82ð\8ew\92è\82µ\82Ü\82·\81B\r
- String callbackURL = url + "?result=yes";\r
- // RequestToken requestToken =\r
- // oauth.getOAuthRequestToken(callbackURL);\r
- RequestToken requestToken = oauth.getOAuthRequestToken(callbackURL);\r
- // RequestToken\82ð\83Z\83b\83V\83\87\83\93\82É\95Û\91¶\82µ\82Ä\82¨\82«\82Ü\82·\81B\r
- // sessionScope("RequestToken", requestToken);\r
- // Twitter\82Ì\94F\8fØ\89æ\96Ê\82Ö\83\8a\83_\83C\83\8c\83N\83g\82µ\82Ü\82·\81B\r
-\r
- // consumerKey = parmConsumerKey;\r
- // consumerSecret = parmConsumerSecret;\r
- dao.put(KeyValueDao.KEY_CONSUMER_KEY, parmConsumerKey);\r
- dao.put(KeyValueDao.KEY_CONSUMER_SECRET, parmConsumerSecret);\r
- dao.put(KeyValueDao.KEY_REQUEST_TOKEN, requestToken.getToken());\r
- dao.put(KeyValueDao.KEY_REQUEST_TOKEN_SECRET,\r
- requestToken.getTokenSecret());\r
-\r
- resp.sendRedirect(requestToken.getAuthenticationURL());\r
- } catch (TwitterException e) {\r
- // TODO Auto-generated catch block\r
- e.printStackTrace();\r
- log.severe(e.toString());\r
- } catch (IOException e) {\r
- // TODO Auto-generated catch block\r
- e.printStackTrace();\r
- log.severe(e.toString());\r
- }\r
- }\r
-\r
- private void resultOAuthAuthorization(String consumerKey,\r
- String consumerSecret, RequestToken requestToken) {\r
- try {\r
- // Twitter twitter = new TwitterFactory().getInstance();\r
- // String tokenKey = requestToken.getToken();\r
- // String tokenSecret = requestToken.getTokenSecret();\r
-\r
- ConfigurationBuilder confBuilder = new ConfigurationBuilder();\r
- confBuilder.setDebugEnabled(true).setOAuthConsumerKey(consumerKey)\r
- .setOAuthConsumerSecret(consumerSecret);\r
- TwitterFactory factory = new TwitterFactory(confBuilder.build());\r
- Twitter twitter = factory.getInstance();\r
-\r
- AccessToken accessToken = twitter.getOAuthAccessToken(requestToken);\r
- dao.put(KeyValueDao.KEY_ACCESS_TOKEN, accessToken.getToken());\r
- dao.put(KeyValueDao.KEY_ACCESS_TOKEN_SECRET,\r
- accessToken.getTokenSecret());\r
- } catch (TwitterException e) {\r
- // TODO Auto-generated catch block\r
- e.printStackTrace();\r
- log.severe(e.toString());\r
- }\r
- }\r
-}\r
+++ /dev/null
-package com.yuji.tdb.twitter;\r
-\r
-import java.text.DateFormat;\r
-import java.text.SimpleDateFormat;\r
-import java.util.ArrayList;\r
-import java.util.Calendar;\r
-import java.util.Date;\r
-import java.util.HashMap;\r
-import java.util.List;\r
-import java.util.Map;\r
-import java.util.TimeZone;\r
-import java.util.logging.Logger;\r
-\r
-import twitter4j.Query;\r
-import twitter4j.QueryResult;\r
-import twitter4j.Status;\r
-import twitter4j.Tweet;\r
-import twitter4j.Twitter;\r
-import twitter4j.TwitterException;\r
-import twitter4j.TwitterFactory;\r
-import twitter4j.auth.AccessToken;\r
-import twitter4j.conf.ConfigurationBuilder;\r
-\r
-import com.yuji.tdb.common.CommonUtil;\r
-import com.yuji.tdb.db.KeyValueDao;\r
-import com.yuji.tdb.db.Train;\r
-import com.yuji.tdb.db.TrainDao;\r
-import com.yuji.tdb.debug.Debug;\r
-import com.yuji.tdb.utility.StringUtility;\r
-\r
-public class TwitterUtil {\r
- private static final Logger log = Logger\r
- .getLogger(TwitterUtil.class.getName());\r
- private static TwitterUtil instance = null;\r
- private static Object obj = new Object();\r
- //private DateFormat df = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");\r
- private DateFormat df = new SimpleDateFormat("HH:mm");\r
- private static List<String> keywords = null;\r
- private long searchPeriod = 0;\r
- private long twitPeriod = 0;\r
- private Map<String, Long> twitTimeList = new HashMap<String, Long>();\r
- \r
- public static TwitterUtil getInstance() {\r
- if (instance == null) {\r
- synchronized (obj) {\r
- if (instance == null) {\r
- instance = new TwitterUtil();\r
- }\r
- }\r
- }\r
- return instance;\r
- }\r
-\r
- private TwitterUtil() {\r
- df.setTimeZone(TimeZone.getTimeZone("JST")); \r
- }\r
-\r
- public void main(String consumerKey, String consumerSecret, AccessToken accessToken) {\r
- try {\r
- ConfigurationBuilder confBuilder = new ConfigurationBuilder();\r
- confBuilder.setDebugEnabled(true).setOAuthConsumerKey(consumerKey)\r
- .setOAuthConsumerSecret(consumerSecret);\r
- TwitterFactory factory = new TwitterFactory(confBuilder.build());\r
- Twitter twitter = factory.getInstance(accessToken);\r
-\r
- List<Train> list = getTrainList();\r
- for (Train train : list){\r
- Calendar cal = Calendar.getInstance();\r
- Date date = cal.getTime();\r
- long cur = date.getTime();\r
-\r
- long id = train.getId();\r
- long t = getTwitTime(id);\r
- long period = getTwitPeriod();\r
- \r
- if (t + period < cur){\r
- continue;\r
- }\r
- twite(twitter, train);\r
- }\r
- } catch (TwitterException e) {\r
- // TODO Auto-generated catch block\r
- e.printStackTrace();\r
- log.severe(e.toString());\r
- }\r
- }\r
-\r
- private void twite(Twitter twitter, Train train) throws TwitterException {\r
- Query query = new Query();\r
- //query.setRpp(1000); // TODO\r
- query.setQuery(train.getSearchWord());\r
- QueryResult result = null;\r
- try {\r
- result = twitter.search(query);\r
- }\r
- catch (TwitterException e){\r
- log.severe("" + Debug.getLineNo());\r
- throw e;\r
- }\r
- List<Tweet> tweets = result.getTweets();\r
- \r
- Calendar cal = Calendar.getInstance();\r
- Date date = cal.getTime();\r
- long cur = date.getTime();\r
-\r
- int count = 0;\r
- int hit = 0;\r
- int mhit = 0;\r
- long period = getSearchPeriod();\r
- long id = train.getId();\r
- \r
- int index;\r
- int mindex = 0;\r
- int size = tweets.size();\r
- for (index = 0; index < size; index++) {\r
- Tweet tweet = tweets.get(index);\r
- \r
- Date at = tweet.getCreatedAt();\r
- long t = at.getTime();\r
- \r
- String message = tweet.getText();\r
- \r
- if (t < cur - period * 60 * 1000){\r
- System.out.println("\81~" + tweet.getFromUser() + " - "\r
- + tweet.getText() + at);\r
- continue;\r
- }\r
- hit = filter(message);\r
- if (hit <= 0) {\r
- System.out.println("\81¢" + tweet.getFromUser() + " - "\r
- + tweet.getText() + at);\r
- // \92x\89\84\88È\8aO\82Ì\8f\91\82«\8d\9e\82Ý\r
- continue;\r
- }\r
- if (hit > mhit){\r
- hit = mhit;\r
- mindex = index;\r
- }\r
-\r
- System.out.println("@" + tweet.getFromUser() + " - "\r
- + tweet.getText() + at);\r
- count++;\r
- }\r
-\r
- String message = "[" + train.getName() + "] ";\r
- if (count < train.getCount()){\r
- message += df.format(date) + " \92x\89\84\82È\82µ"; \r
- }\r
- else {\r
- int N = 100;\r
- \r
- String sample = tweets.get(mindex).getText();\r
- sample = CommonUtil.replaceString(sample, "@", "(a)");\r
- sample = StringUtility.parseSubstring(sample, N);\r
- message += df.format(date) + " " + sample + " count=" + count; \r
- }\r
- System.out.println(message); //TODO\r
- \r
- Status status = null;\r
- try {\r
- status = twitter.updateStatus(message); //TODO\r
- setTwitTime(id, cur);\r
- }\r
- catch (TwitterException e){\r
- log.severe(Debug.getLineNo() + " " + message);\r
- log.severe(Debug.getLineNo() + " " + status);\r
- throw e;\r
- }\r
- }\r
- \r
- private List<Train> getTrainList(){\r
- TrainDao dao = TrainDao.getInstance();\r
- List<Train> list = dao.search();\r
- if (list.size() <= 0){\r
- Train train;\r
- \r
- train = new Train("\8b\9e\95l\93\8c\96k\90ü", "\8b\9e\95l\93\8c\96k", 5);\r
- dao.put(train);\r
- train = new Train("\93\8c\8aC\93¹\90ü", "\93\8c\8aC\93¹", 5);\r
- dao.put(train);\r
- train = new Train("\8b\9e\95l\8b}\8ds\90ü", "\8b\9e\8b}", 5);\r
- dao.put(train);\r
- list = dao.search();\r
- }\r
- return list;\r
- }\r
- \r
- public int filter(String text) {\r
- if (keywords == null) {\r
- keywords = new ArrayList<String>();\r
- keywords.add("\92x\89\84");\r
- keywords.add("\92x\82ê");\r
- keywords.add("\90U\82è\91Ö\82¦");\r
- keywords.add("\90U\91Ö");\r
- keywords.add("\92â\8e~");\r
- keywords.add("\8e\96\8cÌ");\r
- }\r
-\r
- int count = 0;\r
- for (String keyword : keywords) {\r
- if (text.indexOf(keyword) >= 0) {\r
- count++;\r
- }\r
- }\r
- return count;\r
- }\r
- \r
- public long getSearchPeriod(){\r
- if (searchPeriod <= 0){\r
- KeyValueDao dao = KeyValueDao.getInstance();\r
- searchPeriod = dao.getInt(KeyValueDao.KEY_SEARCH_PERIOD, 5);\r
- }\r
- return searchPeriod;\r
- }\r
- \r
- public long getTwitPeriod(){\r
- if (twitPeriod <= 0){\r
- KeyValueDao dao = KeyValueDao.getInstance();\r
- twitPeriod = dao.getInt(KeyValueDao.KEY_TWIT_PERIOD, 5);\r
- }\r
- return twitPeriod;\r
- }\r
- \r
- private long getTwitTime(long id){\r
- String key = KeyValueDao.KEY_TWIT_TIME + id;\r
- Long value = twitTimeList.get(key);\r
- if (value == null){\r
- value = 0L;\r
- twitTimeList.put(key, value);\r
- }\r
- return value;\r
- }\r
- \r
- private void setTwitTime(long id, long value){\r
- String key = KeyValueDao.KEY_TWIT_TIME + id;\r
- twitTimeList.put(key, value);\r
- }\r
-}\r
+++ /dev/null
-package com.yuji.tdb.twitter;\r
-\r
-import java.text.DateFormat;\r
-import java.text.SimpleDateFormat;\r
-import java.util.ArrayList;\r
-import java.util.Calendar;\r
-import java.util.Date;\r
-import java.util.HashMap;\r
-import java.util.List;\r
-import java.util.Map;\r
-import java.util.TimeZone;\r
-import java.util.logging.Logger;\r
-\r
-import twitter4j.Query;\r
-import twitter4j.QueryResult;\r
-import twitter4j.Status;\r
-import twitter4j.Tweet;\r
-import twitter4j.Twitter;\r
-import twitter4j.TwitterException;\r
-import twitter4j.TwitterFactory;\r
-import twitter4j.auth.AccessToken;\r
-import twitter4j.conf.ConfigurationBuilder;\r
-\r
-import com.yuji.tdb.common.CommonUtil;\r
-import com.yuji.tdb.db.KeyValueDao;\r
-import com.yuji.tdb.db.Train;\r
-import com.yuji.tdb.db.TrainDao;\r
-import com.yuji.tdb.debug.Debug;\r
-import com.yuji.tdb.utility.StringUtility;\r
-\r
-public class TwitterUtil {\r
- private static final Logger log = Logger\r
- .getLogger(TwitterUtil.class.getName());\r
- private static TwitterUtil instance = null;\r
- private static Object obj = new Object();\r
- //private DateFormat df = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");\r
- private DateFormat df = new SimpleDateFormat("HH:mm");\r
- private static List<String> keywords = null;\r
- private int period = 0;\r
- private Map<String, Long> twitTimeList = new HashMap<String, Long>();\r
- \r
- public static TwitterUtil getInstance() {\r
- if (instance == null) {\r
- synchronized (obj) {\r
- if (instance == null) {\r
- instance = new TwitterUtil();\r
- }\r
- }\r
- }\r
- return instance;\r
- }\r
-\r
- private TwitterUtil() {\r
- df.setTimeZone(TimeZone.getTimeZone("JST")); \r
- }\r
-\r
- public void main(String consumerKey, String consumerSecret, AccessToken accessToken) {\r
- try {\r
- ConfigurationBuilder confBuilder = new ConfigurationBuilder();\r
- confBuilder.setDebugEnabled(true).setOAuthConsumerKey(consumerKey)\r
- .setOAuthConsumerSecret(consumerSecret);\r
- TwitterFactory factory = new TwitterFactory(confBuilder.build());\r
- Twitter twitter = factory.getInstance(accessToken);\r
-\r
- List<Train> list = getTrainList();\r
- for (Train train : list){\r
- twite(twitter, train);\r
- }\r
- } catch (TwitterException e) {\r
- // TODO Auto-generated catch block\r
- e.printStackTrace();\r
- log.severe(e.toString());\r
- }\r
- }\r
-\r
- private void twite(Twitter twitter, Train train) throws TwitterException {\r
- Query query = new Query();\r
- //query.setRpp(1000); // TODO\r
- query.setQuery(train.getSearchWord());\r
- QueryResult result = null;\r
- try {\r
- result = twitter.search(query);\r
- }\r
- catch (TwitterException e){\r
- log.severe("" + Debug.getLineNo());\r
- throw e;\r
- }\r
- List<Tweet> tweets = result.getTweets();\r
- \r
- Calendar cal = Calendar.getInstance();\r
- Date date = cal.getTime();\r
- long cur = date.getTime();\r
-\r
- int count = 0;\r
- int hit = 0;\r
- int mhit = 0;\r
- int period = getPeriod();\r
- \r
- int index;\r
- int mindex = 0;\r
- int size = tweets.size();\r
- for (index = 0; index < size; index++) {\r
- Tweet tweet = tweets.get(index);\r
- \r
- Date at = tweet.getCreatedAt();\r
- long t = at.getTime();\r
- \r
- String message = tweet.getText();\r
- \r
- if (t < cur - period * 60 * 1000){\r
- System.out.println("\81~" + tweet.getFromUser() + " - "\r
- + tweet.getText() + at);\r
- continue;\r
- }\r
- hit = filter(message);\r
- if (hit <= 0) {\r
- System.out.println("\81¢" + tweet.getFromUser() + " - "\r
- + tweet.getText() + at);\r
- // \92x\89\84\88È\8aO\82Ì\8f\91\82«\8d\9e\82Ý\r
- continue;\r
- }\r
- if (hit > mhit){\r
- hit = mhit;\r
- mindex = index;\r
- }\r
-\r
- System.out.println("@" + tweet.getFromUser() + " - "\r
- + tweet.getText() + at);\r
- count++;\r
- }\r
-\r
- String message = "[" + train.getName() + "] ";\r
- if (count < train.getCount()){\r
- message += df.format(date) + " \92x\89\84\82È\82µ"; \r
- }\r
- else {\r
- int N = 100;\r
- \r
- String sample = tweets.get(mindex).getText();\r
- sample = CommonUtil.replaceString(sample, "@", "(a)");\r
- sample = StringUtility.parseSubstring(sample, N);\r
- message += df.format(date) + " " + sample + " count=" + count; \r
- }\r
- System.out.println(message); //TODO\r
- \r
- Status status = null;\r
- try {\r
- status = twitter.updateStatus(message); //TODO\r
- }\r
- catch (TwitterException e){\r
- log.severe(Debug.getLineNo() + " " + message);\r
- throw e;\r
- }\r
- }\r
- \r
- private List<Train> getTrainList(){\r
- TrainDao dao = TrainDao.getInstance();\r
- List<Train> list = dao.search();\r
- if (list.size() <= 0){\r
- Train train;\r
- \r
- train = new Train("\8b\9e\95l\93\8c\96k\90ü", "\8b\9e\95l\93\8c\96k", 5);\r
- dao.put(train);\r
- train = new Train("\93\8c\8aC\93¹\90ü", "\93\8c\8aC\93¹", 5);\r
- dao.put(train);\r
- train = new Train("\8b\9e\95l\8b}\8ds\90ü", "\8b\9e\8b}", 5);\r
- dao.put(train);\r
- list = dao.search();\r
- }\r
- return list;\r
- }\r
- \r
- public int filter(String text) {\r
- if (keywords == null) {\r
- keywords = new ArrayList<String>();\r
- keywords.add("\92x\89\84");\r
- keywords.add("\92x\82ê");\r
- keywords.add("\90U\82è\91Ö\82¦");\r
- keywords.add("\90U\91Ö");\r
- keywords.add("\92â\8e~");\r
- keywords.add("\8e\96\8cÌ");\r
- }\r
-\r
- int count = 0;\r
- for (String keyword : keywords) {\r
- if (text.indexOf(keyword) >= 0) {\r
- count++;\r
- }\r
- }\r
- return count;\r
- }\r
- \r
- public int getPeriod(){\r
- if (period <= 0){\r
- KeyValueDao dao = KeyValueDao.getInstance();\r
- period = dao.getInt(KeyValueDao.KEY_SEARCH_PERIOD, 5);\r
- }\r
- return period;\r
- }\r
- \r
- private int getTwitTime(long id){\r
- String key = KeyValueDao.KEY_TWIT_TIME + id;\r
- Long value = (long)twitTimeList.get(key);\r
- if (value == null){\r
- value = 0L;\r
- twitTimeList.put(key, value);\r
- }\r
- return value;\r
- }\r
-}\r
+++ /dev/null
-package com.yuji.tdb.twitter;\r
-\r
-import java.text.DateFormat;\r
-import java.text.SimpleDateFormat;\r
-import java.util.ArrayList;\r
-import java.util.Calendar;\r
-import java.util.Date;\r
-import java.util.HashMap;\r
-import java.util.List;\r
-import java.util.Map;\r
-import java.util.TimeZone;\r
-import java.util.logging.Logger;\r
-\r
-import twitter4j.Query;\r
-import twitter4j.QueryResult;\r
-import twitter4j.Status;\r
-import twitter4j.Tweet;\r
-import twitter4j.Twitter;\r
-import twitter4j.TwitterException;\r
-import twitter4j.TwitterFactory;\r
-import twitter4j.auth.AccessToken;\r
-import twitter4j.conf.ConfigurationBuilder;\r
-\r
-import com.yuji.tdb.common.CommonUtil;\r
-import com.yuji.tdb.db.KeyValueDao;\r
-import com.yuji.tdb.db.Train;\r
-import com.yuji.tdb.db.TrainDao;\r
-import com.yuji.tdb.debug.Debug;\r
-import com.yuji.tdb.utility.StringUtility;\r
-\r
-public class TwitterUtil {\r
- private static final Logger log = Logger\r
- .getLogger(TwitterUtil.class.getName());\r
- private static TwitterUtil instance = null;\r
- private static Object obj = new Object();\r
- //private DateFormat df = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");\r
- private DateFormat df = new SimpleDateFormat("HH:mm");\r
- private static List<String> keywords = null;\r
- private long searchPeriod = 0;\r
- private long twitPeriod = 0;\r
- private Map<String, Long> twitTimeList = new HashMap<String, Long>();\r
- \r
- public static TwitterUtil getInstance() {\r
- if (instance == null) {\r
- synchronized (obj) {\r
- if (instance == null) {\r
- instance = new TwitterUtil();\r
- }\r
- }\r
- }\r
- return instance;\r
- }\r
-\r
- private TwitterUtil() {\r
- df.setTimeZone(TimeZone.getTimeZone("JST")); \r
- }\r
-\r
- public void main(String consumerKey, String consumerSecret, AccessToken accessToken) {\r
- try {\r
- ConfigurationBuilder confBuilder = new ConfigurationBuilder();\r
- confBuilder.setDebugEnabled(true).setOAuthConsumerKey(consumerKey)\r
- .setOAuthConsumerSecret(consumerSecret);\r
- TwitterFactory factory = new TwitterFactory(confBuilder.build());\r
- Twitter twitter = factory.getInstance(accessToken);\r
-\r
- List<Train> list = getTrainList();\r
- for (Train train : list){\r
- Calendar cal = Calendar.getInstance();\r
- Date date = cal.getTime();\r
- long cur = date.getTime();\r
-\r
- long id = train.getId();\r
- long t = getTwitTime(id);\r
- long period = getTwitPeriod();\r
- \r
- if (t > 0 && t + period < cur){\r
- continue;\r
- }\r
-// twite(twitter, train);\r
- }\r
-// } catch (TwitterException e) {\r
-// // TODO Auto-generated catch block\r
-// e.printStackTrace();\r
-// log.severe(e.toString());\r
- }\r
- }\r
-\r
- private void twite(Twitter twitter, Train train) throws TwitterException {\r
- Query query = new Query();\r
- //query.setRpp(1000); // TODO\r
- query.setQuery(train.getSearchWord());\r
- QueryResult result = null;\r
- try {\r
- result = twitter.search(query);\r
- }\r
- catch (TwitterException e){\r
- log.severe("" + Debug.getLineNo());\r
- throw e;\r
- }\r
- List<Tweet> tweets = result.getTweets();\r
- \r
- Calendar cal = Calendar.getInstance();\r
- Date date = cal.getTime();\r
- long cur = date.getTime();\r
-\r
- int count = 0;\r
- int hit = 0;\r
- int mhit = 0;\r
- long period = getSearchPeriod();\r
- long id = train.getId();\r
- \r
- int index;\r
- int mindex = 0;\r
- int size = tweets.size();\r
- for (index = 0; index < size; index++) {\r
- Tweet tweet = tweets.get(index);\r
- \r
- Date at = tweet.getCreatedAt();\r
- long t = at.getTime();\r
- \r
- String message = tweet.getText();\r
- \r
- if (t < cur - period * 60 * 1000){\r
- System.out.println("\81~" + tweet.getFromUser() + " - "\r
- + tweet.getText() + at);\r
- continue;\r
- }\r
- hit = filter(message);\r
- if (hit <= 0) {\r
- System.out.println("\81¢" + tweet.getFromUser() + " - "\r
- + tweet.getText() + at);\r
- // \92x\89\84\88È\8aO\82Ì\8f\91\82«\8d\9e\82Ý\r
- continue;\r
- }\r
- if (hit > mhit){\r
- hit = mhit;\r
- mindex = index;\r
- }\r
-\r
- System.out.println("@" + tweet.getFromUser() + " - "\r
- + tweet.getText() + at);\r
- count++;\r
- }\r
-\r
- String message = "[" + train.getName() + "] ";\r
- if (count < train.getCount()){\r
- message += df.format(date) + " \92x\89\84\82È\82µ"; \r
- }\r
- else {\r
- int N = 100;\r
- \r
- String sample = tweets.get(mindex).getText();\r
- sample = CommonUtil.replaceString(sample, "@", "(a)");\r
- sample = StringUtility.parseSubstring(sample, N);\r
- message += df.format(date) + " " + sample + " count=" + count; \r
- }\r
- System.out.println(message); //TODO\r
- \r
- Status status = null;\r
- try {\r
- status = twitter.updateStatus(message); //TODO\r
- setTwitTime(id, cur);\r
- }\r
- catch (TwitterException e){\r
- log.severe(Debug.getLineNo() + " " + message);\r
- log.severe(Debug.getLineNo() + " " + status);\r
- throw e;\r
- }\r
- }\r
- \r
- private List<Train> getTrainList(){\r
- TrainDao dao = TrainDao.getInstance();\r
- List<Train> list = dao.search();\r
- if (list.size() <= 0){\r
- Train train;\r
- \r
- train = new Train("\8b\9e\95l\93\8c\96k\90ü", "\8b\9e\95l\93\8c\96k", 5);\r
- dao.put(train);\r
- train = new Train("\93\8c\8aC\93¹\90ü", "\93\8c\8aC\93¹", 5);\r
- dao.put(train);\r
- train = new Train("\8b\9e\95l\8b}\8ds\90ü", "\8b\9e\8b}", 5);\r
- dao.put(train);\r
- list = dao.search();\r
- }\r
- return list;\r
- }\r
- \r
- public int filter(String text) {\r
- if (keywords == null) {\r
- keywords = new ArrayList<String>();\r
- keywords.add("\92x\89\84");\r
- keywords.add("\92x\82ê");\r
- keywords.add("\90U\82è\91Ö\82¦");\r
- keywords.add("\90U\91Ö");\r
- keywords.add("\92â\8e~");\r
- keywords.add("\8e\96\8cÌ");\r
- }\r
-\r
- int count = 0;\r
- for (String keyword : keywords) {\r
- if (text.indexOf(keyword) >= 0) {\r
- count++;\r
- }\r
- }\r
- return count;\r
- }\r
- \r
- public long getSearchPeriod(){\r
- if (searchPeriod <= 0){\r
- KeyValueDao dao = KeyValueDao.getInstance();\r
- searchPeriod = dao.getInt(KeyValueDao.KEY_SEARCH_PERIOD, 5);\r
- }\r
- return searchPeriod;\r
- }\r
- \r
- public long getTwitPeriod(){\r
- if (twitPeriod <= 0){\r
- KeyValueDao dao = KeyValueDao.getInstance();\r
- twitPeriod = dao.getInt(KeyValueDao.KEY_TWIT_PERIOD, 5);\r
- }\r
- return twitPeriod;\r
- }\r
- \r
- private long getTwitTime(long id){\r
- String key = KeyValueDao.KEY_TWIT_TIME + id;\r
- Long value = twitTimeList.get(key);\r
- if (value == null){\r
- value = 0L;\r
- twitTimeList.put(key, value);\r
- }\r
- return value;\r
- }\r
- \r
- private void setTwitTime(long id, long value){\r
- String key = KeyValueDao.KEY_TWIT_TIME + id;\r
- twitTimeList.put(key, value);\r
- }\r
-}\r
+++ /dev/null
-package com.yuji.tdb.twitter;\r
-\r
-import java.text.DateFormat;\r
-import java.text.SimpleDateFormat;\r
-import java.util.ArrayList;\r
-import java.util.Calendar;\r
-import java.util.Date;\r
-import java.util.HashMap;\r
-import java.util.List;\r
-import java.util.Map;\r
-import java.util.TimeZone;\r
-import java.util.logging.Logger;\r
-\r
-import twitter4j.Query;\r
-import twitter4j.QueryResult;\r
-import twitter4j.Status;\r
-import twitter4j.Tweet;\r
-import twitter4j.Twitter;\r
-import twitter4j.TwitterException;\r
-import twitter4j.TwitterFactory;\r
-import twitter4j.auth.AccessToken;\r
-import twitter4j.conf.ConfigurationBuilder;\r
-\r
-import com.yuji.tdb.common.CommonUtil;\r
-import com.yuji.tdb.db.KeyValueDao;\r
-import com.yuji.tdb.db.Train;\r
-import com.yuji.tdb.db.TrainDao;\r
-import com.yuji.tdb.debug.Debug;\r
-import com.yuji.tdb.utility.StringUtility;\r
-\r
-public class TwitterUtil {\r
- private static final Logger log = Logger\r
- .getLogger(TwitterUtil.class.getName());\r
- private static TwitterUtil instance = null;\r
- private static Object obj = new Object();\r
- //private DateFormat df = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");\r
- private DateFormat df = new SimpleDateFormat("HH:mm");\r
- private static List<String> keywords = null;\r
- private int period = 0;\r
- private Map<String, Long> twitTimeList = new HashMap<String, Long>();\r
- \r
- public static TwitterUtil getInstance() {\r
- if (instance == null) {\r
- synchronized (obj) {\r
- if (instance == null) {\r
- instance = new TwitterUtil();\r
- }\r
- }\r
- }\r
- return instance;\r
- }\r
-\r
- private TwitterUtil() {\r
- df.setTimeZone(TimeZone.getTimeZone("JST")); \r
- }\r
-\r
- public void main(String consumerKey, String consumerSecret, AccessToken accessToken) {\r
- try {\r
- ConfigurationBuilder confBuilder = new ConfigurationBuilder();\r
- confBuilder.setDebugEnabled(true).setOAuthConsumerKey(consumerKey)\r
- .setOAuthConsumerSecret(consumerSecret);\r
- TwitterFactory factory = new TwitterFactory(confBuilder.build());\r
- Twitter twitter = factory.getInstance(accessToken);\r
-\r
- List<Train> list = getTrainList();\r
- for (Train train : list){\r
- twite(twitter, train);\r
- }\r
- } catch (TwitterException e) {\r
- // TODO Auto-generated catch block\r
- e.printStackTrace();\r
- log.severe(e.toString());\r
- }\r
- }\r
-\r
- private void twite(Twitter twitter, Train train) throws TwitterException {\r
- Query query = new Query();\r
- //query.setRpp(1000); // TODO\r
- query.setQuery(train.getSearchWord());\r
- QueryResult result = null;\r
- try {\r
- result = twitter.search(query);\r
- }\r
- catch (TwitterException e){\r
- log.severe("" + Debug.getLineNo());\r
- throw e;\r
- }\r
- List<Tweet> tweets = result.getTweets();\r
- \r
- Calendar cal = Calendar.getInstance();\r
- Date date = cal.getTime();\r
- long cur = date.getTime();\r
-\r
- int count = 0;\r
- int hit = 0;\r
- int mhit = 0;\r
- int period = getPeriod();\r
- \r
- int index;\r
- int mindex = 0;\r
- int size = tweets.size();\r
- for (index = 0; index < size; index++) {\r
- Tweet tweet = tweets.get(index);\r
- \r
- Date at = tweet.getCreatedAt();\r
- long t = at.getTime();\r
- \r
- String message = tweet.getText();\r
- \r
- if (t < cur - period * 60 * 1000){\r
- System.out.println("\81~" + tweet.getFromUser() + " - "\r
- + tweet.getText() + at);\r
- continue;\r
- }\r
- hit = filter(message);\r
- if (hit <= 0) {\r
- System.out.println("\81¢" + tweet.getFromUser() + " - "\r
- + tweet.getText() + at);\r
- // \92x\89\84\88È\8aO\82Ì\8f\91\82«\8d\9e\82Ý\r
- continue;\r
- }\r
- if (hit > mhit){\r
- hit = mhit;\r
- mindex = index;\r
- }\r
-\r
- System.out.println("@" + tweet.getFromUser() + " - "\r
- + tweet.getText() + at);\r
- count++;\r
- }\r
-\r
- String message = "[" + train.getName() + "] ";\r
- if (count < train.getCount()){\r
- message += df.format(date) + " \92x\89\84\82È\82µ"; \r
- }\r
- else {\r
- int N = 100;\r
- \r
- String sample = tweets.get(mindex).getText();\r
- sample = CommonUtil.replaceString(sample, "@", "(a)");\r
- sample = StringUtility.parseSubstring(sample, N);\r
- message += df.format(date) + " " + sample + " count=" + count; \r
- }\r
- System.out.println(message); //TODO\r
- \r
- Status status = null;\r
- try {\r
- status = twitter.updateStatus(message); //TODO\r
- }\r
- catch (TwitterException e){\r
- log.severe(Debug.getLineNo() + " " + message);\r
- throw e;\r
- }\r
- }\r
- \r
- private List<Train> getTrainList(){\r
- TrainDao dao = TrainDao.getInstance();\r
- List<Train> list = dao.search();\r
- if (list.size() <= 0){\r
- Train train;\r
- \r
- train = new Train("\8b\9e\95l\93\8c\96k\90ü", "\8b\9e\95l\93\8c\96k", 5);\r
- dao.put(train);\r
- train = new Train("\93\8c\8aC\93¹\90ü", "\93\8c\8aC\93¹", 5);\r
- dao.put(train);\r
- train = new Train("\8b\9e\95l\8b}\8ds\90ü", "\8b\9e\8b}", 5);\r
- dao.put(train);\r
- list = dao.search();\r
- }\r
- return list;\r
- }\r
- \r
- public int filter(String text) {\r
- if (keywords == null) {\r
- keywords = new ArrayList<String>();\r
- keywords.add("\92x\89\84");\r
- keywords.add("\92x\82ê");\r
- keywords.add("\90U\82è\91Ö\82¦");\r
- keywords.add("\90U\91Ö");\r
- keywords.add("\92â\8e~");\r
- keywords.add("\8e\96\8cÌ");\r
- }\r
-\r
- int count = 0;\r
- for (String keyword : keywords) {\r
- if (text.indexOf(keyword) >= 0) {\r
- count++;\r
- }\r
- }\r
- return count;\r
- }\r
- \r
- public int getPeriod(){\r
- if (period <= 0){\r
- KeyValueDao dao = KeyValueDao.getInstance();\r
- period = dao.getInt(KeyValueDao.KEY_SEARCH_PERIOD, 5);\r
- }\r
- return period;\r
- }\r
- \r
- private int getTwitTime(long id){\r
- String key = KeyValueDao.KEY_TWIT_TIME + id;\r
- Integer value = (long)twitTimeList.get(key);\r
- if (value == null){\r
- value = 0;\r
- twitTimeList.put(key, value);\r
- }\r
- return value;\r
- }\r
-}\r
+++ /dev/null
-package com.yuji.tdb.twitter;\r
-\r
-import java.text.DateFormat;\r
-import java.text.SimpleDateFormat;\r
-import java.util.ArrayList;\r
-import java.util.Calendar;\r
-import java.util.Date;\r
-import java.util.List;\r
-import java.util.TimeZone;\r
-import java.util.logging.Logger;\r
-\r
-import twitter4j.Query;\r
-import twitter4j.QueryResult;\r
-import twitter4j.Status;\r
-import twitter4j.Tweet;\r
-import twitter4j.Twitter;\r
-import twitter4j.TwitterException;\r
-import twitter4j.TwitterFactory;\r
-import twitter4j.auth.AccessToken;\r
-import twitter4j.conf.ConfigurationBuilder;\r
-\r
-import com.yuji.tdb.common.CommonUtil;\r
-import com.yuji.tdb.db.KeyValueDao;\r
-import com.yuji.tdb.db.Train;\r
-import com.yuji.tdb.db.TrainDao;\r
-import com.yuji.tdb.debug.Debug;\r
-import com.yuji.tdb.utility.StringUtility;\r
-\r
-public class TwitterUtil {\r
- private static final Logger log = Logger\r
- .getLogger(TwitterUtil.class.getName());\r
- private static TwitterUtil instance = null;\r
- private static Object obj = new Object();\r
- //private DateFormat df = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");\r
- private DateFormat df = new SimpleDateFormat("HH:mm");\r
- private static List<String> keywords = null;\r
- private int period = 0;\r
- \r
- public static TwitterUtil getInstance() {\r
- if (instance == null) {\r
- synchronized (obj) {\r
- if (instance == null) {\r
- instance = new TwitterUtil();\r
- }\r
- }\r
- }\r
- return instance;\r
- }\r
-\r
- private TwitterUtil() {\r
- df.setTimeZone(TimeZone.getTimeZone("JST")); \r
- }\r
-\r
- public void main(String consumerKey, String consumerSecret, AccessToken accessToken) {\r
- try {\r
- ConfigurationBuilder confBuilder = new ConfigurationBuilder();\r
- confBuilder.setDebugEnabled(true).setOAuthConsumerKey(consumerKey)\r
- .setOAuthConsumerSecret(consumerSecret);\r
- TwitterFactory factory = new TwitterFactory(confBuilder.build());\r
- Twitter twitter = factory.getInstance(accessToken);\r
-\r
- List<Train> list = getTrainList();\r
- for (Train train : list){\r
- twite(twitter, train);\r
- }\r
- } catch (TwitterException e) {\r
- // TODO Auto-generated catch block\r
- e.printStackTrace();\r
- log.severe(e.toString());\r
- }\r
- }\r
-\r
- private void twite(Twitter twitter, Train train) throws TwitterException {\r
- Query query = new Query();\r
- //query.setRpp(1000); // TODO\r
- query.setQuery(train.getSearchWord());\r
- QueryResult result = null;\r
- try {\r
- result = twitter.search(query);\r
- }\r
- catch (TwitterException e){\r
- log.severe("" + Debug.getLineNo());\r
- throw e;\r
- }\r
- List<Tweet> tweets = result.getTweets();\r
- \r
- Calendar cal = Calendar.getInstance();\r
- Date date = cal.getTime();\r
- long cur = date.getTime();\r
-\r
- int count = 0;\r
- int hit = 0;\r
- int mhit = 0;\r
- int period = getPeriod();\r
- \r
- int index;\r
- int mindex = 0;\r
- int size = tweets.size();\r
- for (index = 0; index < size; index++) {\r
- Tweet tweet = tweets.get(index);\r
- \r
- Date at = tweet.getCreatedAt();\r
- long t = at.getTime();\r
- \r
- String message = tweet.getText();\r
- \r
- if (t < cur - period * 60 * 1000){\r
- System.out.println("\81~" + tweet.getFromUser() + " - "\r
- + tweet.getText() + at);\r
- continue;\r
- }\r
- hit = filter(message);\r
- if (hit <= 0) {\r
- System.out.println("\81¢" + tweet.getFromUser() + " - "\r
- + tweet.getText() + at);\r
- // \92x\89\84\88È\8aO\82Ì\8f\91\82«\8d\9e\82Ý\r
- continue;\r
- }\r
- if (hit > mhit){\r
- hit = mhit;\r
- mindex = index;\r
- }\r
-\r
- System.out.println("@" + tweet.getFromUser() + " - "\r
- + tweet.getText() + at);\r
- count++;\r
- }\r
-\r
- String message = "[" + train.getName() + "] ";\r
- if (count < train.getCount()){\r
- message += df.format(date) + " \92x\89\84\82È\82µ"; \r
- }\r
- else {\r
- int N = 100;\r
- \r
- String sample = tweets.get(mindex).getText();\r
- sample = CommonUtil.replaceString(sample, "@", "(a)");\r
- sample = StringUtility.parseSubstring(sample, N);\r
- message += df.format(date) + " " + sample + " count=" + count; \r
- }\r
- System.out.println(message); //TODO\r
- \r
- Status status = null;\r
- try {\r
- status = twitter.updateStatus(message); //TODO\r
- }\r
- catch (TwitterException e){\r
- log.severe(Debug.getLineNo() + " " + message);\r
- throw e;\r
- }\r
- }\r
- \r
- private List<Train> getTrainList(){\r
- TrainDao dao = TrainDao.getInstance();\r
- List<Train> list = dao.search();\r
- if (list.size() <= 0){\r
- Train train;\r
- \r
- train = new Train("\8b\9e\95l\93\8c\96k\90ü", "\8b\9e\95l\93\8c\96k", 5);\r
- dao.put(train);\r
- train = new Train("\93\8c\8aC\93¹\90ü", "\93\8c\8aC\93¹", 5);\r
- dao.put(train);\r
- train = new Train("\8b\9e\95l\8b}\8ds\90ü", "\8b\9e\8b}", 5);\r
- dao.put(train);\r
- list = dao.search();\r
- }\r
- return list;\r
- }\r
- \r
- public int filter(String text) {\r
- if (keywords == null) {\r
- keywords = new ArrayList<String>();\r
- keywords.add("\92x\89\84");\r
- keywords.add("\92x\82ê");\r
- keywords.add("\90U\82è\91Ö\82¦");\r
- keywords.add("\90U\91Ö");\r
- keywords.add("\92â\8e~");\r
- keywords.add("\8e\96\8cÌ");\r
- }\r
-\r
- int count = 0;\r
- for (String keyword : keywords) {\r
- if (text.indexOf(keyword) >= 0) {\r
- count++;\r
- }\r
- }\r
- return count;\r
- }\r
- \r
- public int getPeriod(){\r
- if (period <= 0){\r
- KeyValueDao dao = KeyValueDao.getInstance();\r
- period = dao.getInt(KeyValueDao.KEY_SEARCH_PERIOD, 5);\r
- }\r
- return period;\r
- }\r
-}\r
+++ /dev/null
-package com.yuji.tdb.twitter;\r
-\r
-import java.text.DateFormat;\r
-import java.text.SimpleDateFormat;\r
-import java.util.ArrayList;\r
-import java.util.Calendar;\r
-import java.util.Date;\r
-import java.util.HashMap;\r
-import java.util.List;\r
-import java.util.Map;\r
-import java.util.TimeZone;\r
-import java.util.logging.Logger;\r
-\r
-import twitter4j.Query;\r
-import twitter4j.QueryResult;\r
-import twitter4j.Status;\r
-import twitter4j.Tweet;\r
-import twitter4j.Twitter;\r
-import twitter4j.TwitterException;\r
-import twitter4j.TwitterFactory;\r
-import twitter4j.auth.AccessToken;\r
-import twitter4j.conf.ConfigurationBuilder;\r
-\r
-import com.yuji.tdb.common.CommonUtil;\r
-import com.yuji.tdb.db.KeyValueDao;\r
-import com.yuji.tdb.db.Train;\r
-import com.yuji.tdb.db.TrainDao;\r
-import com.yuji.tdb.debug.Debug;\r
-import com.yuji.tdb.utility.StringUtility;\r
-\r
-public class TwitterUtil {\r
- private static final Logger log = Logger\r
- .getLogger(TwitterUtil.class.getName());\r
- private static TwitterUtil instance = null;\r
- private static Object obj = new Object();\r
- //private DateFormat df = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");\r
- private DateFormat df = new SimpleDateFormat("HH:mm");\r
- private static List<String> keywords = null;\r
- private long searchPeriod = 0;\r
- private long twitPeriod = 0;\r
- private Map<String, Long> twitTimeList = new HashMap<String, Long>();\r
- \r
- public static TwitterUtil getInstance() {\r
- if (instance == null) {\r
- synchronized (obj) {\r
- if (instance == null) {\r
- instance = new TwitterUtil();\r
- }\r
- }\r
- }\r
- return instance;\r
- }\r
-\r
- private TwitterUtil() {\r
- df.setTimeZone(TimeZone.getTimeZone("JST")); \r
- }\r
-\r
- public void main(String consumerKey, String consumerSecret, AccessToken accessToken) {\r
- try {\r
- ConfigurationBuilder confBuilder = new ConfigurationBuilder();\r
- confBuilder.setDebugEnabled(true).setOAuthConsumerKey(consumerKey)\r
- .setOAuthConsumerSecret(consumerSecret);\r
- TwitterFactory factory = new TwitterFactory(confBuilder.build());\r
- Twitter twitter = factory.getInstance(accessToken);\r
-\r
- List<Train> list = getTrainList();\r
- for (Train train : list){\r
- Calendar cal = Calendar.getInstance();\r
- Date date = cal.getTime();\r
- long cur = date.getTime();\r
-\r
- long id = train.getId();\r
- long t = getTwitTime(id);\r
- long period = getTwitPeriod();\r
-\r
- if (t > 0 && t + period * 60 * 1000 < cur){\r
- continue;\r
- }\r
- twite(twitter, train);\r
- }\r
- } catch (TwitterException e) {\r
- // TODO Auto-generated catch block\r
- e.printStackTrace();\r
- log.severe(e.toString());\r
- }\r
- }\r
-\r
- private void twite(Twitter twitter, Train train) throws TwitterException {\r
- Query query = new Query();\r
- //query.setRpp(1000); // TODO\r
- query.setQuery(train.getSearchWord());\r
- QueryResult result = null;\r
- try {\r
- result = twitter.search(query);\r
- }\r
- catch (TwitterException e){\r
- log.severe("" + Debug.getLineNo());\r
- throw e;\r
- }\r
- List<Tweet> tweets = result.getTweets();\r
- \r
- Calendar cal = Calendar.getInstance();\r
- Date date = cal.getTime();\r
- long cur = date.getTime();\r
-\r
- int count = 0;\r
- int hit = 0;\r
- int mhit = 0;\r
- long period = getSearchPeriod();\r
- long id = train.getId();\r
- \r
- int index;\r
- int mindex = 0;\r
- int size = tweets.size();\r
- for (index = 0; index < size; index++) {\r
- Tweet tweet = tweets.get(index);\r
- \r
- Date at = tweet.getCreatedAt();\r
- long t = at.getTime();\r
- \r
- String message = tweet.getText();\r
- \r
- if (t < cur - period * 60 * 1000){\r
- System.out.println("\81~" + tweet.getFromUser() + " - "\r
- + tweet.getText() + at);\r
- continue;\r
- }\r
- hit = filter(message);\r
- if (hit <= 0) {\r
- System.out.println("\81¢" + tweet.getFromUser() + " - "\r
- + tweet.getText() + at);\r
- // \92x\89\84\88È\8aO\82Ì\8f\91\82«\8d\9e\82Ý\r
- continue;\r
- }\r
- if (hit > mhit){\r
- hit = mhit;\r
- mindex = index;\r
- }\r
-\r
- System.out.println("@" + tweet.getFromUser() + " - "\r
- + tweet.getText() + at);\r
- count++;\r
- }\r
-\r
- String message = "[" + train.getName() + "] ";\r
- if (count < train.getCount()){\r
- message += df.format(date) + " \92x\89\84\82È\82µ"; \r
- }\r
- else {\r
- int N = 100;\r
- \r
- String sample = tweets.get(mindex).getText();\r
- sample = CommonUtil.replaceString(sample, "@", "(a)");\r
- sample = StringUtility.parseSubstring(sample, N);\r
- message += df.format(date) + " " + sample + " count=" + count; \r
- }\r
- System.out.println(message); //TODO\r
- \r
-// Status status = null;\r
-// try {\r
-// status = twitter.updateStatus(message); //TODO\r
-// setTwitTime(id, cur);\r
-// }\r
-// catch (TwitterException e){\r
-// log.severe(Debug.getLineNo() + " " + message);\r
-// log.severe(Debug.getLineNo() + " " + status);\r
-// throw e;\r
-// }\r
- setTwitTime(id, cur); // TODO\r
- }\r
- \r
- private List<Train> getTrainList(){\r
- TrainDao dao = TrainDao.getInstance();\r
- List<Train> list = dao.search();\r
- if (list.size() <= 0){\r
- Train train;\r
- \r
- train = new Train("\8b\9e\95l\93\8c\96k\90ü", "\8b\9e\95l\93\8c\96k", 5);\r
- dao.put(train);\r
- train = new Train("\93\8c\8aC\93¹\90ü", "\93\8c\8aC\93¹", 5);\r
- dao.put(train);\r
- train = new Train("\8b\9e\95l\8b}\8ds\90ü", "\8b\9e\8b}", 5);\r
- dao.put(train);\r
- list = dao.search();\r
- }\r
- return list;\r
- }\r
- \r
- public int filter(String text) {\r
- if (keywords == null) {\r
- keywords = new ArrayList<String>();\r
- keywords.add("\92x\89\84");\r
- keywords.add("\92x\82ê");\r
- keywords.add("\90U\82è\91Ö\82¦");\r
- keywords.add("\90U\91Ö");\r
- keywords.add("\92â\8e~");\r
- keywords.add("\8e\96\8cÌ");\r
- }\r
-\r
- int count = 0;\r
- for (String keyword : keywords) {\r
- if (text.indexOf(keyword) >= 0) {\r
- count++;\r
- }\r
- }\r
- return count;\r
- }\r
- \r
- public long getSearchPeriod(){\r
- if (searchPeriod <= 0){\r
- KeyValueDao dao = KeyValueDao.getInstance();\r
- searchPeriod = dao.getInt(KeyValueDao.KEY_SEARCH_PERIOD, 5);\r
- }\r
- return searchPeriod;\r
- }\r
- \r
- public long getTwitPeriod(){\r
- if (twitPeriod <= 0){\r
- KeyValueDao dao = KeyValueDao.getInstance();\r
- twitPeriod = dao.getInt(KeyValueDao.KEY_TWIT_PERIOD, 5);\r
- }\r
- return twitPeriod;\r
- }\r
- \r
- private long getTwitTime(long id){\r
- String key = KeyValueDao.KEY_TWIT_TIME + id;\r
- Long value = twitTimeList.get(key);\r
- if (value == null){\r
- value = 0L;\r
- setTwitTime(id, value)\r
- }\r
- return value;\r
- }\r
- \r
- private void setTwitTime(long id, long value){\r
- String key = KeyValueDao.KEY_TWIT_TIME + id;\r
- twitTimeList.put(key, value);\r
- }\r
-}\r
+++ /dev/null
-package com.yuji.tdb.db;\r
-\r
-import javax.jdo.PersistenceManager;\r
-\r
-public class KeyValueDao {\r
- public static final String KEY_CONSUMER_KEY = "CONSUMER_KEY";\r
- public static final String KEY_CONSUMER_SECRET = "CONSUMER_SECRET";\r
- public static final String KEY_REQUEST_TOKEN = "REQUEST_TOKEN";\r
- public static final String KEY_REQUEST_TOKEN_SECRET = "REQUEST_TOKEN_SECRET";\r
- public static final String KEY_ACCESS_TOKEN = "ACCESS_TOKEN";\r
- public static final String KEY_ACCESS_TOKEN_SECRET = "ACCESS_TOKEN_SECRET";\r
-\r
- public static final String KEY_SEARCH_PERIOD = "SEARCH_PERIOD";\r
-\r
- private static KeyValueDao instance = null;\r
- private PersistenceManager pm = PMFactory.get().getPersistenceManager();\r
- \r
- public static KeyValueDao getInstance(){\r
- if (instance == null){\r
- instance = new KeyValueDao();\r
- }\r
- return instance;\r
- }\r
- \r
- private KeyValueDao(){\r
- \r
- }\r
- \r
- public String get(String key){\r
- KeyValue keyValue = pm.getObjectById(KeyValue.class, key);\r
- if (keyValue == null){\r
- return null;\r
- }\r
- return keyValue.getValue();\r
- }\r
- \r
- public int getInt(String key){\r
- String value = get(key);\r
- return Integer.valueOf(value).intValue();\r
- }\r
- \r
- public void put(String key, String value){\r
- KeyValue keyValue = new KeyValue(key, value);\r
- pm.makePersistent(keyValue);\r
- }\r
-\r
- public void put(String key, int value){\r
- put(key, String.valueOf(value));\r
- }\r
-\r
- public String get(String key, String initValue){\r
- String value = get(key);\r
- if (value == null){\r
- put(key, initValue);\r
- value = initValue;\r
- }\r
- return value;\r
- }\r
-\r
- public int getInt(String key, int initValue){\r
- String value = get(key);\r
- if (value == null){\r
- put(key, initValue);\r
- }\r
- return Integer.valueOf(value).intValue();\r
- }\r
-}\r
\r
Status status = null;\r
try {\r
- status = twitter.updateStatus(message); //TODO\r
if (count < train.getCount()){\r
- setTwitTime(id, cur); // TODO \92x\89\84\82È\82µ\82Ì\8e\9e\82Ì\82Ý\r
+ // \92x\89\84\82È\82µ\r
+ //status = twitter.updateStatus(message); //TODO\r
+ //setTwitTime(id, cur); // TODO \92x\89\84\82È\82µ\82Ì\8e\9e\82Ì\82Ý\r
+ }\r
+ else {\r
+ // \92x\89\84\82 \82è\r
+ status = twitter.updateStatus(message); //TODO\r
+ setTwitTime(id, cur); \r
}\r
}\r
catch (TwitterException e){\r
+++ /dev/null
-package com.yuji.tdb.db;\r
-\r
-import javax.jdo.PersistenceManager;\r
-\r
-public class KeyValueDao {\r
- public static final String KEY_CONSUMER_KEY = "CONSUMER_KEY";\r
- public static final String KEY_CONSUMER_SECRET = "CONSUMER_SECRET";\r
- public static final String KEY_REQUEST_TOKEN = "REQUEST_TOKEN";\r
- public static final String KEY_REQUEST_TOKEN_SECRET = "REQUEST_TOKEN_SECRET";\r
- public static final String KEY_ACCESS_TOKEN = "ACCESS_TOKEN";\r
- public static final String KEY_ACCESS_TOKEN_SECRET = "ACCESS_TOKEN_SECRET";\r
-\r
- public static final String KEY_SEARCH_PERIOD = "SEARCH_PERIOD";\r
- public static final String KEY_TWIT_PERIOD = "TWIT_PERIOD";\r
- public static final String KEY_TWIT_TIME = "TWIT_TIME";\r
-\r
- private static KeyValueDao instance = null;\r
- private PersistenceManager pm = PMFactory.get().getPersistenceManager();\r
- \r
- public static KeyValueDao getInstance(){\r
- if (instance == null){\r
- instance = new KeyValueDao();\r
- }\r
- return instance;\r
- }\r
- \r
- private KeyValueDao(){\r
- \r
- }\r
- \r
- public String get(String key){\r
- KeyValue keyValue = pm.getObjectById(KeyValue.class, key);\r
- if (keyValue == null){\r
- return null;\r
- }\r
- return keyValue.getValue();\r
- }\r
- \r
- public int getInt(String key){\r
- String value = get(key);\r
- return Integer.valueOf(value).intValue();\r
- }\r
- \r
- public void put(String key, String value){\r
- KeyValue keyValue = new KeyValue(key, value);\r
- pm.makePersistent(keyValue);\r
- }\r
-\r
- public void put(String key, int value){\r
- put(key, String.valueOf(value));\r
- }\r
-\r
- public String get(String key, String initValue){\r
- String value = get(key);\r
- if (value == null){\r
- put(key, initValue);\r
- value = initValue;\r
- }\r
- return value;\r
- }\r
-\r
- public int getInt(String key, int initValue){\r
- String value = get(key);\r
- if (value == null){\r
- put(key, initValue);\r
- }\r
- return Integer.valueOf(value).intValue();\r
- }\r
-}\r
+++ /dev/null
-package com.yuji.tdb;
-
-public class Debug {
- public static int getLineNo() {
- StackTraceElement[] stackTrace = new Exception().getStackTrace();
- StackTraceElement info = stackTrace[stackTrace.length - 1];
- return info.getLineNumber();
- }
-}
+++ /dev/null
-package com.yuji.tdb.twitter;\r
-\r
-import java.text.DateFormat;\r
-import java.text.SimpleDateFormat;\r
-import java.util.ArrayList;\r
-import java.util.Calendar;\r
-import java.util.Date;\r
-import java.util.HashMap;\r
-import java.util.List;\r
-import java.util.Map;\r
-import java.util.TimeZone;\r
-import java.util.logging.Logger;\r
-\r
-import twitter4j.Query;\r
-import twitter4j.QueryResult;\r
-import twitter4j.Status;\r
-import twitter4j.Tweet;\r
-import twitter4j.Twitter;\r
-import twitter4j.TwitterException;\r
-import twitter4j.TwitterFactory;\r
-import twitter4j.auth.AccessToken;\r
-import twitter4j.conf.ConfigurationBuilder;\r
-\r
-import com.yuji.tdb.common.CommonUtil;\r
-import com.yuji.tdb.db.KeyValueDao;\r
-import com.yuji.tdb.db.Train;\r
-import com.yuji.tdb.db.TrainDao;\r
-import com.yuji.tdb.debug.Debug;\r
-import com.yuji.tdb.utility.StringUtility;\r
-\r
-public class TwitterUtil {\r
- private static final Logger log = Logger\r
- .getLogger(TwitterUtil.class.getName());\r
- private static TwitterUtil instance = null;\r
- private static Object obj = new Object();\r
- //private DateFormat df = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");\r
- private DateFormat df = new SimpleDateFormat("HH:mm");\r
- private static List<String> keywords = null;\r
- private long searchPeriod = 0;\r
- private long twitPeriod = 0;\r
- private Map<String, Long> twitTimeList = new HashMap<String, Long>();\r
- \r
- public static TwitterUtil getInstance() {\r
- if (instance == null) {\r
- synchronized (obj) {\r
- if (instance == null) {\r
- instance = new TwitterUtil();\r
- }\r
- }\r
- }\r
- return instance;\r
- }\r
-\r
- private TwitterUtil() {\r
- df.setTimeZone(TimeZone.getTimeZone("JST")); \r
- }\r
-\r
- public void main(String consumerKey, String consumerSecret, AccessToken accessToken) {\r
- try {\r
- ConfigurationBuilder confBuilder = new ConfigurationBuilder();\r
- confBuilder.setDebugEnabled(true).setOAuthConsumerKey(consumerKey)\r
- .setOAuthConsumerSecret(consumerSecret);\r
- TwitterFactory factory = new TwitterFactory(confBuilder.build());\r
- Twitter twitter = factory.getInstance(accessToken);\r
-\r
- List<Train> list = getTrainList();\r
- for (Train train : list){\r
- Calendar cal = Calendar.getInstance();\r
- Date date = cal.getTime();\r
- long cur = date.getTime();\r
-\r
- long id = train.getId();\r
- long t = getTwitTime(id);\r
- long period = getTwitPeriod();\r
- \r
- if (t + period < cur){\r
- continue;\r
- }\r
- twite(twitter, train);\r
- }\r
- } catch (TwitterException e) {\r
- // TODO Auto-generated catch block\r
- e.printStackTrace();\r
- log.severe(e.toString());\r
- }\r
- }\r
-\r
- private void twite(Twitter twitter, Train train) throws TwitterException {\r
- Query query = new Query();\r
- //query.setRpp(1000); // TODO\r
- query.setQuery(train.getSearchWord());\r
- QueryResult result = null;\r
- try {\r
- result = twitter.search(query);\r
- }\r
- catch (TwitterException e){\r
- log.severe("" + Debug.getLineNo());\r
- throw e;\r
- }\r
- List<Tweet> tweets = result.getTweets();\r
- \r
- Calendar cal = Calendar.getInstance();\r
- Date date = cal.getTime();\r
- long cur = date.getTime();\r
-\r
- int count = 0;\r
- int hit = 0;\r
- int mhit = 0;\r
- long period = getSearchPeriod();\r
- \r
- int index;\r
- int mindex = 0;\r
- int size = tweets.size();\r
- for (index = 0; index < size; index++) {\r
- Tweet tweet = tweets.get(index);\r
- \r
- Date at = tweet.getCreatedAt();\r
- long t = at.getTime();\r
- \r
- String message = tweet.getText();\r
- \r
- if (t < cur - period * 60 * 1000){\r
- System.out.println("\81~" + tweet.getFromUser() + " - "\r
- + tweet.getText() + at);\r
- continue;\r
- }\r
- hit = filter(message);\r
- if (hit <= 0) {\r
- System.out.println("\81¢" + tweet.getFromUser() + " - "\r
- + tweet.getText() + at);\r
- // \92x\89\84\88È\8aO\82Ì\8f\91\82«\8d\9e\82Ý\r
- continue;\r
- }\r
- if (hit > mhit){\r
- hit = mhit;\r
- mindex = index;\r
- }\r
-\r
- System.out.println("@" + tweet.getFromUser() + " - "\r
- + tweet.getText() + at);\r
- count++;\r
- }\r
-\r
- String message = "[" + train.getName() + "] ";\r
- if (count < train.getCount()){\r
- message += df.format(date) + " \92x\89\84\82È\82µ"; \r
- }\r
- else {\r
- int N = 100;\r
- \r
- String sample = tweets.get(mindex).getText();\r
- sample = CommonUtil.replaceString(sample, "@", "(a)");\r
- sample = StringUtility.parseSubstring(sample, N);\r
- message += df.format(date) + " " + sample + " count=" + count; \r
- }\r
- System.out.println(message); //TODO\r
- \r
- Status status = null;\r
- try {\r
- status = twitter.updateStatus(message); //TODO\r
- setTwitTime(id, cur);\r
- }\r
- catch (TwitterException e){\r
- log.severe(Debug.getLineNo() + " " + message);\r
- throw e;\r
- }\r
- }\r
- \r
- private List<Train> getTrainList(){\r
- TrainDao dao = TrainDao.getInstance();\r
- List<Train> list = dao.search();\r
- if (list.size() <= 0){\r
- Train train;\r
- \r
- train = new Train("\8b\9e\95l\93\8c\96k\90ü", "\8b\9e\95l\93\8c\96k", 5);\r
- dao.put(train);\r
- train = new Train("\93\8c\8aC\93¹\90ü", "\93\8c\8aC\93¹", 5);\r
- dao.put(train);\r
- train = new Train("\8b\9e\95l\8b}\8ds\90ü", "\8b\9e\8b}", 5);\r
- dao.put(train);\r
- list = dao.search();\r
- }\r
- return list;\r
- }\r
- \r
- public int filter(String text) {\r
- if (keywords == null) {\r
- keywords = new ArrayList<String>();\r
- keywords.add("\92x\89\84");\r
- keywords.add("\92x\82ê");\r
- keywords.add("\90U\82è\91Ö\82¦");\r
- keywords.add("\90U\91Ö");\r
- keywords.add("\92â\8e~");\r
- keywords.add("\8e\96\8cÌ");\r
- }\r
-\r
- int count = 0;\r
- for (String keyword : keywords) {\r
- if (text.indexOf(keyword) >= 0) {\r
- count++;\r
- }\r
- }\r
- return count;\r
- }\r
- \r
- public long getSearchPeriod(){\r
- if (searchPeriod <= 0){\r
- KeyValueDao dao = KeyValueDao.getInstance();\r
- searchPeriod = dao.getInt(KeyValueDao.KEY_SEARCH_PERIOD, 5);\r
- }\r
- return searchPeriod;\r
- }\r
- \r
- public long getTwitPeriod(){\r
- if (twitPeriod <= 0){\r
- KeyValueDao dao = KeyValueDao.getInstance();\r
- twitPeriod = dao.getInt(KeyValueDao.KEY_TWIT_PERIOD, 5);\r
- }\r
- return twitPeriod;\r
- }\r
- \r
- private long getTwitTime(long id){\r
- String key = KeyValueDao.KEY_TWIT_TIME + id;\r
- Long value = (long)twitTimeList.get(key);\r
- if (value == null){\r
- value = 0L;\r
- twitTimeList.put(key, value);\r
- }\r
- return value;\r
- }\r
- \r
- private void setTwitTime(long id, long value){\r
- String key = KeyValueDao.KEY_TWIT_TIME + id;\r
- twitTimeList.put(key, value);\r
- }\r
-}\r
+++ /dev/null
-package com.yuji.tdb.twitter;\r
-\r
-import java.text.DateFormat;\r
-import java.text.SimpleDateFormat;\r
-import java.util.ArrayList;\r
-import java.util.Calendar;\r
-import java.util.Date;\r
-import java.util.HashMap;\r
-import java.util.List;\r
-import java.util.Map;\r
-import java.util.TimeZone;\r
-import java.util.logging.Logger;\r
-\r
-import twitter4j.Query;\r
-import twitter4j.QueryResult;\r
-import twitter4j.Status;\r
-import twitter4j.Tweet;\r
-import twitter4j.Twitter;\r
-import twitter4j.TwitterException;\r
-import twitter4j.TwitterFactory;\r
-import twitter4j.auth.AccessToken;\r
-import twitter4j.conf.ConfigurationBuilder;\r
-\r
-import com.yuji.tdb.common.CommonUtil;\r
-import com.yuji.tdb.db.KeyValueDao;\r
-import com.yuji.tdb.db.Train;\r
-import com.yuji.tdb.db.TrainDao;\r
-import com.yuji.tdb.debug.Debug;\r
-import com.yuji.tdb.utility.StringUtility;\r
-\r
-public class TwitterUtil {\r
- private static final Logger log = Logger\r
- .getLogger(TwitterUtil.class.getName());\r
- private static TwitterUtil instance = null;\r
- private static Object obj = new Object();\r
- //private DateFormat df = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");\r
- private DateFormat df = new SimpleDateFormat("HH:mm");\r
- private static List<String> keywords = null;\r
- private long searchPeriod = 0;\r
- private long twitPeriod = 0;\r
- private Map<String, Long> twitTimeList = new HashMap<String, Long>();\r
- \r
- public static TwitterUtil getInstance() {\r
- if (instance == null) {\r
- synchronized (obj) {\r
- if (instance == null) {\r
- instance = new TwitterUtil();\r
- }\r
- }\r
- }\r
- return instance;\r
- }\r
-\r
- private TwitterUtil() {\r
- df.setTimeZone(TimeZone.getTimeZone("JST")); \r
- }\r
-\r
- public void main(String consumerKey, String consumerSecret, AccessToken accessToken) {\r
- try {\r
- ConfigurationBuilder confBuilder = new ConfigurationBuilder();\r
- confBuilder.setDebugEnabled(true).setOAuthConsumerKey(consumerKey)\r
- .setOAuthConsumerSecret(consumerSecret);\r
- TwitterFactory factory = new TwitterFactory(confBuilder.build());\r
- Twitter twitter = factory.getInstance(accessToken);\r
-\r
- List<Train> list = getTrainList();\r
- for (Train train : list){\r
- Calendar cal = Calendar.getInstance();\r
- Date date = cal.getTime();\r
- long cur = date.getTime();\r
-\r
- long id = train.getId();\r
- long t = getTwitTime(id);\r
- long period = getTwitPeriod();\r
-\r
- if (t > 0 && t + period * 60 * 1000 < cur){\r
- continue;\r
- }\r
- twite(twitter, train);\r
- }\r
- } catch (TwitterException e) {\r
- // TODO Auto-generated catch block\r
- e.printStackTrace();\r
- log.severe(e.toString());\r
- }\r
- }\r
-\r
- private void twite(Twitter twitter, Train train) throws TwitterException {\r
- Query query = new Query();\r
- //query.setRpp(1000); // TODO\r
- query.setQuery(train.getSearchWord());\r
- QueryResult result = null;\r
- try {\r
- result = twitter.search(query);\r
- }\r
- catch (TwitterException e){\r
- log.severe("" + Debug.getLineNo());\r
- throw e;\r
- }\r
- List<Tweet> tweets = result.getTweets();\r
- \r
- Calendar cal = Calendar.getInstance();\r
- Date date = cal.getTime();\r
- long cur = date.getTime();\r
-\r
- int count = 0;\r
- int hit = 0;\r
- int mhit = 0;\r
- long period = getSearchPeriod();\r
- long id = train.getId();\r
- \r
- int index;\r
- int mindex = 0;\r
- int size = tweets.size();\r
- for (index = 0; index < size; index++) {\r
- Tweet tweet = tweets.get(index);\r
- \r
- Date at = tweet.getCreatedAt();\r
- long t = at.getTime();\r
- \r
- String message = tweet.getText();\r
- \r
- if (t < cur - period * 60 * 1000){\r
- System.out.println("\81~" + tweet.getFromUser() + " - "\r
- + tweet.getText() + at);\r
- continue;\r
- }\r
- hit = filter(message);\r
- if (hit <= 0) {\r
- System.out.println("\81¢" + tweet.getFromUser() + " - "\r
- + tweet.getText() + at);\r
- // \92x\89\84\88È\8aO\82Ì\8f\91\82«\8d\9e\82Ý\r
- continue;\r
- }\r
- if (hit > mhit){\r
- hit = mhit;\r
- mindex = index;\r
- }\r
-\r
- System.out.println("@" + tweet.getFromUser() + " - "\r
- + tweet.getText() + at);\r
- count++;\r
- }\r
-\r
- String message = "[" + train.getName() + "] ";\r
- if (count < train.getCount()){\r
- message += df.format(date) + " \92x\89\84\82È\82µ"; \r
- }\r
- else {\r
- int N = 100;\r
- \r
- String sample = tweets.get(mindex).getText();\r
- sample = CommonUtil.replaceString(sample, "@", "(a)");\r
- sample = StringUtility.parseSubstring(sample, N);\r
- message += df.format(date) + " " + sample + " count=" + count; \r
- }\r
- System.out.println(message); //TODO\r
- \r
- Status status = null;\r
- try {\r
- status = twitter.updateStatus(message); //TODO\r
- setTwitTime(id, cur);\r
- }\r
- catch (TwitterException e){\r
- log.severe(Debug.getLineNo() + " " + message);\r
- log.severe(Debug.getLineNo() + " " + status);\r
- throw e;\r
- }\r
- }\r
- \r
- private List<Train> getTrainList(){\r
- TrainDao dao = TrainDao.getInstance();\r
- List<Train> list = dao.search();\r
- if (list.size() <= 0){\r
- Train train;\r
- \r
- train = new Train("\8b\9e\95l\93\8c\96k\90ü", "\8b\9e\95l\93\8c\96k", 5);\r
- dao.put(train);\r
- train = new Train("\93\8c\8aC\93¹\90ü", "\93\8c\8aC\93¹", 5);\r
- dao.put(train);\r
- train = new Train("\8b\9e\95l\8b}\8ds\90ü", "\8b\9e\8b}", 5);\r
- dao.put(train);\r
- list = dao.search();\r
- }\r
- return list;\r
- }\r
- \r
- public int filter(String text) {\r
- if (keywords == null) {\r
- keywords = new ArrayList<String>();\r
- keywords.add("\92x\89\84");\r
- keywords.add("\92x\82ê");\r
- keywords.add("\90U\82è\91Ö\82¦");\r
- keywords.add("\90U\91Ö");\r
- keywords.add("\92â\8e~");\r
- keywords.add("\8e\96\8cÌ");\r
- }\r
-\r
- int count = 0;\r
- for (String keyword : keywords) {\r
- if (text.indexOf(keyword) >= 0) {\r
- count++;\r
- }\r
- }\r
- return count;\r
- }\r
- \r
- public long getSearchPeriod(){\r
- if (searchPeriod <= 0){\r
- KeyValueDao dao = KeyValueDao.getInstance();\r
- searchPeriod = dao.getInt(KeyValueDao.KEY_SEARCH_PERIOD, 5);\r
- }\r
- return searchPeriod;\r
- }\r
- \r
- public long getTwitPeriod(){\r
- if (twitPeriod <= 0){\r
- KeyValueDao dao = KeyValueDao.getInstance();\r
- twitPeriod = dao.getInt(KeyValueDao.KEY_TWIT_PERIOD, 5);\r
- }\r
- return twitPeriod;\r
- }\r
- \r
- private long getTwitTime(long id){\r
- String key = KeyValueDao.KEY_TWIT_TIME + id;\r
- Long value = twitTimeList.get(key);\r
- if (value == null){\r
- value = 0L;\r
- twitTimeList.put(key, value);\r
- }\r
- return value;\r
- }\r
- \r
- private void setTwitTime(long id, long value){\r
- String key = KeyValueDao.KEY_TWIT_TIME + id;\r
- twitTimeList.put(key, value);\r
- }\r
-}\r
+++ /dev/null
-package com.yuji.tdb.twitter;\r
-\r
-import java.text.DateFormat;\r
-import java.text.SimpleDateFormat;\r
-import java.util.ArrayList;\r
-import java.util.Calendar;\r
-import java.util.Date;\r
-import java.util.HashMap;\r
-import java.util.List;\r
-import java.util.Map;\r
-import java.util.TimeZone;\r
-import java.util.logging.Logger;\r
-\r
-import twitter4j.Query;\r
-import twitter4j.QueryResult;\r
-import twitter4j.Status;\r
-import twitter4j.Tweet;\r
-import twitter4j.Twitter;\r
-import twitter4j.TwitterException;\r
-import twitter4j.TwitterFactory;\r
-import twitter4j.auth.AccessToken;\r
-import twitter4j.conf.ConfigurationBuilder;\r
-\r
-import com.yuji.tdb.common.CommonUtil;\r
-import com.yuji.tdb.db.KeyValueDao;\r
-import com.yuji.tdb.db.Train;\r
-import com.yuji.tdb.db.TrainDao;\r
-import com.yuji.tdb.debug.Debug;\r
-import com.yuji.tdb.utility.StringUtility;\r
-\r
-public class TwitterUtil {\r
- private static final Logger log = Logger\r
- .getLogger(TwitterUtil.class.getName());\r
- private static TwitterUtil instance = null;\r
- private static Object obj = new Object();\r
- //private DateFormat df = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");\r
- private DateFormat df = new SimpleDateFormat("HH:mm");\r
- private static List<String> keywords = null;\r
- private long searchPeriod = 0;\r
- private long twitPeriod = 0;\r
- private Map<String, Long> twitTimeList = new HashMap<String, Long>();\r
- \r
- public static TwitterUtil getInstance() {\r
- if (instance == null) {\r
- synchronized (obj) {\r
- if (instance == null) {\r
- instance = new TwitterUtil();\r
- }\r
- }\r
- }\r
- return instance;\r
- }\r
-\r
- private TwitterUtil() {\r
- df.setTimeZone(TimeZone.getTimeZone("JST")); \r
- }\r
-\r
- public void main(String consumerKey, String consumerSecret, AccessToken accessToken) {\r
- try {\r
- ConfigurationBuilder confBuilder = new ConfigurationBuilder();\r
- confBuilder.setDebugEnabled(true).setOAuthConsumerKey(consumerKey)\r
- .setOAuthConsumerSecret(consumerSecret);\r
- TwitterFactory factory = new TwitterFactory(confBuilder.build());\r
- Twitter twitter = factory.getInstance(accessToken);\r
-\r
- List<Train> list = getTrainList();\r
- for (Train train : list){\r
- Calendar cal = Calendar.getInstance();\r
- Date date = cal.getTime();\r
- long cur = date.getTime();\r
-\r
- long id = train.getId();\r
- long t = getTwitTime(id);\r
- long period = getTwitPeriod();\r
-\r
- if (t > 0 && cur < t + period * 60 * 1000){\r
- continue;\r
- }\r
- twite(twitter, train);\r
- }\r
- } catch (TwitterException e) {\r
- // TODO Auto-generated catch block\r
- e.printStackTrace();\r
- log.severe(e.toString());\r
- }\r
- }\r
-\r
- private void twite(Twitter twitter, Train train) throws TwitterException {\r
- Query query = new Query();\r
- //query.setRpp(1000); // TODO\r
- query.setQuery(train.getSearchWord());\r
- QueryResult result = null;\r
- try {\r
- result = twitter.search(query);\r
- }\r
- catch (TwitterException e){\r
- log.severe("" + Debug.getLineNo());\r
- throw e;\r
- }\r
- List<Tweet> tweets = result.getTweets();\r
- \r
- Calendar cal = Calendar.getInstance();\r
- Date date = cal.getTime();\r
- long cur = date.getTime();\r
-\r
- int count = 0;\r
- int hit = 0;\r
- int mhit = 0;\r
- long period = getSearchPeriod();\r
- long id = train.getId();\r
- \r
- int index;\r
- int mindex = 0;\r
- int size = tweets.size();\r
- for (index = 0; index < size; index++) {\r
- Tweet tweet = tweets.get(index);\r
- \r
- Date at = tweet.getCreatedAt();\r
- long t = at.getTime();\r
- \r
- String message = tweet.getText();\r
- \r
- if (t < cur - period * 60 * 1000){\r
- System.out.println("\81~" + tweet.getFromUser() + " - "\r
- + tweet.getText() + at);\r
- continue;\r
- }\r
- hit = filter(message);\r
- if (hit <= 0) {\r
- System.out.println("\81¢" + tweet.getFromUser() + " - "\r
- + tweet.getText() + at);\r
- // \92x\89\84\88È\8aO\82Ì\8f\91\82«\8d\9e\82Ý\r
- continue;\r
- }\r
- if (hit > mhit){\r
- hit = mhit;\r
- mindex = index;\r
- }\r
-\r
- System.out.println("@" + tweet.getFromUser() + " - "\r
- + tweet.getText() + at);\r
- count++;\r
- }\r
-\r
- String message = "[" + train.getName() + "] ";\r
- if (count < train.getCount()){\r
- message += df.format(date) + " \92x\89\84\82È\82µ"; \r
- }\r
- else {\r
- int N = 100;\r
- \r
- String sample = tweets.get(mindex).getText();\r
- sample = CommonUtil.replaceString(sample, "@", "(a)");\r
- sample = StringUtility.parseSubstring(sample, N);\r
- message += df.format(date) + " " + sample + " count=" + count; \r
- }\r
- System.out.println(message); //TODO\r
- \r
- Status status = null;\r
- try {\r
- status = twitter.updateStatus(message); //TODO\r
- setTwitTime(id, cur);\r
- }\r
- catch (TwitterException e){\r
- log.severe(Debug.getLineNo() + " " + message);\r
- log.severe(Debug.getLineNo() + " " + status);\r
- throw e;\r
- }\r
- }\r
- \r
- private List<Train> getTrainList(){\r
- TrainDao dao = TrainDao.getInstance();\r
- List<Train> list = dao.search();\r
- if (list.size() <= 0){\r
- Train train;\r
- \r
- train = new Train("\8b\9e\95l\93\8c\96k\90ü", "\8b\9e\95l\93\8c\96k", 5);\r
- dao.put(train);\r
- train = new Train("\93\8c\8aC\93¹\90ü", "\93\8c\8aC\93¹", 5);\r
- dao.put(train);\r
- train = new Train("\8b\9e\95l\8b}\8ds\90ü", "\8b\9e\8b}", 5);\r
- dao.put(train);\r
- list = dao.search();\r
- }\r
- return list;\r
- }\r
- \r
- public int filter(String text) {\r
- if (keywords == null) {\r
- keywords = new ArrayList<String>();\r
- keywords.add("\92x\89\84");\r
- keywords.add("\92x\82ê");\r
- keywords.add("\90U\82è\91Ö\82¦");\r
- keywords.add("\90U\91Ö");\r
- keywords.add("\92â\8e~");\r
- keywords.add("\8e\96\8cÌ");\r
- }\r
-\r
- int count = 0;\r
- for (String keyword : keywords) {\r
- if (text.indexOf(keyword) >= 0) {\r
- count++;\r
- }\r
- }\r
- return count;\r
- }\r
- \r
- public long getSearchPeriod(){\r
- if (searchPeriod <= 0){\r
- KeyValueDao dao = KeyValueDao.getInstance();\r
- searchPeriod = dao.getInt(KeyValueDao.KEY_SEARCH_PERIOD, 5);\r
- }\r
- return searchPeriod;\r
- }\r
- \r
- public long getTwitPeriod(){\r
- if (twitPeriod <= 0){\r
- KeyValueDao dao = KeyValueDao.getInstance();\r
- twitPeriod = dao.getInt(KeyValueDao.KEY_TWIT_PERIOD, 60);\r
- }\r
- return twitPeriod;\r
- }\r
- \r
- private long getTwitTime(long id){\r
- String key = KeyValueDao.KEY_TWIT_TIME + id;\r
- Long value = twitTimeList.get(key);\r
- if (value == null){\r
- value = 0L;\r
- setTwitTime(id, value);\r
- }\r
- return value;\r
- }\r
- \r
- private void setTwitTime(long id, long value){\r
- String key = KeyValueDao.KEY_TWIT_TIME + id;\r
- twitTimeList.put(key, value);\r
- KeyValueDao dao = KeyValueDao.getInstance();\r
- dao.put(key, String.valueOf(value));\r
- }\r
-}\r
+++ /dev/null
-package com.yuji.tdb;
-
-public class Debug {
-
-}
+++ /dev/null
-package com.yuji.tdb.twitter;\r
-\r
-import java.text.DateFormat;\r
-import java.text.SimpleDateFormat;\r
-import java.util.ArrayList;\r
-import java.util.Calendar;\r
-import java.util.Date;\r
-import java.util.HashMap;\r
-import java.util.List;\r
-import java.util.Map;\r
-import java.util.TimeZone;\r
-import java.util.logging.Logger;\r
-\r
-import twitter4j.Query;\r
-import twitter4j.QueryResult;\r
-import twitter4j.Status;\r
-import twitter4j.Tweet;\r
-import twitter4j.Twitter;\r
-import twitter4j.TwitterException;\r
-import twitter4j.TwitterFactory;\r
-import twitter4j.auth.AccessToken;\r
-import twitter4j.conf.ConfigurationBuilder;\r
-\r
-import com.yuji.tdb.common.CommonUtil;\r
-import com.yuji.tdb.db.KeyValueDao;\r
-import com.yuji.tdb.db.Train;\r
-import com.yuji.tdb.db.TrainDao;\r
-import com.yuji.tdb.debug.Debug;\r
-import com.yuji.tdb.utility.StringUtility;\r
-\r
-public class TwitterUtil {\r
- private static final Logger log = Logger\r
- .getLogger(TwitterUtil.class.getName());\r
- private static TwitterUtil instance = null;\r
- private static Object obj = new Object();\r
- //private DateFormat df = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");\r
- private DateFormat df = new SimpleDateFormat("HH:mm");\r
- private static List<String> keywords = null;\r
- private long searchPeriod = 0;\r
- private long twitPeriod = 0;\r
- private Map<String, Long> twitTimeList = new HashMap<String, Long>();\r
- \r
- public static TwitterUtil getInstance() {\r
- if (instance == null) {\r
- synchronized (obj) {\r
- if (instance == null) {\r
- instance = new TwitterUtil();\r
- }\r
- }\r
- }\r
- return instance;\r
- }\r
-\r
- private TwitterUtil() {\r
- df.setTimeZone(TimeZone.getTimeZone("JST")); \r
- }\r
-\r
- public void main(String consumerKey, String consumerSecret, AccessToken accessToken) {\r
- try {\r
- ConfigurationBuilder confBuilder = new ConfigurationBuilder();\r
- confBuilder.setDebugEnabled(true).setOAuthConsumerKey(consumerKey)\r
- .setOAuthConsumerSecret(consumerSecret);\r
- TwitterFactory factory = new TwitterFactory(confBuilder.build());\r
- Twitter twitter = factory.getInstance(accessToken);\r
-\r
- List<Train> list = getTrainList();\r
- for (Train train : list){\r
- Calendar cal = Calendar.getInstance();\r
- Date date = cal.getTime();\r
- long cur = date.getTime();\r
-\r
- long id = train.getId();\r
- long t = getTwitTime(id);\r
- long period = getTwitPeriod();\r
- \r
- if (t > 0 && t + period < cur){\r
- continue;\r
- }\r
- twite(twitter, train);\r
- }\r
- } catch (TwitterException e) {\r
- // TODO Auto-generated catch block\r
- e.printStackTrace();\r
- log.severe(e.toString());\r
- }\r
- }\r
-\r
- private void twite(Twitter twitter, Train train) throws TwitterException {\r
- Query query = new Query();\r
- //query.setRpp(1000); // TODO\r
- query.setQuery(train.getSearchWord());\r
- QueryResult result = null;\r
- try {\r
- result = twitter.search(query);\r
- }\r
- catch (TwitterException e){\r
- log.severe("" + Debug.getLineNo());\r
- throw e;\r
- }\r
- List<Tweet> tweets = result.getTweets();\r
- \r
- Calendar cal = Calendar.getInstance();\r
- Date date = cal.getTime();\r
- long cur = date.getTime();\r
-\r
- int count = 0;\r
- int hit = 0;\r
- int mhit = 0;\r
- long period = getSearchPeriod();\r
- long id = train.getId();\r
- \r
- int index;\r
- int mindex = 0;\r
- int size = tweets.size();\r
- for (index = 0; index < size; index++) {\r
- Tweet tweet = tweets.get(index);\r
- \r
- Date at = tweet.getCreatedAt();\r
- long t = at.getTime();\r
- \r
- String message = tweet.getText();\r
- \r
- if (t < cur - period * 60 * 1000){\r
- System.out.println("\81~" + tweet.getFromUser() + " - "\r
- + tweet.getText() + at);\r
- continue;\r
- }\r
- hit = filter(message);\r
- if (hit <= 0) {\r
- System.out.println("\81¢" + tweet.getFromUser() + " - "\r
- + tweet.getText() + at);\r
- // \92x\89\84\88È\8aO\82Ì\8f\91\82«\8d\9e\82Ý\r
- continue;\r
- }\r
- if (hit > mhit){\r
- hit = mhit;\r
- mindex = index;\r
- }\r
-\r
- System.out.println("@" + tweet.getFromUser() + " - "\r
- + tweet.getText() + at);\r
- count++;\r
- }\r
-\r
- String message = "[" + train.getName() + "] ";\r
- if (count < train.getCount()){\r
- message += df.format(date) + " \92x\89\84\82È\82µ"; \r
- }\r
- else {\r
- int N = 100;\r
- \r
- String sample = tweets.get(mindex).getText();\r
- sample = CommonUtil.replaceString(sample, "@", "(a)");\r
- sample = StringUtility.parseSubstring(sample, N);\r
- message += df.format(date) + " " + sample + " count=" + count; \r
- }\r
- System.out.println(message); //TODO\r
- \r
- Status status = null;\r
- try {\r
- status = twitter.updateStatus(message); //TODO\r
- setTwitTime(id, cur);\r
- }\r
- catch (TwitterException e){\r
- log.severe(Debug.getLineNo() + " " + message);\r
- log.severe(Debug.getLineNo() + " " + status);\r
- throw e;\r
- }\r
- }\r
- \r
- private List<Train> getTrainList(){\r
- TrainDao dao = TrainDao.getInstance();\r
- List<Train> list = dao.search();\r
- if (list.size() <= 0){\r
- Train train;\r
- \r
- train = new Train("\8b\9e\95l\93\8c\96k\90ü", "\8b\9e\95l\93\8c\96k", 5);\r
- dao.put(train);\r
- train = new Train("\93\8c\8aC\93¹\90ü", "\93\8c\8aC\93¹", 5);\r
- dao.put(train);\r
- train = new Train("\8b\9e\95l\8b}\8ds\90ü", "\8b\9e\8b}", 5);\r
- dao.put(train);\r
- list = dao.search();\r
- }\r
- return list;\r
- }\r
- \r
- public int filter(String text) {\r
- if (keywords == null) {\r
- keywords = new ArrayList<String>();\r
- keywords.add("\92x\89\84");\r
- keywords.add("\92x\82ê");\r
- keywords.add("\90U\82è\91Ö\82¦");\r
- keywords.add("\90U\91Ö");\r
- keywords.add("\92â\8e~");\r
- keywords.add("\8e\96\8cÌ");\r
- }\r
-\r
- int count = 0;\r
- for (String keyword : keywords) {\r
- if (text.indexOf(keyword) >= 0) {\r
- count++;\r
- }\r
- }\r
- return count;\r
- }\r
- \r
- public long getSearchPeriod(){\r
- if (searchPeriod <= 0){\r
- KeyValueDao dao = KeyValueDao.getInstance();\r
- searchPeriod = dao.getInt(KeyValueDao.KEY_SEARCH_PERIOD, 5);\r
- }\r
- return searchPeriod;\r
- }\r
- \r
- public long getTwitPeriod(){\r
- if (twitPeriod <= 0){\r
- KeyValueDao dao = KeyValueDao.getInstance();\r
- twitPeriod = dao.getInt(KeyValueDao.KEY_TWIT_PERIOD, 5);\r
- }\r
- return twitPeriod;\r
- }\r
- \r
- private long getTwitTime(long id){\r
- String key = KeyValueDao.KEY_TWIT_TIME + id;\r
- Long value = twitTimeList.get(key);\r
- if (value == null){\r
- value = 0L;\r
- twitTimeList.put(key, value);\r
- }\r
- return value;\r
- }\r
- \r
- private void setTwitTime(long id, long value){\r
- String key = KeyValueDao.KEY_TWIT_TIME + id;\r
- twitTimeList.put(key, value);\r
- }\r
-}\r
+++ /dev/null
-package com.yuji.tdb.db;\r
-\r
-import javax.jdo.PersistenceManager;\r
-\r
-public class KeyValueDao {\r
- public static final String KEY_CONSUMER_KEY = "CONSUMER_KEY";\r
- public static final String KEY_CONSUMER_SECRET = "CONSUMER_SECRET";\r
- public static final String KEY_REQUEST_TOKEN = "REQUEST_TOKEN";\r
- public static final String KEY_REQUEST_TOKEN_SECRET = "REQUEST_TOKEN_SECRET";\r
- public static final String KEY_ACCESS_TOKEN = "ACCESS_TOKEN";\r
- public static final String KEY_ACCESS_TOKEN_SECRET = "ACCESS_TOKEN_SECRET";\r
-\r
- public static final String KEY_SEARCH_PERIOD = "SEARCH_PERIOD";\r
-\r
- private static KeyValueDao instance = null;\r
- private PersistenceManager pm = PMFactory.get().getPersistenceManager();\r
- \r
- public static KeyValueDao getInstance(){\r
- if (instance == null){\r
- instance = new KeyValueDao();\r
- }\r
- return instance;\r
- }\r
- \r
- private KeyValueDao(){\r
- \r
- }\r
- \r
- public String get(String key){\r
- KeyValue keyValue = pm.getObjectById(KeyValue.class, key);\r
- if (keyValue == null){\r
- return null;\r
- }\r
- return keyValue.getValue();\r
- }\r
- \r
- public int getInt(String key){\r
- String value = get(key);\r
- return Integer.valueOf(value).intValue();\r
- }\r
- \r
- public void put(String key, String value){\r
- KeyValue keyValue = new KeyValue(key, value);\r
- pm.makePersistent(keyValue);\r
- }\r
-\r
- public void put(String key, int value){\r
- put(key, String.valueOf(value));\r
- }\r
-\r
- public String get(String key, String initValue){\r
- String value = get(key);\r
- if (value == null){\r
- put(key, initValue);\r
- value = initValue;\r
- }\r
- return value;\r
- }\r
-\r
- public int getInt(String key, int initValue){\r
- String value = get(key);\r
- if (value == null){\r
- putInt(key, initValue);\r
- }\r
- return Integer.valueOf(value).intValue();\r
- }\r
-}\r
-#Sat Mar 24 16:23:50 JST 2012
-org.eclipse.epp.usagedata.recording.last-upload=1332573830805
+#Mon Apr 09 19:40:36 JST 2012
+org.eclipse.epp.usagedata.recording.last-upload=1333968036001
eclipse.preferences.version=1
what,kind,bundleId,bundleVersion,description,time
-started,bundle,org.eclipse.m2e.logback.configuration,1.0.0.20110607-2117,"org.eclipse.m2e.logback.configuration",1332573829038
-started,bundle,org.eclipse.mylyn.bugzilla.core,3.6.0.v20110608-1400,"org.eclipse.mylyn.bugzilla.core",1332573829038
-started,bundle,org.eclipse.mylyn.bugzilla.ui,3.6.0.v20110608-1400,"org.eclipse.mylyn.bugzilla.ui",1332573829038
-started,bundle,org.eclipse.mylyn.commons.identity,0.8.0.v20110608-1400,"org.eclipse.mylyn.commons.identity",1332573829038
-started,bundle,org.eclipse.mylyn.commons.net,3.6.0.v20110608-1400,"org.eclipse.mylyn.commons.net",1332573829038
-started,bundle,org.eclipse.mylyn.context.core,3.6.0.v20110608-1400,"org.eclipse.mylyn.context.core",1332573829038
-started,bundle,org.eclipse.mylyn.context.ui,3.6.0.v20110608-1400,"org.eclipse.mylyn.context.ui",1332573829038
-started,bundle,org.eclipse.mylyn.monitor.ui,3.6.0.v20110608-1400,"org.eclipse.mylyn.monitor.ui",1332573829044
-started,bundle,org.eclipse.mylyn.tasks.ui,3.6.0.v20110608-1400,"org.eclipse.mylyn.tasks.ui",1332573829093
-started,bundle,org.eclipse.mylyn.team.ui,3.6.0.v20110608-1400,"org.eclipse.mylyn.team.ui",1332573829103
-started,bundle,org.eclipse.search,3.7.0.v20110505-0800,"org.eclipse.search",1332573829146
-started,bundle,org.eclipse.team.core,3.6.0.I20110525-0800,"org.eclipse.team.core",1332573829158
-started,bundle,org.eclipse.team.cvs.core,3.3.400.I20110510-0800,"org.eclipse.team.cvs.core",1332573829169
-started,bundle,org.eclipse.team.cvs.ui,3.3.400.I20110510-0800,"org.eclipse.team.cvs.ui",1332573829207
-started,bundle,org.eclipse.team.ui,3.6.100.I20110525-0800,"org.eclipse.team.ui",1332573829253
-started,bundle,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui",1332573829270
-started,bundle,org.eclipse.ui.console,3.5.100.v20110511,"org.eclipse.ui.console",1332573829331
-started,bundle,org.eclipse.ui.editors,3.7.0.v20110517-0800,"org.eclipse.ui.editors",1332573829331
-started,bundle,org.eclipse.ui.forms,3.5.100.v20110425,"org.eclipse.ui.forms",1332573829346
-started,bundle,org.eclipse.ui.ide,3.7.0.I20110519-0100,"org.eclipse.ui.ide",1332573829373
-started,bundle,org.eclipse.ui.net,1.2.100.I20110511-0800,"org.eclipse.ui.net",1332573829400
-started,bundle,org.eclipse.ui.views,3.6.0.I20110412-0800,"org.eclipse.ui.views",1332573829402
-started,bundle,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"org.eclipse.ui.workbench",1332573829417
-started,bundle,org.eclipse.ui.workbench.texteditor,3.7.0.v20110505-0800,"org.eclipse.ui.workbench.texteditor",1332573829429
-started,bundle,org.eclipse.update.configurator,3.3.100.v20100512,"org.eclipse.update.configurator",1332573829430
-started,bundle,org.eclipse.update.core,3.2.500.v20110330,"org.eclipse.update.core",1332573829461
-started,bundle,com.google.appengine.eclipse.core,2.5.2.v201202290255-rel-r37,"com.google.appengine.eclipse.core",1332573829462
-started,bundle,com.google.gdt.eclipse.appengine.rpc,2.5.2.v201202290255-rel-r37,"com.google.gdt.eclipse.appengine.rpc",1332573829479
-started,bundle,com.google.gdt.eclipse.core,2.5.2.v201202290255-rel-r37,"com.google.gdt.eclipse.core",1332573829479
-started,bundle,com.google.gdt.eclipse.designer,2.5.0.r37x201112291029,"com.google.gdt.eclipse.designer",1332573829519
-started,bundle,com.google.gdt.eclipse.login,2.5.2.v201202290255-rel-r37,"com.google.gdt.eclipse.login",1332573829519
-started,bundle,com.google.gdt.eclipse.managedapis,2.5.2.v201202290255-rel-r37,"com.google.gdt.eclipse.managedapis",1332573829520
-started,bundle,com.google.gdt.eclipse.platform.e37,2.5.2.v201202290255-rel-r37,"com.google.gdt.eclipse.platform.e37",1332573829546
-started,bundle,com.google.gdt.eclipse.platform.shared,2.5.2.v201202290255-rel-r37,"com.google.gdt.eclipse.platform.shared",1332573829547
-started,bundle,com.google.gdt.eclipse.suite.ext,2.5.2.v201202290255-rel-r37,"com.google.gdt.eclipse.suite.ext",1332573829547
-started,bundle,com.google.gwt.eclipse.core,2.5.2.v201202290255-rel-r37,"com.google.gwt.eclipse.core",1332573829615
-started,bundle,org.eclipse.mylyn.commons.ui,3.6.1.v20110720-0100,"org.eclipse.mylyn.commons.ui",1332573829635
-started,bundle,org.eclipse.wb.core,1.2.0.r37x201112290923,"org.eclipse.wb.core",1332573829672
-started,bundle,org.eclipse.wb.core.lib,1.2.0.r37x201112290923,"org.eclipse.wb.core.lib",1332573829714
-os,sysinfo,,,"macosx",1332573829718
-arch,sysinfo,,,"x86_64",1332573829718
-ws,sysinfo,,,"cocoa",1332573829718
-locale,sysinfo,,,"ja_JP",1332573829718
-processors,sysinfo,,,"8",1332573829718
-java.runtime.name,sysinfo,,,"Java(TM) SE Runtime Environment",1332573829718
-java.runtime.version,sysinfo,,,"1.6.0_29-b11-402-11D50d",1332573829718
-java.specification.name,sysinfo,,,"Java Platform API Specification",1332573829718
-java.specification.vendor,sysinfo,,,"Sun Microsystems Inc.",1332573829718
-java.specification.version,sysinfo,,,"1.6",1332573829718
-java.vendor,sysinfo,,,"Apple Inc.",1332573829718
-java.version,sysinfo,,,"1.6.0_29",1332573829718
-java.vm.info,sysinfo,,,"mixed mode",1332573829718
-java.vm.name,sysinfo,,,"Java HotSpot(TM) 64-Bit Server VM",1332573829718
-java.vm.specification.name,sysinfo,,,"Java Virtual Machine Specification",1332573829718
-java.vm.specification.vendor,sysinfo,,,"Sun Microsystems Inc.",1332573829718
-java.vm.specification.version,sysinfo,,,"1.0",1332573829718
-java.vm.vendor,sysinfo,,,"Apple Inc.",1332573829718
-java.vm.version,sysinfo,,,"20.4-b02-402",1332573829718
-started,bundle,org.eclipse.m2e.usagedata,1.0.200.20111228-1245,"org.eclipse.m2e.usagedata",1332573829756
-started,bundle,org.eclipse.update.scheduler,3.2.300.v20100512,"org.eclipse.update.scheduler",1332573830102
-started,bundle,org.eclipse.wb.discovery.core,1.0.0.r37x201106081733,"org.eclipse.wb.discovery.core",1332573830291
-started,bundle,org.eclipse.epp.usagedata.ui,1.3.1.R201106061540,"org.eclipse.epp.usagedata.ui",1332573830805
-deactivated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1332573831572
-started,bundle,org.eclipse.wb.discovery.ui,1.0.0.r37x201106081733,"org.eclipse.wb.discovery.ui",1332573832131
-started,bundle,com.google.gdt.eclipse.designer.hosted,2.5.0.r37x201112291019,"com.google.gdt.eclipse.designer.hosted",1332573832286
-started,bundle,com.google.gdt.eclipse.designer.UiBinder,2.5.0.r37x201112291029,"com.google.gdt.eclipse.designer.UiBinder",1332573832393
-started,bundle,com.google.gdt.eclipse.maven,2.5.2.v201202290255-rel-r37,"com.google.gdt.eclipse.maven",1332573833867
-started,bundle,com.google.gdt.eclipse.suite,2.5.2.v201202290255-rel-r37,"com.google.gdt.eclipse.suite",1332573833999
-started,bundle,org.eclipse.core.variables,3.2.500.v20110511,"org.eclipse.core.variables",1332573834127
-activated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1332573834292
-activated,view,org.eclipse.jdt.ui,3.7.0.v20110531-1200,"org.eclipse.jdt.ui.PackageExplorer",1332573837605
-opened,editor,org.eclipse.jdt.ui,3.7.0.v20110531-1200,"org.eclipse.jdt.ui.CompilationUnitEditor",1332573847271
-activated,editor,org.eclipse.jdt.ui,3.7.0.v20110531-1200,"org.eclipse.jdt.ui.CompilationUnitEditor",1332573847338
-activated,view,org.eclipse.jdt.ui,3.7.0.v20110531-1200,"org.eclipse.jdt.ui.PackageExplorer",1332573907356
-opened,editor,org.eclipse.jdt.ui,3.7.0.v20110531-1200,"org.eclipse.jdt.ui.CompilationUnitEditor",1332573907837
-activated,editor,org.eclipse.jdt.ui,3.7.0.v20110531-1200,"org.eclipse.jdt.ui.CompilationUnitEditor",1332573907941
-activated,editor,org.eclipse.jdt.ui,3.7.0.v20110531-1200,"org.eclipse.jdt.ui.CompilationUnitEditor",1332573937822
-deactivated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1332574024782
-activated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1332574041790
-deactivated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1332574048836
-activated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1332574051082
-closed,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1332574051322
-started,bundle,org.eclipse.compare,3.5.200.I20110525-0800,"org.eclipse.compare",1332574052289
-stopped,bundle,org.eclipse.m2e.logback.configuration,1.0.0.20110607-2117,"org.eclipse.m2e.logback.configuration",1332574052635
-stopped,bundle,org.eclipse.ui.cheatsheets,3.4.100.v20110425,"org.eclipse.ui.cheatsheets",1332574052636
-stopped,bundle,org.eclipse.help.ui,3.5.100.v20110425,"org.eclipse.help.ui",1332574052636
-stopped,bundle,org.eclipse.help.webapp,3.6.0.v20110518,"org.eclipse.help.webapp",1332574052636
-stopped,bundle,org.eclipse.epp.mpc.ui,1.1.0.I20110525-0742,"org.eclipse.epp.mpc.ui",1332574052636
-stopped,bundle,org.eclipse.epp.usagedata.ui,1.3.1.R201106061540,"org.eclipse.epp.usagedata.ui",1332574052636
-stopped,bundle,org.eclipse.ui.intro.universal,3.2.500.v20110510,"org.eclipse.ui.intro.universal",1332574052636
-stopped,bundle,org.eclipse.ui.intro,3.4.100.v20110425,"org.eclipse.ui.intro",1332574052636
-stopped,bundle,org.eclipse.help.base,3.6.0.v201106131736,"org.eclipse.help.base",1332574052636
-stopped,bundle,org.eclipse.equinox.http.jetty,2.0.100.v20110502,"org.eclipse.equinox.http.jetty",1332574052636
-stopped,bundle,com.google.appengine.eclipse.datatools,2.5.2.v201202290255-rel-r37,"com.google.appengine.eclipse.datatools",1332574052636
-stopped,bundle,com.google.appengine.eclipse.sdkbundle,1.6.3.v201202290255r37,"com.google.appengine.eclipse.sdkbundle",1332574052636
-stopped,bundle,com.google.gdt.eclipse.appengine.rpc,2.5.2.v201202290255-rel-r37,"com.google.gdt.eclipse.appengine.rpc",1332574052637
-stopped,bundle,com.google.gdt.eclipse.gph.e36,2.5.2.v201202290255-rel-r37,"com.google.gdt.eclipse.gph.e36",1332574052637
-stopped,bundle,com.google.gdt.eclipse.gph.hge,2.5.2.v201202290255-rel-r37,"com.google.gdt.eclipse.gph.hge",1332574052637
-stopped,bundle,com.google.gdt.eclipse.gph.subclipse,2.5.2.v201202290255-rel-r37,"com.google.gdt.eclipse.gph.subclipse",1332574052637
-stopped,bundle,com.google.gdt.eclipse.gph.subversive,2.5.2.v201202290255-rel-r37,"com.google.gdt.eclipse.gph.subversive",1332574052637
-stopped,bundle,com.google.gdt.eclipse.suite.ext,2.5.2.v201202290255-rel-r37,"com.google.gdt.eclipse.suite.ext",1332574052637
-stopped,bundle,com.google.gdt.eclipse.gph,2.5.2.v201202290255-rel-r37,"com.google.gdt.eclipse.gph",1332574052637
-stopped,bundle,com.google.gdt.eclipse.maven.e37,2.5.2.v201202290255-rel-r37,"com.google.gdt.eclipse.maven.e37",1332574052637
-stopped,bundle,com.google.gdt.eclipse.maven,2.5.2.v201202290255-rel-r37,"com.google.gdt.eclipse.maven",1332574052637
-stopped,bundle,com.google.gdt.eclipse.suite,2.5.2.v201202290255-rel-r37,"com.google.gdt.eclipse.suite",1332574052638
-stopped,bundle,com.google.gdt.eclipse.appsmarketplace,2.5.2.v201202290255-rel-r37,"com.google.gdt.eclipse.appsmarketplace",1332574052638
-stopped,bundle,com.google.appengine.eclipse.core,2.5.2.v201202290255-rel-r37,"com.google.appengine.eclipse.core",1332574052638
-stopped,bundle,com.google.gdt.eclipse.login,2.5.2.v201202290255-rel-r37,"com.google.gdt.eclipse.login",1332574052638
-stopped,bundle,com.google.gdt.eclipse.managedapis,2.5.2.v201202290255-rel-r37,"com.google.gdt.eclipse.managedapis",1332574052640
-stopped,bundle,com.google.gwt.eclipse.oophm,2.5.2.v201202290255-rel-r37,"com.google.gwt.eclipse.oophm",1332574052640
-stopped,bundle,com.google.gwt.eclipse.sdkbundle,2.4.0.v201202290255-rel-r37,"com.google.gwt.eclipse.sdkbundle",1332574052640
-stopped,bundle,com.google.gwt.eclipse.core,2.5.2.v201202290255-rel-r37,"com.google.gwt.eclipse.core",1332574052787
-stopped,bundle,com.google.gdt.eclipse.core,2.5.2.v201202290255-rel-r37,"com.google.gdt.eclipse.core",1332574052787
-stopped,bundle,com.google.gdt.eclipse.platform,2.5.2.v201202290255-rel-r37,"com.google.gdt.eclipse.platform",1332574052787
-stopped,bundle,com.google.gdt.eclipse.platform.e37,2.5.2.v201202290255-rel-r37,"com.google.gdt.eclipse.platform.e37",1332574052787
-stopped,bundle,org.eclipse.m2e.discovery,1.0.200.20111228-1245,"org.eclipse.m2e.discovery",1332574052788
-stopped,bundle,org.eclipse.m2e.refactoring,1.0.200.20111228-1245,"org.eclipse.m2e.refactoring",1332574052788
-stopped,bundle,org.eclipse.m2e.editor,1.0.200.20111228-1245,"org.eclipse.m2e.editor",1332574052788
-stopped,bundle,org.eclipse.m2e.editor.xml,1.0.200.20111228-1245,"org.eclipse.m2e.editor.xml",1332574052788
-stopped,bundle,org.eclipse.m2e.jdt,1.0.200.20111228-1245,"org.eclipse.m2e.jdt",1332574052788
-stopped,bundle,org.eclipse.m2e.launching,1.0.200.20111228-1245,"org.eclipse.m2e.launching",1332574052788
-stopped,bundle,org.eclipse.m2e.usagedata,1.0.200.20111228-1245,"org.eclipse.m2e.usagedata",1332574052789
-stopped,bundle,org.eclipse.m2e.core.ui,1.0.200.20111228-1245,"org.eclipse.m2e.core.ui",1332574052789
-stopped,bundle,org.eclipse.m2e.core,1.0.200.20111228-1245,"org.eclipse.m2e.core",1332574052789
-stopped,bundle,org.eclipse.mylyn.ide.ant,3.6.0.v20110608-1400,"org.eclipse.mylyn.ide.ant",1332574052789
-stopped,bundle,org.eclipse.ant.ui,3.5.100.v20110510,"org.eclipse.ant.ui",1332574052789
-stopped,bundle,org.eclipse.ant.launching,1.0.100.v20110506,"org.eclipse.ant.launching",1332574052789
-stopped,bundle,org.eclipse.equinox.p2.ui.sdk,1.0.200.v20110502-1955,"org.eclipse.equinox.p2.ui.sdk",1332574052789
-stopped,bundle,org.eclipse.mylyn.java.tasks,3.6.0.v20110608-1400,"org.eclipse.mylyn.java.tasks",1332574052789
-stopped,bundle,org.eclipse.mylyn.java.ui,3.6.0.v20110608-1400,"org.eclipse.mylyn.java.ui",1332574052790
-stopped,bundle,com.google.gdt.eclipse.designer.UiBinder,2.5.0.r37x201112291029,"com.google.gdt.eclipse.designer.UiBinder",1332574052790
-stopped,bundle,com.google.gdt.eclipse.designer.gpe,2.5.0.r37x201201030222,"com.google.gdt.eclipse.designer.gpe",1332574052790
-stopped,bundle,com.google.gdt.eclipse.designer,2.5.0.r37x201112291029,"com.google.gdt.eclipse.designer",1332574052790
-stopped,bundle,org.eclipse.jdt.junit,3.7.0.v20110505-0800,"org.eclipse.jdt.junit",1332574052790
-stopped,bundle,org.eclipse.jdt.apt.ui,3.3.300.v20110305-1450,"org.eclipse.jdt.apt.ui",1332574052790
-stopped,bundle,org.eclipse.jdt.debug.ui,3.6.0.v20110512,"org.eclipse.jdt.debug.ui",1332574052791
-stopped,bundle,com.google.gdt.eclipse.platform.shared,2.5.2.v201202290255-rel-r37,"com.google.gdt.eclipse.platform.shared",1332574052791
-stopped,bundle,org.eclipse.wb.swing.FormLayout,1.0.0.r37x201106081552,"org.eclipse.wb.swing.FormLayout",1332574052791
-stopped,bundle,org.eclipse.wb.swing.MigLayout,1.0.0.r37x201106081552,"org.eclipse.wb.swing.MigLayout",1332574052791
-stopped,bundle,org.eclipse.wb.swing.databinding,1.0.0.r37x201106081552,"org.eclipse.wb.swing.databinding",1332574052791
-stopped,bundle,org.eclipse.wb.swing.java6,1.0.0.r37x201106081552,"org.eclipse.wb.swing.java6",1332574052791
-stopped,bundle,org.eclipse.wb.swing.jsr296,1.0.0.r37x201106081552,"org.eclipse.wb.swing.jsr296",1332574052791
-stopped,bundle,org.eclipse.wb.swing,1.0.0.r37x201106081552,"org.eclipse.wb.swing",1332574052791
-stopped,bundle,org.eclipse.wb.core.ui,1.0.0.r37x201106081733,"org.eclipse.wb.core.ui",1332574052791
-stopped,bundle,org.eclipse.wb.layout.group,1.0.0.r37x201106081642,"org.eclipse.wb.layout.group",1332574052791
-stopped,bundle,com.google.gdt.eclipse.designer.hosted.2_0.webkit,2.5.0.r37x201112291019,"com.google.gdt.eclipse.designer.hosted.2_0.webkit",1332574052791
-stopped,bundle,com.google.gdt.eclipse.designer.hosted.2_0,2.5.0.r37x201112291019,"com.google.gdt.eclipse.designer.hosted.2_0",1332574052791
-stopped,bundle,com.google.gdt.eclipse.designer.hosted.2_2.webkit,2.5.0.r37x201112291019,"com.google.gdt.eclipse.designer.hosted.2_2.webkit",1332574052791
-stopped,bundle,com.google.gdt.eclipse.designer.hosted.2_2,2.5.0.r37x201112291019,"com.google.gdt.eclipse.designer.hosted.2_2",1332574052791
-stopped,bundle,com.google.gdt.eclipse.designer.hosted,2.5.0.r37x201112291019,"com.google.gdt.eclipse.designer.hosted",1332574052791
-stopped,bundle,org.eclipse.wb.core.databinding.xml,1.2.0.r37x201112291009,"org.eclipse.wb.core.databinding.xml",1332574052792
-stopped,bundle,org.eclipse.wb.core.databinding,1.2.0.r37x201112290923,"org.eclipse.wb.core.databinding",1332574052792
-stopped,bundle,org.eclipse.wb.core.xml,1.2.0.r37x201112291009,"org.eclipse.wb.core.xml",1332574052792
-stopped,bundle,org.eclipse.wb.css,1.2.0.r37x201112290951,"org.eclipse.wb.css",1332574052792
-stopped,bundle,org.eclipse.wb.os.macosx,1.2.0.r37x201112290923,"org.eclipse.wb.os.macosx",1332574052792
-stopped,bundle,org.eclipse.wb.core,1.2.0.r37x201112290923,"org.eclipse.wb.core",1332574052792
-stopped,bundle,org.eclipse.jdt.ui,3.7.0.v20110531-1200,"org.eclipse.jdt.ui",1332574052830
-stopped,bundle,org.eclipse.wst.dtd.ui,1.0.600.v201103171359,"org.eclipse.wst.dtd.ui",1332574052830
-stopped,bundle,org.eclipse.wst.xsd.ui,1.2.404.v201105050216,"org.eclipse.wst.xsd.ui",1332574052830
-stopped,bundle,org.eclipse.wst.css.ui,1.0.601.v201201101544,"org.eclipse.wst.css.ui",1332574052830
-stopped,bundle,org.eclipse.wst.xml.ui,1.1.202.v201112071516,"org.eclipse.wst.xml.ui",1332574052830
-stopped,bundle,org.eclipse.wst.common.ui,1.1.500.v200911190730,"org.eclipse.wst.common.ui",1332574052830
-stopped,bundle,org.eclipse.wst.jsdt.ui,1.1.102.v201201131900,"org.eclipse.wst.jsdt.ui",1332574052830
-stopped,bundle,org.eclipse.wst.sse.ui,1.3.2.v201201041522,"org.eclipse.wst.sse.ui",1332574052830
-stopped,bundle,org.eclipse.search,3.7.0.v20110505-0800,"org.eclipse.search",1332574052860
-stopped,bundle,org.eclipse.mylyn.commons.team,0.8.0.v20110608-1400,"org.eclipse.mylyn.commons.team",1332574052860
-stopped,bundle,org.eclipse.mylyn.team.ui,3.6.0.v20110608-1400,"org.eclipse.mylyn.team.ui",1332574052862
-stopped,bundle,org.eclipse.ui.navigator.resources,3.4.300.I20110421-1800,"org.eclipse.ui.navigator.resources",1332574052862
-stopped,bundle,org.eclipse.ltk.ui.refactoring,3.6.0.v20110505-0800,"org.eclipse.ltk.ui.refactoring",1332574052862
-stopped,bundle,org.eclipse.mylyn.bugzilla.ui,3.6.0.v20110608-1400,"org.eclipse.mylyn.bugzilla.ui",1332574052862
-stopped,bundle,org.eclipse.mylyn.ide.ui,3.6.0.v20110608-1400,"org.eclipse.mylyn.ide.ui",1332574052862
-stopped,bundle,org.eclipse.mylyn.resources.ui,3.6.0.v20110608-1400,"org.eclipse.mylyn.resources.ui",1332574052862
-stopped,bundle,org.eclipse.mylyn.wikitext.tasks.ui,1.5.0.v20110608-1400,"org.eclipse.mylyn.wikitext.tasks.ui",1332574052862
-stopped,bundle,org.eclipse.mylyn.context.ui,3.6.0.v20110608-1400,"org.eclipse.mylyn.context.ui",1332574052862
-stopped,bundle,org.eclipse.mylyn.help.ui,3.6.0.v20110608-1400,"org.eclipse.mylyn.help.ui",1332574052863
-stopped,bundle,org.eclipse.mylyn.tasks.bugs,3.6.0.v20110608-1400,"org.eclipse.mylyn.tasks.bugs",1332574052863
-stopped,bundle,org.eclipse.mylyn.tasks.ui,3.6.0.v20110608-1400,"org.eclipse.mylyn.tasks.ui",1332574052863
-stopped,bundle,org.eclipse.team.cvs.ui,3.3.400.I20110510-0800,"org.eclipse.team.cvs.ui",1332574052865
-stopped,bundle,org.eclipse.team.ui,3.6.100.I20110525-0800,"org.eclipse.team.ui",1332574052867
-stopped,bundle,org.eclipse.compare,3.5.200.I20110525-0800,"org.eclipse.compare",1332574052867
-stopped,bundle,org.eclipse.ui.externaltools,3.2.0.v20110506,"org.eclipse.ui.externaltools",1332574052867
-stopped,bundle,org.eclipse.debug.ui,3.7.0.v20110518,"org.eclipse.debug.ui",1332574052867
-stopped,bundle,org.eclipse.mylyn.wikitext.ui,1.5.0.v20110608-1400,"org.eclipse.mylyn.wikitext.ui",1332574052867
-stopped,bundle,org.eclipse.ui.console,3.5.100.v20110511,"org.eclipse.ui.console",1332574052867
-stopped,bundle,org.eclipse.mylyn.commons.ui,3.6.1.v20110720-0100,"org.eclipse.mylyn.commons.ui",1332574052867
-stopped,bundle,org.eclipse.ui.editors,3.7.0.v20110517-0800,"org.eclipse.ui.editors",1332574052867
-stopped,bundle,org.eclipse.wst.common.snippets,1.2.100.v201103281740,"org.eclipse.wst.common.snippets",1332574052868
-stopped,bundle,org.eclipse.ui.workbench.texteditor,3.7.0.v20110505-0800,"org.eclipse.ui.workbench.texteditor",1332574052868
-stopped,bundle,org.eclipse.compare.core,3.5.200.I20110208-0800,"org.eclipse.compare.core",1332574052868
-stopped,bundle,org.eclipse.emf.edit.ui,2.7.0.v20110606-0949,"org.eclipse.emf.edit.ui",1332574052868
-stopped,bundle,org.eclipse.gef,3.7.0.v20110407-2050,"org.eclipse.gef",1332574052868
-activated,perspective,org.eclipse.jdt.ui,,"org.eclipse.jdt.ui.JavaPerspective",1332579753521
-started,bundle,org.eclipse.osgi,3.7.0.v20110613,"org.eclipse.osgi",1332579753523
-started,bundle,org.eclipse.equinox.simpleconfigurator,1.0.200.v20110502-1955,"org.eclipse.equinox.simpleconfigurator",1332579753523
-started,bundle,com.ibm.icu,4.4.2.v20110208,"com.ibm.icu",1332579753523
-started,bundle,org.eclipse.compare.core,3.5.200.I20110208-0800,"org.eclipse.compare.core",1332579753523
-started,bundle,org.eclipse.core.contenttype,3.4.100.v20110423-0524,"org.eclipse.core.contenttype",1332579753523
-started,bundle,org.eclipse.core.databinding.observable,1.4.0.I20110222-0800,"org.eclipse.core.databinding.observable",1332579753523
-started,bundle,org.eclipse.core.expressions,3.4.300.v20110228,"org.eclipse.core.expressions",1332579753523
-started,bundle,org.eclipse.core.filebuffers,3.5.200.v20110505-0800,"org.eclipse.core.filebuffers",1332579753523
-started,bundle,org.eclipse.core.filesystem,1.3.100.v20110423-0524,"org.eclipse.core.filesystem",1332579753523
-started,bundle,org.eclipse.core.jobs,3.5.100.v20110404,"org.eclipse.core.jobs",1332579753523
-started,bundle,org.eclipse.core.net,1.2.100.I20110511-0800,"org.eclipse.core.net",1332579753523
-started,bundle,org.eclipse.core.resources,3.7.100.v20110510-0712,"org.eclipse.core.resources",1332579753523
-started,bundle,org.eclipse.core.runtime,3.7.0.v20110110,"org.eclipse.core.runtime",1332579753523
-started,bundle,org.eclipse.core.runtime.compatibility,3.2.100.v20100505,"org.eclipse.core.runtime.compatibility",1332579753523
-started,bundle,org.eclipse.core.runtime.compatibility.auth,3.2.200.v20110110,"org.eclipse.core.runtime.compatibility.auth",1332579753523
-started,bundle,org.eclipse.debug.core,3.7.0.v20110518,"org.eclipse.debug.core",1332579753523
-started,bundle,org.eclipse.epp.mpc.ui,1.1.0.I20110525-0742,"org.eclipse.epp.mpc.ui",1332579753523
-started,bundle,org.eclipse.epp.usagedata.gathering,1.3.1.R201106061540,"org.eclipse.epp.usagedata.gathering",1332579753523
-started,bundle,org.eclipse.epp.usagedata.recording,1.3.1.R201106061540,"org.eclipse.epp.usagedata.recording",1332579753523
-started,bundle,org.eclipse.equinox.app,1.3.100.v20110321,"org.eclipse.equinox.app",1332579753523
-started,bundle,org.eclipse.equinox.common,3.6.0.v20110523,"org.eclipse.equinox.common",1332579753523
-started,bundle,org.eclipse.equinox.ds,1.3.0.v20110502,"org.eclipse.equinox.ds",1332579753523
-started,bundle,org.eclipse.equinox.event,1.2.100.v20110502,"org.eclipse.equinox.event",1332579753523
-started,bundle,org.eclipse.equinox.p2.core,2.1.0.v20110502-1955,"org.eclipse.equinox.p2.core",1332579753523
-started,bundle,org.eclipse.equinox.p2.directorywatcher,1.0.300.v20110502-1955,"org.eclipse.equinox.p2.directorywatcher",1332579753523
-started,bundle,org.eclipse.equinox.p2.engine,2.1.0.v20110511,"org.eclipse.equinox.p2.engine",1332579753523
-started,bundle,org.eclipse.equinox.p2.metadata,2.1.0.v20110510,"org.eclipse.equinox.p2.metadata",1332579753523
-started,bundle,org.eclipse.equinox.p2.metadata.repository,1.2.0.v20110511-1359,"org.eclipse.equinox.p2.metadata.repository",1332579753523
-started,bundle,org.eclipse.equinox.p2.operations,2.1.0.v20110511-1821,"org.eclipse.equinox.p2.operations",1332579753523
-started,bundle,org.eclipse.equinox.p2.reconciler.dropins,1.1.100.v20110510,"org.eclipse.equinox.p2.reconciler.dropins",1332579753523
-started,bundle,org.eclipse.equinox.p2.repository,2.1.0.v20110601,"org.eclipse.equinox.p2.repository",1332579753523
-started,bundle,org.eclipse.equinox.p2.ui.sdk.scheduler,1.0.100.v20110502-1955,"org.eclipse.equinox.p2.ui.sdk.scheduler",1332579753523
-started,bundle,org.eclipse.equinox.p2.updatechecker,1.1.200.v20110502-1955,"org.eclipse.equinox.p2.updatechecker",1332579753523
-started,bundle,org.eclipse.equinox.preferences,3.4.0.v20110502,"org.eclipse.equinox.preferences",1332579753523
-started,bundle,org.eclipse.equinox.registry,3.5.100.v20110502,"org.eclipse.equinox.registry",1332579753523
-started,bundle,org.eclipse.equinox.security,1.1.0.v20110502,"org.eclipse.equinox.security",1332579753523
-started,bundle,org.eclipse.equinox.util,1.0.300.v20110502,"org.eclipse.equinox.util",1332579753523
-started,bundle,org.eclipse.help,3.5.100.v20110426,"org.eclipse.help",1332579753523
-started,bundle,org.eclipse.jdt.apt.core,3.3.500.v20110420-1015,"org.eclipse.jdt.apt.core",1332579753523
-started,bundle,org.eclipse.jdt.apt.pluggable.core,1.0.400.v20110305-1450,"org.eclipse.jdt.apt.pluggable.core",1332579753523
-started,bundle,org.eclipse.jdt.core,3.7.0.v_B61,"org.eclipse.jdt.core",1332579753523
-started,bundle,org.eclipse.jdt.core.manipulation,1.4.0.v20110505-0800,"org.eclipse.jdt.core.manipulation",1332579753523
-started,bundle,org.eclipse.jdt.launching,3.6.0.v20110509,"org.eclipse.jdt.launching",1332579753523
-started,bundle,org.eclipse.jdt.launching.macosx,3.2.100.v20110509,"org.eclipse.jdt.launching.macosx",1332579753523
-started,bundle,org.eclipse.jdt.ui,3.7.0.v20110531-1200,"org.eclipse.jdt.ui",1332579753523
-started,bundle,org.eclipse.jface,3.7.0.I20110522-1430,"org.eclipse.jface",1332579753523
-started,bundle,org.eclipse.jsch.core,1.1.300.I20110514-0800,"org.eclipse.jsch.core",1332579753523
-started,bundle,org.eclipse.ltk.core.refactoring,3.5.200.v20110505-0800,"org.eclipse.ltk.core.refactoring",1332579753523
-started,bundle,org.eclipse.ltk.ui.refactoring,3.6.0.v20110505-0800,"org.eclipse.ltk.ui.refactoring",1332579753523
+started,bundle,org.eclipse.ltk.ui.refactoring,3.6.0.v20110505-0800,"org.eclipse.ltk.ui.refactoring",1333968034977
+started,bundle,org.eclipse.m2e.logback.configuration,1.0.0.20110607-2117,"org.eclipse.m2e.logback.configuration",1333968034977
+started,bundle,org.eclipse.mylyn.bugzilla.core,3.6.0.v20110608-1400,"org.eclipse.mylyn.bugzilla.core",1333968034977
+started,bundle,org.eclipse.mylyn.bugzilla.ui,3.6.0.v20110608-1400,"org.eclipse.mylyn.bugzilla.ui",1333968034977
+started,bundle,org.eclipse.mylyn.commons.identity,0.8.0.v20110608-1400,"org.eclipse.mylyn.commons.identity",1333968034977
+started,bundle,org.eclipse.mylyn.commons.net,3.6.0.v20110608-1400,"org.eclipse.mylyn.commons.net",1333968034977
+started,bundle,org.eclipse.mylyn.context.core,3.6.0.v20110608-1400,"org.eclipse.mylyn.context.core",1333968034977
+started,bundle,org.eclipse.mylyn.context.ui,3.6.0.v20110608-1400,"org.eclipse.mylyn.context.ui",1333968034977
+started,bundle,org.eclipse.mylyn.monitor.ui,3.6.0.v20110608-1400,"org.eclipse.mylyn.monitor.ui",1333968034977
+started,bundle,org.eclipse.mylyn.tasks.ui,3.6.0.v20110608-1400,"org.eclipse.mylyn.tasks.ui",1333968034977
+started,bundle,org.eclipse.mylyn.team.ui,3.6.0.v20110608-1400,"org.eclipse.mylyn.team.ui",1333968034977
+started,bundle,org.eclipse.search,3.7.0.v20110505-0800,"org.eclipse.search",1333968034977
+started,bundle,org.eclipse.team.core,3.6.0.I20110525-0800,"org.eclipse.team.core",1333968034977
+started,bundle,org.eclipse.team.cvs.core,3.3.400.I20110510-0800,"org.eclipse.team.cvs.core",1333968034977
+started,bundle,org.eclipse.team.cvs.ui,3.3.400.I20110510-0800,"org.eclipse.team.cvs.ui",1333968034977
+started,bundle,org.eclipse.team.ui,3.6.100.I20110525-0800,"org.eclipse.team.ui",1333968034977
+started,bundle,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui",1333968034977
+started,bundle,org.eclipse.ui.console,3.5.100.v20110511,"org.eclipse.ui.console",1333968034977
+started,bundle,org.eclipse.ui.editors,3.7.0.v20110517-0800,"org.eclipse.ui.editors",1333968034977
+started,bundle,org.eclipse.ui.forms,3.5.100.v20110425,"org.eclipse.ui.forms",1333968034977
+started,bundle,org.eclipse.ui.ide,3.7.0.I20110519-0100,"org.eclipse.ui.ide",1333968034977
+started,bundle,org.eclipse.ui.net,1.2.100.I20110511-0800,"org.eclipse.ui.net",1333968034977
+started,bundle,org.eclipse.ui.views,3.6.0.I20110412-0800,"org.eclipse.ui.views",1333968034977
+started,bundle,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"org.eclipse.ui.workbench",1333968034977
+started,bundle,org.eclipse.ui.workbench.texteditor,3.7.0.v20110505-0800,"org.eclipse.ui.workbench.texteditor",1333968034977
+started,bundle,org.eclipse.update.configurator,3.3.100.v20100512,"org.eclipse.update.configurator",1333968034977
+started,bundle,org.eclipse.update.core,3.2.500.v20110330,"org.eclipse.update.core",1333968034977
+started,bundle,org.eclipse.update.scheduler,3.2.300.v20100512,"org.eclipse.update.scheduler",1333968034977
+started,bundle,org.eclipse.wb.discovery.core,1.0.0.r37x201106081733,"org.eclipse.wb.discovery.core",1333968034977
+started,bundle,org.eclipse.wb.discovery.ui,1.0.0.r37x201106081733,"org.eclipse.wb.discovery.ui",1333968034977
+started,bundle,com.google.appengine.eclipse.core,2.5.2.v201202290255-rel-r37,"com.google.appengine.eclipse.core",1333968034977
+started,bundle,com.google.gdt.eclipse.appengine.rpc,2.5.2.v201202290255-rel-r37,"com.google.gdt.eclipse.appengine.rpc",1333968034977
+started,bundle,com.google.gdt.eclipse.core,2.5.2.v201202290255-rel-r37,"com.google.gdt.eclipse.core",1333968034977
+started,bundle,com.google.gdt.eclipse.designer,2.5.0.r37x201112291029,"com.google.gdt.eclipse.designer",1333968034977
+started,bundle,com.google.gdt.eclipse.designer.UiBinder,2.5.0.r37x201112291029,"com.google.gdt.eclipse.designer.UiBinder",1333968034977
+started,bundle,com.google.gdt.eclipse.designer.hosted,2.5.0.r37x201112291019,"com.google.gdt.eclipse.designer.hosted",1333968034977
+started,bundle,com.google.gdt.eclipse.login,2.5.2.v201202290255-rel-r37,"com.google.gdt.eclipse.login",1333968034977
+started,bundle,com.google.gdt.eclipse.managedapis,2.5.2.v201202290255-rel-r37,"com.google.gdt.eclipse.managedapis",1333968034977
+started,bundle,com.google.gdt.eclipse.maven,2.5.2.v201202290255-rel-r37,"com.google.gdt.eclipse.maven",1333968034977
+started,bundle,com.google.gdt.eclipse.platform.e37,2.5.2.v201202290255-rel-r37,"com.google.gdt.eclipse.platform.e37",1333968034977
+started,bundle,com.google.gdt.eclipse.platform.shared,2.5.2.v201202290255-rel-r37,"com.google.gdt.eclipse.platform.shared",1333968034977
+started,bundle,com.google.gdt.eclipse.suite,2.5.2.v201202290255-rel-r37,"com.google.gdt.eclipse.suite",1333968034977
+started,bundle,com.google.gdt.eclipse.suite.ext,2.5.2.v201202290255-rel-r37,"com.google.gdt.eclipse.suite.ext",1333968034977
+started,bundle,com.google.gwt.eclipse.core,2.5.2.v201202290255-rel-r37,"com.google.gwt.eclipse.core",1333968034977
+started,bundle,org.eclipse.mylyn.commons.ui,3.6.1.v20110720-0100,"org.eclipse.mylyn.commons.ui",1333968034977
+started,bundle,org.eclipse.wb.core,1.2.0.r37x201112290923,"org.eclipse.wb.core",1333968034977
+started,bundle,org.eclipse.wb.core.lib,1.2.0.r37x201112290923,"org.eclipse.wb.core.lib",1333968034977
+os,sysinfo,,,"macosx",1333968034979
+arch,sysinfo,,,"x86_64",1333968034979
+ws,sysinfo,,,"cocoa",1333968034980
+locale,sysinfo,,,"ja_JP",1333968034980
+processors,sysinfo,,,"8",1333968034980
+java.runtime.name,sysinfo,,,"Java(TM) SE Runtime Environment",1333968034980
+java.runtime.version,sysinfo,,,"1.6.0_29-b11-402-11D50d",1333968034980
+java.specification.name,sysinfo,,,"Java Platform API Specification",1333968034980
+java.specification.vendor,sysinfo,,,"Sun Microsystems Inc.",1333968034980
+java.specification.version,sysinfo,,,"1.6",1333968034980
+java.vendor,sysinfo,,,"Apple Inc.",1333968034980
+java.version,sysinfo,,,"1.6.0_29",1333968034980
+java.vm.info,sysinfo,,,"mixed mode",1333968034980
+java.vm.name,sysinfo,,,"Java HotSpot(TM) 64-Bit Server VM",1333968034980
+java.vm.specification.name,sysinfo,,,"Java Virtual Machine Specification",1333968034980
+java.vm.specification.vendor,sysinfo,,,"Sun Microsystems Inc.",1333968034980
+java.vm.specification.version,sysinfo,,,"1.0",1333968034980
+java.vm.vendor,sysinfo,,,"Apple Inc.",1333968034980
+java.vm.version,sysinfo,,,"20.4-b02-402",1333968034980
+started,bundle,org.eclipse.m2e.usagedata,1.0.200.20111228-1245,"org.eclipse.m2e.usagedata",1333968034981
+started,bundle,org.eclipse.epp.usagedata.ui,1.3.1.R201106061540,"org.eclipse.epp.usagedata.ui",1333968036000
+deactivated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1333968036176
+activated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1333968038136
+opened,view,org.eclipse.ui.ide,3.7.0.I20110519-0100,"org.eclipse.ui.views.ProblemView",1333968039578
+deactivated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1333968041071
+activated,view,org.eclipse.jdt.ui,3.7.0.v20110531-1200,"org.eclipse.jdt.ui.PackageExplorer",1333968059175
+activated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1333968059306
+deactivated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1333968061472
+activated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1333968063540
+closed,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1333968063713
+started,bundle,org.eclipse.compare,3.5.200.I20110525-0800,"org.eclipse.compare",1333968064628
+stopped,bundle,org.eclipse.m2e.logback.configuration,1.0.0.20110607-2117,"org.eclipse.m2e.logback.configuration",1333968064722
+stopped,bundle,org.eclipse.ui.cheatsheets,3.4.100.v20110425,"org.eclipse.ui.cheatsheets",1333968064723
+stopped,bundle,org.eclipse.help.ui,3.5.100.v20110425,"org.eclipse.help.ui",1333968064723
+stopped,bundle,org.eclipse.help.webapp,3.6.0.v20110518,"org.eclipse.help.webapp",1333968064723
+stopped,bundle,org.eclipse.epp.mpc.ui,1.1.0.I20110525-0742,"org.eclipse.epp.mpc.ui",1333968064723
+stopped,bundle,org.eclipse.epp.usagedata.ui,1.3.1.R201106061540,"org.eclipse.epp.usagedata.ui",1333968064723
+stopped,bundle,org.eclipse.ui.intro.universal,3.2.500.v20110510,"org.eclipse.ui.intro.universal",1333968064723
+stopped,bundle,org.eclipse.ui.intro,3.4.100.v20110425,"org.eclipse.ui.intro",1333968064723
+stopped,bundle,org.eclipse.help.base,3.6.0.v201106131736,"org.eclipse.help.base",1333968064723
+stopped,bundle,org.eclipse.equinox.http.jetty,2.0.100.v20110502,"org.eclipse.equinox.http.jetty",1333968064723
+stopped,bundle,com.google.appengine.eclipse.datatools,2.5.2.v201202290255-rel-r37,"com.google.appengine.eclipse.datatools",1333968064723
+stopped,bundle,com.google.appengine.eclipse.sdkbundle,1.6.3.v201202290255r37,"com.google.appengine.eclipse.sdkbundle",1333968064723
+stopped,bundle,com.google.gdt.eclipse.appengine.rpc,2.5.2.v201202290255-rel-r37,"com.google.gdt.eclipse.appengine.rpc",1333968064723
+stopped,bundle,com.google.gdt.eclipse.gph.e36,2.5.2.v201202290255-rel-r37,"com.google.gdt.eclipse.gph.e36",1333968064724
+stopped,bundle,com.google.gdt.eclipse.gph.hge,2.5.2.v201202290255-rel-r37,"com.google.gdt.eclipse.gph.hge",1333968064724
+stopped,bundle,com.google.gdt.eclipse.gph.subclipse,2.5.2.v201202290255-rel-r37,"com.google.gdt.eclipse.gph.subclipse",1333968064724
+stopped,bundle,com.google.gdt.eclipse.gph.subversive,2.5.2.v201202290255-rel-r37,"com.google.gdt.eclipse.gph.subversive",1333968064724
+stopped,bundle,com.google.gdt.eclipse.suite.ext,2.5.2.v201202290255-rel-r37,"com.google.gdt.eclipse.suite.ext",1333968064724
+stopped,bundle,com.google.gdt.eclipse.gph,2.5.2.v201202290255-rel-r37,"com.google.gdt.eclipse.gph",1333968064724
+stopped,bundle,com.google.gdt.eclipse.maven.e37,2.5.2.v201202290255-rel-r37,"com.google.gdt.eclipse.maven.e37",1333968064724
+stopped,bundle,com.google.gdt.eclipse.maven,2.5.2.v201202290255-rel-r37,"com.google.gdt.eclipse.maven",1333968064724
+stopped,bundle,com.google.gdt.eclipse.suite,2.5.2.v201202290255-rel-r37,"com.google.gdt.eclipse.suite",1333968064725
+stopped,bundle,com.google.gdt.eclipse.appsmarketplace,2.5.2.v201202290255-rel-r37,"com.google.gdt.eclipse.appsmarketplace",1333968064725
+stopped,bundle,com.google.appengine.eclipse.core,2.5.2.v201202290255-rel-r37,"com.google.appengine.eclipse.core",1333968064725
+stopped,bundle,com.google.gdt.eclipse.login,2.5.2.v201202290255-rel-r37,"com.google.gdt.eclipse.login",1333968064725
+stopped,bundle,com.google.gdt.eclipse.managedapis,2.5.2.v201202290255-rel-r37,"com.google.gdt.eclipse.managedapis",1333968064727
+stopped,bundle,com.google.gwt.eclipse.oophm,2.5.2.v201202290255-rel-r37,"com.google.gwt.eclipse.oophm",1333968064727
+stopped,bundle,com.google.gwt.eclipse.sdkbundle,2.4.0.v201202290255-rel-r37,"com.google.gwt.eclipse.sdkbundle",1333968064727
+stopped,bundle,com.google.gwt.eclipse.core,2.5.2.v201202290255-rel-r37,"com.google.gwt.eclipse.core",1333968064834
+stopped,bundle,com.google.gdt.eclipse.core,2.5.2.v201202290255-rel-r37,"com.google.gdt.eclipse.core",1333968064835
+stopped,bundle,com.google.gdt.eclipse.platform,2.5.2.v201202290255-rel-r37,"com.google.gdt.eclipse.platform",1333968064835
+stopped,bundle,com.google.gdt.eclipse.platform.e37,2.5.2.v201202290255-rel-r37,"com.google.gdt.eclipse.platform.e37",1333968064836
+stopped,bundle,org.eclipse.m2e.discovery,1.0.200.20111228-1245,"org.eclipse.m2e.discovery",1333968064836
+stopped,bundle,org.eclipse.m2e.refactoring,1.0.200.20111228-1245,"org.eclipse.m2e.refactoring",1333968064836
+stopped,bundle,org.eclipse.m2e.editor,1.0.200.20111228-1245,"org.eclipse.m2e.editor",1333968064836
+stopped,bundle,org.eclipse.m2e.editor.xml,1.0.200.20111228-1245,"org.eclipse.m2e.editor.xml",1333968064836
+stopped,bundle,org.eclipse.m2e.jdt,1.0.200.20111228-1245,"org.eclipse.m2e.jdt",1333968064836
+stopped,bundle,org.eclipse.m2e.launching,1.0.200.20111228-1245,"org.eclipse.m2e.launching",1333968064836
+stopped,bundle,org.eclipse.m2e.usagedata,1.0.200.20111228-1245,"org.eclipse.m2e.usagedata",1333968064836
+stopped,bundle,org.eclipse.m2e.core.ui,1.0.200.20111228-1245,"org.eclipse.m2e.core.ui",1333968064836
+stopped,bundle,org.eclipse.m2e.core,1.0.200.20111228-1245,"org.eclipse.m2e.core",1333968064836
+stopped,bundle,org.eclipse.mylyn.ide.ant,3.6.0.v20110608-1400,"org.eclipse.mylyn.ide.ant",1333968064836
+stopped,bundle,org.eclipse.ant.ui,3.5.100.v20110510,"org.eclipse.ant.ui",1333968064836
+stopped,bundle,org.eclipse.ant.launching,1.0.100.v20110506,"org.eclipse.ant.launching",1333968064836
+stopped,bundle,org.eclipse.equinox.p2.ui.sdk,1.0.200.v20110502-1955,"org.eclipse.equinox.p2.ui.sdk",1333968064836
+stopped,bundle,org.eclipse.mylyn.java.tasks,3.6.0.v20110608-1400,"org.eclipse.mylyn.java.tasks",1333968064836
+stopped,bundle,org.eclipse.mylyn.java.ui,3.6.0.v20110608-1400,"org.eclipse.mylyn.java.ui",1333968064836
+stopped,bundle,com.google.gdt.eclipse.designer.UiBinder,2.5.0.r37x201112291029,"com.google.gdt.eclipse.designer.UiBinder",1333968064838
+stopped,bundle,com.google.gdt.eclipse.designer.gpe,2.5.0.r37x201201030222,"com.google.gdt.eclipse.designer.gpe",1333968064838
+stopped,bundle,com.google.gdt.eclipse.designer,2.5.0.r37x201112291029,"com.google.gdt.eclipse.designer",1333968064839
+stopped,bundle,org.eclipse.jdt.junit,3.7.0.v20110505-0800,"org.eclipse.jdt.junit",1333968064839
+stopped,bundle,org.eclipse.jdt.apt.ui,3.3.300.v20110305-1450,"org.eclipse.jdt.apt.ui",1333968064839
+stopped,bundle,org.eclipse.jdt.debug.ui,3.6.0.v20110512,"org.eclipse.jdt.debug.ui",1333968064839
+stopped,bundle,com.google.gdt.eclipse.platform.shared,2.5.2.v201202290255-rel-r37,"com.google.gdt.eclipse.platform.shared",1333968064840
+stopped,bundle,org.eclipse.wb.swing.FormLayout,1.0.0.r37x201106081552,"org.eclipse.wb.swing.FormLayout",1333968064840
+stopped,bundle,org.eclipse.wb.swing.MigLayout,1.0.0.r37x201106081552,"org.eclipse.wb.swing.MigLayout",1333968064840
+stopped,bundle,org.eclipse.wb.swing.databinding,1.0.0.r37x201106081552,"org.eclipse.wb.swing.databinding",1333968064840
+stopped,bundle,org.eclipse.wb.swing.java6,1.0.0.r37x201106081552,"org.eclipse.wb.swing.java6",1333968064840
+stopped,bundle,org.eclipse.wb.swing.jsr296,1.0.0.r37x201106081552,"org.eclipse.wb.swing.jsr296",1333968064840
+stopped,bundle,org.eclipse.wb.swing,1.0.0.r37x201106081552,"org.eclipse.wb.swing",1333968064840
+stopped,bundle,org.eclipse.wb.core.ui,1.0.0.r37x201106081733,"org.eclipse.wb.core.ui",1333968064840
+stopped,bundle,org.eclipse.wb.layout.group,1.0.0.r37x201106081642,"org.eclipse.wb.layout.group",1333968064840
+stopped,bundle,com.google.gdt.eclipse.designer.hosted.2_0.webkit,2.5.0.r37x201112291019,"com.google.gdt.eclipse.designer.hosted.2_0.webkit",1333968064840
+stopped,bundle,com.google.gdt.eclipse.designer.hosted.2_0,2.5.0.r37x201112291019,"com.google.gdt.eclipse.designer.hosted.2_0",1333968064840
+stopped,bundle,com.google.gdt.eclipse.designer.hosted.2_2.webkit,2.5.0.r37x201112291019,"com.google.gdt.eclipse.designer.hosted.2_2.webkit",1333968064840
+stopped,bundle,com.google.gdt.eclipse.designer.hosted.2_2,2.5.0.r37x201112291019,"com.google.gdt.eclipse.designer.hosted.2_2",1333968064840
+stopped,bundle,com.google.gdt.eclipse.designer.hosted,2.5.0.r37x201112291019,"com.google.gdt.eclipse.designer.hosted",1333968064840
+stopped,bundle,org.eclipse.wb.core.databinding.xml,1.2.0.r37x201112291009,"org.eclipse.wb.core.databinding.xml",1333968064840
+stopped,bundle,org.eclipse.wb.core.databinding,1.2.0.r37x201112290923,"org.eclipse.wb.core.databinding",1333968064840
+stopped,bundle,org.eclipse.wb.core.xml,1.2.0.r37x201112291009,"org.eclipse.wb.core.xml",1333968064840
+stopped,bundle,org.eclipse.wb.css,1.2.0.r37x201112290951,"org.eclipse.wb.css",1333968064840
+stopped,bundle,org.eclipse.wb.os.macosx,1.2.0.r37x201112290923,"org.eclipse.wb.os.macosx",1333968064840
+stopped,bundle,org.eclipse.wb.core,1.2.0.r37x201112290923,"org.eclipse.wb.core",1333968064840
+stopped,bundle,org.eclipse.jdt.ui,3.7.0.v20110531-1200,"org.eclipse.jdt.ui",1333968064890
+stopped,bundle,org.eclipse.wst.dtd.ui,1.0.600.v201103171359,"org.eclipse.wst.dtd.ui",1333968064890
+stopped,bundle,org.eclipse.wst.xsd.ui,1.2.404.v201105050216,"org.eclipse.wst.xsd.ui",1333968064890
+stopped,bundle,org.eclipse.wst.css.ui,1.0.601.v201201101544,"org.eclipse.wst.css.ui",1333968064890
+stopped,bundle,org.eclipse.wst.xml.ui,1.1.202.v201112071516,"org.eclipse.wst.xml.ui",1333968064890
+stopped,bundle,org.eclipse.wst.common.ui,1.1.500.v200911190730,"org.eclipse.wst.common.ui",1333968064890
+stopped,bundle,org.eclipse.wst.jsdt.ui,1.1.102.v201201131900,"org.eclipse.wst.jsdt.ui",1333968064890
+stopped,bundle,org.eclipse.wst.sse.ui,1.3.2.v201201041522,"org.eclipse.wst.sse.ui",1333968064890
+stopped,bundle,org.eclipse.search,3.7.0.v20110505-0800,"org.eclipse.search",1333968064895
+stopped,bundle,org.eclipse.mylyn.commons.team,0.8.0.v20110608-1400,"org.eclipse.mylyn.commons.team",1333968064895
+stopped,bundle,org.eclipse.mylyn.team.ui,3.6.0.v20110608-1400,"org.eclipse.mylyn.team.ui",1333968064896
+stopped,bundle,org.eclipse.ui.navigator.resources,3.4.300.I20110421-1800,"org.eclipse.ui.navigator.resources",1333968064896
+stopped,bundle,org.eclipse.ltk.ui.refactoring,3.6.0.v20110505-0800,"org.eclipse.ltk.ui.refactoring",1333968064896
+stopped,bundle,org.eclipse.mylyn.bugzilla.ui,3.6.0.v20110608-1400,"org.eclipse.mylyn.bugzilla.ui",1333968064896
+stopped,bundle,org.eclipse.mylyn.ide.ui,3.6.0.v20110608-1400,"org.eclipse.mylyn.ide.ui",1333968064896
+stopped,bundle,org.eclipse.mylyn.resources.ui,3.6.0.v20110608-1400,"org.eclipse.mylyn.resources.ui",1333968064896
+stopped,bundle,org.eclipse.mylyn.wikitext.tasks.ui,1.5.0.v20110608-1400,"org.eclipse.mylyn.wikitext.tasks.ui",1333968064896
+stopped,bundle,org.eclipse.mylyn.context.ui,3.6.0.v20110608-1400,"org.eclipse.mylyn.context.ui",1333968064896
+stopped,bundle,org.eclipse.mylyn.help.ui,3.6.0.v20110608-1400,"org.eclipse.mylyn.help.ui",1333968064896
+stopped,bundle,org.eclipse.mylyn.tasks.bugs,3.6.0.v20110608-1400,"org.eclipse.mylyn.tasks.bugs",1333968064896
+stopped,bundle,org.eclipse.mylyn.tasks.ui,3.6.0.v20110608-1400,"org.eclipse.mylyn.tasks.ui",1333968064896
+stopped,bundle,org.eclipse.team.cvs.ui,3.3.400.I20110510-0800,"org.eclipse.team.cvs.ui",1333968064897
+stopped,bundle,org.eclipse.team.ui,3.6.100.I20110525-0800,"org.eclipse.team.ui",1333968064897
+stopped,bundle,org.eclipse.compare,3.5.200.I20110525-0800,"org.eclipse.compare",1333968064897
+activated,perspective,org.eclipse.jdt.ui,,"org.eclipse.jdt.ui.JavaPerspective",1334370678281
+started,bundle,org.eclipse.osgi,3.7.0.v20110613,"org.eclipse.osgi",1334370678282
+started,bundle,org.eclipse.equinox.simpleconfigurator,1.0.200.v20110502-1955,"org.eclipse.equinox.simpleconfigurator",1334370678282
+started,bundle,com.ibm.icu,4.4.2.v20110208,"com.ibm.icu",1334370678282
+started,bundle,org.eclipse.compare.core,3.5.200.I20110208-0800,"org.eclipse.compare.core",1334370678282
+started,bundle,org.eclipse.core.contenttype,3.4.100.v20110423-0524,"org.eclipse.core.contenttype",1334370678282
+started,bundle,org.eclipse.core.databinding.observable,1.4.0.I20110222-0800,"org.eclipse.core.databinding.observable",1334370678282
+started,bundle,org.eclipse.core.expressions,3.4.300.v20110228,"org.eclipse.core.expressions",1334370678282
+started,bundle,org.eclipse.core.filebuffers,3.5.200.v20110505-0800,"org.eclipse.core.filebuffers",1334370678282
+started,bundle,org.eclipse.core.filesystem,1.3.100.v20110423-0524,"org.eclipse.core.filesystem",1334370678282
+started,bundle,org.eclipse.core.jobs,3.5.100.v20110404,"org.eclipse.core.jobs",1334370678282
+started,bundle,org.eclipse.core.net,1.2.100.I20110511-0800,"org.eclipse.core.net",1334370678282
+started,bundle,org.eclipse.core.resources,3.7.100.v20110510-0712,"org.eclipse.core.resources",1334370678282
+started,bundle,org.eclipse.core.runtime,3.7.0.v20110110,"org.eclipse.core.runtime",1334370678282
+started,bundle,org.eclipse.core.runtime.compatibility,3.2.100.v20100505,"org.eclipse.core.runtime.compatibility",1334370678282
+started,bundle,org.eclipse.core.runtime.compatibility.auth,3.2.200.v20110110,"org.eclipse.core.runtime.compatibility.auth",1334370678282
+started,bundle,org.eclipse.debug.core,3.7.0.v20110518,"org.eclipse.debug.core",1334370678282
+started,bundle,org.eclipse.epp.mpc.ui,1.1.0.I20110525-0742,"org.eclipse.epp.mpc.ui",1334370678282
+started,bundle,org.eclipse.epp.usagedata.gathering,1.3.1.R201106061540,"org.eclipse.epp.usagedata.gathering",1334370678282
+started,bundle,org.eclipse.epp.usagedata.recording,1.3.1.R201106061540,"org.eclipse.epp.usagedata.recording",1334370678282
+started,bundle,org.eclipse.equinox.app,1.3.100.v20110321,"org.eclipse.equinox.app",1334370678282
+started,bundle,org.eclipse.equinox.common,3.6.0.v20110523,"org.eclipse.equinox.common",1334370678282
+started,bundle,org.eclipse.equinox.ds,1.3.0.v20110502,"org.eclipse.equinox.ds",1334370678282
+started,bundle,org.eclipse.equinox.event,1.2.100.v20110502,"org.eclipse.equinox.event",1334370678282
+started,bundle,org.eclipse.equinox.p2.core,2.1.0.v20110502-1955,"org.eclipse.equinox.p2.core",1334370678282
+started,bundle,org.eclipse.equinox.p2.directorywatcher,1.0.300.v20110502-1955,"org.eclipse.equinox.p2.directorywatcher",1334370678282
+started,bundle,org.eclipse.equinox.p2.engine,2.1.0.v20110511,"org.eclipse.equinox.p2.engine",1334370678282
+started,bundle,org.eclipse.equinox.p2.metadata,2.1.0.v20110510,"org.eclipse.equinox.p2.metadata",1334370678282
+started,bundle,org.eclipse.equinox.p2.metadata.repository,1.2.0.v20110511-1359,"org.eclipse.equinox.p2.metadata.repository",1334370678282
+started,bundle,org.eclipse.equinox.p2.operations,2.1.0.v20110511-1821,"org.eclipse.equinox.p2.operations",1334370678282
+started,bundle,org.eclipse.equinox.p2.reconciler.dropins,1.1.100.v20110510,"org.eclipse.equinox.p2.reconciler.dropins",1334370678282
+started,bundle,org.eclipse.equinox.p2.repository,2.1.0.v20110601,"org.eclipse.equinox.p2.repository",1334370678282
+started,bundle,org.eclipse.equinox.p2.ui.sdk.scheduler,1.0.100.v20110502-1955,"org.eclipse.equinox.p2.ui.sdk.scheduler",1334370678282
+started,bundle,org.eclipse.equinox.p2.updatechecker,1.1.200.v20110502-1955,"org.eclipse.equinox.p2.updatechecker",1334370678282
+started,bundle,org.eclipse.equinox.preferences,3.4.0.v20110502,"org.eclipse.equinox.preferences",1334370678282
+started,bundle,org.eclipse.equinox.registry,3.5.100.v20110502,"org.eclipse.equinox.registry",1334370678282
+started,bundle,org.eclipse.equinox.security,1.1.0.v20110502,"org.eclipse.equinox.security",1334370678282
+started,bundle,org.eclipse.equinox.util,1.0.300.v20110502,"org.eclipse.equinox.util",1334370678282
+started,bundle,org.eclipse.help,3.5.100.v20110426,"org.eclipse.help",1334370678282
+started,bundle,org.eclipse.jdt.apt.core,3.3.500.v20110420-1015,"org.eclipse.jdt.apt.core",1334370678282
+started,bundle,org.eclipse.jdt.apt.pluggable.core,1.0.400.v20110305-1450,"org.eclipse.jdt.apt.pluggable.core",1334370678282
+started,bundle,org.eclipse.jdt.core,3.7.0.v_B61,"org.eclipse.jdt.core",1334370678282
+started,bundle,org.eclipse.jdt.core.manipulation,1.4.0.v20110505-0800,"org.eclipse.jdt.core.manipulation",1334370678282
+started,bundle,org.eclipse.jdt.launching,3.6.0.v20110509,"org.eclipse.jdt.launching",1334370678282
+started,bundle,org.eclipse.jdt.launching.macosx,3.2.100.v20110509,"org.eclipse.jdt.launching.macosx",1334370678282
+started,bundle,org.eclipse.jdt.ui,3.7.0.v20110531-1200,"org.eclipse.jdt.ui",1334370678282
+started,bundle,org.eclipse.jface,3.7.0.I20110522-1430,"org.eclipse.jface",1334370678282
+started,bundle,org.eclipse.jsch.core,1.1.300.I20110514-0800,"org.eclipse.jsch.core",1334370678282
+started,bundle,org.eclipse.ltk.core.refactoring,3.5.200.v20110505-0800,"org.eclipse.ltk.core.refactoring",1334370678282
+started,bundle,org.eclipse.ltk.ui.refactoring,3.6.0.v20110505-0800,"org.eclipse.ltk.ui.refactoring",1334370678282
+started,bundle,org.eclipse.m2e.logback.configuration,1.0.0.20110607-2117,"org.eclipse.m2e.logback.configuration",1334370678282
+started,bundle,org.eclipse.mylyn.bugzilla.core,3.6.0.v20110608-1400,"org.eclipse.mylyn.bugzilla.core",1334370678282
+started,bundle,org.eclipse.mylyn.bugzilla.ui,3.6.0.v20110608-1400,"org.eclipse.mylyn.bugzilla.ui",1334370678282
+started,bundle,org.eclipse.mylyn.commons.identity,0.8.0.v20110608-1400,"org.eclipse.mylyn.commons.identity",1334370678282
+started,bundle,org.eclipse.mylyn.commons.net,3.6.0.v20110608-1400,"org.eclipse.mylyn.commons.net",1334370678282
+started,bundle,org.eclipse.mylyn.context.core,3.6.0.v20110608-1400,"org.eclipse.mylyn.context.core",1334370678282
+started,bundle,org.eclipse.mylyn.context.ui,3.6.0.v20110608-1400,"org.eclipse.mylyn.context.ui",1334370678282
+started,bundle,org.eclipse.mylyn.monitor.ui,3.6.0.v20110608-1400,"org.eclipse.mylyn.monitor.ui",1334370678282
+started,bundle,org.eclipse.mylyn.tasks.ui,3.6.0.v20110608-1400,"org.eclipse.mylyn.tasks.ui",1334370678282
+started,bundle,org.eclipse.mylyn.team.ui,3.6.0.v20110608-1400,"org.eclipse.mylyn.team.ui",1334370678282
+started,bundle,org.eclipse.search,3.7.0.v20110505-0800,"org.eclipse.search",1334370678316
+started,bundle,org.eclipse.team.core,3.6.0.I20110525-0800,"org.eclipse.team.core",1334370678337
+started,bundle,org.eclipse.team.cvs.core,3.3.400.I20110510-0800,"org.eclipse.team.cvs.core",1334370678357
+started,bundle,org.eclipse.team.cvs.ui,3.3.400.I20110510-0800,"org.eclipse.team.cvs.ui",1334370678409
+started,bundle,org.eclipse.team.ui,3.6.100.I20110525-0800,"org.eclipse.team.ui",1334370678420
+started,bundle,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui",1334370678434
+started,bundle,org.eclipse.ui.console,3.5.100.v20110511,"org.eclipse.ui.console",1334370678449
+started,bundle,org.eclipse.ui.editors,3.7.0.v20110517-0800,"org.eclipse.ui.editors",1334370678449
+started,bundle,org.eclipse.ui.forms,3.5.100.v20110425,"org.eclipse.ui.forms",1334370678479
+started,bundle,org.eclipse.ui.ide,3.7.0.I20110519-0100,"org.eclipse.ui.ide",1334370678495
+started,bundle,org.eclipse.ui.net,1.2.100.I20110511-0800,"org.eclipse.ui.net",1334370678512
+started,bundle,org.eclipse.ui.views,3.6.0.I20110412-0800,"org.eclipse.ui.views",1334370678537
+started,bundle,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"org.eclipse.ui.workbench",1334370678606
+started,bundle,org.eclipse.ui.workbench.texteditor,3.7.0.v20110505-0800,"org.eclipse.ui.workbench.texteditor",1334370678631
+started,bundle,org.eclipse.update.configurator,3.3.100.v20100512,"org.eclipse.update.configurator",1334370678670
--- /dev/null
+what,kind,bundleId,bundleVersion,description,time
+started,bundle,org.eclipse.m2e.logback.configuration,1.0.0.20110607-2117,"org.eclipse.m2e.logback.configuration",1332579753523
+started,bundle,org.eclipse.mylyn.bugzilla.core,3.6.0.v20110608-1400,"org.eclipse.mylyn.bugzilla.core",1332579753523
+started,bundle,org.eclipse.mylyn.bugzilla.ui,3.6.0.v20110608-1400,"org.eclipse.mylyn.bugzilla.ui",1332579753523
+started,bundle,org.eclipse.mylyn.commons.identity,0.8.0.v20110608-1400,"org.eclipse.mylyn.commons.identity",1332579753523
+started,bundle,org.eclipse.mylyn.commons.net,3.6.0.v20110608-1400,"org.eclipse.mylyn.commons.net",1332579753523
+started,bundle,org.eclipse.mylyn.context.core,3.6.0.v20110608-1400,"org.eclipse.mylyn.context.core",1332579753523
+started,bundle,org.eclipse.mylyn.context.ui,3.6.0.v20110608-1400,"org.eclipse.mylyn.context.ui",1332579753523
+started,bundle,org.eclipse.mylyn.monitor.ui,3.6.0.v20110608-1400,"org.eclipse.mylyn.monitor.ui",1332579753523
+started,bundle,org.eclipse.mylyn.tasks.ui,3.6.0.v20110608-1400,"org.eclipse.mylyn.tasks.ui",1332579753523
+started,bundle,org.eclipse.mylyn.team.ui,3.6.0.v20110608-1400,"org.eclipse.mylyn.team.ui",1332579753523
+started,bundle,org.eclipse.search,3.7.0.v20110505-0800,"org.eclipse.search",1332579753523
+started,bundle,org.eclipse.team.core,3.6.0.I20110525-0800,"org.eclipse.team.core",1332579753524
+started,bundle,org.eclipse.team.cvs.core,3.3.400.I20110510-0800,"org.eclipse.team.cvs.core",1332579753524
+started,bundle,org.eclipse.team.cvs.ui,3.3.400.I20110510-0800,"org.eclipse.team.cvs.ui",1332579753527
+started,bundle,org.eclipse.team.ui,3.6.100.I20110525-0800,"org.eclipse.team.ui",1332579753544
+started,bundle,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui",1332579753639
+started,bundle,org.eclipse.ui.console,3.5.100.v20110511,"org.eclipse.ui.console",1332579753662
+started,bundle,org.eclipse.ui.editors,3.7.0.v20110517-0800,"org.eclipse.ui.editors",1332579753662
+started,bundle,org.eclipse.ui.forms,3.5.100.v20110425,"org.eclipse.ui.forms",1332579753682
+started,bundle,org.eclipse.ui.ide,3.7.0.I20110519-0100,"org.eclipse.ui.ide",1332579753720
+started,bundle,org.eclipse.ui.net,1.2.100.I20110511-0800,"org.eclipse.ui.net",1332579753749
+started,bundle,org.eclipse.ui.views,3.6.0.I20110412-0800,"org.eclipse.ui.views",1332579753773
+started,bundle,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"org.eclipse.ui.workbench",1332579753787
+started,bundle,org.eclipse.ui.workbench.texteditor,3.7.0.v20110505-0800,"org.eclipse.ui.workbench.texteditor",1332579753831
+started,bundle,org.eclipse.update.configurator,3.3.100.v20100512,"org.eclipse.update.configurator",1332579753840
+started,bundle,org.eclipse.update.core,3.2.500.v20110330,"org.eclipse.update.core",1332579753888
+started,bundle,org.eclipse.update.scheduler,3.2.300.v20100512,"org.eclipse.update.scheduler",1332579753919
+started,bundle,org.eclipse.wb.discovery.core,1.0.0.r37x201106081733,"org.eclipse.wb.discovery.core",1332579753927
+started,bundle,com.google.appengine.eclipse.core,2.5.2.v201202290255-rel-r37,"com.google.appengine.eclipse.core",1332579753927
+started,bundle,com.google.gdt.eclipse.appengine.rpc,2.5.2.v201202290255-rel-r37,"com.google.gdt.eclipse.appengine.rpc",1332579753960
+started,bundle,com.google.gdt.eclipse.core,2.5.2.v201202290255-rel-r37,"com.google.gdt.eclipse.core",1332579753960
+started,bundle,com.google.gdt.eclipse.designer,2.5.0.r37x201112291029,"com.google.gdt.eclipse.designer",1332579754088
+started,bundle,com.google.gdt.eclipse.login,2.5.2.v201202290255-rel-r37,"com.google.gdt.eclipse.login",1332579754090
+started,bundle,com.google.gdt.eclipse.managedapis,2.5.2.v201202290255-rel-r37,"com.google.gdt.eclipse.managedapis",1332579754090
+started,bundle,com.google.gdt.eclipse.platform.e37,2.5.2.v201202290255-rel-r37,"com.google.gdt.eclipse.platform.e37",1332579754115
+started,bundle,com.google.gdt.eclipse.platform.shared,2.5.2.v201202290255-rel-r37,"com.google.gdt.eclipse.platform.shared",1332579754116
+started,bundle,com.google.gdt.eclipse.suite.ext,2.5.2.v201202290255-rel-r37,"com.google.gdt.eclipse.suite.ext",1332579754116
+started,bundle,com.google.gwt.eclipse.core,2.5.2.v201202290255-rel-r37,"com.google.gwt.eclipse.core",1332579754196
+started,bundle,org.eclipse.mylyn.commons.ui,3.6.1.v20110720-0100,"org.eclipse.mylyn.commons.ui",1332579754240
+started,bundle,org.eclipse.wb.core,1.2.0.r37x201112290923,"org.eclipse.wb.core",1332579754297
+started,bundle,org.eclipse.wb.core.lib,1.2.0.r37x201112290923,"org.eclipse.wb.core.lib",1332579754384
+os,sysinfo,,,"macosx",1332579754404
+arch,sysinfo,,,"x86_64",1332579754404
+ws,sysinfo,,,"cocoa",1332579754404
+locale,sysinfo,,,"ja_JP",1332579754404
+processors,sysinfo,,,"8",1332579754404
+java.runtime.name,sysinfo,,,"Java(TM) SE Runtime Environment",1332579754404
+java.runtime.version,sysinfo,,,"1.6.0_29-b11-402-11D50d",1332579754404
+java.specification.name,sysinfo,,,"Java Platform API Specification",1332579754404
+java.specification.vendor,sysinfo,,,"Sun Microsystems Inc.",1332579754404
+java.specification.version,sysinfo,,,"1.6",1332579754404
+java.vendor,sysinfo,,,"Apple Inc.",1332579754404
+java.version,sysinfo,,,"1.6.0_29",1332579754404
+java.vm.info,sysinfo,,,"mixed mode",1332579754404
+java.vm.name,sysinfo,,,"Java HotSpot(TM) 64-Bit Server VM",1332579754404
+java.vm.specification.name,sysinfo,,,"Java Virtual Machine Specification",1332579754404
+java.vm.specification.vendor,sysinfo,,,"Sun Microsystems Inc.",1332579754404
+java.vm.specification.version,sysinfo,,,"1.0",1332579754404
+java.vm.vendor,sysinfo,,,"Apple Inc.",1332579754404
+java.vm.version,sysinfo,,,"20.4-b02-402",1332579754404
+started,bundle,org.eclipse.m2e.usagedata,1.0.200.20111228-1245,"org.eclipse.m2e.usagedata",1332579754428
+activated,view,org.eclipse.jdt.ui,3.7.0.v20110531-1200,"org.eclipse.jdt.ui.PackageExplorer",1332579755091
+started,bundle,org.eclipse.wb.discovery.ui,1.0.0.r37x201106081733,"org.eclipse.wb.discovery.ui",1332579755730
+started,bundle,com.google.gdt.eclipse.designer.hosted,2.5.0.r37x201112291019,"com.google.gdt.eclipse.designer.hosted",1332579756044
+started,bundle,com.google.gdt.eclipse.designer.UiBinder,2.5.0.r37x201112291029,"com.google.gdt.eclipse.designer.UiBinder",1332579756097
+opened,view,org.eclipse.ui.ide,3.7.0.I20110519-0100,"org.eclipse.ui.views.ProblemView",1332579757458
+started,bundle,com.google.gdt.eclipse.maven,2.5.2.v201202290255-rel-r37,"com.google.gdt.eclipse.maven",1332579757481
+started,bundle,com.google.gdt.eclipse.suite,2.5.2.v201202290255-rel-r37,"com.google.gdt.eclipse.suite",1332579757602
+started,bundle,org.eclipse.core.variables,3.2.500.v20110511,"org.eclipse.core.variables",1332579757719
+opened,editor,org.eclipse.jdt.ui,3.7.0.v20110531-1200,"org.eclipse.jdt.ui.CompilationUnitEditor",1332579767036
+activated,editor,org.eclipse.jdt.ui,3.7.0.v20110531-1200,"org.eclipse.jdt.ui.CompilationUnitEditor",1332579767156
+deactivated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1332579772998
+executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.edit.findReplace",1332579773030
+activated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1332579776193
+started,bundle,org.eclipse.jdt.junit,3.7.0.v20110505-0800,"org.eclipse.jdt.junit",1332579825749
+executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.file.save",1332579841475
+started,bundle,org.eclipse.debug.ui,3.7.0.v20110518,"org.eclipse.debug.ui",1332579842328
+started,bundle,org.eclipse.jdt.debug,3.7.0.v20110509,"org.eclipse.jdt.debug",1332579842907
+started,bundle,org.eclipse.jdt.debug.ui,3.6.0.v20110512,"org.eclipse.jdt.debug.ui",1332579843400
+executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.edit.cut",1332579893425
+executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.edit.paste",1332579894190
+executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.edit.copy",1332579909503
+executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.edit.paste",1332579911667
+executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.file.save",1332579951813
+executed,command,com.google.gdt.eclipse.suite,2.5.2.v201202290255-rel-r37,"com.google.gdt.eclipse.suite.GDTPulldown",1332579955765
+started,bundle,org.eclipse.wst.sse.core,1.1.602.v201112071516,"org.eclipse.wst.sse.core",1332579958280
+started,bundle,org.eclipse.wst.xml.core,1.1.602.v201201091944,"org.eclipse.wst.xml.core",1332579958316
+started,bundle,org.eclipse.wst.common.uriresolver,1.1.401.v201004280700,"org.eclipse.wst.common.uriresolver",1332579958436
+deactivated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1332579958510
+activated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1332579961288
+executed,command,com.google.appengine.eclipse.core,2.5.2.v201202290255-rel-r37,"com.google.appengine.eclipse.core.deployToGoogle",1332579963392
+deactivated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1332579964408
+activated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1332579975971
+deactivated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1332579981583
+activated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1332580255333
+deactivated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1332580268719
+activated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1332580271481
+closed,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1332580271748
+started,bundle,org.eclipse.compare,3.5.200.I20110525-0800,"org.eclipse.compare",1332580272383
+stopped,bundle,org.eclipse.m2e.logback.configuration,1.0.0.20110607-2117,"org.eclipse.m2e.logback.configuration",1332580272725
+stopped,bundle,org.eclipse.ui.cheatsheets,3.4.100.v20110425,"org.eclipse.ui.cheatsheets",1332580272726
+stopped,bundle,org.eclipse.help.ui,3.5.100.v20110425,"org.eclipse.help.ui",1332580272726
+stopped,bundle,org.eclipse.help.webapp,3.6.0.v20110518,"org.eclipse.help.webapp",1332580272726
+stopped,bundle,org.eclipse.epp.mpc.ui,1.1.0.I20110525-0742,"org.eclipse.epp.mpc.ui",1332580272727
+stopped,bundle,org.eclipse.epp.usagedata.ui,1.3.1.R201106061540,"org.eclipse.epp.usagedata.ui",1332580272727
+stopped,bundle,org.eclipse.ui.intro.universal,3.2.500.v20110510,"org.eclipse.ui.intro.universal",1332580272727
+stopped,bundle,org.eclipse.ui.intro,3.4.100.v20110425,"org.eclipse.ui.intro",1332580272727
+stopped,bundle,org.eclipse.help.base,3.6.0.v201106131736,"org.eclipse.help.base",1332580272727
+stopped,bundle,org.eclipse.equinox.http.jetty,2.0.100.v20110502,"org.eclipse.equinox.http.jetty",1332580272728
+stopped,bundle,com.google.appengine.eclipse.datatools,2.5.2.v201202290255-rel-r37,"com.google.appengine.eclipse.datatools",1332580272728
+stopped,bundle,com.google.appengine.eclipse.sdkbundle,1.6.3.v201202290255r37,"com.google.appengine.eclipse.sdkbundle",1332580272728
+stopped,bundle,com.google.gdt.eclipse.appengine.rpc,2.5.2.v201202290255-rel-r37,"com.google.gdt.eclipse.appengine.rpc",1332580272728
+stopped,bundle,com.google.gdt.eclipse.gph.e36,2.5.2.v201202290255-rel-r37,"com.google.gdt.eclipse.gph.e36",1332580272729
+stopped,bundle,com.google.gdt.eclipse.gph.hge,2.5.2.v201202290255-rel-r37,"com.google.gdt.eclipse.gph.hge",1332580272729
+stopped,bundle,com.google.gdt.eclipse.gph.subclipse,2.5.2.v201202290255-rel-r37,"com.google.gdt.eclipse.gph.subclipse",1332580272729
+stopped,bundle,com.google.gdt.eclipse.gph.subversive,2.5.2.v201202290255-rel-r37,"com.google.gdt.eclipse.gph.subversive",1332580272729
+stopped,bundle,com.google.gdt.eclipse.suite.ext,2.5.2.v201202290255-rel-r37,"com.google.gdt.eclipse.suite.ext",1332580272729
+stopped,bundle,com.google.gdt.eclipse.gph,2.5.2.v201202290255-rel-r37,"com.google.gdt.eclipse.gph",1332580272730
+stopped,bundle,com.google.gdt.eclipse.maven.e37,2.5.2.v201202290255-rel-r37,"com.google.gdt.eclipse.maven.e37",1332580272730
+stopped,bundle,com.google.gdt.eclipse.maven,2.5.2.v201202290255-rel-r37,"com.google.gdt.eclipse.maven",1332580272730
+stopped,bundle,com.google.gdt.eclipse.suite,2.5.2.v201202290255-rel-r37,"com.google.gdt.eclipse.suite",1332580272730
+stopped,bundle,com.google.gdt.eclipse.appsmarketplace,2.5.2.v201202290255-rel-r37,"com.google.gdt.eclipse.appsmarketplace",1332580272731
+stopped,bundle,com.google.appengine.eclipse.core,2.5.2.v201202290255-rel-r37,"com.google.appengine.eclipse.core",1332580272731
+stopped,bundle,com.google.gdt.eclipse.login,2.5.2.v201202290255-rel-r37,"com.google.gdt.eclipse.login",1332580272731
+stopped,bundle,com.google.gdt.eclipse.managedapis,2.5.2.v201202290255-rel-r37,"com.google.gdt.eclipse.managedapis",1332580272732
+stopped,bundle,com.google.gwt.eclipse.oophm,2.5.2.v201202290255-rel-r37,"com.google.gwt.eclipse.oophm",1332580272733
+stopped,bundle,com.google.gwt.eclipse.sdkbundle,2.4.0.v201202290255-rel-r37,"com.google.gwt.eclipse.sdkbundle",1332580272733
+stopped,bundle,com.google.gwt.eclipse.core,2.5.2.v201202290255-rel-r37,"com.google.gwt.eclipse.core",1332580272855
+stopped,bundle,com.google.gdt.eclipse.core,2.5.2.v201202290255-rel-r37,"com.google.gdt.eclipse.core",1332580272856
+stopped,bundle,com.google.gdt.eclipse.platform,2.5.2.v201202290255-rel-r37,"com.google.gdt.eclipse.platform",1332580272856
+stopped,bundle,com.google.gdt.eclipse.platform.e37,2.5.2.v201202290255-rel-r37,"com.google.gdt.eclipse.platform.e37",1332580272856
+stopped,bundle,org.eclipse.m2e.discovery,1.0.200.20111228-1245,"org.eclipse.m2e.discovery",1332580272857
+stopped,bundle,org.eclipse.m2e.refactoring,1.0.200.20111228-1245,"org.eclipse.m2e.refactoring",1332580272857
+stopped,bundle,org.eclipse.m2e.editor,1.0.200.20111228-1245,"org.eclipse.m2e.editor",1332580272857
+stopped,bundle,org.eclipse.m2e.editor.xml,1.0.200.20111228-1245,"org.eclipse.m2e.editor.xml",1332580272857
+stopped,bundle,org.eclipse.m2e.jdt,1.0.200.20111228-1245,"org.eclipse.m2e.jdt",1332580272857
+stopped,bundle,org.eclipse.m2e.launching,1.0.200.20111228-1245,"org.eclipse.m2e.launching",1332580272858
+stopped,bundle,org.eclipse.m2e.usagedata,1.0.200.20111228-1245,"org.eclipse.m2e.usagedata",1332580272858
+stopped,bundle,org.eclipse.m2e.core.ui,1.0.200.20111228-1245,"org.eclipse.m2e.core.ui",1332580272858
+stopped,bundle,org.eclipse.m2e.core,1.0.200.20111228-1245,"org.eclipse.m2e.core",1332580272858
+stopped,bundle,org.eclipse.mylyn.ide.ant,3.6.0.v20110608-1400,"org.eclipse.mylyn.ide.ant",1332580272858
+stopped,bundle,org.eclipse.ant.ui,3.5.100.v20110510,"org.eclipse.ant.ui",1332580272858
+stopped,bundle,org.eclipse.ant.launching,1.0.100.v20110506,"org.eclipse.ant.launching",1332580272858
+stopped,bundle,org.eclipse.equinox.p2.ui.sdk,1.0.200.v20110502-1955,"org.eclipse.equinox.p2.ui.sdk",1332580272858
+stopped,bundle,org.eclipse.mylyn.java.tasks,3.6.0.v20110608-1400,"org.eclipse.mylyn.java.tasks",1332580272859
+stopped,bundle,org.eclipse.mylyn.java.ui,3.6.0.v20110608-1400,"org.eclipse.mylyn.java.ui",1332580272859
+stopped,bundle,com.google.gdt.eclipse.designer.UiBinder,2.5.0.r37x201112291029,"com.google.gdt.eclipse.designer.UiBinder",1332580272860
+stopped,bundle,com.google.gdt.eclipse.designer.gpe,2.5.0.r37x201201030222,"com.google.gdt.eclipse.designer.gpe",1332580272860
+stopped,bundle,com.google.gdt.eclipse.designer,2.5.0.r37x201112291029,"com.google.gdt.eclipse.designer",1332580272861
+stopped,bundle,org.eclipse.jdt.junit,3.7.0.v20110505-0800,"org.eclipse.jdt.junit",1332580272861
+stopped,bundle,org.eclipse.jdt.apt.ui,3.3.300.v20110305-1450,"org.eclipse.jdt.apt.ui",1332580272861
+stopped,bundle,org.eclipse.jdt.debug.ui,3.6.0.v20110512,"org.eclipse.jdt.debug.ui",1332580272905
+stopped,bundle,com.google.gdt.eclipse.platform.shared,2.5.2.v201202290255-rel-r37,"com.google.gdt.eclipse.platform.shared",1332580272905
+stopped,bundle,org.eclipse.wb.swing.FormLayout,1.0.0.r37x201106081552,"org.eclipse.wb.swing.FormLayout",1332580272905
+stopped,bundle,org.eclipse.wb.swing.MigLayout,1.0.0.r37x201106081552,"org.eclipse.wb.swing.MigLayout",1332580272905
+stopped,bundle,org.eclipse.wb.swing.databinding,1.0.0.r37x201106081552,"org.eclipse.wb.swing.databinding",1332580272905
+stopped,bundle,org.eclipse.wb.swing.java6,1.0.0.r37x201106081552,"org.eclipse.wb.swing.java6",1332580272905
+stopped,bundle,org.eclipse.wb.swing.jsr296,1.0.0.r37x201106081552,"org.eclipse.wb.swing.jsr296",1332580272906
+stopped,bundle,org.eclipse.wb.swing,1.0.0.r37x201106081552,"org.eclipse.wb.swing",1332580272906
+stopped,bundle,org.eclipse.wb.core.ui,1.0.0.r37x201106081733,"org.eclipse.wb.core.ui",1332580272906
+stopped,bundle,org.eclipse.wb.layout.group,1.0.0.r37x201106081642,"org.eclipse.wb.layout.group",1332580272906
+stopped,bundle,com.google.gdt.eclipse.designer.hosted.2_0.webkit,2.5.0.r37x201112291019,"com.google.gdt.eclipse.designer.hosted.2_0.webkit",1332580272906
+stopped,bundle,com.google.gdt.eclipse.designer.hosted.2_0,2.5.0.r37x201112291019,"com.google.gdt.eclipse.designer.hosted.2_0",1332580272906
+stopped,bundle,com.google.gdt.eclipse.designer.hosted.2_2.webkit,2.5.0.r37x201112291019,"com.google.gdt.eclipse.designer.hosted.2_2.webkit",1332580272906
+stopped,bundle,com.google.gdt.eclipse.designer.hosted.2_2,2.5.0.r37x201112291019,"com.google.gdt.eclipse.designer.hosted.2_2",1332580272906
+stopped,bundle,com.google.gdt.eclipse.designer.hosted,2.5.0.r37x201112291019,"com.google.gdt.eclipse.designer.hosted",1332580272906
+stopped,bundle,org.eclipse.wb.core.databinding.xml,1.2.0.r37x201112291009,"org.eclipse.wb.core.databinding.xml",1332580272906
+stopped,bundle,org.eclipse.wb.core.databinding,1.2.0.r37x201112290923,"org.eclipse.wb.core.databinding",1332580272906
+stopped,bundle,org.eclipse.wb.core.xml,1.2.0.r37x201112291009,"org.eclipse.wb.core.xml",1332580272906
+stopped,bundle,org.eclipse.wb.css,1.2.0.r37x201112290951,"org.eclipse.wb.css",1332580272906
+stopped,bundle,org.eclipse.wb.os.macosx,1.2.0.r37x201112290923,"org.eclipse.wb.os.macosx",1332580272906
+stopped,bundle,org.eclipse.wb.core,1.2.0.r37x201112290923,"org.eclipse.wb.core",1332580272907
+stopped,bundle,org.eclipse.jdt.ui,3.7.0.v20110531-1200,"org.eclipse.jdt.ui",1332580272936
+stopped,bundle,org.eclipse.wst.dtd.ui,1.0.600.v201103171359,"org.eclipse.wst.dtd.ui",1332580272936
+stopped,bundle,org.eclipse.wst.xsd.ui,1.2.404.v201105050216,"org.eclipse.wst.xsd.ui",1332580272936
+stopped,bundle,org.eclipse.wst.css.ui,1.0.601.v201201101544,"org.eclipse.wst.css.ui",1332580272936
+stopped,bundle,org.eclipse.wst.xml.ui,1.1.202.v201112071516,"org.eclipse.wst.xml.ui",1332580272936
+stopped,bundle,org.eclipse.wst.common.ui,1.1.500.v200911190730,"org.eclipse.wst.common.ui",1332580272936
+stopped,bundle,org.eclipse.wst.jsdt.ui,1.1.102.v201201131900,"org.eclipse.wst.jsdt.ui",1332580272936
+stopped,bundle,org.eclipse.wst.sse.ui,1.3.2.v201201041522,"org.eclipse.wst.sse.ui",1332580272936
+stopped,bundle,org.eclipse.search,3.7.0.v20110505-0800,"org.eclipse.search",1332580272958
+stopped,bundle,org.eclipse.mylyn.commons.team,0.8.0.v20110608-1400,"org.eclipse.mylyn.commons.team",1332580272959
+stopped,bundle,org.eclipse.mylyn.team.ui,3.6.0.v20110608-1400,"org.eclipse.mylyn.team.ui",1332580272959
+stopped,bundle,org.eclipse.ui.navigator.resources,3.4.300.I20110421-1800,"org.eclipse.ui.navigator.resources",1332580272959
+stopped,bundle,org.eclipse.ltk.ui.refactoring,3.6.0.v20110505-0800,"org.eclipse.ltk.ui.refactoring",1332580272959
+stopped,bundle,org.eclipse.mylyn.bugzilla.ui,3.6.0.v20110608-1400,"org.eclipse.mylyn.bugzilla.ui",1332580272959
+stopped,bundle,org.eclipse.mylyn.ide.ui,3.6.0.v20110608-1400,"org.eclipse.mylyn.ide.ui",1332580272959
+stopped,bundle,org.eclipse.mylyn.resources.ui,3.6.0.v20110608-1400,"org.eclipse.mylyn.resources.ui",1332580272959
+stopped,bundle,org.eclipse.mylyn.wikitext.tasks.ui,1.5.0.v20110608-1400,"org.eclipse.mylyn.wikitext.tasks.ui",1332580272959
+stopped,bundle,org.eclipse.mylyn.context.ui,3.6.0.v20110608-1400,"org.eclipse.mylyn.context.ui",1332580272959
+stopped,bundle,org.eclipse.mylyn.help.ui,3.6.0.v20110608-1400,"org.eclipse.mylyn.help.ui",1332580272959
+stopped,bundle,org.eclipse.mylyn.tasks.bugs,3.6.0.v20110608-1400,"org.eclipse.mylyn.tasks.bugs",1332580272959
+stopped,bundle,org.eclipse.mylyn.tasks.ui,3.6.0.v20110608-1400,"org.eclipse.mylyn.tasks.ui",1332580272960
+stopped,bundle,org.eclipse.team.cvs.ui,3.3.400.I20110510-0800,"org.eclipse.team.cvs.ui",1332580272960
+stopped,bundle,org.eclipse.team.ui,3.6.100.I20110525-0800,"org.eclipse.team.ui",1332580272960
+stopped,bundle,org.eclipse.compare,3.5.200.I20110525-0800,"org.eclipse.compare",1332580272960
+stopped,bundle,org.eclipse.ui.externaltools,3.2.0.v20110506,"org.eclipse.ui.externaltools",1332580272960
+stopped,bundle,org.eclipse.debug.ui,3.7.0.v20110518,"org.eclipse.debug.ui",1332580272990
+stopped,bundle,org.eclipse.mylyn.wikitext.ui,1.5.0.v20110608-1400,"org.eclipse.mylyn.wikitext.ui",1332580272990
+stopped,bundle,org.eclipse.ui.console,3.5.100.v20110511,"org.eclipse.ui.console",1332580272991
+stopped,bundle,org.eclipse.mylyn.commons.ui,3.6.1.v20110720-0100,"org.eclipse.mylyn.commons.ui",1332580272991
+stopped,bundle,org.eclipse.ui.editors,3.7.0.v20110517-0800,"org.eclipse.ui.editors",1332580272991
+stopped,bundle,org.eclipse.wst.common.snippets,1.2.100.v201103281740,"org.eclipse.wst.common.snippets",1332580272992
+stopped,bundle,org.eclipse.ui.workbench.texteditor,3.7.0.v20110505-0800,"org.eclipse.ui.workbench.texteditor",1332580272992
+stopped,bundle,org.eclipse.compare.core,3.5.200.I20110208-0800,"org.eclipse.compare.core",1332580272992
+activated,perspective,org.eclipse.jdt.ui,,"org.eclipse.jdt.ui.JavaPerspective",1333968034969
+started,bundle,org.eclipse.osgi,3.7.0.v20110613,"org.eclipse.osgi",1333968034969
+started,bundle,org.eclipse.equinox.simpleconfigurator,1.0.200.v20110502-1955,"org.eclipse.equinox.simpleconfigurator",1333968034970
+started,bundle,com.ibm.icu,4.4.2.v20110208,"com.ibm.icu",1333968034971
+started,bundle,org.eclipse.compare.core,3.5.200.I20110208-0800,"org.eclipse.compare.core",1333968034971
+started,bundle,org.eclipse.core.contenttype,3.4.100.v20110423-0524,"org.eclipse.core.contenttype",1333968034973
+started,bundle,org.eclipse.core.databinding.observable,1.4.0.I20110222-0800,"org.eclipse.core.databinding.observable",1333968034973
+started,bundle,org.eclipse.core.expressions,3.4.300.v20110228,"org.eclipse.core.expressions",1333968034973
+started,bundle,org.eclipse.core.filebuffers,3.5.200.v20110505-0800,"org.eclipse.core.filebuffers",1333968034975
+started,bundle,org.eclipse.core.filesystem,1.3.100.v20110423-0524,"org.eclipse.core.filesystem",1333968034975
+started,bundle,org.eclipse.core.jobs,3.5.100.v20110404,"org.eclipse.core.jobs",1333968034977
+started,bundle,org.eclipse.core.net,1.2.100.I20110511-0800,"org.eclipse.core.net",1333968034977
+started,bundle,org.eclipse.core.resources,3.7.100.v20110510-0712,"org.eclipse.core.resources",1333968034977
+started,bundle,org.eclipse.core.runtime,3.7.0.v20110110,"org.eclipse.core.runtime",1333968034977
+started,bundle,org.eclipse.core.runtime.compatibility,3.2.100.v20100505,"org.eclipse.core.runtime.compatibility",1333968034977
+started,bundle,org.eclipse.core.runtime.compatibility.auth,3.2.200.v20110110,"org.eclipse.core.runtime.compatibility.auth",1333968034977
+started,bundle,org.eclipse.core.variables,3.2.500.v20110511,"org.eclipse.core.variables",1333968034977
+started,bundle,org.eclipse.debug.core,3.7.0.v20110518,"org.eclipse.debug.core",1333968034977
+started,bundle,org.eclipse.epp.mpc.ui,1.1.0.I20110525-0742,"org.eclipse.epp.mpc.ui",1333968034977
+started,bundle,org.eclipse.epp.usagedata.gathering,1.3.1.R201106061540,"org.eclipse.epp.usagedata.gathering",1333968034977
+started,bundle,org.eclipse.epp.usagedata.recording,1.3.1.R201106061540,"org.eclipse.epp.usagedata.recording",1333968034977
+started,bundle,org.eclipse.equinox.app,1.3.100.v20110321,"org.eclipse.equinox.app",1333968034977
+started,bundle,org.eclipse.equinox.common,3.6.0.v20110523,"org.eclipse.equinox.common",1333968034977
+started,bundle,org.eclipse.equinox.ds,1.3.0.v20110502,"org.eclipse.equinox.ds",1333968034977
+started,bundle,org.eclipse.equinox.event,1.2.100.v20110502,"org.eclipse.equinox.event",1333968034977
+started,bundle,org.eclipse.equinox.p2.core,2.1.0.v20110502-1955,"org.eclipse.equinox.p2.core",1333968034977
+started,bundle,org.eclipse.equinox.p2.directorywatcher,1.0.300.v20110502-1955,"org.eclipse.equinox.p2.directorywatcher",1333968034977
+started,bundle,org.eclipse.equinox.p2.engine,2.1.0.v20110511,"org.eclipse.equinox.p2.engine",1333968034977
+started,bundle,org.eclipse.equinox.p2.metadata,2.1.0.v20110510,"org.eclipse.equinox.p2.metadata",1333968034977
+started,bundle,org.eclipse.equinox.p2.metadata.repository,1.2.0.v20110511-1359,"org.eclipse.equinox.p2.metadata.repository",1333968034977
+started,bundle,org.eclipse.equinox.p2.operations,2.1.0.v20110511-1821,"org.eclipse.equinox.p2.operations",1333968034977
+started,bundle,org.eclipse.equinox.p2.reconciler.dropins,1.1.100.v20110510,"org.eclipse.equinox.p2.reconciler.dropins",1333968034977
+started,bundle,org.eclipse.equinox.p2.repository,2.1.0.v20110601,"org.eclipse.equinox.p2.repository",1333968034977
+started,bundle,org.eclipse.equinox.p2.ui.sdk.scheduler,1.0.100.v20110502-1955,"org.eclipse.equinox.p2.ui.sdk.scheduler",1333968034977
+started,bundle,org.eclipse.equinox.p2.updatechecker,1.1.200.v20110502-1955,"org.eclipse.equinox.p2.updatechecker",1333968034977
+started,bundle,org.eclipse.equinox.preferences,3.4.0.v20110502,"org.eclipse.equinox.preferences",1333968034977
+started,bundle,org.eclipse.equinox.registry,3.5.100.v20110502,"org.eclipse.equinox.registry",1333968034977
+started,bundle,org.eclipse.equinox.security,1.1.0.v20110502,"org.eclipse.equinox.security",1333968034977
+started,bundle,org.eclipse.equinox.util,1.0.300.v20110502,"org.eclipse.equinox.util",1333968034977
+started,bundle,org.eclipse.help,3.5.100.v20110426,"org.eclipse.help",1333968034977
+started,bundle,org.eclipse.jdt.apt.core,3.3.500.v20110420-1015,"org.eclipse.jdt.apt.core",1333968034977
+started,bundle,org.eclipse.jdt.apt.pluggable.core,1.0.400.v20110305-1450,"org.eclipse.jdt.apt.pluggable.core",1333968034977
+started,bundle,org.eclipse.jdt.core,3.7.0.v_B61,"org.eclipse.jdt.core",1333968034977
+started,bundle,org.eclipse.jdt.core.manipulation,1.4.0.v20110505-0800,"org.eclipse.jdt.core.manipulation",1333968034977
+started,bundle,org.eclipse.jdt.launching,3.6.0.v20110509,"org.eclipse.jdt.launching",1333968034977
+started,bundle,org.eclipse.jdt.launching.macosx,3.2.100.v20110509,"org.eclipse.jdt.launching.macosx",1333968034977
+started,bundle,org.eclipse.jdt.ui,3.7.0.v20110531-1200,"org.eclipse.jdt.ui",1333968034977
+started,bundle,org.eclipse.jface,3.7.0.I20110522-1430,"org.eclipse.jface",1333968034977
+started,bundle,org.eclipse.jsch.core,1.1.300.I20110514-0800,"org.eclipse.jsch.core",1333968034977
+started,bundle,org.eclipse.ltk.core.refactoring,3.5.200.v20110505-0800,"org.eclipse.ltk.core.refactoring",1333968034977
+++ /dev/null
-what,kind,bundleId,bundleVersion,description,time
-executed,command,org.eclipse.debug.ui,3.7.0.v20110518,"org.eclipse.debug.ui.commands.StepOver",1332210433625
-executed,command,org.eclipse.debug.ui,3.7.0.v20110518,"org.eclipse.debug.ui.commands.Resume",1332210434679
-executed,command,org.eclipse.debug.ui,3.7.0.v20110518,"org.eclipse.debug.ui.commands.StepOver",1332210436015
-executed,command,org.eclipse.debug.ui,3.7.0.v20110518,"org.eclipse.debug.ui.commands.Resume",1332210439320
-executed,command,org.eclipse.debug.ui,3.7.0.v20110518,"org.eclipse.debug.ui.commands.StepOver",1332210442518
-executed,command,org.eclipse.debug.ui,3.7.0.v20110518,"org.eclipse.debug.ui.commands.Resume",1332210445301
-executed,command,,,"AUTOGEN:::org.eclipse.jdt.internal.ui.CompilationUnitEditor.ruler.actions/org.eclipse.jdt.internal.ui.javaeditor.JavaSelectRulerAction",1332210449090
-executed,command,,,"AUTOGEN:::org.eclipse.jdt.debug.CompilationUnitEditor.BreakpointRulerActions/org.eclipse.jdt.debug.ui.actions.ManageBreakpointRulerAction",1332210452024
-activated,view,org.eclipse.debug.ui,3.7.0.v20110518,"org.eclipse.debug.ui.DebugView",1332210454152
-executed,command,org.eclipse.debug.ui,3.7.0.v20110518,"org.eclipse.debug.ui.commands.Terminate",1332210454310
-activated,editor,org.eclipse.jdt.ui,3.7.0.v20110531-1200,"org.eclipse.jdt.ui.CompilationUnitEditor",1332210462670
-executed,command,org.eclipse.jdt.ui,3.7.0.v20110531-1200,"org.eclipse.jdt.ui.edit.text.java.toggle.comment",1332210468563
-executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.file.save",1332210472060
-deactivated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1332210481637
-activated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1332210503504
-deactivated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1332210505717
-activated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1332210514669
-activated,view,org.eclipse.ui.console,3.5.100.v20110511,"org.eclipse.ui.console.ConsoleView",1332210516018
-started,bundle,org.eclipse.wst.sse.core,1.1.602.v201112071516,"org.eclipse.wst.sse.core",1332210527876
-started,bundle,org.eclipse.wst.xml.core,1.1.602.v201201091944,"org.eclipse.wst.xml.core",1332210527911
-started,bundle,org.eclipse.wst.common.uriresolver,1.1.401.v201004280700,"org.eclipse.wst.common.uriresolver",1332210528007
-deactivated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1332210528056
-activated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1332210530338
-executed,command,com.google.appengine.eclipse.core,2.5.2.v201202290255-rel-r37,"com.google.appengine.eclipse.core.deployToGoogle",1332210532131
-deactivated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1332210537954
-activated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1332210696399
-activated,editor,org.eclipse.jdt.ui,3.7.0.v20110531-1200,"org.eclipse.jdt.ui.CompilationUnitEditor",1332210699425
-activated,editor,org.eclipse.jdt.ui,3.7.0.v20110531-1200,"org.eclipse.jdt.ui.CompilationUnitEditor",1332210738753
-executed,command,org.eclipse.jdt.ui,3.7.0.v20110531-1200,"org.eclipse.jdt.ui.edit.text.java.open.editor",1332210738755
-executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.edit.copy",1332210756751
-executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.edit.paste",1332210769222
-executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.edit.copy",1332210772217
-executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.edit.paste",1332210775865
-executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.file.save",1332210777847
-executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.file.save",1332210791049
-executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.file.save",1332210794060
-executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.edit.copy",1332210831615
-executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.edit.paste",1332210833671
-executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.edit.copy",1332210839902
-executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.edit.paste",1332210842993
-executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.file.save",1332210843685
-executed,command,com.google.gdt.eclipse.suite,2.5.2.v201202290255-rel-r37,"com.google.gdt.eclipse.suite.GDTPulldown",1332210866079
-deactivated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1332210868037
-activated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1332210870523
-executed,command,com.google.appengine.eclipse.core,2.5.2.v201202290255-rel-r37,"com.google.appengine.eclipse.core.deployToGoogle",1332210874954
-deactivated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1332210874972
-activated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1332211239567
-deactivated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1332211267024
-activated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1332211747131
-activated,editor,org.eclipse.jdt.ui,3.7.0.v20110531-1200,"org.eclipse.jdt.ui.CompilationUnitEditor",1332211759049
-activated,editor,org.eclipse.jdt.ui,3.7.0.v20110531-1200,"org.eclipse.jdt.ui.CompilationUnitEditor",1332211766409
-executed,command,org.eclipse.jdt.ui,3.7.0.v20110531-1200,"org.eclipse.jdt.ui.edit.text.java.open.editor",1332211766411
-activated,editor,org.eclipse.jdt.ui,3.7.0.v20110531-1200,"org.eclipse.jdt.ui.CompilationUnitEditor",1332211822503
-activated,editor,org.eclipse.jdt.ui,3.7.0.v20110531-1200,"org.eclipse.jdt.ui.CompilationUnitEditor",1332211864905
-executed,command,org.eclipse.jdt.ui,3.7.0.v20110531-1200,"org.eclipse.jdt.ui.edit.text.java.open.editor",1332211864933
-executed,command,org.eclipse.jdt.ui,3.7.0.v20110531-1200,"org.eclipse.jdt.ui.edit.text.java.open.editor",1332211877562
-executed,command,org.eclipse.jdt.ui,3.7.0.v20110531-1200,"org.eclipse.jdt.ui.edit.text.java.open.editor",1332211882962
-deactivated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1332211905066
-activated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1332211920025
-activated,editor,org.eclipse.jdt.ui,3.7.0.v20110531-1200,"org.eclipse.jdt.ui.CompilationUnitEditor",1332211925758
-executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.file.save",1332211934653
-deactivated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1332211939646
-activated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1332211941733
-executed,command,com.google.appengine.eclipse.core,2.5.2.v201202290255-rel-r37,"com.google.appengine.eclipse.core.deployToGoogle",1332211947005
-deactivated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1332211951238
-activated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1332211953755
-deactivated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1332211954588
-activated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1332213110759
-deactivated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1332213112635
-activated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1332213815418
-executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.file.save",1332213828003
-activated,view,org.eclipse.jdt.ui,3.7.0.v20110531-1200,"org.eclipse.jdt.ui.PackageExplorer",1332213832924
-activated,editor,org.eclipse.jdt.ui,3.7.0.v20110531-1200,"org.eclipse.jdt.ui.CompilationUnitEditor",1332213833240
-executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.edit.copy",1332213857575
-executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.edit.paste",1332213862055
-executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.file.save",1332213865965
-executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.file.save",1332213879670
-deactivated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1332213892435
-activated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1332213907662
-executed,command,com.google.appengine.eclipse.core,2.5.2.v201202290255-rel-r37,"com.google.appengine.eclipse.core.deployToGoogle",1332213908918
-deactivated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1332213913522
-activated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1332213930564
-deactivated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1332213932197
-activated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1332214046902
-executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.file.save",1332214057261
-executed,command,com.google.gdt.eclipse.suite,2.5.2.v201202290255-rel-r37,"com.google.gdt.eclipse.suite.GDTPulldown",1332214070482
-deactivated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1332214072366
-activated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1332214074439
-executed,command,com.google.appengine.eclipse.core,2.5.2.v201202290255-rel-r37,"com.google.appengine.eclipse.core.deployToGoogle",1332214077865
-deactivated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1332214100281
-activated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1332214102686
-closed,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1332214103004
-stopped,bundle,org.eclipse.m2e.logback.configuration,1.0.0.20110607-2117,"org.eclipse.m2e.logback.configuration",1332214103832
-stopped,bundle,org.eclipse.ui.cheatsheets,3.4.100.v20110425,"org.eclipse.ui.cheatsheets",1332214103832
-stopped,bundle,org.eclipse.help.ui,3.5.100.v20110425,"org.eclipse.help.ui",1332214103833
-stopped,bundle,org.eclipse.help.webapp,3.6.0.v20110518,"org.eclipse.help.webapp",1332214103833
-stopped,bundle,org.eclipse.epp.mpc.ui,1.1.0.I20110525-0742,"org.eclipse.epp.mpc.ui",1332214103833
-stopped,bundle,org.eclipse.epp.usagedata.ui,1.3.1.R201106061540,"org.eclipse.epp.usagedata.ui",1332214103833
-stopped,bundle,org.eclipse.ui.intro.universal,3.2.500.v20110510,"org.eclipse.ui.intro.universal",1332214103833
-stopped,bundle,org.eclipse.ui.intro,3.4.100.v20110425,"org.eclipse.ui.intro",1332214103833
-stopped,bundle,org.eclipse.help.base,3.6.0.v201106131736,"org.eclipse.help.base",1332214103833
-stopped,bundle,org.eclipse.equinox.http.jetty,2.0.100.v20110502,"org.eclipse.equinox.http.jetty",1332214103833
-stopped,bundle,com.google.appengine.eclipse.datatools,2.5.2.v201202290255-rel-r37,"com.google.appengine.eclipse.datatools",1332214103833
-stopped,bundle,com.google.appengine.eclipse.sdkbundle,1.6.3.v201202290255r37,"com.google.appengine.eclipse.sdkbundle",1332214103834
-stopped,bundle,com.google.gdt.eclipse.appengine.rpc,2.5.2.v201202290255-rel-r37,"com.google.gdt.eclipse.appengine.rpc",1332214103834
-stopped,bundle,com.google.gdt.eclipse.gph.e36,2.5.2.v201202290255-rel-r37,"com.google.gdt.eclipse.gph.e36",1332214103834
-stopped,bundle,com.google.gdt.eclipse.gph.hge,2.5.2.v201202290255-rel-r37,"com.google.gdt.eclipse.gph.hge",1332214103834
-stopped,bundle,com.google.gdt.eclipse.gph.subclipse,2.5.2.v201202290255-rel-r37,"com.google.gdt.eclipse.gph.subclipse",1332214103834
-stopped,bundle,com.google.gdt.eclipse.gph.subversive,2.5.2.v201202290255-rel-r37,"com.google.gdt.eclipse.gph.subversive",1332214103834
-stopped,bundle,com.google.gdt.eclipse.suite.ext,2.5.2.v201202290255-rel-r37,"com.google.gdt.eclipse.suite.ext",1332214103834
-stopped,bundle,com.google.gdt.eclipse.gph,2.5.2.v201202290255-rel-r37,"com.google.gdt.eclipse.gph",1332214103835
-stopped,bundle,com.google.gdt.eclipse.maven.e37,2.5.2.v201202290255-rel-r37,"com.google.gdt.eclipse.maven.e37",1332214103835
-stopped,bundle,com.google.gdt.eclipse.maven,2.5.2.v201202290255-rel-r37,"com.google.gdt.eclipse.maven",1332214103835
-stopped,bundle,com.google.gdt.eclipse.suite,2.5.2.v201202290255-rel-r37,"com.google.gdt.eclipse.suite",1332214103835
-stopped,bundle,com.google.gdt.eclipse.appsmarketplace,2.5.2.v201202290255-rel-r37,"com.google.gdt.eclipse.appsmarketplace",1332214103835
-stopped,bundle,com.google.appengine.eclipse.core,2.5.2.v201202290255-rel-r37,"com.google.appengine.eclipse.core",1332214103836
-stopped,bundle,com.google.gdt.eclipse.login,2.5.2.v201202290255-rel-r37,"com.google.gdt.eclipse.login",1332214103836
-stopped,bundle,com.google.gdt.eclipse.managedapis,2.5.2.v201202290255-rel-r37,"com.google.gdt.eclipse.managedapis",1332214103838
-stopped,bundle,com.google.gwt.eclipse.oophm,2.5.2.v201202290255-rel-r37,"com.google.gwt.eclipse.oophm",1332214103838
-stopped,bundle,com.google.gwt.eclipse.sdkbundle,2.4.0.v201202290255-rel-r37,"com.google.gwt.eclipse.sdkbundle",1332214103839
-stopped,bundle,com.google.gwt.eclipse.core,2.5.2.v201202290255-rel-r37,"com.google.gwt.eclipse.core",1332214103944
-stopped,bundle,com.google.gdt.eclipse.core,2.5.2.v201202290255-rel-r37,"com.google.gdt.eclipse.core",1332214103944
-stopped,bundle,com.google.gdt.eclipse.platform,2.5.2.v201202290255-rel-r37,"com.google.gdt.eclipse.platform",1332214103945
-stopped,bundle,com.google.gdt.eclipse.platform.e37,2.5.2.v201202290255-rel-r37,"com.google.gdt.eclipse.platform.e37",1332214103945
-stopped,bundle,org.eclipse.m2e.discovery,1.0.200.20111228-1245,"org.eclipse.m2e.discovery",1332214103946
-stopped,bundle,org.eclipse.m2e.refactoring,1.0.200.20111228-1245,"org.eclipse.m2e.refactoring",1332214103946
-stopped,bundle,org.eclipse.m2e.editor,1.0.200.20111228-1245,"org.eclipse.m2e.editor",1332214103946
-stopped,bundle,org.eclipse.m2e.editor.xml,1.0.200.20111228-1245,"org.eclipse.m2e.editor.xml",1332214103946
-stopped,bundle,org.eclipse.m2e.jdt,1.0.200.20111228-1245,"org.eclipse.m2e.jdt",1332214103946
-stopped,bundle,org.eclipse.m2e.launching,1.0.200.20111228-1245,"org.eclipse.m2e.launching",1332214103946
-stopped,bundle,org.eclipse.m2e.usagedata,1.0.200.20111228-1245,"org.eclipse.m2e.usagedata",1332214103946
-stopped,bundle,org.eclipse.m2e.core.ui,1.0.200.20111228-1245,"org.eclipse.m2e.core.ui",1332214103947
-stopped,bundle,org.eclipse.m2e.core,1.0.200.20111228-1245,"org.eclipse.m2e.core",1332214103947
-stopped,bundle,org.eclipse.mylyn.ide.ant,3.6.0.v20110608-1400,"org.eclipse.mylyn.ide.ant",1332214103947
-stopped,bundle,org.eclipse.ant.ui,3.5.100.v20110510,"org.eclipse.ant.ui",1332214103947
-stopped,bundle,org.eclipse.ant.launching,1.0.100.v20110506,"org.eclipse.ant.launching",1332214103947
-stopped,bundle,org.eclipse.equinox.p2.ui.sdk,1.0.200.v20110502-1955,"org.eclipse.equinox.p2.ui.sdk",1332214103948
-stopped,bundle,org.eclipse.mylyn.java.tasks,3.6.0.v20110608-1400,"org.eclipse.mylyn.java.tasks",1332214103948
-stopped,bundle,org.eclipse.mylyn.java.ui,3.6.0.v20110608-1400,"org.eclipse.mylyn.java.ui",1332214103948
-stopped,bundle,com.google.gdt.eclipse.designer.UiBinder,2.5.0.r37x201112291029,"com.google.gdt.eclipse.designer.UiBinder",1332214103948
-stopped,bundle,com.google.gdt.eclipse.designer.gpe,2.5.0.r37x201201030222,"com.google.gdt.eclipse.designer.gpe",1332214103948
-stopped,bundle,com.google.gdt.eclipse.designer,2.5.0.r37x201112291029,"com.google.gdt.eclipse.designer",1332214103949
-stopped,bundle,org.eclipse.jdt.junit,3.7.0.v20110505-0800,"org.eclipse.jdt.junit",1332214103949
-stopped,bundle,org.eclipse.jdt.apt.ui,3.3.300.v20110305-1450,"org.eclipse.jdt.apt.ui",1332214103949
-stopped,bundle,org.eclipse.jdt.debug.ui,3.6.0.v20110512,"org.eclipse.jdt.debug.ui",1332214103952
-stopped,bundle,com.google.gdt.eclipse.platform.shared,2.5.2.v201202290255-rel-r37,"com.google.gdt.eclipse.platform.shared",1332214103952
-stopped,bundle,org.eclipse.wb.swing.FormLayout,1.0.0.r37x201106081552,"org.eclipse.wb.swing.FormLayout",1332214103952
-stopped,bundle,org.eclipse.wb.swing.MigLayout,1.0.0.r37x201106081552,"org.eclipse.wb.swing.MigLayout",1332214103952
-stopped,bundle,org.eclipse.wb.swing.databinding,1.0.0.r37x201106081552,"org.eclipse.wb.swing.databinding",1332214103952
-stopped,bundle,org.eclipse.wb.swing.java6,1.0.0.r37x201106081552,"org.eclipse.wb.swing.java6",1332214103952
-stopped,bundle,org.eclipse.wb.swing.jsr296,1.0.0.r37x201106081552,"org.eclipse.wb.swing.jsr296",1332214103952
-stopped,bundle,org.eclipse.wb.swing,1.0.0.r37x201106081552,"org.eclipse.wb.swing",1332214103952
-stopped,bundle,org.eclipse.wb.core.ui,1.0.0.r37x201106081733,"org.eclipse.wb.core.ui",1332214103952
-stopped,bundle,org.eclipse.wb.layout.group,1.0.0.r37x201106081642,"org.eclipse.wb.layout.group",1332214103952
-stopped,bundle,com.google.gdt.eclipse.designer.hosted.2_0.webkit,2.5.0.r37x201112291019,"com.google.gdt.eclipse.designer.hosted.2_0.webkit",1332214103952
-stopped,bundle,com.google.gdt.eclipse.designer.hosted.2_0,2.5.0.r37x201112291019,"com.google.gdt.eclipse.designer.hosted.2_0",1332214103952
-stopped,bundle,com.google.gdt.eclipse.designer.hosted.2_2.webkit,2.5.0.r37x201112291019,"com.google.gdt.eclipse.designer.hosted.2_2.webkit",1332214103953
-stopped,bundle,com.google.gdt.eclipse.designer.hosted.2_2,2.5.0.r37x201112291019,"com.google.gdt.eclipse.designer.hosted.2_2",1332214103953
-stopped,bundle,com.google.gdt.eclipse.designer.hosted,2.5.0.r37x201112291019,"com.google.gdt.eclipse.designer.hosted",1332214103953
-stopped,bundle,org.eclipse.wb.core.databinding.xml,1.2.0.r37x201112291009,"org.eclipse.wb.core.databinding.xml",1332214103953
-stopped,bundle,org.eclipse.wb.core.databinding,1.2.0.r37x201112290923,"org.eclipse.wb.core.databinding",1332214103953
-stopped,bundle,org.eclipse.wb.core.xml,1.2.0.r37x201112291009,"org.eclipse.wb.core.xml",1332214103953
-stopped,bundle,org.eclipse.wb.css,1.2.0.r37x201112290951,"org.eclipse.wb.css",1332214103953
-stopped,bundle,org.eclipse.wb.os.macosx,1.2.0.r37x201112290923,"org.eclipse.wb.os.macosx",1332214103953
-stopped,bundle,org.eclipse.wb.core,1.2.0.r37x201112290923,"org.eclipse.wb.core",1332214103954
-stopped,bundle,org.eclipse.jdt.ui,3.7.0.v20110531-1200,"org.eclipse.jdt.ui",1332214103962
-stopped,bundle,org.eclipse.wst.dtd.ui,1.0.600.v201103171359,"org.eclipse.wst.dtd.ui",1332214103962
-stopped,bundle,org.eclipse.wst.xsd.ui,1.2.404.v201105050216,"org.eclipse.wst.xsd.ui",1332214103962
-stopped,bundle,org.eclipse.wst.css.ui,1.0.601.v201201101544,"org.eclipse.wst.css.ui",1332214103962
-stopped,bundle,org.eclipse.wst.xml.ui,1.1.202.v201112071516,"org.eclipse.wst.xml.ui",1332214103962
-stopped,bundle,org.eclipse.wst.common.ui,1.1.500.v200911190730,"org.eclipse.wst.common.ui",1332214103962
-stopped,bundle,org.eclipse.wst.jsdt.ui,1.1.102.v201201131900,"org.eclipse.wst.jsdt.ui",1332214103994
-stopped,bundle,org.eclipse.wst.sse.ui,1.3.2.v201201041522,"org.eclipse.wst.sse.ui",1332214103994
-stopped,bundle,org.eclipse.search,3.7.0.v20110505-0800,"org.eclipse.search",1332214104021
-stopped,bundle,org.eclipse.mylyn.commons.team,0.8.0.v20110608-1400,"org.eclipse.mylyn.commons.team",1332214104021
-stopped,bundle,org.eclipse.mylyn.team.ui,3.6.0.v20110608-1400,"org.eclipse.mylyn.team.ui",1332214104022
-stopped,bundle,org.eclipse.ui.navigator.resources,3.4.300.I20110421-1800,"org.eclipse.ui.navigator.resources",1332214104022
-stopped,bundle,org.eclipse.ltk.ui.refactoring,3.6.0.v20110505-0800,"org.eclipse.ltk.ui.refactoring",1332214104022
-stopped,bundle,org.eclipse.mylyn.bugzilla.ui,3.6.0.v20110608-1400,"org.eclipse.mylyn.bugzilla.ui",1332214104023
-stopped,bundle,org.eclipse.mylyn.ide.ui,3.6.0.v20110608-1400,"org.eclipse.mylyn.ide.ui",1332214104023
-stopped,bundle,org.eclipse.mylyn.resources.ui,3.6.0.v20110608-1400,"org.eclipse.mylyn.resources.ui",1332214104023
-stopped,bundle,org.eclipse.mylyn.wikitext.tasks.ui,1.5.0.v20110608-1400,"org.eclipse.mylyn.wikitext.tasks.ui",1332214104023
-stopped,bundle,org.eclipse.mylyn.context.ui,3.6.0.v20110608-1400,"org.eclipse.mylyn.context.ui",1332214104023
-stopped,bundle,org.eclipse.mylyn.help.ui,3.6.0.v20110608-1400,"org.eclipse.mylyn.help.ui",1332214104023
-stopped,bundle,org.eclipse.mylyn.tasks.bugs,3.6.0.v20110608-1400,"org.eclipse.mylyn.tasks.bugs",1332214104023
-stopped,bundle,org.eclipse.mylyn.tasks.ui,3.6.0.v20110608-1400,"org.eclipse.mylyn.tasks.ui",1332214104023
-stopped,bundle,org.eclipse.team.cvs.ui,3.3.400.I20110510-0800,"org.eclipse.team.cvs.ui",1332214104024
-stopped,bundle,org.eclipse.team.ui,3.6.100.I20110525-0800,"org.eclipse.team.ui",1332214104024
-stopped,bundle,org.eclipse.compare,3.5.200.I20110525-0800,"org.eclipse.compare",1332214104024
-stopped,bundle,org.eclipse.ui.externaltools,3.2.0.v20110506,"org.eclipse.ui.externaltools",1332214104024
-stopped,bundle,org.eclipse.debug.ui,3.7.0.v20110518,"org.eclipse.debug.ui",1332214104026
-stopped,bundle,org.eclipse.mylyn.wikitext.ui,1.5.0.v20110608-1400,"org.eclipse.mylyn.wikitext.ui",1332214104026
-stopped,bundle,org.eclipse.ui.console,3.5.100.v20110511,"org.eclipse.ui.console",1332214104026
-stopped,bundle,org.eclipse.mylyn.commons.ui,3.6.1.v20110720-0100,"org.eclipse.mylyn.commons.ui",1332214104026
-stopped,bundle,org.eclipse.ui.editors,3.7.0.v20110517-0800,"org.eclipse.ui.editors",1332214104026
-stopped,bundle,org.eclipse.wst.common.snippets,1.2.100.v201103281740,"org.eclipse.wst.common.snippets",1332214104026
-stopped,bundle,org.eclipse.ui.workbench.texteditor,3.7.0.v20110505-0800,"org.eclipse.ui.workbench.texteditor",1332214104026
-stopped,bundle,org.eclipse.compare.core,3.5.200.I20110208-0800,"org.eclipse.compare.core",1332214104027
-stopped,bundle,org.eclipse.emf.edit.ui,2.7.0.v20110606-0949,"org.eclipse.emf.edit.ui",1332214104027
-stopped,bundle,org.eclipse.gef,3.7.0.v20110407-2050,"org.eclipse.gef",1332214104027
-stopped,bundle,org.eclipse.emf.common.ui,2.7.0.v20110606-0949,"org.eclipse.emf.common.ui",1332214104027
-activated,perspective,org.eclipse.jdt.ui,,"org.eclipse.jdt.ui.JavaPerspective",1332573829036
-started,bundle,org.eclipse.osgi,3.7.0.v20110613,"org.eclipse.osgi",1332573829037
-started,bundle,org.eclipse.equinox.simpleconfigurator,1.0.200.v20110502-1955,"org.eclipse.equinox.simpleconfigurator",1332573829037
-started,bundle,com.ibm.icu,4.4.2.v20110208,"com.ibm.icu",1332573829037
-started,bundle,org.eclipse.compare.core,3.5.200.I20110208-0800,"org.eclipse.compare.core",1332573829037
-started,bundle,org.eclipse.core.contenttype,3.4.100.v20110423-0524,"org.eclipse.core.contenttype",1332573829037
-started,bundle,org.eclipse.core.databinding.observable,1.4.0.I20110222-0800,"org.eclipse.core.databinding.observable",1332573829037
-started,bundle,org.eclipse.core.expressions,3.4.300.v20110228,"org.eclipse.core.expressions",1332573829038
-started,bundle,org.eclipse.core.filebuffers,3.5.200.v20110505-0800,"org.eclipse.core.filebuffers",1332573829038
-started,bundle,org.eclipse.core.filesystem,1.3.100.v20110423-0524,"org.eclipse.core.filesystem",1332573829038
-started,bundle,org.eclipse.core.jobs,3.5.100.v20110404,"org.eclipse.core.jobs",1332573829038
-started,bundle,org.eclipse.core.net,1.2.100.I20110511-0800,"org.eclipse.core.net",1332573829038
-started,bundle,org.eclipse.core.resources,3.7.100.v20110510-0712,"org.eclipse.core.resources",1332573829038
-started,bundle,org.eclipse.core.runtime,3.7.0.v20110110,"org.eclipse.core.runtime",1332573829038
-started,bundle,org.eclipse.core.runtime.compatibility,3.2.100.v20100505,"org.eclipse.core.runtime.compatibility",1332573829038
-started,bundle,org.eclipse.core.runtime.compatibility.auth,3.2.200.v20110110,"org.eclipse.core.runtime.compatibility.auth",1332573829038
-started,bundle,org.eclipse.debug.core,3.7.0.v20110518,"org.eclipse.debug.core",1332573829038
-started,bundle,org.eclipse.epp.mpc.ui,1.1.0.I20110525-0742,"org.eclipse.epp.mpc.ui",1332573829038
-started,bundle,org.eclipse.epp.usagedata.gathering,1.3.1.R201106061540,"org.eclipse.epp.usagedata.gathering",1332573829038
-started,bundle,org.eclipse.epp.usagedata.recording,1.3.1.R201106061540,"org.eclipse.epp.usagedata.recording",1332573829038
-started,bundle,org.eclipse.equinox.app,1.3.100.v20110321,"org.eclipse.equinox.app",1332573829038
-started,bundle,org.eclipse.equinox.common,3.6.0.v20110523,"org.eclipse.equinox.common",1332573829038
-started,bundle,org.eclipse.equinox.ds,1.3.0.v20110502,"org.eclipse.equinox.ds",1332573829038
-started,bundle,org.eclipse.equinox.event,1.2.100.v20110502,"org.eclipse.equinox.event",1332573829038
-started,bundle,org.eclipse.equinox.p2.core,2.1.0.v20110502-1955,"org.eclipse.equinox.p2.core",1332573829038
-started,bundle,org.eclipse.equinox.p2.directorywatcher,1.0.300.v20110502-1955,"org.eclipse.equinox.p2.directorywatcher",1332573829038
-started,bundle,org.eclipse.equinox.p2.engine,2.1.0.v20110511,"org.eclipse.equinox.p2.engine",1332573829038
-started,bundle,org.eclipse.equinox.p2.metadata,2.1.0.v20110510,"org.eclipse.equinox.p2.metadata",1332573829038
-started,bundle,org.eclipse.equinox.p2.metadata.repository,1.2.0.v20110511-1359,"org.eclipse.equinox.p2.metadata.repository",1332573829038
-started,bundle,org.eclipse.equinox.p2.operations,2.1.0.v20110511-1821,"org.eclipse.equinox.p2.operations",1332573829038
-started,bundle,org.eclipse.equinox.p2.reconciler.dropins,1.1.100.v20110510,"org.eclipse.equinox.p2.reconciler.dropins",1332573829038
-started,bundle,org.eclipse.equinox.p2.repository,2.1.0.v20110601,"org.eclipse.equinox.p2.repository",1332573829038
-started,bundle,org.eclipse.equinox.p2.ui.sdk.scheduler,1.0.100.v20110502-1955,"org.eclipse.equinox.p2.ui.sdk.scheduler",1332573829038
-started,bundle,org.eclipse.equinox.p2.updatechecker,1.1.200.v20110502-1955,"org.eclipse.equinox.p2.updatechecker",1332573829038
-started,bundle,org.eclipse.equinox.preferences,3.4.0.v20110502,"org.eclipse.equinox.preferences",1332573829038
-started,bundle,org.eclipse.equinox.registry,3.5.100.v20110502,"org.eclipse.equinox.registry",1332573829038
-started,bundle,org.eclipse.equinox.security,1.1.0.v20110502,"org.eclipse.equinox.security",1332573829038
-started,bundle,org.eclipse.equinox.util,1.0.300.v20110502,"org.eclipse.equinox.util",1332573829038
-started,bundle,org.eclipse.help,3.5.100.v20110426,"org.eclipse.help",1332573829038
-started,bundle,org.eclipse.jdt.apt.core,3.3.500.v20110420-1015,"org.eclipse.jdt.apt.core",1332573829038
-started,bundle,org.eclipse.jdt.apt.pluggable.core,1.0.400.v20110305-1450,"org.eclipse.jdt.apt.pluggable.core",1332573829038
-started,bundle,org.eclipse.jdt.core,3.7.0.v_B61,"org.eclipse.jdt.core",1332573829038
-started,bundle,org.eclipse.jdt.core.manipulation,1.4.0.v20110505-0800,"org.eclipse.jdt.core.manipulation",1332573829038
-started,bundle,org.eclipse.jdt.launching,3.6.0.v20110509,"org.eclipse.jdt.launching",1332573829038
-started,bundle,org.eclipse.jdt.launching.macosx,3.2.100.v20110509,"org.eclipse.jdt.launching.macosx",1332573829038
-started,bundle,org.eclipse.jdt.ui,3.7.0.v20110531-1200,"org.eclipse.jdt.ui",1332573829038
-started,bundle,org.eclipse.jface,3.7.0.I20110522-1430,"org.eclipse.jface",1332573829038
-started,bundle,org.eclipse.jsch.core,1.1.300.I20110514-0800,"org.eclipse.jsch.core",1332573829038
-started,bundle,org.eclipse.ltk.core.refactoring,3.5.200.v20110505-0800,"org.eclipse.ltk.core.refactoring",1332573829038
-started,bundle,org.eclipse.ltk.ui.refactoring,3.6.0.v20110505-0800,"org.eclipse.ltk.ui.refactoring",1332573829038
what,kind,bundleId,bundleVersion,description,time
-started,bundle,org.eclipse.m2e.logback.configuration,1.0.0.20110607-2117,"org.eclipse.m2e.logback.configuration",1332579753523
-started,bundle,org.eclipse.mylyn.bugzilla.core,3.6.0.v20110608-1400,"org.eclipse.mylyn.bugzilla.core",1332579753523
-started,bundle,org.eclipse.mylyn.bugzilla.ui,3.6.0.v20110608-1400,"org.eclipse.mylyn.bugzilla.ui",1332579753523
-started,bundle,org.eclipse.mylyn.commons.identity,0.8.0.v20110608-1400,"org.eclipse.mylyn.commons.identity",1332579753523
-started,bundle,org.eclipse.mylyn.commons.net,3.6.0.v20110608-1400,"org.eclipse.mylyn.commons.net",1332579753523
-started,bundle,org.eclipse.mylyn.context.core,3.6.0.v20110608-1400,"org.eclipse.mylyn.context.core",1332579753523
-started,bundle,org.eclipse.mylyn.context.ui,3.6.0.v20110608-1400,"org.eclipse.mylyn.context.ui",1332579753523
-started,bundle,org.eclipse.mylyn.monitor.ui,3.6.0.v20110608-1400,"org.eclipse.mylyn.monitor.ui",1332579753523
-started,bundle,org.eclipse.mylyn.tasks.ui,3.6.0.v20110608-1400,"org.eclipse.mylyn.tasks.ui",1332579753523
-started,bundle,org.eclipse.mylyn.team.ui,3.6.0.v20110608-1400,"org.eclipse.mylyn.team.ui",1332579753523
-started,bundle,org.eclipse.search,3.7.0.v20110505-0800,"org.eclipse.search",1332579753523
-started,bundle,org.eclipse.team.core,3.6.0.I20110525-0800,"org.eclipse.team.core",1332579753524
-started,bundle,org.eclipse.team.cvs.core,3.3.400.I20110510-0800,"org.eclipse.team.cvs.core",1332579753524
-started,bundle,org.eclipse.team.cvs.ui,3.3.400.I20110510-0800,"org.eclipse.team.cvs.ui",1332579753527
-started,bundle,org.eclipse.team.ui,3.6.100.I20110525-0800,"org.eclipse.team.ui",1332579753544
-started,bundle,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui",1332579753639
-started,bundle,org.eclipse.ui.console,3.5.100.v20110511,"org.eclipse.ui.console",1332579753662
-started,bundle,org.eclipse.ui.editors,3.7.0.v20110517-0800,"org.eclipse.ui.editors",1332579753662
-started,bundle,org.eclipse.ui.forms,3.5.100.v20110425,"org.eclipse.ui.forms",1332579753682
-started,bundle,org.eclipse.ui.ide,3.7.0.I20110519-0100,"org.eclipse.ui.ide",1332579753720
-started,bundle,org.eclipse.ui.net,1.2.100.I20110511-0800,"org.eclipse.ui.net",1332579753749
-started,bundle,org.eclipse.ui.views,3.6.0.I20110412-0800,"org.eclipse.ui.views",1332579753773
-started,bundle,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"org.eclipse.ui.workbench",1332579753787
-started,bundle,org.eclipse.ui.workbench.texteditor,3.7.0.v20110505-0800,"org.eclipse.ui.workbench.texteditor",1332579753831
-started,bundle,org.eclipse.update.configurator,3.3.100.v20100512,"org.eclipse.update.configurator",1332579753840
-started,bundle,org.eclipse.update.core,3.2.500.v20110330,"org.eclipse.update.core",1332579753888
-started,bundle,org.eclipse.update.scheduler,3.2.300.v20100512,"org.eclipse.update.scheduler",1332579753919
-started,bundle,org.eclipse.wb.discovery.core,1.0.0.r37x201106081733,"org.eclipse.wb.discovery.core",1332579753927
-started,bundle,com.google.appengine.eclipse.core,2.5.2.v201202290255-rel-r37,"com.google.appengine.eclipse.core",1332579753927
-started,bundle,com.google.gdt.eclipse.appengine.rpc,2.5.2.v201202290255-rel-r37,"com.google.gdt.eclipse.appengine.rpc",1332579753960
-started,bundle,com.google.gdt.eclipse.core,2.5.2.v201202290255-rel-r37,"com.google.gdt.eclipse.core",1332579753960
-started,bundle,com.google.gdt.eclipse.designer,2.5.0.r37x201112291029,"com.google.gdt.eclipse.designer",1332579754088
-started,bundle,com.google.gdt.eclipse.login,2.5.2.v201202290255-rel-r37,"com.google.gdt.eclipse.login",1332579754090
-started,bundle,com.google.gdt.eclipse.managedapis,2.5.2.v201202290255-rel-r37,"com.google.gdt.eclipse.managedapis",1332579754090
-started,bundle,com.google.gdt.eclipse.platform.e37,2.5.2.v201202290255-rel-r37,"com.google.gdt.eclipse.platform.e37",1332579754115
-started,bundle,com.google.gdt.eclipse.platform.shared,2.5.2.v201202290255-rel-r37,"com.google.gdt.eclipse.platform.shared",1332579754116
-started,bundle,com.google.gdt.eclipse.suite.ext,2.5.2.v201202290255-rel-r37,"com.google.gdt.eclipse.suite.ext",1332579754116
-started,bundle,com.google.gwt.eclipse.core,2.5.2.v201202290255-rel-r37,"com.google.gwt.eclipse.core",1332579754196
-started,bundle,org.eclipse.mylyn.commons.ui,3.6.1.v20110720-0100,"org.eclipse.mylyn.commons.ui",1332579754240
-started,bundle,org.eclipse.wb.core,1.2.0.r37x201112290923,"org.eclipse.wb.core",1332579754297
-started,bundle,org.eclipse.wb.core.lib,1.2.0.r37x201112290923,"org.eclipse.wb.core.lib",1332579754384
-os,sysinfo,,,"macosx",1332579754404
-arch,sysinfo,,,"x86_64",1332579754404
-ws,sysinfo,,,"cocoa",1332579754404
-locale,sysinfo,,,"ja_JP",1332579754404
-processors,sysinfo,,,"8",1332579754404
-java.runtime.name,sysinfo,,,"Java(TM) SE Runtime Environment",1332579754404
-java.runtime.version,sysinfo,,,"1.6.0_29-b11-402-11D50d",1332579754404
-java.specification.name,sysinfo,,,"Java Platform API Specification",1332579754404
-java.specification.vendor,sysinfo,,,"Sun Microsystems Inc.",1332579754404
-java.specification.version,sysinfo,,,"1.6",1332579754404
-java.vendor,sysinfo,,,"Apple Inc.",1332579754404
-java.version,sysinfo,,,"1.6.0_29",1332579754404
-java.vm.info,sysinfo,,,"mixed mode",1332579754404
-java.vm.name,sysinfo,,,"Java HotSpot(TM) 64-Bit Server VM",1332579754404
-java.vm.specification.name,sysinfo,,,"Java Virtual Machine Specification",1332579754404
-java.vm.specification.vendor,sysinfo,,,"Sun Microsystems Inc.",1332579754404
-java.vm.specification.version,sysinfo,,,"1.0",1332579754404
-java.vm.vendor,sysinfo,,,"Apple Inc.",1332579754404
-java.vm.version,sysinfo,,,"20.4-b02-402",1332579754404
-started,bundle,org.eclipse.m2e.usagedata,1.0.200.20111228-1245,"org.eclipse.m2e.usagedata",1332579754428
-activated,view,org.eclipse.jdt.ui,3.7.0.v20110531-1200,"org.eclipse.jdt.ui.PackageExplorer",1332579755091
-started,bundle,org.eclipse.wb.discovery.ui,1.0.0.r37x201106081733,"org.eclipse.wb.discovery.ui",1332579755730
-started,bundle,com.google.gdt.eclipse.designer.hosted,2.5.0.r37x201112291019,"com.google.gdt.eclipse.designer.hosted",1332579756044
-started,bundle,com.google.gdt.eclipse.designer.UiBinder,2.5.0.r37x201112291029,"com.google.gdt.eclipse.designer.UiBinder",1332579756097
-opened,view,org.eclipse.ui.ide,3.7.0.I20110519-0100,"org.eclipse.ui.views.ProblemView",1332579757458
-started,bundle,com.google.gdt.eclipse.maven,2.5.2.v201202290255-rel-r37,"com.google.gdt.eclipse.maven",1332579757481
-started,bundle,com.google.gdt.eclipse.suite,2.5.2.v201202290255-rel-r37,"com.google.gdt.eclipse.suite",1332579757602
-started,bundle,org.eclipse.core.variables,3.2.500.v20110511,"org.eclipse.core.variables",1332579757719
-opened,editor,org.eclipse.jdt.ui,3.7.0.v20110531-1200,"org.eclipse.jdt.ui.CompilationUnitEditor",1332579767036
-activated,editor,org.eclipse.jdt.ui,3.7.0.v20110531-1200,"org.eclipse.jdt.ui.CompilationUnitEditor",1332579767156
-deactivated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1332579772998
-executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.edit.findReplace",1332579773030
-activated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1332579776193
-started,bundle,org.eclipse.jdt.junit,3.7.0.v20110505-0800,"org.eclipse.jdt.junit",1332579825749
-executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.file.save",1332579841475
-started,bundle,org.eclipse.debug.ui,3.7.0.v20110518,"org.eclipse.debug.ui",1332579842328
-started,bundle,org.eclipse.jdt.debug,3.7.0.v20110509,"org.eclipse.jdt.debug",1332579842907
-started,bundle,org.eclipse.jdt.debug.ui,3.6.0.v20110512,"org.eclipse.jdt.debug.ui",1332579843400
-executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.edit.cut",1332579893425
-executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.edit.paste",1332579894190
-executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.edit.copy",1332579909503
-executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.edit.paste",1332579911667
-executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.file.save",1332579951813
-executed,command,com.google.gdt.eclipse.suite,2.5.2.v201202290255-rel-r37,"com.google.gdt.eclipse.suite.GDTPulldown",1332579955765
-started,bundle,org.eclipse.wst.sse.core,1.1.602.v201112071516,"org.eclipse.wst.sse.core",1332579958280
-started,bundle,org.eclipse.wst.xml.core,1.1.602.v201201091944,"org.eclipse.wst.xml.core",1332579958316
-started,bundle,org.eclipse.wst.common.uriresolver,1.1.401.v201004280700,"org.eclipse.wst.common.uriresolver",1332579958436
-deactivated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1332579958510
-activated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1332579961288
-executed,command,com.google.appengine.eclipse.core,2.5.2.v201202290255-rel-r37,"com.google.appengine.eclipse.core.deployToGoogle",1332579963392
-deactivated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1332579964408
-activated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1332579975971
-deactivated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1332579981583
-activated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1332580255333
-deactivated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1332580268719
-activated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1332580271481
-closed,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1332580271748
-started,bundle,org.eclipse.compare,3.5.200.I20110525-0800,"org.eclipse.compare",1332580272383
-stopped,bundle,org.eclipse.m2e.logback.configuration,1.0.0.20110607-2117,"org.eclipse.m2e.logback.configuration",1332580272725
-stopped,bundle,org.eclipse.ui.cheatsheets,3.4.100.v20110425,"org.eclipse.ui.cheatsheets",1332580272726
-stopped,bundle,org.eclipse.help.ui,3.5.100.v20110425,"org.eclipse.help.ui",1332580272726
-stopped,bundle,org.eclipse.help.webapp,3.6.0.v20110518,"org.eclipse.help.webapp",1332580272726
-stopped,bundle,org.eclipse.epp.mpc.ui,1.1.0.I20110525-0742,"org.eclipse.epp.mpc.ui",1332580272727
-stopped,bundle,org.eclipse.epp.usagedata.ui,1.3.1.R201106061540,"org.eclipse.epp.usagedata.ui",1332580272727
-stopped,bundle,org.eclipse.ui.intro.universal,3.2.500.v20110510,"org.eclipse.ui.intro.universal",1332580272727
-stopped,bundle,org.eclipse.ui.intro,3.4.100.v20110425,"org.eclipse.ui.intro",1332580272727
-stopped,bundle,org.eclipse.help.base,3.6.0.v201106131736,"org.eclipse.help.base",1332580272727
-stopped,bundle,org.eclipse.equinox.http.jetty,2.0.100.v20110502,"org.eclipse.equinox.http.jetty",1332580272728
-stopped,bundle,com.google.appengine.eclipse.datatools,2.5.2.v201202290255-rel-r37,"com.google.appengine.eclipse.datatools",1332580272728
-stopped,bundle,com.google.appengine.eclipse.sdkbundle,1.6.3.v201202290255r37,"com.google.appengine.eclipse.sdkbundle",1332580272728
-stopped,bundle,com.google.gdt.eclipse.appengine.rpc,2.5.2.v201202290255-rel-r37,"com.google.gdt.eclipse.appengine.rpc",1332580272728
-stopped,bundle,com.google.gdt.eclipse.gph.e36,2.5.2.v201202290255-rel-r37,"com.google.gdt.eclipse.gph.e36",1332580272729
-stopped,bundle,com.google.gdt.eclipse.gph.hge,2.5.2.v201202290255-rel-r37,"com.google.gdt.eclipse.gph.hge",1332580272729
-stopped,bundle,com.google.gdt.eclipse.gph.subclipse,2.5.2.v201202290255-rel-r37,"com.google.gdt.eclipse.gph.subclipse",1332580272729
-stopped,bundle,com.google.gdt.eclipse.gph.subversive,2.5.2.v201202290255-rel-r37,"com.google.gdt.eclipse.gph.subversive",1332580272729
-stopped,bundle,com.google.gdt.eclipse.suite.ext,2.5.2.v201202290255-rel-r37,"com.google.gdt.eclipse.suite.ext",1332580272729
-stopped,bundle,com.google.gdt.eclipse.gph,2.5.2.v201202290255-rel-r37,"com.google.gdt.eclipse.gph",1332580272730
-stopped,bundle,com.google.gdt.eclipse.maven.e37,2.5.2.v201202290255-rel-r37,"com.google.gdt.eclipse.maven.e37",1332580272730
-stopped,bundle,com.google.gdt.eclipse.maven,2.5.2.v201202290255-rel-r37,"com.google.gdt.eclipse.maven",1332580272730
-stopped,bundle,com.google.gdt.eclipse.suite,2.5.2.v201202290255-rel-r37,"com.google.gdt.eclipse.suite",1332580272730
-stopped,bundle,com.google.gdt.eclipse.appsmarketplace,2.5.2.v201202290255-rel-r37,"com.google.gdt.eclipse.appsmarketplace",1332580272731
-stopped,bundle,com.google.appengine.eclipse.core,2.5.2.v201202290255-rel-r37,"com.google.appengine.eclipse.core",1332580272731
-stopped,bundle,com.google.gdt.eclipse.login,2.5.2.v201202290255-rel-r37,"com.google.gdt.eclipse.login",1332580272731
-stopped,bundle,com.google.gdt.eclipse.managedapis,2.5.2.v201202290255-rel-r37,"com.google.gdt.eclipse.managedapis",1332580272732
-stopped,bundle,com.google.gwt.eclipse.oophm,2.5.2.v201202290255-rel-r37,"com.google.gwt.eclipse.oophm",1332580272733
-stopped,bundle,com.google.gwt.eclipse.sdkbundle,2.4.0.v201202290255-rel-r37,"com.google.gwt.eclipse.sdkbundle",1332580272733
-stopped,bundle,com.google.gwt.eclipse.core,2.5.2.v201202290255-rel-r37,"com.google.gwt.eclipse.core",1332580272855
-stopped,bundle,com.google.gdt.eclipse.core,2.5.2.v201202290255-rel-r37,"com.google.gdt.eclipse.core",1332580272856
-stopped,bundle,com.google.gdt.eclipse.platform,2.5.2.v201202290255-rel-r37,"com.google.gdt.eclipse.platform",1332580272856
-stopped,bundle,com.google.gdt.eclipse.platform.e37,2.5.2.v201202290255-rel-r37,"com.google.gdt.eclipse.platform.e37",1332580272856
-stopped,bundle,org.eclipse.m2e.discovery,1.0.200.20111228-1245,"org.eclipse.m2e.discovery",1332580272857
-stopped,bundle,org.eclipse.m2e.refactoring,1.0.200.20111228-1245,"org.eclipse.m2e.refactoring",1332580272857
-stopped,bundle,org.eclipse.m2e.editor,1.0.200.20111228-1245,"org.eclipse.m2e.editor",1332580272857
-stopped,bundle,org.eclipse.m2e.editor.xml,1.0.200.20111228-1245,"org.eclipse.m2e.editor.xml",1332580272857
-stopped,bundle,org.eclipse.m2e.jdt,1.0.200.20111228-1245,"org.eclipse.m2e.jdt",1332580272857
-stopped,bundle,org.eclipse.m2e.launching,1.0.200.20111228-1245,"org.eclipse.m2e.launching",1332580272858
-stopped,bundle,org.eclipse.m2e.usagedata,1.0.200.20111228-1245,"org.eclipse.m2e.usagedata",1332580272858
-stopped,bundle,org.eclipse.m2e.core.ui,1.0.200.20111228-1245,"org.eclipse.m2e.core.ui",1332580272858
-stopped,bundle,org.eclipse.m2e.core,1.0.200.20111228-1245,"org.eclipse.m2e.core",1332580272858
-stopped,bundle,org.eclipse.mylyn.ide.ant,3.6.0.v20110608-1400,"org.eclipse.mylyn.ide.ant",1332580272858
-stopped,bundle,org.eclipse.ant.ui,3.5.100.v20110510,"org.eclipse.ant.ui",1332580272858
-stopped,bundle,org.eclipse.ant.launching,1.0.100.v20110506,"org.eclipse.ant.launching",1332580272858
-stopped,bundle,org.eclipse.equinox.p2.ui.sdk,1.0.200.v20110502-1955,"org.eclipse.equinox.p2.ui.sdk",1332580272858
-stopped,bundle,org.eclipse.mylyn.java.tasks,3.6.0.v20110608-1400,"org.eclipse.mylyn.java.tasks",1332580272859
-stopped,bundle,org.eclipse.mylyn.java.ui,3.6.0.v20110608-1400,"org.eclipse.mylyn.java.ui",1332580272859
-stopped,bundle,com.google.gdt.eclipse.designer.UiBinder,2.5.0.r37x201112291029,"com.google.gdt.eclipse.designer.UiBinder",1332580272860
-stopped,bundle,com.google.gdt.eclipse.designer.gpe,2.5.0.r37x201201030222,"com.google.gdt.eclipse.designer.gpe",1332580272860
-stopped,bundle,com.google.gdt.eclipse.designer,2.5.0.r37x201112291029,"com.google.gdt.eclipse.designer",1332580272861
-stopped,bundle,org.eclipse.jdt.junit,3.7.0.v20110505-0800,"org.eclipse.jdt.junit",1332580272861
-stopped,bundle,org.eclipse.jdt.apt.ui,3.3.300.v20110305-1450,"org.eclipse.jdt.apt.ui",1332580272861
-stopped,bundle,org.eclipse.jdt.debug.ui,3.6.0.v20110512,"org.eclipse.jdt.debug.ui",1332580272905
-stopped,bundle,com.google.gdt.eclipse.platform.shared,2.5.2.v201202290255-rel-r37,"com.google.gdt.eclipse.platform.shared",1332580272905
-stopped,bundle,org.eclipse.wb.swing.FormLayout,1.0.0.r37x201106081552,"org.eclipse.wb.swing.FormLayout",1332580272905
-stopped,bundle,org.eclipse.wb.swing.MigLayout,1.0.0.r37x201106081552,"org.eclipse.wb.swing.MigLayout",1332580272905
-stopped,bundle,org.eclipse.wb.swing.databinding,1.0.0.r37x201106081552,"org.eclipse.wb.swing.databinding",1332580272905
-stopped,bundle,org.eclipse.wb.swing.java6,1.0.0.r37x201106081552,"org.eclipse.wb.swing.java6",1332580272905
-stopped,bundle,org.eclipse.wb.swing.jsr296,1.0.0.r37x201106081552,"org.eclipse.wb.swing.jsr296",1332580272906
-stopped,bundle,org.eclipse.wb.swing,1.0.0.r37x201106081552,"org.eclipse.wb.swing",1332580272906
-stopped,bundle,org.eclipse.wb.core.ui,1.0.0.r37x201106081733,"org.eclipse.wb.core.ui",1332580272906
-stopped,bundle,org.eclipse.wb.layout.group,1.0.0.r37x201106081642,"org.eclipse.wb.layout.group",1332580272906
-stopped,bundle,com.google.gdt.eclipse.designer.hosted.2_0.webkit,2.5.0.r37x201112291019,"com.google.gdt.eclipse.designer.hosted.2_0.webkit",1332580272906
-stopped,bundle,com.google.gdt.eclipse.designer.hosted.2_0,2.5.0.r37x201112291019,"com.google.gdt.eclipse.designer.hosted.2_0",1332580272906
-stopped,bundle,com.google.gdt.eclipse.designer.hosted.2_2.webkit,2.5.0.r37x201112291019,"com.google.gdt.eclipse.designer.hosted.2_2.webkit",1332580272906
-stopped,bundle,com.google.gdt.eclipse.designer.hosted.2_2,2.5.0.r37x201112291019,"com.google.gdt.eclipse.designer.hosted.2_2",1332580272906
-stopped,bundle,com.google.gdt.eclipse.designer.hosted,2.5.0.r37x201112291019,"com.google.gdt.eclipse.designer.hosted",1332580272906
-stopped,bundle,org.eclipse.wb.core.databinding.xml,1.2.0.r37x201112291009,"org.eclipse.wb.core.databinding.xml",1332580272906
-stopped,bundle,org.eclipse.wb.core.databinding,1.2.0.r37x201112290923,"org.eclipse.wb.core.databinding",1332580272906
-stopped,bundle,org.eclipse.wb.core.xml,1.2.0.r37x201112291009,"org.eclipse.wb.core.xml",1332580272906
-stopped,bundle,org.eclipse.wb.css,1.2.0.r37x201112290951,"org.eclipse.wb.css",1332580272906
-stopped,bundle,org.eclipse.wb.os.macosx,1.2.0.r37x201112290923,"org.eclipse.wb.os.macosx",1332580272906
-stopped,bundle,org.eclipse.wb.core,1.2.0.r37x201112290923,"org.eclipse.wb.core",1332580272907
-stopped,bundle,org.eclipse.jdt.ui,3.7.0.v20110531-1200,"org.eclipse.jdt.ui",1332580272936
-stopped,bundle,org.eclipse.wst.dtd.ui,1.0.600.v201103171359,"org.eclipse.wst.dtd.ui",1332580272936
-stopped,bundle,org.eclipse.wst.xsd.ui,1.2.404.v201105050216,"org.eclipse.wst.xsd.ui",1332580272936
-stopped,bundle,org.eclipse.wst.css.ui,1.0.601.v201201101544,"org.eclipse.wst.css.ui",1332580272936
-stopped,bundle,org.eclipse.wst.xml.ui,1.1.202.v201112071516,"org.eclipse.wst.xml.ui",1332580272936
-stopped,bundle,org.eclipse.wst.common.ui,1.1.500.v200911190730,"org.eclipse.wst.common.ui",1332580272936
-stopped,bundle,org.eclipse.wst.jsdt.ui,1.1.102.v201201131900,"org.eclipse.wst.jsdt.ui",1332580272936
-stopped,bundle,org.eclipse.wst.sse.ui,1.3.2.v201201041522,"org.eclipse.wst.sse.ui",1332580272936
-stopped,bundle,org.eclipse.search,3.7.0.v20110505-0800,"org.eclipse.search",1332580272958
-stopped,bundle,org.eclipse.mylyn.commons.team,0.8.0.v20110608-1400,"org.eclipse.mylyn.commons.team",1332580272959
-stopped,bundle,org.eclipse.mylyn.team.ui,3.6.0.v20110608-1400,"org.eclipse.mylyn.team.ui",1332580272959
-stopped,bundle,org.eclipse.ui.navigator.resources,3.4.300.I20110421-1800,"org.eclipse.ui.navigator.resources",1332580272959
-stopped,bundle,org.eclipse.ltk.ui.refactoring,3.6.0.v20110505-0800,"org.eclipse.ltk.ui.refactoring",1332580272959
-stopped,bundle,org.eclipse.mylyn.bugzilla.ui,3.6.0.v20110608-1400,"org.eclipse.mylyn.bugzilla.ui",1332580272959
-stopped,bundle,org.eclipse.mylyn.ide.ui,3.6.0.v20110608-1400,"org.eclipse.mylyn.ide.ui",1332580272959
-stopped,bundle,org.eclipse.mylyn.resources.ui,3.6.0.v20110608-1400,"org.eclipse.mylyn.resources.ui",1332580272959
-stopped,bundle,org.eclipse.mylyn.wikitext.tasks.ui,1.5.0.v20110608-1400,"org.eclipse.mylyn.wikitext.tasks.ui",1332580272959
-stopped,bundle,org.eclipse.mylyn.context.ui,3.6.0.v20110608-1400,"org.eclipse.mylyn.context.ui",1332580272959
-stopped,bundle,org.eclipse.mylyn.help.ui,3.6.0.v20110608-1400,"org.eclipse.mylyn.help.ui",1332580272959
-stopped,bundle,org.eclipse.mylyn.tasks.bugs,3.6.0.v20110608-1400,"org.eclipse.mylyn.tasks.bugs",1332580272959
-stopped,bundle,org.eclipse.mylyn.tasks.ui,3.6.0.v20110608-1400,"org.eclipse.mylyn.tasks.ui",1332580272960
-stopped,bundle,org.eclipse.team.cvs.ui,3.3.400.I20110510-0800,"org.eclipse.team.cvs.ui",1332580272960
-stopped,bundle,org.eclipse.team.ui,3.6.100.I20110525-0800,"org.eclipse.team.ui",1332580272960
-stopped,bundle,org.eclipse.compare,3.5.200.I20110525-0800,"org.eclipse.compare",1332580272960
-stopped,bundle,org.eclipse.ui.externaltools,3.2.0.v20110506,"org.eclipse.ui.externaltools",1332580272960
-stopped,bundle,org.eclipse.debug.ui,3.7.0.v20110518,"org.eclipse.debug.ui",1332580272990
-stopped,bundle,org.eclipse.mylyn.wikitext.ui,1.5.0.v20110608-1400,"org.eclipse.mylyn.wikitext.ui",1332580272990
-stopped,bundle,org.eclipse.ui.console,3.5.100.v20110511,"org.eclipse.ui.console",1332580272991
-stopped,bundle,org.eclipse.mylyn.commons.ui,3.6.1.v20110720-0100,"org.eclipse.mylyn.commons.ui",1332580272991
-stopped,bundle,org.eclipse.ui.editors,3.7.0.v20110517-0800,"org.eclipse.ui.editors",1332580272991
-stopped,bundle,org.eclipse.wst.common.snippets,1.2.100.v201103281740,"org.eclipse.wst.common.snippets",1332580272992
-stopped,bundle,org.eclipse.ui.workbench.texteditor,3.7.0.v20110505-0800,"org.eclipse.ui.workbench.texteditor",1332580272992
-stopped,bundle,org.eclipse.compare.core,3.5.200.I20110208-0800,"org.eclipse.compare.core",1332580272992
+started,bundle,org.eclipse.update.core,3.2.500.v20110330,"org.eclipse.update.core",1334370678732
+started,bundle,com.google.appengine.eclipse.core,2.5.2.v201202290255-rel-r37,"com.google.appengine.eclipse.core",1334370678733
+started,bundle,com.google.gdt.eclipse.appengine.rpc,2.5.2.v201202290255-rel-r37,"com.google.gdt.eclipse.appengine.rpc",1334370678746
+started,bundle,com.google.gdt.eclipse.core,2.5.2.v201202290255-rel-r37,"com.google.gdt.eclipse.core",1334370678747
+started,bundle,com.google.gdt.eclipse.designer,2.5.0.r37x201112291029,"com.google.gdt.eclipse.designer",1334370678774
+started,bundle,com.google.gdt.eclipse.login,2.5.2.v201202290255-rel-r37,"com.google.gdt.eclipse.login",1334370678775
+started,bundle,com.google.gdt.eclipse.managedapis,2.5.2.v201202290255-rel-r37,"com.google.gdt.eclipse.managedapis",1334370678776
+started,bundle,com.google.gdt.eclipse.platform.e37,2.5.2.v201202290255-rel-r37,"com.google.gdt.eclipse.platform.e37",1334370678824
+started,bundle,com.google.gdt.eclipse.platform.shared,2.5.2.v201202290255-rel-r37,"com.google.gdt.eclipse.platform.shared",1334370678825
+started,bundle,com.google.gdt.eclipse.suite.ext,2.5.2.v201202290255-rel-r37,"com.google.gdt.eclipse.suite.ext",1334370678826
+started,bundle,com.google.gwt.eclipse.core,2.5.2.v201202290255-rel-r37,"com.google.gwt.eclipse.core",1334370678882
+started,bundle,org.eclipse.mylyn.commons.ui,3.6.1.v20110720-0100,"org.eclipse.mylyn.commons.ui",1334370678949
+started,bundle,org.eclipse.wb.core,1.2.0.r37x201112290923,"org.eclipse.wb.core",1334370679005
+started,bundle,org.eclipse.wb.core.lib,1.2.0.r37x201112290923,"org.eclipse.wb.core.lib",1334370679069
+os,sysinfo,,,"macosx",1334370679071
+arch,sysinfo,,,"x86_64",1334370679071
+ws,sysinfo,,,"cocoa",1334370679071
+locale,sysinfo,,,"ja_JP",1334370679071
+processors,sysinfo,,,"8",1334370679071
+java.runtime.name,sysinfo,,,"Java(TM) SE Runtime Environment",1334370679071
+java.runtime.version,sysinfo,,,"1.6.0_31-b04-414-11M3626",1334370679071
+java.specification.name,sysinfo,,,"Java Platform API Specification",1334370679071
+java.specification.vendor,sysinfo,,,"Sun Microsystems Inc.",1334370679071
+java.specification.version,sysinfo,,,"1.6",1334370679071
+java.vendor,sysinfo,,,"Apple Inc.",1334370679071
+java.version,sysinfo,,,"1.6.0_31",1334370679071
+java.vm.info,sysinfo,,,"mixed mode",1334370679071
+java.vm.name,sysinfo,,,"Java HotSpot(TM) 64-Bit Server VM",1334370679071
+java.vm.specification.name,sysinfo,,,"Java Virtual Machine Specification",1334370679071
+java.vm.specification.vendor,sysinfo,,,"Sun Microsystems Inc.",1334370679071
+java.vm.specification.version,sysinfo,,,"1.0",1334370679071
+java.vm.vendor,sysinfo,,,"Apple Inc.",1334370679071
+java.vm.version,sysinfo,,,"20.6-b01-414",1334370679071
+started,bundle,org.eclipse.m2e.usagedata,1.0.200.20111228-1245,"org.eclipse.m2e.usagedata",1334370679134
+started,bundle,org.eclipse.update.scheduler,3.2.300.v20100512,"org.eclipse.update.scheduler",1334370679330
+started,bundle,org.eclipse.wb.discovery.core,1.0.0.r37x201106081733,"org.eclipse.wb.discovery.core",1334370679471
+activated,view,org.eclipse.jdt.ui,3.7.0.v20110531-1200,"org.eclipse.jdt.ui.PackageExplorer",1334370680205
+started,bundle,org.eclipse.wb.discovery.ui,1.0.0.r37x201106081733,"org.eclipse.wb.discovery.ui",1334370681267
+started,bundle,com.google.gdt.eclipse.designer.hosted,2.5.0.r37x201112291019,"com.google.gdt.eclipse.designer.hosted",1334370681408
+started,bundle,com.google.gdt.eclipse.designer.UiBinder,2.5.0.r37x201112291029,"com.google.gdt.eclipse.designer.UiBinder",1334370681483
+started,bundle,com.google.gdt.eclipse.maven,2.5.2.v201202290255-rel-r37,"com.google.gdt.eclipse.maven",1334370682923
+started,bundle,com.google.gdt.eclipse.suite,2.5.2.v201202290255-rel-r37,"com.google.gdt.eclipse.suite",1334370683052
+started,bundle,org.eclipse.core.variables,3.2.500.v20110511,"org.eclipse.core.variables",1334370684061
+started,bundle,org.eclipse.debug.ui,3.7.0.v20110518,"org.eclipse.debug.ui",1334370685286
+started,bundle,org.eclipse.jdt.debug,3.7.0.v20110509,"org.eclipse.jdt.debug",1334370685909
+started,bundle,org.eclipse.jdt.debug.ui,3.6.0.v20110512,"org.eclipse.jdt.debug.ui",1334370690518
+activated,editor,org.eclipse.jdt.ui,3.7.0.v20110531-1200,"org.eclipse.jdt.ui.CompilationUnitEditor",1334370690624
+executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.file.save",1334370703672
+deactivated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1334370708901
+activated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1334370729151
INDEX VERSION 1.126+/Users/yuji/prog/workspaces/TrainDelayBot/source/workspace/.metadata/.plugins/org.eclipse.jdt.core
-4249315662.index
-2125629668.index
-1833648217.index
-3721599461.index
-3321539481.index
-2324327163.index
-393625461.index
-770573466.index
-1702319727.index
-3337990103.index
+2570668310.index
+765977872.index
+3000285004.index
+1384487945.index
121238776.index
-4238209716.index
-4286473667.index
-156905802.index
-3712507179.index
-272178059.index
-4210253391.index
+1438997932.index
2487942853.index
-545044415.index
-3954040986.index
-2545238116.index
-3302703152.index
-84777399.index
-1819685514.index
-1884285145.index
-3000285004.index
551190387.index
-757901550.index
1457489534.index
-1384487945.index
+84777399.index
2265792888.index
+1702319727.index
+3302703152.index
2765345590.index
-1438997932.index
-765977872.index
+4249315662.index
+156905802.index
+4286473667.index
+2324327163.index
+3712507179.index
+272178059.index
324969621.index
+3321539481.index
+1884285145.index
+393625461.index
+4210253391.index
+2545238116.index
+3954040986.index
+757901550.index
+2408811069.index
+3721599461.index
+1819685514.index
+3337990103.index
1271342938.index
-450555687.index
-3266567714.index
-2326659272.index
+1833648217.index
+545044415.index
3004609673.index
-471433581.index
-2570668310.index
+450555687.index
3703194086.index
-2408811069.index
+770573466.index
+2326659272.index
+3266567714.index
+2125629668.index
+4238209716.index
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<dirs>
-<entry loc="/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home" stamp="1321316278000"/>
+<entry loc="/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home" stamp="1333981811000"/>
<entry loc="C:\Program Files\Java\jre6" stamp="1308232866937"/>
</dirs>
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<libraryInfos>
-<libraryInfo home="/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home" version="1.6.0_29">
+<libraryInfo home="/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home" version="1.6.0_31">
<bootpath>
<entry path="/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Classes/jsfd.jar"/>
<entry path="/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Classes/classes.jar"/>
<?xml version="1.0" encoding="UTF-8"?>
<section name="Workbench">
<item value="2" key="TypeHierarchyViewPart.hierarchyview"/>
- <item value="3" key="TypeHierarchyViewPart.orientation"/>
<item value="false" key="TypeHierarchyViewPart.qualifiednames"/>
+ <item value="3" key="TypeHierarchyViewPart.orientation"/>
<item value="false" key="TypeHierarchyViewPart.linkeditors"/>
<section name="OptionalMessageDialog.hide.">
<item value="true" key="org.eclipse.jdt.ui.typecomment.deprecated"/>
<section name="quick_assist_proposal_size">
</section>
<section name="SourceActionDialog.methods">
- <item value="false" key="Comments"/>
<item value="1" key="VisibilityModifier"/>
+ <item value="false" key="Comments"/>
<item value="false" key="SynchronizedModifier"/>
<item value="false" key="FinalModifier"/>
</section>
<section name="RenameInformationPopup">
</section>
<section name="org.eclipse.ltk.ui.refactoring.settings">
- <item value="false" key="renameSubpackages"/>
- <item value="false" key="updateQualifiedNames"/>
<item value="*" key="patterns"/>
+ <item value="false" key="updateQualifiedNames"/>
+ <item value="false" key="renameSubpackages"/>
<item value="false" key="updateTextualMatches"/>
</section>
<section name="org.eclipse.jdt.internal.ui.text.QuickOutline">
2012-03-20 08:31:50,763 [org.eclipse.jdt.internal.ui.text.JavaReconciler] INFO org.mortbay.log - Logging to Logger[org.mortbay.log] via org.mortbay.log.Slf4jLog
2012-03-24 16:23:44,891 [org.eclipse.jdt.internal.ui.text.JavaReconciler] INFO org.mortbay.log - Logging to Logger[org.mortbay.log] via org.mortbay.log.Slf4jLog
2012-03-24 18:02:28,484 [org.eclipse.jdt.internal.ui.text.JavaReconciler] INFO org.mortbay.log - Logging to Logger[org.mortbay.log] via org.mortbay.log.Slf4jLog
+2012-04-09 19:40:33,857 [org.eclipse.jdt.internal.ui.text.JavaReconciler] INFO org.mortbay.log - Logging to Logger[org.mortbay.log] via org.mortbay.log.Slf4jLog
+2012-04-14 11:31:13,058 [org.eclipse.jdt.internal.ui.text.JavaReconciler] INFO org.mortbay.log - Logging to Logger[org.mortbay.log] via org.mortbay.log.Slf4jLog
<section name="ShowViewDialog">
<item value="436" key="DIALOG_WIDTH"/>
<item value="56" key="DIALOG_Y_ORIGIN"/>
- <item value="348" key="DIALOG_X_ORIGIN"/>
<item value="456" key="DIALOG_HEIGHT"/>
+ <item value="348" key="DIALOG_X_ORIGIN"/>
<item value="1|メイリオ|9.0|0|WINDOWS|1|-12|0|0|0|400|0|0|0|1|0|0|0|0|メイリオ" key="DIALOG_FONT_NAME"/>
</section>
<section name="ImportExportAction">
<?xml version="1.0" encoding="UTF-8"?>
-<workbench progressCount="43" version="2.0">
+<workbench progressCount="34" version="2.0">
<workbenchAdvisor/>
<window height="783" width="1241" x="73" y="26">
<fastViewData fastViewLocation="1024"/>
</view>
<view id="org.eclipse.ui.views.ProblemView" partName="Problems">
<viewState PRIMARY_SORT_FIELD="org.eclipse.ui.ide.severityAndDescriptionField" categoryGroup="org.eclipse.ui.ide.severity" markerContentGenerator="org.eclipse.ui.ide.problemsGenerator" partName="Problems">
-<expanded>
-<category IMemento.internal.id="Warnings (3 items)"/>
-</expanded>
<columnWidths org.eclipse.ui.ide.locationField="180" org.eclipse.ui.ide.markerType="180" org.eclipse.ui.ide.pathField="240" org.eclipse.ui.ide.resourceField="180" org.eclipse.ui.ide.severityAndDescriptionField="600"/>
<visible IMemento.internal.id="org.eclipse.ui.ide.severityAndDescriptionField"/>
<visible IMemento.internal.id="org.eclipse.ui.ide.resourceField"/>
<viewState/>
</view>
</views>
-<perspectives activePart="org.eclipse.jdt.ui.CompilationUnitEditor" activePerspective="org.eclipse.jdt.ui.JavaPerspective">
+<perspectives activePart="org.eclipse.jdt.ui.PackageExplorer" activePerspective="org.eclipse.jdt.ui.JavaPerspective">
<perspective editorAreaTrimState="2" editorAreaVisible="1" fixed="0" version="0.016">
<descriptor class="org.eclipse.jdt.internal.ui.JavaPerspectiveFactory" id="org.eclipse.jdt.ui.JavaPerspective" label="Java"/>
<alwaysOnActionSet id="org.eclipse.mylyn.context.ui.actionSet"/>
int N = 100;\r
\r
String sample = tweets.get(mindex).getText();\r
- //sample = CommonUtil.replaceString(sample, "@", "(a)");\r
+ sample = CommonUtil.replaceString(sample, "@", "\81\97");\r
sample = StringUtility.parseSubstring(sample, N);\r
message += df.format(date) + "(" + count + "\83c\83C\81[\83g)" + " " + sample;\r
}\r