Ignore:
Timestamp:
2024-02-22T18:59:49+13:00 (4 months ago)
Author:
anupama
Message:

Following Dr Bainbridge's task description and with his fixes: changes to get the Networked Derby Driver that we now use to use the shorter URL to the usersDB of the form jdbc:derby://derbyserver:derbyport/usersDB, instead of the full path to usersDB after the protocol. It needed setting derby.system.home JAVA_OPT when starting up the derby server in build.xml, then the tomcat greenstone3.xml file needed to refer to the shorter URL. Then classes that used to pass the full path need to pass the shorter form. And those classes called from the comandline with full usersDB path, like ModifyUsersDB, needed to now pass the shorter path. So build.xml needed further updating when calling ModifyUsersDB. The full path still works (for example, you can connect to both the original jdbc:derby URL and the shorter URL now from Squirrel SQL Client now), but the code now uses the shorter path.

Location:
main/trunk/greenstone3/src/java/org/greenstone/gsdl3/util
Files:
4 edited

Legend:

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

    r37693 r38769  
    4444    static final String PROTOCOL;   
    4545
     46    static final String DRIVER = "org.apache.derby.jdbc.ClientDriver"; //"org.apache.derby.jdbc.EmbeddedDriver";
     47    static final String USERSDB = "usersDB";
     48    public static final String USERSDB_DIR;
     49   
    4650    // static code block to initialise the above
    4751    static {
     
    7579    PROTOCOL = "jdbc:derby://"+DERBYSERVER+":"+PORT+"/"; // "jdbc:derby://localhost:8327"; // by default
    7680    //System.out.println("@@@ PROTOCOL:" + PROTOCOL); //check in installer
     81
     82    // if embedded derby Driver (UNTESTED BRANCH), use the full path to usersDB,
     83    // else if networked derby server then just append dbname (usersDB) to protocol
     84    if(DRIVER.equals("org.apache.derby.jdbc.EmbeddedDriver")) {
     85        USERSDB_DIR = GlobalProperties.getGSDL3Home() + File.separatorChar + "etc" + File.separatorChar + USERSDB;
     86    } else { // derby network driver, just go direct to usersDB
     87        USERSDB_DIR = USERSDB;
     88    }   
    7789    }
    78    
    79 
    80     static final String DRIVER = "org.apache.derby.jdbc.ClientDriver"; //"org.apache.derby.jdbc.EmbeddedDriver";
    81         static final String USERSDB = "usersDB";
     90
    8291    public static final String USERS = "users";
    8392    public static final String ROLES = "roles";
     
    93102    public static void createDatabaseIfNeeded()
    94103    {
    95         String usersDB_dir = GlobalProperties.getGSDL3Home() + File.separatorChar + "etc" + File.separatorChar + "usersDB";
    96         protocol_str = PROTOCOL + usersDB_dir;
    97         File usersDB_file = new File(usersDB_dir);
     104        protocol_str = PROTOCOL + USERSDB_DIR;
     105        File usersDB_file = new File(USERSDB_DIR);
    98106        if (!usersDB_file.exists())
    99107        {
  • main/trunk/greenstone3/src/java/org/greenstone/gsdl3/util/ModifyUsersDB.java

    r37660 r38769  
    2828    then run:
    2929
    30     java -Dgsdl3.writablehome=/Scratch/ak19/gs3-svn-2Sep2015/web -cp web/WEB-INF/lib/gsdl3.jar:web/WEB-INF/lib/gutil.jar:web/WEB-INF/lib/derby.jar:web/WEB-INF/lib/derbyclient.jar:web/WEB-INF/lib/log4j-1.2.8.jar:web/WEB-INF/lib/commons-codec-1.7.jar:web/WEB-INF/classes org.greenstone.gsdl3.util.ModifyUsersDB web/etc/usersDB/ <username or 'ALL'> [options specifying user fields to change, e.g.: password=me!]
    31    
     30    java -Dgsdl3.writablehome=/Scratch/ak19/gs3-svn-2Sep2015/web -cp web/WEB-INF/lib/gsdl3.jar:web/WEB-INF/lib/gutil.jar:web/WEB-INF/lib/derby.jar:web/WEB-INF/lib/derbyclient.jar:web/WEB-INF/lib/log4j-1.2.8.jar:web/WEB-INF/lib/commons-codec-1.7.jar:web/WEB-INF/classes org.greenstone.gsdl3.util.ModifyUsersDB usersDB <username or 'ALL'> [options specifying user fields to change, e.g.: password=me!]
     31   
     32    Now just pass in "usersDB" for networked derby server, previously web/etc/usersDB/ was needed.
     33
    3234    Don't forget to stop the networked derby server again at the end, if you had started it: ant stop-derby
    3335   [[ OLD METHOD ]]
  • main/trunk/greenstone3/src/java/org/greenstone/gsdl3/util/txt2usersDB.java

    r35298 r38769  
    3131    then run:
    3232
    33     java -Dgsdl3.writablehome=/full/path/to/GS3/web -cp web/WEB-INF/lib/gsdl3.jar:web/WEB-INF/lib/gutil.jar:web/WEB-INF/lib/derby.jar:./web/WEB-INF/lib/derbyclient.jar:./web/WEB-INF/lib/log4j-1.2.8.jar:./web/WEB-INF/classes org.greenstone.gsdl3.util.txt2usersDB <filename>.txt web/etc/usersDB/ [-append]
     33    java -Dgsdl3.writablehome=/full/path/to/GS3/web -cp web/WEB-INF/lib/gsdl3.jar:web/WEB-INF/lib/gutil.jar:web/WEB-INF/lib/derby.jar:./web/WEB-INF/lib/derbyclient.jar:./web/WEB-INF/lib/log4j-1.2.8.jar:./web/WEB-INF/classes org.greenstone.gsdl3.util.txt2usersDB <filename>.txt usersDB [-append]
     34
     35    Now just pass in "usersDB" for networked derby server, previously web/etc/usersDB/ was needed.
    3436
    3537    Don't forget to stop the networked derby server again at the end, if you had started it: ant stop-derby
  • main/trunk/greenstone3/src/java/org/greenstone/gsdl3/util/usersDB2txt.java

    r30196 r38769  
    3333    then run:
    3434 
    35     java -Dgsdl3.writablehome=/full/path/to/GS3/web -cp ./web/WEB-INF/lib/gsdl3.jar:./web/WEB-INF/lib/gutil.jar:./web/WEB-INF/lib/derby.jar:./web/WEB-INF/lib/derbyclient.jar:./web/WEB-INF/lib/log4j-1.2.8.jar:./web/WEB-INF/classes org.greenstone.gsdl3.util.usersDB2txt web/etc/usersDB/
     35    java -Dgsdl3.writablehome=/full/path/to/GS3/web -cp ./web/WEB-INF/lib/gsdl3.jar:./web/WEB-INF/lib/gutil.jar:./web/WEB-INF/lib/derby.jar:./web/WEB-INF/lib/derbyclient.jar:./web/WEB-INF/lib/log4j-1.2.8.jar:./web/WEB-INF/classes org.greenstone.gsdl3.util.usersDB2txt usersDB
     36
     37    Now just pass in "usersDB" for networked derby server, previously web/etc/usersDB/ was needed.
    3638
    3739    if redirecting to a file append ">& filename.txt" to the above command
     
    4749    public static void main(String[] args) throws SQLException{
    4850    if (args.length!=1){
    49         System.out.println("The path of usersDB has to be given!");
     51        System.out.println("Set parameter to \"usersDB\" for a derby networked server or usersDB path if using an embedded derby server");
    5052        System.exit(0);
    5153    }
Note: See TracChangeset for help on using the changeset viewer.