391. EPMO Open Source Coordination Office Redaction File Detail Report

Produced by Araxis Merge on 12/5/2017 12:06:50 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.

391.1 Files compared

# Location File Last Modified
1 IV-eHMP_CIF.zip\IMAG_Source\VISA\Java\VistaImagingDataSourceProvider\main\src\java\gov\va\med\imaging\url\vista\image NetworkLocationCacheManager.java Mon Dec 4 21:35:26 2017 UTC
2 IV-eHMP_CIF.zip\IMAG_Source\VISA\Java\VistaImagingDataSourceProvider\main\src\java\gov\va\med\imaging\url\vista\image NetworkLocationCacheManager.java Mon Dec 4 22:06:42 2017 UTC

391.2 Comparison summary

Description Between
Files 1 and 2
Text Blocks Lines
Unchanged 4 386
Changed 3 6
Inserted 0 0
Removed 0 0

391.3 Comparison options

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

391.4 Active regular expressions

No regular expressions were active.

391.5 Comparison detail

  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: Nov  28, 2006
  6     Site Nam e:  Washin gton OI Fi eld Office , Silver S pring, MD
  7       Developer:          
WERFEJ
  8     Descript ion: Netwo rk Locatio ns cache m anager. Ma intains th e cache of  network L ocation cr edentials  and expire s old cred entials af ter 15 min utes. 
  9                                      This ens ures crede ntials are  not held  for a long  period of  time.
  10  
  11           ;;  +-------- ---------- ---------- ---------- ---------- ---------- ---------- +
  12           ;;  Property  of the US  Government .
  13           ;;  No permis sion to co py or redi stribute t his softwa re is give n.
  14           ;;  Use of un released v ersions of  this soft ware requi res the us er
  15           ;;   to execu te a writt en test ag reement wi th the Vis tA Imaging
  16           ;;   Developm ent Office  of the De partment o f Veterans  Affairs,
  17           ;;   telephon e (301) 73 4-0100.
  18           ;;
  19           ;;  The Food  and Drug A dministrat ion classi fies this  software a s
  20           ;;  a Class I I medical  device.  A s such, it  may not b e changed
  21           ;;  in any wa y.  Modifi cations to  this soft ware may r esult in a n
  22           ;;  adulterat ed medical  device un der 21CFR8 20, the us e of which
  23           ;;  is consid ered to be  a violati on of US F ederal Sta tutes.
  24           ;;  +-------- ---------- ---------- ---------- ---------- ---------- ---------- +
  25  
  26    */
  27   package go v.va.med.i maging.url .vista.ima ge;
  28  
  29   import org .apache.lo gging.log4 j.LogManag er;
  30   import org .apache.lo gging.log4 j.Logger;
  31  
  32   import gov .va.med.im aging.exch ange.BaseT imedCache;
  33   import gov .va.med.im aging.exch ange.BaseT imedCacheV alueItem;
  34   import gov .va.med.im aging.exch ange.TaskS cheduler;
  35   import gov .va.med.im aging.exch ange.busin ess.Image;
  36   import gov .va.med.im aging.prot ocol.vista .VistaImag ingTransla tor;
  37  
  38   /**
  39    * Network  Locations  cache man ager. Main tains the  cache of n etwork Loc ation cred entials an d expires  old creden tials afte r 15 minut es. 
  40    *      Th is ensures  credentia ls are not  held for  a long per iod of tim e.
  41    * 
  42    * @author         
WERFEJ
  43    *
  44    */
  45   public cla ss Network LocationCa cheManager   {
  46  
  47           pr ivate fina l static l ong NETWOR K_LOCATION _CACHE_TIM ER_REFRESH  = 1000 *  60 * 15; / / 15 minut es
  48           
  49           pr ivate stat ic Logger  logger = L ogManager. getLogger( NetworkLoc ationCache Manager.cl ass);
  50           
  51           pr ivate Base TimedCache <String, I magingSite Credential sCacheItem > cache;
  52           
  53           /* *
  54            *  In the Vi X, this cl ass is cre ated by Sp ring.
  55            *  This cons tructor wa s made pub lic to all ow a test  client to  access it
  56            *  without S pring.  Th is class s hould be t reated as  a singleto n, both 
  57            *  within Sp ring and i n non-Spri ng applica tions.  Co nstruction  is 
  58            *  left to a n external  class tho ugh.
  59            * /
  60           pu blic Netwo rkLocation CacheManag er() 
  61           {
  62                    logg er.info("N etworkLoca tionCacheM anager() c reated");
  63                    try  {
  64                             cache  = new Base TimedCache <String, I magingSite Credential sCacheItem >(NetworkL ocationCac heManager. class.toSt ring());
  65                             TaskSc heduler.ge tTaskSched uler().sch edule(cach e, NETWORK _LOCATION_ CACHE_TIME R_REFRESH,  NETWORK_L OCATION_CA CHE_TIMER_ REFRESH);
  66                    }
  67                    catc h(Exceptio n eX) {
  68                             logger .error("Er ror creati ng image c redentials  map", eX) ;
  69                    }
  70           }
  71  
  72           /* *
  73            *  Retrieves  network l ocation in formation  from the c ache based  on an ima ge
  74            *  
  75            *  @param im age Image  object sea rching for  the netwo rk locatio n informat ion for
  76            *  @return T he network  locations  for the i mage or nu ll
  77            * /
  78           pu blic Imagi ngStorageC redentials  getNetwor kLocations (Image ima ge, String  siteNumbe r) 
  79           {
  80                    if(i mage == nu ll)
  81                             return  null;
  82                    if(c ache == nu ll)
  83                             return  null;
  84                    Stri ng network Location =  VistaImag ingTransla tor.extrac tServerSha re(image);
  85                    
  86                    logg er.info("S earching f or cached  imaging si te credent ials for s ite '" + s iteNumber  + "'.");
  87                    
  88                    Imag ingSiteCre dentialsCa cheItem it em = (Imag ingSiteCre dentialsCa cheItem)ca che.getIte m(siteNumb er);
  89                    if(i tem == nul l)
  90                             return  null;
  91                    logg er.info("F ound cache d imaging  site crede ntials for  site '" +  siteNumbe r + "'.");
  92                    retu rn item.im agingSiteC redentials .getStorag eCredentia ls(network Location);
  93           }
  94           
  95           pu blic Imagi ngStorageC redentials  getNetwor kLocation( String fil ename, Str ing siteNu mber)
  96           {
  97                    if(f ilename ==  null)
  98                             return  null;
  99                    if(c ache == nu ll)
  100                             return  null;
  101                    Stri ng network Location =  VistaImag ingTransla tor.extrac tServerSha re(filenam e);
  102                    
  103                    logg er.info("S earching f or cached  imaging si te credent ials for s ite '" + s iteNumber  + "'.");
  104                    
  105                    Imag ingSiteCre dentialsCa cheItem it em = (Imag ingSiteCre dentialsCa cheItem)ca che.getIte m(siteNumb er);
  106                    if(i tem == nul l)
  107                             return  null;
  108                    retu rn item.im agingSiteC redentials .getStorag eCredentia ls(network Location);
  109           }
  110           
  111           pu blic void  updateImag ingSiteCre dentials(I magingSite Credential s imagingS iteCredent ials)
  112           {
  113                    if(i magingSite Credential s == null)
  114                             return ;
  115                    if(c ache == nu ll)
  116                             return ; // could  try to ma ke it here
  117                    Imag ingSiteCre dentialsCa cheItem ca chedItem =  new Imagi ngSiteCred entialsCac heItem();
  118                    cach edItem.ima gingSiteCr edentials  = imagingS iteCredent ials;
  119                    logg er.debug(" Putting Im aging Site  Credentia ls for sit e '" + ima gingSiteCr edentials. getSiteNum ber() + "'  into cach e");
  120                    cach e.updateIt em(cachedI tem);
  121           }
  122  
  123           /* *
  124            *  Updates m ultiple ne twork loca tions in t he cache.  This reset s the refr eshTime fo r the netw ork locati on if it i s already  in the cac he 
  125            *       to t he current  time
  126            *  
  127            *  @param ne tworkLocat ions Updat es the net work locat ions in th e cache
  128            * /
  129           /*
  130           pu blic void  updateNetw orkLocatio ns(List<Ne tworkLocat ion> netwo rkLocation s) {
  131                    if(n etworkLoca tions == n ull)
  132                             return ;
  133                    if(c ache == nu ll)
  134                             return ; // could  try to ma ke it here
  135                    //lo ng now = S ystem.curr entTimeMil lis();
  136                    for( int i = 0;  i < netwo rkLocation s.size();  i++) {
  137                             Networ kLocation  networkLoc ation = ne tworkLocat ions.get(i );
  138                             Networ kLocationC acheItem c acheItem =  new Netwo rkLocation CacheItem( );
  139                             cacheI tem.networ kLocation  = networkL ocation;
  140                             logger .debug("Pu tting netw ork locati on [" + ca cheItem.ge tKey() + " ] into cac he");
  141                             cache. updateItem (cacheItem );                      
  142                    }
  143           }* /
  144           
  145           /* *
  146            *  Purge exp ired items  from the  cache. An  expired it em is purg ed if it h as not bee n added/up dated for  longer tha n the rete ntion peri od
  147            * /
  148           pu blic void  purgeExpir edCacheIte ms() {
  149                    logg er.debug(" Checking f or old ent ries in th e NetworkL ocation ca che");
  150                    if(c ache == nu ll)
  151                             return ;
  152                    cach e.purgeExp iredCacheI tems();
  153           }
  154           
  155           /* *
  156            *  Wrapper f or network Location o bject that  includes  a time whe n the item  was last  added/upda ted in the  cache
  157            *  
  158              * @author        
WERFEJ
  159            *
  160            * /
  161           cl ass Imagin gSiteCrede ntialsCach eItem 
  162           ex tends Base TimedCache ValueItem 
  163           {
  164                    Imag ingSiteCre dentials i magingSite Credential s;
  165                    long  refreshed Time;
  166  
  167                    @Ove rride
  168                    publ ic String  toString()  
  169                    {
  170                             return  imagingSi teCredenti als.getSit eNumber();
  171                    }
  172  
  173                    @Ove rride
  174                    publ ic Object  getKey() {
  175                             return  imagingSi teCredenti als.getSit eNumber();
  176                    }
  177           }
  178           
  179           /* *
  180            *  Set the r etention p eriod in m illisecond s.  This d oes not ch ange how o ften the t imer event  occurs to  purge the  expired i tems.
  181            *  
  182            *  @param ne tworkLocat ionRetenti onPeriod T he retenti on period  in ms
  183            * /
  184           pu blic void  setNetwork LocationRe tentionPer iod(
  185                             long n etworkLoca tionRetent ionPeriod)  
  186           {
  187                    cach e.setReten tionPeriod (networkLo cationRete ntionPerio d);
  188           }
  189           
  190           /*
  191           pr ivate stat ic String  createKey( String sit eNumber, S tring netw orkLocatio nPath)
  192           {
  193                    retu rn (siteNu mber + "_"  + network LocationPa th).toUppe rCase();
  194           }* /
  195  
  196   }