Produced by Araxis Merge on 3/25/2019 8:58:02 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\ImagingExchangeBaseWebProxy\main\src\java\gov\va\med\imaging\proxy\ids | IDSProxy.java | Mon Mar 18 20:39:09 2019 UTC |
2 | C:\AraxisMergeCompare\Pri_re\IMAG_Source\VISA\Java\ImagingExchangeBaseWebProxy\main\src\java\gov\va\med\imaging\proxy\ids | IDSProxy.java | Tue Mar 19 12:03:48 2019 UTC |
Description | Between Files 1 and 2 |
|
---|---|---|
Text Blocks | Lines | |
Unchanged | 3 | 420 |
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: 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.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 DN S WERFEJ | |
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 | //An ything bef ore P207 w ill return 8. This i s to get a round prob lem with P 177 where it always return | |
70 | //th e latest v ersion of the callee 's service s | |
71 | int callerVers ion = 8; | |
72 | retu rn getImag ingService s(siteNumb er, accele ratorServe r, acceler atorPort, applicatio nName, cal lerVersion , version) ; | |
73 | } | |
74 | ||
75 | pu blic Sorte dSet<IDSSe rvice> get ImagingSer vices(Stri ng siteNum ber, Strin g accelera torServer, | |
76 | int ac celeratorP ort, Strin g applicat ionName, i nt callerV ersion, St ring versi on) | |
77 | { | |
78 | if(s erviceCach e.isSiteOf fline(site Number)) | |
79 | { | |
80 | logger .info("Sit e '" + sit eNumber + "' has bee n previous ly tested and determ ined to be offline, returning null servi ces."); | |
81 | return null; | |
82 | } | |
83 | ||
84 | Sort edSet<IDSS ervice> se rvices = n ew TreeSet <IDSServic e>(); | |
85 | // c an only lo ok in the cache if a specified service t ype and ve rsion was specified | |
86 | if(( applicatio nName != n ull) && (a pplication Name.lengt h() > 0) & & | |
87 | (versi on != null ) && (vers ion.length () > 0)) | |
88 | { | |
89 | logger .info("Sea rch IDS Se rvice cach e for serv ice from s ite [" + s iteNumber + "] [" + applicatio nName + ", " + versi on + "]"); | |
90 | IDSSer vice servi ce = servi ceCache.ge tCachedSer vice(siteN umber, app licationNa me, versio n); | |
91 | if(ser vice != nu ll) | |
92 | { | |
93 | logger.i nfo("Found service i n cache, r eturning s ervice inf ormation f rom cache" ); | |
94 | services .add(servi ce); | |
95 | return s ervices; | |
96 | } | |
97 | // 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 | |
98 | if(ser viceCache. isSiteVers ionUnavail able(siteN umber, ver sion, appl icationNam e)) | |
99 | { | |
100 | 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."); | |
101 | return n ull; | |
102 | } | |
103 | } | |
104 | ||
105 | Http Client cli ent = null ; | |
106 | GetM ethod getM ethod = nu ll; | |
107 | int response = 0; | |
108 | Stri ng type = ""; //$NON -NLS-1$ | |
109 | Stri ng version Query = "" ; //$NON-N LS-1$ | |
110 | Stri ng caller = "?caller Version=" + Integer. toString(c allerVersi on); | |
111 | if(( applicatio nName != n ull) && (a pplication Name.lengt h() > 0)) | |
112 | { | |
113 | type = "&type=" + applicat ionName; / /$NON-NLS- 1$ | |
114 | } | |
115 | if(( version != null) && (version.l ength() > 0)) | |
116 | { | |
117 | // if(typ e.length() > 0) | |
118 | // { | |
119 | // versionQ uery = "&" ; //$NON-N LS-1$ | |
120 | // } | |
121 | // else | |
122 | // { | |
123 | // versionQ uery = "?" ; //$NON-N LS-1$ | |
124 | // } | |
125 | versio nQuery = " &version=" + version ; //$NON-NL S-1$ | |
126 | } | |
127 | Stri ng idsServ iceUrlStri ng = getId sProxyConf iguration( ).getIdsPr otocolWith Default() + "://" + //$NON-NL S-1$ | |
128 | accele ratorServe r + ":" + accelerato rPort + "/ " + //$NO N-NLS-1$ / /$NON-NLS- 2$ | |
129 | getIds ProxyConfi guration() .getIdsApp licationPa thWithDefa ult() + "/ " + | |
130 | getIds ProxyConfi guration() .getIdsSer vicePathWi thDefault( ) + caller + type + versionQue ry ; //$NO N-NLS-1$ | |
131 | try | |
132 | { | |
133 | logger .info("Que rying IDS Service at site [" + siteNumbe r + "] wit h URL [" + idsServic eUrlString + "]"); | |
134 | client = new Htt pClient(); | |
135 | ||
136 | // JMW set conne ction time out so VIX doesn't w ait foreve r if remot e VIX is u navailable | |
137 | HttpCo nnectionMa nager conn ectionMana ger = clie nt.getHttp Connection Manager(); | |
138 | HttpCo nnectionPa rams param s = connec tionManage r.getParam s(); | |
139 | // amo unt of tim e (in ms) for a conn ection to occur | |
140 | params .setConnec tionTimeou t(getIdsPr oxyConfigu ration().g etIdsConne ctionTimeo utMsWithDe fault()); | |
141 | // amo unt of tim e (in ms) to wait fo r a respon se | |
142 | params .setSoTime out(getIds ProxyConfi guration() .getIdsRes ponseTimeo utMsWithDe fault()); | |
143 | ||
144 | getMet hod = new GetMethod( idsService UrlString) ; | |
145 | respon se = clien t.executeM ethod(getM ethod); | |
146 | ||
147 | // 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 | |
148 | } | |
149 | catc h(IOExcept ion ioX) | |
150 | { | |
151 | logger .error("Er ror gettin g service list from [" + idsSe rviceUrlSt ring + "]" , ioX); // $NON-NLS-1 $ //$NON-N LS-2$ | |
152 | servic eCache.set SiteOfflin e(siteNumb er); // lo g that sit e is offli ne | |
153 | return null; | |
154 | } | |
155 | ||
156 | if(r esponse == HttpStatu s.SC_OK) | |
157 | { | |
158 | try | |
159 | { | |
160 | InputStr eam input = getMetho d.getRespo nseBodyAsS tream(); | |
161 | IDSServi ceParser p arser = ne w IDSServi ceParser() ; | |
162 | services = parser. parse(inpu t); | |
163 | if((serv ices == nu ll) || (se rvices.siz e() <= 0)) | |
164 | { | |
165 | logger.inf o("Found " + (servic es == null ? "null" : "no") + " services for site '" + siteN umber + "' , version '" + versi on + "', " + applica tionName + "', cachi ng this st atus."); | |
166 | serviceCac he.setSite VersionUna vailable(s iteNumber, version, applicatio nName); | |
167 | } | |
168 | else | |
169 | { | |
170 | logger.inf o("Caching services in IDS Ser vice cache "); | |
171 | serviceCac he.cacheSe rvices(sit eNumber, s ervices); | |
172 | } | |
173 | } | |
174 | catch( IOExceptio n ioX) | |
175 | { | |
176 | logger.e rror("Erro r reading response f rom server [" + idsS erviceUrlS tring + "] ", ioX); / /$NON-NLS- 1$ //$NON- NLS-2$ | |
177 | return n ull; | |
178 | } | |
179 | } | |
180 | else | |
181 | { | |
182 | logger .error("Di d not reci eve 200 re sponse fro m server, received [ " + respon se + "]"); //$NON-NL S-1$ //$NO N-NLS-2$ | |
183 | return null; | |
184 | } | |
185 | ||
186 | retu rn service s; | |
187 | } | |
188 | ||
189 | pu blic Sorte dSet<IDSSe rvice> get ImagingSer vices(Site site, Str ing applic ationName, String ve rsion) | |
190 | { | |
191 | int callerVers ion = 999; //Use max version i f no calle rVersion p assed in | |
192 | retu rn getImag ingService s(site, ap plicationN ame, calle rVersion, version); | |
193 | } | |
194 | ||
195 | pu blic Sorte dSet<IDSSe rvice> get ImagingSer vices(Site site, Str ing applic ationName, int calle rVersion, String ver sion) | |
196 | { | |
197 | if(s ite == nul l) | |
198 | return null; | |
199 | if(! site.hasAc celeratorS erver()) | |
200 | { | |
201 | 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"); | |
202 | return null; | |
203 | } | |
204 | retu rn getImag ingService s(site.get SiteNumber (), site.g etAccelera torServer( ), | |
205 | site.get Accelerato rPort(), a pplication Name, call erVersion, version); | |
206 | } | |
207 | ||
208 | pr ivate IDSP roxyConfig uration ge tIdsProxyC onfigurati on() | |
209 | { | |
210 | retu rn IDSProx yConfigura tion.getId sProxyConf iguration( ); | |
211 | } | |
212 | } |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.