Changeset 27825

Show
Ignore:
Timestamp:
12.07.2013 17:09:11 (6 years ago)
Author:
davidb
Message:

'writabe' version of gsdl3_home introduced to help support Greenstone running off a read-only medium, such as a DVD

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • main/trunk/greenstone3/src/java/org/greenstone/util/GlobalProperties.java

    r25951 r27825  
    3535    private static String properties_filename = "global.properties"; 
    3636    private static String gsdl3_home = null; 
     37    private static String gsdl3_writablehome = null; 
    3738    private static String gsdl3_web_address = null; 
    3839    private static String full_gsdl3_web_address = null; 
     
    5657    { 
    5758        return gsdl3_home; 
     59    } 
     60 
     61    public static String getGSDL3WritableHome() 
     62    { 
     63        return gsdl3_writablehome; 
    5864    } 
    5965 
     
    8086            if (in != null) 
    8187            { 
    82                 logger.debug("loading global properties"); 
     88                logger.debug("Loading global properties"); 
    8389                properties.load(in); 
    8490                in.close(); 
     
    8692            else 
    8793            { 
    88                 logger.error("couldn't load global properties!"); 
     94                logger.error("Couldn't load global properties: " + properties_filename); 
    8995            } 
    9096 
    9197            gsdl3_home = properties.getProperty("gsdl3.home"); 
    92             if ((gsdl3_home == null || gsdl3_home.length() == 0) && optionalGS3Home != null && optionalGS3Home.length() > 0) 
     98            if ((gsdl3_home == null || gsdl3_home.length() == 0)  
     99                && optionalGS3Home != null && optionalGS3Home.length() > 0) 
    93100            { 
    94101                gsdl3_home = optionalGS3Home; 
     
    102109 
    103110            // make sure the path separators are correct 
    104             // gsdl3_home may be null, eg when we are loading properties from Server3 
     111            // gsdl3_home may be null, e.g., when we are loading properties from Server3 
    105112            if (gsdl3_home != null) 
    106113            { 
     
    108115                gsdl3_home = gs3_file.getPath(); 
    109116            } 
     117 
     118            gsdl3_writablehome = properties.getProperty("gsdl3.writablehome"); 
     119            // if gsdl3_writablehome is null, then defaults to gsdl3_home 
     120            if (gsdl3_writablehome == null) {  
     121                gsdl3_writablehome = gsdl3_home; 
     122            } 
     123 
    110124            //build the gsdl3 web address, in a way resilient to errors and ommisions in global.properties, simplifying where possible 
    111125            //aiming for a string with no trailing slash, eg "http://localhost:8080/greenstone3" or "http://www.mygreenstonelibrary.com"