Changeset 24427


Ignore:
Timestamp:
2011-08-19T10:58:29+12:00 (13 years ago)
Author:
sjm84
Message:

More tidying

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

Legend:

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

    r24393 r24427  
    421421        response.setAttribute(GSXML.TYPE_ATT, type);
    422422
    423         logger.error("Collection received a message, attempting to process");
    424 
    425423        if (type.equals(GSXML.REQUEST_TYPE_FORMAT_STRING))
    426424        {
    427             logger.error("Received format string request");
    428 
    429425            String subaction = request.getAttribute("subaction");
    430             logger.error("Subaction is " + subaction);
    431 
    432426            String service = request.getAttribute("service");
    433             logger.error("Service is " + service);
    434427
    435428            String classifier = null;
     
    437430            {
    438431                classifier = request.getAttribute("classifier");
    439                 logger.error("Classifier is " + classifier);
    440             }
    441 
    442             //logger.error("Format string: " + format_string);
    443             logger.error("Config file location = " + GSFile.collectionConfigFile(this.site_home, this.cluster_name));
    444 
     432            }
     433           
    445434            // check for version file
    446 
    447435            String directory = new File(GSFile.collectionConfigFile(this.site_home, this.cluster_name)).getParent() + File.separator;
    448             logger.error("Directory is " + directory);
    449436
    450437            String version_filename = "";
     
    455442
    456443            File version_file = new File(version_filename);
    457             logger.error("Version filename is " + version_filename);
    458444
    459445            if (subaction.equals("update"))
     
    495481                        format_statement_filename = directory + "query_format_statement_v" + version_number + ".txt";
    496482
    497                     logger.error("Format statement filename is " + format_statement_filename);
    498 
    499483                    // Write format statement
    500484                    String format_string = this.converter.getString(format_statement); //GSXML.xmlNodeToString(format_statement);
     
    523507                Element display_format = (Element) format_element.getFirstChild();
    524508
    525                 logger.error("I have received a save document request");
    526509                String format_string = GSXML.xmlNodeToString(display_format);
    527                 logger.error("Param=" + format_string);
    528510                String collection_config = directory + "collectionConfig.xml";
    529511                Document config = this.converter.getDOM(new File(collection_config), "UTF-8");
     
    534516                if (GSXML.getChildByTagName(current_node, "display") == null)
    535517                {
    536                     logger.error("ERROR: does not have a display child");
    537518                    // well then create a format tag
    538519                    Element display_tag = config.createElement("display");
    539520                    current_node = (Node) current_node.appendChild(display_tag);
    540                     //current_node = (Node) format_tag;
    541                 }
    542 
     521                }
    543522                else
    544523                {
     
    548527                if (GSXML.getChildByTagName(current_node, "format") == null)
    549528                {
    550                     logger.error("ERROR: does not have a format child");
    551529                    // well then create a format tag
    552530                    Element format_tag = config.createElement("format");
    553531                    current_node.appendChild(format_tag);
    554                     //current_node = (Node) format_tag;
    555532                }
    556533
    557534                current_node.replaceChild(config.importNode(display_format, true), GSXML.getChildByTagName(current_node, "format"));
    558535
    559                 logger.error(GSXML.xmlNodeToString(current_node));
    560 
    561                 logger.error("Convert config to string");
    562536                String new_config = this.converter.getString(config);
    563537
     
    572546                    writer.write(new_config);
    573547                    writer.close();
    574                     logger.error("All is happy with collection saveDocument");
    575548                }
    576549                catch (IOException e)
     
    582555            if (subaction.equals("save"))
    583556            {
    584                 logger.error("SAVE format statement");
    585 
    586557                Element format_element = (Element) GSXML.getChildByTagName(request, GSXML.FORMAT_STRING_ELEM);
    587                 //String format_string = GSXML.getNodeText(format_element);
    588558                Element format_statement = (Element) format_element.getFirstChild();
    589559
    590560                try
    591561                {
    592 
    593562                    // open collectionConfig.xml and read in to w3 Document
    594563                    String collection_config = directory + "collectionConfig.xml";
     
    604573                    NodeList current_node_list;
    605574
    606                     logger.error("Service is " + service);
    607 
    608575                    if (service.equals("ClassifierBrowse"))
    609576                    {
     
    612579                        // default is <browse><format>
    613580
    614                         logger.error("Looking for browse");
    615581                        current_node = GSXML.getChildByTagName(current_node, "browse");
    616582
     
    618584                        if (classifier != null)
    619585                        {
    620                             logger.error("Classifier is not null");
    621                             logger.error("Classifier is " + classifier);
    622586                            current_node_list = GSXML.getChildrenByTagName(current_node, "classifier");
    623587                            index = Integer.parseInt(classifier.substring(2)) - 1;
    624                             logger.error("classifier index is " + index);
     588
    625589                            // index should be given by X-1
    626590                            current_node = current_node_list.item(index);
     
    628592                            if (GSXML.getChildByTagName(current_node, "format") == null)
    629593                            {
    630                                 logger.error("ERROR: valid classifier but does not have a format child");
    631594                                // well then create a format tag
    632595                                Element format_tag = config.createElement("format");
    633596                                current_node.appendChild(format_tag);
    634                                 //current_node = (Node) format_tag;
    635597                            }
    636598                        }
    637599                        else
    638600                        {
    639                             logger.error("Classifier is null");
    640601                            // To support all classifiers, set classifier to null?  There is the chance here that the format tag does not exist
    641602                            if (GSXML.getChildByTagName(current_node, "format") == null)
    642603                            {
    643                                 logger.error("ERROR: classifier does not have a format child");
    644604                                // well then create a format tag
    645605                                Element format_tag = config.createElement("format");
    646606                                current_node.appendChild(format_tag);
    647                                 //current_node = (Node) format_tag;
    648607                            }
    649608                        }
     
    651610                    else if (service.equals("AllClassifierBrowse"))
    652611                    {
    653                         logger.error("Looking for browse");
    654612                        current_node = GSXML.getChildByTagName(current_node, "browse");
    655613                        if (GSXML.getChildByTagName(current_node, "format") == null)
    656614                        {
    657                             logger.error("ERROR AllClassifierBrowse: all classifiers do not have a format child");
    658615                            // well then create a format tag
    659616                            Element format_tag = config.createElement("format");
    660617                            current_node.appendChild(format_tag);
    661                             //current_node = (Node) format_tag;
    662618                        }
    663619                    }
     
    665621                    {
    666622                        // look in <format> with no attributes
    667                         logger.error("I presume this is search");
    668 
    669623                        current_node_list = GSXML.getChildrenByTagName(current_node, "search");
    670624                        for (k = 0; k < current_node_list.getLength(); k++)
     
    681635
    682636                    // Now convert config document to string for writing to file
    683                     logger.error("Convert config to string");
    684637                    String new_config = this.converter.getString(config);
    685638
     
    692645                    writer.write(new_config);
    693646                    writer.close();
    694                     logger.error("All is happy with collection");
    695647
    696648                }
  • main/trunk/greenstone3/src/java/org/greenstone/gsdl3/service/DocumentMaker.java

    r24393 r24427  
    5555    protected static final String DOCUMENT_GET_INFORMATION = "DocumentGetInformation";
    5656
    57     //Metadata services
    58     protected static final String DOCUMENT_GET_METADATA = "DocumentGetMetadata";
    59     protected static final String DOCUMENT_ADD_METADATA = "DocumentAddMetadata";
    60     protected static final String DOCUMENT_DELETE_METADATA = "DocumentDeleteMetadata";
    61 
    62     //Document text services
    63     protected static final String DOCUMENT_GET_TEXT = "DocumentGetText";
    64     protected static final String DOCUMENT_SET_TEXT = "DocumentSetText";
    65 
    6657    //Other services
    6758    protected static final String DOCUMENT_EXECUTE_TRANSACTION = "DocumentExecuteTransaction";
    6859    /***************************************************/
    6960
    70     String[] services = { DOCUMENT_CREATE, DOCUMENT_DELETE, DOCUMENT_DUPLICATE, DOCUMENT_GET_INFORMATION, DOCUMENT_MOVE, DOCUMENT_MERGE, DOCUMENT_SPLIT, DOCUMENT_GET_METADATA, DOCUMENT_ADD_METADATA, DOCUMENT_DELETE_METADATA, DOCUMENT_GET_TEXT, DOCUMENT_SET_TEXT, DOCUMENT_EXECUTE_TRANSACTION };
     61    String[] services = { DOCUMENT_CREATE, DOCUMENT_DELETE, DOCUMENT_DUPLICATE, DOCUMENT_GET_INFORMATION, DOCUMENT_MOVE, DOCUMENT_MERGE, DOCUMENT_SPLIT, DOCUMENT_EXECUTE_TRANSACTION };
    7162
    7263    /** configure this service */
     
    360351        return null;
    361352    }
    362 
    363353}
Note: See TracChangeset for help on using the changeset viewer.