[MOBY-guts] biomoby commit

Martin Senger senger at pub.open-bio.org
Fri Oct 28 13:39:09 UTC 2005


senger
Fri Oct 28 09:39:09 EDT 2005
Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard
In directory pub.open-bio.org:/tmp/cvs-serv13861/src/main/org/biomoby/service/dashboard

Modified Files:
	NOTES RegistryModel.java RegistryPanel.java 
	ServiceTypesTree.java 
Added Files:
	NamespacesBoard.java NamespacesTree.java 
Log Message:


moby-live/Java/src/main/org/biomoby/service/dashboard NamespacesBoard.java,NONE,1.1 NamespacesTree.java,NONE,1.1 NOTES,1.13,1.14 RegistryModel.java,1.10,1.11 RegistryPanel.java,1.14,1.15 ServiceTypesTree.java,1.1,1.2
===================================================================
RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/NOTES,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/NOTES	2005/10/28 11:30:37	1.13
+++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/NOTES	2005/10/28 13:39:09	1.14
@@ -1,3 +1,5 @@
+* collapse/expand should be disabled when namespaces are sorted by name
+
 * BUG: When 'no-use-chache' then changing sorting also reloads; which
   is bad I think
 

===================================================================
RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/RegistryModel.java,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/RegistryModel.java	2005/10/28 11:30:37	1.10
+++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/RegistryModel.java	2005/10/28 13:39:09	1.11
@@ -13,6 +13,7 @@
 import org.biomoby.shared.NoSuccessException;
 import org.biomoby.shared.MobyDataType;
 import org.biomoby.shared.MobyServiceType;
+import org.biomoby.shared.MobyNamespace;
 import org.biomoby.shared.CentralAll;
 import org.biomoby.client.CentralDigestCachedImpl;
 
@@ -44,6 +45,7 @@
     boolean useCache = true;
     Hashtable dataTypesTable = new Hashtable();
     Hashtable serviceTypesTable = new Hashtable();
+    Hashtable namespacesTable = new Hashtable();
 
     private static final String MSG_REG_PENDING_CURATION =
     "Registration reports 'Pending curation'...\n" +
@@ -257,6 +259,92 @@
 
     /*********************************************************************
      *
+     * Dealing with Moby Namespaces.
+     *
+     ********************************************************************/
+
+    /*********************************************************************
+     *
+     ********************************************************************/
+    public void registerNamespace (MobyNamespace namespace)
+	throws MobyException {
+	initWorker();
+ 	try {
+	    worker.registerNamespace (namespace);
+	} catch (PendingCurationException e) {
+	    throw new MobyException (MSG_REG_PENDING_CURATION);
+	} catch (NoSuccessException e) {
+	    throw new MobyException (MSG_REG_NO_SUCCESS + e.getMessage());
+	}
+    }
+
+    /*********************************************************************
+     *
+     ********************************************************************/
+    public void unRegisterNamespace (MobyNamespace namespace)
+	throws MobyException {
+	initWorker();
+ 	try {
+	    worker.unregisterNamespace (namespace);
+	} catch (PendingCurationException e) {
+	    throw new MobyException (MSG_UNREG_PENDING_CURATION);
+	} catch (NoSuccessException e) {
+	    throw new MobyException (MSG_UNREG_NO_SUCCESS + e.getMessage());
+	}
+    }
+
+    /*********************************************************************
+     * Fetch namespaces (from a cache or from a registry). When done,
+     * signal that namespaces are updated. If an initiator is known
+     * (not null), signal, who asked for it, as well.
+     ********************************************************************/
+    public synchronized MobyNamespace[] getNamespaces (Object initiator)
+	throws MobyException {
+	initWorker();
+	if (initiator != null)
+	    fireEvent (initiator, NAMESPACES_RESET, "", null);
+	MobyNamespace[] namespaces = worker.getFullNamespaces();
+	namespacesTable.clear();
+	for (int i = 0; i < namespaces.length; i++)
+	    namespacesTable.put (namespaces[i].getName(), namespaces[i]);
+ 	if (initiator != null)
+ 	    fireEvent (initiator, NAMESPACES_UPDATED, "", namespaces);
+	return namespaces;
+    }
+
+    /*********************************************************************
+     *
+     ********************************************************************/
+    public MobyNamespace getNamespace (String namespace)
+	throws MobyException {
+	if (namespace == null)
+	    return null;
+	MobyNamespace[] namespaces = getNamespaces (null);
+	return (MobyNamespace)namespacesTable.get (namespace);
+    }
+
+    /*********************************************************************
+     * Return a HashSet filled with names of namespaces that have
+     * somewhere given 'searchText'. Add case-insensitivity to the
+     * regular expression in 'searchText'.
+     ********************************************************************/
+    public HashSet findInNamespaces (String searchText)
+	throws MobyException {
+	HashSet found = new HashSet();
+	MobyNamespace[] namespaces = getNamespaces (null);
+	if (! searchText.startsWith ("(?i)"))
+	    searchText = "(?i)" + searchText;
+	Pattern pattern = Pattern.compile (searchText);
+	for (int i = 0; i < namespaces.length; i++) {
+	    if (pattern.matcher (namespaces[i].toString()).find())
+		found.add (namespaces[i].getName());
+	}
+	return found;
+    }
+
+
+    /*********************************************************************
+     *
      * The rest...
      *
      ********************************************************************/

