Changeset 9202
- Timestamp:
- 2005-02-28T10:29:08+13:00 (19 years ago)
- Location:
- trunk/gli/src/org/greenstone/gatherer
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gli/src/org/greenstone/gatherer/GathererApplet.java
r9166 r9202 259 259 error.printStackTrace(); 260 260 } 261 } 262 263 264 static public void upload_url_zip(String col_name, String dir, GShell source) 261 DebugStream.println("Exited download_url_zip"); //debug 262 } 263 264 265 static public void upload_url_zip(String col_name, String dir, String delete_type, GShell source) 265 266 { 266 267 final String lineEnd = "\r\n"; … … 278 279 // Send zip file to server 279 280 280 File file = new File(zip_fname) ; 281 File file = new File(zip_fname) ; 282 281 283 FileInputStream fileInputStream = new FileInputStream(file); 282 284 … … 309 311 310 312 dos.writeBytes(twoHyphens + boundary + lineEnd); 313 dos.writeBytes("Content-Disposition: form-data; name=\"del\"" + lineEnd + lineEnd); 314 dos.writeBytes(delete_type + lineEnd); 315 System.err.println("**** del="+delete_type); 316 317 dos.writeBytes(twoHyphens + boundary + lineEnd); 311 318 dos.writeBytes("Content-Disposition: form-data; name=\"zip\";" 312 319 + " filename=\"" + zip_fname +"\"" + lineEnd); … … 314 321 System.err.println("**** zip (filename)="+zip_fname); 315 322 323 324 316 325 // create a buffer of maximum size 317 326 int bytesAvailable = fileInputStream.available(); -
trunk/gli/src/org/greenstone/gatherer/cdm/CollectionDesignManager.java
r9166 r9202 217 217 // upload etc/collect.cfg to server to reflect changes 218 218 Utility.zipup(Gatherer.getCollectDirectoryPath(), collection_name, Utility.CONFIG_FILE, null, "", ""); 219 GathererApplet.upload_url_zip(collection_name, "etc", null);219 GathererApplet.upload_url_zip(collection_name, "etc", "", null); 220 220 } 221 221 } -
trunk/gli/src/org/greenstone/gatherer/shell/GShell.java
r9166 r9202 241 241 String collect_directory_path = Gatherer.getCollectDirectoryPath(); 242 242 243 //Only upload the import directory if the files or metadata has changed. 244 System.err.println("getFilesChanged(): " + Gatherer.c_man.getCollection().getFilesChanged()); 245 System.err.println("getMetadataChanged(): " + Gatherer.c_man.getCollection().getMetadataChanged()); 246 if(Gatherer.c_man.getCollection().getFilesChanged() || Gatherer.c_man.getCollection().getMetadataChanged()) { 247 // zip up import folder 248 Utility.zipup(collect_directory_path, col_name, "import", this, "", ""); 249 System.err.println("collect_directory_path: " + collect_directory_path); 250 System.err.println("col_name: " + col_name); 243 //Only upload the parts of the import folder (files/metadata) that has been changed. 244 if(Gatherer.c_man.getCollection().getFilesChanged()) { 245 // zip up import folder, but exclude metadata 246 Utility.zipup(collect_directory_path, col_name, "import", this, "", ".*metadata\\.xml"); 251 247 252 248 if(hasSignalledStop()) { return; } 253 249 // upload it to gsdl server 254 GathererApplet.upload_url_zip(col_name, "import", this);250 GathererApplet.upload_url_zip(col_name, "import", "files", this); 255 251 256 252 Gatherer.c_man.getCollection().setFilesChanged(false); 253 System.err.println("Finished uploading files"); 254 } 255 if(Gatherer.c_man.getCollection().getMetadataChanged()) { 256 // zip up metadata from import folder 257 Utility.zipup(collect_directory_path, col_name, "import", this, ".*metadata\\.xml", ""); 258 259 if(hasSignalledStop()) { return; } 260 // upload it to gsdl server 261 GathererApplet.upload_url_zip(col_name, "import", "metadata", this); 257 262 Gatherer.c_man.getCollection().setMetadataChanged(false); 263 System.err.println("Finished uploading metadata."); 258 264 } 259 265 … … 263 269 264 270 if(hasSignalledStop()) { return; } 265 GathererApplet.upload_url_zip(col_name, "etc", this);271 GathererApplet.upload_url_zip(col_name, "etc", "", this); 266 272 267 273 String collection_directory_path = Gatherer.c_man.getCollectionDirectoryPath(col_name); … … 273 279 274 280 if(hasSignalledStop()) { return; } 275 GathererApplet.upload_url_zip(col_name, "images", this); 281 GathererApplet.upload_url_zip(col_name, "images", "", this); 282 283 System.err.println("collect_directory_path: " + collect_directory_path); 284 System.err.println("col_name: " + col_name); 276 285 } 277 286 -
trunk/gli/src/org/greenstone/gatherer/util/Unzip.java
r7820 r9202 103 103 } 104 104 catch (IOException ioe) { 105 System.err.println("Unhandled exception :");105 System.err.println("Unhandled exception on " + args[1]); 106 106 ioe.printStackTrace(); 107 107 return; -
trunk/gli/src/org/greenstone/gatherer/util/Utility.java
r9195 r9202 71 71 static final public int BUFFER_SIZE = FACTOR * 1024; 72 72 /** Definition of an important directory name, in this case the base dir, or the working directory of the Gatherer. */ 73 /** The regular expression that marks if we only want doc.xml files. Will this work in Windows?? --Matthew */74 static final public String METADATA_ONLY_EXPR = "\".*" + File.separator + "doc\\.xml\"";75 73 76 74 static public String BASE_DIR = System.getProperty("user.dir") + File.separator; … … 627 625 if((reject_expr != "") && (file_path.matches(reject_expr))) { 628 626 // matches reject expression 629 DebugStream.println("File \'" + file_path + "\' matches the reject expression \'" + reject_expr + "\'");627 //DebugStream.println("File \'" + file_path + "\' matches the reject expression \'" + reject_expr + "\'"); 630 628 return encountered_file; 631 629 } … … 633 631 if ((accept_expr != "") && (!file_path.matches(accept_expr))) { 634 632 // does not match accept expression 635 DebugStream.println("File \'" + file_path + "\' doesn't match accept expression \'" + accept_expr + "\'");633 //DebugStream.println("File \'" + file_path + "\' doesn't match accept expression \'" + accept_expr + "\'"); 636 634 return encountered_file; 637 635 } … … 639 637 //Special case: we only want the metadata. Parse the xml files. 640 638 if(accept_expr.compareTo(".*doc.xml") == 0) { 641 System.err.println("Only want to get metadata"); //debug639 DebugStream.println("Only want to get metadata"); 642 640 Document old_document = XMLTools.parseXMLFile(new File(file_path)); 643 641 NodeList content = old_document.getElementsByTagName("Content"); … … 719 717 static protected boolean dirFunc (ZipOutputStream zos, String dir_name, int prefix_strip, GShell source, boolean encountered_file, String accept_expr, String reject_expr) 720 718 { 721 /*722 if (reject_expr != "" && (dir_name.matches(reject_expr))) {723 // matches reject expression724 System.err.println("matches reject expression");725 return encountered_file;726 }727 728 if ((accept_expr != "") && (!dir_name.matches(accept_expr))) {729 // does not match accept expression730 System.err.println("doesn't match accept expression");731 return encountered_file;732 }733 */734 735 719 File dirObj = new File(dir_name); 736 720 … … 859 843 860 844 if (zipentry.isDirectory()) { 861 // Create named directory 862 boolean success = (new File(zentryname)).mkdir(); 863 if (!success) { 864 System.err.println("Error: unable to create directory '"+zentryname+"'"); 845 if(!file.exists()) { 846 // Create named directory, if it doesn't already exist. 847 boolean success = (file.mkdir()); 848 if (!success) { 849 System.err.println("Error: unable to create directory '"+zentryname+"'"); 850 } 865 851 } 866 852 } … … 894 880 catch (ZipException error) { 895 881 System.err.println("Error: Unable to open '"+zip_fname+"'"); 882 System.err.println("This maybe caused by the zip file being empty."); 896 883 DebugStream.printStackTrace(error); 897 884 }
Note:
See TracChangeset
for help on using the changeset viewer.