Produced by Araxis Merge on 12/5/2017 12:06:45 PM Central Standard 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 | IV-eHMP_CIF.zip\IMAG_Source\VISA\Java\ImagingExchangeBaseWebProxy\main\src\java\gov\va\med\imaging\proxy\ids | IDSProxy.java | Mon Dec 4 21:34:58 2017 UTC |
| 2 | IV-eHMP_CIF.zip\IMAG_Source\VISA\Java\ImagingExchangeBaseWebProxy\main\src\java\gov\va\med\imaging\proxy\ids | IDSProxy.java | Mon Dec 4 22:03:16 2017 UTC |
| Description | Between Files 1 and 2 |
|
|---|---|---|
| Text Blocks | Lines | |
| Unchanged | 3 | 388 |
| 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:
|
|
| 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
|
|
| 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 | // 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 | |
| 89 | if(ser viceCache. isSiteVers ionUnavail able(siteN umber, ver sion, appl icationNam e)) | |
| 90 | { | |
| 91 | 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."); | |
| 92 | return n ull; | |
| 93 | } | |
| 94 | } | |
| 95 | ||
| 96 | Http Client cli ent = null ; | |
| 97 | GetM ethod getM ethod = nu ll; | |
| 98 | int response = 0; | |
| 99 | Stri ng type = ""; //$NON -NLS-1$ | |
| 100 | Stri ng version Query = "" ; //$NON-N LS-1$ | |
| 101 | if(( applicatio nName != n ull) && (a pplication Name.lengt h() > 0)) | |
| 102 | { | |
| 103 | type = "?type=" + applicat ionName; / /$NON-NLS- 1$ | |
| 104 | } | |
| 105 | if(( version != null) && (version.l ength() > 0)) | |
| 106 | { | |
| 107 | if(typ e.length() > 0) | |
| 108 | { | |
| 109 | versionQ uery = "&" ; //$NON-N LS-1$ | |
| 110 | } | |
| 111 | else | |
| 112 | { | |
| 113 | versionQ uery = "?" ; //$NON-N LS-1$ | |
| 114 | } | |
| 115 | versio nQuery += "version=" + version ; //$NON-NL S-1$ | |
| 116 | } | |
| 117 | Stri ng idsServ iceUrlStri ng = getId sProxyConf iguration( ).getIdsPr otocolWith Default() + "://" + //$NON-NL S-1$ | |
| 118 | accele ratorServe r + ":" + accelerato rPort + "/ " + //$NO N-NLS-1$ / /$NON-NLS- 2$ | |
| 119 | getIds ProxyConfi guration() .getIdsApp licationPa thWithDefa ult() + "/ " + | |
| 120 | getIds ProxyConfi guration() .getIdsSer vicePathWi thDefault( ) + type + versionQu ery ; //$N ON-NLS-1$ | |
| 121 | try | |
| 122 | { | |
| 123 | logger .info("Que rying IDS Service at site [" + siteNumbe r + "] wit h URL [" + idsServic eUrlString + "]"); | |
| 124 | client = new Htt pClient(); | |
| 125 | ||
| 126 | // JMW set conne ction time out so VIX doesn't w ait foreve r if remot e VIX is u navailable | |
| 127 | HttpCo nnectionMa nager conn ectionMana ger = clie nt.getHttp Connection Manager(); | |
| 128 | HttpCo nnectionPa rams param s = connec tionManage r.getParam s(); | |
| 129 | // amo unt of tim e (in ms) for a conn ection to occur | |
| 130 | params .setConnec tionTimeou t(getIdsPr oxyConfigu ration().g etIdsConne ctionTimeo utMsWithDe fault()); | |
| 131 | // amo unt of tim e (in ms) to wait fo r a respon se | |
| 132 | params .setSoTime out(getIds ProxyConfi guration() .getIdsRes ponseTimeo utMsWithDe fault()); | |
| 133 | ||
| 134 | getMet hod = new GetMethod( idsService UrlString) ; | |
| 135 | respon se = clien t.executeM ethod(getM ethod); | |
| 136 | ||
| 137 | // 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 | |
| 138 | } | |
| 139 | catc h(IOExcept ion ioX) | |
| 140 | { | |
| 141 | logger .error("Er ror gettin g service list from [" + idsSe rviceUrlSt ring + "]" , ioX); // $NON-NLS-1 $ //$NON-N LS-2$ | |
| 142 | servic eCache.set SiteOfflin e(siteNumb er); // lo g that sit e is offli ne | |
| 143 | return null; | |
| 144 | } | |
| 145 | ||
| 146 | if(r esponse == HttpStatu s.SC_OK) | |
| 147 | { | |
| 148 | try | |
| 149 | { | |
| 150 | InputStr eam input = getMetho d.getRespo nseBodyAsS tream(); | |
| 151 | IDSServi ceParser p arser = ne w IDSServi ceParser() ; | |
| 152 | services = parser. parse(inpu t); | |
| 153 | if((serv ices == nu ll) || (se rvices.siz e() <= 0)) | |
| 154 | { | |
| 155 | logger.inf o("Found " + (servic es == null ? "null" : "no") + " services for site '" + siteN umber + "' , version '" + versi on + "', " + applica tionName + "', cachi ng this st atus."); | |
| 156 | serviceCac he.setSite VersionUna vailable(s iteNumber, version, applicatio nName); | |
| 157 | } | |
| 158 | else | |
| 159 | { | |
| 160 | logger.inf o("Caching services in IDS Ser vice cache "); | |
| 161 | serviceCac he.cacheSe rvices(sit eNumber, s ervices); | |
| 162 | } | |
| 163 | } | |
| 164 | catch( IOExceptio n ioX) | |
| 165 | { | |
| 166 | logger.e rror("Erro r reading response f rom server [" + idsS erviceUrlS tring + "] ", ioX); / /$NON-NLS- 1$ //$NON- NLS-2$ | |
| 167 | return n ull; | |
| 168 | } | |
| 169 | } | |
| 170 | else | |
| 171 | { | |
| 172 | logger .error("Di d not reci eve 200 re sponse fro m server, received [ " + respon se + "]"); //$NON-NL S-1$ //$NO N-NLS-2$ | |
| 173 | return null; | |
| 174 | } | |
| 175 | ||
| 176 | retu rn service s; | |
| 177 | } | |
| 178 | ||
| 179 | pu blic Sorte dSet<IDSSe rvice> get ImagingSer vices(Site site, Str ing applic ationName, String ve rsion) | |
| 180 | { | |
| 181 | if(s ite == nul l) | |
| 182 | return null; | |
| 183 | if(! site.hasAc celeratorS erver()) | |
| 184 | { | |
| 185 | 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"); | |
| 186 | return null; | |
| 187 | } | |
| 188 | retu rn getImag ingService s(site.get SiteNumber (), site.g etAccelera torServer( ), | |
| 189 | site.get Accelerato rPort(), a pplication Name, vers ion); | |
| 190 | } | |
| 191 | ||
| 192 | pr ivate IDSP roxyConfig uration ge tIdsProxyC onfigurati on() | |
| 193 | { | |
| 194 | retu rn IDSProx yConfigura tion.getId sProxyConf iguration( ); | |
| 195 | } | |
| 196 | } |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.