Changeset 8290 for trunk/gsdl3
- Timestamp:
- 2004-10-12T12:19:22+13:00 (20 years ago)
- Location:
- trunk/gsdl3
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gsdl3/extensions/vishnu/src/vishnu/builder/CollectionBuilder.java
r8189 r8290 12 12 String collDesc; 13 13 String indexer; 14 boolean use_views; 14 15 long numDocs=0; 15 16 16 17 private static void usage() 17 18 { 18 System.out.println("java vishnu.builder.CollectionBuilder\n -collsHome (directory where collections live) \n -collection (directory name of collection)\n -name (descriptive name for collection) \n -description (collection description)\n -index (\"mg\" or \"luc\") ");19 System.out.println("java vishnu.builder.CollectionBuilder\n -collsHome (directory where collections live) \n -collection (directory name of collection)\n -name (descriptive name for collection) \n -description (collection description)\n -index (\"mg\" or \"luc\")\n [-use_views]"); 19 20 } 20 21 … … 32 33 String collDesc = ""; 33 34 String indexer = null; 34 35 boolean use_views = false; 35 36 int a = 0; 36 37 while( a < args.length ){ … … 47 48 else if( args[a].equals("-index") ) 48 49 indexer = args[++a]; 50 else if (args[a].equals("-use_views")) 51 use_views = true; 49 52 a++; 50 53 } … … 66 69 String coll_home = collsHome + collID + File.separator; 67 70 //CollectionBuilder cb = new CollectionBuilder(site,collName,gHome,indexer); 68 CollectionBuilder cb = new CollectionBuilder(coll_home,collID, collName,collDesc, indexer );69 } 70 71 72 73 public CollectionBuilder(String coll_home, String coll_id, String coll_name,String coll_desc, String ind )71 CollectionBuilder cb = new CollectionBuilder(coll_home,collID, collName,collDesc, indexer, use_views); 72 } 73 74 75 76 public CollectionBuilder(String coll_home, String coll_id, String coll_name,String coll_desc, String ind, boolean use_views) 74 77 { 75 78 this.collHome = coll_home; … … 78 81 this.collDesc = coll_desc; 79 82 this.indexer = ind; 80 83 this.use_views = use_views; 84 81 85 if (!setupCollection()) { 82 86 System.err.println("Couldn't setup the collection. Quitting build"); … … 144 148 buffer.append("\" />"); 145 149 150 // add in views 151 if (use_views) { 152 153 } 146 154 out.print(buffer.toString()); 147 155 out.close(); … … 185 193 private void CKIndexing() 186 194 { 187 CKWrapper ckw = new CKWrapper();188 195 //CKWrapper ckw = new CKWrapper(); 196 CKIndexer cki = new CKIndexer(); 189 197 String in = collHome + "import"+File.separator; 190 198 String out = collHome + "building"+File.separator+"ck_index"+File.separator; 191 199 192 ck w.setCollectionName(collID);193 ck w.setOutputDirectory(out);194 ck w.setInputDirectory(in);195 ck w.startIndexing();200 cki.setCollectionName(collID); 201 cki.setOutputDirectory(out); 202 cki.setInputDirectory(in); 203 cki.startIndexing(); 196 204 } 197 205 -
trunk/gsdl3/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 } -
trunk/gsdl3/extensions/vishnu/src/vishnu/builder/IndexerGUI.java
r8189 r8290 6 6 import javax.swing.SpringLayout; 7 7 import java.io.File; 8 import vishnu.util.SpringUtilities; 8 9 9 10 public class IndexerGUI { … … 100 101 101 102 //CollectionBuilder builder = new CollectionBuilder(dir,name,home,indexer); 102 CollectionBuilder builder = new CollectionBuilder(coll_home, coll_id, coll_name, coll_desc, indexer );103 CollectionBuilder builder = new CollectionBuilder(coll_home, coll_id, coll_name, coll_desc, indexer, false); // no views for now - change this 103 104 output += "\n Indexing Finished"; 104 105 ja.setText(output); -
trunk/gsdl3/extensions/vishnu/src/vishnu/builder/LuceneWrapper.java
r8189 r8290 64 64 65 65 public void startIndexing() { 66 67 if( inputDir == null || outputDir == null ){ 68 usage(); 69 System.exit(0); 70 } 71 72 /* check if index dir exists */ 73 File in = new File(inputDir); 74 if (!in.isDirectory()) { 75 System.err.println("input directory ("+inputDir+") not a directory, exiting..."); 76 System.exit(0); 77 } 78 79 /**** check if output directory exists, if not create it ****/ 80 File f = new File(outputDir); 81 if( !f.exists() ){ 82 try { 83 f.mkdirs(); 84 } catch (Exception e) { 85 System.err.println("Couldn't create output directory "+outputDir); 86 System.err.println(e); 87 System.exit(0); 88 } 89 } 66 initialize(); 90 67 try { 91 68 IndexWriter writer = new IndexWriter(outputDir, new StandardAnalyzer(), true); 92 69 // this is a bit of a hack putting import here 93 indexFiles(writer, in, "import/");70 indexFiles(writer, new File(inputDir), "import/"); 94 71 writer.optimize(); 95 72 writer.close(); -
trunk/gsdl3/extensions/vishnu/src/vishnu/builder/MGWrapper.java
r8189 r8290 64 64 { 65 65 66 if( inputDir == null || outputDir == null ){ 67 usage(); 68 System.exit(0); 69 } 70 71 72 /* check if index dir exists */ 73 File in = new File(inputDir); 74 if (!in.isDirectory()) { 75 System.err.println("input directory ("+inputDir+") not a directory, exiting..."); 76 System.exit(0); 77 } 78 79 /**** check if output directory exist, if not create it ****/ 80 81 File f = new File(outputDir); 82 if( !f.exists() ){ 83 try { 84 f.mkdirs(); 85 } catch (Exception e) { 86 System.err.println("Couldn't create output directory "+outputDir); 87 System.err.println(e); 88 System.exit(0); 89 } 90 } 91 66 initialize(); 92 67 // new mg requires a .mg_getrc to work 93 68 // lets put it in the output dir 94 File rc_file = new File( f, ".mg_getrc");69 File rc_file = new File(outputDir, ".mg_getrc"); 95 70 if (!rc_file.exists()) { 96 71 // if its there, assume it is correct -
trunk/gsdl3/packages/vishnu/src/vishnu/builder/CollectionBuilder.java
r8189 r8290 12 12 String collDesc; 13 13 String indexer; 14 boolean use_views; 14 15 long numDocs=0; 15 16 16 17 private static void usage() 17 18 { 18 System.out.println("java vishnu.builder.CollectionBuilder\n -collsHome (directory where collections live) \n -collection (directory name of collection)\n -name (descriptive name for collection) \n -description (collection description)\n -index (\"mg\" or \"luc\") ");19 System.out.println("java vishnu.builder.CollectionBuilder\n -collsHome (directory where collections live) \n -collection (directory name of collection)\n -name (descriptive name for collection) \n -description (collection description)\n -index (\"mg\" or \"luc\")\n [-use_views]"); 19 20 } 20 21 … … 32 33 String collDesc = ""; 33 34 String indexer = null; 34 35 boolean use_views = false; 35 36 int a = 0; 36 37 while( a < args.length ){ … … 47 48 else if( args[a].equals("-index") ) 48 49 indexer = args[++a]; 50 else if (args[a].equals("-use_views")) 51 use_views = true; 49 52 a++; 50 53 } … … 66 69 String coll_home = collsHome + collID + File.separator; 67 70 //CollectionBuilder cb = new CollectionBuilder(site,collName,gHome,indexer); 68 CollectionBuilder cb = new CollectionBuilder(coll_home,collID, collName,collDesc, indexer );69 } 70 71 72 73 public CollectionBuilder(String coll_home, String coll_id, String coll_name,String coll_desc, String ind )71 CollectionBuilder cb = new CollectionBuilder(coll_home,collID, collName,collDesc, indexer, use_views); 72 } 73 74 75 76 public CollectionBuilder(String coll_home, String coll_id, String coll_name,String coll_desc, String ind, boolean use_views) 74 77 { 75 78 this.collHome = coll_home; … … 78 81 this.collDesc = coll_desc; 79 82 this.indexer = ind; 80 83 this.use_views = use_views; 84 81 85 if (!setupCollection()) { 82 86 System.err.println("Couldn't setup the collection. Quitting build"); … … 144 148 buffer.append("\" />"); 145 149 150 // add in views 151 if (use_views) { 152 153 } 146 154 out.print(buffer.toString()); 147 155 out.close(); … … 185 193 private void CKIndexing() 186 194 { 187 CKWrapper ckw = new CKWrapper();188 195 //CKWrapper ckw = new CKWrapper(); 196 CKIndexer cki = new CKIndexer(); 189 197 String in = collHome + "import"+File.separator; 190 198 String out = collHome + "building"+File.separator+"ck_index"+File.separator; 191 199 192 ck w.setCollectionName(collID);193 ck w.setOutputDirectory(out);194 ck w.setInputDirectory(in);195 ck w.startIndexing();200 cki.setCollectionName(collID); 201 cki.setOutputDirectory(out); 202 cki.setInputDirectory(in); 203 cki.startIndexing(); 196 204 } 197 205 -
trunk/gsdl3/packages/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 } -
trunk/gsdl3/packages/vishnu/src/vishnu/builder/IndexerGUI.java
r8189 r8290 6 6 import javax.swing.SpringLayout; 7 7 import java.io.File; 8 import vishnu.util.SpringUtilities; 8 9 9 10 public class IndexerGUI { … … 100 101 101 102 //CollectionBuilder builder = new CollectionBuilder(dir,name,home,indexer); 102 CollectionBuilder builder = new CollectionBuilder(coll_home, coll_id, coll_name, coll_desc, indexer );103 CollectionBuilder builder = new CollectionBuilder(coll_home, coll_id, coll_name, coll_desc, indexer, false); // no views for now - change this 103 104 output += "\n Indexing Finished"; 104 105 ja.setText(output); -
trunk/gsdl3/packages/vishnu/src/vishnu/builder/LuceneWrapper.java
r8189 r8290 64 64 65 65 public void startIndexing() { 66 67 if( inputDir == null || outputDir == null ){ 68 usage(); 69 System.exit(0); 70 } 71 72 /* check if index dir exists */ 73 File in = new File(inputDir); 74 if (!in.isDirectory()) { 75 System.err.println("input directory ("+inputDir+") not a directory, exiting..."); 76 System.exit(0); 77 } 78 79 /**** check if output directory exists, if not create it ****/ 80 File f = new File(outputDir); 81 if( !f.exists() ){ 82 try { 83 f.mkdirs(); 84 } catch (Exception e) { 85 System.err.println("Couldn't create output directory "+outputDir); 86 System.err.println(e); 87 System.exit(0); 88 } 89 } 66 initialize(); 90 67 try { 91 68 IndexWriter writer = new IndexWriter(outputDir, new StandardAnalyzer(), true); 92 69 // this is a bit of a hack putting import here 93 indexFiles(writer, in, "import/");70 indexFiles(writer, new File(inputDir), "import/"); 94 71 writer.optimize(); 95 72 writer.close(); -
trunk/gsdl3/packages/vishnu/src/vishnu/builder/MGWrapper.java
r8189 r8290 64 64 { 65 65 66 if( inputDir == null || outputDir == null ){ 67 usage(); 68 System.exit(0); 69 } 70 71 72 /* check if index dir exists */ 73 File in = new File(inputDir); 74 if (!in.isDirectory()) { 75 System.err.println("input directory ("+inputDir+") not a directory, exiting..."); 76 System.exit(0); 77 } 78 79 /**** check if output directory exist, if not create it ****/ 80 81 File f = new File(outputDir); 82 if( !f.exists() ){ 83 try { 84 f.mkdirs(); 85 } catch (Exception e) { 86 System.err.println("Couldn't create output directory "+outputDir); 87 System.err.println(e); 88 System.exit(0); 89 } 90 } 91 66 initialize(); 92 67 // new mg requires a .mg_getrc to work 93 68 // lets put it in the output dir 94 File rc_file = new File( f, ".mg_getrc");69 File rc_file = new File(outputDir, ".mg_getrc"); 95 70 if (!rc_file.exists()) { 96 71 // if its there, assume it is correct
Note:
See TracChangeset
for help on using the changeset viewer.