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 | JcifsInstanceSet.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 | JcifsInstanceSet.java | Wed Oct 17 18:51:25 2018 UTC |
Description | Between Files 1 and 2 |
|
---|---|---|
Text Blocks | Lines | |
Unchanged | 2 | 304 |
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. Instance; | |
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 stentInsta nceSet; | |
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 instances in a Jcif sCacheGrou p. | |
23 | * It is t he respons ibility of this clas s to ensur e that the persisten t (filesys tem) | |
24 | * and the transient (memory) views of t he Instanc es in a gr oup are co nsistent. | |
25 | * It is a requireme nt that th is class N OT keep re ferences t o child in stances th at | |
26 | * would p revent gar bage colle ction of i nstances t hat are no longer re ferenced o utside | |
27 | * 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 | |
28 | * prevent garbage c ollection) . | |
29 | * This cl ass should be the so le modifie r of the i nstances r eferenced within. | |
30 | * | |
31 | * @author PI I
|
|
32 | * | |
33 | */ | |
34 | class Jcif sInstanceS et | |
35 | extends Pe rsistentIn stanceSet | |
36 | { | |
37 | pr ivate Logg er logger = LogManag er.getLogg er(this.ge tClass()); | |
38 | pr ivate stat ic final l ong serial VersionUID = -346790 2332881831 29L; | |
39 | pr ivate SmbF ile rootDi rectory = null; // the directory in which all of our instances reside in persisten t storage | |
40 | pr ivate SmbU tilities s mbUtilitie s = new Sm bUtilities (); | |
41 | ||
42 | /* * | |
43 | * | |
44 | * @param ro otDirector y | |
45 | * @param by teChannelF actory | |
46 | * @param se condsReadW aitsForWri teCompleti on | |
47 | * @param se tModificat ionTimeOnR ead | |
48 | * / | |
49 | Jc ifsInstanc eSet( | |
50 | SmbF ile rootDi rectory, | |
51 | Inst anceByteCh annelFacto ry byteCha nnelFactor y, | |
52 | int secondsRea dWaitsForW riteComple tion, | |
53 | bool ean setMod ificationT imeOnRead | |
54 | ) | |
55 | { | |
56 | supe r(byteChan nelFactory , secondsR eadWaitsFo rWriteComp letion, se tModificat ionTimeOnR ead); | |
57 | this .rootDirec tory = roo tDirectory ; | |
58 | } | |
59 | ||
60 | /* * | |
61 | * | |
62 | * @return | |
63 | * / | |
64 | pu blic SmbFi le getRoot Directory( ) | |
65 | { | |
66 | retu rn rootDir ectory; | |
67 | } | |
68 | ||
69 | /* * | |
70 | * | |
71 | * / | |
72 | @O verride | |
73 | pr otected In stance get OrCreate(S tring name , boolean create) | |
74 | th rows Cache Exception | |
75 | { | |
76 | SmbF ile childI nstanceFil e; | |
77 | CIFS Context co ntext = nu ll; | |
78 | try | |
79 | { | |
80 | if(con text == nu ll){ | |
81 | context = Singleto nContext.g etInstance (); | |
82 | } | |
83 | childI nstanceFil e = new Sm bFile(getR ootDirecto ry().getCa nonicalPat h() + "/" + name, co ntext); | |
84 | ||
85 | Instan ce child = create ? | |
86 | JcifsInsta nce.getOrC reateInsta nce(childI nstanceFil e, getByte ChannelFac tory(), ge tSecondsRe adWaitsFor WriteCompl etion(), i sSetModifi cationTime OnRead()) : | |
87 | JcifsInsta nce.getIns tance(chil dInstanceF ile, getBy teChannelF actory(), getSeconds ReadWaitsF orWriteCom pletion(), isSetModi ficationTi meOnRead() ); | |
88 | ||
89 | return child; | |
90 | } | |
91 | catc h (Malform edURLExcep tion x) | |
92 | { | |
93 | throw new CacheI nternalExc eption( | |
94 | "The SMB URL built from dire ctory '" + getRootDi rectory(). getPath() + "' and f ile name ' " + name + "' is inv alid.", | |
95 | x); | |
96 | } | |
97 | //ca tch (Unkno wnHostExce ption x) | |
98 | //{ | |
99 | // throw new Persis tenceIOExc eption("Th e SMB host computer (file serv er) is ina ccesible." , x); | |
100 | //} | |
101 | ||
102 | } | |
103 | ||
104 | /* * | |
105 | * Assure th at the int ernal repr esenation of child i nstances m atches | |
106 | * what is i n the file system. | |
107 | * / | |
108 | @O verride | |
109 | pr otected vo id interna lSynchroni zeChildren () | |
110 | th rows Cache Exception | |
111 | { | |
112 | Stri ng instanc eName = nu ll; // d eclared ou t here so tha the er ror logs c an report it | |
113 | ||
114 | try | |
115 | { | |
116 | // pru ne unused references | |
117 | for( I terator<So ftReferenc e<? extend s Instance >> iter=it erator(); | |
118 | iter.has Next(); ) | |
119 | { | |
120 | SoftRefe rence<? ex tends Inst ance> inst anceRef = iter.next( ); | |
121 | if( inst anceRef.ge t() == nul l ) | |
122 | iter.remov e(); | |
123 | } | |
124 | ||
125 | // get a list of all the c hild files | |
126 | for( S mbFile chi ldFile : s mbUtilitie s.getPersi stentChild ren(getRoo tDirectory (), false, true) ) | |
127 | { | |
128 | instance Name = chi ldFile.get Name(); // the fil e name and the Insta nce name a re the sam e | |
129 | Instance childInst ance = get Transient( instanceNa me); // g et an exis ting refer ence by na me | |
130 | if(child Instance = = null) | |
131 | { | |
132 | childInsta nce = getC hild(insta nceName, f alse); | |
133 | SmbFile in stanceFile = new Smb File(this. getRootDir ectory(), instanceNa me); | |
134 | childInsta nce = Jci fsInstance .getInstan ce(instanc eFile, get ByteChanne lFactory() , getSecon dsReadWait sForWriteC ompletion( ), isSetMo dification TimeOnRead ()); | |
135 | SoftRefere nce<JcifsI nstance> i nstanceRef = new Sof tReference <JcifsInst ance>( (Jc ifsInstanc e)childIns tance); | |
136 | add( insta nceRef ); | |
137 | } | |
138 | } | |
139 | } | |
140 | catc h (Malform edURLExcep tion x) | |
141 | { | |
142 | throw new CacheI nternalExc eption( | |
143 | "The SMB U RL built f rom direct ory '" + g etRootDire ctory().ge tPath() + "' and fil e name '" + instance Name + "' is invalid .", | |
144 | x); | |
145 | } | |
146 | catc h (Unknown HostExcept ion x) | |
147 | { | |
148 | throw new Persis tenceIOExc eption( | |
149 | "The host specified in the SMB URL '" + getRootDir ectory().g etPath() + "' cannot be contac ted.", | |
150 | x); | |
151 | } | |
152 | } | |
153 | } |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.