Changeset 4692


Ignore:
Timestamp:
2003-06-18T11:39:26+12:00 (21 years ago)
Author:
kjdon
Message:

no longer use ConfigVars, use a HashMap instead. request type cgi is now request type page

File:
1 edited

Legend:

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

    r4258 r4692  
    2323
    2424    /** the set up variables */
    25     /// this is web specific - perhaps use an interface so diff types (web/java app) can use diff classes
    26     protected ConfigVars config=null;
    27 
     25    protected HashMap config_params = null;
    2826    /** container Document to create XML Nodes */
    2927    protected Document doc=null;
     
    4442    }
    4543   
    46     /** the set up vars must be set before configure called*/
    47     public void setConfigVars(ConfigVars config) {
    48     this.config = config;
     44    public void setConfigParams(HashMap params) {
     45    this.config_params = params;
    4946    }
    50 
    5147    /** sets the message router  - it should already be created and
    5248     * configured before  being passed to the receptionist*/
     
    5854    public boolean configure() {
    5955
    60     if (this.config==null) {
     56    if (this.config_params==null) {
    6157        System.err.println("Receptionist Error: config variables must be set before calling configure");
    6258        return false;
     
    6864
    6965    // find the config file containing a list of actions
    70     File interface_config_file = new File(GSFile.interfaceConfigFile(GSFile.interfaceHome(this.config.gsdl3_home_, this.config.interface_name_)));
     66    File interface_config_file = new File(GSFile.interfaceConfigFile(GSFile.interfaceHome((String)this.config_params.get(GSConstants.GSDL3_HOME), (String)this.config_params.get(GSConstants.INTERFACE_NAME))));
    7167    if (!interface_config_file.exists()) {
    7268        System.err.println("Receptionist: interface config file: "+interface_config_file.getPath()+" not found!");
     
    9086        continue;
    9187        }
    92         ac.setConfigVars(this.config);
     88        ac.setConfigParams(this.config_params);
    9389        ac.setMessageRouter(this.mr);
    9490        ac.configure();
     
    119115    // check the request type
    120116    String type = request.getAttribute(GSXML.TYPE_ATT); // returns "" if no att of this name
    121     if (!type.equals(GSXML.REQUEST_TYPE_CGI)) { // should use a diff name??
    122         // now Receptionist forwards non-cgi requests straight to the MR, and returns the responses
    123         System.err.println("Receptionist: request type is not '"+GSXML.REQUEST_TYPE_CGI+"', but it is '"+type+"', so forwarding the message to the MR!");
     117    if (!type.equals(GSXML.REQUEST_TYPE_PAGE)) {
     118        // now Receptionist forwards non-page requests straight to the MR, and returns the responses
     119        System.err.println("Receptionist: request type is not '"+GSXML.REQUEST_TYPE_PAGE+"', but it is '"+type+"', so forwarding the message to the MR!");
    124120        // process the whole message - mr needs <message> tags, and
    125121        // in this case, there may be more than one request in the message
     
    141137        action_name = action.substring(0,1).toUpperCase()+action.substring(1)+"Action";
    142138        Action ac = (Action)Class.forName("org.greenstone.gsdl3.action."+action_name).newInstance();
    143         ac.setConfigVars(this.config);
     139        ac.setConfigParams(this.config_params);
    144140        ac.setMessageRouter(this.mr);
    145141        ac.configure();
     
    157153    // set up the page
    158154    Element page = this.doc.createElement(GSXML.PAGE_ELEM);
    159     // do we need this??
    160155    page.setAttribute(GSXML.LANG_ATT, request.getAttribute(GSXML.LANG_ATT));
    161156   
Note: See TracChangeset for help on using the changeset viewer.