[MOBY-guts] biomoby commit

Paul Gordon gordonp at dev.open-bio.org
Sat Jun 9 22:16:54 UTC 2007


gordonp
Sat Jun  9 18:16:54 EDT 2007
Update of /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/seahawk/gui
In directory dev.open-bio.org:/tmp/cvs-serv5656/src/main/ca/ucalgary/seahawk/gui

Modified Files:
	MobyContentGUI.java 
Log Message:
Better caching implemented
moby-live/Java/src/main/ca/ucalgary/seahawk/gui MobyContentGUI.java,1.10,1.11
===================================================================
RCS file: /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/seahawk/gui/MobyContentGUI.java,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/seahawk/gui/MobyContentGUI.java	2007/06/08 20:30:21	1.10
+++ /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/seahawk/gui/MobyContentGUI.java	2007/06/09 22:16:54	1.11
@@ -80,6 +80,8 @@
     private MobyContentClipboard clipboard;
     private MobyContentHelpPane helpPane;
     private DataRecorder dataRecorder; // used for workflow export, etc.
+    private SeahawkOptionsGUI settingsGUI;
+
     private boolean setup;
     private Map request2tab;
     private int activeTabIndex = -1;
@@ -210,6 +212,7 @@
 					     status);
 	getContentPane().add(tabbedPane, java.awt.BorderLayout.CENTER);
 
+	settingsGUI = new SeahawkOptionsGUI(this);
     }
 
     public boolean allTabsVisible(){
@@ -727,6 +730,10 @@
 	    showHelpTab();
 	    return;
 	}
+	else if(source == settingsButton){
+	    settingsGUI.setVisible(true);
+	    return;
+	}
 
 	String cmd = e.getActionCommand();
 	if(FILE_OPEN_OPTION.equals(cmd)){
@@ -924,7 +931,7 @@
 	// Asynchronously load up ontology data so it's ready when the user needs it.
 	cacheOntologies();
 
-	MobyContentGUI gui = ca.ucalgary.seahawk.util.MobyUtils.getMobyContentGUI(new JLabel());
+	MobyContentGUI gui = MobyUtils.getMobyContentGUI(new JLabel());
 	gui.setDefaultCloseOperation(defaultCloseOperation);
 
 	gui.setVisible(true);
@@ -953,9 +960,37 @@
     protected static void cacheOntologies(){
 	final Registry preferredRegistry = SeahawkOptions.getRegistry();
 
+	// Remove stale cache files before doing anything else
+	long allowedAgeMillis = (long) SeahawkOptions.getCacheExpiry()*60*60*1000; // hours to milliseconds
+	RegistryCache.deleteExpiredCacheFiles(allowedAgeMillis);
+
 	// 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
 
+	new Thread(){
+		public void run(){
+		    File namespacesDefFile = RegistryCache.getOntologyFile(preferredRegistry, 	
+									   Central.NAMESPACES_RESOURCE_NAME);
+		    try{
+			URL namespacesDefURL = namespacesDefFile.toURI().toURL();
+			if(namespacesDefFile.exists()){
+			    // Use the cached file rather than actually going to the registry
+			    MobyNamespace.loadNamespaces(namespacesDefURL,
+							 preferredRegistry);
+			}
+			else{
+			    // Create it from the remote source, then load it
+			    RegistryCache.cacheRegistryOntology(preferredRegistry, 
+								Central.NAMESPACES_RESOURCE_NAME);
+			    MobyNamespace.loadNamespaces(namespacesDefURL,
+							 preferredRegistry);
+			}
+		    } catch(Exception e){
+			e.printStackTrace();
+		    }
+		}
+	    }.start();
+
 	// The following command will cache all data type definitions for this session
 	new Thread(){
 		public void run(){
@@ -1002,6 +1037,7 @@
 		    }
 		}
 	    }.start();
+
 	// And the service definitions
 	//new Thread(){
 	//	public void run(){org.biomoby.shared.MobyService.getService("","");}




More information about the MOBY-guts mailing list