Changeset 16272 for gli


Ignore:
Timestamp:
07/02/08 11:51:05 (13 years ago)
Author:
ak19
Message:

New method canDoScheduling() replaces if tests in various locations. In future can adjust this method to reflect availability of scheduling under more circumstances.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • gli/trunk/src/org/greenstone/gatherer/collection/CollectionManager.java

    r16265 r16272  
    559559        // for remote case, scheduling causes an Exception on creating a new collection that
    560560        // can't be recovered from. For GS3, it doesn't work since it it trying to access etc/main.cfg
    561         if (!Gatherer.isGsdlRemote && !Gatherer.GS3) {
     561        if (canDoScheduling()) {
    562562        scheduling();
    563563        }
     
    680680    //try to obtain email address of Greenstone installation webmaster for - used to indicate "sender".
    681681    File mcfg = new File(LocalGreenstone.getDirectoryPath() + File.separator + "etc" + File.separator + "main.cfg");
    682     if(!mcfg.exists()) {
    683         System.out.println("Cannot do scheduling, since there is no file: " + mcfg.getAbsolutePath()
    684                    + ".\nScheduling presently depends on GLI running from inside a GS2.");
    685         return;
    686     }
    687682    BufferedReader maincfg = new BufferedReader(new FileReader(mcfg));     
    688683        stmp = "";
     
    12191214        }
    12201215       
    1221         if (!Gatherer.isGsdlRemote && !Gatherer.GS3) {
     1216        if (canDoScheduling()) {
    12221217        //THIS LOOKS LIKE THE BEST PLACE TO TRY AND UPDATE .col FILES FOR EXISTING COLLECTIONS...Wendy
    12231218 
     
    12901285        }
    12911286       
    1292         if (!Gatherer.isGsdlRemote && !Gatherer.GS3) {
     1287        if (canDoScheduling()) {
    12931288        scheduling();
    12941289        }
     
    13541349    }
    13551350
     1351    /** At present, scheduling only works for GS2, only when GS2 is local and only when GLI runs from
     1352     * within a GS2 installation. This method can be adjusted as scheduling becomes available for more
     1353     * more situations. */
     1354    private boolean canDoScheduling() {
     1355    if(Gatherer.isGsdlRemote) {
     1356        return false;
     1357    }
     1358    if(Gatherer.GS3) {
     1359        return false;
     1360    }
     1361   
     1362    // GS2's etc/main.cfg is necessary for scheduling, but scheduling looks for it locally:
     1363    // it assumes GLI is inside a GS2 installation
     1364    File mcfg = new File(LocalGreenstone.getDirectoryPath() + File.separator + "etc" + File.separator + "main.cfg");
     1365    if(!mcfg.exists()) {
     1366        System.out.println("Cannot do scheduling, since there is no file: " + mcfg.getAbsolutePath()
     1367                   + ".\nScheduling presently depends on GLI running from inside a GS2.");
     1368        return false;
     1369    }
     1370   
     1371    return true;
     1372    }
    13561373
    13571374    private void makeCollection(String name, String email)
Note: See TracChangeset for help on using the changeset viewer.