[MOBY-guts] biomoby commit

senger@ebi.ac.uk senger at pub.open-bio.org
Thu Apr 1 21:03:42 UTC 2004


senger
Thu Apr  1 16:03:42 EST 2004
Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/client
In directory pub.open-bio.org:/tmp/cvs-serv7084/src/main/org/biomoby/client

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


moby-live/Java/src/main/org/biomoby/client FileCache.java,1.2,1.3 GraphsServlet.java,1.4,1.5 ServletFileCache.java,1.1,1.2
===================================================================
RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/FileCache.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/client/FileCache.java	2003/11/09 01:05:02	1.2
+++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/FileCache.java	2004/04/01 21:03:42	1.3
@@ -1,6 +1,6 @@
 // FileCache.java
 //
-//    A cache used for a data produced by a servlet.
+//    A cache storing data in files.
 //
 //    senger at ebi.ac.uk
 //    November 2003
@@ -37,7 +37,10 @@
     // given 'rootDirname)
     protected static String startingDir;
 
-     /**************************************************************************
+    // index of cached files (TBD: put it also in a file?)
+    Hashtable index = new Hashtable();
+
+    /**************************************************************************
      * To be used by the inheriting classes.
      **************************************************************************/
     protected FileCache() {
@@ -49,14 +52,14 @@
      * Constructor specifying where to create files with the cached
      * objects. Use this constructor if you cannot store them in the
      * context of the calling servlet (usually because of the
-     * unsifficient write permissions). The cache files will created in
+     * unsifficient write permissions). The cache files will be stored in
      *
      * <pre>
      * <rootDirName>/cache/
      * </pre>
      *
      * The all not yet existing directories (for example the last
-     * 'cache' diorectory) will be created for you.
+     * 'cache' directory) will be created for you.
      * <p>
      *
      * 'rootURLName' is used by method {@link #getURL} to return back
@@ -75,7 +78,11 @@
     static final char   CLEAR_CHAR = '_';
     /**************************************************************************
      * It creates an 'id' in the form:
-     *    rootName / semanticType / prop1_prop2_... (time).syntaxType
+     *    rootName / semanticType / { prop1_prop2_... } (time).syntaxType
+     *
+     * The part between { and } (inclusive) will be replaced by a
+     * unique shorter string in order to create a reasonably long real
+     * file name.
      **************************************************************************/
     public String createId (String rootName,
 			    String semanticType, String syntaxType,
@@ -94,10 +101,13 @@
 		ps[++i] = it.next().toString();
 	}
 	Arrays.sort (ps);
+	buf.append ("{");
 	for (int i = 0; i < ps.length; i++) {
  	    buf.append (CLEAR_CHAR);
-	    buf.append (clean (ps[i].toString()));
+// 	    buf.append (clean (ps[i].toString()));
+	    buf.append (ps[i].toString());
 	}
+	buf.append ("}");
 	buf.append ("(" + lastModified + ")");
 	buf.append (".");
 	buf.append (clean (syntaxType));
@@ -235,6 +245,20 @@
      * dir (as set in a constructor).
      **************************************************************************/
     protected String getRelativeFilename (String id) {
-	return fileSeparator + startingDir + fileSeparator + id;
+	String fileName = (String)index.get (id);
+	if (fileName == null) {
+	    int posFrom = id.indexOf ("{");
+	    int posTo = id.indexOf ("}");
+	    StringBuffer buf = new StringBuffer();
+	    buf.append (fileSeparator);
+	    buf.append (startingDir);
+	    buf.append (fileSeparator);
+	    buf.append (id.substring (0, posFrom));
+	    buf.append (clean (new java.rmi.server.UID().toString()));
+	    buf.append (id.substring (posTo+1));
+	    fileName = new String (buf);
+	    index.put (id, fileName);
+	}
+	return fileName;
     }
 }

===================================================================
RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/GraphsServlet.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/GraphsServlet.java	2003/11/25 13:18:10	1.4
+++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/GraphsServlet.java	2004/04/01 21:03:42	1.5
@@ -491,7 +491,7 @@
 			   h.gen (TD,
 				  radios[0]) +
 			   h.gen (TD,
-				  "Show all services and all connections")) +
+				  "Show all services and all connections " + h.gen (EM, "(very long and big)"))) +
 		    h.gen (TR,
 			   h.gen (TD, new String[] { VALIGN, "top" },
 				  radios[1]) +

===================================================================
RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/ServletFileCache.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/ServletFileCache.java	2003/11/08 00:27:24	1.1
+++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/ServletFileCache.java	2004/04/01 21:03:42	1.2
@@ -40,11 +40,11 @@
      * </pre>
      *
      * The not existing directories (for example the last 'cache'
-     * diorectory) will be created for you.
+     * directory) will be created for you.
      *
      * The 'contextPath' is a path (relative to the servlet context)
      * where the cached files will be created (actually starting from
-     * here, because they may be created ina deeper directory
+     * here, because they may be created in a deeper directory
      * structure. Usually you get it in the calling servlet from the
      * request by method request.getContextPath(). The 'contextPath'
      * starts with a "/" character but does not end with a "/"




More information about the MOBY-guts mailing list