412. EPMO Open Source Coordination Office Redaction File Detail Report

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

412.1 Files compared

# Location File Last Modified
1 IV-eHMP_CIF.zip\IMAG_Source\VISA\Java\VixCacheWebApp\main\src\gov\va\med\imaging\cache ImagingCacheManagementServiceImpl.java Mon Dec 4 21:34:28 2017 UTC
2 IV-eHMP_CIF.zip\IMAG_Source\VISA\Java\VixCacheWebApp\main\src\gov\va\med\imaging\cache ImagingCacheManagementServiceImpl.java Mon Dec 4 22:07:19 2017 UTC

412.2 Comparison summary

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

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

412.4 Active regular expressions

No regular expressions were active.

412.5 Comparison detail

  1   package go v.va.med.i maging.cac he;
  2  
  3   import gov .va.med.im aging.cach e.CacheMan agementSer vice;
  4   import gov .va.med.im aging.cach e.ImagingC acheManage mentServic e;
  5   import gov .va.med.im aging.cach e.CACHE_PO PULATION_D EPTH;
  6   import gov .va.med.im aging.cach e.CacheGro upMetadata ;
  7   import gov .va.med.im aging.cach e.CacheIns tanceMetad ata;
  8   import gov .va.med.im aging.cach e.CacheIte mPath;
  9   import gov .va.med.im aging.cach e.CacheMan agerVO;
  10   import gov .va.med.im aging.cach e.CacheMet adata;
  11   import gov .va.med.im aging.cach e.CacheReg ionMetadat a;
  12   import gov .va.med.im aging.cach e.CacheVO;
  13   import gov .va.med.im aging.cach e.FieldVer ifier;
  14   import gov .va.med.im aging.cach e.GroupVO;
  15   import gov .va.med.im aging.cach e.Instance VO;
  16   import gov .va.med.im aging.cach e.RegionVO ;
  17   import gov .va.med.im aging.stor age.cache. Cache;
  18   import gov .va.med.im aging.stor age.cache. Group;
  19   import gov .va.med.im aging.stor age.cache. Region;
  20   import gov .va.med.im aging.stor age.cache. exceptions .CacheExce ption;
  21  
  22   import jav a.util.Lis t;
  23  
  24   import jav ax.managem ent.MBeanE xception;
  25  
  26   import org .apache.lo gging.log4 j.LogManag er;
  27   import org .apache.lo gging.log4 j.Logger;
  28  
  29   /**
  30    * The ser ver side i mplementat ion of the  cache man agement RP C service.
  31    * 
  32    * NOTES:
  33    * 1.) Thi s servlet  needs the  servlet co ntext so t hat it can  get the S pring appl ication co ntext,
  34    * so that  it can ge t the cach e manager.   Overridi ng Servlet ContextAwa re, specif ically set ServletCon text(),
  35    * breaks  something  in GWT.  D oing so re sults in a  NullPoint erExceptio n deep in  GWT with l ittle indi cation
  36    * of its  source.
  37    * 2.) The  CacheAPI  and CacheI mpl jars M UST be loa ded from t he Tomcat  common cla ss loader.   If those  jars
  38    * are loa ded from t his web ap plication  then multi ple copies  of the ca che manage r and cach es will be  created
  39    * and tha t will bre ak things  seriously.  
  40    * 
  41    * @author         
BECKEC
  42    * 
  43    */
  44   @SuppressW arnings("s erial")
  45   public cla ss Imaging CacheManag ementServi ceImpl 
  46   implements  ImagingCa cheManagem entService
  47   {
  48           pr ivate fina l Logger l ogger = Lo gManager.g etLogger(t his.getCla ss());
  49           
  50           //  default t he initial  populatio n depth to  REGION
  51           //  this seem s to make  everything  work and  won't be t oo slow
  52           pr ivate stat ic final C ACHE_POPUL ATION_DEPT H INITIAL_ DEPTH = CA CHE_POPULA TION_DEPTH .REGION;
  53           //  how much  metadata i s populate d on the i nitial pop ulation
  54           //  anything  below CACH E level wi ll cause a  significa nt perform ance hit
  55           pr ivate stat ic final C ACHE_POPUL ATION_DEPT H INITIAL_ METADATA_D EPTH = CAC HE_POPULAT ION_DEPTH. CACHE;
  56           
  57           pu blic Imagi ngCacheMan agementSer viceImpl()
  58           {
  59                    supe r();
  60           }
  61  
  62           /* public Ima gingCacheM anagementS erviceImpl (Object de legate)
  63           {
  64                    supe r(delegate );
  65           }* /
  66  
  67           /* *
  68            *  The depth  of the re sult when  getCacheMa nagerVO()  is called,  has no
  69            *  meaning a fter that.
  70            *  
  71            *  @return
  72            * /
  73           pu blic CACHE _POPULATIO N_DEPTH ge tInitialDe pth()
  74           {
  75                    retu rn INITIAL _DEPTH;
  76           }
  77  
  78           pu blic CACHE _POPULATIO N_DEPTH ge tInitialMe tadataDept h() 
  79           {
  80                    retu rn INITIAL _METADATA_ DEPTH;
  81           }
  82  
  83           /* *
  84            *  
  85            *  @return
  86            * /
  87           @O verride
  88           pu blic Cache ManagerVO  getCacheMa nagerVO()
  89           {
  90                    logg er.info("E NTER getCa cheManager VO()");
  91                    Cach eManagerVO  cacheMana gerVo = ne w CacheMan agerVO();
  92                    try
  93                    {
  94                             cacheM anagerVo.a ddAll(Cach eManagemen tService.g etCacheMan agerCaches (getInitia lDepth(),  getInitial MetadataDe pth()));
  95                    }
  96                    catc h (CacheEx ception e)
  97                    {
  98                             e.prin tStackTrac e();
  99                    } 
  100                    catc h (MBeanEx ception e)  
  101                    {
  102                             e.prin tStackTrac e();
  103                    }
  104           
  105                    logg er.info("R eturning C acheManage rVO with "  + getInit ialDepth() .toString( ) + ".");
  106                    
  107                    retu rn cacheMa nagerVo;
  108           }
  109  
  110           @O verride
  111           pu blic List< CacheVO> g etCacheLis t(CACHE_PO PULATION_D EPTH depth , CACHE_PO PULATION_D EPTH metad ataPopulat ionDepth) 
  112           th rows Illeg alArgument Exception
  113           {
  114                    List <CacheVO>  caches = n ull;
  115                    try
  116                    {
  117                             caches  = CacheMa nagementSe rvice.getC acheManage rCaches(de pth, metad ataPopulat ionDepth);
  118                    }
  119                    catc h (CacheEx ception e)
  120                    {
  121                             e.prin tStackTrac e();
  122                    }
  123                    catc h (MBeanEx ception e)  
  124                    {
  125                             e.prin tStackTrac e();
  126                    }
  127                    retu rn caches;
  128           }
  129  
  130           /* *
  131            *  Populate  a CacheVO  to an arbi trary leve l, startin g at an ar bitrary it em
  132            *  determine d by the g iven path.  Gets cach e items fr om the pat h down to  the reques ted depth,
  133            *  returning  the resul ts as a po pulated Ca cheVO.
  134            *  
  135            *  @param pa th - NULL  means to s tart at th e top, the  CacheMana ger
  136            *  @param ta rgetDepth  - the maxi mum depth
  137            *  @param me tadaPopula tionDepth  - to what  depth to i nclude met adata in t he result
  138            * /
  139           @O verride
  140           pu blic Cache VO getCach eItems(Cac heItemPath  path, CAC HE_POPULAT ION_DEPTH  targetDept h, CACHE_P OPULATION_ DEPTH meta dataPopula tionDepth)  
  141           th rows Illeg alArgument Exception
  142           {
  143                    Cach eVO result  = null;
  144                    Cach e cache;
  145  
  146                    if(t argetDepth  == null)
  147                             target Depth = pa th == null  ? CACHE_P OPULATION_ DEPTH.CACH E : CACHE_ POPULATION _DEPTH.nex t(path.get EndpointDe pth()); 
  148                    if(m etadataPop ulationDep th == null )
  149                             metada taPopulati onDepth =  CACHE_POPU LATION_DEP TH.CACHE; 
  150                    
  151                    logg er.debug(
  152                             "getCa cheItems("  
  153                             + (pat h == null  ? "null" :  path.toSt ring()) 
  154                             + ", "  + targetD epth.toStr ing() 
  155                             + ", "  + metadat aPopulatio nDepth.toS tring() +  ")");
  156                    
  157                    Cach eItemPath  currentPat h;
  158                    
  159                    try
  160                    {
  161                             cache  = CacheMan agementSer vice.getCa che(path.g etCacheNam e());
  162                             if(cac he == null )
  163                                      throw ne w IllegalA rgumentExc eption("Th e cache na med '" + p ath.getCac heName() +  "' does n ot exist." );
  164                             
  165                             // all  of the Ca cheMetadat a properti es are qui ckly acces sible so p opulate th e
  166                             // met adata all  of the tim e
  167                             result  = new Cac heVO(
  168                                      cache.ge tName(), 
  169                                      new Cach eMetadata(
  170                                               new CacheI temPath(pa th.getCach eName()), 
  171                                               cache.getL ocationUri ().toStrin g(), 
  172                                               cache.getL ocationPat h(), 
  173                                               cache.getL ocationPro tocol() )
  174                             );
  175                             curren tPath = ne w CacheIte mPath(cach e.getName( ));
  176                             
  177                             // if  the region  name is n ull, then  populate t he result  from the c ache level
  178                             if(pat h.getRegio nName() ==  null)
  179                             {
  180                                      result.a ddAll( Cac heManageme ntService. getCacheRe gions(cach e, targetD epth, meta dataPopula tionDepth)  );
  181                             }
  182                             // els e, the reg ion is par t of the p ath, popul ate the re sults from  some lowe r level
  183                             else
  184                             {
  185                                      Region r egion = ca che.getReg ion(path.g etRegionNa me());
  186                                      RegionVO  regionVO  = new Regi onVO(regio n.getName( ), null);
  187                                      result.a dd(regionV O);            // add  the regio n to the r esult, to  set the co ntext of t he result
  188                                      currentP ath = curr entPath.cr eateChildP ath(region .getName() , false);
  189                                      
  190                                      // if no  group nam es are pro vided then  populate  the result  with all  of the gro ups
  191                                      // withi n the regi on
  192                                      if(path. getGroupNa mes() == n ull || pat h.getGroup Names().le ngth < 1)
  193                                      {
  194                                               regionVO.a ddAll( Cac heManageme ntService. getRegionG roups(cach e, region,  targetDep th, metada taPopulati onDepth) ) ;
  195                                      }
  196                                      
  197                                      // else,  at least  one group  level is p rovided, s o populate  from a 
  198                                      // lower  group lev el 
  199                                      else
  200                                      {
  201                                               // get the  first gro up and bui ld the cur rentPath
  202                                               CACHE_POPU LATION_DEP TH current GroupDepth  = CACHE_P OPULATION_ DEPTH.GROU P0;
  203                                               Group curr entGroup =  region.ge tChildGrou p(path.get GroupNames ()[0]);
  204                                               String gro upSemantic Name = Cac heSemantic s.getGroup SemanticTy pe(
  205                                                       ca che.getNam e(), 
  206                                                       re gion.getNa me(), 
  207                                                       cu rrentGroup Depth.getG roupIndex( )
  208                                               );
  209                                              
  210                                               GroupVO cu rrentGroup VO = new G roupVO(
  211                                                       cu rrentGroup .getName() ,
  212                                                       nu ll, 
  213                                                       cu rrentGroup Depth, 
  214                                                       gr oupSemanti cName
  215                                               );
  216                                               regionVO.a dd(current GroupVO);    // add t he current  group, to  set the c ontext of  the result
  217                                               currentPat h = curren tPath.crea teChildPat h(currentG roup.getNa me(), fals e);
  218                                              
  219                                              
  220                                               //
  221                                               // iterate  through t he groups  until the  path ends
  222                                               for(int in dex=1; ind ex < path. getGroupNa mes().leng th; ++inde x)
  223                                               {
  224                                                       Gr oup childG roup = cur rentGroup. getChildGr oup(path.g etGroupNam es()[index ]);
  225                                                       cu rrentGroup Depth = CA CHE_POPULA TION_DEPTH .next(curr entGroupDe pth);
  226                                                       
  227                                                       gr oupSemanti cName = Ca cheSemanti cs.getGrou pSemanticT ype(
  228                                                                cach e.getName( ), 
  229                                                                regi on.getName (), 
  230                                                                curr entGroupDe pth.getGro upIndex()
  231                                                       );
  232                                                       
  233                                                       Gr oupVO chil dGroupVO =  new Group VO(
  234                                                                chil dGroup.get Name(),
  235                                                                null
  236                                                                curr entGroupDe pth, 
  237                                                                grou pSemanticN ame
  238                                                       );
  239                                                       cu rrentPath  = currentP ath.create ChildPath( childGroup .getName() , false);
  240                                                       
  241                                                       cu rrentGroup VO.add(chi ldGroupVO) ;
  242                                                       cu rrentGroup  = childGr oup;
  243                                                       cu rrentGroup VO = child GroupVO;
  244                                               }
  245                                              
  246                                               if(path.ge tInstanceN ame() == n ull)
  247                                               {
  248                                                       cu rrentGroup VO.addAll(  
  249                                                                Cach eManagemen tService.g etGroupGro ups(curren tPath, cur rentGroup,  currentGr oupDepth,  targetDept h, metadat aPopulatio nDepth) 
  250                                                       );
  251                                                       cu rrentGroup VO.addAllI nstance( 
  252                                                                Cach eManagemen tService.g etGroupIns tances(cur rentPath,  currentGro up, metada taPopulati onDepth) ) ;
  253                                               }
  254                                               else
  255                                               {
  256                                                       //  this is k inda' sill y 'cause i t just rec reates the  original  path as a
  257                                                       //  link of v alue objec ts, but it  is logica lly correc t so ...
  258                                                       cu rrentGroup VO.addInst ance( new  InstanceVO (
  259                                                                path .getInstan ceName(), 
  260                                                                null
  261                                                                Cach eSemantics .getInstan ceSemantic Type(cache .getName() , region.g etName()))
  262                                                       );
  263                                               }
  264                                      }
  265                             }
  266                    }
  267                    catc h (CacheEx ception e)
  268                    {
  269                             e.prin tStackTrac e();
  270                    }
  271                    catc h (MBeanEx ception e)  
  272                    {
  273                             e.prin tStackTrac e();
  274                    }
  275                    
  276                    logg er.debug(" getCacheIt ems(" + pa th.toStrin g() + ","  + targetDe pth.toStri ng() + ")  result is:  \r\n" + C acheManage mentServic e.makeText Summary(re sult));
  277                    retu rn result;
  278           }
  279  
  280           /* *
  281            *  
  282            *  @param ca chename
  283            * /
  284           pu blic Cache ItemPath c learCache( CacheItemP ath path) 
  285           th rows Illeg alArgument Exception
  286           {
  287                    try 
  288                    {
  289                             Cache  cache = Ca cheManagem entService .getCache( path.getCa cheName()) ;
  290                             cache. clear();
  291                    } 
  292                    catc h (Excepti on e) 
  293                    {
  294                             e.prin tStackTrac e();
  295                             throw  new Illega lArgumentE xception(" I'm sorry  Keith, I c an't do th at...", e) ;
  296                    }
  297  
  298                    retu rn path;
  299           }
  300  
  301           @O verride
  302           pu blic Cache ItemPath d eleteGroup (CacheItem Path group Path) 
  303           th rows Illeg alArgument Exception
  304           {
  305                    logg er.debug(" deleteGrou p(" + grou pPath.toSt ring() + " )");
  306                    asse rt( groupP ath.getCac heName() ! = null );
  307                    asse rt( groupP ath.getReg ionName()  != null );
  308                    asse rt( groupP ath.getGro upNames()  != null );
  309                    asse rt( groupP ath.getGro upNames(). length > 0  );
  310                    asse rt( groupP ath.getGro upNames()[ 0] != null  );
  311                    logg er.debug(" deleteGrou p(" + grou pPath.toSt ring() + " ), paramet ers valida ted");
  312                    
  313                    try
  314                    {
  315                             Cache  cache = Ca cheManagem entService .getCache(  groupPath .getCacheN ame() );
  316                             logger .debug("de leteGroup( " + groupP ath.toStri ng() + ")  cache '" +  cache.get Name() + " ' found.") ;
  317                             cache. deleteGrou p(groupPat h.getRegio nName(), g roupPath.g etGroupNam es(), true );
  318                             logger .debug("de leteGroup( " + groupP ath.toStri ng() + ")  group dele ted.");
  319                             
  320                             return  groupPath ;
  321                    }
  322                    catc h (CacheEx ception e)
  323                    {
  324                             e.prin tStackTrac e();
  325                             throw  new Illega lArgumentE xception(" Unable to  delete gro up, except ion occure d '" + e.g etMessage( ) + "'.");
  326                    }
  327                    catc h (MBeanEx ception e)  
  328                    {
  329                             e.prin tStackTrac e();
  330                             throw  new Illega lArgumentE xception(" Unable to  delete gro up, except ion occure d '" + e.g etMessage( ) + "'.");
  331                    }
  332           }
  333           
  334           /* *
  335            *  
  336            * /
  337           @O verride
  338           pu blic Cache ItemPath d eleteInsta nce(CacheI temPath in stancePath
  339           th rows Illeg alArgument Exception
  340           {
  341                    if(i nstancePat h == null)
  342                             throw  new Illega lArgumentE xception(" deleteInst ance(), NU LL instanc ePath para meter.");
  343                    
  344                    logg er.debug(" deleteInst ance(" + i nstancePat h.toString () + ")");
  345                    asse rt( instan cePath.get CacheName( ) != null  );
  346                    asse rt( instan cePath.get RegionName () != null  );
  347                    asse rt( instan cePath.get GroupNames () != null  );
  348                    asse rt( instan cePath.get InstanceNa me() != nu ll );
  349                    asse rt( instan cePath.get GroupNames ().length  > 0 );
  350                    asse rt( instan cePath.get GroupNames ()[0] != n ull );
  351                    logg er.debug(" deleteInst ance(" + i nstancePat h.toString () + "), p arameters  validated" );
  352                    
  353                    try
  354                    {
  355                             Cache  cache = Ca cheManagem entService .getCache(  instanceP ath.getCac heName() ) ;
  356                             logger .debug("de leteInstan ce(" + ins tancePath. toString()  + ") cach e '" + cac he.getName () + "' fo und.");
  357                             cache. deleteInst ance(insta ncePath.ge tRegionNam e(), insta ncePath.ge tGroupName s(), insta ncePath.ge tInstanceN ame(), tru e);
  358                             logger .debug("de leteInstan ce(" + ins tancePath. toString()  + ") inst ance delet ed.");
  359                             
  360                             return  instanceP ath;
  361                    }
  362                    catc h (CacheEx ception cX )
  363                    {
  364                             cX.pri ntStackTra ce();
  365                             throw  new Illega lArgumentE xception(" Unable to  delete ins tance, exc eption occ ured '" +  cX.getMess age() + "' .");
  366                    } 
  367                    catc h (MBeanEx ception mb X) 
  368                    {
  369                             mbX.pr intStackTr ace();
  370                             throw  new Illega lArgumentE xception(" Unable to  delete ins tance, exc eption occ ured '" +  mbX.getMes sage() + " '.");
  371                    }
  372           }
  373  
  374           @O verride
  375           pu blic Cache Metadata g etCacheMet adata(Cach eItemPath  cachePath)
  376           th rows Illeg alArgument Exception 
  377           {
  378                    logg er.debug(" getCacheRe gionMetada ta(" + cac hePath.toS tring() +  ")");
  379                    asse rt( cacheP ath.getCac heName() ! = null );
  380                    logg er.debug(" getCacheRe gionMetada ta(" + cac hePath.toS tring() +  "), parame ters valid ated");
  381           
  382                    retu rn CacheMa nagementSe rvice.getC acheMetada ta(cachePa th);
  383           }
  384  
  385           @O verride
  386           pu blic Cache RegionMeta data getCa cheRegionM etadata(Ca cheItemPat h regionPa th)
  387           th rows Illeg alArgument Exception 
  388           {
  389                    logg er.debug(" getCacheRe gionMetada ta(" + reg ionPath.to String() +  ")");
  390                    asse rt( region Path.getCa cheName()  != null );
  391                    asse rt( region Path.getRe gionName()  != null ) ;
  392                    logg er.debug(" getCacheRe gionMetada ta(" + reg ionPath.to String() +  "), param eters vali dated");
  393                    
  394                    retu rn CacheMa nagementSe rvice.getC acheRegion Metadata(r egionPath) ;
  395           }
  396  
  397           @O verride
  398           pu blic Cache GroupMetad ata getCac heGroupMet adata(Cach eItemPath  groupPath)
  399           th rows Illeg alArgument Exception 
  400           {
  401                    logg er.debug(" getCacheIn stanceMeta data(" + g roupPath.t oString()  + ")");
  402                    asse rt( groupP ath.getCac heName() ! = null );
  403                    asse rt( groupP ath.getReg ionName()  != null );
  404                    asse rt( groupP ath.getGro upNames()  != null &&  groupPath .getGroupN ames().len gth > 0);
  405                    logg er.debug(" getCacheIn stanceMeta data(" + g roupPath.t oString()  + "), para meters val idated");
  406                    
  407                    retu rn CacheMa nagementSe rvice.getC acheGroupM etadata(gr oupPath);
  408           }
  409  
  410           @O verride
  411           pu blic Cache InstanceMe tadata get CacheInsta nceMetadat a(CacheIte mPath item Path)
  412           th rows Illeg alArgument Exception 
  413           {
  414                    logg er.debug(" getCacheIn stanceMeta data(" + i temPath.to String() +  ")");
  415                    asse rt( itemPa th.getCach eName() !=  null );
  416                    asse rt( itemPa th.getRegi onName() ! = null );
  417                    asse rt( itemPa th.getGrou pNames() ! = null &&  itemPath.g etGroupNam es().lengt h > 0);
  418                    asse rt( itemPa th.getInst anceName()  != null ) ;
  419                    logg er.debug(" getCacheIn stanceMeta data(" + i temPath.to String() +  "), param eters vali dated");
  420                    
  421                    retu rn CacheMa nagementSe rvice.getC acheInstan ceMetadata (itemPath) ;
  422           }
  423           
  424           /* *
  425            *  Escape an  html stri ng. Escapi ng data re ceived fro m the clie nt helps t o
  426            *  prevent c ross-site  script vul nerabiliti es.
  427            *  
  428            *  @param ht ml the htm l string t o escape
  429            *  @return t he escaped  string
  430            * /
  431           pr ivate stat ic String  escapeHtml (String ht ml)
  432           {
  433                    if ( html == nu ll) { retu rn null; }
  434                    retu rn html.re placeAll(" &", "&amp; ").replace All("<", " &lt;").rep laceAll("> ", "&gt;") ;
  435           }
  436           
  437  
  438   //      pr ivate void  evaluateN ameInConte xt(Context  ctx, Stri ng[] names )
  439   //      {
  440   //               for( String nam e : names)
  441   //               {
  442   //                        try
  443   //                        {
  444   //                                 Object o bj = ctx.l ookup(name );
  445   //                                 logger.i nfo("'" +  name + "'  is bound t o an objec t of type  '" + obj.g etClass(). getName()  + "'.");
  446   //                        }
  447   //                        catch( NamingExce ption nX)
  448   //                        {
  449   //                                 logger.i nfo("'" +  name + "'  is NOT bou nd in this  context") ;
  450   //                        }
  451   //               }
  452   //      }
  453  
  454           //  Names use d when the  CacheMana ger is mad e availabl e through  JNDI
  455   //      pu blic stati c final St ring JNDI_ CACHE_MANA GER_FQN =  "java:comp /env/cache Manager";
  456   //      pu blic final  static St ring JNDI_ CONTEXT =  "java:comp /env";
  457   //      pu blic final  static St ring JNDI_ CACHE_MANA GER_NAME =  "cacheMan ager";
  458           
  459   //      pr ivate void  initializ eThroughJN DI()
  460   //      {
  461   //               try
  462   //               {
  463   //                        Initia lContext i nitialCtx  = new Init ialContext ();
  464   //                        logger .info(init ialCtx.get Class().ge tName());
  465   //                        logger .info(init ialCtx.com poseName(J NDI_CACHE_ MANAGER_NA ME, ""));
  466   //                        //eval uateNameIn Context(in itialCtx, 
  467   //                        //       new Stri ng[]{"java :", "java: comp", "ja va:comp/en v", "cache Manager",  "java:cach eManager",  "java:com p/cacheMan ager", "ja va:comp/en v/cacheMan ager"}
  468   //                        //);
  469   //                        Contex t envCtx =  (Context)  initialCt x.lookup(J NDI_CONTEX T);
  470   //                        
  471   //                        logger .info("Ini tial Conte xt " 
  472   //                                 + (initi alCtx inst anceof Dir Context ?  "IS" : "IS  NOT")
  473   //                                 + " a Di rContext." );
  474   //                        logger .info("Env ironment C ontext " 
  475   //                                 + (envCt x instance of DirCont ext ? "IS"  : "IS NOT ")
  476   //                                 + " a Di rContext." );
  477   //                        
  478   //                        //eval uateNameIn Context(en vCtx, 
  479   //                        //       new Stri ng[]{"java :", "java: comp", "ja va:comp/en v", "cache Manager",  "java:cach eManager",  "java:com p/cacheMan ager", "ja va:comp/en v/cacheMan ager"}
  480   //                        //);
  481   //                        Object  uncastCac heManager  = null;
  482   //                        try
  483   //                        {
  484   //                                 try
  485   //                                 {
  486   //                                          // Running  in Tomcat  and runni ng with Si mpleJNDI i n JUnit te sts
  487   //                                          // put the  cache man ager under  different  contexts.
  488   //                                          // This tr y/catch is  a cheesy  way to hac k around i t rather t han
  489   //                                          // really  fixing it.
  490   //                                          if(envCtx  == null)                // this  just jumps  us to the  catch blo ck
  491   //                                                  th row new Na mingExcept ion();
  492   //                                         
  493   //                                          uncastCach eManager =  envCtx.lo okup(JNDI_ CACHE_MANA GER_FQN);
  494   //                                 }
  495   //                                 catch (N amingExcep tion nX)
  496   //                                 {
  497   //                                          uncastCach eManager =  initialCt x.lookup(J NDI_CACHE_ MANAGER_FQ N);
  498   //                                 }
  499   //                                 
  500   //                                 this.cac heManager  = (CacheMa nager)unca stCacheMan ager;
  501   //                        }
  502   //                        catch  (ClassCast Exception  ccX)
  503   //                        {
  504   //                                 logger.e rror(
  505   //                                          "A referen ce to '" +  uncastCac heManager. getClass() .getName()  
  506   //                                          + "{" + un castCacheM anager.get Class().ge tClassLoad er().toStr ing() + "} "  
  507   //                                          + "' was o btained fr om '" + JN DI_CACHE_M ANAGER_FQN  + 
  508   //                                          "' but cas ting to '"
  509   //                                          + CacheMan ager.class .getName()
  510   //                                          + "{" + Ca cheManager .class.get ClassLoade r().toStri ng() + "}"   
  511   //                                          + " failed .  "
  512   //                                          + "If the  Class Load ers differ  this may  indicate t hat an ext ra copy of  either Ca cheManager  or CacheM anagerImpl  is refere nced from  the web ap p class lo ader."
  513   //                                 );
  514   //                                 this.cac heManager  = null;
  515   //                        }
  516   //                                 
  517   //                        logger .info("Cac he manager  reference  " + (this .cacheMana ger == nul l ? "IS NU LL" : "IS  NOT NULL")  + ".");
  518   //                        if(thi s.cacheMan ager == nu ll)
  519   //                                 throw ne w Assertio nError("Ca che manage r referenc e IS NULL. ");
  520   //               }
  521   //               catc h (NamingE xception e )
  522   //               {
  523   //                        e.prin tStackTrac e();
  524   //                        logger .error(e);
  525   //                        throw  new Assert ionError(e .getMessag e());
  526   //               }
  527   //      }
  528   }