74. EPMO Open Source Coordination Office Redaction File Detail Report

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

74.1 Files compared

# Location File Last Modified
1 IV-eHMP_CIF.zip\IMAG_Source\VISA\Java\CacheWeb\src\gov\va\med\cache\gui\server ImagingCacheManagementServiceImpl.java Mon Dec 4 21:34:20 2017 UTC
2 IV-eHMP_CIF.zip\IMAG_Source\VISA\Java\CacheWeb\src\gov\va\med\cache\gui\server ImagingCacheManagementServiceImpl.java Mon Dec 4 21:58:01 2017 UTC

74.2 Comparison summary

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

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

74.4 Active regular expressions

No regular expressions were active.

74.5 Comparison detail

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