Changeset 30233

Show
Ignore:
Timestamp:
08.09.2015 21:24:51 (4 years ago)
Author:
ak19
Message:

More derby port and server changes to get the installer to set the admin pwd again

Files:
1 modified

Legend:

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

    r30232 r30233  
    3535public class DerbyWrapper 
    3636{ 
    37     static final String PORT; 
    38     static final String DERBYSERVER; 
    39     static final String PROTOCOL;    
     37    static String PORT = null; 
     38    static String DERBYSERVER = null; 
     39    static String PROTOCOL = null 
    4040 
    4141    // static code block to initialise the above 
    4242    static { 
    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         try { 
     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 
    5251        System.err.println("@@@@@ writablehome: " + gsdl3_writablehome); 
    5352        GlobalProperties.loadGlobalProperties(gsdl3_writablehome); 
    54         } catch (Exception ex){ 
    55         PORT = "1527"; 
    56         DERBYSERVER = "localhost"; 
    5753        } 
    58     } 
    59      
    60     System.err.println("@@@@@ GlobalProperties.getGSDL3Home(): " + GlobalProperties.getGSDL3Home()); //test 
    61      
    62     // No more fallback values, use exactly what's propagated into global.properties from build.properties 
    63     // Fallback values are only for the installer to use 
    64     if (PORT == null) { // if these constants are not set yet because of exceptions 
    65         PORT = GlobalProperties.getProperty("derby.server.port", "1527"); 
    66         DERBYSERVER = GlobalProperties.getProperty("derby.server", "localhost"); 
    67         PROTOCOL = "jdbc:derby://"+DERBYSERVER+":"+PORT+"/"; // "jdbc:derby://localhost:1527"; // by default 
    68     } 
    69     System.err.println("@@@ PROTOCOL:" + PROTOCOL); //check in installer 
     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        // 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.err.println("@@@ PORT " + PORT); //check in installer 
     62        System.err.println("@@@ DERBYSERVER " + DERBYSERVER); //check in installer 
     63 
     64    } catch (Exception ex){ 
     65        System.err.println("@@@ Got exception: " + ex.getMessage()); 
     66        System.err.println("@@@ Using default derby port and servername"); 
     67        PORT = "1527"; 
     68        DERBYSERVER = "localhost"; 
     69    } finally { 
     70 
     71        PROTOCOL = "jdbc:derby://"+DERBYSERVER+":"+PORT+"/"; // "jdbc:derby://localhost:1527"; // by default         
     72        System.err.println("@@@ PROTOCOL:" + PROTOCOL); //check in installer 
     73    } 
    7074    } 
    7175