small updates.
authorjprocter <jprocter@compbio.dundee.ac.uk>
Tue, 29 Nov 2005 16:21:37 +0000 (16:21 +0000)
committerjprocter <jprocter@compbio.dundee.ac.uk>
Tue, 29 Nov 2005 16:21:37 +0000 (16:21 +0000)
git-svn-id: https://svn.lifesci.dundee.ac.uk/svn/repository/trunk@99 be28352e-c001-0410-b1a7-c7978e42abec

src/org/vamsas/client/simpleclient/SessionFile.java
src/org/vamsas/client/simpleclient/VamsasArchive.java

index e7b450f..b73a47f 100644 (file)
@@ -7,13 +7,12 @@ import java.io.IOException;
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
-import org.apache.commons.logging.impl.Log4jFactory;
 
 /**
  * Basic methods for classes handling locked IO on files 
  * monitored by all (simpleclient) clients in a vamsas session.
  * @author jimp
- *
+ *TODO: support non nio file locking capable systems
  */
 public class SessionFile {
   private static Log log = LogFactory.getLog(SessionFile.class);
index 8ef72f0..7b0532d 100644 (file)
@@ -7,9 +7,7 @@ import java.io.IOException;
 import java.io.OutputStream;
 import java.io.PrintWriter;
 import java.util.Hashtable;
-import java.util.Map;
 import java.util.jar.JarEntry;
-import java.util.jar.JarInputStream;
 import java.util.jar.JarOutputStream;
 
 import org.apache.commons.logging.Log;
@@ -113,6 +111,12 @@ public class VamsasArchive {
         if (!archive.getAbsolutePath().equals(original)) {
           if (originalBackup==null) 
             makeBackup();
+          try {
+            odoclock.updateFrom(null, rchive);
+          }
+          catch (IOException e) {
+            log.error("Problem updating archive from temporary file!",e);
+          }
         }
       } else {
         archive.renameTo(original);
@@ -376,6 +380,7 @@ public class VamsasArchive {
       if (!isDocumentWritten())
         log.warn("Premature closure of archive '"+archive.getAbsolutePath()+"': No document has been written.");
       newarchive.close();
+      updateOriginal();
       closeAndReset();
     } else {
       log.warn("Attempt to close archive that has not been opened for writing.");