Ignore:
Timestamp:
2014-04-10T14:39:33+12:00 (10 years ago)
Author:
kjdon
Message:

Lots of changes. Mainly to do with removing this.doc from everywhere. Document is not thread safe. Now we tend to create a new Document everytime we are starting a new page/message etc. in service this.desc_doc is available as teh document to create service info stuff. But it should only be used for this and not for other messages. newDOM is now static for XMLConverter. method param changes for some GSXML methods.

File:
1 edited

Legend:

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

    r26446 r28966  
    3030                      Element build_config_xml){
    3131
    32     // metadata
     32    // add metadata to stored metadata list from collConfig and buildConfig
    3333    Element meta_list = (Element)GSXML.getChildByTagName(coll_config_xml, GSXML.METADATA_ELEM+GSXML.LIST_MODIFIER);
    3434    addMetadata(meta_list);
     
    3636    addMetadata(meta_list);
    3737
    38     meta_list = this.doc.createElement(GSXML.METADATA_ELEM + GSXML.LIST_MODIFIER);
    39     GSXML.addMetadata(this.doc, meta_list, "httpPath", this.site_http_address+"/collect/"+this.cluster_name);
    40     addMetadata(meta_list);
     38    addMetadata("httpPath", this.site_http_address+"/collect/"+this.cluster_name);
    4139
    4240    // display stuff
     
    4745    }
    4846
    49     //plugin stuff
    50     // Element import_list = (Element)GSXML.getChildByTagName(coll_config_xml, GSXML.IMPORT_ELEM);
    51     // if (import_list != null)
    52     // {
    53     //  Element plugin_list = (Element)GSXML.getChildByTagName(import_list, GSXML.PLUGIN_ELEM+GSXML.LIST_MODIFIER);
    54     //  addPlugins(plugin_list);
    55     // }
    56    
    5747    // are we a private collection??
    5848    if (this.metadata_list != null) {
     
    6959    Element config_doc_list = (Element)GSXML.getChildByTagName(coll_config_xml, GSXML.DOCUMENT_ELEM+GSXML.LIST_MODIFIER);
    7060    if (config_doc_list != null) {
    71         document_list = (Element)this.doc.importNode(config_doc_list, true);
     61        document_list = (Element)desc_doc.importNode(config_doc_list, true);
    7262    } else {
    73         document_list = this.doc.createElement(GSXML.DOCUMENT_ELEM+GSXML.LIST_MODIFIER);
     63        document_list = desc_doc.createElement(GSXML.DOCUMENT_ELEM+GSXML.LIST_MODIFIER);
    7464    }
    7565    return true;
     
    8272     * @return the result Element - should be <response>
    8373     */
    84     protected Element processMessage(Element request) {
     74  protected Element processMessage(Document response_doc, Element request) {
    8575
    86     Element response = this.doc.createElement(GSXML.RESPONSE_ELEM);
     76    Element response = response_doc.createElement(GSXML.RESPONSE_ELEM);
    8777    response.setAttribute(GSXML.FROM_ATT, this.cluster_name);
    8878    String type = request.getAttribute(GSXML.TYPE_ATT);
     
    9282    if (type.equals(GSXML.REQUEST_TYPE_DESCRIBE)) {
    9383        // create the collection element
    94         Element description = (Element)this.description.cloneNode(false);
     84      Element description = (Element)response_doc.importNode(this.description, false);
    9585        response.appendChild(description);
    9686        // check the param list
     
    9888        if (param_list == null) {
    9989        addAllDisplayInfo(description, lang);
    100         description.appendChild(this.service_list);
    101         description.appendChild(this.metadata_list);
    102         description.appendChild(this.library_param_list);
    103         description.appendChild(this.document_list);
     90        description.appendChild(response_doc.importNode(this.service_list, true));
     91        description.appendChild(response_doc.importNode(this.metadata_list, true));
     92        description.appendChild(response_doc.importNode(this.library_param_list, true));
     93        description.appendChild(response_doc.importNode(this.document_list, true));
    10494        return response;
    10595        }
     
    114104            String info = param.getAttribute(GSXML.VALUE_ATT);
    115105            if (info.equals(GSXML.SERVICE_ELEM+GSXML.LIST_MODIFIER)) {
    116             description.appendChild(this.service_list);
     106            description.appendChild(response_doc.importNode(this.service_list, true));
    117107            } else if (info.equals(GSXML.METADATA_ELEM+GSXML.LIST_MODIFIER)) {
    118             description.appendChild(metadata_list);
     108            description.appendChild(response_doc.importNode(metadata_list, true));
    119109            } else if (info.equals(GSXML.DISPLAY_TEXT_ELEM+GSXML.LIST_MODIFIER)) {
    120110            addAllDisplayInfo(description, lang);
    121111           
    122112            } else if (info.equals(GSXML.DOCUMENT_ELEM+GSXML.LIST_MODIFIER)) {
    123             description.appendChild(this.document_list);
    124             // } else if (info.equals(GSXML.PLUGIN_ELEM+GSXML.LIST_MODIFIER)) {
    125             //  description.appendChild(this.plugin_item_list);
    126             // }
    127             } else if (info.equals("libraryParamlist")) {
     113            description.appendChild(response_doc.importNode(this.document_list, true));
     114            } else if (info.equals(GSXML.LIBRARY_PARAM_ELEM+GSXML.LIST_MODIFIER)) {
    128115             
    129               description.appendChild(this.library_param_list);
     116            description.appendChild(response_doc.importNode(this.library_param_list, true));
    130117            }
    131118       
     
    134121        return response;
    135122    }
    136     return super.processMessage(request);
     123    return super.processMessage(response_doc, request);
    137124       
    138125    }
Note: See TracChangeset for help on using the changeset viewer.