Changeset 15710

Show
Ignore:
Timestamp:
27.05.2008 12:06:29 (11 years ago)
Author:
mdewsnip
Message:

(Adding new DB support) Adding new get_infodb_file_path() function to dbutil to abstract away the GDBM endian stuff, and changed basebuilder::make_infodatabase() to use it.

Location:
gsdl/trunk/perllib
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • gsdl/trunk/perllib/basebuilder.pm

    r15709 r15710  
    320320    &util::mk_all_dir ($assocdir); 
    321321 
    322     # get db name 
    323     my $dbext = ".bdb"; 
    324     $dbext = ".ldb" if &util::is_little_endian(); 
    325     my $dbname = &util::get_dirsep_tail($self->{'collection'}).$dbext; 
    326     my $fulldbname = &util::filename_cat ($textdir, $dbname); 
    327     $fulldbname =~ s/\//\\/g if ($ENV{'GSDLOS'} =~ /^windows$/i); 
    328  
    329     my $exedir = "$ENV{'GSDLHOME'}/bin/$ENV{'GSDLOS'}"; 
    330     my $exe = &util::get_os_exe (); 
    331     my $txt2db_exe = &util::filename_cat($exedir, "txt2db$exe"); 
     322    # Get info database file path 
     323    my $infodb_file_path = &dbutil::get_infodb_file_path($self->{'collection'}, $textdir); 
    332324 
    333325    print $outhandle "\n*** creating the info database and processing associated files\n"  
     
    338330    &classify::init_classifiers ($self->{'classifiers'}); 
    339331 
    340  
    341332    my $reconstructed_docs = undef; 
    342333    if ($self->{'keepold'}) { 
    343334    # reconstruct doc_obj metadata from database for all docs 
    344     $reconstructed_docs = &classify::reconstruct_doc_objs_metadata($fulldbname); 
     335    $reconstructed_docs = &classify::reconstruct_doc_objs_metadata($infodb_file_path); 
    345336    } 
    346337     
     
    349340    if ($self->{'debug'}) { 
    350341    $infodb_handle = *STDOUT; 
    351     } else { 
    352     if (!-e "$txt2db_exe" || !open (PIPEOUT, "| txt2db$exe \"$fulldbname\"")) { 
     342    } 
     343    else { 
     344    my $exedir = "$ENV{'GSDLHOME'}/bin/$ENV{'GSDLOS'}"; 
     345    my $exe = &util::get_os_exe (); 
     346    my $txt2db_exe = &util::filename_cat($exedir, "txt2db$exe"); 
     347 
     348    if (!-e "$txt2db_exe" || !open (PIPEOUT, "| txt2db$exe \"$infodb_file_path\"")) { 
    353349        print STDERR "<FatalError name='NoRunText2DB'/>\n</Stage>\n" if $self->{'gli'}; 
    354350        die "builder::make_infodatabase - couldn't run $txt2db_exe\n"; 
  • gsdl/trunk/perllib/dbutil.pm

    r15705 r15710  
    2929 
    3030 
     31sub get_infodb_file_path 
     32{ 
     33    my $collection_name = shift(@_); 
     34    my $infodb_directory_path = shift(@_); 
     35 
     36    return &get_infodb_file_path_gdbm($collection_name, $infodb_directory_path); 
     37} 
     38 
     39 
    3140sub read_infodb_file 
    3241{ 
     
    5261#   GDBM FUNCTIONS 
    5362# ---------------------------------------------------------------------------------------- 
     63 
     64sub get_infodb_file_path_gdbm 
     65{ 
     66    my $collection_name = shift(@_); 
     67    my $infodb_directory_path = shift(@_); 
     68 
     69    my $infodb_file_extension = (&util::is_little_endian() ? ".ldb" : ".bdb"); 
     70    my $infodb_file_name = &util::get_dirsep_tail($collection_name) . $infodb_file_extension; 
     71    return &util::filename_cat($infodb_directory_path, $infodb_file_name); 
     72} 
     73 
    5474 
    5575sub read_infodb_file_gdbm