Changeset 19173

Show
Ignore:
Timestamp:
21.04.2009 18:55:32 (10 years ago)
Author:
ak19
Message:

GLI and gliserver.pl have been updated together to deal with inconsistent Zipping environment. When testing on Linux, LANG variable was set on the GLI (client) side but not set on server side. This resulted in special characters in filenames being unzipped differently from their originals on the client side, or if the LANG env var had been set to be the same on the server end as it was on the client end when the zipping took place. Now the client passes the LANG variable to every upload and download gliserver command. The client gets and stores the LANG variable only once though (on creating the RemoteGreenstoneServer? object) since the System.getenv() method is deprecated.

Location:
gli/trunk/src/org/greenstone/gatherer/remote
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • gli/trunk/src/org/greenstone/gatherer/remote/RemoteGreenstoneServer.java

    r17630 r19173  
    6262    // static private PasswordAuthentication remote_greenstone_server_authentication = new PasswordAuthentication(System.getProperty("user.name"), new char[] { }); 
    6363 
     64    // the language and region environment variables (in "lang_REGION" form) 
     65    // this is necessary in order for the client and server sides to zip and unzip 
     66    // using the same settings 
     67    public final String lang_region; 
     68 
    6469    private ActionQueue remote_greenstone_server_action_queue; 
    6570    private RemoteGreenstoneServer.ProgressBar progress_bar; 
     
    7075    progress_bar = new RemoteGreenstoneServer.ProgressBar(); 
    7176    remote_greenstone_server_action_queue = new ActionQueue(); 
     77 
     78    String langReg = System.getenv("LANG"); 
     79    lang_region = (langReg == null) ? "" : langReg;  
    7280    } 
    7381 
     
    481489        String gliserver_url_string = Configuration.gliserver_url.toString(); 
    482490        String command_output = sendCommandToServerInternal(gliserver_url_string, gliserver_args, shell); 
    483          
     491                 
     492        // Debugging - print any ok messages to stderr 
     493        //if(!(command_output.trim().startsWith("<"))) { 
     494        //System.err.println("**** RECEIVED (sendCommandToServer()): " + command_output); 
     495        //} 
     496         
    484497        // Check the first line to see if authentication has failed; if so, go around the loop again 
    485498        if (command_output.startsWith("ERROR: Authentication failed:")) { 
  • gli/trunk/src/org/greenstone/gatherer/remote/RemoteGreenstoneServerAction.java

    r18646 r19173  
    179179        String download_collection_command = "cmd=download-collection"; 
    180180        download_collection_command += "&c=" + URLEncoder.encode(collection_name, "UTF-8"); 
     181        download_collection_command += "&lr=" + remote.lang_region; 
    181182        String zip_file_path = Gatherer.getCollectDirectoryPath() + collection_name + ".zip"; 
    182183        action_output = remote.downloadFile(download_collection_command, zip_file_path); 
     
    213214        String download_collection_archives_command = "cmd=download-collection-archives"; 
    214215        download_collection_archives_command += "&c=" + URLEncoder.encode(collection_name, "UTF-8"); 
     216        download_collection_archives_command += "&lr=" + remote.lang_region; 
    215217        String zip_file_path = Gatherer.getCollectDirectoryPath() + collection_name + "-archives.zip"; 
    216218        action_output = remote.downloadFile(download_collection_archives_command, zip_file_path); 
     
    247249 
    248250        String download_collection_configurations_command = "cmd=download-collection-configurations"; 
     251        download_collection_configurations_command += "&lr=" + remote.lang_region; 
    249252        String zip_file_path = Gatherer.getCollectDirectoryPath() + "collections.zip"; 
    250253        action_output = remote.downloadFile(download_collection_configurations_command, zip_file_path); 
     
    346349        download_collection_file_command += "&c=" + URLEncoder.encode(collection_name, "UTF-8"); 
    347350        download_collection_file_command += "&file=" + URLEncoder.encode(collection_file_relative_path, "UTF-8"); 
     351        download_collection_file_command += "&lr=" + remote.lang_region; 
    348352        String zip_file_name = collection_name + "-" + collection_file.getName() + ".zip"; 
    349353        String zip_file_path = collection_directory_path + zip_file_name; 
     
    372376        String download_web_xml_file_command = "cmd=download-web-xml-file"; 
    373377        download_web_xml_file_command += "&file=" + URLEncoder.encode("web.xml", "UTF-8"); 
     378        download_web_xml_file_command += "&lr=" + remote.lang_region; 
    374379        String zip_file_name = "web-xml.zip"; 
    375380        String zip_file_path = web_xml_directory_path + zip_file_name; 
     
    585590        upload_collection_file_command += "&directory="; 
    586591        upload_collection_file_command += "&zip=true"; 
     592        upload_collection_file_command += "&lr=" + remote.lang_region; 
    587593        action_output = remote.uploadFile(upload_collection_file_command, zip_file_path); 
    588594    } 
     
    639645        upload_collection_file_command += "&directory=" + URLEncoder.encode(target_collection_directory_relative_path, "UTF-8"); 
    640646        upload_collection_file_command += "&zip=true"; 
     647        upload_collection_file_command += "&lr=" + remote.lang_region; 
    641648        action_output = remote.uploadFile(upload_collection_file_command, zip_file_path); 
    642649    }