X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Forg%2Fvamsas%2Fclient%2FSessionUrn.java;h=52417f9625207a9e7608c9e9a5e7794a8a7f005a;hb=65a8158d49f3c25e78deba6ddd2f4a83fc695821;hp=2cd5fdda3d111b2e89cffc524249220313292ccc;hpb=388ecffba8a465c22ba2561dd4eb55651f45dd82;p=vamsas.git diff --git a/src/org/vamsas/client/SessionUrn.java b/src/org/vamsas/client/SessionUrn.java index 2cd5fdd..52417f9 100644 --- a/src/org/vamsas/client/SessionUrn.java +++ b/src/org/vamsas/client/SessionUrn.java @@ -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 }