Changeset 27827 for main


Ignore:
Timestamp:
2013-07-12T17:12:13+12:00 (11 years ago)
Author:
davidb
Message:

Code changes to help support Greenstone running off a read-only medium, such as a DVD

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/trunk/greenstone3/src/java/org/greenstone/server/Server3.java

    r26001 r27827  
    1515public class Server3 extends BaseServer
    1616{
     17        String opt_ant_properties = null;
    1718
    1819    public Server3(String gsdl3_src_home, String lang)
     
    3132        STOP_CMD = "force-stop-tomcat";
    3233
     34        String is_read_only = System.getProperty("gsdl3home.isreadonly","false");
     35        if (is_read_only.equals("true")) {
     36            String default_gsdl3_home = gsdl3_src_home + File.separatorChar + "web";
     37            String gsdl3_writablehome = System.getProperty("gsdl3.writablehome",default_gsdl3_home);
     38            opt_ant_properties = "-Dgsdl3home.isreadonly=true -Dgsdl3.writablehome="+gsdl3_writablehome;
     39        }
     40       
    3341        autoStart();
    3442    }
     
    3644    protected int runTarget(String cmd)
    3745    {
    38         RunAnt runAnt = new RunAnt();
     46        RunAnt runAnt = new RunAnt(opt_ant_properties);
    3947        runAnt.setTargetCmd(cmd);
    4048        runAnt.run();
     
    8492        gsdl3_home = fallbackGSDL3Home();
    8593    }
    86     String propsFolder = gsdl3_home + File.separator + "WEB-INF" + File.separator + "classes" + File.separator;
     94
     95    String gsdl3_writablehome = System.getProperty("gsdl3.writablehome",gsdl3_home);
     96
     97    String propsFolder = gsdl3_writablehome + File.separator + "WEB-INF" + File.separator + "classes" + File.separator;
    8798    File propsFile = new File(propsFolder+"log4j.properties");
    8899
    89100    // create it from the template file GS3/resources/java/log4j.properties.in
    90     if(!propsFile.exists()) {
     101    // Always do this => helps make Greenstone3 portable
     102
     103
    91104        try {
    92105        // need to set gsdl3.home property's value to be gsdl_home/web,
     
    102115            // set gsdl3.home to web home
    103116            logProps.setProperty("gsdl3.home", gsdl3_home);
     117            logProps.setProperty("gsdl3.writablehome", gsdl3_writablehome);
    104118           
    105119            // write the customised properties out to a custom log4j.properties file
     
    116130        e.printStackTrace();
    117131        }
    118     }
    119132
    120133    // now configure the logger with the custom log4j.properties file
Note: See TracChangeset for help on using the changeset viewer.