[MOBY-guts] biomoby commit

Paul Gordon gordonp at dev.open-bio.org
Wed Dec 5 17:33:10 UTC 2007


gordonp
Wed Dec  5 12:33:10 EST 2007
Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/registry/meta
In directory dev.open-bio.org:/tmp/cvs-serv22710/src/main/org/biomoby/registry/meta

Modified Files:
	RegistryCache.java 
Log Message:
Added return of cached File object to caching calls
moby-live/Java/src/main/org/biomoby/registry/meta RegistryCache.java,1.4,1.5
===================================================================
RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/registry/meta/RegistryCache.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- /home/repository/moby/moby-live/Java/src/main/org/biomoby/registry/meta/RegistryCache.java	2007/12/05 17:12:20	1.4
+++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/registry/meta/RegistryCache.java	2007/12/05 17:33:10	1.5
@@ -48,17 +48,21 @@
      * Stores the given resource to a file for retrieval later with getOntologyFile().
      *
      * @param resourceName one of the resources listed in org.biomoby.shared.Central
+     *
+     * @return the file where the resource has been cached
      */
-    public static void cacheRegistryOntology(Registry reg, String resourceName) throws Exception{
-	cacheRegistryOntology(reg, resourceName, -1);
+    public static File cacheRegistryOntology(Registry reg, String resourceName) throws Exception{
+	return cacheRegistryOntology(reg, resourceName, -1);
     }
 
     /**
      * Stores the given resource to a file for retrieval later with getOntologyFile().
      *
+     * @param resourceName one of the resources listed in org.biomoby.shared.Central
      * @param 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.
+     * @return the file where the resource has been cached
      */
-    public static void cacheRegistryOntology(Registry reg, String resourceName, int allowedAgeMillis) throws Exception{
+    public static File cacheRegistryOntology(Registry reg, String resourceName, int allowedAgeMillis) throws Exception{
 	if(resourceName == null){
 	    throw new NullPointerException("The resource to be cached was null");
 	}
@@ -67,7 +71,7 @@
 	    reg = getDefaultRegistry();
 	}
 	if(reg == null){
-	    return; // We can't even get a default registry: abandon ship!
+	    throw new MobyException("No registry, even the default one, could be found.  Ontology caching aborted"); // We can't even get a default registry: abandon ship!
 	}
 
 	File cacheFile = null;
@@ -103,6 +107,8 @@
 	    
 	    cacheFileWriter.close();
 	}
+
+	return cacheFile;
     }
 
     public synchronized static Registry getDefaultRegistry(){




More information about the MOBY-guts mailing list