If no matching file is found it will use a file in the jobout directory
Definition at line 24 of file JetWebFile.java.
Public Member Functions | |
JetWebFile (String fName) | |
JetWebFile (String fName, String extension) | |
String | toString () |
JetWebFile | Zip () throws JetWebException |
JetWebFile | UnZip () throws JetWebException |
boolean | isZipped () |
JetWebFile | Archive () throws JetWebException |
JetWebFile | UnArchive () throws JetWebException |
boolean | isArchived () |
String | extension () |
String | directory () |
boolean | isAida () |
boolean | isXML () |
boolean | isOut () |
String | fullPath () |
Static Public Attributes | |
String | XML = ".xml" |
String | AIDA = ".aida" |
String | AIDML = ".aidml" |
String | OUT = ".out" |
Private Member Functions | |
void | parseFileName (String fName) |
JetWebFile | moveTo (String dir) throws JetWebException |
void | reName (String oldName, String newName) throws JetWebException |
void | execCommand (String cmd) throws JetWebException |
Static Private Member Functions | |
String | findFileName (String fName) |
Vector< String > | decompose (String fName) |
void | checkPaths () |
Private Attributes | |
boolean | zipped_ = false |
boolean | archived_ = false |
boolean | jobIn_ = false |
boolean | jobOut_ = false |
String | dir_ = "" |
String | fileName_ = "" |
String | extension_ = "" |
boolean | isXML_ = false |
boolean | isAida_ = false |
boolean | isOut_ = false |
Static Private Attributes | |
String | archiveDir_ = JetWebConfig.storeDirName |
String | inputDir_ = JetWebConfig.jobInDirName |
String | outputDir_ = JetWebConfig.jobOutDirName |
boolean | pathsChecked_ = false |
String | GZ_ = ".gz" |
Integer | xmlLength_ = XML.length() |
Integer | outLength_ = OUT.length() |
Integer | aidaLength_ = AIDA.length() |
Integer | gzLength_ = GZ_.length() |
Integer | aidmlLength_ = AIDML.length() |
|
Instantiates a JetWeb file from a string. First attempts to open a file matching the string exactly If that fails attempts to open a gzipped of non-gzipped file in the archive or jobin directories. If that fails, create new file in jobout directory
Definition at line 64 of file JetWebFile.java. References JetWebFile.findFileName(), and JetWebFile.parseFileName(). Referenced by JetWebFile.moveTo(), JetWebFile.UnZip(), and JetWebFile.Zip(). 00064 { 00065 00066 super(findFileName(fName)); 00067 parseFileName(this.getAbsolutePath()); 00068 }
|
|
Instantiates a JetWeb file from a file name and extension First attempts to open a file matching the string exactly If that fails attempts to open a gzipped of non-gzipped file in the archive or jobin directories. If that fails, create new file in jobout directory
Definition at line 80 of file JetWebFile.java. References JetWebFile.findFileName(), and JetWebFile.parseFileName(). 00080 { 00081 super(findFileName(fName + extension)); 00082 parseFileName(this.getAbsolutePath()); 00083 }
|
|
Moves the file from its present location to the archive directory
Definition at line 173 of file JetWebFile.java. References JetWebFile.archived_, JetWebFile.archiveDir_, JetWebFile.extension_, and JetWebFile.moveTo(). Referenced by JobUtils.moveAndStore(). 00174 { 00175 00176 if(archived_) return this; 00177 if(!this.exists()){ 00178 throw new JetWebException("JetWebFile.Archive()", 00179 "Error, file " + 00180 this + extension_ + 00181 "does not exist for archiving"); 00182 } 00183 00184 archived_ = true; 00185 00186 return moveTo(archiveDir_); 00187 }
|
|
Checks the paths of the directories that were specified in jetweb.properties to make sure the trailing "/" is present Definition at line 429 of file JetWebFile.java. References JetWebFile.archiveDir_, JetWebFile.inputDir_, JetWebFile.outputDir_, and JetWebFile.pathsChecked_. Referenced by JetWebFile.findFileName(). 00429 { 00430 00431 if(pathsChecked_) return; 00432 pathsChecked_ = true; 00433 00434 if(!archiveDir_.endsWith("/")) archiveDir_ = archiveDir_ + "/"; 00435 if(!inputDir_.endsWith("/")) inputDir_ = inputDir_ + "/"; 00436 if(!outputDir_.endsWith("/")) outputDir_ = outputDir_ + "/"; 00437 00438 return; 00439 }
|
|
Definition at line 334 of file JetWebFile.java. References JetWebFile.AIDA, JetWebFile.AIDML, JetWebFile.GZ_, JetWebFile.OUT, and JetWebFile.XML. Referenced by JetWebFile.findFileName(), and JetWebFile.parseFileName(). 00334 { 00335 Vector<String> vec = new Vector(4); 00336 00337 int lastSlash = fName .lastIndexOf("/"); 00338 if(lastSlash != -1){ 00339 String dir = fName.substring(0, lastSlash); 00340 if(!dir.endsWith("/")) dir = dir + "/"; 00341 vec.add(dir); 00342 fName = fName.substring(lastSlash+1); 00343 }else{ 00344 vec.add(""); 00345 } 00346 boolean zipped = false; 00347 boolean aida; 00348 String gz = ""; 00349 String ext = ""; 00350 if(fName.endsWith(GZ_)){ 00351 fName = fName.substring(0, fName.length() - gzLength_); 00352 gz = GZ_; 00353 } 00354 00355 if(fName.endsWith(AIDA)){ 00356 fName = fName.substring(0, fName.length() - aidaLength_); 00357 ext = AIDA; 00358 } 00359 00360 if(fName.endsWith(AIDML)){ 00361 fName = fName.substring(0, fName.length() - aidmlLength_); 00362 ext = AIDML; 00363 } 00364 00365 if(fName.endsWith(XML)){ 00366 fName = fName.substring(0, fName.length() - xmlLength_); 00367 ext = XML; 00368 } 00369 00370 if(fName.endsWith(OUT)){ 00371 fName = fName.substring(0, fName.length() - outLength_); 00372 ext = OUT; 00373 } 00374 00375 vec.add(fName); 00376 vec.add(ext); 00377 vec.add(gz); 00378 return vec; 00379 }
|
|
Returns the directory this file is in. Definition at line 230 of file JetWebFile.java. Referenced by JobUtils.zipIt(). 00230 {
00231 return dir_;
00232 }
|
|
Definition at line 482 of file JetWebFile.java. References JetWebFile.dir_, and JetWebFile.fileName_. Referenced by JetWebFile.UnZip(), and JetWebFile.Zip(). 00483 { 00484 00485 try{ 00486 Process prc = 00487 Runtime.getRuntime().exec 00488 (cmd + " " + dir_ + fileName_ + extension_); 00489 try { 00490 prc.waitFor(); 00491 } catch (InterruptedException e) { 00492 System.out.println("JetWebFile: Problem waiting for file " + 00493 dir_ + fileName_ + 00494 " with command " + cmd); 00495 } 00496 }catch (IOException e1) { 00497 throw new JetWebException 00498 (e1, "JetWebFile: Could not execute command " + 00499 cmd +"on file " + dir_ + fileName_); 00500 } 00501 00502 return; 00503 }
|
|
Returns the extension of this file. Definition at line 223 of file JetWebFile.java. Referenced by HTMLJobWriter.display(), and JobUtils.zipIt(). 00223 {
00224 return extension_;
00225 }
|
|
Definition at line 267 of file JetWebFile.java. References JetWebFile.AIDA, JetWebFile.AIDML, JetWebFile.archiveDir_, JetWebFile.checkPaths(), JetWebFile.decompose(), JetWebFile.GZ_, JetWebFile.inputDir_, JetWebFile.isAida(), and JetWebFile.outputDir_. Referenced by JetWebFile.JetWebFile(). 00267 { 00268 00269 checkPaths(); 00270 00271 File tmp = new File(fName); 00272 if(tmp.exists()){ 00273 return fName; 00274 } 00275 00276 Vector<String> parts = decompose(fName); 00277 00278 boolean triedZipped = parts.get(2).equals(AIDA) || 00279 parts.get(3).equals(GZ_); 00280 boolean triedArchive = parts.get(0).equals(archiveDir_); 00281 boolean triedInput = parts.get(0).equals(inputDir_); 00282 boolean isAida = parts.get(2).equals(AIDA) || 00283 parts.get(2).equals(AIDML); 00284 00285 if( !(triedArchive && triedZipped) ){ 00286 if(isAida){ 00287 fName = archiveDir_ + parts.get(1) + AIDA; 00288 }else{ 00289 fName = archiveDir_ + parts.get(1) + parts.get(2) + GZ_; 00290 } 00291 00292 tmp = new File(fName); 00293 if(tmp.exists())return fName; 00294 } 00295 00296 if( !(triedArchive && !triedZipped) ){ 00297 if(isAida){ 00298 fName = archiveDir_ + parts.get(1) + AIDML; 00299 }else{ 00300 fName = archiveDir_ + parts.get(1) + parts.get(2); 00301 } 00302 00303 tmp = new File(fName); 00304 if(tmp.exists()) return fName; 00305 } 00306 00307 if( !(triedInput && triedZipped)){ 00308 if(isAida){ 00309 fName = inputDir_ + parts.get(1) + AIDA; 00310 }else{ 00311 fName = inputDir_ + parts.get(1) + parts.get(2) + GZ_; 00312 } 00313 00314 tmp = new File(fName); 00315 if(tmp.exists()) return fName; 00316 } 00317 00318 if( !(triedInput && !triedZipped)){ 00319 if(isAida){ 00320 fName = inputDir_ + parts.get(1) + AIDML; 00321 }else{ 00322 fName = inputDir_ + parts.get(1) + parts.get(2); 00323 } 00324 00325 tmp = new File(fName); 00326 if(tmp.exists()) return fName; 00327 } 00328 00329 fName = outputDir_ + parts.get(1) + parts.get(2); 00330 00331 return fName; 00332 }
|
|
Returns the full path and filename of this file Definition at line 259 of file JetWebFile.java. References JetWebFile.dir_, JetWebFile.fileName_, and JetWebFile.zipped_. Referenced by JetWebPlotReaderFactory.getNewPlotReader(). 00259 { 00260 00261 String fp = dir_ + fileName_ + extension_; 00262 if(zipped_ && !isAida_) fp = fp + GZ_; 00263 00264 return fp; 00265 }
|
|
Returns true if this file is a compressed or uncompressed aida file. Definition at line 237 of file JetWebFile.java. Referenced by JetWebFile.findFileName(), JetWebPlotReaderFactory.getNewPlotReader(), JetWebFile.moveTo(), JetWebFile.UnZip(), and JetWebFile.Zip(). 00237 {
00238 return(isAida_);
00239 }
|
|
Returns true if this file is archived in the archive directory Definition at line 215 of file JetWebFile.java. 00215 {
00216 return archived_;
00217 }
|
|
Returns true if this file is a compressed or uncompressed .out file. Definition at line 252 of file JetWebFile.java. Referenced by HTMLJobWriter.display(). 00252 {
00253 return(isOut_);
00254 }
|
|
Returns true if this file is a compressed or uncompressed xml file. Definition at line 244 of file JetWebFile.java. 00244 {
00245 return(isXML_);
00246 }
|
|
Returns true if this file is compressed Definition at line 164 of file JetWebFile.java. Referenced by HTMLJobWriter.display(), JetWebXMLReader.getUnzippedSource(), JetWebFile.moveTo(), and JetWebXMLReader.readZipped(). 00164 {
00165 return zipped_;
00166 }
|
|
Definition at line 441 of file JetWebFile.java. References JetWebFile.dir_, JetWebFile.fileName_, JetWebFile.isAida(), JetWebFile.isZipped(), and JetWebFile.JetWebFile(). Referenced by JetWebFile.Archive(), and JetWebFile.UnArchive(). 00442 { 00443 00444 if(!dir.endsWith("/")) dir = dir + "/"; 00445 JetWebFile newFile = null; 00446 try{ 00447 File fileDir = new File(dir); 00448 FileUtils.copyFileToDirectory(this, fileDir); 00449 00450 String fName = fileName_ + extension_; 00451 if(!isAida() && isZipped()){ 00452 fName = fName + GZ_; 00453 } 00454 00455 newFile = new JetWebFile(dir + fName); 00456 File oldFile = new File(dir_ + fName); 00457 00458 //this.renameTo(newFile); 00459 FileUtils.forceDelete(oldFile); 00460 }catch (IOException err){ 00461 throw new JetWebException(err); 00462 } 00463 return newFile; 00464 }
|
|
Parses path to file to see if it is gzipped or not, whether it is an aida, xml or out file and whether it is stored in the archive or jobin directories. Definition at line 386 of file JetWebFile.java. References JetWebFile.AIDA, JetWebFile.AIDML, JetWebFile.archived_, JetWebFile.archiveDir_, JetWebFile.decompose(), JetWebFile.dir_, JetWebFile.extension_, JetWebFile.fileName_, JetWebFile.GZ_, JetWebFile.inputDir_, JetWebFile.isAida_, JetWebFile.isOut_, JetWebFile.isXML_, JetWebFile.jobIn_, JetWebFile.jobOut_, JetWebFile.OUT, JetWebFile.outputDir_, JetWebFile.XML, and JetWebFile.zipped_. Referenced by JetWebFile.JetWebFile(). 00386 { 00387 00388 Vector<String> parts = decompose(fName); 00389 dir_ = parts.get(0); 00390 fileName_ = parts.get(1); 00391 String ext = parts.get(2); 00392 00393 if(parts.get(3).equals(GZ_) || 00394 ext.equals(AIDA)){ 00395 zipped_ = true; 00396 }else{ 00397 zipped_ = false; 00398 } 00399 00400 if(ext.equals(AIDA)){ 00401 extension_ = AIDA; 00402 isAida_ = true; 00403 }else if(ext.equals(AIDML)){ 00404 extension_ = AIDML; 00405 isAida_ = true; 00406 }else if(ext.equals(XML)){ 00407 extension_ = XML; 00408 isXML_ = true; 00409 }else if(ext.equals(OUT)){ 00410 extension_ = OUT; 00411 isOut_ = true; 00412 } 00413 00414 if(dir_.equals(archiveDir_)){ 00415 archived_ = true; 00416 }else if(dir_.equals(inputDir_)){ 00417 jobIn_ = true; 00418 }else if(dir_.equals(outputDir_)){ 00419 jobOut_ = true; 00420 } 00421 00422 return; 00423 }
|
|
Definition at line 466 of file JetWebFile.java. Referenced by JetWebFile.UnZip(), and JetWebFile.Zip(). 00467 { 00468 00469 File newFile = new File(newName); 00470 File oldFile = new File(oldName); 00471 try{ 00472 FileUtils.copyFile(oldFile, newFile); 00473 FileUtils.forceDelete(oldFile); 00474 }catch(IOException err){ 00475 throw new JetWebException(err); 00476 } 00477 //this.renameTo(newFile); 00478 //oldFile.delete(); 00479 return; 00480 }
|
|
Returns the name of this file. Does not include the path to the file or the extension in the name Definition at line 89 of file JetWebFile.java. Referenced by HTMLJobWriter.display(). 00089 {
00090
00091 return fileName_;
00092 }
|
|
Retrieves the file from the archive directory (if present) and moves it to the jobin directory
Definition at line 195 of file JetWebFile.java. References JetWebFile.archived_, JetWebFile.extension_, JetWebFile.moveTo(), and JetWebFile.outputDir_. 00196 { 00197 00198 if(!archived_) return this; 00199 if(!this.exists()){ 00200 throw new JetWebException("JetWebFile.UnArchive()", 00201 "Error, file " + 00202 this + extension_ + 00203 "does not exist in the archive directory" 00204 ); 00205 } 00206 00207 archived_ = false; 00208 00209 return moveTo(outputDir_); 00210 }
|
|
Uncompress this file. If this is an aida file then it is renamed from .aida to .aidml
Definition at line 133 of file JetWebFile.java. References JetWebFile.AIDA, JetWebFile.AIDML, JetWebFile.dir_, JetWebFile.execCommand(), JetWebFile.extension_, JetWebFile.fileName_, JetWebFile.GZ_, JetWebFile.isAida(), JetWebFile.JetWebFile(), JetWebFile.reName(), and JetWebFile.zipped_. 00134 { 00135 00136 if(!zipped_) return this; 00137 00138 if(!this.exists()){ 00139 throw new JetWebException("JetWebFile.UnZip()", 00140 "Error, file " + 00141 this + extension_ + GZ_ + 00142 "does not exist for unzipping"); 00143 } 00144 00145 JetWebFile newFile = null; 00146 00147 if(isAida()){ 00148 execCommand("gunzip -f -S '" + AIDA + "'"); 00149 //we now need to tag on the .aidml extension 00150 reName(dir_ + fileName_, dir_ + fileName_ + AIDML); 00151 extension_ = AIDML; 00152 newFile = new JetWebFile(dir_ + fileName_ + AIDML); 00153 }else{ 00154 execCommand("gunzip -f"); 00155 newFile = new JetWebFile(dir_ + fileName_ + extension_); 00156 } 00157 zipped_ = false; 00158 return newFile; 00159 }
|
|
Compress this file using the gzip algorithm if this is an aida file then it is renamed from .aidml to .aida
Definition at line 99 of file JetWebFile.java. References JetWebFile.AIDA, JetWebFile.AIDML, JetWebFile.dir_, JetWebFile.execCommand(), JetWebFile.extension_, JetWebFile.fileName_, JetWebFile.GZ_, JetWebFile.isAida(), JetWebFile.JetWebFile(), JetWebFile.reName(), and JetWebFile.zipped_. Referenced by JetWebPlotReaderFactory.getNewPlotReader(), JobUtils.moveAndStore(), and JobUtils.zipIt(). 00100 { 00101 00102 if(zipped_) return this; 00103 00104 if(!this.exists()){ 00105 throw new JetWebException("JetWebFile.Zip()", 00106 "Error, file " + 00107 this + extension_ + 00108 "does not exist for zipping"); 00109 } 00110 00111 execCommand("gzip -f"); 00112 zipped_ = true; 00113 00114 JetWebFile newFile = null; 00115 00116 if(isAida()){//then we must re-name the file from .aidml.gz to .aida 00117 reName(dir_ + fileName_ + AIDML + GZ_, 00118 dir_ + fileName_ + AIDA); 00119 extension_ = AIDA; 00120 newFile = new JetWebFile(dir_ + fileName_ + AIDA); 00121 }else{ 00122 newFile = new JetWebFile(dir_ + fileName_ + extension_ + GZ_); 00123 } 00124 00125 return newFile; 00126 }
|
|
Definition at line 44 of file JetWebFile.java. Referenced by JetWebFile.decompose(), HTMLJobWriter.display(), JetWebFile.findFileName(), JetWebFile.parseFileName(), JetWebFile.UnZip(), and JetWebFile.Zip(). |
|
Definition at line 50 of file JetWebFile.java. |
|
Definition at line 45 of file JetWebFile.java. Referenced by JetWebFile.decompose(), JetWebFile.findFileName(), JetWebFile.parseFileName(), JetWebFile.UnZip(), and JetWebFile.Zip(). |
|
Definition at line 52 of file JetWebFile.java. |
|
Definition at line 27 of file JetWebFile.java. Referenced by JetWebFile.Archive(), JetWebFile.parseFileName(), and JetWebFile.UnArchive(). |
|
Definition at line 33 of file JetWebFile.java. Referenced by JetWebFile.Archive(), JetWebFile.checkPaths(), JetWebFile.findFileName(), and JetWebFile.parseFileName(). |
|
Definition at line 30 of file JetWebFile.java. Referenced by JetWebFile.execCommand(), JetWebFile.fullPath(), JetWebFile.moveTo(), JetWebFile.parseFileName(), JetWebFile.UnZip(), and JetWebFile.Zip(). |
|
Definition at line 32 of file JetWebFile.java. Referenced by JetWebFile.Archive(), JetWebFile.parseFileName(), JetWebFile.UnArchive(), JetWebFile.UnZip(), and JetWebFile.Zip(). |
|
Definition at line 31 of file JetWebFile.java. Referenced by JetWebFile.execCommand(), JetWebFile.fullPath(), JetWebFile.moveTo(), JetWebFile.parseFileName(), JetWebFile.UnZip(), and JetWebFile.Zip(). |
|
Definition at line 43 of file JetWebFile.java. Referenced by JetWebFile.decompose(), JetWebFile.findFileName(), JetWebFile.parseFileName(), JetWebFile.UnZip(), and JetWebFile.Zip(). |
|
Definition at line 51 of file JetWebFile.java. |
|
Definition at line 34 of file JetWebFile.java. Referenced by JetWebFile.checkPaths(), JetWebFile.findFileName(), and JetWebFile.parseFileName(). |
|
Definition at line 39 of file JetWebFile.java. Referenced by JetWebFile.parseFileName(). |
|
Definition at line 40 of file JetWebFile.java. Referenced by JetWebFile.parseFileName(). |
|
Definition at line 38 of file JetWebFile.java. Referenced by JetWebFile.parseFileName(). |
|
Definition at line 28 of file JetWebFile.java. Referenced by JetWebFile.parseFileName(). |
|
Definition at line 29 of file JetWebFile.java. Referenced by JetWebFile.parseFileName(). |
|
Definition at line 46 of file JetWebFile.java. Referenced by JetWebFile.decompose(), and JetWebFile.parseFileName(). |
|
Definition at line 49 of file JetWebFile.java. |
|
Definition at line 35 of file JetWebFile.java. Referenced by JetWebFile.checkPaths(), JetWebFile.findFileName(), JetWebFile.parseFileName(), and JetWebFile.UnArchive(). |
|
Definition at line 36 of file JetWebFile.java. Referenced by JetWebFile.checkPaths(). |
|
Definition at line 42 of file JetWebFile.java. Referenced by JetWebFile.decompose(), HTMLJobWriter.display(), DBJobManager.fillLog(), and JetWebFile.parseFileName(). |
|
Definition at line 48 of file JetWebFile.java. |
|
Definition at line 26 of file JetWebFile.java. Referenced by JetWebFile.fullPath(), JetWebFile.parseFileName(), JetWebFile.UnZip(), and JetWebFile.Zip(). |
Generated Wed Jan 17 09:14:27 GMT 2007