[MOBY-guts] biomoby commit

Paul Gordon gordonp at dev.open-bio.org
Fri Jun 8 20:30:21 UTC 2007


gordonp
Fri Jun  8 16:30:21 EDT 2007
Update of /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/seahawk/gui
In directory dev.open-bio.org:/tmp/cvs-serv29870/src/main/ca/ucalgary/seahawk/gui

Modified Files:
	MobyContentGUI.java MobyContentPane.java 
	SeahawkOptionsGUI.java 
Log Message:
Code revamp to deal with new disk cache
moby-live/Java/src/main/ca/ucalgary/seahawk/gui MobyContentGUI.java,1.9,1.10 MobyContentPane.java,1.8,1.9 SeahawkOptionsGUI.java,1.1,1.2
===================================================================
RCS file: /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/seahawk/gui/MobyContentGUI.java,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/seahawk/gui/MobyContentGUI.java	2007/06/08 14:04:27	1.9
+++ /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/seahawk/gui/MobyContentGUI.java	2007/06/08 20:30:21	1.10
@@ -19,8 +19,10 @@
 import org.biomoby.client.MobyRequest;
 import org.biomoby.client.MobyRequestEvent;
 import org.biomoby.client.MobyRequestEventHandler;
+import org.biomoby.registry.meta.*;
 import org.biomoby.shared.*;
 import org.biomoby.shared.data.*;
+
 import ca.ucalgary.seahawk.util.*;
 
 /**
@@ -949,7 +951,7 @@
     }
 
     protected static void cacheOntologies(){
-	final org.biomoby.registry.meta.Registry preferredRegistry = SeahawkOptions.getRegistry();
+	final Registry preferredRegistry = SeahawkOptions.getRegistry();
 
 	// Redirect the registry endpoints to local cache files if available
 	// preferredRegistry and/or dataDefURL may be null, if not cached, but that's okay to pass around
@@ -957,25 +959,46 @@
 	// The following command will cache all data type definitions for this session
 	new Thread(){
 		public void run(){
-		    URL dataDefURL = RegistryCache.getDataTypeOntologyURL(preferredRegistry);
-		    if(dataDefURL != null){
-			// Use the cached file rather than actually going to the registry
-			MobyDataType.loadDataTypes(dataDefURL, preferredRegistry);
-		    }
-		    else{
-			MobyDataType.getDataType("Object", preferredRegistry);
+		    File dataDefFile = RegistryCache.getOntologyFile(preferredRegistry, 
+								     Central.DATA_TYPES_RESOURCE_NAME);
+		    try{
+			URL dataDefURL = dataDefFile.toURI().toURL();
+			if(dataDefFile.exists()){
+			    // Use the cached file rather than actually going to the registry
+			    MobyDataType.loadDataTypes(dataDefURL, preferredRegistry);
+			}
+			else{
+			    // Create it from the remote source, then load it
+			    RegistryCache.cacheRegistryOntology(preferredRegistry, 
+								Central.DATA_TYPES_RESOURCE_NAME);
+			    MobyDataType.loadDataTypes(dataDefURL, preferredRegistry);
+			}
+		    }catch(Exception e){
+			e.printStackTrace();
 		    }
 		}
-	    }.start();
+	}.start();
+
 	new Thread(){
 		public void run(){
-		    URL serviceTypeDefURL = RegistryCache.getServiceTypeOntologyURL(preferredRegistry);
-		    if(serviceTypeDefURL != null){
-			// Use the cached file rather than actually going to the registry
-			MobyServiceType.loadServiceTypes(serviceTypeDefURL, preferredRegistry);
-		    }
-		    else{
-			MobyServiceType.getServiceType("Analysis", preferredRegistry);
+		    File serviceTypeDefFile = RegistryCache.getOntologyFile(preferredRegistry, 	
+									    Central.SERVICE_TYPES_RESOURCE_NAME);
+		    try{
+			URL serviceTypeDefURL = serviceTypeDefFile.toURI().toURL();
+			if(serviceTypeDefFile.exists()){
+			    // Use the cached file rather than actually going to the registry
+			    MobyServiceType.loadServiceTypes(serviceTypeDefURL,
+							     preferredRegistry);
+			}
+			else{
+			    // Create it from the remote source, then load it
+			    RegistryCache.cacheRegistryOntology(preferredRegistry, 
+								Central.SERVICE_TYPES_RESOURCE_NAME);
+			    MobyServiceType.loadServiceTypes(serviceTypeDefURL,
+							     preferredRegistry);
+			}
+		    } catch(Exception e){
+			e.printStackTrace();
 		    }
 		}
 	    }.start();

===================================================================
RCS file: /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/seahawk/gui/MobyContentPane.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/seahawk/gui/MobyContentPane.java	2007/06/08 14:04:27	1.8
+++ /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/seahawk/gui/MobyContentPane.java	2007/06/08 20:30:21	1.9
@@ -310,9 +310,17 @@
 		// Shouldn't get here unless either not binary, or the binary data load failed
 		System.err.println("Is plain text");
 		editorPane.setContentType("text/html");
-		resultBuffer = new StringBuffer("<html><body><pre>"+
-						getInputStreamContents(url.openStream()).replaceAll("&", "&amp;").replaceAll("<","&lt;")+
-						"</pre></body></html>");
+		String body = getInputStreamContents(url.openStream());
+		// Is it already HTML?
+		if(body.toLowerCase().indexOf("<html") != -1){
+		    resultBuffer = new StringBuffer(body);
+		}
+		// Otherwise it needs preformatting to get a fixed width font
+		else{
+		    resultBuffer = new StringBuffer("<html><body><pre>"+
+						    body.replaceAll("&", "&amp;").replaceAll("<","&lt;")+
+						    "</pre></body></html>");
+		}
 		editorPane.setText(resultBuffer.toString());
 	    }
 	    else{

===================================================================
RCS file: /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/seahawk/gui/SeahawkOptionsGUI.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/seahawk/gui/SeahawkOptionsGUI.java	2007/06/08 14:04:27	1.1
+++ /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/seahawk/gui/SeahawkOptionsGUI.java	2007/06/08 20:30:21	1.2
@@ -1,4 +1,5 @@
 package ca.ucalgary.seahawk.gui;
 
 public class SeahawkOptionsGUI{
+    
 }




More information about the MOBY-guts mailing list