Changeset 33079 for main/trunk


Ignore:
Timestamp:
2019-05-14T19:47:08+12:00 (5 years ago)
Author:
kjdon
Message:

make TransformingReceptionist call Receptionist.configure rather than having the entire method copied in this class.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/trunk/greenstone3/src/java/org/greenstone/gsdl3/core/TransformingReceptionist.java

    r32549 r33079  
    101101    }
    102102
    103     /** configures the receptionist - overwrite this to set up the xslt map */
     103    /** configures the receptionist - adding in setting up the xslt map */
    104104    public boolean configure()
    105105    {
    106         if (this.config_params == null)
    107         {
    108             logger.error(" config variables must be set before calling configure");
    109             return false;
    110         }
    111         if (this.mr == null)
    112         {
    113             logger.error(" message router must be set  before calling configure");
    114             return false;
    115         }
     106        if (!super.configure()) {
     107       
     108        return false;
     109        }
     110       
     111        logger.info("configuring the TransformingReceptionist");
    116112
    117113        // find the config file containing a list of actions
    118114        File interface_config_file = new File(GSFile.interfaceConfigFile(GSFile.interfaceHome(GlobalProperties.getGSDL3Home(), (String) this.config_params.get(GSConstants.INTERFACE_NAME))));
    119         if (!interface_config_file.exists())
    120         {
    121             logger.error(" interface config file: " + interface_config_file.getPath() + " not found!");
    122             return false;
    123         }
    124115        Document config_doc = this.converter.getDOM(interface_config_file, "utf-8");
    125         if (config_doc == null)
    126         {
    127             logger.error(" could not parse interface config file: " + interface_config_file.getPath());
    128             return false;
    129         }
    130116        Element config_elem = config_doc.getDocumentElement();
    131         String base_interface = config_elem.getAttribute("baseInterface");
    132         setUpBaseInterface(base_interface);
    133         setUpInterfaceOptions(config_elem);
    134 
    135         Element lang_list = (Element) GSXML.getChildByTagName(config_elem, "languageList");
    136         if (lang_list == null)
    137         {
    138             logger.error(" didn't find a language list in the config file!!");
    139         }
    140         else
    141         {
    142           this.language_list = lang_list;
    143         }
    144117       
     118        // Find the actions again so that we can set up the xslt map
    145119        Element action_list = (Element) GSXML.getChildByTagName(config_elem, GSXML.ACTION_ELEM + GSXML.LIST_MODIFIER);
    146120        NodeList actions = action_list.getElementsByTagName(GSXML.ACTION_ELEM);
     
    151125            String class_name = action.getAttribute("class");
    152126            String action_name = action.getAttribute("name");
    153             Action ac = null;
    154             try
    155             {
    156                 ac = (Action) Class.forName("org.greenstone.gsdl3.action." + class_name).newInstance();
    157             }
    158             catch (Exception e)
    159             {
    160                 logger.error(" couldn't load in action " + class_name);
    161                 e.printStackTrace();
    162                 continue;
    163             }
    164             ac.setConfigParams(this.config_params);
    165             ac.setMessageRouter(this.mr);
    166             ac.configure();
    167             ac.addActionParameters(this.params);
    168             ac.setLanguageList(this.language_list);
    169             this.action_map.put(action_name, ac);
    170127
    171128            // now do the xslt map
Note: See TracChangeset for help on using the changeset viewer.