===================================================================
RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/RegistryPanel.java,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -r1.14 -r1.15
--- /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/RegistryPanel.java	2005/10/28 11:30:37	1.14
+++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/RegistryPanel.java	2005/10/28 13:39:09	1.15
@@ -12,6 +12,7 @@
 import org.biomoby.shared.Central;
 import org.biomoby.shared.MobyDataType;
 import org.biomoby.shared.MobyServiceType;
+import org.biomoby.shared.MobyNamespace;
 import org.biomoby.shared.MobyRelationship;
 import org.biomoby.service.generator.DataTypesGenerator;
 
@@ -119,7 +120,6 @@
 
 	// ontology trees
 	ServicesTree servicesTree = new ServicesTree();
-	NamespacesTree namespacesTree = new NamespacesTree();
 	DataTypesBoard dataTypesBoard =
 	    new DataTypesBoard (registryModel,
 				console,
@@ -130,6 +130,11 @@
 				   console,
 				   propertyChannel);
 	serviceTypesBoard.updateTree (CommonTree.SORTED_BY_NAME);
+	NamespacesBoard namespacesBoard =
+	    new NamespacesBoard (registryModel,
+				 console,
+				 propertyChannel);
+	namespacesBoard.updateTree (CommonTree.SORTED_BY_NAME);
 
 	JSplitPane split1 = new JSplitPane (JSplitPane.HORIZONTAL_SPLIT,
 					    servicesTree.scrollable(),
@@ -140,7 +145,7 @@
 
 	JSplitPane split2 = new JSplitPane (JSplitPane.HORIZONTAL_SPLIT,
 					    serviceTypesBoard,
-					    namespacesTree.scrollable());
+					    namespacesBoard);
 	split2.setResizeWeight (0.5);
 	split2.setContinuousLayout (true);
 	split2.setOneTouchExpandable (true);

===================================================================
RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/ServiceTypesTree.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/ServiceTypesTree.java	2005/10/28 11:30:37	1.1
+++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/ServiceTypesTree.java	2005/10/28 13:39:09	1.2
@@ -136,9 +136,9 @@
 			error (SERVICE_TYPES_ACCESS_ERROR, updateException);
 		    if (serviceTypes != null) {
 			if (sorted == SORTED_BY_AUTHORITY)
-			    onUpdateServiceTreeByAuth (serviceTypes);
+			    onUpdateServiceTypesTreeByAuth (serviceTypes);
 			else
-			    onUpdateServiceTree (serviceTypes);
+			    onUpdateServiceTypesTree (serviceTypes);
 			if (serviceTypes.length > 0)
 			    setEnabledPopup (true);
 		    }
@@ -147,7 +147,7 @@
 	worker.start(); 
     }
 
-    void onUpdateServiceTree (MobyServiceType[] serviceTypes) {
+    void onUpdateServiceTypesTree (MobyServiceType[] serviceTypes) {
 	DefaultTreeModel tModel = (DefaultTreeModel)getModel();
 	DefaultMutableTreeNode root = (DefaultMutableTreeNode)tModel.getRoot();
 	root.removeAllChildren();   // does not harm if no children exist
@@ -176,7 +176,7 @@
     }
 
 
-    void onUpdateServiceTreeByAuth (MobyServiceType[] serviceTypes) {
+    void onUpdateServiceTypesTreeByAuth (MobyServiceType[] serviceTypes) {
 	DefaultTreeModel tModel = (DefaultTreeModel)getModel();
 	DefaultMutableTreeNode root = (DefaultMutableTreeNode)tModel.getRoot();
 	root.removeAllChildren();   // does not harm if no children exist




More information about the MOBY-guts mailing list