From 231f6987dd7ba09049a77f5b120f8c01411a73b4 Mon Sep 17 00:00:00 2001 From: pmarguerite Date: Thu, 14 Dec 2006 21:18:21 +0000 Subject: [PATCH] created setURN to generated sessionUrn from a urn as String. Allow to be replaced by an inheriting class git-svn-id: https://svn.lifesci.dundee.ac.uk/svn/repository/trunk@307 be28352e-c001-0410-b1a7-c7978e42abec --- src/uk/ac/vamsas/client/SessionUrn.java | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/src/uk/ac/vamsas/client/SessionUrn.java b/src/uk/ac/vamsas/client/SessionUrn.java index 519c287..158389c 100644 --- a/src/uk/ac/vamsas/client/SessionUrn.java +++ b/src/uk/ac/vamsas/client/SessionUrn.java @@ -3,6 +3,7 @@ */ package uk.ac.vamsas.client; +import java.io.File; import java.net.URI; import java.util.Hashtable; import java.util.Vector; @@ -19,6 +20,11 @@ public abstract class SessionUrn { */ protected static final Hashtable TYPES=new Hashtable(); + + protected SessionUrn() + { + // + } /** * construct urn for a locally stored session file * @param type @@ -28,13 +34,28 @@ public abstract class SessionUrn { if (!TYPES.containsKey(type.toLowerCase())) throw new Error("Unknown "+this.getClass().getName()+" type '"+type+"' for URL '"+url+"'"); try { - urn = URI.create(type+"://"+url.getPath()); + //urn = URI.create(type+"://"+urlString); + this.setURN(type+"://"+url.getPath()); + // urn = URI.create(type+"://"+url.getPath()); } catch (Exception e) { // TODO: something better than throwing an error should be done here. + e.printStackTrace(System.err); throw new Error(e); } } public String getSessionUrn() { - return urn.toString(); + return this.urn.toString(); } + + /** + * Set arun attribute + * create a URI from the provided String + * + * @param urnString urn to convert to a URN + */ + protected void setURN(String urnString) throws NullPointerException, IllegalArgumentException + { + this.urn = URI.create(urnString); + } + } -- 1.7.10.2