com.jme3.asset
Class ImplHandler

java.lang.Object
  extended by com.jme3.asset.ImplHandler

public class ImplHandler
extends java.lang.Object

ImplHandler manages the asset loader and asset locator implementations in a thread safe way. This allows implementations which store local persistent data to operate with a multi-threaded system. This is done by keeping an instance of each asset loader and asset locator object in a thread local.


Nested Class Summary
protected  class ImplHandler.ImplThreadLocal<T>
           
 
Constructor Summary
ImplHandler(AssetManager assetManager)
           
 
Method Summary
 void addLoader(java.lang.Class<? extends AssetLoader> loaderType, java.lang.String... extensions)
           
 void addLocator(java.lang.Class<? extends AssetLocator> locatorType, java.lang.String rootPath)
           
 AssetLoader aquireLoader(AssetKey key)
          Returns the AssetLoader registered for the given extension of the current thread.
 void clearCache()
           
 void establishParentKey(AssetKey parentKey)
          Establishes the asset key that is used for tracking dependent assets that have failed to load.
<T extends AssetCache>
T
getCache(java.lang.Class<T> cacheClass)
           
 int getLocatorCount()
           
 AssetKey getParentKey()
           
<T extends AssetProcessor>
T
getProcessor(java.lang.Class<T> procClass)
           
 void releaseParentKey(AssetKey parentKey)
           
 void removeLoader(java.lang.Class<? extends AssetLoader> loaderType)
           
 void removeLocator(java.lang.Class<? extends AssetLocator> locatorType, java.lang.String rootPath)
           
 AssetInfo tryLocate(AssetKey key)
          Attempts to locate the given resource name.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ImplHandler

public ImplHandler(AssetManager assetManager)
Method Detail

establishParentKey

public void establishParentKey(AssetKey parentKey)
Establishes the asset key that is used for tracking dependent assets that have failed to load. When set, the DesktopAssetManager gets a hint that it should suppress AssetNotFoundExceptions and instead call the listener callback (if set).

Parameters:
parentKey - The parent key

releaseParentKey

public void releaseParentKey(AssetKey parentKey)

getParentKey

public AssetKey getParentKey()

tryLocate

public AssetInfo tryLocate(AssetKey key)
Attempts to locate the given resource name.

Parameters:
key - The full name of the resource.
Returns:
The AssetInfo containing resource information required for access, or null if not found.

getLocatorCount

public int getLocatorCount()

aquireLoader

public AssetLoader aquireLoader(AssetKey key)
Returns the AssetLoader registered for the given extension of the current thread.

Returns:
AssetLoader registered with addLoader.

clearCache

public void clearCache()

getCache

public <T extends AssetCache> T getCache(java.lang.Class<T> cacheClass)

getProcessor

public <T extends AssetProcessor> T getProcessor(java.lang.Class<T> procClass)

addLoader

public void addLoader(java.lang.Class<? extends AssetLoader> loaderType,
                      java.lang.String... extensions)

removeLoader

public void removeLoader(java.lang.Class<? extends AssetLoader> loaderType)

addLocator

public void addLocator(java.lang.Class<? extends AssetLocator> locatorType,
                       java.lang.String rootPath)

removeLocator

public void removeLocator(java.lang.Class<? extends AssetLocator> locatorType,
                          java.lang.String rootPath)