Changeset 24993

Show
Ignore:
Timestamp:
26.01.2012 11:50:17 (8 years ago)
Author:
sjm84
Message:

Adding UserContext? to replace the use of lang and uid

Location:
main/trunk/greenstone3/src/java/org/greenstone/gsdl3
Files:
1 added
29 modified

Legend:

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

    r24982 r24993  
    132132 
    133133        Element xml_message = this.doc.createElement(GSXML.MESSAGE_ELEM); 
    134         Element xml_request = GSXML.createBasicRequest(this.doc, GSXML.REQUEST_TYPE_PAGE, "", "", ""); 
     134        Element xml_request = GSXML.createBasicRequest(this.doc, GSXML.REQUEST_TYPE_PAGE, "", new UserContext()); 
    135135        xml_message.appendChild(xml_request); 
    136136        Element xml_param_list = this.doc.createElement(GSXML.PARAM_ELEM + GSXML.LIST_MODIFIER); 
  • main/trunk/greenstone3/src/java/org/greenstone/gsdl3/LibraryServlet.java

    r24969 r24993  
    544544            } 
    545545        } 
     546        UserContext userContext = new UserContext(); 
     547        userContext.setLanguage(lang); 
     548        userContext.setUserID(uid); 
    546549 
    547550        // set the lang in the session 
     
    582585        // the request to the receptionist 
    583586        Element xml_message = this.doc.createElement(GSXML.MESSAGE_ELEM); 
    584         Element xml_request = GSXML.createBasicRequest(this.doc, GSXML.REQUEST_TYPE_PAGE, "", lang, uid); 
     587        Element xml_request = GSXML.createBasicRequest(this.doc, GSXML.REQUEST_TYPE_PAGE, "", userContext); 
    585588        xml_request.setAttribute(GSXML.OUTPUT_ATT, output); 
    586589 
  • main/trunk/greenstone3/src/java/org/greenstone/gsdl3/action/Action.java

    r24889 r24993  
    232232     *            the current user id 
    233233     */ 
    234     protected void addSiteMetadata(Element element, String lang, String uid) 
     234    protected void addSiteMetadata(Element element, UserContext userContext) 
    235235    { 
    236236        //ADD SITE METADATA 
    237         Element metadata_request = GSXML.createBasicRequest(this.doc, GSXML.REQUEST_TYPE_DESCRIBE, "", lang, uid); 
     237        Element metadata_request = GSXML.createBasicRequest(this.doc, GSXML.REQUEST_TYPE_DESCRIBE, "", userContext); 
    238238        //create a hashmap of params 
    239239        HashMap subset_params = new HashMap(1); 
  • main/trunk/greenstone3/src/java/org/greenstone/gsdl3/action/AppletAction.java

    r24986 r24993  
    4545        boolean coll_specified = true; 
    4646        String service_name = (String) params.get(GSParams.SERVICE); 
    47         String lang = request.getAttribute(GSXML.LANG_ATT); 
    48         String uid = request.getAttribute(GSXML.USER_ID_ATT); 
     47        UserContext userContext = new UserContext(request); 
    4948        String to = null; 
    5049        if (collection == null || collection.equals("")) 
     
    6362 
    6463            Element mr_message = this.doc.createElement(GSXML.MESSAGE_ELEM); 
    65             Element mr_request = GSXML.createBasicRequest(this.doc, GSXML.REQUEST_TYPE_PROCESS, to, lang, uid); 
     64            Element mr_request = GSXML.createBasicRequest(this.doc, GSXML.REQUEST_TYPE_PROCESS, to, userContext); 
    6665            mr_message.appendChild(mr_request); 
    6766            // just append all the params for now - should filter out unneeded ones 
     
    8180 
    8281        Element mr_message = this.doc.createElement(GSXML.MESSAGE_ELEM); 
    83         Element applet_request = GSXML.createBasicRequest(this.doc, GSXML.REQUEST_TYPE_DESCRIBE, to, lang, uid); 
     82        Element applet_request = GSXML.createBasicRequest(this.doc, GSXML.REQUEST_TYPE_DESCRIBE, to, userContext); 
    8483        mr_message.appendChild(applet_request); 
    8584 
  • main/trunk/greenstone3/src/java/org/greenstone/gsdl3/action/BrowseAction.java

    r24889 r24993  
    6464    } 
    6565 
    66     String lang = request.getAttribute(GSXML.LANG_ATT); 
    67     String uid = request.getAttribute(GSXML.USER_ID_ATT);    
     66    UserContext userContext = new UserContext(request);  
    6867    String to = GSPath.appendLink(collection, service_name); 
    6968     
     
    7372     
    7473    Element info_message = this.doc.createElement(GSXML.MESSAGE_ELEM); 
    75     Element info_request = GSXML.createBasicRequest(this.doc, GSXML.REQUEST_TYPE_DESCRIBE, to, lang, uid);  
     74    Element info_request = GSXML.createBasicRequest(this.doc, GSXML.REQUEST_TYPE_DESCRIBE, to, userContext);  
    7675    info_message.appendChild(info_request); 
    7776     
    7877    // also get the format stuff now if there is some 
    79     Element format_request = GSXML.createBasicRequest(this.doc, GSXML.REQUEST_TYPE_FORMAT, to, lang, uid); 
     78    Element format_request = GSXML.createBasicRequest(this.doc, GSXML.REQUEST_TYPE_FORMAT, to, userContext); 
    8079    info_message.appendChild(format_request); 
    8180    // process the requests 
     
    9291     
    9392    //append site metadata 
    94     addSiteMetadata(page_response, lang, uid); 
     93    addSiteMetadata(page_response, userContext); 
    9594 
    9695    // if rt=d, then we are just displaying the service 
     
    135134    // get the browse structure for the selected node 
    136135    Element classify_message = this.doc.createElement(GSXML.MESSAGE_ELEM); 
    137     Element classify_request = GSXML.createBasicRequest(this.doc, GSXML.REQUEST_TYPE_PROCESS, to, lang, uid); 
     136    Element classify_request = GSXML.createBasicRequest(this.doc, GSXML.REQUEST_TYPE_PROCESS, to, userContext); 
    138137    classify_message.appendChild(classify_request); 
    139138         
     
    200199    if (cl_nodes.getLength() > 0) { 
    201200        did_classifier = true; 
    202         Element cl_meta_request = GSXML.createBasicRequest(this.doc, GSXML.REQUEST_TYPE_PROCESS, to+"MetadataRetrieve", lang, uid); 
     201        Element cl_meta_request = GSXML.createBasicRequest(this.doc, GSXML.REQUEST_TYPE_PROCESS, to+"MetadataRetrieve", userContext); 
    203202        metadata_message.appendChild(cl_meta_request); 
    204203         
     
    237236    if (doc_nodes.getLength() > 0) { 
    238237        did_documents = true; 
    239         Element doc_meta_request = GSXML.createBasicRequest(this.doc, GSXML.REQUEST_TYPE_PROCESS, GSPath.appendLink(collection, "DocumentMetadataRetrieve"), lang, uid); 
     238        Element doc_meta_request = GSXML.createBasicRequest(this.doc, GSXML.REQUEST_TYPE_PROCESS, GSPath.appendLink(collection, "DocumentMetadataRetrieve"), userContext); 
    240239        metadata_message.appendChild(doc_meta_request); 
    241240         
  • main/trunk/greenstone3/src/java/org/greenstone/gsdl3/action/DocumentAction.java

    r24889 r24993  
    9797        has_rl = (String) params.get("rl");//for an external link : get the rl value if it is existing in the params list 
    9898        String collection = (String) params.get(GSParams.COLLECTION); 
    99         String lang = request.getAttribute(GSXML.LANG_ATT); 
    100         String uid = request.getAttribute(GSXML.USER_ID_ATT); 
     99        UserContext userContext = new UserContext(request); 
    101100        String document_name = (String) params.get(GSParams.DOCUMENT); 
    102101        if ((document_name == null || document_name.equals("")) && (has_href == null || has_href.equals(""))) 
     
    147146 
    148147        //append site metadata 
    149         addSiteMetadata(page_response, lang, uid); 
     148        addSiteMetadata(page_response, userContext); 
    150149 
    151150        // get the additional data needed for the page 
    152         getBackgroundData(page_response, collection, lang, uid); 
     151        getBackgroundData(page_response, collection, userContext); 
    153152        Element format_elem = (Element) GSXML.getChildByTagName(page_response, GSXML.FORMAT_ELEM); 
    154153 
     
    263262            Element ds_message = this.doc.createElement(GSXML.MESSAGE_ELEM); 
    264263            String to = GSPath.appendLink(collection, "DocumentStructureRetrieve");// Hard-wired? 
    265             Element ds_request = GSXML.createBasicRequest(this.doc, GSXML.REQUEST_TYPE_PROCESS, to, lang, uid); 
     264            Element ds_request = GSXML.createBasicRequest(this.doc, GSXML.REQUEST_TYPE_PROCESS, to, userContext); 
    266265            ds_message.appendChild(ds_request); 
    267266            ds_request.appendChild(ds_param_list); 
     
    339338        Element dm_message = this.doc.createElement(GSXML.MESSAGE_ELEM); 
    340339        String to = GSPath.appendLink(collection, "DocumentMetadataRetrieve"); // Hard-wired? 
    341         Element dm_request = GSXML.createBasicRequest(this.doc, GSXML.REQUEST_TYPE_PROCESS, to, lang, uid); 
     340        Element dm_request = GSXML.createBasicRequest(this.doc, GSXML.REQUEST_TYPE_PROCESS, to, userContext); 
    342341        dm_message.appendChild(dm_request); 
    343342        // Create a parameter list to specify the required metadata information 
     
    378377        // we also want a metadata request to the top level document to get 
    379378        // assocfilepath - this could be cached too 
    380         Element doc_meta_request = GSXML.createBasicRequest(this.doc, GSXML.REQUEST_TYPE_PROCESS, to, lang, uid); 
     379        Element doc_meta_request = GSXML.createBasicRequest(this.doc, GSXML.REQUEST_TYPE_PROCESS, to, userContext); 
    381380        dm_message.appendChild(doc_meta_request); 
    382381        Element doc_meta_param_list = this.doc.createElement(GSXML.PARAM_ELEM + GSXML.LIST_MODIFIER); 
     
    432431        Element dc_message = this.doc.createElement(GSXML.MESSAGE_ELEM); 
    433432        to = GSPath.appendLink(collection, "DocumentContentRetrieve"); // Hard-wired? 
    434         Element dc_request = GSXML.createBasicRequest(this.doc, GSXML.REQUEST_TYPE_PROCESS, to, lang, uid); 
     433        Element dc_request = GSXML.createBasicRequest(this.doc, GSXML.REQUEST_TYPE_PROCESS, to, userContext); 
    435434        dc_message.appendChild(dc_request); 
    436435 
     
    517516                    // send a message to the service 
    518517                    Element enrich_message = this.doc.createElement(GSXML.MESSAGE_ELEM); 
    519                     Element enrich_request = GSXML.createBasicRequest(this.doc, GSXML.REQUEST_TYPE_PROCESS, enrich_service, lang, uid); 
     518                    Element enrich_request = GSXML.createBasicRequest(this.doc, GSXML.REQUEST_TYPE_PROCESS, enrich_service, userContext); 
    520519                    enrich_message.appendChild(enrich_request); 
    521520                    // check for parameters 
     
    610609     * whatever the query is - should be cached 
    611610     */ 
    612     protected boolean getBackgroundData(Element page_response, String collection, String lang, String uid) 
     611    protected boolean getBackgroundData(Element page_response, String collection, UserContext userContext) 
    613612    { 
    614613 
     
    619618        String path = GSPath.appendLink(collection, "DocumentContentRetrieve"); 
    620619        // the format request - ignore for now, where does this request go to?? 
    621         Element format_request = GSXML.createBasicRequest(this.doc, GSXML.REQUEST_TYPE_FORMAT, path, lang, uid); 
     620        Element format_request = GSXML.createBasicRequest(this.doc, GSXML.REQUEST_TYPE_FORMAT, path, userContext); 
    622621        info_message.appendChild(format_request); 
    623622 
     
    626625        if (provide_annotations) 
    627626        { 
    628             Element enrich_services_request = GSXML.createBasicRequest(this.doc, GSXML.REQUEST_TYPE_DESCRIBE, "", lang, uid); 
     627            Element enrich_services_request = GSXML.createBasicRequest(this.doc, GSXML.REQUEST_TYPE_DESCRIBE, "", userContext); 
    629628            enrich_services_request.setAttribute(GSXML.INFO_ATT, "serviceList"); 
    630629            info_message.appendChild(enrich_services_request); 
     
    659658                if (((Element) e_services.item(j)).getAttribute(GSXML.TYPE_ATT).equals("enrich")) 
    660659                { 
    661                     Element s = GSXML.createBasicRequest(this.doc, GSXML.REQUEST_TYPE_DESCRIBE, ((Element) e_services.item(j)).getAttribute(GSXML.NAME_ATT), lang, uid); 
     660                    Element s = GSXML.createBasicRequest(this.doc, GSXML.REQUEST_TYPE_DESCRIBE, ((Element) e_services.item(j)).getAttribute(GSXML.NAME_ATT), userContext); 
    662661                    enrich_message.appendChild(s); 
    663662                    service_found = true; 
     
    711710        } 
    712711        String collection = (String) params.get(GSParams.COLLECTION); 
    713         String lang = request.getAttribute(GSXML.LANG_ATT); 
    714         String uid = request.getAttribute(GSXML.USER_ID_ATT); 
     712        UserContext userContext = new UserContext(request); 
    715713        String to = GSPath.appendLink(collection, service_name); 
    716714 
    717715        Element mr_query_message = this.doc.createElement(GSXML.MESSAGE_ELEM); 
    718         Element mr_query_request = GSXML.createBasicRequest(this.doc, GSXML.REQUEST_TYPE_PROCESS, to, lang, uid); 
     716        Element mr_query_request = GSXML.createBasicRequest(this.doc, GSXML.REQUEST_TYPE_PROCESS, to, userContext); 
    719717        mr_query_message.appendChild(mr_query_request); 
    720718 
     
    899897        { 
    900898            //We don't want to find words inside HTML tags 
    901             if(content_characters[i] == '<') 
     899            if (content_characters[i] == '<') 
    902900            { 
    903901                inTag = true; 
     
    912910                continue; 
    913911            } 
    914              
     912 
    915913            boolean is_character_letter_or_digit = Character.isLetterOrDigit(content_characters[i]); 
    916              
     914 
    917915            // Has a word just started? 
    918916            if (in_word == false && is_character_letter_or_digit == true) 
  • main/trunk/greenstone3/src/java/org/greenstone/gsdl3/action/FormatAction.java

    r24247 r24993  
    1212// other java stuff 
    1313import java.io.File; 
    14 import java.util.HashMap; 
    1514import java.util.*; 
    1615import java.io.StringReader; 
     
    4645     
    4746        String subaction = request.getAttribute(GSXML.SUBACTION_ATT); 
    48         String lang = request.getAttribute(GSXML.LANG_ATT); 
    49         String uid = request.getAttribute(GSXML.USER_ID_ATT); 
     47        UserContext userContext = new UserContext(request); 
    5048        // get the param list 
    5149        Element cgi_param_list = (Element)GSXML.getChildByTagName(request, GSXML.PARAM_ELEM+GSXML.LIST_MODIFIER); 
     
    6462 
    6563        Element mr_request_message = this.doc.createElement(GSXML.MESSAGE_ELEM); 
    66         Element mr_request = GSXML.createBasicRequest(this.doc, GSXML.REQUEST_TYPE_FORMAT_STRING, to, lang, uid); 
     64        Element mr_request = GSXML.createBasicRequest(this.doc, GSXML.REQUEST_TYPE_FORMAT_STRING, to, userContext); 
    6765 
    6866        mr_request.setAttribute("service", service); 
  • main/trunk/greenstone3/src/java/org/greenstone/gsdl3/action/GS2BrowseAction.java

    r24990 r24993  
    5858        } 
    5959 
    60         String lang = request.getAttribute(GSXML.LANG_ATT); 
    61         String uid = request.getAttribute(GSXML.USER_ID_ATT); 
     60        UserContext userContext = new UserContext(request); 
    6261        String to = GSPath.appendLink(collection, service_name); 
    6362 
     
    6766 
    6867        Element info_message = this.doc.createElement(GSXML.MESSAGE_ELEM); 
    69         Element info_request = GSXML.createBasicRequest(this.doc, GSXML.REQUEST_TYPE_DESCRIBE, to, lang, uid); 
     68        Element info_request = GSXML.createBasicRequest(this.doc, GSXML.REQUEST_TYPE_DESCRIBE, to, userContext); 
    7069        info_message.appendChild(info_request); 
    7170 
    7271        // also get the format stuff now if there is some 
    73         Element format_request = GSXML.createBasicRequest(this.doc, GSXML.REQUEST_TYPE_FORMAT, to, lang, uid); 
     72        Element format_request = GSXML.createBasicRequest(this.doc, GSXML.REQUEST_TYPE_FORMAT, to, userContext); 
    7473        info_message.appendChild(format_request); 
    7574        // process the requests 
     
    8685 
    8786        //append site metadata 
    88         addSiteMetadata(page_response, lang, uid); 
     87        addSiteMetadata(page_response, userContext); 
    8988 
    9089        // if rt=d, then we are just displaying the service 
     
    154153        // get the browse structure for the selected node 
    155154        Element classify_message = this.doc.createElement(GSXML.MESSAGE_ELEM); 
    156         Element classify_request = GSXML.createBasicRequest(this.doc, GSXML.REQUEST_TYPE_PROCESS, to, lang, uid); 
     155        Element classify_request = GSXML.createBasicRequest(this.doc, GSXML.REQUEST_TYPE_PROCESS, to, userContext); 
    157156        classify_message.appendChild(classify_request); 
    158157 
     
    252251        { 
    253252            did_classifier = true; 
    254             Element cl_meta_request = GSXML.createBasicRequest(this.doc, GSXML.REQUEST_TYPE_PROCESS, to + "MetadataRetrieve", lang, uid); 
     253            Element cl_meta_request = GSXML.createBasicRequest(this.doc, GSXML.REQUEST_TYPE_PROCESS, to + "MetadataRetrieve", userContext); 
    255254            metadata_message.appendChild(cl_meta_request); 
    256255 
     
    281280        { 
    282281            did_documents = true; 
    283             Element doc_meta_request = GSXML.createBasicRequest(this.doc, GSXML.REQUEST_TYPE_PROCESS, GSPath.appendLink(collection, "DocumentMetadataRetrieve"), lang, uid); 
     282            Element doc_meta_request = GSXML.createBasicRequest(this.doc, GSXML.REQUEST_TYPE_PROCESS, GSPath.appendLink(collection, "DocumentMetadataRetrieve"), userContext); 
    284283            metadata_message.appendChild(doc_meta_request); 
    285284 
  • main/trunk/greenstone3/src/java/org/greenstone/gsdl3/action/GeneralAction.java

    r24866 r24993  
    2626        logger.debug(" request=" + this.converter.getString(request)); 
    2727 
    28         String lang = request.getAttribute(GSXML.LANG_ATT); 
    29         String uid = request.getAttribute(GSXML.USER_ID_ATT); 
     28        UserContext userContext = new UserContext(request); 
    3029 
    3130        // get the param list 
     
    6665 
    6766            Element mr_query_message = this.doc.createElement(GSXML.MESSAGE_ELEM); 
    68             Element mr_query_request = GSXML.createBasicRequest(this.doc, GSXML.REQUEST_TYPE_PROCESS, to, lang, uid); 
     67            Element mr_query_request = GSXML.createBasicRequest(this.doc, GSXML.REQUEST_TYPE_PROCESS, to, userContext); 
    6968             
    7069            if(request_type.equals("s")) 
     
    9190            { 
    9291                // just send the reponse as is 
    93                 addSiteMetadata(result_response, lang, uid); 
     92                addSiteMetadata(result_response, userContext); 
    9493                return result_response; 
    9594            } 
     
    105104        // request the service info for the selected service - should be cached 
    106105        Element mr_info_message = this.doc.createElement(GSXML.MESSAGE_ELEM); 
    107         Element mr_info_request = GSXML.createBasicRequest(this.doc, GSXML.REQUEST_TYPE_DESCRIBE, to, lang, uid); 
     106        Element mr_info_request = GSXML.createBasicRequest(this.doc, GSXML.REQUEST_TYPE_DESCRIBE, to, userContext); 
    108107        mr_info_message.appendChild(mr_info_request); 
    109108        Element mr_info_response = (Element) this.mr.process(mr_info_message); 
     
    118117        } 
    119118 
    120         addSiteMetadata(page_response, lang, uid); 
     119        addSiteMetadata(page_response, userContext); 
    121120         
    122121        return result; 
  • main/trunk/greenstone3/src/java/org/greenstone/gsdl3/action/NoCollQueryAction.java

    r24988 r24993  
    6565 
    6666        String request_type = (String) params.get(GSParams.REQUEST_TYPE); 
    67         String lang = request.getAttribute(GSXML.LANG_ATT); 
    68         String uid = request.getAttribute(GSXML.USER_ID_ATT); 
     67        UserContext userContext = new UserContext(request); 
    6968        if (request_type.equals("d")) 
    7069        { 
     
    7271            // the only info we need to return is the collection list cos the xslt does teh rest 
    7372 
    74             Element coll_list = getCollectionList(lang, uid); 
     73            Element coll_list = getCollectionList(userContext); 
    7574            page_response.appendChild(this.doc.importNode(coll_list, true)); 
    7675            return page_response; 
     
    8988        { 
    9089            logger.error("no collections were specified!"); 
    91             Element coll_list = getCollectionList(lang, uid); 
     90            Element coll_list = getCollectionList(userContext); 
    9291            page_response.appendChild(this.doc.importNode(coll_list, true)); 
    9392            return page_response; 
     
    111110        { 
    112111            String to = GSPath.appendLink(colls[i], service_name); 
    113             Element mr_query_request = GSXML.createBasicRequest(this.doc, GSXML.REQUEST_TYPE_PROCESS, to, lang, uid); 
     112            Element mr_query_request = GSXML.createBasicRequest(this.doc, GSXML.REQUEST_TYPE_PROCESS, to, userContext); 
    114113            mr_query_message.appendChild(mr_query_request); 
    115114            mr_query_request.appendChild(query_param_list.cloneNode(true)); 
     
    130129                String coll_name = extractCollName(((Element) responses.item(j)).getAttribute(GSXML.FROM_ATT)); 
    131130                String path = GSPath.appendLink(coll_name, "DocumentMetadataRetrieve"); 
    132                 Element mr_meta_request = GSXML.createBasicRequest(this.doc, GSXML.REQUEST_TYPE_PROCESS, path, lang, uid); 
     131                Element mr_meta_request = GSXML.createBasicRequest(this.doc, GSXML.REQUEST_TYPE_PROCESS, path, userContext); 
    133132                mr_meta_message.appendChild(mr_meta_request); 
    134133                mr_meta_request.appendChild(this.doc.importNode(document_list, true)); 
     
    182181    } 
    183182 
    184     protected Element getCollectionList(String lang, String uid) 
     183    protected Element getCollectionList(UserContext userContext) 
    185184    { 
    186185 
    187186        // first, get the message router info 
    188187        Element coll_list_message = this.doc.createElement(GSXML.MESSAGE_ELEM); 
    189         Element coll_list_request = GSXML.createBasicRequest(this.doc, GSXML.REQUEST_TYPE_DESCRIBE, "", lang, uid); 
     188        Element coll_list_request = GSXML.createBasicRequest(this.doc, GSXML.REQUEST_TYPE_DESCRIBE, "", userContext); 
    190189        coll_list_message.appendChild(coll_list_request); 
    191190        Element coll_list_response = (Element) this.mr.process(coll_list_message); 
     
    209208            String name = c.getAttribute(GSXML.NAME_ATT); 
    210209 
    211             Element metadata_request = GSXML.createBasicRequest(this.doc, GSXML.REQUEST_TYPE_DESCRIBE, name, lang, uid); 
     210            Element metadata_request = GSXML.createBasicRequest(this.doc, GSXML.REQUEST_TYPE_DESCRIBE, name, userContext); 
    212211            metadata_request.appendChild(coll_param_list.cloneNode(true)); 
    213212            metadata_message.appendChild(metadata_request); 
  • main/trunk/greenstone3/src/java/org/greenstone/gsdl3/action/PageAction.java

    r24989 r24993  
    6969    { 
    7070 
    71         String lang = request.getAttribute(GSXML.LANG_ATT); 
    72         String uid = request.getAttribute(GSXML.USER_ID_ATT); 
     71        UserContext userContext = new UserContext(request); 
    7372        // first, get the message router info 
    7473        Element info_message = this.doc.createElement(GSXML.MESSAGE_ELEM); 
    75         Element coll_list_request = GSXML.createBasicRequest(this.doc, GSXML.REQUEST_TYPE_DESCRIBE, "", lang, uid); 
     74        Element coll_list_request = GSXML.createBasicRequest(this.doc, GSXML.REQUEST_TYPE_DESCRIBE, "", userContext); 
    7675        info_message.appendChild(coll_list_request); 
    7776        Element info_response_message = (Element) this.mr.process(info_message); 
     
    9796            if (colls.getLength() > 0) 
    9897            { 
    99                 sendMultipleRequests(colls, null, GSXML.REQUEST_TYPE_DESCRIBE, lang, uid); 
     98                sendMultipleRequests(colls, null, GSXML.REQUEST_TYPE_DESCRIBE, userContext); 
    10099            } 
    101100        } 
     
    108107            if (services.getLength() > 0) 
    109108            { 
    110                 sendMultipleRequests(services, null, GSXML.REQUEST_TYPE_DESCRIBE, lang, uid); 
     109                sendMultipleRequests(services, null, GSXML.REQUEST_TYPE_DESCRIBE, userContext); 
    111110            } 
    112111        } 
     
    119118            if (clusters.getLength() > 0) 
    120119            { 
    121                 sendMultipleRequests(clusters, null, GSXML.REQUEST_TYPE_DESCRIBE, lang, uid); 
     120                sendMultipleRequests(clusters, null, GSXML.REQUEST_TYPE_DESCRIBE, userContext); 
    122121 
    123122            } 
     
    132131    { 
    133132 
    134         String lang = request.getAttribute(GSXML.LANG_ATT); 
    135         String uid = request.getAttribute(GSXML.USER_ID_ATT); 
     133        UserContext userContext = new UserContext(request); 
    136134        // extract the params from the cgi-request,  
    137135        Element cgi_paramList = (Element) GSXML.getChildByTagName(request, GSXML.PARAM_ELEM + GSXML.LIST_MODIFIER); 
     
    144142            // return an empty response 
    145143            Element response = this.doc.createElement(GSXML.RESPONSE_ELEM); 
    146             addSiteMetadata(response, lang, uid); 
     144            addSiteMetadata(response, userContext); 
    147145            return response; 
    148146        } 
     
    151149        Element coll_about_message = this.doc.createElement(GSXML.MESSAGE_ELEM); 
    152150 
    153         Element coll_about_request = GSXML.createBasicRequest(this.doc, GSXML.REQUEST_TYPE_DESCRIBE, coll_name, lang, uid); 
     151        Element coll_about_request = GSXML.createBasicRequest(this.doc, GSXML.REQUEST_TYPE_DESCRIBE, coll_name, userContext); 
    154152        coll_about_message.appendChild(coll_about_request); 
    155153        Element coll_about_response = (Element) this.mr.process(coll_about_message); 
     
    196194        if (services.getLength() > 0) 
    197195        { 
    198             sendMultipleRequests(services, coll_name, GSXML.REQUEST_TYPE_DESCRIBE, lang, uid); 
     196            sendMultipleRequests(services, coll_name, GSXML.REQUEST_TYPE_DESCRIBE, userContext); 
    199197        } 
    200198 
    201199        Element response = (Element) GSXML.getChildByTagName(coll_about_response, GSXML.RESPONSE_ELEM); 
    202200        //add the site metadata 
    203         addSiteMetadata(response, lang, uid); 
     201        addSiteMetadata(response, userContext); 
    204202        return response; 
    205203    } 
     
    213211    protected Element unknownPage(Element request) 
    214212    { 
    215  
    216         String lang = request.getAttribute(GSXML.LANG_ATT); 
    217         String uid = request.getAttribute(GSXML.USER_ID_ATT); 
     213        UserContext userContext = new UserContext(request); 
    218214        String page_name = request.getAttribute(GSXML.SUBACTION_ATT); 
    219215 
     
    227223            // just return an empty response 
    228224            Element response = this.doc.createElement(GSXML.RESPONSE_ELEM); 
    229             addSiteMetadata(response, lang, uid); 
     225            addSiteMetadata(response, userContext); 
    230226            return response; 
    231227        } 
     
    237233        Element coll_about_message = this.doc.createElement(GSXML.MESSAGE_ELEM); 
    238234 
    239         Element coll_about_request = GSXML.createBasicRequest(this.doc, GSXML.REQUEST_TYPE_DESCRIBE, coll_name, lang, uid); 
     235        Element coll_about_request = GSXML.createBasicRequest(this.doc, GSXML.REQUEST_TYPE_DESCRIBE, coll_name, userContext); 
    240236        coll_about_message.appendChild(coll_about_request); 
    241237 
     
    245241 
    246242        //add the site metadata 
    247         addSiteMetadata(response, lang, uid); 
     243        addSiteMetadata(response, userContext); 
    248244 
    249245        return response; 
     
    251247    } 
    252248 
    253     protected boolean sendMultipleRequests(NodeList items, String path_prefix, String request_type, String lang, String uid) 
     249    protected boolean sendMultipleRequests(NodeList items, String path_prefix, String request_type, UserContext userContext) 
    254250    { 
    255251 
     
    264260                path = GSPath.appendLink(path_prefix, path); 
    265261            } 
    266             Element request = GSXML.createBasicRequest(this.doc, request_type, path, lang, uid); 
     262            Element request = GSXML.createBasicRequest(this.doc, request_type, path, userContext); 
    267263            message.appendChild(request); 
    268264        } 
  • main/trunk/greenstone3/src/java/org/greenstone/gsdl3/action/ProcessAction.java

    r24991 r24993  
    4343        } 
    4444        String request_type = (String) params.get(GSParams.REQUEST_TYPE); 
    45         String lang = request.getAttribute(GSXML.LANG_ATT); 
    46         String uid = request.getAttribute(GSXML.USER_ID_ATT); 
     45        UserContext userContext = new UserContext(request); 
    4746        // what is carried out depends on the request_type 
    4847        // if rt=d, then a describe request is done, 
     
    9493 
    9594            } 
    96             Element mr_query_request = GSXML.createBasicRequest(this.doc, request_type_att, to, lang, uid); 
     95            Element mr_query_request = GSXML.createBasicRequest(this.doc, request_type_att, to, userContext); 
    9796            if (param_list != null) 
    9897            { 
     
    119118        // request the service info for the selected service - should be cached 
    120119        Element mr_info_message = this.doc.createElement(GSXML.MESSAGE_ELEM); 
    121         Element mr_info_request = GSXML.createBasicRequest(this.doc, GSXML.REQUEST_TYPE_DESCRIBE, to, lang, uid); 
     120        Element mr_info_request = GSXML.createBasicRequest(this.doc, GSXML.REQUEST_TYPE_DESCRIBE, to, userContext); 
    122121        mr_info_message.appendChild(mr_info_request); 
    123122        Element mr_info_response = (Element) this.mr.process(mr_info_message); 
  • main/trunk/greenstone3/src/java/org/greenstone/gsdl3/action/QueryAction.java

    r24987 r24993  
    6868        } 
    6969 
    70         String lang = request.getAttribute(GSXML.LANG_ATT); 
    71         String uid = request.getAttribute(GSXML.USER_ID_ATT); 
     70        UserContext userContext = new UserContext(request); 
    7271        String to = service_name; 
    7372        if (collection != null) 
     
    8079            // we have been asked for the service description 
    8180            Element mr_info_message = this.doc.createElement(GSXML.MESSAGE_ELEM); 
    82             Element mr_info_request = GSXML.createBasicRequest(this.doc, GSXML.REQUEST_TYPE_DESCRIBE, to, lang, uid); 
     81            Element mr_info_request = GSXML.createBasicRequest(this.doc, GSXML.REQUEST_TYPE_DESCRIBE, to, userContext); 
    8382            mr_info_message.appendChild(mr_info_request); 
    8483 
     
    8685            Element mr_info_response = (Element) this.mr.process(mr_info_message); 
    8786            // the response 
     87             
    8888            Element service_response = (Element) GSXML.getChildByTagName(mr_info_response, GSXML.RESPONSE_ELEM); 
    8989 
     
    9696            // just a display request, no actual processing to do 
    9797            //append site metadata 
    98             addSiteMetadata(page_response, lang, uid); 
     98            addSiteMetadata(page_response, userContext); 
    9999            return page_response; 
    100100        } 
     
    105105        { // no query 
    106106            //append site metadata 
    107             addSiteMetadata(page_response, lang, uid); 
     107            addSiteMetadata(page_response, userContext); 
    108108            return page_response; 
    109109        } 
     
    111111        // create the query request 
    112112        Element mr_query_message = this.doc.createElement(GSXML.MESSAGE_ELEM); 
    113         Element mr_query_request = GSXML.createBasicRequest(this.doc, GSXML.REQUEST_TYPE_PROCESS, to, lang, uid); 
     113        Element mr_query_request = GSXML.createBasicRequest(this.doc, GSXML.REQUEST_TYPE_PROCESS, to, userContext); 
    114114        mr_query_message.appendChild(mr_query_request); 
    115115 
     
    119119 
    120120        // also get the format stuff now if there is some 
    121         Element format_request = GSXML.createBasicRequest(this.doc, GSXML.REQUEST_TYPE_FORMAT, to, lang, uid); 
     121        Element format_request = GSXML.createBasicRequest(this.doc, GSXML.REQUEST_TYPE_FORMAT, to, userContext); 
    122122        mr_query_message.appendChild(format_request); 
    123123 
     
    131131        { 
    132132            //append site metadata 
    133             addSiteMetadata(page_response, lang, uid); 
     133            addSiteMetadata(page_response, userContext); 
    134134            return page_response; 
    135135        } 
     
    167167            page_response.appendChild(this.doc.createElement(GSXML.DOC_NODE_ELEM + GSXML.LIST_MODIFIER)); 
    168168            //append site metadata 
    169             addSiteMetadata(page_response, lang, uid); 
     169            addSiteMetadata(page_response, userContext); 
    170170            return page_response; 
    171171        } 
     
    179179            page_response.appendChild(this.doc.importNode(document_list, true)); 
    180180            //append site metadata 
    181             addSiteMetadata(page_response, lang, uid); 
     181            addSiteMetadata(page_response, userContext); 
    182182            return page_response; 
    183183        } 
     
    207207            to = GSPath.prependLink(to, collection); 
    208208        } 
    209         Element mr_metadata_request = GSXML.createBasicRequest(this.doc, GSXML.REQUEST_TYPE_PROCESS, to, lang, uid); 
     209        Element mr_metadata_request = GSXML.createBasicRequest(this.doc, GSXML.REQUEST_TYPE_PROCESS, to, userContext); 
    210210        mr_metadata_message.appendChild(mr_metadata_request); 
    211211 
     
    235235        logger.debug("Query page:\n" + this.converter.getPrettyString(page_response)); 
    236236        //append site metadata 
    237         addSiteMetadata(page_response, lang, uid); 
     237        addSiteMetadata(page_response, userContext); 
    238238        return page_response; 
    239239    } 
  • main/trunk/greenstone3/src/java/org/greenstone/gsdl3/action/SystemAction.java

    r24985 r24993  
    1111// other java stuff 
    1212import java.io.File; 
    13 import java.util.HashMap; 
    1413import java.util.*; 
    1514import java.io.StringReader; 
     
    4645 
    4746        String subaction = request.getAttribute(GSXML.SUBACTION_ATT); 
    48         String lang = request.getAttribute(GSXML.LANG_ATT); 
    49         String uid = request.getAttribute(GSXML.USER_ID_ATT); 
     47        UserContext userContext = new UserContext(request); 
    5048        // get the param list 
    5149        Element cgi_param_list = (Element) GSXML.getChildByTagName(request, GSXML.PARAM_ELEM + GSXML.LIST_MODIFIER); 
     
    6361 
    6462        Element mr_request_message = this.doc.createElement(GSXML.MESSAGE_ELEM); 
    65         Element mr_request = GSXML.createBasicRequest(this.doc, GSXML.REQUEST_TYPE_SYSTEM, to, lang, uid); 
     63        Element mr_request = GSXML.createBasicRequest(this.doc, GSXML.REQUEST_TYPE_SYSTEM, to, userContext); 
    6664        mr_request_message.appendChild(mr_request); 
    6765 
  • main/trunk/greenstone3/src/java/org/greenstone/gsdl3/action/XMLDocumentAction.java

    r24992 r24993  
    5252            return result; 
    5353        } 
    54         String lang = request.getAttribute(GSXML.LANG_ATT); 
    55         String uid = request.getAttribute(GSXML.USER_ID_ATT); 
     54        UserContext userContext = new UserContext(request); 
    5655 
    5756        // subaction used to decide if we are returning content or structure 
     
    7473        Element mr_message = this.doc.createElement(GSXML.MESSAGE_ELEM); 
    7574 
    76         Element ret_request = GSXML.createBasicRequest(this.doc, GSXML.REQUEST_TYPE_PROCESS, to, lang, uid); 
     75        Element ret_request = GSXML.createBasicRequest(this.doc, GSXML.REQUEST_TYPE_PROCESS, to, userContext); 
    7776        mr_message.appendChild(ret_request); 
    7877 
     
    8584        // also add in a request for the Title metadata 
    8685        to = GSPath.appendLink(collection, "DocumentMetadataRetrieve"); 
    87         Element meta_request = GSXML.createBasicRequest(this.doc, GSXML.REQUEST_TYPE_PROCESS, to, lang, uid); 
     86        Element meta_request = GSXML.createBasicRequest(this.doc, GSXML.REQUEST_TYPE_PROCESS, to, userContext); 
    8887        // copy the doc list 
    8988        meta_request.appendChild(doc_list.cloneNode(true)); 
  • main/trunk/greenstone3/src/java/org/greenstone/gsdl3/collection/ServiceCluster.java

    r24975 r24993  
    347347            // services it provides 
    348348            Element message = this.doc.createElement(GSXML.MESSAGE_ELEM); 
    349             Element request = GSXML.createBasicRequest(this.doc, GSXML.REQUEST_TYPE_DESCRIBE, "", "", ""); 
     349            Element request = GSXML.createBasicRequest(this.doc, GSXML.REQUEST_TYPE_DESCRIBE, "", new UserContext()); 
    350350            message.appendChild(request); 
    351351 
  • main/trunk/greenstone3/src/java/org/greenstone/gsdl3/core/DefaultReceptionist.java

    r24974 r24993  
    5555        // see if the collection/cluster element is already there 
    5656        String coll_name = coll_param.getAttribute(GSXML.VALUE_ATT); 
    57         String lang = page_request.getAttribute(GSXML.LANG_ATT); 
    58         String uid = page_request.getAttribute(GSXML.USER_ID_ATT); 
     57        UserContext userContext = new UserContext(page_request); 
    5958 
    6059        if (coll_name.equals("")) 
     
    8483            // we dont have one yet - get it 
    8584            Element coll_about_message = this.doc.createElement(GSXML.MESSAGE_ELEM); 
    86             Element coll_about_request = GSXML.createBasicRequest(this.doc, GSXML.REQUEST_TYPE_DESCRIBE, coll_name, lang, uid); 
     85            Element coll_about_request = GSXML.createBasicRequest(this.doc, GSXML.REQUEST_TYPE_DESCRIBE, coll_name, userContext); 
    8786            coll_about_message.appendChild(coll_about_request); 
    8887 
     
    158157            String name = c.getAttribute(GSXML.NAME_ATT); 
    159158            String address = GSPath.appendLink(coll_name, name); 
    160             Element info_request = GSXML.createBasicRequest(this.doc, GSXML.REQUEST_TYPE_DESCRIBE, address, lang, uid); 
     159            Element info_request = GSXML.createBasicRequest(this.doc, GSXML.REQUEST_TYPE_DESCRIBE, address, userContext); 
    161160            //Element req_param_list = this.doc.createElement(GSXML.PARAM_ELEM+GSXML.LIST_MODIFIER); 
    162161            //req_param_list.appendChild(GSXML.createParameter(this.doc, GSXML.SUBSET_PARAM, GSXML.DISPLAY_TEXT_ELEM+GSXML.LIST_MODIFIER)); 
  • main/trunk/greenstone3/src/java/org/greenstone/gsdl3/core/MessageRouter.java

    r23938 r24993  
    454454     
    455455    Element service_message = this.doc.createElement(GSXML.MESSAGE_ELEM); 
    456     Element service_request = GSXML.createBasicRequest(this.doc, GSXML.REQUEST_TYPE_DESCRIBE, "", "", ""); 
     456    Element service_request = GSXML.createBasicRequest(this.doc, GSXML.REQUEST_TYPE_DESCRIBE, "", new UserContext()); 
    457457    service_message.appendChild(service_request); 
    458458     
     
    774774     
    775775    Element info_request = this.doc.createElement(GSXML.MESSAGE_ELEM); 
    776     Element req = GSXML.createBasicRequest(this.doc, GSXML.REQUEST_TYPE_DESCRIBE, "", "", ""); 
     776    Element req = GSXML.createBasicRequest(this.doc, GSXML.REQUEST_TYPE_DESCRIBE, "", new UserContext()); 
    777777    info_request.appendChild(req); 
    778778     
  • main/trunk/greenstone3/src/java/org/greenstone/gsdl3/core/TransformingReceptionist.java

    r24884 r24993  
    763763        //Transformation of the XML message from the receptionist to HTML with doctype 
    764764 
    765         if(inlineTemplate != null) 
     765        if (inlineTemplate != null) 
    766766        { 
    767767            try 
     
    770770                GSXSLT.mergeStylesheets(skinAndLibraryDoc, inlineTemplateDoc.getDocumentElement()); 
    771771            } 
    772             catch(Exception ex) 
     772            catch (Exception ex) 
    773773            { 
    774774                ex.printStackTrace(); 
    775775            } 
    776776        } 
    777          
     777 
    778778        if (skinAndLibraryDoc.getElementsByTagName("gsf:metadata").getLength() > 0) 
    779779        { 
    780             secondConfigFormatPass(collection, skinAndLibraryDoc, doc, request.getAttribute("lang"), request.getAttribute("uid")); 
     780            secondConfigFormatPass(collection, skinAndLibraryDoc, doc, new UserContext(request)); 
    781781        } 
    782782 
     
    795795    } 
    796796 
    797     protected void secondConfigFormatPass(String collection, Document skinAndLibraryDoc, Document doc, String lang, String uid) 
     797    protected void secondConfigFormatPass(String collection, Document skinAndLibraryDoc, Document doc, UserContext userContext) 
    798798    { 
    799799        String to = GSPath.appendLink(collection, "DocumentMetadataRetrieve"); // Hard-wired? 
    800800        Element metaMessage = this.doc.createElement(GSXML.MESSAGE_ELEM); 
    801         Element metaRequest = GSXML.createBasicRequest(this.doc, GSXML.REQUEST_TYPE_PROCESS, to, lang, uid); 
     801        Element metaRequest = GSXML.createBasicRequest(this.doc, GSXML.REQUEST_TYPE_PROCESS, to, userContext); 
    802802        Element paramList = this.doc.createElement(GSXML.PARAM_ELEM + GSXML.LIST_MODIFIER); 
    803803        Element docNodeList = this.doc.createElement(GSXML.DOC_NODE_ELEM + GSXML.LIST_MODIFIER); 
  • main/trunk/greenstone3/src/java/org/greenstone/gsdl3/service/ArchiveIO.java

    r24393 r24993  
    2828import org.greenstone.gsdl3.util.GSXML; 
    2929import org.greenstone.gsdl3.util.SimpleCollectionDatabase; 
     30import org.greenstone.gsdl3.util.UserContext; 
    3031 
    3132import org.w3c.dom.Element; 
     
    108109        result.setAttribute(GSXML.TYPE_ATT, GSXML.REQUEST_TYPE_PROCESS); 
    109110 
    110         String lang = request.getAttribute(GSXML.LANG_ATT); 
    111         String uid = request.getAttribute(GSXML.USER_ID_ATT); 
     111        UserContext userContext = new UserContext(request); 
    112112 
    113113        // Get the parameters of the request 
     
    123123        String collection = (String) params.get(GSXML.COLLECTION_ATT); 
    124124 
    125         String filePath = _GSDM.archiveGetDocumentFilePath(oid, collection, lang, uid); 
     125        String filePath = _GSDM.archiveGetDocumentFilePath(oid, collection, userContext); 
    126126         
    127127        Element metadataList = this.doc.createElement(GSXML.METADATA_ELEM + GSXML.LIST_MODIFIER); 
     
    139139        result.setAttribute(GSXML.TYPE_ATT, GSXML.REQUEST_TYPE_PROCESS); 
    140140 
    141         String lang = request.getAttribute(GSXML.LANG_ATT); 
    142         String uid = request.getAttribute(GSXML.USER_ID_ATT); 
     141        UserContext userContext = new UserContext(request); 
    143142 
    144143        // Get the parameters of the request 
     
    154153        String collection = (String) params.get(GSXML.COLLECTION_ATT); 
    155154 
    156         String oid = _GSDM.archiveGetSourceFileOID(srcFile, collection, lang, uid); 
     155        String oid = _GSDM.archiveGetSourceFileOID(srcFile, collection, userContext); 
    157156        if(_GSDM.checkError(result, ARCHIVE_GET_SOURCE_FILE_OID)) 
    158157        { 
     
    174173        result.setAttribute(GSXML.TYPE_ATT, GSXML.REQUEST_TYPE_PROCESS); 
    175174 
    176         String lang = request.getAttribute(GSXML.LANG_ATT); 
    177         String uid = request.getAttribute(GSXML.USER_ID_ATT); 
     175        UserContext userContext = new UserContext(request); 
    178176 
    179177        // Get the parameters of the request 
     
    189187        String collection = (String) params.get(GSXML.COLLECTION_ATT); 
    190188         
    191         boolean exists = _GSDM.archiveCheckDocumentOrSectionExists(oid, collection, lang, uid); 
     189        boolean exists = _GSDM.archiveCheckDocumentOrSectionExists(oid, collection, userContext); 
    192190        if(_GSDM.checkError(result, ARCHIVE_CHECK_DOCUMENT_OR_SECTION_EXISTS)) 
    193191        { 
     
    207205        result.setAttribute(GSXML.TYPE_ATT, GSXML.REQUEST_TYPE_PROCESS); 
    208206 
    209         String lang = request.getAttribute(GSXML.LANG_ATT); 
    210         String uid = request.getAttribute(GSXML.USER_ID_ATT); 
     207        UserContext userContext = new UserContext(request); 
    211208 
    212209        // Get the parameters of the request 
     
    255252        } 
    256253         
    257         _GSDM.archiveWriteEntryToDatabase(oid, collection, info, lang, uid); 
     254        _GSDM.archiveWriteEntryToDatabase(oid, collection, info, userContext); 
    258255        _GSDM.checkError(result, ARCHIVE_WRITE_ENTRY_TO_DATABASE); 
    259256 
     
    268265        result.setAttribute(GSXML.TYPE_ATT, GSXML.REQUEST_TYPE_PROCESS); 
    269266 
    270         String lang = request.getAttribute(GSXML.LANG_ATT); 
    271         String uid = request.getAttribute(GSXML.USER_ID_ATT); 
     267        UserContext userContext = new UserContext(request); 
    272268 
    273269        // Get the parameters of the request 
     
    299295        } 
    300296         
    301         _GSDM.archiveRemoveEntryFromDatabase(oid, collection, lang, uid); 
     297        _GSDM.archiveRemoveEntryFromDatabase(oid, collection, userContext); 
    302298        _GSDM.checkError(result, ARCHIVE_REMOVE_ENTRY_FROM_DATABASE); 
    303299 
     
    312308        result.setAttribute(GSXML.TYPE_ATT, GSXML.REQUEST_TYPE_PROCESS); 
    313309 
    314         String lang = request.getAttribute(GSXML.LANG_ATT); 
    315         String uid = request.getAttribute(GSXML.USER_ID_ATT); 
     310        UserContext userContext = new UserContext(request); 
    316311 
    317312        // Get the parameters of the request 
     
    327322        String collection = (String) params.get(GSXML.COLLECTION_ATT); 
    328323 
    329         ArrayList<String> assocFiles = _GSDM.archiveGetAssociatedImportFiles(oid, collection, lang, uid); 
     324        ArrayList<String> assocFiles = _GSDM.archiveGetAssociatedImportFiles(oid, collection, userContext); 
    330325        if(_GSDM.checkError(result, ARCHIVE_GET_ASSOCIATED_IMPORT_FILES)) 
    331326        { 
  • main/trunk/greenstone3/src/java/org/greenstone/gsdl3/service/ArchiveRetrieve.java

    r24221 r24993  
    2525import org.greenstone.gsdl3.util.GSXML; 
    2626import org.greenstone.gsdl3.util.SimpleCollectionDatabase; 
     27import org.greenstone.gsdl3.util.UserContext; 
    2728 
    2829import org.w3c.dom.Element;  
     
    106107        result.setAttribute(GSXML.TYPE_ATT, GSXML.REQUEST_TYPE_PROCESS); 
    107108         
    108         String lang = request.getAttribute(GSXML.LANG_ATT); 
    109         String uid = request.getAttribute(GSXML.USER_ID_ATT); 
     109        UserContext userContext = new UserContext(request); 
    110110         
    111111        // Get the parameters of the request 
     
    120120        String collection = (String) params.get("c"); 
    121121         
    122         String assocFilePath = getAssocFilePathFromDocID(oid, collection, lang, uid); 
     122        String assocFilePath = getAssocFilePathFromDocID(oid, collection, userContext); 
    123123         
    124124        String docFilePath = this.site_home + File.separatorChar +  
     
    143143        result.setAttribute(GSXML.TYPE_ATT, GSXML.REQUEST_TYPE_PROCESS); 
    144144         
    145         String lang = request.getAttribute(GSXML.LANG_ATT); 
    146         String uid = request.getAttribute(GSXML.USER_ID_ATT); 
     145        UserContext userContext = new UserContext(request); 
    147146         
    148147        // Get the parameters of the request 
     
    159158         
    160159        //Find out what kind of database we have 
    161         String databaseType = getDatabaseTypeFromCollection(collection, lang, uid); 
     160        String databaseType = getDatabaseTypeFromCollection(collection, userContext); 
    162161        if (databaseType == null || databaseType.equals(""))  
    163162        { 
     
    215214        result.setAttribute(GSXML.TYPE_ATT, GSXML.REQUEST_TYPE_PROCESS); 
    216215         
    217         String lang = request.getAttribute(GSXML.LANG_ATT); 
    218         String uid = request.getAttribute(GSXML.USER_ID_ATT); 
     216        UserContext userContext = new UserContext(request); 
    219217         
    220218        // Get the parameters of the request 
     
    230228        String collection = (String) params.get("c"); 
    231229         
    232         String databaseType = getDatabaseTypeFromCollection(collection, lang, uid); 
     230        String databaseType = getDatabaseTypeFromCollection(collection, userContext); 
    233231        if (databaseType == null || databaseType.equals(""))  
    234232        { 
     
    294292    } 
    295293     
    296     public String getAssocFilePathFromDocID(String oid, String collection, String lang, String uid) 
     294    public String getAssocFilePathFromDocID(String oid, String collection, UserContext userContext) 
    297295    { 
    298296        Element mr_query_message = this.doc.createElement(GSXML.MESSAGE_ELEM); 
    299         Element mr_query_request = GSXML.createBasicRequest (this.doc, GSXML.REQUEST_TYPE_PAGE, collection + "/DocumentMetadataRetrieve", lang, uid); 
     297        Element mr_query_request = GSXML.createBasicRequest (this.doc, GSXML.REQUEST_TYPE_PAGE, collection + "/DocumentMetadataRetrieve", userContext); 
    300298        mr_query_message.appendChild(mr_query_request); 
    301299         
     
    322320    } 
    323321     
    324     public String getDatabaseTypeFromCollection(String collection, String lang, String uid) 
     322    public String getDatabaseTypeFromCollection(String collection, UserContext userContext) 
    325323    { 
    326324        //Find out what kind of database we have 
    327325        Element dbTypeMessage = this.doc.createElement(GSXML.MESSAGE_ELEM); 
    328         Element dbTypeRequest = GSXML.createBasicRequest(this.doc, GSXML.REQUEST_TYPE_DESCRIBE, collection, lang, uid); 
     326        Element dbTypeRequest = GSXML.createBasicRequest(this.doc, GSXML.REQUEST_TYPE_DESCRIBE, collection, userContext); 
    329327        dbTypeMessage.appendChild(dbTypeRequest); 
    330328        Element dbTypeResponse = (Element)this.router.process(dbTypeMessage); 
  • main/trunk/greenstone3/src/java/org/greenstone/gsdl3/service/BerryBasket.java

    r24977 r24993  
    3333import org.greenstone.gsdl3.util.GSXML; 
    3434import org.greenstone.gsdl3.util.GSPath; 
     35import org.greenstone.gsdl3.util.UserContext; 
    3536 
    3637import java.net.InetAddress; 
     
    262263        ArrayList tmp = new ArrayList(); 
    263264        tmp.add(id); 
    264         Element response = getDocumentMetadata(to, "en", "dumy", tmp.iterator()); 
     265         
     266        UserContext userContext = new UserContext(); 
     267        userContext.setLanguage("en"); 
     268        userContext.setUserID("dumy"); 
     269        Element response = getDocumentMetadata(to, userContext, tmp.iterator()); 
    265270        Element doc_node = (Element) response.getElementsByTagName(GSXML.DOC_NODE_ELEM).item(0); 
    266271 
     
    432437    } 
    433438 
    434     private Element getDocumentMetadata(String to, String lang, String uid, Iterator ids) 
     439    private Element getDocumentMetadata(String to, UserContext userContext, Iterator ids) 
    435440    { 
    436441 
    437442        // Build a request to obtain some document metadata 
    438443        Element dm_message = this.doc.createElement(GSXML.MESSAGE_ELEM); 
    439         Element dm_request = GSXML.createBasicRequest(this.doc, GSXML.REQUEST_TYPE_PROCESS, to, lang, uid); 
     444        Element dm_request = GSXML.createBasicRequest(this.doc, GSXML.REQUEST_TYPE_PROCESS, to, userContext); 
    440445        dm_message.appendChild(dm_request); 
    441446 
  • main/trunk/greenstone3/src/java/org/greenstone/gsdl3/service/CrossCollectionSearch.java

    r24979 r24993  
    2121import org.greenstone.gsdl3.util.GSXML; 
    2222import org.greenstone.gsdl3.util.GSPath; 
     23import org.greenstone.gsdl3.util.UserContext; 
    2324 
    2425import org.w3c.dom.Element; 
     
    147148        result.setAttribute(GSXML.TYPE_ATT, GSXML.REQUEST_TYPE_PROCESS); 
    148149 
    149         String lang = request.getAttribute(GSXML.LANG_ATT); 
     150        UserContext userContext = new UserContext(request); 
     151         
    150152        // Get the parameters of the request 
    151153        Element param_list = (Element) GSXML.getChildByTagName(request, GSXML.PARAM_ELEM + GSXML.LIST_MODIFIER); 
     
    182184        } 
    183185        // send the query to all colls 
    184         Element query_request = GSXML.createBasicRequest(this.doc, GSXML.REQUEST_TYPE_PROCESS, to_att.toString(), lang, ""); 
     186        Element query_request = GSXML.createBasicRequest(this.doc, GSXML.REQUEST_TYPE_PROCESS, to_att.toString(), userContext); 
    185187        query_message.appendChild(query_request); 
    186188        // should we add params individually? 
     
    257259    protected boolean initCollectionList() 
    258260    { 
    259         String lang = "en"; 
    260         String uid = ""; 
     261        UserContext userContext = new UserContext(); 
     262        userContext.setLanguage("en"); 
     263        userContext.setUserID(""); 
     264 
    261265        // first, get the message router info 
    262266        Element coll_list_message = this.doc.createElement(GSXML.MESSAGE_ELEM); 
    263         Element coll_list_request = GSXML.createBasicRequest(this.doc, GSXML.REQUEST_TYPE_DESCRIBE, "", lang, ""); // uid 
     267        Element coll_list_request = GSXML.createBasicRequest(this.doc, GSXML.REQUEST_TYPE_DESCRIBE, "", userContext); // uid 
    264268        coll_list_message.appendChild(coll_list_request); 
    265269        logger.debug("coll list request = " + this.converter.getPrettyString(coll_list_request)); 
     
    281285            Element c = (Element) colls.item(i); 
    282286            String name = c.getAttribute(GSXML.NAME_ATT); 
    283             Element metadata_request = GSXML.createBasicRequest(this.doc, GSXML.REQUEST_TYPE_DESCRIBE, name, lang, uid); 
     287            Element metadata_request = GSXML.createBasicRequest(this.doc, GSXML.REQUEST_TYPE_DESCRIBE, name, userContext); 
    284288            metadata_message.appendChild(metadata_request); 
    285289        } 
     
    331335        result.setAttribute(GSXML.TYPE_ATT, GSXML.REQUEST_TYPE_PROCESS); 
    332336 
    333         String lang = request.getAttribute(GSXML.LANG_ATT); 
     337        UserContext userContext = new UserContext(request); 
    334338        // Get the parameters of the request 
    335339        Element param_list = (Element) GSXML.getChildByTagName(request, GSXML.PARAM_ELEM + GSXML.LIST_MODIFIER); 
     
    382386            String cname = (String) e.getKey(); 
    383387            Element doc_nodes = (Element) e.getValue(); 
    384             Element meta_request = GSXML.createBasicRequest(this.doc, GSXML.REQUEST_TYPE_PROCESS, GSPath.appendLink(cname, DOCUMENT_METADATA_RETRIEVE_SERVICE), lang, ""); 
     388            Element meta_request = GSXML.createBasicRequest(this.doc, GSXML.REQUEST_TYPE_PROCESS, GSPath.appendLink(cname, DOCUMENT_METADATA_RETRIEVE_SERVICE), userContext); 
    385389            meta_request.appendChild(doc_nodes); 
    386390            meta_request.appendChild(new_param_list.cloneNode(true)); 
  • main/trunk/greenstone3/src/java/org/greenstone/gsdl3/service/DocXMLUtil.java

    r24583 r24993  
    2424import org.greenstone.gsdl3.util.GSPath; 
    2525import org.greenstone.gsdl3.util.GSXML; 
     26import org.greenstone.gsdl3.util.UserContext; 
    2627 
    2728import org.w3c.dom.Document; 
     
    122123        } 
    123124 
    124         String lang = request.getAttribute(GSXML.LANG_ATT); 
    125         String uid = request.getAttribute(GSXML.USER_ID_ATT); 
     125        UserContext userContext = new UserContext(request); 
    126126 
    127127        //Go through each of the document items that are requested 
     
    133133            String collection = currentDoc.getAttribute(GSXML.COLLECTION_ATT); 
    134134 
    135             _GSDM.documentXMLCreateDocXML(oid, collection, lang, uid); 
     135            _GSDM.documentXMLCreateDocXML(oid, collection, userContext); 
    136136            if(_GSDM.checkError(result, DOC_XML_CREATE_EMPTY_FILE)) 
    137137            { 
     
    152152        } 
    153153 
    154         String lang = request.getAttribute(GSXML.LANG_ATT); 
    155         String uid = request.getAttribute(GSXML.USER_ID_ATT); 
     154        UserContext userContext = new UserContext(request); 
    156155 
    157156        //Go through each of the metadata items that are requested 
     
    164163            String metadataName = currentMetadata.getAttribute(GSXML.NAME_ATT); 
    165164 
    166             ArrayList<Element> metadataValues = _GSDM.documentXMLGetMetadata(oid, collection, metadataName, lang, uid); 
     165            ArrayList<Element> metadataValues = _GSDM.documentXMLGetMetadata(oid, collection, metadataName, userContext); 
    167166            if(_GSDM.checkError(result, DOC_XML_GET_METADATA)) 
    168167            { 
     
    192191        } 
    193192 
    194         String lang = request.getAttribute(GSXML.LANG_ATT); 
    195         String uid = request.getAttribute(GSXML.USER_ID_ATT); 
     193        UserContext userContext = new UserContext(request); 
    196194 
    197195        //Go through each of the metadata items that are requested 
     
    237235                    return result; 
    238236                } 
    239                 _GSDM.documentXMLSetMetadata(oid, collection, metadataName, newMetadataValue, pos, op, lang, uid); 
     237                _GSDM.documentXMLSetMetadata(oid, collection, metadataName, newMetadataValue, pos, op, userContext); 
    240238                if(_GSDM.checkError(result, DOC_XML_SET_METADATA)) 
    241239                { 
     
    246244            else if (oldMetadataValue != null && !oldMetadataValue.equals("")) 
    247245            { 
    248                 _GSDM.documentXMLReplaceMetadata(oid, collection, metadataName, oldMetadataValue, newMetadataValue, lang, uid); 
     246                _GSDM.documentXMLReplaceMetadata(oid, collection, metadataName, oldMetadataValue, newMetadataValue, userContext); 
    249247                if(_GSDM.checkError(result, DOC_XML_SET_METADATA)) 
    250248                { 
     
    272270        } 
    273271 
    274         String lang = request.getAttribute(GSXML.LANG_ATT); 
    275         String uid = request.getAttribute(GSXML.USER_ID_ATT); 
     272        UserContext userContext = new UserContext(request); 
    276273 
    277274        //Go through each of the requests  
     
    283280            String collection = currentSection.getAttribute(GSXML.COLLECTION_ATT); 
    284281 
    285             _GSDM.documentXMLCreateSection(oid, collection, lang, uid); 
     282            _GSDM.documentXMLCreateSection(oid, collection, userContext); 
    286283            if(_GSDM.checkError(result, DOC_XML_CREATE_SECTION)) 
    287284            { 
     
    302299        } 
    303300 
    304         String lang = request.getAttribute(GSXML.LANG_ATT); 
    305         String uid = request.getAttribute(GSXML.USER_ID_ATT); 
     301        UserContext userContext = new UserContext(request); 
    306302 
    307303        //Go through each of the requests  
     
    313309            String collection = currentSection.getAttribute(GSXML.COLLECTION_ATT); 
    314310 
    315             _GSDM.documentXMLDeleteSection(oid, collection, lang, uid); 
     311            _GSDM.documentXMLDeleteSection(oid, collection, userContext); 
    316312            if(_GSDM.checkError(result, DOC_XML_DELETE_SECTION)) 
    317313            { 
     
    332328        } 
    333329 
    334         String lang = request.getAttribute(GSXML.LANG_ATT); 
    335         String uid = request.getAttribute(GSXML.USER_ID_ATT); 
     330        UserContext userContext = new UserContext(request); 
    336331 
    337332        //Go through each of the requests  
     
    343338            String collection = currentSection.getAttribute(GSXML.COLLECTION_ATT); 
    344339 
    345             _GSDM.documentXMLGetSection(oid, collection, lang, uid); 
     340            _GSDM.documentXMLGetSection(oid, collection, userContext); 
    346341            if(_GSDM.checkError(result, DOC_XML_GET_SECTION)) 
    347342            { 
     
    362357        } 
    363358 
    364         String lang = request.getAttribute(GSXML.LANG_ATT); 
    365         String uid = request.getAttribute(GSXML.USER_ID_ATT); 
     359        UserContext userContext = new UserContext(request); 
    366360 
    367361        //Go through each of the requests  
     
    388382            } 
    389383             
    390             _GSDM.documentXMLSetSection(oid, collection, currentSection, op, lang, uid); 
     384            _GSDM.documentXMLSetSection(oid, collection, currentSection, op, userContext); 
    391385            if(_GSDM.checkError(result, DOC_XML_SET_SECTION)) 
    392386            { 
     
    408402        } 
    409403 
    410         String lang = request.getAttribute(GSXML.LANG_ATT); 
    411         String uid = request.getAttribute(GSXML.USER_ID_ATT); 
     404        UserContext userContext = new UserContext(request); 
    412405 
    413406        //Go through each of the requests  
     
    419412            String collection = currentContent.getAttribute(GSXML.COLLECTION_ATT); 
    420413 
    421             String content = _GSDM.documentXMLGetText(oid, collection, lang, uid); 
     414            String content = _GSDM.documentXMLGetText(oid, collection, userContext); 
    422415            if(_GSDM.checkError(result, DOC_XML_GET_TEXT)) 
    423416            { 
     
    451444        } 
    452445 
    453         String lang = request.getAttribute(GSXML.LANG_ATT); 
    454         String uid = request.getAttribute(GSXML.USER_ID_ATT); 
     446        UserContext userContext = new UserContext(request); 
    455447 
    456448        //Go through each of the requests  
     
    462454            String collection = currentContent.getAttribute(GSXML.COLLECTION_ATT); 
    463455 
    464             _GSDM.documentXMLSetText(oid, collection, currentContent, lang, uid); 
     456            _GSDM.documentXMLSetText(oid, collection, currentContent, userContext); 
    465457            if(_GSDM.checkError(result, DOC_XML_SET_TEXT)) 
    466458            { 
  • main/trunk/greenstone3/src/java/org/greenstone/gsdl3/service/DocumentBasket.java

    r24976 r24993  
    3333import org.greenstone.gsdl3.util.GSXML; 
    3434import org.greenstone.gsdl3.util.GSPath; 
     35import org.greenstone.gsdl3.util.UserContext; 
    3536 
    3637import java.net.InetAddress; 
     
    4546import javax.swing.Timer; 
    4647 
    47 import java.io.FileOutputStream; 
    4848import java.io.*; 
    49 import java.io.IOException; 
    5049 
    5150import org.apache.log4j.*; 
     
    364363        ArrayList tmp = new ArrayList(); 
    365364        tmp.add(id); 
    366         Element response = getDocumentMetadata(to, "en", "dumy", tmp.iterator()); 
     365         
     366        UserContext userContext = new UserContext(); 
     367        userContext.setLanguage("en"); 
     368        userContext.setUserID("dumy"); 
     369         
     370        Element response = getDocumentMetadata(to, userContext, tmp.iterator()); 
    367371        Element doc_node = (Element) response.getElementsByTagName(GSXML.DOC_NODE_ELEM).item(0); 
    368372 
     
    539543    } 
    540544 
    541     private Element getDocumentMetadata(String to, String lang, String uid, Iterator ids) 
     545    private Element getDocumentMetadata(String to, UserContext userContext, Iterator ids) 
    542546    { 
    543547 
    544548        // Build a request to obtain some document metadata 
    545549        Element dm_message = this.doc.createElement(GSXML.MESSAGE_ELEM); 
    546         Element dm_request = GSXML.createBasicRequest(this.doc, GSXML.REQUEST_TYPE_PROCESS, to, lang, uid); 
     550        Element dm_request = GSXML.createBasicRequest(this.doc, GSXML.REQUEST_TYPE_PROCESS, to, userContext); 
    547551        dm_message.appendChild(dm_request); 
    548552 
  • main/trunk/greenstone3/src/java/org/greenstone/gsdl3/service/DocumentMaker.java

    r24890 r24993  
    3838import org.greenstone.gsdl3.util.GSPath; 
    3939import org.greenstone.gsdl3.util.GSXML; 
     40import org.greenstone.gsdl3.util.UserContext; 
    4041 
    4142import org.w3c.dom.Element; 
     
    123124        } 
    124125 
    125         String lang = request.getAttribute(GSXML.LANG_ATT); 
    126         String uid = request.getAttribute(GSXML.USER_ID_ATT); 
     126        UserContext userContext = new UserContext(request); 
    127127 
    128128        //Get the list of documents to create 
     
    135135            String collection = currentDoc.getAttribute(GSXML.COLLECTION_ATT); 
    136136 
    137             _GSDM.documentCreate(oid, collection, lang, uid); 
     137            _GSDM.documentCreate(oid, collection, userContext); 
    138138            if (_GSDM.checkError(result, DOCUMENT_CREATE)) 
    139139            { 
     
    155155        } 
    156156 
    157         String lang = request.getAttribute(GSXML.LANG_ATT); 
    158         String uid = request.getAttribute(GSXML.USER_ID_ATT); 
     157        UserContext userContext = new UserContext(request); 
    159158 
    160159        //Get the list of documents to delete 
     
    166165            String collection = currentDoc.getAttribute(GSXML.COLLECTION_ATT); 
    167166 
    168             _GSDM.documentDelete(oid, collection, lang, uid); 
     167            _GSDM.documentDelete(oid, collection, userContext); 
    169168            if (_GSDM.checkError(result, DOCUMENT_DELETE)) 
    170169            { 
     
    186185        } 
    187186 
    188         String lang = request.getAttribute(GSXML.LANG_ATT); 
    189         String uid = request.getAttribute(GSXML.USER_ID_ATT); 
     187        UserContext userContext = new UserContext(request); 
    190188 
    191189        //Get the list of documents to duplicate 
     
    200198            String operation = currentDoc.getAttribute("operation"); 
    201199 
    202             _GSDM.documentMoveOrDuplicate(oid, collection, newOID, newCollection, _GSDM.operationStringToInt(operation), false, lang, uid); 
     200            _GSDM.documentMoveOrDuplicate(oid, collection, newOID, newCollection, _GSDM.operationStringToInt(operation), false, userContext); 
    203201            if (_GSDM.checkError(result, DOCUMENT_DUPLICATE)) 
    204202            { 
     
    220218        } 
    221219 
    222         String lang = request.getAttribute(GSXML.LANG_ATT); 
    223         String uid = request.getAttribute(GSXML.USER_ID_ATT); 
     220        UserContext userContext = new UserContext(request); 
    224221 
    225222        //Get the list of documents to duplicate 
     
    239236            } 
    240237 
    241             _GSDM.documentGetInformation(oid, collection, requestedInfo, lang, uid); 
     238            _GSDM.documentGetInformation(oid, collection, requestedInfo, userContext); 
    242239            if (_GSDM.checkError(result, DOCUMENT_GET_INFORMATION)) 
    243240            { 
     
    259256        } 
    260257 
    261         String lang = request.getAttribute(GSXML.LANG_ATT); 
    262         String uid = request.getAttribute(GSXML.USER_ID_ATT); 
     258        UserContext userContext = new UserContext(request); 
    263259 
    264260        //Get the list of documents to duplicate 
     
    273269            String operation = currentDoc.getAttribute("operation"); 
    274270 
    275             _GSDM.documentMoveOrDuplicate(oid, collection, newOID, newCollection, _GSDM.operationStringToInt(operation), true, lang, uid); 
     271            _GSDM.documentMoveOrDuplicate(oid, collection, newOID, newCollection, _GSDM.operationStringToInt(operation), true, userContext); 
    276272            if (_GSDM.checkError(result, DOCUMENT_MOVE)) 
    277273            { 
     
    292288        } 
    293289 
    294         String lang = request.getAttribute(GSXML.LANG_ATT); 
    295         String uid = request.getAttribute(GSXML.USER_ID_ATT); 
     290        UserContext userContext = new UserContext(request); 
    296291 
    297292        //Get the list of documents to duplicate 
     
    304299            String mergeOID = currentDoc.getAttribute("merge" + GSXML.NODE_ID_ATT); 
    305300 
    306             _GSDM.documentMerge(oid, collection, mergeOID, lang, uid); 
     301            _GSDM.documentMerge(oid, collection, mergeOID, userContext); 
    307302            if (_GSDM.checkError(result, DOCUMENT_MERGE)) 
    308303            { 
     
    324319        } 
    325320 
    326         String lang = request.getAttribute(GSXML.LANG_ATT); 
    327         String uid = request.getAttribute(GSXML.USER_ID_ATT); 
     321        UserContext userContext = new UserContext(request); 
    328322 
    329323        //Get the list of documents to duplicate 
     
    347341            } 
    348342 
    349             _GSDM.documentSplit(oid, collection, split, lang, uid); 
     343            _GSDM.documentSplit(oid, collection, split, userContext); 
    350344            if (_GSDM.checkError(result, DOCUMENT_SPLIT)) 
    351345            { 
     
    367361        } 
    368362 
    369         String lang = request.getAttribute(GSXML.LANG_ATT); 
    370         String uid = request.getAttribute(GSXML.USER_ID_ATT); 
     363        UserContext userContext = new UserContext(request); 
    371364 
    372365        Element param_list = (Element) GSXML.getChildByTagName(request, GSXML.PARAM_ELEM + GSXML.LIST_MODIFIER); 
     
    401394                    String subOperation = (String) keyValueMap.get("subOperation"); 
    402395 
    403                     _GSDM.documentMoveOrDuplicate(origOID, origCollection, newOID, newCollection, _GSDM.operationStringToInt(subOperation), operation.equals("move"), lang, uid); 
     396                    _GSDM.documentMoveOrDuplicate(origOID, origCollection, newOID, newCollection, _GSDM.operationStringToInt(subOperation), operation.equals("move"), userContext); 
    404397 
    405398                    if (_GSDM.getErrorStatus() == GSDocumentModel.NO_ERROR && origCollection != null && !collectionsToBuild.contains(origCollection)) 
     
    419412                    String subOperation = (String) keyValueMap.get("subOperation"); 
    420413 
    421                     //_GSDM.documentCreate(oid, collection, lang, uid); <--- Maybe go back to this 
    422                     _GSDM.documentXMLSetSection(oid, collection, this.doc.createElement(GSXML.DOCXML_SECTION_ELEM), _GSDM.operationStringToInt(subOperation), lang, uid); 
     414                    //_GSDM.documentCreate(oid, collection, userContext); <--- Maybe go back to this 
     415                    _GSDM.documentXMLSetSection(oid, collection, this.doc.createElement(GSXML.DOCXML_SECTION_ELEM), _GSDM.operationStringToInt(subOperation), userContext); 
    423416 
    424417                    if (_GSDM.getErrorStatus() == GSDocumentModel.NO_ERROR && collection != null && !collectionsToBuild.contains(collection)) 
     
    432425                    String collection = (String) keyValueMap.get("collection"); 
    433426 
    434                     _GSDM.documentDelete(oid, collection, lang, uid); 
     427                    _GSDM.documentDelete(oid, collection, userContext); 
    435428 
    436429                    if (_GSDM.getErrorStatus() == GSDocumentModel.NO_ERROR && collection != null && !collectionsToBuild.contains(collection)) 
     
    445438                    String newContent = (String) keyValueMap.get("text"); 
    446439                     
    447                     _GSDM.documentXMLSetText(oid, collection, newContent, lang, uid); 
     440                    _GSDM.documentXMLSetText(oid, collection, newContent, userContext); 
    448441                     
    449442                    System.err.println(newContent); 
  • main/trunk/greenstone3/src/java/org/greenstone/gsdl3/service/GS2Construct.java

    r24888 r24993  
    174174        String lang = request.getAttribute(GSXML.LANG_ATT); 
    175175 
    176         systemRequest("delete", coll_name, null, lang); 
     176        UserContext userContext = new UserContext(request); 
     177         
     178        systemRequest("delete", coll_name, null, userContext); 
    177179 
    178180        Element response = runCommand(request, GS2PerlConstructor.ACTIVATE); 
     
    227229        // once have got here, we assume 
    228230        // the first bit proceeded successfully, now reload the collection 
    229         systemRequest("reload", coll_name, status, lang); // this will append more messages to the status, and overwrite the error code att 
     231        systemRequest("reload", coll_name, status, userContext); // this will append more messages to the status, and overwrite the error code att 
    230232        return response; 
    231233 
     
    282284            return response; 
    283285        } 
    284         systemRequest("delete", coll_name, status, lang); 
     286         
     287        UserContext userContext = new UserContext(request); 
     288 
     289        systemRequest("delete", coll_name, status, userContext); 
    285290        return response; 
    286291    } 
     
    319324 
    320325        String coll_name = (String) params.get(COL_PARAM); 
    321         systemRequest("reload", coll_name, status, lang); 
     326         
     327        UserContext userContext = new UserContext(request); 
     328 
     329        systemRequest("reload", coll_name, status, userContext); 
    322330        return response; 
    323331 
     
    328336     * "delete" or "reload" response will be put into the status element 
    329337     */ 
    330     protected void systemRequest(String action_name, String coll_name, Element status, String lang) 
     338    protected void systemRequest(String action_name, String coll_name, Element status, UserContext userContext) 
    331339    { 
    332340        // send the request to the MR 
    333341        Element message = this.doc.createElement(GSXML.MESSAGE_ELEM); 
    334         Element request = GSXML.createBasicRequest(this.doc, GSXML.REQUEST_TYPE_SYSTEM, "", lang, ""); 
     342        Element request = GSXML.createBasicRequest(this.doc, GSXML.REQUEST_TYPE_SYSTEM, "", userContext); 
    335343        message.appendChild(request); 
    336344        Element command = this.doc.createElement(GSXML.SYSTEM_ELEM); 
     
    361369            if (response == null) 
    362370            { 
    363                 t = this.doc.createTextNode(getTextString(action_name + ".configure_error", lang, args)); 
     371                t = this.doc.createTextNode(getTextString(action_name + ".configure_error", userContext.getLanguage(), args)); 
    364372                status.setAttribute(GSXML.STATUS_ERROR_CODE_ATT, Integer.toString(GSStatus.ERROR)); 
    365373                status.appendChild(t); 
     
    368376 
    369377            // if we got here, we have succeeded! 
    370             t = this.doc.createTextNode(getTextString(action_name + ".success", lang, args)); 
     378            t = this.doc.createTextNode(getTextString(action_name + ".success", userContext.getLanguage(), args)); 
    371379            status.setAttribute(GSXML.STATUS_ERROR_CODE_ATT, Integer.toString(GSStatus.SUCCESS)); 
    372380            status.appendChild(t); 
     
    441449 
    442450        String lang = request.getAttribute(GSXML.LANG_ATT); 
    443         String uid = request.getAttribute(GSXML.USER_ID_ATT); 
    444451        String request_type = request.getAttribute(GSXML.TYPE_ATT); 
    445452 
  • main/trunk/greenstone3/src/java/org/greenstone/gsdl3/util/GSDocumentModel.java

    r24887 r24993  
    121121     *            is the collection we want to create the document/section in. 
    122122     */ 
    123     public void documentCreate(String oid, String collection, String lang, String uid) 
     123    public void documentCreate(String oid, String collection, UserContext userContext) 
    124124    { 
    125125        _errorStatus = NO_ERROR; 
     
    136136            oid = generateOID(); 
    137137        } 
    138         else if (archiveCheckDocumentOrSectionExists(oid, collection, lang, uid)) 
     138        else if (archiveCheckDocumentOrSectionExists(oid, collection, userContext)) 
    139139        { 
    140140            _errorStatus = ERROR_DESTINATION_DOCUMENT_OR_SECTION_ALREADY_EXISTS; 
     
    164164 
    165165            //Write the new entry to the archive database  
    166             archiveWriteEntryToDatabase(oid, collection, entries, lang, uid); 
     166            archiveWriteEntryToDatabase(oid, collection, entries, userContext); 
    167167            if (_errorStatus != NO_ERROR) 
    168168            { 
     
    171171 
    172172            //Create a basic doc.xml file to go in the new folder 
    173             documentXMLCreateDocXML(oid, collection, lang, uid); 
     173            documentXMLCreateDocXML(oid, collection, userContext); 
    174174        } 
    175175        else 
    176176        { 
    177             documentXMLCreateSection(oid, collection, lang, uid); 
     177            documentXMLCreateSection(oid, collection, userContext); 
    178178        } 
    179179    } 
     
    187187     *            is the collection to delete the document/section from. 
    188188     */ 
    189     public void documentDelete(String oid, String collection, String lang, String uid) 
     189    public void documentDelete(String oid, String collection, UserContext userContext) 
    190190    { 
    191191        _errorStatus = NO_ERROR; 
     
    201201        } 
    202202 
    203         if (!archiveCheckDocumentOrSectionExists(oid, collection, lang, uid)) 
     203        if (!archiveCheckDocumentOrSectionExists(oid, collection, userContext)) 
    204204        { 
    205205            _errorStatus = ERROR_SOURCE_DOCUMENT_OR_SECTION_DOES_NOT_EXIST; 
     
    225225 
    226226            //Remove the entry from the archive database  
    227             archiveRemoveEntryFromDatabase(oid, collection, lang, uid); 
     227            archiveRemoveEntryFromDatabase(oid, collection, userContext); 
    228228        } 
    229229        else 
    230230        { 
    231             documentXMLDeleteSection(oid, collection, lang, uid); 
     231            documentXMLDeleteSection(oid, collection, userContext); 
    232232        } 
    233233    } 
     
    249249     *            instead. 
    250250     */ 
    251     public void documentMoveOrDuplicate(String oid, String collection, String newOID, String newCollection, int operation, boolean move, String lang, String uid) 
    252     { 
    253         if ((_errorStatus = checkOIDandCollection(oid, collection, lang, uid)) != NO_ERROR) 
     251    public void documentMoveOrDuplicate(String oid, String collection, String newOID, String newCollection, int operation, boolean move, UserContext userContext) 
     252    { 
     253        if ((_errorStatus = checkOIDandCollection(oid, collection, userContext)) != NO_ERROR) 
    254254        { 
    255255            return; 
     
    275275        case OPERATION_TYPE_DOC_TO_DOC: 
    276276        { 
    277             String archiveDir = archiveGetDocumentFilePath(oid, collection, lang, uid); 
     277            String archiveDir = archiveGetDocumentFilePath(oid, collection, userContext); 
    278278            if (_errorStatus != NO_ERROR) 
    279279            { 
     
    312312        case OPERATION_TYPE_DOC_TO_SEC: 
    313313        { 
    314             Document originalDocument = getDocXML(oid, collection, lang, uid); 
     314            Document originalDocument = getDocXML(oid, collection, userContext); 
    315315            Element originalSection = getTopLevelSectionElement(originalDocument); 
    316316 
    317             documentXMLCreateSection(newOID, newCollection, lang, uid); 
     317            documentXMLCreateSection(newOID, newCollection, userContext); 
    318318            if (_errorStatus != NO_ERROR) 
    319319            { 
     
    321321            } 
    322322 
    323             documentXMLSetSection(newOID, newCollection, originalSection, operation, lang, uid); 
     323            documentXMLSetSection(newOID, newCollection, originalSection, operation, userContext); 
    324324 
    325325            if (move) 
    326326            { 
    327                 String archiveDirStr = archiveGetDocumentFilePath(oid, collection, lang, uid); 
     327                String archiveDirStr = archiveGetDocumentFilePath(oid, collection, userContext); 
    328328                if (_errorStatus != NO_ERROR) 
    329329                { 
     
    342342        case OPERATION_TYPE_SEC_TO_DOC: 
    343343        { 
    344             Document originalDocument = getDocXML(oid, collection, lang, uid); 
     344            Document originalDocument = getDocXML(oid, collection, userContext); 
    345345            Element originalSection = getSectionBySectionNumber(originalDocument, getSectionFromOID(oid)); 
    346346 
    347             documentCreate(newOID, newCollection, lang, uid); 
     347            documentCreate(newOID, newCollection, userContext); 
    348348            if (_errorStatus != NO_ERROR) 
    349349            { 
     
    351351            } 
    352352 
    353             documentXMLCreateSection(newOID, newCollection, lang, uid); 
     353            documentXMLCreateSection(newOID, newCollection, userContext); 
    354354            if (_errorStatus != NO_ERROR) 
    355355            { 
     
    357357            } 
    358358 
    359             documentXMLSetSection(newOID, newCollection, originalSection, operation, lang, uid); 
     359            documentXMLSetSection(newOID, newCollection, originalSection, operation, userContext); 
    360360 
    361361            if (move) 
    362362            { 
    363                 originalDocument = getDocXML(oid, collection, lang, uid); 
     363                originalDocument = getDocXML(oid, collection, userContext); 
    364364                originalSection.getParentNode().removeChild(originalSection); 
    365365 
    366366                //Write the new change back into the file 
    367                 if (!writeXMLFile(originalDocument, oid, collection, lang, uid)) 
     367                if (!writeXMLFile(originalDocument, oid, collection, userContext)) 
    368368                { 
    369369                    _errorStatus = ERROR_COULD_NOT_WRITE_TO_DOC_XML; 
     
    377377        case OPERATION_TYPE_SEC_TO_SEC: 
    378378        { 
    379             Document originalDocument = getDocXML(oid, collection, lang, uid); 
     379            Document originalDocument = getDocXML(oid, collection, userContext); 
    380380            Element originalSection = getSectionBySectionNumber(originalDocument, getSectionFromOID(oid)); 
    381381 
    382382            if (operation == OPERATION_REPLACE) 
    383383            { 
    384                 documentXMLCreateSection(newOID, newCollection, lang, uid); 
     384                documentXMLCreateSection(newOID, newCollection, userContext); 
    385385                if (_errorStatus != NO_ERROR) 
    386386                { 
     
    389389            } 
    390390 
    391             documentXMLSetSection(newOID, newCollection, originalSection, operation, lang, uid); 
     391            documentXMLSetSection(newOID, newCollection, originalSection, operation, userContext); 
    392392            if (_errorStatus != NO_ERROR) 
    393393            { 
     
    397397            if (move) 
    398398            { 
    399                 originalDocument = getDocXML(oid, collection, lang, uid); 
     399                originalDocument = getDocXML(oid, collection, userContext); 
    400400                originalSection.getParentNode().removeChild(originalSection); 
    401401 
    402402                //Write the new change back into the file 
    403                 if (!writeXMLFile(originalDocument, oid, collection, lang, uid)) 
     403                if (!writeXMLFile(originalDocument, oid, collection, userContext)) 
    404404                { 
    405405                    _errorStatus = ERROR_COULD_NOT_WRITE_TO_DOC_XML; 
     
    420420 
    421421            //Write the new entry to the archive database  
    422             archiveWriteEntryToDatabase(newOID, newCollection, entries, lang, uid); 
     422            archiveWriteEntryToDatabase(newOID, newCollection, entries, userContext); 
    423423        } 
    424424    } 
     
    435435     * @return This returns an array containing the requested information. 
    436436     */ 
    437     public String[] documentGetInformation(String oid, String collection, String[] requestedInfo, String lang, String uid) 
    438     { 
    439         if ((_errorStatus = checkOIDandCollection(oid, collection, lang, uid)) != NO_ERROR) 
     437    public String[] documentGetInformation(String oid, String collection, String[] requestedInfo, UserContext userContext) 
     438    { 
     439        if ((_errorStatus = checkOIDandCollection(oid, collection, userContext)) != NO_ERROR) 
    440440        { 
    441441            return null; 
     
    467467     *            merged into. 
    468468     */ 
    469     public void documentMerge(String oid, String collection, String mergeOID, String lang, String uid) 
    470     { 
    471         if ((_errorStatus = checkOIDandCollection(oid, collection, lang, uid)) != NO_ERROR) 
    472         { 
    473             return; 
    474         } 
    475  
    476         if ((_errorStatus = checkOIDandCollection(mergeOID, collection, lang, uid)) != NO_ERROR) 
     469    public void documentMerge(String oid, String collection, String mergeOID, UserContext userContext) 
     470    { 
     471        if ((_errorStatus = checkOIDandCollection(oid, collection, userContext)) != NO_ERROR) 
     472        { 
     473            return; 
     474        } 
     475 
     476        if ((_errorStatus = checkOIDandCollection(mergeOID, collection, userContext)) != NO_ERROR) 
    477477        { 
    478478            return; 
     
    504504        } 
    505505 
    506         Document docXML = getDocXML(oid, collection, lang, uid); 
     506        Document docXML = getDocXML(oid, collection, userContext); 
    507507        if (docXML == null) 
    508508        { 
     
    569569        } 
    570570 
    571         documentXMLSetSection(mergeOID, collection, sourceSection, OPERATION_REPLACE, lang, uid); 
     571        documentXMLSetSection(mergeOID, collection, sourceSection, OPERATION_REPLACE, userContext); 
    572572        if (_errorStatus != NO_ERROR) 
    573573        { 
     
    575575        } 
    576576 
    577         documentXMLDeleteSection(oid, collection, lang, uid); 
     577        documentXMLDeleteSection(oid, collection, userContext); 
    578578    } 
    579579 
     
    590590     *            is the point in the text we want to split at. 
    591591     */ 
    592     public void documentSplit(String oid, String collection, int splitPoint, String lang, String uid) 
    593     { 
    594         if ((_errorStatus = checkOIDandCollection(oid, collection, lang, uid)) != NO_ERROR) 
    595         { 
    596             return; 
    597         } 
    598  
    599         Document docXML = getDocXML(oid, collection, lang, uid); 
     592    public void documentSplit(String oid, String collection, int splitPoint, UserContext userContext) 
     593    { 
     594        if ((_errorStatus = checkOIDandCollection(oid, collection, userContext)) != NO_ERROR) 
     595        { 
     596            return; 
     597        } 
     598 
     599        Document docXML = getDocXML(oid, collection, userContext); 
    600600        if (docXML == null) 
    601601        { 
     
    644644        newSection.appendChild(newContent); 
    645645 
    646         documentXMLSetSection(oid, collection, newSection, OPERATION_INSERT_BEFORE, lang, uid); 
     646        documentXMLSetSection(oid, collection, newSection, OPERATION_INSERT_BEFORE, userContext); 
    647647        if (_errorStatus != NO_ERROR) 
    648648        { 
     
    652652 
    653653        //Write the new change back into the file 
    654         if (!writeXMLFile(docXML, oid, collection, lang, uid)) 
     654        if (!writeXMLFile(docXML, oid, collection, userContext)) 
    655655        { 
    656656            _errorStatus = ERROR_COULD_NOT_WRITE_TO_DOC_XML; 
     
    666666     *            is the collection the new document will reside in. 
    667667     */ 
    668     public void documentXMLCreateDocXML(String oid, String collection, String lang, String uid) 
     668    public void documentXMLCreateDocXML(String oid, String collection, UserContext userContext) 
    669669    { 
    670670        _errorStatus = NO_ERROR; 
     
    673673            Document docXML = null; 
    674674 
    675             String filePath = archiveGetDocumentFilePath(oid, collection, lang, uid); 
     675            String filePath = archiveGetDocumentFilePath(oid, collection, userContext); 
    676676            File docFile = new File(filePath); 
    677677            if (!docFile.exists() && !docFile.createNewFile()) 
     
    714714     * @return an array of metadata elements containing the resquested metadata 
    715715     */ 
    716     public ArrayList<Element> documentXMLGetMetadata(String oid, String collection, String metadataName, String lang, String uid) 
    717     { 
    718         if ((_errorStatus = checkOIDandCollection(oid, collection, lang, uid)) != NO_ERROR) 
     716    public ArrayList<Element> documentXMLGetMetadata(String oid, String collection, String metadataName, UserContext userContext) 
     717    { 
     718        if ((_errorStatus = checkOIDandCollection(oid, collection, userContext)) != NO_ERROR) 
    719719        { 
    720720            return null; 
     
    726726        } 
    727727 
    728         Document docXML = getDocXML(oid, collection, lang, uid); 
     728        Document docXML = getDocXML(oid, collection, userContext); 
    729729        if (docXML == null) 
    730730        { 
     
    753753     *            OPERATION_INSERT_AFTER or OPERATION_APPEND. 
    754754     */ 
    755     public void documentXMLSetMetadata(String oid, String collection, String metadataName, String newMetadataValue, int position, int operation, String lang, String uid) 
    756     { 
    757         if ((_errorStatus = checkOIDandCollection(oid, collection, lang, uid)) != NO_ERROR) 
     755    public void documentXMLSetMetadata(String oid, String collection, String metadataName, String newMetadataValue, int position, int operation, UserContext userContext) 
     756    { 
     757        if ((_errorStatus = checkOIDandCollection(oid, collection, userContext)) != NO_ERROR) 
    758758        { 
    759759            return; 
     
    770770        } 
    771771 
    772         Document docXML = getDocXML(oid, collection, lang, uid); 
     772        Document docXML = getDocXML(oid, collection, userContext); 
    773773        if (docXML == null) 
    774774        { 
     
    825825 
    826826        //Write the new change back into the file 
    827         if (!writeXMLFile(docXML, oid, collection, lang, uid)) 
     827        if (!writeXMLFile(docXML, oid, collection, userContext)) 
    828828        { 
    829829            _errorStatus = ERROR_COULD_NOT_WRITE_TO_DOC_XML; 
     
    845845     *            is position of the item that is to be deleted. 
    846846     */ 
    847     public void documentXMLDeleteMetadata(String oid, String collection, String metadataName, int position, String lang, String uid) 
    848     { 
    849         if ((_errorStatus = checkOIDandCollection(oid, collection, lang, uid)) != NO_ERROR) 
     847    public void documentXMLDeleteMetadata(String oid, String collection, String metadataName, int position, UserContext userContext) 
     848    { 
     849        if ((_errorStatus = checkOIDandCollection(oid, collection, userContext)) != NO_ERROR) 
    850850        { 
    851851            return; 
     
    857857        } 
    858858 
    859         Document docXML = getDocXML(oid, collection, lang, uid); 
     859        Document docXML = getDocXML(oid, collection, userContext); 
    860860        if (docXML == null) 
    861861        { 
     
    884884     *            is the name of the metadata to delete. 
    885885     */ 
    886     public void documentXMLDeleteMetadata(String oid, String collection, String metadataName, String lang, String uid) 
    887     { 
    888         if ((_errorStatus = checkOIDandCollection(oid, collection, lang, uid)) != NO_ERROR) 
     886    public void documentXMLDeleteMetadata(String oid, String collection, String metadataName, UserContext userContext) 
     887    { 
     888        if ((_errorStatus = checkOIDandCollection(oid, collection, userContext)) != NO_ERROR) 
    889889        { 
    890890            return; 
     
    896896        } 
    897897 
    898         Document docXML = getDocXML(oid, collection, lang, uid); 
     898        Document docXML = getDocXML(oid, collection, userContext); 
    899899        if (docXML == null) 
    900900        { 
     
    929929     *            value. 
    930930     */ 
    931     public void documentXMLReplaceMetadata(String oid, String collection, String metadataName, String oldMetadataValue, String newMetadataValue, String lang, String uid) 
    932     { 
    933         if ((_errorStatus = checkOIDandCollection(oid, collection, lang, uid)) != NO_ERROR) 
     931    public void documentXMLReplaceMetadata(String oid, String collection, String metadataName, String oldMetadataValue, String newMetadataValue, UserContext userContext) 
     932    { 
     933        if ((_errorStatus = checkOIDandCollection(oid, collection, userContext)) != NO_ERROR) 
    934934        { 
    935935            return; 
     
    951951        } 
    952952 
    953         Document docXML = getDocXML(oid, collection, lang, uid); 
     953        Document docXML = getDocXML(oid, collection, userContext); 
    954954        if (docXML == null) 
    955955        { 
     
    971971 
    972972        //Write the new change back into the file 
    973         if (!writeXMLFile(docXML, oid, collection, lang, uid)) 
     973        if (!writeXMLFile(docXML, oid, collection, userContext)) 
    974974        { 
    975975            _errorStatus = ERROR_COULD_NOT_WRITE_TO_DOC_XML; 
     
    985985     *            is the collection the document resides in. 
    986986     */ 
    987     public void documentXMLCreateSection(String oid, String collection, String lang, String uid) 
     987    public void documentXMLCreateSection(String oid, String collection, UserContext userContext) 
    988988    { 
    989989        _errorStatus = NO_ERROR; 
     
    999999        } 
    10001000 
    1001         if (oid.contains(".") && !archiveCheckDocumentOrSectionExists(oid.substring(0, oid.indexOf(".")), collection, lang, uid)) 
    1002         { 
    1003             documentCreate(oid.substring(0, oid.indexOf(".")), collection, lang, uid); 
     1001        if (oid.contains(".") && !archiveCheckDocumentOrSectionExists(oid.substring(0, oid.indexOf(".")), collection, userContext)) 
     1002        { 
     1003            documentCreate(oid.substring(0, oid.indexOf(".")), collection, userContext); 
    10041004            if (_errorStatus != NO_ERROR) 
    10051005            { 
     
    10081008        } 
    10091009 
    1010         Document docXML = getDocXML(oid, collection, lang, uid); 
     1010        Document docXML = getDocXML(oid, collection, userContext); 
    10111011        if (docXML == null) 
    10121012        { 
     
    10681068 
    10691069        //Write the new change back into the file 
    1070         if (!writeXMLFile(docXML, oid, collection, lang, uid)) 
     1070        if (!writeXMLFile(docXML, oid, collection, userContext)) 
    10711071        { 
    10721072            _errorStatus = ERROR_COULD_NOT_WRITE_TO_DOC_XML; 
     
    10821082     *            is the collection the document resides in. 
    10831083     */ 
    1084     public void documentXMLDeleteSection(String oid, String collection, String lang, String uid) 
    1085     { 
    1086         if ((_errorStatus = checkOIDandCollection(oid, collection, lang, uid)) != NO_ERROR) 
    1087         { 
    1088             return; 
    1089         } 
    1090  
    1091         Document docXML = getDocXML(oid, collection, lang, uid); 
     1084    public void documentXMLDeleteSection(String oid, String collection, UserContext userContext) 
     1085    { 
     1086        if ((_errorStatus = checkOIDandCollection(oid, collection, userContext)) != NO_ERROR) 
     1087        { 
     1088            return; 
     1089        } 
     1090 
     1091        Document docXML = getDocXML(oid, collection, userContext); 
    10921092        if (docXML == null) 
    10931093        { 
     
    11061106 
    11071107        //Write the new change back into the file 
    1108         if (!writeXMLFile(docXML, oid, collection, lang, uid)) 
     1108        if (!writeXMLFile(docXML, oid, collection, userContext)) 
    11091109        { 
    11101110            _errorStatus = ERROR_COULD_NOT_WRITE_TO_DOC_XML; 
     
    11211121     * @return the requested section. 
    11221122     */ 
    1123     public Element documentXMLGetSection(String oid, String collection, String lang, String uid) 
    1124     { 
    1125         if ((_errorStatus = checkOIDandCollection(oid, collection, lang, uid)) != NO_ERROR) 
    1126         { 
    1127             return null; 
    1128         } 
    1129  
    1130         Document docXML = getDocXML(oid, collection, lang, uid); 
     1123    public Element documentXMLGetSection(String oid, String collection, UserContext userContext) 
     1124    { 
     1125        if ((_errorStatus = checkOIDandCollection(oid, collection, userContext)) != NO_ERROR) 
     1126        { 
     1127            return null; 
     1128        } 
     1129 
     1130        Document docXML = getDocXML(oid, collection, userContext); 
    11311131        if (docXML == null) 
    11321132        { 
     
    11681168     * @throws IOException 
    11691169     */ 
    1170     public void documentXMLSetSection(String oid, String collection, Element newSection, int operation, String lang, String uid) 
    1171     { 
    1172         if ((_errorStatus = checkOIDandCollection(oid, collection, lang, uid)) != NO_ERROR) 
    1173         { 
    1174             return; 
    1175         } 
    1176  
    1177         Document docXML = getDocXML(oid, collection, lang, uid); 
     1170    public void documentXMLSetSection(String oid, String collection, Element newSection, int operation, UserContext userContext) 
     1171    { 
     1172        if ((_errorStatus = checkOIDandCollection(oid, collection, userContext)) != NO_ERROR) 
     1173        { 
     1174            return; 
     1175        } 
     1176 
     1177        Document docXML = getDocXML(oid, collection, userContext); 
    11781178        if (docXML == null) 
    11791179        { 
     
    12401240         
    12411241        //Write the new change back into the file 
    1242         if (!writeXMLFile(docXML, oid, collection, lang, uid)) 
     1242        if (!writeXMLFile(docXML, oid, collection, userContext)) 
    12431243        { 
    12441244            _errorStatus = ERROR_COULD_NOT_WRITE_TO_DOC_XML; 
     
    12561256     * @return the text from the section. 
    12571257     */ 
    1258     public String documentXMLGetText(String oid, String collection, String lang, String uid) 
    1259     { 
    1260         if ((_errorStatus = checkOIDandCollection(oid, collection, lang, uid)) != NO_ERROR) 
    1261         { 
    1262             return null; 
    1263         } 
    1264  
    1265         Document docXML = getDocXML(oid, collection, lang, uid); 
     1258    public String documentXMLGetText(String oid, String collection, UserContext userContext) 
     1259    { 
     1260        if ((_errorStatus = checkOIDandCollection(oid, collection, userContext)) != NO_ERROR) 
     1261        { 
     1262            return null; 
     1263        } 
     1264 
     1265        Document docXML = getDocXML(oid, collection, userContext); 
    12661266        if (docXML == null) 
    12671267        { 
     
    13111311     *            is the new content element for the section. 
    13121312     */ 
    1313     public void documentXMLSetText(String oid, String collection, Element newContent, String lang, String uid) 
    1314     { 
    1315         if ((_errorStatus = checkOIDandCollection(oid, collection, lang, uid)) != NO_ERROR) 
    1316         { 
    1317             return; 
    1318         } 
    1319  
    1320         Document docXML = getDocXML(oid, collection, lang, uid); 
     1313    public void documentXMLSetText(String oid, String collection, Element newContent, UserContext userContext) 
     1314    { 
     1315        if ((_errorStatus = checkOIDandCollection(oid, collection, userContext)) != NO_ERROR) 
     1316        { 
     1317            return; 
     1318        } 
     1319 
     1320        Document docXML = getDocXML(oid, collection, userContext); 
    13211321        if (docXML == null) 
    13221322        { 
     
    13631363 
    13641364        //Write the new change back into the file 
    1365         if (!writeXMLFile(docXML, oid, collection, lang, uid)) 
     1365        if (!writeXMLFile(docXML, oid, collection, userContext)) 
    13661366        { 
    13671367            _errorStatus = ERROR_COULD_NOT_WRITE_TO_DOC_XML; 
     
    13801380     *            is the new text for the section. 
    13811381     */ 
    1382     public void documentXMLSetText(String oid, String collection, String newContent, String lang, String uid) 
    1383     { 
    1384         if ((_errorStatus = checkOIDandCollection(oid, collection, lang, uid)) != NO_ERROR) 
    1385         { 
    1386             return; 
    1387         } 
    1388  
    1389         Document docXML = getDocXML(oid, collection, lang, uid); 
     1382    public void documentXMLSetText(String oid, String collection, String newContent, UserContext userContext) 
     1383    { 
     1384        if ((_errorStatus = checkOIDandCollection(oid, collection, userContext)) != NO_ERROR) 
     1385        { 
     1386            return; 
     1387        } 
     1388 
     1389        Document docXML = getDocXML(oid, collection, userContext); 
    13901390        if (docXML == null) 
    13911391        { 
     
    14331433 
    14341434        //Write the new change back into the file 
    1435         if (!writeXMLFile(docXML, oid, collection, lang, uid)) 
     1435        if (!writeXMLFile(docXML, oid, collection, userContext)) 
    14361436        { 
    14371437            _errorStatus = ERROR_COULD_NOT_WRITE_TO_DOC_XML; 
     
    14511451     * @return the file path to the doc.xml file. 
    14521452     */ 
    1453     public String archiveGetDocumentFilePath(String oid, String collection, String lang, String uid) 
     1453    public String archiveGetDocumentFilePath(String oid, String collection, UserContext userContext) 
    14541454    { 
    14551455        _errorStatus = NO_ERROR; 
     
    14601460        } 
    14611461 
    1462         String assocFilePath = getDocFilePathFromDatabase(oid, collection, lang, uid); 
     1462        String assocFilePath = getDocFilePathFromDatabase(oid, collection, userContext); 
    14631463        if (assocFilePath == null) 
    14641464        { 
     
    14851485     * @return the OID of the document that the source file is used in. 
    14861486     */ 
    1487     public String archiveGetSourceFileOID(String srcFile, String collection, String lang, String uid) 
     1487    public String archiveGetSourceFileOID(String srcFile, String collection, UserContext userContext) 
    14881488    { 
    14891489        _errorStatus = NO_ERROR; 
    1490         SimpleCollectionDatabase coll_db = openDatabase(collection, ARCHIVEINFSRC, SimpleCollectionDatabase.READ, lang, uid); 
     1490        SimpleCollectionDatabase coll_db = openDatabase(collection, ARCHIVEINFSRC, SimpleCollectionDatabase.READ, userContext); 
    14911491        if (coll_db == null) 
    14921492        { 
     
    15181518     * @return true if the document/section exists, false otherwise. 
    15191519     */ 
    1520     public boolean archiveCheckDocumentOrSectionExists(String oid, String collection, String lang, String uid) 
     1520    public boolean archiveCheckDocumentOrSectionExists(String oid, String collection, UserContext userContext) 
    15211521    { 
    15221522        _errorStatus = NO_ERROR; 
    1523         SimpleCollectionDatabase coll_db = openDatabase(collection, ARCHIVEINFDOC, SimpleCollectionDatabase.READ, lang, uid); 
     1523        SimpleCollectionDatabase coll_db = openDatabase(collection, ARCHIVEINFDOC, SimpleCollectionDatabase.READ, userContext); 
    15241524        if (coll_db == null) 
    15251525        { 
     
    15481548        if (section && exists) 
    15491549        { 
    1550             Document docXML = getDocXML(oid, collection, lang, uid); 
     1550            Document docXML = getDocXML(oid, collection, userContext); 
    15511551            if (getSectionBySectionNumber(docXML, getSectionFromOID(oid)) == null) 
    15521552            { 
     
    15691569     *            is the list of entries to write. 
    15701570     */ 
    1571     public void archiveWriteEntryToDatabase(String oid, String collection, HashMap<String, ArrayList<String>> infoList, String lang, String uid) 
     1571    public void archiveWriteEntryToDatabase(String oid, String collection, HashMap<String, ArrayList<String>> infoList, UserContext userContext) 
    15721572    { 
    15731573        _errorStatus = NO_ERROR; 
     
    15931593        } 
    15941594 
    1595         SimpleCollectionDatabase coll_db = openDatabase(collection, ARCHIVEINFDOC, SimpleCollectionDatabase.WRITE, lang, uid); 
     1595        SimpleCollectionDatabase coll_db = openDatabase(collection, ARCHIVEINFDOC, SimpleCollectionDatabase.WRITE, userContext); 
    15961596        if (coll_db == null) 
    15971597        { 
     
    16111611     *            is the collection whose database will have the entry removed. 
    16121612     */ 
    1613     public void archiveRemoveEntryFromDatabase(String oid, String collection, String lang, String uid) 
     1613    public void archiveRemoveEntryFromDatabase(String oid, String collection, UserContext userContext) 
    16141614    { 
    16151615        _errorStatus = NO_ERROR; 
     
    16251625        } 
    16261626 
    1627         SimpleCollectionDatabase coll_db = openDatabase(collection, ARCHIVEINFDOC, SimpleCollectionDatabase.WRITE, lang, uid); 
     1627        SimpleCollectionDatabase coll_db = openDatabase(collection, ARCHIVEINFDOC, SimpleCollectionDatabase.WRITE, userContext); 
    16281628        if (coll_db == null) 
    16291629        { 
     
    16451645     * @return the list of associated files. 
    16461646     */ 
    1647     public ArrayList<String> archiveGetAssociatedImportFiles(String oid, String collection, String lang, String uid) 
     1647    public ArrayList<String> archiveGetAssociatedImportFiles(String oid, String collection, UserContext userContext) 
    16481648    { 
    16491649        _errorStatus = NO_ERROR; 
     
    16591659        } 
    16601660 
    1661         SimpleCollectionDatabase coll_db = openDatabase(collection, ARCHIVEINFDOC, SimpleCollectionDatabase.READ, lang, uid); 
     1661        SimpleCollectionDatabase coll_db = openDatabase(collection, ARCHIVEINFDOC, SimpleCollectionDatabase.READ, userContext); 
    16621662        if (coll_db == null) 
    16631663        { 
     
    17561756    } 
    17571757 
    1758     public String getDocFilePathFromDatabase(String oid, String collection, String lang, String uid) 
    1759     { 
    1760         SimpleCollectionDatabase coll_db = openDatabase(collection, ARCHIVEINFDOC, SimpleCollectionDatabase.WRITE, lang, uid); 
     1758    public String getDocFilePathFromDatabase(String oid, String collection, UserContext userContext) 
     1759    { 
     1760        SimpleCollectionDatabase coll_db = openDatabase(collection, ARCHIVEINFDOC, SimpleCollectionDatabase.WRITE, userContext); 
    17611761        if (coll_db == null) 
    17621762        { 
     
    18101810    } 
    18111811 
    1812     public int checkOIDandCollection(String oid, String collection, String lang, String uid) 
     1812    public int checkOIDandCollection(String oid, String collection, UserContext userContext) 
    18131813    { 
    18141814        if (oid == null || oid.equals("")) 
     
    18221822        } 
    18231823 
    1824         if (!archiveCheckDocumentOrSectionExists(oid, collection, lang, uid)) 
     1824        if (!archiveCheckDocumentOrSectionExists(oid, collection, userContext)) 
    18251825        { 
    18261826            return ERROR_SOURCE_DOCUMENT_OR_SECTION_DOES_NOT_EXIST; 
     
    18831883    } 
    18841884 
    1885     public boolean writeXMLFile(Document doc, String oid, String collection, String lang, String uid) 
     1885    public boolean writeXMLFile(Document doc, String oid, String collection, UserContext userContext) 
    18861886    { 
    18871887        try 
     
    18891889            DOMSource source = new DOMSource(doc); 
    18901890 
    1891             String test = archiveGetDocumentFilePath(oid, collection, lang, uid); 
     1891            String test = archiveGetDocumentFilePath(oid, collection, userContext); 
    18921892            File xmlFile = new File(test); 
    18931893            Result result = new StreamResult(xmlFile); 
     
    19031903    } 
    19041904 
    1905     public Document getDocXML(String oid, String collection, String lang, String uid) 
     1905    public Document getDocXML(String oid, String collection, UserContext userContext) 
    19061906    { 
    19071907        if (oid.contains(".")) 
     
    19131913        if ((docXML = _docCache.get(oid + "__" + collection)) == null) 
    19141914        { 
    1915             String filePath = archiveGetDocumentFilePath(oid, collection, lang, uid); 
     1915            String filePath = archiveGetDocumentFilePath(oid, collection, userContext); 
    19161916            File docFile = new File(filePath); 
    19171917 
     
    20052005    } 
    20062006 
    2007     public String getDatabaseTypeFromCollection(String collection, String lang, String uid) 
     2007    public String getDatabaseTypeFromCollection(String collection, UserContext userContext) 
    20082008    { 
    20092009        //Find out what kind of database we have 
    20102010        Element dbTypeMessage = _mainDoc.createElement(GSXML.MESSAGE_ELEM); 
    2011         Element dbTypeRequest = GSXML.createBasicRequest(_mainDoc, GSXML.REQUEST_TYPE_DESCRIBE, collection, lang, uid); 
     2011        Element dbTypeRequest = GSXML.createBasicRequest(_mainDoc, GSXML.REQUEST_TYPE_DESCRIBE, collection, userContext); 
    20122012        dbTypeMessage.appendChild(dbTypeRequest); 
    20132013        Element dbTypeResponse = (Element) _router.process(dbTypeMessage); 
     
    20232023    } 
    20242024 
    2025     public SimpleCollectionDatabase openDatabase(String collection, String dbName, int readWrite, String lang, String uid) 
     2025    public SimpleCollectionDatabase openDatabase(String collection, String dbName, int readWrite, UserContext userContext) 
    20262026    { 
    20272027        //Find out what kind of database we have 
    2028         String databaseType = getDatabaseTypeFromCollection(collection, lang, uid); 
     2028        String databaseType = getDatabaseTypeFromCollection(collection, userContext); 
    20292029        String dbExt = DBHelper.getDBExtFromDBType(databaseType); 
    20302030 
  • main/trunk/greenstone3/src/java/org/greenstone/gsdl3/util/GSXML.java

    r24984 r24993  
    727727 
    728728    /** returns a basic request message */ 
    729     public static Element createBasicRequest(Document owner, String request_type, String to, String lang, String uid) 
     729    public static Element createBasicRequest(Document owner, String request_type, String to, UserContext userContext) 
    730730    { 
    731731        Element request = owner.createElement(REQUEST_ELEM); 
    732732        request.setAttribute(TYPE_ATT, request_type); 
    733         request.setAttribute(LANG_ATT, lang); 
     733        request.setAttribute(LANG_ATT, userContext._lang); 
    734734        request.setAttribute(TO_ATT, to); 
    735         request.setAttribute(USER_ID_ATT, uid); 
     735        request.setAttribute(USER_ID_ATT, userContext._userID); 
    736736        return request; 
    737737    }