********************************************************************/ protected void collapse() { @@ -389,7 +438,8 @@ Enumeration en = root.depthFirstEnumeration(); while (en.hasMoreElements()) { DefaultMutableTreeNode node = (DefaultMutableTreeNode)en.nextElement(); - if (toBeHighlighted.contains (node.getUserObject().toString())) { +// if (toBeHighlighted.contains (node.getUserObject().toString())) { + if (toBeHighlighted.contains ( ((CommonNode)node.getUserObject()).getValue())) { makeVisible (new TreePath (tModel.getPathToRoot (node))); } } =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/DataTypesTree.java,v retrieving revision 1.6 retrieving revision 1.7 diff -u -r1.6 -r1.7 --- /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/DataTypesTree.java 2005/10/28 11:30:37 1.6 +++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/DataTypesTree.java 2005/11/02 06:39:06 1.7 @@ -46,8 +46,6 @@ org.apache.commons.logging.LogFactory.getLog (DataTypesTree.class); // action commands for popup menu items - protected final static String AC_NSORT = "ac-nsort"; - protected final static String AC_ASORT = "ac-asort"; protected final static String AC_HASA = "ac-hasa"; protected final static String AC_DEPR = "ac-depr"; @@ -56,7 +54,6 @@ CommonConsole console; MobyDataType[] dataTypes = null; - int lastSorted = SORTED_BY_NAME; boolean showBadGuys = false; boolean showMembers = false; JCheckBoxMenuItem deprecatedBox; @@ -83,21 +80,7 @@ ********************************************************************/ protected void createPopups (String title) { super.createPopups (title); - popup.addSeparator(); - popup.add - (createMenuItem (new AbstractAction ("Sort by names") { - public void actionPerformed (ActionEvent e) { - update (lastSorted = SORTED_BY_NAME, null); - deprecatedBox.setEnabled (true); - } - }, AC_NSORT)); - popup.add - (createMenuItem (new AbstractAction ("Sort by authorities") { - public void actionPerformed (ActionEvent e) { - update (lastSorted = SORTED_BY_AUTHORITY, null); - deprecatedBox.setEnabled (false); - } - }, AC_ASORT)); + addSortingItems(); popup.addSeparator(); JCheckBoxMenuItem showBox = new JCheckBoxMenuItem ("Show HAS/HASA members"); =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/NamespacesTree.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/NamespacesTree.java 2005/10/28 13:39:09 1.1 +++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/NamespacesTree.java 2005/11/02 06:39:06 1.2 @@ -45,16 +45,11 @@ private static org.apache.commons.logging.Log log = org.apache.commons.logging.LogFactory.getLog (NamespacesTree.class); - // action commands for popup menu items - protected final static String AC_NSORT = "ac-nsort"; - protected final static String AC_ASORT = "ac-asort"; - // remembered from constructor RegistryModel registryModel; CommonConsole console; MobyNamespace[] namespaces = null; - int lastSorted = SORTED_BY_NAME; MobyException updateException = null; final static String NAMESPACES_ACCESS_ERROR = @@ -73,24 +68,11 @@ } /********************************************************************* - * Adding data types tree specific menu items to a - * right-click-popup. + * ********************************************************************/ protected void createPopups (String title) { super.createPopups (title); - popup.addSeparator(); - popup.add - (createMenuItem (new AbstractAction ("Sort by names") { - public void actionPerformed (ActionEvent e) { - update (lastSorted = SORTED_BY_NAME, null); - } - }, AC_NSORT)); - popup.add - (createMenuItem (new AbstractAction ("Sort by authorities") { - public void actionPerformed (ActionEvent e) { - update (lastSorted = SORTED_BY_AUTHORITY, null); - } - }, AC_ASORT)); + addSortingItems(); } /********************************************************************* =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/RegistryModel.java,v retrieving revision 1.11 retrieving revision 1.12 diff -u -r1.11 -r1.12 --- /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/RegistryModel.java 2005/10/28 13:39:09 1.11 +++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/RegistryModel.java 2005/11/02 06:39:06 1.12 @@ -13,6 +13,7 @@ import org.biomoby.shared.NoSuccessException; import org.biomoby.shared.MobyDataType; import org.biomoby.shared.MobyServiceType; +import org.biomoby.shared.MobyService; import org.biomoby.shared.MobyNamespace; import org.biomoby.shared.CentralAll; import org.biomoby.client.CentralDigestCachedImpl; @@ -46,6 +47,7 @@ Hashtable dataTypesTable = new Hashtable(); Hashtable serviceTypesTable = new Hashtable(); Hashtable namespacesTable = new Hashtable(); + Hashtable servicesTable = new Hashtable(); private static final String MSG_REG_PENDING_CURATION = "Registration reports 'Pending curation'...\n" + @@ -183,13 +185,13 @@ 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()); - } +// 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()); +// } } /********************************************************************* @@ -198,13 +200,13 @@ 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()); - } +// 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()); +// } } /********************************************************************* @@ -269,13 +271,13 @@ 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()); - } +// 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()); +// } } /********************************************************************* @@ -284,13 +286,13 @@ 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()); - } +// 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()); +// } } /********************************************************************* @@ -345,6 +347,94 @@ /********************************************************************* * + * Dealing with Moby Services. + * + ********************************************************************/ + + + /********************************************************************* + * + ********************************************************************/ + public void registerService (MobyService service) + throws MobyException { + initWorker(); +// try { +// worker.registerService (service); +// } catch (PendingCurationException e) { +// throw new MobyException (MSG_REG_PENDING_CURATION); +// } catch (NoSuccessException e) { +// throw new MobyException (MSG_REG_NO_SUCCESS + e.getMessage()); +// } + } + + /********************************************************************* + * + ********************************************************************/ + public void unRegisterService (MobyService service) + throws MobyException { + initWorker(); +// try { +// worker.unregisterService (service); +// } catch (PendingCurationException e) { +// throw new MobyException (MSG_UNREG_PENDING_CURATION); +// } catch (NoSuccessException e) { +// throw new MobyException (MSG_UNREG_NO_SUCCESS + e.getMessage()); +// } + } + + /********************************************************************* + * 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. + ********************************************************************/ + public synchronized MobyService[] getServices (Object initiator) + throws MobyException { + initWorker(); + if (initiator != null) + fireEvent (initiator, AUTHORITIES_RESET, "", null); + MobyService[] services = worker.getServices(); + servicesTable = new Hashtable(); + for (int i = 0; i < services.length; i++) + servicesTable.put (services[i].getUniqueName(), + services[i]); + if (initiator != null) + fireEvent (initiator, AUTHORITIES_UPDATED, "", services); + return services; + } + + /********************************************************************* + * + ********************************************************************/ + public MobyService getService (String combinedServiceName) + throws MobyException { + if (combinedServiceName == null) + return null; + MobyService[] services = getServices (null); + return (MobyService)servicesTable.get (combinedServiceName); + } + + /********************************************************************* + * Return a HashSet filled with names of services that have + * somewhere given 'searchText'. Add case-insensitivity to the + * regular expression in 'searchText'. + ********************************************************************/ + public HashSet findInServices (String searchText) + throws MobyException { + HashSet found = new HashSet(); + MobyService[] services = getServices (null); + if (! searchText.startsWith ("(?i)")) + searchText = "(?i)" + searchText; + Pattern pattern = Pattern.compile (searchText); + for (int i = 0; i < services.length; i++) { + if (pattern.matcher (services[i].toString()).find()) + found.add (services[i].getUniqueName()); + } + return found; + } + + + /********************************************************************* + * * The rest... * ********************************************************************/ =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/RegistryPanel.java,v retrieving revision 1.15 retrieving revision 1.16 diff -u -r1.15 -r1.16 --- /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/RegistryPanel.java 2005/10/28 13:39:09 1.15 +++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/RegistryPanel.java 2005/11/02 06:39:06 1.16 @@ -119,7 +119,6 @@ console.setAppendMode (false); // ontology trees - ServicesTree servicesTree = new ServicesTree(); DataTypesBoard dataTypesBoard = new DataTypesBoard (registryModel, console, @@ -135,9 +134,15 @@ console, propertyChannel); namespacesBoard.updateTree (CommonTree.SORTED_BY_NAME); + ServicesBoard servicesBoard = + new ServicesBoard (registryModel, + console, + propertyChannel); + servicesBoard.updateTree (CommonTree.SORTED_BY_NAME); + // split it into moving panels JSplitPane split1 = new JSplitPane (JSplitPane.HORIZONTAL_SPLIT, - servicesTree.scrollable(), + servicesBoard, dataTypesBoard); split1.setResizeWeight (0.5); split1.setContinuousLayout (true); @@ -318,35 +323,6 @@ /************************************************************************** * **************************************************************************/ - class ServicesTree extends CommonTree { - public ServicesTree() { - super ("Services"); - } - } - - - /************************************************************************** - * - **************************************************************************/ - class ServiceTypesTree extends CommonTree { - public ServiceTypesTree() { - super ("Service Types"); - } - } - - - /************************************************************************** - * - **************************************************************************/ - class NamespacesTree extends CommonTree { - public NamespacesTree() { - super ("Namespaces"); - } - } - - /************************************************************************** - * - **************************************************************************/ public String getName() { return "Registry Browser"; } =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/ServiceTypesTree.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/ServiceTypesTree.java 2005/10/28 13:39:09 1.2 +++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/ServiceTypesTree.java 2005/11/02 06:39:06 1.3 @@ -46,16 +46,11 @@ private static org.apache.commons.logging.Log log = org.apache.commons.logging.LogFactory.getLog (ServiceTypesTree.class); - // action commands for popup menu items - protected final static String AC_NSORT = "ac-nsort"; - protected final static String AC_ASORT = "ac-asort"; - // remembered from constructor RegistryModel registryModel; CommonConsole console; MobyServiceType[] serviceTypes = null; - int lastSorted = SORTED_BY_NAME; MobyException updateException = null; final static String SERVICE_TYPES_ACCESS_ERROR = @@ -74,24 +69,11 @@ } /********************************************************************* - * Adding data types tree specific menu items to a - * right-click-popup. + * ********************************************************************/ protected void createPopups (String title) { super.createPopups (title); - popup.addSeparator(); - popup.add - (createMenuItem (new AbstractAction ("Sort by names") { - public void actionPerformed (ActionEvent e) { - update (lastSorted = SORTED_BY_NAME, null); - } - }, AC_NSORT)); - popup.add - (createMenuItem (new AbstractAction ("Sort by authorities") { - public void actionPerformed (ActionEvent e) { - update (lastSorted = SORTED_BY_AUTHORITY, null); - } - }, AC_ASORT)); + addSortingItems(); } /********************************************************************* From senger at pub.open-bio.org Wed Nov 2 01:39:06 2005 From: senger at pub.open-bio.org (Martin Senger) Date: Wed Nov 2 01:37:19 2005 Subject: [MOBY-guts] biomoby commit Message-ID: <200511020639.jA26d6sl012267@pub.open-bio.org> senger Wed Nov 2 01:39:06 EST 2005 Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/images In directory pub.open-bio.org:/tmp/cvs-serv12193/src/main/org/biomoby/service/dashboard/images Added Files: smallA.gif smallA_dis.gif smallI.gif smallI_dis.gif smallN.gif smallN_dis.gif smallO.gif smallO_dis.gif smallT.gif smallT_dis.gif Log Message: moby-live/Java/src/main/org/biomoby/service/dashboard/images smallA.gif,NONE,1.1 smallA_dis.gif,NONE,1.1 smallI.gif,NONE,1.1 smallI_dis.gif,NONE,1.1 smallN.gif,NONE,1.1 smallN_dis.gif,NONE,1.1 smallO.gif,NONE,1.1 smallO_dis.gif,NONE,1.1 smallT.gif,NONE,1.1 smallT_dis.gif,NONE,1.1 From senger at pub.open-bio.org Wed Nov 2 01:39:06 2005 From: senger at pub.open-bio.org (Martin Senger) Date: Wed Nov 2 01:37:25 2005 Subject: [MOBY-guts] biomoby commit Message-ID: <200511020639.jA26d6QY012291@pub.open-bio.org> senger Wed Nov 2 01:39:06 EST 2005 Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared In directory pub.open-bio.org:/tmp/cvs-serv12193/src/main/org/biomoby/shared Modified Files: MobyPrimaryDataSet.java MobyService.java Log Message: moby-live/Java/src/main/org/biomoby/shared MobyPrimaryDataSet.java,1.3,1.4 MobyService.java,1.7,1.8 =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/MobyPrimaryDataSet.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/shared/MobyPrimaryDataSet.java 2005/09/22 16:07:09 1.3 +++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/MobyPrimaryDataSet.java 2005/11/02 06:39:06 1.4 @@ -78,6 +78,15 @@ return true; } + public MobyDataType getDataType() { + synchronized (elements) { + if (elements.size() > 0) + return ((MobyPrimaryDataSimple)elements.firstElement()).getDataType(); + else + return null; + } + } + /************************************************************************** * Convert this instance to the XML. * The XML will look like this: =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/MobyService.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/shared/MobyService.java 2005/09/22 16:07:09 1.7 +++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/MobyService.java 2005/11/02 06:39:06 1.8 @@ -9,6 +9,7 @@ import org.tulsoft.shared.UUtils; +import java.util.Comparator; import java.util.Enumeration; import java.util.Vector; @@ -24,7 +25,8 @@ * @version $Id$ */ -public class MobyService { +public class MobyService + implements Comparable { /** * A dummy name used for MobyService instances that do not have @@ -57,6 +59,18 @@ protected Vector primaryOutputs = new Vector(); /************************************************************************** + * Implementing Comparable interface. + *************************************************************************/ + public int compareTo (Object obj) { + return getUniqueName().compareToIgnoreCase ( ((MobyService)obj).getUniqueName() ); + } + + public boolean equals (Object obj) { + if (obj == null) return false; + return getUniqueName().equals ( ((MobyService)obj).getUniqueName() ); + } + + /************************************************************************** * Default constructor. *************************************************************************/ public MobyService() { @@ -299,9 +313,10 @@ } } + // some historical reasons for this method... public boolean equals (MobyService anotherOne) { - if (anotherOne == null) return false; - return this.name.equals (anotherOne.getName()); + if (anotherOne == null) return false; + return equals ((Object)anotherOne); } public String toString() { @@ -336,8 +351,32 @@ return new String (buf); } + /************************************************************************** + * It combines this service name and its authority name. It is + * used also in {@link #equals} and {@link #compareTo} methods.
+ * + * TBD: The authority should be checked that it does not contain + * character sequence 'space followed by a left parenthesis'. + *************************************************************************/ public String toShortString() { return name + " (" + authority + ")"; } + /************************************************************************** + * Create a comparator for case-insensitive sorting of services by + * their authorities. + *************************************************************************/ + public static Comparator getAuthorityComparator() { + return new Comparator() { + public int compare (Object o1, Object o2) { + String a1 = ((MobyService)o1).getAuthority(); + String a2 = ((MobyService)o2).getAuthority(); + int compared = (a1).compareToIgnoreCase ((String)a2); + if (compared == 0) + return ( ((MobyService)o1).getName().compareToIgnoreCase ( ((MobyService)o2).getName() ) ); + else + return compared; + } + }; + } } From senger at pub.open-bio.org Thu Nov 3 03:38:40 2005 From: senger at pub.open-bio.org (Martin Senger) Date: Thu Nov 3 03:36:26 2005 Subject: [MOBY-guts] biomoby commit Message-ID: <200511030838.jA38ceGL018463@pub.open-bio.org> senger Thu Nov 3 03:38:40 EST 2005 Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/images In directory pub.open-bio.org:/tmp/cvs-serv18397/src/main/org/biomoby/service/dashboard/images Added Files: smallRegister.gif smallRegister_dis.gif Log Message: moby-live/Java/src/main/org/biomoby/service/dashboard/images smallRegister.gif,NONE,1.1 smallRegister_dis.gif,NONE,1.1 From senger at pub.open-bio.org Thu Nov 3 10:21:57 2005 From: senger at pub.open-bio.org (Martin Senger) Date: Thu Nov 3 10:20:36 2005 Subject: [MOBY-guts] biomoby commit Message-ID: <200511031521.jA3FLvns020067@pub.open-bio.org> senger Thu Nov 3 10:21:57 EST 2005 Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared In directory pub.open-bio.org:/tmp/cvs-serv20017/src/main/org/biomoby/shared Modified Files: MobyService.java Log Message: moby-live/Java/src/main/org/biomoby/shared MobyService.java,1.8,1.9 =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/MobyService.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/shared/MobyService.java 2005/11/02 06:39:06 1.8 +++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/MobyService.java 2005/11/03 15:21:57 1.9 @@ -16,7 +16,7 @@ /** * A container representing a service. But do not be too excited - * this is not a real service but only its definition as it appears in - * the BioMoby regustry.
+ * the BioMoby registry.
* * This container is used mainly to register a new service in a * Moby registry, and to find registered services later.
From senger at pub.open-bio.org Thu Nov 3 10:21:57 2005 From: senger at pub.open-bio.org (Martin Senger) Date: Thu Nov 3 10:20:41 2005 Subject: [MOBY-guts] biomoby commit Message-ID: <200511031521.jA3FLvqQ020048@pub.open-bio.org> senger Thu Nov 3 10:21:57 EST 2005 Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard In directory pub.open-bio.org:/tmp/cvs-serv20017/src/main/org/biomoby/service/dashboard Modified Files: AbstractPanel.java DashboardProperties.java NOTES RegistrationPanel.java Log Message: moby-live/Java/src/main/org/biomoby/service/dashboard AbstractPanel.java,1.12,1.13 DashboardProperties.java,1.9,1.10 NOTES,1.15,1.16 RegistrationPanel.java,1.6,1.7 =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/AbstractPanel.java,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/AbstractPanel.java 2005/11/03 08:38:39 1.12 +++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/AbstractPanel.java 2005/11/03 15:21:57 1.13 @@ -94,6 +94,8 @@ // re-use "style" components protected static final Insets BREATH_TOP = new Insets (10,0,0,0); + protected static final Insets BREATH_TOP_LEFT = new Insets (10,10,0,0); + protected static final Insets BREATH_LEFT = new Insets (0,10,0,0); protected static final Font MSG_AREA_FONT = new Font ("Courier", Font.PLAIN, 10); protected static final Font TITLE_FONT = new Font ("Serif", Font.BOLD, 20); protected static final Color TITLE_FGCOLOR = new Color (12, 55, 241); @@ -213,7 +215,8 @@ JCheckBox box = new JCheckBox (label, isSelected); if (mnemonic > 0) box.setMnemonic (mnemonic); - box.addItemListener (listener); + if (listener != null) + box.addItemListener (listener); box.setFocusPainted (false); return box; } =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/DashboardProperties.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/DashboardProperties.java 2005/11/03 08:38:39 1.9 +++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/DashboardProperties.java 2005/11/03 15:21:57 1.10 @@ -58,6 +58,16 @@ static final String DP_REG_ST_ISA = "dp-reg-st-isa"; static final String DP_REG_ST_COPY_BY_SELECT = "dp-reg-st-cbs"; // type: Boolean + static final String DP_REG_S_NAME = "dp-reg-s-name"; + static final String DP_REG_S_AUTH = "dp-reg-s-auth"; + static final String DP_REG_S_EMAIL = "dp-reg-s-email"; + static final String DP_REG_S_DESC = "dp-reg-s-desc"; + static final String DP_REG_S_URL = "dp-reg-s-url"; + static final String DP_REG_S_RDF_URL = "dp-reg-s-rdf-url"; + static final String DP_REG_S_RDF_PATH = "dp-reg-s-rdf-path"; + static final String DP_USE_SIGNATURE = "dp-use-signature"; // type: Boolean + static final String DP_USE_AUTHORITATIVE = "dp-use-auth"; // type: Boolean + /** A filename containing Java properties that configure the dashboard. */ static final String DASHBOARD_PROPERTIES_FILE = "dashboard.properties"; =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/NOTES,v retrieving revision 1.15 retrieving revision 1.16 diff -u -r1.15 -r1.16 --- /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/NOTES 2005/11/03 08:38:39 1.15 +++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/NOTES 2005/11/03 15:21:57 1.16 @@ -1,3 +1,8 @@ +* show/store XML sent to register this service + (a place for using it other time?) + +* how to squeeze too long combo boxes into smaller place ? + * registration: selecting an authority is really propagated to the text fields? (Do for data type registration the same as was done for Namespace registration.) =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/RegistrationPanel.java,v retrieving revision 1.6 retrieving revision 1.7 diff -u -r1.6 -r1.7 --- /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/RegistrationPanel.java 2005/11/03 08:38:39 1.6 +++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/RegistrationPanel.java 2005/11/03 15:21:57 1.7 @@ -13,6 +13,7 @@ import org.biomoby.shared.MobyDataType; import org.biomoby.shared.MobyNamespace; import org.biomoby.shared.MobyServiceType; +import org.biomoby.shared.MobyService; import org.biomoby.shared.MobyRelationship; import org.biomoby.shared.parser.MobyTags; import org.biomoby.service.generator.DataTypesGenerator; @@ -73,7 +74,8 @@ static final String COPY_BY_SELECT_NS = "ns-copy-by-select"; static final String COPY_BY_SELECT_ST = "st-copy-by-select"; static final String COPY_BY_SELECT_DT = "dt-copy-by-select"; - static final String COPY_BY_SELECT_S = "s-copy-by-select"; + static final String USE_SIGNATURE = "use-signature"; + static final String USE_AUTHORITATIVE = "use-authoritative"; // associated model working behind the scenes RegistryModel registryModel; @@ -86,14 +88,18 @@ JButton sRegisterButton; CommonConsole console; - JTextFieldWithHistory dtName, nsName, stName; - JTextFieldWithHistory dtAuth, nsAuth, stAuth; - JTextFieldWithHistory dtEmail, nsEmail, stEmail; - JTextArea dtDescArea, nsDescArea, stDescArea; + JTextFieldWithHistory dtName, nsName, stName, sName; + JTextFieldWithHistory dtAuth, nsAuth, stAuth, sAuth; + JTextFieldWithHistory dtEmail, nsEmail, stEmail, sEmail; + JTextArea dtDescArea, nsDescArea, stDescArea, sDescArea; JLabel stISA; + JLabel sType, labelSigURL, labelRDFPath; + JTextFieldWithHistory sURL, sSigURL; + JFileChooserWithHistory localRDFFile; + JCheckBox useAuth; - MobyException dtException, nsException, stException; - MobyException dtUnregException, nsUnregException, stUnregException; + MobyException dtException, nsException, stException, sException; + MobyException dtUnregException, nsUnregException, stUnregException, sUnregException; // shared icons protected static Icon menuAddISAIcon, menuAddISAIconDis; @@ -126,6 +132,12 @@ final static String SERVICE_TYPE_UNREG_PROLOGUE = "An error occured when trying to unregister a service type.\n\n"; + final static String SERVICE_PROLOGUE = + "An error occured when trying to register a new service.\n\n"; + + final static String SERVICE_UNREG_PROLOGUE = + "An error occured when trying to unregister a service.\n\n"; + /********************************************************************* * Default constructor. ********************************************************************/ @@ -306,11 +318,173 @@ protected JPanel getServiceRegistration() { JPanel p = new JPanel (new GridBagLayout()); - SwingUtils.addComponent (p, new JLabel ("Not Yet Implemented"), 0, 0, 1, 1, BOTH, NWEST, 1.0, 1.0); + + // text fields to define new service + JLabel labelSName = new JLabel ("Service name"); + sName = createText (null, "serviceName", DP_REG_S_NAME); + JLabel labelSAuth = new JLabel ("Authority"); + sAuth = createText (null, "serviceAuth", DP_REG_S_AUTH); + JLabel labelSEmail = new JLabel ("Contact email"); + sEmail = createText (null, "serviceEmail", DP_REG_S_EMAIL); + JLabel labelSURL = new JLabel ("Service endpoint - URL"); + sURL = createText (null, "serviceURL", DP_REG_S_URL); + boolean usingAuth = getPrefValue (USE_AUTHORITATIVE, true); + useAuth = + createCheckBox ("authoritative", usingAuth, KeyEvent.VK_A, + new ItemListener() { + public void itemStateChanged (ItemEvent e) { + onAuth (e.getStateChange() == ItemEvent.SELECTED); + } + }); + onAuth (usingAuth); + + // group of fields for RDF signature + labelSigURL = new JLabel ("RDF endpoint - signature URL"); + sSigURL = createText (null, "signatureURL", DP_REG_S_RDF_URL); + labelRDFPath = new JLabel ("Where to store RDF document"); + String defValue = + System.getProperty ("java.io.tmpdir") + + System.getProperty ("file.separator") + + "service.rdf"; + localRDFFile = createFileSelector ("File name for RDF service signature", + "Select", + defValue, + "localRDFFile", + DP_REG_S_RDF_PATH); + boolean usingSignature = getPrefValue (USE_SIGNATURE, false); + JCheckBox useSignature = + createCheckBox ("Use RDF signature", usingSignature, KeyEvent.VK_R, + new ItemListener() { + public void itemStateChanged (ItemEvent e) { + onUseRDFSignature (e.getStateChange() == ItemEvent.SELECTED); + } + }); + onUseRDFSignature (usingSignature); + + JPanel pRDF = createTitledPanel ("Service RDF Signature"); + SwingUtils.addComponent (pRDF, useSignature, 0, 0, 1, 1, NONE, NWEST, 0.0, 0.0); + SwingUtils.addComponent (pRDF, labelSigURL, 0, 1, 1, 1, NONE, NWEST, 0.0, 0.0, BREATH_TOP); + SwingUtils.addComponent (pRDF, sSigURL, 0, 2, 1, 1, HORI, NWEST, 1.0, 0.0); + SwingUtils.addComponent (pRDF, labelRDFPath, 0, 3, 1, 1, NONE, NWEST, 0.0, 0.0); + SwingUtils.addComponent (pRDF, localRDFFile, 0, 4, 1, 1, HORI, NWEST, 1.0, 0.0); + + // service type + JPanel serviceType = new JPanel (new GridBagLayout()); + JLabel labelST = new JLabel ("Service type: "); + sType = new JLabel (""); + 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); + + // put together service fields + JPanel defs = new JPanel (new GridBagLayout()); + SwingUtils.addComponent (defs, labelSName, 0, 0, 1, 1, NONE, NWEST, 0.0, 0.0); + SwingUtils.addComponent (defs, sName, 0, 1, 1, 1, HORI, NWEST, 1.0, 0.0); + SwingUtils.addComponent (defs, useAuth, 1, 1, 1, 1, NONE, NWEST, 0.0, 0.0, BREATH_LEFT); + SwingUtils.addComponent (defs, labelSAuth, 0, 2, 2, 1, NONE, NWEST, 0.0, 0.0); + SwingUtils.addComponent (defs, sAuth, 0, 3, 2, 1, HORI, NWEST, 1.0, 0.0); + SwingUtils.addComponent (defs, labelSEmail, 0, 4, 2, 1, NONE, NWEST, 0.0, 0.0); + SwingUtils.addComponent (defs, sEmail, 0, 5, 2, 1, HORI, NWEST, 1.0, 0.0); + SwingUtils.addComponent (defs, labelSURL, 0, 6, 2, 1, NONE, NWEST, 0.0, 0.0); + SwingUtils.addComponent (defs, sURL, 0, 7, 2, 1, HORI, NWEST, 1.0, 0.0); + SwingUtils.addComponent (defs, pRDF, 0, 8, 2, 1, HORI, NWEST, 1.0, 0.0, BREATH_TOP); + SwingUtils.addComponent (defs, serviceType, 0, 9, 2, 1, NONE, NWEST, 0.0, 0.0, BREATH_TOP); + + // description + sDescArea = new JTextArea(); + JPanel sDesc = createCustomTextArea ("Description", null, "serviceDesc", DP_REG_S_DESC, + sDescArea); + + // a tree with all service types + ServiceTypesBoard stBoard = + new ServiceTypesBoard (registryModel, + console, + propertyChannel, + new CustomServiceTypesTree2 (registryModel, console)); + stBoard.updateTree (CommonTree.SORTED_BY_NAME); + + JPanel main = createTitledPanel ("New Service"); + SwingUtils.addComponent (main, defs, 0, 0, 2, 1, HORI, NWEST, 1.0, 0.0); + SwingUtils.addComponent (main, sDesc, 0, 1, 1, 1, BOTH, NWEST, 1.0, 1.0, BREATH_TOP); + SwingUtils.addComponent (main, stBoard, 1, 1, 1, 1, BOTH, NWEST, 1.0, 1.0, BREATH_TOP_LEFT); + + // sub-panels for input/output data + JTabbedPane dataPane = new JTabbedPane(); + dataPane.addTab ("Primary Inputs", getPrimaryInputs()); + dataPane.addTab ("Secondary Inputs", getSecondaryInputs()); + dataPane.addTab ("Outputs", getOutputs()); + + // split data defs and service fields + JSplitPane split = new JSplitPane (JSplitPane.HORIZONTAL_SPLIT, + main, + dataPane); + split.setResizeWeight (0.3); + split.setContinuousLayout (true); + split.setOneTouchExpandable (true); + + // registration button + sRegisterButton = + createButton (" Register Service ", + "Register a new service in a Biomoby registry", + KeyEvent.VK_S, + new ActionListener() { + public void actionPerformed (ActionEvent e) { + onRegisterService(); + } + }); + sRegisterButton.setIcon (registerIcon); + sRegisterButton.setDisabledIcon (registerIconDis); + + // put it together + SwingUtils.addComponent (p, split, 0, 0, 1, 1, BOTH, NWEST, 1.0, 1.0); + SwingUtils.addComponent (p, sRegisterButton, 0, 1, 1, 1, NONE, CENTER, 0.0, 0.0); return p; } /************************************************************************** + * + **************************************************************************/ + protected void onUseRDFSignature (boolean enabled) { + sSigURL.setEnabled (enabled); + labelSigURL.setEnabled (enabled); + localRDFFile.setEnabled (enabled); + labelRDFPath.setEnabled (enabled); + setPrefValue (USE_SIGNATURE, enabled); + propertyChannel.put (DP_USE_SIGNATURE, new Boolean (enabled).toString()); + } + + /************************************************************************** + * + **************************************************************************/ + protected void onAuth (boolean enabled) { + setPrefValue (USE_AUTHORITATIVE, enabled); + propertyChannel.put (DP_USE_AUTHORITATIVE, new Boolean (enabled).toString()); + } + + /************************************************************************** + * + **************************************************************************/ + protected JPanel getPrimaryInputs() { + JPanel p = new JPanel (new GridBagLayout()); + return p; + } + + /************************************************************************** + * + **************************************************************************/ + protected JPanel getSecondaryInputs() { + JPanel p = new JPanel (new GridBagLayout()); + return p; + } + + /************************************************************************** + * + **************************************************************************/ + protected JPanel getOutputs() { + JPanel p = new JPanel (new GridBagLayout()); + return p; + } + + /************************************************************************** * Panel to register a namespace and a service type. **************************************************************************/ protected JPanel getOtherRegistration() { @@ -728,6 +902,75 @@ /************************************************************************** * **************************************************************************/ + public void onRegisterService() { + sRegisterButton.setEnabled (false); + sException = null; + final SwingWorker worker = new SwingWorker() { + public Object construct() { + try { + String value = sName.getText(); + if (UUtils.isEmpty (value)) { + sException = new MobyException ("Service name is still missing. Please fill it first."); + return null; + } + MobyService service = new MobyService (value); + + value = sAuth.getText(); + if (UUtils.isEmpty (value)) { + sException = new MobyException ("Every service must have an authority.\n" + + "Please fill it."); + return null; + } + service.setAuthority (value); + + value = sEmail.getText(); + if (UUtils.isEmpty (value)) { + sException = new MobyException ("Every service must have a contact person.\n" + + "Please fill in an email address."); + return null; + } + service.setEmailContact (value); + + value = sDescArea.getText(); + if (UUtils.isEmpty (value)) { + sException = new MobyException ("Every service must have a description.\n" + + "Please fill in the most detailed one."); + return null; + } + service.setDescription (value); + + value = sType.getText(); + if (UUtils.isEmpty (value)) { + sException = new MobyException ("Every service must belong to an existing service type.\n" + + "Please select a type from available service types."); + return null; + } + service.setType (value); + + console.setText ("Service to be registered:\n" + + "-------------------------\n" + service.toString()); + registryModel.registerService (service); + console.setText ("\nRegistration successful!\n\n"); + + } catch (MobyException e) { + sException = e; + } + return null; // not used here + } + + // runs on the event-dispatching thread. + public void finished() { + if (sException != null) + error (SERVICE_PROLOGUE, sException); + sRegisterButton.setEnabled (true); + } + }; + worker.start(); + } + + /************************************************************************** + * + **************************************************************************/ public String getName() { return "Biomoby Registration"; } @@ -1235,4 +1478,48 @@ } + + /************************************************************************** + * + * Customized tree of service types - use for service registration + * + **************************************************************************/ + protected class CustomServiceTypesTree2 + extends ServiceTypesTree { + + /********************************************************************* + * Construtor + ********************************************************************/ + public CustomServiceTypesTree2 (RegistryModel model, + CommonConsole console) { + super (model, console); + } + + /********************************************************************* + * + ********************************************************************/ + protected void createPopups (String title) { + super.createPopups (title); + removeFromPopups (AC_RELOAD); + removeSeparatorAfter (AC_COLLAPSE); + } + + /********************************************************************* + * + ********************************************************************/ + protected void setEnabledPopup (boolean enabled) { + super.setEnabledPopup (enabled); + selected (null); + } + + /********************************************************************* + * Copy selected service type to the service fields. + ********************************************************************/ + 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()); + } + } } From mwilkinson at pub.open-bio.org Thu Nov 3 11:39:42 2005 From: mwilkinson at pub.open-bio.org (Mark Wilkinson) Date: Thu Nov 3 11:37:23 2005 Subject: [MOBY-guts] biomoby commit Message-ID: <200511031639.jA3Gdgsn021261@pub.open-bio.org> mwilkinson Thu Nov 3 11:39:42 EST 2005 Update of /home/repository/moby/moby-live/Docs/MOBY-S_API/Perl In directory pub.open-bio.org:/tmp/cvs-serv21242 Modified Files: ConstructingYourService.html Log Message: fixed a URL typo and added a link to the register service tutorial moby-live/Docs/MOBY-S_API/Perl ConstructingYourService.html,1.3,1.4 =================================================================== RCS file: /home/repository/moby/moby-live/Docs/MOBY-S_API/Perl/ConstructingYourService.html,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- /home/repository/moby/moby-live/Docs/MOBY-S_API/Perl/ConstructingYourService.html 2005/09/28 00:24:26 1.3 +++ /home/repository/moby/moby-live/Docs/MOBY-S_API/Perl/ConstructingYourService.html 2005/11/03 16:39:42 1.4 @@ -27,7 +27,7 @@