Changeset 3476


Ignore:
Timestamp:
2002-10-25T11:48:51+13:00 (22 years ago)
Author:
kjdon
Message:

now uses gsdl3_home rather than sites_home and interfaces_home

Location:
trunk/gsdl3/src/java/org/greenstone/gsdl3
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/gsdl3/src/java/org/greenstone/gsdl3/Library2.java

    r3363 r3476  
    3737    public static void main(String args[]) {
    3838
    39     if (args.length != 4) {
    40         System.out.println("Usage: Library2 <sites home> <site name> <interfaces home> <interface name>");
     39    if (args.length != 3) {
     40        System.out.println("Usage: Library2 <gsdl3 home> <site name> <interface name>");
    4141        System.exit(1);
    4242    }
    4343
    4444    ConfigVars config_ = new ConfigVars();
    45     config_.sites_home_ = args[0];
     45    config_.gsdl3_home_ = args[0];
    4646    config_.site_name_ = args[1];
    47     config_.interfaces_home_ = args[2];
    48     config_.interface_name_ = args[3];
     47    config_.interface_name_ = args[2];
    4948
    5049    config_.createXML();
     
    5352    // the servlet wont use this directly
    5453    MessageRouter message_router_ = new MessageRouter();
    55     message_router_.setSiteHome(config_.sites_home_+File.separatorChar
    56                +config_.site_name_);
     54   
     55    message_router_.setSiteHome(GSFile.siteHome(config_.gsdl3_home_,
     56                            config_.site_name_));
    5757    message_router_.configure();
    5858    // new receptionist
  • trunk/gsdl3/src/java/org/greenstone/gsdl3/LibraryServlet.java

    r3467 r3476  
    1010import java.io.File;
    1111
    12 /** a servlet to serve the greenstone library - using servlets instead
     12/** a servlet to serve the greenstone library - we are using servlets instead
    1313 * of cgi
    1414 * the init method is called only once - the first time the servlet classes
     
    1616 * method is called in a new thread (calls doGet/doPut etc)
    1717 * takes the a=p&p=home type args and builds a simple request to send to
    18  * its receptionist, which returns the result in html, cos output=html
     18 * its receptionist, which returns a result in html, cos output=html
    1919 * is set in the request
    2020 * @see Receptionist
     
    3333    config_ = new ConfigVars();
    3434    String library_name_ = config.getInitParameter("libraryname");
    35     String sites_home_ = config.getInitParameter("siteshome");
     35    String gsdl3_home_ = config.getInitParameter("gsdl3home");
    3636    String site_name_ = config.getInitParameter("sitename");
    37     String interfaces_home_ = config.getInitParameter("interfaceshome");
    3837    String interface_name_ = config.getInitParameter("interfacename");
    39     if (library_name_ == null || sites_home_ == null || site_name_==null || interfaces_home_ ==null || interface_name_==null) {
     38    if (library_name_ == null || gsdl3_home_ == null || site_name_==null || interface_name_==null) {
    4039        // must have this
    4140        System.err.println("initialisation parameters not all set!");
    42         System.err.println(" you must have libraryname, siteshome, sitename, interfaceshome, interfacename");
     41        System.err.println(" you must have libraryname, gsdl3home, sitename, interfacename");
    4342        System.exit(1);
    4443    }
    4544
    4645    config_.library_name_ = library_name_;
    47     config_.sites_home_ = sites_home_;
     46    config_.gsdl3_home_ = gsdl3_home_;
    4847    config_.site_name_ = site_name_;
    49     config_.interfaces_home_ = interfaces_home_;
    5048    config_.interface_name_ =interface_name_;
    5149
     
    5553    // the servlet wont use this directly
    5654    message_router_ = new MessageRouter();
    57     message_router_.setSiteHome(config_.sites_home_+File.separatorChar
    58                +config_.site_name_);
     55    message_router_.setSiteHome(GSFile.siteHome(config_.gsdl3_home_,
     56                            config_.site_name_));
    5957    message_router_.configure();
    6058    // new receptionist
     
    7472    PrintWriter out = response.getWriter();
    7573
     74    // if the interface owns the default - keep this here, otherwise move
     75    // it to receptionist
    7676    String lang = request.getParameter("l");
    7777    if (lang==null || lang.equals("")) {
     
    7979    }
    8080    // the request to the receptionist 
    81     String xml_request="<message lang='"+lang+"'>";
     81    String xml_request="<message lang='"+lang+"'><request type='action' output='html' action=";
    8282
    8383    String action = request.getParameter("a");
     
    8585        // display the home page
    8686        // a=p&p=home
    87         xml_request +="<request type='action' output='html' action='p' subaction='home'/>";
     87        xml_request +="'p' subaction='home'/>";
    8888    } else {
    8989        String subaction = request.getParameter("sa");
    90         xml_request += "<request type='action' action='"+action+"'";
     90        xml_request += "'"+action+"'";
    9191        if (subaction != null) {
    9292        xml_request += " subaction='"+subaction+"'";
     
    9696        while(params.hasMoreElements()) {
    9797        String name = (String)params.nextElement();
    98         if (!name.equals("a") && !name.equals("sa")) {
    99             String value = request.getParameter(name);
     98        //if (!name.equals("a") && !name.equals("sa")) {
     99        String value = request.getParameter(name);
    100100        // for now, just add value as attribute - should un-url
    101             // encode them etc and so some might need to be text not atts
    102             // or is that done already?
    103             xml_request += "<param name='"+name+"' value='"+value+"'/>";
    104         }
     101        // encode them etc and so some might need to be text not atts
     102        // or is that done already?
     103        xml_request += "<param name='"+name+"' value='"+value+"'/>";
     104        //  }
    105105        }
    106106        xml_request += "</paramList></request>";
  • trunk/gsdl3/src/java/org/greenstone/gsdl3/util/ConfigVars.java

    r3438 r3476  
    11package org.greenstone.gsdl3.util;
    2 
    3 /** holds all the site setup variables
    4  * includes a method to represent them as an XML node
    5  */
    62
    73import org.w3c.dom.Document;
    84import org.w3c.dom.Element;
    95
     6/** holds all the site setup variables
     7 * includes a method to represent them as an XML node
     8 *
     9 * is this only applicable to the servlet type interface? should this
     10 * be called ServletConfigVars? or WebServletVars?
     11 */
    1012public class ConfigVars {
    1113
     14    /** the name that has been given to the servlet thats running eg library
     15     * not needed for other types of clients*/
    1216    public String library_name_=null;
    13     public String sites_home_=null;
     17    /** the gsdl home directory
     18     * where the sites and interfaces directories live */
     19    public String gsdl3_home_ = null;
     20    /** the name of the current site */
    1421    public String site_name_=null;
    15     public String interfaces_home_=null;
     22    /** the name of the current interface */
    1623    public String interface_name_=null;
     24    /** the xml <config> element containing all the variables */
    1725    public Element config_xml_ = null;
    1826
     27    /** creates the <config> Element containting all the variables*/
    1928    public void createXML() {
    2029   
     
    2332
    2433    config_xml_ = doc.createElement("config");
    25     Element e = GSXML.createTextElement(doc, "library_name", library_name_);
     34
     35    Element e;
     36    e = GSXML.createTextElement(doc, "library_name", library_name_);
    2637    config_xml_.appendChild(e);
    27     e = GSXML.createTextElement(doc, "sites_home", sites_home_);
     38    e = GSXML.createTextElement(doc, "gsdl3_home", gsdl3_home_);
    2839    config_xml_.appendChild(e);
    2940    e = GSXML.createTextElement(doc, "site_name", site_name_);
    30     config_xml_.appendChild(e);
    31     e = GSXML.createTextElement(doc, "interfaces_home", interfaces_home_);
    3241    config_xml_.appendChild(e);
    3342    e = GSXML.createTextElement(doc, "interface_name", interface_name_);
Note: See TracChangeset for help on using the changeset viewer.