[MOBY-guts] biomoby commit
Martin Senger
senger at pub.open-bio.org
Tue Nov 15 03:25:51 UTC 2005
senger
Mon Nov 14 22:25:51 EST 2005
Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard
In directory pub.open-bio.org:/tmp/cvs-serv29860/src/main/org/biomoby/service/dashboard
Modified Files:
AbstractPanel.java DashboardProperties.java
GeneratorPanel.java NOTES RegistrationServiceSubPanel.java
Log Message:
moby-live/Java/src/main/org/biomoby/service/dashboard AbstractPanel.java,1.20,1.21 DashboardProperties.java,1.15,1.16 GeneratorPanel.java,1.1,1.2 NOTES,1.25,1.26 RegistrationServiceSubPanel.java,1.7,1.8
===================================================================
RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/AbstractPanel.java,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -r1.20 -r1.21
--- /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/AbstractPanel.java 2005/11/12 16:43:47 1.20
+++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/AbstractPanel.java 2005/11/15 03:25:51 1.21
@@ -428,7 +428,7 @@
protected JSplitPane hSplit (Component a, Component b, double weight) {
JSplitPane split = new JSplitPane (JSplitPane.HORIZONTAL_SPLIT,
a, b);
- split.setResizeWeight (0.5);
+ split.setResizeWeight (weight);
split.setContinuousLayout (true);
split.setOneTouchExpandable (true);
return split;
@@ -441,7 +441,7 @@
protected JSplitPane vSplit (Component a, Component b, double weight) {
JSplitPane split = new JSplitPane (JSplitPane.VERTICAL_SPLIT,
a, b);
- split.setResizeWeight (0.5);
+ split.setResizeWeight (weight);
split.setContinuousLayout (true);
split.setOneTouchExpandable (true);
return split;
===================================================================
RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/DashboardProperties.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/DashboardProperties.java 2005/11/10 14:32:42 1.15
+++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/DashboardProperties.java 2005/11/15 03:25:51 1.16
@@ -52,7 +52,6 @@
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";
===================================================================
RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/GeneratorPanel.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/GeneratorPanel.java 2005/11/11 08:35:58 1.1
+++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/GeneratorPanel.java 2005/11/15 03:25:51 1.2
@@ -17,8 +17,11 @@
import javax.swing.JPanel;
import javax.swing.JLabel;
+import javax.swing.JTextArea;
import javax.swing.Icon;
import javax.swing.JButton;
+import javax.swing.JRadioButton;
+import javax.swing.ButtonGroup;
import javax.swing.JCheckBox;
import javax.swing.JOptionPane;
import javax.swing.JFileChooser;
@@ -64,17 +67,17 @@
// components that are used from more methods
CommonConsole console;
+ JFileChooserWithHistory jmobyDir;
JFileChooserWithHistory outputDir;
JFileChooserWithHistory javadocDir;
JFileChooserWithHistory dotLocation;
JLabel labelDotLocation;
-
+ JTextArea selectName, selectAuth;
JCheckBox dtGenerate, dtCompile, dtJavadoc;
JCheckBox sGenerate, sCompile, sJavadoc;
JCheckBox simulate, useDot;
JButton dtgenButton, sgenButton, bothButton;
-
- DataTypesBoard dataTypesBoard;
+ JRadioButton fNone, fBiocase, fSoaplab, fHibernate;
ServicesBoard servicesBoard;
// shared icons
@@ -121,16 +124,23 @@
console = new CommonConsole();
console.setAppendMode (true);
- // ontology trees
- dataTypesBoard = new DataTypesBoard (registryModel,
- console,
- propertyChannel);
- dataTypesBoard.updateTree (CommonTree.SORTED_BY_NAME);
+ // service ontology tree
servicesBoard = new ServicesBoard (registryModel,
console,
propertyChannel);
servicesBoard.updateTree (CommonTree.SORTED_BY_AUTHORITY);
+ // areas for selecting services
+ selectName = new JTextArea();
+ JPanel filterName =
+ createCustomTextArea ("Filter services by name", null, "filterServices", null, selectName);
+ selectAuth = new JTextArea();
+ JPanel filterAuth =
+ createCustomTextArea ("Filter services by authorities", null, "filterAuthorities", null, selectAuth);
+ JPanel select = createTitledPanel ("Services to generate code for");
+ SwingUtils.addComponent (select, filterName, 0, 0, 1, 1, BOTH, NWEST, 1.0, 1.0);
+ SwingUtils.addComponent (select, filterAuth, 0, 1, 1, 1, BOTH, NWEST, 1.0, 1.0, BREATH_TOP);
+
// what to do for datatypes
JPanel genData = createTitledPanel ("Data Types");
dtGenerate = createActionBox ("Generate code", USE_DT_GEN);
@@ -210,10 +220,24 @@
SwingUtils.addComponent (options, labelDotLocation, 0, 2, 1, 1, NONE, NWEST, 0.0, 0.0, BREATH_TOP);
SwingUtils.addComponent (options, dotLocation, 0, 3, 1, 1, HORI, NWEST, 1.0, 0.0);
- // panel with options
- JPanel outputs = createTitledPanel ("Output locations");
+ // panel with jMoby dir
+ JPanel jMoby = createTitledPanel ("jMoby");
File currentDir = new File (System.getProperty ("user.dir"));
+ JLabel labelJMoby = new JLabel ("Directory with a local copy of jMoby");
+ jmobyDir = createFileSelector ("Select directory with jMoby",
+ "Select",
+ currentDir.getAbsolutePath(),
+ "jMobyHome",
+ null);
+ jmobyDir.getFileChooser().setFileSelectionMode (JFileChooser.DIRECTORIES_ONLY);
+
+ SwingUtils.addComponent (jMoby, labelJMoby, 0, 0, 1, 1, NONE, NWEST, 0.0, 0.0);
+ SwingUtils.addComponent (jMoby, jmobyDir, 0, 1, 1, 1, HORI, NWEST, 1.0, 0.0);
+
+ // panel with output dirs
+ JPanel outputs = createTitledPanel ("Output locations");
+
JLabel labelOutput = new JLabel ("Output directory for generated code");
outputDir = createFileSelector ("Select directory for generated code",
"Select",
@@ -221,7 +245,7 @@
"generatedDirectory",
null);
outputDir.getFileChooser().setFileSelectionMode (JFileChooser.DIRECTORIES_ONLY);
- JLabel labelJavadoc = new JLabel ("Output directory for generated code");
+ JLabel labelJavadoc = new JLabel ("Output directory for javadoc API");
javadocDir = createFileSelector ("Select directory for generated javadoc",
"Select",
new File (currentDir, "docs/APIservices").getAbsolutePath(),
@@ -234,18 +258,47 @@
SwingUtils.addComponent (outputs, labelJavadoc, 0, 2, 1, 1, NONE, NWEST, 0.0, 0.0);
SwingUtils.addComponent (outputs, javadocDir, 0, 3, 1, 1, HORI, NWEST, 1.0, 0.0);
+ // all-in-one button
+ bothButton =
+ createButton (" All-In-One: Do it all ",
+ "Do everything for all/selected datatypes and service",
+ KeyEvent.VK_A,
+ new ActionListener() {
+ public void actionPerformed (ActionEvent e) {
+ onBoth();
+ }
+ });
+ bothButton.setIcon (genIcon);
+ bothButton.setDisabledIcon (genIconDis);
+
+ // TBD: Moses flavours
+ JPanel flavours = createTitledPanel ("MoSeS service generator's flavours");
+ ButtonGroup group = new ButtonGroup();
+ group.add (fNone = createFlavourBox ("General service - no specific flavour"));
+ group.add (fSoaplab = createFlavourBox ("Analysis service based on Soaplab"));
+ group.add (fBiocase = createFlavourBox ("Database service based on BioCase"));
+ group.add (fHibernate = createFlavourBox ("Database service based on Hibernate"));
+ fNone.setSelected (true);
+ fNone.setEnabled (true);
+
+ SwingUtils.addComponent (flavours, fNone, 0, 0, 1, 1, HORI, NWEST, 1.0, 0.0);
+ SwingUtils.addComponent (flavours, fSoaplab, 0, 1, 1, 1, NONE, NWEST, 0.0, 0.0);
+ SwingUtils.addComponent (flavours, fBiocase, 0, 2, 1, 1, NONE, NWEST, 0.0, 0.0);
+ SwingUtils.addComponent (flavours, fHibernate, 0, 3, 1, 1, NONE, NWEST, 0.0, 0.0);
+
// split it into moving panels
JSplitPane split = vSplit (hSplit (servicesBoard,
- dataTypesBoard, 0.5),
- console, 0.6);
+ select, 0.5),
+ console, 0.25);
// put all together
- SwingUtils.addComponent (pComponent, split, 0, 0, 1, 4, BOTH, NWEST, 1.0, 1.0);
- SwingUtils.addComponent (pComponent, outputs, 1, 0, 2, 1, HORI, NWEST, 0.0, 0.0);
- SwingUtils.addComponent (pComponent, options, 1, 1, 2, 1, HORI, NWEST, 0.0, 0.0);
- SwingUtils.addComponent (pComponent, genData, 1, 2, 1, 1, HORI, NWEST, 0.0, 0.0);
- SwingUtils.addComponent (pComponent, genSkel, 2, 2, 1, 1, HORI, NWEST, 0.0, 0.0);
-// SwingUtils.addComponent (pComponent, genData, 1, 2, 1, 1, HORI, NWEST, 0.0, 0.0);
-// SwingUtils.addComponent (pComponent, genSkel, 1, 3, 1, 1, HORI, NWEST, 0.0, 0.0);
+ SwingUtils.addComponent (pComponent, split, 0, 0, 1, 7, BOTH, NWEST, 1.0, 1.0);
+ SwingUtils.addComponent (pComponent, jMoby, 1, 0, 2, 1, HORI, NWEST, 0.0, 0.0);
+ SwingUtils.addComponent (pComponent, outputs, 1, 1, 2, 1, HORI, NWEST, 0.0, 0.0);
+ SwingUtils.addComponent (pComponent, options, 1, 2, 2, 1, HORI, NWEST, 0.0, 0.0);
+ SwingUtils.addComponent (pComponent, flavours, 1, 3, 2, 1, HORI, NWEST, 0.0, 0.0);
+ SwingUtils.addComponent (pComponent, genData, 1, 4, 1, 1, HORI, NWEST, 0.0, 0.0);
+ SwingUtils.addComponent (pComponent, genSkel, 2, 4, 1, 1, HORI, NWEST, 0.0, 0.0);
+ SwingUtils.addComponent (pComponent, bothButton, 1, 5, 2, 1, NONE, CENTER, 0.0, 0.0, BREATH_TOP);
return pComponent;
}
@@ -264,6 +317,15 @@
}
/**************************************************************************
+ * Create a specialized check box (use for Moses flavours).
+ **************************************************************************/
+ private JRadioButton createFlavourBox (String title) {
+ JRadioButton radio = new JRadioButton (title);
+ radio.setEnabled (false);
+ return radio;
+ }
+
+ /**************************************************************************
* Generate datatypes...
**************************************************************************/
protected void onDataTypes() {
@@ -276,6 +338,12 @@
}
/**************************************************************************
+ * Generate both...
+ **************************************************************************/
+ protected void onBoth() {
+ }
+
+ /**************************************************************************
* Select/unselect using graphics...
**************************************************************************/
protected void onUseDot (boolean enabled) {
===================================================================
RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/NOTES,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -r1.25 -r1.26
--- /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/NOTES 2005/11/12 16:43:47 1.25
+++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/NOTES 2005/11/15 03:25:51 1.26
@@ -1,7 +1,5 @@
* Add Throwable.initCause() etc. into exception handling
-* Add Alt-x for quick changing panels
-
* Why are not services sorted by name, the first time they appear in
Registry browser?
@@ -11,7 +9,7 @@
* move various exceptions from being global to the swing workers
* FWK005 parse may not be called while parsing.
- - probably when too many network request together
+ - probably when too many network requests together
---
* More testing:
- interrupting loading
@@ -204,3 +202,93 @@
mouse (selected first), otherwise it is annoying
+---
+The error seems to be with Xerces writing out an XML file. Under
+Linux, Xerces writes UTF-8 data correctly. Under Windows however,
+Xerces outputs ISO-8859-1 instead, even though it has been expressly
+told to output UTF-8. The code to output the XML is as follows:
+
+Writer writer = new FileWriter(this.workboxFile);
+ OutputFormat outputFormat = new OutputFormat("xml", "UTF-8", true);
+ XMLSerializer serial = new XMLSerializer(writer, outputFormat);
+ serial.asDOMSerializer();
+ serial.serialize(this.workboxDocument);
+ writer.close();
+----
+http://jena.sourceforge.net/IO/iohowto.html
+----
+ This is neither a Xerces bug or a bug in Java.
+
+Investigating this further, this is definitely a bug in Java which is
+then not trapped by Xerces - the FileWriter opens the file with an
+unpredictable encoding different per platform, which is definitely
+broken behaviour. Xerces then silently allows this problem to remain
+unchecked through encoding, when in reality it should have thrown an
+exception.
+
+ When you pass the serializer a Writer rather than an OutputStream
+it will write characters not bytes. If the Writer is writing to an
+OutputStream, it is responsible for encoding the characters and will
+do whatever it does regardless of what encoding you specified on the
+serializer.
+
+
+Which in turn produces broken XML - What Xerces should be doing is
+testing the encoding of the underlying Writer, and if different from
+the encoding specified for serialisation, it should throw an exception
+and fail safely, rather than quietly continuing rendering broken
+output.
+
+http://java.sun.com/j2se/1.4.2/docs/api/java/io/OutputStreamWriter.html#getEncodin
+----
+http://www.mail-archive.com/j-dev@xerces.apache.org/msg00040.html
+----
+I understand your annoyance, but I agree with the other posters.
+
+The Xalan-J serializer Javadoc
+http://xml.apache.org/xalan-j/apidocs/org/apache/xml/serializer/
+Serializer.html#setWriter(java.io.Writer) has an explicit warning that
+the serializer and writer must have consistent encodings. It would
+probably be beneficial if a similar (or maybe more emphatic) warning
+were placed in the Javadoc for XMLSerializer(Writer,
+OutputFormat). However, the problems of representing an XML document
+as a string (or any sequence of characters) are well known.
+
+XML is not text data, the XML recommendation tells how to convert an
+XML document into a stream of bytes. If you break that into two steps,
+document -> characters -> bytes the steps have to be consistent and as
+Jeremy pointed out there is no effective way for the serializer to
+detect and adjust itself to the writer's encoding.
+
+The Xerces-J team has no power to change to the Java platform's
+behavior even if it was a bug. That FileWriter would use the default
+platform encoding appears to be documented in
+http://java.sun.com/j2se/1.5.0/docs/api/java/io/FileWriter.html:
+
+The constructors of this class assume that the default character
+encoding and the default byte-buffer size are acceptable. To specify
+these values yourself, construct an OutputStreamWriter on a
+FileOutputStream.
+
+However, unless you have a specific need to serialize to a sequence of
+characters (for example, to fill in a UI widget), use the forms that
+take an OutputStream and let the serializer control the entire
+process.
+---
+Omitting all the Writer-based methods to encourage Stream usage wouldn't
+have been a bad idea either (like DocumentBuilder and SAXParser for the
+same problem on the other end). But it's a bit late now I suppose.
+
+Over the years, I've seen probably every programmer new to XML fall
+into the same pitfall when they try do this. "Well this is text, it
+makes the most sense to use the Writer version...", they inevitably
+think, and it often takes a lot of explaining to convince them
+otherwise. I shudder to imagine how many wrong implementations there
+are out there because it works most of the time.
+---
+
+Similarly use of a FileReader to read XML is an error, using an
+InputStream is much better, except in special circumstances.
+----
+FOR ME: perhaps to try to change load() in CentralDigestCachedImpl...
+----
===================================================================
RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/RegistrationServiceSubPanel.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/RegistrationServiceSubPanel.java 2005/11/12 16:43:47 1.7
+++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/RegistrationServiceSubPanel.java 2005/11/15 03:25:51 1.8
@@ -173,8 +173,7 @@
// description
sDescArea = new JTextArea();
- JPanel sDesc = createCustomTextArea ("Description", null, "serviceDesc", DP_REG_S_DESC,
- sDescArea);
+ JPanel sDesc = createCustomTextArea ("Description", null, "serviceDesc", null, sDescArea);
// a tree with all service types
ServiceTypesBoard stBoard =
More information about the MOBY-guts
mailing list