[MOBY-guts] biomoby commit
Paul Gordon
gordonp at dev.open-bio.org
Fri Dec 7 20:34:27 UTC 2007
gordonp
Fri Dec 7 15:34:27 EST 2007
Update of /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/seahawk/gui
In directory dev.open-bio.org:/tmp/cvs-serv2612/src/main/ca/ucalgary/seahawk/gui
Modified Files:
MobyContentGUI.java
Log Message:
Simplified the ontology caching code
moby-live/Java/src/main/ca/ucalgary/seahawk/gui MobyContentGUI.java,1.14,1.15
===================================================================
RCS file: /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/seahawk/gui/MobyContentGUI.java,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -r1.14 -r1.15
--- /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/seahawk/gui/MobyContentGUI.java 2007/12/06 17:03:48 1.14
+++ /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/seahawk/gui/MobyContentGUI.java 2007/12/07 20:34:27 1.15
@@ -872,7 +872,7 @@
}
// Asynchronously load up ontology data so it's ready when the user needs it.
cacheOntologies();
-
+ try{Thread.sleep(5000);}catch(Exception e){System.err.println("Sleep interrupted");}
MobyContentGUI gui = MobyUtils.getMobyContentGUI(new JLabel());
gui.setDefaultCloseOperation(defaultCloseOperation);
@@ -903,83 +903,47 @@
final Registry preferredRegistry = SeahawkOptions.getRegistry();
// Remove stale cache files before doing anything else
- long allowedAgeMillis = (long) SeahawkOptions.getCacheExpiry()*60*60*1000; // hours to milliseconds
+ final 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();
- }
+ public void run(){
+ try{
+ MobyNamespace.loadNamespaces(RegistryCache.cacheRegistryOntology(preferredRegistry,
+ Central.NAMESPACES_RESOURCE_NAME,
+ allowedAgeMillis).toURI().toURL(),
+ preferredRegistry);
+ }catch(Exception e){
+ e.printStackTrace();
}
- }.start();
+ }}.start();
// The following command will cache all data type definitions for this session
new Thread(){
- public void run(){
- 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();
- }
+ public void run(){
+ try{
+ MobyDataType.loadDataTypes(RegistryCache.cacheRegistryOntology(preferredRegistry,
+ Central.DATA_TYPES_RESOURCE_NAME,
+ allowedAgeMillis).toURI().toURL(),
+ preferredRegistry);
+ }catch(Exception e){
+ e.printStackTrace();
}
- }.start();
+ }}.start();
new Thread(){
- public void run(){
- 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();
- }
+ public void run(){
+ try{
+ MobyServiceType.loadServiceTypes(RegistryCache.cacheRegistryOntology(preferredRegistry,
+ Central.SERVICE_TYPES_RESOURCE_NAME,
+ allowedAgeMillis).toURI().toURL(),
+ preferredRegistry);
+ } catch(Exception e){
+ e.printStackTrace();
}
- }.start();
-
+ }}.start();
// And the service definitions
//new Thread(){
// public void run(){org.biomoby.shared.MobyService.getService("","");}
More information about the MOBY-guts
mailing list