[MOBY-guts] biomoby commit

Martin Senger senger at pub.open-bio.org
Fri Oct 28 11:30:37 UTC 2005


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

Modified Files:
	CommonBoard.java CommonTree.java Dashboard.java 
	DataTypesBoard.java DataTypesTree.java NOTES 
	PropertyChannel.java RegistryModel.java RegistryPanel.java 
Added Files:
	ServiceTypesBoard.java ServiceTypesTree.java 
Log Message:


moby-live/Java/src/main/org/biomoby/service/dashboard ServiceTypesBoard.java,NONE,1.1 ServiceTypesTree.java,NONE,1.1 CommonBoard.java,1.3,1.4 CommonTree.java,1.8,1.9 Dashboard.java,1.9,1.10 DataTypesBoard.java,1.4,1.5 DataTypesTree.java,1.5,1.6 NOTES,1.12,1.13 PropertyChannel.java,1.5,1.6 RegistryModel.java,1.9,1.10 RegistryPanel.java,1.13,1.14
===================================================================
RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/CommonBoard.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/CommonBoard.java	2005/10/28 07:58:08	1.3
+++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/CommonBoard.java	2005/10/28 11:30:37	1.4
@@ -43,7 +43,7 @@
     implements NotificationListener {
 
     private static org.apache.commons.logging.Log log =
-       org.apache.commons.logging.LogFactory.getLog (RegistryModel.class);
+       org.apache.commons.logging.LogFactory.getLog (CommonBoard.class);
 
     protected RegistryModel model;
     protected PropertyChannel channel;

===================================================================
RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/CommonTree.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/CommonTree.java	2005/10/28 07:58:08	1.8
+++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/CommonTree.java	2005/10/28 11:30:37	1.9
@@ -73,6 +73,12 @@
 
     protected String rootNode;
 
+    final static protected String ACCESS_ERROR_INTRO =
+    "Check please values in text fields (in Registry Browser)\n"
+    + "specifying registry endpoint and namespace, and in the\n"
+    + "one specifying directory used as a local cache. Then\n"
+    + "right-click in the data types area and select 'Reload'.\n\n";
+
     /*********************************************************************
      * Constructor
      ********************************************************************/

===================================================================
RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/Dashboard.java,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/Dashboard.java	2005/10/28 07:58:08	1.9
+++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/Dashboard.java	2005/10/28 11:30:37	1.10
@@ -52,7 +52,7 @@
     implements DashboardPanel, ChangeListener {
 
     private static org.apache.commons.logging.Log log =
-       org.apache.commons.logging.LogFactory.getLog (RegistryModel.class);
+       org.apache.commons.logging.LogFactory.getLog (Dashboard.class);
 
     private JComponent dashboard;
     private DashboardHeader header;

===================================================================
RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/DataTypesBoard.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/DataTypesBoard.java	2005/10/28 07:58:08	1.4
+++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/DataTypesBoard.java	2005/10/28 11:30:37	1.5
@@ -29,7 +29,7 @@
     extends CommonBoard {
 
     private static org.apache.commons.logging.Log log =
-       org.apache.commons.logging.LogFactory.getLog (RegistryModel.class);
+       org.apache.commons.logging.LogFactory.getLog (DataTypesBoard.class);
 
     /*********************************************************************
      * Constructor. <p>

===================================================================
RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/DataTypesTree.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/DataTypesTree.java	2005/10/28 07:58:08	1.5
+++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/DataTypesTree.java	2005/10/28 11:30:37	1.6
@@ -43,7 +43,7 @@
     extends CommonTree {
 
     private static org.apache.commons.logging.Log log =
-       org.apache.commons.logging.LogFactory.getLog (RegistryModel.class);
+       org.apache.commons.logging.LogFactory.getLog (DataTypesTree.class);
 
     // action commands for popup menu items
     protected final static String AC_NSORT = "ac-nsort";
@@ -64,17 +64,14 @@
 
     final static String DATA_TYPES_ACCESS_ERROR =
     "An error happened when accessing a list of available data types.\n\n"
-    + "Check please values in text fields (in Registry Browser)\n"
-    + "specifying registry endpoint and namespace, and in the\n"
-    + "one specifying directory used as a local cache. Then\n"
-    + "right-click in the data types area and select 'Reload'.\n\n";
+    + ACCESS_ERROR_INTRO;
 
     /*********************************************************************
      * Constructor.
      ********************************************************************/
     public DataTypesTree (RegistryModel registryModel,
 			  CommonConsole console) {
-	super ("DataTypes");
+	super ("Data Types");
 	this.registryModel = registryModel;
 	this.console = console;
 	createPopups ("Data Types Menu");
@@ -309,7 +306,7 @@
 		public Object construct() {
 		    try {
 			if (UUtils.notEmpty (regex))
-			    found = registryModel.find (regex);
+			    found = registryModel.findInDataTypes (regex);
 		    } catch (MobyException e) {
 			error (DATA_TYPES_ACCESS_ERROR, e);
 		    }

===================================================================
RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/NOTES,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/NOTES	2005/10/28 07:58:08	1.12
+++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/NOTES	2005/10/28 11:30:37	1.13
@@ -1,3 +1,8 @@
+* BUG: When 'no-use-chache' then changing sorting also reloads; which
+  is bad I think
+
+* Reload ... does it ignore cache?
+
 TODO generally:
 ---------------
 

===================================================================
RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/PropertyChannel.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/PropertyChannel.java	2005/10/27 08:55:48	1.5
+++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/PropertyChannel.java	2005/10/28 11:30:37	1.6
@@ -10,9 +10,6 @@
 
 import org.tulsoft.shared.UUtils;
 
-import org.apache.commons.logging.LogFactory;
-import org.apache.commons.logging.Log;
-
 import java.beans.PropertyChangeListener;
 import java.beans.PropertyChangeEvent;
 import java.beans.PropertyChangeSupport;
@@ -62,7 +59,9 @@
 public class PropertyChannel
     extends Hashtable {
 
-    private static Log log = LogFactory.getLog (PropertyChannel.class);
+    private static org.apache.commons.logging.Log log =
+       org.apache.commons.logging.LogFactory.getLog (PropertyChannel.class);
+
     private PropertyChangeSupport support;
 
     /*********************************************************************

===================================================================
RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/RegistryModel.java,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/RegistryModel.java	2005/10/28 07:58:08	1.9
+++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/RegistryModel.java	2005/10/28 11:30:37	1.10
@@ -12,6 +12,7 @@
 import org.biomoby.shared.PendingCurationException;
 import org.biomoby.shared.NoSuccessException;
 import org.biomoby.shared.MobyDataType;
+import org.biomoby.shared.MobyServiceType;
 import org.biomoby.shared.CentralAll;
 import org.biomoby.client.CentralDigestCachedImpl;
 
@@ -41,7 +42,22 @@
 
     CentralAll worker;
     boolean useCache = true;
-    Hashtable dataTypesTable;
+    Hashtable dataTypesTable = new Hashtable();
+    Hashtable serviceTypesTable = new Hashtable();
+
+    private static final String MSG_REG_PENDING_CURATION =
+    "Registration reports 'Pending curation'...\n" +
+    "Well, nobody knows what it means. Call Mark!";
+
+    private static final String MSG_REG_NO_SUCCESS =
+    "Registration reports 'No Success'...\n";
+
+    private static final String MSG_UNREG_PENDING_CURATION =
+    "Unregistration reports 'Pending curation'...\n" +
+    "Well, nobody knows what it means. Call Mark!";
+
+    private static final String MSG_UNREG_NO_SUCCESS =
+    "Unregistration reports 'No Success'...\n";
 
     /*********************************************************************
      * Default constructor.
@@ -65,6 +81,13 @@
 	return CentralDigestCachedImpl.DEFAULT_NAMESPACE;
     }
 
+
+    /*********************************************************************
+     *
+     * Dealing with Moby Data Types.
+     *
+     ********************************************************************/
+
     /*********************************************************************
      *
      ********************************************************************/
@@ -74,11 +97,9 @@
 //  	try {
 // 	    worker.registerDataType (dataType);
 // 	} catch (PendingCurationException e) {
-// 	    throw new MobyException ("Registration reports 'Pending curation'...\n" +
-// 				     "Well, nobody knows what it means. Call Mark!");
+// 	    throw new MobyException (MSG_REG_PENDING_CURATION);
 // 	} catch (NoSuccessException e) {
-// 	    throw new MobyException ("Registration reports 'No Success'...\n" +
-// 				     e.getMessage());
+// 	    throw new MobyException (MSG_REG_NO_SUCCESS + e.getMessage());
 // 	}
     }
 
@@ -91,18 +112,16 @@
 //  	try {
 // 	    worker.unregisterDataType (dataType);
 // 	} catch (PendingCurationException e) {
-// 	    throw new MobyException ("Unregistration reports 'Pending curation'...\n" +
-// 				     "Well, nobody knows what it means. Call Mark!");
+// 	    throw new MobyException (MSG_UNREG_PENDING_CURATION);
 // 	} catch (NoSuccessException e) {
-// 	    throw new MobyException ("Unregistration reports 'No Success'...\n" +
-// 				     e.getMessage());
+// 	    throw new MobyException (MSG_UNREG_NO_SUCCESS + e.getMessage());
 // 	}
     }
 
     /*********************************************************************
      * Fetch data types (from a cache or from a registry). When done,
-     * signal that data type are updated. If an initiator is known
-     * (not null), signal, who asked for data, as well.
+     * signal that data types are updated. If an initiator is known
+     * (not null), signal, who asked for it, as well.
      ********************************************************************/
     public synchronized MobyDataType[] getDataTypes (Object initiator)
 	throws MobyException {
@@ -110,6 +129,9 @@
 	if (initiator != null)
 	    fireEvent (initiator, DATA_TYPES_RESET, "", null);
 	MobyDataType[] dataTypes = worker.getDataTypes();
+	dataTypesTable.clear();
+	for (int i = 0; i < dataTypes.length; i++)
+	    dataTypesTable.put (dataTypes[i].getName(), dataTypes[i]);
  	if (initiator != null)
  	    fireEvent (initiator, DATA_TYPES_UPDATED, "", dataTypes);
 	return dataTypes;
@@ -122,15 +144,7 @@
 	throws MobyException {
 	if (dataTypeName == null)
 	    return null;
-
 	MobyDataType[] dataTypes = getDataTypes (null);
-
-	if (dataTypesTable == null) {
-	    dataTypesTable = new Hashtable();
-	    for (int i = 0; i < dataTypes.length; i++) {
-		dataTypesTable.put (dataTypes[i].getName(), dataTypes[i]);
-	    }
-	}
 	return (MobyDataType)dataTypesTable.get (dataTypeName);
     }
 
@@ -139,7 +153,7 @@
      * somewhere given 'searchText'. Add case-insensitivity to the
      * regular expression in 'searchText'.
      ********************************************************************/
-    public HashSet find (String searchText)
+    public HashSet findInDataTypes (String searchText)
 	throws MobyException {
 	HashSet found = new HashSet();
 	MobyDataType[] dataTypes = getDataTypes (null);
@@ -153,6 +167,100 @@
 	return found;
     }
 
+
+    /*********************************************************************
+     *
+     * Dealing with Moby Service Types.
+     *
+     ********************************************************************/
+
+
+    /*********************************************************************
+     *
+     ********************************************************************/
+    public void registerServiceType (MobyServiceType serviceType)
+	throws MobyException {
+	initWorker();
+ 	try {
+	    worker.registerServiceType (serviceType);
+	} catch (PendingCurationException e) {
+	    throw new MobyException (MSG_REG_PENDING_CURATION);
+	} catch (NoSuccessException e) {
+	    throw new MobyException (MSG_REG_NO_SUCCESS + e.getMessage());
+	}
+    }
+
+    /*********************************************************************
+     *
+     ********************************************************************/
+    public void unRegisterServiceType (MobyServiceType serviceType)
+	throws MobyException {
+	initWorker();
+ 	try {
+	    worker.unregisterServiceType (serviceType);
+	} catch (PendingCurationException e) {
+	    throw new MobyException (MSG_UNREG_PENDING_CURATION);
+	} catch (NoSuccessException e) {
+	    throw new MobyException (MSG_UNREG_NO_SUCCESS + e.getMessage());
+	}
+    }
+
+    /*********************************************************************
+     * Fetch service types (from a cache or from a registry). When done,
+     * signal that service types are updated. If an initiator is known
+     * (not null), signal, who asked for it, as well.
+     ********************************************************************/
+    public synchronized MobyServiceType[] getServiceTypes (Object initiator)
+	throws MobyException {
+	initWorker();
+	if (initiator != null)
+	    fireEvent (initiator, SERVICE_TYPES_RESET, "", null);
+	MobyServiceType[] serviceTypes = worker.getFullServiceTypes();
+	serviceTypesTable = new Hashtable();
+	for (int i = 0; i < serviceTypes.length; i++)
+	    serviceTypesTable.put (serviceTypes[i].getName(), serviceTypes[i]);
+ 	if (initiator != null)
+ 	    fireEvent (initiator, SERVICE_TYPES_UPDATED, "", serviceTypes);
+	return serviceTypes;
+    }
+
+    /*********************************************************************
+     *
+     ********************************************************************/
+    public MobyServiceType getServiceType (String serviceTypeName)
+	throws MobyException {
+	if (serviceTypeName == null)
+	    return null;
+	MobyServiceType[] serviceTypes = getServiceTypes (null);
+	return (MobyServiceType)serviceTypesTable.get (serviceTypeName);
+    }
+
+    /*********************************************************************
+     * Return a HashSet filled with names of service types that have
+     * somewhere given 'searchText'. Add case-insensitivity to the
+     * regular expression in 'searchText'.
+     ********************************************************************/
+    public HashSet findInServiceTypes (String searchText)
+	throws MobyException {
+	HashSet found = new HashSet();
+	MobyServiceType[] serviceTypes = getServiceTypes (null);
+	if (! searchText.startsWith ("(?i)"))
+	    searchText = "(?i)" + searchText;
+	Pattern pattern = Pattern.compile (searchText);
+	for (int i = 0; i < serviceTypes.length; i++) {
+	    if (pattern.matcher (serviceTypes[i].toString()).find())
+		found.add (serviceTypes[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.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/RegistryPanel.java	2005/10/27 08:55:48	1.13
+++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/RegistryPanel.java	2005/10/28 11:30:37	1.14
@@ -11,6 +11,7 @@
 import org.biomoby.shared.MobyException;
 import org.biomoby.shared.Central;
 import org.biomoby.shared.MobyDataType;
+import org.biomoby.shared.MobyServiceType;
 import org.biomoby.shared.MobyRelationship;
 import org.biomoby.service.generator.DataTypesGenerator;
 
@@ -118,12 +119,17 @@
 
 	// ontology trees
 	ServicesTree servicesTree = new ServicesTree();
-	ServiceTypesTree serviceTypesTree = new ServiceTypesTree();
 	NamespacesTree namespacesTree = new NamespacesTree();
-	DataTypesBoard dataTypesBoard = new DataTypesBoard (registryModel,
-							    console,
-							    propertyChannel);
+	DataTypesBoard dataTypesBoard =
+	    new DataTypesBoard (registryModel,
+				console,
+				propertyChannel);
 	dataTypesBoard.updateTree (CommonTree.SORTED_BY_NAME);
+	ServiceTypesBoard serviceTypesBoard =
+	    new ServiceTypesBoard (registryModel,
+				   console,
+				   propertyChannel);
+	serviceTypesBoard.updateTree (CommonTree.SORTED_BY_NAME);
 
 	JSplitPane split1 = new JSplitPane (JSplitPane.HORIZONTAL_SPLIT,
 					    servicesTree.scrollable(),
@@ -133,7 +139,7 @@
 	split1.setOneTouchExpandable (true);
 
 	JSplitPane split2 = new JSplitPane (JSplitPane.HORIZONTAL_SPLIT,
-					    serviceTypesTree.scrollable(),
+					    serviceTypesBoard,
 					    namespacesTree.scrollable());
 	split2.setResizeWeight (0.5);
 	split2.setContinuousLayout (true);




More information about the MOBY-guts mailing list