Ignore:
Timestamp:
2011-06-27T11:08:35+12:00 (13 years ago)
Author:
sjb48
Message:

Working on document-level format editting

Location:
main/trunk/greenstone3/src/java/org/greenstone/gsdl3/collection
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • main/trunk/greenstone3/src/java/org/greenstone/gsdl3/collection/Collection.java

    r24135 r24203  
    359359    response.setAttribute(GSXML.TYPE_ATT, type);
    360360
     361    logger.error("Collection received a message, attempting to process");
     362
    361363    if (type.equals(GSXML.REQUEST_TYPE_FORMAT_STRING)) {
    362364        logger.error("Received format string request");
     
    501503                        if(GSXML.getChildByTagName(current_node, "format") == null)
    502504                        {
    503                             logger.error("ERROR: classifier does not have a format child");
     505                            logger.error("ERROR: valid classifier but does not have a format child");
    504506                            // well then create a format tag
    505507                            Element format_tag = config.createElement("format");
     
    511513                            current_node = GSXML.getChildByTagName(current_node, "format");
    512514                        }
     515
    513516                    }
    514517                    else{
    515518                        logger.error("Classifier is null");
     519                        // To support all classifiers, set classifier to null?  There is the chance here that the format tag does not exist
     520                        if(GSXML.getChildByTagName(current_node, "format") == null)
     521                        {
     522                            logger.error("ERROR: classifier does not have a format child");
     523                            // well then create a format tag
     524                            Element format_tag = config.createElement("format");
     525                            current_node = (Node) current_node.appendChild(format_tag);
     526                            //current_node = (Node) format_tag;
     527                        }
     528                        else
     529                            current_node = GSXML.getChildByTagName(current_node, "format");
     530                    }
     531                }
     532                else if(service.equals("AllClassifierBrowse"))
     533                {
     534                    logger.error("Looking for browse");
     535                    current_node = GSXML.getChildByTagName(current_node, "browse");
     536                    if(GSXML.getChildByTagName(current_node, "format") == null)
     537                    {
     538                        logger.error("ERROR AllClassifierBrowse: all classifiers do not have a format child");
     539                        // well then create a format tag
     540                        Element format_tag = config.createElement("format");
     541                        current_node = (Node) current_node.appendChild(format_tag);
     542                        //current_node = (Node) format_tag;
     543                    }
     544                    else
    516545                        current_node = GSXML.getChildByTagName(current_node, "format");
    517                     }
    518546                }
    519547                else
     
    536564                elem = (Element) current_node;
    537565   
    538                 logger.error("Current_node = " + elem.getNodeName());
     566                logger.error("*Current_node = " + elem.getNodeName());
    539567
    540568                // seems we want to remove current child/ren and replace with format_statement's child/ren?
     
    542570                // remove existing
    543571                current_node_list = elem.getChildNodes();
     572                logger.error("About to remove old children");
    544573                for(k=0; k<current_node_list.getLength(); k++)
    545574                {
    546575                    current_node = elem.removeChild(current_node_list.item(k));
    547576                }
     577
     578                logger.error("old nodes removed");
    548579
    549580                // append new but we have a string!
     
    560591                        elem.appendChild(config.importNode(current_node_list.item(k),true));
    561592                }
     593                logger.error("new nodes added");
    562594
    563595                //String text = GSXML.getNodeText(elem);
     
    568600
    569601                // Now convert config document to string for writing to file
     602                logger.error("Convert config to string");
    570603                String new_config = this.converter.getString(config);
    571604
     
    578611                writer.write(new_config);
    579612                writer.close();
     613                logger.error("All is happy with collection");
    580614
    581615             } catch( Exception ex ) {
  • main/trunk/greenstone3/src/java/org/greenstone/gsdl3/collection/ServiceCluster.java

    r23489 r24203  
    388388    public Node process(Node message_node) {
    389389
     390    logger.error("ServiceCluster is processing a message");
     391
    390392    Element message = this.converter.nodeToElement(message_node);
    391393
     
    417419        } else { // the request is for one of my services
    418420        String service = GSPath.getFirstLink(to);
     421        logger.error(service+" specified!");
    419422       
    420423        if (!this.service_map.containsKey(service)) {
     
    467470    protected Element processMessage(Element request) {
    468471
     472    logger.error("ServiceCluster is processing an element request");
    469473    Element response = this.doc.createElement(GSXML.RESPONSE_ELEM);
    470474    response.setAttribute(GSXML.FROM_ATT, this.cluster_name);
Note: See TracChangeset for help on using the changeset viewer.