Changeset 21646

Show
Ignore:
Timestamp:
26.01.2010 17:30:08 (9 years ago)
Author:
mdewsnip
Message:

Changed ClassifyTreeModel? constructor to take the infodbtype as a parameter, instead of assuming GDBM. Part of making the code less GDBM-specific.

Location:
main/trunk/greenstone2/perllib
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • main/trunk/greenstone2/perllib/ClassifyTreeModel.pm

    r21564 r21646  
    1818sub new() 
    1919  { 
    20     my ($class, $collection, $root) = @_; 
     20    my ($class, $collection, $infodbtype, $root) = @_; 
    2121    my $debug = 0; 
    22     print STDERR "ClassifyTreeModel.new(\"$collection\", \"$root\")\n" unless !$debug; 
     22    print STDERR "ClassifyTreeModel.new(\"$collection\", $infodbtype, \"$root\")\n" unless !$debug; 
    2323    # Store the variables 
    2424    my $self = {}; 
    2525    $self->{'collection'} = $collection; 
     26    $self->{'infodbtype'} = $infodbtype; 
    2627    $self->{'debug'} = $debug; 
    2728    $self->{'root'} = $root; 
     
    122123 
    123124    my $index_text_directory_path = &util::filename_cat($ENV{'GSDLHOME'}, "collect", $self->getCollection(), "index", "text"); 
    124     my $infodb_file_path = &dbutil::get_infodb_file_path("gdbm", $self->getCollection(), $index_text_directory_path); 
    125     if (&dbutil::read_infodb_entry("gdbm", $infodb_file_path, $clid) =~ /\w+/) 
     125    my $infodb_file_path = &dbutil::get_infodb_file_path($self->{'infodbtype'}, $self->getCollection(), $index_text_directory_path); 
     126    if (&dbutil::read_infodb_entry($self->{'infodbtype'}, $infodb_file_path, $clid) =~ /\w+/) 
    126127      { 
    127128        # Since the CLID can directly reference the correct entry in the info database we 
  • main/trunk/greenstone2/perllib/IncrementalBuildUtils.pm

    r21645 r21646  
    127127    if ($is_top) 
    128128      { 
    129         my $dummy_model = new ClassifyTreeModel($collection, ""); 
     129        my $dummy_model = new ClassifyTreeModel($collection, $infodbtype, ""); 
    130130        my $browselist_node = new ClassifyTreeNode($dummy_model, "browselist"); 
    131131        # Add the document 
     
    221221                # Create a tree model for this classifier 
    222222                print STDERR "* creating a tree model for classifier: CL$clidx\n" unless !$debug; 
    223                 my $tree_model_obj = new ClassifyTreeModel($collection, "CL" . $clidx); 
     223                my $tree_model_obj = new ClassifyTreeModel($collection, $infodbtype, "CL" . $clidx); 
    224224                # And store it for later 
    225225                push(@classifier_tree_models, $tree_model_obj); 
     
    415415                    # Create a tree model for this classifier 
    416416                    print STDERR "* creating a tree model for classifier: CL" . $clidx . " [" . $key . "]\n";# unless !$debug; 
    417                     my $tree_model_obj = new ClassifyTreeModel($collection, "CL" . $clidx); 
     417                    my $tree_model_obj = new ClassifyTreeModel($collection, $infodbtype, "CL" . $clidx); 
    418418                    # And store it against its key for later 
    419419                    $classifier_tree_models{$key} = $tree_model_obj; 
     
    442442        # We also have to remove from browselist - the reverse process of 
    443443        # adding to browselist shown above. 
    444         my $dummy_model = new ClassifyTreeModel($collection, ""); 
     444        my $dummy_model = new ClassifyTreeModel($collection, $infodbtype, ""); 
    445445        my $browselist_node = new ClassifyTreeNode($dummy_model, "browselist"); 
    446446        # Add the document