Changeset 10651


Ignore:
Timestamp:
2005-09-26T17:07:05+12:00 (19 years ago)
Author:
kjdon
Message:

made all index/gdbm db paths use indexstem instead of cluster_name

Location:
trunk/gsdl3/src/java/org/greenstone/gsdl3/service
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/gsdl3/src/java/org/greenstone/gsdl3/service/AbstractGS2DocumentRetrieve.java

    r10334 r10651  
    5252    extends AbstractDocumentRetrieve {
    5353
    54      protected static final String INDEX_STEM_ELEM = "indexStem";
    55 
    5654    //    protected static final String EXTLINK_PARAM = "ext"; here or in base??   
    5755    protected String index_stem = null;
     
    8078    System.out.println("Configuring AbstractGS2DocumentRetrieve...");
    8179    //this.config_info = info;
     80   
     81    // the index stem is either specified in the config file or is  the collection name
     82    Element index_stem_elem = (Element) GSXML.getChildByTagName(info, GSXML.INDEX_STEM_ELEM);
     83    if (index_stem_elem != null) {
     84        this.index_stem = index_stem_elem.getAttribute(GSXML.NAME_ATT);
     85    }
     86    if (this.index_stem == null || this.index_stem.equals("")) {
     87        System.err.println("AbstractGS2DocumentRetrieve.configure(): indexStem element not found, stem will default to collection name");
     88        this.index_stem = this.cluster_name;
     89    }
    8290
    8391    // Open GDBM database for querying
    84     String gdbm_db_file = GSFile.GDBMDatabaseFile(this.site_home, this.cluster_name);
     92    String gdbm_db_file = GSFile.GDBMDatabaseFile(this.site_home, this.cluster_name, this.index_stem);
    8593    if (!this.gdbm_src.openDatabase(gdbm_db_file, GDBMWrapper.READER)) {
    8694        System.err.println("AbstractGS2DocumentRetrieve Error: Could not open GDBM database!");
    8795        return false;
    8896    }
    89    
    90     // the index stem is either specified in the config file or is  the collection name
    91     Element index_stem_elem = (Element) GSXML.getChildByTagName(info, INDEX_STEM_ELEM);
    92     if (index_stem_elem != null) {
    93         this.index_stem = index_stem_elem.getAttribute(GSXML.NAME_ATT);
    94     }
    95     if (this.index_stem == null || this.index_stem.equals("")) {
    96         System.err.println("AbstractGS2DocumentRetrieve.configure(): indexStem element not found, stem will default to collection name");
    97         this.index_stem = this.cluster_name;
    98     }
     97
    9998    return true;
    10099    }
  • trunk/gsdl3/src/java/org/greenstone/gsdl3/service/AbstractMGPPSearch.java

    r9966 r10651  
    9191    private static final int ADVANCED_QUERY = 2;
    9292
    93     protected static final String INDEX_STEM_ELEM = "indexStem";
    9493    protected static final String FIELD_ATT = "field";
    9594    private MGPPWrapper mgpp_src=null;
     
    135134   
    136135    // the index stem is either specified in the config file or is "index"
    137     Element index_stem_elem = (Element) GSXML.getChildByTagName(info, INDEX_STEM_ELEM);
     136    Element index_stem_elem = (Element) GSXML.getChildByTagName(info, GSXML.INDEX_STEM_ELEM);
    138137    if (index_stem_elem != null) {
    139138        this.index_stem = index_stem_elem.getAttribute(GSXML.NAME_ATT);
  • trunk/gsdl3/src/java/org/greenstone/gsdl3/service/GS2Browse.java

    r10093 r10651  
    6868
    6969    System.err.println("Configuring GS2Browse...");
     70    // the index stem is either specified in the config file or is  the collection name
     71    Element index_stem_elem = (Element) GSXML.getChildByTagName(info, GSXML.INDEX_STEM_ELEM);
     72    String index_stem = null;
     73    if (index_stem_elem != null) {
     74        index_stem = index_stem_elem.getAttribute(GSXML.NAME_ATT);
     75    }
     76    if (index_stem == null || index_stem.equals("")) {
     77        index_stem = this.cluster_name;
     78    }
     79   
    7080    // Open GDBM database for querying
    71     String gdbm_db_file = GSFile.GDBMDatabaseFile(this.site_home, this.cluster_name);
     81    String gdbm_db_file = GSFile.GDBMDatabaseFile(this.site_home, this.cluster_name, index_stem);
    7282    if (!this.gdbm_src.openDatabase(gdbm_db_file, GDBMWrapper.READER)) {
    7383        System.err.println("GS2Browse Error: Could not open GDBM database!");
  • trunk/gsdl3/src/java/org/greenstone/gsdl3/service/GS2MGPPRetrieve.java

    r10093 r10651  
    7878    // The location of the MGPP text files
    7979    mgpp_textdir = GSFile.collectionBaseDir(this.site_home, this.cluster_name) +
    80         File.separatorChar + GSFile.collectionTextPath(this.cluster_name);
     80        File.separatorChar + GSFile.collectionTextPath(this.index_stem);
    8181
    8282    // Do generic configuration
  • trunk/gsdl3/src/java/org/greenstone/gsdl3/service/GS2MGPPSearch.java

    r10093 r10651  
    3737{
    3838    protected GDBMWrapper gdbm_src = null;
     39    protected String index_stem = null;
    3940
    4041    /** constructor */
     
    5758
    5859        // Open GDBM database for querying
    59     String gdbm_db_file = GSFile.GDBMDatabaseFile(this.site_home, this.cluster_name);
     60    String gdbm_db_file = GSFile.GDBMDatabaseFile(this.site_home, this.cluster_name, this.index_stem);
    6061    if (!this.gdbm_src.openDatabase(gdbm_db_file, GDBMWrapper.READER)) {
    6162        System.err.println("Error: Could not open GDBM database!");
  • trunk/gsdl3/src/java/org/greenstone/gsdl3/service/GS2MGRetrieve.java

    r10093 r10651  
    7777    // The location of the MG index and text files
    7878    mg_basedir = GSFile.collectionBaseDir(this.site_home, this.cluster_name) + File.separatorChar;  // Needed by MG
    79     mg_textdir = GSFile.collectionTextPath(this.cluster_name);
     79    mg_textdir = GSFile.collectionTextPath(this.index_stem);
    8080    // index is only needed to start up MG, not used so just use the default index
    81     String indexpath = GSFile.collectionIndexPath(this.cluster_name, this.default_index);
     81    String indexpath = GSFile.collectionIndexPath(this.index_stem, this.default_index);
    8282    this.mg_src.setIndex(indexpath);
    8383
  • trunk/gsdl3/src/java/org/greenstone/gsdl3/service/GS2MGSearch.java

    r10093 r10651  
    5656
    5757        // Open GDBM database for querying
    58     String gdbm_db_file = GSFile.GDBMDatabaseFile(this.site_home, this.cluster_name);
     58    String gdbm_db_file = GSFile.GDBMDatabaseFile(this.site_home, this.cluster_name, this.index_stem);
    5959    if (!this.gdbm_src.openDatabase(gdbm_db_file, GDBMWrapper.READER)) {
    6060        System.err.println("Error: Could not open GDBM database!");
Note: See TracChangeset for help on using the changeset viewer.