/** * Default Constructor. */ public ResourceManager() { this( new DefaultResourceManagerBackend() ); }
public synchronized URL toURL( final ResourceKey key ) { if ( key == null ) { throw new NullPointerException(); } final ResourceLoader loader = findBySchema( key ); if ( loader == null ) { return null; } return loader.toURL( key ); }
return autoCreateResource( frontEnd, data, context ); for ( int i = 0; i < factoryCount; i++ ) { final ResourceFactory fact = factories[ i ]; if ( isSupportedTarget( targetClass, fact ) == false ) {
public void registerDefaultLoaders() { if ( registeredLoaders == true ) { return; } registeredLoaders = true; final Configuration config = LibLoaderBoot.getInstance().getGlobalConfig(); final Iterator<String> it = config.findPropertyKeys( ResourceManager.LOADER_PREFIX ); while ( it.hasNext() ) { final String key = it.next(); final String value = config.getConfigProperty( key ); final ResourceLoader loader = ObjectUtilities.loadAndInstantiate( value, ResourceManager.class, ResourceLoader.class ); if ( loader != null ) { //Log.debug("Registering loader for " + loader.getSchema()); registerLoader( loader ); } } final Iterator bit = config.findPropertyKeys( ResourceManager.BUNDLE_LOADER_PREFIX ); while ( bit.hasNext() ) { final String key = (String) bit.next(); final String value = config.getConfigProperty( key ); final ResourceBundleLoader loader = ObjectUtilities.loadAndInstantiate( value, ResourceManager.class, ResourceBundleLoader.class ); if ( loader != null ) { //Log.debug("Registering loader for " + loader.getSchema()); registerBundleLoader( loader ); } } }
public String serialize( final ResourceKey bundleKey, final ResourceKey key ) throws ResourceException { if ( loader.isSupportedKey( key ) ) { return loader.serialize( bundleKey, key ); } final String serializedVersion = backend.serialize( bundleKey, key ); if ( serializedVersion != null ) { return serializedVersion; } return super.serialize( bundleKey, key ); } }
public void registerDefaultFactories() { if ( registeredFactories == true ) { return; } registeredFactories = true; final Configuration config = LibLoaderBoot.getInstance().getGlobalConfig(); final Iterator itType = config.findPropertyKeys( ResourceManager.FACTORY_TYPE_PREFIX ); while ( itType.hasNext() ) { final String key = (String) itType.next(); final String factoryClass = config.getConfigProperty( key ); final ResourceFactory factory = ObjectUtilities.loadAndInstantiate( factoryClass, ResourceManager.class, ResourceFactory.class ); if ( factory == null ) { continue; } factory.initializeDefaults(); registerFactory( factory ); } }
return createKey( path, parameters );
public ResourceData loadRawData( final ResourceManager frontEnd, final ResourceKey key ) throws UnrecognizedLoaderException, ResourceLoadingException { if ( frontEnd == null ) { throw new NullPointerException(); } if ( key == null ) { throw new NullPointerException(); } final ResourceLoader loader = findBySchema( key ); if ( loader == null ) { throw new UnrecognizedLoaderException( "Invalid key: No resource-loader registered for schema: " + key.getSchema() ); } logger.debug( "Loaded " + key ); return loader.load( key ); }