verson 0.2 LGPL licensed source and jars
[vamsas.git] / src / uk / ac / vamsas / client / simpleclient / SessionUrn.java
index 2172602..0dfe65a 100644 (file)
@@ -1,6 +1,6 @@
 /*\r
- * This file is part of the Vamsas Client version 0.1. \r
- * Copyright 2009 by Jim Procter, Iain Milne, Pierre Marguerite, \r
+ * This file is part of the Vamsas Client version 0.2. \r
+ * Copyright 2010 by Jim Procter, Iain Milne, Pierre Marguerite, \r
  *  Andrew Waterhouse and Dominik Lindner.\r
  * \r
  * Earlier versions have also been incorporated into Jalview version 2.4 \r
@@ -61,16 +61,18 @@ public class SessionUrn extends uk.ac.vamsas.client.SessionUrn {
   }\r
 \r
   /**\r
-   * Generates a sessionURN bases on a session directory location\r
+   * Generates a sessionURN from a file with a type of SIMPLECLIENT if it is a directory or VAMSASDOCUMENT if it is a file. \r
+   * \r
+   * Note: No validation is performed, either for uniqueness of resultant URI or validity of the location.\r
    * \r
    * @param sessionLocation\r
-   *          the file object to the session directory\r
+   *          the file object to create the sessionURN from.\r
+   * \r
    */\r
-  public SessionUrn(File sessionLocation) {// throws MalformedURLException {\r
-    // TODO: LATER: implement switch to have vamsas document or simpleclient\r
-    // sessions for same constructor\r
-    // use URI instead of URL\r
-    super(SIMPLECLIENT, sessionLocation.getAbsoluteFile().toURI());\r
+  public SessionUrn(File sessionLocation) {\r
+    // TODO: refactor this and use a Urn factory - this inline switch is pretty ugly!\r
+    super((sessionLocation.isFile() ? VAMSASDOCUMENT : SIMPLECLIENT)\r
+        ,sessionLocation.getAbsoluteFile().toURI());\r
   }\r
 \r
   /**\r