[MOBY-guts] biomoby commit

Paul Gordon gordonp at dev.open-bio.org
Thu Dec 6 18:47:58 UTC 2007


gordonp
Thu Dec  6 13:47:58 EST 2007
Update of /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/seahawk/util
In directory dev.open-bio.org:/tmp/cvs-serv26586/src/main/ca/ucalgary/seahawk/util

Modified Files:
	SeahawkOptions.java 
Log Message:
Added support for office document conversion proxy settings
moby-live/Java/src/main/ca/ucalgary/seahawk/util SeahawkOptions.java,1.4,1.5
===================================================================
RCS file: /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/seahawk/util/SeahawkOptions.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/seahawk/util/SeahawkOptions.java	2007/06/16 00:26:38	1.4
+++ /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/seahawk/util/SeahawkOptions.java	2007/12/06 18:47:58	1.5
@@ -17,6 +17,8 @@
     public static final String REGISTRY_SYNONYM_PROP = "registrySynonym";
     public static final String REGISTRY_ENDPOINT_PROP = "registryEndpoint";
     public static final String REGISTRY_NAMESPACE_PROP = "registryNamespace";
+    public static final String CONVERTER_HOST_PROP = "documentConverterHost";
+    public static final String CONVERTER_PORT_PROP = "documentConverterPort";
     public static final String CUSTOM_REGISTRY_SYNONYM = "custom";
 
     public static final String PROPS_FILE_NAME = "seahawkUserPrefs.xml";
@@ -29,6 +31,9 @@
     private static File tmpDir = new File(System.getProperty("java.io.tmpdir"));
     private static boolean referrerPolicy = true;
     private static double cacheExpiryInHours = 24.0;
+    // Used OpenOffice to convert MS Office docs to RTF, currently a Solaris zone on moby.ucalgary.ca
+    private static String documentConverterHost = "136.159.169.81";  
+    private static int documentConverterPort = 8100;
 
     /**
      * Sets the options based on a shortcircuiting set of 
@@ -163,7 +168,27 @@
 	    }
 	}
 
+	String convHost = properties.getProperty(CONVERTER_HOST_PROP);	
+	if(convHost != null && convHost.length() > 0){
+	    setDocConverterHost(convHost);
+	}
+	String intString = properties.getProperty(CONVERTER_PORT_PROP);
+	if(intString != null && intString.length() > 0){
+	    int portNum = documentConverterPort;
+	    try{
+		portNum = Integer.parseInt(intString);
+	    } catch(NumberFormatException nfe){
+		nfe.printStackTrace();
+		System.err.println("Ignoring the document converter port number (" +CONVERTER_PORT_PROP+ 
+				   ") provided in the Seahawk config file (" + 
+				   u + "), it is not in valid integer number format: " + 
+				   intString);
+	    }
+	    setDocConverterPort(portNum);
+	}
+
 	// We determine the registry first based on the alias, then fallback on the endpoint
+	// This should be the LAST thing we do (note the return statement in the for loop)
 	if(regSynonym != null && regSynonym.length() > 0){
 	    // See if it's one we know about
 	    RegistriesList regList = new RegistriesList();
@@ -213,6 +238,8 @@
 	properties.setProperty(CACHE_POLICY_PROP, ""+cacheExpiryInHours);
 	properties.setProperty(REFERRER_POLICY_PROP, ""+referrerPolicy);
 	properties.setProperty(TEMP_DIR_PROP, tmpDir.getCanonicalFile().getPath());
+	properties.setProperty(CONVERTER_HOST_PROP, documentConverterHost);
+	properties.setProperty(CONVERTER_PORT_PROP, ""+documentConverterPort);
 	if(registry != null){
 	    properties.setProperty(REGISTRY_SYNONYM_PROP, registry.getSynonym());	
 	    properties.setProperty(REGISTRY_ENDPOINT_PROP, registry.getEndpoint());
@@ -348,4 +375,42 @@
     public static boolean getSendReferrerPolicy(){
 	return referrerPolicy;
     }
+
+    /**
+     * @param port positive number representing where the OpenOffice file converter is listening
+     */
+    public static void setDocConverterPort(int port) throws Exception{
+	if(port < 0){
+	    throw new Exception("The port number for the document converter must be greater " +
+				"than 0, but an attempt was made to set it to "+port);
+	}
+	documentConverterPort = port;
+    }
+
+    /**
+     * @return the port number on which OpenOffice is listening, waiting to do document format conversion
+     */
+    public static int getDocConverterPort(){
+	return documentConverterPort;
+    }
+
+    /**
+     * For more details on how to run your own file converter, see http://www.artofsolving.com/node/10
+     *
+     * @param hostname machine on which an OpenOffice file converter is running
+     */
+    public static void setDocConverterHost(String hostname){
+	if(hostname == null ||
+	   hostname.length() == 0){
+	    hostname = null;
+	}
+	documentConverterHost = hostname;
+    }
+
+    /**
+     * May be null (in which case conversions will not be available)
+     */
+    public static String getDocConverterHost(){
+	return documentConverterHost;
+    }
 }




More information about the MOBY-guts mailing list