Ignore:
Timestamp:
2004-10-12T12:19:22+13:00 (20 years ago)
Author:
kjdon
Message:

some mods, not sure what they are. will tidy them up soon, but didn't want to leave the package uncompilable so committing this now

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/greenstone3-extensions/vishnu/src/vishnu/builder/Indexer.java

    r8189 r8290  
    11package vishnu.builder;
    22
     3import java.io.File;
    34abstract public class Indexer
    45{
    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;
    620    String outputDir = null;
    721    String inputDir = null;
    822    String collName = null;
    9     //String GSDL3_HOME = null;
    10    
     23
    1124    public Indexer(String n)
    1225    {
     
    1528   
    1629   
    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)
    1835//     {
    19 //  GSDL3_HOME = root;
    20 //     }
    21 
    22 
     36//  type = t;
     37//     }   
    2338    public void setOutputDirectory(String s)
    2439    {
     
    2641    }
    2742   
     43//     public void setLimiter(String s)
     44//     {
     45//         limiter = s;
     46//     }
    2847   
    2948    public void setInputDirectory(String s)
     
    3857    }
    3958
     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   
    4088    abstract public void startIndexing();
    4189}
Note: See TracChangeset for help on using the changeset viewer.