12. EPMO Open Source Coordination Office Redaction File Detail Report

Produced by Araxis Merge on 6/5/2018 10:24:07 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.

12.1 Files compared

# Location File Last Modified
1 patch_205_build_9.zip\Java\CacheImpl\main\src\resources\gov\va\med\server CacheResourceReferenceFactory.java Wed May 30 14:35:21 2018 UTC
2 patch_205_build_9.zip\Java\CacheImpl\main\src\resources\gov\va\med\server CacheResourceReferenceFactory.java Fri Jun 1 18:49:04 2018 UTC

12.2 Comparison summary

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

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

12.4 Active regular expressions

No regular expressions were active.

12.5 Comparison detail

  1   package go v.va.med.s erver;
  2  
  3   import gov .va.med.im aging.stor age.cache. Cache;
  4   import gov .va.med.im aging.stor age.cache. CacheManag er;
  5   import gov .va.med.im aging.stor age.cache. exceptions .CacheExce ption;
  6   import gov .va.med.im aging.stor age.cache. impl.Cache ManagerImp l;
  7  
  8   import jav a.util.Has htable;
  9  
  10   import jav ax.managem ent.MBeanE xception;
  11   import jav ax.naming. Context;
  12   import jav ax.naming. Name;
  13   import jav ax.naming. Reference;
  14   import jav ax.naming. spi.Object Factory;
  15  
  16   import org .apache.lo gging.log4 j.LogManag er;
  17   import org .apache.lo gging.log4 j.Logger;
  18  
  19   /**
  20    * This cl ass implem ents the J NDI SPI Ob jectFactor y interfac e, providi ng a way
  21    * to crea te Cache i nstances a nd make th em availab le as
  22    * Resourc es. The ap p server m ay create  many copie s of the c lass, howe ver only
  23    * one ins tance of t he cache ( and cache  manager) s hould be c reated. 
  24    * 
  25    * @author   PI I
  26    * 
  27    */
  28   public cla ss CacheRe sourceRefe renceFacto ry 
  29   implements  ObjectFac tory 
  30   {
  31           pu blic final  static St ring CACHE _MANAGER_N AME = "Cac heManager" ;
  32           pr ivate stat ic final L ogger logg er = LogMa nager.getL ogger(Cach eResourceR eferenceFa ctory.clas s);
  33  
  34           pu blic Cache ResourceRe ferenceFac tory() 
  35           {
  36                    try 
  37                    {
  38                             regist erServerLi fecycleLis tener();
  39                    } 
  40                    catc h (MBeanEx ception e)  
  41                    {
  42                             e.prin tStackTrac e();
  43                             throw  new Except ionInIniti alizerErro r();
  44                    } 
  45                    catc h (CacheEx ception e)  
  46                    {
  47                             e.prin tStackTrac e();
  48                             throw  new Except ionInIniti alizerErro r();
  49                    }
  50           }
  51  
  52           pr ivate stat ic boolean  lifecycle ListenerRe gistered =  false;
  53           pr ivate stat ic synchro nized void  registerS erverLifec ycleListen er() 
  54           th rows MBean Exception,  CacheExce ption 
  55           {
  56                    if(  ! lifecycl eListenerR egistered)
  57                    {
  58                             Server AdapterImp l.getSingl eton().add ServerLife cycleListe ner( Cache ManagerImp l.getSingl eton() );
  59                             lifecy cleListene rRegistere d = true;
  60                    }
  61           }
  62  
  63           /* *
  64            *  @param ob j
  65            *              The poss ibly null  object con taining lo cation or  reference
  66            *              informat ion that c an be used  in creati ng an obje ct
  67            *  @param na me
  68            *              The name  of this o bject rela tive to <c ode>nameCt x</code>
  69            *  @param na meCtx
  70            *              The cont ext relati ve to whic h the <cod e>name</co de> parame ter
  71            *              is speci fied, or < code>null< /code> if  <code>name </code> is
  72            *              relative  to the de fault init ial contex t
  73            *  @param en vironment
  74            *              The poss ibly null  environmen t that is  used in cr eating thi s
  75            *              object
  76            *  
  77            *              For the  following  element in  server.xm l: <Resour ce
  78            *              auth="Co ntainer"
  79            *              descript ion="Core  applicatio n (Spring)  context"
  80            *              name="Co reRouterCo ntext"
  81            *              type="or g.springfr amework.co ntext.Appl icationCon text"
  82            *              instance -name="Cor eRouterCon text"
  83            *              factory= "gov.va.me d.server.t omcat.Core RouterCont extFactory " />
  84            *  
  85            *              nameCts  = 'org.apa che.naming .NamingCon text@787d6 a'
  86            *              name.toS tring = 'I magingExch angeCache'
  87            *  
  88            *              Referenc e factory
  89            *              classnam e[org.apac he.naming. factory.Re sourceFact ory], fact ory
  90            *              class lo cation [nu ll] RefAdd r type [de scription]  = [Cachin g
  91            *              mechanis m for ViXS ] RefAddr  type [scop e] = [Shar eable] Ref Addr
  92            *              type [au th] = [Con tainer] Re fAddr type  [factory]  =
  93            *              [gov.va. med.imagin g.storage. cache.impl .tomcat.Ca cheFactory ]
  94            *  
  95            *              javax.na ming.Name  [.ImagingE xchangeCac he]
  96            * /
  97           @O verride
  98           pu blic Objec t getObjec tInstance(
  99                    Obje ct obj, 
  100                    Name  name, 
  101                    Cont ext nameCt x,
  102                    Hash table<?, ? > environm ent) 
  103           th rows Excep tion 
  104           {
  105                    // W e only kno w how to d eal with < code>javax .naming.Re ference</c ode>s
  106                    // t hat specif y a class  name of "g ov.va.med. imaging.st orage.cach e.Cache"
  107                    if ( (obj == nu ll) || !(o bj instanc eof Refere nce))
  108                             return  null;
  109  
  110                    Refe rence refe rence = (R eference)  obj;
  111  
  112                    // T he propert ies of the  Reference  instance  come from  the server .xml
  113                    // f ile, Resou rce elemen t:
  114                    // < Resource
  115                    // a uth="Conta iner"
  116                    // d escription ="VIX Cach e"
  117                    // n ame="Imagi ngExchange Cache"
  118                    // s cope="Shar eable"
  119                    // t ype="gov.v a.med.imag ing.storag e.cache.Ca che"
  120                    // i nstance-na me="CoreRo uterContex t"
  121                    // f actory="go v.va.med.i maging.sto rage.cache .impl.Cach eManagerIm pl"/>
  122  
  123                    Stri ng referen ceClassNam e = refere nce.getCla ssName();
  124                    Clas s<?> refer enceClass  = null;
  125                    
  126                    try
  127                    {
  128                             refere nceClass =  reference ClassName  == null ?  null : Cla ss.forName (reference ClassName) ;
  129                    }
  130                    catc h (Excepti on e)
  131                    {
  132                             logger .warn("Una ble to val idate retu rned value  is expect ed type '"
  133                                      + refere nceClassNa me 
  134                                      + "', co ntinuing b ut ClassCa stExceptio ns may be  thrown lat er."); 
  135                    }
  136                    
  137                    Cach eManager c acheManage r = CacheM anagerImpl .getSingle ton();
  138                    
  139                    Stri ng cacheNa me = name. toString() ;
  140                    if(C ACHE_MANAG ER_NAME.eq ualsIgnore Case(cache Name))
  141                    {
  142                             logger .info("Ret urning ref erence to  cache mana ger " 
  143                                      + getCla ss().getSi mpleName()
  144                                      + " getO bjectInsta nce(Refere nce, '" +  cacheName  + "', '"
  145                                      + nameCt x.toString () + ", .. .) ");
  146                             
  147                             if(ref erenceClas s != null  && !refere nceClass.i sInstance( cacheManag er) )
  148                             {
  149                                      logger.e rror("Retu rned value  is NOT ex pected typ e '"
  150                                               + referenc eClassName  
  151                                               + "', retu rning null .");
  152                                      return n ull;
  153                             }
  154                             
  155                             return  cacheMana ger;
  156                    }
  157                    else
  158                    {
  159                             logger .info("Ret urning ref erence to  cache inst ance " 
  160                                      + getCla ss().getSi mpleName()
  161                                      + " getO bjectInsta nce(Refere nce, '" +  cacheName  + "', '"
  162                                      + nameCt x.toString () + ", .. .) ");
  163           
  164                             Cache  cache = ca cheManager .getCache( cacheName) ;
  165                             
  166                             if(ref erenceClas s != null  && !refere nceClass.i sInstance( cache) )
  167                             {
  168                                      logger.e rror("Retu rned value  is NOT ex pected typ e '"
  169                                               + referenc eClassName  
  170                                               + "', retu rning null .");
  171                                      return n ull;
  172                             }
  173                             
  174                             return  cache;
  175                    }
  176           }
  177   }