[MOBY-guts] biomoby commit
Martin Senger
senger at pub.open-bio.org
Thu Nov 10 08:54:32 UTC 2005
senger
Thu Nov 10 03:54:32 EST 2005
Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard
In directory pub.open-bio.org:/tmp/cvs-serv3825/src/main/org/biomoby/service/dashboard
Modified Files:
CommonTree.java Dashboard.java DashboardProperties.java
DataTypesBoard.java NOTES NamespacesBoard.java
RegistrationDataTypeSubPanel.java
RegistrationServiceSubPanel.java
RegistrationServiceTypeSubPanel.java RegistryModel.java
RegistryPanel.java ServiceTypesBoard.java
ServiceTypesTree.java ServicesBoard.java
Log Message:
moby-live/Java/src/main/org/biomoby/service/dashboard CommonTree.java,1.14,1.15 Dashboard.java,1.13,1.14 DashboardProperties.java,1.13,1.14 DataTypesBoard.java,1.8,1.9 NOTES,1.21,1.22 NamespacesBoard.java,1.3,1.4 RegistrationDataTypeSubPanel.java,1.4,1.5 RegistrationServiceSubPanel.java,1.3,1.4 RegistrationServiceTypeSubPanel.java,1.5,1.6 RegistryModel.java,1.17,1.18 RegistryPanel.java,1.21,1.22 ServiceTypesBoard.java,1.4,1.5 ServiceTypesTree.java,1.7,1.8 ServicesBoard.java,1.3,1.4
===================================================================
RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/CommonTree.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/CommonTree.java 2005/11/06 16:47:11 1.14
+++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/CommonTree.java 2005/11/10 08:54:31 1.15
@@ -57,6 +57,7 @@
protected final static String AC_ASORT = "ac-asort";
// some shared constants
+ final static protected int SORTED_AS_PREVIOUSLY = -1;
final static protected int SORTED_BY_NAME = 0;
final static protected int SORTED_BY_AUTHORITY = 1;
final static protected int SORTED_UNUSUAL = 9;
===================================================================
RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/Dashboard.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/Dashboard.java 2005/11/07 17:14:46 1.13
+++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/Dashboard.java 2005/11/10 08:54:31 1.14
@@ -116,8 +116,14 @@
JFrame frame = SwingUtils.createMainFrame (getComponent (propertyChannel),
getName());
addMenuBar (frame);
-// SwingUtils.showMainFrame (frame, dashboard.getPreferredSize());
- SwingUtils.showMainFrame (frame, new Dimension (1000, 800));
+
+ Dimension screenSize = frame.getToolkit().getScreenSize();
+ double myWidth = Math.min (screenSize.getWidth(), 1100);
+ double myHeight = Math.min (screenSize.getHeight(), 900);
+ Dimension mySize = new Dimension();
+ mySize.setSize (myWidth, myHeight);
+
+ SwingUtils.showMainFrame (frame, mySize);
}
/**************************************************************************
@@ -266,7 +272,8 @@
* the bottom of a dashboard).
**************************************************************************/
protected StatusBar getStatusBar() {
- return new StatusBar ("Status: Work in progress");
+ return new StatusBar
+ ("Dashboard is ready. Fasten your seat belts - it's going to be a bumpy ride.");
}
class StatusBar extends JLabel implements PropertyChangeListener {
===================================================================
RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/DashboardProperties.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/DashboardProperties.java 2005/11/09 05:29:38 1.13
+++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/DashboardProperties.java 2005/11/10 08:54:31 1.14
@@ -63,6 +63,7 @@
static final String DP_REG_S_XML_PATH = "dp-reg-s-xml-path";
static final String DP_USE_SIGNATURE = "dp-use-signature"; // type: Boolean
static final String DP_USE_AUTHORITATIVE = "dp-use-auth"; // type: Boolean
+ static final String DP_REG_S_TYPE = "dp-reg-s-type";
static final String DP_REG_VERBOSE = "dp-reg-verbose";
===================================================================
RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/DataTypesBoard.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/DataTypesBoard.java 2005/11/07 17:14:46 1.8
+++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/DataTypesBoard.java 2005/11/10 08:54:31 1.9
@@ -99,7 +99,8 @@
// for updating data types - so we need to update our
// own tree - using for that data types included in
// this event
- tree.update (-1, (MobyDataType[])event.getDetails());
+ tree.update (CommonTree.SORTED_AS_PREVIOUSLY,
+ (MobyDataType[])event.getDetails());
}
break;
}
===================================================================
RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/NOTES,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -r1.21 -r1.22
--- /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/NOTES 2005/11/09 16:23:32 1.21
+++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/NOTES 2005/11/10 08:54:31 1.22
@@ -1,10 +1,28 @@
+* More testing:
+ - interrupting loading
+ - different order of panels
+ - loading without caching
+ - changing cache...
+
+* MAJOR BUG: synchronization problem when starting; revised it!
+ - perhaps singletons for registry model and for workers there
+
+* BUG: still sometimes a bug by reloading the cache -
+ NullPointerException reported in a dialog window - difficult to
+ reproduce it... but it is somewhere there :-(
+
+* WARN: How would an authority with characters 'http://' cope as a
+ cache name? Can it happen?
+
* after unregistration, fill the form with just unregistered entity -
so it is easier to update it and register again
-* better initial dimension of the whole dashboard
* too much empty space in the dashboard title...
(perhaps to move the icon somewhere else - like a "splash panel")
+* log warning if the 'notified' is not called from the event-dispatch
+ queue
+
---
* how to squeeze too long combo boxes into smaller place ?
@@ -19,8 +37,6 @@
* BUG: When 'no-use-chache' then changing sorting also reloads; which
is bad I think
-* Reload ... does it ignore cache?
-
TODO generally:
---------------
@@ -35,26 +51,19 @@
? select a part of an error message and highlight it in red?
? HELP (in a Dashboard Menu)
+ - starting panel/splash screen
- helps from panels
- About
- credits
- add dynamically a URL from dashboard.properties...
-* change onMethods() to be protected or even private...
-
? improve API javadoc of all these Central*Impl
? start to work on/think of the RDF-based cache
TODO for cache:
---------------
-* poor-man update: keep what's there but add what is not there
- (and perhaps delete what should not be there) - but do not
- check any age of existing
-* getInfo() method
-* corresponding changes with command-line clients for cache
- implementations
-* remove memory-caching from CentralImpl
-* graphics by default: yes for datatyeps and no for services
+? remove memory-caching from CentralImpl
+? graphics by default: yes for datatyeps and no for services
General options (available from the menu)
---------------
@@ -63,12 +72,6 @@
* language ( => use proper ResourceBundler...)
-Registry panel
---------------
-
-* finish all buttons
-
-
Registration panel
------------------
@@ -123,12 +126,6 @@
- the BuildDataTypeTree is sometimes damaged (after adding a member
node); not sure how to reproduce it
- ! finish all the caching stuff (separate scrap of paper)
-
-* After registration, update cache, update list
-* The same, after de-registration
-* Then make the reg/unreg real...
-
* log4j.configuration property - works only from Ant... add it to the
cmd-line clients, as well
===================================================================
RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/NamespacesBoard.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/NamespacesBoard.java 2005/11/07 17:14:46 1.3
+++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/NamespacesBoard.java 2005/11/10 08:54:31 1.4
@@ -99,7 +99,8 @@
// for updating namespaces - so we need to update our
// own tree - using for that namespaces included in
// this event
- tree.update (-1, (MobyNamespace[])event.getDetails());
+ tree.update (CommonTree.SORTED_AS_PREVIOUSLY,
+ (MobyNamespace[])event.getDetails());
}
break;
}
===================================================================
RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/RegistrationDataTypeSubPanel.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/RegistrationDataTypeSubPanel.java 2005/11/09 05:29:38 1.4
+++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/RegistrationDataTypeSubPanel.java 2005/11/10 08:54:31 1.5
@@ -327,7 +327,10 @@
/*********************************************************************
* Called when a tree node is selected, or deselected (in
* which case 'node' is null). If a data type name is
- * selected, enable few popup menu items, otherwise disable them.
+ * selected, enable few popup menu items, otherwise disable
+ * them. Then copy the contents of this data type to a
+ * console, and additional (if indicated in the
+ * propertyChannel) to the newly built data type fields.
********************************************************************/
protected void selected (DefaultMutableTreeNode node) {
if (node == null) {
@@ -366,6 +369,7 @@
dtAuth.setText (dataType.getAuthority());
dtEmail.setText (dataType.getEmailContact());
dtDescArea.setText (dataType.getDescription());
+ buildTree.setParent (dataType.getParentName());
}
} else if (isAuthority) {
if (propertyChannel.getBoolean (DP_REG_DT_COPY_BY_SELECT, false))
===================================================================
RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/RegistrationServiceSubPanel.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/RegistrationServiceSubPanel.java 2005/11/09 05:29:38 1.3
+++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/RegistrationServiceSubPanel.java 2005/11/10 08:54:31 1.4
@@ -59,6 +59,7 @@
// names of user preferences keys
static final String USE_SIGNATURE = "use-signature";
static final String USE_AUTHORITATIVE = "use-authoritative";
+ static final String REG_S_TYPE = "reg-s-type";
static final String REG_S_FROM_XML = "reg-service-from-xml-file";
// components that are used from more methods
@@ -142,7 +143,7 @@
// service type
JPanel serviceType = new JPanel (new GridBagLayout());
JLabel labelST = new JLabel ("Service type: ");
- sType = new JLabel ("");
+ sType = new JLabel (getPrefValue (REG_S_TYPE, ""));
SwingUtils.addComponent (serviceType, labelST, 0, 0, 1, 1, NONE, NWEST, 0.0, 0.0);
SwingUtils.addComponent (serviceType, sType, 1, 0, 1, 1, NONE, NWEST, 0.0, 0.0);
@@ -585,8 +586,12 @@
protected void selected (DefaultMutableTreeNode node) {
if (node == null) return;
CommonNode nodeObject = (CommonNode)node.getUserObject();
- if (nodeObject.getType() == CommonNode.NODE_SERVICE_TYPE)
- sType.setText (nodeObject.getValue());
+ if (nodeObject.getType() == CommonNode.NODE_SERVICE_TYPE) {
+ String value = nodeObject.getValue();
+ sType.setText (value);
+ setPrefValue (REG_S_TYPE, value);
+ propertyChannel.put (DP_REG_S_TYPE, value);
+ }
}
}
===================================================================
RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/RegistrationServiceTypeSubPanel.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/RegistrationServiceTypeSubPanel.java 2005/11/09 16:23:32 1.5
+++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/RegistrationServiceTypeSubPanel.java 2005/11/10 08:54:31 1.6
@@ -312,6 +312,7 @@
stAuth.setText (serviceType.getAuthority());
stEmail.setText (serviceType.getEmailContact());
stDescArea.setText (serviceType.getDescription());
+ stISA.setText (serviceType.getParentName());
}
} else if (isAuthority) {
if (propertyChannel.getBoolean (DP_REG_ST_COPY_BY_SELECT, false))
===================================================================
RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/RegistryModel.java,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -r1.17 -r1.18
--- /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/RegistryModel.java 2005/11/09 16:23:32 1.17
+++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/RegistryModel.java 2005/11/10 08:54:31 1.18
@@ -32,9 +32,9 @@
import java.io.IOException;
/**
- * A real worker that supplies all data to the {@link
- * RegistryPanel}. It accesses a Biomoby registry (or a local cache)
- * to get data. <p>
+ * A real worker that supplies all data from a Biomoby registry (or
+ * from a local cache) to various panels, especially to the {@link
+ * RegistryPanel} and the {@link RegistrationPanel}. <p>
*
* @author <A HREF="mailto:martin.senger at gmail.com">Martin Senger</A>
* @version $Id$
@@ -47,6 +47,14 @@
private static org.apache.commons.logging.Log log =
org.apache.commons.logging.LogFactory.getLog (RegistryModel.class);
+ // Biomoby parts: reflects the same what from is in
+ // CentralDigestCachedImpl for cache parts - but here more
+ // conveniently as integers
+ public static final int PART_SERVICES = 1;
+ public static final int PART_DATA_TYPES = 2;
+ public static final int PART_SERVICE_TYPES = 4;
+ public static final int PART_NAMESPACES = 8;
+
CentralAll worker;
CentralDigestCachedImpl castWorker;
@@ -168,6 +176,27 @@
}
/*********************************************************************
+ *
+ ********************************************************************/
+ public void updateDataTypesCache()
+ throws MobyException {
+ initWorker();
+ castWorker.updateCache (CentralDigestCachedImpl.CACHE_PART_DATATYPES);
+ fireEvent (Notifier.DATA_TYPES_UPDATED, "", null);
+ }
+
+ /*********************************************************************
+ *
+ ********************************************************************/
+ public void reloadDataTypesCache()
+ throws MobyException {
+ initWorker();
+ castWorker.removeFromCache (CentralDigestCachedImpl.CACHE_PART_DATATYPES);
+ castWorker.updateCache (CentralDigestCachedImpl.CACHE_PART_DATATYPES);
+ fireEvent (Notifier.DATA_TYPES_UPDATED, "", null);
+ }
+
+ /*********************************************************************
* Fetch data types (from a cache or from a registry). When done,
* signal that data types are updated. If an initiator is known
* (not null), signal, who asked for it, as well.
@@ -380,6 +409,27 @@
}
/*********************************************************************
+ *
+ ********************************************************************/
+ public void updateNamespacesCache()
+ throws MobyException {
+ initWorker();
+ castWorker.updateCache (CentralDigestCachedImpl.CACHE_PART_NAMESPACES);
+ fireEvent (Notifier.NAMESPACES_UPDATED, "", null);
+ }
+
+ /*********************************************************************
+ *
+ ********************************************************************/
+ public void reloadNamespacesCache()
+ throws MobyException {
+ initWorker();
+ castWorker.removeFromCache (CentralDigestCachedImpl.CACHE_PART_NAMESPACES);
+ castWorker.updateCache (CentralDigestCachedImpl.CACHE_PART_NAMESPACES);
+ fireEvent (Notifier.NAMESPACES_UPDATED, "", null);
+ }
+
+ /*********************************************************************
* 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.
@@ -476,6 +526,27 @@
}
/*********************************************************************
+ *
+ ********************************************************************/
+ public void updateServicesCache()
+ throws MobyException {
+ initWorker();
+ castWorker.updateCache (CentralDigestCachedImpl.CACHE_PART_SERVICES);
+ fireEvent (Notifier.AUTHORITIES_UPDATED, "", null);
+ }
+
+ /*********************************************************************
+ *
+ ********************************************************************/
+ public void reloadServicesCache()
+ throws MobyException {
+ initWorker();
+ castWorker.removeFromCache (CentralDigestCachedImpl.CACHE_PART_SERVICES);
+ castWorker.updateCache (CentralDigestCachedImpl.CACHE_PART_SERVICES);
+ fireEvent (Notifier.AUTHORITIES_UPDATED, "", null);
+ }
+
+ /*********************************************************************
* Fetch services (from a cache or from a registry). When done,
* signal that services are updated. If an initiator is known (not
* null), signal, who asked for it, as well.
@@ -544,6 +615,20 @@
/*********************************************************************
*
+ ********************************************************************/
+ public String getCacheInfoFormatted()
+ throws MobyException {
+ initWorker();
+ StringBuffer buf = new StringBuffer (500);
+ buf.append (castWorker.getCacheInfoFormatted (CentralDigestCachedImpl.CACHE_PART_SERVICES));
+ buf.append (castWorker.getCacheInfoFormatted (CentralDigestCachedImpl.CACHE_PART_DATATYPES));
+ buf.append (castWorker.getCacheInfoFormatted (CentralDigestCachedImpl.CACHE_PART_NAMESPACES));
+ buf.append (castWorker.getCacheInfoFormatted (CentralDigestCachedImpl.CACHE_PART_SERVICETYPES));
+ return new String (buf);
+ }
+
+ /*********************************************************************
+ *
* The rest...
*
********************************************************************/
===================================================================
RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/RegistryPanel.java,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -r1.21 -r1.22
--- /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/RegistryPanel.java 2005/11/09 16:23:32 1.21
+++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/RegistryPanel.java 2005/11/10 08:54:31 1.22
@@ -14,7 +14,6 @@
import org.biomoby.shared.MobyException;
import org.biomoby.shared.event.Notifier;
-import org.biomoby.client.CentralDigestCachedImpl;
import javax.swing.JPanel;
import javax.swing.JLabel;
@@ -62,6 +61,12 @@
CommonConsole console;
JCheckBox bServices, bDataTypes, bNamespaces, bServiceTypes, bAll;
+ JButton infoButton, updateButton, eraseButton;
+
+ DataTypesBoard dataTypesBoard;
+ ServiceTypesBoard serviceTypesBoard;
+ NamespacesBoard namespacesBoard;
+ ServicesBoard servicesBoard;
// shared icons
protected static Icon defaultsIcon;
@@ -108,25 +113,21 @@
console.setAppendMode (false);
// ontology trees
- DataTypesBoard dataTypesBoard =
- new DataTypesBoard (registryModel,
- console,
- propertyChannel);
+ dataTypesBoard = new DataTypesBoard (registryModel,
+ console,
+ propertyChannel);
dataTypesBoard.updateTree (CommonTree.SORTED_BY_NAME);
- ServiceTypesBoard serviceTypesBoard =
- new ServiceTypesBoard (registryModel,
- console,
- propertyChannel);
+ serviceTypesBoard = new ServiceTypesBoard (registryModel,
+ console,
+ propertyChannel);
serviceTypesBoard.updateTree (CommonTree.SORTED_BY_NAME);
- NamespacesBoard namespacesBoard =
- new NamespacesBoard (registryModel,
- console,
- propertyChannel);
+ namespacesBoard = new NamespacesBoard (registryModel,
+ console,
+ propertyChannel);
namespacesBoard.updateTree (CommonTree.SORTED_BY_NAME);
- ServicesBoard servicesBoard =
- new ServicesBoard (registryModel,
- console,
- propertyChannel);
+ servicesBoard = new ServicesBoard (registryModel,
+ console,
+ propertyChannel);
servicesBoard.updateTree (CommonTree.SORTED_BY_NAME);
// split it into moving panels
@@ -144,9 +145,23 @@
}
/**************************************************************************
- *
+ * It updates all lists. Each tree is responsible to reload itself
+ * in a separate thread.
+ **************************************************************************/
+ protected void onReloadAll() {
+ dataTypesBoard.updateTree (CommonTree.SORTED_AS_PREVIOUSLY);
+ serviceTypesBoard.updateTree (CommonTree.SORTED_AS_PREVIOUSLY);
+ namespacesBoard.updateTree (CommonTree.SORTED_AS_PREVIOUSLY);
+ servicesBoard.updateTree (CommonTree.SORTED_AS_PREVIOUSLY);
+ }
+
+ /**************************************************************************
+ * Replace text fields that define location of a Biomoby registry
+ * with a default location.
**************************************************************************/
- public void onReloadAll() {
+ protected void onDefaults() {
+ registryURL.setText (registryModel.getDefaultRegistryEndpoint());
+ registryNS.setText (registryModel.getDefaultRegistryNamespace());
}
/**************************************************************************
@@ -183,21 +198,53 @@
/**************************************************************************
*
**************************************************************************/
- public void onDefaults() {
- registryURL.setText (registryModel.getDefaultRegistryEndpoint());
- registryNS.setText (registryModel.getDefaultRegistryNamespace());
- }
+ protected void onCacheInfo() {
- /**************************************************************************
- *
- **************************************************************************/
- public void onCacheInfo() {
+ final JLabel contents = new JLabel();
+ final String[] buttons = new String[] { "Copy to console", "Done"};
+ propertyChannel.fire (DP_STATUS_MSG, "Retrieving cach info...");
+ infoButton.setEnabled (false);
+
+ final SwingWorker worker = new SwingWorker() {
+ MobyException exception = null;
+ String info = null;
+ public Object construct() {
+ try {
+ info = registryModel.getCacheInfoFormatted();
+ } catch (MobyException e) {
+ exception = e;
+ }
+ return null; // not used here
+ }
+
+ // runs on the event-dispatching thread.
+ public void finished() {
+ if (exception == null)
+ contents.setText ("<html><pre>" + info + "</pre>");
+ else
+ contents.setText ("<html>Sorry, I could not retrieve any info...<br>" +
+ "I think that the problem is actually here:<p><pre>" +
+ exception.getMessage() +
+ "</pre>");
+ if (JOptionPane.showOptionDialog (null, contents,
+ "Info on local cache",
+ JOptionPane.YES_NO_OPTION,
+ JOptionPane.PLAIN_MESSAGE,
+ confirmIcon,
+ buttons,
+ null) == 0)
+ console.setText (info);
+ propertyChannel.fire (DP_STATUS_MSG, "Done");
+ infoButton.setEnabled (true);
+ }
+ };
+ worker.start();
}
/**************************************************************************
*
**************************************************************************/
- public void onCacheErase() {
+ protected void onCacheErase() {
}
final static String UPDATE_LABEL =
@@ -215,7 +262,7 @@
/**************************************************************************
*
**************************************************************************/
- public void onCacheUpdate() {
+ protected void onCacheUpdate() {
JPanel p = createCacheDialog (UPDATE_LABEL);
String[] buttons = new String[] { "Update", "Reload", "Cancel"};
int selected =
@@ -234,31 +281,53 @@
else
return; // cancelled
+ // update each cache part in a separate (and concurrent) thread
boolean all = bAll.isSelected();
if (all || bServices.isSelected())
- updateCache (CentralDigestCachedImpl.CACHE_PART_SERVICES, toReload);
+ updateCache (RegistryModel.PART_SERVICES, toReload);
if (all || bDataTypes.isSelected())
- updateCache (CentralDigestCachedImpl.CACHE_PART_DATATYPES, toReload);
+ updateCache (RegistryModel.PART_DATA_TYPES, toReload);
if (all || bNamespaces.isSelected())
- updateCache (CentralDigestCachedImpl.CACHE_PART_NAMESPACES, toReload);
+ updateCache (RegistryModel.PART_NAMESPACES, toReload);
if (all || bServiceTypes.isSelected())
- updateCache (CentralDigestCachedImpl.CACHE_PART_SERVICETYPES, toReload);
+ updateCache (RegistryModel.PART_SERVICE_TYPES, toReload);
}
/**************************************************************************
*
**************************************************************************/
- private void updateCache (String cachePart, boolean reload) {
- final String myCachePart = cachePart;
+ private void updateCache (int cachePart, boolean reload) {
+ final int myCachePart = cachePart;
final boolean myReload = reload;
final SwingWorker worker = new SwingWorker() {
MobyException exception = null;
public Object construct() {
try {
- if (myReload) {
- registryModel.reloadServiceTypesCache();
- } else {
- registryModel.updateServiceTypesCache();
+ switch (myCachePart) {
+ case RegistryModel.PART_SERVICES:
+ if (myReload)
+ registryModel.reloadServicesCache();
+ else
+ registryModel.updateServicesCache();
+ break;
+ case RegistryModel.PART_DATA_TYPES:
+ if (myReload)
+ registryModel.reloadDataTypesCache();
+ else
+ registryModel.updateDataTypesCache();
+ break;
+ case RegistryModel.PART_SERVICE_TYPES:
+ if (myReload)
+ registryModel.reloadServiceTypesCache();
+ else
+ registryModel.updateServiceTypesCache();
+ break;
+ case RegistryModel.PART_NAMESPACES:
+ if (myReload)
+ registryModel.reloadNamespacesCache();
+ else
+ registryModel.updateNamespacesCache();
+ break;
}
} catch (MobyException e) {
exception = e;
@@ -269,7 +338,7 @@
// runs on the event-dispatching thread.
public void finished() {
if (log.isDebugEnabled())
- log.debug (myReload ? "Reload of " : "Update of " + myCachePart + " finished");
+ log.debug (myReload ? "Reload of " : "Update of part " + myCachePart + " finished");
if (exception != null)
error ("An error occured when filling/updating the cache.\n\n",
exception);
@@ -286,6 +355,8 @@
protected void onUseCache (boolean enabled) {
cacheDir.setEnabled (enabled);
labelCacheDir.setEnabled (enabled);
+ infoButton.setEnabled (enabled);
+ updateButton.setEnabled (enabled);
setPrefValue (USE_CACHE, enabled);
propertyChannel.put (DP_USE_CACHE, new Boolean (enabled).toString());
}
@@ -299,8 +370,8 @@
JLabel labelRegistryNS = new JLabel("Namespace (URI)");
registryNS = createText (null, "registryNamespace", DP_REGISTRY_NAMESPACE);
JButton reloadAllButton =
- createButton (" Reload ",
- "Reload fully some or all ontology trees from the Biomoby registry",
+ createButton (" Reload all lists ",
+ "Reload all ontology trees from a Biomoby registry, or from the cache",
KeyEvent.VK_R,
new ActionListener() {
public void actionPerformed (ActionEvent e) {
@@ -353,8 +424,7 @@
DP_CACHE_DIR);
cacheDir.getFileChooser().setFileSelectionMode (JFileChooser.DIRECTORIES_ONLY);
- onUseCache (usingCache);
- JButton infoButton =
+ infoButton =
createButton (" Info ",
"Show current information about the local cache",
KeyEvent.VK_I,
@@ -365,7 +435,7 @@
});
infoButton.setIcon (infoIcon);
- JButton updateButton =
+ updateButton =
createButton (" Update ",
"Update local cache from Biomoby registry",
KeyEvent.VK_U,
@@ -375,19 +445,21 @@
}
});
updateButton.setIcon (updateIcon);
- JButton eraseButton =
- createButton (" Erase ",
- "Remove everything from the local cache",
- KeyEvent.VK_E,
- new ActionListener() {
- public void actionPerformed (ActionEvent e) {
- onCacheErase();
- }
- });
- eraseButton.setIcon (eraseIcon);
+// eraseButton =
+// createButton (" Erase ",
+// "Remove everything from the local cache",
+// KeyEvent.VK_E,
+// new ActionListener() {
+// public void actionPerformed (ActionEvent e) {
+// onCacheErase();
+// }
+// });
+// eraseButton.setIcon (eraseIcon);
+
JPanel buttonPanel = createButtonPanel (new JButton[] { infoButton,
- updateButton,
- eraseButton });
+ updateButton });
+// eraseButton });
+ onUseCache (usingCache);
JPanel cLocation = createTitledPanel ("Local cache");
SwingUtils.addComponent (cLocation, useCache, 0, 0, 1, 1, NONE, NWEST, 0.0, 0.0);
===================================================================
RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/ServiceTypesBoard.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/ServiceTypesBoard.java 2005/11/09 16:23:32 1.4
+++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/ServiceTypesBoard.java 2005/11/10 08:54:31 1.5
@@ -88,20 +88,19 @@
case Notifier.SERVICE_TYPES_CANCELLED:
case Notifier.SERVICE_TYPES_RESET:
initiator = event.getSource();
-// log.info ("RESET initiator: " + initiator + ", this tree: " + tree);
if (tree == initiator)
channel.fire (DashboardProperties.DP_STATUS_MSG, "Done");
removeProgressBar();
break;
case Notifier.SERVICE_TYPES_UPDATED:
initiator = event.getSource();
-// log.info ("UPDATED initiator: " + initiator + ", this tree: " + tree);
if (tree != initiator) {
// someone else (of this instance) initiated request
// for updating service types - so we need to update our
// own tree - using for that service types included in
// this event
- tree.update (-1, (MobyServiceType[])event.getDetails());
+ tree.update (CommonTree.SORTED_AS_PREVIOUSLY,
+ (MobyServiceType[])event.getDetails());
}
break;
}
===================================================================
RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/ServiceTypesTree.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/ServiceTypesTree.java 2005/11/07 07:03:49 1.7
+++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/ServiceTypesTree.java 2005/11/10 08:54:31 1.8
@@ -176,8 +176,9 @@
}
/*********************************************************************
- * Reload the tree from the Biomoby registry, ignoring (and
- * updating) cache.
+ * Reload the tree from the Biomoby registry (or from the current
+ * cache). If you want to update also cache, use the cache buttons
+ * - they will invoke this method also after updating the cache.
********************************************************************/
protected void reload() {
update (lastSorted, null);
===================================================================
RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/ServicesBoard.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/ServicesBoard.java 2005/11/07 17:14:46 1.3
+++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/ServicesBoard.java 2005/11/10 08:54:31 1.4
@@ -99,7 +99,8 @@
// for updating services - so we need to update our
// own tree - using for that services included in this
// event
- tree.update (-1, (MobyService[])event.getDetails());
+ tree.update (CommonTree.SORTED_AS_PREVIOUSLY,
+ (MobyService[])event.getDetails());
}
break;
}
More information about the MOBY-guts
mailing list