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