Produced by Araxis Merge on 3/25/2019 8:58:03 AM 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 | C:\AraxisMergeCompare\Pri_un\IMAG_Source\VISA\Java\ROICommands\main\src\java\gov\va\med\imaging\roi\cache | ROIVASourcedCacheDecorator.java | Mon Mar 18 20:39:10 2019 UTC |
2 | C:\AraxisMergeCompare\Pri_re\IMAG_Source\VISA\Java\ROICommands\main\src\java\gov\va\med\imaging\roi\cache | ROIVASourcedCacheDecorator.java | Tue Mar 19 12:04:00 2019 UTC |
Description | Between Files 1 and 2 |
|
---|---|---|
Text Blocks | Lines | |
Unchanged | 3 | 418 |
Changed | 2 | 4 |
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 | /** | |
2 | * | |
3 | Package: MAG - Vis tA Imaging | |
4 | WARNING: Per VHA D irective 2 004-038, t his routin e should n ot be modi fied. | |
5 | Date Cre ated: Apr 9, 2012 | |
6 | Site Nam e: Washin gton OI Fi eld Office , Silver S pring, MD | |
7 | Developer: DN S WERFEJ | |
8 | Descript ion: | |
9 | ||
10 | ;; +-------- ---------- ---------- ---------- ---------- ---------- ---------- + | |
11 | ;; Property of the US Government . | |
12 | ;; No permis sion to co py or redi stribute t his softwa re is give n. | |
13 | ;; Use of un released v ersions of this soft ware requi res the us er | |
14 | ;; to execu te a writt en test ag reement wi th the Vis tA Imaging | |
15 | ;; Developm ent Office of the De partment o f Veterans Affairs, | |
16 | ;; telephon e (301) 73 4-0100. | |
17 | ;; | |
18 | ;; The Food and Drug A dministrat ion classi fies this software a s | |
19 | ;; a Class I I medical device. A s such, it may not b e changed | |
20 | ;; in any wa y. Modifi cations to this soft ware may r esult in a n | |
21 | ;; adulterat ed medical device un der 21CFR8 20, the us e of which | |
22 | ;; is consid ered to be a violati on of US F ederal Sta tutes. | |
23 | ;; +-------- ---------- ---------- ---------- ---------- ---------- ---------- + | |
24 | ||
25 | */ | |
26 | package go v.va.med.i maging.roi .cache; | |
27 | ||
28 | import jav a.io.IOExc eption; | |
29 | import jav a.io.Objec tInputStre am; | |
30 | import jav a.io.Objec tOutputStr eam; | |
31 | import jav a.nio.chan nels.Chann els; | |
32 | import jav a.nio.chan nels.Reada bleByteCha nnel; | |
33 | import jav a.nio.chan nels.Writa bleByteCha nnel; | |
34 | ||
35 | //import o rg.apache. commons.io .IOUtils; | |
36 | import org .apache.co mmons.conf iguration. Configurat ionExcepti on; | |
37 | import org .apache.lo gging.log4 j.LogManag er; | |
38 | import org .apache.lo gging.log4 j.Logger; | |
39 | import org .nibblesec .tools.Ser ialKiller; | |
40 | ||
41 | import gov .va.med.Pa tientIdent ifier; | |
42 | import gov .va.med.im aging.exch ange.stora ge.cache.V ASourcedCa che; | |
43 | import gov .va.med.im aging.exch ange.stora ge.cache.V ASourcedCa cheDecorat or; | |
44 | import gov .va.med.im aging.roi. ROIStudyLi st; | |
45 | import gov .va.med.im aging.stor age.cache. Cache; | |
46 | import gov .va.med.im aging.stor age.cache. Instance; | |
47 | import gov .va.med.im aging.stor age.cache. exceptions .CacheExce ption; | |
48 | //import g ov.va.med. lookahead. LookAheadO bjectInput Stream; | |
49 | ||
50 | /** | |
51 | * @author DN S WERFEJ | |
52 | * | |
53 | */ | |
54 | public cla ss ROIVASo urcedCache Decorator | |
55 | extends VA SourcedCac heDecorato r | |
56 | implements ROIVASour cedCache | |
57 | { | |
58 | pr ivate stat ic ROIVASo urcedCache roiVaSour cedCache = null; | |
59 | pr ivate Stri ng serialK illerConfi gFilename = System.g etenv("vix config") + "/serialk iller.conf ig"; | |
60 | pr ivate fina l static L ogger logg er = LogMa nager.getL ogger(ROIV ASourcedCa cheDecorat or.class); | |
61 | ||
62 | pu blic synch ronized st atic ROIVA SourcedCac he getInst ance(VASou rcedCache vaSourcedC ache) | |
63 | { | |
64 | if(r oiVaSource dCache == null) | |
65 | { | |
66 | roiVaS ourcedCach e = new RO IVASourced CacheDecor ator(vaSou rcedCache. getWrapped Cache(), | |
67 | vaSourcedC ache.getMe tadataRegi onName(), vaSourcedC ache.getIm ageRegionN ame()); | |
68 | } | |
69 | retu rn roiVaSo urcedCache ; | |
70 | } | |
71 | ||
72 | pr ivate ROIV ASourcedCa cheDecorat or(Cache w rappedCach e, | |
73 | String metadataR egionName, | |
74 | String imageRegi onName) | |
75 | { | |
76 | supe r(wrappedC ache, meta dataRegion Name, imag eRegionNam e); | |
77 | } | |
78 | ||
79 | /* (non-Java doc) | |
80 | * @see gov. va.med.ima ging.roi.c ache.ROIVA SourcedCac he#getROIR equest(gov .va.med.im aging.GUID ) | |
81 | * / | |
82 | @O verride | |
83 | pu blic ROISt udyList ge tROIStudyL ist(Patien tIdentifie r patientI dentifier, String gu id) | |
84 | th rows Cache Exception | |
85 | { | |
86 | Stri ng[] group s = create ROIRequest GroupName( patientIde ntifier); | |
87 | Stri ng groupKe y = create ROIRequest Key(guid); | |
88 | ||
89 | retu rn getMeta dataFromIm ageRegion( ROIStudyLi st.class, groups, gr oupKey); | |
90 | } | |
91 | ||
92 | /* (non-Java doc) | |
93 | * @see gov. va.med.ima ging.roi.c ache.ROIVA SourcedCac he#createR OIRequest( gov.va.med .imaging.r oi.ROIRequ est) | |
94 | * / | |
95 | @O verride | |
96 | pu blic void createROIS tudyList(P atientIden tifier pat ientIdenti fier, Stri ng guid, | |
97 | ROIStu dyList roi StudyList) | |
98 | th rows Cache Exception | |
99 | { | |
100 | Stri ng[] group s = create ROIRequest GroupName( patientIde ntifier); | |
101 | Stri ng groupKe y = create ROIRequest Key(guid); | |
102 | ||
103 | crea teMetadata InImageReg ion(groups , groupKey , roiStudy List); | |
104 | } | |
105 | ||
106 | pr otected <T > void cre ateMetadat aInImageRe gion( | |
107 | String [] groups, | |
108 | String groupKey, | |
109 | T meta data) | |
110 | thro ws CacheEx ception | |
111 | { | |
112 | Writab leByteChan nel metada taWritable = null; | |
113 | Object OutputStre am metadat aOutStream = null; | |
114 | try | |
115 | { | |
116 | if( getW rappedCach e().isEnab led().bool eanValue() ) | |
117 | { | |
118 | Instance m etadataIns tance = ge tWrappedCa che().getO rCreateIns tance( | |
119 | getI mageRegion Name(), | |
120 | grou ps, | |
121 | grou pKey); | |
122 | if(metadat aInstance != null) | |
123 | { | |
124 | me tadataWrit able = met adataInsta nce.getWri tableChann el(); | |
125 | me tadataOutS tream = ne w ObjectOu tputStream (Channels. newOutputS tream(meta dataWritab le)); | |
126 | ||
127 | me tadataOutS tream.writ eObject(me tadata); | |
128 | } | |
129 | else | |
130 | lo gger.warn( "Unable to write to cache and cache is e nabled. A pplication will cont inue to op erate with reduced p erformance ."); | |
131 | } | |
132 | } | |
133 | catch (IOExcepti on e) | |
134 | { | |
135 | e.printS tackTrace( ); | |
136 | } | |
137 | finall y | |
138 | { | |
139 | try{if(m etadataOut Stream != null) meta dataOutStr eam.close( );} | |
140 | catch(Th rowable t) {} | |
141 | } | |
142 | ||
143 | return ; | |
144 | } | |
145 | ||
146 | pr otected <T > T getMet adataFromI mageRegion (Class<T> expectedRe sultClass, String[] groups, St ring group Key) | |
147 | th rows Cache Exception | |
148 | { | |
149 | T re sult = nul l; | |
150 | ||
151 | Read ableByteCh annel meta dataReadab le = null; | |
152 | Obje ctInputStr eam metada taInStream = null; | |
153 | try | |
154 | { | |
155 | Instan ce studyMe tadataInst ance = get WrappedCac he().getIn stance( | |
156 | getImageRe gionName() , | |
157 | groups, | |
158 | groupKey); | |
159 | ||
160 | if(stu dyMetadata Instance ! = null) | |
161 | { | |
162 | metadata Readable = studyMeta dataInstan ce.getRead ableChanne l(); | |
163 | ||
164 | //metada taInStream = new Obj ectInputSt ream(Chann els.newInp utStream(m etadataRea dable)); | |
165 | //return expectedR esultClass .cast(Look AheadObjec tInputStre am | |
166 | // .d eserialize (IOUtils.t oByteArray (Channels. newInputSt ream(metad ataReadabl e)) , expe ctedResult Class.getC lass().get Name())); | |
167 | try | |
168 | { | |
169 | metadataIn Stream = n ew SerialK iller(Chan nels.newIn putStream( metadataRe adable),se rialKiller ConfigFile name); | |
170 | return exp ectedResul tClass.cas t(metadata InStream.r eadObject( )); | |
171 | } | |
172 | catch (o rg.apache. commons.co nfiguratio n.Configur ationExcep tion ce) | |
173 | { | |
174 | ce.printSt ackTrace() ; | |
175 | } | |
176 | } | |
177 | } | |
178 | catc h (IOExcep tion e) | |
179 | { | |
180 | e.prin tStackTrac e(); | |
181 | } | |
182 | catc h (ClassNo tFoundExce ption e) | |
183 | { | |
184 | e.prin tStackTrac e(); | |
185 | } | |
186 | fina lly | |
187 | { | |
188 | try{if (metadataI nStream != null)meta dataInStre am.close() ;} | |
189 | catch( Throwable t){} | |
190 | } | |
191 | ||
192 | retu rn result; | |
193 | } | |
194 | ||
195 | pr ivate Stri ng[] creat eROIReques tGroupName (PatientId entifier p atientIden tifier) | |
196 | { | |
197 | retu rn new Str ing [] | |
198 | { | |
199 | VASource dCacheDeco rator.file nameOctetE scaping.es capeIllega lCharacter s("roi"), | |
200 | VASource dCacheDeco rator.file nameOctetE scaping.es capeIllega lCharacter s(patientI dentifier. toString() ), | |
201 | VASource dCacheDeco rator.file nameOctetE scaping.es capeIllega lCharacter s("metadat a") | |
202 | }; | |
203 | } | |
204 | ||
205 | pr ivate Stri ng createR OIRequestK ey(String guid) | |
206 | { | |
207 | retu rn VASourc edCacheDec orator.fil enameOctet Escaping.e scapeIlleg alCharacte rs(guid); | |
208 | } | |
209 | ||
210 | ||
211 | } |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.