[MOBY-guts] biomoby commit
Martin Senger
senger at pub.open-bio.org
Fri Aug 26 06:27:04 UTC 2005
senger
Fri Aug 26 02:27:04 EDT 2005
Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/client
In directory pub.open-bio.org:/tmp/cvs-serv2547/src/main/org/biomoby/client
Modified Files:
CentralDigestCachedImpl.java CentralImpl.java Graphviz.java
ServiceConnections.java
Added Files:
FilterDataTypes.java
Log Message:
moby-live/Java/src/main/org/biomoby/client FilterDataTypes.java,NONE,1.1 CentralDigestCachedImpl.java,1.4,1.5 CentralImpl.java,1.23,1.24 Graphviz.java,1.8,1.9 ServiceConnections.java,1.5,1.6
===================================================================
RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/CentralDigestCachedImpl.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/client/CentralDigestCachedImpl.java 2005/05/19 15:57:25 1.4
+++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/CentralDigestCachedImpl.java 2005/08/26 06:27:04 1.5
@@ -36,7 +36,7 @@
* directory, or calls {@link #removeFromCache}). <p>
* This class can be used also without caching - just instantiate it
- * wit 'cacheDir' set to null in the constructor. <p>
+ * with 'cacheDir' set to null in the constructor. <p>
*
* @author <A HREF="mailto:senger at ebi.ac.uk">Martin Senger</A>
* @version $Id$
@@ -238,7 +238,8 @@
// create a file and put into it data to be cached
protected void store (File cache, String name, String data)
throws MobyException {
- File outputFile = new File (cache.getAbsolutePath() + fileSeparator + clean (name));
+// File outputFile = new File (cache.getAbsolutePath() + fileSeparator + clean (name));
+ File outputFile = new File (cache.getAbsolutePath() + fileSeparator + name);
try {
PrintWriter fileout =
new PrintWriter (new BufferedOutputStream (new FileOutputStream (outputFile)));
@@ -333,9 +334,12 @@
throw new MobyException ("Surprisingly, '" + dataTypesCache.getAbsolutePath() + "' is not a directory. Strange...");
for (int i = 0; i < list.length; i++) {
try {
+ if (list[i].getPath().endsWith ("~"))
+ continue; // ignore some files
v.addElement (createDataTypeFromXML (load (list[i]), "-dummy-"));
} catch (NoSuccessException e) {
- throw new MobyException (e.getMessage());
+ System.err.println ("Ignoring '" + list[i].getPath() + "'. It should not be in the cache directory.");
+// throw new MobyException (e.getMessage() + " (" + e.getCulprit() + ")");
}
}
MobyDataType[] result = new MobyDataType [v.size()];
@@ -359,6 +363,8 @@
if (list == null)
throw new MobyException ("Surprisingly, '" + servicesCache.getAbsolutePath() + "' is not a directory. Strange...");
for (int i = 0; i < list.length; i++) {
+ if (list[i].getPath().endsWith ("~"))
+ continue; // ignore some files
MobyService[] servs = extractServices (load (list[i]));
for (int j = 0; j < servs.length; j++)
v.addElement (servs[j]);
===================================================================
RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/CentralImpl.java,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -r1.23 -r1.24
--- /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/CentralImpl.java 2005/08/07 06:30:23 1.23
+++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/CentralImpl.java 2005/08/26 06:27:04 1.24
@@ -7,24 +7,6 @@
package org.biomoby.client;
-import java.io.ByteArrayInputStream;
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.PrintStream;
-import java.io.InputStream;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.util.HashMap;
-import java.util.Hashtable;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.Properties;
-import java.util.Vector;
-
-import org.apache.axis.AxisFault;
-import org.apache.axis.client.Call;
-import org.apache.axis.client.Service;
import org.biomoby.shared.Central;
import org.biomoby.shared.MobyData;
import org.biomoby.shared.MobyDataType;
@@ -40,11 +22,33 @@
import org.biomoby.shared.PendingCurationException;
import org.biomoby.shared.Utils;
import org.biomoby.shared.MobyResourceRef;
+
+import embl.ebi.soap.axis.AxisUtils;
+
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
+import org.apache.axis.AxisFault;
+import org.apache.axis.client.Call;
+import org.apache.axis.client.Service;
+
+import java.io.ByteArrayInputStream;
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.PrintStream;
+import java.io.InputStream;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.HashMap;
+import java.util.Hashtable;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Properties;
+import java.util.Vector;
+
/**
* A default implementation of the
* interface {@link org.biomoby.shared.Central Central}
@@ -130,9 +134,9 @@
public CentralImpl (String endpoint, String namespace)
throws MobyException {
- if (endpoint == null)
+ if (endpoint == null || "".equals (endpoint.trim()))
endpoint = DEFAULT_ENDPOINT;
- if (namespace == null)
+ if (namespace == null || "".equals (namespace.trim()))
namespace = DEFAULT_NAMESPACE;
try {
@@ -193,8 +197,9 @@
}
} catch (AxisFault e) {
- throw new MobyException (Utils.formatFault (e, endpoint.toString(),
- (call == null ? null : call.getOperationName())));
+ throw new MobyException
+ (AxisUtils.formatFault (e, endpoint.toString(),
+ (call == null ? null : call.getOperationName())));
} catch (Exception e) {
throw new MobyException (e.toString());
// e.printStackTrace();
===================================================================
RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/Graphviz.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/client/Graphviz.java 2005/07/19 12:39:59 1.8
+++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/Graphviz.java 2005/08/26 06:27:04 1.9
@@ -34,6 +34,29 @@
*/
public static final String PROP_RANKDIR = "rankdir";
+ /** Property name. It contains a name of an element that should
+ be highlighted in the resulting graph.
+ */
+ public static final String PROP_HIGHLIGHT = "highlight";
+
+ /** Property name. It contains a name of a color that should be
+ used to highlight an element (see {@link
+ #PROP_HIGHLIGHT}. Default is "cyan2".
+ */
+ public static final String PROP_HIGHLIGHT_COLOR = "highlightcolor";
+
+ /** Property name. It indicates that the graph should create URLs
+ for graph nodes (except the highlighted one - see @{link
+ #PROP_HIGHLIGHT}). The default URL is taken from this
+ property. If this property exists but has an empty value, the
+ URL for individual nodes are still going to be created, but
+ not the deafult one. The URLs for individual nodes are taken
+ from the "comment" field of the data objects for whom are
+ nodes created. No URL is created for a node where the comment
+ field is empty.
+ */
+ public static final String PROP_IMAGEMAP = "imagemap";
+
/*************************************************************************
* Creates a graph connecting Moby services as defined in a set of
* the graph 'edges'. <p>
@@ -255,6 +278,43 @@
buf.append ("digraph MobyDataTypes {\n");
buf.append ("\trankdir=" + props.getProperty (PROP_RANKDIR, "LR") + ";\n");
buf.append ("\tedge [dir=back,arrowtail=empty];\n");
+
+ String highlighted = props.getProperty (PROP_HIGHLIGHT);
+ if (highlighted != null) {
+ for (int i = 0; i < dataTypes.length; i++) {
+ if (highlighted.equals (dataTypes[i].getName())) {
+ buf.append ("\t");
+ buf.append (quoteIt (trName (Utils.pureName (highlighted))));
+ buf.append (" [fillcolor=");
+ buf.append (quoteIt (props.getProperty (PROP_HIGHLIGHT_COLOR, "cyan2")));
+ buf.append (",style=filled];\n");
+ break;
+ }
+ }
+ }
+
+ String defaultURL = props.getProperty (PROP_IMAGEMAP);
+ if (defaultURL != null) {
+ if (! "".equals (defaultURL)) {
+ buf.append ("\tURL=\"");
+ buf.append (defaultURL);
+ buf.append ("\";\n");
+ }
+ for (int i = 0; i < dataTypes.length; i++) {
+ String name = dataTypes[i].getName();
+ if (name.equals (highlighted))
+ continue; // no hyperlink for the highlighted one
+ String hyperlink = dataTypes[i].getComment();
+ if (hyperlink != null && ! "".equals (hyperlink.trim())) {
+ buf.append ("\t");
+ buf.append (quoteIt (trName (Utils.pureName (name))));
+ buf.append (" [URL=\"");
+ buf.append (hyperlink);
+ buf.append ("\"];\n");
+ }
+ }
+ }
+
for (int d = 0; d < dataTypes.length; d++) {
MobyDataType type = dataTypes[d];
String name = Utils.pureName (type.getName());
===================================================================
RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/ServiceConnections.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/client/ServiceConnections.java 2005/07/19 12:39:59 1.5
+++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/ServiceConnections.java 2005/08/26 06:27:04 1.6
@@ -41,7 +41,7 @@
/*************************************************************************
- * Make te data types better searchable. This is a public method
+ * Make the data types better searchable. This is a public method
* because for optimalization purposes it is often better to make
* the hashtable only once.
*
More information about the MOBY-guts
mailing list