added legacy import of version 0.1 SessionLists master Release_0.2
authorjprocter <jprocter@compbio.dundee.ac.uk>
Fri, 19 Feb 2010 16:36:15 +0000 (16:36 +0000)
committerjprocter <jprocter@compbio.dundee.ac.uk>
Fri, 19 Feb 2010 16:36:15 +0000 (16:36 +0000)
git-svn-id: https://svn.lifesci.dundee.ac.uk/svn/repository/trunk@521 be28352e-c001-0410-b1a7-c7978e42abec

README
packages/vamsas-client-j1.5.jar
packages/vamsas-client.jar
packages/vamsas-schema-and-doc.jar
src/uk/ac/vamsas/client/simpleclient/SessionsFile.java

diff --git a/README b/README
index 0c12439..38818e5 100644 (file)
--- a/README
+++ b/README
@@ -43,6 +43,7 @@ Changes since version 0.1
 * 1.5 and 1.4 build options\r
 * SAXTreeViewer\r
 * minor bug and information message fixes.\r
+* legacy import of vamsas 0.1 sessions\r
 \r
 The SAXTreeViewer was added to the uk.ac.vamsas.test.document package - it is\r
 a simple debug tool which will monitor a specific VAMSAS document archive, and\r
index 8222280..5c5a3cb 100644 (file)
Binary files a/packages/vamsas-client-j1.5.jar and b/packages/vamsas-client-j1.5.jar differ
index cc96e10..2634954 100644 (file)
Binary files a/packages/vamsas-client.jar and b/packages/vamsas-client.jar differ
index 1c1bad7..701fe73 100644 (file)
Binary files a/packages/vamsas-schema-and-doc.jar and b/packages/vamsas-schema-and-doc.jar differ
index ab26d20..9871bbf 100644 (file)
@@ -26,6 +26,7 @@ import java.io.FileNotFoundException;
 import java.io.FileOutputStream;\r
 import java.io.ObjectInputStream;\r
 import java.io.ObjectOutputStream;\r
+import java.net.URL;\r
 \r
 import org.apache.commons.logging.Log;\r
 import org.apache.commons.logging.LogFactory;\r
@@ -80,7 +81,30 @@ public class SessionsFile extends ListFile {
           o = is.readObject();\r
           if (o != null) {\r
             try {\r
-              sessions = (SimpleSessionHandle[]) o;\r
+              if (o instanceof SimpleSessionHandle[]) {\r
+                sessions = (SimpleSessionHandle[]) o;\r
+              } else {\r
+                // legacy support or incorrect path.\r
+                if (o instanceof SessionHandle[]) {\r
+                  log.info("Importing VAMSAS 0.1 clientHandle list.");\r
+                  SessionHandle[] oldsess = (SessionHandle[]) o;\r
+                  File sessdir;\r
+                  sessions = new SimpleSessionHandle[oldsess.length];\r
+                  for (int s=0;s<oldsess.length;s++)\r
+                  {\r
+                    try {\r
+                      sessdir = new SessionUrn(oldsess[s].getSessionUrn()).asFile();\r
+                      // try to locate it.\r
+                      sessions[s] = new SimpleSessionHandle(oldsess[s].getSessionUrn(), sessdir);\r
+                    } catch (Exception e)\r
+                    {\r
+                      // give up and report an error.\r
+                      sessions = null;\r
+                      throw new Exception("Legacy SessionFile problem. Couldn't locate "+oldsess[s]+" as a file.",e);\r
+                    }\r
+                  }\r
+                }\r
+              }\r
             } catch (Exception e) {\r
               log.error("Garbage in the clientHandle list " + this.sessionFile,\r
                   e);\r