Ignore:
Timestamp:
2010-07-15T22:10:59+12:00 (14 years ago)
Author:
ak19
Message:

Getting collectgroup to work for a remote Greenstone server. Need to update gliserver.pl still to work with the collectgroup changes. 1. GLI side changes: no longer does the collectdir parameter to import and build include the colgroup at the end, it is now back to being everything upto the GS collect dir. Instead, the loaded collection is colgroup/subcolname. 2. Changed CollectionManager.getLoadedCollectionName() to return (colgroup/)subcolname instead of the subcolname excluding groupname. 3. This required changes in other classes, including replacing unnecessary explicit calls to getLoadedGroupQualifiedCollectionName(). 4. Added another variant: getLoadedCollectionName(boolean). If the parameter is true, it will put a url style slash between colgroup and subcolname, otherwise use the OS dependent FileSeparator. 5. Changes to RemoteGreenstoneServer to pass the group/subcol as the collectionname to gliserver.pl, with a vertical bar separator. 6. Minor changes like: WorkspaceTreeNode now knows not to load a collection group if it's already in the loaded collection (previously handed only sub collection name), removed old debugging statements and unused import statements.

File:
1 edited

Legend:

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

    r19231 r22410  
    118118
    119119        String delete_collection_command = "cmd=delete-collection";
    120         delete_collection_command += "&c=" + URLEncoder.encode(collection_name, "UTF-8");
     120        delete_collection_command += "&c=" + URLEncoder.encode(collection_name.replace(File.separatorChar, '|'), "UTF-8");
    121121        action_output = remote.sendCommandToServer(delete_collection_command, null);
    122122    }
     
    150150
    151151        String delete_collection_file_command = "cmd=delete-collection-file";
    152         delete_collection_file_command += "&c=" + URLEncoder.encode(collection_name, "UTF-8");
     152        delete_collection_file_command += "&c=" + URLEncoder.encode(collection_name.replace(File.separatorChar, '|'), "UTF-8");
    153153        delete_collection_file_command += "&file=" + Base64.encodeBytes(collection_file_relative_path.getBytes());
    154154        action_output = remote.sendCommandToServer(delete_collection_file_command, null);
     
    178178
    179179        String download_collection_command = "cmd=download-collection";
    180         download_collection_command += "&c=" + URLEncoder.encode(collection_name, "UTF-8");
     180        download_collection_command += "&c=" + URLEncoder.encode(collection_name.replace(File.separatorChar, '|'), "UTF-8");
    181181        download_collection_command += "&lr=" + remote.lang_region;
    182182        String zip_file_path = Gatherer.getCollectDirectoryPath() + collection_name + ".zip";
     
    213213
    214214        String download_collection_archives_command = "cmd=download-collection-archives";
    215         download_collection_archives_command += "&c=" + URLEncoder.encode(collection_name, "UTF-8");
     215        download_collection_archives_command += "&c=" + URLEncoder.encode(collection_name.replace(File.separatorChar, '|'), "UTF-8");
    216216        download_collection_archives_command += "&lr=" + remote.lang_region;
    217217        String zip_file_path = Gatherer.getCollectDirectoryPath() + collection_name + "-archives.zip";
     
    310310
    311311        String file_exists_command = "cmd=file-exists";
    312         file_exists_command += "&c=" + URLEncoder.encode(collection_name, "UTF-8");
     312        file_exists_command += "&c=" + URLEncoder.encode(collection_name.replace(File.separatorChar, '|'), "UTF-8");
    313313        // base64 encode the filename to preserve special characters
    314314        file_exists_command += "&file=" + Base64.encodeBytes(collection_file_relative_path.getBytes());
     
    347347
    348348        String download_collection_file_command = "cmd=download-collection-file";
    349         download_collection_file_command += "&c=" + URLEncoder.encode(collection_name, "UTF-8");
     349        download_collection_file_command += "&c=" + URLEncoder.encode(collection_name.replace(File.separatorChar, '|'), "UTF-8");
    350350        download_collection_file_command += "&file=" + URLEncoder.encode(collection_file_relative_path, "UTF-8");
    351351        download_collection_file_command += "&lr=" + remote.lang_region;
     
    470470
    471471        String move_collection_file_command = "cmd=move-collection-file";
    472         move_collection_file_command += "&c=" + URLEncoder.encode(collection_name, "UTF-8");
     472        move_collection_file_command += "&c=" + URLEncoder.encode(collection_name.replace(File.separatorChar, '|'), "UTF-8");
    473473        move_collection_file_command += "&source=" + Base64.encodeBytes(source_collection_file_relative_path.getBytes());
    474474        move_collection_file_command += "&target=" + Base64.encodeBytes(target_collection_file_relative_path.getBytes());
     
    507507
    508508        String new_collection_directory_command = "cmd=new-collection-directory";
    509         new_collection_directory_command += "&c=" + URLEncoder.encode(collection_name, "UTF-8");
     509        new_collection_directory_command += "&c=" + URLEncoder.encode(collection_name.replace(File.separatorChar, '|'), "UTF-8");
    510510        new_collection_directory_command += "&directory=" + URLEncoder.encode(new_collection_directory_relative_path, "UTF-8");
    511511        action_output = remote.sendCommandToServer(new_collection_directory_command, null);
     
    541541
    542542        String run_script_command = "cmd=run-script";
    543         run_script_command += "&c=" + URLEncoder.encode(collection_name, "UTF-8");
     543        run_script_command += "&c=" + URLEncoder.encode(collection_name.replace(File.separatorChar, '|'), "UTF-8");
    544544        run_script_command += "&script=" + script_name;
    545545        run_script_command += "&language=" + Configuration.getLanguage();
     
    588588        // Upload the zip file
    589589        String upload_collection_file_command = "cmd=upload-collection-file";
    590         upload_collection_file_command += "&c=" + URLEncoder.encode(collection_name, "UTF-8");
     590        upload_collection_file_command += "&c=" + URLEncoder.encode(collection_name.replace(File.separatorChar, '|'), "UTF-8");
    591591        upload_collection_file_command += "&file=" + URLEncoder.encode(zip_file_name, "UTF-8");
    592592        upload_collection_file_command += "&directory=";
     
    643643
    644644        String upload_collection_file_command = "cmd=upload-collection-file";
    645         upload_collection_file_command += "&c=" + URLEncoder.encode(collection_name, "UTF-8");
     645        upload_collection_file_command += "&c=" + URLEncoder.encode(collection_name.replace(File.separatorChar, '|'), "UTF-8");
    646646        upload_collection_file_command += "&file=" + URLEncoder.encode(zip_file_name, "UTF-8");
    647647        upload_collection_file_command += "&directory=" + URLEncoder.encode(target_collection_directory_relative_path, "UTF-8");
Note: See TracChangeset for help on using the changeset viewer.