public ResourceManager( final ResourceManager parent, final ResourceManagerBackend backend ) { if ( backend == null ) { throw new NullPointerException(); } if ( parent == null ) { throw new NullPointerException(); } this.backend = backend; this.bundleCache = parent.getBundleCache(); this.dataCache = parent.getDataCache(); this.factoryCache = parent.getFactoryCache(); registerDefaults(); }
public synchronized ResourceData loadRawData( final ResourceKey key ) throws UnrecognizedLoaderException, ResourceLoadingException { final ResourceDataCache dataCache = getDataCache(); // Alternative 3: This is a plain resource and not contained in a bundle. Load as binary data final ResourceDataCacheEntry cached = dataCache.get( key ); if ( cached != null ) { final ResourceData data = cached.getData(); if ( data != null ) { if ( isValidData( cached, data ) ) { return data; } dataCache.remove( data ); } } final ResourceData data = backend.loadRawData( this, key ); if ( data != null && isResourceDataCacheable( data ) ) { dataCache.put( this, data ); } return data; }
int counter = 1; while ( bundleKey != null ) { final ResourceDataCacheEntry bundleRawDataCacheEntry = getDataCache().get( bundleKey ); if ( bundleRawDataCacheEntry != null ) { final ResourceData bundleRawData = bundleRawDataCacheEntry.getData(); return data; getDataCache().remove( bundleRawData );