Changeset 14310 for gli


Ignore:
Timestamp:
2007-08-06T11:36:26+12:00 (17 years ago)
Author:
qq6
Message:

download web.xml and get names of sites if Gatherer.isGsdlRemote

File:
1 edited

Legend:

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

    r13596 r14310  
    4444import javax.swing.*;
    4545import javax.swing.plaf.*;
     46import org.greenstone.gatherer.Gatherer;
    4647import org.greenstone.gatherer.DebugStream;
    4748import org.greenstone.gatherer.util.ArrayTools;
     
    4950import org.greenstone.gatherer.util.Utility;
    5051import org.greenstone.gatherer.util.XMLTools;
     52import org.greenstone.gatherer.remote.RemoteGreenstoneServer;
    5153import org.w3c.dom.*;
    5254
     
    6870   
    6971    //String web_xml_path = gsdl3_path + File.separator + "web" + File.separator + "WEB-INF"+ File.separator + "web.xml";
    70     File web_xml = new File(gsdl3_path + "WEB-INF"+ File.separator + "web.xml");
    71 
     72    File web_xml;
     73    if (Gatherer.isGsdlRemote){
     74        web_xml = new File(gsdl3_path + "web.xml");
     75    }else{
     76        web_xml = new File(gsdl3_path + "WEB-INF"+ File.separator + "web.xml");
     77    }
    7278    if (!web_xml.exists()) {
    7379        DebugStream.println("Error: no web.xml found at "+web_xml.toString());
     
    7682
    7783    this.sites = new ArrayList();
     84    if (Gatherer.isGsdlRemote){
     85        if (RemoteGreenstoneServer.downloadWebXMLFile().equals("")) {
     86        System.err.println("Error: Could not download web.xml.");
     87        System.exit(0);
     88        }
     89        String sites_on_server = RemoteGreenstoneServer.getSiteNames();
     90        if (sites_on_server.equals("")) {
     91        // !! Something went wrong : could not get names of the sites
     92        System.err.println("Error: Could not get names of the sites.");
     93        System.exit(0);
     94        }
     95       
     96        String[] sites_arr=sites_on_server.split("-----");
     97        for (int i=0; i<sites_arr.length; i++){
     98        if (!(sites_arr[i].trim().equals(""))){
     99            this.sites.add(sites_arr[i].trim());
     100        }
     101        }
     102    }else{
    78103    // find the sites
    79104    File start = new File(Utility.getSitesDir(gsdl3_path));
     
    86111        }
    87112    }
    88    
     113    }
    89114    this.mappings = new HashMap();
    90115    Document web_config = XMLTools.parseXMLFile(web_xml.getAbsolutePath(), false);
Note: See TracChangeset for help on using the changeset viewer.