Produced by Araxis Merge on 12/5/2017 12:06:43 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.
| # | Location | File | Last Modified |
|---|---|---|---|
| 1 | IV-eHMP_CIF.zip\IMAG_Source\VISA\Java\ImagingCacheImpl\main\src\java\gov\va\med\imaging\storage\cache\impl | CacheFactory.java | Mon Dec 4 21:35:26 2017 UTC |
| 2 | IV-eHMP_CIF.zip\IMAG_Source\VISA\Java\ImagingCacheImpl\main\src\java\gov\va\med\imaging\storage\cache\impl | CacheFactory.java | Mon Dec 4 22:01:31 2017 UTC |
| Description | Between Files 1 and 2 |
|
|---|---|---|
| Text Blocks | Lines | |
| Unchanged | 2 | 942 |
| Changed | 1 | 2 |
| Inserted | 0 | 0 |
| Removed | 0 | 0 |
| 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 |
No regular expressions were active.
| 1 | /** | |
| 2 | * | |
| 3 | */ | |
| 4 | package go v.va.med.i maging.sto rage.cache .impl; | |
| 5 | ||
| 6 | import gov .va.med.im aging.stor age.cache. Cache; | |
| 7 | import gov .va.med.im aging.stor age.cache. EvictionSt rategy; | |
| 8 | import gov .va.med.im aging.stor age.cache. EvictionTi mer; | |
| 9 | import gov .va.med.im aging.stor age.cache. Region; | |
| 10 | import gov .va.med.im aging.stor age.cache. exceptions .CacheExce ption; | |
| 11 | import gov .va.med.im aging.stor age.cache. exceptions .CacheInit ialization Exception; | |
| 12 | import gov .va.med.im aging.stor age.cache. exceptions .Initializ ationExcep tion; | |
| 13 | import gov .va.med.im aging.stor age.cache. exceptions .InvalidSw eepSpecifi cation; | |
| 14 | import gov .va.med.im aging.stor age.cache. impl.evict ion.Evicti onStrategy Factory; | |
| 15 | import gov .va.med.im aging.stor age.cache. memento.*; | |
| 16 | import gov .va.med.im aging.stor age.cache. timer.Evic tionTimerI mpl; | |
| 17 | ||
| 18 | import jav a.beans.XM LDecoder; | |
| 19 | import jav a.io.Input Stream; | |
| 20 | import jav a.lang.ref lect.Invoc ationTarge tException ; | |
| 21 | import jav a.lang.ref lect.Metho d; | |
| 22 | import jav a.net.URI; | |
| 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 | * @author
|
|
| 31 | * | |
| 32 | * A facto ry that cr eate Cache instances , the type of which is based o n one of: | |
| 33 | * 1.) a m emento typ e | |
| 34 | * 2.) a l ocation UR L | |
| 35 | * | |
| 36 | */ | |
| 37 | public cla ss CacheFa ctory | |
| 38 | { | |
| 39 | // the creat e mode is passed in when creat ing a new cache from scratch ( i.e. not f rom a meme nto) | |
| 40 | // the Creat eMode is p assed as a String (i .e. CREATE .toString( )) rather than the e num value | |
| 41 | // so that a pplication specific configurat ors may be specified | |
| 42 | pu blic enum CreateMode | |
| 43 | { | |
| 44 | CREA TE, // confi gure with no evictio n strategi es and no regions | |
| 45 | CREA TE_TEST, // con figure wit h test reg ions and s hort term evictions | |
| 46 | CREA TE_TEST_NO _EVICTION // c onfigure w ith test r egions and no evicti on | |
| 47 | }; | |
| 48 | ||
| 49 | pr ivate stat ic CacheFa ctory sing leton; | |
| 50 | // a map fro m the pers istence pr otocol to the cache and cache configurat or that su pports the protocol | |
| 51 | pr ivate stat ic Protoco lCacheImpl ementation Map protoc olCacheImp lementatio nMap; | |
| 52 | pr ivate Logg er logger = LogManag er.getLogg er(this.ge tClass()); | |
| 53 | ||
| 54 | st atic | |
| 55 | { | |
| 56 | // a map from the persis tence prot ocol to th e cache an d cache co nfigurator that supp orts the p rotocol | |
| 57 | prot ocolCacheI mplementat ionMap = n ew Protoco lCacheImpl ementation Map(); | |
| 58 | ||
| 59 | prot ocolCacheI mplementat ionMap.put ( | |
| 60 | gov.va.m ed.imaging .storage.c ache.impl. filesystem .FileSyste mCache.pro tocol, | |
| 61 | gov.va.m ed.imaging .storage.c ache.impl. filesystem .FileSyste mCache.cla ss, | |
| 62 | gov.va.m ed.imaging .storage.c ache.impl. filesystem .FileSyste mCacheConf igurator.c lass, | |
| 63 | gov.va.m ed.imaging .storage.c ache.impl. filesystem .memento.F ileSystemC acheMement o.class); | |
| 64 | ||
| 65 | prot ocolCacheI mplementat ionMap.put ( | |
| 66 | gov.va.m ed.imaging .storage.c ache.impl. jcifs.Jcif sCache.pro tocol, | |
| 67 | gov.va.m ed.imaging .storage.c ache.impl. jcifs.Jcif sCache.cla ss, | |
| 68 | gov.va.m ed.imaging .storage.c ache.impl. jcifs.Jcif sCacheConf igurator.c lass, | |
| 69 | gov.va.m ed.imaging .storage.c ache.impl. jcifs.meme nto.JcifsC acheMement o.class); | |
| 70 | ||
| 71 | prot ocolCacheI mplementat ionMap.put ( | |
| 72 | gov.va.m ed.imaging .storage.c ache.impl. memory.Mem oryCache.p rotocol, | |
| 73 | gov.va.m ed.imaging .storage.c ache.impl. memory.Mem oryCache.c lass, | |
| 74 | gov.va.m ed.imaging .storage.c ache.impl. memory.Mem oryCacheCo nfigurator .class, | |
| 75 | gov.va.m ed.imaging .storage.c ache.impl. memory.mem ento.Memor yCacheMeme nto.class) ; | |
| 76 | }; | |
| 77 | ||
| 78 | pu blic stati c synchron ized Cache Factory ge tSingleton () | |
| 79 | { | |
| 80 | if(s ingleton = = null) | |
| 81 | single ton = new CacheFacto ry(); | |
| 82 | ||
| 83 | retu rn singlet on; | |
| 84 | } | |
| 85 | ||
| 86 | /* * | |
| 87 | * | |
| 88 | * / | |
| 89 | pr ivate Cach eFactory() | |
| 90 | { | |
| 91 | ||
| 92 | } | |
| 93 | ||
| 94 | /* * | |
| 95 | * Use this method to create a c ache insta nce from a cache mem ento insta nce. | |
| 96 | * | |
| 97 | * @param me mento | |
| 98 | * @return | |
| 99 | * @throws C acheInitia lizationEx ception | |
| 100 | * / | |
| 101 | pu blic Cache createCac he(CacheMe mento meme nto) | |
| 102 | th rows Cache Initializa tionExcept ion | |
| 103 | { | |
| 104 | Clas s<? extend s Cache> c acheClass = protocol CacheImple mentationM ap.getCach eClass(mem ento); | |
| 105 | ||
| 106 | Cach e cache = createCach eInstance( memento, c acheClass) ; | |
| 107 | //co nfigurator = createC onfigurato rInstance( protocol, configurat orClass, c onfigurato r); | |
| 108 | ||
| 109 | retu rn cache; | |
| 110 | } | |
| 111 | ||
| 112 | /* * | |
| 113 | * Use this factory me thod to cr eate a new uninitial ized Cache . | |
| 114 | * | |
| 115 | * @param pr otocol | |
| 116 | * @param na me | |
| 117 | * @return | |
| 118 | * @throws M BeanExcept ion | |
| 119 | * @throws C acheExcept ion | |
| 120 | * / | |
| 121 | pu blic Cache createCac he(String cacheName, URI locat ionUri, St ring proto typeName) | |
| 122 | th rows Cache Exception | |
| 123 | { | |
| 124 | Stri ng protoco l = locati onUri.getS cheme(); | |
| 125 | Stri ng locatio n = locati onUri.getP ath(); | |
| 126 | ||
| 127 | logg er.info(ge tClass().g etSimpleNa me() + ".c reateCache ('" + loc ationUri.t oString() + ")"); | |
| 128 | logg er.info(ge tClass().g etSimpleNa me() + ".c reateCache protocol ='" + prot ocol + "', location= '" + locat ion + "'." ); | |
| 129 | ||
| 130 | Clas s<? extend s Cache> c acheClass = getImple mentingCac heClass(lo cationUri) ; | |
| 131 | Clas s<? extend s CacheCon figurator> cacheConf iguratorCl ass = getI mplementin gCacheConf iguratorCl ass(locati onUri); | |
| 132 | ||
| 133 | logg er.info(ge tClass().g etSimpleNa me() + ".c reateCache cacheClas s='" + cac heClass.ge tName() + "'" ); | |
| 134 | ||
| 135 | Cach e cache = createCach eInstance( cacheName, cacheClas s, cacheCo nfigurator Class, loc ationUri, null); | |
| 136 | //co nfigurator = createC onfigurato rInstance( protocol, configurat orClass, c onfigurato r); | |
| 137 | ||
| 138 | if(p rototypeNa me != null ) | |
| 139 | config ureCache(c ache, prot otypeName) ; | |
| 140 | ||
| 141 | retu rn cache; | |
| 142 | } | |
| 143 | ||
| 144 | /* * | |
| 145 | * Create a cache, giv en a proto type in th e given in put stream . | |
| 146 | * | |
| 147 | * @param ca cheName | |
| 148 | * @param lo cationUri | |
| 149 | * @param pr ototype | |
| 150 | * @return | |
| 151 | * @throws C acheExcept ion | |
| 152 | * / | |
| 153 | pu blic Cache createCac he(String cacheName, URI locat ionUri, In putStream prototype) | |
| 154 | th rows Cache Exception | |
| 155 | { | |
| 156 | Stri ng protoco l = locati onUri.getS cheme(); | |
| 157 | Stri ng locatio n = locati onUri.getP ath(); | |
| 158 | ||
| 159 | logg er.info(ge tClass().g etSimpleNa me() + ".c reateCache ('" + loc ationUri.t oString() + ")"); | |
| 160 | logg er.info(ge tClass().g etSimpleNa me() + ".c reateCache protocol ='" + prot ocol + "', location= '" + locat ion + "'." ); | |
| 161 | ||
| 162 | Clas s<? extend s Cache> c acheClass = getImple mentingCac heClass(lo cationUri) ; | |
| 163 | Clas s<? extend s CacheCon figurator> cacheConf iguratorCl ass = getI mplementin gCacheConf iguratorCl ass(locati onUri); | |
| 164 | ||
| 165 | logg er.info(ge tClass().g etSimpleNa me() + ".c reateCache cacheClas s='" + cac heClass.ge tName() + "'" ); | |
| 166 | ||
| 167 | Cach e cache = createCach eInstance( cacheName, cacheClas s, cacheCo nfigurator Class, loc ationUri, null); | |
| 168 | //co nfigurator = createC onfigurato rInstance( protocol, configurat orClass, c onfigurato r); | |
| 169 | ||
| 170 | if(p rototype ! = null) | |
| 171 | config ureCache(c ache, prot otype); | |
| 172 | ||
| 173 | retu rn cache; | |
| 174 | } | |
| 175 | ||
| 176 | /* * | |
| 177 | * This meth od takes a n unconfig ured cache and runs the given configurat ion | |
| 178 | * strategy on it. Th e configur ation stra tegy name is a resou rce name o f an XMLEn coded | |
| 179 | * CacheConf igurationS trategyMem ento insta nce. | |
| 180 | * | |
| 181 | * @param ca che | |
| 182 | * @param pr ototypeNam e | |
| 183 | * @throws C acheInitia lizationEx ception | |
| 184 | * / | |
| 185 | pr ivate void configure Cache(Cach e cache, S tring prot otypeName) | |
| 186 | th rows Cache Exception | |
| 187 | { | |
| 188 | logg er.info("C onfiguring cache '" + cache.ge tName() + "' as '" + prototype Name + "'. "); | |
| 189 | ||
| 190 | // l ook for th e prototyp e first fr om the roo t and then in the pr ototype di r | |
| 191 | Inpu tStream in Stream = g etClass(). getClassLo ader().get ResourceAs Stream(pro totypeName ); | |
| 192 | if(i nStream == null) | |
| 193 | { | |
| 194 | String standardi zedName = "prototype /" + proto typeName + ".xml"; | |
| 195 | inStre am = getCl ass().getC lassLoader ().getReso urceAsStre am(standar dizedName) ; | |
| 196 | if(inS tream == n ull) | |
| 197 | throw ne w CacheIni tializatio nException ("Unable t o access r esource '" + prototy peName + " ' to confi gure cache , also loo ked in '" + standard izedName + "'."); | |
| 198 | } | |
| 199 | conf igureCache (cache, in Stream); | |
| 200 | } | |
| 201 | ||
| 202 | /* * | |
| 203 | * Takes an unconfigur ed cache a nd applies the confi guration f rom the in put stream . | |
| 204 | * | |
| 205 | * @param ca che | |
| 206 | * @param pr ototype | |
| 207 | * @throws C acheExcept ion | |
| 208 | * / | |
| 209 | pr ivate void configure Cache(Cach e cache, I nputStream prototype ) | |
| 210 | th rows Cache Exception | |
| 211 | { | |
| 212 | logg er.info("C onfiguring cache '" + cache.ge tName() + "' as from prototype input str eam."); | |
| 213 | ||
| 214 | if(p rototype = = null) | |
| 215 | throw new CacheI nitializat ionExcepti on("Unable to access resource prototype input stre am to conf igure cach e"); | |
| 216 | ||
| 217 | XMLD ecoder dec oder = new XMLDecode r(prototyp e); | |
| 218 | Cach eConfigura tionMement o memento = (CacheCo nfiguratio nMemento)d ecoder.rea dObject(); | |
| 219 | deco der.close( ); | |
| 220 | ||
| 221 | conf igureCache (cache, me mento); | |
| 222 | } | |
| 223 | ||
| 224 | /* * | |
| 225 | * | |
| 226 | * @param ca che | |
| 227 | * @param me mento | |
| 228 | * @throws C acheExcept ion | |
| 229 | * / | |
| 230 | pr ivate void configure Cache(Cach e cache, C acheConfig urationMem ento memen to) | |
| 231 | th rows Cache Exception | |
| 232 | { | |
| 233 | Evic tionStrate gyFactory evictionSt rategyFact ory = Evic tionStrate gyFactory. getSinglet on(); | |
| 234 | // c reate and add the ev iction str ategies | |
| 235 | if(m emento.get EvictionSt rategyMeme ntoes() != null) | |
| 236 | { | |
| 237 | for(Ev ictionStra tegyMement o eviction StrategyMe mento : me mento.getE victionStr ategyMemen toes()) | |
| 238 | { | |
| 239 | logger.i nfo("Creat ing evicti on strateg y '" + evi ctionStrat egyMemento .getName() + "'...") ; | |
| 240 | Eviction Strategy e victionStr ategy = ev ictionStra tegyFactor y.createEv ictionStra tegy(evict ionStrateg yMemento, cache.getE victionTim er()); | |
| 241 | logger.i nfo("Evict ion strate gy '" + ev ictionStra tegyMement o.getName( ) + "' cre ated."); | |
| 242 | cache.ad dEvictionS trategy(ev ictionStra tegy); | |
| 243 | logger.i nfo("Evict ion strate gy '" + ev ictionStra tegyMement o.getName( ) + "' add ed to cach e '" + cac he.getName () + "'.") ; | |
| 244 | } | |
| 245 | } | |
| 246 | if(m emento.get RegionMeme ntoes() != null) | |
| 247 | { | |
| 248 | for(Re gionMement o regionMe mento : me mento.getR egionMemen toes()) | |
| 249 | { | |
| 250 | logger.i nfo("Creat ing region '" + regi onMemento. getName() + "'..."); | |
| 251 | Region r egion = ca che.create Region(reg ionMemento ); | |
| 252 | logger.i nfo("Regio n '" + reg ionMemento .getName() + "' crea ted."); | |
| 253 | cache.ad dRegion(re gion); | |
| 254 | logger.i nfo("Regio n '" + reg ionMemento .getName() + "' adde d to cache '" + cach e.getName( ) + "'."); | |
| 255 | } | |
| 256 | } | |
| 257 | } | |
| 258 | ||
| 259 | pr ivate Clas s<? extend s Cache> g etImplemen tingCacheC lass(URI l ocationUri ) | |
| 260 | th rows Cache Initializa tionExcept ion | |
| 261 | { | |
| 262 | Stri ng protoco l = locati onUri.getS cheme(); | |
| 263 | ||
| 264 | Clas s<? extend s Cache> c acheClass = protocol CacheImple mentationM ap.getCach eClass(pro tocol); | |
| 265 | ||
| 266 | if(c acheClass == null) | |
| 267 | throw new CacheI nitializat ionExcepti on("Unable to find a Cache imp lementatio n that sup ports the '" + proto col + "' p rotocol.") ; | |
| 268 | ||
| 269 | retu rn cacheCl ass; | |
| 270 | } | |
| 271 | ||
| 272 | pr ivate Clas s<? extend s CacheCon figurator> getImplem entingCach eConfigura torClass(U RI locatio nUri) | |
| 273 | th rows Cache Initializa tionExcept ion | |
| 274 | { | |
| 275 | Stri ng protoco l = locati onUri.getS cheme(); | |
| 276 | ||
| 277 | Clas s<? extend s CacheCon figurator> configura torClass = protocolC acheImplem entationMa p.getConfi guratorCla ss(protoco l); | |
| 278 | ||
| 279 | if(c onfigurato rClass == null) | |
| 280 | throw new CacheI nitializat ionExcepti on("Unable to find a CacheConf igurator i mplementat ion that s upports th e '" + pro tocol + "' protocol. "); | |
| 281 | ||
| 282 | retu rn configu ratorClass ; | |
| 283 | } | |
| 284 | ||
| 285 | /* * | |
| 286 | * @param pr otocol | |
| 287 | * @param ca cheName | |
| 288 | * @param ca cheClass | |
| 289 | * @param ev ictionTime r | |
| 290 | * @throws C acheInitia lizationEx ception | |
| 291 | * / | |
| 292 | pr ivate Cach e createCa cheInstanc e( | |
| 293 | String cacheName , | |
| 294 | Class< ? extends Cache> cac heClass, | |
| 295 | Class< ? extends CacheConfi gurator> c acheConfig uratorClas s, | |
| 296 | URI lo cationUri, | |
| 297 | Evicti onTimer ev ictionTime r) | |
| 298 | th rows Cache Initializa tionExcept ion | |
| 299 | { | |
| 300 | try | |
| 301 | { | |
| 302 | if(evi ctionTimer == null & & cacheCon figuratorC lass != nu ll) | |
| 303 | eviction Timer = cr eateDefaul tEvictionT imerImpl(c acheConfig uratorClas s); | |
| 304 | ||
| 305 | Method factoryMe thod = cac heClass.ge tMethod("c reate", ne w Class[]{ String.cla ss, URI.cl ass, Evict ionTimer.c lass}); | |
| 306 | // ass ure that t he factory method ac tually ret urns an in stance of the cache class | |
| 307 | if( ! cacheClass .isAssigna bleFrom(fa ctoryMetho d.getRetur nType()) ) | |
| 308 | throw ne w CacheIni tializatio nException ( | |
| 309 | "E rror creat ing the ca che realiz ation '" + cacheClas s.getName( ) + "." + | |
| 310 | "A ssure that the facto ry method 'create(St ring, URI, EvictionT imer)' exi sts, is ac cessible a nd returns an instan ce of '" + cacheClas s.getName( ) + "'."); | |
| 311 | ||
| 312 | return (Cache)fa ctoryMetho d.invoke(n ull, new O bject[]{ca cheName, l ocationUri , eviction Timer}); | |
| 313 | } | |
| 314 | catc h (Securit yException x) | |
| 315 | { | |
| 316 | logger .error(x); | |
| 317 | throw new CacheI nitializat ionExcepti on( | |
| 318 | "SecurityE xception c reating th e cache re alization '" + cache Class.getN ame() + ". " + | |
| 319 | "Assure th at the fac tory metho d 'create( String, UR I, Evictio nTimer)' e xists and is accessi ble"); | |
| 320 | } | |
| 321 | catc h (Illegal ArgumentEx ception x) | |
| 322 | { | |
| 323 | logger .error(x); | |
| 324 | throw new CacheI nitializat ionExcepti on( | |
| 325 | "IllegalAr gumentExce ption crea ting the c ache reali zation '" + cacheCla ss.getName () + "." + | |
| 326 | "Assure th at the fac tory metho d 'create( String, UR I, Evictio nTimer)' e xists and is accessi ble"); | |
| 327 | } | |
| 328 | catc h (NoSuchM ethodExcep tion x) | |
| 329 | { | |
| 330 | logger .error(x); | |
| 331 | throw new CacheI nitializat ionExcepti on( | |
| 332 | "NoSuchMet hodExcepti on creatin g the cach e realizat ion '" + c acheClass. getName() + "." + | |
| 333 | "Assure th at the fac tory metho d 'create( String, UR I, Evictio nTimer)' e xists and is accessi ble"); | |
| 334 | } | |
| 335 | catc h (Illegal AccessExce ption x) | |
| 336 | { | |
| 337 | logger .error(x); | |
| 338 | throw new CacheI nitializat ionExcepti on( | |
| 339 | "IllegalAr gumentExce ption crea ting the c ache reali zation '" + cacheCla ss.getName () + "." + | |
| 340 | "Assure th at the fac tory metho d 'create( String, UR I, Evictio nTimer)' e xists and is accessi ble"); | |
| 341 | } | |
| 342 | catc h (Invocat ionTargetE xception x ) | |
| 343 | { | |
| 344 | logger .error(x); | |
| 345 | throw new CacheI nitializat ionExcepti on( | |
| 346 | "IllegalAr gumentExce ption crea ting the c ache reali zation '" + cacheCla ss.getName () + "." + | |
| 347 | "Assure th at the fac tory metho d 'create( String, UR I, Evictio nTimer)' e xists and is accessi ble"); | |
| 348 | } | |
| 349 | catc h (Instant iationExce ption x) | |
| 350 | { | |
| 351 | logger .error(x); | |
| 352 | throw new CacheI nitializat ionExcepti on( | |
| 353 | "IllegalAr gumentExce ption crea ting the c ache reali zation '" + cacheCla ss.getName () + "." + | |
| 354 | "Assure th at the fac tory metho d 'create( String, UR I, Evictio nTimer)' e xists and is accessi ble"); | |
| 355 | } | |
| 356 | } | |
| 357 | ||
| 358 | /* * | |
| 359 | * @param pr otocol | |
| 360 | * @param ca cheName | |
| 361 | * @param ca cheClass | |
| 362 | * @param ev ictionTime r | |
| 363 | * @throws C acheInitia lizationEx ception | |
| 364 | * / | |
| 365 | pr ivate Cach e createCa cheInstanc e( | |
| 366 | CacheM emento cac heMemento, | |
| 367 | Class< ? extends Cache> cac heClass) | |
| 368 | th rows Cache Initializa tionExcept ion | |
| 369 | { | |
| 370 | logg er.info("C reating ca che '" + c acheMement o.getName( ) + "' fro m memento as type '" + cacheCl ass.getNam e() + "'." ); | |
| 371 | try | |
| 372 | { | |
| 373 | Method factoryMe thod = cac heClass.ge tMethod("c reate", ne w Class[]{ CacheMemen to.class}) ; | |
| 374 | // ass ure that t he factory method ac tuall retu rns an ins tance of t he cache c lass | |
| 375 | if( ! cacheClass .isAssigna bleFrom(fa ctoryMetho d.getRetur nType()) ) | |
| 376 | throw ne w CacheIni tializatio nException ( | |
| 377 | "E rror creat ing the ca che realiz ation '" + cacheClas s.getName( ) + "." + | |
| 378 | "A ssure that the facto ry method 'create(St ring, URI, EvictionT imer)' exi sts, is ac cessible a nd returns an instan ce of '" + cacheClas s.getName( ) + "'."); | |
| 379 | ||
| 380 | return (Cache)fa ctoryMetho d.invoke(n ull, new O bject[]{ca cheMemento }); | |
| 381 | } | |
| 382 | catc h (Securit yException x) | |
| 383 | { | |
| 384 | logger .error(x); | |
| 385 | throw new CacheI nitializat ionExcepti on( | |
| 386 | "SecurityE xception c reating th e cache re alization '" + cache Class.getN ame() + ". " + | |
| 387 | "Assure th at the fac tory metho d 'create( CacheMemen to)' exist s and is a ccessible" ); | |
| 388 | } | |
| 389 | catc h (Illegal ArgumentEx ception x) | |
| 390 | { | |
| 391 | logger .error(x); | |
| 392 | throw new CacheI nitializat ionExcepti on( | |
| 393 | "IllegalAr gumentExce ption crea ting the c ache reali zation '" + cacheCla ss.getName () + "." + | |
| 394 | "Assure th at the fac tory metho d 'create( CacheMemen to)' exist s and is a ccessible" ); | |
| 395 | } | |
| 396 | catc h (NoSuchM ethodExcep tion x) | |
| 397 | { | |
| 398 | logger .error(x); | |
| 399 | throw new CacheI nitializat ionExcepti on( | |
| 400 | "NoSuchMet hodExcepti on creatin g the cach e realizat ion '" + c acheClass. getName() + "." + | |
| 401 | "Assure th at the fac tory metho d 'create( CacheMemen to)' exist s and is a ccessible" ); | |
| 402 | } | |
| 403 | catc h (Illegal AccessExce ption x) | |
| 404 | { | |
| 405 | logger .error(x); | |
| 406 | throw new CacheI nitializat ionExcepti on( | |
| 407 | "IllegalAc cessExcept ion creati ng the cac he realiza tion '" + cacheClass .getName() + "." + | |
| 408 | "Assure th at the fac tory metho d 'create( CacheMemen to)' exist s and is a ccessible" ); | |
| 409 | } | |
| 410 | catc h (Invocat ionTargetE xception x ) | |
| 411 | { | |
| 412 | x.prin tStackTrac e(); | |
| 413 | if(x.g etCause() != null) | |
| 414 | x.getCau se().print StackTrace (); | |
| 415 | logger .error(x); | |
| 416 | logger .error("CA USED BY .. ."); | |
| 417 | logger .error(x.g etCause()) ; | |
| 418 | throw new CacheI nitializat ionExcepti on( | |
| 419 | "Invocatio nTargetExc eption cre ating the cache real ization '" + cacheCl ass.getNam e() + ". \ n" + | |
| 420 | "Underlyin g exceptio n is '" + x.getCause ().getMess age() + "' . \n" + | |
| 421 | "Assure th at the fac tory metho d 'create( CacheMemen to)' exist s and is a ccessible" ); | |
| 422 | } | |
| 423 | } | |
| 424 | ||
| 425 | // ========= ========== ========== ========== ========== ========== ========== ========== ========== ========== ========== ========== ==== | |
| 426 | // Eviction Timer | |
| 427 | // ========= ========== ========== ========== ========== ========== ========== ========== ========== ========== ========== ========== ==== | |
| 428 | ||
| 429 | /* * | |
| 430 | * | |
| 431 | * @return | |
| 432 | * @throws I llegalAcce ssExceptio n | |
| 433 | * @throws I nstantiati onExceptio n | |
| 434 | * / | |
| 435 | pu blic Evict ionTimerIm pl createD efaultEvic tionTimerI mpl(Class< ? extends CacheConfi gurator> c onfigurato rClass) | |
| 436 | th rows Insta ntiationEx ception, I llegalAcce ssExceptio n | |
| 437 | { | |
| 438 | Cach eConfigura tor config urator = c onfigurato rClass.new Instance() ; | |
| 439 | try | |
| 440 | { | |
| 441 | return EvictionT imerImpl.c reate(conf igurator.g etEviction TimerSweep IntervalMa p()); | |
| 442 | } | |
| 443 | catc h (Initial izationExc eption iX) | |
| 444 | { | |
| 445 | logger .error(iX) ; | |
| 446 | return null; | |
| 447 | } | |
| 448 | catc h (Invalid SweepSpeci fication i ssX) | |
| 449 | { | |
| 450 | logger .error(iss X); | |
| 451 | return null; | |
| 452 | } | |
| 453 | } | |
| 454 | ||
| 455 | pu blic Evict ionTimerIm pl createE victionTim erImpl(Evi ctionTimer ImplMement o memento) | |
| 456 | { | |
| 457 | try | |
| 458 | { | |
| 459 | return EvictionT imerImpl.c reate( mem ento.getSw eepInterva lMap() ); | |
| 460 | } | |
| 461 | catc h (Initial izationExc eption iX) | |
| 462 | { | |
| 463 | logger .error(iX) ; | |
| 464 | return null; | |
| 465 | } | |
| 466 | catc h (Invalid SweepSpeci fication i ssX) | |
| 467 | { | |
| 468 | logger .error(iss X); | |
| 469 | return null; | |
| 470 | } | |
| 471 | } | |
| 472 | } |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.