Package org.jppf.classloader.resource
Class ResourceCache
java.lang.Object
org.jppf.classloader.resource.ResourceCache
Instances of this class are used as cache for resources downloaded from a driver or client, using the JPPF class loader APIs.
- Author:
- Laurent Cohen
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Close this resource cache and clean all resources it uses.protected voidfinalize()static ResourceCachegetCacheInstance(String uuid) Get a cache instance form its uuid.List<org.jppf.location.Location<?>>getResourcesLocations(String name) Get the list of locations for the resource with the specified name.getResourcesURLs(String name) Get a list of URLs for the resource with the specified name.getResourceURL(String name) Get the URL for a cached resource.getUuid()Get the unique identifier for this resource cache.booleanDetermine whether this cache is enabled.voidregisterResource(String name, org.jppf.location.Location<?> location) Register the location of a resource with this cache.voidregisterResources(String name, List<byte[]> definitions) Save the definitions for a resource to temporary files, and register their location with this cache.
-
Constructor Details
-
ResourceCache
public ResourceCache(boolean enabled) Default initializations.- Parameters:
enabled- whether this cache is enabled.
-
-
Method Details
-
getResourcesLocations
Get the list of locations for the resource with the specified name.- Parameters:
name- the name of the resource to lookup.- Returns:
- a list of file paths, or null if the resource is not found in the cache.
-
getResourcesURLs
Get a list of URLs for the resource with the specified name.- Parameters:
name- the name of the resource to lookup.- Returns:
- a list of
URLs, or null if the resource is not found in the cache.
-
getResourceURL
Get the URL for a cached resource.- Parameters:
name- the name of the resource to find.- Returns:
- resource location expressed as a URL.
-
registerResources
Save the definitions for a resource to temporary files, and register their location with this cache.- Parameters:
name- the name of the resource to register.definitions- a list of byte array definitions.
-
registerResource
Register the location of a resource with this cache.- Parameters:
name- the name of the resource to register.location- a Location object holding or pointing to the resource defintion.
-
close
public void close()Close this resource cache and clean all resources it uses. -
finalize
-
getUuid
Get the unique identifier for this resource cache.- Returns:
- the uuid as a string.
-
getCacheInstance
Get a cache instance form its uuid.- Parameters:
uuid- the uuid of the cache to find.- Returns:
- a
ResourceCacheinstance.
-
isEnabled
public boolean isEnabled()Determine whether this cache is enabled.- Returns:
trueif this cache is enabled,falseotherwise.
-