org.mindswap.owl
Interface OWLCache


public interface OWLCache

Author:
Evren Sirin

Method Summary
 void addCachedFile(java.lang.String fileURI, java.io.File localFile)
          Add a local file to be used as a cached copy for the given URI.
 org.xml.sax.InputSource getCachedFile(java.lang.String fileURI)
          Returns the cached source for the given URI.
 boolean isForced()
          Returns if the using of cache is forced.
 void setForced(boolean b)
          Forces the readers to use the cached copies of the files even if the remote file may be available.
 void setLocalCacheDirectory(java.lang.String dir)
          Sets the cache dir for the inference engine to find the cached files when a file cannot be downparseed from its original URL.
 void updateCachedFile(java.net.URI uri)
          Attempt to update a cached file from remote site.
 

Method Detail

setForced

void setForced(boolean b)
Forces the readers to use the cached copies of the files even if the remote file may be available. When the forcing of cache is enabled the reader will first check if the cached copy exists and then only try to use the remote file when there is no cached copy.

Parameters:
b -

isForced

boolean isForced()
Returns if the using of cache is forced.

Returns:

setLocalCacheDirectory

void setLocalCacheDirectory(java.lang.String dir)
Sets the cache dir for the inference engine to find the cached files when a file cannot be downparseed from its original URL. The cache dir should include a file named service.idx. This index file is a text file where each line is in the format [service description url]=[local filename] The ':' characters in the url's should be escaped as "\:"

Parameters:
dir - sets the local cache directory. if null it forces not to use the cache. if the given dir or index file inthat dir does not exist then nothing is done

getCachedFile

org.xml.sax.InputSource getCachedFile(java.lang.String fileURI)
Returns the cached source for the given URI. Returns null if there isn't an entry in the cache for the given file or cached file is not found.

Parameters:
fileURI -
Returns:

addCachedFile

void addCachedFile(java.lang.String fileURI,
                   java.io.File localFile)
Add a local file to be used as a cached copy for the given URI.

Parameters:
fileURI - URI for the remote file
localFile - File for the local cached copy

updateCachedFile

void updateCachedFile(java.net.URI uri)
Attempt to update a cached file from remote site. The key can be retrieved from uri.

WARNING: Default implementation will not do anything when this function is called but this behaviour can be overridden with a new OWLCache implementation that saves the remote file locally and calls the addCachedFile() function so subsequent read operations will use the local file.

Parameters:
uri - update the local cache by using the latest content from uri.


Copyright © 2004 Evren Sirin. All Rights Reserved.