Produced by Araxis Merge on 12/5/2017 12:06:46 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\ImagingRouterCache\main\src\java\gov\va\med\imaging\router\cache | ImagingCacheFactory.java | Mon Dec 4 21:35:08 2017 UTC |
| 2 | IV-eHMP_CIF.zip\IMAG_Source\VISA\Java\ImagingRouterCache\main\src\java\gov\va\med\imaging\router\cache | ImagingCacheFactory.java | Mon Dec 4 22:03:34 2017 UTC |
| Description | Between Files 1 and 2 |
|
|---|---|---|
| Text Blocks | Lines | |
| Unchanged | 3 | 366 |
| 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: Oct 31, 2011 | |
| 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.rou ter.cache; | |
| 27 | ||
| 28 | import gov .va.med.im aging.exch ange.stora ge.cache.D ODSourcedC ache; | |
| 29 | import gov .va.med.im aging.exch ange.stora ge.cache.V ASourcedCa che; | |
| 30 | ||
| 31 | import jav a.util.Has htable; | |
| 32 | ||
| 33 | import jav ax.naming. Context; | |
| 34 | import jav ax.naming. Name; | |
| 35 | import jav ax.naming. Reference; | |
| 36 | import jav ax.naming. spi.Object Factory; | |
| 37 | ||
| 38 | import org .apache.lo gging.log4 j.LogManag er; | |
| 39 | import org .apache.lo gging.log4 j.Logger; | |
| 40 | import org .springfra mework.con text.Appli cationCont ext; | |
| 41 | import org .springfra mework.con text.suppo rt.ClassPa thXmlAppli cationCont ext; | |
| 42 | ||
| 43 | /** | |
| 44 | * @author
|
|
| 45 | * | |
| 46 | */ | |
| 47 | public cla ss Imaging CacheFacto ry | |
| 48 | implements ObjectFac tory | |
| 49 | { | |
| 50 | pr ivate fina l static L ogger logg er = LogMa nager.getL ogger(Imag ingCacheFa ctory.clas s); | |
| 51 | pr ivate stat ic Applica tionContex t cacheApp licationCo ntext = nu ll; | |
| 52 | pu blic stati c final St ring[] CON TEXT_FILEN AMES = new String[]{ "imagingRo uterCacheC ontext.xml "}; | |
| 53 | pu blic stati c final St ring DOD_S OURCED_CAC HE_BEAN_NA ME = "dodS ourcedCach e"; | |
| 54 | pu blic stati c final St ring VA_SO URCED_CACH E_BEAN_NAM E = "vaSou rcedCache" ; | |
| 55 | ||
| 56 | /* (non-Java doc) | |
| 57 | * @see java x.naming.s pi.ObjectF actory#get ObjectInst ance(java. lang.Objec t, javax.n aming.Name , javax.na ming.Conte xt, java.u til.Hashta ble) | |
| 58 | * / | |
| 59 | @O verride | |
| 60 | pu blic Objec t getObjec tInstance( Object obj , Name nam e, Context nameCtx, | |
| 61 | Hashta ble<?, ?> environmen t) | |
| 62 | th rows Excep tion | |
| 63 | { | |
| 64 | // W e only kno w how to d eal with < code>javax .naming.Re ference</c ode>s | |
| 65 | // that spec ify a clas s name of "gov.va.me d.imaging. storage.ca che.Cache" | |
| 66 | if ( (obj == null) || ! (obj insta nceof Refe rence) ) | |
| 67 | return n ull; | |
| 68 | ||
| 69 | // The JNDI defines th e Referenc e class to represent reference . | |
| 70 | // A referen ce contain s informat ion on how to constr uct a copy of the ob ject. | |
| 71 | // The JNDI will attem pt to turn reference s looked u p from the directory into the Java objec ts that th ey | |
| 72 | // represent so that J NDI client s have the illusion that what is stored in the dir ectory are Java obje cts. | |
| 73 | Re ference re f = (Refer ence) obj; | |
| 74 | ||
| 75 | // Best gues s; the pro perties of the Refer ence insta nce come f rom the se rver.xml f ile, Resou rce elemen t: | |
| 76 | // <Resource | |
| 77 | // auth="Con tainer" | |
| 78 | // descripti on="Core a pplication (Spring) context" | |
| 79 | // name="Cor eRouterCon text" | |
| 80 | // type="org .springfra mework.con text.Appli cationCont ext" | |
| 81 | // instance- name="Core RouterCont ext" | |
| 82 | // factory=" gov.va.med .server.to mcat.CoreR outerConte xtFactory" /> | |
| 83 | ||
| 84 | lo gger.info( getClass() .getSimple Name() + " getObject Instance(R eference, '" + | |
| 85 | name.t oString() + "', '" + nameCtx.t oString() + ", ...) " ); | |
| 86 | lo gger.info( "begin Ref erence con tents ==== ========== ======== " ); | |
| 87 | // logger.inf o(dumpRefe renceConte nts(ref)); | |
| 88 | lo gger.info( "end Ref erence con tents ==== ========== ======== " ); | |
| 89 | ||
| 90 | // System.out .println(d umpName(na me)); | |
| 91 | Stri ng resourc eName = na me.toStrin g(); | |
| 92 | ||
| 93 | // t his refere nce will c ontain the reference that is b eing reque sted | |
| 94 | Ob ject imple mentation = null; | |
| 95 | ||
| 96 | St ring msg = getClass( ).getSimpl eName() + " getting reference to '" + re sourceName + "', exp ected type is [" + r ef.getClas sName() + "]."; | |
| 97 | lo gger.info( msg); | |
| 98 | ||
| 99 | // The route r implemen tation is determined by the Sp ring conte xt | |
| 100 | lo gger.info( "Ref class name [" + ref.getCla ssName() + "]"); | |
| 101 | lo gger.info( "Cache Cla ss Name [" + gov.va. med.imagin g.router.c ache.Imagi ngCache.cl ass.getNam e() + "]") ; | |
| 102 | if ( gov.va.m ed.imaging .router.ca che.Imagin gCache.cla ss.getName ().equals( ref.getCla ssName()) ) | |
| 103 | { | |
| 104 | impl ementation = getCach e(); | |
| 105 | } | |
| 106 | ||
| 107 | if (implement ation == n ull) | |
| 108 | { | |
| 109 | logg er.error( getClass() .getSimple Name() + " reference to '" + r esourceNam e + "' is null." ); | |
| 110 | } | |
| 111 | el se | |
| 112 | { | |
| 113 | msg = | |
| 114 | getCla ss().getSi mpleName() + " refer ence to '" + resourc eName + "' is " + | |
| 115 | (imple mentation == null ? "null" : " [" + imple mentation. getClass() .getName() + "]") + "."; | |
| 116 | ||
| 117 | logg er.info(ge tClass().g etSimpleNa me() + " r eference t o '" + res ourceName + "' is of type [" + implement ation.getC lass().get Name() + " ]." ); | |
| 118 | ||
| 119 | } | |
| 120 | ||
| 121 | re turn imple mentation; | |
| 122 | } | |
| 123 | ||
| 124 | pr ivate sync hronized s tatic gov. va.med.ima ging.route r.cache.Im agingCache getCache( ) | |
| 125 | { | |
| 126 | DODS ourcedCach e dodCache = getDODS ourcedCach e(); | |
| 127 | VASo urcedCache vaCache = getVASour cedCache() ; | |
| 128 | retu rn new Ima gingCacheI mpl(dodCac he, vaCach e); | |
| 129 | } | |
| 130 | ||
| 131 | pr ivate stat ic synchro nized VASo urcedCache getVASour cedCache() | |
| 132 | { | |
| 133 | Appl icationCon text appCo ntext = ge tApplicati onContext( ); | |
| 134 | ||
| 135 | Stri ng msg = " ImagingCac heFactory " + | |
| 136 | (appCo ntext == n ull ? "fai led to obt ain" : "ob tained") + | |
| 137 | " refe rence to a pplication context w hen gettin g VASource dCache"; | |
| 138 | logg er.info(ms g); | |
| 139 | ||
| 140 | VASo urcedCache vaCache = | |
| 141 | (VASou rcedCache) appContext .getBean(V A_SOURCED_ CACHE_BEAN _NAME); | |
| 142 | ||
| 143 | msg = "Imaging CacheFacto ry " + | |
| 144 | (vaCac he == null ? "failed to obtain " : "obtai ned") + | |
| 145 | " refe rence to r outer from applicati on context ." + | |
| 146 | "VA So urced Cach e implemen tation is of type '" + (vaCach e == null ? "<null>" : vaCache .getClass( ).getName( )) + "'."; | |
| 147 | logg er.info(ms g); | |
| 148 | ||
| 149 | retu rn vaCache ; | |
| 150 | } | |
| 151 | ||
| 152 | pr ivate stat ic synchro nized DODS ourcedCach e getDODSo urcedCache () | |
| 153 | { | |
| 154 | Appl icationCon text appCo ntext = ge tApplicati onContext( ); | |
| 155 | ||
| 156 | Stri ng msg = " ImagingCac heFactory " + | |
| 157 | (appCo ntext == n ull ? "fai led to obt ain" : "ob tained") + | |
| 158 | " refe rence to a pplication context w hen gettin g DODSourc edCache"; | |
| 159 | logg er.info(ms g); | |
| 160 | ||
| 161 | DODS ourcedCach e dodCache = | |
| 162 | (DODSo urcedCache )appContex t.getBean( DOD_SOURCE D_CACHE_BE AN_NAME); | |
| 163 | ||
| 164 | msg = "Imaging CacheFacto ry " + | |
| 165 | (dodCa che == nul l ? "faile d to obtai n" : "obta ined") + | |
| 166 | " refe rence to r outer from applicati on context ." + | |
| 167 | "DOD S ourced Cac he impleme ntation is of type ' " + (dodCa che == nul l ? "<null >" : dodCa che.getCla ss().getNa me()) + "' ."; | |
| 168 | logg er.info(ms g); | |
| 169 | ||
| 170 | retu rn dodCach e; | |
| 171 | } | |
| 172 | ||
| 173 | pr ivate sync hronized s tatic Appl icationCon text getAp plicationC ontext() | |
| 174 | { | |
| 175 | if(c acheApplic ationConte xt == null ) | |
| 176 | { | |
| 177 | logger .info("Cre ating VIX Cache cont ext."); | |
| 178 | cacheA pplication Context = new ClassP athXmlAppl icationCon text( CONT EXT_FILENA MES ); | |
| 179 | logger .info("VIX Cache con text " + c acheApplic ationConte xt.hashCod e() + " cr eated."); | |
| 180 | ||
| 181 | } | |
| 182 | ||
| 183 | retu rn cacheAp plicationC ontext; | |
| 184 | } | |
| 185 | } |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.