Changeset 18663

Show
Ignore:
Timestamp:
11.03.2009 13:56:28 (10 years ago)
Author:
kjdon
Message:

we now use gdb all the time internally for database extension. In the open database method, if gdb not there check for ldb/bdb for legacy collections

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • greenstone3/trunk/src/java/org/greenstone/gsdl3/util/GDBMWrapper.java

    r17907 r18663  
    6666    // The java version of the C++ code in common-src/src/lib/gdbmclass.cpp 
    6767    if(mode == GdbmFile.READER) { 
    68         // Looking to read in the database 
    69         // => check to see if .ldb/.bdb file already there 
    70         // if not (first time) then generate using txt2db 
     68      // Looking to read in the database 
     69      // we now use gdb extension. Check for ldb/bdb in case of legacy collection 
     70      // if not (first time) then generate using txt2db 
    7171        if (!new File(filename).exists()) { 
    72         logger.warn("Database file " + filename + " does not exist. Looking for txtgz version of db file."); 
     72          logger.warn("Database file " + filename + " does not exist. Looking for ldb/bdb version"); 
     73          int extension = filename.lastIndexOf('.'); 
     74          String filename_head = filename.substring(0, extension); 
     75          filename = filename_head + ".ldb"; 
     76          if (!new File(filename).exists()) { 
     77        filename = filename_head + ".bdb"; 
    7378         
     79        if (!new File(filename).exists()) { 
     80        logger.warn("ldb/bdb version of database file " + filename + " does not exist. Looking for txtgz version of db file."); 
     81        // put the filename back to gdb 
     82        filename = filename_head + ".gdb"; 
    7483        // need to generate architecture native GDBM file using txt2db 
    7584         
    7685        // replace sought after gdbm filename ext with ".txt.gz" 
    7786         
    78         int extension = filename.lastIndexOf('.'); 
    79         String txtgzFilename = filename.substring(0, extension) + ".txt.gz"; 
     87        String txtgzFilename = filename_head + ".txt.gz"; 
    8088        if(new File(txtgzFilename).exists()) {           
    8189            // Test to make sure Perl is on the path 
     
    103111            }            
    104112        } 
     113        } 
     114          } 
     115           
    105116        } 
    106117    }