Ignore:
Timestamp:
2015-09-09T13:11:34+12:00 (9 years ago)
Author:
ak19
Message:

I think I've got the final fix in, but with debug statements. It's based off of the revision 30196.

File:
1 edited

Legend:

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

    r30234 r30237  
    3535public class DerbyWrapper
    3636{
    37     static String PORT = null;
    38     static String DERBYSERVER = null;
    39     static String PROTOCOL = null
     37    static final String PORT;
     38    static final String DERBYSERVER;
     39    static final String PROTOCOL;   
    4040
    4141    // static code block to initialise the above
    4242    static {
    43     try {
    44         // GlobalProperties won't be loaded at this point if running ant config-admin or ant config-user
    45         // from the command line (both of which call ant update-userdb which in turn calls ModifyUsersDB.java)
    46         // In such a case, the ant command will have set the system property (-Dgsdl3_writablehome)
    47         // and passed this to ModifyUsersDB.java. Use that to load the GlobalProperties at this point
    48 
    49         if(GlobalProperties.getGSDL3Home() == null) { // testing whether GlobalProperties is already loaded
    50         String gsdl3_writablehome = System.getProperty("gsdl3.writablehome"); // set by 'ant update-userdb' cmd
    51         System.err.println("@@@@@ writablehome: " + gsdl3_writablehome);
    52         GlobalProperties.loadGlobalProperties(gsdl3_writablehome);
    53         }
    54        
    55         System.out.println("@@@@@ GlobalProperties.getGSDL3Home(): " + GlobalProperties.getGSDL3Home()); //test
    56        
    57         // No more fallback values, use exactly what's propagated into global.properties from build.properties
    58         // Fallback values are only for the installer to use
    59         PORT = GlobalProperties.getProperty("derby.server.port");// "1527");
    60         DERBYSERVER = GlobalProperties.getProperty("derby.server");// "localhost");     
    61         System.out.println("@@@ PORT " + PORT); //check in installer
    62         System.out.println("@@@ DERBYSERVER " + DERBYSERVER); //check in installer
    63 
    64     } catch (Exception ex){
    65         System.out.println("@@@ Got exception: " + ex.getMessage());
    66         System.out.println("@@@ Using default derby port and servername");
     43    // GlobalProperties won't be loaded at this point if running ant config-admin or ant config-user
     44    // from the command line (both of which call ant update-userdb which in turn calls ModifyUsersDB.java)
     45    // In such a case, the ant command will have set the system property (-Dgsdl3_writablehome)
     46    // and passed this to ModifyUsersDB.java. Use that to load the GlobalProperties at this point
     47
     48    if(GlobalProperties.getGSDL3Home() == null) { // testing whether GlobalProperties is already loaded
     49        String gsdl3_writablehome = System.getProperty("gsdl3.writablehome"); // set by 'ant update-userdb' cmd
     50
     51        //System.err.println("@@@@@ writablehome: " + gsdl3_writablehome);
     52        GlobalProperties.loadGlobalProperties(gsdl3_writablehome);
     53    }
     54   
     55    //System.err.println("@@@@@ GlobalProperties.getGSDL3Home(): " + GlobalProperties.getGSDL3Home()); //test
     56   
     57    // No more fallback values, use exactly what's propagated into global.properties from build.properties
     58    String port = GlobalProperties.getProperty("derby.server.port");//, "1527");
     59    if(port.indexOf("@") == -1) { // if there are still @placeholders@ in global.properties, then use fallback values
     60        PORT = port;
     61        DERBYSERVER = GlobalProperties.getProperty("derby.server");//, "localhost");
     62    } else {
    6763        PORT = "1527";
    6864        DERBYSERVER = "localhost";
    69     } finally {
    70 
    71         PROTOCOL = "jdbc:derby://"+DERBYSERVER+":"+PORT+"/"; // "jdbc:derby://localhost:1527"; // by default       
    72         System.out.println("@@@ PROTOCOL:" + PROTOCOL); //check in installer
    73     }
     65    }
     66    PROTOCOL = "jdbc:derby://"+DERBYSERVER+":"+PORT+"/"; // "jdbc:derby://localhost:1527"; // by default
     67    System.out.println("@@@ PROTOCOL:" + PROTOCOL); //check in installer
    7468    }
    7569   
Note: See TracChangeset for help on using the changeset viewer.