[MOBY-guts] biomoby commit

senger@ebi.ac.uk senger at pub.open-bio.org
Sun Nov 9 01:05:03 UTC 2003


senger
Sat Nov  8 20:05:02 EST 2003
Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/client
In directory pub.open-bio.org:/tmp/cvs-serv21510/src/main/org/biomoby/client

Modified Files:
	FileCache.java GraphsServlet.java 
Log Message:


moby-live/Java/src/main/org/biomoby/client FileCache.java,1.1,1.2 GraphsServlet.java,1.1,1.2
===================================================================
RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/FileCache.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/client/FileCache.java	2003/11/08 00:27:24	1.1
+++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/FileCache.java	2003/11/09 01:05:02	1.2
@@ -128,7 +128,7 @@
 	parent.mkdirs();
  	if (parent.exists())
 	    return filename;
-	throw new IOException ("Cannot create all needed directories.");
+	throw new IOException ("Cannot create all needed directories: '" + parent.toString() + "'.");
     }
 
     /**************************************************************************

===================================================================
RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/GraphsServlet.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/client/GraphsServlet.java	2003/11/08 00:27:24	1.1
+++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/GraphsServlet.java	2003/11/09 01:05:02	1.2
@@ -41,6 +41,10 @@
     static final protected String CACHE_URL = "cache_url";
     static final protected String DEFAULT_ENDPOINT = "default_endpoint";
     static final protected String DEFAULT_NAMESPACE = "default_namespace";
+    static final protected String PROXY_SET = "proxySet";
+    static final protected String PROXY_PORT = "http.proxyPort";
+    static final protected String PROXY_HOST = "http.proxyHost";
+    static final protected String DOT_PATH = "dot_path";
 
     // expected/known form's element names
     static final protected String VERBOSE = "verbose";
@@ -214,6 +218,19 @@
 	defaultNamespace = (String)initParams.get (DEFAULT_NAMESPACE);
 	if (UUtils.isEmpty (defaultNamespace))
 	    defaultNamespace = CentralImpl.DEFAULT_NAMESPACE;
+
+	// set HTTP proxy - this is probably useless because (I guess)
+	// the proxy can be set in the Tomcat configuration file (and
+	// not to let each servlet to do it) - but it's here, anyway
+	String proxySet = (String)initParams.get (PROXY_SET);
+	if (! UUtils.isEmpty (proxySet))
+	    System.setProperty (PROXY_SET, proxySet);
+	String proxyPort = (String)initParams.get (PROXY_PORT);
+	if (! UUtils.isEmpty (proxyPort))
+	    System.setProperty (PROXY_PORT, proxyPort);
+	String proxyHost = (String)initParams.get (PROXY_HOST);
+	if (! UUtils.isEmpty (proxyHost))
+	    System.setProperty (PROXY_HOST, proxyHost);
     }
 
     /*************************************************************************
@@ -648,6 +665,12 @@
 		} else {
 		    graph = Graphviz.createServicesGraph (edges, props);
 
+		    // where is the 'dot' program
+		    String dotProg = "dot";
+		    String dotPath = getString (req, DOT_PATH);
+		    if (dotPath != null)
+			dotProg = dotPath + System.getProperty ("file.sparator") + dotProg;
+
 		    // depending on the cache implementation we may ask
 		    // 'dot' to produce output to its standard output, or
 		    // to write to a file
@@ -657,12 +680,12 @@
 			String filename = cache.getFilename (id);
 
 			// call 'dot' to create a real graph in a 'filename'
-			executeDot (graph, wantedOutputType, filename);
+			executeDot (dotProg, graph, wantedOutputType, filename);
 
 		    } else {
 
 			// call 'dot' to return a real graph as byte array
-			byte[] graphBytes = executeDot (graph, wantedOutputType);
+			byte[] graphBytes = executeDot (dotProg, graph, wantedOutputType);
 			if (graphBytes == null || graphBytes.length == 0)
 			    throw new MobyException ("An empty graph. Strange.");
 			cache.setContents (id, graphBytes);
@@ -716,6 +739,13 @@
 		log ("Creating a graph of the data types...\n");
 		String dotGraph = Graphviz.createDataTypesGraph (dataTypes, props);
 
+
+		// where is the 'dot' program
+		String dotProg = "dot";
+		String dotPath = getString (req, DOT_PATH);
+		if (dotPath != null)
+		    dotProg = dotPath + System.getProperty ("file.sparator") + dotProg;
+
 		// depending on the cache implementation we may ask
 		// 'dot' to produce output to its standard output, or
 		// to write to a file
@@ -725,12 +755,12 @@
 		    String filename = cache.getFilename (id);
 
 		    // call 'dot' to create a real graph in a 'filename'
-		    executeDot (dotGraph, wantedOutputType, filename);
+		    executeDot (dotProg, dotGraph, wantedOutputType, filename);
 
 		} else {
 
 		    // call 'dot' to return a real graph as byte array
-		    byte[] graph = executeDot (dotGraph, wantedOutputType);
+		    byte[] graph = executeDot (dotProg, dotGraph, wantedOutputType);
 		    if (graph == null || graph.length == 0)
 			throw new MobyException ("An empty graph. Strange.");
 		    cache.setContents (id, graph);
@@ -821,17 +851,18 @@
     }
 
     /********************************************************************
-     * Execute 'dot' program with the given graph description in
+     * Execute 'dotProg' program with the given graph description in
      * 'dotGraph' in order to create a graph in 'outputType'
      * format. The graph is created in the given file 'filename'.
      ********************************************************************/
-    protected void executeDot (String dotGraph, String outputType, String filename)
+    protected void executeDot (String dotProg, String dotGraph,
+			       String outputType, String filename)
 	throws MobyException {
 
 	if (outputType.equals ("txt"))
 	    outputType = "plain-ext";
 
-	String[] cmdLine = new String[] { "dot", "-T" + outputType, "-o" + filename };
+	String[] cmdLine = new String[] { dotProg, "-T" + outputType, "-o" + filename };
         String[] envArr = new String[] {};   // no environment
 	try {
 	    // start an external process
@@ -852,17 +883,17 @@
     }
 
     /********************************************************************
-     * Execute 'dot' program with the given graph description in
+     * Execute 'dotProg' program with the given graph description in
      * 'dotGraph' in order to create a graph in 'outputType'
      * format. The created graph is returned back as a byte array.
      ********************************************************************/
-    protected byte[] executeDot (String dotGraph, String outputType)
+    protected byte[] executeDot (String dotProg, String dotGraph, String outputType)
 	throws MobyException {
 
 	if (outputType.equals ("txt"))
 	    outputType = "plain-ext";
 
-	String[] cmdLine = new String[] { "dot", "-T" + outputType };
+	String[] cmdLine = new String[] { dotProg, "-T" + outputType };
         String[] envArr = new String[] {};   // no environment
 	try {
 	    // start an external process




More information about the MOBY-guts mailing list