From 86fda51136738b4cf1bd32b0d6a0a65767d7ad8c Mon Sep 17 00:00:00 2001 From: jprocter Date: Mon, 8 Jun 2009 12:28:08 +0000 Subject: [PATCH] displayed urn is either vamsasdocument reference or local simpleclient session reference git-svn-id: https://svn.lifesci.dundee.ac.uk/svn/repository/trunk@500 be28352e-c001-0410-b1a7-c7978e42abec --- src/uk/ac/vamsas/client/simpleclient/SessionUrn.java | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/uk/ac/vamsas/client/simpleclient/SessionUrn.java b/src/uk/ac/vamsas/client/simpleclient/SessionUrn.java index 2172602..36ca50a 100644 --- a/src/uk/ac/vamsas/client/simpleclient/SessionUrn.java +++ b/src/uk/ac/vamsas/client/simpleclient/SessionUrn.java @@ -61,16 +61,18 @@ public class SessionUrn extends uk.ac.vamsas.client.SessionUrn { } /** - * Generates a sessionURN bases on a session directory location + * Generates a sessionURN from a file with a type of SIMPLECLIENT if it is a directory or VAMSASDOCUMENT if it is a file. + * + * Note: No validation is performed, either for uniqueness of resultant URI or validity of the location. * * @param sessionLocation - * the file object to the session directory + * the file object to create the sessionURN from. + * */ - public SessionUrn(File sessionLocation) {// throws MalformedURLException { - // TODO: LATER: implement switch to have vamsas document or simpleclient - // sessions for same constructor - // use URI instead of URL - super(SIMPLECLIENT, sessionLocation.getAbsoluteFile().toURI()); + public SessionUrn(File sessionLocation) { + // TODO: refactor this and use a Urn factory - this inline switch is pretty ugly! + super((sessionLocation.isFile() ? VAMSASDOCUMENT : SIMPLECLIENT) + ,sessionLocation.getAbsoluteFile().toURI()); } /** -- 1.7.10.2