Produced by Araxis Merge on 10/18/2018 2:02:20 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\ImagingExchangeBaseWebProxy\main\src\java\gov\va\med\imaging\proxy\ids | IDSProxy.java | Thu Oct 11 13:30:19 2018 UTC |
2 | VIX_SIV_v3_0_patch_201_build_8.zip\v3.0_patch_201_build_8\VISA\Java\ImagingExchangeBaseWebProxy\main\src\java\gov\va\med\imaging\proxy\ids | IDSProxy.java | Wed Oct 17 18:56:11 2018 UTC |
Description | Between Files 1 and 2 |
|
---|---|---|
Text Blocks | Lines | |
Unchanged | 3 | 394 |
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: Feb 29, 2008 | |
6 | Site Nam e: Washin gton OI Fi eld Office , Silver S pring, MD | |
7 | Developer: PI I
|
|
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.pro xy.ids; | |
27 | ||
28 | import gov .va.med.im aging.exch ange.busin ess.Site; | |
29 | import gov .va.med.im aging.prox y.ids.conf iguration. IDSProxyCo nfiguratio n; | |
30 | ||
31 | import jav a.io.IOExc eption; | |
32 | import jav a.io.Input Stream; | |
33 | import jav a.util.Sor tedSet; | |
34 | import jav a.util.Tre eSet; | |
35 | ||
36 | import org .apache.co mmons.http client.Htt pClient; | |
37 | import org .apache.co mmons.http client.Htt pConnectio nManager; | |
38 | import org .apache.co mmons.http client.Htt pStatus; | |
39 | import org .apache.co mmons.http client.met hods.GetMe thod; | |
40 | import org .apache.co mmons.http client.par ams.HttpCo nnectionPa rams; | |
41 | import org .apache.lo gging.log4 j.LogManag er; | |
42 | import org .apache.lo gging.log4 j.Logger; | |
43 | ||
44 | /** | |
45 | * Proxy f or retriev ing IDS Se rvice info rmation. M akes use o f the IDSS erviceCach e to reduc e the numb er of time s | |
46 | * the ver sion is re quested fr om the ori ginating s ource. If no value i s found in the cache , then the source | |
47 | * is requ ested the available versions. | |
48 | * | |
49 | * @author PI I
|
|
50 | * | |
51 | */ | |
52 | public cla ss IDSProx y | |
53 | { | |
54 | // This valu e is used when stori ng data ab out the lo cal site V IX | |
55 | pu blic final static St ring defau ltLocalSit eNumber = "localSite Number"; | |
56 | ||
57 | pr ivate fina l static L ogger logg er = LogMa nager.getL ogger(IDSP roxy.class ); | |
58 | ||
59 | pr ivate fina l static I DSServiceC ache servi ceCache = new IDSSer viceCache( ); | |
60 | ||
61 | pu blic IDSPr oxy() | |
62 | { | |
63 | supe r(); | |
64 | } | |
65 | ||
66 | pu blic Sorte dSet<IDSSe rvice> get ImagingSer vices(Stri ng siteNum ber, Strin g accelera torServer, | |
67 | int ac celeratorP ort, Strin g applicat ionName, S tring vers ion) | |
68 | { | |
69 | if(s erviceCach e.isSiteOf fline(site Number)) | |
70 | { | |
71 | logger .info("Sit e '" + sit eNumber + "' has bee n previous ly tested and determ ined to be offline, returning null servi ces."); | |
72 | return null; | |
73 | } | |
74 | ||
75 | Sort edSet<IDSS ervice> se rvices = n ew TreeSet <IDSServic e>(); | |
76 | // c an only lo ok in the cache if a specified service t ype and ve rsion was specified | |
77 | if(( applicatio nName != n ull) && (a pplication Name.lengt h() > 0) & & | |
78 | (versi on != null ) && (vers ion.length () > 0)) | |
79 | { | |
80 | logger .info("Sea rch IDS Se rvice cach e for serv ice from s ite [" + s iteNumber + "] [" + applicatio nName + ", " + versi on + "]"); | |
81 | IDSSer vice servi ce = servi ceCache.ge tCachedSer vice(siteN umber, app licationNa me, versio n); | |
82 | if(ser vice != nu ll) | |
83 | { | |
84 | logger.i nfo("Found service i n cache, r eturning s ervice inf ormation f rom cache" ); | |
85 | services .add(servi ce); | |
86 | return s ervices; | |
87 | } | |
88 | else{ | |
89 | logger.i nfo("Servi ce not fou nd in cach e."); | |
90 | } | |
91 | // che ck to see if this si te/version /applicati on was pre viously at tempted an d not foun d, don't b other agai n | |
92 | if(ser viceCache. isSiteVers ionUnavail able(siteN umber, ver sion, appl icationNam e)) | |
93 | { | |
94 | logger.i nfo("Site '" +siteNu mber + "', version ' " + versio n + "', ap plication '" + appli cationName + "', was previousl y tested a nd no serv ices found , returnin g null ser vices."); | |
95 | return n ull; | |
96 | } | |
97 | } | |
98 | ||
99 | Http Client cli ent = null ; | |
100 | GetM ethod getM ethod = nu ll; | |
101 | int response = 0; | |
102 | Stri ng type = ""; //$NON -NLS-1$ | |
103 | Stri ng version Query = "" ; //$NON-N LS-1$ | |
104 | if(( applicatio nName != n ull) && (a pplication Name.lengt h() > 0)) | |
105 | { | |
106 | type = "?type=" + applicat ionName; / /$NON-NLS- 1$ | |
107 | } | |
108 | if(( version != null) && (version.l ength() > 0)) | |
109 | { | |
110 | if(typ e.length() > 0) | |
111 | { | |
112 | versionQ uery = "&" ; //$NON-N LS-1$ | |
113 | } | |
114 | else | |
115 | { | |
116 | versionQ uery = "?" ; //$NON-N LS-1$ | |
117 | } | |
118 | versio nQuery += "version=" + version ; //$NON-NL S-1$ | |
119 | } | |
120 | Stri ng idsServ iceUrlStri ng = getId sProxyConf iguration( ).getIdsPr otocolWith Default() + "://" + //$NON-NL S-1$ | |
121 | accele ratorServe r + ":" + accelerato rPort + "/ " + //$NO N-NLS-1$ / /$NON-NLS- 2$ | |
122 | getIds ProxyConfi guration() .getIdsApp licationPa thWithDefa ult() + "/ " + | |
123 | getIds ProxyConfi guration() .getIdsSer vicePathWi thDefault( ) + type + versionQu ery ; //$N ON-NLS-1$ | |
124 | try | |
125 | { | |
126 | logger .info("Que rying IDS Service at site [" + siteNumbe r + "] wit h URL [" + idsServic eUrlString + "]"); | |
127 | client = new Htt pClient(); | |
128 | ||
129 | // JMW set conne ction time out so VIX doesn't w ait foreve r if remot e VIX is u navailable | |
130 | HttpCo nnectionMa nager conn ectionMana ger = clie nt.getHttp Connection Manager(); | |
131 | HttpCo nnectionPa rams param s = connec tionManage r.getParam s(); | |
132 | // amo unt of tim e (in ms) for a conn ection to occur | |
133 | params .setConnec tionTimeou t(getIdsPr oxyConfigu ration().g etIdsConne ctionTimeo utMsWithDe fault()); | |
134 | // amo unt of tim e (in ms) to wait fo r a respon se | |
135 | params .setSoTime out(getIds ProxyConfi guration() .getIdsRes ponseTimeo utMsWithDe fault()); | |
136 | ||
137 | getMet hod = new GetMethod( idsService UrlString) ; | |
138 | respon se = clien t.executeM ethod(getM ethod); | |
139 | ||
140 | // JMW 2/2/2009 - don't tr ack the am ount of da ta called to IDS or the amount of time - not relev ant or con sistent (o nly should do the fi rst time) - not spec ific to a transactio n | |
141 | } | |
142 | catc h(IOExcept ion ioX) | |
143 | { | |
144 | logger .error("Er ror gettin g service list from [" + idsSe rviceUrlSt ring + "]" , ioX); // $NON-NLS-1 $ //$NON-N LS-2$ | |
145 | servic eCache.set SiteOfflin e(siteNumb er); // lo g that sit e is offli ne | |
146 | return null; | |
147 | } | |
148 | ||
149 | if(r esponse == HttpStatu s.SC_OK) | |
150 | { | |
151 | try | |
152 | { | |
153 | InputStr eam input = getMetho d.getRespo nseBodyAsS tream(); | |
154 | IDSServi ceParser p arser = ne w IDSServi ceParser() ; | |
155 | services = parser. parse(inpu t); | |
156 | if((serv ices == nu ll) || (se rvices.siz e() <= 0)) | |
157 | { | |
158 | logger.inf o("Found " + (servic es == null ? "null" : "no") + " services for site '" + siteN umber + "' , version '" + versi on + "', " + applica tionName + "', cachi ng this st atus."); | |
159 | serviceCac he.setSite VersionUna vailable(s iteNumber, version, applicatio nName); | |
160 | } | |
161 | else | |
162 | { | |
163 | logger.inf o("Caching services in IDS Ser vice cache "); | |
164 | serviceCac he.cacheSe rvices(sit eNumber, s ervices); | |
165 | } | |
166 | } | |
167 | catch( IOExceptio n ioX) | |
168 | { | |
169 | logger.e rror("Erro r reading response f rom server [" + idsS erviceUrlS tring + "] ", ioX); / /$NON-NLS- 1$ //$NON- NLS-2$ | |
170 | return n ull; | |
171 | } | |
172 | } | |
173 | else | |
174 | { | |
175 | logger .error("Di d not reci eve 200 re sponse fro m server, received [ " + respon se + "]"); //$NON-NL S-1$ //$NO N-NLS-2$ | |
176 | return null; | |
177 | } | |
178 | ||
179 | retu rn service s; | |
180 | } | |
181 | ||
182 | pu blic Sorte dSet<IDSSe rvice> get ImagingSer vices(Site site, Str ing applic ationName, String ve rsion) | |
183 | { | |
184 | if(s ite == nul l) | |
185 | return null; | |
186 | if(! site.hasAc celeratorS erver()) | |
187 | { | |
188 | logger .info("Sit e [" + sit e.getSiteN umber() + "] does no t have VIX defined i n site ser vice, cann ot get ima ging servi ces"); | |
189 | return null; | |
190 | } | |
191 | retu rn getImag ingService s(site.get SiteNumber (), site.g etAccelera torServer( ), | |
192 | site.get Accelerato rPort(), a pplication Name, vers ion); | |
193 | } | |
194 | ||
195 | pr ivate IDSP roxyConfig uration ge tIdsProxyC onfigurati on() | |
196 | { | |
197 | retu rn IDSProx yConfigura tion.getId sProxyConf iguration( ); | |
198 | } | |
199 | } |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.