OSDN Git Service

Txxxxx
authorYuji Konishi <yuji.k64613@gmail.com>
Tue, 20 Mar 2012 03:29:46 +0000 (12:29 +0900)
committerYuji Konishi <yuji.k64613@gmail.com>
Tue, 20 Mar 2012 03:29:46 +0000 (12:29 +0900)
262 files changed:
workspace/.metadata/.log
workspace/.metadata/.mylyn/.tasks.xml.zip
workspace/.metadata/.mylyn/tasks.xml.zip
workspace/.metadata/.plugins/com.google.gdt.eclipse.managedapis/icon_caches/temp20808907331581361121331738399321038000 [deleted file]
workspace/.metadata/.plugins/com.google.gdt.eclipse.managedapis/icon_caches/temp50807651823440362971331738401163307000/cache_0 [deleted file]
workspace/.metadata/.plugins/com.google.gdt.eclipse.managedapis/icon_caches/temp50807651823440362971331738401163307000/cache_1 [deleted file]
workspace/.metadata/.plugins/com.google.gdt.eclipse.managedapis/icon_caches/temp50807651823440362971331738401163307000/cache_10 [deleted file]
workspace/.metadata/.plugins/com.google.gdt.eclipse.managedapis/icon_caches/temp50807651823440362971331738401163307000/cache_11 [deleted file]
workspace/.metadata/.plugins/com.google.gdt.eclipse.managedapis/icon_caches/temp50807651823440362971331738401163307000/cache_12 [deleted file]
workspace/.metadata/.plugins/com.google.gdt.eclipse.managedapis/icon_caches/temp50807651823440362971331738401163307000/cache_13 [deleted file]
workspace/.metadata/.plugins/com.google.gdt.eclipse.managedapis/icon_caches/temp50807651823440362971331738401163307000/cache_14 [deleted file]
workspace/.metadata/.plugins/com.google.gdt.eclipse.managedapis/icon_caches/temp50807651823440362971331738401163307000/cache_15 [deleted file]
workspace/.metadata/.plugins/com.google.gdt.eclipse.managedapis/icon_caches/temp50807651823440362971331738401163307000/cache_2 [deleted file]
workspace/.metadata/.plugins/com.google.gdt.eclipse.managedapis/icon_caches/temp50807651823440362971331738401163307000/cache_3 [deleted file]
workspace/.metadata/.plugins/com.google.gdt.eclipse.managedapis/icon_caches/temp50807651823440362971331738401163307000/cache_4 [deleted file]
workspace/.metadata/.plugins/com.google.gdt.eclipse.managedapis/icon_caches/temp50807651823440362971331738401163307000/cache_5 [deleted file]
workspace/.metadata/.plugins/com.google.gdt.eclipse.managedapis/icon_caches/temp50807651823440362971331738401163307000/cache_6 [deleted file]
workspace/.metadata/.plugins/com.google.gdt.eclipse.managedapis/icon_caches/temp50807651823440362971331738401163307000/cache_7 [deleted file]
workspace/.metadata/.plugins/com.google.gdt.eclipse.managedapis/icon_caches/temp50807651823440362971331738401163307000/cache_8 [deleted file]
workspace/.metadata/.plugins/com.google.gdt.eclipse.managedapis/icon_caches/temp50807651823440362971331738401163307000/cache_9 [deleted file]
workspace/.metadata/.plugins/com.google.gdt.eclipse.managedapis/icon_caches/temp50807651823440362971331738401163307000/icon_bundle_map [deleted file]
workspace/.metadata/.plugins/org.eclipse.core.resources/.history/0/80d0300c106b001115b7b82f2f4ce01a [deleted file]
workspace/.metadata/.plugins/org.eclipse.core.resources/.history/11/d02587b12b7200111835fa7adce7cfd2 [new file with mode: 0644]
workspace/.metadata/.plugins/org.eclipse.core.resources/.history/12/007d7e77666b001115b7b82f2f4ce01a [deleted file]
workspace/.metadata/.plugins/org.eclipse.core.resources/.history/12/50ffd5cf666b001115b7b82f2f4ce01a [deleted file]
workspace/.metadata/.plugins/org.eclipse.core.resources/.history/12/a05269d2307200111835fa7adce7cfd2 [new file with mode: 0644]
workspace/.metadata/.plugins/org.eclipse.core.resources/.history/12/c060b2e5ee6500111e5bcf098ae37dc9 [deleted file]
workspace/.metadata/.plugins/org.eclipse.core.resources/.history/12/d08a7295cc6a0011194396142d5d2649 [deleted file]
workspace/.metadata/.plugins/org.eclipse.core.resources/.history/16/306ca0980e6b001115b7b82f2f4ce01a [deleted file]
workspace/.metadata/.plugins/org.eclipse.core.resources/.history/17/b0c9cd33cd6a0011194396142d5d2649 [deleted file]
workspace/.metadata/.plugins/org.eclipse.core.resources/.history/18/f0d4fbdc2a7200111835fa7adce7cfd2 [new file with mode: 0644]
workspace/.metadata/.plugins/org.eclipse.core.resources/.history/19/e077c3f6ef6500111e5bcf098ae37dc9 [deleted file]
workspace/.metadata/.plugins/org.eclipse.core.resources/.history/1b/10fe5b37106b001115b7b82f2f4ce01a [deleted file]
workspace/.metadata/.plugins/org.eclipse.core.resources/.history/1d/e0adf789317200111835fa7adce7cfd2 [new file with mode: 0644]
workspace/.metadata/.plugins/org.eclipse.core.resources/.history/1e/70271f3a3c7200111835fa7adce7cfd2 [new file with mode: 0644]
workspace/.metadata/.plugins/org.eclipse.core.resources/.history/1e/e063f9a33c7200111835fa7adce7cfd2 [new file with mode: 0644]
workspace/.metadata/.plugins/org.eclipse.core.resources/.history/1f/70c5ac3c106b001115b7b82f2f4ce01a [deleted file]
workspace/.metadata/.plugins/org.eclipse.core.resources/.history/1f/80fdab5dee6500111e5bcf098ae37dc9 [deleted file]
workspace/.metadata/.plugins/org.eclipse.core.resources/.history/2/e0d11725f06500111e5bcf098ae37dc9 [deleted file]
workspace/.metadata/.plugins/org.eclipse.core.resources/.history/20/6040cd9d2b7200111835fa7adce7cfd2 [new file with mode: 0644]
workspace/.metadata/.plugins/org.eclipse.core.resources/.history/25/60c5644e2c7200111835fa7adce7cfd2 [new file with mode: 0644]
workspace/.metadata/.plugins/org.eclipse.core.resources/.history/26/c007379f136b001115b7b82f2f4ce01a [deleted file]
workspace/.metadata/.plugins/org.eclipse.core.resources/.history/29/e064390fea6d001110a188bae663c898 [deleted file]
workspace/.metadata/.plugins/org.eclipse.core.resources/.history/2a/b0b40c7f1e7200111835fa7adce7cfd2 [moved from workspace/.metadata/.plugins/org.eclipse.core.resources/.history/5a/b06ee04af96500111e5bcf098ae37dc9 with 91% similarity]
workspace/.metadata/.plugins/org.eclipse.core.resources/.history/2d/b017f80fce6a0011194396142d5d2649 [deleted file]
workspace/.metadata/.plugins/org.eclipse.core.resources/.history/3/f02e309f2f7200111835fa7adce7cfd2 [new file with mode: 0644]
workspace/.metadata/.plugins/org.eclipse.core.resources/.history/30/d0494b01357200111835fa7adce7cfd2 [new file with mode: 0644]
workspace/.metadata/.plugins/org.eclipse.core.resources/.history/31/5021e69b0e6b001115b7b82f2f4ce01a [deleted file]
workspace/.metadata/.plugins/org.eclipse.core.resources/.history/31/b060e838327200111835fa7adce7cfd2 [new file with mode: 0644]
workspace/.metadata/.plugins/org.eclipse.core.resources/.history/32/c0bf5276cd6a0011194396142d5d2649 [deleted file]
workspace/.metadata/.plugins/org.eclipse.core.resources/.history/33/909857312b7200111835fa7adce7cfd2 [new file with mode: 0644]
workspace/.metadata/.plugins/org.eclipse.core.resources/.history/36/a0dc6068116b001115b7b82f2f4ce01a [deleted file]
workspace/.metadata/.plugins/org.eclipse.core.resources/.history/38/20c52514ea6d001110a188bae663c898 [deleted file]
workspace/.metadata/.plugins/org.eclipse.core.resources/.history/38/5033ef01d46a001115b0ad2bca3cccad [deleted file]
workspace/.metadata/.plugins/org.eclipse.core.resources/.history/38/a0378928357200111835fa7adce7cfd2 [new file with mode: 0644]
workspace/.metadata/.plugins/org.eclipse.core.resources/.history/3a/601d2c33cb6a0011194396142d5d2649 [deleted file]
workspace/.metadata/.plugins/org.eclipse.core.resources/.history/3b/e0dcd1aa0e6b001115b7b82f2f4ce01a [deleted file]
workspace/.metadata/.plugins/org.eclipse.core.resources/.history/3c/a09ae0bacc6a0011194396142d5d2649 [deleted file]
workspace/.metadata/.plugins/org.eclipse.core.resources/.history/3c/e03d0e9bcc6a0011194396142d5d2649 [deleted file]
workspace/.metadata/.plugins/org.eclipse.core.resources/.history/3e/7073d45d2b7200111835fa7adce7cfd2 [new file with mode: 0644]
workspace/.metadata/.plugins/org.eclipse.core.resources/.history/40/b049028871680011170bbf669c61406a [deleted file]
workspace/.metadata/.plugins/org.eclipse.core.resources/.history/42/608da1dbfb6500111e5bcf098ae37dc9 [deleted file]
workspace/.metadata/.plugins/org.eclipse.core.resources/.history/43/70d1a5aeee6500111e5bcf098ae37dc9 [deleted file]
workspace/.metadata/.plugins/org.eclipse.core.resources/.history/45/204c2062136b001115b7b82f2f4ce01a [deleted file]
workspace/.metadata/.plugins/org.eclipse.core.resources/.history/45/20714db22d7200111835fa7adce7cfd2 [new file with mode: 0644]
workspace/.metadata/.plugins/org.eclipse.core.resources/.history/46/20f9def1cc6a0011194396142d5d2649 [deleted file]
workspace/.metadata/.plugins/org.eclipse.core.resources/.history/46/f0fab198676b001115b7b82f2f4ce01a [deleted file]
workspace/.metadata/.plugins/org.eclipse.core.resources/.history/48/b0de5c91ee6500111e5bcf098ae37dc9 [deleted file]
workspace/.metadata/.plugins/org.eclipse.core.resources/.history/49/20d0d043666b001115b7b82f2f4ce01a [deleted file]
workspace/.metadata/.plugins/org.eclipse.core.resources/.history/49/700d25d1ca6a0011194396142d5d2649 [deleted file]
workspace/.metadata/.plugins/org.eclipse.core.resources/.history/4a/400c6497696b001115b7b82f2f4ce01a [deleted file]
workspace/.metadata/.plugins/org.eclipse.core.resources/.history/4a/f0ed907fcd6a0011194396142d5d2649 [deleted file]
workspace/.metadata/.plugins/org.eclipse.core.resources/.history/4b/4011f0b10e6b001115b7b82f2f4ce01a [deleted file]
workspace/.metadata/.plugins/org.eclipse.core.resources/.history/4b/d0ad083bcd6a0011194396142d5d2649 [deleted file]
workspace/.metadata/.plugins/org.eclipse.core.resources/.history/4c/a08eea65f16500111e5bcf098ae37dc9 [deleted file]
workspace/.metadata/.plugins/org.eclipse.core.resources/.history/4d/0001f26f497000111324ab4fa5fd1a16 [new file with mode: 0644]
workspace/.metadata/.plugins/org.eclipse.core.resources/.history/4e/00c0f7d31e7200111835fa7adce7cfd2 [moved from workspace/.metadata/.plugins/org.eclipse.core.resources/.history/96/b0baaa43f96500111e5bcf098ae37dc9 with 74% similarity]
workspace/.metadata/.plugins/org.eclipse.core.resources/.history/4e/f0770210ce6a0011194396142d5d2649 [deleted file]
workspace/.metadata/.plugins/org.eclipse.core.resources/.history/5/903de7bf646b001115b7b82f2f4ce01a [deleted file]
workspace/.metadata/.plugins/org.eclipse.core.resources/.history/50/505796472f7200111835fa7adce7cfd2 [new file with mode: 0644]
workspace/.metadata/.plugins/org.eclipse.core.resources/.history/51/8084fc0fce6a0011194396142d5d2649 [deleted file]
workspace/.metadata/.plugins/org.eclipse.core.resources/.history/52/00e28e351d7200111835fa7adce7cfd2 [moved from workspace/.metadata/.plugins/org.eclipse.core.resources/.history/9/b07f0731ec6d001110a188bae663c898 with 83% similarity]
workspace/.metadata/.plugins/org.eclipse.core.resources/.history/52/303e531b3c7200111835fa7adce7cfd2 [new file with mode: 0644]
workspace/.metadata/.plugins/org.eclipse.core.resources/.history/52/f064530c166b001115b7b82f2f4ce01a [deleted file]
workspace/.metadata/.plugins/org.eclipse.core.resources/.history/54/8010a1162b7200111835fa7adce7cfd2 [new file with mode: 0644]
workspace/.metadata/.plugins/org.eclipse.core.resources/.history/54/f0875033106b001115b7b82f2f4ce01a [deleted file]
workspace/.metadata/.plugins/org.eclipse.core.resources/.history/55/b03bbfdfcc6a0011194396142d5d2649 [deleted file]
workspace/.metadata/.plugins/org.eclipse.core.resources/.history/55/e095f40a357200111835fa7adce7cfd2 [new file with mode: 0644]
workspace/.metadata/.plugins/org.eclipse.core.resources/.history/56/50c41d65ea6d001110a188bae663c898 [deleted file]
workspace/.metadata/.plugins/org.eclipse.core.resources/.history/56/a0a02626106b001115b7b82f2f4ce01a [deleted file]
workspace/.metadata/.plugins/org.eclipse.core.resources/.history/57/3054f86e487000111324ab4fa5fd1a16 [new file with mode: 0644]
workspace/.metadata/.plugins/org.eclipse.core.resources/.history/57/605e696fca6a0011194396142d5d2649 [deleted file]
workspace/.metadata/.plugins/org.eclipse.core.resources/.history/5b/606e02a1126b001115b7b82f2f4ce01a [deleted file]
workspace/.metadata/.plugins/org.eclipse.core.resources/.history/5b/d0097442676b001115b7b82f2f4ce01a [deleted file]
workspace/.metadata/.plugins/org.eclipse.core.resources/.history/5c/c064bd2b2e7200111835fa7adce7cfd2 [new file with mode: 0644]
workspace/.metadata/.plugins/org.eclipse.core.resources/.history/5d/807f3406136b001115b7b82f2f4ce01a [deleted file]
workspace/.metadata/.plugins/org.eclipse.core.resources/.history/5f/80aee7f32c7200111835fa7adce7cfd2 [new file with mode: 0644]
workspace/.metadata/.plugins/org.eclipse.core.resources/.history/61/b009eb56016600111e5bcf098ae37dc9 [deleted file]
workspace/.metadata/.plugins/org.eclipse.core.resources/.history/64/202eb3df166b001115b7b82f2f4ce01a [deleted file]
workspace/.metadata/.plugins/org.eclipse.core.resources/.history/64/4052d11a106b001115b7b82f2f4ce01a [deleted file]
workspace/.metadata/.plugins/org.eclipse.core.resources/.history/64/40939ee9c96a0011194396142d5d2649 [deleted file]
workspace/.metadata/.plugins/org.eclipse.core.resources/.history/67/005e3fd72b7200111835fa7adce7cfd2 [new file with mode: 0644]
workspace/.metadata/.plugins/org.eclipse.core.resources/.history/67/502681e5ca6a0011194396142d5d2649 [deleted file]
workspace/.metadata/.plugins/org.eclipse.core.resources/.history/67/70b740f9f06500111e5bcf098ae37dc9 [deleted file]
workspace/.metadata/.plugins/org.eclipse.core.resources/.history/67/906a95c8ef6500111e5bcf098ae37dc9 [deleted file]
workspace/.metadata/.plugins/org.eclipse.core.resources/.history/69/207abf4d2b7200111835fa7adce7cfd2 [new file with mode: 0644]
workspace/.metadata/.plugins/org.eclipse.core.resources/.history/6b/30f9b77ace6a0011194396142d5d2649 [deleted file]
workspace/.metadata/.plugins/org.eclipse.core.resources/.history/6b/d092c4c42c7200111835fa7adce7cfd2 [new file with mode: 0644]
workspace/.metadata/.plugins/org.eclipse.core.resources/.history/6e/d081bb24666b001115b7b82f2f4ce01a [deleted file]
workspace/.metadata/.plugins/org.eclipse.core.resources/.history/73/204c5c5a666b001115b7b82f2f4ce01a [deleted file]
workspace/.metadata/.plugins/org.eclipse.core.resources/.history/75/101ae08c2c7200111835fa7adce7cfd2 [new file with mode: 0644]
workspace/.metadata/.plugins/org.eclipse.core.resources/.history/75/80253805106b001115b7b82f2f4ce01a [deleted file]
workspace/.metadata/.plugins/org.eclipse.core.resources/.history/76/10fec63be96d001110a188bae663c898 [deleted file]
workspace/.metadata/.plugins/org.eclipse.core.resources/.history/78/a01f6262307200111835fa7adce7cfd2 [new file with mode: 0644]
workspace/.metadata/.plugins/org.eclipse.core.resources/.history/78/c08392a82b7200111835fa7adce7cfd2 [new file with mode: 0644]
workspace/.metadata/.plugins/org.eclipse.core.resources/.history/7c/005c8003136b001115b7b82f2f4ce01a [deleted file]
workspace/.metadata/.plugins/org.eclipse.core.resources/.history/7c/b04d6b77497000111324ab4fa5fd1a16 [new file with mode: 0644]
workspace/.metadata/.plugins/org.eclipse.core.resources/.history/7e/309e4416106b001115b7b82f2f4ce01a [deleted file]
workspace/.metadata/.plugins/org.eclipse.core.resources/.history/80/005b38a12f7200111835fa7adce7cfd2 [new file with mode: 0644]
workspace/.metadata/.plugins/org.eclipse.core.resources/.history/80/f0c02909357200111835fa7adce7cfd2 [new file with mode: 0644]
workspace/.metadata/.plugins/org.eclipse.core.resources/.history/81/00122453646b001115b7b82f2f4ce01a [deleted file]
workspace/.metadata/.plugins/org.eclipse.core.resources/.history/84/40de9e1bca6a0011194396142d5d2649 [deleted file]
workspace/.metadata/.plugins/org.eclipse.core.resources/.history/86/105854fa2a7200111835fa7adce7cfd2 [new file with mode: 0644]
workspace/.metadata/.plugins/org.eclipse.core.resources/.history/87/207ae93a2d7200111835fa7adce7cfd2 [new file with mode: 0644]
workspace/.metadata/.plugins/org.eclipse.core.resources/.history/87/30ef33d6fb6500111e5bcf098ae37dc9 [deleted file]
workspace/.metadata/.plugins/org.eclipse.core.resources/.history/87/50202ce0666b001115b7b82f2f4ce01a [deleted file]
workspace/.metadata/.plugins/org.eclipse.core.resources/.history/89/700228b4676b001115b7b82f2f4ce01a [deleted file]
workspace/.metadata/.plugins/org.eclipse.core.resources/.history/8a/20e5074b347200111835fa7adce7cfd2 [new file with mode: 0644]
workspace/.metadata/.plugins/org.eclipse.core.resources/.history/8a/f0c1cafa166b001115b7b82f2f4ce01a [deleted file]
workspace/.metadata/.plugins/org.eclipse.core.resources/.history/8d/40149274317200111835fa7adce7cfd2 [new file with mode: 0644]
workspace/.metadata/.plugins/org.eclipse.core.resources/.history/8e/301f8940487000111324ab4fa5fd1a16 [moved from workspace/.metadata/.plugins/org.eclipse.core.resources/.history/75/d0a6c02b6f680011170bbf669c61406a with 100% similarity]
workspace/.metadata/.plugins/org.eclipse.core.resources/.history/8e/c05cd6941d7200111835fa7adce7cfd2 [new file with mode: 0644]
workspace/.metadata/.plugins/org.eclipse.core.resources/.history/8f/10bbfe571f7200111835fa7adce7cfd2 [new file with mode: 0644]
workspace/.metadata/.plugins/org.eclipse.core.resources/.history/8f/10f7c380ca6a0011194396142d5d2649 [deleted file]
workspace/.metadata/.plugins/org.eclipse.core.resources/.history/8f/4007ceb2377200111835fa7adce7cfd2 [new file with mode: 0644]
workspace/.metadata/.plugins/org.eclipse.core.resources/.history/93/c032e2e8666b001115b7b82f2f4ce01a [deleted file]
workspace/.metadata/.plugins/org.eclipse.core.resources/.history/97/7061f588ee6500111e5bcf098ae37dc9 [deleted file]
workspace/.metadata/.plugins/org.eclipse.core.resources/.history/97/d0086a6c116b001115b7b82f2f4ce01a [deleted file]
workspace/.metadata/.plugins/org.eclipse.core.resources/.history/99/302553766d6800111d29ec7e4ac25070 [deleted file]
workspace/.metadata/.plugins/org.eclipse.core.resources/.history/99/802014ff1e7200111835fa7adce7cfd2 [new file with mode: 0644]
workspace/.metadata/.plugins/org.eclipse.core.resources/.history/99/f0ca4e2e106b001115b7b82f2f4ce01a [deleted file]
workspace/.metadata/.plugins/org.eclipse.core.resources/.history/9a/80079dc82b7200111835fa7adce7cfd2 [new file with mode: 0644]
workspace/.metadata/.plugins/org.eclipse.core.resources/.history/9b/b025a50c2d7200111835fa7adce7cfd2 [new file with mode: 0644]
workspace/.metadata/.plugins/org.eclipse.core.resources/.history/9c/60e41e32ef6500111e5bcf098ae37dc9 [deleted file]
workspace/.metadata/.plugins/org.eclipse.core.resources/.history/9c/c09796a2666b001115b7b82f2f4ce01a [deleted file]
workspace/.metadata/.plugins/org.eclipse.core.resources/.history/a/202f1e152d7200111835fa7adce7cfd2 [new file with mode: 0644]
workspace/.metadata/.plugins/org.eclipse.core.resources/.history/a0/7088eb5d2c7200111835fa7adce7cfd2 [new file with mode: 0644]
workspace/.metadata/.plugins/org.eclipse.core.resources/.history/a1/00485adb2c7200111835fa7adce7cfd2 [new file with mode: 0644]
workspace/.metadata/.plugins/org.eclipse.core.resources/.history/a3/40fb3d84cd6a0011194396142d5d2649 [deleted file]
workspace/.metadata/.plugins/org.eclipse.core.resources/.history/a3/f0786f29006600111e5bcf098ae37dc9 [deleted file]
workspace/.metadata/.plugins/org.eclipse.core.resources/.history/a4/40c69c5a136b001115b7b82f2f4ce01a [deleted file]
workspace/.metadata/.plugins/org.eclipse.core.resources/.history/a5/30ef1ee3ef6500111e5bcf098ae37dc9 [deleted file]
workspace/.metadata/.plugins/org.eclipse.core.resources/.history/a5/40f42873136b001115b7b82f2f4ce01a [deleted file]
workspace/.metadata/.plugins/org.eclipse.core.resources/.history/a9/00ae725a6b6800111d29ec7e4ac25070 [deleted file]
workspace/.metadata/.plugins/org.eclipse.core.resources/.history/aa/f08063aafb6500111e5bcf098ae37dc9 [deleted file]
workspace/.metadata/.plugins/org.eclipse.core.resources/.history/ab/707a20f5ca6a0011194396142d5d2649 [deleted file]
workspace/.metadata/.plugins/org.eclipse.core.resources/.history/ab/c0c91bed71680011170bbf669c61406a [deleted file]
workspace/.metadata/.plugins/org.eclipse.core.resources/.history/ac/d0ddd996317200111835fa7adce7cfd2 [new file with mode: 0644]
workspace/.metadata/.plugins/org.eclipse.core.resources/.history/b0/603ec758ee6500111e5bcf098ae37dc9 [deleted file]
workspace/.metadata/.plugins/org.eclipse.core.resources/.history/b1/804be6242e7200111835fa7adce7cfd2 [new file with mode: 0644]
workspace/.metadata/.plugins/org.eclipse.core.resources/.history/b5/309651481d7200111835fa7adce7cfd2 [moved from workspace/.metadata/.plugins/org.eclipse.core.resources/.history/2b/902157bbea6d001110a188bae663c898 with 79% similarity]
workspace/.metadata/.plugins/org.eclipse.core.resources/.history/b5/b0c6e469f16500111e5bcf098ae37dc9 [deleted file]
workspace/.metadata/.plugins/org.eclipse.core.resources/.history/b6/d05dcf6f497000111324ab4fa5fd1a16 [moved from workspace/.metadata/.plugins/org.eclipse.core.resources/.history/14/f07a586bf16500111e5bcf098ae37dc9 with 91% similarity]
workspace/.metadata/.plugins/org.eclipse.core.resources/.history/bb/60e0098b0e6b001115b7b82f2f4ce01a [deleted file]
workspace/.metadata/.plugins/org.eclipse.core.resources/.history/bb/a0032a032f7200111835fa7adce7cfd2 [new file with mode: 0644]
workspace/.metadata/.plugins/org.eclipse.core.resources/.history/bb/b0de668c166b001115b7b82f2f4ce01a [deleted file]
workspace/.metadata/.plugins/org.eclipse.core.resources/.history/bb/e02a3d87646b001115b7b82f2f4ce01a [deleted file]
workspace/.metadata/.plugins/org.eclipse.core.resources/.history/bc/30af1db42b7200111835fa7adce7cfd2 [new file with mode: 0644]
workspace/.metadata/.plugins/org.eclipse.core.resources/.history/bd/80845745d46a001115b0ad2bca3cccad [deleted file]
workspace/.metadata/.plugins/org.eclipse.core.resources/.history/c/30ed9725686b001115b7b82f2f4ce01a [deleted file]
workspace/.metadata/.plugins/org.eclipse.core.resources/.history/c/30f7a5ad2f7200111835fa7adce7cfd2 [new file with mode: 0644]
workspace/.metadata/.plugins/org.eclipse.core.resources/.history/c0/10133829f16500111e5bcf098ae37dc9 [deleted file]
workspace/.metadata/.plugins/org.eclipse.core.resources/.history/c0/4003fcad2b7200111835fa7adce7cfd2 [new file with mode: 0644]
workspace/.metadata/.plugins/org.eclipse.core.resources/.history/c1/c0baafb92a7200111835fa7adce7cfd2 [moved from workspace/.metadata/.plugins/org.eclipse.core.resources/.history/f6/a068b38fea6d001110a188bae663c898 with 80% similarity]
workspace/.metadata/.plugins/org.eclipse.core.resources/.history/c2/e0c22d76317200111835fa7adce7cfd2 [new file with mode: 0644]
workspace/.metadata/.plugins/org.eclipse.core.resources/.history/c3/50c1af74ef6500111e5bcf098ae37dc9 [deleted file]
workspace/.metadata/.plugins/org.eclipse.core.resources/.history/c4/3086012e1f7200111835fa7adce7cfd2 [moved from workspace/.metadata/.plugins/org.eclipse.core.resources/.history/3b/302290e7646b001115b7b82f2f4ce01a with 63% similarity]
workspace/.metadata/.plugins/org.eclipse.core.resources/.history/c5/7080417b0e6b001115b7b82f2f4ce01a [deleted file]
workspace/.metadata/.plugins/org.eclipse.core.resources/.history/c6/10cbb6e8686b001115b7b82f2f4ce01a [deleted file]
workspace/.metadata/.plugins/org.eclipse.core.resources/.history/c8/601fc3751f7200111835fa7adce7cfd2 [new file with mode: 0644]
workspace/.metadata/.plugins/org.eclipse.core.resources/.history/ca/b0e1f82eee6500111e5bcf098ae37dc9 [deleted file]
workspace/.metadata/.plugins/org.eclipse.core.resources/.history/cc/c02a7477cc6a0011194396142d5d2649 [deleted file]
workspace/.metadata/.plugins/org.eclipse.core.resources/.history/cc/f02011cdcc6a0011194396142d5d2649 [deleted file]
workspace/.metadata/.plugins/org.eclipse.core.resources/.history/cf/30140310ce6a0011194396142d5d2649 [deleted file]
workspace/.metadata/.plugins/org.eclipse.core.resources/.history/d0/0090ef6f497000111324ab4fa5fd1a16 [new file with mode: 0644]
workspace/.metadata/.plugins/org.eclipse.core.resources/.history/d2/70aa19d4cc6a0011194396142d5d2649 [deleted file]
workspace/.metadata/.plugins/org.eclipse.core.resources/.history/d4/0072607dee6500111e5bcf098ae37dc9 [deleted file]
workspace/.metadata/.plugins/org.eclipse.core.resources/.history/d4/e0dc6685676b001115b7b82f2f4ce01a [deleted file]
workspace/.metadata/.plugins/org.eclipse.core.resources/.history/d5/a04877b2cc6a0011194396142d5d2649 [deleted file]
workspace/.metadata/.plugins/org.eclipse.core.resources/.history/d7/20c7a723f06500111e5bcf098ae37dc9 [deleted file]
workspace/.metadata/.plugins/org.eclipse.core.resources/.history/d8/7055126aca6a0011194396142d5d2649 [deleted file]
workspace/.metadata/.plugins/org.eclipse.core.resources/.history/da/90e917232d7200111835fa7adce7cfd2 [new file with mode: 0644]
workspace/.metadata/.plugins/org.eclipse.core.resources/.history/db/505dd38a307200111835fa7adce7cfd2 [new file with mode: 0644]
workspace/.metadata/.plugins/org.eclipse.core.resources/.history/db/e0607deaef6500111e5bcf098ae37dc9 [deleted file]
workspace/.metadata/.plugins/org.eclipse.core.resources/.history/e1/e0eff3313c7200111835fa7adce7cfd2 [new file with mode: 0644]
workspace/.metadata/.plugins/org.eclipse.core.resources/.history/e2/d089c97ece6a0011194396142d5d2649 [deleted file]
workspace/.metadata/.plugins/org.eclipse.core.resources/.history/e3/3032e66b487000111324ab4fa5fd1a16 [new file with mode: 0644]
workspace/.metadata/.plugins/org.eclipse.core.resources/.history/e6/205b432bcd6a0011194396142d5d2649 [deleted file]
workspace/.metadata/.plugins/org.eclipse.core.resources/.history/e6/a04fe410f06500111e5bcf098ae37dc9 [deleted file]
workspace/.metadata/.plugins/org.eclipse.core.resources/.history/e6/c0a38c926d6800111d29ec7e4ac25070 [deleted file]
workspace/.metadata/.plugins/org.eclipse.core.resources/.history/e7/001bffce2f7200111835fa7adce7cfd2 [new file with mode: 0644]
workspace/.metadata/.plugins/org.eclipse.core.resources/.history/e8/10fcce04136b001115b7b82f2f4ce01a [deleted file]
workspace/.metadata/.plugins/org.eclipse.core.resources/.history/e9/b04b6ed5ef6500111e5bcf098ae37dc9 [deleted file]
workspace/.metadata/.plugins/org.eclipse.core.resources/.history/e9/c0f31d431d7200111835fa7adce7cfd2 [moved from workspace/.metadata/.plugins/org.eclipse.core.resources/.history/a4/90e96797ea6d001110a188bae663c898 with 79% similarity]
workspace/.metadata/.plugins/org.eclipse.core.resources/.history/eb/b04bd6a30e6b001115b7b82f2f4ce01a [deleted file]
workspace/.metadata/.plugins/org.eclipse.core.resources/.history/ed/b098d6e3cc6a0011194396142d5d2649 [deleted file]
workspace/.metadata/.plugins/org.eclipse.core.resources/.history/ee/20690eeecc6a0011194396142d5d2649 [deleted file]
workspace/.metadata/.plugins/org.eclipse.core.resources/.history/f/c02fa8d7c96a0011194396142d5d2649 [deleted file]
workspace/.metadata/.plugins/org.eclipse.core.resources/.history/f4/e0c759e41e7200111835fa7adce7cfd2 [moved from workspace/.metadata/.plugins/org.eclipse.core.resources/.history/93/7016bf1df96500111e5bcf098ae37dc9 with 62% similarity]
workspace/.metadata/.plugins/org.eclipse.core.resources/.history/f7/109715b4136b001115b7b82f2f4ce01a [deleted file]
workspace/.metadata/.plugins/org.eclipse.core.resources/.history/f9/9057bf6570680011170bbf669c61406a [deleted file]
workspace/.metadata/.plugins/org.eclipse.core.resources/.history/fb/4023b420ca6a0011194396142d5d2649 [deleted file]
workspace/.metadata/.plugins/org.eclipse.core.resources/.history/fe/90892eab136b001115b7b82f2f4ce01a [deleted file]
workspace/.metadata/.plugins/org.eclipse.core.resources/.history/ff/30ad4fddca6a0011194396142d5d2649 [deleted file]
workspace/.metadata/.plugins/org.eclipse.core.resources/.history/ff/80d48880676b001115b7b82f2f4ce01a [deleted file]
workspace/.metadata/.plugins/org.eclipse.core.resources/.projects/Test/.markers.snap [deleted file]
workspace/.metadata/.plugins/org.eclipse.core.resources/.projects/Test/.syncinfo.snap [deleted file]
workspace/.metadata/.plugins/org.eclipse.core.resources/.projects/TrainDelayBot/.indexes/e4/81/5b/f2/53/history.index [new file with mode: 0644]
workspace/.metadata/.plugins/org.eclipse.core.resources/.projects/TrainDelayBot/.indexes/e4/81/5b/f2/7e/history.index
workspace/.metadata/.plugins/org.eclipse.core.resources/.projects/TrainDelayBot/.indexes/e4/81/5b/f2/8d/history.index
workspace/.metadata/.plugins/org.eclipse.core.resources/.projects/TrainDelayBot/.indexes/e4/81/5b/f2/94/history.index [deleted file]
workspace/.metadata/.plugins/org.eclipse.core.resources/.projects/TrainDelayBot/.indexes/e4/81/5b/f2/b9/history.index [deleted file]
workspace/.metadata/.plugins/org.eclipse.core.resources/.projects/TrainDelayBot/.indexes/e4/81/5b/f2/history.index
workspace/.metadata/.plugins/org.eclipse.core.resources/.projects/TrainDelayBot/.indexes/properties.index
workspace/.metadata/.plugins/org.eclipse.core.resources/.projects/TrainDelayBot/.markers
workspace/.metadata/.plugins/org.eclipse.core.resources/.projects/TrainDelayBot/.markers.snap [deleted file]
workspace/.metadata/.plugins/org.eclipse.core.resources/.projects/TrainDelayBot/.syncinfo.snap [deleted file]
workspace/.metadata/.plugins/org.eclipse.core.resources/.projects/TrainDelayBot/org.eclipse.jdt.core/state.dat [new file with mode: 0644]
workspace/.metadata/.plugins/org.eclipse.core.resources/.root/.markers.snap [deleted file]
workspace/.metadata/.plugins/org.eclipse.core.resources/.root/22.tree [moved from workspace/.metadata/.plugins/org.eclipse.core.resources/.root/19.tree with 71% similarity]
workspace/.metadata/.plugins/org.eclipse.core.resources/.safetable/org.eclipse.core.resources
workspace/.metadata/.plugins/org.eclipse.core.resources/.snap [deleted file]
workspace/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.epp.usagedata.recording.prefs
workspace/.metadata/.plugins/org.eclipse.epp.usagedata.recording/upload0.csv
workspace/.metadata/.plugins/org.eclipse.epp.usagedata.recording/upload1.csv
workspace/.metadata/.plugins/org.eclipse.epp.usagedata.recording/upload2.csv
workspace/.metadata/.plugins/org.eclipse.epp.usagedata.recording/upload24.csv [deleted file]
workspace/.metadata/.plugins/org.eclipse.epp.usagedata.recording/upload3.csv
workspace/.metadata/.plugins/org.eclipse.epp.usagedata.recording/upload4.csv [deleted file]
workspace/.metadata/.plugins/org.eclipse.epp.usagedata.recording/usagedata.csv
workspace/.metadata/.plugins/org.eclipse.jdt.core/471433581.index
workspace/.metadata/.plugins/org.eclipse.jdt.debug.ui/dialog_settings.xml
workspace/.metadata/.plugins/org.eclipse.jdt.ui/QualifiedTypeNameHistory.xml
workspace/.metadata/.plugins/org.eclipse.jdt.ui/dialog_settings.xml
workspace/.metadata/.plugins/org.eclipse.jdt.ui/jdt-images/0.png [deleted file]
workspace/.metadata/.plugins/org.eclipse.ltk.core.refactoring/.refactorings/TrainDelayBot/2012/3/11/refactorings.history
workspace/.metadata/.plugins/org.eclipse.ltk.core.refactoring/.refactorings/TrainDelayBot/2012/3/11/refactorings.index
workspace/.metadata/.plugins/org.eclipse.ltk.core.refactoring/.refactorings/TrainDelayBot/2012/3/12/refactorings.history [new file with mode: 0644]
workspace/.metadata/.plugins/org.eclipse.ltk.core.refactoring/.refactorings/TrainDelayBot/2012/3/12/refactorings.index [new file with mode: 0644]
workspace/.metadata/.plugins/org.eclipse.ltk.ui.refactoring/dialog_settings.xml
workspace/.metadata/.plugins/org.eclipse.m2e.logback.configuration/0.log
workspace/.metadata/.plugins/org.eclipse.team.cvs.core/.running [deleted file]
workspace/.metadata/.plugins/org.eclipse.ui.ide/dialog_settings.xml
workspace/.metadata/.plugins/org.eclipse.ui.workbench.texteditor/dialog_settings.xml
workspace/.metadata/.plugins/org.eclipse.ui.workbench/dialog_settings.xml
workspace/.metadata/.plugins/org.eclipse.ui.workbench/workbench.xml
workspace/TrainDelayBot/src/com/yuji/tdb/TrainDelayBotServlet.java
workspace/TrainDelayBot/src/com/yuji/tdb/db/KeyValueDao.java
workspace/TrainDelayBot/src/com/yuji/tdb/debug/Debug.java [new file with mode: 0644]
workspace/TrainDelayBot/src/com/yuji/tdb/twitter/TwitterUtil.java
workspace/TrainDelayBot/war/WEB-INF/appengine-generated/datastore-indexes-auto.xml
workspace/TrainDelayBot/war/WEB-INF/appengine-generated/local_db.bin

index 63e6494..35b848c 100644 (file)
@@ -3100,3 +3100,125 @@ Command-line arguments:  -os macosx -ws cocoa -arch x86_64 -product org.eclipse.
 
 !ENTRY com.google.appengine.eclipse.core 1 0 2012-03-15 00:42:14.961
 !MESSAGE TrainDelayBot successfully deployed to Google App Engine
+!SESSION 2012-03-18 00:25:16.436 -----------------------------------------------
+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 -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-03-18 00:25:25.936
+!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-03-18 00:25:46.460
+!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-03-18 00:25:46.523
+!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-03-18 00:25:46.550
+!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-03-18 00:25:46.562
+!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-03-18 00:25:51.552
+!MESSAGE Usage data uploaded to http://udc.eclipse.org/upload.php in 5632 milliseconds.
+
+!ENTRY com.google.appengine.eclipse.core 1 0 2012-03-18 00:30:22.763
+!MESSAGE TrainDelayBot successfully deployed to Google App Engine
+
+!ENTRY com.google.appengine.eclipse.core 1 0 2012-03-18 00:51:20.358
+!MESSAGE TrainDelayBot successfully deployed to Google App Engine
+
+!ENTRY com.google.appengine.eclipse.core 1 0 2012-03-18 00:54:59.083
+!MESSAGE TrainDelayBot successfully deployed to Google App Engine
+
+!ENTRY com.google.gdt.eclipse.managedapis 1 0 2012-03-18 06:54:25.210
+!MESSAGE Failed to load icon cache
+
+!ENTRY com.google.gdt.eclipse.managedapis 1 0 2012-03-18 09:31:40.185
+!MESSAGE Failed to load icon cache
+
+!ENTRY com.google.gdt.eclipse.managedapis 1 0 2012-03-18 11:31:59.185
+!MESSAGE Failed to load icon cache
+
+!ENTRY com.google.gdt.eclipse.managedapis 1 0 2012-03-18 13:32:18.202
+!MESSAGE Failed to load icon cache
+
+!ENTRY com.google.gdt.eclipse.managedapis 1 0 2012-03-18 15:32:37.524
+!MESSAGE Failed to load icon cache
+
+!ENTRY com.google.gdt.eclipse.managedapis 1 0 2012-03-18 17:32:56.512
+!MESSAGE Failed to load icon cache
+
+!ENTRY com.google.gdt.eclipse.managedapis 1 0 2012-03-18 19:33:15.187
+!MESSAGE Failed to load icon cache
+
+!ENTRY com.google.gdt.eclipse.managedapis 1 0 2012-03-18 21:33:34.540
+!MESSAGE Failed to load icon cache
+
+!ENTRY com.google.gdt.eclipse.managedapis 1 0 2012-03-18 23:33:53.519
+!MESSAGE Failed to load icon cache
+
+!ENTRY com.google.gdt.eclipse.managedapis 1 0 2012-03-19 09:30:44.180
+!MESSAGE Failed to load icon cache
+
+!ENTRY com.google.gdt.eclipse.managedapis 1 0 2012-03-19 11:31:03.169
+!MESSAGE Failed to load icon cache
+
+!ENTRY com.google.gdt.eclipse.managedapis 1 0 2012-03-19 13:31:22.194
+!MESSAGE Failed to load icon cache
+
+!ENTRY com.google.gdt.eclipse.managedapis 1 0 2012-03-19 15:31:41.169
+!MESSAGE Failed to load icon cache
+
+!ENTRY com.google.gdt.eclipse.managedapis 1 0 2012-03-19 17:32:00.524
+!MESSAGE Failed to load icon cache
+
+!ENTRY com.google.gdt.eclipse.managedapis 1 0 2012-03-19 19:32:19.518
+!MESSAGE Failed to load icon cache
+
+!ENTRY com.google.gdt.eclipse.managedapis 1 0 2012-03-19 21:32:38.174
+!MESSAGE Failed to load icon cache
+
+!ENTRY com.google.gdt.eclipse.managedapis 1 0 2012-03-19 23:32:57.535
+!MESSAGE Failed to load icon cache
+!SESSION 2012-03-20 01:25:34.233 -----------------------------------------------
+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 -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-03-20 08:31:39.736
+!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-03-20 08:32:01.192
+!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-03-20 08:32:01.244
+!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-03-20 08:32:01.269
+!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-03-20 08:32:01.278
+!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-03-20 11:29:12.496
+!MESSAGE TrainDelayBot successfully deployed to Google App Engine
+
+!ENTRY com.google.appengine.eclipse.core 1 0 2012-03-20 11:34:57.375
+!MESSAGE TrainDelayBot successfully deployed to Google App Engine
+
+!ENTRY com.google.appengine.eclipse.core 1 0 2012-03-20 11:52:47.278
+!MESSAGE TrainDelayBot successfully deployed to Google App Engine
+
+!ENTRY com.google.appengine.eclipse.core 1 0 2012-03-20 12:25:29.189
+!MESSAGE TrainDelayBot successfully deployed to Google App Engine
+
+!ENTRY com.google.appengine.eclipse.core 1 0 2012-03-20 12:28:17.838
+!MESSAGE TrainDelayBot successfully deployed to Google App Engine
index b590d06..a23df7c 100644 (file)
Binary files a/workspace/.metadata/.mylyn/.tasks.xml.zip and b/workspace/.metadata/.mylyn/.tasks.xml.zip differ
index 26d0c60..6bc6eee 100644 (file)
Binary files a/workspace/.metadata/.mylyn/tasks.xml.zip and b/workspace/.metadata/.mylyn/tasks.xml.zip differ
diff --git a/workspace/.metadata/.plugins/com.google.gdt.eclipse.managedapis/icon_caches/temp20808907331581361121331738399321038000 b/workspace/.metadata/.plugins/com.google.gdt.eclipse.managedapis/icon_caches/temp20808907331581361121331738399321038000
deleted file mode 100644 (file)
index 48dcedf..0000000
Binary files a/workspace/.metadata/.plugins/com.google.gdt.eclipse.managedapis/icon_caches/temp20808907331581361121331738399321038000 and /dev/null differ
diff --git a/workspace/.metadata/.plugins/com.google.gdt.eclipse.managedapis/icon_caches/temp50807651823440362971331738401163307000/cache_0 b/workspace/.metadata/.plugins/com.google.gdt.eclipse.managedapis/icon_caches/temp50807651823440362971331738401163307000/cache_0
deleted file mode 100644 (file)
index 13aecfe..0000000
Binary files a/workspace/.metadata/.plugins/com.google.gdt.eclipse.managedapis/icon_caches/temp50807651823440362971331738401163307000/cache_0 and /dev/null differ
diff --git a/workspace/.metadata/.plugins/com.google.gdt.eclipse.managedapis/icon_caches/temp50807651823440362971331738401163307000/cache_1 b/workspace/.metadata/.plugins/com.google.gdt.eclipse.managedapis/icon_caches/temp50807651823440362971331738401163307000/cache_1
deleted file mode 100644 (file)
index f2f07a9..0000000
Binary files a/workspace/.metadata/.plugins/com.google.gdt.eclipse.managedapis/icon_caches/temp50807651823440362971331738401163307000/cache_1 and /dev/null differ
diff --git a/workspace/.metadata/.plugins/com.google.gdt.eclipse.managedapis/icon_caches/temp50807651823440362971331738401163307000/cache_10 b/workspace/.metadata/.plugins/com.google.gdt.eclipse.managedapis/icon_caches/temp50807651823440362971331738401163307000/cache_10
deleted file mode 100644 (file)
index 37c41f7..0000000
Binary files a/workspace/.metadata/.plugins/com.google.gdt.eclipse.managedapis/icon_caches/temp50807651823440362971331738401163307000/cache_10 and /dev/null differ
diff --git a/workspace/.metadata/.plugins/com.google.gdt.eclipse.managedapis/icon_caches/temp50807651823440362971331738401163307000/cache_11 b/workspace/.metadata/.plugins/com.google.gdt.eclipse.managedapis/icon_caches/temp50807651823440362971331738401163307000/cache_11
deleted file mode 100644 (file)
index 6b3e065..0000000
Binary files a/workspace/.metadata/.plugins/com.google.gdt.eclipse.managedapis/icon_caches/temp50807651823440362971331738401163307000/cache_11 and /dev/null differ
diff --git a/workspace/.metadata/.plugins/com.google.gdt.eclipse.managedapis/icon_caches/temp50807651823440362971331738401163307000/cache_12 b/workspace/.metadata/.plugins/com.google.gdt.eclipse.managedapis/icon_caches/temp50807651823440362971331738401163307000/cache_12
deleted file mode 100644 (file)
index 3deba90..0000000
Binary files a/workspace/.metadata/.plugins/com.google.gdt.eclipse.managedapis/icon_caches/temp50807651823440362971331738401163307000/cache_12 and /dev/null differ
diff --git a/workspace/.metadata/.plugins/com.google.gdt.eclipse.managedapis/icon_caches/temp50807651823440362971331738401163307000/cache_13 b/workspace/.metadata/.plugins/com.google.gdt.eclipse.managedapis/icon_caches/temp50807651823440362971331738401163307000/cache_13
deleted file mode 100644 (file)
index 6b3e065..0000000
Binary files a/workspace/.metadata/.plugins/com.google.gdt.eclipse.managedapis/icon_caches/temp50807651823440362971331738401163307000/cache_13 and /dev/null differ
diff --git a/workspace/.metadata/.plugins/com.google.gdt.eclipse.managedapis/icon_caches/temp50807651823440362971331738401163307000/cache_14 b/workspace/.metadata/.plugins/com.google.gdt.eclipse.managedapis/icon_caches/temp50807651823440362971331738401163307000/cache_14
deleted file mode 100644 (file)
index 6bdf8d1..0000000
Binary files a/workspace/.metadata/.plugins/com.google.gdt.eclipse.managedapis/icon_caches/temp50807651823440362971331738401163307000/cache_14 and /dev/null differ
diff --git a/workspace/.metadata/.plugins/com.google.gdt.eclipse.managedapis/icon_caches/temp50807651823440362971331738401163307000/cache_15 b/workspace/.metadata/.plugins/com.google.gdt.eclipse.managedapis/icon_caches/temp50807651823440362971331738401163307000/cache_15
deleted file mode 100644 (file)
index 6b3e065..0000000
Binary files a/workspace/.metadata/.plugins/com.google.gdt.eclipse.managedapis/icon_caches/temp50807651823440362971331738401163307000/cache_15 and /dev/null differ
diff --git a/workspace/.metadata/.plugins/com.google.gdt.eclipse.managedapis/icon_caches/temp50807651823440362971331738401163307000/cache_2 b/workspace/.metadata/.plugins/com.google.gdt.eclipse.managedapis/icon_caches/temp50807651823440362971331738401163307000/cache_2
deleted file mode 100644 (file)
index 6b3e065..0000000
Binary files a/workspace/.metadata/.plugins/com.google.gdt.eclipse.managedapis/icon_caches/temp50807651823440362971331738401163307000/cache_2 and /dev/null differ
diff --git a/workspace/.metadata/.plugins/com.google.gdt.eclipse.managedapis/icon_caches/temp50807651823440362971331738401163307000/cache_3 b/workspace/.metadata/.plugins/com.google.gdt.eclipse.managedapis/icon_caches/temp50807651823440362971331738401163307000/cache_3
deleted file mode 100644 (file)
index 9abf6f2..0000000
Binary files a/workspace/.metadata/.plugins/com.google.gdt.eclipse.managedapis/icon_caches/temp50807651823440362971331738401163307000/cache_3 and /dev/null differ
diff --git a/workspace/.metadata/.plugins/com.google.gdt.eclipse.managedapis/icon_caches/temp50807651823440362971331738401163307000/cache_4 b/workspace/.metadata/.plugins/com.google.gdt.eclipse.managedapis/icon_caches/temp50807651823440362971331738401163307000/cache_4
deleted file mode 100644 (file)
index 8269661..0000000
Binary files a/workspace/.metadata/.plugins/com.google.gdt.eclipse.managedapis/icon_caches/temp50807651823440362971331738401163307000/cache_4 and /dev/null differ
diff --git a/workspace/.metadata/.plugins/com.google.gdt.eclipse.managedapis/icon_caches/temp50807651823440362971331738401163307000/cache_5 b/workspace/.metadata/.plugins/com.google.gdt.eclipse.managedapis/icon_caches/temp50807651823440362971331738401163307000/cache_5
deleted file mode 100644 (file)
index 6b3e065..0000000
Binary files a/workspace/.metadata/.plugins/com.google.gdt.eclipse.managedapis/icon_caches/temp50807651823440362971331738401163307000/cache_5 and /dev/null differ
diff --git a/workspace/.metadata/.plugins/com.google.gdt.eclipse.managedapis/icon_caches/temp50807651823440362971331738401163307000/cache_6 b/workspace/.metadata/.plugins/com.google.gdt.eclipse.managedapis/icon_caches/temp50807651823440362971331738401163307000/cache_6
deleted file mode 100644 (file)
index 10a6dc5..0000000
Binary files a/workspace/.metadata/.plugins/com.google.gdt.eclipse.managedapis/icon_caches/temp50807651823440362971331738401163307000/cache_6 and /dev/null differ
diff --git a/workspace/.metadata/.plugins/com.google.gdt.eclipse.managedapis/icon_caches/temp50807651823440362971331738401163307000/cache_7 b/workspace/.metadata/.plugins/com.google.gdt.eclipse.managedapis/icon_caches/temp50807651823440362971331738401163307000/cache_7
deleted file mode 100644 (file)
index b82ebfc..0000000
Binary files a/workspace/.metadata/.plugins/com.google.gdt.eclipse.managedapis/icon_caches/temp50807651823440362971331738401163307000/cache_7 and /dev/null differ
diff --git a/workspace/.metadata/.plugins/com.google.gdt.eclipse.managedapis/icon_caches/temp50807651823440362971331738401163307000/cache_8 b/workspace/.metadata/.plugins/com.google.gdt.eclipse.managedapis/icon_caches/temp50807651823440362971331738401163307000/cache_8
deleted file mode 100644 (file)
index b834758..0000000
Binary files a/workspace/.metadata/.plugins/com.google.gdt.eclipse.managedapis/icon_caches/temp50807651823440362971331738401163307000/cache_8 and /dev/null differ
diff --git a/workspace/.metadata/.plugins/com.google.gdt.eclipse.managedapis/icon_caches/temp50807651823440362971331738401163307000/cache_9 b/workspace/.metadata/.plugins/com.google.gdt.eclipse.managedapis/icon_caches/temp50807651823440362971331738401163307000/cache_9
deleted file mode 100644 (file)
index 0c9aa8a..0000000
Binary files a/workspace/.metadata/.plugins/com.google.gdt.eclipse.managedapis/icon_caches/temp50807651823440362971331738401163307000/cache_9 and /dev/null differ
diff --git a/workspace/.metadata/.plugins/com.google.gdt.eclipse.managedapis/icon_caches/temp50807651823440362971331738401163307000/icon_bundle_map b/workspace/.metadata/.plugins/com.google.gdt.eclipse.managedapis/icon_caches/temp50807651823440362971331738401163307000/icon_bundle_map
deleted file mode 100644 (file)
index 042c74a..0000000
+++ /dev/null
@@ -1 +0,0 @@
-{"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"}
diff --git a/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/0/80d0300c106b001115b7b82f2f4ce01a b/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/0/80d0300c106b001115b7b82f2f4ce01a
deleted file mode 100644 (file)
index d7af4cb..0000000
+++ /dev/null
@@ -1,54 +0,0 @@
-package com.yuji.tdb.utility;
-
-import java.util.regex.Pattern;
-
-public class StringUtility {
-       private static Pattern ptnAlnum = Pattern.compile("[a-zA-Z0-9]");
-       private static Pattern ptnSpace = Pattern.compile("\\s");
-       private static Pattern ptnAscii = Pattern.compile("\\p{ASCII}");
-       
-       public static String parseSubstring(String text, int length){
-               int len = text.length();
-               int status = -1;
-               int pos = 0;
-               
-               for (int i = 0; i < len + 1 && i < length + 1; i++){
-                       if (i >= len){
-                               pos = i;
-                               break;
-                       }
-                       String ch = text.substring(i, i + 1);
-                       
-                       if (ptnAlnum.matcher(ch).matches()){
-                               if (status != 0){
-                                       if (status != 1){
-                                               pos = i;
-                                       }
-                                       status = 0;
-                               }
-                       }
-                       else if (ptnSpace.matcher(ch).matches()){
-                               if (status != 1){
-                                       pos = i;
-                                       status = 1;
-                               }
-                       }
-                       else if (ptnAscii.matcher(ch).matches()){
-                               if (status != 2){
-                                       if (status != 1){
-                                               pos = i;
-                                       }
-                                       status = 2;
-                               }                               
-                       }
-                       else {
-                               pos = i;
-                               status = 3;
-                       }
-               }
-               if (pos == 0){
-                       return text.substring(0, (len < length)? len : length);                 
-               }
-               return text.substring(0, pos);
-       }
-}
diff --git a/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/11/d02587b12b7200111835fa7adce7cfd2 b/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/11/d02587b12b7200111835fa7adce7cfd2
new file mode 100644 (file)
index 0000000..ebba668
--- /dev/null
@@ -0,0 +1,210 @@
+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
diff --git a/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/12/007d7e77666b001115b7b82f2f4ce01a b/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/12/007d7e77666b001115b7b82f2f4ce01a
deleted file mode 100644 (file)
index 11e9e21..0000000
+++ /dev/null
@@ -1,37 +0,0 @@
-package com.yuji.tdb.db;\r
-\r
-import java.util.List;\r
-\r
-import javax.jdo.PersistenceManager;\r
-\r
-public class TrainDao {\r
-       private static TrainDao instance = null;\r
-       private PersistenceManager pm = PMFactory.get().getPersistenceManager();\r
-\r
-       public static TrainDao getInstance() {\r
-               if (instance == null) {\r
-                       instance = new TrainDao();\r
-               }\r
-               return instance;\r
-       }\r
-\r
-       private TrainDao() {\r
-\r
-       }\r
-\r
-       public List<Train> search() {\r
-               String query = "SELECT FROM " + Train.class.getName();\r
-               List<Train> list = (List<Train>) pm.newQuery(query).execute();\r
-               pm.close();\r
-               return list;\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
diff --git a/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/12/50ffd5cf666b001115b7b82f2f4ce01a b/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/12/50ffd5cf666b001115b7b82f2f4ce01a
deleted file mode 100644 (file)
index 568f2b7..0000000
+++ /dev/null
@@ -1,149 +0,0 @@
-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.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
-\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
-               //TimeZone.setDefault(TimeZone.getTimeZone("JST")); // TODO \8fê\8f\8a\r
-       }\r
-\r
-       public void main(String consumerKey, String consumerSecret, AccessToken accessToken) {\r
-\r
-               String text = "\8b\9e\95l\93\8c\96k";\r
-\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
-                       twite(text, twitter);\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(String text, Twitter twitter) throws TwitterException {\r
-               Calendar cal = Calendar.getInstance();\r
-               Date date = cal.getTime();\r
-               long cur = date.getTime();\r
-               \r
-               Query query = new Query();\r
-               //query.setRpp(1000); // TODO\r
-               query.setQuery(text);\r
-               QueryResult result = twitter.search(query);\r
-               List<Tweet> tweets = result.getTweets();\r
-               \r
-               int count = 0;\r
-               int hit = 0;\r
-               int mhit = 0;\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 - 30 * 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
-                               // \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 = "";\r
-               if (count < 5){\r
-                       message = "\92x\89\84\82È\82µ " + df.format(date);        \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 = sample + " " + df.format(date) + " count=" + count;                                                   \r
-               }\r
-               System.out.println(message); //TODO\r
-               Status status = twitter.updateStatus(message); //TODO\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
diff --git a/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/12/a05269d2307200111835fa7adce7cfd2 b/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/12/a05269d2307200111835fa7adce7cfd2
new file mode 100644 (file)
index 0000000..de781f9
--- /dev/null
@@ -0,0 +1,238 @@
+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
diff --git a/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/12/c060b2e5ee6500111e5bcf098ae37dc9 b/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/12/c060b2e5ee6500111e5bcf098ae37dc9
deleted file mode 100644 (file)
index 6d67eac..0000000
+++ /dev/null
@@ -1,140 +0,0 @@
-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 (requestToken == null || CommonUtil.isNull(consumerKey)\r
-                                       || CommonUtil.isNull(consumerSecret)) {\r
-                               log.warning("001");\r
-                               return;\r
-                       }\r
-\r
-                       if (!CommonUtil.isNull(parmResult)) {\r
-                               resultOAuthAuthorization(consumerKey, consumerSecret);\r
-                               return;\r
-                       }\r
-\r
-                       if (accessToken == null) {\r
-                               log.warning("002");\r
-                               return;\r
-                       }\r
-\r
-                       AccessToken a = new AccessToken(parmResult, parmResult);\r
-                       \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 = 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
-                       \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, String consumerSecret) {\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 = twitter.getOAuthAccessToken(requestToken);\r
-               } catch (TwitterException e) {\r
-                       // TODO Auto-generated catch block\r
-                       e.printStackTrace();\r
-                       log.severe(e.toString());\r
-               }\r
-       }\r
-}\r
diff --git a/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/12/d08a7295cc6a0011194396142d5d2649 b/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/12/d08a7295cc6a0011194396142d5d2649
deleted file mode 100644 (file)
index bb56d95..0000000
+++ /dev/null
@@ -1,46 +0,0 @@
-package com.yuji.tdb.main;\r
-\r
-import com.yuji.tdb.utility.StringUtil;\r
-\r
-import twitter4j.Status;\r
-import twitter4j.Twitter;\r
-import twitter4j.TwitterException;\r
-import twitter4j.TwitterFactory;\r
-import twitter4j.auth.AccessToken;\r
-import twitter4j.conf.ConfigurationBuilder;\r
-\r
-public class Main {\r
-\r
-       public static void main(String[] args) {\r
-               test1();\r
-       }\r
-       \r
-       public static void test1(){\r
-               String text = "ab#\82 \82¢\82¤";\r
-               int length = 3;\r
-               String ret = StringUtil.parseSubstring(text, length);\r
-               System.out.println(ret);\r
-       }\r
-\r
-       public static void main() {\r
-               String consumerKey = "";\r
-               String consumerSecret = "";\r
-               String tokenKey = "";\r
-               String tokenSecret = "";\r
-\r
-               try {\r
-                       ConfigurationBuilder confBuilder = new ConfigurationBuilder();\r
-                       confBuilder.setDebugEnabled(true).setOAuthConsumerKey(consumerKey)\r
-                                       .setOAuthConsumerSecret(consumerSecret);\r
-                       TwitterFactory factory = new TwitterFactory(confBuilder.build());\r
-\r
-                       AccessToken accessToken = new AccessToken(tokenKey, tokenSecret);\r
-                       Twitter twitter = factory.getInstance(accessToken);\r
-\r
-                       Status status = twitter.updateStatus("\83e\83X\83g");\r
-               } catch (TwitterException e) {\r
-                       // TODO Auto-generated catch block\r
-                       e.printStackTrace();\r
-               }\r
-       }\r
-}\r
diff --git a/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/16/306ca0980e6b001115b7b82f2f4ce01a b/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/16/306ca0980e6b001115b7b82f2f4ce01a
deleted file mode 100644 (file)
index 14ef6fe..0000000
+++ /dev/null
@@ -1,46 +0,0 @@
-package com.yuji.tdb.main;\r
-\r
-import twitter4j.Status;\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.utility.StringUtility;\r
-\r
-public class Main {\r
-\r
-       public static void main(String[] args) {\r
-               test1();\r
-       }\r
-       \r
-       public static void test1(){\r
-               String text = "\82 \82¢ \82¤\82¦\82¨";\r
-               int length = 4;\r
-               String ret = StringUtility.parseSubstring(text, length);\r
-               System.out.println(ret);\r
-       }\r
-\r
-       public static void main() {\r
-               String consumerKey = "";\r
-               String consumerSecret = "";\r
-               String tokenKey = "";\r
-               String tokenSecret = "";\r
-\r
-               try {\r
-                       ConfigurationBuilder confBuilder = new ConfigurationBuilder();\r
-                       confBuilder.setDebugEnabled(true).setOAuthConsumerKey(consumerKey)\r
-                                       .setOAuthConsumerSecret(consumerSecret);\r
-                       TwitterFactory factory = new TwitterFactory(confBuilder.build());\r
-\r
-                       AccessToken accessToken = new AccessToken(tokenKey, tokenSecret);\r
-                       Twitter twitter = factory.getInstance(accessToken);\r
-\r
-                       Status status = twitter.updateStatus("\83e\83X\83g");\r
-               } catch (TwitterException e) {\r
-                       // TODO Auto-generated catch block\r
-                       e.printStackTrace();\r
-               }\r
-       }\r
-}\r
diff --git a/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/17/b0c9cd33cd6a0011194396142d5d2649 b/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/17/b0c9cd33cd6a0011194396142d5d2649
deleted file mode 100644 (file)
index 19fcc1e..0000000
+++ /dev/null
@@ -1,46 +0,0 @@
-package com.yuji.tdb.main;\r
-\r
-import com.yuji.tdb.utility.StringUtil;\r
-\r
-import twitter4j.Status;\r
-import twitter4j.Twitter;\r
-import twitter4j.TwitterException;\r
-import twitter4j.TwitterFactory;\r
-import twitter4j.auth.AccessToken;\r
-import twitter4j.conf.ConfigurationBuilder;\r
-\r
-public class Main {\r
-\r
-       public static void main(String[] args) {\r
-               test1();\r
-       }\r
-       \r
-       public static void test1(){\r
-               String text = "abcd";\r
-               int length = 3;\r
-               String ret = StringUtil.parseSubstring(text, length);\r
-               System.out.println(ret);\r
-       }\r
-\r
-       public static void main() {\r
-               String consumerKey = "";\r
-               String consumerSecret = "";\r
-               String tokenKey = "";\r
-               String tokenSecret = "";\r
-\r
-               try {\r
-                       ConfigurationBuilder confBuilder = new ConfigurationBuilder();\r
-                       confBuilder.setDebugEnabled(true).setOAuthConsumerKey(consumerKey)\r
-                                       .setOAuthConsumerSecret(consumerSecret);\r
-                       TwitterFactory factory = new TwitterFactory(confBuilder.build());\r
-\r
-                       AccessToken accessToken = new AccessToken(tokenKey, tokenSecret);\r
-                       Twitter twitter = factory.getInstance(accessToken);\r
-\r
-                       Status status = twitter.updateStatus("\83e\83X\83g");\r
-               } catch (TwitterException e) {\r
-                       // TODO Auto-generated catch block\r
-                       e.printStackTrace();\r
-               }\r
-       }\r
-}\r
diff --git a/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/18/f0d4fbdc2a7200111835fa7adce7cfd2 b/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/18/f0d4fbdc2a7200111835fa7adce7cfd2
new file mode 100644 (file)
index 0000000..15b2251
--- /dev/null
@@ -0,0 +1,202 @@
+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
diff --git a/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/19/e077c3f6ef6500111e5bcf098ae37dc9 b/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/19/e077c3f6ef6500111e5bcf098ae37dc9
deleted file mode 100644 (file)
index 15ec369..0000000
+++ /dev/null
@@ -1,147 +0,0 @@
-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("001");\r
-                               return;\r
-                       }\r
-\r
-                       if (!CommonUtil.isNull(parmResult)) {\r
-                               String requestTokenKey = dao.get(KeyValueDao.KEY_REQUEST_TOKEN);\r
-                               String requestTokenSecret = dao.get(KeyValueDao.KEY_REQUEST_TOKEN_SECRET);\r
-\r
-                               if (CommonUtil.isNull(requestTokenKey)\r
-                                               || CommonUtil.isNull(requestTokenSecret)) {\r
-                                       log.warning("003");\r
-                                       return;                                 \r
-                               }\r
-                               RequestToken requestToken = new RequestToken(requestTokenKey, requestTokenSecret);\r
-                               resultOAuthAuthorization(consumerKey, consumerSecret, requestToken);\r
-                               return;\r
-                       }\r
-\r
-                       if (accessToken == null) {\r
-                               log.warning("003");\r
-                               return;\r
-                       }\r
-\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
-                       String 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
-                       \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, 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 = twitter.getOAuthAccessToken(requestToken);\r
-               } catch (TwitterException e) {\r
-                       // TODO Auto-generated catch block\r
-                       e.printStackTrace();\r
-                       log.severe(e.toString());\r
-               }\r
-       }\r
-}\r
diff --git a/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/1b/10fe5b37106b001115b7b82f2f4ce01a b/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/1b/10fe5b37106b001115b7b82f2f4ce01a
deleted file mode 100644 (file)
index fb4e8d7..0000000
+++ /dev/null
@@ -1,46 +0,0 @@
-package com.yuji.tdb.main;\r
-\r
-import twitter4j.Status;\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.utility.StringUtility;\r
-\r
-public class Main {\r
-\r
-       public static void main(String[] args) {\r
-               test1();\r
-       }\r
-       \r
-       public static void test1(){\r
-               String text = "\82 \82¢ bb cc";\r
-               int length = 3;\r
-               String ret = StringUtility.parseSubstring(text, length);\r
-               System.out.println(ret);\r
-       }\r
-\r
-       public static void main() {\r
-               String consumerKey = "";\r
-               String consumerSecret = "";\r
-               String tokenKey = "";\r
-               String tokenSecret = "";\r
-\r
-               try {\r
-                       ConfigurationBuilder confBuilder = new ConfigurationBuilder();\r
-                       confBuilder.setDebugEnabled(true).setOAuthConsumerKey(consumerKey)\r
-                                       .setOAuthConsumerSecret(consumerSecret);\r
-                       TwitterFactory factory = new TwitterFactory(confBuilder.build());\r
-\r
-                       AccessToken accessToken = new AccessToken(tokenKey, tokenSecret);\r
-                       Twitter twitter = factory.getInstance(accessToken);\r
-\r
-                       Status status = twitter.updateStatus("\83e\83X\83g");\r
-               } catch (TwitterException e) {\r
-                       // TODO Auto-generated catch block\r
-                       e.printStackTrace();\r
-               }\r
-       }\r
-}\r
diff --git a/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/1d/e0adf789317200111835fa7adce7cfd2 b/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/1d/e0adf789317200111835fa7adce7cfd2
new file mode 100644 (file)
index 0000000..ec8419b
--- /dev/null
@@ -0,0 +1,239 @@
+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
diff --git a/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/1e/70271f3a3c7200111835fa7adce7cfd2 b/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/1e/70271f3a3c7200111835fa7adce7cfd2
new file mode 100644 (file)
index 0000000..3a5d76b
--- /dev/null
@@ -0,0 +1,242 @@
+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
diff --git a/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/1e/e063f9a33c7200111835fa7adce7cfd2 b/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/1e/e063f9a33c7200111835fa7adce7cfd2
new file mode 100644 (file)
index 0000000..c53f572
--- /dev/null
@@ -0,0 +1,242 @@
+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
diff --git a/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/1f/70c5ac3c106b001115b7b82f2f4ce01a b/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/1f/70c5ac3c106b001115b7b82f2f4ce01a
deleted file mode 100644 (file)
index 4c54553..0000000
+++ /dev/null
@@ -1,46 +0,0 @@
-package com.yuji.tdb.main;\r
-\r
-import twitter4j.Status;\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.utility.StringUtility;\r
-\r
-public class Main {\r
-\r
-       public static void main(String[] args) {\r
-               test1();\r
-       }\r
-       \r
-       public static void test1(){\r
-               String text = "\82 \82¢ bb cc";\r
-               int length = 2;\r
-               String ret = StringUtility.parseSubstring(text, length);\r
-               System.out.println(ret);\r
-       }\r
-\r
-       public static void main() {\r
-               String consumerKey = "";\r
-               String consumerSecret = "";\r
-               String tokenKey = "";\r
-               String tokenSecret = "";\r
-\r
-               try {\r
-                       ConfigurationBuilder confBuilder = new ConfigurationBuilder();\r
-                       confBuilder.setDebugEnabled(true).setOAuthConsumerKey(consumerKey)\r
-                                       .setOAuthConsumerSecret(consumerSecret);\r
-                       TwitterFactory factory = new TwitterFactory(confBuilder.build());\r
-\r
-                       AccessToken accessToken = new AccessToken(tokenKey, tokenSecret);\r
-                       Twitter twitter = factory.getInstance(accessToken);\r
-\r
-                       Status status = twitter.updateStatus("\83e\83X\83g");\r
-               } catch (TwitterException e) {\r
-                       // TODO Auto-generated catch block\r
-                       e.printStackTrace();\r
-               }\r
-       }\r
-}\r
diff --git a/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/1f/80fdab5dee6500111e5bcf098ae37dc9 b/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/1f/80fdab5dee6500111e5bcf098ae37dc9
deleted file mode 100644 (file)
index 10aa01b..0000000
+++ /dev/null
@@ -1,145 +0,0 @@
-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
-                               \r
-                               dao.put("FOO", "aaa");\r
-                               \r
-                               return;\r
-                       }\r
-\r
-                       consumerKey = dao.get(KeyValueDao.KEY_CONSUMER_KEY);\r
-                       consumerSecret = dao.get(KeyValueDao.KEY_CONSUMER_SECRET);\r
-                       if (requestToken == null || CommonUtil.isNull(consumerKey)\r
-                                       || CommonUtil.isNull(consumerSecret)) {\r
-                               log.warning("001");\r
-                               return;\r
-                       }\r
-\r
-                       if (!CommonUtil.isNull(parmResult)) {\r
-                               resultOAuthAuthorization();\r
-                               \r
-                               String value = dao.get("FOO");\r
-                               log.warning("VALUE=" + value);\r
-                               \r
-                               return;\r
-                       }\r
-\r
-                       if (accessToken == null) {\r
-                               log.warning("002");\r
-                               return;\r
-                       }\r
-\r
-                       AccessToken a = new AccessToken(parmResult, parmResult);\r
-                       \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 = 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
-\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() {\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 = twitter.getOAuthAccessToken(requestToken);\r
-               } catch (TwitterException e) {\r
-                       // TODO Auto-generated catch block\r
-                       e.printStackTrace();\r
-                       log.severe(e.toString());\r
-               }\r
-       }\r
-}\r
diff --git a/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/2/e0d11725f06500111e5bcf098ae37dc9 b/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/2/e0d11725f06500111e5bcf098ae37dc9
deleted file mode 100644 (file)
index 7ad3a2f..0000000
+++ /dev/null
@@ -1,149 +0,0 @@
-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("001");\r
-                               return;\r
-                       }\r
-\r
-                       if (!CommonUtil.isNull(parmResult)) {\r
-                               String requestTokenKey = dao.get(KeyValueDao.KEY_REQUEST_TOKEN);\r
-                               String requestTokenSecret = dao.get(KeyValueDao.KEY_REQUEST_TOKEN_SECRET);\r
-\r
-                               if (CommonUtil.isNull(requestTokenKey)\r
-                                               || CommonUtil.isNull(requestTokenSecret)) {\r
-                                       log.warning("003");\r
-                                       return;                                 \r
-                               }\r
-                               RequestToken requestToken = new RequestToken(requestTokenKey, requestTokenSecret);\r
-                               resultOAuthAuthorization(consumerKey, consumerSecret, requestToken);\r
-                               return;\r
-                       }\r
-\r
-                       if (accessToken == null) {\r
-                               log.warning("003");\r
-                               return;\r
-                       }\r
-\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, 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, 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 = twitter.getOAuthAccessToken(requestToken);\r
-               } catch (TwitterException e) {\r
-                       // TODO Auto-generated catch block\r
-                       e.printStackTrace();\r
-                       log.severe(e.toString());\r
-               }\r
-       }\r
-}\r
diff --git a/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/20/6040cd9d2b7200111835fa7adce7cfd2 b/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/20/6040cd9d2b7200111835fa7adce7cfd2
new file mode 100644 (file)
index 0000000..8f02835
--- /dev/null
@@ -0,0 +1,210 @@
+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
diff --git a/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/25/60c5644e2c7200111835fa7adce7cfd2 b/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/25/60c5644e2c7200111835fa7adce7cfd2
new file mode 100644 (file)
index 0000000..52bd15e
--- /dev/null
@@ -0,0 +1,218 @@
+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
diff --git a/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/26/c007379f136b001115b7b82f2f4ce01a b/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/26/c007379f136b001115b7b82f2f4ce01a
deleted file mode 100644 (file)
index 2e1f465..0000000
+++ /dev/null
@@ -1,143 +0,0 @@
-package com.yuji.tdb.twitter;\r
-\r
-import java.text.DateFormat;\r
-import java.util.ArrayList;\r
-import java.util.Calendar;\r
-import java.util.Date;\r
-import java.util.List;\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.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");\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
-\r
-       }\r
-\r
-       public void main(String consumerKey, String consumerSecret, AccessToken accessToken) {\r
-\r
-               String text = "\8b\9e\95l\93\8c\96k";\r
-\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
-                       Calendar cal = Calendar.getInstance();\r
-                       Date date = cal.getTime();\r
-                       long cur = date.getTime();\r
-                       \r
-                       Query query = new Query();\r
-                       //query.setRpp(1000); // TODO\r
-                       query.setQuery(text);\r
-                       QueryResult result = twitter.search(query);\r
-                       List<Tweet> tweets = result.getTweets();\r
-                       \r
-                       int count = 0;\r
-                       int hit = 0;\r
-                       int mhit = 0;\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 - 30 * 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
-                                       // \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 = "";\r
-                       if (count < 5){\r
-                               message = "\92x\89\84\82È\82µ " + DateFormat.format(date);        \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 = sample + " " + date.toString() + " count=" + count;                                                   \r
-                       }\r
-                       System.out.println(message);//TODO\r
-                       Status status = twitter.updateStatus(message);\r
-               } catch (TwitterException e) {\r
-                       // TODO Auto-generated catch block\r
-                       e.printStackTrace();\r
-                       log.severe(e.toString());\r
-               }\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
diff --git a/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/29/e064390fea6d001110a188bae663c898 b/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/29/e064390fea6d001110a188bae663c898
deleted file mode 100644 (file)
index e285c2a..0000000
+++ /dev/null
@@ -1,169 +0,0 @@
-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.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.Train;\r
-import com.yuji.tdb.db.TrainDao;\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
-\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
-               //TimeZone.setDefault(TimeZone.getTimeZone("JST")); // TODO \8fê\8f\8a\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 = twitter.search(query);\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
-               \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 - 30 * 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 += "\92x\89\84\82È\82µ " + df.format(date);       \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 += sample + " " + df.format(date) + " count=" + count;                                                  \r
-               }\r
-               System.out.println(message); //TODO\r
-               Status status = twitter.updateStatus(message); //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
-       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
@@ -10,6 +10,8 @@ public class KeyValueDao {
        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
@@ -45,5 +47,4 @@ public class KeyValueDao {
        public void put(String key, int value){\r
                put(key, String.valueOf(value));\r
        }\r
-       }\r
 }\r
diff --git a/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/2d/b017f80fce6a0011194396142d5d2649 b/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/2d/b017f80fce6a0011194396142d5d2649
deleted file mode 100644 (file)
index dd5b362..0000000
+++ /dev/null
@@ -1,46 +0,0 @@
-package com.yuji.tdb.main;\r
-\r
-import com.yuji.tdb.utility.StringUtil;\r
-\r
-import twitter4j.Status;\r
-import twitter4j.Twitter;\r
-import twitter4j.TwitterException;\r
-import twitter4j.TwitterFactory;\r
-import twitter4j.auth.AccessToken;\r
-import twitter4j.conf.ConfigurationBuilder;\r
-\r
-public class Main {\r
-\r
-       public static void main(String[] args) {\r
-               test1();\r
-       }\r
-       \r
-       public static void test1(){\r
-               String text = "\82 \82¢\82¤\82¦\82¨";\r
-               int length = 3;\r
-               String ret = StringUtil.parseSubstring(text, length);\r
-               System.out.println(ret);\r
-       }\r
-\r
-       public static void main() {\r
-               String consumerKey = "";\r
-               String consumerSecret = "";\r
-               String tokenKey = "";\r
-               String tokenSecret = "";\r
-\r
-               try {\r
-                       ConfigurationBuilder confBuilder = new ConfigurationBuilder();\r
-                       confBuilder.setDebugEnabled(true).setOAuthConsumerKey(consumerKey)\r
-                                       .setOAuthConsumerSecret(consumerSecret);\r
-                       TwitterFactory factory = new TwitterFactory(confBuilder.build());\r
-\r
-                       AccessToken accessToken = new AccessToken(tokenKey, tokenSecret);\r
-                       Twitter twitter = factory.getInstance(accessToken);\r
-\r
-                       Status status = twitter.updateStatus("\83e\83X\83g");\r
-               } catch (TwitterException e) {\r
-                       // TODO Auto-generated catch block\r
-                       e.printStackTrace();\r
-               }\r
-       }\r
-}\r
diff --git a/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/3/f02e309f2f7200111835fa7adce7cfd2 b/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/3/f02e309f2f7200111835fa7adce7cfd2
new file mode 100644 (file)
index 0000000..43b2f2b
--- /dev/null
@@ -0,0 +1,238 @@
+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
diff --git a/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/30/d0494b01357200111835fa7adce7cfd2 b/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/30/d0494b01357200111835fa7adce7cfd2
new file mode 100644 (file)
index 0000000..19dff9f
--- /dev/null
@@ -0,0 +1,74 @@
+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
diff --git a/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/31/5021e69b0e6b001115b7b82f2f4ce01a b/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/31/5021e69b0e6b001115b7b82f2f4ce01a
deleted file mode 100644 (file)
index 9be18d3..0000000
+++ /dev/null
@@ -1,46 +0,0 @@
-package com.yuji.tdb.main;\r
-\r
-import twitter4j.Status;\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.utility.StringUtility;\r
-\r
-public class Main {\r
-\r
-       public static void main(String[] args) {\r
-               test1();\r
-       }\r
-       \r
-       public static void test1(){\r
-               String text = "aa bb cc";\r
-               int length = 4;\r
-               String ret = StringUtility.parseSubstring(text, length);\r
-               System.out.println(ret);\r
-       }\r
-\r
-       public static void main() {\r
-               String consumerKey = "";\r
-               String consumerSecret = "";\r
-               String tokenKey = "";\r
-               String tokenSecret = "";\r
-\r
-               try {\r
-                       ConfigurationBuilder confBuilder = new ConfigurationBuilder();\r
-                       confBuilder.setDebugEnabled(true).setOAuthConsumerKey(consumerKey)\r
-                                       .setOAuthConsumerSecret(consumerSecret);\r
-                       TwitterFactory factory = new TwitterFactory(confBuilder.build());\r
-\r
-                       AccessToken accessToken = new AccessToken(tokenKey, tokenSecret);\r
-                       Twitter twitter = factory.getInstance(accessToken);\r
-\r
-                       Status status = twitter.updateStatus("\83e\83X\83g");\r
-               } catch (TwitterException e) {\r
-                       // TODO Auto-generated catch block\r
-                       e.printStackTrace();\r
-               }\r
-       }\r
-}\r
diff --git a/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/31/b060e838327200111835fa7adce7cfd2 b/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/31/b060e838327200111835fa7adce7cfd2
new file mode 100644 (file)
index 0000000..2f1baa2
--- /dev/null
@@ -0,0 +1,241 @@
+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
diff --git a/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/32/c0bf5276cd6a0011194396142d5d2649 b/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/32/c0bf5276cd6a0011194396142d5d2649
deleted file mode 100644 (file)
index 35c2d78..0000000
+++ /dev/null
@@ -1,141 +0,0 @@
-package com.yuji.tdb.twitter;\r
-\r
-import java.util.ArrayList;\r
-import java.util.Calendar;\r
-import java.util.Date;\r
-import java.util.List;\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
-\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
-\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
-\r
-       }\r
-\r
-       public void main(String consumerKey, String consumerSecret, AccessToken accessToken) {\r
-\r
-               String text = "\8b\9e\95l\93\8c\96k";\r
-\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
-                       Calendar cal = Calendar.getInstance();\r
-                       Date date = cal.getTime();\r
-                       long cur = date.getTime();\r
-                       \r
-                       Query query = new Query();\r
-                       //query.setRpp(1000); // TODO\r
-                       query.setQuery(text);\r
-                       QueryResult result = twitter.search(query);\r
-                       List<Tweet> tweets = result.getTweets();\r
-                       \r
-                       int count = 0;\r
-                       int hit = 0;\r
-                       int mhit = 0;\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 - 30 * 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
-                                       // \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 = "";\r
-                       if (count < 10){\r
-                               message = "\92x\89\84\82È\82µ " + date.toString();                        \r
-                       }\r
-                       else {\r
-                               int N = 50;\r
-                               \r
-                               String sample = tweets.get(mindex).getText();\r
-                               if (sample.length() > N){\r
-                                       sample = sample.substring(0, N);\r
-                               }\r
-                               sample = CommonUtil.replaceString(sample, "@", "(a)");\r
-                               message = sample + " " + date.toString() + " count=" + count;                                                   \r
-                       }\r
-                       Status status = twitter.updateStatus(message);\r
-               } catch (TwitterException e) {\r
-                       // TODO Auto-generated catch block\r
-                       e.printStackTrace();\r
-                       log.severe(e.toString());\r
-               }\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
diff --git a/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/33/909857312b7200111835fa7adce7cfd2 b/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/33/909857312b7200111835fa7adce7cfd2
new file mode 100644 (file)
index 0000000..891b5d1
--- /dev/null
@@ -0,0 +1,204 @@
+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
diff --git a/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/36/a0dc6068116b001115b7b82f2f4ce01a b/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/36/a0dc6068116b001115b7b82f2f4ce01a
deleted file mode 100644 (file)
index e44cdbf..0000000
+++ /dev/null
@@ -1,140 +0,0 @@
-package com.yuji.tdb.twitter;\r
-\r
-import java.util.ArrayList;\r
-import java.util.Calendar;\r
-import java.util.Date;\r
-import java.util.List;\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.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
-\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
-\r
-       }\r
-\r
-       public void main(String consumerKey, String consumerSecret, AccessToken accessToken) {\r
-\r
-               String text = "\8b\9e\95l\93\8c\96k";\r
-\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
-                       Calendar cal = Calendar.getInstance();\r
-                       Date date = cal.getTime();\r
-                       long cur = date.getTime();\r
-                       \r
-                       Query query = new Query();\r
-                       //query.setRpp(1000); // TODO\r
-                       query.setQuery(text);\r
-                       QueryResult result = twitter.search(query);\r
-                       List<Tweet> tweets = result.getTweets();\r
-                       \r
-                       int count = 0;\r
-                       int hit = 0;\r
-                       int mhit = 0;\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 - 30 * 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
-                                       // \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 = "";\r
-                       if (count < 10){\r
-                               message = "\92x\89\84\82È\82µ " + date.toString();                        \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 = sample + " " + date.toString() + " count=" + count;                                                   \r
-                       }\r
-                       Status status = twitter.updateStatus(message);\r
-               } catch (TwitterException e) {\r
-                       // TODO Auto-generated catch block\r
-                       e.printStackTrace();\r
-                       log.severe(e.toString());\r
-               }\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
diff --git a/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/38/20c52514ea6d001110a188bae663c898 b/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/38/20c52514ea6d001110a188bae663c898
deleted file mode 100644 (file)
index 5bee032..0000000
+++ /dev/null
@@ -1,169 +0,0 @@
-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.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.Train;\r
-import com.yuji.tdb.db.TrainDao;\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
-\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 = twitter.search(query);\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
-               \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 - 30 * 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 += "\92x\89\84\82È\82µ " + df.format(date);       \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 += sample + " " + df.format(date) + " count=" + count;                                                  \r
-               }\r
-               System.out.println(message); //TODO\r
-               Status status = twitter.updateStatus(message); //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
-       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
diff --git a/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/38/5033ef01d46a001115b0ad2bca3cccad b/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/38/5033ef01d46a001115b0ad2bca3cccad
deleted file mode 100644 (file)
index 99580d4..0000000
+++ /dev/null
@@ -1,43 +0,0 @@
-package com.yuji.tdb.utility;
-
-import java.util.regex.Pattern;
-
-public class StringUtility {
-       private static Pattern ptnAlnum = Pattern.compile("[a-zA-Z0-9]");
-       private static Pattern ptnAscii = Pattern.compile("\\p{ASCII}");
-       
-       public static String parseSubstring(String text, int length){
-               int len = text.length();
-               int status = -1;
-               int pos = 0;
-               
-               for (int i = 0; i < len + 1 && i < length + 1; i++){
-                       if (i >= len){
-                               pos = i;
-                               break;
-                       }
-                       String ch = text.substring(i, i + 1);
-                       
-                       if (ptnAlnum.matcher(ch).matches()){
-                               if (status != 0){
-                                       pos = i;
-                                       status = 0;
-                               }
-                       }
-                       else if (ptnAscii.matcher(ch).matches()){
-                               if (status != 1){
-                                       pos = i;
-                                       status = 1;
-                               }                               
-                       }
-                       else {
-                               pos = i;
-                               status = 2;
-                       }
-               }
-               if (pos == 0){
-                       return text.substring(0, (len < length)? len : length);                 
-               }
-               return text.substring(0, pos);
-       }
-}
diff --git a/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/38/a0378928357200111835fa7adce7cfd2 b/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/38/a0378928357200111835fa7adce7cfd2
new file mode 100644 (file)
index 0000000..be96836
--- /dev/null
@@ -0,0 +1,75 @@
+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
diff --git a/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/3a/601d2c33cb6a0011194396142d5d2649 b/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/3a/601d2c33cb6a0011194396142d5d2649
deleted file mode 100644 (file)
index 3818e8c..0000000
+++ /dev/null
@@ -1,46 +0,0 @@
-package com.yuji.tdb.main;\r
-\r
-import com.yuji.tdb.utility.StringUtil;\r
-\r
-import twitter4j.Status;\r
-import twitter4j.Twitter;\r
-import twitter4j.TwitterException;\r
-import twitter4j.TwitterFactory;\r
-import twitter4j.auth.AccessToken;\r
-import twitter4j.conf.ConfigurationBuilder;\r
-\r
-public class Main {\r
-\r
-       public static void main(String[] args) {\r
-               test1();\r
-       }\r
-       \r
-       public static void test1(){\r
-               String text = "a#\82 \82¢\82¤";\r
-               int length = 3;\r
-               String ret = StringUtil.parseSubstring(text, length);\r
-               System.out.println(ret);\r
-       }\r
-\r
-       public static void main() {\r
-               String consumerKey = "";\r
-               String consumerSecret = "";\r
-               String tokenKey = "";\r
-               String tokenSecret = "";\r
-\r
-               try {\r
-                       ConfigurationBuilder confBuilder = new ConfigurationBuilder();\r
-                       confBuilder.setDebugEnabled(true).setOAuthConsumerKey(consumerKey)\r
-                                       .setOAuthConsumerSecret(consumerSecret);\r
-                       TwitterFactory factory = new TwitterFactory(confBuilder.build());\r
-\r
-                       AccessToken accessToken = new AccessToken(tokenKey, tokenSecret);\r
-                       Twitter twitter = factory.getInstance(accessToken);\r
-\r
-                       Status status = twitter.updateStatus("\83e\83X\83g");\r
-               } catch (TwitterException e) {\r
-                       // TODO Auto-generated catch block\r
-                       e.printStackTrace();\r
-               }\r
-       }\r
-}\r
diff --git a/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/3b/e0dcd1aa0e6b001115b7b82f2f4ce01a b/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/3b/e0dcd1aa0e6b001115b7b82f2f4ce01a
deleted file mode 100644 (file)
index 9be18d3..0000000
+++ /dev/null
@@ -1,46 +0,0 @@
-package com.yuji.tdb.main;\r
-\r
-import twitter4j.Status;\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.utility.StringUtility;\r
-\r
-public class Main {\r
-\r
-       public static void main(String[] args) {\r
-               test1();\r
-       }\r
-       \r
-       public static void test1(){\r
-               String text = "aa bb cc";\r
-               int length = 4;\r
-               String ret = StringUtility.parseSubstring(text, length);\r
-               System.out.println(ret);\r
-       }\r
-\r
-       public static void main() {\r
-               String consumerKey = "";\r
-               String consumerSecret = "";\r
-               String tokenKey = "";\r
-               String tokenSecret = "";\r
-\r
-               try {\r
-                       ConfigurationBuilder confBuilder = new ConfigurationBuilder();\r
-                       confBuilder.setDebugEnabled(true).setOAuthConsumerKey(consumerKey)\r
-                                       .setOAuthConsumerSecret(consumerSecret);\r
-                       TwitterFactory factory = new TwitterFactory(confBuilder.build());\r
-\r
-                       AccessToken accessToken = new AccessToken(tokenKey, tokenSecret);\r
-                       Twitter twitter = factory.getInstance(accessToken);\r
-\r
-                       Status status = twitter.updateStatus("\83e\83X\83g");\r
-               } catch (TwitterException e) {\r
-                       // TODO Auto-generated catch block\r
-                       e.printStackTrace();\r
-               }\r
-       }\r
-}\r
diff --git a/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/3c/a09ae0bacc6a0011194396142d5d2649 b/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/3c/a09ae0bacc6a0011194396142d5d2649
deleted file mode 100644 (file)
index 684c45b..0000000
+++ /dev/null
@@ -1,46 +0,0 @@
-package com.yuji.tdb.main;\r
-\r
-import com.yuji.tdb.utility.StringUtil;\r
-\r
-import twitter4j.Status;\r
-import twitter4j.Twitter;\r
-import twitter4j.TwitterException;\r
-import twitter4j.TwitterFactory;\r
-import twitter4j.auth.AccessToken;\r
-import twitter4j.conf.ConfigurationBuilder;\r
-\r
-public class Main {\r
-\r
-       public static void main(String[] args) {\r
-               test1();\r
-       }\r
-       \r
-       public static void test1(){\r
-               String text = "\82 \82¢\82¤";\r
-               int length = 3;\r
-               String ret = StringUtil.parseSubstring(text, length);\r
-               System.out.println(ret);\r
-       }\r
-\r
-       public static void main() {\r
-               String consumerKey = "";\r
-               String consumerSecret = "";\r
-               String tokenKey = "";\r
-               String tokenSecret = "";\r
-\r
-               try {\r
-                       ConfigurationBuilder confBuilder = new ConfigurationBuilder();\r
-                       confBuilder.setDebugEnabled(true).setOAuthConsumerKey(consumerKey)\r
-                                       .setOAuthConsumerSecret(consumerSecret);\r
-                       TwitterFactory factory = new TwitterFactory(confBuilder.build());\r
-\r
-                       AccessToken accessToken = new AccessToken(tokenKey, tokenSecret);\r
-                       Twitter twitter = factory.getInstance(accessToken);\r
-\r
-                       Status status = twitter.updateStatus("\83e\83X\83g");\r
-               } catch (TwitterException e) {\r
-                       // TODO Auto-generated catch block\r
-                       e.printStackTrace();\r
-               }\r
-       }\r
-}\r
diff --git a/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/3c/e03d0e9bcc6a0011194396142d5d2649 b/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/3c/e03d0e9bcc6a0011194396142d5d2649
deleted file mode 100644 (file)
index c9c19b4..0000000
+++ /dev/null
@@ -1,46 +0,0 @@
-package com.yuji.tdb.main;\r
-\r
-import com.yuji.tdb.utility.StringUtil;\r
-\r
-import twitter4j.Status;\r
-import twitter4j.Twitter;\r
-import twitter4j.TwitterException;\r
-import twitter4j.TwitterFactory;\r
-import twitter4j.auth.AccessToken;\r
-import twitter4j.conf.ConfigurationBuilder;\r
-\r
-public class Main {\r
-\r
-       public static void main(String[] args) {\r
-               test1();\r
-       }\r
-       \r
-       public static void test1(){\r
-               String text = "ab#@\82 \82¢\82¤";\r
-               int length = 3;\r
-               String ret = StringUtil.parseSubstring(text, length);\r
-               System.out.println(ret);\r
-       }\r
-\r
-       public static void main() {\r
-               String consumerKey = "";\r
-               String consumerSecret = "";\r
-               String tokenKey = "";\r
-               String tokenSecret = "";\r
-\r
-               try {\r
-                       ConfigurationBuilder confBuilder = new ConfigurationBuilder();\r
-                       confBuilder.setDebugEnabled(true).setOAuthConsumerKey(consumerKey)\r
-                                       .setOAuthConsumerSecret(consumerSecret);\r
-                       TwitterFactory factory = new TwitterFactory(confBuilder.build());\r
-\r
-                       AccessToken accessToken = new AccessToken(tokenKey, tokenSecret);\r
-                       Twitter twitter = factory.getInstance(accessToken);\r
-\r
-                       Status status = twitter.updateStatus("\83e\83X\83g");\r
-               } catch (TwitterException e) {\r
-                       // TODO Auto-generated catch block\r
-                       e.printStackTrace();\r
-               }\r
-       }\r
-}\r
diff --git a/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/3e/7073d45d2b7200111835fa7adce7cfd2 b/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/3e/7073d45d2b7200111835fa7adce7cfd2
new file mode 100644 (file)
index 0000000..f692e01
--- /dev/null
@@ -0,0 +1,210 @@
+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
diff --git a/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/40/b049028871680011170bbf669c61406a b/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/40/b049028871680011170bbf669c61406a
deleted file mode 100644 (file)
index f3a90f4..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-package com.yuji.tdb.utility;
-
-import java.util.regex.Pattern;
-
-public class StringUtil {
-       private static Pattern ptnAlnum = Pattern.compile("[a-zA-Z0-9]");
-       private static Pattern ptnAscii = Pattern.compile("\\p{ASCII}");
-       
-       public static String parseSubstring(String text, int length){
-               // http://java.sun.com/javase/ja/6/docs/ja/api/java/util/regex/Pattern.html
-       }
-}
diff --git a/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/42/608da1dbfb6500111e5bcf098ae37dc9 b/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/42/608da1dbfb6500111e5bcf098ae37dc9
deleted file mode 100644 (file)
index 8d6d6da..0000000
+++ /dev/null
@@ -1,137 +0,0 @@
-package com.yuji.tdb.twitter;\r
-\r
-import java.util.ArrayList;\r
-import java.util.Calendar;\r
-import java.util.Date;\r
-import java.util.List;\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
-\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
-\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
-\r
-       }\r
-\r
-       public void main(String consumerKey, String consumerSecret, AccessToken accessToken) {\r
-\r
-               String text = "\8b\9e\95l\93\8c\96k";\r
-\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
-                       Calendar cal = Calendar.getInstance();\r
-                       Date date = cal.getTime();\r
-                       long cur = date.getTime();\r
-                       \r
-                       Query query = new Query();\r
-                       query.setRpp(1000); // TODO\r
-                       query.setQuery(text);\r
-                       QueryResult result = twitter.search(query);\r
-                       List<Tweet> tweets = result.getTweets();\r
-                       \r
-                       int count = 0;\r
-                       int hit = 0;\r
-                       int mhit = 0;\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
-                               String message = tweet.getText();\r
-                               \r
-                               if (t < cur - 30 * 60 * 1000){\r
-                                       continue;\r
-                               }\r
-                               hit = filter(message);\r
-                               if (hit <= 0) {\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 = "";\r
-                       if (count < 10){\r
-                               message = "\92x\89\84\82È\82µ " + date.toString();                        \r
-                       }\r
-                       else {\r
-                               int N = 50;\r
-                               \r
-                               String sample = tweets.get(mindex).getText();\r
-                               if (sample.length() > N){\r
-                                       sample = sample.substring(0, N);\r
-                               }\r
-                               sample = CommonUtil.replaceString(sample, "@", "(a)");\r
-                               message = sample + " " + date.toString() + " count=" + count;                                                   \r
-                       }\r
-                       Status status = twitter.updateStatus(message);\r
-               } catch (TwitterException e) {\r
-                       // TODO Auto-generated catch block\r
-                       e.printStackTrace();\r
-                       log.severe(e.toString());\r
-               }\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("\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
diff --git a/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/43/70d1a5aeee6500111e5bcf098ae37dc9 b/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/43/70d1a5aeee6500111e5bcf098ae37dc9
deleted file mode 100644 (file)
index 09675a6..0000000
+++ /dev/null
@@ -1,147 +0,0 @@
-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
-                               \r
-                               dao.put("FOO", "aaa");\r
-                               \r
-                               return;\r
-                       }\r
-\r
-                       String consumerKey = dao.get(KeyValueDao.KEY_CONSUMER_KEY);\r
-                       String consumerSecret = dao.get(KeyValueDao.KEY_CONSUMER_SECRET);\r
-                       if (requestToken == null || CommonUtil.isNull(consumerKey)\r
-                                       || CommonUtil.isNull(consumerSecret)) {\r
-                               log.warning("001");\r
-                               return;\r
-                       }\r
-\r
-                       if (!CommonUtil.isNull(parmResult)) {\r
-                               resultOAuthAuthorization(consumerKey, consumerSecret);\r
-                               \r
-                               String value = dao.get("FOO");\r
-                               log.warning("VALUE=" + value);\r
-                               \r
-                               return;\r
-                       }\r
-\r
-                       if (accessToken == null) {\r
-                               log.warning("002");\r
-                               return;\r
-                       }\r
-\r
-                       AccessToken a = new AccessToken(parmResult, parmResult);\r
-                       \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 = 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
-                       \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, String consumerSecret) {\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 = twitter.getOAuthAccessToken(requestToken);\r
-               } catch (TwitterException e) {\r
-                       // TODO Auto-generated catch block\r
-                       e.printStackTrace();\r
-                       log.severe(e.toString());\r
-               }\r
-       }\r
-}\r
diff --git a/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/45/204c2062136b001115b7b82f2f4ce01a b/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/45/204c2062136b001115b7b82f2f4ce01a
deleted file mode 100644 (file)
index 2e1f465..0000000
+++ /dev/null
@@ -1,143 +0,0 @@
-package com.yuji.tdb.twitter;\r
-\r
-import java.text.DateFormat;\r
-import java.util.ArrayList;\r
-import java.util.Calendar;\r
-import java.util.Date;\r
-import java.util.List;\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.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");\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
-\r
-       }\r
-\r
-       public void main(String consumerKey, String consumerSecret, AccessToken accessToken) {\r
-\r
-               String text = "\8b\9e\95l\93\8c\96k";\r
-\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
-                       Calendar cal = Calendar.getInstance();\r
-                       Date date = cal.getTime();\r
-                       long cur = date.getTime();\r
-                       \r
-                       Query query = new Query();\r
-                       //query.setRpp(1000); // TODO\r
-                       query.setQuery(text);\r
-                       QueryResult result = twitter.search(query);\r
-                       List<Tweet> tweets = result.getTweets();\r
-                       \r
-                       int count = 0;\r
-                       int hit = 0;\r
-                       int mhit = 0;\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 - 30 * 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
-                                       // \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 = "";\r
-                       if (count < 5){\r
-                               message = "\92x\89\84\82È\82µ " + DateFormat.format(date);        \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 = sample + " " + date.toString() + " count=" + count;                                                   \r
-                       }\r
-                       System.out.println(message);//TODO\r
-                       Status status = twitter.updateStatus(message);\r
-               } catch (TwitterException e) {\r
-                       // TODO Auto-generated catch block\r
-                       e.printStackTrace();\r
-                       log.severe(e.toString());\r
-               }\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
diff --git a/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/45/20714db22d7200111835fa7adce7cfd2 b/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/45/20714db22d7200111835fa7adce7cfd2
new file mode 100644 (file)
index 0000000..d247e15
--- /dev/null
@@ -0,0 +1,238 @@
+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
diff --git a/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/46/20f9def1cc6a0011194396142d5d2649 b/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/46/20f9def1cc6a0011194396142d5d2649
deleted file mode 100644 (file)
index 01d1236..0000000
+++ /dev/null
@@ -1,46 +0,0 @@
-package com.yuji.tdb.main;\r
-\r
-import com.yuji.tdb.utility.StringUtil;\r
-\r
-import twitter4j.Status;\r
-import twitter4j.Twitter;\r
-import twitter4j.TwitterException;\r
-import twitter4j.TwitterFactory;\r
-import twitter4j.auth.AccessToken;\r
-import twitter4j.conf.ConfigurationBuilder;\r
-\r
-public class Main {\r
-\r
-       public static void main(String[] args) {\r
-               test1();\r
-       }\r
-       \r
-       public static void test1(){\r
-               String text = "abc";\r
-               int length = 3;\r
-               String ret = StringUtil.parseSubstring(text, length);\r
-               System.out.println(ret);\r
-       }\r
-\r
-       public static void main() {\r
-               String consumerKey = "";\r
-               String consumerSecret = "";\r
-               String tokenKey = "";\r
-               String tokenSecret = "";\r
-\r
-               try {\r
-                       ConfigurationBuilder confBuilder = new ConfigurationBuilder();\r
-                       confBuilder.setDebugEnabled(true).setOAuthConsumerKey(consumerKey)\r
-                                       .setOAuthConsumerSecret(consumerSecret);\r
-                       TwitterFactory factory = new TwitterFactory(confBuilder.build());\r
-\r
-                       AccessToken accessToken = new AccessToken(tokenKey, tokenSecret);\r
-                       Twitter twitter = factory.getInstance(accessToken);\r
-\r
-                       Status status = twitter.updateStatus("\83e\83X\83g");\r
-               } catch (TwitterException e) {\r
-                       // TODO Auto-generated catch block\r
-                       e.printStackTrace();\r
-               }\r
-       }\r
-}\r
diff --git a/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/46/f0fab198676b001115b7b82f2f4ce01a b/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/46/f0fab198676b001115b7b82f2f4ce01a
deleted file mode 100644 (file)
index 11d6fd7..0000000
+++ /dev/null
@@ -1,170 +0,0 @@
-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.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.Train;\r
-import com.yuji.tdb.db.TrainDao;\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
-\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
-               //TimeZone.setDefault(TimeZone.getTimeZone("JST")); // TODO \8fê\8f\8a\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
-               Calendar cal = Calendar.getInstance();\r
-               Date date = cal.getTime();\r
-               long cur = date.getTime();\r
-               \r
-               Query query = new Query();\r
-               //query.setRpp(1000); // TODO\r
-               query.setQuery(text);\r
-               QueryResult result = twitter.search(query);\r
-               List<Tweet> tweets = result.getTweets();\r
-               \r
-               int count = 0;\r
-               int hit = 0;\r
-               int mhit = 0;\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 - 30 * 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
-                               // \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 = "";\r
-               if (count < 5){\r
-                       message = "\92x\89\84\82È\82µ " + df.format(date);        \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 = sample + " " + df.format(date) + " count=" + count;                                                   \r
-               }\r
-               System.out.println(message); //TODO\r
-               Status status = twitter.updateStatus(message); //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
-                       list.add(train);\r
-                       train = new Train("\93\8c\8aC\93¹\90ü", "\93\8c\8aC\93¹", 5);\r
-                       list.add(train);\r
-                       train = new Train("\8b\9e\95l\8b}\8ds\90ü", "\8b\9e\8b}", 5);\r
-                       list.add(train);\r
-                       \r
-                       for (Train t : list){\r
-                               dao.put(t);\r
-                       }\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
diff --git a/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/48/b0de5c91ee6500111e5bcf098ae37dc9 b/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/48/b0de5c91ee6500111e5bcf098ae37dc9
deleted file mode 100644 (file)
index 99071f1..0000000
+++ /dev/null
@@ -1,147 +0,0 @@
-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
-                               \r
-                               dao.put("FOO", "aaa");\r
-                               \r
-                               return;\r
-                       }\r
-\r
-                       String consumerKey = dao.get(KeyValueDao.KEY_CONSUMER_KEY);\r
-                       String consumerSecret = dao.get(KeyValueDao.KEY_CONSUMER_SECRET);\r
-                       if (requestToken == null || CommonUtil.isNull(consumerKey)\r
-                                       || CommonUtil.isNull(consumerSecret)) {\r
-                               log.warning("001");\r
-                               return;\r
-                       }\r
-\r
-                       if (!CommonUtil.isNull(parmResult)) {\r
-                               resultOAuthAuthorization();\r
-                               \r
-                               String value = dao.get("FOO");\r
-                               log.warning("VALUE=" + value);\r
-                               \r
-                               return;\r
-                       }\r
-\r
-                       if (accessToken == null) {\r
-                               log.warning("002");\r
-                               return;\r
-                       }\r
-\r
-                       AccessToken a = new AccessToken(parmResult, parmResult);\r
-                       \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 = 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
-                       \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, String consumerSecret) {\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 = twitter.getOAuthAccessToken(requestToken);\r
-               } catch (TwitterException e) {\r
-                       // TODO Auto-generated catch block\r
-                       e.printStackTrace();\r
-                       log.severe(e.toString());\r
-               }\r
-       }\r
-}\r
diff --git a/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/49/20d0d043666b001115b7b82f2f4ce01a b/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/49/20d0d043666b001115b7b82f2f4ce01a
deleted file mode 100644 (file)
index 90d9829..0000000
+++ /dev/null
@@ -1,44 +0,0 @@
-package com.yuji.tdb.db;\r
-\r
-import javax.jdo.PersistenceManager;\r
-\r
-public class TrainDao {\r
-       private static TrainDao instance = null;\r
-       private PersistenceManager pm = PMFactory.get().getPersistenceManager();\r
-               \r
-       public static TrainDao getInstance(){\r
-               if (instance == null){\r
-                       instance = new TrainDao();\r
-               }\r
-               return instance;\r
-       }\r
-       \r
-       private TrainDao(){\r
-               \r
-       }\r
-       \r
-       public String get(String key){\r
-           String query = "SELECT FROM " + Train.class.getName();\r
-           List<Employee> emp = (List<Employee>) pm.newQuery(query).execute();\r
-            \r
-           if (emp.isEmpty()) {\r
-               out.println("<p>The guestbook has no messages.</p>");\r
-           }else {\r
-               out.println(emp.size() + "\r
-       ");\r
-               for (Employee e : emp) {\r
-                  out.println(e.getName());\r
-               }\r
-           }\r
-           pm.close();\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
diff --git a/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/49/700d25d1ca6a0011194396142d5d2649 b/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/49/700d25d1ca6a0011194396142d5d2649
deleted file mode 100644 (file)
index 06f5089..0000000
+++ /dev/null
@@ -1,38 +0,0 @@
-package com.yuji.tdb.utility;
-
-import java.util.regex.Pattern;
-
-public class StringUtil {
-       private static Pattern ptnAlnum = Pattern.compile("[a-zA-Z0-9]");
-       private static Pattern ptnAscii = Pattern.compile("\\p{ASCII}");
-       
-       public static String parseSubstring(String text, int length){
-               int len = text.length();
-               int status = -1;
-               int pos = 0;
-               
-               for (int i = 0; i < len && i < length; i++){
-                       String ch = text.substring(i, i + 1);
-                       
-                       if (ptnAlnum.matcher(ch).matches()){
-                               if (status != 0){
-                                       pos = i;
-                                       status = 0;
-                               }
-                       }
-                       else if (ptnAscii.matcher(ch).matches()){
-                               if (status != 1){
-                                       pos = i;
-                                       status = 1;
-                               }                               
-                       }
-                       else {
-                               if (status != 2){
-                                       pos = i;
-                                       status = 2;
-                               }                                                               
-                       }
-               }
-               return text.substring(0, pos);
-       }
-}
diff --git a/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/4a/400c6497696b001115b7b82f2f4ce01a b/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/4a/400c6497696b001115b7b82f2f4ce01a
deleted file mode 100644 (file)
index 916b64a..0000000
+++ /dev/null
@@ -1,169 +0,0 @@
-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.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.Train;\r
-import com.yuji.tdb.db.TrainDao;\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
-\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
-               //TimeZone.setDefault(TimeZone.getTimeZone("JST")); // TODO \8fê\8f\8a\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
-               Calendar cal = Calendar.getInstance();\r
-               Date date = cal.getTime();\r
-               long cur = date.getTime();\r
-               \r
-               Query query = new Query();\r
-               //query.setRpp(1000); // TODO\r
-               query.setQuery(train.getSearchWord());\r
-               QueryResult result = twitter.search(query);\r
-               List<Tweet> tweets = result.getTweets();\r
-               \r
-               int count = 0;\r
-               int hit = 0;\r
-               int mhit = 0;\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 - 30 * 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 = "";\r
-               if (count < train.getCount()){\r
-                       message = "\92x\89\84\82È\82µ " + df.format(date);        \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 = sample + " " + df.format(date) + " count=" + count;                                                   \r
-               }\r
-               System.out.println(message); //TODO\r
-               Status status = twitter.updateStatus(message); //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
-       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
diff --git a/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/4a/f0ed907fcd6a0011194396142d5d2649 b/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/4a/f0ed907fcd6a0011194396142d5d2649
deleted file mode 100644 (file)
index fe9e552..0000000
+++ /dev/null
@@ -1,139 +0,0 @@
-package com.yuji.tdb.twitter;\r
-\r
-import java.util.ArrayList;\r
-import java.util.Calendar;\r
-import java.util.Date;\r
-import java.util.List;\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
-\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
-\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
-\r
-       }\r
-\r
-       public void main(String consumerKey, String consumerSecret, AccessToken accessToken) {\r
-\r
-               String text = "\8b\9e\95l\93\8c\96k";\r
-\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
-                       Calendar cal = Calendar.getInstance();\r
-                       Date date = cal.getTime();\r
-                       long cur = date.getTime();\r
-                       \r
-                       Query query = new Query();\r
-                       //query.setRpp(1000); // TODO\r
-                       query.setQuery(text);\r
-                       QueryResult result = twitter.search(query);\r
-                       List<Tweet> tweets = result.getTweets();\r
-                       \r
-                       int count = 0;\r
-                       int hit = 0;\r
-                       int mhit = 0;\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 - 30 * 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
-                                       // \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 = "";\r
-                       if (count < 10){\r
-                               message = "\92x\89\84\82È\82µ " + date.toString();                        \r
-                       }\r
-                       else {\r
-                               int N = 100;\r
-                               \r
-                               String sample = tweets.get(mindex).getText();\r
-                               sample = CommonUtil.replaceString(sample, "@", "(a)");\r
-                               sample = StringUtil.parseSubstring(sample);\r
-                               message = sample + " " + date.toString() + " count=" + count;                                                   \r
-                       }\r
-                       Status status = twitter.updateStatus(message);\r
-               } catch (TwitterException e) {\r
-                       // TODO Auto-generated catch block\r
-                       e.printStackTrace();\r
-                       log.severe(e.toString());\r
-               }\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
diff --git a/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/4b/4011f0b10e6b001115b7b82f2f4ce01a b/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/4b/4011f0b10e6b001115b7b82f2f4ce01a
deleted file mode 100644 (file)
index ff3804d..0000000
+++ /dev/null
@@ -1,46 +0,0 @@
-package com.yuji.tdb.main;\r
-\r
-import twitter4j.Status;\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.utility.StringUtility;\r
-\r
-public class Main {\r
-\r
-       public static void main(String[] args) {\r
-               test1();\r
-       }\r
-       \r
-       public static void test1(){\r
-               String text = "aa bb cc";\r
-               int length = 3;\r
-               String ret = StringUtility.parseSubstring(text, length);\r
-               System.out.println(ret);\r
-       }\r
-\r
-       public static void main() {\r
-               String consumerKey = "";\r
-               String consumerSecret = "";\r
-               String tokenKey = "";\r
-               String tokenSecret = "";\r
-\r
-               try {\r
-                       ConfigurationBuilder confBuilder = new ConfigurationBuilder();\r
-                       confBuilder.setDebugEnabled(true).setOAuthConsumerKey(consumerKey)\r
-                                       .setOAuthConsumerSecret(consumerSecret);\r
-                       TwitterFactory factory = new TwitterFactory(confBuilder.build());\r
-\r
-                       AccessToken accessToken = new AccessToken(tokenKey, tokenSecret);\r
-                       Twitter twitter = factory.getInstance(accessToken);\r
-\r
-                       Status status = twitter.updateStatus("\83e\83X\83g");\r
-               } catch (TwitterException e) {\r
-                       // TODO Auto-generated catch block\r
-                       e.printStackTrace();\r
-               }\r
-       }\r
-}\r
diff --git a/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/4b/d0ad083bcd6a0011194396142d5d2649 b/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/4b/d0ad083bcd6a0011194396142d5d2649
deleted file mode 100644 (file)
index 65ec5f4..0000000
+++ /dev/null
@@ -1,46 +0,0 @@
-package com.yuji.tdb.main;\r
-\r
-import com.yuji.tdb.utility.StringUtil;\r
-\r
-import twitter4j.Status;\r
-import twitter4j.Twitter;\r
-import twitter4j.TwitterException;\r
-import twitter4j.TwitterFactory;\r
-import twitter4j.auth.AccessToken;\r
-import twitter4j.conf.ConfigurationBuilder;\r
-\r
-public class Main {\r
-\r
-       public static void main(String[] args) {\r
-               test1();\r
-       }\r
-       \r
-       public static void test1(){\r
-               String text = "abcd";\r
-               int length = 5;\r
-               String ret = StringUtil.parseSubstring(text, length);\r
-               System.out.println(ret);\r
-       }\r
-\r
-       public static void main() {\r
-               String consumerKey = "";\r
-               String consumerSecret = "";\r
-               String tokenKey = "";\r
-               String tokenSecret = "";\r
-\r
-               try {\r
-                       ConfigurationBuilder confBuilder = new ConfigurationBuilder();\r
-                       confBuilder.setDebugEnabled(true).setOAuthConsumerKey(consumerKey)\r
-                                       .setOAuthConsumerSecret(consumerSecret);\r
-                       TwitterFactory factory = new TwitterFactory(confBuilder.build());\r
-\r
-                       AccessToken accessToken = new AccessToken(tokenKey, tokenSecret);\r
-                       Twitter twitter = factory.getInstance(accessToken);\r
-\r
-                       Status status = twitter.updateStatus("\83e\83X\83g");\r
-               } catch (TwitterException e) {\r
-                       // TODO Auto-generated catch block\r
-                       e.printStackTrace();\r
-               }\r
-       }\r
-}\r
diff --git a/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/4c/a08eea65f16500111e5bcf098ae37dc9 b/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/4c/a08eea65f16500111e5bcf098ae37dc9
deleted file mode 100644 (file)
index 4685e19..0000000
+++ /dev/null
@@ -1,156 +0,0 @@
-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("001");\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("003");\r
-                                       return;\r
-                               }\r
-                               RequestToken requestToken = new RequestToken(requestTokenKey,\r
-                                               requestTokenSecret);\r
-                               resultOAuthAuthorization(consumerKey, consumerSecret,\r
-                                               requestToken);\r
-                               return;\r
-                       }\r
-\r
-                       if (accessToken == null) {\r
-                               log.warning("003");\r
-                               return;\r
-                       }\r
-\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, accessToken.getTokenSecret());\r
-               } catch (TwitterException e) {\r
-                       // TODO Auto-generated catch block\r
-                       e.printStackTrace();\r
-                       log.severe(e.toString());\r
-               }\r
-       }\r
-}\r
diff --git a/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/4d/0001f26f497000111324ab4fa5fd1a16 b/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/4d/0001f26f497000111324ab4fa5fd1a16
new file mode 100644 (file)
index 0000000..ed23a22
--- /dev/null
@@ -0,0 +1,9 @@
+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();
+       }
+}
@@ -10,6 +10,8 @@ public class KeyValueDao {
        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
@@ -32,6 +34,11 @@ public class KeyValueDao {
                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
@@ -40,5 +47,13 @@ public class KeyValueDao {
        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
diff --git a/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/4e/f0770210ce6a0011194396142d5d2649 b/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/4e/f0770210ce6a0011194396142d5d2649
deleted file mode 100644 (file)
index 83e6fa9..0000000
+++ /dev/null
@@ -1,43 +0,0 @@
-package com.yuji.tdb.utility;
-
-import java.util.regex.Pattern;
-
-public class StringUtil {
-       private static Pattern ptnAlnum = Pattern.compile("[a-zA-Z0-9]");
-       private static Pattern ptnAscii = Pattern.compile("\\p{ASCII}");
-       
-       public static String parseSubstring(String text, int length){
-               int len = text.length();
-               int status = -1;
-               int pos = 0;
-               
-               for (int i = 0; i < len + 1 && i < length + 1; i++){
-                       if (i >= len){
-                               pos = i;
-                               break;
-                       }
-                       String ch = text.substring(i, i + 1);
-                       
-                       if (ptnAlnum.matcher(ch).matches()){
-                               if (status != 0){
-                                       pos = i;
-                                       status = 0;
-                               }
-                       }
-                       else if (ptnAscii.matcher(ch).matches()){
-                               if (status != 1){
-                                       pos = i;
-                                       status = 1;
-                               }                               
-                       }
-                       else {
-                               pos = i;
-                               status = 2;
-                       }
-               }
-               if (pos == 0){
-                       return text.substring(0, (len < length)? len : length);                 
-               }
-               return text.substring(0, pos);
-       }
-}
diff --git a/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/5/903de7bf646b001115b7b82f2f4ce01a b/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/5/903de7bf646b001115b7b82f2f4ce01a
deleted file mode 100644 (file)
index 66bb7a0..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-package com.yuji.tdb.db;
-
-@PersistenceCapable(identityType = IdentityType.APPLICATION)
-public class Train {
-    @PrimaryKey
-    @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
-    private Long id;
-    @Persistent
-    private String name;
-    @Persistent
-    private String searchWord;
-    @Persistent
-    private int count;
-}
diff --git a/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/50/505796472f7200111835fa7adce7cfd2 b/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/50/505796472f7200111835fa7adce7cfd2
new file mode 100644 (file)
index 0000000..7611564
--- /dev/null
@@ -0,0 +1,238 @@
+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
diff --git a/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/51/8084fc0fce6a0011194396142d5d2649 b/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/51/8084fc0fce6a0011194396142d5d2649
deleted file mode 100644 (file)
index e3b29f8..0000000
+++ /dev/null
@@ -1,140 +0,0 @@
-package com.yuji.tdb.twitter;\r
-\r
-import java.util.ArrayList;\r
-import java.util.Calendar;\r
-import java.util.Date;\r
-import java.util.List;\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.utility.StringUtil;\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
-\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
-\r
-       }\r
-\r
-       public void main(String consumerKey, String consumerSecret, AccessToken accessToken) {\r
-\r
-               String text = "\8b\9e\95l\93\8c\96k";\r
-\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
-                       Calendar cal = Calendar.getInstance();\r
-                       Date date = cal.getTime();\r
-                       long cur = date.getTime();\r
-                       \r
-                       Query query = new Query();\r
-                       //query.setRpp(1000); // TODO\r
-                       query.setQuery(text);\r
-                       QueryResult result = twitter.search(query);\r
-                       List<Tweet> tweets = result.getTweets();\r
-                       \r
-                       int count = 0;\r
-                       int hit = 0;\r
-                       int mhit = 0;\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 - 30 * 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
-                                       // \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 = "";\r
-                       if (count < 10){\r
-                               message = "\92x\89\84\82È\82µ " + date.toString();                        \r
-                       }\r
-                       else {\r
-                               int N = 100;\r
-                               \r
-                               String sample = tweets.get(mindex).getText();\r
-                               sample = CommonUtil.replaceString(sample, "@", "(a)");\r
-                               sample = StringUtil.parseSubstring(sample, N);\r
-                               message = sample + " " + date.toString() + " count=" + count;                                                   \r
-                       }\r
-                       Status status = twitter.updateStatus(message);\r
-               } catch (TwitterException e) {\r
-                       // TODO Auto-generated catch block\r
-                       e.printStackTrace();\r
-                       log.severe(e.toString());\r
-               }\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
@@ -20,8 +20,10 @@ import twitter4j.auth.AccessToken;
 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
@@ -31,7 +33,8 @@ public class TwitterUtil {
        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
-\r
+       private int period = 0;\r
+       \r
        public static TwitterUtil getInstance() {\r
                if (instance == null) {\r
                        synchronized (obj) {\r
@@ -70,7 +73,14 @@ public class TwitterUtil {
                Query query = new Query();\r
                //query.setRpp(1000); // TODO\r
                query.setQuery(train.getSearchWord());\r
-               QueryResult result = twitter.search(query);\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
@@ -92,7 +102,7 @@ public class TwitterUtil {
                        \r
                        String message = tweet.getText();\r
                        \r
-                       if (t < cur - 30 * 60 * 1000){\r
+                       if (t < cur - 5 * 60 * 1000){\r
                                System.out.println("\81~" + tweet.getFromUser() + " - "\r
                                                + tweet.getText() + at);\r
                                continue;\r
@@ -127,7 +137,15 @@ public class TwitterUtil {
                        message += df.format(date) + " " + sample + " count=" + count;                                                  \r
                }\r
                System.out.println(message); //TODO\r
-               Status status = twitter.updateStatus(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
@@ -168,4 +186,12 @@ public class TwitterUtil {
                }\r
                return count;\r
        }\r
+       \r
+       public int getPeriod(){\r
+               if (period <= 0){\r
+                       dao = KeyValueDao.getInstance();\r
+                       period = dao.getInt(KeyValueDao.KEY_SEARCH_PERIOD);\r
+               }\r
+               return period;\r
+       }\r
 }\r
diff --git a/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/52/303e531b3c7200111835fa7adce7cfd2 b/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/52/303e531b3c7200111835fa7adce7cfd2
new file mode 100644 (file)
index 0000000..daf9705
--- /dev/null
@@ -0,0 +1,240 @@
+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
diff --git a/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/52/f064530c166b001115b7b82f2f4ce01a b/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/52/f064530c166b001115b7b82f2f4ce01a
deleted file mode 100644 (file)
index f8278d4..0000000
+++ /dev/null
@@ -1,144 +0,0 @@
-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.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.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
-\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
-\r
-       }\r
-\r
-       public void main(String consumerKey, String consumerSecret, AccessToken accessToken) {\r
-\r
-               String text = "\8b\9e\95l\93\8c\96k";\r
-\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
-                       Calendar cal = Calendar.getInstance();\r
-                       Date date = cal.getTime();\r
-                       long cur = date.getTime();\r
-                       \r
-                       Query query = new Query();\r
-                       //query.setRpp(1000); // TODO\r
-                       query.setQuery(text);\r
-                       QueryResult result = twitter.search(query);\r
-                       List<Tweet> tweets = result.getTweets();\r
-                       \r
-                       int count = 0;\r
-                       int hit = 0;\r
-                       int mhit = 0;\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 - 30 * 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
-                                       // \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 = "";\r
-                       if (count < 5){\r
-                               message = "\92x\89\84\82È\82µ " + df.format(date);        \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 = sample + " " + df.format(date) + " count=" + count;                                                   \r
-                       }\r
-                       System.out.println(message);//TODO\r
-                       Status status = twitter.updateStatus(message);\r
-               } catch (TwitterException e) {\r
-                       // TODO Auto-generated catch block\r
-                       e.printStackTrace();\r
-                       log.severe(e.toString());\r
-               }\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
diff --git a/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/54/8010a1162b7200111835fa7adce7cfd2 b/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/54/8010a1162b7200111835fa7adce7cfd2
new file mode 100644 (file)
index 0000000..79710d0
--- /dev/null
@@ -0,0 +1,202 @@
+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
diff --git a/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/54/f0875033106b001115b7b82f2f4ce01a b/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/54/f0875033106b001115b7b82f2f4ce01a
deleted file mode 100644 (file)
index 05cada5..0000000
+++ /dev/null
@@ -1,46 +0,0 @@
-package com.yuji.tdb.main;\r
-\r
-import twitter4j.Status;\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.utility.StringUtility;\r
-\r
-public class Main {\r
-\r
-       public static void main(String[] args) {\r
-               test1();\r
-       }\r
-       \r
-       public static void test1(){\r
-               String text = "\82 \82¢ bb cc";\r
-               int length = 4;\r
-               String ret = StringUtility.parseSubstring(text, length);\r
-               System.out.println(ret);\r
-       }\r
-\r
-       public static void main() {\r
-               String consumerKey = "";\r
-               String consumerSecret = "";\r
-               String tokenKey = "";\r
-               String tokenSecret = "";\r
-\r
-               try {\r
-                       ConfigurationBuilder confBuilder = new ConfigurationBuilder();\r
-                       confBuilder.setDebugEnabled(true).setOAuthConsumerKey(consumerKey)\r
-                                       .setOAuthConsumerSecret(consumerSecret);\r
-                       TwitterFactory factory = new TwitterFactory(confBuilder.build());\r
-\r
-                       AccessToken accessToken = new AccessToken(tokenKey, tokenSecret);\r
-                       Twitter twitter = factory.getInstance(accessToken);\r
-\r
-                       Status status = twitter.updateStatus("\83e\83X\83g");\r
-               } catch (TwitterException e) {\r
-                       // TODO Auto-generated catch block\r
-                       e.printStackTrace();\r
-               }\r
-       }\r
-}\r
diff --git a/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/55/b03bbfdfcc6a0011194396142d5d2649 b/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/55/b03bbfdfcc6a0011194396142d5d2649
deleted file mode 100644 (file)
index ee756ee..0000000
+++ /dev/null
@@ -1,46 +0,0 @@
-package com.yuji.tdb.main;\r
-\r
-import com.yuji.tdb.utility.StringUtil;\r
-\r
-import twitter4j.Status;\r
-import twitter4j.Twitter;\r
-import twitter4j.TwitterException;\r
-import twitter4j.TwitterFactory;\r
-import twitter4j.auth.AccessToken;\r
-import twitter4j.conf.ConfigurationBuilder;\r
-\r
-public class Main {\r
-\r
-       public static void main(String[] args) {\r
-               test1();\r
-       }\r
-       \r
-       public static void test1(){\r
-               String text = "\82 \82¢ab";\r
-               int length = 3;\r
-               String ret = StringUtil.parseSubstring(text, length);\r
-               System.out.println(ret);\r
-       }\r
-\r
-       public static void main() {\r
-               String consumerKey = "";\r
-               String consumerSecret = "";\r
-               String tokenKey = "";\r
-               String tokenSecret = "";\r
-\r
-               try {\r
-                       ConfigurationBuilder confBuilder = new ConfigurationBuilder();\r
-                       confBuilder.setDebugEnabled(true).setOAuthConsumerKey(consumerKey)\r
-                                       .setOAuthConsumerSecret(consumerSecret);\r
-                       TwitterFactory factory = new TwitterFactory(confBuilder.build());\r
-\r
-                       AccessToken accessToken = new AccessToken(tokenKey, tokenSecret);\r
-                       Twitter twitter = factory.getInstance(accessToken);\r
-\r
-                       Status status = twitter.updateStatus("\83e\83X\83g");\r
-               } catch (TwitterException e) {\r
-                       // TODO Auto-generated catch block\r
-                       e.printStackTrace();\r
-               }\r
-       }\r
-}\r
diff --git a/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/55/e095f40a357200111835fa7adce7cfd2 b/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/55/e095f40a357200111835fa7adce7cfd2
new file mode 100644 (file)
index 0000000..7d89e4c
--- /dev/null
@@ -0,0 +1,75 @@
+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
diff --git a/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/56/50c41d65ea6d001110a188bae663c898 b/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/56/50c41d65ea6d001110a188bae663c898
deleted file mode 100644 (file)
index a37830c..0000000
+++ /dev/null
@@ -1,170 +0,0 @@
-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.Train;\r
-import com.yuji.tdb.db.TrainDao;\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
-\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 = twitter.search(query);\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
-               \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 - 30 * 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 += "\92x\89\84\82È\82µ " + df.format(date);       \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 += sample + " " + df.format(date) + " count=" + count;                                                  \r
-               }\r
-               System.out.println(message); //TODO\r
-               Status status = twitter.updateStatus(message); //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
-       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
diff --git a/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/56/a0a02626106b001115b7b82f2f4ce01a b/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/56/a0a02626106b001115b7b82f2f4ce01a
deleted file mode 100644 (file)
index 0c486e8..0000000
+++ /dev/null
@@ -1,46 +0,0 @@
-package com.yuji.tdb.main;\r
-\r
-import twitter4j.Status;\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.utility.StringUtility;\r
-\r
-public class Main {\r
-\r
-       public static void main(String[] args) {\r
-               test1();\r
-       }\r
-       \r
-       public static void test1(){\r
-               String text = "aa bb cc";\r
-               int length = 5;\r
-               String ret = StringUtility.parseSubstring(text, length);\r
-               System.out.println(ret);\r
-       }\r
-\r
-       public static void main() {\r
-               String consumerKey = "";\r
-               String consumerSecret = "";\r
-               String tokenKey = "";\r
-               String tokenSecret = "";\r
-\r
-               try {\r
-                       ConfigurationBuilder confBuilder = new ConfigurationBuilder();\r
-                       confBuilder.setDebugEnabled(true).setOAuthConsumerKey(consumerKey)\r
-                                       .setOAuthConsumerSecret(consumerSecret);\r
-                       TwitterFactory factory = new TwitterFactory(confBuilder.build());\r
-\r
-                       AccessToken accessToken = new AccessToken(tokenKey, tokenSecret);\r
-                       Twitter twitter = factory.getInstance(accessToken);\r
-\r
-                       Status status = twitter.updateStatus("\83e\83X\83g");\r
-               } catch (TwitterException e) {\r
-                       // TODO Auto-generated catch block\r
-                       e.printStackTrace();\r
-               }\r
-       }\r
-}\r
diff --git a/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/57/3054f86e487000111324ab4fa5fd1a16 b/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/57/3054f86e487000111324ab4fa5fd1a16
new file mode 100644 (file)
index 0000000..b67e116
--- /dev/null
@@ -0,0 +1,9 @@
+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();
+       }
+}
diff --git a/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/57/605e696fca6a0011194396142d5d2649 b/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/57/605e696fca6a0011194396142d5d2649
deleted file mode 100644 (file)
index 7d98054..0000000
+++ /dev/null
@@ -1,45 +0,0 @@
-package com.yuji.tdb.main;\r
-\r
-import com.yuji.tdb.utility.StringUtil;\r
-\r
-import twitter4j.Status;\r
-import twitter4j.Twitter;\r
-import twitter4j.TwitterException;\r
-import twitter4j.TwitterFactory;\r
-import twitter4j.auth.AccessToken;\r
-import twitter4j.conf.ConfigurationBuilder;\r
-\r
-public class Main {\r
-\r
-       public static void main(String[] args) {\r
-               test1();\r
-       }\r
-       \r
-       public static test1(){\r
-               String text = "ab#\82 \82¢\82¤";\r
-               int length;\r
-               StringUtil.parseSubstring(text, length);\r
-       }\r
-\r
-       public static void main() {\r
-               String consumerKey = "";\r
-               String consumerSecret = "";\r
-               String tokenKey = "";\r
-               String tokenSecret = "";\r
-\r
-               try {\r
-                       ConfigurationBuilder confBuilder = new ConfigurationBuilder();\r
-                       confBuilder.setDebugEnabled(true).setOAuthConsumerKey(consumerKey)\r
-                                       .setOAuthConsumerSecret(consumerSecret);\r
-                       TwitterFactory factory = new TwitterFactory(confBuilder.build());\r
-\r
-                       AccessToken accessToken = new AccessToken(tokenKey, tokenSecret);\r
-                       Twitter twitter = factory.getInstance(accessToken);\r
-\r
-                       Status status = twitter.updateStatus("\83e\83X\83g");\r
-               } catch (TwitterException e) {\r
-                       // TODO Auto-generated catch block\r
-                       e.printStackTrace();\r
-               }\r
-       }\r
-}\r
diff --git a/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/5b/606e02a1126b001115b7b82f2f4ce01a b/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/5b/606e02a1126b001115b7b82f2f4ce01a
deleted file mode 100644 (file)
index 3bdb5f8..0000000
+++ /dev/null
@@ -1,141 +0,0 @@
-package com.yuji.tdb.twitter;\r
-\r
-import java.util.ArrayList;\r
-import java.util.Calendar;\r
-import java.util.Date;\r
-import java.util.List;\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.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
-\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
-\r
-       }\r
-\r
-       public void main(String consumerKey, String consumerSecret, AccessToken accessToken) {\r
-\r
-               String text = "\8b\9e\95l\93\8c\96k";\r
-\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
-                       Calendar cal = Calendar.getInstance();\r
-                       Date date = cal.getTime();\r
-                       long cur = date.getTime();\r
-                       \r
-                       Query query = new Query();\r
-                       //query.setRpp(1000); // TODO\r
-                       query.setQuery(text);\r
-                       QueryResult result = twitter.search(query);\r
-                       List<Tweet> tweets = result.getTweets();\r
-                       \r
-                       int count = 0;\r
-                       int hit = 0;\r
-                       int mhit = 0;\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 - 30 * 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
-                                       // \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 = "";\r
-                       if (count < 10){\r
-                               message = "\92x\89\84\82È\82µ " + date.toString();                        \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 = sample + " " + date.toString() + " count=" + count;                                                   \r
-                       }\r
-                       System.out.println(message);//TODO\r
-                       Status status = twitter.updateStatus(message);\r
-               } catch (TwitterException e) {\r
-                       // TODO Auto-generated catch block\r
-                       e.printStackTrace();\r
-                       log.severe(e.toString());\r
-               }\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
diff --git a/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/5b/d0097442676b001115b7b82f2f4ce01a b/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/5b/d0097442676b001115b7b82f2f4ce01a
deleted file mode 100644 (file)
index 1e5163e..0000000
+++ /dev/null
@@ -1,161 +0,0 @@
-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.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.Train;\r
-import com.yuji.tdb.db.TrainDao;\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
-\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
-               //TimeZone.setDefault(TimeZone.getTimeZone("JST")); // TODO \8fê\8f\8a\r
-       }\r
-\r
-       public void main(String consumerKey, String consumerSecret, AccessToken accessToken) {\r
-\r
-               String text = "\8b\9e\95l\93\8c\96k";\r
-\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
-                       twite(text, twitter);\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(String text, Twitter twitter) throws TwitterException {\r
-               Calendar cal = Calendar.getInstance();\r
-               Date date = cal.getTime();\r
-               long cur = date.getTime();\r
-               \r
-               Query query = new Query();\r
-               //query.setRpp(1000); // TODO\r
-               query.setQuery(text);\r
-               QueryResult result = twitter.search(query);\r
-               List<Tweet> tweets = result.getTweets();\r
-               \r
-               int count = 0;\r
-               int hit = 0;\r
-               int mhit = 0;\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 - 30 * 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
-                               // \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 = "";\r
-               if (count < 5){\r
-                       message = "\92x\89\84\82È\82µ " + df.format(date);        \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 = sample + " " + df.format(date) + " count=" + count;                                                   \r
-               }\r
-               System.out.println(message); //TODO\r
-               Status status = twitter.updateStatus(message); //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();\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
diff --git a/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/5c/c064bd2b2e7200111835fa7adce7cfd2 b/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/5c/c064bd2b2e7200111835fa7adce7cfd2
new file mode 100644 (file)
index 0000000..a69ee65
--- /dev/null
@@ -0,0 +1,76 @@
+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
diff --git a/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/5d/807f3406136b001115b7b82f2f4ce01a b/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/5d/807f3406136b001115b7b82f2f4ce01a
deleted file mode 100644 (file)
index 66afd13..0000000
+++ /dev/null
@@ -1,141 +0,0 @@
-package com.yuji.tdb.twitter;\r
-\r
-import java.util.ArrayList;\r
-import java.util.Calendar;\r
-import java.util.Date;\r
-import java.util.List;\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.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
-\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
-\r
-       }\r
-\r
-       public void main(String consumerKey, String consumerSecret, AccessToken accessToken) {\r
-\r
-               String text = "\8b\9e\95l\93\8c\96k";\r
-\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
-                       Calendar cal = Calendar.getInstance();\r
-                       Date date = cal.getTime();\r
-                       long cur = date.getTime();\r
-                       \r
-                       Query query = new Query();\r
-                       //query.setRpp(1000); // TODO\r
-                       query.setQuery(text);\r
-                       QueryResult result = twitter.search(query);\r
-                       List<Tweet> tweets = result.getTweets();\r
-                       \r
-                       int count = 0;\r
-                       int hit = 0;\r
-                       int mhit = 0;\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 - 30 * 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
-                                       // \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 = "";\r
-                       if (count < 5){\r
-                               message = "\92x\89\84\82È\82µ " + DateFormat.format(date);        \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 = sample + " " + date.toString() + " count=" + count;                                                   \r
-                       }\r
-                       System.out.println(message);//TODO\r
-                       Status status = twitter.updateStatus(message);\r
-               } catch (TwitterException e) {\r
-                       // TODO Auto-generated catch block\r
-                       e.printStackTrace();\r
-                       log.severe(e.toString());\r
-               }\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
diff --git a/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/5f/80aee7f32c7200111835fa7adce7cfd2 b/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/5f/80aee7f32c7200111835fa7adce7cfd2
new file mode 100644 (file)
index 0000000..7bdb4d8
--- /dev/null
@@ -0,0 +1,230 @@
+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
diff --git a/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/61/b009eb56016600111e5bcf098ae37dc9 b/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/61/b009eb56016600111e5bcf098ae37dc9
deleted file mode 100644 (file)
index 85220c8..0000000
+++ /dev/null
@@ -1,138 +0,0 @@
-package com.yuji.tdb.twitter;\r
-\r
-import java.util.ArrayList;\r
-import java.util.Calendar;\r
-import java.util.Date;\r
-import java.util.List;\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
-\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
-\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
-\r
-       }\r
-\r
-       public void main(String consumerKey, String consumerSecret, AccessToken accessToken) {\r
-\r
-               String text = "\8b\9e\95l\93\8c\96k";\r
-\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
-                       Calendar cal = Calendar.getInstance();\r
-                       Date date = cal.getTime();\r
-                       long cur = date.getTime();\r
-                       \r
-                       Query query = new Query();\r
-                       query.setRpp(1000); // TODO\r
-                       query.setQuery(text);\r
-                       QueryResult result = twitter.search(query);\r
-                       List<Tweet> tweets = result.getTweets();\r
-                       \r
-                       int count = 0;\r
-                       int hit = 0;\r
-                       int mhit = 0;\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
-                               String message = tweet.getText();\r
-                               \r
-                               if (t < cur - 30 * 60 * 1000){\r
-                                       continue;\r
-                               }\r
-                               hit = filter(message);\r
-                               if (hit <= 0) {\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 = "";\r
-                       if (count < 10){\r
-                               message = "\92x\89\84\82È\82µ " + date.toString();                        \r
-                       }\r
-                       else {\r
-                               int N = 50;\r
-                               \r
-                               String sample = tweets.get(mindex).getText();\r
-                               if (sample.length() > N){\r
-                                       sample = sample.substring(0, N);\r
-                               }\r
-                               //sample = CommonUtil.replaceString(sample, "@", "(a)");\r
-                               message = sample + " " + date.toString() + " count=" + count;                                                   \r
-                       }\r
-                       Status status = twitter.updateStatus(message);\r
-               } catch (TwitterException e) {\r
-                       // TODO Auto-generated catch block\r
-                       e.printStackTrace();\r
-                       log.severe(e.toString());\r
-               }\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
diff --git a/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/64/202eb3df166b001115b7b82f2f4ce01a b/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/64/202eb3df166b001115b7b82f2f4ce01a
deleted file mode 100644 (file)
index 6dabcd2..0000000
+++ /dev/null
@@ -1,145 +0,0 @@
-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.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
-\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
-               //TimeZone.setDefault(TimeZone.getTimeZone("JST")); // TODO \8fê\8f\8a\r
-       }\r
-\r
-       public void main(String consumerKey, String consumerSecret, AccessToken accessToken) {\r
-\r
-               String text = "\8b\9e\95l\93\8c\96k";\r
-\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
-                       Calendar cal = Calendar.getInstance();\r
-                       Date date = cal.getTime();\r
-                       long cur = date.getTime();\r
-                       \r
-                       Query query = new Query();\r
-                       //query.setRpp(1000); // TODO\r
-                       query.setQuery(text);\r
-                       QueryResult result = twitter.search(query);\r
-                       List<Tweet> tweets = result.getTweets();\r
-                       \r
-                       int count = 0;\r
-                       int hit = 0;\r
-                       int mhit = 0;\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 - 30 * 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
-                                       // \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 = "";\r
-                       if (count < 5){\r
-                               message = "\92x\89\84\82È\82µ " + df.format(date);        \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 = sample + " " + df.format(date) + " count=" + count;                                                   \r
-                       }\r
-                       System.out.println(message);//TODO\r
-                       Status status = twitter.updateStatus(message);\r
-               } catch (TwitterException e) {\r
-                       // TODO Auto-generated catch block\r
-                       e.printStackTrace();\r
-                       log.severe(e.toString());\r
-               }\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
diff --git a/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/64/4052d11a106b001115b7b82f2f4ce01a b/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/64/4052d11a106b001115b7b82f2f4ce01a
deleted file mode 100644 (file)
index 9be18d3..0000000
+++ /dev/null
@@ -1,46 +0,0 @@
-package com.yuji.tdb.main;\r
-\r
-import twitter4j.Status;\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.utility.StringUtility;\r
-\r
-public class Main {\r
-\r
-       public static void main(String[] args) {\r
-               test1();\r
-       }\r
-       \r
-       public static void test1(){\r
-               String text = "aa bb cc";\r
-               int length = 4;\r
-               String ret = StringUtility.parseSubstring(text, length);\r
-               System.out.println(ret);\r
-       }\r
-\r
-       public static void main() {\r
-               String consumerKey = "";\r
-               String consumerSecret = "";\r
-               String tokenKey = "";\r
-               String tokenSecret = "";\r
-\r
-               try {\r
-                       ConfigurationBuilder confBuilder = new ConfigurationBuilder();\r
-                       confBuilder.setDebugEnabled(true).setOAuthConsumerKey(consumerKey)\r
-                                       .setOAuthConsumerSecret(consumerSecret);\r
-                       TwitterFactory factory = new TwitterFactory(confBuilder.build());\r
-\r
-                       AccessToken accessToken = new AccessToken(tokenKey, tokenSecret);\r
-                       Twitter twitter = factory.getInstance(accessToken);\r
-\r
-                       Status status = twitter.updateStatus("\83e\83X\83g");\r
-               } catch (TwitterException e) {\r
-                       // TODO Auto-generated catch block\r
-                       e.printStackTrace();\r
-               }\r
-       }\r
-}\r
diff --git a/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/64/40939ee9c96a0011194396142d5d2649 b/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/64/40939ee9c96a0011194396142d5d2649
deleted file mode 100644 (file)
index 0faf7e5..0000000
+++ /dev/null
@@ -1,39 +0,0 @@
-package com.yuji.tdb.utility;
-
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-public class StringUtil {
-       private static Pattern ptnAlnum = Pattern.compile("[a-zA-Z0-9]");
-       private static Pattern ptnAscii = Pattern.compile("\\p{ASCII}");
-       
-       public static String parseSubstring(String text, int length){
-               int len = text.length();
-               int status = -1;
-               int pos = 0;
-               
-               for (int i = 0; i < len && i < length; i++){
-                       String ch = text.substring(i, i + 1);
-                       
-                       if (ptnAlnum.matcher(ch).matches()){
-                               if (status != 0){
-                                       pos = i;
-                                       status = 0;
-                               }
-                       }
-                       else if (ptnAscii.matcher(ch).matches()){
-                               if (status != 1){
-                                       pos = i;
-                                       status = 1;
-                               }                               
-                       }
-                       else {
-                               if (status != 2){
-                                       pos = i;
-                                       status = 2;
-                               }                                                               
-                       }
-               }
-               return text.substring(0, pos);
-       }
-}
diff --git a/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/67/005e3fd72b7200111835fa7adce7cfd2 b/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/67/005e3fd72b7200111835fa7adce7cfd2
new file mode 100644 (file)
index 0000000..943c4db
--- /dev/null
@@ -0,0 +1,214 @@
+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
diff --git a/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/67/502681e5ca6a0011194396142d5d2649 b/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/67/502681e5ca6a0011194396142d5d2649
deleted file mode 100644 (file)
index 66c9de2..0000000
+++ /dev/null
@@ -1,46 +0,0 @@
-package com.yuji.tdb.main;\r
-\r
-import com.yuji.tdb.utility.StringUtil;\r
-\r
-import twitter4j.Status;\r
-import twitter4j.Twitter;\r
-import twitter4j.TwitterException;\r
-import twitter4j.TwitterFactory;\r
-import twitter4j.auth.AccessToken;\r
-import twitter4j.conf.ConfigurationBuilder;\r
-\r
-public class Main {\r
-\r
-       public static void main(String[] args) {\r
-               test1();\r
-       }\r
-       \r
-       public static void test1(){\r
-               String text = "abc#\82 \82¢\82¤";\r
-               int length = 3;\r
-               String ret = StringUtil.parseSubstring(text, length);\r
-               System.out.println(ret);\r
-       }\r
-\r
-       public static void main() {\r
-               String consumerKey = "";\r
-               String consumerSecret = "";\r
-               String tokenKey = "";\r
-               String tokenSecret = "";\r
-\r
-               try {\r
-                       ConfigurationBuilder confBuilder = new ConfigurationBuilder();\r
-                       confBuilder.setDebugEnabled(true).setOAuthConsumerKey(consumerKey)\r
-                                       .setOAuthConsumerSecret(consumerSecret);\r
-                       TwitterFactory factory = new TwitterFactory(confBuilder.build());\r
-\r
-                       AccessToken accessToken = new AccessToken(tokenKey, tokenSecret);\r
-                       Twitter twitter = factory.getInstance(accessToken);\r
-\r
-                       Status status = twitter.updateStatus("\83e\83X\83g");\r
-               } catch (TwitterException e) {\r
-                       // TODO Auto-generated catch block\r
-                       e.printStackTrace();\r
-               }\r
-       }\r
-}\r
diff --git a/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/67/70b740f9f06500111e5bcf098ae37dc9 b/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/67/70b740f9f06500111e5bcf098ae37dc9
deleted file mode 100644 (file)
index 9c7e190..0000000
+++ /dev/null
@@ -1,154 +0,0 @@
-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("001");\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("003");\r
-                                       return;\r
-                               }\r
-                               RequestToken requestToken = new RequestToken(requestTokenKey,\r
-                                               requestTokenSecret);\r
-                               resultOAuthAuthorization(consumerKey, consumerSecret,\r
-                                               requestToken);\r
-                               return;\r
-                       }\r
-\r
-                       if (accessToken == null) {\r
-                               log.warning("003");\r
-                               return;\r
-                       }\r
-\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 = twitter.getOAuthAccessToken(requestToken);\r
-               } catch (TwitterException e) {\r
-                       // TODO Auto-generated catch block\r
-                       e.printStackTrace();\r
-                       log.severe(e.toString());\r
-               }\r
-       }\r
-}\r
diff --git a/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/67/906a95c8ef6500111e5bcf098ae37dc9 b/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/67/906a95c8ef6500111e5bcf098ae37dc9
deleted file mode 100644 (file)
index 180d232..0000000
+++ /dev/null
@@ -1,142 +0,0 @@
-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("001");\r
-                               return;\r
-                       }\r
-\r
-                       if (!CommonUtil.isNull(parmResult)) {\r
-                               if (requestToken == null){\r
-                                       log.warning("003");\r
-                                       return;                                 \r
-                               }\r
-                               resultOAuthAuthorization(consumerKey, consumerSecret);\r
-                               return;\r
-                       }\r
-\r
-                       if (accessToken == null) {\r
-                               log.warning("003");\r
-                               return;\r
-                       }\r
-\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 = 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
-                       \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, String consumerSecret) {\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 = twitter.getOAuthAccessToken(requestToken);\r
-               } catch (TwitterException e) {\r
-                       // TODO Auto-generated catch block\r
-                       e.printStackTrace();\r
-                       log.severe(e.toString());\r
-               }\r
-       }\r
-}\r
diff --git a/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/69/207abf4d2b7200111835fa7adce7cfd2 b/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/69/207abf4d2b7200111835fa7adce7cfd2
new file mode 100644 (file)
index 0000000..da91f3e
--- /dev/null
@@ -0,0 +1,205 @@
+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
diff --git a/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/6b/30f9b77ace6a0011194396142d5d2649 b/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/6b/30f9b77ace6a0011194396142d5d2649
deleted file mode 100644 (file)
index e190a00..0000000
+++ /dev/null
@@ -1,46 +0,0 @@
-package com.yuji.tdb.main;\r
-\r
-import com.yuji.tdb.utility.StringUtility;\r
-\r
-import twitter4j.Status;\r
-import twitter4j.Twitter;\r
-import twitter4j.TwitterException;\r
-import twitter4j.TwitterFactory;\r
-import twitter4j.auth.AccessToken;\r
-import twitter4j.conf.ConfigurationBuilder;\r
-\r
-public class Main {\r
-\r
-       public static void main(String[] args) {\r
-               test1();\r
-       }\r
-       \r
-       public static void test1(){\r
-               String text = "\82 \82¢\82¤\82¦\82¨";\r
-               int length = 3;\r
-               String ret = StringUtility.parseSubstring(text, length);\r
-               System.out.println(ret);\r
-       }\r
-\r
-       public static void main() {\r
-               String consumerKey = "";\r
-               String consumerSecret = "";\r
-               String tokenKey = "";\r
-               String tokenSecret = "";\r
-\r
-               try {\r
-                       ConfigurationBuilder confBuilder = new ConfigurationBuilder();\r
-                       confBuilder.setDebugEnabled(true).setOAuthConsumerKey(consumerKey)\r
-                                       .setOAuthConsumerSecret(consumerSecret);\r
-                       TwitterFactory factory = new TwitterFactory(confBuilder.build());\r
-\r
-                       AccessToken accessToken = new AccessToken(tokenKey, tokenSecret);\r
-                       Twitter twitter = factory.getInstance(accessToken);\r
-\r
-                       Status status = twitter.updateStatus("\83e\83X\83g");\r
-               } catch (TwitterException e) {\r
-                       // TODO Auto-generated catch block\r
-                       e.printStackTrace();\r
-               }\r
-       }\r
-}\r
diff --git a/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/6b/d092c4c42c7200111835fa7adce7cfd2 b/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/6b/d092c4c42c7200111835fa7adce7cfd2
new file mode 100644 (file)
index 0000000..75de29c
--- /dev/null
@@ -0,0 +1,233 @@
+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
diff --git a/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/6e/d081bb24666b001115b7b82f2f4ce01a b/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/6e/d081bb24666b001115b7b82f2f4ce01a
deleted file mode 100644 (file)
index 0054a60..0000000
+++ /dev/null
@@ -1,36 +0,0 @@
-package com.yuji.tdb.db;\r
-\r
-import javax.jdo.PersistenceManager;\r
-\r
-public class TrainDao {\r
-       private static TrainDao instance = null;\r
-       private PersistenceManager pm = PMFactory.get().getPersistenceManager();\r
-               \r
-       public static TrainDao getInstance(){\r
-               if (instance == null){\r
-                       instance = new TrainDao();\r
-               }\r
-               return instance;\r
-       }\r
-       \r
-       private TrainDao(){\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 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
diff --git a/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/73/204c5c5a666b001115b7b82f2f4ce01a b/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/73/204c5c5a666b001115b7b82f2f4ce01a
deleted file mode 100644 (file)
index 2a25b1a..0000000
+++ /dev/null
@@ -1,39 +0,0 @@
-package com.yuji.tdb.db;\r
-\r
-import java.util.List;\r
-\r
-import javax.jdo.PersistenceManager;\r
-\r
-public class TrainDao {\r
-       private static TrainDao instance = null;\r
-       private PersistenceManager pm = PMFactory.get().getPersistenceManager();\r
-\r
-       public static TrainDao getInstance() {\r
-               if (instance == null) {\r
-                       instance = new TrainDao();\r
-               }\r
-               return instance;\r
-       }\r
-\r
-       private TrainDao() {\r
-\r
-       }\r
-\r
-       public String get(String key) {\r
-               String query = "SELECT FROM " + Train.class.getName();\r
-               List<Train> list = (List<Train>) pm.newQuery(query).execute();\r
-\r
-               for (Train train : list) {\r
-               }\r
-               pm.close();\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
diff --git a/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/75/101ae08c2c7200111835fa7adce7cfd2 b/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/75/101ae08c2c7200111835fa7adce7cfd2
new file mode 100644 (file)
index 0000000..7bbde9c
--- /dev/null
@@ -0,0 +1,229 @@
+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
diff --git a/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/75/80253805106b001115b7b82f2f4ce01a b/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/75/80253805106b001115b7b82f2f4ce01a
deleted file mode 100644 (file)
index 1d27c92..0000000
+++ /dev/null
@@ -1,48 +0,0 @@
-package com.yuji.tdb.utility;
-
-import java.util.regex.Pattern;
-
-public class StringUtility {
-       private static Pattern ptnAlnum = Pattern.compile("[a-zA-Z0-9]");
-       private static Pattern ptnSpace = Pattern.compile("\\s");
-       private static Pattern ptnAscii = Pattern.compile("\\p{ASCII}");
-       
-       public static String parseSubstring(String text, int length){
-               int len = text.length();
-               int status = -1;
-               int pos = 0;
-               
-               for (int i = 0; i < len + 1 && i < length + 1; i++){
-                       if (i >= len){
-                               pos = i;
-                               break;
-                       }
-                       String ch = text.substring(i, i + 1);
-                       
-                       if (ptnAlnum.matcher(ch).matches()){
-                               if (status != 0){
-                                       pos = i;
-                                       status = 0;
-                               }
-                       }
-                       else if (ptnSpace.matcher(ch).matches()){
-                               pos = i;
-                               status = 1;
-                       }
-                       else if (ptnAscii.matcher(ch).matches()){
-                               if (status != 2){
-                                       pos = i;
-                                       status = 2;
-                               }                               
-                       }
-                       else {
-                               pos = i;
-                               status = 3;
-                       }
-               }
-               if (pos == 0){
-                       return text.substring(0, (len < length)? len : length);                 
-               }
-               return text.substring(0, pos);
-       }
-}
diff --git a/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/76/10fec63be96d001110a188bae663c898 b/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/76/10fec63be96d001110a188bae663c898
deleted file mode 100644 (file)
index 9ea526e..0000000
+++ /dev/null
@@ -1,169 +0,0 @@
-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.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.Train;\r
-import com.yuji.tdb.db.TrainDao;\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
-\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
-               //TimeZone.setDefault(TimeZone.getTimeZone("JST")); // TODO \8fê\8f\8a\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
-               Calendar cal = Calendar.getInstance();\r
-               Date date = cal.getTime();\r
-               long cur = date.getTime();\r
-               \r
-               Query query = new Query();\r
-               //query.setRpp(1000); // TODO\r
-               query.setQuery(train.getSearchWord());\r
-               QueryResult result = twitter.search(query);\r
-               List<Tweet> tweets = result.getTweets();\r
-               \r
-               int count = 0;\r
-               int hit = 0;\r
-               int mhit = 0;\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 - 30 * 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 += "\92x\89\84\82È\82µ " + df.format(date);       \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 += sample + " " + df.format(date) + " count=" + count;                                                  \r
-               }\r
-               System.out.println(message); //TODO\r
-               Status status = twitter.updateStatus(message); //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
-       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
diff --git a/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/78/a01f6262307200111835fa7adce7cfd2 b/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/78/a01f6262307200111835fa7adce7cfd2
new file mode 100644 (file)
index 0000000..cf78752
--- /dev/null
@@ -0,0 +1,238 @@
+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
diff --git a/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/78/c08392a82b7200111835fa7adce7cfd2 b/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/78/c08392a82b7200111835fa7adce7cfd2
new file mode 100644 (file)
index 0000000..bc9eae0
--- /dev/null
@@ -0,0 +1,210 @@
+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
diff --git a/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/7c/005c8003136b001115b7b82f2f4ce01a b/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/7c/005c8003136b001115b7b82f2f4ce01a
deleted file mode 100644 (file)
index 8e7aa99..0000000
+++ /dev/null
@@ -1,141 +0,0 @@
-package com.yuji.tdb.twitter;\r
-\r
-import java.util.ArrayList;\r
-import java.util.Calendar;\r
-import java.util.Date;\r
-import java.util.List;\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.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
-\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
-\r
-       }\r
-\r
-       public void main(String consumerKey, String consumerSecret, AccessToken accessToken) {\r
-\r
-               String text = "\8b\9e\95l\93\8c\96k";\r
-\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
-                       Calendar cal = Calendar.getInstance();\r
-                       Date date = cal.getTime();\r
-                       long cur = date.getTime();\r
-                       \r
-                       Query query = new Query();\r
-                       //query.setRpp(1000); // TODO\r
-                       query.setQuery(text);\r
-                       QueryResult result = twitter.search(query);\r
-                       List<Tweet> tweets = result.getTweets();\r
-                       \r
-                       int count = 0;\r
-                       int hit = 0;\r
-                       int mhit = 0;\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 - 30 * 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
-                                       // \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 = "";\r
-                       if (count < 5){\r
-                               message = "\92x\89\84\82È\82µ " + date.toString();                        \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 = sample + " " + date.toString() + " count=" + count;                                                   \r
-                       }\r
-                       System.out.println(message);//TODO\r
-                       Status status = twitter.updateStatus(message);\r
-               } catch (TwitterException e) {\r
-                       // TODO Auto-generated catch block\r
-                       e.printStackTrace();\r
-                       log.severe(e.toString());\r
-               }\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
diff --git a/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/7c/b04d6b77497000111324ab4fa5fd1a16 b/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/7c/b04d6b77497000111324ab4fa5fd1a16
new file mode 100644 (file)
index 0000000..9a92e5a
--- /dev/null
@@ -0,0 +1,9 @@
+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();
+       }
+}
diff --git a/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/7e/309e4416106b001115b7b82f2f4ce01a b/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/7e/309e4416106b001115b7b82f2f4ce01a
deleted file mode 100644 (file)
index ff3804d..0000000
+++ /dev/null
@@ -1,46 +0,0 @@
-package com.yuji.tdb.main;\r
-\r
-import twitter4j.Status;\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.utility.StringUtility;\r
-\r
-public class Main {\r
-\r
-       public static void main(String[] args) {\r
-               test1();\r
-       }\r
-       \r
-       public static void test1(){\r
-               String text = "aa bb cc";\r
-               int length = 3;\r
-               String ret = StringUtility.parseSubstring(text, length);\r
-               System.out.println(ret);\r
-       }\r
-\r
-       public static void main() {\r
-               String consumerKey = "";\r
-               String consumerSecret = "";\r
-               String tokenKey = "";\r
-               String tokenSecret = "";\r
-\r
-               try {\r
-                       ConfigurationBuilder confBuilder = new ConfigurationBuilder();\r
-                       confBuilder.setDebugEnabled(true).setOAuthConsumerKey(consumerKey)\r
-                                       .setOAuthConsumerSecret(consumerSecret);\r
-                       TwitterFactory factory = new TwitterFactory(confBuilder.build());\r
-\r
-                       AccessToken accessToken = new AccessToken(tokenKey, tokenSecret);\r
-                       Twitter twitter = factory.getInstance(accessToken);\r
-\r
-                       Status status = twitter.updateStatus("\83e\83X\83g");\r
-               } catch (TwitterException e) {\r
-                       // TODO Auto-generated catch block\r
-                       e.printStackTrace();\r
-               }\r
-       }\r
-}\r
diff --git a/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/80/005b38a12f7200111835fa7adce7cfd2 b/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/80/005b38a12f7200111835fa7adce7cfd2
new file mode 100644 (file)
index 0000000..e9d4a1c
--- /dev/null
@@ -0,0 +1,238 @@
+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
diff --git a/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/80/f0c02909357200111835fa7adce7cfd2 b/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/80/f0c02909357200111835fa7adce7cfd2
new file mode 100644 (file)
index 0000000..be96836
--- /dev/null
@@ -0,0 +1,75 @@
+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
diff --git a/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/81/00122453646b001115b7b82f2f4ce01a b/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/81/00122453646b001115b7b82f2f4ce01a
deleted file mode 100644 (file)
index e69de29..0000000
diff --git a/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/84/40de9e1bca6a0011194396142d5d2649 b/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/84/40de9e1bca6a0011194396142d5d2649
deleted file mode 100644 (file)
index 21fe48c..0000000
+++ /dev/null
@@ -1,36 +0,0 @@
-package com.yuji.tdb.main;\r
-\r
-import twitter4j.Status;\r
-import twitter4j.Twitter;\r
-import twitter4j.TwitterException;\r
-import twitter4j.TwitterFactory;\r
-import twitter4j.auth.AccessToken;\r
-import twitter4j.conf.ConfigurationBuilder;\r
-\r
-public class Main {\r
-\r
-       /**\r
-        * @param args\r
-        */\r
-       public static void main(String[] args) {\r
-               String consumerKey = "";\r
-               String consumerSecret = "";\r
-               String tokenKey = "";\r
-               String tokenSecret = "";\r
-\r
-               try {\r
-                       ConfigurationBuilder confBuilder = new ConfigurationBuilder();\r
-                       confBuilder.setDebugEnabled(true).setOAuthConsumerKey(consumerKey)\r
-                                       .setOAuthConsumerSecret(consumerSecret);\r
-                       TwitterFactory factory = new TwitterFactory(confBuilder.build());\r
-\r
-                       AccessToken accessToken = new AccessToken(tokenKey, tokenSecret);\r
-                       Twitter twitter = factory.getInstance(accessToken);\r
-\r
-                       Status status = twitter.updateStatus("\83e\83X\83g");\r
-               } catch (TwitterException e) {\r
-                       // TODO Auto-generated catch block\r
-                       e.printStackTrace();\r
-               }\r
-       }\r
-}\r
diff --git a/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/86/105854fa2a7200111835fa7adce7cfd2 b/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/86/105854fa2a7200111835fa7adce7cfd2
new file mode 100644 (file)
index 0000000..1c47394
--- /dev/null
@@ -0,0 +1,202 @@
+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
diff --git a/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/87/207ae93a2d7200111835fa7adce7cfd2 b/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/87/207ae93a2d7200111835fa7adce7cfd2
new file mode 100644 (file)
index 0000000..c3f7f9b
--- /dev/null
@@ -0,0 +1,237 @@
+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
diff --git a/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/87/30ef33d6fb6500111e5bcf098ae37dc9 b/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/87/30ef33d6fb6500111e5bcf098ae37dc9
deleted file mode 100644 (file)
index 573c01e..0000000
+++ /dev/null
@@ -1,136 +0,0 @@
-package com.yuji.tdb.twitter;\r
-\r
-import java.util.ArrayList;\r
-import java.util.Calendar;\r
-import java.util.Date;\r
-import java.util.List;\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
-\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
-\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
-\r
-       }\r
-\r
-       public void main(String consumerKey, String consumerSecret, AccessToken accessToken) {\r
-\r
-               String text = "\8b\9e\95l\93\8c\96k";\r
-\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
-                       Calendar cal = Calendar.getInstance();\r
-                       Date date = cal.getTime();\r
-                       long cur = date.getTime();\r
-                       \r
-                       Query query = new Query();\r
-                       query.setRpp(1000); // TODO\r
-                       query.setQuery(text);\r
-                       QueryResult result = twitter.search(query);\r
-                       List<Tweet> tweets = result.getTweets();\r
-                       \r
-                       int count = 0;\r
-                       int hit = 0;\r
-                       int mhit = 0;\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
-                               String message = tweet.getText();\r
-                               \r
-                               if (t < cur - 30 * 60 * 1000){\r
-                                       continue;\r
-                               }\r
-                               hit = filter(message);\r
-                               if (hit <= 0) {\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 = "";\r
-                       if (count < 10){\r
-                               message = "\92x\89\84\82È\82µ " + date.toString();                        \r
-                       }\r
-                       else {\r
-                               int N = 50;\r
-                               \r
-                               String sample = tweets.get(mindex).getText();\r
-                               if (sample.length() > N){\r
-                                       sample = sample.substring(0, N);\r
-                               }\r
-                               sample = CommonUtil.replaceString(sample, "@", "(a)");\r
-                               message = sample + " " + date.toString() + " count=" + count;                                                   \r
-                       }\r
-                       Status status = twitter.updateStatus(message);\r
-               } catch (TwitterException e) {\r
-                       // TODO Auto-generated catch block\r
-                       e.printStackTrace();\r
-                       log.severe(e.toString());\r
-               }\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("\92â\8e~");\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
diff --git a/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/87/50202ce0666b001115b7b82f2f4ce01a b/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/87/50202ce0666b001115b7b82f2f4ce01a
deleted file mode 100644 (file)
index 4dfa2f3..0000000
+++ /dev/null
@@ -1,155 +0,0 @@
-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.TrainDao;\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
-\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
-               //TimeZone.setDefault(TimeZone.getTimeZone("JST")); // TODO \8fê\8f\8a\r
-       }\r
-\r
-       public void main(String consumerKey, String consumerSecret, AccessToken accessToken) {\r
-\r
-               String text = "\8b\9e\95l\93\8c\96k";\r
-\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
-                       twite(text, twitter);\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(String text, Twitter twitter) throws TwitterException {\r
-               Calendar cal = Calendar.getInstance();\r
-               Date date = cal.getTime();\r
-               long cur = date.getTime();\r
-               \r
-               Query query = new Query();\r
-               //query.setRpp(1000); // TODO\r
-               query.setQuery(text);\r
-               QueryResult result = twitter.search(query);\r
-               List<Tweet> tweets = result.getTweets();\r
-               \r
-               int count = 0;\r
-               int hit = 0;\r
-               int mhit = 0;\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 - 30 * 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
-                               // \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 = "";\r
-               if (count < 5){\r
-                       message = "\92x\89\84\82È\82µ " + df.format(date);        \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 = sample + " " + df.format(date) + " count=" + count;                                                   \r
-               }\r
-               System.out.println(message); //TODO\r
-               Status status = twitter.updateStatus(message); //TODO\r
-       }\r
-       \r
-       private List<Train> getTrainList(){\r
-               TrainDao dao = TrainDao.getInstance();\r
-               list = dao.search();\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
diff --git a/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/89/700228b4676b001115b7b82f2f4ce01a b/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/89/700228b4676b001115b7b82f2f4ce01a
deleted file mode 100644 (file)
index 08c96ed..0000000
+++ /dev/null
@@ -1,170 +0,0 @@
-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.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.Train;\r
-import com.yuji.tdb.db.TrainDao;\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
-\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
-               //TimeZone.setDefault(TimeZone.getTimeZone("JST")); // TODO \8fê\8f\8a\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
-               Calendar cal = Calendar.getInstance();\r
-               Date date = cal.getTime();\r
-               long cur = date.getTime();\r
-               \r
-               Query query = new Query();\r
-               //query.setRpp(1000); // TODO\r
-               query.setQuery(train.getSearchWord());\r
-               QueryResult result = twitter.search(query);\r
-               List<Tweet> tweets = result.getTweets();\r
-               \r
-               int count = 0;\r
-               int hit = 0;\r
-               int mhit = 0;\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 - 30 * 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
-                               // \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 = "";\r
-               if (count < train.getCount()){\r
-                       message = "\92x\89\84\82È\82µ " + df.format(date);        \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 = sample + " " + df.format(date) + " count=" + count;                                                   \r
-               }\r
-               System.out.println(message); //TODO\r
-               Status status = twitter.updateStatus(message); //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
-                       list.add(train);\r
-                       train = new Train("\93\8c\8aC\93¹\90ü", "\93\8c\8aC\93¹", 5);\r
-                       list.add(train);\r
-                       train = new Train("\8b\9e\95l\8b}\8ds\90ü", "\8b\9e\8b}", 5);\r
-                       list.add(train);\r
-                       \r
-                       for (Train t : list){\r
-                               dao.put(t);\r
-                       }\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
diff --git a/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/8a/20e5074b347200111835fa7adce7cfd2 b/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/8a/20e5074b347200111835fa7adce7cfd2
new file mode 100644 (file)
index 0000000..e7b96da
--- /dev/null
@@ -0,0 +1,241 @@
+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
diff --git a/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/8a/f0c1cafa166b001115b7b82f2f4ce01a b/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/8a/f0c1cafa166b001115b7b82f2f4ce01a
deleted file mode 100644 (file)
index b44efd0..0000000
+++ /dev/null
@@ -1,149 +0,0 @@
-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.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
-\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
-               //TimeZone.setDefault(TimeZone.getTimeZone("JST")); // TODO \8fê\8f\8a\r
-       }\r
-\r
-       public void main(String consumerKey, String consumerSecret, AccessToken accessToken) {\r
-\r
-               String text = "\8b\9e\95l\93\8c\96k";\r
-\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
-                       twite(text, twitter);\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(String text, Twitter twitter) throws TwitterException {\r
-               Calendar cal = Calendar.getInstance();\r
-               Date date = cal.getTime();\r
-               long cur = date.getTime();\r
-               \r
-               Query query = new Query();\r
-               //query.setRpp(1000); // TODO\r
-               query.setQuery(text);\r
-               QueryResult result = twitter.search(query);\r
-               List<Tweet> tweets = result.getTweets();\r
-               \r
-               int count = 0;\r
-               int hit = 0;\r
-               int mhit = 0;\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 - 30 * 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
-                               // \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 = "";\r
-               if (count < 5){\r
-                       message = "\92x\89\84\82È\82µ " + df.format(date);        \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 = sample + " " + df.format(date) + " count=" + count;                                                   \r
-               }\r
-               System.out.println(message);//TODO\r
-               Status status = twitter.updateStatus(message);\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
diff --git a/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/8d/40149274317200111835fa7adce7cfd2 b/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/8d/40149274317200111835fa7adce7cfd2
new file mode 100644 (file)
index 0000000..fb9691e
--- /dev/null
@@ -0,0 +1,239 @@
+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
diff --git a/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/8e/c05cd6941d7200111835fa7adce7cfd2 b/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/8e/c05cd6941d7200111835fa7adce7cfd2
new file mode 100644 (file)
index 0000000..c9c8652
--- /dev/null
@@ -0,0 +1,202 @@
+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
diff --git a/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/8f/10bbfe571f7200111835fa7adce7cfd2 b/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/8f/10bbfe571f7200111835fa7adce7cfd2
new file mode 100644 (file)
index 0000000..2ccc18a
--- /dev/null
@@ -0,0 +1,68 @@
+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
diff --git a/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/8f/10f7c380ca6a0011194396142d5d2649 b/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/8f/10f7c380ca6a0011194396142d5d2649
deleted file mode 100644 (file)
index 56ebbcd..0000000
+++ /dev/null
@@ -1,45 +0,0 @@
-package com.yuji.tdb.main;\r
-\r
-import com.yuji.tdb.utility.StringUtil;\r
-\r
-import twitter4j.Status;\r
-import twitter4j.Twitter;\r
-import twitter4j.TwitterException;\r
-import twitter4j.TwitterFactory;\r
-import twitter4j.auth.AccessToken;\r
-import twitter4j.conf.ConfigurationBuilder;\r
-\r
-public class Main {\r
-\r
-       public static void main(String[] args) {\r
-               test1();\r
-       }\r
-       \r
-       public static test1(){\r
-               String text = "ab#\82 \82¢\82¤";\r
-               int length = 3;\r
-               StringUtil.parseSubstring(text, length);\r
-       }\r
-\r
-       public static void main() {\r
-               String consumerKey = "";\r
-               String consumerSecret = "";\r
-               String tokenKey = "";\r
-               String tokenSecret = "";\r
-\r
-               try {\r
-                       ConfigurationBuilder confBuilder = new ConfigurationBuilder();\r
-                       confBuilder.setDebugEnabled(true).setOAuthConsumerKey(consumerKey)\r
-                                       .setOAuthConsumerSecret(consumerSecret);\r
-                       TwitterFactory factory = new TwitterFactory(confBuilder.build());\r
-\r
-                       AccessToken accessToken = new AccessToken(tokenKey, tokenSecret);\r
-                       Twitter twitter = factory.getInstance(accessToken);\r
-\r
-                       Status status = twitter.updateStatus("\83e\83X\83g");\r
-               } catch (TwitterException e) {\r
-                       // TODO Auto-generated catch block\r
-                       e.printStackTrace();\r
-               }\r
-       }\r
-}\r
diff --git a/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/8f/4007ceb2377200111835fa7adce7cfd2 b/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/8f/4007ceb2377200111835fa7adce7cfd2
new file mode 100644 (file)
index 0000000..94d4237
--- /dev/null
@@ -0,0 +1,240 @@
+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
diff --git a/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/93/c032e2e8666b001115b7b82f2f4ce01a b/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/93/c032e2e8666b001115b7b82f2f4ce01a
deleted file mode 100644 (file)
index 01e9974..0000000
+++ /dev/null
@@ -1,159 +0,0 @@
-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.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.Train;\r
-import com.yuji.tdb.db.TrainDao;\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
-\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
-               //TimeZone.setDefault(TimeZone.getTimeZone("JST")); // TODO \8fê\8f\8a\r
-       }\r
-\r
-       public void main(String consumerKey, String consumerSecret, AccessToken accessToken) {\r
-\r
-               String text = "\8b\9e\95l\93\8c\96k";\r
-\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
-                       twite(text, twitter);\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(String text, Twitter twitter) throws TwitterException {\r
-               Calendar cal = Calendar.getInstance();\r
-               Date date = cal.getTime();\r
-               long cur = date.getTime();\r
-               \r
-               Query query = new Query();\r
-               //query.setRpp(1000); // TODO\r
-               query.setQuery(text);\r
-               QueryResult result = twitter.search(query);\r
-               List<Tweet> tweets = result.getTweets();\r
-               \r
-               int count = 0;\r
-               int hit = 0;\r
-               int mhit = 0;\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 - 30 * 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
-                               // \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 = "";\r
-               if (count < 5){\r
-                       message = "\92x\89\84\82È\82µ " + df.format(date);        \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 = sample + " " + df.format(date) + " count=" + count;                                                   \r
-               }\r
-               System.out.println(message); //TODO\r
-               Status status = twitter.updateStatus(message); //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
-                       \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
diff --git a/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/97/7061f588ee6500111e5bcf098ae37dc9 b/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/97/7061f588ee6500111e5bcf098ae37dc9
deleted file mode 100644 (file)
index d10bbc1..0000000
+++ /dev/null
@@ -1,147 +0,0 @@
-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
-                               \r
-                               dao.put("FOO", "aaa");\r
-                               \r
-                               return;\r
-                       }\r
-\r
-                       String consumerKey = dao.get(KeyValueDao.KEY_CONSUMER_KEY);\r
-                       String consumerSecret = dao.get(KeyValueDao.KEY_CONSUMER_SECRET);\r
-                       if (requestToken == null || CommonUtil.isNull(consumerKey)\r
-                                       || CommonUtil.isNull(consumerSecret)) {\r
-                               log.warning("001");\r
-                               return;\r
-                       }\r
-\r
-                       if (!CommonUtil.isNull(parmResult)) {\r
-                               resultOAuthAuthorization();\r
-                               \r
-                               String value = dao.get("FOO");\r
-                               log.warning("VALUE=" + value);\r
-                               \r
-                               return;\r
-                       }\r
-\r
-                       if (accessToken == null) {\r
-                               log.warning("002");\r
-                               return;\r
-                       }\r
-\r
-                       AccessToken a = new AccessToken(parmResult, parmResult);\r
-                       \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 = 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
-                       \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() {\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 = twitter.getOAuthAccessToken(requestToken);\r
-               } catch (TwitterException e) {\r
-                       // TODO Auto-generated catch block\r
-                       e.printStackTrace();\r
-                       log.severe(e.toString());\r
-               }\r
-       }\r
-}\r
diff --git a/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/97/d0086a6c116b001115b7b82f2f4ce01a b/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/97/d0086a6c116b001115b7b82f2f4ce01a
deleted file mode 100644 (file)
index 858c87f..0000000
+++ /dev/null
@@ -1,141 +0,0 @@
-package com.yuji.tdb.twitter;\r
-\r
-import java.util.ArrayList;\r
-import java.util.Calendar;\r
-import java.util.Date;\r
-import java.util.List;\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.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
-\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
-\r
-       }\r
-\r
-       public void main(String consumerKey, String consumerSecret, AccessToken accessToken) {\r
-\r
-               String text = "\8b\9e\95l\93\8c\96k";\r
-\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
-                       Calendar cal = Calendar.getInstance();\r
-                       Date date = cal.getTime();\r
-                       long cur = date.getTime();\r
-                       \r
-                       Query query = new Query();\r
-                       //query.setRpp(1000); // TODO\r
-                       query.setQuery(text);\r
-                       QueryResult result = twitter.search(query);\r
-                       List<Tweet> tweets = result.getTweets();\r
-                       \r
-                       int count = 0;\r
-                       int hit = 0;\r
-                       int mhit = 0;\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 - 30 * 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
-                                       // \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 = "";\r
-                       if (count < 10){\r
-                               message = "\92x\89\84\82È\82µ " + date.toString();                        \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 = sample + " " + date.toString() + " count=" + count;                                                   \r
-                       }\r
-                       System.out.println(message);\r
-                       Status status = twitter.updateStatus(message);\r
-               } catch (TwitterException e) {\r
-                       // TODO Auto-generated catch block\r
-                       e.printStackTrace();\r
-                       log.severe(e.toString());\r
-               }\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
diff --git a/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/99/302553766d6800111d29ec7e4ac25070 b/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/99/302553766d6800111d29ec7e4ac25070
deleted file mode 100644 (file)
index 9d447bf..0000000
+++ /dev/null
@@ -1,141 +0,0 @@
-package com.yuji.tdb.twitter;\r
-\r
-import java.util.ArrayList;\r
-import java.util.Calendar;\r
-import java.util.Date;\r
-import java.util.List;\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
-\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
-\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
-\r
-       }\r
-\r
-       public void main(String consumerKey, String consumerSecret, AccessToken accessToken) {\r
-\r
-               String text = "\8b\9e\95l\93\8c\96k";\r
-\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
-                       Calendar cal = Calendar.getInstance();\r
-                       Date date = cal.getTime();\r
-                       long cur = date.getTime();\r
-                       \r
-                       Query query = new Query();\r
-                       query.setRpp(1000); // TODO\r
-                       query.setQuery(text);\r
-                       QueryResult result = twitter.search(query);\r
-                       List<Tweet> tweets = result.getTweets();\r
-                       \r
-                       int count = 0;\r
-                       int hit = 0;\r
-                       int mhit = 0;\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 - 30 * 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
-                                       // \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 = "";\r
-                       if (count < 10){\r
-                               message = "\92x\89\84\82È\82µ " + date.toString();                        \r
-                       }\r
-                       else {\r
-                               int N = 50;\r
-                               \r
-                               String sample = tweets.get(mindex).getText();\r
-                               if (sample.length() > N){\r
-                                       sample = sample.substring(0, N);\r
-                               }\r
-                               sample = CommonUtil.replaceString(sample, "@", "(a)");\r
-                               message = sample + " " + date.toString() + " count=" + count;                                                   \r
-                       }\r
-                       Status status = twitter.updateStatus(message);\r
-               } catch (TwitterException e) {\r
-                       // TODO Auto-generated catch block\r
-                       e.printStackTrace();\r
-                       log.severe(e.toString());\r
-               }\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
diff --git a/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/99/802014ff1e7200111835fa7adce7cfd2 b/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/99/802014ff1e7200111835fa7adce7cfd2
new file mode 100644 (file)
index 0000000..6791629
--- /dev/null
@@ -0,0 +1,201 @@
+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
diff --git a/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/99/f0ca4e2e106b001115b7b82f2f4ce01a b/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/99/f0ca4e2e106b001115b7b82f2f4ce01a
deleted file mode 100644 (file)
index fe94479..0000000
+++ /dev/null
@@ -1,46 +0,0 @@
-package com.yuji.tdb.main;\r
-\r
-import twitter4j.Status;\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.utility.StringUtility;\r
-\r
-public class Main {\r
-\r
-       public static void main(String[] args) {\r
-               test1();\r
-       }\r
-       \r
-       public static void test1(){\r
-               String text = "\82 \82¢ bb cc";\r
-               int length = 5;\r
-               String ret = StringUtility.parseSubstring(text, length);\r
-               System.out.println(ret);\r
-       }\r
-\r
-       public static void main() {\r
-               String consumerKey = "";\r
-               String consumerSecret = "";\r
-               String tokenKey = "";\r
-               String tokenSecret = "";\r
-\r
-               try {\r
-                       ConfigurationBuilder confBuilder = new ConfigurationBuilder();\r
-                       confBuilder.setDebugEnabled(true).setOAuthConsumerKey(consumerKey)\r
-                                       .setOAuthConsumerSecret(consumerSecret);\r
-                       TwitterFactory factory = new TwitterFactory(confBuilder.build());\r
-\r
-                       AccessToken accessToken = new AccessToken(tokenKey, tokenSecret);\r
-                       Twitter twitter = factory.getInstance(accessToken);\r
-\r
-                       Status status = twitter.updateStatus("\83e\83X\83g");\r
-               } catch (TwitterException e) {\r
-                       // TODO Auto-generated catch block\r
-                       e.printStackTrace();\r
-               }\r
-       }\r
-}\r
diff --git a/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/9a/80079dc82b7200111835fa7adce7cfd2 b/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/9a/80079dc82b7200111835fa7adce7cfd2
new file mode 100644 (file)
index 0000000..a1fd614
--- /dev/null
@@ -0,0 +1,210 @@
+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
diff --git a/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/9b/b025a50c2d7200111835fa7adce7cfd2 b/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/9b/b025a50c2d7200111835fa7adce7cfd2
new file mode 100644 (file)
index 0000000..20687bf
--- /dev/null
@@ -0,0 +1,235 @@
+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
diff --git a/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/9c/60e41e32ef6500111e5bcf098ae37dc9 b/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/9c/60e41e32ef6500111e5bcf098ae37dc9
deleted file mode 100644 (file)
index 32fbe4b..0000000
+++ /dev/null
@@ -1,138 +0,0 @@
-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 (requestToken == null || CommonUtil.isNull(consumerKey)\r
-                                       || CommonUtil.isNull(consumerSecret)) {\r
-                               log.warning("001");\r
-                               return;\r
-                       }\r
-\r
-                       if (!CommonUtil.isNull(parmResult)) {\r
-                               resultOAuthAuthorization(consumerKey, consumerSecret);\r
-                               return;\r
-                       }\r
-\r
-                       if (accessToken == null) {\r
-                               log.warning("002");\r
-                               return;\r
-                       }\r
-\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 = 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
-                       \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, String consumerSecret) {\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 = twitter.getOAuthAccessToken(requestToken);\r
-               } catch (TwitterException e) {\r
-                       // TODO Auto-generated catch block\r
-                       e.printStackTrace();\r
-                       log.severe(e.toString());\r
-               }\r
-       }\r
-}\r
diff --git a/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/9c/c09796a2666b001115b7b82f2f4ce01a b/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/9c/c09796a2666b001115b7b82f2f4ce01a
deleted file mode 100644 (file)
index 270a432..0000000
+++ /dev/null
@@ -1,40 +0,0 @@
-package com.yuji.tdb.db;
-
-import javax.jdo.annotations.IdGeneratorStrategy;
-import javax.jdo.annotations.IdentityType;
-import javax.jdo.annotations.PersistenceCapable;
-import javax.jdo.annotations.Persistent;
-import javax.jdo.annotations.PrimaryKey;
-
-@PersistenceCapable(identityType = IdentityType.APPLICATION)
-public class Train {
-    @PrimaryKey
-    @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
-    private Long id;
-    @Persistent
-    private String name;
-       @Persistent
-    private String searchWord;
-    @Persistent
-    private int count;
-
-    public Train(Long id, String name, String searchWord, int count){
-       this.id = id;
-       this.name = name;
-       this.searchWord = searchWord;
-       this.count = count;
-    }
-    
-    public Long getId() {
-               return id;
-       }
-       public String getName() {
-               return name;
-       }
-       public String getSearchWord() {
-               return searchWord;
-       }
-       public int getCount() {
-               return count;
-       }
-}
diff --git a/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/a/202f1e152d7200111835fa7adce7cfd2 b/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/a/202f1e152d7200111835fa7adce7cfd2
new file mode 100644 (file)
index 0000000..30dc70c
--- /dev/null
@@ -0,0 +1,236 @@
+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
diff --git a/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/a0/7088eb5d2c7200111835fa7adce7cfd2 b/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/a0/7088eb5d2c7200111835fa7adce7cfd2
new file mode 100644 (file)
index 0000000..aebe5ae
--- /dev/null
@@ -0,0 +1,229 @@
+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
diff --git a/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/a1/00485adb2c7200111835fa7adce7cfd2 b/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/a1/00485adb2c7200111835fa7adce7cfd2
new file mode 100644 (file)
index 0000000..921c3c4
--- /dev/null
@@ -0,0 +1,230 @@
+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
diff --git a/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/a3/40fb3d84cd6a0011194396142d5d2649 b/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/a3/40fb3d84cd6a0011194396142d5d2649
deleted file mode 100644 (file)
index 3f53eba..0000000
+++ /dev/null
@@ -1,140 +0,0 @@
-package com.yuji.tdb.twitter;\r
-\r
-import java.util.ArrayList;\r
-import java.util.Calendar;\r
-import java.util.Date;\r
-import java.util.List;\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.utility.StringUtil;\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
-\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
-\r
-       }\r
-\r
-       public void main(String consumerKey, String consumerSecret, AccessToken accessToken) {\r
-\r
-               String text = "\8b\9e\95l\93\8c\96k";\r
-\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
-                       Calendar cal = Calendar.getInstance();\r
-                       Date date = cal.getTime();\r
-                       long cur = date.getTime();\r
-                       \r
-                       Query query = new Query();\r
-                       //query.setRpp(1000); // TODO\r
-                       query.setQuery(text);\r
-                       QueryResult result = twitter.search(query);\r
-                       List<Tweet> tweets = result.getTweets();\r
-                       \r
-                       int count = 0;\r
-                       int hit = 0;\r
-                       int mhit = 0;\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 - 30 * 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
-                                       // \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 = "";\r
-                       if (count < 10){\r
-                               message = "\92x\89\84\82È\82µ " + date.toString();                        \r
-                       }\r
-                       else {\r
-                               int N = 100;\r
-                               \r
-                               String sample = tweets.get(mindex).getText();\r
-                               sample = CommonUtil.replaceString(sample, "@", "(a)");\r
-                               sample = StringUtil.parseSubstring(sample);\r
-                               message = sample + " " + date.toString() + " count=" + count;                                                   \r
-                       }\r
-                       Status status = twitter.updateStatus(message);\r
-               } catch (TwitterException e) {\r
-                       // TODO Auto-generated catch block\r
-                       e.printStackTrace();\r
-                       log.severe(e.toString());\r
-               }\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
diff --git a/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/a3/f0786f29006600111e5bcf098ae37dc9 b/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/a3/f0786f29006600111e5bcf098ae37dc9
deleted file mode 100644 (file)
index d5863ec..0000000
+++ /dev/null
@@ -1,138 +0,0 @@
-package com.yuji.tdb.twitter;\r
-\r
-import java.util.ArrayList;\r
-import java.util.Calendar;\r
-import java.util.Date;\r
-import java.util.List;\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
-\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
-\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
-\r
-       }\r
-\r
-       public void main(String consumerKey, String consumerSecret, AccessToken accessToken) {\r
-\r
-               String text = "\8b\9e\95l\93\8c\96k";\r
-\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
-                       Calendar cal = Calendar.getInstance();\r
-                       Date date = cal.getTime();\r
-                       long cur = date.getTime();\r
-                       \r
-                       Query query = new Query();\r
-                       query.setRpp(1000); // TODO\r
-                       query.setQuery(text);\r
-                       QueryResult result = twitter.search(query);\r
-                       List<Tweet> tweets = result.getTweets();\r
-                       \r
-                       int count = 0;\r
-                       int hit = 0;\r
-                       int mhit = 0;\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
-                               String message = tweet.getText();\r
-                               \r
-                               if (t < cur - 30 * 60 * 1000){\r
-                                       continue;\r
-                               }\r
-                               hit = filter(message);\r
-                               if (hit <= 0) {\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 = "";\r
-                       if (count < 10){\r
-                               message = "\92x\89\84\82È\82µ " + date.toString();                        \r
-                       }\r
-                       else {\r
-                               int N = 50;\r
-                               \r
-                               String sample = tweets.get(mindex).getText();\r
-                               if (sample.length() > N){\r
-                                       sample = sample.substring(0, N);\r
-                               }\r
-                               sample = CommonUtil.replaceString(sample, "@", "(a)");\r
-                               message = sample + " " + date.toString() + " count=" + count;                                                   \r
-                       }\r
-                       Status status = twitter.updateStatus(message);\r
-               } catch (TwitterException e) {\r
-                       // TODO Auto-generated catch block\r
-                       e.printStackTrace();\r
-                       log.severe(e.toString());\r
-               }\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
diff --git a/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/a4/40c69c5a136b001115b7b82f2f4ce01a b/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/a4/40c69c5a136b001115b7b82f2f4ce01a
deleted file mode 100644 (file)
index 0304199..0000000
+++ /dev/null
@@ -1,142 +0,0 @@
-package com.yuji.tdb.twitter;\r
-\r
-import java.text.DateFormat;\r
-import java.util.ArrayList;\r
-import java.util.Calendar;\r
-import java.util.Date;\r
-import java.util.List;\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.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
-\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
-\r
-       }\r
-\r
-       public void main(String consumerKey, String consumerSecret, AccessToken accessToken) {\r
-\r
-               String text = "\8b\9e\95l\93\8c\96k";\r
-\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
-                       Calendar cal = Calendar.getInstance();\r
-                       Date date = cal.getTime();\r
-                       long cur = date.getTime();\r
-                       \r
-                       Query query = new Query();\r
-                       //query.setRpp(1000); // TODO\r
-                       query.setQuery(text);\r
-                       QueryResult result = twitter.search(query);\r
-                       List<Tweet> tweets = result.getTweets();\r
-                       \r
-                       int count = 0;\r
-                       int hit = 0;\r
-                       int mhit = 0;\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 - 30 * 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
-                                       // \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 = "";\r
-                       if (count < 5){\r
-                               message = "\92x\89\84\82È\82µ " + DateFormat.format(date);        \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 = sample + " " + date.toString() + " count=" + count;                                                   \r
-                       }\r
-                       System.out.println(message);//TODO\r
-                       Status status = twitter.updateStatus(message);\r
-               } catch (TwitterException e) {\r
-                       // TODO Auto-generated catch block\r
-                       e.printStackTrace();\r
-                       log.severe(e.toString());\r
-               }\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
diff --git a/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/a5/30ef1ee3ef6500111e5bcf098ae37dc9 b/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/a5/30ef1ee3ef6500111e5bcf098ae37dc9
deleted file mode 100644 (file)
index 83690cc..0000000
+++ /dev/null
@@ -1,147 +0,0 @@
-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("001");\r
-                               return;\r
-                       }\r
-\r
-                       if (!CommonUtil.isNull(parmResult)) {\r
-                               String requestTokenKey = dao.get(KeyValueDao.KEY_REQUEST_TOKEN);\r
-                               String requestTokenSecret = dao.get(KeyValueDao.KEY_REQUEST_TOKEN_SECRET);\r
-\r
-                               if (CommonUtil.isNull(requestTokenKey)\r
-                                               || CommonUtil.isNull(requestTokenSecret)) {\r
-                                       log.warning("003");\r
-                                       return;                                 \r
-                               }\r
-                               RequestToken requestToken = new RequestToken(requestTokenKey, requestTokenSecret);\r
-                               resultOAuthAuthorization(consumerKey, consumerSecret. requestToken);\r
-                               return;\r
-                       }\r
-\r
-                       if (accessToken == null) {\r
-                               log.warning("003");\r
-                               return;\r
-                       }\r
-\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 = 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
-                       \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, 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 = twitter.getOAuthAccessToken(requestToken);\r
-               } catch (TwitterException e) {\r
-                       // TODO Auto-generated catch block\r
-                       e.printStackTrace();\r
-                       log.severe(e.toString());\r
-               }\r
-       }\r
-}\r
diff --git a/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/a5/40f42873136b001115b7b82f2f4ce01a b/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/a5/40f42873136b001115b7b82f2f4ce01a
deleted file mode 100644 (file)
index f610df1..0000000
+++ /dev/null
@@ -1,143 +0,0 @@
-package com.yuji.tdb.twitter;\r
-\r
-import java.text.DateFormat;\r
-import java.util.ArrayList;\r
-import java.util.Calendar;\r
-import java.util.Date;\r
-import java.util.List;\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.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 DateFormat("yyyy/MM/dd");\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
-\r
-       }\r
-\r
-       public void main(String consumerKey, String consumerSecret, AccessToken accessToken) {\r
-\r
-               String text = "\8b\9e\95l\93\8c\96k";\r
-\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
-                       Calendar cal = Calendar.getInstance();\r
-                       Date date = cal.getTime();\r
-                       long cur = date.getTime();\r
-                       \r
-                       Query query = new Query();\r
-                       //query.setRpp(1000); // TODO\r
-                       query.setQuery(text);\r
-                       QueryResult result = twitter.search(query);\r
-                       List<Tweet> tweets = result.getTweets();\r
-                       \r
-                       int count = 0;\r
-                       int hit = 0;\r
-                       int mhit = 0;\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 - 30 * 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
-                                       // \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 = "";\r
-                       if (count < 5){\r
-                               message = "\92x\89\84\82È\82µ " + DateFormat.format(date);        \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 = sample + " " + date.toString() + " count=" + count;                                                   \r
-                       }\r
-                       System.out.println(message);//TODO\r
-                       Status status = twitter.updateStatus(message);\r
-               } catch (TwitterException e) {\r
-                       // TODO Auto-generated catch block\r
-                       e.printStackTrace();\r
-                       log.severe(e.toString());\r
-               }\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
diff --git a/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/a9/00ae725a6b6800111d29ec7e4ac25070 b/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/a9/00ae725a6b6800111d29ec7e4ac25070
deleted file mode 100644 (file)
index d5863ec..0000000
+++ /dev/null
@@ -1,138 +0,0 @@
-package com.yuji.tdb.twitter;\r
-\r
-import java.util.ArrayList;\r
-import java.util.Calendar;\r
-import java.util.Date;\r
-import java.util.List;\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
-\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
-\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
-\r
-       }\r
-\r
-       public void main(String consumerKey, String consumerSecret, AccessToken accessToken) {\r
-\r
-               String text = "\8b\9e\95l\93\8c\96k";\r
-\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
-                       Calendar cal = Calendar.getInstance();\r
-                       Date date = cal.getTime();\r
-                       long cur = date.getTime();\r
-                       \r
-                       Query query = new Query();\r
-                       query.setRpp(1000); // TODO\r
-                       query.setQuery(text);\r
-                       QueryResult result = twitter.search(query);\r
-                       List<Tweet> tweets = result.getTweets();\r
-                       \r
-                       int count = 0;\r
-                       int hit = 0;\r
-                       int mhit = 0;\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
-                               String message = tweet.getText();\r
-                               \r
-                               if (t < cur - 30 * 60 * 1000){\r
-                                       continue;\r
-                               }\r
-                               hit = filter(message);\r
-                               if (hit <= 0) {\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 = "";\r
-                       if (count < 10){\r
-                               message = "\92x\89\84\82È\82µ " + date.toString();                        \r
-                       }\r
-                       else {\r
-                               int N = 50;\r
-                               \r
-                               String sample = tweets.get(mindex).getText();\r
-                               if (sample.length() > N){\r
-                                       sample = sample.substring(0, N);\r
-                               }\r
-                               sample = CommonUtil.replaceString(sample, "@", "(a)");\r
-                               message = sample + " " + date.toString() + " count=" + count;                                                   \r
-                       }\r
-                       Status status = twitter.updateStatus(message);\r
-               } catch (TwitterException e) {\r
-                       // TODO Auto-generated catch block\r
-                       e.printStackTrace();\r
-                       log.severe(e.toString());\r
-               }\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
diff --git a/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/aa/f08063aafb6500111e5bcf098ae37dc9 b/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/aa/f08063aafb6500111e5bcf098ae37dc9
deleted file mode 100644 (file)
index cac908a..0000000
+++ /dev/null
@@ -1,136 +0,0 @@
-package com.yuji.tdb.twitter;\r
-\r
-import java.util.ArrayList;\r
-import java.util.Calendar;\r
-import java.util.Date;\r
-import java.util.List;\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
-\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
-\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
-\r
-       }\r
-\r
-       public void main(String consumerKey, String consumerSecret, AccessToken accessToken) {\r
-\r
-               String text = "\8b\9e\95l\93\8c\96k";\r
-\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
-                       Calendar cal = Calendar.getInstance();\r
-                       Date date = cal.getTime();\r
-                       long cur = date.getTime();\r
-                       \r
-                       Query query = new Query();\r
-                       query.setRpp(1000); // TODO\r
-                       query.setQuery(text);\r
-                       QueryResult result = twitter.search(query);\r
-                       List<Tweet> tweets = result.getTweets();\r
-                       \r
-                       int count = 0;\r
-                       int hit = 0;\r
-                       int mhit = 0;\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
-                               String message = tweet.getText();\r
-                               \r
-                               if (t < cur - 30 * 60 * 1000){\r
-                                       continue;\r
-                               }\r
-                               hit = filter(message);\r
-                               if (hit <= 0) {\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 = "";\r
-                       if (count < 10){\r
-                               message = "\92x\89\84\82È\82µ " + date.toString();                        \r
-                       }\r
-                       else {\r
-                               int N = 50;\r
-                               \r
-                               String sample = tweets.get(mindex).getText();\r
-                               if (sample.length() > N){\r
-                                       sample = sample.substring(0, N);\r
-                               }\r
-                               sample = CommonUtil.replaceString(sample, "@", "(a)");\r
-                               message = sample + " " + date.toString() + " count=" + count;                                                   \r
-                       }\r
-                       Status status = twitter.updateStatus(message);\r
-               } catch (TwitterException e) {\r
-                       // TODO Auto-generated catch block\r
-                       e.printStackTrace();\r
-                       log.severe(e.toString());\r
-               }\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("\8bÙ\8b}\92â\8e~");\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
diff --git a/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/ab/707a20f5ca6a0011194396142d5d2649 b/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/ab/707a20f5ca6a0011194396142d5d2649
deleted file mode 100644 (file)
index 335e652..0000000
+++ /dev/null
@@ -1,38 +0,0 @@
-package com.yuji.tdb.utility;
-
-import java.util.regex.Pattern;
-
-public class StringUtil {
-       private static Pattern ptnAlnum = Pattern.compile("[a-zA-Z0-9]");
-       private static Pattern ptnAscii = Pattern.compile("\\p{ASCII}");
-       
-       public static String parseSubstring(String text, int length){
-               int len = text.length();
-               int status = -1;
-               int pos = 0;
-               
-               for (int i = 0; i < len && i < length; i++){
-                       String ch = text.substring(i, i + 1);
-                       
-                       if (ptnAlnum.matcher(ch).matches()){
-                               if (status != 0){
-                                       pos = i;
-                                       status = 0;
-                               }
-                       }
-                       else if (ptnAscii.matcher(ch).matches()){
-                               if (status != 1){
-                                       pos = i;
-                                       status = 1;
-                               }                               
-                       }
-                       else {
-                               if (status != 2){
-                                       pos = i;
-                                       status = 2;
-                               }                                                               
-                       }
-               }
-               return text.substring(0, pos + 1);
-       }
-}
diff --git a/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/ab/c0c91bed71680011170bbf669c61406a b/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/ab/c0c91bed71680011170bbf669c61406a
deleted file mode 100644 (file)
index b01c818..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-package com.yuji.tdb.utility;
-
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-public class StringUtil {
-       private static Pattern ptnAlnum = Pattern.compile("[a-zA-Z0-9]");
-       private static Pattern ptnAscii = Pattern.compile("\\p{ASCII}");
-       
-       public static String parseSubstring(String text, int length){
-               int len = text.length();
-               
-               for (int i = 0; i < len; i++){
-                       String ch = text.substring(i, i + 1);
-                       Matcher m;
-                       
-                       ptnAlnum.matcher(ch);
-                       ptnAscii.matcher(ch);
-               }
-       }
-}
diff --git a/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/ac/d0ddd996317200111835fa7adce7cfd2 b/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/ac/d0ddd996317200111835fa7adce7cfd2
new file mode 100644 (file)
index 0000000..4d2653a
--- /dev/null
@@ -0,0 +1,241 @@
+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
diff --git a/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/b0/603ec758ee6500111e5bcf098ae37dc9 b/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/b0/603ec758ee6500111e5bcf098ae37dc9
deleted file mode 100644 (file)
index 5569c02..0000000
+++ /dev/null
@@ -1,143 +0,0 @@
-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
-                               \r
-                               dao.put("FOO", "aaa");\r
-                               \r
-                               return;\r
-                       }\r
-\r
-                       if (requestToken == null || CommonUtil.isNull(consumerKey)\r
-                                       || CommonUtil.isNull(consumerSecret)) {\r
-                               log.warning("001");\r
-                               return;\r
-                       }\r
-\r
-                       if (!CommonUtil.isNull(parmResult)) {\r
-                               resultOAuthAuthorization();\r
-                               \r
-                               String value = dao.get("FOO");\r
-                               log.warning("VALUE=" + value);\r
-                               \r
-                               return;\r
-                       }\r
-\r
-                       if (accessToken == null) {\r
-                               log.warning("002");\r
-                               return;\r
-                       }\r
-\r
-                       AccessToken a = new AccessToken(parmResult, parmResult);\r
-                       \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 = 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
-\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() {\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 = twitter.getOAuthAccessToken(requestToken);\r
-               } catch (TwitterException e) {\r
-                       // TODO Auto-generated catch block\r
-                       e.printStackTrace();\r
-                       log.severe(e.toString());\r
-               }\r
-       }\r
-}\r
diff --git a/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/b1/804be6242e7200111835fa7adce7cfd2 b/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/b1/804be6242e7200111835fa7adce7cfd2
new file mode 100644 (file)
index 0000000..66969d8
--- /dev/null
@@ -0,0 +1,69 @@
+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
@@ -20,8 +20,10 @@ import twitter4j.auth.AccessToken;
 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
@@ -31,7 +33,8 @@ public class TwitterUtil {
        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
-\r
+       private int period = 0;\r
+       \r
        public static TwitterUtil getInstance() {\r
                if (instance == null) {\r
                        synchronized (obj) {\r
@@ -70,7 +73,14 @@ public class TwitterUtil {
                Query query = new Query();\r
                //query.setRpp(1000); // TODO\r
                query.setQuery(train.getSearchWord());\r
-               QueryResult result = twitter.search(query);\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
@@ -80,6 +90,7 @@ public class TwitterUtil {
                int count = 0;\r
                int hit = 0;\r
                int mhit = 0;\r
+               int period = getPeriod;\r
                \r
                int index;\r
                int mindex = 0;\r
@@ -92,7 +103,7 @@ public class TwitterUtil {
                        \r
                        String message = tweet.getText();\r
                        \r
-                       if (t < cur - 30 * 60 * 1000){\r
+                       if (t < cur - 5 * 60 * 1000){\r
                                System.out.println("\81~" + tweet.getFromUser() + " - "\r
                                                + tweet.getText() + at);\r
                                continue;\r
@@ -116,7 +127,7 @@ public class TwitterUtil {
 \r
                String message = "[" + train.getName() + "] ";\r
                if (count < train.getCount()){\r
-                       message += " " + df.format(date) + " \92x\89\84\82È\82µ"; \r
+                       message += df.format(date) + " \92x\89\84\82È\82µ";       \r
                }\r
                else {\r
                        int N = 100;\r
@@ -124,10 +135,18 @@ public class TwitterUtil {
                        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
+                       message += df.format(date) + " " + sample + " count=" + count;                                                  \r
                }\r
                System.out.println(message); //TODO\r
-               Status status = twitter.updateStatus(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
@@ -168,4 +187,16 @@ public class TwitterUtil {
                }\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
diff --git a/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/b5/b0c6e469f16500111e5bcf098ae37dc9 b/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/b5/b0c6e469f16500111e5bcf098ae37dc9
deleted file mode 100644 (file)
index 5141fc1..0000000
+++ /dev/null
@@ -1,161 +0,0 @@
-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("001");\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("003");\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.get(KeyValueDao.KEY_ACCESS_TOKEN_SECRET);\r
-                       if (CommonUtil.isNull(accessTokenKey)\r
-                                       || CommonUtil.isNull(accessTokenSecret)) {\r
-                               log.warning("003");\r
-                               return;\r
-                       }\r
-\r
-                       AccessToken accessToken = new AccessToken(requestTokenKey,\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, accessToken.getTokenSecret());\r
-               } catch (TwitterException e) {\r
-                       // TODO Auto-generated catch block\r
-                       e.printStackTrace();\r
-                       log.severe(e.toString());\r
-               }\r
-       }\r
-}\r
@@ -25,7 +25,7 @@ public class TrainDelayBotServlet extends HttpServlet {
        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 AccessToken accessToken = null;\r
        // private static String consumerKey = null;\r
        // private static String consumerSecret = null;\r
 \r
@@ -53,7 +53,7 @@ public class TrainDelayBotServlet extends HttpServlet {
                        String consumerSecret = dao.get(KeyValueDao.KEY_CONSUMER_SECRET);\r
                        if (CommonUtil.isNull(consumerKey)\r
                                        || CommonUtil.isNull(consumerSecret)) {\r
-                               log.warning("001");\r
+                               log.warning("" + Debug.getLineNo());\r
                                return;\r
                        }\r
 \r
@@ -64,7 +64,7 @@ public class TrainDelayBotServlet extends HttpServlet {
 \r
                                if (CommonUtil.isNull(requestTokenKey)\r
                                                || CommonUtil.isNull(requestTokenSecret)) {\r
-                                       log.warning("003");\r
+                                       log.warning("" + Debug.getLineNo());\r
                                        return;\r
                                }\r
                                RequestToken requestToken = new RequestToken(requestTokenKey,\r
@@ -75,10 +75,11 @@ public class TrainDelayBotServlet extends HttpServlet {
                        }\r
 \r
                        String accessTokenKey = dao.get(KeyValueDao.KEY_ACCESS_TOKEN);\r
-                       String accessTokenSecret = dao.get(KeyValueDao.KEY_ACCESS_TOKEN_SECRET);\r
+                       String accessTokenSecret = dao\r
+                                       .get(KeyValueDao.KEY_ACCESS_TOKEN_SECRET);\r
                        if (CommonUtil.isNull(accessTokenKey)\r
                                        || CommonUtil.isNull(accessTokenSecret)) {\r
-                               log.warning("003");\r
+                               log.warning("" + Debug.getLineNo());\r
                                return;\r
                        }\r
 \r
@@ -151,7 +152,8 @@ public class TrainDelayBotServlet extends HttpServlet {
 \r
                        AccessToken accessToken = twitter.getOAuthAccessToken(requestToken);\r
                        dao.put(KeyValueDao.KEY_ACCESS_TOKEN, accessToken.getToken());\r
-                       dao.put(KeyValueDao.KEY_ACCESS_TOKEN_SECRET, accessToken.getTokenSecret());\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
diff --git a/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/bb/60e0098b0e6b001115b7b82f2f4ce01a b/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/bb/60e0098b0e6b001115b7b82f2f4ce01a
deleted file mode 100644 (file)
index b64b11f..0000000
+++ /dev/null
@@ -1,46 +0,0 @@
-package com.yuji.tdb.main;\r
-\r
-import twitter4j.Status;\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.utility.StringUtility;\r
-\r
-public class Main {\r
-\r
-       public static void main(String[] args) {\r
-               test1();\r
-       }\r
-       \r
-       public static void test1(){\r
-               String text = "\82 \82¢\82¤\82¦\82¨";\r
-               int length = 3;\r
-               String ret = StringUtility.parseSubstring(text, length);\r
-               System.out.println(ret);\r
-       }\r
-\r
-       public static void main() {\r
-               String consumerKey = "";\r
-               String consumerSecret = "";\r
-               String tokenKey = "";\r
-               String tokenSecret = "";\r
-\r
-               try {\r
-                       ConfigurationBuilder confBuilder = new ConfigurationBuilder();\r
-                       confBuilder.setDebugEnabled(true).setOAuthConsumerKey(consumerKey)\r
-                                       .setOAuthConsumerSecret(consumerSecret);\r
-                       TwitterFactory factory = new TwitterFactory(confBuilder.build());\r
-\r
-                       AccessToken accessToken = new AccessToken(tokenKey, tokenSecret);\r
-                       Twitter twitter = factory.getInstance(accessToken);\r
-\r
-                       Status status = twitter.updateStatus("\83e\83X\83g");\r
-               } catch (TwitterException e) {\r
-                       // TODO Auto-generated catch block\r
-                       e.printStackTrace();\r
-               }\r
-       }\r
-}\r
diff --git a/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/bb/a0032a032f7200111835fa7adce7cfd2 b/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/bb/a0032a032f7200111835fa7adce7cfd2
new file mode 100644 (file)
index 0000000..f9d04e7
--- /dev/null
@@ -0,0 +1,238 @@
+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
diff --git a/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/bb/b0de668c166b001115b7b82f2f4ce01a b/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/bb/b0de668c166b001115b7b82f2f4ce01a
deleted file mode 100644 (file)
index b198de9..0000000
+++ /dev/null
@@ -1,145 +0,0 @@
-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.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
-\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
-               TimeZone.setDefault(TimeZone.getTimeZone("JST")); // TODO \8fê\8f\8a\r
-       }\r
-\r
-       public void main(String consumerKey, String consumerSecret, AccessToken accessToken) {\r
-\r
-               String text = "\8b\9e\95l\93\8c\96k";\r
-\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
-                       Calendar cal = Calendar.getInstance();\r
-                       Date date = cal.getTime();\r
-                       long cur = date.getTime();\r
-                       \r
-                       Query query = new Query();\r
-                       //query.setRpp(1000); // TODO\r
-                       query.setQuery(text);\r
-                       QueryResult result = twitter.search(query);\r
-                       List<Tweet> tweets = result.getTweets();\r
-                       \r
-                       int count = 0;\r
-                       int hit = 0;\r
-                       int mhit = 0;\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 - 30 * 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
-                                       // \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 = "";\r
-                       if (count < 5){\r
-                               message = "\92x\89\84\82È\82µ " + df.format(date);        \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 = sample + " " + df.format(date) + " count=" + count;                                                   \r
-                       }\r
-                       System.out.println(message);//TODO\r
-                       Status status = twitter.updateStatus(message);\r
-               } catch (TwitterException e) {\r
-                       // TODO Auto-generated catch block\r
-                       e.printStackTrace();\r
-                       log.severe(e.toString());\r
-               }\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
diff --git a/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/bb/e02a3d87646b001115b7b82f2f4ce01a b/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/bb/e02a3d87646b001115b7b82f2f4ce01a
deleted file mode 100644 (file)
index f41b952..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-package com.yuji.tdb.db;
-
-public class Train {
-
-}
diff --git a/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/bc/30af1db42b7200111835fa7adce7cfd2 b/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/bc/30af1db42b7200111835fa7adce7cfd2
new file mode 100644 (file)
index 0000000..b0b75b9
--- /dev/null
@@ -0,0 +1,210 @@
+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
diff --git a/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/bd/80845745d46a001115b0ad2bca3cccad b/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/bd/80845745d46a001115b0ad2bca3cccad
deleted file mode 100644 (file)
index e24b621..0000000
+++ /dev/null
@@ -1,48 +0,0 @@
-package com.yuji.tdb.utility;
-
-import java.util.regex.Pattern;
-
-public class StringUtility {
-       private static Pattern ptnAlnum = Pattern.compile("[a-zA-Z0-9]");
-       private static Pattern ptnSpace = Pattern.compile("TODO");
-       private static Pattern ptnAscii = Pattern.compile("\\p{ASCII}");
-       
-       public static String parseSubstring(String text, int length){
-               int len = text.length();
-               int status = -1;
-               int pos = 0;
-               
-               for (int i = 0; i < len + 1 && i < length + 1; i++){
-                       if (i >= len){
-                               pos = i;
-                               break;
-                       }
-                       String ch = text.substring(i, i + 1);
-                       
-                       if (ptnAlnum.matcher(ch).matches()){
-                               if (status != 0){
-                                       pos = i;
-                                       status = 0;
-                               }
-                       }
-                       else if (ptnSpace.matcher(ch).matches()){
-                               pos = i;
-                               status = 1;
-                       }
-                       else if (ptnAscii.matcher(ch).matches()){
-                               if (status != 2){
-                                       pos = i;
-                                       status = 2;
-                               }                               
-                       }
-                       else {
-                               pos = i;
-                               status = 3;
-                       }
-               }
-               if (pos == 0){
-                       return text.substring(0, (len < length)? len : length);                 
-               }
-               return text.substring(0, pos);
-       }
-}
diff --git a/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/c/30ed9725686b001115b7b82f2f4ce01a b/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/c/30ed9725686b001115b7b82f2f4ce01a
deleted file mode 100644 (file)
index 2b1c123..0000000
+++ /dev/null
@@ -1,172 +0,0 @@
-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.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.Train;\r
-import com.yuji.tdb.db.TrainDao;\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
-\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
-               //TimeZone.setDefault(TimeZone.getTimeZone("JST")); // TODO \8fê\8f\8a\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
-               Calendar cal = Calendar.getInstance();\r
-               Date date = cal.getTime();\r
-               long cur = date.getTime();\r
-               \r
-               Query query = new Query();\r
-               //query.setRpp(1000); // TODO\r
-               query.setQuery(train.getSearchWord());\r
-               QueryResult result = twitter.search(query);\r
-               List<Tweet> tweets = result.getTweets();\r
-               \r
-               int count = 0;\r
-               int hit = 0;\r
-               int mhit = 0;\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 - 30 * 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 = "";\r
-               if (count < train.getCount()){\r
-                       message = "\92x\89\84\82È\82µ " + df.format(date);        \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 = sample + " " + df.format(date) + " count=" + count;                                                   \r
-               }\r
-               System.out.println(message); //TODO\r
-               Status status = twitter.updateStatus(message); //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
-                       list.add(train);\r
-                       train = new Train("\93\8c\8aC\93¹\90ü", "\93\8c\8aC\93¹", 5);\r
-                       list.add(train);\r
-                       train = new Train("\8b\9e\95l\8b}\8ds\90ü", "\8b\9e\8b}", 5);\r
-                       list.add(train);\r
-                       \r
-                       for (Train t : list){\r
-                               dao.put(t);\r
-                       }\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
diff --git a/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/c/30f7a5ad2f7200111835fa7adce7cfd2 b/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/c/30f7a5ad2f7200111835fa7adce7cfd2
new file mode 100644 (file)
index 0000000..9350088
--- /dev/null
@@ -0,0 +1,238 @@
+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
diff --git a/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/c0/10133829f16500111e5bcf098ae37dc9 b/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/c0/10133829f16500111e5bcf098ae37dc9
deleted file mode 100644 (file)
index 48b34f1..0000000
+++ /dev/null
@@ -1,154 +0,0 @@
-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("001");\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("003");\r
-                                       return;\r
-                               }\r
-                               RequestToken requestToken = new RequestToken(requestTokenKey,\r
-                                               requestTokenSecret);\r
-                               resultOAuthAuthorization(consumerKey, consumerSecret,\r
-                                               requestToken);\r
-                               return;\r
-                       }\r
-\r
-                       if (accessToken == null) {\r
-                               log.warning("003");\r
-                               return;\r
-                       }\r
-\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 = twitter.getOAuthAccessToken(requestToken);\r
-               } catch (TwitterException e) {\r
-                       // TODO Auto-generated catch block\r
-                       e.printStackTrace();\r
-                       log.severe(e.toString());\r
-               }\r
-       }\r
-}\r
diff --git a/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/c0/4003fcad2b7200111835fa7adce7cfd2 b/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/c0/4003fcad2b7200111835fa7adce7cfd2
new file mode 100644 (file)
index 0000000..a6c05d9
--- /dev/null
@@ -0,0 +1,210 @@
+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
@@ -20,8 +20,10 @@ import twitter4j.auth.AccessToken;
 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
@@ -31,7 +33,9 @@ public class TwitterUtil {
        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
-\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
@@ -70,7 +74,14 @@ public class TwitterUtil {
                Query query = new Query();\r
                //query.setRpp(1000); // TODO\r
                query.setQuery(train.getSearchWord());\r
-               QueryResult result = twitter.search(query);\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
@@ -80,6 +91,7 @@ public class TwitterUtil {
                int count = 0;\r
                int hit = 0;\r
                int mhit = 0;\r
+               int period = getPeriod();\r
                \r
                int index;\r
                int mindex = 0;\r
@@ -92,7 +104,7 @@ public class TwitterUtil {
                        \r
                        String message = tweet.getText();\r
                        \r
-                       if (t < cur - 30 * 60 * 1000){\r
+                       if (t < cur - period * 60 * 1000){\r
                                System.out.println("\81~" + tweet.getFromUser() + " - "\r
                                                + tweet.getText() + at);\r
                                continue;\r
@@ -116,7 +128,7 @@ public class TwitterUtil {
 \r
                String message = "[" + train.getName() + "] ";\r
                if (count < train.getCount()){\r
-                       message += "\92x\89\84\82È\82µ " + df.format(date);       \r
+                       message += df.format(date) + " \92x\89\84\82È\82µ";       \r
                }\r
                else {\r
                        int N = 100;\r
@@ -124,10 +136,18 @@ public class TwitterUtil {
                        String sample = tweets.get(mindex).getText();\r
                        sample = CommonUtil.replaceString(sample, "@", "(a)");\r
                        sample = StringUtility.parseSubstring(sample, N);\r
-                       message += sample + " " + df.format(date) + " count=" + count;                                                  \r
+                       message += df.format(date) + " " + sample + " count=" + count;                                                  \r
                }\r
                System.out.println(message); //TODO\r
-               Status status = twitter.updateStatus(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
@@ -147,8 +167,6 @@ public class TwitterUtil {
                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
@@ -168,4 +186,12 @@ public class TwitterUtil {
                }\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
diff --git a/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/c2/e0c22d76317200111835fa7adce7cfd2 b/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/c2/e0c22d76317200111835fa7adce7cfd2
new file mode 100644 (file)
index 0000000..5cc2cdc
--- /dev/null
@@ -0,0 +1,239 @@
+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
diff --git a/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/c3/50c1af74ef6500111e5bcf098ae37dc9 b/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/c3/50c1af74ef6500111e5bcf098ae37dc9
deleted file mode 100644 (file)
index ecb8d67..0000000
+++ /dev/null
@@ -1,138 +0,0 @@
-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 (requestToken == null || CommonUtil.isNull(consumerKey)\r
-                                       || CommonUtil.isNull(consumerSecret)) {\r
-                               log.warning("001");\r
-                               return;\r
-                       }\r
-\r
-                       if (!CommonUtil.isNull(parmResult)) {\r
-                               resultOAuthAuthorization(consumerKey, consumerSecret);\r
-                               return;\r
-                       }\r
-\r
-                       if (accessToken == null) {\r
-                               log.warning("002");\r
-                               return;\r
-                       }\r
-\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 = 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
-                       \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, String consumerSecret) {\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 = twitter.getOAuthAccessToken(requestToken);\r
-               } catch (TwitterException e) {\r
-                       // TODO Auto-generated catch block\r
-                       e.printStackTrace();\r
-                       log.severe(e.toString());\r
-               }\r
-       }\r
-}\r
@@ -2,7 +2,7 @@ package com.yuji.tdb.db;
 \r
 import javax.jdo.PersistenceManager;\r
 \r
-public class TrainDao {\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
@@ -10,17 +10,19 @@ public class TrainDao {
        public static final String KEY_ACCESS_TOKEN = "ACCESS_TOKEN";\r
        public static final String KEY_ACCESS_TOKEN_SECRET = "ACCESS_TOKEN_SECRET";\r
 \r
-       private static TrainDao instance = null;\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 TrainDao getInstance(){\r
+       public static KeyValueDao getInstance(){\r
                if (instance == null){\r
-                       instance = new TrainDao();\r
+                       instance = new KeyValueDao();\r
                }\r
                return instance;\r
        }\r
        \r
-       private TrainDao(){\r
+       private KeyValueDao(){\r
                \r
        }\r
        \r
@@ -45,4 +47,21 @@ public class TrainDao {
        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
diff --git a/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/c5/7080417b0e6b001115b7b82f2f4ce01a b/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/c5/7080417b0e6b001115b7b82f2f4ce01a
deleted file mode 100644 (file)
index 1a00ce7..0000000
+++ /dev/null
@@ -1,48 +0,0 @@
-package com.yuji.tdb.utility;
-
-import java.util.regex.Pattern;
-
-public class StringUtility {
-       private static Pattern ptnAlnum = Pattern.compile("[a-zA-Z0-9]");
-       private static Pattern ptnSpace = Pattern.compile(TODO);
-       private static Pattern ptnAscii = Pattern.compile("\\p{ASCII}");
-       
-       public static String parseSubstring(String text, int length){
-               int len = text.length();
-               int status = -1;
-               int pos = 0;
-               
-               for (int i = 0; i < len + 1 && i < length + 1; i++){
-                       if (i >= len){
-                               pos = i;
-                               break;
-                       }
-                       String ch = text.substring(i, i + 1);
-                       
-                       if (ptnAlnum.matcher(ch).matches()){
-                               if (status != 0){
-                                       pos = i;
-                                       status = 0;
-                               }
-                       }
-                       else if (ptnSpace.matcher(ch).matches()){
-                               pos = i;
-                               status = 1;
-                       }
-                       else if (ptnAscii.matcher(ch).matches()){
-                               if (status != 2){
-                                       pos = i;
-                                       status = 2;
-                               }                               
-                       }
-                       else {
-                               pos = i;
-                               status = 3;
-                       }
-               }
-               if (pos == 0){
-                       return text.substring(0, (len < length)? len : length);                 
-               }
-               return text.substring(0, pos);
-       }
-}
diff --git a/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/c6/10cbb6e8686b001115b7b82f2f4ce01a b/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/c6/10cbb6e8686b001115b7b82f2f4ce01a
deleted file mode 100644 (file)
index dd61743..0000000
+++ /dev/null
@@ -1,32 +0,0 @@
-package com.yuji.tdb.db;\r
-\r
-import java.util.List;\r
-\r
-import javax.jdo.PersistenceManager;\r
-\r
-public class TrainDao {\r
-       private static TrainDao instance = null;\r
-       private PersistenceManager pm = PMFactory.get().getPersistenceManager();\r
-\r
-       public static TrainDao getInstance() {\r
-               if (instance == null) {\r
-                       instance = new TrainDao();\r
-               }\r
-               return instance;\r
-       }\r
-\r
-       private TrainDao() {\r
-\r
-       }\r
-\r
-       public List<Train> search() {\r
-               String query = "SELECT FROM " + Train.class.getName();\r
-               List<Train> list = (List<Train>) pm.newQuery(query).execute();\r
-               pm.close();\r
-               return list;\r
-       }\r
-\r
-       public void put(Train train) {\r
-               pm.makePersistent(train);\r
-       }\r
-}\r
diff --git a/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/c8/601fc3751f7200111835fa7adce7cfd2 b/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/c8/601fc3751f7200111835fa7adce7cfd2
new file mode 100644 (file)
index 0000000..ce5557d
--- /dev/null
@@ -0,0 +1,69 @@
+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
diff --git a/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/ca/b0e1f82eee6500111e5bcf098ae37dc9 b/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/ca/b0e1f82eee6500111e5bcf098ae37dc9
deleted file mode 100644 (file)
index 454f1e6..0000000
+++ /dev/null
@@ -1,39 +0,0 @@
-package com.yuji.tdb.db;\r
-\r
-import javax.jdo.PersistenceManager;\r
-\r
-public class KeyValueDao {\r
-       private static final String KEY_CONSUMER_KEY = "CONSUMER_KEY";\r
-       private static final String KEY_CONSUMER_SECRET = "CONSUMER_SECRET";\r
-       private static final String KEY_REQUEST_TOKEN = "REQUEST_TOKEN";\r
-       private static final String KEY_REQUEST_TOKEN_SECRET = "REQUEST_TOKEN_SECRET";\r
-       private static final String KEY_ACCESS_TOKEN = "ACCESS_TOKEN";\r
-       private static final String KEY_ACCESS_TOKEN_SECRET = "ACCESS_TOKEN_SECRET";\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 void put(String key, String value){\r
-               KeyValue keyValue = new KeyValue(key, value);\r
-               pm.makePersistent(keyValue);\r
-       }\r
-}\r
diff --git a/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/cc/c02a7477cc6a0011194396142d5d2649 b/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/cc/c02a7477cc6a0011194396142d5d2649
deleted file mode 100644 (file)
index 06f5089..0000000
+++ /dev/null
@@ -1,38 +0,0 @@
-package com.yuji.tdb.utility;
-
-import java.util.regex.Pattern;
-
-public class StringUtil {
-       private static Pattern ptnAlnum = Pattern.compile("[a-zA-Z0-9]");
-       private static Pattern ptnAscii = Pattern.compile("\\p{ASCII}");
-       
-       public static String parseSubstring(String text, int length){
-               int len = text.length();
-               int status = -1;
-               int pos = 0;
-               
-               for (int i = 0; i < len && i < length; i++){
-                       String ch = text.substring(i, i + 1);
-                       
-                       if (ptnAlnum.matcher(ch).matches()){
-                               if (status != 0){
-                                       pos = i;
-                                       status = 0;
-                               }
-                       }
-                       else if (ptnAscii.matcher(ch).matches()){
-                               if (status != 1){
-                                       pos = i;
-                                       status = 1;
-                               }                               
-                       }
-                       else {
-                               if (status != 2){
-                                       pos = i;
-                                       status = 2;
-                               }                                                               
-                       }
-               }
-               return text.substring(0, pos);
-       }
-}
diff --git a/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/cc/f02011cdcc6a0011194396142d5d2649 b/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/cc/f02011cdcc6a0011194396142d5d2649
deleted file mode 100644 (file)
index 34f01bb..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
-package com.yuji.tdb.utility;
-
-import java.util.regex.Pattern;
-
-public class StringUtil {
-       private static Pattern ptnAlnum = Pattern.compile("[a-zA-Z0-9]");
-       private static Pattern ptnAscii = Pattern.compile("\\p{ASCII}");
-       
-       public static String parseSubstring(String text, int length){
-               int len = text.length();
-               int status = -1;
-               int pos = 0;
-               
-               for (int i = 0; i < len + 1 && i < length + 1; i++){
-                       if (i >= len){
-                               pos = i;
-                               break;
-                       }
-                       String ch = text.substring(i, i + 1);
-                       
-                       if (ptnAlnum.matcher(ch).matches()){
-                               if (status != 0){
-                                       pos = i;
-                                       status = 0;
-                               }
-                       }
-                       else if (ptnAscii.matcher(ch).matches()){
-                               if (status != 1){
-                                       pos = i;
-                                       status = 1;
-                               }                               
-                       }
-                       else {
-                               if (status != 2){
-                                       pos = i;
-                                       status = 2;
-                               }                                                               
-                       }
-               }
-               return text.substring(0, pos);
-       }
-}
diff --git a/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/cf/30140310ce6a0011194396142d5d2649 b/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/cf/30140310ce6a0011194396142d5d2649
deleted file mode 100644 (file)
index 83e6fa9..0000000
+++ /dev/null
@@ -1,43 +0,0 @@
-package com.yuji.tdb.utility;
-
-import java.util.regex.Pattern;
-
-public class StringUtil {
-       private static Pattern ptnAlnum = Pattern.compile("[a-zA-Z0-9]");
-       private static Pattern ptnAscii = Pattern.compile("\\p{ASCII}");
-       
-       public static String parseSubstring(String text, int length){
-               int len = text.length();
-               int status = -1;
-               int pos = 0;
-               
-               for (int i = 0; i < len + 1 && i < length + 1; i++){
-                       if (i >= len){
-                               pos = i;
-                               break;
-                       }
-                       String ch = text.substring(i, i + 1);
-                       
-                       if (ptnAlnum.matcher(ch).matches()){
-                               if (status != 0){
-                                       pos = i;
-                                       status = 0;
-                               }
-                       }
-                       else if (ptnAscii.matcher(ch).matches()){
-                               if (status != 1){
-                                       pos = i;
-                                       status = 1;
-                               }                               
-                       }
-                       else {
-                               pos = i;
-                               status = 2;
-                       }
-               }
-               if (pos == 0){
-                       return text.substring(0, (len < length)? len : length);                 
-               }
-               return text.substring(0, pos);
-       }
-}
diff --git a/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/d0/0090ef6f497000111324ab4fa5fd1a16 b/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/d0/0090ef6f497000111324ab4fa5fd1a16
new file mode 100644 (file)
index 0000000..ed23a22
--- /dev/null
@@ -0,0 +1,9 @@
+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();
+       }
+}
diff --git a/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/d2/70aa19d4cc6a0011194396142d5d2649 b/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/d2/70aa19d4cc6a0011194396142d5d2649
deleted file mode 100644 (file)
index 50c1d9f..0000000
+++ /dev/null
@@ -1,46 +0,0 @@
-package com.yuji.tdb.main;\r
-\r
-import com.yuji.tdb.utility.StringUtil;\r
-\r
-import twitter4j.Status;\r
-import twitter4j.Twitter;\r
-import twitter4j.TwitterException;\r
-import twitter4j.TwitterFactory;\r
-import twitter4j.auth.AccessToken;\r
-import twitter4j.conf.ConfigurationBuilder;\r
-\r
-public class Main {\r
-\r
-       public static void main(String[] args) {\r
-               test1();\r
-       }\r
-       \r
-       public static void test1(){\r
-               String text = "\82 \82¢\82¤\82¦";\r
-               int length = 3;\r
-               String ret = StringUtil.parseSubstring(text, length);\r
-               System.out.println(ret);\r
-       }\r
-\r
-       public static void main() {\r
-               String consumerKey = "";\r
-               String consumerSecret = "";\r
-               String tokenKey = "";\r
-               String tokenSecret = "";\r
-\r
-               try {\r
-                       ConfigurationBuilder confBuilder = new ConfigurationBuilder();\r
-                       confBuilder.setDebugEnabled(true).setOAuthConsumerKey(consumerKey)\r
-                                       .setOAuthConsumerSecret(consumerSecret);\r
-                       TwitterFactory factory = new TwitterFactory(confBuilder.build());\r
-\r
-                       AccessToken accessToken = new AccessToken(tokenKey, tokenSecret);\r
-                       Twitter twitter = factory.getInstance(accessToken);\r
-\r
-                       Status status = twitter.updateStatus("\83e\83X\83g");\r
-               } catch (TwitterException e) {\r
-                       // TODO Auto-generated catch block\r
-                       e.printStackTrace();\r
-               }\r
-       }\r
-}\r
diff --git a/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/d4/0072607dee6500111e5bcf098ae37dc9 b/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/d4/0072607dee6500111e5bcf098ae37dc9
deleted file mode 100644 (file)
index 04b713b..0000000
+++ /dev/null
@@ -1,145 +0,0 @@
-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
-                               \r
-                               dao.put("FOO", "aaa");\r
-                               \r
-                               return;\r
-                       }\r
-\r
-                       String consumerKey = dao.get(KeyValueDao.KEY_CONSUMER_KEY);\r
-                       String consumerSecret = dao.get(KeyValueDao.KEY_CONSUMER_SECRET);\r
-                       if (requestToken == null || CommonUtil.isNull(consumerKey)\r
-                                       || CommonUtil.isNull(consumerSecret)) {\r
-                               log.warning("001");\r
-                               return;\r
-                       }\r
-\r
-                       if (!CommonUtil.isNull(parmResult)) {\r
-                               resultOAuthAuthorization();\r
-                               \r
-                               String value = dao.get("FOO");\r
-                               log.warning("VALUE=" + value);\r
-                               \r
-                               return;\r
-                       }\r
-\r
-                       if (accessToken == null) {\r
-                               log.warning("002");\r
-                               return;\r
-                       }\r
-\r
-                       AccessToken a = new AccessToken(parmResult, parmResult);\r
-                       \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 = 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
-\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() {\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 = twitter.getOAuthAccessToken(requestToken);\r
-               } catch (TwitterException e) {\r
-                       // TODO Auto-generated catch block\r
-                       e.printStackTrace();\r
-                       log.severe(e.toString());\r
-               }\r
-       }\r
-}\r
diff --git a/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/d4/e0dc6685676b001115b7b82f2f4ce01a b/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/d4/e0dc6685676b001115b7b82f2f4ce01a
deleted file mode 100644 (file)
index 81f19fd..0000000
+++ /dev/null
@@ -1,173 +0,0 @@
-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.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.Train;\r
-import com.yuji.tdb.db.TrainDao;\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
-\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
-               //TimeZone.setDefault(TimeZone.getTimeZone("JST")); // TODO \8fê\8f\8a\r
-       }\r
-\r
-       public void main(String consumerKey, String consumerSecret, AccessToken accessToken) {\r
-\r
-               String text = "\8b\9e\95l\93\8c\96k";\r
-\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
-               Calendar cal = Calendar.getInstance();\r
-               Date date = cal.getTime();\r
-               long cur = date.getTime();\r
-               \r
-               Query query = new Query();\r
-               //query.setRpp(1000); // TODO\r
-               query.setQuery(text);\r
-               QueryResult result = twitter.search(query);\r
-               List<Tweet> tweets = result.getTweets();\r
-               \r
-               int count = 0;\r
-               int hit = 0;\r
-               int mhit = 0;\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 - 30 * 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
-                               // \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 = "";\r
-               if (count < 5){\r
-                       message = "\92x\89\84\82È\82µ " + df.format(date);        \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 = sample + " " + df.format(date) + " count=" + count;                                                   \r
-               }\r
-               System.out.println(message); //TODO\r
-               Status status = twitter.updateStatus(message); //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
-                       list.add(train);\r
-                       train = new Train("\93\8c\8aC\93¹\90ü", "\93\8c\8aC\93¹", 5);\r
-                       list.add(train);\r
-                       train = new Train("\8b\9e\95l\8b}\8ds\90ü", "\8b\9e\8b}", 5);\r
-                       list.add(train);\r
-                       \r
-                       for (Train t : list){\r
-                               dao.put(t);\r
-                       }\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
diff --git a/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/d5/a04877b2cc6a0011194396142d5d2649 b/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/d5/a04877b2cc6a0011194396142d5d2649
deleted file mode 100644 (file)
index e432d1c..0000000
+++ /dev/null
@@ -1,46 +0,0 @@
-package com.yuji.tdb.main;\r
-\r
-import com.yuji.tdb.utility.StringUtil;\r
-\r
-import twitter4j.Status;\r
-import twitter4j.Twitter;\r
-import twitter4j.TwitterException;\r
-import twitter4j.TwitterFactory;\r
-import twitter4j.auth.AccessToken;\r
-import twitter4j.conf.ConfigurationBuilder;\r
-\r
-public class Main {\r
-\r
-       public static void main(String[] args) {\r
-               test1();\r
-       }\r
-       \r
-       public static void test1(){\r
-               String text = "ab\82 \82¢\82¤";\r
-               int length = 3;\r
-               String ret = StringUtil.parseSubstring(text, length);\r
-               System.out.println(ret);\r
-       }\r
-\r
-       public static void main() {\r
-               String consumerKey = "";\r
-               String consumerSecret = "";\r
-               String tokenKey = "";\r
-               String tokenSecret = "";\r
-\r
-               try {\r
-                       ConfigurationBuilder confBuilder = new ConfigurationBuilder();\r
-                       confBuilder.setDebugEnabled(true).setOAuthConsumerKey(consumerKey)\r
-                                       .setOAuthConsumerSecret(consumerSecret);\r
-                       TwitterFactory factory = new TwitterFactory(confBuilder.build());\r
-\r
-                       AccessToken accessToken = new AccessToken(tokenKey, tokenSecret);\r
-                       Twitter twitter = factory.getInstance(accessToken);\r
-\r
-                       Status status = twitter.updateStatus("\83e\83X\83g");\r
-               } catch (TwitterException e) {\r
-                       // TODO Auto-generated catch block\r
-                       e.printStackTrace();\r
-               }\r
-       }\r
-}\r
diff --git a/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/d7/20c7a723f06500111e5bcf098ae37dc9 b/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/d7/20c7a723f06500111e5bcf098ae37dc9
deleted file mode 100644 (file)
index e95d27c..0000000
+++ /dev/null
@@ -1,148 +0,0 @@
-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("001");\r
-                               return;\r
-                       }\r
-\r
-                       if (!CommonUtil.isNull(parmResult)) {\r
-                               String requestTokenKey = dao.get(KeyValueDao.KEY_REQUEST_TOKEN);\r
-                               String requestTokenSecret = dao.get(KeyValueDao.KEY_REQUEST_TOKEN_SECRET);\r
-\r
-                               if (CommonUtil.isNull(requestTokenKey)\r
-                                               || CommonUtil.isNull(requestTokenSecret)) {\r
-                                       log.warning("003");\r
-                                       return;                                 \r
-                               }\r
-                               RequestToken requestToken = new RequestToken(requestTokenKey, requestTokenSecret);\r
-                               resultOAuthAuthorization(consumerKey, consumerSecret, requestToken);\r
-                               return;\r
-                       }\r
-\r
-                       if (accessToken == null) {\r
-                               log.warning("003");\r
-                               return;\r
-                       }\r
-\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, value);\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, 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 = twitter.getOAuthAccessToken(requestToken);\r
-               } catch (TwitterException e) {\r
-                       // TODO Auto-generated catch block\r
-                       e.printStackTrace();\r
-                       log.severe(e.toString());\r
-               }\r
-       }\r
-}\r
diff --git a/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/d8/7055126aca6a0011194396142d5d2649 b/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/d8/7055126aca6a0011194396142d5d2649
deleted file mode 100644 (file)
index 382be79..0000000
+++ /dev/null
@@ -1,44 +0,0 @@
-package com.yuji.tdb.main;\r
-\r
-import com.yuji.tdb.utility.StringUtil;\r
-\r
-import twitter4j.Status;\r
-import twitter4j.Twitter;\r
-import twitter4j.TwitterException;\r
-import twitter4j.TwitterFactory;\r
-import twitter4j.auth.AccessToken;\r
-import twitter4j.conf.ConfigurationBuilder;\r
-\r
-public class Main {\r
-\r
-       public static void main(String[] args) {\r
-               test1();\r
-       }\r
-       \r
-       public static test1(){\r
-               int length;\r
-               StringUtil.parseSubstring(text, length);\r
-       }\r
-\r
-       public static void main() {\r
-               String consumerKey = "";\r
-               String consumerSecret = "";\r
-               String tokenKey = "";\r
-               String tokenSecret = "";\r
-\r
-               try {\r
-                       ConfigurationBuilder confBuilder = new ConfigurationBuilder();\r
-                       confBuilder.setDebugEnabled(true).setOAuthConsumerKey(consumerKey)\r
-                                       .setOAuthConsumerSecret(consumerSecret);\r
-                       TwitterFactory factory = new TwitterFactory(confBuilder.build());\r
-\r
-                       AccessToken accessToken = new AccessToken(tokenKey, tokenSecret);\r
-                       Twitter twitter = factory.getInstance(accessToken);\r
-\r
-                       Status status = twitter.updateStatus("\83e\83X\83g");\r
-               } catch (TwitterException e) {\r
-                       // TODO Auto-generated catch block\r
-                       e.printStackTrace();\r
-               }\r
-       }\r
-}\r
diff --git a/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/da/90e917232d7200111835fa7adce7cfd2 b/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/da/90e917232d7200111835fa7adce7cfd2
new file mode 100644 (file)
index 0000000..f6e14b2
--- /dev/null
@@ -0,0 +1,236 @@
+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
diff --git a/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/db/505dd38a307200111835fa7adce7cfd2 b/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/db/505dd38a307200111835fa7adce7cfd2
new file mode 100644 (file)
index 0000000..fa92b75
--- /dev/null
@@ -0,0 +1,238 @@
+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
diff --git a/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/db/e0607deaef6500111e5bcf098ae37dc9 b/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/db/e0607deaef6500111e5bcf098ae37dc9
deleted file mode 100644 (file)
index 3c1433a..0000000
+++ /dev/null
@@ -1,147 +0,0 @@
-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("001");\r
-                               return;\r
-                       }\r
-\r
-                       if (!CommonUtil.isNull(parmResult)) {\r
-                               String requestTokenKey = dao.get(KeyValueDao.KEY_REQUEST_TOKEN);\r
-                               String requestTokenSecret = dao.get(KeyValueDao.KEY_REQUEST_TOKEN_SECRET);\r
-\r
-                               if (CommonUtil.isNull(requestTokenKey)\r
-                                               || CommonUtil.isNull(requestTokenSecret)) {\r
-                                       log.warning("003");\r
-                                       return;                                 \r
-                               }\r
-                               RequestToken requestToken = new RequestToken(requestTokenKey, requestTokenSecret);\r
-                               resultOAuthAuthorization(consumerKey, consumerSecret, requestToken);\r
-                               return;\r
-                       }\r
-\r
-                       if (accessToken == null) {\r
-                               log.warning("003");\r
-                               return;\r
-                       }\r
-\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 = 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
-                       \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, 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 = twitter.getOAuthAccessToken(requestToken);\r
-               } catch (TwitterException e) {\r
-                       // TODO Auto-generated catch block\r
-                       e.printStackTrace();\r
-                       log.severe(e.toString());\r
-               }\r
-       }\r
-}\r
diff --git a/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/e1/e0eff3313c7200111835fa7adce7cfd2 b/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/e1/e0eff3313c7200111835fa7adce7cfd2
new file mode 100644 (file)
index 0000000..56b416e
--- /dev/null
@@ -0,0 +1,240 @@
+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
diff --git a/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/e2/d089c97ece6a0011194396142d5d2649 b/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/e2/d089c97ece6a0011194396142d5d2649
deleted file mode 100644 (file)
index ae71100..0000000
+++ /dev/null
@@ -1,37 +0,0 @@
-package com.yuji.tdb.main;\r
-\r
-public class Main {\r
-\r
-       public static void main(String[] args) {\r
-               test1();\r
-       }\r
-       \r
-       public static void test1(){\r
-               String text = "\82 \82¢\82¤\82¦\82¨";\r
-               int length = 3;\r
-               String ret = StringUtility.parseSubstring(text, length);\r
-               System.out.println(ret);\r
-       }\r
-\r
-       public static void main() {\r
-               String consumerKey = "";\r
-               String consumerSecret = "";\r
-               String tokenKey = "";\r
-               String tokenSecret = "";\r
-\r
-               try {\r
-                       ConfigurationBuilder confBuilder = new ConfigurationBuilder();\r
-                       confBuilder.setDebugEnabled(true).setOAuthConsumerKey(consumerKey)\r
-                                       .setOAuthConsumerSecret(consumerSecret);\r
-                       TwitterFactory factory = new TwitterFactory(confBuilder.build());\r
-\r
-                       AccessToken accessToken = new AccessToken(tokenKey, tokenSecret);\r
-                       Twitter twitter = factory.getInstance(accessToken);\r
-\r
-                       Status status = twitter.updateStatus("\83e\83X\83g");\r
-               } catch (TwitterException e) {\r
-                       // TODO Auto-generated catch block\r
-                       e.printStackTrace();\r
-               }\r
-       }\r
-}\r
diff --git a/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/e3/3032e66b487000111324ab4fa5fd1a16 b/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/e3/3032e66b487000111324ab4fa5fd1a16
new file mode 100644 (file)
index 0000000..f61d0ed
--- /dev/null
@@ -0,0 +1,5 @@
+package com.yuji.tdb;
+
+public class Debug {
+
+}
diff --git a/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/e6/205b432bcd6a0011194396142d5d2649 b/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/e6/205b432bcd6a0011194396142d5d2649
deleted file mode 100644 (file)
index 304bfdc..0000000
+++ /dev/null
@@ -1,40 +0,0 @@
-package com.yuji.tdb.utility;
-
-import java.util.regex.Pattern;
-
-public class StringUtil {
-       private static Pattern ptnAlnum = Pattern.compile("[a-zA-Z0-9]");
-       private static Pattern ptnAscii = Pattern.compile("\\p{ASCII}");
-       
-       public static String parseSubstring(String text, int length){
-               int len = text.length();
-               int status = -1;
-               int pos = 0;
-               
-               for (int i = 0; i < len + 1 && i < length + 1; i++){
-                       if (i >= len){
-                               pos = i;
-                               break;
-                       }
-                       String ch = text.substring(i, i + 1);
-                       
-                       if (ptnAlnum.matcher(ch).matches()){
-                               if (status != 0){
-                                       pos = i;
-                                       status = 0;
-                               }
-                       }
-                       else if (ptnAscii.matcher(ch).matches()){
-                               if (status != 1){
-                                       pos = i;
-                                       status = 1;
-                               }                               
-                       }
-                       else {
-                               pos = i;
-                               status = 2;
-                       }
-               }
-               return text.substring(0, pos);
-       }
-}
diff --git a/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/e6/a04fe410f06500111e5bcf098ae37dc9 b/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/e6/a04fe410f06500111e5bcf098ae37dc9
deleted file mode 100644 (file)
index 0052388..0000000
+++ /dev/null
@@ -1,148 +0,0 @@
-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("001");\r
-                               return;\r
-                       }\r
-\r
-                       if (!CommonUtil.isNull(parmResult)) {\r
-                               String requestTokenKey = dao.get(KeyValueDao.KEY_REQUEST_TOKEN);\r
-                               String requestTokenSecret = dao.get(KeyValueDao.KEY_REQUEST_TOKEN_SECRET);\r
-\r
-                               if (CommonUtil.isNull(requestTokenKey)\r
-                                               || CommonUtil.isNull(requestTokenSecret)) {\r
-                                       log.warning("003");\r
-                                       return;                                 \r
-                               }\r
-                               RequestToken requestToken = new RequestToken(requestTokenKey, requestTokenSecret);\r
-                               resultOAuthAuthorization(consumerKey, consumerSecret, requestToken);\r
-                               return;\r
-                       }\r
-\r
-                       if (accessToken == null) {\r
-                               log.warning("003");\r
-                               return;\r
-                       }\r
-\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
-                       String 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, value);\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, 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 = twitter.getOAuthAccessToken(requestToken);\r
-               } catch (TwitterException e) {\r
-                       // TODO Auto-generated catch block\r
-                       e.printStackTrace();\r
-                       log.severe(e.toString());\r
-               }\r
-       }\r
-}\r
diff --git a/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/e6/c0a38c926d6800111d29ec7e4ac25070 b/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/e6/c0a38c926d6800111d29ec7e4ac25070
deleted file mode 100644 (file)
index 9d447bf..0000000
+++ /dev/null
@@ -1,141 +0,0 @@
-package com.yuji.tdb.twitter;\r
-\r
-import java.util.ArrayList;\r
-import java.util.Calendar;\r
-import java.util.Date;\r
-import java.util.List;\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
-\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
-\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
-\r
-       }\r
-\r
-       public void main(String consumerKey, String consumerSecret, AccessToken accessToken) {\r
-\r
-               String text = "\8b\9e\95l\93\8c\96k";\r
-\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
-                       Calendar cal = Calendar.getInstance();\r
-                       Date date = cal.getTime();\r
-                       long cur = date.getTime();\r
-                       \r
-                       Query query = new Query();\r
-                       query.setRpp(1000); // TODO\r
-                       query.setQuery(text);\r
-                       QueryResult result = twitter.search(query);\r
-                       List<Tweet> tweets = result.getTweets();\r
-                       \r
-                       int count = 0;\r
-                       int hit = 0;\r
-                       int mhit = 0;\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 - 30 * 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
-                                       // \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 = "";\r
-                       if (count < 10){\r
-                               message = "\92x\89\84\82È\82µ " + date.toString();                        \r
-                       }\r
-                       else {\r
-                               int N = 50;\r
-                               \r
-                               String sample = tweets.get(mindex).getText();\r
-                               if (sample.length() > N){\r
-                                       sample = sample.substring(0, N);\r
-                               }\r
-                               sample = CommonUtil.replaceString(sample, "@", "(a)");\r
-                               message = sample + " " + date.toString() + " count=" + count;                                                   \r
-                       }\r
-                       Status status = twitter.updateStatus(message);\r
-               } catch (TwitterException e) {\r
-                       // TODO Auto-generated catch block\r
-                       e.printStackTrace();\r
-                       log.severe(e.toString());\r
-               }\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
diff --git a/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/e7/001bffce2f7200111835fa7adce7cfd2 b/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/e7/001bffce2f7200111835fa7adce7cfd2
new file mode 100644 (file)
index 0000000..7611564
--- /dev/null
@@ -0,0 +1,238 @@
+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
diff --git a/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/e8/10fcce04136b001115b7b82f2f4ce01a b/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/e8/10fcce04136b001115b7b82f2f4ce01a
deleted file mode 100644 (file)
index d183b17..0000000
+++ /dev/null
@@ -1,140 +0,0 @@
-package com.yuji.tdb.twitter;\r
-\r
-import java.util.ArrayList;\r
-import java.util.Calendar;\r
-import java.util.Date;\r
-import java.util.List;\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.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
-\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
-\r
-       }\r
-\r
-       public void main(String consumerKey, String consumerSecret, AccessToken accessToken) {\r
-\r
-               String text = "\8b\9e\95l\93\8c\96k";\r
-\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
-                       Calendar cal = Calendar.getInstance();\r
-                       Date date = cal.getTime();\r
-                       long cur = date.getTime();\r
-                       \r
-                       Query query = new Query();\r
-                       //query.setRpp(1000); // TODO\r
-                       query.setQuery(text);\r
-                       QueryResult result = twitter.search(query);\r
-                       List<Tweet> tweets = result.getTweets();\r
-                       \r
-                       int count = 0;\r
-                       int hit = 0;\r
-                       int mhit = 0;\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 - 30 * 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
-                                       // \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 = "";\r
-                       if (count < 5){\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 = sample + " " + date.toString() + " count=" + count;                                                   \r
-                       }\r
-                       System.out.println(message);//TODO\r
-                       Status status = twitter.updateStatus(message);\r
-               } catch (TwitterException e) {\r
-                       // TODO Auto-generated catch block\r
-                       e.printStackTrace();\r
-                       log.severe(e.toString());\r
-               }\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
diff --git a/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/e9/b04b6ed5ef6500111e5bcf098ae37dc9 b/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/e9/b04b6ed5ef6500111e5bcf098ae37dc9
deleted file mode 100644 (file)
index d9bdd8f..0000000
+++ /dev/null
@@ -1,147 +0,0 @@
-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("001");\r
-                               return;\r
-                       }\r
-\r
-                       if (!CommonUtil.isNull(parmResult)) {\r
-                               String requestTokenKey = dao.get(KeyValueDao.KEY_REQUEST_TOKEN);\r
-                               String requestTokenSecret = dao.get(KeyValueDao.KEY_REQUEST_TOKEN_SECRET);\r
-\r
-                               if (CommonUtil.isNull(requestTokenKey)\r
-                                               || CommonUtil.isNull(requestTokenSecret)) {\r
-                                       log.warning("003");\r
-                                       return;                                 \r
-                               }\r
-                               RequestToken requestToken = new RequestToken(requestTokenKey, requestTokenSecret);\r
-                               resultOAuthAuthorization(consumerKey, consumerSecret. requestToken);\r
-                               return;\r
-                       }\r
-\r
-                       if (accessToken == null) {\r
-                               log.warning("003");\r
-                               return;\r
-                       }\r
-\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 = 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
-                       \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, String consumerSecret) {\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 = twitter.getOAuthAccessToken(requestToken);\r
-               } catch (TwitterException e) {\r
-                       // TODO Auto-generated catch block\r
-                       e.printStackTrace();\r
-                       log.severe(e.toString());\r
-               }\r
-       }\r
-}\r
@@ -20,8 +20,10 @@ import twitter4j.auth.AccessToken;
 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
@@ -31,7 +33,8 @@ public class TwitterUtil {
        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
-\r
+       private int period = 0;\r
+       \r
        public static TwitterUtil getInstance() {\r
                if (instance == null) {\r
                        synchronized (obj) {\r
@@ -70,7 +73,14 @@ public class TwitterUtil {
                Query query = new Query();\r
                //query.setRpp(1000); // TODO\r
                query.setQuery(train.getSearchWord());\r
-               QueryResult result = twitter.search(query);\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
@@ -92,7 +102,7 @@ public class TwitterUtil {
                        \r
                        String message = tweet.getText();\r
                        \r
-                       if (t < cur - 30 * 60 * 1000){\r
+                       if (t < cur - 5 * 60 * 1000){\r
                                System.out.println("\81~" + tweet.getFromUser() + " - "\r
                                                + tweet.getText() + at);\r
                                continue;\r
@@ -116,7 +126,7 @@ public class TwitterUtil {
 \r
                String message = "[" + train.getName() + "] ";\r
                if (count < train.getCount()){\r
-                       message += " " + df.format(date) + " \92x\89\84\82È\82µ"; \r
+                       message += df.format(date) + " \92x\89\84\82È\82µ";       \r
                }\r
                else {\r
                        int N = 100;\r
@@ -124,10 +134,18 @@ public class TwitterUtil {
                        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
+                       message += df.format(date) + " " + sample + " count=" + count;                                                  \r
                }\r
                System.out.println(message); //TODO\r
-               Status status = twitter.updateStatus(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
@@ -168,4 +186,16 @@ public class TwitterUtil {
                }\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
diff --git a/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/eb/b04bd6a30e6b001115b7b82f2f4ce01a b/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/eb/b04bd6a30e6b001115b7b82f2f4ce01a
deleted file mode 100644 (file)
index 0c486e8..0000000
+++ /dev/null
@@ -1,46 +0,0 @@
-package com.yuji.tdb.main;\r
-\r
-import twitter4j.Status;\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.utility.StringUtility;\r
-\r
-public class Main {\r
-\r
-       public static void main(String[] args) {\r
-               test1();\r
-       }\r
-       \r
-       public static void test1(){\r
-               String text = "aa bb cc";\r
-               int length = 5;\r
-               String ret = StringUtility.parseSubstring(text, length);\r
-               System.out.println(ret);\r
-       }\r
-\r
-       public static void main() {\r
-               String consumerKey = "";\r
-               String consumerSecret = "";\r
-               String tokenKey = "";\r
-               String tokenSecret = "";\r
-\r
-               try {\r
-                       ConfigurationBuilder confBuilder = new ConfigurationBuilder();\r
-                       confBuilder.setDebugEnabled(true).setOAuthConsumerKey(consumerKey)\r
-                                       .setOAuthConsumerSecret(consumerSecret);\r
-                       TwitterFactory factory = new TwitterFactory(confBuilder.build());\r
-\r
-                       AccessToken accessToken = new AccessToken(tokenKey, tokenSecret);\r
-                       Twitter twitter = factory.getInstance(accessToken);\r
-\r
-                       Status status = twitter.updateStatus("\83e\83X\83g");\r
-               } catch (TwitterException e) {\r
-                       // TODO Auto-generated catch block\r
-                       e.printStackTrace();\r
-               }\r
-       }\r
-}\r
diff --git a/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/ed/b098d6e3cc6a0011194396142d5d2649 b/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/ed/b098d6e3cc6a0011194396142d5d2649
deleted file mode 100644 (file)
index 4fb89fc..0000000
+++ /dev/null
@@ -1,46 +0,0 @@
-package com.yuji.tdb.main;\r
-\r
-import com.yuji.tdb.utility.StringUtil;\r
-\r
-import twitter4j.Status;\r
-import twitter4j.Twitter;\r
-import twitter4j.TwitterException;\r
-import twitter4j.TwitterFactory;\r
-import twitter4j.auth.AccessToken;\r
-import twitter4j.conf.ConfigurationBuilder;\r
-\r
-public class Main {\r
-\r
-       public static void main(String[] args) {\r
-               test1();\r
-       }\r
-       \r
-       public static void test1(){\r
-               String text = "\82 \82¢a#c";\r
-               int length = 3;\r
-               String ret = StringUtil.parseSubstring(text, length);\r
-               System.out.println(ret);\r
-       }\r
-\r
-       public static void main() {\r
-               String consumerKey = "";\r
-               String consumerSecret = "";\r
-               String tokenKey = "";\r
-               String tokenSecret = "";\r
-\r
-               try {\r
-                       ConfigurationBuilder confBuilder = new ConfigurationBuilder();\r
-                       confBuilder.setDebugEnabled(true).setOAuthConsumerKey(consumerKey)\r
-                                       .setOAuthConsumerSecret(consumerSecret);\r
-                       TwitterFactory factory = new TwitterFactory(confBuilder.build());\r
-\r
-                       AccessToken accessToken = new AccessToken(tokenKey, tokenSecret);\r
-                       Twitter twitter = factory.getInstance(accessToken);\r
-\r
-                       Status status = twitter.updateStatus("\83e\83X\83g");\r
-               } catch (TwitterException e) {\r
-                       // TODO Auto-generated catch block\r
-                       e.printStackTrace();\r
-               }\r
-       }\r
-}\r
diff --git a/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/ee/20690eeecc6a0011194396142d5d2649 b/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/ee/20690eeecc6a0011194396142d5d2649
deleted file mode 100644 (file)
index de357cf..0000000
+++ /dev/null
@@ -1,46 +0,0 @@
-package com.yuji.tdb.main;\r
-\r
-import com.yuji.tdb.utility.StringUtil;\r
-\r
-import twitter4j.Status;\r
-import twitter4j.Twitter;\r
-import twitter4j.TwitterException;\r
-import twitter4j.TwitterFactory;\r
-import twitter4j.auth.AccessToken;\r
-import twitter4j.conf.ConfigurationBuilder;\r
-\r
-public class Main {\r
-\r
-       public static void main(String[] args) {\r
-               test1();\r
-       }\r
-       \r
-       public static void test1(){\r
-               String text = "\82 \82¢ac";\r
-               int length = 3;\r
-               String ret = StringUtil.parseSubstring(text, length);\r
-               System.out.println(ret);\r
-       }\r
-\r
-       public static void main() {\r
-               String consumerKey = "";\r
-               String consumerSecret = "";\r
-               String tokenKey = "";\r
-               String tokenSecret = "";\r
-\r
-               try {\r
-                       ConfigurationBuilder confBuilder = new ConfigurationBuilder();\r
-                       confBuilder.setDebugEnabled(true).setOAuthConsumerKey(consumerKey)\r
-                                       .setOAuthConsumerSecret(consumerSecret);\r
-                       TwitterFactory factory = new TwitterFactory(confBuilder.build());\r
-\r
-                       AccessToken accessToken = new AccessToken(tokenKey, tokenSecret);\r
-                       Twitter twitter = factory.getInstance(accessToken);\r
-\r
-                       Status status = twitter.updateStatus("\83e\83X\83g");\r
-               } catch (TwitterException e) {\r
-                       // TODO Auto-generated catch block\r
-                       e.printStackTrace();\r
-               }\r
-       }\r
-}\r
diff --git a/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/f/c02fa8d7c96a0011194396142d5d2649 b/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/f/c02fa8d7c96a0011194396142d5d2649
deleted file mode 100644 (file)
index 6c5f5b0..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-package com.yuji.tdb.utility;
-
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-public class StringUtil {
-       private static Pattern ptnAlnum = Pattern.compile("[a-zA-Z0-9]");
-       private static Pattern ptnAscii = Pattern.compile("\\p{ASCII}");
-       
-       public static String parseSubstring(String text, int length){
-               int len = text.length();
-               int status = 0;
-               
-               for (int i = 0; i < len && i < length; i++){
-                       String ch = text.substring(i, i + 1);
-                       
-                       if (ptnAlnum.matcher(ch).matches()){
-                               
-                       }
-                       else if (ptnAscii.matcher(ch).matches()){
-                               
-                       }
-                       else {
-                               
-                       }
-               }
-               return null;
-       }
-}
@@ -10,6 +10,8 @@ public class KeyValueDao {
        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
@@ -32,8 +34,34 @@ public class KeyValueDao {
                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
diff --git a/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/f7/109715b4136b001115b7b82f2f4ce01a b/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/f7/109715b4136b001115b7b82f2f4ce01a
deleted file mode 100644 (file)
index 8fd54cb..0000000
+++ /dev/null
@@ -1,144 +0,0 @@
-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.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.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
-\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
-\r
-       }\r
-\r
-       public void main(String consumerKey, String consumerSecret, AccessToken accessToken) {\r
-\r
-               String text = "\8b\9e\95l\93\8c\96k";\r
-\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
-                       Calendar cal = Calendar.getInstance();\r
-                       Date date = cal.getTime();\r
-                       long cur = date.getTime();\r
-                       \r
-                       Query query = new Query();\r
-                       //query.setRpp(1000); // TODO\r
-                       query.setQuery(text);\r
-                       QueryResult result = twitter.search(query);\r
-                       List<Tweet> tweets = result.getTweets();\r
-                       \r
-                       int count = 0;\r
-                       int hit = 0;\r
-                       int mhit = 0;\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 - 30 * 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
-                                       // \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 = "";\r
-                       if (count < 5){\r
-                               message = "\92x\89\84\82È\82µ " + df.format(date);        \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 = sample + " " + date.toString() + " count=" + count;                                                   \r
-                       }\r
-                       System.out.println(message);//TODO\r
-                       Status status = twitter.updateStatus(message);\r
-               } catch (TwitterException e) {\r
-                       // TODO Auto-generated catch block\r
-                       e.printStackTrace();\r
-                       log.severe(e.toString());\r
-               }\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
diff --git a/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/f9/9057bf6570680011170bbf669c61406a b/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/f9/9057bf6570680011170bbf669c61406a
deleted file mode 100644 (file)
index e4a30ac..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-package com.yuji.tdb.utility;
-
-public class StringUtil {
-
-}
diff --git a/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/fb/4023b420ca6a0011194396142d5d2649 b/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/fb/4023b420ca6a0011194396142d5d2649
deleted file mode 100644 (file)
index 251e20c..0000000
+++ /dev/null
@@ -1,43 +0,0 @@
-package com.yuji.tdb.main;\r
-\r
-import com.yuji.tdb.utility.StringUtil;\r
-\r
-import twitter4j.Status;\r
-import twitter4j.Twitter;\r
-import twitter4j.TwitterException;\r
-import twitter4j.TwitterFactory;\r
-import twitter4j.auth.AccessToken;\r
-import twitter4j.conf.ConfigurationBuilder;\r
-\r
-public class Main {\r
-\r
-       public static void main(String[] args) {\r
-               test1();\r
-       }\r
-       \r
-       public static test1(){\r
-               StringUtil.parseSubstring(text, length);\r
-       }\r
-\r
-       public static void main() {\r
-               String consumerKey = "";\r
-               String consumerSecret = "";\r
-               String tokenKey = "";\r
-               String tokenSecret = "";\r
-\r
-               try {\r
-                       ConfigurationBuilder confBuilder = new ConfigurationBuilder();\r
-                       confBuilder.setDebugEnabled(true).setOAuthConsumerKey(consumerKey)\r
-                                       .setOAuthConsumerSecret(consumerSecret);\r
-                       TwitterFactory factory = new TwitterFactory(confBuilder.build());\r
-\r
-                       AccessToken accessToken = new AccessToken(tokenKey, tokenSecret);\r
-                       Twitter twitter = factory.getInstance(accessToken);\r
-\r
-                       Status status = twitter.updateStatus("\83e\83X\83g");\r
-               } catch (TwitterException e) {\r
-                       // TODO Auto-generated catch block\r
-                       e.printStackTrace();\r
-               }\r
-       }\r
-}\r
diff --git a/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/fe/90892eab136b001115b7b82f2f4ce01a b/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/fe/90892eab136b001115b7b82f2f4ce01a
deleted file mode 100644 (file)
index 5b564cd..0000000
+++ /dev/null
@@ -1,144 +0,0 @@
-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.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.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
-\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
-\r
-       }\r
-\r
-       public void main(String consumerKey, String consumerSecret, AccessToken accessToken) {\r
-\r
-               String text = "\8b\9e\95l\93\8c\96k";\r
-\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
-                       Calendar cal = Calendar.getInstance();\r
-                       Date date = cal.getTime();\r
-                       long cur = date.getTime();\r
-                       \r
-                       Query query = new Query();\r
-                       //query.setRpp(1000); // TODO\r
-                       query.setQuery(text);\r
-                       QueryResult result = twitter.search(query);\r
-                       List<Tweet> tweets = result.getTweets();\r
-                       \r
-                       int count = 0;\r
-                       int hit = 0;\r
-                       int mhit = 0;\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 - 30 * 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
-                                       // \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 = "";\r
-                       if (count < 5){\r
-                               message = "\92x\89\84\82È\82µ " + DateFormat.format(date);        \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 = sample + " " + date.toString() + " count=" + count;                                                   \r
-                       }\r
-                       System.out.println(message);//TODO\r
-                       Status status = twitter.updateStatus(message);\r
-               } catch (TwitterException e) {\r
-                       // TODO Auto-generated catch block\r
-                       e.printStackTrace();\r
-                       log.severe(e.toString());\r
-               }\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
diff --git a/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/ff/30ad4fddca6a0011194396142d5d2649 b/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/ff/30ad4fddca6a0011194396142d5d2649
deleted file mode 100644 (file)
index bb56d95..0000000
+++ /dev/null
@@ -1,46 +0,0 @@
-package com.yuji.tdb.main;\r
-\r
-import com.yuji.tdb.utility.StringUtil;\r
-\r
-import twitter4j.Status;\r
-import twitter4j.Twitter;\r
-import twitter4j.TwitterException;\r
-import twitter4j.TwitterFactory;\r
-import twitter4j.auth.AccessToken;\r
-import twitter4j.conf.ConfigurationBuilder;\r
-\r
-public class Main {\r
-\r
-       public static void main(String[] args) {\r
-               test1();\r
-       }\r
-       \r
-       public static void test1(){\r
-               String text = "ab#\82 \82¢\82¤";\r
-               int length = 3;\r
-               String ret = StringUtil.parseSubstring(text, length);\r
-               System.out.println(ret);\r
-       }\r
-\r
-       public static void main() {\r
-               String consumerKey = "";\r
-               String consumerSecret = "";\r
-               String tokenKey = "";\r
-               String tokenSecret = "";\r
-\r
-               try {\r
-                       ConfigurationBuilder confBuilder = new ConfigurationBuilder();\r
-                       confBuilder.setDebugEnabled(true).setOAuthConsumerKey(consumerKey)\r
-                                       .setOAuthConsumerSecret(consumerSecret);\r
-                       TwitterFactory factory = new TwitterFactory(confBuilder.build());\r
-\r
-                       AccessToken accessToken = new AccessToken(tokenKey, tokenSecret);\r
-                       Twitter twitter = factory.getInstance(accessToken);\r
-\r
-                       Status status = twitter.updateStatus("\83e\83X\83g");\r
-               } catch (TwitterException e) {\r
-                       // TODO Auto-generated catch block\r
-                       e.printStackTrace();\r
-               }\r
-       }\r
-}\r
diff --git a/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/ff/80d48880676b001115b7b82f2f4ce01a b/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/ff/80d48880676b001115b7b82f2f4ce01a
deleted file mode 100644 (file)
index a09f8bc..0000000
+++ /dev/null
@@ -1,170 +0,0 @@
-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.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.Train;\r
-import com.yuji.tdb.db.TrainDao;\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
-\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
-               //TimeZone.setDefault(TimeZone.getTimeZone("JST")); // TODO \8fê\8f\8a\r
-       }\r
-\r
-       public void main(String consumerKey, String consumerSecret, AccessToken accessToken) {\r
-\r
-               String text = "\8b\9e\95l\93\8c\96k";\r
-\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
-                       twite(text, twitter);\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(String text, Twitter twitter) throws TwitterException {\r
-               Calendar cal = Calendar.getInstance();\r
-               Date date = cal.getTime();\r
-               long cur = date.getTime();\r
-               \r
-               Query query = new Query();\r
-               //query.setRpp(1000); // TODO\r
-               query.setQuery(text);\r
-               QueryResult result = twitter.search(query);\r
-               List<Tweet> tweets = result.getTweets();\r
-               \r
-               int count = 0;\r
-               int hit = 0;\r
-               int mhit = 0;\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 - 30 * 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
-                               // \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 = "";\r
-               if (count < 5){\r
-                       message = "\92x\89\84\82È\82µ " + df.format(date);        \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 = sample + " " + df.format(date) + " count=" + count;                                                   \r
-               }\r
-               System.out.println(message); //TODO\r
-               Status status = twitter.updateStatus(message); //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
-                       list.add(train);\r
-                       train = new Train("\93\8c\8aC\93¹\90ü", "\93\8c\8aC\93¹", 5);\r
-                       list.add(train);\r
-                       train = new Train("\8b\9e\95l\8b}\8ds\90ü", "\8b\9e\8b}", 5);\r
-                       list.add(train);\r
-                       \r
-                       for (Train t : list){\r
-                               dao.put(t);\r
-                       }\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
diff --git a/workspace/.metadata/.plugins/org.eclipse.core.resources/.projects/Test/.markers.snap b/workspace/.metadata/.plugins/org.eclipse.core.resources/.projects/Test/.markers.snap
deleted file mode 100644 (file)
index 1253ec8..0000000
Binary files a/workspace/.metadata/.plugins/org.eclipse.core.resources/.projects/Test/.markers.snap and /dev/null differ
diff --git a/workspace/.metadata/.plugins/org.eclipse.core.resources/.projects/Test/.syncinfo.snap b/workspace/.metadata/.plugins/org.eclipse.core.resources/.projects/Test/.syncinfo.snap
deleted file mode 100644 (file)
index 1253ec8..0000000
Binary files a/workspace/.metadata/.plugins/org.eclipse.core.resources/.projects/Test/.syncinfo.snap and /dev/null differ
diff --git a/workspace/.metadata/.plugins/org.eclipse.core.resources/.projects/TrainDelayBot/.indexes/e4/81/5b/f2/53/history.index b/workspace/.metadata/.plugins/org.eclipse.core.resources/.projects/TrainDelayBot/.indexes/e4/81/5b/f2/53/history.index
new file mode 100644 (file)
index 0000000..d8cc4fa
Binary files /dev/null and b/workspace/.metadata/.plugins/org.eclipse.core.resources/.projects/TrainDelayBot/.indexes/e4/81/5b/f2/53/history.index differ
index 3671ac6..898a0a1 100644 (file)
Binary files a/workspace/.metadata/.plugins/org.eclipse.core.resources/.projects/TrainDelayBot/.indexes/e4/81/5b/f2/7e/history.index and b/workspace/.metadata/.plugins/org.eclipse.core.resources/.projects/TrainDelayBot/.indexes/e4/81/5b/f2/7e/history.index differ
index 79efa42..ce21067 100644 (file)
Binary files a/workspace/.metadata/.plugins/org.eclipse.core.resources/.projects/TrainDelayBot/.indexes/e4/81/5b/f2/8d/history.index and b/workspace/.metadata/.plugins/org.eclipse.core.resources/.projects/TrainDelayBot/.indexes/e4/81/5b/f2/8d/history.index differ
diff --git a/workspace/.metadata/.plugins/org.eclipse.core.resources/.projects/TrainDelayBot/.indexes/e4/81/5b/f2/94/history.index b/workspace/.metadata/.plugins/org.eclipse.core.resources/.projects/TrainDelayBot/.indexes/e4/81/5b/f2/94/history.index
deleted file mode 100644 (file)
index 0e41211..0000000
Binary files a/workspace/.metadata/.plugins/org.eclipse.core.resources/.projects/TrainDelayBot/.indexes/e4/81/5b/f2/94/history.index and /dev/null differ
diff --git a/workspace/.metadata/.plugins/org.eclipse.core.resources/.projects/TrainDelayBot/.indexes/e4/81/5b/f2/b9/history.index b/workspace/.metadata/.plugins/org.eclipse.core.resources/.projects/TrainDelayBot/.indexes/e4/81/5b/f2/b9/history.index
deleted file mode 100644 (file)
index 0d94216..0000000
Binary files a/workspace/.metadata/.plugins/org.eclipse.core.resources/.projects/TrainDelayBot/.indexes/e4/81/5b/f2/b9/history.index and /dev/null differ
index b30d7b0..797d0ef 100644 (file)
Binary files a/workspace/.metadata/.plugins/org.eclipse.core.resources/.projects/TrainDelayBot/.indexes/e4/81/5b/f2/history.index and b/workspace/.metadata/.plugins/org.eclipse.core.resources/.projects/TrainDelayBot/.indexes/e4/81/5b/f2/history.index differ
index 451abdc..3d6101c 100644 (file)
Binary files a/workspace/.metadata/.plugins/org.eclipse.core.resources/.projects/TrainDelayBot/.indexes/properties.index and b/workspace/.metadata/.plugins/org.eclipse.core.resources/.projects/TrainDelayBot/.indexes/properties.index differ
index 5421481..c594af5 100644 (file)
Binary files a/workspace/.metadata/.plugins/org.eclipse.core.resources/.projects/TrainDelayBot/.markers and b/workspace/.metadata/.plugins/org.eclipse.core.resources/.projects/TrainDelayBot/.markers differ
diff --git a/workspace/.metadata/.plugins/org.eclipse.core.resources/.projects/TrainDelayBot/.markers.snap b/workspace/.metadata/.plugins/org.eclipse.core.resources/.projects/TrainDelayBot/.markers.snap
deleted file mode 100644 (file)
index 1211b93..0000000
Binary files a/workspace/.metadata/.plugins/org.eclipse.core.resources/.projects/TrainDelayBot/.markers.snap and /dev/null differ
diff --git a/workspace/.metadata/.plugins/org.eclipse.core.resources/.projects/TrainDelayBot/.syncinfo.snap b/workspace/.metadata/.plugins/org.eclipse.core.resources/.projects/TrainDelayBot/.syncinfo.snap
deleted file mode 100644 (file)
index 1253ec8..0000000
Binary files a/workspace/.metadata/.plugins/org.eclipse.core.resources/.projects/TrainDelayBot/.syncinfo.snap and /dev/null differ
diff --git a/workspace/.metadata/.plugins/org.eclipse.core.resources/.projects/TrainDelayBot/org.eclipse.jdt.core/state.dat b/workspace/.metadata/.plugins/org.eclipse.core.resources/.projects/TrainDelayBot/org.eclipse.jdt.core/state.dat
new file mode 100644 (file)
index 0000000..a53b559
Binary files /dev/null and b/workspace/.metadata/.plugins/org.eclipse.core.resources/.projects/TrainDelayBot/org.eclipse.jdt.core/state.dat differ
diff --git a/workspace/.metadata/.plugins/org.eclipse.core.resources/.root/.markers.snap b/workspace/.metadata/.plugins/org.eclipse.core.resources/.root/.markers.snap
deleted file mode 100644 (file)
index 8cc51e1..0000000
Binary files a/workspace/.metadata/.plugins/org.eclipse.core.resources/.root/.markers.snap and /dev/null differ
similarity index 71%
rename from workspace/.metadata/.plugins/org.eclipse.core.resources/.root/19.tree
rename to workspace/.metadata/.plugins/org.eclipse.core.resources/.root/22.tree
index b0389fb..bab750f 100644 (file)
Binary files a/workspace/.metadata/.plugins/org.eclipse.core.resources/.root/19.tree and b/workspace/.metadata/.plugins/org.eclipse.core.resources/.root/22.tree differ
index 8b50b3d..d651b0d 100644 (file)
Binary files a/workspace/.metadata/.plugins/org.eclipse.core.resources/.safetable/org.eclipse.core.resources and b/workspace/.metadata/.plugins/org.eclipse.core.resources/.safetable/org.eclipse.core.resources differ
diff --git a/workspace/.metadata/.plugins/org.eclipse.core.resources/.snap b/workspace/.metadata/.plugins/org.eclipse.core.resources/.snap
deleted file mode 100644 (file)
index 5893e32..0000000
Binary files a/workspace/.metadata/.plugins/org.eclipse.core.resources/.snap and /dev/null differ
index 44951cc..ea6fd16 100644 (file)
 what,kind,bundleId,bundleVersion,description,time
-started,bundle,org.eclipse.ltk.core.refactoring,3.5.200.v20110505-0800,"org.eclipse.ltk.core.refactoring",1331394654598
-started,bundle,org.eclipse.ltk.ui.refactoring,3.6.0.v20110505-0800,"org.eclipse.ltk.ui.refactoring",1331394654598
-started,bundle,org.eclipse.m2e.logback.configuration,1.0.0.20110607-2117,"org.eclipse.m2e.logback.configuration",1331394654598
-started,bundle,org.eclipse.mylyn.bugzilla.core,3.6.0.v20110608-1400,"org.eclipse.mylyn.bugzilla.core",1331394654598
-started,bundle,org.eclipse.mylyn.bugzilla.ui,3.6.0.v20110608-1400,"org.eclipse.mylyn.bugzilla.ui",1331394654598
-started,bundle,org.eclipse.mylyn.commons.identity,0.8.0.v20110608-1400,"org.eclipse.mylyn.commons.identity",1331394654598
-started,bundle,org.eclipse.mylyn.commons.net,3.6.0.v20110608-1400,"org.eclipse.mylyn.commons.net",1331394654598
-started,bundle,org.eclipse.mylyn.context.core,3.6.0.v20110608-1400,"org.eclipse.mylyn.context.core",1331394654598
-started,bundle,org.eclipse.mylyn.context.ui,3.6.0.v20110608-1400,"org.eclipse.mylyn.context.ui",1331394654598
-started,bundle,org.eclipse.mylyn.monitor.ui,3.6.0.v20110608-1400,"org.eclipse.mylyn.monitor.ui",1331394654598
-started,bundle,org.eclipse.mylyn.tasks.ui,3.6.0.v20110608-1400,"org.eclipse.mylyn.tasks.ui",1331394654598
-started,bundle,org.eclipse.mylyn.team.ui,3.6.0.v20110608-1400,"org.eclipse.mylyn.team.ui",1331394654598
-started,bundle,org.eclipse.search,3.7.0.v20110505-0800,"org.eclipse.search",1331394654598
-started,bundle,org.eclipse.team.core,3.6.0.I20110525-0800,"org.eclipse.team.core",1331394654598
-started,bundle,org.eclipse.team.cvs.core,3.3.400.I20110510-0800,"org.eclipse.team.cvs.core",1331394654598
-started,bundle,org.eclipse.team.cvs.ui,3.3.400.I20110510-0800,"org.eclipse.team.cvs.ui",1331394654598
-started,bundle,org.eclipse.team.ui,3.6.100.I20110525-0800,"org.eclipse.team.ui",1331394654598
-started,bundle,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui",1331394654598
-started,bundle,org.eclipse.ui.console,3.5.100.v20110511,"org.eclipse.ui.console",1331394654598
-started,bundle,org.eclipse.ui.editors,3.7.0.v20110517-0800,"org.eclipse.ui.editors",1331394654598
-started,bundle,org.eclipse.ui.forms,3.5.100.v20110425,"org.eclipse.ui.forms",1331394654598
-started,bundle,org.eclipse.ui.ide,3.7.0.I20110519-0100,"org.eclipse.ui.ide",1331394654598
-started,bundle,org.eclipse.ui.net,1.2.100.I20110511-0800,"org.eclipse.ui.net",1331394654599
-started,bundle,org.eclipse.ui.views,3.6.0.I20110412-0800,"org.eclipse.ui.views",1331394654599
-started,bundle,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"org.eclipse.ui.workbench",1331394654599
-started,bundle,org.eclipse.ui.workbench.texteditor,3.7.0.v20110505-0800,"org.eclipse.ui.workbench.texteditor",1331394654599
-started,bundle,org.eclipse.update.configurator,3.3.100.v20100512,"org.eclipse.update.configurator",1331394654599
-started,bundle,org.eclipse.update.core,3.2.500.v20110330,"org.eclipse.update.core",1331394654599
-started,bundle,com.google.appengine.eclipse.core,2.5.2.v201202290255-rel-r37,"com.google.appengine.eclipse.core",1331394654599
-started,bundle,com.google.gdt.eclipse.appengine.rpc,2.5.2.v201202290255-rel-r37,"com.google.gdt.eclipse.appengine.rpc",1331394654599
-started,bundle,com.google.gdt.eclipse.core,2.5.2.v201202290255-rel-r37,"com.google.gdt.eclipse.core",1331394654599
-started,bundle,com.google.gdt.eclipse.designer,2.5.0.r37x201112291029,"com.google.gdt.eclipse.designer",1331394654599
-started,bundle,com.google.gdt.eclipse.login,2.5.2.v201202290255-rel-r37,"com.google.gdt.eclipse.login",1331394654599
-started,bundle,com.google.gdt.eclipse.managedapis,2.5.2.v201202290255-rel-r37,"com.google.gdt.eclipse.managedapis",1331394654599
-started,bundle,com.google.gdt.eclipse.maven,2.5.2.v201202290255-rel-r37,"com.google.gdt.eclipse.maven",1331394654599
-started,bundle,com.google.gdt.eclipse.platform.e37,2.5.2.v201202290255-rel-r37,"com.google.gdt.eclipse.platform.e37",1331394654599
-started,bundle,com.google.gdt.eclipse.platform.shared,2.5.2.v201202290255-rel-r37,"com.google.gdt.eclipse.platform.shared",1331394654599
-started,bundle,com.google.gdt.eclipse.suite,2.5.2.v201202290255-rel-r37,"com.google.gdt.eclipse.suite",1331394654599
-started,bundle,com.google.gdt.eclipse.suite.ext,2.5.2.v201202290255-rel-r37,"com.google.gdt.eclipse.suite.ext",1331394654599
-started,bundle,com.google.gwt.eclipse.core,2.5.2.v201202290255-rel-r37,"com.google.gwt.eclipse.core",1331394654599
-started,bundle,org.eclipse.mylyn.commons.ui,3.6.1.v20110720-0100,"org.eclipse.mylyn.commons.ui",1331394654599
-started,bundle,org.eclipse.wb.core,1.2.0.r37x201112290923,"org.eclipse.wb.core",1331394654599
-started,bundle,org.eclipse.wb.core.lib,1.2.0.r37x201112290923,"org.eclipse.wb.core.lib",1331394654599
-os,sysinfo,,,"macosx",1331394654601
-arch,sysinfo,,,"x86_64",1331394654601
-ws,sysinfo,,,"cocoa",1331394654601
-locale,sysinfo,,,"ja_JP",1331394654601
-processors,sysinfo,,,"8",1331394654601
-java.runtime.name,sysinfo,,,"Java(TM) SE Runtime Environment",1331394654601
-java.runtime.version,sysinfo,,,"1.6.0_29-b11-402-11D50d",1331394654601
-java.specification.name,sysinfo,,,"Java Platform API Specification",1331394654601
-java.specification.vendor,sysinfo,,,"Sun Microsystems Inc.",1331394654601
-java.specification.version,sysinfo,,,"1.6",1331394654601
-java.vendor,sysinfo,,,"Apple Inc.",1331394654601
-java.version,sysinfo,,,"1.6.0_29",1331394654601
-java.vm.info,sysinfo,,,"mixed mode",1331394654601
-java.vm.name,sysinfo,,,"Java HotSpot(TM) 64-Bit Server VM",1331394654601
-java.vm.specification.name,sysinfo,,,"Java Virtual Machine Specification",1331394654601
-java.vm.specification.vendor,sysinfo,,,"Sun Microsystems Inc.",1331394654601
-java.vm.specification.version,sysinfo,,,"1.0",1331394654601
-java.vm.vendor,sysinfo,,,"Apple Inc.",1331394654601
-java.vm.version,sysinfo,,,"20.4-b02-402",1331394654601
-started,bundle,org.eclipse.m2e.usagedata,1.0.200.20111228-1245,"org.eclipse.m2e.usagedata",1331394654603
-started,bundle,org.eclipse.update.scheduler,3.2.300.v20100512,"org.eclipse.update.scheduler",1331394654641
-started,bundle,org.eclipse.wb.discovery.core,1.0.0.r37x201106081733,"org.eclipse.wb.discovery.core",1331394654729
-started,bundle,org.eclipse.epp.usagedata.ui,1.3.1.R201106061540,"org.eclipse.epp.usagedata.ui",1331394655988
-started,bundle,org.eclipse.wb.discovery.ui,1.0.0.r37x201106081733,"org.eclipse.wb.discovery.ui",1331394656290
-started,bundle,com.google.gdt.eclipse.designer.hosted,2.5.0.r37x201112291019,"com.google.gdt.eclipse.designer.hosted",1331394656621
-started,bundle,com.google.gdt.eclipse.designer.UiBinder,2.5.0.r37x201112291029,"com.google.gdt.eclipse.designer.UiBinder",1331394656695
-deactivated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1331394656935
-started,bundle,org.eclipse.debug.ui,3.7.0.v20110518,"org.eclipse.debug.ui",1331394656982
-opened,view,org.eclipse.ui.ide,3.7.0.I20110519-0100,"org.eclipse.ui.views.ProblemView",1331394657588
-started,bundle,org.eclipse.jdt.debug,3.7.0.v20110509,"org.eclipse.jdt.debug",1331394658298
-started,bundle,org.eclipse.jdt.debug.ui,3.6.0.v20110512,"org.eclipse.jdt.debug.ui",1331394658789
-activated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1331394680741
-deactivated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1331394771216
-activated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1331394991984
-executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.edit.copy",1331395052189
-executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.edit.paste",1331395053101
-executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.edit.copy",1331395063274
-executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.edit.paste",1331395064755
-started,bundle,org.eclipse.mylyn.ide.ui,3.6.0.v20110608-1400,"org.eclipse.mylyn.ide.ui",1331395083057
-started,bundle,org.eclipse.mylyn.java.ui,3.6.0.v20110608-1400,"org.eclipse.mylyn.java.ui",1331395083093
-executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.file.save",1331395093822
-executed,command,org.eclipse.jdt.ui,3.7.0.v20110531-1200,"org.eclipse.jdt.ui.edit.text.java.organize.imports",1331395122984
-executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.file.save",1331395123890
-executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.edit.copy",1331395132031
-started,bundle,org.eclipse.mylyn.java.tasks,3.6.0.v20110608-1400,"org.eclipse.mylyn.java.tasks",1331395132264
-activated,view,org.eclipse.jdt.ui,3.7.0.v20110531-1200,"org.eclipse.jdt.ui.PackageExplorer",1331395137674
-opened,editor,org.eclipse.jdt.ui,3.7.0.v20110531-1200,"org.eclipse.jdt.ui.CompilationUnitEditor",1331395143385
-activated,editor,org.eclipse.jdt.ui,3.7.0.v20110531-1200,"org.eclipse.jdt.ui.CompilationUnitEditor",1331395143478
-executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.edit.paste",1331395169860
-executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.edit.copy",1331395174994
-executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.edit.paste",1331395176825
-executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.file.save",1331395208185
-executed,command,org.eclipse.ui.ide,3.7.0.I20110519-0100,"org.eclipse.jdt.ui.edit.text.java.correction.assist.proposals",1331395209536
-executed,command,org.eclipse.ui.ide,3.7.0.I20110519-0100,"org.eclipse.jdt.ui.edit.text.java.correction.assist.proposals",1331395213901
-executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.file.save",1331395216257
-executed,command,org.eclipse.ui.ide,3.7.0.I20110519-0100,"org.eclipse.jdt.ui.edit.text.java.correction.assist.proposals",1331395218622
-executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.edit.cut",1331395222027
-executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.edit.paste",1331395222636
-executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.file.save",1331395339681
-executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.file.save",1331395348308
-executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.file.save",1331395378234
-started,bundle,org.eclipse.m2e.launching,1.0.200.20111228-1245,"org.eclipse.m2e.launching",1331395409107
-activated,editor,org.eclipse.jdt.ui,3.7.0.v20110531-1200,"org.eclipse.jdt.ui.CompilationUnitEditor",1331395428271
-executed,command,,,"AUTOGEN:::org.eclipse.jdt.internal.ui.CompilationUnitEditor.ruler.actions/org.eclipse.jdt.internal.ui.javaeditor.JavaSelectRulerAction",1331395443990
-executed,command,,,"AUTOGEN:::org.eclipse.jdt.debug.CompilationUnitEditor.BreakpointRulerActions/org.eclipse.jdt.debug.ui.actions.ManageBreakpointRulerAction",1331395443997
-activated,view,org.eclipse.ui.console,3.5.100.v20110511,"org.eclipse.ui.console.ConsoleView",1331395455645
-opened,view,org.eclipse.debug.ui,3.7.0.v20110518,"org.eclipse.debug.ui.DebugView",1331395460292
-activated,view,org.eclipse.debug.ui,3.7.0.v20110518,"org.eclipse.debug.ui.DebugView",1331395460311
-executed,command,org.eclipse.debug.ui,3.7.0.v20110518,"org.eclipse.debug.ui.commands.StepOver",1331395484626
-executed,command,org.eclipse.debug.ui,3.7.0.v20110518,"org.eclipse.debug.ui.commands.StepOver",1331395485416
-executed,command,org.eclipse.debug.ui,3.7.0.v20110518,"org.eclipse.debug.ui.commands.StepOver",1331395486008
-executed,command,org.eclipse.debug.ui,3.7.0.v20110518,"org.eclipse.debug.ui.commands.StepOver",1331395487200
-executed,command,org.eclipse.debug.ui,3.7.0.v20110518,"org.eclipse.debug.ui.commands.StepOver",1331395489488
-executed,command,org.eclipse.debug.ui,3.7.0.v20110518,"org.eclipse.debug.ui.commands.StepOver",1331395491528
-executed,command,org.eclipse.debug.ui,3.7.0.v20110518,"org.eclipse.debug.ui.commands.StepOver",1331395492632
-executed,command,org.eclipse.debug.ui,3.7.0.v20110518,"org.eclipse.debug.ui.commands.StepOver",1331395493104
-executed,command,org.eclipse.debug.ui,3.7.0.v20110518,"org.eclipse.debug.ui.commands.StepOver",1331395493552
-executed,command,org.eclipse.debug.ui,3.7.0.v20110518,"org.eclipse.debug.ui.commands.StepOver",1331395494072
-executed,command,org.eclipse.debug.ui,3.7.0.v20110518,"org.eclipse.debug.ui.commands.StepOver",1331395494936
-executed,command,org.eclipse.debug.ui,3.7.0.v20110518,"org.eclipse.debug.ui.commands.StepOver",1331395495439
-executed,command,org.eclipse.debug.ui,3.7.0.v20110518,"org.eclipse.debug.ui.commands.StepOver",1331395495936
-executed,command,org.eclipse.debug.ui,3.7.0.v20110518,"org.eclipse.debug.ui.commands.StepOver",1331395497592
-executed,command,org.eclipse.debug.ui,3.7.0.v20110518,"org.eclipse.debug.ui.commands.StepOver",1331395499160
-executed,command,org.eclipse.debug.ui,3.7.0.v20110518,"org.eclipse.debug.ui.commands.StepOver",1331395500488
-executed,command,org.eclipse.debug.ui,3.7.0.v20110518,"org.eclipse.debug.ui.commands.StepOver",1331395501136
-executed,command,org.eclipse.debug.ui,3.7.0.v20110518,"org.eclipse.debug.ui.commands.StepOver",1331395501728
-executed,command,org.eclipse.debug.ui,3.7.0.v20110518,"org.eclipse.debug.ui.commands.Resume",1331395505842
-activated,view,org.eclipse.ui.console,3.5.100.v20110511,"org.eclipse.ui.console.ConsoleView",1331395506281
-activated,editor,org.eclipse.jdt.ui,3.7.0.v20110531-1200,"org.eclipse.jdt.ui.CompilationUnitEditor",1331395508346
-executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.file.save",1331395512542
-executed,command,org.eclipse.debug.ui,3.7.0.v20110518,"org.eclipse.debug.ui.commands.StepInto",1331395520476
-executed,command,,,"AUTOGEN:::org.eclipse.jdt.debug.CompilationUnitEditor.BreakpointRulerActions/org.eclipse.jdt.debug.ui.actions.ManageBreakpointRulerAction",1331395523521
-executed,command,org.eclipse.debug.ui,3.7.0.v20110518,"org.eclipse.debug.ui.commands.Resume",1331395525283
-activated,editor,org.eclipse.jdt.ui,3.7.0.v20110531-1200,"org.eclipse.jdt.ui.CompilationUnitEditor",1331395529161
-executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.file.save",1331395532862
-executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.file.save",1331395546434
-activated,editor,org.eclipse.jdt.ui,3.7.0.v20110531-1200,"org.eclipse.jdt.ui.CompilationUnitEditor",1331395566652
-executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.file.save",1331395572642
-activated,editor,org.eclipse.jdt.ui,3.7.0.v20110531-1200,"org.eclipse.jdt.ui.CompilationUnitEditor",1331395574458
-activated,editor,org.eclipse.jdt.ui,3.7.0.v20110531-1200,"org.eclipse.jdt.ui.CompilationUnitEditor",1331395624899
-activated,editor,org.eclipse.jdt.ui,3.7.0.v20110531-1200,"org.eclipse.jdt.ui.CompilationUnitEditor",1331395671633
-executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.file.save",1331395676737
-activated,editor,org.eclipse.jdt.ui,3.7.0.v20110531-1200,"org.eclipse.jdt.ui.CompilationUnitEditor",1331395678828
-executed,command,,,"AUTOGEN:::org.eclipse.jdt.debug.CompilationUnitEditor.BreakpointRulerActions/org.eclipse.jdt.debug.ui.actions.ManageBreakpointRulerAction",1331395681497
-executed,command,org.eclipse.debug.ui,3.7.0.v20110518,"org.eclipse.debug.ui.commands.Resume",1331395706945
-executed,command,org.eclipse.debug.ui,3.7.0.v20110518,"org.eclipse.debug.ui.commands.StepOver",1331395709040
-executed,command,org.eclipse.debug.ui,3.7.0.v20110518,"org.eclipse.debug.ui.commands.StepOver",1331395709632
-executed,command,org.eclipse.debug.ui,3.7.0.v20110518,"org.eclipse.debug.ui.commands.StepOver",1331395710064
-executed,command,org.eclipse.debug.ui,3.7.0.v20110518,"org.eclipse.debug.ui.commands.StepOver",1331395710688
-executed,command,org.eclipse.debug.ui,3.7.0.v20110518,"org.eclipse.debug.ui.commands.StepOver",1331395713208
-executed,command,org.eclipse.debug.ui,3.7.0.v20110518,"org.eclipse.debug.ui.commands.StepOver",1331395713784
-executed,command,org.eclipse.debug.ui,3.7.0.v20110518,"org.eclipse.debug.ui.commands.StepOver",1331395714320
-executed,command,org.eclipse.debug.ui,3.7.0.v20110518,"org.eclipse.debug.ui.commands.StepOver",1331395716288
-executed,command,org.eclipse.debug.ui,3.7.0.v20110518,"org.eclipse.debug.ui.commands.StepOver",1331395719400
-executed,command,org.eclipse.debug.ui,3.7.0.v20110518,"org.eclipse.debug.ui.commands.StepOver",1331395720312
-executed,command,org.eclipse.debug.ui,3.7.0.v20110518,"org.eclipse.debug.ui.commands.StepOver",1331395725990
-executed,command,org.eclipse.debug.ui,3.7.0.v20110518,"org.eclipse.debug.ui.commands.StepOver",1331395726663
-opened,view,org.eclipse.jdt.ui,3.7.0.v20110531-1200,"org.eclipse.jdt.ui.TypeHierarchy",1331395736597
-activated,view,org.eclipse.jdt.ui,3.7.0.v20110531-1200,"org.eclipse.jdt.ui.TypeHierarchy",1331395736624
-executed,command,org.eclipse.jdt.ui,3.7.0.v20110531-1200,"org.eclipse.jdt.ui.edit.text.java.open.type.hierarchy",1331395736673
-executed,command,org.eclipse.debug.ui,3.7.0.v20110518,"org.eclipse.debug.ui.commands.Resume",1331395739538
-executed,command,org.eclipse.debug.ui,3.7.0.v20110518,"org.eclipse.debug.ui.commands.StepOver",1331395805294
-executed,command,org.eclipse.debug.ui,3.7.0.v20110518,"org.eclipse.debug.ui.commands.StepOver",1331395806309
-executed,command,org.eclipse.debug.ui,3.7.0.v20110518,"org.eclipse.debug.ui.commands.StepOver",1331395811253
-executed,command,org.eclipse.debug.ui,3.7.0.v20110518,"org.eclipse.debug.ui.commands.StepOver",1331395812893
-executed,command,org.eclipse.debug.ui,3.7.0.v20110518,"org.eclipse.debug.ui.commands.StepOver",1331395814053
-executed,command,org.eclipse.debug.ui,3.7.0.v20110518,"org.eclipse.debug.ui.commands.StepOver",1331395820572
-executed,command,org.eclipse.debug.ui,3.7.0.v20110518,"org.eclipse.debug.ui.commands.StepOver",1331395821140
-executed,command,org.eclipse.debug.ui,3.7.0.v20110518,"org.eclipse.debug.ui.commands.StepOver",1331395822756
-executed,command,org.eclipse.debug.ui,3.7.0.v20110518,"org.eclipse.debug.ui.commands.StepOver",1331395825452
-executed,command,org.eclipse.debug.ui,3.7.0.v20110518,"org.eclipse.debug.ui.commands.StepOver",1331395826628
-executed,command,org.eclipse.debug.ui,3.7.0.v20110518,"org.eclipse.debug.ui.commands.StepOver",1331395829692
-executed,command,org.eclipse.debug.ui,3.7.0.v20110518,"org.eclipse.debug.ui.commands.StepOver",1331395830224
-executed,command,org.eclipse.debug.ui,3.7.0.v20110518,"org.eclipse.debug.ui.commands.StepOver",1331395838996
-executed,command,org.eclipse.debug.ui,3.7.0.v20110518,"org.eclipse.debug.ui.commands.StepOver",1331395840180
-executed,command,org.eclipse.debug.ui,3.7.0.v20110518,"org.eclipse.debug.ui.commands.StepInto",1331395851665
-executed,command,org.eclipse.debug.ui,3.7.0.v20110518,"org.eclipse.debug.ui.commands.StepInto",1331395853896
-executed,command,org.eclipse.debug.ui,3.7.0.v20110518,"org.eclipse.debug.ui.commands.Resume",1331395975280
-executed,command,org.eclipse.debug.ui,3.7.0.v20110518,"org.eclipse.debug.ui.commands.Resume",1331395978057
-deactivated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1331396098509
-activated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1331396099402
-activated,editor,org.eclipse.jdt.ui,3.7.0.v20110531-1200,"org.eclipse.jdt.ui.CompilationUnitEditor",1331396172478
-executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.file.save",1331396221104
-executed,command,,,"AUTOGEN:::org.eclipse.jdt.debug.CompilationUnitEditor.BreakpointRulerActions/org.eclipse.jdt.debug.ui.actions.ManageBreakpointRulerAction",1331396257903
-activated,editor,org.eclipse.jdt.ui,3.7.0.v20110531-1200,"org.eclipse.jdt.ui.CompilationUnitEditor",1331396267654
-executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.file.save",1331396271420
-executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.file.save",1331396280567
-executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.file.save",1331396320060
-executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.file.save",1331396334812
-activated,editor,org.eclipse.jdt.ui,3.7.0.v20110531-1200,"org.eclipse.jdt.ui.CompilationUnitEditor",1331396354109
-executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.file.save",1331396364424
-activated,editor,org.eclipse.jdt.ui,3.7.0.v20110531-1200,"org.eclipse.jdt.ui.CompilationUnitEditor",1331396366725
-executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.file.save",1331396376271
-executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.file.save",1331396395932
-executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.file.save",1331396402975
-executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.file.save",1331396420081
-executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.file.save",1331396426635
-activated,editor,org.eclipse.jdt.ui,3.7.0.v20110531-1200,"org.eclipse.jdt.ui.CompilationUnitEditor",1331396460427
-executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.edit.copy",1331396472810
-executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.edit.paste",1331396473777
-executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.file.save",1331396522460
-activated,editor,org.eclipse.jdt.ui,3.7.0.v20110531-1200,"org.eclipse.jdt.ui.CompilationUnitEditor",1331396526035
-executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.file.save",1331396536821
-executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.file.save",1331396549585
-opened,editor,org.eclipse.jdt.ui,3.7.0.v20110531-1200,"org.eclipse.jdt.ui.CompilationUnitEditor",1331396565326
-activated,editor,org.eclipse.jdt.ui,3.7.0.v20110531-1200,"org.eclipse.jdt.ui.CompilationUnitEditor",1331396565443
-deactivated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1331396618305
-activated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1331396632634
-activated,editor,org.eclipse.jdt.ui,3.7.0.v20110531-1200,"org.eclipse.jdt.ui.CompilationUnitEditor",1331396634244
-executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.edit.copy",1331396640980
-activated,editor,org.eclipse.jdt.ui,3.7.0.v20110531-1200,"org.eclipse.jdt.ui.CompilationUnitEditor",1331396643293
-executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.edit.paste",1331396644344
-executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.file.save",1331396648393
-deactivated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1331396660300
-activated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1331396663404
-executed,command,org.eclipse.jdt.ui,3.7.0.v20110531-1200,"org.eclipse.jdt.ui.edit.text.java.organize.imports",1331396663554
-executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.file.save",1331396663907
-executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.file.save",1331396671787
-deactivated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1331396697506
-activated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1331396815578
-activated,view,org.eclipse.jdt.ui,3.7.0.v20110531-1200,"org.eclipse.jdt.ui.PackageExplorer",1331396820215
-deactivated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1331396833348
-activated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1331396861118
-activated,editor,org.eclipse.jdt.ui,3.7.0.v20110531-1200,"org.eclipse.jdt.ui.CompilationUnitEditor",1331396874157
-started,bundle,org.eclipse.compare,3.5.200.I20110525-0800,"org.eclipse.compare",1331396891979
-executed,command,org.eclipse.jdt.ui,3.7.0.v20110531-1200,"org.eclipse.jdt.ui.edit.text.java.rename.element",1331396897591
-started,bundle,org.eclipse.wst.jsdt.manipulation,1.0.300.v201104272153,"org.eclipse.wst.jsdt.manipulation",1331396904591
-started,bundle,org.eclipse.wst.jsdt.core,1.1.102.v201111090634,"org.eclipse.wst.jsdt.core",1331396904839
-started,bundle,org.eclipse.wst.jsdt.ui,1.1.102.v201201131900,"org.eclipse.wst.jsdt.ui",1331396904988
-started,bundle,org.eclipse.ant.ui,3.5.100.v20110510,"org.eclipse.ant.ui",1331396905937
-deactivated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1331396939620
-activated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1331397062968
-executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.edit.copy",1331397069845
-activated,view,org.eclipse.jdt.ui,3.7.0.v20110531-1200,"org.eclipse.jdt.ui.PackageExplorer",1331397073089
-activated,editor,org.eclipse.jdt.ui,3.7.0.v20110531-1200,"org.eclipse.jdt.ui.CompilationUnitEditor",1331397073349
-executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.edit.paste",1331397076980
-executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.edit.undo",1331397079960
-executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.edit.undo",1331397080585
-executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.file.save",1331397085597
-deactivated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1331397088235
-activated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1331397090071
-executed,command,org.eclipse.jdt.ui,3.7.0.v20110531-1200,"org.eclipse.jdt.ui.edit.text.java.organize.imports",1331397090264
-executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.file.save",1331397092090
-deactivated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1331397101117
-activated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1331397103526
-closed,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1331397103830
-stopped,bundle,org.eclipse.m2e.logback.configuration,1.0.0.20110607-2117,"org.eclipse.m2e.logback.configuration",1331397104663
+stopped,bundle,com.google.gdt.eclipse.login,2.5.2.v201202290255-rel-r37,"com.google.gdt.eclipse.login",1331741857703
+stopped,bundle,com.google.gdt.eclipse.managedapis,2.5.2.v201202290255-rel-r37,"com.google.gdt.eclipse.managedapis",1331741857704
+stopped,bundle,com.google.gwt.eclipse.oophm,2.5.2.v201202290255-rel-r37,"com.google.gwt.eclipse.oophm",1331741857706
+stopped,bundle,com.google.gwt.eclipse.sdkbundle,2.4.0.v201202290255-rel-r37,"com.google.gwt.eclipse.sdkbundle",1331741857706
+stopped,bundle,com.google.gwt.eclipse.core,2.5.2.v201202290255-rel-r37,"com.google.gwt.eclipse.core",1331741857840
+stopped,bundle,com.google.gdt.eclipse.core,2.5.2.v201202290255-rel-r37,"com.google.gdt.eclipse.core",1331741857841
+stopped,bundle,com.google.gdt.eclipse.platform,2.5.2.v201202290255-rel-r37,"com.google.gdt.eclipse.platform",1331741857841
+stopped,bundle,com.google.gdt.eclipse.platform.e37,2.5.2.v201202290255-rel-r37,"com.google.gdt.eclipse.platform.e37",1331741857841
+stopped,bundle,org.eclipse.m2e.discovery,1.0.200.20111228-1245,"org.eclipse.m2e.discovery",1331741857842
+stopped,bundle,org.eclipse.m2e.refactoring,1.0.200.20111228-1245,"org.eclipse.m2e.refactoring",1331741857842
+stopped,bundle,org.eclipse.m2e.editor,1.0.200.20111228-1245,"org.eclipse.m2e.editor",1331741857842
+stopped,bundle,org.eclipse.m2e.editor.xml,1.0.200.20111228-1245,"org.eclipse.m2e.editor.xml",1331741857842
+stopped,bundle,org.eclipse.m2e.jdt,1.0.200.20111228-1245,"org.eclipse.m2e.jdt",1331741857842
+stopped,bundle,org.eclipse.m2e.launching,1.0.200.20111228-1245,"org.eclipse.m2e.launching",1331741857842
+stopped,bundle,org.eclipse.m2e.usagedata,1.0.200.20111228-1245,"org.eclipse.m2e.usagedata",1331741857843
+stopped,bundle,org.eclipse.m2e.core.ui,1.0.200.20111228-1245,"org.eclipse.m2e.core.ui",1331741857843
+stopped,bundle,org.eclipse.m2e.core,1.0.200.20111228-1245,"org.eclipse.m2e.core",1331741857843
+stopped,bundle,org.eclipse.mylyn.ide.ant,3.6.0.v20110608-1400,"org.eclipse.mylyn.ide.ant",1331741857843
+stopped,bundle,org.eclipse.ant.ui,3.5.100.v20110510,"org.eclipse.ant.ui",1331741857843
+stopped,bundle,org.eclipse.ant.launching,1.0.100.v20110506,"org.eclipse.ant.launching",1331741857843
+stopped,bundle,org.eclipse.equinox.p2.ui.sdk,1.0.200.v20110502-1955,"org.eclipse.equinox.p2.ui.sdk",1331741857844
+stopped,bundle,org.eclipse.mylyn.java.tasks,3.6.0.v20110608-1400,"org.eclipse.mylyn.java.tasks",1331741857844
+stopped,bundle,org.eclipse.mylyn.java.ui,3.6.0.v20110608-1400,"org.eclipse.mylyn.java.ui",1331741857844
+stopped,bundle,com.google.gdt.eclipse.designer.UiBinder,2.5.0.r37x201112291029,"com.google.gdt.eclipse.designer.UiBinder",1331741857845
+stopped,bundle,com.google.gdt.eclipse.designer.gpe,2.5.0.r37x201201030222,"com.google.gdt.eclipse.designer.gpe",1331741857845
+stopped,bundle,com.google.gdt.eclipse.designer,2.5.0.r37x201112291029,"com.google.gdt.eclipse.designer",1331741857845
+stopped,bundle,org.eclipse.jdt.junit,3.7.0.v20110505-0800,"org.eclipse.jdt.junit",1331741857845
+stopped,bundle,org.eclipse.jdt.apt.ui,3.3.300.v20110305-1450,"org.eclipse.jdt.apt.ui",1331741857845
+stopped,bundle,org.eclipse.jdt.debug.ui,3.6.0.v20110512,"org.eclipse.jdt.debug.ui",1331741857847
+stopped,bundle,com.google.gdt.eclipse.platform.shared,2.5.2.v201202290255-rel-r37,"com.google.gdt.eclipse.platform.shared",1331741857847
+stopped,bundle,org.eclipse.wb.swing.FormLayout,1.0.0.r37x201106081552,"org.eclipse.wb.swing.FormLayout",1331741857847
+stopped,bundle,org.eclipse.wb.swing.MigLayout,1.0.0.r37x201106081552,"org.eclipse.wb.swing.MigLayout",1331741857847
+stopped,bundle,org.eclipse.wb.swing.databinding,1.0.0.r37x201106081552,"org.eclipse.wb.swing.databinding",1331741857848
+stopped,bundle,org.eclipse.wb.swing.java6,1.0.0.r37x201106081552,"org.eclipse.wb.swing.java6",1331741857848
+stopped,bundle,org.eclipse.wb.swing.jsr296,1.0.0.r37x201106081552,"org.eclipse.wb.swing.jsr296",1331741857848
+stopped,bundle,org.eclipse.wb.swing,1.0.0.r37x201106081552,"org.eclipse.wb.swing",1331741857848
+stopped,bundle,org.eclipse.wb.core.ui,1.0.0.r37x201106081733,"org.eclipse.wb.core.ui",1331741857848
+stopped,bundle,org.eclipse.wb.layout.group,1.0.0.r37x201106081642,"org.eclipse.wb.layout.group",1331741857848
+stopped,bundle,com.google.gdt.eclipse.designer.hosted.2_0.webkit,2.5.0.r37x201112291019,"com.google.gdt.eclipse.designer.hosted.2_0.webkit",1331741857848
+stopped,bundle,com.google.gdt.eclipse.designer.hosted.2_0,2.5.0.r37x201112291019,"com.google.gdt.eclipse.designer.hosted.2_0",1331741857848
+stopped,bundle,com.google.gdt.eclipse.designer.hosted.2_2.webkit,2.5.0.r37x201112291019,"com.google.gdt.eclipse.designer.hosted.2_2.webkit",1331741857848
+stopped,bundle,com.google.gdt.eclipse.designer.hosted.2_2,2.5.0.r37x201112291019,"com.google.gdt.eclipse.designer.hosted.2_2",1331741857848
+stopped,bundle,com.google.gdt.eclipse.designer.hosted,2.5.0.r37x201112291019,"com.google.gdt.eclipse.designer.hosted",1331741857848
+stopped,bundle,org.eclipse.wb.core.databinding.xml,1.2.0.r37x201112291009,"org.eclipse.wb.core.databinding.xml",1331741857848
+stopped,bundle,org.eclipse.wb.core.databinding,1.2.0.r37x201112290923,"org.eclipse.wb.core.databinding",1331741857848
+stopped,bundle,org.eclipse.wb.core.xml,1.2.0.r37x201112291009,"org.eclipse.wb.core.xml",1331741857848
+stopped,bundle,org.eclipse.wb.css,1.2.0.r37x201112290951,"org.eclipse.wb.css",1331741857848
+stopped,bundle,org.eclipse.wb.os.macosx,1.2.0.r37x201112290923,"org.eclipse.wb.os.macosx",1331741857848
+stopped,bundle,org.eclipse.wb.core,1.2.0.r37x201112290923,"org.eclipse.wb.core",1331741857849
+stopped,bundle,org.eclipse.jdt.ui,3.7.0.v20110531-1200,"org.eclipse.jdt.ui",1331741857855
+stopped,bundle,org.eclipse.wst.dtd.ui,1.0.600.v201103171359,"org.eclipse.wst.dtd.ui",1331741857855
+stopped,bundle,org.eclipse.wst.xsd.ui,1.2.404.v201105050216,"org.eclipse.wst.xsd.ui",1331741857855
+stopped,bundle,org.eclipse.wst.css.ui,1.0.601.v201201101544,"org.eclipse.wst.css.ui",1331741857855
+stopped,bundle,org.eclipse.wst.xml.ui,1.1.202.v201112071516,"org.eclipse.wst.xml.ui",1331741857855
+stopped,bundle,org.eclipse.wst.common.ui,1.1.500.v200911190730,"org.eclipse.wst.common.ui",1331741857855
+stopped,bundle,org.eclipse.wst.jsdt.ui,1.1.102.v201201131900,"org.eclipse.wst.jsdt.ui",1331741857855
+stopped,bundle,org.eclipse.wst.sse.ui,1.3.2.v201201041522,"org.eclipse.wst.sse.ui",1331741857855
+stopped,bundle,org.eclipse.search,3.7.0.v20110505-0800,"org.eclipse.search",1331741857908
+stopped,bundle,org.eclipse.mylyn.commons.team,0.8.0.v20110608-1400,"org.eclipse.mylyn.commons.team",1331741857908
+stopped,bundle,org.eclipse.mylyn.team.ui,3.6.0.v20110608-1400,"org.eclipse.mylyn.team.ui",1331741857909
+stopped,bundle,org.eclipse.ui.navigator.resources,3.4.300.I20110421-1800,"org.eclipse.ui.navigator.resources",1331741857909
+stopped,bundle,org.eclipse.ltk.ui.refactoring,3.6.0.v20110505-0800,"org.eclipse.ltk.ui.refactoring",1331741857909
+stopped,bundle,org.eclipse.mylyn.bugzilla.ui,3.6.0.v20110608-1400,"org.eclipse.mylyn.bugzilla.ui",1331741857910
+stopped,bundle,org.eclipse.mylyn.ide.ui,3.6.0.v20110608-1400,"org.eclipse.mylyn.ide.ui",1331741857910
+stopped,bundle,org.eclipse.mylyn.resources.ui,3.6.0.v20110608-1400,"org.eclipse.mylyn.resources.ui",1331741857910
+stopped,bundle,org.eclipse.mylyn.wikitext.tasks.ui,1.5.0.v20110608-1400,"org.eclipse.mylyn.wikitext.tasks.ui",1331741857910
+stopped,bundle,org.eclipse.mylyn.context.ui,3.6.0.v20110608-1400,"org.eclipse.mylyn.context.ui",1331741857910
+stopped,bundle,org.eclipse.mylyn.help.ui,3.6.0.v20110608-1400,"org.eclipse.mylyn.help.ui",1331741857910
+stopped,bundle,org.eclipse.mylyn.tasks.bugs,3.6.0.v20110608-1400,"org.eclipse.mylyn.tasks.bugs",1331741857910
+stopped,bundle,org.eclipse.mylyn.tasks.ui,3.6.0.v20110608-1400,"org.eclipse.mylyn.tasks.ui",1331741857911
+stopped,bundle,org.eclipse.team.cvs.ui,3.3.400.I20110510-0800,"org.eclipse.team.cvs.ui",1331741857911
+stopped,bundle,org.eclipse.team.ui,3.6.100.I20110525-0800,"org.eclipse.team.ui",1331741857912
+stopped,bundle,org.eclipse.compare,3.5.200.I20110525-0800,"org.eclipse.compare",1331741857912
+stopped,bundle,org.eclipse.ui.externaltools,3.2.0.v20110506,"org.eclipse.ui.externaltools",1331741857912
+stopped,bundle,org.eclipse.debug.ui,3.7.0.v20110518,"org.eclipse.debug.ui",1331741857915
+activated,perspective,org.eclipse.jdt.ui,,"org.eclipse.jdt.ui.JavaPerspective",1331997940953
+started,bundle,org.eclipse.osgi,3.7.0.v20110613,"org.eclipse.osgi",1331997940954
+started,bundle,org.eclipse.equinox.simpleconfigurator,1.0.200.v20110502-1955,"org.eclipse.equinox.simpleconfigurator",1331997940954
+started,bundle,com.ibm.icu,4.4.2.v20110208,"com.ibm.icu",1331997940955
+started,bundle,org.eclipse.compare.core,3.5.200.I20110208-0800,"org.eclipse.compare.core",1331997940956
+started,bundle,org.eclipse.core.contenttype,3.4.100.v20110423-0524,"org.eclipse.core.contenttype",1331997940956
+started,bundle,org.eclipse.core.databinding.observable,1.4.0.I20110222-0800,"org.eclipse.core.databinding.observable",1331997940956
+started,bundle,org.eclipse.core.expressions,3.4.300.v20110228,"org.eclipse.core.expressions",1331997940957
+started,bundle,org.eclipse.core.filebuffers,3.5.200.v20110505-0800,"org.eclipse.core.filebuffers",1331997940957
+started,bundle,org.eclipse.core.filesystem,1.3.100.v20110423-0524,"org.eclipse.core.filesystem",1331997940957
+started,bundle,org.eclipse.core.jobs,3.5.100.v20110404,"org.eclipse.core.jobs",1331997940957
+started,bundle,org.eclipse.core.net,1.2.100.I20110511-0800,"org.eclipse.core.net",1331997940957
+started,bundle,org.eclipse.core.resources,3.7.100.v20110510-0712,"org.eclipse.core.resources",1331997940957
+started,bundle,org.eclipse.core.runtime,3.7.0.v20110110,"org.eclipse.core.runtime",1331997940957
+started,bundle,org.eclipse.core.runtime.compatibility,3.2.100.v20100505,"org.eclipse.core.runtime.compatibility",1331997940957
+started,bundle,org.eclipse.core.runtime.compatibility.auth,3.2.200.v20110110,"org.eclipse.core.runtime.compatibility.auth",1331997940957
+started,bundle,org.eclipse.debug.core,3.7.0.v20110518,"org.eclipse.debug.core",1331997940957
+started,bundle,org.eclipse.epp.mpc.ui,1.1.0.I20110525-0742,"org.eclipse.epp.mpc.ui",1331997940957
+started,bundle,org.eclipse.epp.usagedata.gathering,1.3.1.R201106061540,"org.eclipse.epp.usagedata.gathering",1331997940957
+started,bundle,org.eclipse.epp.usagedata.recording,1.3.1.R201106061540,"org.eclipse.epp.usagedata.recording",1331997940957
+started,bundle,org.eclipse.equinox.app,1.3.100.v20110321,"org.eclipse.equinox.app",1331997940957
+started,bundle,org.eclipse.equinox.common,3.6.0.v20110523,"org.eclipse.equinox.common",1331997940957
+started,bundle,org.eclipse.equinox.ds,1.3.0.v20110502,"org.eclipse.equinox.ds",1331997940957
+started,bundle,org.eclipse.equinox.event,1.2.100.v20110502,"org.eclipse.equinox.event",1331997940957
+started,bundle,org.eclipse.equinox.p2.core,2.1.0.v20110502-1955,"org.eclipse.equinox.p2.core",1331997940957
+started,bundle,org.eclipse.equinox.p2.directorywatcher,1.0.300.v20110502-1955,"org.eclipse.equinox.p2.directorywatcher",1331997940957
+started,bundle,org.eclipse.equinox.p2.engine,2.1.0.v20110511,"org.eclipse.equinox.p2.engine",1331997940957
+started,bundle,org.eclipse.equinox.p2.metadata,2.1.0.v20110510,"org.eclipse.equinox.p2.metadata",1331997940957
+started,bundle,org.eclipse.equinox.p2.metadata.repository,1.2.0.v20110511-1359,"org.eclipse.equinox.p2.metadata.repository",1331997940957
+started,bundle,org.eclipse.equinox.p2.operations,2.1.0.v20110511-1821,"org.eclipse.equinox.p2.operations",1331997940957
+started,bundle,org.eclipse.equinox.p2.reconciler.dropins,1.1.100.v20110510,"org.eclipse.equinox.p2.reconciler.dropins",1331997940957
+started,bundle,org.eclipse.equinox.p2.repository,2.1.0.v20110601,"org.eclipse.equinox.p2.repository",1331997940957
+started,bundle,org.eclipse.equinox.p2.ui.sdk.scheduler,1.0.100.v20110502-1955,"org.eclipse.equinox.p2.ui.sdk.scheduler",1331997940957
+started,bundle,org.eclipse.equinox.p2.updatechecker,1.1.200.v20110502-1955,"org.eclipse.equinox.p2.updatechecker",1331997940957
+started,bundle,org.eclipse.equinox.preferences,3.4.0.v20110502,"org.eclipse.equinox.preferences",1331997940957
+started,bundle,org.eclipse.equinox.registry,3.5.100.v20110502,"org.eclipse.equinox.registry",1331997940957
+started,bundle,org.eclipse.equinox.security,1.1.0.v20110502,"org.eclipse.equinox.security",1331997940957
+started,bundle,org.eclipse.equinox.util,1.0.300.v20110502,"org.eclipse.equinox.util",1331997940957
+started,bundle,org.eclipse.help,3.5.100.v20110426,"org.eclipse.help",1331997940957
+started,bundle,org.eclipse.jdt.apt.core,3.3.500.v20110420-1015,"org.eclipse.jdt.apt.core",1331997940957
+started,bundle,org.eclipse.jdt.apt.pluggable.core,1.0.400.v20110305-1450,"org.eclipse.jdt.apt.pluggable.core",1331997940957
+started,bundle,org.eclipse.jdt.core,3.7.0.v_B61,"org.eclipse.jdt.core",1331997940957
+started,bundle,org.eclipse.jdt.core.manipulation,1.4.0.v20110505-0800,"org.eclipse.jdt.core.manipulation",1331997940957
+started,bundle,org.eclipse.jdt.launching,3.6.0.v20110509,"org.eclipse.jdt.launching",1331997940957
+started,bundle,org.eclipse.jdt.launching.macosx,3.2.100.v20110509,"org.eclipse.jdt.launching.macosx",1331997940957
+started,bundle,org.eclipse.jdt.ui,3.7.0.v20110531-1200,"org.eclipse.jdt.ui",1331997940957
+started,bundle,org.eclipse.jface,3.7.0.I20110522-1430,"org.eclipse.jface",1331997940957
+started,bundle,org.eclipse.jsch.core,1.1.300.I20110514-0800,"org.eclipse.jsch.core",1331997940957
+started,bundle,org.eclipse.ltk.core.refactoring,3.5.200.v20110505-0800,"org.eclipse.ltk.core.refactoring",1331997940957
+started,bundle,org.eclipse.ltk.ui.refactoring,3.6.0.v20110505-0800,"org.eclipse.ltk.ui.refactoring",1331997940957
+started,bundle,org.eclipse.m2e.logback.configuration,1.0.0.20110607-2117,"org.eclipse.m2e.logback.configuration",1331997940957
+started,bundle,org.eclipse.mylyn.bugzilla.core,3.6.0.v20110608-1400,"org.eclipse.mylyn.bugzilla.core",1331997940957
+started,bundle,org.eclipse.mylyn.bugzilla.ui,3.6.0.v20110608-1400,"org.eclipse.mylyn.bugzilla.ui",1331997940957
+started,bundle,org.eclipse.mylyn.commons.identity,0.8.0.v20110608-1400,"org.eclipse.mylyn.commons.identity",1331997940957
+started,bundle,org.eclipse.mylyn.commons.net,3.6.0.v20110608-1400,"org.eclipse.mylyn.commons.net",1331997940957
+started,bundle,org.eclipse.mylyn.context.core,3.6.0.v20110608-1400,"org.eclipse.mylyn.context.core",1331997940957
+started,bundle,org.eclipse.mylyn.context.ui,3.6.0.v20110608-1400,"org.eclipse.mylyn.context.ui",1331997940957
+started,bundle,org.eclipse.mylyn.monitor.ui,3.6.0.v20110608-1400,"org.eclipse.mylyn.monitor.ui",1331997940970
+started,bundle,org.eclipse.mylyn.tasks.ui,3.6.0.v20110608-1400,"org.eclipse.mylyn.tasks.ui",1331997941017
+started,bundle,org.eclipse.mylyn.team.ui,3.6.0.v20110608-1400,"org.eclipse.mylyn.team.ui",1331997941051
+started,bundle,org.eclipse.search,3.7.0.v20110505-0800,"org.eclipse.search",1331997941110
+started,bundle,org.eclipse.team.core,3.6.0.I20110525-0800,"org.eclipse.team.core",1331997941187
+started,bundle,org.eclipse.team.cvs.core,3.3.400.I20110510-0800,"org.eclipse.team.cvs.core",1331997941249
+started,bundle,org.eclipse.team.cvs.ui,3.3.400.I20110510-0800,"org.eclipse.team.cvs.ui",1331997941288
+started,bundle,org.eclipse.team.ui,3.6.100.I20110525-0800,"org.eclipse.team.ui",1331997941312
+started,bundle,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui",1331997941365
+started,bundle,org.eclipse.ui.console,3.5.100.v20110511,"org.eclipse.ui.console",1331997941387
+started,bundle,org.eclipse.ui.editors,3.7.0.v20110517-0800,"org.eclipse.ui.editors",1331997941387
+started,bundle,org.eclipse.ui.forms,3.5.100.v20110425,"org.eclipse.ui.forms",1331997941416
+started,bundle,org.eclipse.ui.ide,3.7.0.I20110519-0100,"org.eclipse.ui.ide",1331997941454
+started,bundle,org.eclipse.ui.net,1.2.100.I20110511-0800,"org.eclipse.ui.net",1331997941493
+started,bundle,org.eclipse.ui.views,3.6.0.I20110412-0800,"org.eclipse.ui.views",1331997941507
+started,bundle,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"org.eclipse.ui.workbench",1331997941569
+started,bundle,org.eclipse.ui.workbench.texteditor,3.7.0.v20110505-0800,"org.eclipse.ui.workbench.texteditor",1331997941600
+started,bundle,org.eclipse.update.configurator,3.3.100.v20100512,"org.eclipse.update.configurator",1331997941607
+started,bundle,org.eclipse.update.core,3.2.500.v20110330,"org.eclipse.update.core",1331997941655
+started,bundle,org.eclipse.update.scheduler,3.2.300.v20100512,"org.eclipse.update.scheduler",1331997941695
+started,bundle,org.eclipse.wb.discovery.core,1.0.0.r37x201106081733,"org.eclipse.wb.discovery.core",1331997941716
+started,bundle,com.google.appengine.eclipse.core,2.5.2.v201202290255-rel-r37,"com.google.appengine.eclipse.core",1331997941717
+started,bundle,com.google.gdt.eclipse.appengine.rpc,2.5.2.v201202290255-rel-r37,"com.google.gdt.eclipse.appengine.rpc",1331997941761
+started,bundle,com.google.gdt.eclipse.core,2.5.2.v201202290255-rel-r37,"com.google.gdt.eclipse.core",1331997941762
+started,bundle,com.google.gdt.eclipse.designer,2.5.0.r37x201112291029,"com.google.gdt.eclipse.designer",1331997941822
+started,bundle,com.google.gdt.eclipse.login,2.5.2.v201202290255-rel-r37,"com.google.gdt.eclipse.login",1331997941823
+started,bundle,com.google.gdt.eclipse.managedapis,2.5.2.v201202290255-rel-r37,"com.google.gdt.eclipse.managedapis",1331997941823
+started,bundle,com.google.gdt.eclipse.platform.e37,2.5.2.v201202290255-rel-r37,"com.google.gdt.eclipse.platform.e37",1331997941871
+started,bundle,com.google.gdt.eclipse.platform.shared,2.5.2.v201202290255-rel-r37,"com.google.gdt.eclipse.platform.shared",1331997941871
+started,bundle,com.google.gdt.eclipse.suite.ext,2.5.2.v201202290255-rel-r37,"com.google.gdt.eclipse.suite.ext",1331997941872
+started,bundle,com.google.gwt.eclipse.core,2.5.2.v201202290255-rel-r37,"com.google.gwt.eclipse.core",1331997941941
+started,bundle,org.eclipse.mylyn.commons.ui,3.6.1.v20110720-0100,"org.eclipse.mylyn.commons.ui",1331997942006
+started,bundle,org.eclipse.wb.core,1.2.0.r37x201112290923,"org.eclipse.wb.core",1331997942064
+started,bundle,org.eclipse.wb.core.lib,1.2.0.r37x201112290923,"org.eclipse.wb.core.lib",1331997942106
+os,sysinfo,,,"macosx",1331997942110
+arch,sysinfo,,,"x86_64",1331997942110
+ws,sysinfo,,,"cocoa",1331997942110
+locale,sysinfo,,,"ja_JP",1331997942110
+processors,sysinfo,,,"8",1331997942111
+java.runtime.name,sysinfo,,,"Java(TM) SE Runtime Environment",1331997942111
+java.runtime.version,sysinfo,,,"1.6.0_29-b11-402-11D50d",1331997942111
+java.specification.name,sysinfo,,,"Java Platform API Specification",1331997942111
+java.specification.vendor,sysinfo,,,"Sun Microsystems Inc.",1331997942111
+java.specification.version,sysinfo,,,"1.6",1331997942111
+java.vendor,sysinfo,,,"Apple Inc.",1331997942111
+java.version,sysinfo,,,"1.6.0_29",1331997942111
+java.vm.info,sysinfo,,,"mixed mode",1331997942111
+java.vm.name,sysinfo,,,"Java HotSpot(TM) 64-Bit Server VM",1331997942111
+java.vm.specification.name,sysinfo,,,"Java Virtual Machine Specification",1331997942111
+java.vm.specification.vendor,sysinfo,,,"Sun Microsystems Inc.",1331997942111
+java.vm.specification.version,sysinfo,,,"1.0",1331997942111
+java.vm.vendor,sysinfo,,,"Apple Inc.",1331997942111
+java.vm.version,sysinfo,,,"20.4-b02-402",1331997942111
+started,bundle,org.eclipse.m2e.usagedata,1.0.200.20111228-1245,"org.eclipse.m2e.usagedata",1331997942180
+started,bundle,org.eclipse.epp.usagedata.ui,1.3.1.R201106061540,"org.eclipse.epp.usagedata.ui",1331997943225
+started,bundle,org.eclipse.wb.discovery.ui,1.0.0.r37x201106081733,"org.eclipse.wb.discovery.ui",1331997943370
+started,bundle,com.google.gdt.eclipse.designer.hosted,2.5.0.r37x201112291019,"com.google.gdt.eclipse.designer.hosted",1331997943502
+started,bundle,com.google.gdt.eclipse.designer.UiBinder,2.5.0.r37x201112291029,"com.google.gdt.eclipse.designer.UiBinder",1331997943666
+deactivated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1331997943998
+opened,view,org.eclipse.ui.ide,3.7.0.I20110519-0100,"org.eclipse.ui.views.ProblemView",1331997944436
+activated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1331997945952
+started,bundle,com.google.gdt.eclipse.maven,2.5.2.v201202290255-rel-r37,"com.google.gdt.eclipse.maven",1331997946138
+started,bundle,com.google.gdt.eclipse.suite,2.5.2.v201202290255-rel-r37,"com.google.gdt.eclipse.suite",1331997946282
+started,bundle,org.eclipse.core.variables,3.2.500.v20110511,"org.eclipse.core.variables",1331997946420
+started,bundle,org.eclipse.jdt.junit,3.7.0.v20110505-0800,"org.eclipse.jdt.junit",1331997951551
+executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.file.save",1331997987790
+started,bundle,org.eclipse.debug.ui,3.7.0.v20110518,"org.eclipse.debug.ui",1331997988477
+started,bundle,org.eclipse.jdt.debug,3.7.0.v20110509,"org.eclipse.jdt.debug",1331997988936
+started,bundle,org.eclipse.jdt.debug.ui,3.6.0.v20110512,"org.eclipse.jdt.debug.ui",1331997989242
+executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.file.save",1331998014498
+opened,editor,org.eclipse.jdt.ui,3.7.0.v20110531-1200,"org.eclipse.jdt.ui.CompilationUnitEditor",1331998031287
+activated,editor,org.eclipse.jdt.ui,3.7.0.v20110531-1200,"org.eclipse.jdt.ui.CompilationUnitEditor",1331998031368
+started,bundle,org.eclipse.mylyn.java.tasks,3.6.0.v20110608-1400,"org.eclipse.mylyn.java.tasks",1331998039650
+executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.edit.copy",1331998039785
+activated,editor,org.eclipse.jdt.ui,3.7.0.v20110531-1200,"org.eclipse.jdt.ui.CompilationUnitEditor",1331998041590
+executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.edit.paste",1331998049603
+executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.edit.copy",1331998052615
+executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.edit.paste",1331998055743
+executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.file.save",1331998058947
+started,bundle,org.eclipse.mylyn.ide.ui,3.6.0.v20110608-1400,"org.eclipse.mylyn.ide.ui",1331998062108
+started,bundle,org.eclipse.mylyn.java.ui,3.6.0.v20110608-1400,"org.eclipse.mylyn.java.ui",1331998062148
+deactivated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1331998066598
+activated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1331998077396
+executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.file.save",1331998082086
+executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.edit.copy",1331998110685
+executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.edit.paste",1331998121169
+executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.file.save",1331998123034
+executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.edit.copy",1331998128184
+executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.edit.paste",1331998129716
+executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.file.save",1331998137793
+executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.file.save",1331998140151
+executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.file.save",1331998146023
+executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.file.save",1331998160407
+executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.edit.copy",1331998167849
+executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.edit.paste",1331998169679
+executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.file.save",1331998175610
+started,bundle,org.eclipse.wst.sse.core,1.1.602.v201112071516,"org.eclipse.wst.sse.core",1331998193269
+started,bundle,org.eclipse.wst.xml.core,1.1.602.v201201091944,"org.eclipse.wst.xml.core",1331998193308
+started,bundle,org.eclipse.wst.common.uriresolver,1.1.401.v201004280700,"org.eclipse.wst.common.uriresolver",1331998193418
+deactivated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1331998193492
+activated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1331998195260
+executed,command,com.google.appengine.eclipse.core,2.5.2.v201202290255-rel-r37,"com.google.appengine.eclipse.core.deployToGoogle",1331998200363
+deactivated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1331998219096
+activated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1331998239426
+deactivated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1331998244621
+activated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1331998266554
+deactivated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1331998268637
+activated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1331998631625
+deactivated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1331998638260
+activated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1331998644544
+started,bundle,org.eclipse.m2e.launching,1.0.200.20111228-1245,"org.eclipse.m2e.launching",1331998646557
+deactivated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1331998648800
+activated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1331998654025
+deactivated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1331998656316
+activated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1331998661098
+deactivated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1331998663062
+activated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1331998685743
+deactivated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1331998692315
index f519db6..778ac54 100644 (file)
 what,kind,bundleId,bundleVersion,description,time
-stopped,bundle,org.eclipse.ui.cheatsheets,3.4.100.v20110425,"org.eclipse.ui.cheatsheets",1331397104663
-stopped,bundle,org.eclipse.help.ui,3.5.100.v20110425,"org.eclipse.help.ui",1331397104663
-stopped,bundle,org.eclipse.help.webapp,3.6.0.v20110518,"org.eclipse.help.webapp",1331397104663
-stopped,bundle,org.eclipse.epp.mpc.ui,1.1.0.I20110525-0742,"org.eclipse.epp.mpc.ui",1331397104665
-stopped,bundle,org.eclipse.epp.usagedata.ui,1.3.1.R201106061540,"org.eclipse.epp.usagedata.ui",1331397104665
-stopped,bundle,org.eclipse.ui.intro.universal,3.2.500.v20110510,"org.eclipse.ui.intro.universal",1331397104665
-stopped,bundle,org.eclipse.ui.intro,3.4.100.v20110425,"org.eclipse.ui.intro",1331397104665
-stopped,bundle,org.eclipse.help.base,3.6.0.v201106131736,"org.eclipse.help.base",1331397104665
-stopped,bundle,org.eclipse.equinox.http.jetty,2.0.100.v20110502,"org.eclipse.equinox.http.jetty",1331397104665
-stopped,bundle,com.google.appengine.eclipse.datatools,2.5.2.v201202290255-rel-r37,"com.google.appengine.eclipse.datatools",1331397104666
-stopped,bundle,com.google.appengine.eclipse.sdkbundle,1.6.3.v201202290255r37,"com.google.appengine.eclipse.sdkbundle",1331397104666
-stopped,bundle,com.google.gdt.eclipse.appengine.rpc,2.5.2.v201202290255-rel-r37,"com.google.gdt.eclipse.appengine.rpc",1331397104666
-stopped,bundle,com.google.gdt.eclipse.gph.e36,2.5.2.v201202290255-rel-r37,"com.google.gdt.eclipse.gph.e36",1331397104666
-stopped,bundle,com.google.gdt.eclipse.gph.hge,2.5.2.v201202290255-rel-r37,"com.google.gdt.eclipse.gph.hge",1331397104666
-stopped,bundle,com.google.gdt.eclipse.gph.subclipse,2.5.2.v201202290255-rel-r37,"com.google.gdt.eclipse.gph.subclipse",1331397104666
-stopped,bundle,com.google.gdt.eclipse.gph.subversive,2.5.2.v201202290255-rel-r37,"com.google.gdt.eclipse.gph.subversive",1331397104666
-stopped,bundle,com.google.gdt.eclipse.suite.ext,2.5.2.v201202290255-rel-r37,"com.google.gdt.eclipse.suite.ext",1331397104666
-stopped,bundle,com.google.gdt.eclipse.gph,2.5.2.v201202290255-rel-r37,"com.google.gdt.eclipse.gph",1331397104666
-stopped,bundle,com.google.gdt.eclipse.maven.e37,2.5.2.v201202290255-rel-r37,"com.google.gdt.eclipse.maven.e37",1331397104666
-stopped,bundle,com.google.gdt.eclipse.maven,2.5.2.v201202290255-rel-r37,"com.google.gdt.eclipse.maven",1331397104667
-stopped,bundle,com.google.gdt.eclipse.suite,2.5.2.v201202290255-rel-r37,"com.google.gdt.eclipse.suite",1331397104667
-stopped,bundle,com.google.gdt.eclipse.appsmarketplace,2.5.2.v201202290255-rel-r37,"com.google.gdt.eclipse.appsmarketplace",1331397104667
-stopped,bundle,com.google.appengine.eclipse.core,2.5.2.v201202290255-rel-r37,"com.google.appengine.eclipse.core",1331397104667
-stopped,bundle,com.google.gdt.eclipse.login,2.5.2.v201202290255-rel-r37,"com.google.gdt.eclipse.login",1331397104669
-stopped,bundle,com.google.gdt.eclipse.managedapis,2.5.2.v201202290255-rel-r37,"com.google.gdt.eclipse.managedapis",1331397104670
-stopped,bundle,com.google.gwt.eclipse.oophm,2.5.2.v201202290255-rel-r37,"com.google.gwt.eclipse.oophm",1331397104670
-stopped,bundle,com.google.gwt.eclipse.sdkbundle,2.4.0.v201202290255-rel-r37,"com.google.gwt.eclipse.sdkbundle",1331397104670
-stopped,bundle,com.google.gwt.eclipse.core,2.5.2.v201202290255-rel-r37,"com.google.gwt.eclipse.core",1331397104788
-stopped,bundle,com.google.gdt.eclipse.core,2.5.2.v201202290255-rel-r37,"com.google.gdt.eclipse.core",1331397104788
-stopped,bundle,com.google.gdt.eclipse.platform,2.5.2.v201202290255-rel-r37,"com.google.gdt.eclipse.platform",1331397104788
-stopped,bundle,com.google.gdt.eclipse.platform.e37,2.5.2.v201202290255-rel-r37,"com.google.gdt.eclipse.platform.e37",1331397104789
-stopped,bundle,org.eclipse.m2e.discovery,1.0.200.20111228-1245,"org.eclipse.m2e.discovery",1331397104789
-stopped,bundle,org.eclipse.m2e.refactoring,1.0.200.20111228-1245,"org.eclipse.m2e.refactoring",1331397104789
-stopped,bundle,org.eclipse.m2e.editor,1.0.200.20111228-1245,"org.eclipse.m2e.editor",1331397104790
-stopped,bundle,org.eclipse.m2e.editor.xml,1.0.200.20111228-1245,"org.eclipse.m2e.editor.xml",1331397104790
-stopped,bundle,org.eclipse.m2e.jdt,1.0.200.20111228-1245,"org.eclipse.m2e.jdt",1331397104790
-stopped,bundle,org.eclipse.m2e.launching,1.0.200.20111228-1245,"org.eclipse.m2e.launching",1331397104790
-stopped,bundle,org.eclipse.m2e.usagedata,1.0.200.20111228-1245,"org.eclipse.m2e.usagedata",1331397104790
-stopped,bundle,org.eclipse.m2e.core.ui,1.0.200.20111228-1245,"org.eclipse.m2e.core.ui",1331397104790
-stopped,bundle,org.eclipse.m2e.core,1.0.200.20111228-1245,"org.eclipse.m2e.core",1331397104790
-stopped,bundle,org.eclipse.mylyn.ide.ant,3.6.0.v20110608-1400,"org.eclipse.mylyn.ide.ant",1331397104790
-stopped,bundle,org.eclipse.ant.ui,3.5.100.v20110510,"org.eclipse.ant.ui",1331397104830
-stopped,bundle,org.eclipse.ant.launching,1.0.100.v20110506,"org.eclipse.ant.launching",1331397104830
-stopped,bundle,org.eclipse.equinox.p2.ui.sdk,1.0.200.v20110502-1955,"org.eclipse.equinox.p2.ui.sdk",1331397104830
-stopped,bundle,org.eclipse.mylyn.java.tasks,3.6.0.v20110608-1400,"org.eclipse.mylyn.java.tasks",1331397104830
-stopped,bundle,org.eclipse.mylyn.java.ui,3.6.0.v20110608-1400,"org.eclipse.mylyn.java.ui",1331397104831
-stopped,bundle,com.google.gdt.eclipse.designer.UiBinder,2.5.0.r37x201112291029,"com.google.gdt.eclipse.designer.UiBinder",1331397104831
-stopped,bundle,com.google.gdt.eclipse.designer.gpe,2.5.0.r37x201201030222,"com.google.gdt.eclipse.designer.gpe",1331397104831
-stopped,bundle,com.google.gdt.eclipse.designer,2.5.0.r37x201112291029,"com.google.gdt.eclipse.designer",1331397104832
-stopped,bundle,org.eclipse.jdt.junit,3.7.0.v20110505-0800,"org.eclipse.jdt.junit",1331397104832
-stopped,bundle,org.eclipse.jdt.apt.ui,3.3.300.v20110305-1450,"org.eclipse.jdt.apt.ui",1331397104832
-stopped,bundle,org.eclipse.jdt.debug.ui,3.6.0.v20110512,"org.eclipse.jdt.debug.ui",1331397104834
-stopped,bundle,com.google.gdt.eclipse.platform.shared,2.5.2.v201202290255-rel-r37,"com.google.gdt.eclipse.platform.shared",1331397104834
-stopped,bundle,org.eclipse.wb.swing.FormLayout,1.0.0.r37x201106081552,"org.eclipse.wb.swing.FormLayout",1331397104834
-stopped,bundle,org.eclipse.wb.swing.MigLayout,1.0.0.r37x201106081552,"org.eclipse.wb.swing.MigLayout",1331397104835
-stopped,bundle,org.eclipse.wb.swing.databinding,1.0.0.r37x201106081552,"org.eclipse.wb.swing.databinding",1331397104835
-stopped,bundle,org.eclipse.wb.swing.java6,1.0.0.r37x201106081552,"org.eclipse.wb.swing.java6",1331397104835
-stopped,bundle,org.eclipse.wb.swing.jsr296,1.0.0.r37x201106081552,"org.eclipse.wb.swing.jsr296",1331397104835
-stopped,bundle,org.eclipse.wb.swing,1.0.0.r37x201106081552,"org.eclipse.wb.swing",1331397104835
-stopped,bundle,org.eclipse.wb.core.ui,1.0.0.r37x201106081733,"org.eclipse.wb.core.ui",1331397104835
-stopped,bundle,org.eclipse.wb.layout.group,1.0.0.r37x201106081642,"org.eclipse.wb.layout.group",1331397104835
-stopped,bundle,com.google.gdt.eclipse.designer.hosted.2_0.webkit,2.5.0.r37x201112291019,"com.google.gdt.eclipse.designer.hosted.2_0.webkit",1331397104835
-stopped,bundle,com.google.gdt.eclipse.designer.hosted.2_0,2.5.0.r37x201112291019,"com.google.gdt.eclipse.designer.hosted.2_0",1331397104835
-stopped,bundle,com.google.gdt.eclipse.designer.hosted.2_2.webkit,2.5.0.r37x201112291019,"com.google.gdt.eclipse.designer.hosted.2_2.webkit",1331397104835
-stopped,bundle,com.google.gdt.eclipse.designer.hosted.2_2,2.5.0.r37x201112291019,"com.google.gdt.eclipse.designer.hosted.2_2",1331397104835
-stopped,bundle,com.google.gdt.eclipse.designer.hosted,2.5.0.r37x201112291019,"com.google.gdt.eclipse.designer.hosted",1331397104835
-stopped,bundle,org.eclipse.wb.core.databinding.xml,1.2.0.r37x201112291009,"org.eclipse.wb.core.databinding.xml",1331397104835
-stopped,bundle,org.eclipse.wb.core.databinding,1.2.0.r37x201112290923,"org.eclipse.wb.core.databinding",1331397104835
-stopped,bundle,org.eclipse.wb.core.xml,1.2.0.r37x201112291009,"org.eclipse.wb.core.xml",1331397104835
-stopped,bundle,org.eclipse.wb.css,1.2.0.r37x201112290951,"org.eclipse.wb.css",1331397104835
-stopped,bundle,org.eclipse.wb.os.macosx,1.2.0.r37x201112290923,"org.eclipse.wb.os.macosx",1331397104835
-stopped,bundle,org.eclipse.wb.core,1.2.0.r37x201112290923,"org.eclipse.wb.core",1331397104836
-stopped,bundle,org.eclipse.jdt.ui,3.7.0.v20110531-1200,"org.eclipse.jdt.ui",1331397104842
-stopped,bundle,org.eclipse.wst.dtd.ui,1.0.600.v201103171359,"org.eclipse.wst.dtd.ui",1331397104842
-stopped,bundle,org.eclipse.wst.xsd.ui,1.2.404.v201105050216,"org.eclipse.wst.xsd.ui",1331397104842
-stopped,bundle,org.eclipse.wst.css.ui,1.0.601.v201201101544,"org.eclipse.wst.css.ui",1331397104843
-stopped,bundle,org.eclipse.wst.xml.ui,1.1.202.v201112071516,"org.eclipse.wst.xml.ui",1331397104843
-stopped,bundle,org.eclipse.wst.common.ui,1.1.500.v200911190730,"org.eclipse.wst.common.ui",1331397104843
-stopped,bundle,org.eclipse.wst.jsdt.ui,1.1.102.v201201131900,"org.eclipse.wst.jsdt.ui",1331397104868
-stopped,bundle,org.eclipse.wst.sse.ui,1.3.2.v201201041522,"org.eclipse.wst.sse.ui",1331397104868
-stopped,bundle,org.eclipse.search,3.7.0.v20110505-0800,"org.eclipse.search",1331397104902
-stopped,bundle,org.eclipse.mylyn.commons.team,0.8.0.v20110608-1400,"org.eclipse.mylyn.commons.team",1331397104902
-stopped,bundle,org.eclipse.mylyn.team.ui,3.6.0.v20110608-1400,"org.eclipse.mylyn.team.ui",1331397104904
-stopped,bundle,org.eclipse.ui.navigator.resources,3.4.300.I20110421-1800,"org.eclipse.ui.navigator.resources",1331397104904
-stopped,bundle,org.eclipse.ltk.ui.refactoring,3.6.0.v20110505-0800,"org.eclipse.ltk.ui.refactoring",1331397104904
-stopped,bundle,org.eclipse.mylyn.bugzilla.ui,3.6.0.v20110608-1400,"org.eclipse.mylyn.bugzilla.ui",1331397104904
-stopped,bundle,org.eclipse.mylyn.ide.ui,3.6.0.v20110608-1400,"org.eclipse.mylyn.ide.ui",1331397104904
-stopped,bundle,org.eclipse.mylyn.resources.ui,3.6.0.v20110608-1400,"org.eclipse.mylyn.resources.ui",1331397104904
-stopped,bundle,org.eclipse.mylyn.wikitext.tasks.ui,1.5.0.v20110608-1400,"org.eclipse.mylyn.wikitext.tasks.ui",1331397104904
-stopped,bundle,org.eclipse.mylyn.context.ui,3.6.0.v20110608-1400,"org.eclipse.mylyn.context.ui",1331397104905
-stopped,bundle,org.eclipse.mylyn.help.ui,3.6.0.v20110608-1400,"org.eclipse.mylyn.help.ui",1331397104905
-stopped,bundle,org.eclipse.mylyn.tasks.bugs,3.6.0.v20110608-1400,"org.eclipse.mylyn.tasks.bugs",1331397104905
-stopped,bundle,org.eclipse.mylyn.tasks.ui,3.6.0.v20110608-1400,"org.eclipse.mylyn.tasks.ui",1331397104905
-stopped,bundle,org.eclipse.team.cvs.ui,3.3.400.I20110510-0800,"org.eclipse.team.cvs.ui",1331397104906
-stopped,bundle,org.eclipse.team.ui,3.6.100.I20110525-0800,"org.eclipse.team.ui",1331397104906
-stopped,bundle,org.eclipse.compare,3.5.200.I20110525-0800,"org.eclipse.compare",1331397104906
-stopped,bundle,org.eclipse.ui.externaltools,3.2.0.v20110506,"org.eclipse.ui.externaltools",1331397104906
-stopped,bundle,org.eclipse.debug.ui,3.7.0.v20110518,"org.eclipse.debug.ui",1331397104908
-stopped,bundle,org.eclipse.mylyn.wikitext.ui,1.5.0.v20110608-1400,"org.eclipse.mylyn.wikitext.ui",1331397104908
-stopped,bundle,org.eclipse.ui.console,3.5.100.v20110511,"org.eclipse.ui.console",1331397104909
-activated,perspective,org.eclipse.jdt.ui,,"org.eclipse.jdt.ui.JavaPerspective",1331399343440
-started,bundle,org.eclipse.osgi,3.7.0.v20110613,"org.eclipse.osgi",1331399343441
-started,bundle,org.eclipse.equinox.simpleconfigurator,1.0.200.v20110502-1955,"org.eclipse.equinox.simpleconfigurator",1331399343488
-started,bundle,com.ibm.icu,4.4.2.v20110208,"com.ibm.icu",1331399343497
-started,bundle,org.eclipse.compare.core,3.5.200.I20110208-0800,"org.eclipse.compare.core",1331399343504
-started,bundle,org.eclipse.core.contenttype,3.4.100.v20110423-0524,"org.eclipse.core.contenttype",1331399343516
-started,bundle,org.eclipse.core.databinding.observable,1.4.0.I20110222-0800,"org.eclipse.core.databinding.observable",1331399343558
-started,bundle,org.eclipse.core.expressions,3.4.300.v20110228,"org.eclipse.core.expressions",1331399343582
-started,bundle,org.eclipse.core.filebuffers,3.5.200.v20110505-0800,"org.eclipse.core.filebuffers",1331399343616
-started,bundle,org.eclipse.core.filesystem,1.3.100.v20110423-0524,"org.eclipse.core.filesystem",1331399343625
-started,bundle,org.eclipse.core.jobs,3.5.100.v20110404,"org.eclipse.core.jobs",1331399343636
-started,bundle,org.eclipse.core.net,1.2.100.I20110511-0800,"org.eclipse.core.net",1331399343655
-started,bundle,org.eclipse.core.resources,3.7.100.v20110510-0712,"org.eclipse.core.resources",1331399343711
-started,bundle,org.eclipse.core.runtime,3.7.0.v20110110,"org.eclipse.core.runtime",1331399343783
-started,bundle,org.eclipse.core.runtime.compatibility,3.2.100.v20100505,"org.eclipse.core.runtime.compatibility",1331399344041
-started,bundle,org.eclipse.core.runtime.compatibility.auth,3.2.200.v20110110,"org.eclipse.core.runtime.compatibility.auth",1331399344152
-started,bundle,org.eclipse.debug.core,3.7.0.v20110518,"org.eclipse.debug.core",1331399344238
-started,bundle,org.eclipse.epp.mpc.ui,1.1.0.I20110525-0742,"org.eclipse.epp.mpc.ui",1331399344366
-started,bundle,org.eclipse.epp.usagedata.gathering,1.3.1.R201106061540,"org.eclipse.epp.usagedata.gathering",1331399344431
-started,bundle,org.eclipse.epp.usagedata.recording,1.3.1.R201106061540,"org.eclipse.epp.usagedata.recording",1331399344515
-started,bundle,org.eclipse.equinox.app,1.3.100.v20110321,"org.eclipse.equinox.app",1331399344552
-started,bundle,org.eclipse.equinox.common,3.6.0.v20110523,"org.eclipse.equinox.common",1331399344616
-started,bundle,org.eclipse.equinox.ds,1.3.0.v20110502,"org.eclipse.equinox.ds",1331399344697
-started,bundle,org.eclipse.equinox.event,1.2.100.v20110502,"org.eclipse.equinox.event",1331399344747
-started,bundle,org.eclipse.equinox.p2.core,2.1.0.v20110502-1955,"org.eclipse.equinox.p2.core",1331399344770
-started,bundle,org.eclipse.equinox.p2.directorywatcher,1.0.300.v20110502-1955,"org.eclipse.equinox.p2.directorywatcher",1331399344787
-started,bundle,org.eclipse.equinox.p2.engine,2.1.0.v20110511,"org.eclipse.equinox.p2.engine",1331399344788
-started,bundle,org.eclipse.equinox.p2.metadata,2.1.0.v20110510,"org.eclipse.equinox.p2.metadata",1331399344844
-started,bundle,org.eclipse.equinox.p2.metadata.repository,1.2.0.v20110511-1359,"org.eclipse.equinox.p2.metadata.repository",1331399344865
-started,bundle,org.eclipse.equinox.p2.operations,2.1.0.v20110511-1821,"org.eclipse.equinox.p2.operations",1331399344925
-started,bundle,org.eclipse.equinox.p2.reconciler.dropins,1.1.100.v20110510,"org.eclipse.equinox.p2.reconciler.dropins",1331399345296
-started,bundle,org.eclipse.equinox.p2.repository,2.1.0.v20110601,"org.eclipse.equinox.p2.repository",1331399345372
-started,bundle,org.eclipse.equinox.p2.ui.sdk.scheduler,1.0.100.v20110502-1955,"org.eclipse.equinox.p2.ui.sdk.scheduler",1331399345380
-started,bundle,org.eclipse.equinox.p2.updatechecker,1.1.200.v20110502-1955,"org.eclipse.equinox.p2.updatechecker",1331399345474
-started,bundle,org.eclipse.equinox.preferences,3.4.0.v20110502,"org.eclipse.equinox.preferences",1331399345569
-started,bundle,org.eclipse.equinox.registry,3.5.100.v20110502,"org.eclipse.equinox.registry",1331399345673
-started,bundle,org.eclipse.equinox.security,1.1.0.v20110502,"org.eclipse.equinox.security",1331399345767
-started,bundle,org.eclipse.equinox.util,1.0.300.v20110502,"org.eclipse.equinox.util",1331399345814
-started,bundle,org.eclipse.help,3.5.100.v20110426,"org.eclipse.help",1331399345884
-started,bundle,org.eclipse.jdt.core,3.7.0.v_B61,"org.eclipse.jdt.core",1331399345924
-started,bundle,org.eclipse.jdt.core.manipulation,1.4.0.v20110505-0800,"org.eclipse.jdt.core.manipulation",1331399345937
-started,bundle,org.eclipse.jdt.launching,3.6.0.v20110509,"org.eclipse.jdt.launching",1331399345971
-started,bundle,org.eclipse.jdt.launching.macosx,3.2.100.v20110509,"org.eclipse.jdt.launching.macosx",1331399346042
-started,bundle,org.eclipse.jdt.ui,3.7.0.v20110531-1200,"org.eclipse.jdt.ui",1331399346042
-started,bundle,org.eclipse.jface,3.7.0.I20110522-1430,"org.eclipse.jface",1331399346057
-started,bundle,org.eclipse.jsch.core,1.1.300.I20110514-0800,"org.eclipse.jsch.core",1331399346224
-started,bundle,org.eclipse.ltk.core.refactoring,3.5.200.v20110505-0800,"org.eclipse.ltk.core.refactoring",1331399346241
-started,bundle,org.eclipse.ltk.ui.refactoring,3.6.0.v20110505-0800,"org.eclipse.ltk.ui.refactoring",1331399346288
-started,bundle,org.eclipse.m2e.logback.configuration,1.0.0.20110607-2117,"org.eclipse.m2e.logback.configuration",1331399346302
-started,bundle,org.eclipse.mylyn.bugzilla.core,3.6.0.v20110608-1400,"org.eclipse.mylyn.bugzilla.core",1331399346339
-started,bundle,org.eclipse.mylyn.bugzilla.ui,3.6.0.v20110608-1400,"org.eclipse.mylyn.bugzilla.ui",1331399346373
-started,bundle,org.eclipse.mylyn.commons.identity,0.8.0.v20110608-1400,"org.eclipse.mylyn.commons.identity",1331399346383
-started,bundle,org.eclipse.mylyn.commons.net,3.6.0.v20110608-1400,"org.eclipse.mylyn.commons.net",1331399346383
-started,bundle,org.eclipse.mylyn.context.core,3.6.0.v20110608-1400,"org.eclipse.mylyn.context.core",1331399346395
-started,bundle,org.eclipse.mylyn.context.ui,3.6.0.v20110608-1400,"org.eclipse.mylyn.context.ui",1331399346439
-started,bundle,org.eclipse.mylyn.monitor.ui,3.6.0.v20110608-1400,"org.eclipse.mylyn.monitor.ui",1331399346459
-started,bundle,org.eclipse.mylyn.tasks.ui,3.6.0.v20110608-1400,"org.eclipse.mylyn.tasks.ui",1331399346576
-started,bundle,org.eclipse.mylyn.team.ui,3.6.0.v20110608-1400,"org.eclipse.mylyn.team.ui",1331399346640
-started,bundle,org.eclipse.search,3.7.0.v20110505-0800,"org.eclipse.search",1331399346654
-started,bundle,org.eclipse.team.core,3.6.0.I20110525-0800,"org.eclipse.team.core",1331399346686
-started,bundle,org.eclipse.team.cvs.core,3.3.400.I20110510-0800,"org.eclipse.team.cvs.core",1331399346777
-started,bundle,org.eclipse.team.ui,3.6.100.I20110525-0800,"org.eclipse.team.ui",1331399346790
-started,bundle,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui",1331399346852
-started,bundle,org.eclipse.ui.console,3.5.100.v20110511,"org.eclipse.ui.console",1331399346873
-started,bundle,org.eclipse.ui.editors,3.7.0.v20110517-0800,"org.eclipse.ui.editors",1331399346873
-started,bundle,org.eclipse.ui.forms,3.5.100.v20110425,"org.eclipse.ui.forms",1331399346927
-started,bundle,org.eclipse.ui.ide,3.7.0.I20110519-0100,"org.eclipse.ui.ide",1331399347010
-started,bundle,org.eclipse.ui.net,1.2.100.I20110511-0800,"org.eclipse.ui.net",1331399347038
-started,bundle,org.eclipse.ui.views,3.6.0.I20110412-0800,"org.eclipse.ui.views",1331399347040
-started,bundle,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"org.eclipse.ui.workbench",1331399347054
-started,bundle,org.eclipse.ui.workbench.texteditor,3.7.0.v20110505-0800,"org.eclipse.ui.workbench.texteditor",1331399347077
-started,bundle,org.eclipse.update.configurator,3.3.100.v20100512,"org.eclipse.update.configurator",1331399347118
-started,bundle,org.eclipse.update.core,3.2.500.v20110330,"org.eclipse.update.core",1331399347143
-started,bundle,com.google.appengine.eclipse.core,2.5.2.v201202290255-rel-r37,"com.google.appengine.eclipse.core",1331399347143
-started,bundle,com.google.gdt.eclipse.appengine.rpc,2.5.2.v201202290255-rel-r37,"com.google.gdt.eclipse.appengine.rpc",1331399347149
-started,bundle,com.google.gdt.eclipse.core,2.5.2.v201202290255-rel-r37,"com.google.gdt.eclipse.core",1331399347150
-started,bundle,com.google.gdt.eclipse.designer,2.5.0.r37x201112291029,"com.google.gdt.eclipse.designer",1331399347189
-started,bundle,com.google.gdt.eclipse.login,2.5.2.v201202290255-rel-r37,"com.google.gdt.eclipse.login",1331399347190
-started,bundle,com.google.gdt.eclipse.managedapis,2.5.2.v201202290255-rel-r37,"com.google.gdt.eclipse.managedapis",1331399347190
-started,bundle,com.google.gdt.eclipse.platform.e37,2.5.2.v201202290255-rel-r37,"com.google.gdt.eclipse.platform.e37",1331399347205
-started,bundle,com.google.gdt.eclipse.platform.shared,2.5.2.v201202290255-rel-r37,"com.google.gdt.eclipse.platform.shared",1331399347205
-started,bundle,com.google.gdt.eclipse.suite.ext,2.5.2.v201202290255-rel-r37,"com.google.gdt.eclipse.suite.ext",1331399347205
-started,bundle,com.google.gwt.eclipse.core,2.5.2.v201202290255-rel-r37,"com.google.gwt.eclipse.core",1331399347264
-started,bundle,org.eclipse.mylyn.commons.ui,3.6.1.v20110720-0100,"org.eclipse.mylyn.commons.ui",1331399347273
-started,bundle,org.eclipse.wb.core,1.2.0.r37x201112290923,"org.eclipse.wb.core",1331399347298
-started,bundle,org.eclipse.wb.core.lib,1.2.0.r37x201112290923,"org.eclipse.wb.core.lib",1331399347312
-os,sysinfo,,,"macosx",1331399347316
-arch,sysinfo,,,"x86_64",1331399347316
-ws,sysinfo,,,"cocoa",1331399347316
-locale,sysinfo,,,"ja_JP",1331399347316
-processors,sysinfo,,,"8",1331399347316
-java.runtime.name,sysinfo,,,"Java(TM) SE Runtime Environment",1331399347316
-java.runtime.version,sysinfo,,,"1.6.0_29-b11-402-11D50d",1331399347316
-java.specification.name,sysinfo,,,"Java Platform API Specification",1331399347316
-java.specification.vendor,sysinfo,,,"Sun Microsystems Inc.",1331399347316
-java.specification.version,sysinfo,,,"1.6",1331399347316
-java.vendor,sysinfo,,,"Apple Inc.",1331399347316
-java.version,sysinfo,,,"1.6.0_29",1331399347316
-java.vm.info,sysinfo,,,"mixed mode",1331399347316
-java.vm.name,sysinfo,,,"Java HotSpot(TM) 64-Bit Server VM",1331399347316
-java.vm.specification.name,sysinfo,,,"Java Virtual Machine Specification",1331399347316
-java.vm.specification.vendor,sysinfo,,,"Sun Microsystems Inc.",1331399347316
-java.vm.specification.version,sysinfo,,,"1.0",1331399347316
-java.vm.vendor,sysinfo,,,"Apple Inc.",1331399347316
-java.vm.version,sysinfo,,,"20.4-b02-402",1331399347316
-started,bundle,org.eclipse.m2e.usagedata,1.0.200.20111228-1245,"org.eclipse.m2e.usagedata",1331399347342
-opened,view,org.eclipse.ui.ide,3.7.0.I20110519-0100,"org.eclipse.ui.views.ProblemView",1331399347967
-started,bundle,org.eclipse.update.scheduler,3.2.300.v20100512,"org.eclipse.update.scheduler",1331399348241
-started,bundle,org.eclipse.wb.discovery.core,1.0.0.r37x201106081733,"org.eclipse.wb.discovery.core",1331399348404
-started,bundle,org.eclipse.wb.discovery.ui,1.0.0.r37x201106081733,"org.eclipse.wb.discovery.ui",1331399350282
-started,bundle,com.google.gdt.eclipse.designer.hosted,2.5.0.r37x201112291019,"com.google.gdt.eclipse.designer.hosted",1331399350414
-started,bundle,com.google.gdt.eclipse.designer.UiBinder,2.5.0.r37x201112291029,"com.google.gdt.eclipse.designer.UiBinder",1331399350608
-started,bundle,com.google.gdt.eclipse.maven,2.5.2.v201202290255-rel-r37,"com.google.gdt.eclipse.maven",1331399353338
-started,bundle,com.google.gdt.eclipse.suite,2.5.2.v201202290255-rel-r37,"com.google.gdt.eclipse.suite",1331399353468
-started,bundle,org.eclipse.core.variables,3.2.500.v20110511,"org.eclipse.core.variables",1331399353587
-activated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1331399387400
-activated,editor,org.eclipse.jdt.ui,3.7.0.v20110531-1200,"org.eclipse.jdt.ui.CompilationUnitEditor",1331399387407
-opened,editor,org.eclipse.jdt.ui,3.7.0.v20110531-1200,"org.eclipse.jdt.ui.CompilationUnitEditor",1331399394093
-activated,editor,org.eclipse.jdt.ui,3.7.0.v20110531-1200,"org.eclipse.jdt.ui.CompilationUnitEditor",1331399394171
-executed,command,org.eclipse.jdt.ui,3.7.0.v20110531-1200,"org.eclipse.jdt.ui.edit.text.java.open.editor",1331399394231
-executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.edit.copy",1331399416912
-executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.edit.paste",1331399417951
-started,bundle,org.eclipse.jdt.junit,3.7.0.v20110505-0800,"org.eclipse.jdt.junit",1331399418814
-executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.edit.copy",1331399438689
-executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.edit.paste",1331399439664
-executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.file.save",1331399459724
-started,bundle,org.eclipse.debug.ui,3.7.0.v20110518,"org.eclipse.debug.ui",1331399460211
-started,bundle,org.eclipse.jdt.debug,3.7.0.v20110509,"org.eclipse.jdt.debug",1331399460460
-started,bundle,org.eclipse.jdt.debug.ui,3.6.0.v20110512,"org.eclipse.jdt.debug.ui",1331399460520
-executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.file.save",1331399572725
-deactivated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1331399577122
-activated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1331399578919
-closed,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1331399579212
-started,bundle,org.eclipse.compare,3.5.200.I20110525-0800,"org.eclipse.compare",1331399579866
-stopped,bundle,org.eclipse.m2e.logback.configuration,1.0.0.20110607-2117,"org.eclipse.m2e.logback.configuration",1331399580278
-stopped,bundle,org.eclipse.ui.cheatsheets,3.4.100.v20110425,"org.eclipse.ui.cheatsheets",1331399580278
-stopped,bundle,org.eclipse.help.ui,3.5.100.v20110425,"org.eclipse.help.ui",1331399580278
-stopped,bundle,org.eclipse.help.webapp,3.6.0.v20110518,"org.eclipse.help.webapp",1331399580278
-stopped,bundle,org.eclipse.epp.mpc.ui,1.1.0.I20110525-0742,"org.eclipse.epp.mpc.ui",1331399580279
-stopped,bundle,org.eclipse.epp.usagedata.ui,1.3.1.R201106061540,"org.eclipse.epp.usagedata.ui",1331399580279
-stopped,bundle,org.eclipse.ui.intro.universal,3.2.500.v20110510,"org.eclipse.ui.intro.universal",1331399580279
-stopped,bundle,org.eclipse.ui.intro,3.4.100.v20110425,"org.eclipse.ui.intro",1331399580279
-stopped,bundle,org.eclipse.help.base,3.6.0.v201106131736,"org.eclipse.help.base",1331399580279
-stopped,bundle,org.eclipse.equinox.http.jetty,2.0.100.v20110502,"org.eclipse.equinox.http.jetty",1331399580280
-stopped,bundle,com.google.appengine.eclipse.datatools,2.5.2.v201202290255-rel-r37,"com.google.appengine.eclipse.datatools",1331399580280
-stopped,bundle,com.google.appengine.eclipse.sdkbundle,1.6.3.v201202290255r37,"com.google.appengine.eclipse.sdkbundle",1331399580280
-stopped,bundle,com.google.gdt.eclipse.appengine.rpc,2.5.2.v201202290255-rel-r37,"com.google.gdt.eclipse.appengine.rpc",1331399580281
-stopped,bundle,com.google.gdt.eclipse.gph.e36,2.5.2.v201202290255-rel-r37,"com.google.gdt.eclipse.gph.e36",1331399580281
-stopped,bundle,com.google.gdt.eclipse.gph.hge,2.5.2.v201202290255-rel-r37,"com.google.gdt.eclipse.gph.hge",1331399580281
-stopped,bundle,com.google.gdt.eclipse.gph.subclipse,2.5.2.v201202290255-rel-r37,"com.google.gdt.eclipse.gph.subclipse",1331399580281
+activated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1331998697842
+deactivated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1331998717970
+activated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1331999122904
+activated,view,org.eclipse.jdt.ui,3.7.0.v20110531-1200,"org.eclipse.jdt.ui.PackageExplorer",1331999124604
+started,bundle,org.eclipse.compare,3.5.200.I20110525-0800,"org.eclipse.compare",1331999132840
+deactivated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1331999136289
+activated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1331999142258
+opened,editor,org.eclipse.jdt.ui,3.7.0.v20110531-1200,"org.eclipse.jdt.ui.CompilationUnitEditor",1331999142511
+activated,editor,org.eclipse.jdt.ui,3.7.0.v20110531-1200,"org.eclipse.jdt.ui.CompilationUnitEditor",1331999142591
+deactivated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1331999144857
+activated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1331999155351
+executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.edit.paste",1331999158539
+executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.edit.selectAll",1331999205644
+executed,command,org.eclipse.jdt.ui,3.7.0.v20110531-1200,"org.eclipse.jdt.ui.edit.text.java.format",1331999206572
+executed,command,org.eclipse.jdt.ui,3.7.0.v20110531-1200,"org.eclipse.jdt.ui.edit.text.java.format",1331999208136
+executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.edit.selectAll",1331999213187
+executed,command,org.eclipse.jdt.ui,3.7.0.v20110531-1200,"org.eclipse.jdt.ui.edit.text.java.format",1331999214173
+executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.file.save",1331999214816
+executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.file.save",1331999219966
+executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.edit.copy",1331999222049
+activated,editor,org.eclipse.jdt.ui,3.7.0.v20110531-1200,"org.eclipse.jdt.ui.CompilationUnitEditor",1331999228268
+executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.edit.paste",1331999246537
+executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.file.save",1331999255717
+executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.edit.copy",1331999257345
+executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.edit.paste",1331999275053
+executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.file.save",1331999282645
+executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.file.save",1331999290419
+deactivated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1331999303615
+activated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1331999343144
+executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.edit.copy",1331999346633
+activated,editor,org.eclipse.jdt.ui,3.7.0.v20110531-1200,"org.eclipse.jdt.ui.CompilationUnitEditor",1331999348095
+deactivated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1331999352240
+executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.edit.findReplace",1331999352285
+activated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1331999360594
+deactivated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1331999362545
+activated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1331999362658
+executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.edit.paste",1331999366228
+executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.edit.copy",1331999372591
+executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.edit.paste",1331999375466
+deactivated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1331999383658
+executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.edit.findReplace",1331999383695
+activated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1331999387249
+executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.edit.paste",1331999390289
+deactivated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1331999392195
+executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.edit.findReplace",1331999392233
+activated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1331999401839
+executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.file.save",1331999411579
+deactivated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1331999421185
+activated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1331999446222
+deactivated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1331999450982
+activated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1331999452421
+executed,command,com.google.appengine.eclipse.core,2.5.2.v201202290255-rel-r37,"com.google.appengine.eclipse.core.deployToGoogle",1331999455418
+deactivated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1331999457709
+activated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1331999555098
+activated,view,org.eclipse.jdt.ui,3.7.0.v20110531-1200,"org.eclipse.jdt.ui.PackageExplorer",1331999558572
+opened,editor,org.eclipse.jdt.ui,3.7.0.v20110531-1200,"org.eclipse.jdt.ui.CompilationUnitEditor",1331999560138
+activated,editor,org.eclipse.jdt.ui,3.7.0.v20110531-1200,"org.eclipse.jdt.ui.CompilationUnitEditor",1331999560208
+activated,view,org.eclipse.jdt.ui,3.7.0.v20110531-1200,"org.eclipse.jdt.ui.PackageExplorer",1331999563282
+activated,editor,org.eclipse.jdt.ui,3.7.0.v20110531-1200,"org.eclipse.jdt.ui.CompilationUnitEditor",1331999564454
+deactivated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1331999572255
+activated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1331999616240
+activated,view,org.eclipse.jdt.ui,3.7.0.v20110531-1200,"org.eclipse.jdt.ui.PackageExplorer",1331999629833
+deactivated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1331999634839
+activated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1331999641857
+deactivated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1331999645375
+started,bundle,org.eclipse.wst.jsdt.manipulation,1.0.300.v201104272153,"org.eclipse.wst.jsdt.manipulation",1331999650069
+started,bundle,org.eclipse.wst.jsdt.core,1.1.102.v201111090634,"org.eclipse.wst.jsdt.core",1331999650366
+started,bundle,org.eclipse.wst.jsdt.ui,1.1.102.v201201131900,"org.eclipse.wst.jsdt.ui",1331999650512
+activated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1331999651663
+activated,editor,org.eclipse.jdt.ui,3.7.0.v20110531-1200,"org.eclipse.jdt.ui.CompilationUnitEditor",1331999655384
+executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.file.save",1331999663638
+deactivated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1331999668892
+activated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1331999670673
+executed,command,com.google.appengine.eclipse.core,2.5.2.v201202290255-rel-r37,"com.google.appengine.eclipse.core.deployToGoogle",1331999671744
+deactivated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1331999679419
+activated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1331999775532
+activated,view,org.eclipse.jdt.ui,3.7.0.v20110531-1200,"org.eclipse.jdt.ui.PackageExplorer",1331999777615
+activated,editor,org.eclipse.jdt.ui,3.7.0.v20110531-1200,"org.eclipse.jdt.ui.CompilationUnitEditor",1331999777889
+activated,editor,org.eclipse.jdt.ui,3.7.0.v20110531-1200,"org.eclipse.jdt.ui.CompilationUnitEditor",1331999791582
+deactivated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1331999812681
+activated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1331999946199
+activated,editor,org.eclipse.jdt.ui,3.7.0.v20110531-1200,"org.eclipse.jdt.ui.CompilationUnitEditor",1331999949935
+deactivated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1331999974951
+activated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1332172045134
+closed,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1332172045488
+stopped,bundle,org.eclipse.m2e.logback.configuration,1.0.0.20110607-2117,"org.eclipse.m2e.logback.configuration",1332172046395
+stopped,bundle,org.eclipse.ui.cheatsheets,3.4.100.v20110425,"org.eclipse.ui.cheatsheets",1332172046395
+stopped,bundle,org.eclipse.help.ui,3.5.100.v20110425,"org.eclipse.help.ui",1332172046395
+stopped,bundle,org.eclipse.help.webapp,3.6.0.v20110518,"org.eclipse.help.webapp",1332172046395
+stopped,bundle,org.eclipse.epp.mpc.ui,1.1.0.I20110525-0742,"org.eclipse.epp.mpc.ui",1332172046398
+stopped,bundle,org.eclipse.epp.usagedata.ui,1.3.1.R201106061540,"org.eclipse.epp.usagedata.ui",1332172046399
+stopped,bundle,org.eclipse.ui.intro.universal,3.2.500.v20110510,"org.eclipse.ui.intro.universal",1332172046399
+stopped,bundle,org.eclipse.ui.intro,3.4.100.v20110425,"org.eclipse.ui.intro",1332172046399
+stopped,bundle,org.eclipse.help.base,3.6.0.v201106131736,"org.eclipse.help.base",1332172046399
+stopped,bundle,org.eclipse.equinox.http.jetty,2.0.100.v20110502,"org.eclipse.equinox.http.jetty",1332172046399
+stopped,bundle,com.google.appengine.eclipse.datatools,2.5.2.v201202290255-rel-r37,"com.google.appengine.eclipse.datatools",1332172046399
+stopped,bundle,com.google.appengine.eclipse.sdkbundle,1.6.3.v201202290255r37,"com.google.appengine.eclipse.sdkbundle",1332172046399
+stopped,bundle,com.google.gdt.eclipse.appengine.rpc,2.5.2.v201202290255-rel-r37,"com.google.gdt.eclipse.appengine.rpc",1332172046401
+stopped,bundle,com.google.gdt.eclipse.gph.e36,2.5.2.v201202290255-rel-r37,"com.google.gdt.eclipse.gph.e36",1332172046401
+stopped,bundle,com.google.gdt.eclipse.gph.hge,2.5.2.v201202290255-rel-r37,"com.google.gdt.eclipse.gph.hge",1332172046401
+stopped,bundle,com.google.gdt.eclipse.gph.subclipse,2.5.2.v201202290255-rel-r37,"com.google.gdt.eclipse.gph.subclipse",1332172046401
+stopped,bundle,com.google.gdt.eclipse.gph.subversive,2.5.2.v201202290255-rel-r37,"com.google.gdt.eclipse.gph.subversive",1332172046401
+stopped,bundle,com.google.gdt.eclipse.suite.ext,2.5.2.v201202290255-rel-r37,"com.google.gdt.eclipse.suite.ext",1332172046401
+stopped,bundle,com.google.gdt.eclipse.gph,2.5.2.v201202290255-rel-r37,"com.google.gdt.eclipse.gph",1332172046401
+stopped,bundle,com.google.gdt.eclipse.maven.e37,2.5.2.v201202290255-rel-r37,"com.google.gdt.eclipse.maven.e37",1332172046401
+stopped,bundle,com.google.gdt.eclipse.maven,2.5.2.v201202290255-rel-r37,"com.google.gdt.eclipse.maven",1332172046402
+stopped,bundle,com.google.gdt.eclipse.suite,2.5.2.v201202290255-rel-r37,"com.google.gdt.eclipse.suite",1332172046402
+stopped,bundle,com.google.gdt.eclipse.appsmarketplace,2.5.2.v201202290255-rel-r37,"com.google.gdt.eclipse.appsmarketplace",1332172046402
+stopped,bundle,com.google.appengine.eclipse.core,2.5.2.v201202290255-rel-r37,"com.google.appengine.eclipse.core",1332172046404
+stopped,bundle,com.google.gdt.eclipse.login,2.5.2.v201202290255-rel-r37,"com.google.gdt.eclipse.login",1332172046404
+stopped,bundle,com.google.gdt.eclipse.managedapis,2.5.2.v201202290255-rel-r37,"com.google.gdt.eclipse.managedapis",1332172046413
+stopped,bundle,com.google.gwt.eclipse.oophm,2.5.2.v201202290255-rel-r37,"com.google.gwt.eclipse.oophm",1332172046413
+stopped,bundle,com.google.gwt.eclipse.sdkbundle,2.4.0.v201202290255-rel-r37,"com.google.gwt.eclipse.sdkbundle",1332172046413
+stopped,bundle,com.google.gwt.eclipse.core,2.5.2.v201202290255-rel-r37,"com.google.gwt.eclipse.core",1332172046518
+stopped,bundle,com.google.gdt.eclipse.core,2.5.2.v201202290255-rel-r37,"com.google.gdt.eclipse.core",1332172046518
+stopped,bundle,com.google.gdt.eclipse.platform,2.5.2.v201202290255-rel-r37,"com.google.gdt.eclipse.platform",1332172046518
+stopped,bundle,com.google.gdt.eclipse.platform.e37,2.5.2.v201202290255-rel-r37,"com.google.gdt.eclipse.platform.e37",1332172046518
+stopped,bundle,org.eclipse.m2e.discovery,1.0.200.20111228-1245,"org.eclipse.m2e.discovery",1332172046519
+stopped,bundle,org.eclipse.m2e.refactoring,1.0.200.20111228-1245,"org.eclipse.m2e.refactoring",1332172046520
+stopped,bundle,org.eclipse.m2e.editor,1.0.200.20111228-1245,"org.eclipse.m2e.editor",1332172046520
+stopped,bundle,org.eclipse.m2e.editor.xml,1.0.200.20111228-1245,"org.eclipse.m2e.editor.xml",1332172046520
+stopped,bundle,org.eclipse.m2e.jdt,1.0.200.20111228-1245,"org.eclipse.m2e.jdt",1332172046520
+stopped,bundle,org.eclipse.m2e.launching,1.0.200.20111228-1245,"org.eclipse.m2e.launching",1332172046520
+stopped,bundle,org.eclipse.m2e.usagedata,1.0.200.20111228-1245,"org.eclipse.m2e.usagedata",1332172046520
+stopped,bundle,org.eclipse.m2e.core.ui,1.0.200.20111228-1245,"org.eclipse.m2e.core.ui",1332172046521
+stopped,bundle,org.eclipse.m2e.core,1.0.200.20111228-1245,"org.eclipse.m2e.core",1332172046521
+stopped,bundle,org.eclipse.mylyn.ide.ant,3.6.0.v20110608-1400,"org.eclipse.mylyn.ide.ant",1332172046521
+stopped,bundle,org.eclipse.ant.ui,3.5.100.v20110510,"org.eclipse.ant.ui",1332172046521
+stopped,bundle,org.eclipse.ant.launching,1.0.100.v20110506,"org.eclipse.ant.launching",1332172046521
+stopped,bundle,org.eclipse.equinox.p2.ui.sdk,1.0.200.v20110502-1955,"org.eclipse.equinox.p2.ui.sdk",1332172046521
+stopped,bundle,org.eclipse.mylyn.java.tasks,3.6.0.v20110608-1400,"org.eclipse.mylyn.java.tasks",1332172046521
+stopped,bundle,org.eclipse.mylyn.java.ui,3.6.0.v20110608-1400,"org.eclipse.mylyn.java.ui",1332172046522
+stopped,bundle,com.google.gdt.eclipse.designer.UiBinder,2.5.0.r37x201112291029,"com.google.gdt.eclipse.designer.UiBinder",1332172046523
+stopped,bundle,com.google.gdt.eclipse.designer.gpe,2.5.0.r37x201201030222,"com.google.gdt.eclipse.designer.gpe",1332172046523
+stopped,bundle,com.google.gdt.eclipse.designer,2.5.0.r37x201112291029,"com.google.gdt.eclipse.designer",1332172046524
+stopped,bundle,org.eclipse.jdt.junit,3.7.0.v20110505-0800,"org.eclipse.jdt.junit",1332172046524
+stopped,bundle,org.eclipse.jdt.apt.ui,3.3.300.v20110305-1450,"org.eclipse.jdt.apt.ui",1332172046524
+stopped,bundle,org.eclipse.jdt.debug.ui,3.6.0.v20110512,"org.eclipse.jdt.debug.ui",1332172046525
+stopped,bundle,com.google.gdt.eclipse.platform.shared,2.5.2.v201202290255-rel-r37,"com.google.gdt.eclipse.platform.shared",1332172046525
+stopped,bundle,org.eclipse.wb.swing.FormLayout,1.0.0.r37x201106081552,"org.eclipse.wb.swing.FormLayout",1332172046525
+stopped,bundle,org.eclipse.wb.swing.MigLayout,1.0.0.r37x201106081552,"org.eclipse.wb.swing.MigLayout",1332172046525
+stopped,bundle,org.eclipse.wb.swing.databinding,1.0.0.r37x201106081552,"org.eclipse.wb.swing.databinding",1332172046525
+stopped,bundle,org.eclipse.wb.swing.java6,1.0.0.r37x201106081552,"org.eclipse.wb.swing.java6",1332172046525
+stopped,bundle,org.eclipse.wb.swing.jsr296,1.0.0.r37x201106081552,"org.eclipse.wb.swing.jsr296",1332172046525
+stopped,bundle,org.eclipse.wb.swing,1.0.0.r37x201106081552,"org.eclipse.wb.swing",1332172046525
+stopped,bundle,org.eclipse.wb.core.ui,1.0.0.r37x201106081733,"org.eclipse.wb.core.ui",1332172046525
+stopped,bundle,org.eclipse.wb.layout.group,1.0.0.r37x201106081642,"org.eclipse.wb.layout.group",1332172046525
+stopped,bundle,com.google.gdt.eclipse.designer.hosted.2_0.webkit,2.5.0.r37x201112291019,"com.google.gdt.eclipse.designer.hosted.2_0.webkit",1332172046525
+stopped,bundle,com.google.gdt.eclipse.designer.hosted.2_0,2.5.0.r37x201112291019,"com.google.gdt.eclipse.designer.hosted.2_0",1332172046525
+stopped,bundle,com.google.gdt.eclipse.designer.hosted.2_2.webkit,2.5.0.r37x201112291019,"com.google.gdt.eclipse.designer.hosted.2_2.webkit",1332172046525
+stopped,bundle,com.google.gdt.eclipse.designer.hosted.2_2,2.5.0.r37x201112291019,"com.google.gdt.eclipse.designer.hosted.2_2",1332172046525
+stopped,bundle,com.google.gdt.eclipse.designer.hosted,2.5.0.r37x201112291019,"com.google.gdt.eclipse.designer.hosted",1332172046526
+stopped,bundle,org.eclipse.wb.core.databinding.xml,1.2.0.r37x201112291009,"org.eclipse.wb.core.databinding.xml",1332172046526
+stopped,bundle,org.eclipse.wb.core.databinding,1.2.0.r37x201112290923,"org.eclipse.wb.core.databinding",1332172046526
+stopped,bundle,org.eclipse.wb.core.xml,1.2.0.r37x201112291009,"org.eclipse.wb.core.xml",1332172046526
+stopped,bundle,org.eclipse.wb.css,1.2.0.r37x201112290951,"org.eclipse.wb.css",1332172046526
+stopped,bundle,org.eclipse.wb.os.macosx,1.2.0.r37x201112290923,"org.eclipse.wb.os.macosx",1332172046526
+stopped,bundle,org.eclipse.wb.core,1.2.0.r37x201112290923,"org.eclipse.wb.core",1332172046526
+stopped,bundle,org.eclipse.jdt.ui,3.7.0.v20110531-1200,"org.eclipse.jdt.ui",1332172046534
+stopped,bundle,org.eclipse.wst.dtd.ui,1.0.600.v201103171359,"org.eclipse.wst.dtd.ui",1332172046534
+stopped,bundle,org.eclipse.wst.xsd.ui,1.2.404.v201105050216,"org.eclipse.wst.xsd.ui",1332172046534
+stopped,bundle,org.eclipse.wst.css.ui,1.0.601.v201201101544,"org.eclipse.wst.css.ui",1332172046534
+stopped,bundle,org.eclipse.wst.xml.ui,1.1.202.v201112071516,"org.eclipse.wst.xml.ui",1332172046534
+stopped,bundle,org.eclipse.wst.common.ui,1.1.500.v200911190730,"org.eclipse.wst.common.ui",1332172046534
+stopped,bundle,org.eclipse.wst.jsdt.ui,1.1.102.v201201131900,"org.eclipse.wst.jsdt.ui",1332172046567
+stopped,bundle,org.eclipse.wst.sse.ui,1.3.2.v201201041522,"org.eclipse.wst.sse.ui",1332172046567
+stopped,bundle,org.eclipse.search,3.7.0.v20110505-0800,"org.eclipse.search",1332172046594
+stopped,bundle,org.eclipse.mylyn.commons.team,0.8.0.v20110608-1400,"org.eclipse.mylyn.commons.team",1332172046594
+stopped,bundle,org.eclipse.mylyn.team.ui,3.6.0.v20110608-1400,"org.eclipse.mylyn.team.ui",1332172046596
+stopped,bundle,org.eclipse.ui.navigator.resources,3.4.300.I20110421-1800,"org.eclipse.ui.navigator.resources",1332172046596
+stopped,bundle,org.eclipse.ltk.ui.refactoring,3.6.0.v20110505-0800,"org.eclipse.ltk.ui.refactoring",1332172046597
+stopped,bundle,org.eclipse.mylyn.bugzilla.ui,3.6.0.v20110608-1400,"org.eclipse.mylyn.bugzilla.ui",1332172046597
+stopped,bundle,org.eclipse.mylyn.ide.ui,3.6.0.v20110608-1400,"org.eclipse.mylyn.ide.ui",1332172046597
+stopped,bundle,org.eclipse.mylyn.resources.ui,3.6.0.v20110608-1400,"org.eclipse.mylyn.resources.ui",1332172046597
+stopped,bundle,org.eclipse.mylyn.wikitext.tasks.ui,1.5.0.v20110608-1400,"org.eclipse.mylyn.wikitext.tasks.ui",1332172046597
+stopped,bundle,org.eclipse.mylyn.context.ui,3.6.0.v20110608-1400,"org.eclipse.mylyn.context.ui",1332172046597
+stopped,bundle,org.eclipse.mylyn.help.ui,3.6.0.v20110608-1400,"org.eclipse.mylyn.help.ui",1332172046598
+stopped,bundle,org.eclipse.mylyn.tasks.bugs,3.6.0.v20110608-1400,"org.eclipse.mylyn.tasks.bugs",1332172046598
+stopped,bundle,org.eclipse.mylyn.tasks.ui,3.6.0.v20110608-1400,"org.eclipse.mylyn.tasks.ui",1332172046598
+stopped,bundle,org.eclipse.team.cvs.ui,3.3.400.I20110510-0800,"org.eclipse.team.cvs.ui",1332172046599
+stopped,bundle,org.eclipse.team.ui,3.6.100.I20110525-0800,"org.eclipse.team.ui",1332172046599
+stopped,bundle,org.eclipse.compare,3.5.200.I20110525-0800,"org.eclipse.compare",1332172046599
+stopped,bundle,org.eclipse.ui.externaltools,3.2.0.v20110506,"org.eclipse.ui.externaltools",1332172046599
+stopped,bundle,org.eclipse.debug.ui,3.7.0.v20110518,"org.eclipse.debug.ui",1332172046616
+stopped,bundle,org.eclipse.mylyn.wikitext.ui,1.5.0.v20110608-1400,"org.eclipse.mylyn.wikitext.ui",1332172046616
+stopped,bundle,org.eclipse.ui.console,3.5.100.v20110511,"org.eclipse.ui.console",1332172046616
+stopped,bundle,org.eclipse.mylyn.commons.ui,3.6.1.v20110720-0100,"org.eclipse.mylyn.commons.ui",1332172046616
+stopped,bundle,org.eclipse.ui.editors,3.7.0.v20110517-0800,"org.eclipse.ui.editors",1332172046617
+stopped,bundle,org.eclipse.wst.common.snippets,1.2.100.v201103281740,"org.eclipse.wst.common.snippets",1332172046617
+stopped,bundle,org.eclipse.ui.workbench.texteditor,3.7.0.v20110505-0800,"org.eclipse.ui.workbench.texteditor",1332172046617
+stopped,bundle,org.eclipse.compare.core,3.5.200.I20110208-0800,"org.eclipse.compare.core",1332172046618
+stopped,bundle,org.eclipse.emf.edit.ui,2.7.0.v20110606-0949,"org.eclipse.emf.edit.ui",1332172046618
+activated,perspective,org.eclipse.jdt.ui,,"org.eclipse.jdt.ui.JavaPerspective",1332199914431
+started,bundle,org.eclipse.osgi,3.7.0.v20110613,"org.eclipse.osgi",1332199914433
+started,bundle,org.eclipse.equinox.simpleconfigurator,1.0.200.v20110502-1955,"org.eclipse.equinox.simpleconfigurator",1332199914433
+started,bundle,com.ibm.icu,4.4.2.v20110208,"com.ibm.icu",1332199914433
+started,bundle,org.eclipse.compare.core,3.5.200.I20110208-0800,"org.eclipse.compare.core",1332199914433
+started,bundle,org.eclipse.core.contenttype,3.4.100.v20110423-0524,"org.eclipse.core.contenttype",1332199914433
+started,bundle,org.eclipse.core.databinding.observable,1.4.0.I20110222-0800,"org.eclipse.core.databinding.observable",1332199914434
+started,bundle,org.eclipse.core.expressions,3.4.300.v20110228,"org.eclipse.core.expressions",1332199914434
+started,bundle,org.eclipse.core.filebuffers,3.5.200.v20110505-0800,"org.eclipse.core.filebuffers",1332199914434
+started,bundle,org.eclipse.core.filesystem,1.3.100.v20110423-0524,"org.eclipse.core.filesystem",1332199914434
+started,bundle,org.eclipse.core.jobs,3.5.100.v20110404,"org.eclipse.core.jobs",1332199914434
+started,bundle,org.eclipse.core.net,1.2.100.I20110511-0800,"org.eclipse.core.net",1332199914434
+started,bundle,org.eclipse.core.resources,3.7.100.v20110510-0712,"org.eclipse.core.resources",1332199914434
+started,bundle,org.eclipse.core.runtime,3.7.0.v20110110,"org.eclipse.core.runtime",1332199914434
+started,bundle,org.eclipse.core.runtime.compatibility,3.2.100.v20100505,"org.eclipse.core.runtime.compatibility",1332199914434
+started,bundle,org.eclipse.core.runtime.compatibility.auth,3.2.200.v20110110,"org.eclipse.core.runtime.compatibility.auth",1332199914434
+started,bundle,org.eclipse.debug.core,3.7.0.v20110518,"org.eclipse.debug.core",1332199914434
+started,bundle,org.eclipse.epp.mpc.ui,1.1.0.I20110525-0742,"org.eclipse.epp.mpc.ui",1332199914434
+started,bundle,org.eclipse.epp.usagedata.gathering,1.3.1.R201106061540,"org.eclipse.epp.usagedata.gathering",1332199914434
+started,bundle,org.eclipse.epp.usagedata.recording,1.3.1.R201106061540,"org.eclipse.epp.usagedata.recording",1332199914434
+started,bundle,org.eclipse.equinox.app,1.3.100.v20110321,"org.eclipse.equinox.app",1332199914434
+started,bundle,org.eclipse.equinox.common,3.6.0.v20110523,"org.eclipse.equinox.common",1332199914434
+started,bundle,org.eclipse.equinox.ds,1.3.0.v20110502,"org.eclipse.equinox.ds",1332199914434
+started,bundle,org.eclipse.equinox.event,1.2.100.v20110502,"org.eclipse.equinox.event",1332199914434
+started,bundle,org.eclipse.equinox.p2.core,2.1.0.v20110502-1955,"org.eclipse.equinox.p2.core",1332199914434
+started,bundle,org.eclipse.equinox.p2.directorywatcher,1.0.300.v20110502-1955,"org.eclipse.equinox.p2.directorywatcher",1332199914434
+started,bundle,org.eclipse.equinox.p2.engine,2.1.0.v20110511,"org.eclipse.equinox.p2.engine",1332199914434
+started,bundle,org.eclipse.equinox.p2.metadata,2.1.0.v20110510,"org.eclipse.equinox.p2.metadata",1332199914434
+started,bundle,org.eclipse.equinox.p2.metadata.repository,1.2.0.v20110511-1359,"org.eclipse.equinox.p2.metadata.repository",1332199914434
+started,bundle,org.eclipse.equinox.p2.operations,2.1.0.v20110511-1821,"org.eclipse.equinox.p2.operations",1332199914434
+started,bundle,org.eclipse.equinox.p2.reconciler.dropins,1.1.100.v20110510,"org.eclipse.equinox.p2.reconciler.dropins",1332199914434
+started,bundle,org.eclipse.equinox.p2.repository,2.1.0.v20110601,"org.eclipse.equinox.p2.repository",1332199914434
+started,bundle,org.eclipse.equinox.p2.ui.sdk.scheduler,1.0.100.v20110502-1955,"org.eclipse.equinox.p2.ui.sdk.scheduler",1332199914434
+started,bundle,org.eclipse.equinox.p2.updatechecker,1.1.200.v20110502-1955,"org.eclipse.equinox.p2.updatechecker",1332199914434
+started,bundle,org.eclipse.equinox.preferences,3.4.0.v20110502,"org.eclipse.equinox.preferences",1332199914434
+started,bundle,org.eclipse.equinox.registry,3.5.100.v20110502,"org.eclipse.equinox.registry",1332199914434
+started,bundle,org.eclipse.equinox.security,1.1.0.v20110502,"org.eclipse.equinox.security",1332199914434
+started,bundle,org.eclipse.equinox.util,1.0.300.v20110502,"org.eclipse.equinox.util",1332199914434
+started,bundle,org.eclipse.help,3.5.100.v20110426,"org.eclipse.help",1332199914434
+started,bundle,org.eclipse.jdt.apt.core,3.3.500.v20110420-1015,"org.eclipse.jdt.apt.core",1332199914434
+started,bundle,org.eclipse.jdt.apt.pluggable.core,1.0.400.v20110305-1450,"org.eclipse.jdt.apt.pluggable.core",1332199914434
+started,bundle,org.eclipse.jdt.core,3.7.0.v_B61,"org.eclipse.jdt.core",1332199914434
+started,bundle,org.eclipse.jdt.core.manipulation,1.4.0.v20110505-0800,"org.eclipse.jdt.core.manipulation",1332199914434
+started,bundle,org.eclipse.jdt.launching,3.6.0.v20110509,"org.eclipse.jdt.launching",1332199914494
+started,bundle,org.eclipse.jdt.launching.macosx,3.2.100.v20110509,"org.eclipse.jdt.launching.macosx",1332199914519
+started,bundle,org.eclipse.jdt.ui,3.7.0.v20110531-1200,"org.eclipse.jdt.ui",1332199914519
+started,bundle,org.eclipse.jface,3.7.0.I20110522-1430,"org.eclipse.jface",1332199914592
+started,bundle,org.eclipse.ltk.core.refactoring,3.5.200.v20110505-0800,"org.eclipse.ltk.core.refactoring",1332199914605
+started,bundle,org.eclipse.ltk.ui.refactoring,3.6.0.v20110505-0800,"org.eclipse.ltk.ui.refactoring",1332199914663
+started,bundle,org.eclipse.m2e.logback.configuration,1.0.0.20110607-2117,"org.eclipse.m2e.logback.configuration",1332199914680
index 662af14..ead44cb 100644 (file)
 what,kind,bundleId,bundleVersion,description,time
-stopped,bundle,com.google.gdt.eclipse.gph.subversive,2.5.2.v201202290255-rel-r37,"com.google.gdt.eclipse.gph.subversive",1331399580281
-stopped,bundle,com.google.gdt.eclipse.suite.ext,2.5.2.v201202290255-rel-r37,"com.google.gdt.eclipse.suite.ext",1331399580281
-stopped,bundle,com.google.gdt.eclipse.gph,2.5.2.v201202290255-rel-r37,"com.google.gdt.eclipse.gph",1331399580281
-stopped,bundle,com.google.gdt.eclipse.maven.e37,2.5.2.v201202290255-rel-r37,"com.google.gdt.eclipse.maven.e37",1331399580281
-stopped,bundle,com.google.gdt.eclipse.maven,2.5.2.v201202290255-rel-r37,"com.google.gdt.eclipse.maven",1331399580282
-stopped,bundle,com.google.gdt.eclipse.suite,2.5.2.v201202290255-rel-r37,"com.google.gdt.eclipse.suite",1331399580282
-stopped,bundle,com.google.gdt.eclipse.appsmarketplace,2.5.2.v201202290255-rel-r37,"com.google.gdt.eclipse.appsmarketplace",1331399580282
-stopped,bundle,com.google.appengine.eclipse.core,2.5.2.v201202290255-rel-r37,"com.google.appengine.eclipse.core",1331399580282
-stopped,bundle,com.google.gdt.eclipse.login,2.5.2.v201202290255-rel-r37,"com.google.gdt.eclipse.login",1331399580282
-stopped,bundle,com.google.gdt.eclipse.managedapis,2.5.2.v201202290255-rel-r37,"com.google.gdt.eclipse.managedapis",1331399580306
-stopped,bundle,com.google.gwt.eclipse.oophm,2.5.2.v201202290255-rel-r37,"com.google.gwt.eclipse.oophm",1331399580306
-stopped,bundle,com.google.gwt.eclipse.sdkbundle,2.4.0.v201202290255-rel-r37,"com.google.gwt.eclipse.sdkbundle",1331399580306
-stopped,bundle,com.google.gwt.eclipse.core,2.5.2.v201202290255-rel-r37,"com.google.gwt.eclipse.core",1331399580437
-stopped,bundle,com.google.gdt.eclipse.core,2.5.2.v201202290255-rel-r37,"com.google.gdt.eclipse.core",1331399580437
-stopped,bundle,com.google.gdt.eclipse.platform,2.5.2.v201202290255-rel-r37,"com.google.gdt.eclipse.platform",1331399580437
-stopped,bundle,com.google.gdt.eclipse.platform.e37,2.5.2.v201202290255-rel-r37,"com.google.gdt.eclipse.platform.e37",1331399580437
-stopped,bundle,org.eclipse.m2e.discovery,1.0.200.20111228-1245,"org.eclipse.m2e.discovery",1331399580438
-stopped,bundle,org.eclipse.m2e.refactoring,1.0.200.20111228-1245,"org.eclipse.m2e.refactoring",1331399580438
-stopped,bundle,org.eclipse.m2e.editor,1.0.200.20111228-1245,"org.eclipse.m2e.editor",1331399580438
-stopped,bundle,org.eclipse.m2e.editor.xml,1.0.200.20111228-1245,"org.eclipse.m2e.editor.xml",1331399580439
-stopped,bundle,org.eclipse.m2e.jdt,1.0.200.20111228-1245,"org.eclipse.m2e.jdt",1331399580439
-stopped,bundle,org.eclipse.m2e.launching,1.0.200.20111228-1245,"org.eclipse.m2e.launching",1331399580439
-stopped,bundle,org.eclipse.m2e.usagedata,1.0.200.20111228-1245,"org.eclipse.m2e.usagedata",1331399580439
-stopped,bundle,org.eclipse.m2e.core.ui,1.0.200.20111228-1245,"org.eclipse.m2e.core.ui",1331399580439
-stopped,bundle,org.eclipse.m2e.core,1.0.200.20111228-1245,"org.eclipse.m2e.core",1331399580439
-stopped,bundle,org.eclipse.mylyn.ide.ant,3.6.0.v20110608-1400,"org.eclipse.mylyn.ide.ant",1331399580439
-stopped,bundle,org.eclipse.ant.ui,3.5.100.v20110510,"org.eclipse.ant.ui",1331399580439
-stopped,bundle,org.eclipse.ant.launching,1.0.100.v20110506,"org.eclipse.ant.launching",1331399580440
-stopped,bundle,org.eclipse.equinox.p2.ui.sdk,1.0.200.v20110502-1955,"org.eclipse.equinox.p2.ui.sdk",1331399580440
-stopped,bundle,org.eclipse.mylyn.java.tasks,3.6.0.v20110608-1400,"org.eclipse.mylyn.java.tasks",1331399580440
-stopped,bundle,org.eclipse.mylyn.java.ui,3.6.0.v20110608-1400,"org.eclipse.mylyn.java.ui",1331399580440
-stopped,bundle,com.google.gdt.eclipse.designer.UiBinder,2.5.0.r37x201112291029,"com.google.gdt.eclipse.designer.UiBinder",1331399580441
-stopped,bundle,com.google.gdt.eclipse.designer.gpe,2.5.0.r37x201201030222,"com.google.gdt.eclipse.designer.gpe",1331399580441
-stopped,bundle,com.google.gdt.eclipse.designer,2.5.0.r37x201112291029,"com.google.gdt.eclipse.designer",1331399580442
-stopped,bundle,org.eclipse.jdt.junit,3.7.0.v20110505-0800,"org.eclipse.jdt.junit",1331399580442
-stopped,bundle,org.eclipse.jdt.apt.ui,3.3.300.v20110305-1450,"org.eclipse.jdt.apt.ui",1331399580442
-stopped,bundle,org.eclipse.jdt.debug.ui,3.6.0.v20110512,"org.eclipse.jdt.debug.ui",1331399580464
-stopped,bundle,com.google.gdt.eclipse.platform.shared,2.5.2.v201202290255-rel-r37,"com.google.gdt.eclipse.platform.shared",1331399580465
-stopped,bundle,org.eclipse.wb.swing.FormLayout,1.0.0.r37x201106081552,"org.eclipse.wb.swing.FormLayout",1331399580465
-stopped,bundle,org.eclipse.wb.swing.MigLayout,1.0.0.r37x201106081552,"org.eclipse.wb.swing.MigLayout",1331399580465
-stopped,bundle,org.eclipse.wb.swing.databinding,1.0.0.r37x201106081552,"org.eclipse.wb.swing.databinding",1331399580465
-stopped,bundle,org.eclipse.wb.swing.java6,1.0.0.r37x201106081552,"org.eclipse.wb.swing.java6",1331399580465
-stopped,bundle,org.eclipse.wb.swing.jsr296,1.0.0.r37x201106081552,"org.eclipse.wb.swing.jsr296",1331399580465
-stopped,bundle,org.eclipse.wb.swing,1.0.0.r37x201106081552,"org.eclipse.wb.swing",1331399580465
-stopped,bundle,org.eclipse.wb.core.ui,1.0.0.r37x201106081733,"org.eclipse.wb.core.ui",1331399580465
-stopped,bundle,org.eclipse.wb.layout.group,1.0.0.r37x201106081642,"org.eclipse.wb.layout.group",1331399580465
-stopped,bundle,com.google.gdt.eclipse.designer.hosted.2_0.webkit,2.5.0.r37x201112291019,"com.google.gdt.eclipse.designer.hosted.2_0.webkit",1331399580465
-stopped,bundle,com.google.gdt.eclipse.designer.hosted.2_0,2.5.0.r37x201112291019,"com.google.gdt.eclipse.designer.hosted.2_0",1331399580465
-stopped,bundle,com.google.gdt.eclipse.designer.hosted.2_2.webkit,2.5.0.r37x201112291019,"com.google.gdt.eclipse.designer.hosted.2_2.webkit",1331399580465
-stopped,bundle,com.google.gdt.eclipse.designer.hosted.2_2,2.5.0.r37x201112291019,"com.google.gdt.eclipse.designer.hosted.2_2",1331399580465
-stopped,bundle,com.google.gdt.eclipse.designer.hosted,2.5.0.r37x201112291019,"com.google.gdt.eclipse.designer.hosted",1331399580465
-stopped,bundle,org.eclipse.wb.core.databinding.xml,1.2.0.r37x201112291009,"org.eclipse.wb.core.databinding.xml",1331399580465
-stopped,bundle,org.eclipse.wb.core.databinding,1.2.0.r37x201112290923,"org.eclipse.wb.core.databinding",1331399580465
-stopped,bundle,org.eclipse.wb.core.xml,1.2.0.r37x201112291009,"org.eclipse.wb.core.xml",1331399580465
-stopped,bundle,org.eclipse.wb.css,1.2.0.r37x201112290951,"org.eclipse.wb.css",1331399580465
-stopped,bundle,org.eclipse.wb.os.macosx,1.2.0.r37x201112290923,"org.eclipse.wb.os.macosx",1331399580466
-stopped,bundle,org.eclipse.wb.core,1.2.0.r37x201112290923,"org.eclipse.wb.core",1331399580466
-stopped,bundle,org.eclipse.jdt.ui,3.7.0.v20110531-1200,"org.eclipse.jdt.ui",1331399580500
-stopped,bundle,org.eclipse.wst.dtd.ui,1.0.600.v201103171359,"org.eclipse.wst.dtd.ui",1331399580500
-stopped,bundle,org.eclipse.wst.xsd.ui,1.2.404.v201105050216,"org.eclipse.wst.xsd.ui",1331399580500
-stopped,bundle,org.eclipse.wst.css.ui,1.0.601.v201201101544,"org.eclipse.wst.css.ui",1331399580500
-stopped,bundle,org.eclipse.wst.xml.ui,1.1.202.v201112071516,"org.eclipse.wst.xml.ui",1331399580500
-stopped,bundle,org.eclipse.wst.common.ui,1.1.500.v200911190730,"org.eclipse.wst.common.ui",1331399580500
-stopped,bundle,org.eclipse.wst.jsdt.ui,1.1.102.v201201131900,"org.eclipse.wst.jsdt.ui",1331399580500
-stopped,bundle,org.eclipse.wst.sse.ui,1.3.2.v201201041522,"org.eclipse.wst.sse.ui",1331399580500
-stopped,bundle,org.eclipse.search,3.7.0.v20110505-0800,"org.eclipse.search",1331399580518
-stopped,bundle,org.eclipse.mylyn.commons.team,0.8.0.v20110608-1400,"org.eclipse.mylyn.commons.team",1331399580518
-stopped,bundle,org.eclipse.mylyn.team.ui,3.6.0.v20110608-1400,"org.eclipse.mylyn.team.ui",1331399580518
-stopped,bundle,org.eclipse.ui.navigator.resources,3.4.300.I20110421-1800,"org.eclipse.ui.navigator.resources",1331399580518
-stopped,bundle,org.eclipse.ltk.ui.refactoring,3.6.0.v20110505-0800,"org.eclipse.ltk.ui.refactoring",1331399580518
-stopped,bundle,org.eclipse.mylyn.bugzilla.ui,3.6.0.v20110608-1400,"org.eclipse.mylyn.bugzilla.ui",1331399580518
-stopped,bundle,org.eclipse.mylyn.ide.ui,3.6.0.v20110608-1400,"org.eclipse.mylyn.ide.ui",1331399580518
-stopped,bundle,org.eclipse.mylyn.resources.ui,3.6.0.v20110608-1400,"org.eclipse.mylyn.resources.ui",1331399580518
-stopped,bundle,org.eclipse.mylyn.wikitext.tasks.ui,1.5.0.v20110608-1400,"org.eclipse.mylyn.wikitext.tasks.ui",1331399580518
-stopped,bundle,org.eclipse.mylyn.context.ui,3.6.0.v20110608-1400,"org.eclipse.mylyn.context.ui",1331399580519
-stopped,bundle,org.eclipse.mylyn.help.ui,3.6.0.v20110608-1400,"org.eclipse.mylyn.help.ui",1331399580519
-stopped,bundle,org.eclipse.mylyn.tasks.bugs,3.6.0.v20110608-1400,"org.eclipse.mylyn.tasks.bugs",1331399580519
-stopped,bundle,org.eclipse.mylyn.tasks.ui,3.6.0.v20110608-1400,"org.eclipse.mylyn.tasks.ui",1331399580519
-stopped,bundle,org.eclipse.team.cvs.ui,3.3.400.I20110510-0800,"org.eclipse.team.cvs.ui",1331399580519
-stopped,bundle,org.eclipse.team.ui,3.6.100.I20110525-0800,"org.eclipse.team.ui",1331399580520
-stopped,bundle,org.eclipse.compare,3.5.200.I20110525-0800,"org.eclipse.compare",1331399580520
-stopped,bundle,org.eclipse.ui.externaltools,3.2.0.v20110506,"org.eclipse.ui.externaltools",1331399580520
-stopped,bundle,org.eclipse.debug.ui,3.7.0.v20110518,"org.eclipse.debug.ui",1331399580537
-stopped,bundle,org.eclipse.mylyn.wikitext.ui,1.5.0.v20110608-1400,"org.eclipse.mylyn.wikitext.ui",1331399580537
-stopped,bundle,org.eclipse.ui.console,3.5.100.v20110511,"org.eclipse.ui.console",1331399580538
-stopped,bundle,org.eclipse.mylyn.commons.ui,3.6.1.v20110720-0100,"org.eclipse.mylyn.commons.ui",1331399580538
-stopped,bundle,org.eclipse.ui.editors,3.7.0.v20110517-0800,"org.eclipse.ui.editors",1331399580538
-stopped,bundle,org.eclipse.wst.common.snippets,1.2.100.v201103281740,"org.eclipse.wst.common.snippets",1331399580538
-stopped,bundle,org.eclipse.ui.workbench.texteditor,3.7.0.v20110505-0800,"org.eclipse.ui.workbench.texteditor",1331399580538
-stopped,bundle,org.eclipse.compare.core,3.5.200.I20110208-0800,"org.eclipse.compare.core",1331399580538
-stopped,bundle,org.eclipse.emf.edit.ui,2.7.0.v20110606-0949,"org.eclipse.emf.edit.ui",1331399580538
-stopped,bundle,org.eclipse.gef,3.7.0.v20110407-2050,"org.eclipse.gef",1331399580538
-activated,perspective,org.eclipse.jdt.ui,,"org.eclipse.jdt.ui.JavaPerspective",1331424455535
-started,bundle,org.eclipse.osgi,3.7.0.v20110613,"org.eclipse.osgi",1331424455537
-started,bundle,org.eclipse.equinox.simpleconfigurator,1.0.200.v20110502-1955,"org.eclipse.equinox.simpleconfigurator",1331424455537
-started,bundle,com.ibm.icu,4.4.2.v20110208,"com.ibm.icu",1331424455537
-started,bundle,org.eclipse.compare.core,3.5.200.I20110208-0800,"org.eclipse.compare.core",1331424455537
-started,bundle,org.eclipse.core.contenttype,3.4.100.v20110423-0524,"org.eclipse.core.contenttype",1331424455537
-started,bundle,org.eclipse.core.databinding.observable,1.4.0.I20110222-0800,"org.eclipse.core.databinding.observable",1331424455537
-started,bundle,org.eclipse.core.expressions,3.4.300.v20110228,"org.eclipse.core.expressions",1331424455537
-started,bundle,org.eclipse.core.filebuffers,3.5.200.v20110505-0800,"org.eclipse.core.filebuffers",1331424455537
-started,bundle,org.eclipse.core.filesystem,1.3.100.v20110423-0524,"org.eclipse.core.filesystem",1331424455537
-started,bundle,org.eclipse.core.jobs,3.5.100.v20110404,"org.eclipse.core.jobs",1331424455538
-started,bundle,org.eclipse.core.net,1.2.100.I20110511-0800,"org.eclipse.core.net",1331424455538
-started,bundle,org.eclipse.core.resources,3.7.100.v20110510-0712,"org.eclipse.core.resources",1331424455538
-started,bundle,org.eclipse.core.runtime,3.7.0.v20110110,"org.eclipse.core.runtime",1331424455538
-started,bundle,org.eclipse.core.runtime.compatibility,3.2.100.v20100505,"org.eclipse.core.runtime.compatibility",1331424455538
-started,bundle,org.eclipse.core.runtime.compatibility.auth,3.2.200.v20110110,"org.eclipse.core.runtime.compatibility.auth",1331424455538
-started,bundle,org.eclipse.debug.core,3.7.0.v20110518,"org.eclipse.debug.core",1331424455538
-started,bundle,org.eclipse.epp.mpc.ui,1.1.0.I20110525-0742,"org.eclipse.epp.mpc.ui",1331424455538
-started,bundle,org.eclipse.epp.usagedata.gathering,1.3.1.R201106061540,"org.eclipse.epp.usagedata.gathering",1331424455538
-started,bundle,org.eclipse.epp.usagedata.recording,1.3.1.R201106061540,"org.eclipse.epp.usagedata.recording",1331424455538
-started,bundle,org.eclipse.equinox.app,1.3.100.v20110321,"org.eclipse.equinox.app",1331424455538
-started,bundle,org.eclipse.equinox.common,3.6.0.v20110523,"org.eclipse.equinox.common",1331424455538
-started,bundle,org.eclipse.equinox.ds,1.3.0.v20110502,"org.eclipse.equinox.ds",1331424455538
-started,bundle,org.eclipse.equinox.event,1.2.100.v20110502,"org.eclipse.equinox.event",1331424455538
-started,bundle,org.eclipse.equinox.p2.core,2.1.0.v20110502-1955,"org.eclipse.equinox.p2.core",1331424455538
-started,bundle,org.eclipse.equinox.p2.directorywatcher,1.0.300.v20110502-1955,"org.eclipse.equinox.p2.directorywatcher",1331424455538
-started,bundle,org.eclipse.equinox.p2.engine,2.1.0.v20110511,"org.eclipse.equinox.p2.engine",1331424455538
-started,bundle,org.eclipse.equinox.p2.metadata,2.1.0.v20110510,"org.eclipse.equinox.p2.metadata",1331424455538
-started,bundle,org.eclipse.equinox.p2.metadata.repository,1.2.0.v20110511-1359,"org.eclipse.equinox.p2.metadata.repository",1331424455538
-started,bundle,org.eclipse.equinox.p2.operations,2.1.0.v20110511-1821,"org.eclipse.equinox.p2.operations",1331424455538
-started,bundle,org.eclipse.equinox.p2.reconciler.dropins,1.1.100.v20110510,"org.eclipse.equinox.p2.reconciler.dropins",1331424455538
-started,bundle,org.eclipse.equinox.p2.repository,2.1.0.v20110601,"org.eclipse.equinox.p2.repository",1331424455538
-started,bundle,org.eclipse.equinox.p2.ui.sdk.scheduler,1.0.100.v20110502-1955,"org.eclipse.equinox.p2.ui.sdk.scheduler",1331424455538
-started,bundle,org.eclipse.equinox.p2.updatechecker,1.1.200.v20110502-1955,"org.eclipse.equinox.p2.updatechecker",1331424455538
-started,bundle,org.eclipse.equinox.preferences,3.4.0.v20110502,"org.eclipse.equinox.preferences",1331424455538
-started,bundle,org.eclipse.equinox.registry,3.5.100.v20110502,"org.eclipse.equinox.registry",1331424455538
-started,bundle,org.eclipse.equinox.security,1.1.0.v20110502,"org.eclipse.equinox.security",1331424455538
-started,bundle,org.eclipse.equinox.util,1.0.300.v20110502,"org.eclipse.equinox.util",1331424455538
-started,bundle,org.eclipse.help,3.5.100.v20110426,"org.eclipse.help",1331424455538
-started,bundle,org.eclipse.jdt.apt.core,3.3.500.v20110420-1015,"org.eclipse.jdt.apt.core",1331424455538
-started,bundle,org.eclipse.jdt.apt.pluggable.core,1.0.400.v20110305-1450,"org.eclipse.jdt.apt.pluggable.core",1331424455538
-started,bundle,org.eclipse.jdt.core,3.7.0.v_B61,"org.eclipse.jdt.core",1331424455538
-started,bundle,org.eclipse.jdt.core.manipulation,1.4.0.v20110505-0800,"org.eclipse.jdt.core.manipulation",1331424455553
-started,bundle,org.eclipse.jdt.junit,3.7.0.v20110505-0800,"org.eclipse.jdt.junit",1331424455607
-started,bundle,org.eclipse.jdt.launching,3.6.0.v20110509,"org.eclipse.jdt.launching",1331424455638
-started,bundle,org.eclipse.jdt.launching.macosx,3.2.100.v20110509,"org.eclipse.jdt.launching.macosx",1331424455645
-started,bundle,org.eclipse.jdt.ui,3.7.0.v20110531-1200,"org.eclipse.jdt.ui",1331424455645
-started,bundle,org.eclipse.jface,3.7.0.I20110522-1430,"org.eclipse.jface",1331424455660
-started,bundle,org.eclipse.jsch.core,1.1.300.I20110514-0800,"org.eclipse.jsch.core",1331424455690
-started,bundle,org.eclipse.ltk.core.refactoring,3.5.200.v20110505-0800,"org.eclipse.ltk.core.refactoring",1331424455715
-started,bundle,org.eclipse.ltk.ui.refactoring,3.6.0.v20110505-0800,"org.eclipse.ltk.ui.refactoring",1331424455778
-started,bundle,org.eclipse.m2e.logback.configuration,1.0.0.20110607-2117,"org.eclipse.m2e.logback.configuration",1331424455784
-started,bundle,org.eclipse.mylyn.bugzilla.core,3.6.0.v20110608-1400,"org.eclipse.mylyn.bugzilla.core",1331424455830
-started,bundle,org.eclipse.mylyn.bugzilla.ui,3.6.0.v20110608-1400,"org.eclipse.mylyn.bugzilla.ui",1331424455900
-started,bundle,org.eclipse.mylyn.commons.identity,0.8.0.v20110608-1400,"org.eclipse.mylyn.commons.identity",1331424455932
-started,bundle,org.eclipse.mylyn.commons.net,3.6.0.v20110608-1400,"org.eclipse.mylyn.commons.net",1331424455932
-started,bundle,org.eclipse.mylyn.context.core,3.6.0.v20110608-1400,"org.eclipse.mylyn.context.core",1331424455944
-started,bundle,org.eclipse.mylyn.context.ui,3.6.0.v20110608-1400,"org.eclipse.mylyn.context.ui",1331424455992
-started,bundle,org.eclipse.mylyn.monitor.ui,3.6.0.v20110608-1400,"org.eclipse.mylyn.monitor.ui",1331424456008
-started,bundle,org.eclipse.mylyn.tasks.ui,3.6.0.v20110608-1400,"org.eclipse.mylyn.tasks.ui",1331424456091
-started,bundle,org.eclipse.mylyn.team.ui,3.6.0.v20110608-1400,"org.eclipse.mylyn.team.ui",1331424456101
-started,bundle,org.eclipse.search,3.7.0.v20110505-0800,"org.eclipse.search",1331424456114
-started,bundle,org.eclipse.team.core,3.6.0.I20110525-0800,"org.eclipse.team.core",1331424456131
-started,bundle,org.eclipse.team.cvs.core,3.3.400.I20110510-0800,"org.eclipse.team.cvs.core",1331424456164
-started,bundle,org.eclipse.team.ui,3.6.100.I20110525-0800,"org.eclipse.team.ui",1331424456183
-started,bundle,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui",1331424456233
-started,bundle,org.eclipse.ui.console,3.5.100.v20110511,"org.eclipse.ui.console",1331424456244
-started,bundle,org.eclipse.ui.editors,3.7.0.v20110517-0800,"org.eclipse.ui.editors",1331424456244
-started,bundle,org.eclipse.ui.forms,3.5.100.v20110425,"org.eclipse.ui.forms",1331424456286
-started,bundle,org.eclipse.ui.ide,3.7.0.I20110519-0100,"org.eclipse.ui.ide",1331424456391
-started,bundle,org.eclipse.ui.net,1.2.100.I20110511-0800,"org.eclipse.ui.net",1331424456408
-started,bundle,org.eclipse.ui.views,3.6.0.I20110412-0800,"org.eclipse.ui.views",1331424456467
-started,bundle,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"org.eclipse.ui.workbench",1331424456562
-started,bundle,org.eclipse.ui.workbench.texteditor,3.7.0.v20110505-0800,"org.eclipse.ui.workbench.texteditor",1331424456628
-started,bundle,org.eclipse.update.configurator,3.3.100.v20100512,"org.eclipse.update.configurator",1331424456677
-started,bundle,org.eclipse.update.core,3.2.500.v20110330,"org.eclipse.update.core",1331424456757
-started,bundle,com.google.appengine.eclipse.core,2.5.2.v201202290255-rel-r37,"com.google.appengine.eclipse.core",1331424456757
-started,bundle,com.google.gdt.eclipse.appengine.rpc,2.5.2.v201202290255-rel-r37,"com.google.gdt.eclipse.appengine.rpc",1331424456764
-started,bundle,com.google.gdt.eclipse.core,2.5.2.v201202290255-rel-r37,"com.google.gdt.eclipse.core",1331424456765
-started,bundle,com.google.gdt.eclipse.designer,2.5.0.r37x201112291029,"com.google.gdt.eclipse.designer",1331424456826
-started,bundle,com.google.gdt.eclipse.login,2.5.2.v201202290255-rel-r37,"com.google.gdt.eclipse.login",1331424456827
-started,bundle,com.google.gdt.eclipse.managedapis,2.5.2.v201202290255-rel-r37,"com.google.gdt.eclipse.managedapis",1331424456828
-started,bundle,com.google.gdt.eclipse.platform.e37,2.5.2.v201202290255-rel-r37,"com.google.gdt.eclipse.platform.e37",1331424456876
-started,bundle,com.google.gdt.eclipse.platform.shared,2.5.2.v201202290255-rel-r37,"com.google.gdt.eclipse.platform.shared",1331424456877
-started,bundle,com.google.gdt.eclipse.suite.ext,2.5.2.v201202290255-rel-r37,"com.google.gdt.eclipse.suite.ext",1331424456877
-started,bundle,com.google.gwt.eclipse.core,2.5.2.v201202290255-rel-r37,"com.google.gwt.eclipse.core",1331424456901
-started,bundle,org.eclipse.mylyn.commons.ui,3.6.1.v20110720-0100,"org.eclipse.mylyn.commons.ui",1331424456920
-started,bundle,org.eclipse.wb.core,1.2.0.r37x201112290923,"org.eclipse.wb.core",1331424456958
-started,bundle,org.eclipse.wb.core.lib,1.2.0.r37x201112290923,"org.eclipse.wb.core.lib",1331424457011
-os,sysinfo,,,"macosx",1331424457015
-arch,sysinfo,,,"x86_64",1331424457015
-ws,sysinfo,,,"cocoa",1331424457015
-locale,sysinfo,,,"ja_JP",1331424457015
-processors,sysinfo,,,"8",1331424457015
-java.runtime.name,sysinfo,,,"Java(TM) SE Runtime Environment",1331424457015
-java.runtime.version,sysinfo,,,"1.6.0_29-b11-402-11D50d",1331424457015
-java.specification.name,sysinfo,,,"Java Platform API Specification",1331424457015
-java.specification.vendor,sysinfo,,,"Sun Microsystems Inc.",1331424457015
-java.specification.version,sysinfo,,,"1.6",1331424457015
-java.vendor,sysinfo,,,"Apple Inc.",1331424457015
-java.version,sysinfo,,,"1.6.0_29",1331424457015
-java.vm.info,sysinfo,,,"mixed mode",1331424457015
-java.vm.name,sysinfo,,,"Java HotSpot(TM) 64-Bit Server VM",1331424457015
-java.vm.specification.name,sysinfo,,,"Java Virtual Machine Specification",1331424457015
-java.vm.specification.vendor,sysinfo,,,"Sun Microsystems Inc.",1331424457015
-java.vm.specification.version,sysinfo,,,"1.0",1331424457015
-java.vm.vendor,sysinfo,,,"Apple Inc.",1331424457015
-java.vm.version,sysinfo,,,"20.4-b02-402",1331424457015
-started,bundle,org.eclipse.m2e.usagedata,1.0.200.20111228-1245,"org.eclipse.m2e.usagedata",1331424457051
-started,bundle,org.eclipse.update.scheduler,3.2.300.v20100512,"org.eclipse.update.scheduler",1331424457247
-started,bundle,org.eclipse.wb.discovery.core,1.0.0.r37x201106081733,"org.eclipse.wb.discovery.core",1331424457446
-opened,view,org.eclipse.ui.ide,3.7.0.I20110519-0100,"org.eclipse.ui.views.ProblemView",1331424458984
-started,bundle,org.eclipse.wb.discovery.ui,1.0.0.r37x201106081733,"org.eclipse.wb.discovery.ui",1331424459034
-started,bundle,com.google.gdt.eclipse.designer.hosted,2.5.0.r37x201112291019,"com.google.gdt.eclipse.designer.hosted",1331424459216
-started,bundle,com.google.gdt.eclipse.designer.UiBinder,2.5.0.r37x201112291029,"com.google.gdt.eclipse.designer.UiBinder",1331424459279
-started,bundle,com.google.gdt.eclipse.maven,2.5.2.v201202290255-rel-r37,"com.google.gdt.eclipse.maven",1331424460820
-started,bundle,com.google.gdt.eclipse.suite,2.5.2.v201202290255-rel-r37,"com.google.gdt.eclipse.suite",1331424460963
-started,bundle,org.eclipse.core.variables,3.2.500.v20110511,"org.eclipse.core.variables",1331424461068
-deactivated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1331424488367
-activated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1331424565590
-executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.file.save",1331424574208
-started,bundle,org.eclipse.debug.ui,3.7.0.v20110518,"org.eclipse.debug.ui",1331424574997
-started,bundle,org.eclipse.jdt.debug,3.7.0.v20110509,"org.eclipse.jdt.debug",1331424575474
-started,bundle,org.eclipse.jdt.debug.ui,3.6.0.v20110512,"org.eclipse.jdt.debug.ui",1331424576085
-opened,editor,org.eclipse.jdt.ui,3.7.0.v20110531-1200,"org.eclipse.jdt.ui.CompilationUnitEditor",1331424586216
-activated,editor,org.eclipse.jdt.ui,3.7.0.v20110531-1200,"org.eclipse.jdt.ui.CompilationUnitEditor",1331424586351
-executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.file.save",1331424600481
-executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.file.save",1331424623282
-executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.file.save",1331424628733
-started,bundle,org.eclipse.m2e.launching,1.0.200.20111228-1245,"org.eclipse.m2e.launching",1331424634212
-activated,view,org.eclipse.ui.console,3.5.100.v20110511,"org.eclipse.ui.console.ConsoleView",1331424636086
-activated,editor,org.eclipse.jdt.ui,3.7.0.v20110531-1200,"org.eclipse.jdt.ui.CompilationUnitEditor",1331424639455
-executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.file.save",1331424642047
-activated,view,org.eclipse.ui.console,3.5.100.v20110511,"org.eclipse.ui.console.ConsoleView",1331424648115
-activated,editor,org.eclipse.jdt.ui,3.7.0.v20110531-1200,"org.eclipse.jdt.ui.CompilationUnitEditor",1331424651289
-started,bundle,org.eclipse.mylyn.java.tasks,3.6.0.v20110608-1400,"org.eclipse.mylyn.java.tasks",1331424653721
-executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.file.save",1331424653752
-activated,view,org.eclipse.ui.console,3.5.100.v20110511,"org.eclipse.ui.console.ConsoleView",1331424659508
-activated,editor,org.eclipse.jdt.ui,3.7.0.v20110531-1200,"org.eclipse.jdt.ui.CompilationUnitEditor",1331424662320
-executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.file.save",1331424665719
-activated,editor,org.eclipse.jdt.ui,3.7.0.v20110531-1200,"org.eclipse.jdt.ui.CompilationUnitEditor",1331424669705
-deactivated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1331424770904
-activated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1331424871621
-executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.edit.copy",1331424917222
-executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.edit.paste",1331424919112
-executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.edit.copy",1331424930370
-executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.edit.copy",1331425229850
-executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.edit.paste",1331425234106
-executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.file.save",1331425235627
-executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.edit.paste",1331425245939
+started,bundle,org.eclipse.mylyn.bugzilla.core,3.6.0.v20110608-1400,"org.eclipse.mylyn.bugzilla.core",1332199914710
+started,bundle,org.eclipse.mylyn.bugzilla.ui,3.6.0.v20110608-1400,"org.eclipse.mylyn.bugzilla.ui",1332199914774
+started,bundle,org.eclipse.mylyn.commons.identity,0.8.0.v20110608-1400,"org.eclipse.mylyn.commons.identity",1332199914806
+started,bundle,org.eclipse.mylyn.commons.net,3.6.0.v20110608-1400,"org.eclipse.mylyn.commons.net",1332199914806
+started,bundle,org.eclipse.mylyn.context.core,3.6.0.v20110608-1400,"org.eclipse.mylyn.context.core",1332199914884
+started,bundle,org.eclipse.mylyn.context.ui,3.6.0.v20110608-1400,"org.eclipse.mylyn.context.ui",1332199914920
+started,bundle,org.eclipse.mylyn.monitor.ui,3.6.0.v20110608-1400,"org.eclipse.mylyn.monitor.ui",1332199914948
+started,bundle,org.eclipse.mylyn.tasks.ui,3.6.0.v20110608-1400,"org.eclipse.mylyn.tasks.ui",1332199915006
+started,bundle,org.eclipse.mylyn.team.ui,3.6.0.v20110608-1400,"org.eclipse.mylyn.team.ui",1332199915040
+started,bundle,org.eclipse.search,3.7.0.v20110505-0800,"org.eclipse.search",1332199915064
+started,bundle,org.eclipse.team.core,3.6.0.I20110525-0800,"org.eclipse.team.core",1332199915090
+started,bundle,org.eclipse.team.cvs.core,3.3.400.I20110510-0800,"org.eclipse.team.cvs.core",1332199915126
+started,bundle,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui",1332199915141
+started,bundle,org.eclipse.ui.console,3.5.100.v20110511,"org.eclipse.ui.console",1332199915188
+started,bundle,org.eclipse.ui.editors,3.7.0.v20110517-0800,"org.eclipse.ui.editors",1332199915188
+started,bundle,org.eclipse.ui.forms,3.5.100.v20110425,"org.eclipse.ui.forms",1332199915204
+started,bundle,org.eclipse.ui.ide,3.7.0.I20110519-0100,"org.eclipse.ui.ide",1332199915299
+started,bundle,org.eclipse.ui.net,1.2.100.I20110511-0800,"org.eclipse.ui.net",1332199915304
+started,bundle,org.eclipse.ui.views,3.6.0.I20110412-0800,"org.eclipse.ui.views",1332199915318
+started,bundle,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"org.eclipse.ui.workbench",1332199915331
+started,bundle,org.eclipse.ui.workbench.texteditor,3.7.0.v20110505-0800,"org.eclipse.ui.workbench.texteditor",1332199915356
+started,bundle,org.eclipse.update.configurator,3.3.100.v20100512,"org.eclipse.update.configurator",1332199915357
+started,bundle,org.eclipse.update.core,3.2.500.v20110330,"org.eclipse.update.core",1332199915402
+started,bundle,com.google.appengine.eclipse.core,2.5.2.v201202290255-rel-r37,"com.google.appengine.eclipse.core",1332199915402
+started,bundle,com.google.gdt.eclipse.appengine.rpc,2.5.2.v201202290255-rel-r37,"com.google.gdt.eclipse.appengine.rpc",1332199915427
+started,bundle,com.google.gdt.eclipse.core,2.5.2.v201202290255-rel-r37,"com.google.gdt.eclipse.core",1332199915428
+started,bundle,com.google.gdt.eclipse.designer,2.5.0.r37x201112291029,"com.google.gdt.eclipse.designer",1332199915478
+started,bundle,com.google.gdt.eclipse.login,2.5.2.v201202290255-rel-r37,"com.google.gdt.eclipse.login",1332199915478
+started,bundle,com.google.gdt.eclipse.managedapis,2.5.2.v201202290255-rel-r37,"com.google.gdt.eclipse.managedapis",1332199915479
+started,bundle,com.google.gdt.eclipse.platform.e37,2.5.2.v201202290255-rel-r37,"com.google.gdt.eclipse.platform.e37",1332199915493
+started,bundle,com.google.gdt.eclipse.platform.shared,2.5.2.v201202290255-rel-r37,"com.google.gdt.eclipse.platform.shared",1332199915494
+started,bundle,com.google.gdt.eclipse.suite.ext,2.5.2.v201202290255-rel-r37,"com.google.gdt.eclipse.suite.ext",1332199915494
+started,bundle,com.google.gwt.eclipse.core,2.5.2.v201202290255-rel-r37,"com.google.gwt.eclipse.core",1332199915541
+started,bundle,org.eclipse.mylyn.commons.ui,3.6.1.v20110720-0100,"org.eclipse.mylyn.commons.ui",1332199915549
+started,bundle,org.eclipse.wb.core,1.2.0.r37x201112290923,"org.eclipse.wb.core",1332199915586
+started,bundle,org.eclipse.wb.core.lib,1.2.0.r37x201112290923,"org.eclipse.wb.core.lib",1332199915662
+os,sysinfo,,,"macosx",1332199915666
+arch,sysinfo,,,"x86_64",1332199915666
+ws,sysinfo,,,"cocoa",1332199915666
+locale,sysinfo,,,"ja_JP",1332199915666
+processors,sysinfo,,,"8",1332199915666
+java.runtime.name,sysinfo,,,"Java(TM) SE Runtime Environment",1332199915666
+java.runtime.version,sysinfo,,,"1.6.0_29-b11-402-11D50d",1332199915666
+java.specification.name,sysinfo,,,"Java Platform API Specification",1332199915666
+java.specification.vendor,sysinfo,,,"Sun Microsystems Inc.",1332199915666
+java.specification.version,sysinfo,,,"1.6",1332199915666
+java.vendor,sysinfo,,,"Apple Inc.",1332199915666
+java.version,sysinfo,,,"1.6.0_29",1332199915666
+java.vm.info,sysinfo,,,"mixed mode",1332199915666
+java.vm.name,sysinfo,,,"Java HotSpot(TM) 64-Bit Server VM",1332199915666
+java.vm.specification.name,sysinfo,,,"Java Virtual Machine Specification",1332199915666
+java.vm.specification.vendor,sysinfo,,,"Sun Microsystems Inc.",1332199915666
+java.vm.specification.version,sysinfo,,,"1.0",1332199915666
+java.vm.vendor,sysinfo,,,"Apple Inc.",1332199915666
+java.vm.version,sysinfo,,,"20.4-b02-402",1332199915666
+started,bundle,org.eclipse.m2e.usagedata,1.0.200.20111228-1245,"org.eclipse.m2e.usagedata",1332199915705
+started,bundle,org.eclipse.team.cvs.ui,3.3.400.I20110510-0800,"org.eclipse.team.cvs.ui",1332199915866
+started,bundle,org.eclipse.update.scheduler,3.2.300.v20100512,"org.eclipse.update.scheduler",1332199915888
+started,bundle,org.eclipse.wb.discovery.core,1.0.0.r37x201106081733,"org.eclipse.wb.discovery.core",1332199915986
+started,bundle,org.eclipse.wb.discovery.ui,1.0.0.r37x201106081733,"org.eclipse.wb.discovery.ui",1332199918383
+opened,view,org.eclipse.ui.ide,3.7.0.I20110519-0100,"org.eclipse.ui.views.ProblemView",1332199918448
+started,bundle,com.google.gdt.eclipse.designer.hosted,2.5.0.r37x201112291019,"com.google.gdt.eclipse.designer.hosted",1332199918568
+started,bundle,com.google.gdt.eclipse.designer.UiBinder,2.5.0.r37x201112291029,"com.google.gdt.eclipse.designer.UiBinder",1332199918653
+started,bundle,com.google.gdt.eclipse.maven,2.5.2.v201202290255-rel-r37,"com.google.gdt.eclipse.maven",1332199920806
+started,bundle,com.google.gdt.eclipse.suite,2.5.2.v201202290255-rel-r37,"com.google.gdt.eclipse.suite",1332199920915
+started,bundle,org.eclipse.core.variables,3.2.500.v20110511,"org.eclipse.core.variables",1332199921064
+deactivated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1332200003137
+activated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1332200185265
+activated,view,org.eclipse.jdt.ui,3.7.0.v20110531-1200,"org.eclipse.jdt.ui.PackageExplorer",1332200189981
+opened,editor,org.eclipse.jdt.ui,3.7.0.v20110531-1200,"org.eclipse.jdt.ui.CompilationUnitEditor",1332200213044
+activated,editor,org.eclipse.jdt.ui,3.7.0.v20110531-1200,"org.eclipse.jdt.ui.CompilationUnitEditor",1332200213127
+activated,view,org.eclipse.jdt.ui,3.7.0.v20110531-1200,"org.eclipse.jdt.ui.PackageExplorer",1332200252507
+activated,editor,org.eclipse.jdt.ui,3.7.0.v20110531-1200,"org.eclipse.jdt.ui.CompilationUnitEditor",1332200269818
+executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.edit.copy",1332200289725
+executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.edit.paste",1332200292838
+started,bundle,org.eclipse.jdt.junit,3.7.0.v20110505-0800,"org.eclipse.jdt.junit",1332200294432
+deactivated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1332200310392
+activated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1332200312974
+executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.edit.copy",1332200317621
+executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.edit.paste",1332200322214
+executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.file.save",1332200323313
+started,bundle,org.eclipse.debug.ui,3.7.0.v20110518,"org.eclipse.debug.ui",1332200324264
+started,bundle,org.eclipse.jdt.debug,3.7.0.v20110509,"org.eclipse.jdt.debug",1332200324788
+started,bundle,org.eclipse.jdt.debug.ui,3.6.0.v20110512,"org.eclipse.jdt.debug.ui",1332200325175
+activated,editor,org.eclipse.jdt.ui,3.7.0.v20110531-1200,"org.eclipse.jdt.ui.CompilationUnitEditor",1332200344493
+executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.file.save",1332200370249
+started,bundle,org.eclipse.mylyn.java.tasks,3.6.0.v20110608-1400,"org.eclipse.mylyn.java.tasks",1332200372828
+executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.edit.copy",1332200372874
+executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.edit.paste",1332200391655
+executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.edit.paste",1332200404184
+executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.file.save",1332200415608
+executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.edit.paste",1332200427157
+executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.edit.paste",1332200432048
+started,bundle,org.eclipse.mylyn.ide.ui,3.6.0.v20110608-1400,"org.eclipse.mylyn.ide.ui",1332200441401
+started,bundle,org.eclipse.mylyn.java.ui,3.6.0.v20110608-1400,"org.eclipse.mylyn.java.ui",1332200441451
+executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.edit.paste",1332200469594
+executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.edit.cut",1332200489249
+executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.edit.paste",1332200492433
+executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.file.save",1332200502840
+executed,command,org.eclipse.ui.ide,3.7.0.I20110519-0100,"org.eclipse.jdt.ui.edit.text.java.correction.assist.proposals",1332200507653
+executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.edit.paste",1332200524665
+executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.edit.copy",1332200551685
+executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.edit.paste",1332200556590
+executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.file.save",1332200557612
+executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.edit.copy",1332200560967
+executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.edit.paste",1332200579346
+executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.file.save",1332200580421
+executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.edit.copy",1332200586376
+executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.edit.paste",1332200588545
+executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.file.save",1332200589143
+executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.edit.cut",1332200706185
+executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.edit.paste",1332200713610
+executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.file.save",1332200717464
+deactivated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1332200765136
+activated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1332200923710
+activated,editor,org.eclipse.jdt.ui,3.7.0.v20110531-1200,"org.eclipse.jdt.ui.CompilationUnitEditor",1332200951393
+activated,editor,org.eclipse.jdt.ui,3.7.0.v20110531-1200,"org.eclipse.jdt.ui.CompilationUnitEditor",1332200974416
+activated,view,org.eclipse.jdt.ui,3.7.0.v20110531-1200,"org.eclipse.jdt.ui.PackageExplorer",1332201009190
+activated,editor,org.eclipse.jdt.ui,3.7.0.v20110531-1200,"org.eclipse.jdt.ui.CompilationUnitEditor",1332201009785
+executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.edit.copy",1332201021044
+executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.edit.paste",1332201028400
+executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.edit.copy",1332201099926
+executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.edit.paste",1332201108387
+executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.file.save",1332201110408
+executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.edit.copy",1332201119124
+executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.edit.paste",1332201121321
+executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.edit.copy",1332201193822
+executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.edit.copy",1332201200838
+executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.edit.paste",1332201205427
+executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.edit.copy",1332201227730
+executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.edit.paste",1332201233062
+executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.file.save",1332201252878
+executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.file.save",1332201280364
+activated,editor,org.eclipse.jdt.ui,3.7.0.v20110531-1200,"org.eclipse.jdt.ui.CompilationUnitEditor",1332201282341
+executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.edit.copy",1332201292544
+executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.edit.undo",1332201307941
+executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.file.save",1332201325206
+activated,editor,org.eclipse.jdt.ui,3.7.0.v20110531-1200,"org.eclipse.jdt.ui.CompilationUnitEditor",1332201372824
+executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.edit.copy",1332201382430
+executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.edit.paste",1332201383734
+executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.edit.copy",1332201397370
+executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.edit.paste",1332201401695
+executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.file.save",1332201403933
+executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.edit.copy",1332201463983
+executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.edit.paste",1332201464837
+executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.file.save",1332201474429
+executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.file.save",1332201524320
+deactivated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1332201608782
+activated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1332206150083
+activated,editor,org.eclipse.jdt.ui,3.7.0.v20110531-1200,"org.eclipse.jdt.ui.CompilationUnitEditor",1332206156135
+executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.file.save",1332206363171
+executed,command,org.eclipse.ui.ide,3.7.0.I20110519-0100,"org.eclipse.jdt.ui.edit.text.java.correction.assist.proposals",1332206364362
+deactivated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1332206366877
+started,bundle,org.eclipse.compare,3.5.200.I20110525-0800,"org.eclipse.compare",1332206368850
+started,bundle,org.eclipse.wst.jsdt.manipulation,1.0.300.v201104272153,"org.eclipse.wst.jsdt.manipulation",1332206374066
+started,bundle,org.eclipse.wst.jsdt.core,1.1.102.v201111090634,"org.eclipse.wst.jsdt.core",1332206374288
+started,bundle,org.eclipse.wst.jsdt.ui,1.1.102.v201201131900,"org.eclipse.wst.jsdt.ui",1332206374438
+activated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1332206374787
+executed,command,org.eclipse.jdt.ui,3.7.0.v20110531-1200,"org.eclipse.jdt.ui.edit.text.java.organize.imports",1332206390228
+executed,command,org.eclipse.jdt.ui,3.7.0.v20110531-1200,"org.eclipse.jdt.ui.edit.text.java.organize.imports",1332206393697
+executed,command,org.eclipse.ui.ide,3.7.0.I20110519-0100,"org.eclipse.jdt.ui.edit.text.java.correction.assist.proposals",1332206400769
+executed,command,org.eclipse.ui.ide,3.7.0.I20110519-0100,"org.eclipse.jdt.ui.edit.text.java.correction.assist.proposals",1332206407825
+executed,command,org.eclipse.jdt.ui,3.7.0.v20110531-1200,"org.eclipse.jdt.ui.edit.text.java.organize.imports",1332206410771
+executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.edit.copy",1332206417636
+executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.edit.paste",1332206421491
+executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.file.save",1332206422011
+executed,command,org.eclipse.jdt.ui,3.7.0.v20110531-1200,"org.eclipse.jdt.ui.edit.text.java.organize.imports",1332206423389
+executed,command,org.eclipse.jdt.ui,3.7.0.v20110531-1200,"org.eclipse.jdt.ui.edit.text.java.organize.imports",1332206429101
+executed,command,org.eclipse.ui.ide,3.7.0.I20110519-0100,"org.eclipse.jdt.ui.edit.text.java.correction.assist.proposals",1332206431968
+executed,command,,,"AUTOGEN:::org.eclipse.jdt.internal.ui.CompilationUnitEditor.ruler.actions/org.eclipse.jdt.internal.ui.javaeditor.JavaSelectRulerAction",1332206438042
+executed,command,,,"AUTOGEN:::org.eclipse.jdt.internal.ui.CompilationUnitEditor.ruler.actions/org.eclipse.jdt.internal.ui.javaeditor.JavaSelectRulerAction",1332206450762
+executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.file.save",1332206471200
+deactivated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1332206472471
+activated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1332206477449
+executed,command,org.eclipse.jdt.ui,3.7.0.v20110531-1200,"org.eclipse.jdt.ui.edit.text.java.organize.imports",1332206477616
+activated,editor,org.eclipse.jdt.ui,3.7.0.v20110531-1200,"org.eclipse.jdt.ui.CompilationUnitEditor",1332206510387
+activated,editor,org.eclipse.jdt.ui,3.7.0.v20110531-1200,"org.eclipse.jdt.ui.CompilationUnitEditor",1332206512880
+executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.file.save",1332206518723
+executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.file.save",1332206563497
+executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.edit.copy",1332206588141
+executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.edit.paste",1332206599578
+executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.file.save",1332206611152
+executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.edit.cut",1332206631204
+executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.edit.paste",1332206637598
+executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.file.save",1332206638136
+executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.file.save",1332206745463
+executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.file.save",1332206763529
+executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.file.save",1332206772611
+executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.file.save",1332206778558
+executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.file.save",1332206782898
+executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.file.save",1332206817287
+executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.edit.copy",1332206835034
+executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.edit.paste",1332206840771
+executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.file.save",1332206842270
+activated,editor,org.eclipse.jdt.ui,3.7.0.v20110531-1200,"org.eclipse.jdt.ui.CompilationUnitEditor",1332206879107
+activated,editor,org.eclipse.jdt.ui,3.7.0.v20110531-1200,"org.eclipse.jdt.ui.CompilationUnitEditor",1332206886738
+deactivated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1332206935263
+activated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1332206936592
+executed,command,org.eclipse.ui.ide,3.7.0.I20110519-0100,"org.eclipse.ui.navigate.openResource",1332206936658
+executed,command,org.eclipse.jdt.ui,3.7.0.v20110531-1200,"org.eclipse.jdt.ui.edit.text.java.rename.element",1332206940374
+started,bundle,org.eclipse.wb.core.xml,1.2.0.r37x201112291009,"org.eclipse.wb.core.xml",1332206953640
+executed,command,org.eclipse.jdt.ui,3.7.0.v20110531-1200,"org.eclipse.jdt.ui.edit.text.java.rename.element",1332206964127
+executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.edit.copy",1332206973415
+executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.edit.paste",1332206974562
+executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.edit.copy",1332206982108
+deactivated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1332206983075
+executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.edit.findReplace",1332206983107
+executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.edit.paste",1332206983266
+activated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1332206998455
+executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.edit.undo",1332207010582
+executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.edit.copy",1332207028296
+executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.edit.paste",1332207029120
+executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.file.save",1332207041732
+executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.file.save",1332207067779
+executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.file.save",1332207146559
+executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.file.save",1332207240332
+executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.edit.copy",1332207260915
+executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.edit.paste",1332207265891
+executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.file.save",1332207278257
+executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.edit.copy",1332207295830
+executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.edit.paste",1332207296683
+executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.file.save",1332207319417
+executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.edit.copy",1332207326329
+executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.edit.paste",1332207349555
+executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.file.save",1332207360961
+executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.file.save",1332207375137
+executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.file.save",1332207398583
+executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.edit.copy",1332207424775
+executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.edit.paste",1332207425696
+executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.edit.copy",1332207429180
+executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.edit.paste",1332207437843
+executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.file.save",1332207438542
+started,bundle,org.eclipse.m2e.launching,1.0.200.20111228-1245,"org.eclipse.m2e.launching",1332207453561
+deactivated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1332207460892
+activated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1332207484616
+deactivated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1332207487584
+activated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1332207511021
+deactivated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1332207524672
+activated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1332207529731
+deactivated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1332207546548
+executed,command,org.eclipse.ui.workbench.texteditor,3.7.0.v20110505-0800,"org.eclipse.ui.edit.text.showInformation",1332207546564
+activated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1332207551635
+executed,command,org.eclipse.jdt.ui,3.7.0.v20110531-1200,"org.eclipse.jdt.ui.edit.text.java.open.editor",1332207554445
+activated,view,org.eclipse.ui.console,3.5.100.v20110511,"org.eclipse.ui.console.ConsoleView",1332207572195
+activated,editor,org.eclipse.jdt.ui,3.7.0.v20110531-1200,"org.eclipse.jdt.ui.CompilationUnitEditor",1332207572911
+activated,view,org.eclipse.ui.console,3.5.100.v20110511,"org.eclipse.ui.console.ConsoleView",1332207588366
+opened,editor,org.eclipse.jdt.ui,3.7.0.v20110531-1200,"org.eclipse.jdt.ui.CompilationUnitEditor",1332207588592
+activated,editor,org.eclipse.jdt.ui,3.7.0.v20110531-1200,"org.eclipse.jdt.ui.CompilationUnitEditor",1332207588662
+activated,view,org.eclipse.ui.console,3.5.100.v20110511,"org.eclipse.ui.console.ConsoleView",1332207590737
+activated,editor,org.eclipse.jdt.ui,3.7.0.v20110531-1200,"org.eclipse.jdt.ui.CompilationUnitEditor",1332207590912
+activated,view,org.eclipse.ui.console,3.5.100.v20110511,"org.eclipse.ui.console.ConsoleView",1332207596722
+activated,editor,org.eclipse.jdt.ui,3.7.0.v20110531-1200,"org.eclipse.jdt.ui.CompilationUnitEditor",1332207596908
+executed,command,,,"AUTOGEN:::org.eclipse.jdt.debug.CompilationUnitEditor.BreakpointRulerActions/org.eclipse.jdt.debug.ui.actions.ManageBreakpointRulerAction",1332207607014
+deactivated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1332207609638
+opened,view,org.eclipse.debug.ui,3.7.0.v20110518,"org.eclipse.debug.ui.DebugView",1332207611783
+activated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1332207611819
+executed,command,org.eclipse.debug.ui,3.7.0.v20110518,"org.eclipse.debug.ui.commands.Resume",1332207630157
+activated,view,org.eclipse.ui.console,3.5.100.v20110511,"org.eclipse.ui.console.ConsoleView",1332207632291
+activated,editor,org.eclipse.jdt.ui,3.7.0.v20110531-1200,"org.eclipse.jdt.ui.CompilationUnitEditor",1332207635071
+executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.file.save",1332207638886
+executed,command,,,"AUTOGEN:::org.eclipse.jdt.debug.CompilationUnitEditor.BreakpointRulerActions/org.eclipse.jdt.debug.ui.actions.ManageBreakpointRulerAction",1332207643856
+deactivated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1332207647536
+activated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1332207662578
+deactivated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1332207668284
+activated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1332207712112
+activated,view,org.eclipse.ui.console,3.5.100.v20110511,"org.eclipse.ui.console.ConsoleView",1332207728358
+activated,editor,org.eclipse.jdt.ui,3.7.0.v20110531-1200,"org.eclipse.jdt.ui.CompilationUnitEditor",1332207728618
+deactivated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1332207757915
+activated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1332207773109
+activated,view,org.eclipse.ui.console,3.5.100.v20110511,"org.eclipse.ui.console.ConsoleView",1332207793148
+executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.edit.copy",1332207798147
+activated,editor,org.eclipse.jdt.ui,3.7.0.v20110531-1200,"org.eclipse.jdt.ui.CompilationUnitEditor",1332207800030
+executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.edit.paste",1332207810981
+executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.edit.copy",1332207820585
+executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.edit.paste",1332207822684
diff --git a/workspace/.metadata/.plugins/org.eclipse.epp.usagedata.recording/upload24.csv b/workspace/.metadata/.plugins/org.eclipse.epp.usagedata.recording/upload24.csv
deleted file mode 100644 (file)
index 9034911..0000000
+++ /dev/null
@@ -1,251 +0,0 @@
-what,kind,bundleId,bundleVersion,description,time
-ws,sysinfo,,,"cocoa",1331136188674
-locale,sysinfo,,,"ja_JP",1331136188674
-processors,sysinfo,,,"8",1331136188674
-java.runtime.name,sysinfo,,,"Java(TM) SE Runtime Environment",1331136188674
-java.runtime.version,sysinfo,,,"1.6.0_29-b11-402-11M3527",1331136188674
-java.specification.name,sysinfo,,,"Java Platform API Specification",1331136188674
-java.specification.vendor,sysinfo,,,"Sun Microsystems Inc.",1331136188674
-java.specification.version,sysinfo,,,"1.6",1331136188674
-java.vendor,sysinfo,,,"Apple Inc.",1331136188674
-java.version,sysinfo,,,"1.6.0_29",1331136188674
-java.vm.info,sysinfo,,,"mixed mode",1331136188674
-java.vm.name,sysinfo,,,"Java HotSpot(TM) 64-Bit Server VM",1331136188674
-java.vm.specification.name,sysinfo,,,"Java Virtual Machine Specification",1331136188674
-java.vm.specification.vendor,sysinfo,,,"Sun Microsystems Inc.",1331136188674
-java.vm.specification.version,sysinfo,,,"1.0",1331136188674
-java.vm.vendor,sysinfo,,,"Apple Inc.",1331136188674
-java.vm.version,sysinfo,,,"20.4-b02-402",1331136188674
-started,bundle,org.eclipse.m2e.usagedata,1.0.200.20111228-1245,"org.eclipse.m2e.usagedata",1331136188675
-activated,view,org.eclipse.jdt.ui,3.7.0.v20110531-1200,"org.eclipse.jdt.ui.PackageExplorer",1331136189384
-opened,view,org.eclipse.ui.ide,3.7.0.I20110519-0100,"org.eclipse.ui.views.ProblemView",1331136192174
-started,bundle,org.eclipse.compare,3.5.200.I20110525-0800,"org.eclipse.compare",1331136206636
-deactivated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1331136209635
-executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.edit.paste",1331136242458
-activated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1331136248498
-started,bundle,org.eclipse.debug.ui,3.7.0.v20110518,"org.eclipse.debug.ui",1331136248599
-started,bundle,org.eclipse.jdt.debug,3.7.0.v20110509,"org.eclipse.jdt.debug",1331136248732
-opened,editor,org.eclipse.jdt.ui,3.7.0.v20110531-1200,"org.eclipse.jdt.ui.CompilationUnitEditor",1331136248861
-started,bundle,org.eclipse.jdt.debug.ui,3.6.0.v20110512,"org.eclipse.jdt.debug.ui",1331136248974
-activated,editor,org.eclipse.jdt.ui,3.7.0.v20110531-1200,"org.eclipse.jdt.ui.CompilationUnitEditor",1331136248998
-deactivated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1331136329533
-activated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1331136532506
-executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.edit.paste",1331136540100
-deactivated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1331136541651
-activated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1331136564145
-executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.edit.paste",1331136572969
-executed,command,org.eclipse.ui.ide,3.7.0.I20110519-0100,"org.eclipse.jdt.ui.edit.text.java.correction.assist.proposals",1331136588547
-started,bundle,org.eclipse.mylyn.java.tasks,3.6.0.v20110608-1400,"org.eclipse.mylyn.java.tasks",1331136588590
-deactivated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1331136593235
-executed,command,org.eclipse.jdt.ui,3.7.0.v20110531-1200,"org.eclipse.jdt.ui.edit.text.java.show.outline",1331136593260
-activated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1331136594915
-deactivated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1331136600516
-activated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1331136605157
-executed,command,org.eclipse.jdt.ui,3.7.0.v20110531-1200,"org.eclipse.jdt.ui.edit.text.java.organize.imports",1331136605288
-deactivated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1331136618382
-activated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1331136637502
-executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.edit.copy",1331136666222
-executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.edit.paste",1331136668825
-deactivated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1331136673565
-activated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1331136676735
-deactivated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1331136685041
-activated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1331136730884
-executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.edit.paste",1331136737902
-executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.edit.undo",1331136741378
-deactivated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1331136743706
-activated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1331136749781
-executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.edit.paste",1331136754572
-executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.file.save",1331136775057
-deactivated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1331136804489
-activated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1331137062715
-started,bundle,org.eclipse.mylyn.ide.ui,3.6.0.v20110608-1400,"org.eclipse.mylyn.ide.ui",1331137086617
-started,bundle,org.eclipse.mylyn.java.ui,3.6.0.v20110608-1400,"org.eclipse.mylyn.java.ui",1331137086634
-deactivated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1331137146960
-activated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1331137165321
-deactivated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1331137168071
-activated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1331137171263
-executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.edit.paste",1331137172851
-executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.edit.copy",1331137189940
-executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.edit.paste",1331137196134
-deactivated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1331137208986
-activated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1331137210884
-executed,command,org.eclipse.jdt.ui,3.7.0.v20110531-1200,"org.eclipse.jdt.ui.edit.text.java.organize.imports",1331137211017
-executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.edit.copy",1331137222609
-executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.edit.copy",1331137227209
-executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.edit.paste",1331137228101
-executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.edit.copy",1331137231385
-executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.edit.paste",1331137233573
-executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.edit.copy",1331137241329
-executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.edit.paste",1331137242628
-executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.edit.copy",1331137252616
-executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.edit.paste",1331137254254
-executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.edit.copy",1331137258611
-executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.edit.paste",1331137260402
-executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.file.save",1331137262037
-deactivated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1331137390546
-activated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1331137408844
-executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.edit.paste",1331137413085
-executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.edit.paste",1331137418148
-executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.file.save",1331137431653
-deactivated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1331137445929
-activated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1331137447737
-closed,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1331137447953
-stopped,bundle,org.eclipse.m2e.logback.configuration,1.0.0.20110607-2117,"org.eclipse.m2e.logback.configuration",1331137448519
-stopped,bundle,org.eclipse.ui.cheatsheets,3.4.100.v20110425,"org.eclipse.ui.cheatsheets",1331137448520
-stopped,bundle,org.eclipse.help.ui,3.5.100.v20110425,"org.eclipse.help.ui",1331137448520
-stopped,bundle,org.eclipse.help.webapp,3.6.0.v20110518,"org.eclipse.help.webapp",1331137448520
-stopped,bundle,org.eclipse.epp.mpc.ui,1.1.0.I20110525-0742,"org.eclipse.epp.mpc.ui",1331137448520
-stopped,bundle,org.eclipse.epp.usagedata.ui,1.3.1.R201106061540,"org.eclipse.epp.usagedata.ui",1331137448520
-stopped,bundle,org.eclipse.ui.intro.universal,3.2.500.v20110510,"org.eclipse.ui.intro.universal",1331137448520
-stopped,bundle,org.eclipse.ui.intro,3.4.100.v20110425,"org.eclipse.ui.intro",1331137448520
-stopped,bundle,org.eclipse.help.base,3.6.0.v201106131736,"org.eclipse.help.base",1331137448520
-stopped,bundle,org.eclipse.equinox.http.jetty,2.0.100.v20110502,"org.eclipse.equinox.http.jetty",1331137448520
-stopped,bundle,com.google.appengine.eclipse.datatools,2.5.2.v201202290255-rel-r37,"com.google.appengine.eclipse.datatools",1331137448520
-stopped,bundle,com.google.appengine.eclipse.sdkbundle,1.6.3.v201202290255r37,"com.google.appengine.eclipse.sdkbundle",1331137448521
-stopped,bundle,com.google.gdt.eclipse.appengine.rpc,2.5.2.v201202290255-rel-r37,"com.google.gdt.eclipse.appengine.rpc",1331137448521
-stopped,bundle,com.google.gdt.eclipse.gph.e36,2.5.2.v201202290255-rel-r37,"com.google.gdt.eclipse.gph.e36",1331137448521
-stopped,bundle,com.google.gdt.eclipse.gph.hge,2.5.2.v201202290255-rel-r37,"com.google.gdt.eclipse.gph.hge",1331137448521
-stopped,bundle,com.google.gdt.eclipse.gph.subclipse,2.5.2.v201202290255-rel-r37,"com.google.gdt.eclipse.gph.subclipse",1331137448521
-stopped,bundle,com.google.gdt.eclipse.gph.subversive,2.5.2.v201202290255-rel-r37,"com.google.gdt.eclipse.gph.subversive",1331137448521
-stopped,bundle,com.google.gdt.eclipse.suite.ext,2.5.2.v201202290255-rel-r37,"com.google.gdt.eclipse.suite.ext",1331137448521
-stopped,bundle,com.google.gdt.eclipse.gph,2.5.2.v201202290255-rel-r37,"com.google.gdt.eclipse.gph",1331137448521
-stopped,bundle,com.google.gdt.eclipse.maven.e37,2.5.2.v201202290255-rel-r37,"com.google.gdt.eclipse.maven.e37",1331137448522
-stopped,bundle,com.google.gdt.eclipse.maven,2.5.2.v201202290255-rel-r37,"com.google.gdt.eclipse.maven",1331137448522
-stopped,bundle,com.google.gdt.eclipse.suite,2.5.2.v201202290255-rel-r37,"com.google.gdt.eclipse.suite",1331137448524
-stopped,bundle,com.google.gdt.eclipse.appsmarketplace,2.5.2.v201202290255-rel-r37,"com.google.gdt.eclipse.appsmarketplace",1331137448524
-stopped,bundle,com.google.appengine.eclipse.core,2.5.2.v201202290255-rel-r37,"com.google.appengine.eclipse.core",1331137448525
-stopped,bundle,com.google.gdt.eclipse.login,2.5.2.v201202290255-rel-r37,"com.google.gdt.eclipse.login",1331137448526
-stopped,bundle,com.google.gdt.eclipse.managedapis,2.5.2.v201202290255-rel-r37,"com.google.gdt.eclipse.managedapis",1331137448527
-stopped,bundle,com.google.gwt.eclipse.oophm,2.5.2.v201202290255-rel-r37,"com.google.gwt.eclipse.oophm",1331137448527
-stopped,bundle,com.google.gwt.eclipse.sdkbundle,2.4.0.v201202290255-rel-r37,"com.google.gwt.eclipse.sdkbundle",1331137448527
-stopped,bundle,com.google.gwt.eclipse.core,2.5.2.v201202290255-rel-r37,"com.google.gwt.eclipse.core",1331137448633
-stopped,bundle,com.google.gdt.eclipse.core,2.5.2.v201202290255-rel-r37,"com.google.gdt.eclipse.core",1331137448634
-stopped,bundle,com.google.gdt.eclipse.platform,2.5.2.v201202290255-rel-r37,"com.google.gdt.eclipse.platform",1331137448634
-stopped,bundle,com.google.gdt.eclipse.platform.e37,2.5.2.v201202290255-rel-r37,"com.google.gdt.eclipse.platform.e37",1331137448634
-stopped,bundle,org.eclipse.m2e.discovery,1.0.200.20111228-1245,"org.eclipse.m2e.discovery",1331137448634
-stopped,bundle,org.eclipse.m2e.refactoring,1.0.200.20111228-1245,"org.eclipse.m2e.refactoring",1331137448634
-stopped,bundle,org.eclipse.m2e.editor,1.0.200.20111228-1245,"org.eclipse.m2e.editor",1331137448634
-stopped,bundle,org.eclipse.m2e.editor.xml,1.0.200.20111228-1245,"org.eclipse.m2e.editor.xml",1331137448635
-stopped,bundle,org.eclipse.m2e.jdt,1.0.200.20111228-1245,"org.eclipse.m2e.jdt",1331137448635
-stopped,bundle,org.eclipse.m2e.launching,1.0.200.20111228-1245,"org.eclipse.m2e.launching",1331137448635
-stopped,bundle,org.eclipse.m2e.usagedata,1.0.200.20111228-1245,"org.eclipse.m2e.usagedata",1331137448635
-stopped,bundle,org.eclipse.m2e.core.ui,1.0.200.20111228-1245,"org.eclipse.m2e.core.ui",1331137448635
-stopped,bundle,org.eclipse.m2e.core,1.0.200.20111228-1245,"org.eclipse.m2e.core",1331137448635
-stopped,bundle,org.eclipse.mylyn.ide.ant,3.6.0.v20110608-1400,"org.eclipse.mylyn.ide.ant",1331137448635
-stopped,bundle,org.eclipse.ant.ui,3.5.100.v20110510,"org.eclipse.ant.ui",1331137448635
-stopped,bundle,org.eclipse.ant.launching,1.0.100.v20110506,"org.eclipse.ant.launching",1331137448635
-stopped,bundle,org.eclipse.equinox.p2.ui.sdk,1.0.200.v20110502-1955,"org.eclipse.equinox.p2.ui.sdk",1331137448635
-stopped,bundle,org.eclipse.mylyn.java.tasks,3.6.0.v20110608-1400,"org.eclipse.mylyn.java.tasks",1331137448635
-stopped,bundle,org.eclipse.mylyn.java.ui,3.6.0.v20110608-1400,"org.eclipse.mylyn.java.ui",1331137448635
-stopped,bundle,com.google.gdt.eclipse.designer.UiBinder,2.5.0.r37x201112291029,"com.google.gdt.eclipse.designer.UiBinder",1331137448636
-stopped,bundle,com.google.gdt.eclipse.designer.gpe,2.5.0.r37x201201030222,"com.google.gdt.eclipse.designer.gpe",1331137448636
-stopped,bundle,com.google.gdt.eclipse.designer,2.5.0.r37x201112291029,"com.google.gdt.eclipse.designer",1331137448636
-stopped,bundle,org.eclipse.jdt.junit,3.7.0.v20110505-0800,"org.eclipse.jdt.junit",1331137448636
-stopped,bundle,org.eclipse.jdt.apt.ui,3.3.300.v20110305-1450,"org.eclipse.jdt.apt.ui",1331137448636
-stopped,bundle,org.eclipse.jdt.debug.ui,3.6.0.v20110512,"org.eclipse.jdt.debug.ui",1331137448641
-stopped,bundle,com.google.gdt.eclipse.platform.shared,2.5.2.v201202290255-rel-r37,"com.google.gdt.eclipse.platform.shared",1331137448641
-stopped,bundle,org.eclipse.wb.swing.FormLayout,1.0.0.r37x201106081552,"org.eclipse.wb.swing.FormLayout",1331137448641
-stopped,bundle,org.eclipse.wb.swing.MigLayout,1.0.0.r37x201106081552,"org.eclipse.wb.swing.MigLayout",1331137448641
-stopped,bundle,org.eclipse.wb.swing.databinding,1.0.0.r37x201106081552,"org.eclipse.wb.swing.databinding",1331137448641
-stopped,bundle,org.eclipse.wb.swing.java6,1.0.0.r37x201106081552,"org.eclipse.wb.swing.java6",1331137448641
-stopped,bundle,org.eclipse.wb.swing.jsr296,1.0.0.r37x201106081552,"org.eclipse.wb.swing.jsr296",1331137448641
-stopped,bundle,org.eclipse.wb.swing,1.0.0.r37x201106081552,"org.eclipse.wb.swing",1331137448641
-stopped,bundle,org.eclipse.wb.core.ui,1.0.0.r37x201106081733,"org.eclipse.wb.core.ui",1331137448641
-stopped,bundle,org.eclipse.wb.layout.group,1.0.0.r37x201106081642,"org.eclipse.wb.layout.group",1331137448641
-stopped,bundle,com.google.gdt.eclipse.designer.hosted.2_0.webkit,2.5.0.r37x201112291019,"com.google.gdt.eclipse.designer.hosted.2_0.webkit",1331137448642
-stopped,bundle,com.google.gdt.eclipse.designer.hosted.2_0,2.5.0.r37x201112291019,"com.google.gdt.eclipse.designer.hosted.2_0",1331137448642
-stopped,bundle,com.google.gdt.eclipse.designer.hosted.2_2.webkit,2.5.0.r37x201112291019,"com.google.gdt.eclipse.designer.hosted.2_2.webkit",1331137448642
-stopped,bundle,com.google.gdt.eclipse.designer.hosted.2_2,2.5.0.r37x201112291019,"com.google.gdt.eclipse.designer.hosted.2_2",1331137448642
-stopped,bundle,com.google.gdt.eclipse.designer.hosted,2.5.0.r37x201112291019,"com.google.gdt.eclipse.designer.hosted",1331137448642
-stopped,bundle,org.eclipse.wb.core.databinding.xml,1.2.0.r37x201112291009,"org.eclipse.wb.core.databinding.xml",1331137448642
-stopped,bundle,org.eclipse.wb.core.databinding,1.2.0.r37x201112290923,"org.eclipse.wb.core.databinding",1331137448642
-stopped,bundle,org.eclipse.wb.core.xml,1.2.0.r37x201112291009,"org.eclipse.wb.core.xml",1331137448642
-stopped,bundle,org.eclipse.wb.css,1.2.0.r37x201112290951,"org.eclipse.wb.css",1331137448642
-stopped,bundle,org.eclipse.wb.os.macosx,1.2.0.r37x201112290923,"org.eclipse.wb.os.macosx",1331137448642
-stopped,bundle,org.eclipse.wb.core,1.2.0.r37x201112290923,"org.eclipse.wb.core",1331137448644
-stopped,bundle,org.eclipse.jdt.ui,3.7.0.v20110531-1200,"org.eclipse.jdt.ui",1331137448649
-stopped,bundle,org.eclipse.wst.dtd.ui,1.0.600.v201103171359,"org.eclipse.wst.dtd.ui",1331137448649
-stopped,bundle,org.eclipse.wst.xsd.ui,1.2.404.v201105050216,"org.eclipse.wst.xsd.ui",1331137448649
-stopped,bundle,org.eclipse.wst.css.ui,1.0.601.v201201101544,"org.eclipse.wst.css.ui",1331137448649
-stopped,bundle,org.eclipse.wst.xml.ui,1.1.202.v201112071516,"org.eclipse.wst.xml.ui",1331137448649
-stopped,bundle,org.eclipse.wst.common.ui,1.1.500.v200911190730,"org.eclipse.wst.common.ui",1331137448649
-stopped,bundle,org.eclipse.wst.jsdt.ui,1.1.102.v201201131900,"org.eclipse.wst.jsdt.ui",1331137448649
-stopped,bundle,org.eclipse.wst.sse.ui,1.3.2.v201201041522,"org.eclipse.wst.sse.ui",1331137448649
-stopped,bundle,org.eclipse.search,3.7.0.v20110505-0800,"org.eclipse.search",1331137448653
-stopped,bundle,org.eclipse.mylyn.commons.team,0.8.0.v20110608-1400,"org.eclipse.mylyn.commons.team",1331137448653
-stopped,bundle,org.eclipse.mylyn.team.ui,3.6.0.v20110608-1400,"org.eclipse.mylyn.team.ui",1331137448653
-stopped,bundle,org.eclipse.ui.navigator.resources,3.4.300.I20110421-1800,"org.eclipse.ui.navigator.resources",1331137448654
-stopped,bundle,org.eclipse.ltk.ui.refactoring,3.6.0.v20110505-0800,"org.eclipse.ltk.ui.refactoring",1331137448654
-stopped,bundle,org.eclipse.mylyn.bugzilla.ui,3.6.0.v20110608-1400,"org.eclipse.mylyn.bugzilla.ui",1331137448654
-stopped,bundle,org.eclipse.mylyn.ide.ui,3.6.0.v20110608-1400,"org.eclipse.mylyn.ide.ui",1331137448654
-stopped,bundle,org.eclipse.mylyn.resources.ui,3.6.0.v20110608-1400,"org.eclipse.mylyn.resources.ui",1331137448654
-stopped,bundle,org.eclipse.mylyn.wikitext.tasks.ui,1.5.0.v20110608-1400,"org.eclipse.mylyn.wikitext.tasks.ui",1331137448654
-stopped,bundle,org.eclipse.mylyn.context.ui,3.6.0.v20110608-1400,"org.eclipse.mylyn.context.ui",1331137448654
-stopped,bundle,org.eclipse.mylyn.help.ui,3.6.0.v20110608-1400,"org.eclipse.mylyn.help.ui",1331137448654
-stopped,bundle,org.eclipse.mylyn.tasks.bugs,3.6.0.v20110608-1400,"org.eclipse.mylyn.tasks.bugs",1331137448654
-stopped,bundle,org.eclipse.mylyn.tasks.ui,3.6.0.v20110608-1400,"org.eclipse.mylyn.tasks.ui",1331137448654
-stopped,bundle,org.eclipse.team.cvs.ui,3.3.400.I20110510-0800,"org.eclipse.team.cvs.ui",1331137448655
-stopped,bundle,org.eclipse.team.ui,3.6.100.I20110525-0800,"org.eclipse.team.ui",1331137448655
-stopped,bundle,org.eclipse.compare,3.5.200.I20110525-0800,"org.eclipse.compare",1331137448655
-stopped,bundle,org.eclipse.ui.externaltools,3.2.0.v20110506,"org.eclipse.ui.externaltools",1331137448655
-stopped,bundle,org.eclipse.debug.ui,3.7.0.v20110518,"org.eclipse.debug.ui",1331137448658
-stopped,bundle,org.eclipse.mylyn.wikitext.ui,1.5.0.v20110608-1400,"org.eclipse.mylyn.wikitext.ui",1331137448658
-stopped,bundle,org.eclipse.ui.console,3.5.100.v20110511,"org.eclipse.ui.console",1331137448658
-stopped,bundle,org.eclipse.mylyn.commons.ui,3.6.1.v20110720-0100,"org.eclipse.mylyn.commons.ui",1331137448658
-stopped,bundle,org.eclipse.ui.editors,3.7.0.v20110517-0800,"org.eclipse.ui.editors",1331137448658
-stopped,bundle,org.eclipse.wst.common.snippets,1.2.100.v201103281740,"org.eclipse.wst.common.snippets",1331137448658
-stopped,bundle,org.eclipse.ui.workbench.texteditor,3.7.0.v20110505-0800,"org.eclipse.ui.workbench.texteditor",1331137448658
-stopped,bundle,org.eclipse.compare.core,3.5.200.I20110208-0800,"org.eclipse.compare.core",1331137448658
-stopped,bundle,org.eclipse.emf.edit.ui,2.7.0.v20110606-0949,"org.eclipse.emf.edit.ui",1331137448658
-stopped,bundle,org.eclipse.gef,3.7.0.v20110407-2050,"org.eclipse.gef",1331137448658
-stopped,bundle,org.eclipse.emf.common.ui,2.7.0.v20110606-0949,"org.eclipse.emf.common.ui",1331137448659
-activated,perspective,org.eclipse.jdt.ui,,"org.eclipse.jdt.ui.JavaPerspective",1331394654597
-started,bundle,org.eclipse.osgi,3.7.0.v20110613,"org.eclipse.osgi",1331394654598
-started,bundle,org.eclipse.equinox.simpleconfigurator,1.0.200.v20110502-1955,"org.eclipse.equinox.simpleconfigurator",1331394654598
-started,bundle,com.ibm.icu,4.4.2.v20110208,"com.ibm.icu",1331394654598
-started,bundle,org.eclipse.compare.core,3.5.200.I20110208-0800,"org.eclipse.compare.core",1331394654598
-started,bundle,org.eclipse.core.contenttype,3.4.100.v20110423-0524,"org.eclipse.core.contenttype",1331394654598
-started,bundle,org.eclipse.core.databinding.observable,1.4.0.I20110222-0800,"org.eclipse.core.databinding.observable",1331394654598
-started,bundle,org.eclipse.core.expressions,3.4.300.v20110228,"org.eclipse.core.expressions",1331394654598
-started,bundle,org.eclipse.core.filebuffers,3.5.200.v20110505-0800,"org.eclipse.core.filebuffers",1331394654598
-started,bundle,org.eclipse.core.filesystem,1.3.100.v20110423-0524,"org.eclipse.core.filesystem",1331394654598
-started,bundle,org.eclipse.core.jobs,3.5.100.v20110404,"org.eclipse.core.jobs",1331394654598
-started,bundle,org.eclipse.core.net,1.2.100.I20110511-0800,"org.eclipse.core.net",1331394654598
-started,bundle,org.eclipse.core.resources,3.7.100.v20110510-0712,"org.eclipse.core.resources",1331394654598
-started,bundle,org.eclipse.core.runtime,3.7.0.v20110110,"org.eclipse.core.runtime",1331394654598
-started,bundle,org.eclipse.core.runtime.compatibility,3.2.100.v20100505,"org.eclipse.core.runtime.compatibility",1331394654598
-started,bundle,org.eclipse.core.runtime.compatibility.auth,3.2.200.v20110110,"org.eclipse.core.runtime.compatibility.auth",1331394654598
-started,bundle,org.eclipse.core.variables,3.2.500.v20110511,"org.eclipse.core.variables",1331394654598
-started,bundle,org.eclipse.debug.core,3.7.0.v20110518,"org.eclipse.debug.core",1331394654598
-started,bundle,org.eclipse.epp.mpc.ui,1.1.0.I20110525-0742,"org.eclipse.epp.mpc.ui",1331394654598
-started,bundle,org.eclipse.epp.usagedata.gathering,1.3.1.R201106061540,"org.eclipse.epp.usagedata.gathering",1331394654598
-started,bundle,org.eclipse.epp.usagedata.recording,1.3.1.R201106061540,"org.eclipse.epp.usagedata.recording",1331394654598
-started,bundle,org.eclipse.equinox.app,1.3.100.v20110321,"org.eclipse.equinox.app",1331394654598
-started,bundle,org.eclipse.equinox.common,3.6.0.v20110523,"org.eclipse.equinox.common",1331394654598
-started,bundle,org.eclipse.equinox.ds,1.3.0.v20110502,"org.eclipse.equinox.ds",1331394654598
-started,bundle,org.eclipse.equinox.event,1.2.100.v20110502,"org.eclipse.equinox.event",1331394654598
-started,bundle,org.eclipse.equinox.p2.core,2.1.0.v20110502-1955,"org.eclipse.equinox.p2.core",1331394654598
-started,bundle,org.eclipse.equinox.p2.directorywatcher,1.0.300.v20110502-1955,"org.eclipse.equinox.p2.directorywatcher",1331394654598
-started,bundle,org.eclipse.equinox.p2.engine,2.1.0.v20110511,"org.eclipse.equinox.p2.engine",1331394654598
-started,bundle,org.eclipse.equinox.p2.metadata,2.1.0.v20110510,"org.eclipse.equinox.p2.metadata",1331394654598
-started,bundle,org.eclipse.equinox.p2.metadata.repository,1.2.0.v20110511-1359,"org.eclipse.equinox.p2.metadata.repository",1331394654598
-started,bundle,org.eclipse.equinox.p2.operations,2.1.0.v20110511-1821,"org.eclipse.equinox.p2.operations",1331394654598
-started,bundle,org.eclipse.equinox.p2.reconciler.dropins,1.1.100.v20110510,"org.eclipse.equinox.p2.reconciler.dropins",1331394654598
-started,bundle,org.eclipse.equinox.p2.repository,2.1.0.v20110601,"org.eclipse.equinox.p2.repository",1331394654598
-started,bundle,org.eclipse.equinox.p2.ui.sdk.scheduler,1.0.100.v20110502-1955,"org.eclipse.equinox.p2.ui.sdk.scheduler",1331394654598
-started,bundle,org.eclipse.equinox.p2.updatechecker,1.1.200.v20110502-1955,"org.eclipse.equinox.p2.updatechecker",1331394654598
-started,bundle,org.eclipse.equinox.preferences,3.4.0.v20110502,"org.eclipse.equinox.preferences",1331394654598
-started,bundle,org.eclipse.equinox.registry,3.5.100.v20110502,"org.eclipse.equinox.registry",1331394654598
-started,bundle,org.eclipse.equinox.security,1.1.0.v20110502,"org.eclipse.equinox.security",1331394654598
-started,bundle,org.eclipse.equinox.util,1.0.300.v20110502,"org.eclipse.equinox.util",1331394654598
-started,bundle,org.eclipse.help,3.5.100.v20110426,"org.eclipse.help",1331394654598
-started,bundle,org.eclipse.jdt.apt.core,3.3.500.v20110420-1015,"org.eclipse.jdt.apt.core",1331394654598
-started,bundle,org.eclipse.jdt.apt.pluggable.core,1.0.400.v20110305-1450,"org.eclipse.jdt.apt.pluggable.core",1331394654598
-started,bundle,org.eclipse.jdt.core,3.7.0.v_B61,"org.eclipse.jdt.core",1331394654598
-started,bundle,org.eclipse.jdt.core.manipulation,1.4.0.v20110505-0800,"org.eclipse.jdt.core.manipulation",1331394654598
-started,bundle,org.eclipse.jdt.junit,3.7.0.v20110505-0800,"org.eclipse.jdt.junit",1331394654598
-started,bundle,org.eclipse.jdt.launching,3.6.0.v20110509,"org.eclipse.jdt.launching",1331394654598
-started,bundle,org.eclipse.jdt.launching.macosx,3.2.100.v20110509,"org.eclipse.jdt.launching.macosx",1331394654598
-started,bundle,org.eclipse.jdt.ui,3.7.0.v20110531-1200,"org.eclipse.jdt.ui",1331394654598
-started,bundle,org.eclipse.jface,3.7.0.I20110522-1430,"org.eclipse.jface",1331394654598
-started,bundle,org.eclipse.jsch.core,1.1.300.I20110514-0800,"org.eclipse.jsch.core",1331394654598
index c6d9e5d..e8100c2 100644 (file)
 what,kind,bundleId,bundleVersion,description,time
-executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.file.save",1331425246608
-activated,view,org.eclipse.ui.console,3.5.100.v20110511,"org.eclipse.ui.console.ConsoleView",1331425249106
-activated,editor,org.eclipse.jdt.ui,3.7.0.v20110531-1200,"org.eclipse.jdt.ui.CompilationUnitEditor",1331425254047
-activated,view,org.eclipse.ui.console,3.5.100.v20110511,"org.eclipse.ui.console.ConsoleView",1331425257378
-activated,editor,org.eclipse.jdt.ui,3.7.0.v20110531-1200,"org.eclipse.jdt.ui.CompilationUnitEditor",1331425260088
-executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.file.save",1331425263795
-activated,view,org.eclipse.ui.console,3.5.100.v20110511,"org.eclipse.ui.console.ConsoleView",1331425267000
-activated,editor,org.eclipse.jdt.ui,3.7.0.v20110531-1200,"org.eclipse.jdt.ui.CompilationUnitEditor",1331425268865
-executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.file.save",1331425271358
-activated,view,org.eclipse.ui.console,3.5.100.v20110511,"org.eclipse.ui.console.ConsoleView",1331425274728
-activated,editor,org.eclipse.jdt.ui,3.7.0.v20110531-1200,"org.eclipse.jdt.ui.CompilationUnitEditor",1331425276921
-executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.edit.undo",1331425284198
-executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.file.save",1331425290571
-activated,view,org.eclipse.ui.console,3.5.100.v20110511,"org.eclipse.ui.console.ConsoleView",1331425294516
-activated,editor,org.eclipse.jdt.ui,3.7.0.v20110531-1200,"org.eclipse.jdt.ui.CompilationUnitEditor",1331425297369
-executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.file.save",1331425304208
-activated,view,org.eclipse.ui.console,3.5.100.v20110511,"org.eclipse.ui.console.ConsoleView",1331425307032
-activated,editor,org.eclipse.jdt.ui,3.7.0.v20110531-1200,"org.eclipse.jdt.ui.CompilationUnitEditor",1331425310270
-executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.file.save",1331425312289
-activated,view,org.eclipse.ui.console,3.5.100.v20110511,"org.eclipse.ui.console.ConsoleView",1331425315344
-activated,editor,org.eclipse.jdt.ui,3.7.0.v20110531-1200,"org.eclipse.jdt.ui.CompilationUnitEditor",1331425317266
-executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.file.save",1331425319309
-activated,view,org.eclipse.ui.console,3.5.100.v20110511,"org.eclipse.ui.console.ConsoleView",1331425322287
-activated,editor,org.eclipse.jdt.ui,3.7.0.v20110531-1200,"org.eclipse.jdt.ui.CompilationUnitEditor",1331425325181
-executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.file.save",1331425328114
-activated,view,org.eclipse.ui.console,3.5.100.v20110511,"org.eclipse.ui.console.ConsoleView",1331425331903
-deactivated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1331425345991
-activated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1331425513299
-deactivated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1331425539096
-activated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1331425590591
-deactivated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1331425601607
-activated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1331425607565
-opened,view,org.eclipse.debug.ui,3.7.0.v20110518,"org.eclipse.debug.ui.DebugView",1331425609055
-activated,view,org.eclipse.debug.ui,3.7.0.v20110518,"org.eclipse.debug.ui.DebugView",1331425609073
-opened,view,org.eclipse.ui.ide,3.7.0.I20110519-0100,"org.eclipse.ui.views.ProgressView",1331425611381
-activated,view,org.eclipse.ui.ide,3.7.0.I20110519-0100,"org.eclipse.ui.views.ProgressView",1331425611397
-activated,view,org.eclipse.ui.console,3.5.100.v20110511,"org.eclipse.ui.console.ConsoleView",1331425612597
-opened,editor,org.eclipse.jdt.ui,3.7.0.v20110531-1200,"org.eclipse.jdt.ui.CompilationUnitEditor",1331425615753
-activated,editor,org.eclipse.jdt.ui,3.7.0.v20110531-1200,"org.eclipse.jdt.ui.CompilationUnitEditor",1331425615832
-executed,command,,,"AUTOGEN:::org.eclipse.jdt.debug.CompilationUnitEditor.BreakpointRulerActions/org.eclipse.jdt.debug.ui.actions.ManageBreakpointRulerAction",1331425642440
-deactivated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1331425644510
-activated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1331425653703
-executed,command,,,"AUTOGEN:::org.eclipse.jdt.debug.CompilationUnitEditor.BreakpointRulerActions/org.eclipse.jdt.debug.ui.actions.ManageBreakpointRulerAction",1331425657227
-executed,command,org.eclipse.debug.ui,3.7.0.v20110518,"org.eclipse.debug.ui.commands.StepOver",1331425663381
-executed,command,org.eclipse.debug.ui,3.7.0.v20110518,"org.eclipse.debug.ui.commands.StepOver",1331425663939
-executed,command,org.eclipse.debug.ui,3.7.0.v20110518,"org.eclipse.debug.ui.commands.StepOver",1331425664475
-executed,command,org.eclipse.debug.ui,3.7.0.v20110518,"org.eclipse.debug.ui.commands.StepOver",1331425664971
-executed,command,org.eclipse.debug.ui,3.7.0.v20110518,"org.eclipse.debug.ui.commands.StepOver",1331425665435
-executed,command,org.eclipse.debug.ui,3.7.0.v20110518,"org.eclipse.debug.ui.commands.StepOver",1331425665890
-started,bundle,org.eclipse.mylyn.ide.ui,3.6.0.v20110608-1400,"org.eclipse.mylyn.ide.ui",1331425669521
-executed,command,org.eclipse.debug.ui,3.7.0.v20110518,"org.eclipse.debug.ui.commands.StepOver",1331425671747
-executed,command,org.eclipse.debug.ui,3.7.0.v20110518,"org.eclipse.debug.ui.commands.StepOver",1331425672747
-executed,command,org.eclipse.debug.ui,3.7.0.v20110518,"org.eclipse.debug.ui.commands.StepOver",1331425673323
-executed,command,org.eclipse.debug.ui,3.7.0.v20110518,"org.eclipse.debug.ui.commands.StepOver",1331425674803
-executed,command,org.eclipse.debug.ui,3.7.0.v20110518,"org.eclipse.debug.ui.commands.StepOver",1331425675323
-executed,command,org.eclipse.debug.ui,3.7.0.v20110518,"org.eclipse.debug.ui.commands.StepOver",1331425675643
-executed,command,org.eclipse.debug.ui,3.7.0.v20110518,"org.eclipse.debug.ui.commands.StepOver",1331425675909
-executed,command,org.eclipse.debug.ui,3.7.0.v20110518,"org.eclipse.debug.ui.commands.StepOver",1331425676216
-executed,command,org.eclipse.debug.ui,3.7.0.v20110518,"org.eclipse.debug.ui.commands.StepOver",1331425676456
-executed,command,org.eclipse.debug.ui,3.7.0.v20110518,"org.eclipse.debug.ui.commands.StepOver",1331425676857
-executed,command,org.eclipse.debug.ui,3.7.0.v20110518,"org.eclipse.debug.ui.commands.StepOver",1331425680731
-executed,command,org.eclipse.debug.ui,3.7.0.v20110518,"org.eclipse.debug.ui.commands.StepOver",1331425680979
-executed,command,org.eclipse.debug.ui,3.7.0.v20110518,"org.eclipse.debug.ui.commands.StepOver",1331425681191
-executed,command,org.eclipse.debug.ui,3.7.0.v20110518,"org.eclipse.debug.ui.commands.StepOver",1331425681380
-executed,command,org.eclipse.debug.ui,3.7.0.v20110518,"org.eclipse.debug.ui.commands.StepOver",1331425681623
-executed,command,org.eclipse.debug.ui,3.7.0.v20110518,"org.eclipse.debug.ui.commands.StepOver",1331425682099
-executed,command,org.eclipse.debug.ui,3.7.0.v20110518,"org.eclipse.debug.ui.commands.StepOver",1331425682299
-executed,command,org.eclipse.debug.ui,3.7.0.v20110518,"org.eclipse.debug.ui.commands.StepOver",1331425682498
-executed,command,org.eclipse.debug.ui,3.7.0.v20110518,"org.eclipse.debug.ui.commands.StepOver",1331425683219
-executed,command,org.eclipse.debug.ui,3.7.0.v20110518,"org.eclipse.debug.ui.commands.StepOver",1331425683899
-executed,command,org.eclipse.debug.ui,3.7.0.v20110518,"org.eclipse.debug.ui.commands.StepOver",1331425689667
-executed,command,org.eclipse.debug.ui,3.7.0.v20110518,"org.eclipse.debug.ui.commands.StepOver",1331425690562
-executed,command,org.eclipse.debug.ui,3.7.0.v20110518,"org.eclipse.debug.ui.commands.StepOver",1331425690881
-executed,command,org.eclipse.debug.ui,3.7.0.v20110518,"org.eclipse.debug.ui.commands.StepOver",1331425691212
-executed,command,org.eclipse.debug.ui,3.7.0.v20110518,"org.eclipse.debug.ui.commands.StepOver",1331425691355
-executed,command,org.eclipse.debug.ui,3.7.0.v20110518,"org.eclipse.debug.ui.commands.StepOver",1331425691540
-executed,command,org.eclipse.debug.ui,3.7.0.v20110518,"org.eclipse.debug.ui.commands.StepOver",1331425691863
-executed,command,org.eclipse.debug.ui,3.7.0.v20110518,"org.eclipse.debug.ui.commands.StepOver",1331425692029
-executed,command,org.eclipse.debug.ui,3.7.0.v20110518,"org.eclipse.debug.ui.commands.StepOver",1331425692213
-executed,command,org.eclipse.debug.ui,3.7.0.v20110518,"org.eclipse.debug.ui.commands.Resume",1331425693956
-activated,view,org.eclipse.ui.console,3.5.100.v20110511,"org.eclipse.ui.console.ConsoleView",1331425697153
-activated,editor,org.eclipse.jdt.ui,3.7.0.v20110531-1200,"org.eclipse.jdt.ui.CompilationUnitEditor",1331425706450
-executed,command,,,"AUTOGEN:::org.eclipse.jdt.debug.CompilationUnitEditor.BreakpointRulerActions/org.eclipse.jdt.debug.ui.actions.ManageBreakpointRulerAction",1331425706669
-executed,command,,,"AUTOGEN:::org.eclipse.jdt.debug.CompilationUnitEditor.BreakpointRulerActions/org.eclipse.jdt.debug.ui.actions.ManageBreakpointRulerAction",1331425715805
-deactivated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1331425718365
-activated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1331425783880
-deactivated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1331425788925
-activated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1331425796880
-executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.edit.copy",1331425818968
-executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.edit.paste",1331425821819
-executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.edit.copy",1331425826989
-executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.edit.paste",1331425829883
-executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.file.save",1331425830828
-executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.file.save",1331425837979
-activated,view,org.eclipse.ui.console,3.5.100.v20110511,"org.eclipse.ui.console.ConsoleView",1331425848741
-deactivated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1331425882157
-activated,view,org.eclipse.debug.ui,3.7.0.v20110518,"org.eclipse.debug.ui.DebugView",1331425908262
-activated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1331425908309
-executed,command,org.eclipse.debug.ui,3.7.0.v20110518,"org.eclipse.debug.ui.commands.Resume",1331425913431
-executed,command,org.eclipse.debug.ui,3.7.0.v20110518,"org.eclipse.debug.ui.commands.Resume",1331425914167
-activated,view,org.eclipse.ui.console,3.5.100.v20110511,"org.eclipse.ui.console.ConsoleView",1331425914437
-executed,command,org.eclipse.debug.ui,3.7.0.v20110518,"org.eclipse.debug.ui.commands.Resume",1331425915071
-activated,view,org.eclipse.debug.ui,3.7.0.v20110518,"org.eclipse.debug.ui.DebugView",1331425915181
-executed,command,org.eclipse.debug.ui,3.7.0.v20110518,"org.eclipse.debug.ui.commands.Resume",1331425915799
-activated,view,org.eclipse.ui.console,3.5.100.v20110511,"org.eclipse.ui.console.ConsoleView",1331425916000
-activated,editor,org.eclipse.jdt.ui,3.7.0.v20110531-1200,"org.eclipse.jdt.ui.CompilationUnitEditor",1331425951568
-executed,command,,,"AUTOGEN:::org.eclipse.jdt.internal.ui.CompilationUnitEditor.ruler.actions/org.eclipse.jdt.internal.ui.javaeditor.JavaSelectRulerAction",1331425952137
-executed,command,,,"AUTOGEN:::org.eclipse.jdt.internal.ui.CompilationUnitEditor.ruler.actions/org.eclipse.jdt.internal.ui.javaeditor.JavaSelectRulerAction",1331425952721
-executed,command,,,"AUTOGEN:::org.eclipse.jdt.debug.CompilationUnitEditor.BreakpointRulerActions/org.eclipse.jdt.debug.ui.actions.ManageBreakpointRulerAction",1331425953115
-executed,command,,,"AUTOGEN:::org.eclipse.jdt.debug.CompilationUnitEditor.BreakpointRulerActions/org.eclipse.jdt.debug.ui.actions.ManageBreakpointRulerAction",1331425955074
-deactivated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1331425960380
-activated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1331426134365
-deactivated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1331426144506
-activated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1331426285651
-deactivated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1331426290064
-activated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1331426317442
-executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.file.save",1331426355281
-deactivated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1331426369113
-activated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1331426383346
-started,bundle,org.eclipse.mylyn.java.ui,3.6.0.v20110608-1400,"org.eclipse.mylyn.java.ui",1331426404495
-executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.edit.cut",1331426414168
-executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.edit.paste",1331426421283
-executed,command,,,"AUTOGEN:::org.eclipse.jdt.internal.ui.CompilationUnitEditor.ruler.actions/org.eclipse.jdt.internal.ui.javaeditor.JavaSelectRulerAction",1331426429972
-deactivated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1331426438231
-activated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1331426506177
-executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.edit.paste",1331426510124
-executed,command,org.eclipse.ui.workbench.texteditor,3.7.0.v20110505-0800,"org.eclipse.ui.edit.text.delete.line",1331426520495
-executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.file.save",1331426520525
-executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.edit.undo",1331426521342
-executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.file.save",1331426522759
-executed,command,org.eclipse.jdt.ui,3.7.0.v20110531-1200,"org.eclipse.jdt.ui.edit.text.java.organize.imports",1331426523793
-executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.file.save",1331426525060
-deactivated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1331426539126
-activated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1331426572761
-executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.edit.copy",1331426575659
-deactivated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1331426577581
-activated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1331426646326
-executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.edit.paste",1331426650816
-executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.edit.cut",1331426656317
-executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.edit.paste",1331426661468
-executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.file.save",1331426666715
-deactivated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1331426667190
-activated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1331426668946
-activated,view,org.eclipse.ui.console,3.5.100.v20110511,"org.eclipse.ui.console.ConsoleView",1331426670066
-activated,editor,org.eclipse.jdt.ui,3.7.0.v20110531-1200,"org.eclipse.jdt.ui.CompilationUnitEditor",1331426672649
-executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.edit.copy",1331426677369
-executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.edit.paste",1331426678474
-executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.file.save",1331426679275
-deactivated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1331426690781
-activated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1331426706134
-executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.edit.undo",1331426707157
-executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.file.save",1331426707855
-executed,command,org.eclipse.jdt.ui,3.7.0.v20110531-1200,"org.eclipse.jdt.ui.edit.text.java.organize.imports",1331426709189
-deactivated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1331426713788
-activated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1331426776718
-executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.edit.paste",1331426780865
-executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.file.save",1331426781768
-executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.file.save",1331426801844
-executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.edit.copy",1331426806306
-executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.edit.paste",1331426813916
-executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.file.save",1331426816778
-deactivated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1331426827699
-activated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1331426849052
-deactivated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1331426906977
-activated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1331426929132
-activated,view,org.eclipse.ui.console,3.5.100.v20110511,"org.eclipse.ui.console.ConsoleView",1331426932354
-started,bundle,org.eclipse.wst.sse.core,1.1.602.v201112071516,"org.eclipse.wst.sse.core",1331426949040
-started,bundle,org.eclipse.wst.xml.core,1.1.602.v201201091944,"org.eclipse.wst.xml.core",1331426949159
-started,bundle,org.eclipse.wst.common.uriresolver,1.1.401.v201004280700,"org.eclipse.wst.common.uriresolver",1331426949261
-deactivated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1331426949342
-activated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1331426951471
-executed,command,com.google.appengine.eclipse.core,2.5.2.v201202290255-rel-r37,"com.google.appengine.eclipse.core.deployToGoogle",1331426953318
-deactivated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1331426972577
-activated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1331427016951
-deactivated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1331427020056
-activated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1331427332582
-deactivated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1331427473618
-activated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1331427790816
-activated,editor,org.eclipse.jdt.ui,3.7.0.v20110531-1200,"org.eclipse.jdt.ui.CompilationUnitEditor",1331427799252
-executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.edit.paste",1331427802937
-deactivated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1331427819314
-activated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1331427822342
-executed,command,org.eclipse.jdt.ui,3.7.0.v20110531-1200,"org.eclipse.jdt.ui.edit.text.java.organize.imports",1331427822500
-executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.file.save",1331427823819
-deactivated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1331427837312
-activated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1331427880154
-deactivated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1331427898061
-activated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1331427899288
-deactivated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1331427924539
-activated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1331427931490
-deactivated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1331427951764
-activated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1331428033341
-executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.file.save",1331428038731
-deactivated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1331428042069
-activated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1331428055965
-activated,view,org.eclipse.ui.console,3.5.100.v20110511,"org.eclipse.ui.console.ConsoleView",1331428064106
-activated,editor,org.eclipse.jdt.ui,3.7.0.v20110531-1200,"org.eclipse.jdt.ui.CompilationUnitEditor",1331428092288
-started,bundle,org.eclipse.compare,3.5.200.I20110525-0800,"org.eclipse.compare",1331428106776
-deactivated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1331428118571
-started,bundle,org.eclipse.wst.jsdt.manipulation,1.0.300.v201104272153,"org.eclipse.wst.jsdt.manipulation",1331428177880
-started,bundle,org.eclipse.wst.jsdt.core,1.1.102.v201111090634,"org.eclipse.wst.jsdt.core",1331428178148
-started,bundle,org.eclipse.wst.jsdt.ui,1.1.102.v201201131900,"org.eclipse.wst.jsdt.ui",1331428178279
-activated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1331428179147
-executed,command,org.eclipse.jdt.ui,3.7.0.v20110531-1200,"org.eclipse.jdt.ui.edit.text.java.extract.method",1331428179259
-executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.edit.copy",1331428222254
-executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.edit.paste",1331428223199
-executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.file.save",1331428223897
-deactivated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1331428229505
-activated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1331428266995
-activated,view,org.eclipse.debug.ui,3.7.0.v20110518,"org.eclipse.debug.ui.DebugView",1331428271781
-activated,view,org.eclipse.ui.console,3.5.100.v20110511,"org.eclipse.ui.console.ConsoleView",1331428275310
-deactivated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1331428277456
-activated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1331428358754
-deactivated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1331428366294
-activated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1331428545871
-deactivated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1331428576491
-activated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1331428736325
-deactivated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1331428753057
-activated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1331461035690
-activated,view,org.eclipse.jdt.ui,3.7.0.v20110531-1200,"org.eclipse.jdt.ui.PackageExplorer",1331461039383
-opened,editor,org.eclipse.jdt.ui,3.7.0.v20110531-1200,"org.eclipse.jdt.ui.CompilationUnitEditor",1331461050055
-activated,editor,org.eclipse.jdt.ui,3.7.0.v20110531-1200,"org.eclipse.jdt.ui.CompilationUnitEditor",1331461050119
-deactivated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1331461057846
-activated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1331461430248
-activated,view,org.eclipse.jdt.ui,3.7.0.v20110531-1200,"org.eclipse.jdt.ui.PackageExplorer",1331461432107
-deactivated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1331461438752
-activated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1331461443663
-opened,editor,org.eclipse.jdt.ui,3.7.0.v20110531-1200,"org.eclipse.jdt.ui.CompilationUnitEditor",1331461443922
-activated,editor,org.eclipse.jdt.ui,3.7.0.v20110531-1200,"org.eclipse.jdt.ui.CompilationUnitEditor",1331461443989
-deactivated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1331461447997
-activated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1331461466849
-executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.edit.paste",1331461468280
-executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.edit.cut",1331461473368
-executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.edit.paste",1331461474391
-executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.edit.cut",1331461484439
-executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.edit.paste",1331461486317
-executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.edit.copy",1331461510548
-executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.edit.paste",1331461511438
-executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.edit.paste",1331461511597
-executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.file.save",1331461530776
-deactivated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1331461532935
-activated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1331461538526
-executed,command,org.eclipse.jdt.ui,3.7.0.v20110531-1200,"org.eclipse.jdt.ui.edit.text.java.organize.imports",1331461538689
-deactivated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1331461557225
-activated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1331461562785
-executed,command,org.eclipse.jdt.ui,3.7.0.v20110531-1200,"org.eclipse.jdt.ui.edit.text.java.create.getter.setter",1331461562898
-executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.edit.cut",1331461568974
-executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.edit.paste",1331461571936
-executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.edit.copy",1331461576558
-executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.edit.paste",1331461579904
+executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.file.save",1332207831148
+executed,command,org.eclipse.jdt.ui,3.7.0.v20110531-1200,"org.eclipse.jdt.ui.edit.text.java.organize.imports",1332207833080
+executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.edit.copy",1332207837518
+executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.edit.paste",1332207838592
+executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.file.save",1332207842586
+activated,view,org.eclipse.ui.console,3.5.100.v20110511,"org.eclipse.ui.console.ConsoleView",1332207874447
+deactivated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1332207882589
+activated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1332207902956
+activated,editor,org.eclipse.jdt.ui,3.7.0.v20110531-1200,"org.eclipse.jdt.ui.CompilationUnitEditor",1332207910843
+executed,command,,,"AUTOGEN:::org.eclipse.jdt.debug.CompilationUnitEditor.BreakpointRulerActions/org.eclipse.jdt.debug.ui.actions.ManageBreakpointRulerAction",1332207928566
+deactivated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1332207930179
+activated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1332207931619
+executed,command,,,"AUTOGEN:::org.eclipse.jdt.debug.CompilationUnitEditor.BreakpointRulerActions/org.eclipse.jdt.debug.ui.actions.ManageBreakpointRulerAction",1332207936268
+executed,command,,,"AUTOGEN:::org.eclipse.jdt.debug.CompilationUnitEditor.BreakpointRulerActions/org.eclipse.jdt.debug.ui.actions.ManageBreakpointRulerAction",1332207938532
+executed,command,org.eclipse.debug.ui,3.7.0.v20110518,"org.eclipse.debug.ui.commands.Resume",1332207940124
+executed,command,org.eclipse.debug.ui,3.7.0.v20110518,"org.eclipse.debug.ui.commands.Resume",1332207947581
+deactivated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1332207956296
+activated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1332207987826
+deactivated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1332207994388
+activated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1332208011765
+deactivated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1332208014086
+activated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1332208019790
+deactivated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1332208023069
+activated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1332208030951
+executed,command,,,"AUTOGEN:::org.eclipse.jdt.debug.CompilationUnitEditor.BreakpointRulerActions/org.eclipse.jdt.debug.ui.actions.ManageBreakpointRulerAction",1332208036301
+activated,editor,org.eclipse.jdt.ui,3.7.0.v20110531-1200,"org.eclipse.jdt.ui.CompilationUnitEditor",1332208040570
+activated,editor,org.eclipse.jdt.ui,3.7.0.v20110531-1200,"org.eclipse.jdt.ui.CompilationUnitEditor",1332208042157
+closed,editor,org.eclipse.jdt.ui,3.7.0.v20110531-1200,"org.eclipse.jdt.ui.CompilationUnitEditor",1332208042157
+activated,editor,org.eclipse.jdt.ui,3.7.0.v20110531-1200,"org.eclipse.jdt.ui.CompilationUnitEditor",1332208050415
+executed,command,,,"AUTOGEN:::org.eclipse.jdt.debug.CompilationUnitEditor.BreakpointRulerActions/org.eclipse.jdt.debug.ui.actions.ManageBreakpointRulerAction",1332208058830
+deactivated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1332208061284
+activated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1332208133002
+executed,command,,,"AUTOGEN:::org.eclipse.jdt.debug.CompilationUnitEditor.BreakpointRulerActions/org.eclipse.jdt.debug.ui.actions.ManageBreakpointRulerAction",1332208142696
+deactivated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1332208144483
+activated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1332208148354
+executed,command,org.eclipse.debug.ui,3.7.0.v20110518,"org.eclipse.debug.ui.commands.StepOver",1332208152529
+executed,command,org.eclipse.debug.ui,3.7.0.v20110518,"org.eclipse.debug.ui.commands.StepOver",1332208153096
+executed,command,,,"AUTOGEN:::org.eclipse.jdt.debug.CompilationUnitEditor.BreakpointRulerActions/org.eclipse.jdt.debug.ui.actions.ManageBreakpointRulerAction",1332208156079
+executed,command,org.eclipse.debug.ui,3.7.0.v20110518,"org.eclipse.debug.ui.commands.StepOver",1332208157440
+executed,command,org.eclipse.debug.ui,3.7.0.v20110518,"org.eclipse.debug.ui.commands.StepOver",1332208157800
+executed,command,org.eclipse.debug.ui,3.7.0.v20110518,"org.eclipse.debug.ui.commands.StepOver",1332208158062
+executed,command,org.eclipse.debug.ui,3.7.0.v20110518,"org.eclipse.debug.ui.commands.StepOver",1332208158351
+executed,command,org.eclipse.debug.ui,3.7.0.v20110518,"org.eclipse.debug.ui.commands.StepOver",1332208158703
+executed,command,org.eclipse.debug.ui,3.7.0.v20110518,"org.eclipse.debug.ui.commands.StepOver",1332208159263
+executed,command,org.eclipse.debug.ui,3.7.0.v20110518,"org.eclipse.debug.ui.commands.Resume",1332208193324
+executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.file.save",1332208204386
+deactivated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1332208208840
+activated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1332208210681
+executed,command,,,"AUTOGEN:::org.eclipse.jdt.debug.CompilationUnitEditor.BreakpointRulerActions/org.eclipse.jdt.debug.ui.actions.ManageBreakpointRulerAction",1332208213535
+executed,command,,,"AUTOGEN:::org.eclipse.jdt.debug.CompilationUnitEditor.BreakpointRulerActions/org.eclipse.jdt.debug.ui.actions.ManageBreakpointRulerAction",1332208214884
+deactivated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1332208215787
+activated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1332208228007
+activated,view,org.eclipse.ui.console,3.5.100.v20110511,"org.eclipse.ui.console.ConsoleView",1332208239654
+activated,editor,org.eclipse.jdt.ui,3.7.0.v20110531-1200,"org.eclipse.jdt.ui.CompilationUnitEditor",1332208239823
+executed,command,,,"AUTOGEN:::org.eclipse.jdt.debug.CompilationUnitEditor.BreakpointRulerActions/org.eclipse.jdt.debug.ui.actions.ManageBreakpointRulerAction",1332208264285
+deactivated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1332208266306
+activated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1332208267872
+activated,editor,org.eclipse.jdt.ui,3.7.0.v20110531-1200,"org.eclipse.jdt.ui.CompilationUnitEditor",1332208268005
+executed,command,org.eclipse.debug.ui,3.7.0.v20110518,"org.eclipse.debug.ui.commands.Resume",1332208270900
+activated,editor,org.eclipse.jdt.ui,3.7.0.v20110531-1200,"org.eclipse.jdt.ui.CompilationUnitEditor",1332208272491
+executed,command,org.eclipse.debug.ui,3.7.0.v20110518,"org.eclipse.debug.ui.commands.Resume",1332208277323
+activated,view,org.eclipse.ui.console,3.5.100.v20110511,"org.eclipse.ui.console.ConsoleView",1332208282270
+activated,editor,org.eclipse.jdt.ui,3.7.0.v20110531-1200,"org.eclipse.jdt.ui.CompilationUnitEditor",1332208313590
+executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.file.save",1332208318802
+deactivated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1332208321753
+activated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1332208434213
+executed,command,org.eclipse.jdt.ui,3.7.0.v20110531-1200,"org.eclipse.jdt.ui.edit.text.java.toggle.comment",1332208464850
+executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.file.save",1332208465777
+executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.file.save",1332208469575
+executed,command,org.eclipse.jdt.ui,3.7.0.v20110531-1200,"org.eclipse.jdt.ui.edit.text.java.toggle.comment",1332208483514
+executed,command,org.eclipse.jdt.ui,3.7.0.v20110531-1200,"org.eclipse.jdt.ui.edit.text.java.toggle.comment",1332208486463
+executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.file.save",1332208490031
+deactivated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1332208495880
+activated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1332208499720
+executed,command,org.eclipse.debug.ui,3.7.0.v20110518,"org.eclipse.debug.ui.commands.Resume",1332208503129
+executed,command,org.eclipse.debug.ui,3.7.0.v20110518,"org.eclipse.debug.ui.commands.Resume",1332208507023
+executed,command,org.eclipse.debug.ui,3.7.0.v20110518,"org.eclipse.debug.ui.commands.Resume",1332208508928
+deactivated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1332208516235
+activated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1332208540400
+executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.file.save",1332208545980
+deactivated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1332208548248
+activated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1332208552208
+executed,command,org.eclipse.debug.ui,3.7.0.v20110518,"org.eclipse.debug.ui.commands.Resume",1332208555094
+executed,command,org.eclipse.debug.ui,3.7.0.v20110518,"org.eclipse.debug.ui.commands.Resume",1332208555998
+executed,command,org.eclipse.debug.ui,3.7.0.v20110518,"org.eclipse.debug.ui.commands.Resume",1332208556742
+deactivated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1332208562036
+activated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1332208602460
+activated,view,org.eclipse.debug.ui,3.7.0.v20110518,"org.eclipse.debug.ui.DebugView",1332208610234
+executed,command,org.eclipse.debug.ui,3.7.0.v20110518,"org.eclipse.debug.ui.commands.Terminate",1332208610308
+activated,view,org.eclipse.ui.console,3.5.100.v20110511,"org.eclipse.ui.console.ConsoleView",1332208613689
+deactivated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1332208616624
+activated,view,org.eclipse.debug.ui,3.7.0.v20110518,"org.eclipse.debug.ui.DebugView",1332208631721
+activated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1332208631772
+activated,editor,org.eclipse.jdt.ui,3.7.0.v20110531-1200,"org.eclipse.jdt.ui.CompilationUnitEditor",1332208634285
+executed,command,org.eclipse.debug.ui,3.7.0.v20110518,"org.eclipse.debug.ui.commands.Resume",1332208639014
+activated,editor,org.eclipse.jdt.ui,3.7.0.v20110531-1200,"org.eclipse.jdt.ui.CompilationUnitEditor",1332208639388
+executed,command,org.eclipse.debug.ui,3.7.0.v20110518,"org.eclipse.debug.ui.commands.Resume",1332208641078
+activated,editor,org.eclipse.jdt.ui,3.7.0.v20110531-1200,"org.eclipse.jdt.ui.CompilationUnitEditor",1332208641823
+executed,command,org.eclipse.debug.ui,3.7.0.v20110518,"org.eclipse.debug.ui.commands.Resume",1332208646421
+activated,editor,org.eclipse.jdt.ui,3.7.0.v20110531-1200,"org.eclipse.jdt.ui.CompilationUnitEditor",1332208647535
+executed,command,org.eclipse.debug.ui,3.7.0.v20110518,"org.eclipse.debug.ui.commands.Resume",1332208648380
+executed,command,org.eclipse.debug.ui,3.7.0.v20110518,"org.eclipse.debug.ui.commands.Resume",1332208650260
+deactivated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1332208664183
+activated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1332208665663
+executed,command,org.eclipse.debug.ui,3.7.0.v20110518,"org.eclipse.debug.ui.commands.StepOver",1332208674434
+executed,command,org.eclipse.debug.ui,3.7.0.v20110518,"org.eclipse.debug.ui.commands.Resume",1332208676250
+executed,command,org.eclipse.debug.ui,3.7.0.v20110518,"org.eclipse.debug.ui.commands.StepOver",1332208678018
+executed,command,org.eclipse.debug.ui,3.7.0.v20110518,"org.eclipse.debug.ui.commands.Resume",1332208678898
+executed,command,org.eclipse.debug.ui,3.7.0.v20110518,"org.eclipse.debug.ui.commands.StepOver",1332208680258
+executed,command,org.eclipse.debug.ui,3.7.0.v20110518,"org.eclipse.debug.ui.commands.Resume",1332208683249
+deactivated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1332208701442
+activated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1332208703253
+executed,command,org.eclipse.debug.ui,3.7.0.v20110518,"org.eclipse.debug.ui.commands.StepOver",1332208757210
+executed,command,org.eclipse.debug.ui,3.7.0.v20110518,"org.eclipse.debug.ui.commands.Resume",1332208758802
+executed,command,org.eclipse.debug.ui,3.7.0.v20110518,"org.eclipse.debug.ui.commands.StepOver",1332208760538
+executed,command,org.eclipse.debug.ui,3.7.0.v20110518,"org.eclipse.debug.ui.commands.Resume",1332208761090
+executed,command,org.eclipse.debug.ui,3.7.0.v20110518,"org.eclipse.debug.ui.commands.StepOver",1332208761706
+executed,command,org.eclipse.debug.ui,3.7.0.v20110518,"org.eclipse.debug.ui.commands.Resume",1332208762178
+executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.file.save",1332208793279
+deactivated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1332208796814
+activated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1332208798464
+executed,command,org.eclipse.debug.ui,3.7.0.v20110518,"org.eclipse.debug.ui.commands.StepOver",1332208800633
+executed,command,org.eclipse.debug.ui,3.7.0.v20110518,"org.eclipse.debug.ui.commands.StepOver",1332208801760
+executed,command,org.eclipse.debug.ui,3.7.0.v20110518,"org.eclipse.debug.ui.commands.StepOver",1332208802496
+executed,command,org.eclipse.debug.ui,3.7.0.v20110518,"org.eclipse.debug.ui.commands.Resume",1332208829767
+executed,command,org.eclipse.debug.ui,3.7.0.v20110518,"org.eclipse.debug.ui.commands.StepOver",1332208833127
+executed,command,org.eclipse.debug.ui,3.7.0.v20110518,"org.eclipse.debug.ui.commands.StepOver",1332208833919
+executed,command,org.eclipse.debug.ui,3.7.0.v20110518,"org.eclipse.debug.ui.commands.StepOver",1332208834511
+executed,command,org.eclipse.debug.ui,3.7.0.v20110518,"org.eclipse.debug.ui.commands.Resume",1332208835950
+executed,command,org.eclipse.debug.ui,3.7.0.v20110518,"org.eclipse.debug.ui.commands.Resume",1332208837343
+executed,command,org.eclipse.jdt.ui,3.7.0.v20110531-1200,"org.eclipse.jdt.ui.edit.text.java.toggle.comment",1332208860716
+executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.file.save",1332208861519
+deactivated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1332208874026
+activated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1332208886245
+executed,command,org.eclipse.debug.ui,3.7.0.v20110518,"org.eclipse.debug.ui.commands.StepOver",1332208888642
+executed,command,org.eclipse.debug.ui,3.7.0.v20110518,"org.eclipse.debug.ui.commands.StepOver",1332208889647
+executed,command,org.eclipse.debug.ui,3.7.0.v20110518,"org.eclipse.debug.ui.commands.StepOver",1332208890409
+executed,command,org.eclipse.debug.ui,3.7.0.v20110518,"org.eclipse.debug.ui.commands.Resume",1332208892369
+executed,command,org.eclipse.debug.ui,3.7.0.v20110518,"org.eclipse.debug.ui.commands.Resume",1332208897145
+executed,command,org.eclipse.debug.ui,3.7.0.v20110518,"org.eclipse.debug.ui.commands.StepOver",1332208899433
+executed,command,org.eclipse.debug.ui,3.7.0.v20110518,"org.eclipse.debug.ui.commands.StepOver",1332208900161
+executed,command,org.eclipse.debug.ui,3.7.0.v20110518,"org.eclipse.debug.ui.commands.StepOver",1332208900793
+executed,command,org.eclipse.debug.ui,3.7.0.v20110518,"org.eclipse.debug.ui.commands.Resume",1332208902888
+activated,view,org.eclipse.ui.console,3.5.100.v20110511,"org.eclipse.ui.console.ConsoleView",1332208905689
+deactivated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1332208915112
+activated,view,org.eclipse.debug.ui,3.7.0.v20110518,"org.eclipse.debug.ui.DebugView",1332208931624
+activated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1332208931661
+executed,command,org.eclipse.debug.ui,3.7.0.v20110518,"org.eclipse.debug.ui.commands.Resume",1332208937173
+executed,command,org.eclipse.debug.ui,3.7.0.v20110518,"org.eclipse.debug.ui.commands.StepOver",1332208939637
+executed,command,org.eclipse.debug.ui,3.7.0.v20110518,"org.eclipse.debug.ui.commands.Resume",1332208950092
+executed,command,org.eclipse.debug.ui,3.7.0.v20110518,"org.eclipse.debug.ui.commands.Resume",1332208953867
+activated,view,org.eclipse.ui.console,3.5.100.v20110511,"org.eclipse.ui.console.ConsoleView",1332208954067
+executed,command,org.eclipse.debug.ui,3.7.0.v20110518,"org.eclipse.debug.ui.commands.Resume",1332208954972
+activated,view,org.eclipse.debug.ui,3.7.0.v20110518,"org.eclipse.debug.ui.DebugView",1332208955477
+activated,view,org.eclipse.ui.console,3.5.100.v20110511,"org.eclipse.ui.console.ConsoleView",1332208955594
+executed,command,org.eclipse.debug.ui,3.7.0.v20110518,"org.eclipse.debug.ui.commands.Resume",1332208956227
+activated,editor,org.eclipse.jdt.ui,3.7.0.v20110531-1200,"org.eclipse.jdt.ui.CompilationUnitEditor",1332208970719
+executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.edit.copy",1332208973595
+executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.edit.paste",1332208975857
+executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.file.save",1332208981376
+activated,view,org.eclipse.ui.console,3.5.100.v20110511,"org.eclipse.ui.console.ConsoleView",1332208983790
+deactivated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1332209008139
+activated,view,org.eclipse.debug.ui,3.7.0.v20110518,"org.eclipse.debug.ui.DebugView",1332209027680
+activated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1332209027712
+executed,command,org.eclipse.debug.ui,3.7.0.v20110518,"org.eclipse.debug.ui.commands.Resume",1332209031729
+executed,command,org.eclipse.debug.ui,3.7.0.v20110518,"org.eclipse.debug.ui.commands.Resume",1332209038824
+executed,command,org.eclipse.debug.ui,3.7.0.v20110518,"org.eclipse.debug.ui.commands.Resume",1332209040672
+activated,view,org.eclipse.ui.console,3.5.100.v20110511,"org.eclipse.ui.console.ConsoleView",1332209040940
+executed,command,org.eclipse.debug.ui,3.7.0.v20110518,"org.eclipse.debug.ui.commands.Resume",1332209041688
+activated,view,org.eclipse.debug.ui,3.7.0.v20110518,"org.eclipse.debug.ui.DebugView",1332209042079
+activated,view,org.eclipse.ui.console,3.5.100.v20110511,"org.eclipse.ui.console.ConsoleView",1332209042204
+executed,command,org.eclipse.debug.ui,3.7.0.v20110518,"org.eclipse.debug.ui.commands.Resume",1332209043008
+activated,editor,org.eclipse.jdt.ui,3.7.0.v20110531-1200,"org.eclipse.jdt.ui.CompilationUnitEditor",1332209143884
+executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.edit.copy",1332209240599
+executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.edit.paste",1332209245738
+executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.file.save",1332209253540
+executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.file.save",1332209256038
+executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.edit.copy",1332209279194
+executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.edit.paste",1332209282018
+executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.file.save",1332209289243
+executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.file.save",1332209311054
+activated,view,org.eclipse.ui.console,3.5.100.v20110511,"org.eclipse.ui.console.ConsoleView",1332209336075
+deactivated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1332209343361
+activated,view,org.eclipse.debug.ui,3.7.0.v20110518,"org.eclipse.debug.ui.DebugView",1332209357138
+activated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1332209357173
+executed,command,org.eclipse.debug.ui,3.7.0.v20110518,"org.eclipse.debug.ui.commands.Resume",1332209360751
+executed,command,org.eclipse.debug.ui,3.7.0.v20110518,"org.eclipse.debug.ui.commands.Resume",1332209368742
+activated,editor,org.eclipse.jdt.ui,3.7.0.v20110531-1200,"org.eclipse.jdt.ui.CompilationUnitEditor",1332209373429
+executed,command,,,"AUTOGEN:::org.eclipse.jdt.debug.CompilationUnitEditor.BreakpointRulerActions/org.eclipse.jdt.debug.ui.actions.ManageBreakpointRulerAction",1332209373770
+executed,command,org.eclipse.debug.ui,3.7.0.v20110518,"org.eclipse.debug.ui.commands.Resume",1332209374806
+activated,editor,org.eclipse.jdt.ui,3.7.0.v20110531-1200,"org.eclipse.jdt.ui.CompilationUnitEditor",1332209375200
+executed,command,org.eclipse.debug.ui,3.7.0.v20110518,"org.eclipse.debug.ui.commands.StepOver",1332209377638
+executed,command,org.eclipse.debug.ui,3.7.0.v20110518,"org.eclipse.debug.ui.commands.Resume",1332209378702
+executed,command,org.eclipse.debug.ui,3.7.0.v20110518,"org.eclipse.debug.ui.commands.Resume",1332209380014
+deactivated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1332209384440
+activated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1332209393612
+executed,command,org.eclipse.debug.ui,3.7.0.v20110518,"org.eclipse.debug.ui.commands.StepOver",1332209401563
+executed,command,org.eclipse.debug.ui,3.7.0.v20110518,"org.eclipse.debug.ui.commands.Resume",1332209411539
+executed,command,org.eclipse.debug.ui,3.7.0.v20110518,"org.eclipse.debug.ui.commands.Resume",1332209412675
+executed,command,org.eclipse.debug.ui,3.7.0.v20110518,"org.eclipse.debug.ui.commands.Resume",1332209413722
+deactivated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1332209417920
+activated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1332209420462
+deactivated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1332209435714
+executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.edit.copy",1332209437055
+activated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1332209446964
+deactivated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1332209454819
+executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.edit.copy",1332209455869
+activated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1332209463718
+deactivated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1332209482585
+activated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1332209497631
+executed,command,org.eclipse.debug.ui,3.7.0.v20110518,"org.eclipse.debug.ui.commands.Resume",1332209519149
+executed,command,org.eclipse.debug.ui,3.7.0.v20110518,"org.eclipse.debug.ui.commands.Resume",1332209522220
+executed,command,org.eclipse.debug.ui,3.7.0.v20110518,"org.eclipse.debug.ui.commands.Resume",1332209523987
+deactivated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1332209547178
+activated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1332209551551
+executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.file.save",1332209582660
+activated,view,org.eclipse.ui.console,3.5.100.v20110511,"org.eclipse.ui.console.ConsoleView",1332209600647
+deactivated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1332209612932
+activated,view,org.eclipse.debug.ui,3.7.0.v20110518,"org.eclipse.debug.ui.DebugView",1332209640066
+activated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1332209640092
+activated,editor,org.eclipse.jdt.ui,3.7.0.v20110531-1200,"org.eclipse.jdt.ui.CompilationUnitEditor",1332209653245
+executed,command,org.eclipse.debug.ui,3.7.0.v20110518,"org.eclipse.debug.ui.commands.Resume",1332209658898
+executed,command,org.eclipse.debug.ui,3.7.0.v20110518,"org.eclipse.debug.ui.commands.Resume",1332209660330
+executed,command,org.eclipse.debug.ui,3.7.0.v20110518,"org.eclipse.debug.ui.commands.Resume",1332209661224
+deactivated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1332209663512
+activated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1332209666487
+executed,command,org.eclipse.debug.ui,3.7.0.v20110518,"org.eclipse.debug.ui.commands.StepOver",1332209682974
+executed,command,org.eclipse.debug.ui,3.7.0.v20110518,"org.eclipse.debug.ui.commands.Resume",1332209686494
+executed,command,org.eclipse.debug.ui,3.7.0.v20110518,"org.eclipse.debug.ui.commands.StepOver",1332209687198
+executed,command,org.eclipse.debug.ui,3.7.0.v20110518,"org.eclipse.debug.ui.commands.Resume",1332209687909
+executed,command,org.eclipse.debug.ui,3.7.0.v20110518,"org.eclipse.debug.ui.commands.StepOver",1332209688435
+executed,command,org.eclipse.debug.ui,3.7.0.v20110518,"org.eclipse.debug.ui.commands.Resume",1332209688965
+executed,command,org.eclipse.jdt.ui,3.7.0.v20110531-1200,"org.eclipse.jdt.ui.edit.text.java.open.editor",1332209694361
+deactivated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1332209787585
+activated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1332209789169
+executed,command,org.eclipse.debug.ui,3.7.0.v20110518,"org.eclipse.debug.ui.commands.StepOver",1332209791549
+executed,command,org.eclipse.debug.ui,3.7.0.v20110518,"org.eclipse.debug.ui.commands.Resume",1332209792261
+executed,command,org.eclipse.debug.ui,3.7.0.v20110518,"org.eclipse.debug.ui.commands.StepOver",1332209792941
+executed,command,org.eclipse.debug.ui,3.7.0.v20110518,"org.eclipse.debug.ui.commands.Resume",1332209793605
+executed,command,org.eclipse.debug.ui,3.7.0.v20110518,"org.eclipse.debug.ui.commands.StepOver",1332209794220
+executed,command,org.eclipse.debug.ui,3.7.0.v20110518,"org.eclipse.debug.ui.commands.Resume",1332209794862
+deactivated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1332209799646
+activated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1332210410675
+executed,command,org.eclipse.debug.ui,3.7.0.v20110518,"org.eclipse.debug.ui.commands.StepOver",1332210413816
+executed,command,org.eclipse.debug.ui,3.7.0.v20110518,"org.eclipse.debug.ui.commands.Resume",1332210415640
+executed,command,org.eclipse.debug.ui,3.7.0.v20110518,"org.eclipse.debug.ui.commands.Resume",1332210417217
+executed,command,org.eclipse.debug.ui,3.7.0.v20110518,"org.eclipse.debug.ui.commands.StepOver",1332210419545
+executed,command,org.eclipse.debug.ui,3.7.0.v20110518,"org.eclipse.debug.ui.commands.Resume",1332210420313
+deactivated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1332210423996
+activated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1332210431772
diff --git a/workspace/.metadata/.plugins/org.eclipse.epp.usagedata.recording/upload4.csv b/workspace/.metadata/.plugins/org.eclipse.epp.usagedata.recording/upload4.csv
deleted file mode 100644 (file)
index e85de6d..0000000
+++ /dev/null
@@ -1,251 +0,0 @@
-what,kind,bundleId,bundleVersion,description,time
-deactivated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1331461622724
-activated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1331461623804
-executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.file.save",1331461625849
-activated,view,org.eclipse.jdt.ui,3.7.0.v20110531-1200,"org.eclipse.jdt.ui.PackageExplorer",1331461633320
-opened,editor,org.eclipse.jdt.ui,3.7.0.v20110531-1200,"org.eclipse.jdt.ui.CompilationUnitEditor",1331461633664
-activated,editor,org.eclipse.jdt.ui,3.7.0.v20110531-1200,"org.eclipse.jdt.ui.CompilationUnitEditor",1331461633728
-activated,view,org.eclipse.jdt.ui,3.7.0.v20110531-1200,"org.eclipse.jdt.ui.PackageExplorer",1331461658031
-executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.edit.copy",1331461658947
-deactivated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1331461660644
-activated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1331461667027
-executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.edit.paste",1331461667410
-opened,editor,org.eclipse.jdt.ui,3.7.0.v20110531-1200,"org.eclipse.jdt.ui.CompilationUnitEditor",1331461669928
-activated,editor,org.eclipse.jdt.ui,3.7.0.v20110531-1200,"org.eclipse.jdt.ui.CompilationUnitEditor",1331461669997
-executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.file.save",1331461692384
-deactivated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1331461702960
-activated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1331461808648
-deactivated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1331461815925
-activated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1331462208697
-executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.edit.paste",1331462212412
-executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.file.save",1331462224508
-executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.edit.copy",1331462232956
-executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.edit.paste",1331462234273
-executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.edit.paste",1331462236150
-executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.edit.selectAll",1331462250037
-executed,command,org.eclipse.jdt.ui,3.7.0.v20110531-1200,"org.eclipse.jdt.ui.edit.text.java.format",1331462252353
-executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.edit.copy",1331462255969
-executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.edit.paste",1331462256931
-executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.edit.copy",1331462266473
-executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.edit.paste",1331462267620
-deactivated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1331462273771
-activated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1331462275810
-executed,command,org.eclipse.jdt.ui,3.7.0.v20110531-1200,"org.eclipse.jdt.ui.edit.text.java.organize.imports",1331462275957
-executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.file.save",1331462276655
-executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.edit.copy",1331462298643
-executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.edit.paste",1331462299573
-executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.file.save",1331462314479
-executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.edit.copy",1331462349815
-executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.edit.paste",1331462355202
-executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.edit.copy",1331462359459
-executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.edit.paste",1331462360544
-executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.file.save",1331462363357
-deactivated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1331462375120
-activated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1331462421410
-activated,view,org.eclipse.jdt.ui,3.7.0.v20110531-1200,"org.eclipse.jdt.ui.PackageExplorer",1331462425528
-activated,editor,org.eclipse.jdt.ui,3.7.0.v20110531-1200,"org.eclipse.jdt.ui.CompilationUnitEditor",1331462425860
-executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.file.save",1331462435662
-activated,view,org.eclipse.jdt.ui,3.7.0.v20110531-1200,"org.eclipse.jdt.ui.PackageExplorer",1331462444799
-activated,editor,org.eclipse.jdt.ui,3.7.0.v20110531-1200,"org.eclipse.jdt.ui.CompilationUnitEditor",1331462445132
-executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.edit.copy",1331462450160
-activated,editor,org.eclipse.jdt.ui,3.7.0.v20110531-1200,"org.eclipse.jdt.ui.CompilationUnitEditor",1331462452418
-executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.edit.paste",1331462480852
-executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.edit.paste",1331462484707
-executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.file.save",1331462511572
-executed,command,org.eclipse.jdt.ui,3.7.0.v20110531-1200,"org.eclipse.jdt.ui.edit.text.java.organize.imports",1331462512785
-executed,command,org.eclipse.ui.ide,3.7.0.I20110519-0100,"org.eclipse.jdt.ui.edit.text.java.correction.assist.proposals",1331462517172
-executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.file.save",1331462538978
-executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.file.save",1331462553590
-executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.edit.copy",1331462594288
-executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.edit.paste",1331462595994
-executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.edit.copy",1331462609472
-executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.edit.paste",1331462610313
-executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.edit.paste",1331462610458
-executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.edit.copy",1331462623413
-executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.edit.paste",1331462626274
-executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.edit.paste",1331462626401
-executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.edit.undo",1331462627040
-executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.edit.copy",1331462651158
-executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.edit.paste",1331462653498
-executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.file.save",1331462703871
-executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.edit.cut",1331462737451
-executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.edit.paste",1331462739250
-executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.edit.copy",1331462784337
-executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.edit.paste",1331462789922
-executed,command,org.eclipse.ui.ide,3.7.0.I20110519-0100,"org.eclipse.jdt.ui.edit.text.java.correction.assist.proposals",1331462792023
-executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.file.save",1331462808022
-executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.file.save",1331462816231
-executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.file.save",1331462848555
-executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.edit.copy",1331462880654
-executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.edit.paste",1331462881882
-executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.file.save",1331462894626
-executed,command,,,"AUTOGEN:::org.eclipse.jdt.debug.CompilationUnitEditor.BreakpointRulerActions/org.eclipse.jdt.debug.ui.actions.ManageBreakpointRulerAction",1331462927278
-deactivated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1331462945798
-activated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1331462970770
-executed,command,org.eclipse.debug.ui,3.7.0.v20110518,"org.eclipse.debug.ui.commands.StepInto",1331462974522
-executed,command,org.eclipse.debug.ui,3.7.0.v20110518,"org.eclipse.debug.ui.commands.StepOver",1331462975446
-executed,command,org.eclipse.debug.ui,3.7.0.v20110518,"org.eclipse.debug.ui.commands.StepOver",1331462975934
-executed,command,org.eclipse.debug.ui,3.7.0.v20110518,"org.eclipse.debug.ui.commands.StepOver",1331462978264
-executed,command,org.eclipse.debug.ui,3.7.0.v20110518,"org.eclipse.debug.ui.commands.StepOver",1331462979560
-executed,command,org.eclipse.debug.ui,3.7.0.v20110518,"org.eclipse.debug.ui.commands.StepOver",1331462980145
-opened,editor,org.eclipse.jdt.ui,3.7.0.v20110531-1200,"org.eclipse.jdt.ui.CompilationUnitEditor",1331462980328
-activated,editor,org.eclipse.jdt.ui,3.7.0.v20110531-1200,"org.eclipse.jdt.ui.CompilationUnitEditor",1331462980384
-executed,command,org.eclipse.debug.ui,3.7.0.v20110518,"org.eclipse.debug.ui.commands.StepOver",1331462980583
-executed,command,org.eclipse.debug.ui,3.7.0.v20110518,"org.eclipse.debug.ui.commands.StepOver",1331462982942
-opened,editor,org.eclipse.debug.ui,3.7.0.v20110518,"org.eclipse.debug.ui.sourcelookup.CommonSourceNotFoundEditor",1331462983147
-activated,editor,org.eclipse.debug.ui,3.7.0.v20110518,"org.eclipse.debug.ui.sourcelookup.CommonSourceNotFoundEditor",1331462983176
-closed,editor,org.eclipse.jdt.ui,3.7.0.v20110531-1200,"org.eclipse.jdt.ui.CompilationUnitEditor",1331462983182
-executed,command,org.eclipse.debug.ui,3.7.0.v20110518,"org.eclipse.debug.ui.commands.Resume",1331462984683
-activated,editor,org.eclipse.jdt.ui,3.7.0.v20110531-1200,"org.eclipse.jdt.ui.CompilationUnitEditor",1331462999564
-closed,editor,org.eclipse.debug.ui,3.7.0.v20110518,"org.eclipse.debug.ui.sourcelookup.CommonSourceNotFoundEditor",1331462999564
-executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.edit.copy",1331463061338
-executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.edit.paste",1331463062608
-executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.edit.copy",1331463083252
-executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.edit.paste",1331463083840
-executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.edit.paste",1331463084318
-executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.file.save",1331463085335
-activated,view,org.eclipse.ui.console,3.5.100.v20110511,"org.eclipse.ui.console.ConsoleView",1331463090234
-deactivated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1331463100930
-activated,view,org.eclipse.debug.ui,3.7.0.v20110518,"org.eclipse.debug.ui.DebugView",1331463127041
-activated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1331463127076
-executed,command,org.eclipse.debug.ui,3.7.0.v20110518,"org.eclipse.debug.ui.commands.StepInto",1331463129813
-executed,command,org.eclipse.debug.ui,3.7.0.v20110518,"org.eclipse.debug.ui.commands.StepOver",1331463130684
-executed,command,org.eclipse.debug.ui,3.7.0.v20110518,"org.eclipse.debug.ui.commands.StepOver",1331463131155
-executed,command,org.eclipse.debug.ui,3.7.0.v20110518,"org.eclipse.debug.ui.commands.StepOver",1331463132675
-executed,command,org.eclipse.debug.ui,3.7.0.v20110518,"org.eclipse.debug.ui.commands.StepOver",1331463133372
-executed,command,org.eclipse.debug.ui,3.7.0.v20110518,"org.eclipse.debug.ui.commands.StepOver",1331463133948
-opened,editor,org.eclipse.jdt.ui,3.7.0.v20110531-1200,"org.eclipse.jdt.ui.CompilationUnitEditor",1331463134148
-executed,command,org.eclipse.debug.ui,3.7.0.v20110518,"org.eclipse.debug.ui.commands.Resume",1331463137004
-activated,view,org.eclipse.ui.console,3.5.100.v20110511,"org.eclipse.ui.console.ConsoleView",1331463137225
-activated,editor,org.eclipse.jdt.ui,3.7.0.v20110531-1200,"org.eclipse.jdt.ui.CompilationUnitEditor",1331463155718
-activated,editor,org.eclipse.jdt.ui,3.7.0.v20110531-1200,"org.eclipse.jdt.ui.CompilationUnitEditor",1331463161042
-deactivated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1331463168383
-activated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1331463203595
-activated,editor,org.eclipse.jdt.ui,3.7.0.v20110531-1200,"org.eclipse.jdt.ui.CompilationUnitEditor",1331463219507
-activated,view,org.eclipse.jdt.ui,3.7.0.v20110531-1200,"org.eclipse.jdt.ui.PackageExplorer",1331463228850
-opened,editor,org.eclipse.jdt.ui,3.7.0.v20110531-1200,"org.eclipse.jdt.ui.CompilationUnitEditor",1331463229159
-activated,editor,org.eclipse.jdt.ui,3.7.0.v20110531-1200,"org.eclipse.jdt.ui.CompilationUnitEditor",1331463229220
-activated,view,org.eclipse.jdt.ui,3.7.0.v20110531-1200,"org.eclipse.jdt.ui.PackageExplorer",1331463235690
-activated,editor,org.eclipse.jdt.ui,3.7.0.v20110531-1200,"org.eclipse.jdt.ui.CompilationUnitEditor",1331463236211
-activated,editor,org.eclipse.jdt.ui,3.7.0.v20110531-1200,"org.eclipse.jdt.ui.CompilationUnitEditor",1331463243274
-deactivated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1331463253461
-activated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1331463333494
-activated,view,org.eclipse.ui.console,3.5.100.v20110511,"org.eclipse.ui.console.ConsoleView",1331463337209
-executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.edit.copy",1331463342174
-deactivated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1331463343163
-activated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1331463395189
-activated,editor,org.eclipse.jdt.ui,3.7.0.v20110531-1200,"org.eclipse.jdt.ui.CompilationUnitEditor",1331463401197
-executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.file.save",1331463412345
-deactivated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1331463433914
-activated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1331463446942
-activated,editor,org.eclipse.jdt.ui,3.7.0.v20110531-1200,"org.eclipse.jdt.ui.CompilationUnitEditor",1331463447107
-executed,command,org.eclipse.debug.ui,3.7.0.v20110518,"org.eclipse.debug.ui.commands.StepInto",1331463448769
-executed,command,org.eclipse.debug.ui,3.7.0.v20110518,"org.eclipse.debug.ui.commands.StepOver",1331463449496
-executed,command,org.eclipse.debug.ui,3.7.0.v20110518,"org.eclipse.debug.ui.commands.StepOver",1331463449792
-activated,editor,org.eclipse.jdt.ui,3.7.0.v20110531-1200,"org.eclipse.jdt.ui.CompilationUnitEditor",1331463450027
-executed,command,org.eclipse.debug.ui,3.7.0.v20110518,"org.eclipse.debug.ui.commands.StepOver",1331463450141
-executed,command,org.eclipse.debug.ui,3.7.0.v20110518,"org.eclipse.debug.ui.commands.Resume",1331463453713
-activated,view,org.eclipse.ui.console,3.5.100.v20110511,"org.eclipse.ui.console.ConsoleView",1331463468137
-activated,editor,org.eclipse.jdt.ui,3.7.0.v20110531-1200,"org.eclipse.jdt.ui.CompilationUnitEditor",1331463472177
-deactivated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1331463482106
-activated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1331463494922
-activated,editor,org.eclipse.jdt.ui,3.7.0.v20110531-1200,"org.eclipse.jdt.ui.CompilationUnitEditor",1331463495255
-executed,command,org.eclipse.debug.ui,3.7.0.v20110518,"org.eclipse.debug.ui.commands.StepInto",1331463496749
-executed,command,org.eclipse.debug.ui,3.7.0.v20110518,"org.eclipse.debug.ui.commands.StepOver",1331463497557
-executed,command,org.eclipse.debug.ui,3.7.0.v20110518,"org.eclipse.debug.ui.commands.StepOver",1331463498148
-executed,command,org.eclipse.debug.ui,3.7.0.v20110518,"org.eclipse.debug.ui.commands.StepOver",1331463499786
-executed,command,org.eclipse.debug.ui,3.7.0.v20110518,"org.eclipse.debug.ui.commands.StepOver",1331463500556
-executed,command,org.eclipse.debug.ui,3.7.0.v20110518,"org.eclipse.debug.ui.commands.StepOver",1331463501156
-executed,command,org.eclipse.debug.ui,3.7.0.v20110518,"org.eclipse.debug.ui.commands.StepOver",1331463501821
-executed,command,org.eclipse.debug.ui,3.7.0.v20110518,"org.eclipse.debug.ui.commands.StepOver",1331463502221
-executed,command,org.eclipse.debug.ui,3.7.0.v20110518,"org.eclipse.debug.ui.commands.StepOver",1331463502708
-executed,command,org.eclipse.debug.ui,3.7.0.v20110518,"org.eclipse.debug.ui.commands.StepOver",1331463503229
-executed,command,org.eclipse.debug.ui,3.7.0.v20110518,"org.eclipse.debug.ui.commands.StepOver",1331463503731
-executed,command,org.eclipse.debug.ui,3.7.0.v20110518,"org.eclipse.debug.ui.commands.StepOver",1331463507628
-executed,command,org.eclipse.debug.ui,3.7.0.v20110518,"org.eclipse.debug.ui.commands.StepOver",1331463509053
-executed,command,org.eclipse.debug.ui,3.7.0.v20110518,"org.eclipse.debug.ui.commands.StepOver",1331463509813
-executed,command,,,"AUTOGEN:::org.eclipse.jdt.debug.CompilationUnitEditor.BreakpointRulerActions/org.eclipse.jdt.debug.ui.actions.ManageBreakpointRulerAction",1331463514656
-executed,command,org.eclipse.debug.ui,3.7.0.v20110518,"org.eclipse.debug.ui.commands.Resume",1331463515538
-activated,view,org.eclipse.ui.console,3.5.100.v20110511,"org.eclipse.ui.console.ConsoleView",1331463519997
-deactivated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1331463598092
-activated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1331463637104
-activated,editor,org.eclipse.jdt.ui,3.7.0.v20110531-1200,"org.eclipse.jdt.ui.CompilationUnitEditor",1331463651659
-executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.file.save",1331463705359
-deactivated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1331463711828
-activated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1331463720894
-deactivated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1331463723979
-activated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1331463768917
-activated,view,org.eclipse.ui.console,3.5.100.v20110511,"org.eclipse.ui.console.ConsoleView",1331463770297
-deactivated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1331463786091
-activated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1331463787834
-executed,command,com.google.appengine.eclipse.core,2.5.2.v201202290255-rel-r37,"com.google.appengine.eclipse.core.deployToGoogle",1331463789168
-deactivated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1331463820442
-activated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1331464019280
-deactivated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1331464027371
-activated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1331464959938
-deactivated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1331464963429
-activated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1331464964907
-closed,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1331464965247
-stopped,bundle,org.eclipse.m2e.logback.configuration,1.0.0.20110607-2117,"org.eclipse.m2e.logback.configuration",1331464966052
-stopped,bundle,org.eclipse.ui.cheatsheets,3.4.100.v20110425,"org.eclipse.ui.cheatsheets",1331464966052
-stopped,bundle,org.eclipse.help.ui,3.5.100.v20110425,"org.eclipse.help.ui",1331464966052
-stopped,bundle,org.eclipse.help.webapp,3.6.0.v20110518,"org.eclipse.help.webapp",1331464966052
-stopped,bundle,org.eclipse.epp.mpc.ui,1.1.0.I20110525-0742,"org.eclipse.epp.mpc.ui",1331464966053
-stopped,bundle,org.eclipse.epp.usagedata.ui,1.3.1.R201106061540,"org.eclipse.epp.usagedata.ui",1331464966053
-stopped,bundle,org.eclipse.ui.intro.universal,3.2.500.v20110510,"org.eclipse.ui.intro.universal",1331464966053
-stopped,bundle,org.eclipse.ui.intro,3.4.100.v20110425,"org.eclipse.ui.intro",1331464966053
-stopped,bundle,org.eclipse.help.base,3.6.0.v201106131736,"org.eclipse.help.base",1331464966053
-stopped,bundle,org.eclipse.equinox.http.jetty,2.0.100.v20110502,"org.eclipse.equinox.http.jetty",1331464966053
-stopped,bundle,com.google.appengine.eclipse.datatools,2.5.2.v201202290255-rel-r37,"com.google.appengine.eclipse.datatools",1331464966053
-stopped,bundle,com.google.appengine.eclipse.sdkbundle,1.6.3.v201202290255r37,"com.google.appengine.eclipse.sdkbundle",1331464966053
-stopped,bundle,com.google.gdt.eclipse.appengine.rpc,2.5.2.v201202290255-rel-r37,"com.google.gdt.eclipse.appengine.rpc",1331464966053
-stopped,bundle,com.google.gdt.eclipse.gph.e36,2.5.2.v201202290255-rel-r37,"com.google.gdt.eclipse.gph.e36",1331464966053
-stopped,bundle,com.google.gdt.eclipse.gph.hge,2.5.2.v201202290255-rel-r37,"com.google.gdt.eclipse.gph.hge",1331464966053
-stopped,bundle,com.google.gdt.eclipse.gph.subclipse,2.5.2.v201202290255-rel-r37,"com.google.gdt.eclipse.gph.subclipse",1331464966054
-stopped,bundle,com.google.gdt.eclipse.gph.subversive,2.5.2.v201202290255-rel-r37,"com.google.gdt.eclipse.gph.subversive",1331464966054
-stopped,bundle,com.google.gdt.eclipse.suite.ext,2.5.2.v201202290255-rel-r37,"com.google.gdt.eclipse.suite.ext",1331464966054
-stopped,bundle,com.google.gdt.eclipse.gph,2.5.2.v201202290255-rel-r37,"com.google.gdt.eclipse.gph",1331464966054
-stopped,bundle,com.google.gdt.eclipse.maven.e37,2.5.2.v201202290255-rel-r37,"com.google.gdt.eclipse.maven.e37",1331464966054
-stopped,bundle,com.google.gdt.eclipse.maven,2.5.2.v201202290255-rel-r37,"com.google.gdt.eclipse.maven",1331464966054
-stopped,bundle,com.google.gdt.eclipse.suite,2.5.2.v201202290255-rel-r37,"com.google.gdt.eclipse.suite",1331464966056
-stopped,bundle,com.google.gdt.eclipse.appsmarketplace,2.5.2.v201202290255-rel-r37,"com.google.gdt.eclipse.appsmarketplace",1331464966056
-stopped,bundle,com.google.appengine.eclipse.core,2.5.2.v201202290255-rel-r37,"com.google.appengine.eclipse.core",1331464966056
-stopped,bundle,com.google.gdt.eclipse.login,2.5.2.v201202290255-rel-r37,"com.google.gdt.eclipse.login",1331464966056
-stopped,bundle,com.google.gdt.eclipse.managedapis,2.5.2.v201202290255-rel-r37,"com.google.gdt.eclipse.managedapis",1331464966071
-stopped,bundle,com.google.gwt.eclipse.oophm,2.5.2.v201202290255-rel-r37,"com.google.gwt.eclipse.oophm",1331464966071
-stopped,bundle,com.google.gwt.eclipse.sdkbundle,2.4.0.v201202290255-rel-r37,"com.google.gwt.eclipse.sdkbundle",1331464966071
-stopped,bundle,com.google.gwt.eclipse.core,2.5.2.v201202290255-rel-r37,"com.google.gwt.eclipse.core",1331464966187
-stopped,bundle,com.google.gdt.eclipse.core,2.5.2.v201202290255-rel-r37,"com.google.gdt.eclipse.core",1331464966188
-stopped,bundle,com.google.gdt.eclipse.platform,2.5.2.v201202290255-rel-r37,"com.google.gdt.eclipse.platform",1331464966188
-stopped,bundle,com.google.gdt.eclipse.platform.e37,2.5.2.v201202290255-rel-r37,"com.google.gdt.eclipse.platform.e37",1331464966188
-stopped,bundle,org.eclipse.m2e.discovery,1.0.200.20111228-1245,"org.eclipse.m2e.discovery",1331464966189
-stopped,bundle,org.eclipse.m2e.refactoring,1.0.200.20111228-1245,"org.eclipse.m2e.refactoring",1331464966189
-stopped,bundle,org.eclipse.m2e.editor,1.0.200.20111228-1245,"org.eclipse.m2e.editor",1331464966189
-stopped,bundle,org.eclipse.m2e.editor.xml,1.0.200.20111228-1245,"org.eclipse.m2e.editor.xml",1331464966189
-stopped,bundle,org.eclipse.m2e.jdt,1.0.200.20111228-1245,"org.eclipse.m2e.jdt",1331464966189
-stopped,bundle,org.eclipse.m2e.launching,1.0.200.20111228-1245,"org.eclipse.m2e.launching",1331464966190
-stopped,bundle,org.eclipse.m2e.usagedata,1.0.200.20111228-1245,"org.eclipse.m2e.usagedata",1331464966190
-stopped,bundle,org.eclipse.m2e.core.ui,1.0.200.20111228-1245,"org.eclipse.m2e.core.ui",1331464966190
-stopped,bundle,org.eclipse.m2e.core,1.0.200.20111228-1245,"org.eclipse.m2e.core",1331464966190
-stopped,bundle,org.eclipse.mylyn.ide.ant,3.6.0.v20110608-1400,"org.eclipse.mylyn.ide.ant",1331464966190
-stopped,bundle,org.eclipse.ant.ui,3.5.100.v20110510,"org.eclipse.ant.ui",1331464966190
-stopped,bundle,org.eclipse.ant.launching,1.0.100.v20110506,"org.eclipse.ant.launching",1331464966190
-stopped,bundle,org.eclipse.equinox.p2.ui.sdk,1.0.200.v20110502-1955,"org.eclipse.equinox.p2.ui.sdk",1331464966191
-stopped,bundle,org.eclipse.mylyn.java.tasks,3.6.0.v20110608-1400,"org.eclipse.mylyn.java.tasks",1331464966191
-stopped,bundle,org.eclipse.mylyn.java.ui,3.6.0.v20110608-1400,"org.eclipse.mylyn.java.ui",1331464966191
-stopped,bundle,com.google.gdt.eclipse.designer.UiBinder,2.5.0.r37x201112291029,"com.google.gdt.eclipse.designer.UiBinder",1331464966192
-stopped,bundle,com.google.gdt.eclipse.designer.gpe,2.5.0.r37x201201030222,"com.google.gdt.eclipse.designer.gpe",1331464966192
-stopped,bundle,com.google.gdt.eclipse.designer,2.5.0.r37x201112291029,"com.google.gdt.eclipse.designer",1331464966192
-stopped,bundle,org.eclipse.jdt.junit,3.7.0.v20110505-0800,"org.eclipse.jdt.junit",1331464966192
-stopped,bundle,org.eclipse.jdt.apt.ui,3.3.300.v20110305-1450,"org.eclipse.jdt.apt.ui",1331464966192
-stopped,bundle,org.eclipse.jdt.debug.ui,3.6.0.v20110512,"org.eclipse.jdt.debug.ui",1331464966194
-stopped,bundle,com.google.gdt.eclipse.platform.shared,2.5.2.v201202290255-rel-r37,"com.google.gdt.eclipse.platform.shared",1331464966194
-stopped,bundle,org.eclipse.wb.swing.FormLayout,1.0.0.r37x201106081552,"org.eclipse.wb.swing.FormLayout",1331464966195
-stopped,bundle,org.eclipse.wb.swing.MigLayout,1.0.0.r37x201106081552,"org.eclipse.wb.swing.MigLayout",1331464966195
-stopped,bundle,org.eclipse.wb.swing.databinding,1.0.0.r37x201106081552,"org.eclipse.wb.swing.databinding",1331464966195
-stopped,bundle,org.eclipse.wb.swing.java6,1.0.0.r37x201106081552,"org.eclipse.wb.swing.java6",1331464966195
-stopped,bundle,org.eclipse.wb.swing.jsr296,1.0.0.r37x201106081552,"org.eclipse.wb.swing.jsr296",1331464966195
-stopped,bundle,org.eclipse.wb.swing,1.0.0.r37x201106081552,"org.eclipse.wb.swing",1331464966195
-stopped,bundle,org.eclipse.wb.core.ui,1.0.0.r37x201106081733,"org.eclipse.wb.core.ui",1331464966195
-stopped,bundle,org.eclipse.wb.layout.group,1.0.0.r37x201106081642,"org.eclipse.wb.layout.group",1331464966195
-stopped,bundle,com.google.gdt.eclipse.designer.hosted.2_0.webkit,2.5.0.r37x201112291019,"com.google.gdt.eclipse.designer.hosted.2_0.webkit",1331464966195
index cfd0217..5107751 100644 (file)
 what,kind,bundleId,bundleVersion,description,time
-stopped,bundle,com.google.gdt.eclipse.designer.hosted.2_0,2.5.0.r37x201112291019,"com.google.gdt.eclipse.designer.hosted.2_0",1331464966195
-stopped,bundle,com.google.gdt.eclipse.designer.hosted.2_2.webkit,2.5.0.r37x201112291019,"com.google.gdt.eclipse.designer.hosted.2_2.webkit",1331464966195
-stopped,bundle,com.google.gdt.eclipse.designer.hosted.2_2,2.5.0.r37x201112291019,"com.google.gdt.eclipse.designer.hosted.2_2",1331464966195
-stopped,bundle,com.google.gdt.eclipse.designer.hosted,2.5.0.r37x201112291019,"com.google.gdt.eclipse.designer.hosted",1331464966195
-stopped,bundle,org.eclipse.wb.core.databinding.xml,1.2.0.r37x201112291009,"org.eclipse.wb.core.databinding.xml",1331464966195
-stopped,bundle,org.eclipse.wb.core.databinding,1.2.0.r37x201112290923,"org.eclipse.wb.core.databinding",1331464966195
-stopped,bundle,org.eclipse.wb.core.xml,1.2.0.r37x201112291009,"org.eclipse.wb.core.xml",1331464966195
-stopped,bundle,org.eclipse.wb.css,1.2.0.r37x201112290951,"org.eclipse.wb.css",1331464966195
-stopped,bundle,org.eclipse.wb.os.macosx,1.2.0.r37x201112290923,"org.eclipse.wb.os.macosx",1331464966196
-stopped,bundle,org.eclipse.wb.core,1.2.0.r37x201112290923,"org.eclipse.wb.core",1331464966196
-stopped,bundle,org.eclipse.jdt.ui,3.7.0.v20110531-1200,"org.eclipse.jdt.ui",1331464966202
-stopped,bundle,org.eclipse.wst.dtd.ui,1.0.600.v201103171359,"org.eclipse.wst.dtd.ui",1331464966202
-stopped,bundle,org.eclipse.wst.xsd.ui,1.2.404.v201105050216,"org.eclipse.wst.xsd.ui",1331464966202
-stopped,bundle,org.eclipse.wst.css.ui,1.0.601.v201201101544,"org.eclipse.wst.css.ui",1331464966202
-stopped,bundle,org.eclipse.wst.xml.ui,1.1.202.v201112071516,"org.eclipse.wst.xml.ui",1331464966203
-stopped,bundle,org.eclipse.wst.common.ui,1.1.500.v200911190730,"org.eclipse.wst.common.ui",1331464966203
-stopped,bundle,org.eclipse.wst.jsdt.ui,1.1.102.v201201131900,"org.eclipse.wst.jsdt.ui",1331464966247
-stopped,bundle,org.eclipse.wst.sse.ui,1.3.2.v201201041522,"org.eclipse.wst.sse.ui",1331464966247
-stopped,bundle,org.eclipse.search,3.7.0.v20110505-0800,"org.eclipse.search",1331464966273
-stopped,bundle,org.eclipse.mylyn.commons.team,0.8.0.v20110608-1400,"org.eclipse.mylyn.commons.team",1331464966273
-stopped,bundle,org.eclipse.mylyn.team.ui,3.6.0.v20110608-1400,"org.eclipse.mylyn.team.ui",1331464966273
-stopped,bundle,org.eclipse.ui.navigator.resources,3.4.300.I20110421-1800,"org.eclipse.ui.navigator.resources",1331464966273
-stopped,bundle,org.eclipse.ltk.ui.refactoring,3.6.0.v20110505-0800,"org.eclipse.ltk.ui.refactoring",1331464966274
-stopped,bundle,org.eclipse.mylyn.bugzilla.ui,3.6.0.v20110608-1400,"org.eclipse.mylyn.bugzilla.ui",1331464966274
-stopped,bundle,org.eclipse.mylyn.ide.ui,3.6.0.v20110608-1400,"org.eclipse.mylyn.ide.ui",1331464966274
-stopped,bundle,org.eclipse.mylyn.resources.ui,3.6.0.v20110608-1400,"org.eclipse.mylyn.resources.ui",1331464966274
-stopped,bundle,org.eclipse.mylyn.wikitext.tasks.ui,1.5.0.v20110608-1400,"org.eclipse.mylyn.wikitext.tasks.ui",1331464966274
-stopped,bundle,org.eclipse.mylyn.context.ui,3.6.0.v20110608-1400,"org.eclipse.mylyn.context.ui",1331464966274
-stopped,bundle,org.eclipse.mylyn.help.ui,3.6.0.v20110608-1400,"org.eclipse.mylyn.help.ui",1331464966274
-stopped,bundle,org.eclipse.mylyn.tasks.bugs,3.6.0.v20110608-1400,"org.eclipse.mylyn.tasks.bugs",1331464966274
-stopped,bundle,org.eclipse.mylyn.tasks.ui,3.6.0.v20110608-1400,"org.eclipse.mylyn.tasks.ui",1331464966275
-stopped,bundle,org.eclipse.team.cvs.ui,3.3.400.I20110510-0800,"org.eclipse.team.cvs.ui",1331464966277
-stopped,bundle,org.eclipse.team.ui,3.6.100.I20110525-0800,"org.eclipse.team.ui",1331464966277
-stopped,bundle,org.eclipse.compare,3.5.200.I20110525-0800,"org.eclipse.compare",1331464966277
-stopped,bundle,org.eclipse.ui.externaltools,3.2.0.v20110506,"org.eclipse.ui.externaltools",1331464966277
-stopped,bundle,org.eclipse.debug.ui,3.7.0.v20110518,"org.eclipse.debug.ui",1331464966279
-stopped,bundle,org.eclipse.mylyn.wikitext.ui,1.5.0.v20110608-1400,"org.eclipse.mylyn.wikitext.ui",1331464966279
-stopped,bundle,org.eclipse.ui.console,3.5.100.v20110511,"org.eclipse.ui.console",1331464966280
-stopped,bundle,org.eclipse.mylyn.commons.ui,3.6.1.v20110720-0100,"org.eclipse.mylyn.commons.ui",1331464966280
-stopped,bundle,org.eclipse.ui.editors,3.7.0.v20110517-0800,"org.eclipse.ui.editors",1331464966280
-stopped,bundle,org.eclipse.wst.common.snippets,1.2.100.v201103281740,"org.eclipse.wst.common.snippets",1331464966280
-stopped,bundle,org.eclipse.ui.workbench.texteditor,3.7.0.v20110505-0800,"org.eclipse.ui.workbench.texteditor",1331464966280
-stopped,bundle,org.eclipse.compare.core,3.5.200.I20110208-0800,"org.eclipse.compare.core",1331464966280
-stopped,bundle,org.eclipse.emf.edit.ui,2.7.0.v20110606-0949,"org.eclipse.emf.edit.ui",1331464966280
-stopped,bundle,org.eclipse.gef,3.7.0.v20110407-2050,"org.eclipse.gef",1331464966280
-activated,perspective,org.eclipse.jdt.ui,,"org.eclipse.jdt.ui.JavaPerspective",1331738400402
-started,bundle,org.eclipse.osgi,3.7.0.v20110613,"org.eclipse.osgi",1331738400403
-started,bundle,org.eclipse.equinox.simpleconfigurator,1.0.200.v20110502-1955,"org.eclipse.equinox.simpleconfigurator",1331738400403
-started,bundle,com.ibm.icu,4.4.2.v20110208,"com.ibm.icu",1331738400403
-started,bundle,org.eclipse.compare.core,3.5.200.I20110208-0800,"org.eclipse.compare.core",1331738400403
-started,bundle,org.eclipse.core.contenttype,3.4.100.v20110423-0524,"org.eclipse.core.contenttype",1331738400403
-started,bundle,org.eclipse.core.databinding.observable,1.4.0.I20110222-0800,"org.eclipse.core.databinding.observable",1331738400403
-started,bundle,org.eclipse.core.expressions,3.4.300.v20110228,"org.eclipse.core.expressions",1331738400403
-started,bundle,org.eclipse.core.filebuffers,3.5.200.v20110505-0800,"org.eclipse.core.filebuffers",1331738400403
-started,bundle,org.eclipse.core.filesystem,1.3.100.v20110423-0524,"org.eclipse.core.filesystem",1331738400403
-started,bundle,org.eclipse.core.jobs,3.5.100.v20110404,"org.eclipse.core.jobs",1331738400403
-started,bundle,org.eclipse.core.net,1.2.100.I20110511-0800,"org.eclipse.core.net",1331738400403
-started,bundle,org.eclipse.core.resources,3.7.100.v20110510-0712,"org.eclipse.core.resources",1331738400403
-started,bundle,org.eclipse.core.runtime,3.7.0.v20110110,"org.eclipse.core.runtime",1331738400403
-started,bundle,org.eclipse.core.runtime.compatibility,3.2.100.v20100505,"org.eclipse.core.runtime.compatibility",1331738400403
-started,bundle,org.eclipse.core.runtime.compatibility.auth,3.2.200.v20110110,"org.eclipse.core.runtime.compatibility.auth",1331738400403
-started,bundle,org.eclipse.core.variables,3.2.500.v20110511,"org.eclipse.core.variables",1331738400403
-started,bundle,org.eclipse.debug.core,3.7.0.v20110518,"org.eclipse.debug.core",1331738400403
-started,bundle,org.eclipse.epp.mpc.ui,1.1.0.I20110525-0742,"org.eclipse.epp.mpc.ui",1331738400403
-started,bundle,org.eclipse.epp.usagedata.gathering,1.3.1.R201106061540,"org.eclipse.epp.usagedata.gathering",1331738400403
-started,bundle,org.eclipse.epp.usagedata.recording,1.3.1.R201106061540,"org.eclipse.epp.usagedata.recording",1331738400403
-started,bundle,org.eclipse.equinox.app,1.3.100.v20110321,"org.eclipse.equinox.app",1331738400403
-started,bundle,org.eclipse.equinox.common,3.6.0.v20110523,"org.eclipse.equinox.common",1331738400403
-started,bundle,org.eclipse.equinox.ds,1.3.0.v20110502,"org.eclipse.equinox.ds",1331738400403
-started,bundle,org.eclipse.equinox.event,1.2.100.v20110502,"org.eclipse.equinox.event",1331738400403
-started,bundle,org.eclipse.equinox.p2.core,2.1.0.v20110502-1955,"org.eclipse.equinox.p2.core",1331738400403
-started,bundle,org.eclipse.equinox.p2.directorywatcher,1.0.300.v20110502-1955,"org.eclipse.equinox.p2.directorywatcher",1331738400403
-started,bundle,org.eclipse.equinox.p2.engine,2.1.0.v20110511,"org.eclipse.equinox.p2.engine",1331738400403
-started,bundle,org.eclipse.equinox.p2.metadata,2.1.0.v20110510,"org.eclipse.equinox.p2.metadata",1331738400403
-started,bundle,org.eclipse.equinox.p2.metadata.repository,1.2.0.v20110511-1359,"org.eclipse.equinox.p2.metadata.repository",1331738400403
-started,bundle,org.eclipse.equinox.p2.operations,2.1.0.v20110511-1821,"org.eclipse.equinox.p2.operations",1331738400403
-started,bundle,org.eclipse.equinox.p2.reconciler.dropins,1.1.100.v20110510,"org.eclipse.equinox.p2.reconciler.dropins",1331738400403
-started,bundle,org.eclipse.equinox.p2.repository,2.1.0.v20110601,"org.eclipse.equinox.p2.repository",1331738400403
-started,bundle,org.eclipse.equinox.p2.ui.sdk.scheduler,1.0.100.v20110502-1955,"org.eclipse.equinox.p2.ui.sdk.scheduler",1331738400403
-started,bundle,org.eclipse.equinox.p2.updatechecker,1.1.200.v20110502-1955,"org.eclipse.equinox.p2.updatechecker",1331738400403
-started,bundle,org.eclipse.equinox.preferences,3.4.0.v20110502,"org.eclipse.equinox.preferences",1331738400403
-started,bundle,org.eclipse.equinox.registry,3.5.100.v20110502,"org.eclipse.equinox.registry",1331738400403
-started,bundle,org.eclipse.equinox.security,1.1.0.v20110502,"org.eclipse.equinox.security",1331738400403
-started,bundle,org.eclipse.equinox.util,1.0.300.v20110502,"org.eclipse.equinox.util",1331738400403
-started,bundle,org.eclipse.help,3.5.100.v20110426,"org.eclipse.help",1331738400403
-started,bundle,org.eclipse.jdt.apt.core,3.3.500.v20110420-1015,"org.eclipse.jdt.apt.core",1331738400403
-started,bundle,org.eclipse.jdt.apt.pluggable.core,1.0.400.v20110305-1450,"org.eclipse.jdt.apt.pluggable.core",1331738400403
-started,bundle,org.eclipse.jdt.core,3.7.0.v_B61,"org.eclipse.jdt.core",1331738400403
-started,bundle,org.eclipse.jdt.core.manipulation,1.4.0.v20110505-0800,"org.eclipse.jdt.core.manipulation",1331738400403
-started,bundle,org.eclipse.jdt.launching,3.6.0.v20110509,"org.eclipse.jdt.launching",1331738400403
-started,bundle,org.eclipse.jdt.launching.macosx,3.2.100.v20110509,"org.eclipse.jdt.launching.macosx",1331738400403
-started,bundle,org.eclipse.jdt.ui,3.7.0.v20110531-1200,"org.eclipse.jdt.ui",1331738400403
-started,bundle,org.eclipse.jface,3.7.0.I20110522-1430,"org.eclipse.jface",1331738400403
-started,bundle,org.eclipse.jsch.core,1.1.300.I20110514-0800,"org.eclipse.jsch.core",1331738400403
-started,bundle,org.eclipse.ltk.core.refactoring,3.5.200.v20110505-0800,"org.eclipse.ltk.core.refactoring",1331738400403
-started,bundle,org.eclipse.ltk.ui.refactoring,3.6.0.v20110505-0800,"org.eclipse.ltk.ui.refactoring",1331738400403
-started,bundle,org.eclipse.m2e.logback.configuration,1.0.0.20110607-2117,"org.eclipse.m2e.logback.configuration",1331738400403
-started,bundle,org.eclipse.mylyn.bugzilla.core,3.6.0.v20110608-1400,"org.eclipse.mylyn.bugzilla.core",1331738400403
-started,bundle,org.eclipse.mylyn.bugzilla.ui,3.6.0.v20110608-1400,"org.eclipse.mylyn.bugzilla.ui",1331738400403
-started,bundle,org.eclipse.mylyn.commons.identity,0.8.0.v20110608-1400,"org.eclipse.mylyn.commons.identity",1331738400403
-started,bundle,org.eclipse.mylyn.commons.net,3.6.0.v20110608-1400,"org.eclipse.mylyn.commons.net",1331738400403
-started,bundle,org.eclipse.mylyn.context.core,3.6.0.v20110608-1400,"org.eclipse.mylyn.context.core",1331738400403
-started,bundle,org.eclipse.mylyn.context.ui,3.6.0.v20110608-1400,"org.eclipse.mylyn.context.ui",1331738400403
-started,bundle,org.eclipse.mylyn.monitor.ui,3.6.0.v20110608-1400,"org.eclipse.mylyn.monitor.ui",1331738400403
-started,bundle,org.eclipse.mylyn.tasks.ui,3.6.0.v20110608-1400,"org.eclipse.mylyn.tasks.ui",1331738400403
-started,bundle,org.eclipse.mylyn.team.ui,3.6.0.v20110608-1400,"org.eclipse.mylyn.team.ui",1331738400403
-started,bundle,org.eclipse.search,3.7.0.v20110505-0800,"org.eclipse.search",1331738400403
-started,bundle,org.eclipse.team.core,3.6.0.I20110525-0800,"org.eclipse.team.core",1331738400403
-started,bundle,org.eclipse.team.cvs.core,3.3.400.I20110510-0800,"org.eclipse.team.cvs.core",1331738400403
-started,bundle,org.eclipse.team.cvs.ui,3.3.400.I20110510-0800,"org.eclipse.team.cvs.ui",1331738400403
-started,bundle,org.eclipse.team.ui,3.6.100.I20110525-0800,"org.eclipse.team.ui",1331738400403
-started,bundle,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui",1331738400403
-started,bundle,org.eclipse.ui.console,3.5.100.v20110511,"org.eclipse.ui.console",1331738400403
-started,bundle,org.eclipse.ui.editors,3.7.0.v20110517-0800,"org.eclipse.ui.editors",1331738400403
-started,bundle,org.eclipse.ui.forms,3.5.100.v20110425,"org.eclipse.ui.forms",1331738400403
-started,bundle,org.eclipse.ui.ide,3.7.0.I20110519-0100,"org.eclipse.ui.ide",1331738400403
-started,bundle,org.eclipse.ui.net,1.2.100.I20110511-0800,"org.eclipse.ui.net",1331738400403
-started,bundle,org.eclipse.ui.views,3.6.0.I20110412-0800,"org.eclipse.ui.views",1331738400403
-started,bundle,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"org.eclipse.ui.workbench",1331738400403
-started,bundle,org.eclipse.ui.workbench.texteditor,3.7.0.v20110505-0800,"org.eclipse.ui.workbench.texteditor",1331738400403
-started,bundle,org.eclipse.update.configurator,3.3.100.v20100512,"org.eclipse.update.configurator",1331738400403
-started,bundle,org.eclipse.update.core,3.2.500.v20110330,"org.eclipse.update.core",1331738400403
-started,bundle,org.eclipse.update.scheduler,3.2.300.v20100512,"org.eclipse.update.scheduler",1331738400403
-started,bundle,org.eclipse.wb.discovery.core,1.0.0.r37x201106081733,"org.eclipse.wb.discovery.core",1331738400403
-started,bundle,com.google.appengine.eclipse.core,2.5.2.v201202290255-rel-r37,"com.google.appengine.eclipse.core",1331738400403
-started,bundle,com.google.gdt.eclipse.appengine.rpc,2.5.2.v201202290255-rel-r37,"com.google.gdt.eclipse.appengine.rpc",1331738400403
-started,bundle,com.google.gdt.eclipse.core,2.5.2.v201202290255-rel-r37,"com.google.gdt.eclipse.core",1331738400403
-started,bundle,com.google.gdt.eclipse.designer,2.5.0.r37x201112291029,"com.google.gdt.eclipse.designer",1331738400403
-started,bundle,com.google.gdt.eclipse.login,2.5.2.v201202290255-rel-r37,"com.google.gdt.eclipse.login",1331738400403
-started,bundle,com.google.gdt.eclipse.managedapis,2.5.2.v201202290255-rel-r37,"com.google.gdt.eclipse.managedapis",1331738400404
-started,bundle,com.google.gdt.eclipse.maven,2.5.2.v201202290255-rel-r37,"com.google.gdt.eclipse.maven",1331738400404
-started,bundle,com.google.gdt.eclipse.platform.e37,2.5.2.v201202290255-rel-r37,"com.google.gdt.eclipse.platform.e37",1331738400404
-started,bundle,com.google.gdt.eclipse.platform.shared,2.5.2.v201202290255-rel-r37,"com.google.gdt.eclipse.platform.shared",1331738400404
-started,bundle,com.google.gdt.eclipse.suite,2.5.2.v201202290255-rel-r37,"com.google.gdt.eclipse.suite",1331738400404
-started,bundle,com.google.gdt.eclipse.suite.ext,2.5.2.v201202290255-rel-r37,"com.google.gdt.eclipse.suite.ext",1331738400404
-started,bundle,com.google.gwt.eclipse.core,2.5.2.v201202290255-rel-r37,"com.google.gwt.eclipse.core",1331738400404
-started,bundle,org.eclipse.mylyn.commons.ui,3.6.1.v20110720-0100,"org.eclipse.mylyn.commons.ui",1331738400404
-started,bundle,org.eclipse.wb.core,1.2.0.r37x201112290923,"org.eclipse.wb.core",1331738400404
-started,bundle,org.eclipse.wb.core.lib,1.2.0.r37x201112290923,"org.eclipse.wb.core.lib",1331738400404
-os,sysinfo,,,"macosx",1331738400406
-arch,sysinfo,,,"x86_64",1331738400406
-ws,sysinfo,,,"cocoa",1331738400406
-locale,sysinfo,,,"ja_JP",1331738400406
-processors,sysinfo,,,"8",1331738400406
-java.runtime.name,sysinfo,,,"Java(TM) SE Runtime Environment",1331738400406
-java.runtime.version,sysinfo,,,"1.6.0_29-b11-402-11D50d",1331738400406
-java.specification.name,sysinfo,,,"Java Platform API Specification",1331738400406
-java.specification.vendor,sysinfo,,,"Sun Microsystems Inc.",1331738400406
-java.specification.version,sysinfo,,,"1.6",1331738400406
-java.vendor,sysinfo,,,"Apple Inc.",1331738400406
-java.version,sysinfo,,,"1.6.0_29",1331738400406
-java.vm.info,sysinfo,,,"mixed mode",1331738400406
-java.vm.name,sysinfo,,,"Java HotSpot(TM) 64-Bit Server VM",1331738400406
-java.vm.specification.name,sysinfo,,,"Java Virtual Machine Specification",1331738400406
-java.vm.specification.vendor,sysinfo,,,"Sun Microsystems Inc.",1331738400406
-java.vm.specification.version,sysinfo,,,"1.0",1331738400406
-java.vm.vendor,sysinfo,,,"Apple Inc.",1331738400406
-java.vm.version,sysinfo,,,"20.4-b02-402",1331738400406
-started,bundle,org.eclipse.m2e.usagedata,1.0.200.20111228-1245,"org.eclipse.m2e.usagedata",1331738400408
-started,bundle,org.eclipse.wb.discovery.ui,1.0.0.r37x201106081733,"org.eclipse.wb.discovery.ui",1331738400545
-started,bundle,com.google.gdt.eclipse.designer.hosted,2.5.0.r37x201112291019,"com.google.gdt.eclipse.designer.hosted",1331738400557
-started,bundle,com.google.gdt.eclipse.designer.UiBinder,2.5.0.r37x201112291029,"com.google.gdt.eclipse.designer.UiBinder",1331738400562
-opened,view,org.eclipse.ui.ide,3.7.0.I20110519-0100,"org.eclipse.ui.views.ProblemView",1331738401833
-started,bundle,org.eclipse.jdt.junit,3.7.0.v20110505-0800,"org.eclipse.jdt.junit",1331738402120
-executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.edit.cut",1331738426543
-executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.edit.paste",1331738428362
-executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.file.save",1331738429693
-started,bundle,org.eclipse.debug.ui,3.7.0.v20110518,"org.eclipse.debug.ui",1331738430056
-started,bundle,org.eclipse.jdt.debug,3.7.0.v20110509,"org.eclipse.jdt.debug",1331738430247
-started,bundle,org.eclipse.jdt.debug.ui,3.6.0.v20110512,"org.eclipse.jdt.debug.ui",1331738430323
-deactivated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1331738433885
-activated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1331738476975
-deactivated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1331738482636
-activated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1331738669880
-deactivated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1331738683989
-activated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1331738726127
-executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.edit.paste",1331738757932
-started,bundle,org.eclipse.mylyn.ide.ui,3.6.0.v20110608-1400,"org.eclipse.mylyn.ide.ui",1331738783599
-started,bundle,org.eclipse.mylyn.java.ui,3.6.0.v20110608-1400,"org.eclipse.mylyn.java.ui",1331738783645
-executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.file.save",1331738784315
-deactivated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1331738786028
-activated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1331738787875
-executed,command,org.eclipse.jdt.ui,3.7.0.v20110531-1200,"org.eclipse.jdt.ui.edit.text.java.organize.imports",1331738788060
-executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.file.save",1331738792578
-started,bundle,org.eclipse.m2e.launching,1.0.200.20111228-1245,"org.eclipse.m2e.launching",1331738798107
-deactivated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1331738801274
-activated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1331738857703
-deactivated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1331738868027
-activated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1331738906501
-executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.edit.copy",1331738915982
-executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.edit.paste",1331738917026
-executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.file.save",1331738928422
-executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.edit.cut",1331738941950
-executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.edit.paste",1331738953538
-executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.edit.cut",1331738977322
-executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.edit.paste",1331738980503
-deactivated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1331738989422
-activated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1331738999064
-executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.file.save",1331738999901
-executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.file.save",1331739012835
-deactivated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1331739027622
-activated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1331739034209
-deactivated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1331739039621
-activated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1331739047097
-executed,command,org.eclipse.ui,3.7.0.I20110602-0100,"org.eclipse.ui.file.save",1331739073080
-deactivated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1331739078472
-activated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1331739090944
-deactivated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1331739106285
-activated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1331739166384
-executed,command,,,"AUTOGEN:::org.eclipse.jdt.debug.CompilationUnitEditor.BreakpointRulerActions/org.eclipse.jdt.debug.ui.actions.ManageBreakpointRulerAction",1331739221884
-deactivated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1331739224199
-activated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1331739224275
-deactivated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1331739226473
-opened,view,org.eclipse.debug.ui,3.7.0.v20110518,"org.eclipse.debug.ui.DebugView",1331739231758
-activated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1331739231799
-executed,command,org.eclipse.debug.ui,3.7.0.v20110518,"org.eclipse.debug.ui.commands.StepOver",1331739241940
-executed,command,org.eclipse.debug.ui,3.7.0.v20110518,"org.eclipse.debug.ui.commands.StepOver",1331739244108
-deactivated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1331739259167
-activated,workbench,org.eclipse.ui.workbench,3.7.0.I20110519-0100,"",1331739267527
-executed,command,org.eclipse.debug.ui,3.7.0.v20110518,"org.eclipse.debug.ui.commands.Resume",1331739268741
+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
index 352860d..cc789eb 100644 (file)
Binary files a/workspace/.metadata/.plugins/org.eclipse.jdt.core/471433581.index and b/workspace/.metadata/.plugins/org.eclipse.jdt.core/471433581.index differ
index 991b5cb..ac64f3f 100644 (file)
@@ -3,7 +3,7 @@
        <section name="org.eclipse.jdt.internal.debug.ui.ExpressionInformationControlCreator$ExpressionInformationControl">
                <item value="500" key="SashWeightDetails"/>
                <item value="500" key="SashWeightTree"/>
-               <item value="230" key="HEIGHT"/>
-               <item value="1208" key="WIDTH"/>
+               <item value="156" key="HEIGHT"/>
+               <item value="600" key="WIDTH"/>
        </section>
 </section>
index 2f45a58..2a08d5d 100644 (file)
 <fullyQualifiedTypeName name="java.util.regex.Matcher"/>
 <fullyQualifiedTypeName name="com.yuji.tdb.utility.StringUtil"/>
 <fullyQualifiedTypeName name="twitter4j.Status"/>
-<fullyQualifiedTypeName name="java.util.TimeZone"/>
 <fullyQualifiedTypeName name="javax.jdo.annotations.IdentityType"/>
 <fullyQualifiedTypeName name="java.util.List"/>
 <fullyQualifiedTypeName name="com.yuji.tdb.db.TrainDao"/>
+<fullyQualifiedTypeName name="java.util.TimeZone"/>
+<fullyQualifiedTypeName name="com.yuji.tdb.Debug"/>
+<fullyQualifiedTypeName name="com.yuji.tdb.db.KeyValueDao"/>
+<fullyQualifiedTypeName name="java.util.Map"/>
+<fullyQualifiedTypeName name="java.util.HashMap"/>
 </qualifiedTypeNameHistroy>
index 8818426..97d74d5 100644 (file)
@@ -1,8 +1,8 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <section name="Workbench">
        <item value="2" key="TypeHierarchyViewPart.hierarchyview"/>
-       <item value="false" key="TypeHierarchyViewPart.qualifiednames"/>
        <item value="3" key="TypeHierarchyViewPart.orientation"/>
+       <item value="false" key="TypeHierarchyViewPart.qualifiednames"/>
        <item value="false" key="TypeHierarchyViewPart.linkeditors"/>
        <section name="OptionalMessageDialog.hide.">
                <item value="true" key="org.eclipse.jdt.ui.typecomment.deprecated"/>
@@ -17,8 +17,8 @@
        <section name="quick_assist_proposal_size">
        </section>
        <section name="SourceActionDialog.methods">
-               <item value="1" key="VisibilityModifier"/>
                <item value="false" key="Comments"/>
+               <item value="1" key="VisibilityModifier"/>
                <item value="false" key="SynchronizedModifier"/>
                <item value="false" key="FinalModifier"/>
        </section>
@@ -41,9 +41,9 @@
        <section name="RenameInformationPopup">
        </section>
        <section name="org.eclipse.ltk.ui.refactoring.settings">
-               <item value="*" key="patterns"/>
-               <item value="false" key="updateQualifiedNames"/>
                <item value="false" key="renameSubpackages"/>
+               <item value="false" key="updateQualifiedNames"/>
+               <item value="*" key="patterns"/>
                <item value="false" key="updateTextualMatches"/>
        </section>
        <section name="org.eclipse.jdt.internal.ui.text.QuickOutline">
diff --git a/workspace/.metadata/.plugins/org.eclipse.jdt.ui/jdt-images/0.png b/workspace/.metadata/.plugins/org.eclipse.jdt.ui/jdt-images/0.png
deleted file mode 100644 (file)
index db80ee8..0000000
Binary files a/workspace/.metadata/.plugins/org.eclipse.jdt.ui/jdt-images/0.png and /dev/null differ
index 04d41c0..1587b82 100644 (file)
@@ -1,3 +1,3 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<session version="1.0">&#x0A;<refactoring comment="Extract method &apos;private void twite(String text, Twitter twitter) throws TwitterException &apos; from &apos;com.yuji.tdb.twitter.TwitterUtil.main()&apos; to &apos;com.yuji.tdb.twitter.TwitterUtil&apos;&#x0A;- Original project: &apos;TrainDelayBot&apos;&#x0A;- Method name: &apos;twite&apos;&#x0A;- Destination type: &apos;com.yuji.tdb.twitter.TwitterUtil&apos;&#x0A;- Declared visibility: &apos;private&apos;" comments="false" description="Extract method &apos;twite&apos;" destination="0" exceptions="false" flags="786434" id="org.eclipse.jdt.ui.extract.method" input="/src&lt;com.yuji.tdb.twitter{TwitterUtil.java" name="twite" replace="false" selection="1663 1520" stamp="1331428178486" version="1.0" visibility="2"/>&#x0A;<refactoring comment="Copy element &apos;KeyValueDao.java&apos; to &apos;TrainDelayBot/src/com.yuji.tdb.db&apos;&#x0A;- Original project: &apos;TrainDelayBot&apos;&#x0A;- Destination element: &apos;TrainDelayBot/src/com.yuji.tdb.db&apos;&#x0A;- Original element: &apos;com.yuji.tdb.db.KeyValueDao.java&apos;" description="Copy compilation unit" destination="/src&lt;com.yuji.tdb.db" element1="/src&lt;com.yuji.tdb.db{KeyValueDao.java" files="0" flags="589830" folders="0" id="org.eclipse.jdt.ui.copy" policy="org.eclipse.jdt.ui.copyResources" stamp="1331461667300" units="1" version="1.0"/>
+<session version="1.0">&#x0A;<refactoring comment="Extract method &apos;private void twite(String text, Twitter twitter) throws TwitterException &apos; from &apos;com.yuji.tdb.twitter.TwitterUtil.main()&apos; to &apos;com.yuji.tdb.twitter.TwitterUtil&apos;&#x0A;- Original project: &apos;TrainDelayBot&apos;&#x0A;- Method name: &apos;twite&apos;&#x0A;- Destination type: &apos;com.yuji.tdb.twitter.TwitterUtil&apos;&#x0A;- Declared visibility: &apos;private&apos;" comments="false" description="Extract method &apos;twite&apos;" destination="0" exceptions="false" flags="786434" id="org.eclipse.jdt.ui.extract.method" input="/src&lt;com.yuji.tdb.twitter{TwitterUtil.java" name="twite" replace="false" selection="1663 1520" stamp="1331428178486" version="1.0" visibility="2"/>&#x0A;<refactoring comment="Copy element &apos;KeyValueDao.java&apos; to &apos;TrainDelayBot/src/com.yuji.tdb.db&apos;&#x0A;- Original project: &apos;TrainDelayBot&apos;&#x0A;- Destination element: &apos;TrainDelayBot/src/com.yuji.tdb.db&apos;&#x0A;- Original element: &apos;com.yuji.tdb.db.KeyValueDao.java&apos;" description="Copy compilation unit" destination="/src&lt;com.yuji.tdb.db" element1="/src&lt;com.yuji.tdb.db{KeyValueDao.java" files="0" flags="589830" folders="0" id="org.eclipse.jdt.ui.copy" policy="org.eclipse.jdt.ui.copyResources" stamp="1331461667300" units="1" version="1.0"/>&#x0A;<refactoring comment="Move element &apos;Debug.java&apos; to &apos;TrainDelayBot/src/com.yuji.tdb.debug&apos;&#x0A;- Original project: &apos;TrainDelayBot&apos;&#x0A;- Destination element: &apos;TrainDelayBot/src/com.yuji.tdb.debug&apos;&#x0A;- Original element: &apos;com.yuji.tdb.Debug.java&apos;&#x0A;- Update references to refactored element" description="Move compilation unit" destination="/src&lt;com.yuji.tdb.debug" element1="/src&lt;com.yuji.tdb{Debug.java" files="0" flags="589830" folders="0" id="org.eclipse.jdt.ui.move" patterns="*" policy="org.eclipse.jdt.ui.moveResources" qualified="false" references="true" stamp="1331999651140" units="1" version="1.0"/>
 </session>
\ No newline at end of file
diff --git a/workspace/.metadata/.plugins/org.eclipse.ltk.core.refactoring/.refactorings/TrainDelayBot/2012/3/12/refactorings.history b/workspace/.metadata/.plugins/org.eclipse.ltk.core.refactoring/.refactorings/TrainDelayBot/2012/3/12/refactorings.history
new file mode 100644 (file)
index 0000000..4f47d70
--- /dev/null
@@ -0,0 +1,3 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<session version="1.0">&#x0A;<refactoring clone="true" comment="Infer generic type arguments on &apos;TrainDelayBot&apos;&#x0A;- Original project: &apos;TrainDelayBot&apos;&#x0A;- Original elements:&#x0A;     com.yuji.tdb.twitter.TwitterUtil.java&#x0A;- Assume clone() returns an instance of the receiver type&#x0A;- Leave unconstrained type arguments raw" description="Infer generic type arguments" element1="/src&lt;com.yuji.tdb.twitter{TwitterUtil.java" flags="6" id="org.eclipse.jdt.ui.infer.typearguments" leave="true" stamp="1332206374574" version="1.0"/>&#x0A;<refactoring comment="Rename field &apos;period&apos; in &apos;com.yuji.tdb.twitter.TwitterUtil&apos; to &apos;searchPeriod&apos;&#x0A;- Original project: &apos;TrainDelayBot&apos;&#x0A;- Original element: &apos;com.yuji.tdb.twitter.TwitterUtil.period&apos;&#x0A;- Renamed element: &apos;com.yuji.tdb.twitter.TwitterUtil.searchPeriod&apos;&#x0A;- Update references to refactored element&#x0A;- Update textual occurrences in comments and strings" delegate="false" deprecate="false" description="Rename field &apos;period&apos;" flags="589826" getter="false" id="org.eclipse.jdt.ui.rename.field" input="/src&lt;com.yuji.tdb.twitter{TwitterUtil.java[TwitterUtil^period" name="searchPeriod" references="true" setter="false" stamp="1332206953839" textual="false" version="1.0"/>&#x0A;<refactoring comment="Rename method &apos;com.yuji.tdb.twitter.TwitterUtil.getPeriod()&apos; to &apos;getSearchPeriod&apos;&#x0A;- Original project: &apos;TrainDelayBot&apos;&#x0A;- Original element: &apos;com.yuji.tdb.twitter.TwitterUtil.getPeriod()&apos;&#x0A;- Renamed element: &apos;com.yuji.tdb.twitter.TwitterUtil.getSearchPeriod()&apos;&#x0A;- Update references to refactored element" delegate="false" deprecate="false" description="Rename method &apos;getPeriod&apos;" flags="589830" id="org.eclipse.jdt.ui.rename.method" input="/src&lt;com.yuji.tdb.twitter{TwitterUtil.java[TwitterUtil~getPeriod" name="getSearchPeriod" references="true" stamp="1332206970150" version="1.0"/>
+</session>
\ No newline at end of file
diff --git a/workspace/.metadata/.plugins/org.eclipse.ltk.core.refactoring/.refactorings/TrainDelayBot/2012/3/12/refactorings.index b/workspace/.metadata/.plugins/org.eclipse.ltk.core.refactoring/.refactorings/TrainDelayBot/2012/3/12/refactorings.index
new file mode 100644 (file)
index 0000000..2cbfccb
--- /dev/null
@@ -0,0 +1,3 @@
+1332206374574  Infer generic type arguments
+1332206953839  Rename field 'period'
+1332206970150  Rename method 'getPeriod'
index ed857b0..8f9142d 100644 (file)
@@ -1,7 +1,15 @@
-<?xml version="1.0" encoding="UTF-8"?>\r
-<section name="Workbench">\r
-       <section name="RefactoringWizard.preview">\r
-               <item value="400" key="height"/>\r
-               <item value="600" key="width"/>\r
-       </section>\r
-</section>\r
+<?xml version="1.0" encoding="UTF-8"?>
+<section name="Workbench">
+       <section name="RefactoringWizard.preview">
+               <item value="400" key="height"/>
+               <item value="600" key="width"/>
+       </section>
+       <section name="org.eclipse.ltk.ui.refactoring.settings">
+               <item value="*" key="patterns"/>
+               <item value="false" key="moveWizard.updateQualifiedNames"/>
+       </section>
+       <section name="InferTypeArguments">
+               <item value="true" key="leaveUnconstrainedRaw"/>
+               <item value="true" key="assumeCloneReturnsSameType"/>
+       </section>
+</section>
index 08c9edd..01e06f0 100644 (file)
@@ -15,3 +15,5 @@
 2012-03-11 02:09:03,359 [org.eclipse.jdt.internal.ui.text.JavaReconciler] INFO  org.mortbay.log - Logging to Logger[org.mortbay.log] via org.mortbay.log.Slf4jLog
 2012-03-11 09:07:32,089 [org.eclipse.jdt.internal.ui.text.JavaReconciler] INFO  org.mortbay.log - Logging to Logger[org.mortbay.log] via org.mortbay.log.Slf4jLog
 2012-03-15 00:19:58,936 [org.eclipse.jdt.internal.ui.text.JavaReconciler] INFO  org.mortbay.log - Logging to Logger[org.mortbay.log] via org.mortbay.log.Slf4jLog
+2012-03-18 00:25:36,874 [org.eclipse.jdt.internal.ui.text.JavaReconciler] INFO  org.mortbay.log - Logging to Logger[org.mortbay.log] via org.mortbay.log.Slf4jLog
+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
diff --git a/workspace/.metadata/.plugins/org.eclipse.team.cvs.core/.running b/workspace/.metadata/.plugins/org.eclipse.team.cvs.core/.running
deleted file mode 100644 (file)
index e69de29..0000000
index 8bf48e8..6dd6f29 100644 (file)
@@ -1,12 +1,25 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <section name="Workbench">
+       <section name="org.eclipse.ui.dialogs.FilteredResourcesSelectionDialog">
+               <item value="false" key="ShowDerived"/>
+               <item value="true" key="ShowStatusLine"/>
+               <item value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;&#x0A;&lt;workingSet workingSetName=&quot;&quot;/&gt;" key="WorkingSet"/>
+               <item value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;&#x0A;&lt;History&gt;&#x0A;&lt;historyRootNode/&gt;&#x0A;&lt;/History&gt;" key="History"/>
+               <section name="DialogBoundsSettings">
+                       <item value="600" key="DIALOG_WIDTH"/>
+                       <item value="58" key="DIALOG_Y_ORIGIN"/>
+                       <item value="320" key="DIALOG_X_ORIGIN"/>
+                       <item value="500" key="DIALOG_HEIGHT"/>
+                       <item value="1|Lucida Grande|11.0|0|COCOA|1|LucidaGrande" key="DIALOG_FONT_NAME"/>
+               </section>
+       </section>
        <section name="ExternalProjectImportWizard">
        </section>
        <section name="CleanDialogSettings">
                <item value="484" key="DIALOG_WIDTH"/>
                <item value="150" key="DIALOG_Y_ORIGIN"/>
-               <item value="397" key="DIALOG_X_ORIGIN"/>
                <item value="354" key="DIALOG_HEIGHT"/>
+               <item value="397" key="DIALOG_X_ORIGIN"/>
                <item value="false" key="TOGGLE_SELECTED"/>
        </section>
 </section>
index 6f4ebcb..56e46ab 100644 (file)
                <item value="false" key="casesensitive"/>
                <item value="false" key="incremental"/>
                <item value="false" key="wholeword"/>
-               <item value="Cal" key="selection"/>
+               <item value="SEARCH" key="selection"/>
                <list key="findhistory">
+                       <item value="Search"/>
+                       <item value="log."/>
                        <item value="cal"/>
                        <item value="PMF"/>
                        <item value="TrainDelayBotServlet."/>
                        <item value="localhost"/>
                </list>
                <list key="replacehistory">
+                       <item value="Twit"/>
                        <item value="PMFactory"/>
                        <item value=""/>
                </list>
index 629963c..34f000f 100644 (file)
@@ -7,8 +7,8 @@
        <section name="ShowViewDialog">
                <item value="436" key="DIALOG_WIDTH"/>
                <item value="56" key="DIALOG_Y_ORIGIN"/>
-               <item value="456" key="DIALOG_HEIGHT"/>
                <item value="348" key="DIALOG_X_ORIGIN"/>
+               <item value="456" key="DIALOG_HEIGHT"/>
                <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">
index 4bd534f..925b363 100644 (file)
 <part id="4"/>
 <part id="5"/>
 <part id="6"/>
-<part id="7"/>
-<part id="8"/>
 </presentation>
 </folder>
 </info>
 </editorArea>
 <editor activePart="true" focus="true" id="org.eclipse.jdt.ui.CompilationUnitEditor" name="TwitterUtil.java" partName="TwitterUtil.java" path="/Users/yuji/prog/workspaces/TrainDelayBot/source/workspace/TrainDelayBot/src/com/yuji/tdb/twitter/TwitterUtil.java" title="TwitterUtil.java" tooltip="TrainDelayBot/src/com/yuji/tdb/twitter/TwitterUtil.java" workbook="DefaultEditorWorkbook">
 <input factoryID="org.eclipse.ui.part.FileEditorInputFactory" path="/TrainDelayBot/src/com/yuji/tdb/twitter/TwitterUtil.java"/>
-<editorState selectionHorizontalPixel="7" selectionLength="0" selectionOffset="3153" selectionTopPixel="2165"/>
+<editorState selectionHorizontalPixel="0" selectionLength="0" selectionOffset="4170" selectionTopPixel="2113"/>
 </editor>
 <editor id="org.eclipse.jdt.ui.CompilationUnitEditor" name="StringUtility.java" partName="StringUtility.java" path="/Users/yuji/prog/workspaces/TrainDelayBot/source/workspace/TrainDelayBot/src/com/yuji/tdb/utility/StringUtility.java" title="StringUtility.java" tooltip="TrainDelayBot/src/com/yuji/tdb/utility/StringUtility.java" workbook="DefaultEditorWorkbook">
 <input factoryID="org.eclipse.ui.part.FileEditorInputFactory" path="/TrainDelayBot/src/com/yuji/tdb/utility/StringUtility.java"/>
 </editor>
 <editor id="org.eclipse.jdt.ui.CompilationUnitEditor" name="KeyValueDao.java" partName="KeyValueDao.java" path="/Users/yuji/prog/workspaces/TrainDelayBot/source/workspace/TrainDelayBot/src/com/yuji/tdb/db/KeyValueDao.java" title="KeyValueDao.java" tooltip="TrainDelayBot/src/com/yuji/tdb/db/KeyValueDao.java" workbook="DefaultEditorWorkbook">
 <input factoryID="org.eclipse.ui.part.FileEditorInputFactory" path="/TrainDelayBot/src/com/yuji/tdb/db/KeyValueDao.java"/>
-<editorState selectionHorizontalPixel="0" selectionLength="0" selectionOffset="0" selectionTopPixel="62"/>
+<editorState selectionHorizontalPixel="0" selectionLength="3" selectionOffset="1415" selectionTopPixel="756"/>
 </editor>
-<editor id="org.eclipse.jdt.ui.CompilationUnitEditor" name="TrainDao.java" partName="TrainDao.java" path="/Users/yuji/prog/workspaces/TrainDelayBot/source/workspace/TrainDelayBot/src/com/yuji/tdb/db/TrainDao.java" title="TrainDao.java" tooltip="TrainDelayBot/src/com/yuji/tdb/db/TrainDao.java" workbook="DefaultEditorWorkbook">
-<input factoryID="org.eclipse.ui.part.FileEditorInputFactory" path="/TrainDelayBot/src/com/yuji/tdb/db/TrainDao.java"/>
-<editorState selectionHorizontalPixel="0" selectionLength="0" selectionOffset="556" selectionTopPixel="58"/>
-</editor>
-<editor id="org.eclipse.jdt.ui.CompilationUnitEditor" name="TrainDelayBotServlet.java" partName="TrainDelayBotServlet.java" path="/Users/yuji/prog/workspaces/TrainDelayBot/source/workspace/TrainDelayBot/src/com/yuji/tdb/TrainDelayBotServlet.java" title="TrainDelayBotServlet.java" tooltip="TrainDelayBot/src/com/yuji/tdb/TrainDelayBotServlet.java" workbook="DefaultEditorWorkbook">
-<input factoryID="org.eclipse.ui.part.FileEditorInputFactory" path="/TrainDelayBot/src/com/yuji/tdb/TrainDelayBotServlet.java"/>
-<editorState selectionHorizontalPixel="0" selectionLength="0" selectionOffset="3020" selectionTopPixel="1170"/>
-</editor>
-<editor id="org.eclipse.jdt.ui.CompilationUnitEditor" name="PMFactory.java" partName="PMFactory.java" path="/Users/yuji/prog/workspaces/TrainDelayBot/source/workspace/TrainDelayBot/src/com/yuji/tdb/db/PMFactory.java" title="PMFactory.java" tooltip="TrainDelayBot/src/com/yuji/tdb/db/PMFactory.java" workbook="DefaultEditorWorkbook">
-<input factoryID="org.eclipse.ui.part.FileEditorInputFactory" path="/TrainDelayBot/src/com/yuji/tdb/db/PMFactory.java"/>
-<editorState selectionHorizontalPixel="0" selectionLength="0" selectionOffset="0" selectionTopPixel="0"/>
+<editor id="org.eclipse.jdt.ui.CompilationUnitEditor" name="Debug.java" partName="Debug.java" path="/Users/yuji/prog/workspaces/TrainDelayBot/source/workspace/TrainDelayBot/src/com/yuji/tdb/debug/Debug.java" title="Debug.java" tooltip="TrainDelayBot/src/com/yuji/tdb/debug/Debug.java" workbook="DefaultEditorWorkbook">
+<input factoryID="org.eclipse.ui.part.FileEditorInputFactory" path="/TrainDelayBot/src/com/yuji/tdb/debug/Debug.java"/>
+<editorState selectionHorizontalPixel="0" selectionLength="0" selectionOffset="210" selectionTopPixel="0"/>
 </editor>
 </editors>
 <views>
 <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 (2 items)"/>
+<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"/>
 <viewState/>
 </view>
 </views>
-<perspectives activePart="org.eclipse.ui.console.ConsoleView" activePerspective="org.eclipse.jdt.ui.JavaPerspective">
+<perspectives activePart="org.eclipse.jdt.ui.CompilationUnitEditor" 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"/>
 <navigationHistory>
 <editors>
 <editor factoryID="org.eclipse.ui.part.FileEditorInputFactory" id="org.eclipse.jdt.ui.CompilationUnitEditor" path="/TrainDelayBot/src/com/yuji/tdb/twitter/TwitterUtil.java"/>
-<editor factoryID="org.eclipse.ui.part.FileEditorInputFactory" id="org.eclipse.jdt.ui.CompilationUnitEditor" path="/TrainDelayBot/src/com/yuji/tdb/db/TrainDao.java"/>
-<editor factoryID="org.eclipse.ui.part.FileEditorInputFactory" id="org.eclipse.jdt.ui.CompilationUnitEditor" path="/TrainDelayBot/src/com/yuji/tdb/TrainDelayBotServlet.java"/>
-<editor factoryID="org.eclipse.ui.part.FileEditorInputFactory" id="org.eclipse.jdt.ui.CompilationUnitEditor" path="/TrainDelayBot/src/com/yuji/tdb/db/PMFactory.java"/>
+<editor factoryID="org.eclipse.ui.part.FileEditorInputFactory" id="org.eclipse.jdt.ui.CompilationUnitEditor" path="/TrainDelayBot/src/com/yuji/tdb/db/KeyValueDao.java"/>
 </editors>
-<item historyLabel="TwitterUtil.java" index="0">
-<position/>
+<item historyLabel="KeyValueDao.java" index="1">
+<position info="not_deleted" x="1947" y="0"/>
 </item>
 <item historyLabel="TwitterUtil.java" index="0">
-<position/>
+<position info="not_deleted" x="2324" y="0"/>
 </item>
 <item historyLabel="TwitterUtil.java" index="0">
-<position info="not_deleted" x="1766" y="0"/>
+<position info="not_deleted" x="6355" y="0"/>
 </item>
 <item historyLabel="TwitterUtil.java" index="0">
-<position info="not_deleted" x="1613" y="0"/>
+<position info="not_deleted" x="6378" y="0"/>
 </item>
-<item historyLabel="TwitterUtil.java" index="0">
-<position info="not_deleted" x="1671" y="0"/>
+<item historyLabel="KeyValueDao.java" index="1">
+<position info="not_deleted" x="1947" y="0"/>
 </item>
 <item historyLabel="TwitterUtil.java" index="0">
-<position info="not_deleted" x="3654" y="0"/>
+<position info="not_deleted" x="2324" y="0"/>
 </item>
-<item historyLabel="TwitterUtil.java" index="0">
-<position info="not_deleted" x="3696" y="0"/>
+<item historyLabel="KeyValueDao.java" index="1">
+<position info="not_deleted" x="1947" y="0"/>
 </item>
 <item historyLabel="TwitterUtil.java" index="0">
-<position info="not_deleted" x="3732" y="0"/>
+<position info="not_deleted" x="2324" y="0"/>
 </item>
 <item historyLabel="TwitterUtil.java" index="0">
-<position info="not_deleted" x="3780" y="0"/>
+<position info="not_deleted" x="2396" y="0"/>
 </item>
 <item historyLabel="TwitterUtil.java" index="0">
-<position info="not_deleted" x="3843" y="0"/>
-</item>
-<item historyLabel="TrainDelayBotServlet.java" index="2">
-<position info="not_deleted" x="2999" y="0"/>
-</item>
-<item historyLabel="TrainDelayBotServlet.java" index="2">
-<position info="not_deleted" x="3020" y="0"/>
+<position info="not_deleted" x="2324" y="0"/>
 </item>
 <item historyLabel="TwitterUtil.java" index="0">
-<position info="not_deleted" x="3843" y="0"/>
+<position info="not_deleted" x="2396" y="0"/>
 </item>
 <item historyLabel="TwitterUtil.java" index="0">
-<position info="not_deleted" x="3839" y="0"/>
+<position info="not_deleted" x="2324" y="0"/>
 </item>
 <item historyLabel="TwitterUtil.java" index="0">
-<position info="not_deleted" x="3965" y="0"/>
+<position info="not_deleted" x="2347" y="0"/>
 </item>
 <item historyLabel="TwitterUtil.java" index="0">
-<position info="not_deleted" x="1671" y="0"/>
+<position info="not_deleted" x="2324" y="0"/>
 </item>
 <item historyLabel="TwitterUtil.java" index="0">
-<position info="not_deleted" x="3654" y="0"/>
+<position info="not_deleted" x="2276" y="0"/>
 </item>
 <item historyLabel="TwitterUtil.java" index="0">
-<position info="not_deleted" x="3696" y="0"/>
+<position info="not_deleted" x="2324" y="0"/>
 </item>
 <item historyLabel="TwitterUtil.java" index="0">
-<position info="not_deleted" x="3732" y="0"/>
+<position info="not_deleted" x="2373" y="0"/>
 </item>
 <item historyLabel="TwitterUtil.java" index="0">
-<position info="not_deleted" x="3780" y="0"/>
+<position info="not_deleted" x="2324" y="0"/>
 </item>
 <item historyLabel="TwitterUtil.java" index="0">
-<position info="not_deleted" x="3823" y="0"/>
-</item>
-<item historyLabel="TrainDelayBotServlet.java" index="2">
-<position info="not_deleted" x="2999" y="0"/>
-</item>
-<item historyLabel="TrainDao.java" index="1">
-<position info="not_deleted" x="107" y="8"/>
+<position info="not_deleted" x="2373" y="0"/>
 </item>
 <item historyLabel="TwitterUtil.java" index="0">
-<position info="not_deleted" x="3823" y="0"/>
-</item>
-<item historyLabel="TrainDao.java" index="1">
-<position info="not_deleted" x="107" y="8"/>
-</item>
-<item historyLabel="PMFactory.java" index="3">
-<position info="not_deleted" x="0" y="0"/>
-</item>
-<item historyLabel="TrainDao.java" index="1">
-<position info="not_deleted" x="107" y="8"/>
+<position info="not_deleted" x="2324" y="0"/>
 </item>
 <item historyLabel="TwitterUtil.java" index="0">
-<position info="not_deleted" x="3823" y="0"/>
+<position info="not_deleted" x="2373" y="0"/>
 </item>
-<item historyLabel="TrainDao.java" index="1">
-<position info="not_deleted" x="556" y="0"/>
+<item historyLabel="TwitterUtil.java" index="0">
+<position info="not_deleted" x="2275" y="0"/>
 </item>
 <item historyLabel="TwitterUtil.java" index="0">
-<position info="not_deleted" x="1671" y="0"/>
+<position info="not_deleted" x="5958" y="11"/>
 </item>
 <item historyLabel="TwitterUtil.java" index="0">
-<position info="not_deleted" x="3654" y="0"/>
+<position info="not_deleted" x="2324" y="0"/>
 </item>
 <item historyLabel="TwitterUtil.java" index="0">
-<position info="not_deleted" x="3696" y="0"/>
+<position info="not_deleted" x="2373" y="0"/>
 </item>
-<item historyLabel="TrainDelayBotServlet.java" index="2">
-<position info="not_deleted" x="2999" y="0"/>
+<item historyLabel="TwitterUtil.java" index="0">
+<position info="not_deleted" x="2324" y="0"/>
 </item>
-<item historyLabel="TrainDelayBotServlet.java" index="2">
-<position info="not_deleted" x="3020" y="0"/>
+<item historyLabel="TwitterUtil.java" index="0">
+<position info="not_deleted" x="2373" y="0"/>
 </item>
-<item historyLabel="TrainDao.java" index="1">
-<position info="not_deleted" x="556" y="0"/>
+<item historyLabel="TwitterUtil.java" index="0">
+<position info="not_deleted" x="2324" y="0"/>
 </item>
 <item historyLabel="TwitterUtil.java" index="0">
-<position info="not_deleted" x="1671" y="0"/>
+<position info="not_deleted" x="2373" y="0"/>
 </item>
 <item historyLabel="TwitterUtil.java" index="0">
-<position info="not_deleted" x="3654" y="0"/>
+<position info="not_deleted" x="2324" y="0"/>
 </item>
 <item historyLabel="TwitterUtil.java" index="0">
-<position info="not_deleted" x="3696" y="0"/>
+<position info="not_deleted" x="2396" y="0"/>
 </item>
 <item historyLabel="TwitterUtil.java" index="0">
-<position info="not_deleted" x="3732" y="0"/>
+<position info="not_deleted" x="2324" y="0"/>
 </item>
 <item historyLabel="TwitterUtil.java" index="0">
-<position info="not_deleted" x="3780" y="0"/>
+<position info="not_deleted" x="2396" y="0"/>
 </item>
 <item historyLabel="TwitterUtil.java" index="0">
-<position info="not_deleted" x="3823" y="0"/>
+<position info="not_deleted" x="2324" y="0"/>
 </item>
 <item historyLabel="TwitterUtil.java" index="0">
-<position info="not_deleted" x="3843" y="0"/>
+<position info="not_deleted" x="2373" y="0"/>
 </item>
 <item historyLabel="TwitterUtil.java" index="0">
-<position info="not_deleted" x="3884" y="0"/>
+<position info="not_deleted" x="2324" y="0"/>
 </item>
 <item historyLabel="TwitterUtil.java" index="0">
-<position info="not_deleted" x="3904" y="0"/>
+<position info="not_deleted" x="2373" y="0"/>
 </item>
 <item historyLabel="TwitterUtil.java" index="0">
-<position info="not_deleted" x="3945" y="0"/>
+<position info="not_deleted" x="2324" y="0"/>
 </item>
 <item historyLabel="TwitterUtil.java" index="0">
-<position info="not_deleted" x="3965" y="0"/>
+<position info="not_deleted" x="2373" y="0"/>
 </item>
 <item historyLabel="TwitterUtil.java" index="0">
-<position info="not_deleted" x="3995" y="0"/>
+<position info="not_deleted" x="5667" y="0"/>
+</item>
+<item historyLabel="KeyValueDao.java" index="1">
+<position info="not_deleted" x="1994" y="0"/>
 </item>
 <item historyLabel="TwitterUtil.java" index="0">
-<position info="not_deleted" x="1671" y="0"/>
+<position info="not_deleted" x="5667" y="0"/>
+</item>
+<item historyLabel="KeyValueDao.java" index="1">
+<position info="not_deleted" x="1893" y="0"/>
 </item>
 <item historyLabel="TwitterUtil.java" index="0">
-<position info="not_deleted" x="1710" y="0"/>
+<position info="not_deleted" x="5667" y="0"/>
+</item>
+<item historyLabel="KeyValueDao.java" index="1">
+<position info="not_deleted" x="1808" y="6"/>
+</item>
+<item historyLabel="KeyValueDao.java" index="1">
+<position info="not_deleted" x="1900" y="0"/>
+</item>
+<item historyLabel="KeyValueDao.java" index="1">
+<position info="not_deleted" x="1547" y="3"/>
+</item>
+<item historyLabel="KeyValueDao.java" index="1">
+<position info="not_deleted" x="1579" y="0"/>
+</item>
+<item historyLabel="KeyValueDao.java" index="1">
+<position info="not_deleted" x="1415" y="3"/>
 </item>
 <item active="true" historyLabel="TwitterUtil.java" index="0">
-<position info="not_deleted" x="1740" y="0"/>
+<position info="not_deleted" x="5667" y="0"/>
 </item>
 </navigationHistory>
 <input factoryID="org.eclipse.ui.internal.model.ResourceFactory" path="/" type="8"/>
 </trimLayout>
 </window>
 <mruList>
+<file factoryID="org.eclipse.ui.part.FileEditorInputFactory" id="org.eclipse.jdt.ui.CompilationUnitEditor" name="Debug.java" tooltip="TrainDelayBot/src/com/yuji/tdb/Debug.java">
+<persistable path="/TrainDelayBot/src/com/yuji/tdb/Debug.java"/>
+</file>
 <file factoryID="org.eclipse.ui.part.FileEditorInputFactory" id="org.eclipse.jdt.ui.CompilationUnitEditor" name="PMFactory.java" tooltip="TrainDelayBot/src/com/yuji/tdb/db/PMFactory.java">
 <persistable path="/TrainDelayBot/src/com/yuji/tdb/db/PMFactory.java"/>
 </file>
index 9815f69..b7b4273 100644 (file)
@@ -18,6 +18,7 @@ import twitter4j.conf.ConfigurationBuilder;
 \r
 import com.yuji.tdb.common.CommonUtil;\r
 import com.yuji.tdb.db.KeyValueDao;\r
+import com.yuji.tdb.debug.Debug;\r
 import com.yuji.tdb.twitter.TwitterUtil;\r
 \r
 @SuppressWarnings("serial")\r
@@ -53,7 +54,7 @@ public class TrainDelayBotServlet extends HttpServlet {
                        String consumerSecret = dao.get(KeyValueDao.KEY_CONSUMER_SECRET);\r
                        if (CommonUtil.isNull(consumerKey)\r
                                        || CommonUtil.isNull(consumerSecret)) {\r
-                               log.warning("001");\r
+                               log.warning("" + Debug.getLineNo());\r
                                return;\r
                        }\r
 \r
@@ -64,7 +65,7 @@ public class TrainDelayBotServlet extends HttpServlet {
 \r
                                if (CommonUtil.isNull(requestTokenKey)\r
                                                || CommonUtil.isNull(requestTokenSecret)) {\r
-                                       log.warning("003");\r
+                                       log.warning("" + Debug.getLineNo());\r
                                        return;\r
                                }\r
                                RequestToken requestToken = new RequestToken(requestTokenKey,\r
@@ -79,7 +80,7 @@ public class TrainDelayBotServlet extends HttpServlet {
                                        .get(KeyValueDao.KEY_ACCESS_TOKEN_SECRET);\r
                        if (CommonUtil.isNull(accessTokenKey)\r
                                        || CommonUtil.isNull(accessTokenSecret)) {\r
-                               log.warning("003");\r
+                               log.warning("" + Debug.getLineNo());\r
                                return;\r
                        }\r
 \r
index 96eb609..1d3da3c 100644 (file)
@@ -1,5 +1,6 @@
 package com.yuji.tdb.db;\r
 \r
+import javax.jdo.JDOObjectNotFoundException;\r
 import javax.jdo.PersistenceManager;\r
 \r
 public class KeyValueDao {\r
@@ -10,6 +11,10 @@ public class KeyValueDao {
        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
@@ -25,9 +30,13 @@ public class KeyValueDao {
        }\r
        \r
        public String get(String key){\r
-               KeyValue keyValue = pm.getObjectById(KeyValue.class, key);\r
-               if (keyValue == null){\r
-                       return null;\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
@@ -45,4 +54,22 @@ public class KeyValueDao {
        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
+                       return initValue;\r
+               }\r
+               return Integer.valueOf(value).intValue();\r
+       }\r
 }\r
diff --git a/workspace/TrainDelayBot/src/com/yuji/tdb/debug/Debug.java b/workspace/TrainDelayBot/src/com/yuji/tdb/debug/Debug.java
new file mode 100644 (file)
index 0000000..f25f86c
--- /dev/null
@@ -0,0 +1,9 @@
+package com.yuji.tdb.debug;
+
+public class Debug {
+       public static int getLineNo() {
+               StackTraceElement[] stackTrace = new Exception().getStackTrace();
+               StackTraceElement info = stackTrace[stackTrace.length - 2];
+               return info.getLineNumber();
+       }
+}
index 854280b..4454060 100644 (file)
@@ -5,7 +5,9 @@ import java.text.SimpleDateFormat;
 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
@@ -20,8 +22,10 @@ import twitter4j.auth.AccessToken;
 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
@@ -31,7 +35,11 @@ public class TwitterUtil {
        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
-\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
@@ -57,6 +65,17 @@ public class TwitterUtil {
 \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
@@ -70,7 +89,14 @@ public class TwitterUtil {
                Query query = new Query();\r
                //query.setRpp(1000); // TODO\r
                query.setQuery(train.getSearchWord());\r
-               QueryResult result = twitter.search(query);\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
@@ -80,6 +106,8 @@ public class TwitterUtil {
                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
@@ -92,7 +120,7 @@ public class TwitterUtil {
                        \r
                        String message = tweet.getText();\r
                        \r
-                       if (t < cur - 5 * 60 * 1000){\r
+                       if (t < cur - period * 60 * 1000){\r
                                System.out.println("\81~" + tweet.getFromUser() + " - "\r
                                                + tweet.getText() + at);\r
                                continue;\r
@@ -122,12 +150,24 @@ public class TwitterUtil {
                        int N = 100;\r
                        \r
                        String sample = tweets.get(mindex).getText();\r
-                       sample = CommonUtil.replaceString(sample, "@", "(a)");\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
-               Status status = twitter.updateStatus(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
@@ -147,8 +187,6 @@ public class TwitterUtil {
                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
@@ -168,4 +206,37 @@ public class TwitterUtil {
                }\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
index d0f3dc5..b232b89 100644 (file)
Binary files a/workspace/TrainDelayBot/war/WEB-INF/appengine-generated/local_db.bin and b/workspace/TrainDelayBot/war/WEB-INF/appengine-generated/local_db.bin differ