protected final void loadExtensionCache ( ) { // threshold for discarding old cache files long minModified = System . currentTimeMillis ( ) - MAX_CACHE_MILLIS ; File extFolder = XRuntimeUtils . getExtensionCacheFolder ( ) ; XExtension extension ; File [ ] extFiles = extFolder . listFiles ( ) ; if ( extFiles == null ) { // Extension folder may be non-existant for virtual users with no // home directory XLogging . log ( "Extension caching disabled (Could not access cache directory)!" , XLogging . Importance . WARNING ) ; return ; } for ( File extFile : extFiles ) { if ( extFile . getName ( ) . toLowerCase ( ) . endsWith ( ".xesext" ) == false ) { // no real extension continue ; } if ( extFile . lastModified ( ) < minModified ) { // remove outdated cache files if ( extFile . delete ( ) == false ) { extFile . deleteOnExit ( ) ; } } else { // load extension file try { extension = XExtensionParser . instance ( ) . parse ( extFile ) ; if ( extensionMap . containsKey ( ( extension ) . getUri ( ) ) == false ) { extensionMap . put ( extension . getUri ( ) , extension ) ; extensionList . add ( extension ) ; XLogging . log ( "Loaded XES extension '" + extension . getUri ( ) + "' from cache" , XLogging . Importance . DEBUG ) ; } else { XLogging . log ( "Skipping cached XES extension '" + extension . getUri ( ) + "' (already defined)" , XLogging . Importance . DEBUG ) ; } } catch ( IOException | ParserConfigurationException | SAXException e ) { // ignore bad apples for now e . printStackTrace ( ) ; } } } }
Loads all extensions stored in the local cache . Cached extensions which exceed the maximum caching age are discarded and downloaded freshly .