Produced by Araxis Merge on 12/5/2017 12:06:36 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\CacheImplJCIFS\main\src\java\gov\va\med\imaging\storage\cache\impl\jcifs | JcifsGroupSet.java | Mon Dec 4 21:35:30 2017 UTC |
| 2 | IV-eHMP_CIF.zip\IMAG_Source\VISA\Java\CacheImplJCIFS\main\src\java\gov\va\med\imaging\storage\cache\impl\jcifs | JcifsGroupSet.java | Mon Dec 4 21:57:46 2017 UTC |
| Description | Between Files 1 and 2 |
|
|---|---|---|
| Text Blocks | Lines | |
| Unchanged | 2 | 318 |
| 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.jcif s; | |
| 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. exceptions .CacheInte rnalExcept ion; | |
| 7 | import gov .va.med.im aging.stor age.cache. exceptions .Persisten ceIOExcept ion; | |
| 8 | import gov .va.med.im aging.stor age.cache. impl.Persi stentGroup Set; | |
| 9 | ||
| 10 | import jav a.lang.ref .SoftRefer ence; | |
| 11 | import jav a.net.Malf ormedURLEx ception; | |
| 12 | import jav a.net.Unkn ownHostExc eption; | |
| 13 | import jav a.util.Ite rator; | |
| 14 | ||
| 15 | import jci fs.smb.Smb File; | |
| 16 | import jci fs.smb.Smb FileFilter ; | |
| 17 | ||
| 18 | import org .apache.lo gging.log4 j.LogManag er; | |
| 19 | import org .apache.lo gging.log4 j.Logger; | |
| 20 | ||
| 21 | /** | |
| 22 | * This cl ass encaps ulates the collectio n of child groups in a FileSys temCacheGr oup and in | |
| 23 | * a FileS ystemCache Region. | |
| 24 | * It is t he respons ibility of this clas s to ensur e that the persisten t (filesys tem) | |
| 25 | * and the transient (memory) views of t he Groups in a group are consi stent. | |
| 26 | * It is a requireme nt that th is class N OT keep re ferences t o child gr oups that | |
| 27 | * would p revent gar bage colle ction of g roups that are no lo nger refer enced outs ide | |
| 28 | * 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 | |
| 29 | * prevent garbage c ollection) . | |
| 30 | * This cl ass should be the so le modifie r of the g roups refe renced wit hin. | |
| 31 | * | |
| 32 | * @author
|
|
| 33 | * | |
| 34 | */ | |
| 35 | class Jcif sGroupSet | |
| 36 | extends Pe rsistentGr oupSet | |
| 37 | { | |
| 38 | pr ivate stat ic final l ong serial VersionUID = 1L; | |
| 39 | @S uppressWar nings("unu sed") | |
| 40 | pr ivate Logg er log = L ogManager. getLogger( this.getCl ass()); | |
| 41 | pr ivate SmbF ile rootDi rectory = null; // the directory in which all of our instances reside in persisten t storage | |
| 42 | pr ivate SmbU tilities s mbUtilitie s = new Sm bUtilities (); | |
| 43 | ||
| 44 | /* * | |
| 45 | * | |
| 46 | * @param ro otDirector y | |
| 47 | * @param by teChannelF actory | |
| 48 | * @param se condsReadW aitsForWri teCompleti on | |
| 49 | * @param se tModificat ionTimeOnR ead | |
| 50 | * / | |
| 51 | Jc ifsGroupSe t( | |
| 52 | SmbF ile rootDi rectory, | |
| 53 | Inst anceByteCh annelFacto ry byteCha nnelFactor y, | |
| 54 | int secondsRea dWaitsForW riteComple tion, | |
| 55 | bool ean setMod ificationT imeOnRead) | |
| 56 | { | |
| 57 | supe r(byteChan nelFactory , secondsR eadWaitsFo rWriteComp letion, se tModificat ionTimeOnR ead); | |
| 58 | if(r ootDirecto ry == null ) | |
| 59 | throw new Illega lArgumentE xception(" RootDirect ory must b e a valid directory. "); | |
| 60 | this .rootDirec tory = roo tDirectory ; | |
| 61 | } | |
| 62 | ||
| 63 | pu blic SmbFi le getRoot Directory( ) | |
| 64 | { | |
| 65 | retu rn rootDir ectory; | |
| 66 | } | |
| 67 | ||
| 68 | /* * | |
| 69 | * Override this to re duce type check warn ings | |
| 70 | * / | |
| 71 | @O verride | |
| 72 | @S uppressWar nings("unc hecked") | |
| 73 | pu blic Insta nceByteCha nnelFactor y<SmbFile> getByteCh annelFacto ry() | |
| 74 | { | |
| 75 | retu rn super.g etByteChan nelFactory (); | |
| 76 | } | |
| 77 | ||
| 78 | /* * | |
| 79 | * Get or cr eate a Gro up mapped to persist ent storag e. | |
| 80 | * | |
| 81 | * @param na me - the g roup name to get or create | |
| 82 | * @param cr eate - tru e if the g roups shou ld be crea ted if it does not e xist\ | |
| 83 | * / | |
| 84 | @O verride | |
| 85 | pr otected Gr oup getOrC reate(Stri ng name, b oolean cre ate) | |
| 86 | th rows Cache Exception | |
| 87 | { | |
| 88 | SmbF ile childG roupDir; | |
| 89 | try | |
| 90 | { | |
| 91 | childG roupDir = new SmbFil e(getRootD irectory() .getCanoni calPath() + "/" + na me + "/"); | |
| 92 | } | |
| 93 | catc h (Malform edURLExcep tion x) | |
| 94 | { | |
| 95 | throw new Persis tenceIOExc eption( | |
| 96 | "The SMB U RL built f rom direct ory '" + g etRootDire ctory().ge tPath() + "' and fil e name '" + name + " ' is inval id.", | |
| 97 | x); | |
| 98 | } | |
| 99 | //ca tch (Unkno wnHostExce ption x) | |
| 100 | //{ | |
| 101 | // throw new Persis tenceIOExc eption( | |
| 102 | // "The host specified in SMB URL '" + getR ootDirecto ry().getPa th() + "' and file n ame '" + n ame + "' i s invalid. ", | |
| 103 | // x); | |
| 104 | //} | |
| 105 | Jcif sGroup chi ld = creat e ? | |
| 106 | JcifsGro up.getOrCr eate(child GroupDir, getByteCha nnelFactor y(), getSe condsReadW aitsForWri teCompleti on(), isSe tModificat ionTimeOnR ead()) : | |
| 107 | JcifsGro up.get(chi ldGroupDir , getByteC hannelFact ory(), get SecondsRea dWaitsForW riteComple tion(), is SetModific ationTimeO nRead()); | |
| 108 | ||
| 109 | retu rn child; | |
| 110 | } | |
| 111 | ||
| 112 | /* * | |
| 113 | * Assure th at the int ernal repr esenation of child i nstances m atches | |
| 114 | * what is i n the pers istent sto rage (file system). | |
| 115 | * / | |
| 116 | pr otected vo id interna lSynchroni zeChildren () | |
| 117 | th rows Cache Exception | |
| 118 | { | |
| 119 | Stri ng name = null; // declared here so th a the exce ption hand ling can r eport it | |
| 120 | ||
| 121 | try | |
| 122 | { | |
| 123 | // pru ne unused references | |
| 124 | for( I terator<So ftReferenc e<? extend s Group>> iter=itera tor(); | |
| 125 | iter.has Next(); ) | |
| 126 | { | |
| 127 | SoftRefe rence<? ex tends Grou p> groupRe f = iter.n ext(); | |
| 128 | if( grou pRef.get() == null ) | |
| 129 | iter.remov e(); | |
| 130 | } | |
| 131 | ||
| 132 | // get a list of all the c hild files | |
| 133 | for( S mbFile chi ldDir : sm bUtilities .getPersis tentChildr en(getRoot Directory( ), true, f alse) ) | |
| 134 | { | |
| 135 | name = c hildDir.ge tName(); // the f ile name a nd the Ins tance name are the s ame | |
| 136 | Group ch ildGroup = getTransi ent(name); // get an existing r eference b y name | |
| 137 | if(child Group == n ull) | |
| 138 | { | |
| 139 | childGroup = getChil d(name, fa lse); | |
| 140 | SmbFile gr oupDir = n ew SmbFile (this.getR ootDirecto ry(), name ); | |
| 141 | childGroup = JcifsG roup.get(g roupDir, g etByteChan nelFactory (), getSec ondsReadWa itsForWrit eCompletio n(), isSet Modificati onTimeOnRe ad()); | |
| 142 | SoftRefere nce<JcifsG roup> grou pRef = new SoftRefer ence<Jcifs Group>( (J cifsGroup) childGroup ); | |
| 143 | add( group Ref ); | |
| 144 | } | |
| 145 | } | |
| 146 | } | |
| 147 | catc h (Malform edURLExcep tion x) | |
| 148 | { | |
| 149 | throw new CacheI nternalExc eption( | |
| 150 | "The SMB U RL built f rom direct ory '" + g etRootDire ctory().ge tPath() + "' and fil e name '" + name + " ' is inval id.", | |
| 151 | x); | |
| 152 | } | |
| 153 | catc h (Unknown HostExcept ion x) | |
| 154 | { | |
| 155 | throw new Persis tenceIOExc eption( | |
| 156 | "The host specified in the SMB URL '" + getRootDir ectory().g etPath() + "' cannot be contac ted.", | |
| 157 | x); | |
| 158 | } | |
| 159 | } | |
| 160 | } |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.