41. EPMO Open Source Coordination Office Redaction File Detail Report

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

41.1 Files compared

# Location File Last Modified
1 IV-eHMP_CIF.zip\IMAG_Source\VISA\Java\CacheAPI\main\src\java\gov\va\med\imaging\storage\cache\impl\eviction EvictionStrategyFactory.java Mon Dec 4 21:35:30 2017 UTC
2 IV-eHMP_CIF.zip\IMAG_Source\VISA\Java\CacheAPI\main\src\java\gov\va\med\imaging\storage\cache\impl\eviction EvictionStrategyFactory.java Mon Dec 4 21:57:24 2017 UTC

41.2 Comparison summary

Description Between
Files 1 and 2
Text Blocks Lines
Unchanged 2 336
Changed 1 2
Inserted 0 0
Removed 0 0

41.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

41.4 Active regular expressions

No regular expressions were active.

41.5 Comparison detail

  1   /**
  2    * 
  3    */
  4   package go v.va.med.i maging.sto rage.cache .impl.evic tion;
  5  
  6   import gov .va.med.im aging.stor age.cache. EvictionSt rategy;
  7   import gov .va.med.im aging.stor age.cache. EvictionTi mer;
  8   import gov .va.med.im aging.stor age.cache. exceptions .CacheExce ption;
  9   import gov .va.med.im aging.stor age.cache. memento.Ev ictionStra tegyMement o;
  10  
  11   import jav a.util.Has hMap;
  12   import jav a.util.Map ;
  13  
  14   import org .apache.lo gging.log4 j.LogManag er;
  15   import org .apache.lo gging.log4 j.Logger;
  16  
  17   /**
  18    * @author         
BECKEC
  19    * 
  20    * A facto ry class f or creatin g Eviction  Strategie s.  There  is one Evi ctionStrat egyFactory  per VM,
  21    * i.e. a  Singleton.
  22    *
  23    */
  24   public cla ss Evictio nStrategyF actory
  25   {
  26           pu blic final  static St ring evict ionStrateg yClassname Key = "evi ctionStrat egyClassna me";
  27  
  28           pr ivate stat ic Evictio nStrategyF actory sin gleton;
  29           
  30           pr ivate Logg er logger  = LogManag er.getLogg er(this.ge tClass());
  31           
  32           //  the list  of all kno wn evictio n strategy  classes a nd the mem ento
  33           //  classes r equired to  create th em
  34           pr ivate Map< Class<? ex tends Evic tionStrate gy>, Class <? extends  EvictionS trategyMem ento>> evi ctionStrat egiesMap =  null;
  35           
  36           pu blic stati c synchron ized Evict ionStrateg yFactory g etSingleto n()
  37           {
  38                    if(s ingleton = = null)
  39                    {
  40                             single ton = new  EvictionSt rategyFact ory();
  41                    }
  42                    retu rn singlet on;
  43           }
  44  
  45           /* *
  46            *  Get (and  possibly p opulate) t he known e viction st rategies m ap.
  47            *  @return
  48            * /
  49           pu blic synch ronized Ma p<Class<?  extends Ev ictionStra tegy>, Cla ss<? exten ds Evictio nStrategyM emento>> g etKnownEvi ctionStrat egies()
  50           {
  51                    if(e victionStr ategiesMap  == null)
  52                    {
  53                             evicti onStrategi esMap = ne w HashMap< Class<? ex tends Evic tionStrate gy>, Class <? extends  EvictionS trategyMem ento>>();
  54                             
  55                             evicti onStrategi esMap.put( SimpleEvic tionStrate gy.class,  SimpleEvic tionStrate gyMemento. class);
  56                             evicti onStrategi esMap.put( StorageThr esholdEvic tionStrate gy.class,  StorageThr esholdEvic tionStrate gyMemento. class);
  57                             evicti onStrategi esMap.put( LastAccess edEviction Strategy.c lass, Last AccessedEv ictionStra tegyMement o.class);
  58                             
  59                    }
  60                    retu rn evictio nStrategie sMap;
  61           }
  62           
  63           /* *
  64            *  Get an ar ray lising  all of th e known ev iction str ategy name s.
  65            *  
  66            *  @return
  67            * /
  68           pu blic Strin g[] getKno wnEviction StrategyNa mes()
  69           {
  70                    Stri ng[] strat egyNames =  new Strin g[getKnown EvictionSt rategies() .keySet(). size()];
  71                    int  index = 0;
  72                    
  73                    for( Class<? ex tends Evic tionStrate gy> strate gyClass :  getKnownEv ictionStra tegies().k eySet())
  74                             strate gyNames[in dex++] = s trategyCla ss.getName ();
  75                    
  76                    retu rn strateg yNames;
  77           }
  78           
  79           /* *
  80            *  Return th e eviction  strategy  Class with  the given  name.  Th e name mus t be one o f those
  81            *  returned  by @see {@ link #getK nownEvicti onStrategy Names()}
  82            *  
  83            *  @param ev ictionStra tegyClassn ame
  84            *  @return
  85            * /
  86           pu blic Class <? extends  EvictionS trategy> f indEvictio nStrategyC lassByName (String ev ictionStra tegyClassn ame)
  87           {
  88                    if(e victionStr ategyClass name == nu ll)
  89                             return  null;
  90                    
  91                    for( Class<? ex tends Evic tionStrate gy> evicti onStrategy Class : ge tKnownEvic tionStrate gies().key Set())
  92                    {
  93                              if( e victionStr ategyClass name.equal s(eviction StrategyCl ass.getNam e()) ||
  94                                               evictionSt rategyClas sname.equa ls(evictio nStrategyC lass.getSi mpleName() ) )
  95                                      return e victionStr ategyClass ;
  96                    }
  97                    retu rn null;
  98           }
  99           
  100           /* *
  101            *  Return th e memento  class thet  the evict ion strate gy class w iththe giv en name pr oduces, an d
  102            *  is instan tiable fro m.  The na me must be  one of th ose return ed by @see  {@link #g etKnownEvi ctionStrat egyNames() }
  103            *  
  104            *  @param ev ictionstra tegyClassn ame
  105            *  @return
  106            * /
  107           pr ivate Clas s<? extend s Eviction StrategyMe mento> fin dEvictionS trategyMem entoClassB yName(Stri ng evictio nStrategyC lassname)
  108           {
  109                    Clas s<? extend s Eviction Strategy>  evictionSt rategyClas s = findEv ictionStra tegyClassB yName(evic tionStrate gyClassnam e);
  110                    
  111                    if(e victionStr ategyClass  == null)
  112                             return  null;
  113                    
  114                    
  115                    retu rn getKnow nEvictionS trategies( ).get(evic tionStrate gyClass);
  116           }
  117           
  118           /* *
  119            *  Create a  blank meme nto for th e given ev iction str ategy clas s name.  T he name mu st be one  of those
  120            *  returned  by @see {@ link #getK nownEvicti onStrategy Names()}
  121            *  
  122            *  @param ev ictionStra tegyClassn ame
  123            *  @return
  124            * /
  125           pu blic Evict ionStrateg yMemento c reateBlank Memento(St ring evict ionStrateg yClassname )
  126           {
  127                    Clas s mementoC lass = fin dEvictionS trategyMem entoClassB yName(evic tionStrate gyClassnam e);
  128                    try
  129                    {
  130                             return  (Eviction StrategyMe mento)meme ntoClass.n ewInstance ();
  131                    } 
  132                    catc h (Instant iationExce ption x)
  133                    {
  134                             logger .error(x);
  135                             return  null;
  136                    } 
  137                    catc h (Illegal AccessExce ption x)
  138                    {
  139                             logger .error(x);
  140                             return  null;
  141                    }
  142           }
  143           
  144           /* *
  145            *  Create an  eviction  strategy i nstance fr om the giv en memento .  The typ e of the m emento ins tance
  146            *  determine s the evic tion strat egy type r eturned.
  147            *  
  148            *  @param me mento
  149            *  @param ti mer
  150            *  @return
  151            *  @throws C acheExcept ion 
  152            * /
  153           pu blic Evict ionStrateg y createEv ictionStra tegy(Evict ionStrateg yMemento m emento, Ev ictionTime r timer) 
  154           th rows Cache Exception
  155           {
  156                    // W ARNING: or dering of  comparison s is signi ficant bec ause the
  157                    // m emento cla sses may d erive from  one anoth er
  158                    if(m emento ins tanceof La stAccessed EvictionSt rategyMeme nto)
  159                             return  LastAcces sedEvictio nStrategy. create((La stAccessed EvictionSt rategyMeme nto)mement o, timer);
  160  
  161                    if(m emento ins tanceof St orageThres holdEvicti onStrategy Memento)
  162                             return  StorageTh resholdEvi ctionStrat egy.create ((StorageT hresholdEv ictionStra tegyMement o)memento,  timer);
  163                    
  164                    if(m emento ins tanceof Si mpleEvicti onStrategy Memento)
  165                             return  SimpleEvi ctionStrat egy.create ((SimpleEv ictionStra tegyMement o)memento) ;
  166  
  167                    retu rn null;
  168           }
  169   }