public class LoadableResource
extends java.lang.Object
Constructor and Description |
---|
LoadableResource(java.lang.String resourceId,
LoaderService.UpdatePolicy updatePolicy,
java.net.URL fallbackLocation,
java.net.URL... locations)
Create a new instance.
|
Modifier and Type | Method and Description |
---|---|
int |
getAccessCount()
Get the number of successful accesses.
|
java.net.URL |
getCachedResource()
Get the URL of the locally cached resource.
|
byte[] |
getData()
Get the resource data.
|
java.io.InputStream |
getDataStream()
Get the resource data as input stream.
|
java.net.URL |
getFallbackResource()
Return the fallback location.
|
long |
getLastLoaded()
Get the timestamp of the last succesful load.
|
int |
getLoadCount()
Get the number of active loads of this resource (InputStream).
|
java.util.List<java.net.URL> |
getRemoteResources()
Get the remote locations.
|
java.lang.String |
getResourceId()
Get the resourceId.
|
java.util.Map<java.lang.String,java.lang.String> |
getUpdateConfig()
Access the registration config.
|
LoaderService.UpdatePolicy |
getUpdatePolicy()
Get the
LoaderService.UpdatePolicy . |
boolean |
load()
Loads the resource, first from the remote resources, if that fails from
the fallback location.
|
boolean |
loadFallback()
Try to load the resource from the faööback resources.
|
boolean |
loadRemote()
Try to load the resource from the remote locations.
|
boolean |
reset()
Explcitly override the resource wih the fallback context and resets the
load counter.
|
java.lang.String |
toString() |
void |
unload()
Unloads the data.
|
public LoadableResource(java.lang.String resourceId, LoaderService.UpdatePolicy updatePolicy, java.net.URL fallbackLocation, java.net.URL... locations)
resourceId
- The dataId.updatePolicy
- The LoaderService.UpdatePolicy
, not null.fallbackLocation
- teh fallback ULR, not null.locations
- the remote locations, not null (but may be empty!)public final int getAccessCount()
public final java.net.URL getCachedResource()
public final byte[] getData()
public java.io.InputStream getDataStream()
public final java.net.URL getFallbackResource()
public final long getLastLoaded()
public final int getLoadCount()
public final java.util.List<java.net.URL> getRemoteResources()
public final java.lang.String getResourceId()
public java.util.Map<java.lang.String,java.lang.String> getUpdateConfig()
public LoaderService.UpdatePolicy getUpdatePolicy()
LoaderService.UpdatePolicy
.public boolean load()
public boolean loadFallback()
public boolean loadRemote()
public boolean reset() throws java.io.IOException
java.io.IOException
public java.lang.String toString()
toString
in class java.lang.Object
public void unload()