added simple semaphore file mechanism for session directory.
[vamsas.git] / src / org / vamsas / client / SessionUrn.java
index 2cd5fdd..52417f9 100644 (file)
@@ -5,6 +5,7 @@ package org.vamsas.client;
 
 import java.io.File;
 import java.net.URI;
+import java.util.Hashtable;
 import java.util.Vector;
 
 /**
@@ -17,11 +18,7 @@ public abstract class SessionUrn {
   /**
    * The types of URI protocols we understand
    */
-  protected static final Vector TYPES=new Vector();
-  static {
-    TYPES.add(SessionUrn.VAMSASDOCUMENT);
-  }
-  public static String VAMSASDOCUMENT="vdoc";
+  protected static final Hashtable TYPES=new Hashtable();
   
   /**
    * construct urn for a locally stored session file
@@ -29,11 +26,19 @@ public abstract class SessionUrn {
    * @param file
    */
   protected SessionUrn(String type, File file) {
-    if (!TYPES.contains(type.toLowerCase()))
+    if (!TYPES.containsKey(type.toLowerCase()))
       throw new Error("Unknown "+this.getClass().getName()+" type '"+type+"' for file '"+file.getAbsolutePath()+"'");
     urn = URI.create(type+"://"+file.getAbsolutePath());
   }
   public String getSessionUrn() {
     return urn.toString();
   }
+  /**
+   * TODO: LATER: think about this again.
+   * @return File(urn.getPath())
+   */
+  public File asFile() {
+    return new File(urn.getPath());
+  }
+  // TODO: add abstract 'handler' methods for resolving the URN to a particular class
 }