Ignore:
Timestamp:
2012-05-30T15:34:25+12:00 (12 years ago)
Author:
sjm84
Message:

Added a BaseGreenstoneServlet servlet that the other servlets now inherit from so that we can be sure that GlobalProperties is properly initialised. There is also some reformatting and import cleaning

File:
1 edited

Legend:

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

    r25387 r25717  
    3232
    3333    static Logger logger = Logger.getLogger(org.greenstone.util.GlobalProperties.class.getName());
    34     private static Properties properties = null;
     34    private static Properties properties = new Properties();
    3535    private static String properties_filename = "global.properties";
    3636    private static String gsdl3_home = null;
    3737    private static String gsdl3_web_address = null;
    38         private static String full_gsdl3_web_address = null;
    39 
    40     // Note, that if the servlet is reloadable, then it is reloaded each time the file is changed.
    41     static
    42     {
    43         //load in the properties
    44         properties = new Properties();
    45         reload();
    46     }
     38    private static String full_gsdl3_web_address = null;
    4739
    4840    /** get the value of the property 'key'. returns null if not found */
     
    7668    }
    7769
    78         public static String getFullGSDL3WebAddress()
     70    public static String getFullGSDL3WebAddress()
    7971    {
    8072        return full_gsdl3_web_address;
    8173    }
    8274
    83     public static void reload()
     75    public static void loadGlobalProperties(String optionalGS3Home)
    8476    {
    8577        try
    8678        {
    87 
    8879            InputStream in = Class.forName("org.greenstone.util.GlobalProperties").getClassLoader().getResourceAsStream(properties_filename);
    8980            if (in != null)
     
    9788                logger.error("couldn't load global properties!");
    9889            }
     90
    9991            gsdl3_home = properties.getProperty("gsdl3.home");
     92            if ((gsdl3_home == null || gsdl3_home.length() > 0) && optionalGS3Home != null && optionalGS3Home.length() > 0)
     93            {
     94                gsdl3_home = optionalGS3Home;
     95            }
     96
    10097            // make sure the path separators are correct
    10198            File gs3_file = new File(gsdl3_home);
Note: See TracChangeset for help on using the changeset viewer.