Version: 1.1.1

org.biomoby.registry.meta
Class RegistryCache

java.lang.Object
  extended by org.biomoby.registry.meta.RegistryCache

public class RegistryCache
extends Object

A class for storing MOBY RDFs and Central calls to disk for reuse in other JVMs.

Author:
Paul Gordon

Field Summary
static String CALL_CACHE_FILE_PREFIX
           
static String REG_CACHE_FILE_PREFIX
           
 
Constructor Summary
RegistryCache()
           
 
Method Summary
static File cacheRegistryOntology(Registry reg, String resourceName)
          Stores the given resource to a file for retrieval later with getOntologyFile().
static File cacheRegistryOntology(Registry reg, String resourceName, long allowedAgeMillis)
          Stores the given resource to a file for retrieval later with getOntologyFile().
static File calcCentralCallFile(String centralEndpoint, String callKey)
          Reports where the message returned by the call should be stored on disk.
static File calcDataTypeOntologyFile(Registry reg)
           
static File calcNamespaceOntologyFile(Registry reg)
           
static File calcServiceOntologyFile(Registry reg)
           
static File calcServiceTypeOntologyFile(Registry reg)
           
static void deleteAllCacheFiles()
           
static void deleteExpiredCacheFiles(long allowedAgeMillis)
           
static File getCentralCallFile(String centralEndpoint, String callKey)
          Reports where the message returned by the call is stored on disk.
static Registry getDefaultRegistry()
           
static File getNamespaceOntologyFile(Registry reg)
           
static File getOntologyFile(Registry reg, String resourceName)
          Returns where a resource should be cached locally, whether it current exists or not.
static File getServiceOntologyFile(Registry reg)
           
static File getServiceTypeOntologyFile(Registry reg)
           
static void setTempDir(File dir)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

REG_CACHE_FILE_PREFIX

public static final String REG_CACHE_FILE_PREFIX
See Also:
Constant Field Values

CALL_CACHE_FILE_PREFIX

public static final String CALL_CACHE_FILE_PREFIX
See Also:
Constant Field Values
Constructor Detail

RegistryCache

public RegistryCache()
Method Detail

getOntologyFile

public static File getOntologyFile(Registry reg,
                                   String resourceName)
Returns where a resource should be cached locally, whether it current exists or not.

Parameters:
resourceName - one of the resources listed in org.biomoby.shared.Central

cacheRegistryOntology

public static File cacheRegistryOntology(Registry reg,
                                         String resourceName)
                                  throws Exception
Stores the given resource to a file for retrieval later with getOntologyFile().

Parameters:
resourceName - one of the resources listed in org.biomoby.shared.Central
Returns:
the file where the resource has been cached
Throws:
Exception

cacheRegistryOntology

public static File cacheRegistryOntology(Registry reg,
                                         String resourceName,
                                         long allowedAgeMillis)
                                  throws Exception
Stores the given resource to a file for retrieval later with getOntologyFile().

Parameters:
resourceName - one of the resources listed in org.biomoby.shared.Central
allowedAgeMillis - if the hached file exists and is less than this many milliseconds old, a new version will not be downloaded, if zero or negative, overwrite is forced.
Returns:
the file where the resource has been cached
Throws:
Exception

getDefaultRegistry

public static Registry getDefaultRegistry()

calcDataTypeOntologyFile

public static File calcDataTypeOntologyFile(Registry reg)

getServiceTypeOntologyFile

public static File getServiceTypeOntologyFile(Registry reg)

calcServiceTypeOntologyFile

public static File calcServiceTypeOntologyFile(Registry reg)

getNamespaceOntologyFile

public static File getNamespaceOntologyFile(Registry reg)

calcNamespaceOntologyFile

public static File calcNamespaceOntologyFile(Registry reg)

getServiceOntologyFile

public static File getServiceOntologyFile(Registry reg)

calcServiceOntologyFile

public static File calcServiceOntologyFile(Registry reg)

getCentralCallFile

public static File getCentralCallFile(String centralEndpoint,
                                      String callKey)
Reports where the message returned by the call is stored on disk.

Parameters:
callKey - a unique ID for the Moby Central call (i.e. the contents sent to CentralImpl.doCall())
Returns:
the File object for the cached file, or null if it does not exist

calcCentralCallFile

public static File calcCentralCallFile(String centralEndpoint,
                                       String callKey)
Reports where the message returned by the call should be stored on disk.

Parameters:
callKey - a unique ID for the Moby Central call (i.e. the contents sent to CentralImpl.doCall())
Returns:
the File object for the cache file

setTempDir

public static void setTempDir(File dir)
Parameters:
dir - directory where files should be stored, if null, the working directory

deleteExpiredCacheFiles

public static void deleteExpiredCacheFiles(long allowedAgeMillis)
Parameters:
allowedAgeMillis - files older than this are deleted, or if negative, all are deleted, or if zero, deleted at the end of the session

deleteAllCacheFiles

public static void deleteAllCacheFiles()

Version: 1.1.1

Submit a bug or feature
Generated: Sat May 29 04:26:35 EDT 2010