- Timestamp:
- 2004-10-12T12:19:22+13:00 (20 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/greenstone3-extensions/vishnu/src/vishnu/builder/Indexer.java
r8189 r8290 1 1 package vishnu.builder; 2 2 3 import java.io.File; 3 4 abstract public class Indexer 4 5 { 5 String name; 6 7 // views stuff 8 // public static final int DEFAULT = 0; 9 // public static final int DIP = 1; 10 // public static final int REG = 2; 11 // public static final int LEM = 3; 12 // public static final int SYN = 4; 13 14 // public static final String[] types = new String[]{"full","dip","reg","lem","syn"}; 15 16 // boolean use_views = false; 17 // int type = -1; 18 String name = null; 19 //String limiter = null; 6 20 String outputDir = null; 7 21 String inputDir = null; 8 22 String collName = null; 9 //String GSDL3_HOME = null; 10 23 11 24 public Indexer(String n) 12 25 { … … 15 28 16 29 17 // public void setRootDirectory(String root) 30 // public void setUseViews(boolean use_v) { 31 // use_views = use_v; 32 // } 33 34 // public void setIndexingType(int t) 18 35 // { 19 // GSDL3_HOME = root; 20 // } 21 22 36 // type = t; 37 // } 23 38 public void setOutputDirectory(String s) 24 39 { … … 26 41 } 27 42 43 // public void setLimiter(String s) 44 // { 45 // limiter = s; 46 // } 28 47 29 48 public void setInputDirectory(String s) … … 38 57 } 39 58 59 // this should be called at the start of startIndexing() 60 protected void initialize() { 61 62 if( inputDir == null || outputDir == null ){ 63 System.err.println("Input dir or output dir is null"); 64 System.exit(0); 65 } 66 67 /* check if index dir exists */ 68 File in = new File(inputDir); 69 if (!in.isDirectory()) { 70 System.err.println("input directory ("+inputDir+") not a directory, exiting..."); 71 System.exit(0); 72 } 73 74 /**** check if output directory exists, if not create it ****/ 75 File f = new File(outputDir); 76 if( !f.exists() ){ 77 try { 78 f.mkdirs(); 79 } catch (Exception e) { 80 System.err.println("Couldn't create output directory "+outputDir); 81 System.err.println(e); 82 System.exit(0); 83 } 84 } 85 86 } 87 40 88 abstract public void startIndexing(); 41 89 }
Note:
See TracChangeset
for help on using the changeset viewer.