summaryrefslogtreecommitdiff
path: root/src/main/Main.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/Main.java')
-rw-r--r--src/main/Main.java13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/main/Main.java b/src/main/Main.java
index 5338003..f85c5df 100644
--- a/src/main/Main.java
+++ b/src/main/Main.java
@@ -79,6 +79,7 @@ public class Main implements Callable<Boolean> {
*/
private boolean skipDb;
private Integer statusInterval;
+ private int category;
public Main(String[] args) {
// default connection properties
@@ -89,9 +90,14 @@ public class Main implements Callable<Boolean> {
.setDbName("twitter");
skipDb = false;
statusInterval = 2;
-
+ category = 0;
+
/* parse the global options. */
parseGlobalOptions(args);
+
+ if (category == 0) {
+ throw new IllegalArgumentException("Please provide the --cat CATEGORY option.");
+ }
}
/**
@@ -115,7 +121,7 @@ public class Main implements Callable<Boolean> {
try (Connection connection = cb.create()) {
System.err.println("Connected, starting to read tweets.");
/* create the object that fills the database */
- DataFiller filler = new DataFiller(connection);
+ DataFiller filler = new DataFiller(connection, category);
while ((tweet = reader.getTweet()) != null) {
filler.processTweet(tweet);
++tweetNo;
@@ -196,6 +202,8 @@ public class Main implements Callable<Boolean> {
skipDb = true;
} else if ("--status".equals(args[i])) {
statusInterval = Integer.valueOf(getArg(args, ++i, "--status"));
+ } else if ("--cat".equals(args[i])) {
+ category = Integer.valueOf(getArg(args, ++i, "--cat"));
} else if (args[i].startsWith("-")) {
throw new IllegalArgumentException("Invalid option: " + args[i]);
} else {
@@ -238,6 +246,7 @@ public class Main implements Callable<Boolean> {
" --skipdb Do not contact the database at all, just print data.",
" --status SECS The interval in which import status information",
" should be printed, zero disables it (defaults to 2)",
+ " --cat CATEGORY Set the category of filled tweets",
"",
"If no tweets file is given, data will be read from standard input."
};