Changeset 4302


Ignore:
Timestamp:
2003-05-23T16:12:49+12:00 (21 years ago)
Author:
jmt12
Message:

bug fix

File:
1 edited

Legend:

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

    r4293 r4302  
    5555public class Configuration
    5656      extends Hashtable {
     57     public File exec_file;
    5758     /** The path (or url) to the webserver which is serving the Greenstone collection. */
    5859     public String exec_path = null;
     
    7374     private int cache_hit = 0;
    7475     private int cache_miss = 0;
    75      private URL exec_address = null;
     76     public URL exec_address = null;
    7677     /** The string identifying an argument's name attribute. */
    7778     static final private String ARGUMENT_NAME = "name";
     
    103104          this.gsdl_path = gsdl_path;
    104105          this.exec_path = exec_path;
     106          // The exec_path may contain an url address, in which case we blindly use that and leave it up to the user to worry about settings and resetting.
     107          System.err.println("EXEC_PATH = " + exec_path);
     108          if(exec_path != null && exec_path.length() > 0) {
     109                try {
     110                     // If its missing the protocol add it now.
     111                     if(exec_path.indexOf("://") != -1) {
     112                          exec_address = new URL(exec_path);
     113                     }
     114                     else {
     115                          exec_address = new URL("http://" + exec_path);
     116                     }
     117                }
     118                catch (MalformedURLException error) {
     119                     System.err.println("Not an address.");
     120                }
     121          }
     122          // If the above failed, then its up to us to try and figure out what to do.
     123          if(exec_address == null) {
     124                // Try building a file from the given exec_path
     125                try {
     126                     File local_file = new File(exec_path);
     127                     if(local_file.exists()) {
     128                          // All good. I hope.
     129                          exec_file = local_file;
     130                     }
     131                }
     132                // All sorts of errors might be thrown by a bogus file path.
     133                catch (Exception error) {
     134                     System.err.println("Not a valid file.");
     135                }
     136                // We can generate the path to where the local library should be and use that if it is there.
     137                if(exec_file == null) {
     138                     File server_exe = new File(gsdl_path + Utility.SERVER_EXE);
     139                     if(server_exe.exists()) {
     140                          exec_file = server_exe;
     141                     }
     142                     else {
     143                          System.err.println("No local library.");
     144                     }
     145                }
     146                // If we get to here with no exec_address nor an exec_file its just plain not going to work.
     147          }
    105148          this.perl_path = perl_path;
    106149          // Ensure the perl path includes exe under windoze
Note: See TracChangeset for help on using the changeset viewer.