Produced by Araxis Merge on 12/5/2017 12:06:42 PM Central Standard Time. See www.araxis.com for information about Merge. This report uses XHTML and CSS2, and is best viewed with a modern standards-compliant browser. For optimum results when printing this report, use landscape orientation and enable printing of background images and colours in your browser.
| # | Location | File | Last Modified |
|---|---|---|---|
| 1 | IV-eHMP_CIF.zip\IMAG_Source\VISA\Java\ImageGearDataSourceProvider\main\src\java\gov\va\med\imaging\imagegear\datasource | ImageGearMergeOutputPurge.java | Mon Dec 4 21:35:06 2017 UTC |
| 2 | IV-eHMP_CIF.zip\IMAG_Source\VISA\Java\ImageGearDataSourceProvider\main\src\java\gov\va\med\imaging\imagegear\datasource | ImageGearMergeOutputPurge.java | Mon Dec 4 22:01:12 2017 UTC |
| Description | Between Files 1 and 2 |
|
|---|---|---|
| Text Blocks | Lines | |
| Unchanged | 3 | 268 |
| Changed | 2 | 4 |
| Inserted | 0 | 0 |
| Removed | 0 | 0 |
| Whitespace | |
|---|---|
| Character case | Differences in character case are significant |
| Line endings | Differences in line endings (CR and LF characters) are ignored |
| CR/LF characters | Not shown in the comparison detail |
No regular expressions were active.
| 1 | /** | |
| 2 | * | |
| 3 | Package: MAG - Vis tA Imaging | |
| 4 | WARNING: Per VHA D irective 2 004-038, t his routin e should n ot be modi fied. | |
| 5 | Date Cre ated: Apr 6, 2012 | |
| 6 | Site Nam e: Washin gton OI Fi eld Office , Silver S pring, MD | |
| 7 | Developer:
|
|
| 8 | Descript ion: | |
| 9 | ||
| 10 | ;; +-------- ---------- ---------- ---------- ---------- ---------- ---------- + | |
| 11 | ;; Property of the US Government . | |
| 12 | ;; No permis sion to co py or redi stribute t his softwa re is give n. | |
| 13 | ;; Use of un released v ersions of this soft ware requi res the us er | |
| 14 | ;; to execu te a writt en test ag reement wi th the Vis tA Imaging | |
| 15 | ;; Developm ent Office of the De partment o f Veterans Affairs, | |
| 16 | ;; telephon e (301) 73 4-0100. | |
| 17 | ;; | |
| 18 | ;; The Food and Drug A dministrat ion classi fies this software a s | |
| 19 | ;; a Class I I medical device. A s such, it may not b e changed | |
| 20 | ;; in any wa y. Modifi cations to this soft ware may r esult in a n | |
| 21 | ;; adulterat ed medical device un der 21CFR8 20, the us e of which | |
| 22 | ;; is consid ered to be a violati on of US F ederal Sta tutes. | |
| 23 | ;; +-------- ---------- ---------- ---------- ---------- ---------- ---------- + | |
| 24 | ||
| 25 | */ | |
| 26 | package go v.va.med.i maging.ima gegear.dat asource; | |
| 27 | ||
| 28 | import gov .va.med.im aging.Date Util; | |
| 29 | import gov .va.med.im aging.exch ange.TaskS cheduler; | |
| 30 | import gov .va.med.im aging.imag egear.data source.con figuration .ImageGear Configurat ion; | |
| 31 | ||
| 32 | import jav a.io.File; | |
| 33 | import jav a.io.IOExc eption; | |
| 34 | import jav a.util.Dat e; | |
| 35 | import jav a.util.Tim erTask; | |
| 36 | ||
| 37 | import org .apache.co mmons.io.F ileUtils; | |
| 38 | import org .apache.lo gging.log4 j.LogManag er; | |
| 39 | import org .apache.lo gging.log4 j.Logger; | |
| 40 | ||
| 41 | /** | |
| 42 | * This pe riodically runs and purges old merge dir ectories f rom the di sk | |
| 43 | * | |
| 44 | * @author
|
|
| 45 | * | |
| 46 | */ | |
| 47 | public cla ss ImageGe arMergeOut putPurge | |
| 48 | extends Ti merTask | |
| 49 | { | |
| 50 | pr ivate fina l static L ogger logg er = LogMa nager.getL ogger(Imag eGearMerge OutputPurg e.class); | |
| 51 | pr ivate fina l static l ong PURGE_ DELAY = 10 00 * 120; // purge a fter two m inutes | |
| 52 | pr ivate fina l static l ong PURGE_ REFRESH = 1000 * 60 * 60 * 6; // every 6 hours run the purge | |
| 53 | ||
| 54 | pr ivate stat ic ImageGe arMergeOut putPurge p urgeProces s = null; | |
| 55 | pu blic synch ronized st atic void scheduleMe rgeOutputP urge() | |
| 56 | { | |
| 57 | // o nly schedu le once - the first time | |
| 58 | if(p urgeProces s == null) | |
| 59 | { | |
| 60 | logger .info("Sch eduling th e merge ou tput purge to run in '" + PURG E_DELAY + "' ms, the n periodic ally every '" + PURG E_REFRESH + "' ms.") ; | |
| 61 | purgeP rocess = n ew ImageGe arMergeOut putPurge() ; | |
| 62 | TaskSc heduler.ge tTaskSched uler().sch edule(purg eProcess, | |
| 63 | PURGE_DELA Y, PURGE_R EFRESH); | |
| 64 | } | |
| 65 | } | |
| 66 | ||
| 67 | pr ivate Imag eGearMerge OutputPurg e() | |
| 68 | { | |
| 69 | supe r(); | |
| 70 | } | |
| 71 | ||
| 72 | /* (non-Java doc) | |
| 73 | * @see java .util.Time rTask#run( ) | |
| 74 | * / | |
| 75 | @O verride | |
| 76 | pu blic void run() | |
| 77 | { | |
| 78 | runP urge(); | |
| 79 | } | |
| 80 | ||
| 81 | pr ivate void runPurge( ) | |
| 82 | { | |
| 83 | Stri ng directo ryPath = g etImageGea rConfigura tion().get GroupOutpu tDirectory (); | |
| 84 | logg er.info("R unning pur ge to remo ve old mer ge output directorie s from '" + director yPath + "' ."); | |
| 85 | File outputDir ectory = n ew File( | |
| 86 | director yPath); | |
| 87 | if(! outputDire ctory.exis ts()) | |
| 88 | { | |
| 89 | logger .warn("Out put direct ory '" + o utputDirec tory.getAb solutePath () + "' do es not exi st, nothin g to purge !"); | |
| 90 | } | |
| 91 | else | |
| 92 | { | |
| 93 | File[] directori es = outpu tDirectory .listFiles (); | |
| 94 | for(Fi le directo ry : direc tories) | |
| 95 | { | |
| 96 | // just to be sure | |
| 97 | if(direc tory.isDir ectory()) | |
| 98 | { | |
| 99 | examineAnd PurgeDirec tory(direc tory); | |
| 100 | } | |
| 101 | } | |
| 102 | } | |
| 103 | } | |
| 104 | ||
| 105 | pr ivate Imag eGearConfi guration g etImageGea rConfigura tion() | |
| 106 | { | |
| 107 | retu rn ImageGe arDataSour ceProvider .getImageG earConfigu ration(); | |
| 108 | } | |
| 109 | ||
| 110 | pr ivate void examineAn dPurgeDire ctory(File directory ) | |
| 111 | { | |
| 112 | //lo gger.info( "Examining directory '" + dire ctory.getN ame() + "' to determ ine if sho uld be pur ged."); | |
| 113 | Date now = new Date(); | |
| 114 | long nowInMill seconds = now.getTim e(); | |
| 115 | long lastModif iedInMills econds = d irectory.l astModifie d(); | |
| 116 | long timeInter valInDays = (nowInMi llseconds - lastModi fiedInMill seconds)/D ateUtil.MI LLISECONDS _IN_DAY; | |
| 117 | int retentionD ays = getI mageGearCo nfiguratio n().getMer geOutputDi rectoryRet ensionDays (); | |
| 118 | if(t imeInterva lInDays > retentionD ays) | |
| 119 | { | |
| 120 | try | |
| 121 | { | |
| 122 | logger.i nfo("Direc tory '" + directory. getName() + "' is ol der than ' " + retent ionDays + "' days, w ill be pur ged."); | |
| 123 | FileUtil s.deleteDi rectory(di rectory); | |
| 124 | } | |
| 125 | catch (IOExcepti on ioX) | |
| 126 | { | |
| 127 | logger.e rror("IOEx ception de leting dir ectory '" + director y.getName( ) + "', " + ioX.getM essage()); | |
| 128 | } | |
| 129 | catch( Exception ex) | |
| 130 | { | |
| 131 | logger.e rror("Exce ption dele ting direc tory '" + directory. getName() + "', " + ex.getMess age()); | |
| 132 | } | |
| 133 | } | |
| 134 | } | |
| 135 | ||
| 136 | } |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.