Produced by Araxis Merge on 10/18/2018 2:02:19 PM Central Daylight 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 | VIX_SIV_v3_0_patch_201_build_8.zip\v3.0_patch_201_build_8\VISA\Java\ImagingCacheImpl\main\src\java\gov\va\med\imaging\storage\cache\impl\jcifs | JcifsGroupSet.java | Thu Oct 11 13:30:20 2018 UTC |
2 | VIX_SIV_v3_0_patch_201_build_8.zip\v3.0_patch_201_build_8\VISA\Java\ImagingCacheImpl\main\src\java\gov\va\med\imaging\storage\cache\impl\jcifs | JcifsGroupSet.java | Wed Oct 17 18:51:18 2018 UTC |
Description | Between Files 1 and 2 |
|
---|---|---|
Text Blocks | Lines | |
Unchanged | 2 | 326 |
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 jav a.lang.ref .SoftRefer ence; | |
4 | import jav a.net.Malf ormedURLEx ception; | |
5 | import jav a.net.Unkn ownHostExc eption; | |
6 | import jav a.util.Ite rator; | |
7 | ||
8 | import org .apache.lo gging.log4 j.LogManag er; | |
9 | import org .apache.lo gging.log4 j.Logger; | |
10 | ||
11 | import gov .va.med.im aging.stor age.cache. Group; | |
12 | import gov .va.med.im aging.stor age.cache. InstanceBy teChannelF actory; | |
13 | import gov .va.med.im aging.stor age.cache. exceptions .CacheExce ption; | |
14 | import gov .va.med.im aging.stor age.cache. exceptions .CacheInte rnalExcept ion; | |
15 | import gov .va.med.im aging.stor age.cache. exceptions .Persisten ceIOExcept ion; | |
16 | import gov .va.med.im aging.stor age.cache. impl.Persi stentGroup Set; | |
17 | import jci fs.CIFSCon text; | |
18 | import jci fs.context .Singleton Context; | |
19 | import jci fs.smb.Smb File; | |
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 PI I
|
|
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 | CIFS Context co ntext = nu ll; | |
90 | try | |
91 | { | |
92 | if(con text == nu ll){ | |
93 | context = Singleto nContext.g etInstance (); | |
94 | } | |
95 | childG roupDir = new SmbFil e(getRootD irectory() .getCanoni calPath() + "/" + na me + "/", context); | |
96 | } | |
97 | catc h (Malform edURLExcep tion x) | |
98 | { | |
99 | throw new Persis tenceIOExc eption( | |
100 | "The SMB U RL built f rom direct ory '" + g etRootDire ctory().ge tPath() + "' and fil e name '" + name + " ' is inval id.", | |
101 | x); | |
102 | } | |
103 | //ca tch (Unkno wnHostExce ption x) | |
104 | //{ | |
105 | // throw new Persis tenceIOExc eption( | |
106 | // "The host specified in SMB URL '" + getR ootDirecto ry().getPa th() + "' and file n ame '" + n ame + "' i s invalid. ", | |
107 | // x); | |
108 | //} | |
109 | Jcif sGroup chi ld = creat e ? | |
110 | JcifsGro up.getOrCr eate(child GroupDir, getByteCha nnelFactor y(), getSe condsReadW aitsForWri teCompleti on(), isSe tModificat ionTimeOnR ead()) : | |
111 | JcifsGro up.get(chi ldGroupDir , getByteC hannelFact ory(), get SecondsRea dWaitsForW riteComple tion(), is SetModific ationTimeO nRead()); | |
112 | ||
113 | retu rn child; | |
114 | } | |
115 | ||
116 | /* * | |
117 | * Assure th at the int ernal repr esenation of child i nstances m atches | |
118 | * what is i n the pers istent sto rage (file system). | |
119 | * / | |
120 | pr otected vo id interna lSynchroni zeChildren () | |
121 | th rows Cache Exception | |
122 | { | |
123 | Stri ng name = null; // declared here so th a the exce ption hand ling can r eport it | |
124 | ||
125 | try | |
126 | { | |
127 | // pru ne unused references | |
128 | for( I terator<So ftReferenc e<? extend s Group>> iter=itera tor(); | |
129 | iter.has Next(); ) | |
130 | { | |
131 | SoftRefe rence<? ex tends Grou p> groupRe f = iter.n ext(); | |
132 | if( grou pRef.get() == null ) | |
133 | iter.remov e(); | |
134 | } | |
135 | ||
136 | // get a list of all the c hild files | |
137 | for( S mbFile chi ldDir : sm bUtilities .getPersis tentChildr en(getRoot Directory( ), true, f alse) ) | |
138 | { | |
139 | name = c hildDir.ge tName(); // the f ile name a nd the Ins tance name are the s ame | |
140 | Group ch ildGroup = getTransi ent(name); // get an existing r eference b y name | |
141 | if(child Group == n ull) | |
142 | { | |
143 | childGroup = getChil d(name, fa lse); | |
144 | SmbFile gr oupDir = n ew SmbFile (this.getR ootDirecto ry(), name ); | |
145 | childGroup = JcifsG roup.get(g roupDir, g etByteChan nelFactory (), getSec ondsReadWa itsForWrit eCompletio n(), isSet Modificati onTimeOnRe ad()); | |
146 | SoftRefere nce<JcifsG roup> grou pRef = new SoftRefer ence<Jcifs Group>( (J cifsGroup) childGroup ); | |
147 | add( group Ref ); | |
148 | } | |
149 | } | |
150 | } | |
151 | catc h (Malform edURLExcep tion x) | |
152 | { | |
153 | throw new CacheI nternalExc eption( | |
154 | "The SMB U RL built f rom direct ory '" + g etRootDire ctory().ge tPath() + "' and fil e name '" + name + " ' is inval id.", | |
155 | x); | |
156 | } | |
157 | catc h (Unknown HostExcept ion x) | |
158 | { | |
159 | throw new Persis tenceIOExc eption( | |
160 | "The host specified in the SMB URL '" + getRootDir ectory().g etPath() + "' cannot be contac ted.", | |
161 | x); | |
162 | } | |
163 | } | |
164 | } |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.