1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package org.christianschenk.bibsonomy.export;
20
21 import org.christianschenk.bibsonomy.export.delicious.DeliciousExportFormatWriter;
22 import org.christianschenk.bibsonomy.export.delicious.DeliciousImporter;
23
24 public class Runner {
25
26 public static void main(final String[] args) {
27 if (args.length == 0 || (args.length == 1 && "--help".equals(args[0]))) {
28 System.out.println(getUsage());
29 System.out.println("\nThis software uses the del.icio.us Java API Copyright (c) 2004-2007, David A. Czarnecki");
30 System.exit(0);
31 }
32 if (args.length != 2 && args.length != 4) {
33 System.out.println(getUsage());
34 System.exit(1);
35 }
36
37 switch (args.length) {
38 case 2:
39 new DeliciousExportFormatWriter(args[0], args[1]).doExport();
40 break;
41 case 4:
42 new DeliciousImporter(args[0], args[1], args[2], args[3]).doImport();
43 break;
44 default:
45 throw new RuntimeException("Something has gone wrong");
46 }
47 }
48
49 private static String getUsage() {
50 return "Usage:\n" + " import: [bibsonomy-username] [bibsonomy-api-key] [delicious-username] [delicious-password]\n" + " export: [bibsonomy-username] [bibsonomy-api-key]\n" + "Example:\n" + " export: java -jar <jar-file> <your-bibsonomy-username> <your-bibsonomy-apikey>";
51 }
52 }