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\ImagingCacheImpl\main\src\java\gov\va\med\imaging\storage\cache\impl\filesystem | FileSystemGroupSet.java | Mon Dec 4 21:35:34 2017 UTC |
| 2 | IV-eHMP_CIF.zip\IMAG_Source\VISA\Java\ImagingCacheImpl\main\src\java\gov\va\med\imaging\storage\cache\impl\filesystem | FileSystemGroupSet.java | Mon Dec 4 22:01:36 2017 UTC |
| Description | Between Files 1 and 2 |
|
|---|---|---|
| Text Blocks | Lines | |
| Unchanged | 2 | 280 |
| Changed | 1 | 2 |
| 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 | package go v.va.med.i maging.sto rage.cache .impl.file system; | |
| 2 | ||
| 3 | import gov .va.med.im aging.stor age.cache. Group; | |
| 4 | import gov .va.med.im aging.stor age.cache. InstanceBy teChannelF actory; | |
| 5 | import gov .va.med.im aging.stor age.cache. exceptions .CacheExce ption; | |
| 6 | import gov .va.med.im aging.stor age.cache. impl.Persi stentGroup Set; | |
| 7 | ||
| 8 | import jav a.io.File; | |
| 9 | import jav a.io.FileF ilter; | |
| 10 | import jav a.lang.ref .SoftRefer ence; | |
| 11 | import jav a.util.Ite rator; | |
| 12 | ||
| 13 | import org .apache.lo gging.log4 j.LogManag er; | |
| 14 | import org .apache.lo gging.log4 j.Logger; | |
| 15 | ||
| 16 | /** | |
| 17 | * This cl ass encaps ulates the collectio n of child groups in a FileSys temCacheGr oup and in | |
| 18 | * a FileS ystemCache Region. | |
| 19 | * It is t he respons ibility of this clas s to ensur e that the persisten t (filesys tem) | |
| 20 | * and the transient (memory) views of t he Groups in a group are consi stent. | |
| 21 | * It is a requireme nt that th is class N OT keep re ferences t o child gr oups that | |
| 22 | * would p revent gar bage colle ction of g roups that are no lo nger refer enced outs ide | |
| 23 | * the cac he (i.e. i f the appl ication do es not hav e a refere nce then t he cache s hould not | |
| 24 | * prevent garbage c ollection) . | |
| 25 | * This cl ass should be the so le modifie r of the g roups refe renced wit hin. | |
| 26 | * | |
| 27 | * @author
|
|
| 28 | * | |
| 29 | */ | |
| 30 | class File SystemGrou pSet | |
| 31 | extends Pe rsistentGr oupSet | |
| 32 | { | |
| 33 | pr ivate stat ic final l ong serial VersionUID = 1L; | |
| 34 | @S uppressWar nings("unu sed") | |
| 35 | pr ivate Logg er log = L ogManager. getLogger( this.getCl ass()); | |
| 36 | pr ivate File rootDirec tory = nul l; // the directory in which all of our instances reside in persisten t storage | |
| 37 | ||
| 38 | /* * | |
| 39 | * | |
| 40 | * @param ro otDirector y | |
| 41 | * @param by teChannelF actory | |
| 42 | * @param se condsReadW aitsForWri teCompleti on | |
| 43 | * @param se tModificat ionTimeOnR ead | |
| 44 | * / | |
| 45 | Fi leSystemGr oupSet( | |
| 46 | File rootDirec tory, | |
| 47 | Inst anceByteCh annelFacto ry byteCha nnelFactor y, | |
| 48 | int secondsRea dWaitsForW riteComple tion, | |
| 49 | bool ean setMod ificationT imeOnRead) | |
| 50 | { | |
| 51 | supe r(byteChan nelFactory , secondsR eadWaitsFo rWriteComp letion, se tModificat ionTimeOnR ead); | |
| 52 | if(r ootDirecto ry == null ) | |
| 53 | throw new Illega lArgumentE xception(" RootDirect ory must b e a valid directory. "); | |
| 54 | this .rootDirec tory = roo tDirectory ; | |
| 55 | } | |
| 56 | ||
| 57 | pu blic File getRootDir ectory() | |
| 58 | { | |
| 59 | retu rn rootDir ectory; | |
| 60 | } | |
| 61 | ||
| 62 | /* * | |
| 63 | * Override this to re duce type check warn ings | |
| 64 | * / | |
| 65 | @O verride | |
| 66 | @S uppressWar nings("unc hecked") | |
| 67 | pu blic Insta nceByteCha nnelFactor y<File> ge tByteChann elFactory( ) | |
| 68 | { | |
| 69 | retu rn super.g etByteChan nelFactory (); | |
| 70 | } | |
| 71 | ||
| 72 | /* * | |
| 73 | * Get or cr eate a Gro up mapped to persist ent storag e. | |
| 74 | * | |
| 75 | * @param na me - the g roup name to get or create | |
| 76 | * @param cr eate - tru e if the g roups shou ld be crea ted if it does not e xist\ | |
| 77 | * / | |
| 78 | @O verride | |
| 79 | pr otected Gr oup getOrC reate(Stri ng name, b oolean cre ate) | |
| 80 | th rows Cache Exception | |
| 81 | { | |
| 82 | File childGrou pDir = new File(getR ootDirecto ry(), name ); | |
| 83 | File SystemGrou p child = create ? | |
| 84 | FileSyst emGroup.ge tOrCreate( childGroup Dir, getBy teChannelF actory(), getSeconds ReadWaitsF orWriteCom pletion(), isSetModi ficationTi meOnRead() ) : | |
| 85 | FileSyst emGroup.ge t(childGro upDir, get ByteChanne lFactory() , getSecon dsReadWait sForWriteC ompletion( ), isSetMo dification TimeOnRead ()); | |
| 86 | ||
| 87 | retu rn child; | |
| 88 | } | |
| 89 | ||
| 90 | /* * | |
| 91 | * Assure th at the int ernal repr esenation of child i nstances m atches | |
| 92 | * what is i n the pers istent sto rage (file system). | |
| 93 | * / | |
| 94 | pr otected vo id interna lSynchroni zeChildren () | |
| 95 | th rows Cache Exception | |
| 96 | { | |
| 97 | // p rune unuse d referenc es | |
| 98 | for( Iterator< SoftRefere nce<? exte nds Group> > iter=ite rator(); | |
| 99 | iter.h asNext(); ) | |
| 100 | { | |
| 101 | SoftRe ference<? extends Gr oup> group Ref = iter .next(); | |
| 102 | if( gr oupRef.get () == null ) | |
| 103 | iter.rem ove(); | |
| 104 | } | |
| 105 | ||
| 106 | // g et a list of all the child fil es | |
| 107 | for( File chil dDir : get ChildDirec tories() ) | |
| 108 | { | |
| 109 | String name = ch ildDir.get Name(); // the f ile name a nd the Ins tance name are the s ame | |
| 110 | Group childGroup = getTran sient(name ); // get a n existing reference by name | |
| 111 | if(chi ldGroup == null) | |
| 112 | { | |
| 113 | childGro up = getCh ild(name, false); | |
| 114 | File gro upDir = ne w File(thi s.getRootD irectory() , name); | |
| 115 | childGro up = File SystemGrou p.get(grou pDir, getB yteChannel Factory(), getSecond sReadWaits ForWriteCo mpletion() , isSetMod ificationT imeOnRead( )); | |
| 116 | SoftRefe rence<File SystemGrou p> groupRe f = new So ftReferenc e<FileSyst emGroup>( (FileSyste mGroup)chi ldGroup); | |
| 117 | add( gro upRef ); | |
| 118 | } | |
| 119 | } | |
| 120 | } | |
| 121 | ||
| 122 | /* * | |
| 123 | * Get all o f the file s in our d irectory. | |
| 124 | * All files (not dire ctories) a re conside red child instances of this gr oup. | |
| 125 | * | |
| 126 | * @return | |
| 127 | * / | |
| 128 | pr ivate File [] getChil dDirectori es() | |
| 129 | { | |
| 130 | File [] childFi les = getR ootDirecto ry().listF iles(new F ileFilter( ) | |
| 131 | { | |
| 132 | public boolean a ccept(File pathname) | |
| 133 | { | |
| 134 | return p athname.is Directory( ); | |
| 135 | } | |
| 136 | } ); | |
| 137 | ||
| 138 | // n ever retur n null, re turn an em pty array even if th e root dir ectory doe s not exis t | |
| 139 | retu rn childFi les == nul l ? new Fi le[]{} : c hildFiles; | |
| 140 | } | |
| 141 | } |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.