|
XBRLAPIA Java API for XBRL |
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.xbrlapi.cache.CacheImpl
public class CacheImpl
Translates 1. original URIs into cache File objects or cache URI objects 2. cache URIs into original URI objects The translation from cache URIs to original URIs is a hack that enables relative URIs in cached files to be identified as such an resolved to obtain the original URI of the resource identified by the relative URI. This class also provides a method for testing if a URI is a cache URI.
| Constructor Summary | |
|---|---|
CacheImpl(File cacheRoot)
Constructs a URI translator for usage with a local cache location. |
|
CacheImpl(File cacheRoot,
HashMap<URI,URI> uriMap)
Constructs a URI translator for usage with a local cache location. |
|
| Method Summary | |
|---|---|
void |
copyToCache(URI originalURI,
File cacheFile)
Copy the original resource into the local cache if the resource exists and is able to be copied into the cache and does nothing otherwise. |
void |
copyToCache(URI originalURI,
String xml)
Copy the original resource into the local cache. |
boolean |
equals(Object obj)
|
List<URI> |
getAllUris(URI uri)
This method provides a useful means of getting a list of the URIs for all documents in a branch of the cache. |
File |
getCacheFile(URI uri)
Gets the cache file for an original URI. |
File |
getCacheRoot()
|
URI |
getCacheURI(URI uri)
TODO Modify to use the java.net.URIEncoder and java.net.URIDecoder classes. |
URI |
getOriginalURI(File file)
|
URI |
getOriginalURI(URI uri)
|
int |
hashCode()
|
boolean |
isCacheURI(URI uri)
Tests if a URI is a URI of a resource in the local cache. |
void |
purge(URI uri)
Delete a resource from the cache. |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public CacheImpl(File cacheRoot)
throws XBRLException
cacheRoot - The root directory for the cache.
XBRLException - if the cacheRoot is null or does not exist or cannot be
written to or read from.
public CacheImpl(File cacheRoot,
HashMap<URI,URI> uriMap)
throws XBRLException
cacheRoot - uriMap - The hash map from original URIs to local URIs.
XBRLException - if the cacheRoot is null or does not exist| Method Detail |
|---|
public boolean isCacheURI(URI uri)
throws XBRLException
Cache
isCacheURI in interface Cacheuri - The URI to be tested to see if it identifies a
resource in the local cache.
XBRLException - if the URI status as a cache URI cannot be determined.Cache.isCacheURI(java.net.URI)
public URI getCacheURI(URI uri)
throws XBRLException
Cache
getCacheURI in interface Cacheuri - The URI to be translated into a cache URI (if necessary).
XBRLException - if the resource cannot be cached.Cache.getCacheURI(java.net.URI)
public URI getOriginalURI(URI uri)
throws XBRLException
getOriginalURI in interface Cacheuri - The URI to be translated into an original URI (if necessary).
XBRLException - if a caching operation fails
or if a cache file cannot be translated into a URI.Cache.getOriginalURI(java.net.URI)
public URI getOriginalURI(File file)
throws XBRLException
getOriginalURI in interface Cachefile - The file to be translated into an original URI (if necessary).
XBRLException - if a caching operation fails
or if a cache file cannot be translated into a URI.Cache.getOriginalURI(File)
public File getCacheFile(URI uri)
throws XBRLException
Cache
getCacheFile in interface Cacheuri - The URI to obtain the cache file for,
XBRLException - if the URI cannot be translated into
a location in the local cache.Cache.getCacheFile(java.net.URI)
public void copyToCache(URI originalURI,
File cacheFile)
Cache
copyToCache in interface CacheoriginalURI - the URI of the resource to be copied into the cache.cacheFile - The file to be used to store the cache version of the resource.Cache.copyToCache(java.net.URI, java.io.File)
public void copyToCache(URI originalURI,
String xml)
throws XBRLException
Cache
copyToCache in interface CacheoriginalURI - the URI of the resource to be copied into the cache.xml - The XML to store in the cache at the given URI.
XBRLException - if the resource cannot be copied into the local cache.Cache.copyToCache(java.net.URI, java.lang.String)
public void purge(URI uri)
throws XBRLException
Cache
purge in interface Cacheuri - The original or the cache URI.
XBRLException - if the cache file cannot be determined.Cache.purge(java.net.URI)public File getCacheRoot()
public List<URI> getAllUris(URI uri)
throws XBRLException
Cache
getAllUris in interface Cacheuri - A URI that corresponds to a directory or file in the cache.
XBRLExceptionCache.getAllUris(URI)public int hashCode()
hashCode in class ObjectObject.hashCode()public boolean equals(Object obj)
equals in class ObjectObject.equals(java.lang.Object)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||