public class DatabaseStatusFeeder extends Object implements StatusFeeder
The class connects to the database lazily (that is, only when the feed is
started), so the driver can be changed after construction using
setDriver(String).
The schema of the table must include at least two columns: one that contains
the tweet text and one that contains the created time. The default column
names are expected to be text and created_at
respectively. These can be changed by passing in a map, where the key is the
expected column name and the value is the actual column name; e.g.
text -> tweet_text
The results are paged through in steps of 25 by default, so the database must
support the LIMIT command.
| Modifier and Type | Class and Description |
|---|---|
protected static class |
DatabaseStatusFeeder.DatabaseFeederStatus |
| Constructor and Description |
|---|
DatabaseStatusFeeder(String databaseURL,
String table,
String username,
String password)
Create a database status feeder using the database, table, username and
password provided.
|
DatabaseStatusFeeder(String databaseURL,
String table,
String username,
String password,
Map<String,String> columnNames)
Create a database status feeder using the database, table, username and
password provided with the given column mapping
|
| Modifier and Type | Method and Description |
|---|---|
void |
feedStatus(PicSlurper slurper)
Start feeding statuses to the provided picslurper.
|
static void |
main(String[] args) |
void |
setDriver(String driverName)
Set the database driver to use.
|
public DatabaseStatusFeeder(String databaseURL, String table, String username, String password)
databaseURL - The URL to the databasetable - The table to useusername - The user namepassword - The passwordpublic DatabaseStatusFeeder(String databaseURL, String table, String username, String password, Map<String,String> columnNames)
databaseURL - The URL to the databasetable - The table to useusername - The user namepassword - The passwordcolumnNames - The column mappingpublic void feedStatus(PicSlurper slurper) throws IOException
feedStatus in interface StatusFeederIOExceptionStatusFeeder.feedStatus(org.openimaj.picslurper.PicSlurper)public void setDriver(String driverName)
driverName - The driver name.