Mercurial > hg > fulltextIndexer
comparison src/de/mpiwg/dwinter/fulltextIndexer/harvester/CLI/OCRHarvesterCLIMD.java @ 0:dc7622afcfea default tip
initial
author | dwinter |
---|---|
date | Wed, 03 Nov 2010 12:33:16 +0100 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:dc7622afcfea |
---|---|
1 /* */ package de.mpiwg.dwinter.fulltextIndexer.harvester.CLI; | |
2 /* */ | |
3 /* */ import de.mpiwg.dwinter.fulltextIndexer.harvester.OCRHarvesterThreaded; | |
4 /* */ import java.io.File; | |
5 /* */ import java.io.IOException; | |
6 /* */ import java.io.PrintStream; | |
7 /* */ import org.apache.lucene.index.CorruptIndexException; | |
8 /* */ import org.apache.lucene.store.LockObtainFailedException; | |
9 /* */ | |
10 /* */ public class OCRHarvesterCLIMD | |
11 /* */ { | |
12 /* */ public static void main(String[] args) | |
13 /* */ throws CorruptIndexException, LockObtainFailedException, IOException, InterruptedException | |
14 /* */ { | |
15 /* 20 */ String usage = "java de.mpiwg.itgroup.fulltext.harvester.OCRHarvesterCLIMD <root_directory> <index_dir> <mdproviderUrl> --lang=<language>\njava de.mpiwg.itgroup.fulltext.harvester.OCRHarvesterCLIMD <root_directory> <index_dir> <mdproviderUrl>--langfile=<languageFile>\njava de.mpiwg.itgroup.fulltext.harvester.OCRHarvesterCLIMD <root_directory> <index_dir> <mdproviderUrl>"; | |
16 /* */ | |
17 /* 23 */ if ((args.length != 4) && (args.length != 3)) { | |
18 /* 24 */ System.err.println("Usage: " + usage); | |
19 /* 25 */ System.exit(1); | |
20 /* */ } | |
21 /* */ | |
22 /* 33 */ File docDir = new File(args[0]); | |
23 /* 34 */ if ((!docDir.exists()) || (!docDir.canRead())) { | |
24 /* 35 */ System.out.println("Document directory '" + docDir.getAbsolutePath() + "' does not exist or is not readable, please check the path"); | |
25 /* 36 */ System.exit(1); | |
26 /* */ } | |
27 /* */ | |
28 /* 39 */ File index_dir = new File(args[1]); | |
29 /* */ | |
30 /* 41 */ if (args.length == 3) { | |
31 /* 42 */ doTheHarvest(docDir, index_dir, args[2], null); | |
32 /* */ } | |
33 /* */ else { | |
34 /* 45 */ String[] options = args[3].split("="); | |
35 /* 46 */ if (options.length != 3) { | |
36 /* 47 */ System.err.println("wrong options:" + args[3]); | |
37 /* 48 */ System.exit(1); | |
38 /* */ } | |
39 /* */ | |
40 /* 51 */ if (options[0].equals("--lang")) { | |
41 /* 52 */ doTheHarvestLanguage(docDir, index_dir, args[2], options[1]); | |
42 /* 53 */ } else if (options[0].equals("--langfile")) { | |
43 /* 54 */ doTheHarvest(docDir, index_dir, args[2], options[1]); | |
44 /* */ } else { | |
45 /* 56 */ System.err.println("wrong options:" + options[0]); | |
46 /* 57 */ System.exit(1); | |
47 /* */ } | |
48 /* */ } | |
49 /* */ } | |
50 /* */ | |
51 /* */ protected static void doTheHarvestLanguage(File docDir, File index_dir, String mdProviderUrl, String lang) | |
52 /* */ throws CorruptIndexException, LockObtainFailedException, IOException, InterruptedException | |
53 /* */ { | |
54 /* 65 */ OCRHarvesterThreaded harvester = new OCRHarvesterThreaded(docDir, index_dir, null, mdProviderUrl, lang); | |
55 /* 66 */ harvester.harvestFolder(); | |
56 /* */ } | |
57 /* */ | |
58 /* */ protected static void doTheHarvest(File docDir, File index_dir, String mdProviderUrl, String languageFile) | |
59 /* */ throws CorruptIndexException, LockObtainFailedException, IOException, InterruptedException | |
60 /* */ { | |
61 /* 72 */ OCRHarvesterThreaded harvester = new OCRHarvesterThreaded(docDir, index_dir, languageFile, mdProviderUrl, null); | |
62 /* 73 */ harvester.harvestFolder(); | |
63 /* */ } | |
64 /* */ } | |
65 | |
66 /* Location: /private/tmp/fulltextIndexer.jar | |
67 * Qualified Name: de.mpiwg.dwinter.fulltextIndexer.harvester.CLI.OCRHarvesterCLIMD | |
68 * JD-Core Version: 0.5.4 | |
69 */ |