[MOBY-guts] biomoby commit

Eddie Kawas kawas at dev.open-bio.org
Tue Feb 26 15:40:02 UTC 2008


kawas
Tue Feb 26 10:40:01 EST 2008
Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/client
In directory dev.open-bio.org:/tmp/cvs-serv16249

Modified Files:
	CentralDigestCachedImpl.java 
Log Message:
made changs to fillServicesCache()
moby-live/Java/src/main/org/biomoby/client CentralDigestCachedImpl.java,1.25,1.26
===================================================================
RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/CentralDigestCachedImpl.java,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -r1.25 -r1.26
--- /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/CentralDigestCachedImpl.java	2008/02/25 16:25:53	1.25
+++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/CentralDigestCachedImpl.java	2008/02/26 15:40:01	1.26
@@ -238,16 +238,6 @@
 	    // check if RDF file exists ...
 	    if (!rdfExists(servicesCache)) {
 		try {
-		    // delete anything in the cache
-		    File[] filelist = servicesCache.listFiles();
-		    if (filelist != null) {
-                        Model m = null;
-    		        for (int i = 0; i < filelist.length; i++) {
-			    if (!ignored(filelist[i]))
-				remove(servicesCache, filelist[i].getName());
-			}
-		    }
-		    filelist = null;
 		    // TODO add the fireevent calls ...
 		    // download the file, save it, then parse it
 		    store(servicesCache, RDF_FILE,
@@ -274,7 +264,9 @@
 			String s = sRdf.serializeModel(sRdf.createRDFModel(
 				null, sorted.get(authURI).toArray(
 					new MobyService[] {}), true));
-			store(servicesCache, authURI, s);
+			// store rdf
+			store(servicesCache, authURI+".__r__d__f__", s);
+			// TODO store Service XML too
 		    }
 		    // free more memory
 		    sorted.clear();
@@ -284,7 +276,7 @@
 		    // finally, put there the new LIST_FILE
 		    store(servicesCache, LIST_FILE, byAuthorityAsXML);
 		    // store a list file
-		    return true;
+		    //return true;
 		} catch (Exception e) {
 		    log.warn("Error with Services RDF", e);
 		}
@@ -302,7 +294,7 @@
 	    if (list == null)
 		throw new MobyException(MSG_CACHE_NOT_DIR(servicesCache));
 	    for (int i = 0; i < list.length; i++) {
-		if (!ignored(list[i]))
+		if (!ignored(list[i]) && !list[i].getName().endsWith(".__r__d__f__"))
 		    currentFiles.add(list[i].getName());
 	    }
 	    // some flag that determines if we need to re-merge rdf
@@ -355,11 +347,14 @@
 			    MobyService.DUMMY_NAME, authority);
 		    pattern.setCategory("");
 		    String xml = getServicesAsXML(pattern, null, true, true);
+		    // save the Service xml
+		    store(servicesCache, authority, xml);
 		    MobyService[] services = extractServices(xml);
 		    ServiceInstanceRDF sRdf = new ServiceInstanceRDF(reg);
 		    xml = sRdf.serializeModel(sRdf.createRDFModel(null,
 			    services, true));
-		    store(servicesCache, authority, xml);
+		    // save the rdf
+		    store(servicesCache, authority+".__r__d__f__", xml);
 		    hasChanged = true;
 		    fireEvent(AUTHORITY_LOADED, authority);
 		    if (stopS) {
@@ -374,6 +369,8 @@
 	    for (String it : currentFiles) {
 		log.debug("Removing the authority '" + it+"' from the cache");
 		remove(servicesCache, it);
+		// remove the RDF file too if it exists
+		remove(servicesCache, it+".__r__d__f__");
 		hasChanged = true;
 	    }
 
@@ -404,7 +401,7 @@
 	    return;
 	Model m = null;
 	for (int i = 0; i < list.length; i++) {
-	    if (!ignored(list[i])) {
+	    if (!ignored(list[i]) && list[i].getName().endsWith(".__r__d__f__")) {
 		try {
 		    log.debug("loading: " + list[i].getName());
 		    p.setUrl("file:///" + servicesCache.getAbsolutePath()




More information about the MOBY-guts mailing list