import java.io.File;
import java.net.URI;
+import java.util.Hashtable;
import java.util.Vector;
/**
/**
* 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
* @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: add abstract 'handler' methods for resolving the URN to a particular class
}
--- /dev/null
+package org.vamsas.client.simpleclient;
+
+import java.io.File;
+
+/**
+ * Vamsas Document URN for files understood by ArchiveReader and
+ * written by VamsasArchive.
+ * vdoc://{Absolute path to file}
+ * @author jimp
+ *
+ */
+public class ArchiveUrn extends org.vamsas.client.SessionUrn {
+ /**
+ * a simple vamsas document urn prefix
+ */
+ public static String VAMSASDOCUMENT="vdoc";
+ static {
+ TYPES.put(ArchiveUrn.VAMSASDOCUMENT, ArchiveUrn.class);
+ }
+
+ public ArchiveUrn(File docLocation) {
+ super(VAMSASDOCUMENT, docLocation);
+ }
+}
* a simple client session urn prefix
*/
public static final String SIMPLECLIENT="simpleclient";
+ public static String VAMSASDOCUMENT="vdoc";
static {
- TYPES.add(SIMPLECLIENT);
+ TYPES.put(SIMPLECLIENT, SessionUrn.class);
+ TYPES.put(SessionUrn.VAMSASDOCUMENT, SessionUrn.class);
}
+
public SessionUrn(File sessionLocation) {
super(SIMPLECLIENT, sessionLocation);
}