1.1 --- a/src/main/java/cz/xelfi/feedbook/Main.java Wed Nov 10 17:48:58 2010 +0100
1.2 +++ b/src/main/java/cz/xelfi/feedbook/Main.java Wed Nov 10 23:23:46 2010 +0100
1.3 @@ -15,8 +15,9 @@
1.4 import org.xml.sax.InputSource;
1.5
1.6 public class Main {
1.7 - private static final String APP_KEY = "ecdbd5dbacc168f9edfe470ccd7e401b";
1.8 - private static final String APP_SEC = "22e3165366e958a6e049e1e0c1d30105";
1.9 + private static String APP_KEY;
1.10 + private static String APP_SEC;
1.11 + private static String APP_FEED;
1.12
1.13
1.14 private static String login() throws IOException, FacebookException, URISyntaxException {
1.15 @@ -40,11 +41,32 @@
1.16 }
1.17
1.18 public static void main( String[] args) throws Exception {
1.19 + Preferences prefs = Preferences.userNodeForPackage(Main.class);
1.20 + if (args.length == 3) {
1.21 + prefs.put("id", args[0]);
1.22 + prefs.put("secret", args[1]);
1.23 + prefs.put("feed", args[2]);
1.24 + } else {
1.25 + if (args.length != 0) {
1.26 + usage();
1.27 + return;
1.28 + }
1.29 + }
1.30 +
1.31 +
1.32 + APP_KEY = prefs.get("id", null);
1.33 + APP_SEC = prefs.get("secret", null);
1.34 + APP_FEED = prefs.get("feed", null);
1.35 +
1.36 + if (APP_FEED == null || APP_SEC == null || APP_KEY == null) {
1.37 + usage();
1.38 + return;
1.39 + }
1.40 +
1.41 WireFeedInput rssInput = new WireFeedInput();
1.42 - URL rssUrl = new URL("http://blogs.apidesign.org/rss/");
1.43 + URL rssUrl = new URL(APP_FEED);
1.44 Channel rss = (Channel)rssInput.build(new InputSource(rssUrl.openStream()));;
1.45
1.46 - Preferences prefs = Preferences.userNodeForPackage(Main.class);
1.47
1.48 FacebookJaxbRestClient fb;
1.49 Long user;
1.50 @@ -90,4 +112,11 @@
1.51 }
1.52 System.out.println("Published " + cnt + " feed item(s)");
1.53 }
1.54 +
1.55 + private static void usage() {
1.56 + System.out.println("Invoke with three parameters: "
1.57 + + "<facebook_app_key> "
1.58 + + "<facebook_app_secret "
1.59 + + "<rss_feed_url>");
1.60 + }
1.61 }