Changeset 27107

Show
Ignore:
Timestamp:
21.03.2013 16:12:41 (7 years ago)
Author:
ak19
Message:

GS2PerlConstructor.activateCollection() now calls perl method activate.pl, since that has no issues with deleting the jdbm colname.lg file in the index folder when moving building to index, whereas the java code that used to move building to index was at times unable to delete this file, so that saving changes in the online GS3 document editor would fail on such occasions.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • main/trunk/greenstone3/src/java/org/greenstone/gsdl3/build/GS2PerlConstructor.java

    r26005 r27107  
    1818import java.util.Vector; 
    1919 
     20import org.apache.log4j.*; 
     21 
    2022/** 
    2123 * CollectionConstructor class for greenstone 2 compatible building it uses the 
     
    2426public class GS2PerlConstructor extends CollectionConstructor 
    2527{ 
     28    static Logger logger = Logger.getLogger(org.greenstone.gsdl3.build.GS2PerlConstructor.class.getName()); 
     29 
    2630    public static final int NEW = 0; 
    2731    public static final int IMPORT = 1; 
     
    200204 
    201205        // first check that we have a building directory 
     206        // (don't want to bother running activate.pl otherwise) 
    202207        File build_dir = new File(GSFile.collectionBuildDir(this.site_home, this.collection_name)); 
    203208        if (!build_dir.exists()) 
     
    206211            return; 
    207212        } 
     213 
     214        /* 
    208215 
    209216        // move building to index 
     
    228235        // success!!  - need to send the final completed message 
    229236        sendProcessComplete(new ConstructionEvent(this, GSStatus.COMPLETED, "")); 
     237        */ 
     238 
     239        // Running activate.pl instead of making java move building to index as above 
     240        // circumvents the issue of the jdbm .lg log file (managed by TransactionManager)  
     241        // in index dir not getting deleted at times. The perl code is able to delete this 
     242        // sucessfully consistently during testing, whereas java at times is unable to delete it. 
     243        Vector<String> command = new Vector<String>(); 
     244        command.add(GlobalProperties.getProperty("perl.path", "perl") + "perl"); 
     245        command.add("-S"); 
     246        command.add(GlobalProperties.getGS2Build() + File.separator + "bin" + File.separator + "script" + File.separator + "activate.pl"); 
     247        command.add("-site"); 
     248        command.add(this.site_name); 
     249        command.add("-collectdir"); 
     250        command.add(GSFile.collectDir(this.site_home)); 
     251        command.addAll(extractParameters(this.process_params)); 
     252        command.add(this.collection_name); 
     253 
     254        String[] command_str = {}; 
     255        command_str = command.toArray(command_str); 
     256 
     257        if (runPerlCommand(command_str)) 
     258        { 
     259            // success!! - need to send the final completed message 
     260            sendProcessComplete(new ConstructionEvent(this, GSStatus.COMPLETED, "")); 
     261        }// else an error message has already been sent, do nothing      
     262 
    230263    } 
    231264