Ignore:
Timestamp:
2013-08-29T15:08:23+12:00 (11 years ago)
Author:
kjdon
Message:

passing the web/ext/solr dir as solr home to the server. So now it uses the solr.xml file there. We do all modifications in that file, no need to touch the ones in the original solr ext dir. Don't bother copying changes out to .in file each time, we will do that at the end of activate.pl. Once the collection is live, then we can save the changes to the .in file.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • gs3-extensions/solr/trunk/src/perllib/solrserver.pm

    r28128 r28182  
    256256{
    257257    my $self = shift @_;
    258 
     258    my ($solr_xml_dir) = @_;
     259   
    259260    my $gsdl3home = $ENV{'GSDL3HOME'};
    260     my $web_solr_ext_dir = &util::filename_cat($gsdl3home, "ext", "solr");
    261     my $web_solrxml_in = &util::filename_cat($web_solr_ext_dir, "solr.xml.in");
    262     my $web_solrxml = &util::filename_cat($web_solr_ext_dir, "solr.xml");
     261   
     262    if (!defined $solr_xml_dir || !-d $solr_xml_dir) {
     263    # if not passed in, use stored solr_live_home
     264    $solr_xml_dir = $self->{'solr_live_home'};
     265    }
     266    my $solrxml_in = &util::filename_cat($solr_xml_dir, "solr.xml.in");
     267    my $solrxml = &util::filename_cat($solr_xml_dir, "solr.xml");
    263268
    264269    my $gsdl3home_re = &util::filename_to_regex($gsdl3home);
     
    266271    my $replacement_map = { qr/$gsdl3home_re/ => "\@gsdl3home\@" };
    267272
    268     $self->filtered_copy($web_solrxml,$web_solrxml_in,$replacement_map);
     273    $self->filtered_copy($solrxml,$solrxml_in,$replacement_map);
    269274}
    270275
     
    273278{
    274279    my $self = shift @_;
     280    my ($solr_xml_dir) = @_;
    275281
    276282    my $gsdl3home = $ENV{'GSDL3HOME'};
    277     my $web_solr_ext_dir = &util::filename_cat($gsdl3home, "ext", "solr");
    278     my $web_solrxml_in = &util::filename_cat($web_solr_ext_dir, "solr.xml.in");
    279     my $web_solrxml = &util::filename_cat($web_solr_ext_dir, "solr.xml");
     283    if (!defined $solr_xml_dir || !-d $solr_xml_dir) {
     284    # if not passed in, use stored solr home
     285    $solr_xml_dir = $self->{'solr_live_home'};
     286    }
     287    my $solrxml_in = &util::filename_cat($solr_xml_dir, "solr.xml.in");
     288    my $solrxml = &util::filename_cat($solr_xml_dir, "solr.xml");
    280289   
    281290    my $gsdl3home_re = &util::filename_to_regex($gsdl3home);
     
    283292    my $replacement_map = { qr/\@gsdl3home\@/ => $gsdl3home_re };
    284293
    285     $self->filtered_copy($web_solrxml_in,$web_solrxml,$replacement_map);
     294    $self->filtered_copy($solrxml_in,$solrxml,$replacement_map);
    286295}
    287296
     
    298307    $self->_admin_service($cgi_get_args);
    299308
    300     $self->solr_xml_to_solr_xml_in();
    301309}
    302310
     
    310318    $self->_admin_service($cgi_get_args);
    311319
    312     $self->solr_xml_to_solr_xml_in();
    313320}
    314321
     
    322329    $self->_admin_service($cgi_get_args);
    323330
    324     $self->solr_xml_to_solr_xml_in();
    325331}
    326332
     
    336342    $self->_admin_service($cgi_get_args);
    337343
    338     $self->solr_xml_to_solr_xml_in();
    339344}
    340345
     
    362367    $self->_admin_service($cgi_get_args);
    363368
    364     $self->solr_xml_to_solr_xml_in();
    365369}
    366370
     
    378382    $self->_admin_service($cgi_get_args);
    379383
    380     $self->solr_xml_to_solr_xml_in();
    381 }
    382 
    383 sub copy_solrxml_to_web
    384 {
    385     my $self = shift @_;
    386 
    387     my $ext_solrxml = &util::filename_cat($ENV{'GEXT_SOLR'}, "solr.xml.in");
    388     my $web_solrxml = &util::filename_cat($ENV{'GSDL3HOME'}, "ext", "solr", "solr.xml.in");
    389 
    390     #print STDERR "@@@@ Copying $ext_solrxml to $web_solrxml...\n";
    391 
    392     &FileUtils::copyFiles($ext_solrxml, $web_solrxml);
    393 
    394     $self->solr_xml_in_to_solr_xml();
    395384}
    396385
     
    403392
    404393    my $solr_home         = $ENV{'GEXT_SOLR'};
     394    my $solr_live_home    = &util::filename_cat($ENV{'GSDL3HOME'}, "ext", "solr");
    405395    my $jetty_stop_port   = $ENV{'JETTY_STOP_PORT'};
    406396    my $jetty_server_port = $ENV{'SOLR_JETTY_PORT'};
    407397
    408398    chdir($solr_home);
    409    
     399    #$self->{'solr_home'} = $solr_home;
     400    $self->{'solr_live_home'} = $solr_live_home;
    410401##    my $solr_etc = &util::filename_cat($solr_home,"etc");
    411402
    412403    my $server_props = "-DSTOP.PORT=$jetty_stop_port";
    413404    $server_props .= " -DSTOP.KEY=".$self->{'jetty_stop_key'};
    414     $server_props .= " -Dsolr.solr.home=$solr_home";
    415 
     405    #$server_props .= " -Dsolr.solr.home=$solr_home";
     406$server_props .= " -Dsolr.solr.home=$solr_live_home";
    416407    my $full_server_jar = $self->{'full_server_jar'};
    417408   
Note: See TracChangeset for help on using the changeset viewer.