Changeset 30840


Ignore:
Timestamp:
2016-09-22T12:11:04+12:00 (5 years ago)
Author:
kjdon
Message:

adding in handling for displayItems in siteConfig file, and for requests to get these back

File:
1 edited

Legend:

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

    r29308 r30840  
    3333import org.greenstone.gsdl3.comms.SOAPCommunicator;
    3434import org.greenstone.gsdl3.service.ServiceRack;
     35import org.greenstone.gsdl3.util.CustomClassLoader;
     36import org.greenstone.gsdl3.util.DisplayItemUtil;
    3537import org.greenstone.gsdl3.util.GSFile;
    3638import org.greenstone.gsdl3.util.GSPath;
     
    9597    /** list of metadata for the site */
    9698    protected Element metadata_list = null;
     99  /** list of display items for all languages */
     100  protected Element display_item_list = null;
     101
     102  /** a customised class loader so we can find resources in site resources folder*/
     103  protected CustomClassLoader class_loader = null;
     104  protected static final String DEFAULT_LANG = "en"; // hack for now, should be read from the coll cfg file? or site cfg file for cluster
    97105
    98106    //***************************************************************
     
    150158        }
    151159        this.site_home = GSFile.siteHome(GlobalProperties.getGSDL3Home(), this.site_name);
     160        // set up the class loader
     161        this.class_loader = new CustomClassLoader(this.getClass().getClassLoader(), GSFile.siteResourceDir(this.site_home));
     162
    152163        String web_address = GlobalProperties.getGSDL3WebAddress();
    153164        if (web_address.equals("")) {
     
    251262        // gets removed from where it was. This changes the node list - you cant iterate over the node list in a normal manner if you are moving elements out of it
    252263        int num_requests = requests.getLength();
     264        logger.error("**** num requests = "+num_requests);
    253265        for (int i = 0; i < num_requests; i++)
    254266        {
     
    331343        } // for each request
    332344
    333         //  logger.debug("MR returned response");
    334         //logger.debug(XMLConverter.getString(mainResult));
     345            logger.debug("MR returned response");
     346        logger.debug(XMLConverter.getString(mainResult));
    335347
    336348        return mainResult;
     
    480492        loadMetadata(metadata_list_elem);
    481493
     494        // load up the displayItems
     495        this.display_item_list = doc.createElement(GSXML.DISPLAY_TEXT_ELEM + GSXML.LIST_MODIFIER);
     496        Element display_item_list_elem = (Element) GSXML.getChildByTagName(config_info, GSXML.DISPLAY_TEXT_ELEM + GSXML.LIST_MODIFIER);
     497        DisplayItemUtil.storeDisplayItems(this.display_item_list, display_item_list_elem);
    482498        return true;
    483499
     
    10551071            Document doc = XMLConverter.newDOM();
    10561072        String type = req.getAttribute(GSXML.TYPE_ATT);
     1073        String lang = req.getAttribute(GSXML.LANG_ATT);
    10571074        Element response = doc.createElement(GSXML.RESPONSE_ELEM);
    10581075        response.setAttribute(GSXML.FROM_ATT, "");
     
    10691086                response.appendChild(doc.importNode(this.service_list, true));
    10701087                response.appendChild(doc.importNode(this.metadata_list, true));
     1088                Element di_list = doc.createElement(GSXML.DISPLAY_TEXT_ELEM + GSXML.LIST_MODIFIER);
     1089                response.appendChild(di_list);
     1090                DisplayItemUtil.addLanguageSpecificDisplayItems(di_list, this.display_item_list, lang, DEFAULT_LANG, this.class_loader);
    10711091                return response;
    10721092            }
     
    11021122                    {
    11031123                        response.appendChild(doc.importNode(this.metadata_list, true));
     1124                    }
     1125                    else if (info.equals(GSXML.DISPLAY_TEXT_ELEM + GSXML.LIST_MODIFIER))
     1126                    {
     1127                      Element di_list = doc.createElement(GSXML.DISPLAY_TEXT_ELEM + GSXML.LIST_MODIFIER);
     1128                      response.appendChild(di_list);
     1129                      DisplayItemUtil.addLanguageSpecificDisplayItems(di_list, this.display_item_list, lang, DEFAULT_LANG, this.class_loader);
     1130                     
    11041131                    }
    11051132                }
Note: See TracChangeset for help on using the changeset viewer.