Changeset 7960
- Timestamp:
- 2004-08-16T22:38:03+12:00 (20 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gli/src/org/greenstone/gatherer/shell/GShell.java
r7925 r7960 47 47 import org.greenstone.gatherer.Dictionary; 48 48 import org.greenstone.gatherer.Gatherer; 49 import org.greenstone.gatherer.cdm.CollectionConfiguration; 50 import org.greenstone.gatherer.cdm.CollectionDesignManager; 51 import org.greenstone.gatherer.cdm.CollectionMetaManager; 52 import org.greenstone.gatherer.cdm.CollectionMeta; 49 53 import org.greenstone.gatherer.msm.GreenstoneArchiveParser; 50 54 import org.greenstone.gatherer.shell.GShellListener; … … 204 208 } 205 209 210 211 protected int check_for_error(String line, StringBuffer error_list, 212 int error_count) 213 { 214 if (line.startsWith("ERROR:")) { 215 error_count++; 216 if (error_count<10) { 217 error_list.append(line); 218 } 219 else if (error_count==10) { 220 error_list.append("...\n"); 221 } 222 } 223 return error_count; 224 } 225 226 206 227 protected void runRemote(String[] args, BufferedOutputStream bos) 207 228 { … … 254 275 URLConnection launch_connection = launch_url.openConnection(); 255 276 InputStream stdis = launch_connection.getInputStream(); 256 InputStreamReader stdisr = new InputStreamReader(stdis, "UTF-8" 277 InputStreamReader stdisr = new InputStreamReader(stdis, "UTF-8"); 257 278 258 279 BufferedReader stdbr = new BufferedReader(stdisr); 259 280 281 StringBuffer error_list = new StringBuffer(); 282 int error_count = 0; 283 260 284 if (type == GShell.NEW) { 261 285 while(true) { 262 286 String line = stdbr.readLine(); 263 287 if (line == null) { break; } 264 } 288 error_count = check_for_error(line,error_list,error_count); 289 } 265 290 } 266 291 else { … … 268 293 String line = stdbr.readLine(); 269 294 if (line == null) { break; } 295 error_count = check_for_error(line,error_list,error_count); 270 296 fireMessage(type, typeAsString(type) + "> " + line, status, bos); 271 297 } … … 273 299 stdbr.close(); 274 300 275 status = OK; 276 fireMessage(type, typeAsString(type) + "> " + Dictionary.get("GShell.Success"), status, null); 301 if (error_count>0) { 302 status = ERROR; 303 System.err.println(error_list); 304 if (type != GShell.NEW) { 305 fireMessage(type, typeAsString(type) + "> " + error_list, status, null); 306 } 307 } 308 else { 309 status = OK; 310 fireMessage(type, typeAsString(type) + "> " + Dictionary.get("GShell.Success"), status, null); 311 } 312 313 277 314 } 278 315 // Exception 279 316 catch (Exception exception) { 280 Gatherer.println("Exception in GShell.runRemove() - unexpected");317 System.err.println("Exception in GShell.runRemote() - unexpected"); 281 318 Gatherer.printStackTrace(exception); 282 319 status = ERROR; … … 302 339 InputStreamReader eisr = new InputStreamReader( prcs.getErrorStream(), "UTF-8" ); 303 340 InputStreamReader stdisr = new InputStreamReader( prcs.getInputStream(), "UTF-8" ); 304 //BufferedReader ebr = new BufferedReader( eisr );305 //BufferedReader stdinbr = new BufferedReader( stdinisr );306 // Captures the std err of a program and pipes it into std in of java307 341 308 342 StringBuffer eline_buffer = new StringBuffer(); … … 438 472 Utility.zipup(col_name,Utility.CONFIG_FILE); 439 473 Utility.upload_url_zip(col_name,"etc"); 474 475 476 String col_dir = Utility.getCollectDir(Gatherer.config.gsdl_path); 477 478 File img_dir = new File(Utility.getImagesDir(col_dir)); 479 if (img_dir.exists()) { 480 // upload images/ directory to server 481 Utility.zipup(col_name,"images"); 482 Utility.upload_url_zip(col_name,"images"); 483 } 484 485 // see if collection specific image needs uploading 486 CollectionMetaManager cmm 487 = CollectionDesignManager.collectionmeta_manager; 488 489 CollectionMeta icon_collection_collectionmeta 490 = cmm.getMetadatum(CollectionConfiguration.COLLECTIONMETADATA_ICONCOLLECTION_STR); 491 CollectionMeta icon_collection_small_collectionmeta 492 = cmm.getMetadatum(CollectionConfiguration.COLLECTIONMETADATA_ICONCOLLECTIONSMALL_STR); 493 494 String ics_text = icon_collection_collectionmeta.getValue(CollectionMeta.TEXT); 495 String icsc_text = icon_collection_small_collectionmeta.getValue(CollectionMeta.TEXT); 496 if ((ics_text != null) && (ics_text != "")) { 497 // Stub code for detecting when collectoin image changed 498 // => need to upload images 499 // System.err.println("**** ics_text = " + ics_text); 500 } 501 440 502 441 503 if (progress!=null) {
Note:
See TracChangeset
for help on using the changeset viewer.