Ignore:
Timestamp:
2014-04-17T13:18:27+12:00 (10 years ago)
Author:
kjdon
Message:

removed this.converter - now call XMLConverter methods statically. removed oai code - this is now in new OAIMessageRouter

File:
1 edited

Legend:

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

    r28966 r28988  
    3636import org.greenstone.gsdl3.util.GSPath;
    3737import org.greenstone.gsdl3.util.GSXML;
    38 import org.greenstone.gsdl3.util.OAIXML;
    3938import org.greenstone.gsdl3.util.UserContext;
    4039import org.greenstone.gsdl3.util.XMLConverter;
     
    8887    /** list of collections that are loaded but are private */
    8988    protected Element private_collection_list = null;
    90 
    91     /** list of collections that are public and OAI-supportive */
    92     protected Element oai_collection_list = null;
    93 
    9489    /** list of service clusters that can be reached */
    9590    protected Element cluster_list = null;
     
    10196    protected Element metadata_list = null;
    10297
    103     /** a converter class to parse XML and create Docs */
    104     protected XMLConverter converter = null;
    105 
    10698    //***************************************************************
    10799    // public methods
     
    111103    public MessageRouter()
    112104    {
    113         this.converter = new XMLConverter();
    114105    }
    115106
     
    218209    {
    219210
    220         Document doc = this.converter.getDOM(xml_in);
     211        Document doc = XMLConverter.getDOM(xml_in);
    221212
    222213        Node result = process(doc);
    223         return this.converter.getString(result);
     214        return XMLConverter.getString(result);
    224215    }
    225216
     
    333324                    else
    334325                    {
    335                         logger.error("MessageRouter Error: request has illegal module name in:\n" + this.converter.getString(req));
     326                        logger.error("MessageRouter Error: request has illegal module name in:\n" + XMLConverter.getString(req));
    336327                    }
    337328                }
     
    341332
    342333        logger.debug("MR returned response");
    343         logger.debug(this.converter.getString(mainResult));
     334        logger.debug(XMLConverter.getString(mainResult));
    344335
    345336        return mainResult;
     
    391382    protected void cleanUpModuleMapSubset(Element list, String remote_site)
    392383    {
    393         logger.error(this.converter.getString(list));
     384        logger.error(XMLConverter.getString(list));
    394385        NodeList elements = list.getChildNodes(); // we are assuming no extraneous nodes
    395386        for (int i = elements.getLength() - 1; i >= 0; i--)
     
    416407            }
    417408        }
    418         logger.error(this.converter.getString(list));
     409        logger.error(XMLConverter.getString(list));
    419410    }
    420411
     
    454445        }
    455446
    456         Document config_doc = this.converter.getDOM(configFile);
     447        Document config_doc = XMLConverter.getDOM(configFile);
    457448        if (config_doc == null)
    458449        {
     
    477468        this.collection_list = doc.createElement(GSXML.COLLECTION_ELEM + GSXML.LIST_MODIFIER);
    478469        this.private_collection_list = doc.createElement(GSXML.COLLECTION_ELEM + GSXML.LIST_MODIFIER);
    479         this.oai_collection_list = doc.createElement(GSXML.COLLECTION_ELEM + GSXML.LIST_MODIFIER);
    480470        configureCollections();
    481471
     
    687677        if (init_file.exists())
    688678        {
    689             Document init_doc = this.converter.getDOM(init_file);
     679            Document init_doc = XMLConverter.getDOM(init_file);
    690680            if (init_doc != null)
    691681            {
     
    730720                // add short description_ to collection_list_
    731721                this.collection_list.appendChild(e);
    732 
    733                 if (c.hasOAI())
    734                 {
    735                     Element ane = doc.createElement(GSXML.COLLECTION_ELEM);
    736                     ane.setAttribute(GSXML.NAME_ATT, col_name);
    737                     ane.setAttribute(OAIXML.LASTMODIFIED, "" + c.getLastmodified());
    738                     // lastmodified not of use anymore for OAI, perhaps useful as general information
    739                     ane.setAttribute(OAIXML.EARLIEST_DATESTAMP, "" + c.getEarliestDatestamp()); // for OAI
    740 
    741                     this.oai_collection_list.appendChild(ane);
    742                 }
    743 
    744722            }
    745723            else
     
    804782            return false;
    805783        }
    806         Document config_doc = this.converter.getDOM(configFile);
     784        Document config_doc = XMLConverter.getDOM(configFile);
    807785        if (config_doc == null)
    808786        {
     
    1003981                        this.collection_list.removeChild(this_col);
    1004982                    }
    1005                     if (((Collection) m).hasOAI())
    1006                     {
    1007                         this_col = GSXML.getNamedElement(this.oai_collection_list, GSXML.COLLECTION_ELEM, GSXML.NAME_ATT, name);
    1008                         if (this_col != null)
    1009                         {
    1010                             this.oai_collection_list.removeChild(this_col);
    1011                         }
    1012                     }
    1013983                }
    1014984                else
     
    10501020                    cleanUpModuleMapSubset(this.service_list, name);
    10511021
    1052                     // can remote collections be in the oai_coll list, or private coll list ??
     1022                    // can remote collections be in the private coll list ??
    10531023                }
    10541024            }
     
    11391109        }
    11401110
    1141         if (type.equals(OAIXML.OAI_SET_LIST))
    1142         {
    1143             logger.info("oaiSetList request received");
    1144             //this is the oai receptionist asking for a list of oai-support collections
    1145             response.setAttribute(GSXML.TYPE_ATT, OAIXML.OAI_SET_LIST);
    1146             response.appendChild(doc.importNode(this.oai_collection_list, true));
    1147             return response;
    1148         }
    1149 
    11501111        if (type.equals(GSXML.REQUEST_TYPE_SYSTEM))
    11511112        {
     
    12261187                                    continue;
    12271188                                }
    1228                                 Document site_config_doc = this.converter.getDOM(configFile);
     1189                                Document site_config_doc = XMLConverter.getDOM(configFile);
    12291190                                if (site_config_doc == null)
    12301191                                {
     
    13241285        String eol = System.getProperty("line.separator");
    13251286
    1326         String mess = "Can't process request:" + eol + "  " + this.converter.getString(req);
     1287        String mess = "Can't process request:" + eol + "  " + XMLConverter.getString(req);
    13271288        logger.error(mess);
    13281289        return null;
     
    13421303        if (commands == null)
    13431304        {
    1344             logger.error("no commands, " + converter.getPrettyString(request));
     1305            logger.error("no commands, " + XMLConverter.getPrettyString(request));
    13451306            return response;
    13461307        }
Note: See TracChangeset for help on using the changeset viewer.