-package uk.ac.vamsas.client.simpleclient;
-
-import java.io.File;
-import java.net.URI;
-
-import uk.ac.vamsas.client.InvalidSessionUrnException;
-
-/**
- * SessionUrn for simpleclient sessions:
- * simpleclient://{Absolute path to session directory}
- *
- * For simpleclient urn, it consideres as on the same machine, using the path to the session
- * directory to generate the session URN
- *
- * @author jimp
- *
- */
-public class SessionUrn extends uk.ac.vamsas.client.SessionUrn {
- /**
- * a simple client session urn prefix
- */
- public static final String SIMPLECLIENT="simpleclient";
- public static String VAMSASDOCUMENT="vdoc";
- static {
- TYPES.put(SIMPLECLIENT, SessionUrn.class);
- TYPES.put(SessionUrn.VAMSASDOCUMENT, SessionUrn.class);
- }
-
- /**
- * Creates a SessionUrn object from a String.
- * The string must be a string representation of a URI
- * @param urnString
- * @throws InvalidSessionUrnException
- */
- public SessionUrn(String urnString) throws InvalidSessionUrnException
- {
- super();
- this.setURN(urnString);
- }
-
-
- /**
- * Generates a sessionURN bases on a session directory location
- *
- * @param sessionLocation the file object to the session directory
- */
- 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());
- }
-
- /**
- * Generates a sessionURN bases on a vamsas session
- * @param session a VamsasSession
- *
- * Should return the same URN string than the creation with the session directory
- */
- public SessionUrn(VamsasSession session)
- {
- //throws MalformedURLException {
- // use URI instead of URL
- super(SIMPLECLIENT, session.sessionDir.getAbsoluteFile().toURI());
- }
-
-
-
-
-
- /**
- * TODO: LATER: think about this again.
- *
- * Retrieves the file associated to the current sessionURN.
- * The sessionURN (URI) is based on the session directory absolute path.
- * Use the raw path of the URN and change the scheme to file to generate a new file
- * URI. Then, from the URI create the File object (a File object can be created from an uri)
- *
- * @return File object representing the session URN //
- * File(urn.getPath())
- */
- public File asFile() {
- String path = this.urn.getRawPath();
-
- return new File ( URI.create("file://"+path));
- }
- // TODO: add abstract 'handler' methods for resolving the URN to a particular class
-}
+/*\r
+ * This file is part of the Vamsas Client version 0.1. \r
+ * Copyright 2009 by Jim Procter, Iain Milne, Pierre Marguerite, \r
+ * Andrew Waterhouse and Dominik Lindner.\r
+ * \r
+ * Earlier versions have also been incorporated into Jalview version 2.4 \r
+ * since 2008, and TOPALi version 2 since 2007.\r
+ * \r
+ * The Vamsas Client is free software: you can redistribute it and/or modify\r
+ * it under the terms of the GNU Lesser General Public License as published by\r
+ * the Free Software Foundation, either version 3 of the License, or\r
+ * (at your option) any later version.\r
+ * \r
+ * The Vamsas Client is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+ * GNU Lesser General Public License for more details.\r
+ * \r
+ * You should have received a copy of the GNU Lesser General Public License\r
+ * along with the Vamsas Client. If not, see <http://www.gnu.org/licenses/>.\r
+ */\r
+package uk.ac.vamsas.client.simpleclient;\r
+\r
+import java.io.File;\r
+import java.net.URI;\r
+\r
+import uk.ac.vamsas.client.InvalidSessionUrnException;\r
+\r
+/**\r
+ * SessionUrn for simpleclient sessions: simpleclient://{Absolute path to\r
+ * session directory}\r
+ * \r
+ * For simpleclient urn, it consideres as on the same machine, using the path to\r
+ * the session directory to generate the session URN\r
+ * \r
+ * @author jimp\r
+ * \r
+ */\r
+public class SessionUrn extends uk.ac.vamsas.client.SessionUrn {\r
+ /**\r
+ * a simple client session urn prefix\r
+ */\r
+ public static final String SIMPLECLIENT = "simpleclient";\r
+\r
+ public static String VAMSASDOCUMENT = "vdoc";\r
+ static {\r
+ TYPES.put(SIMPLECLIENT, SessionUrn.class);\r
+ TYPES.put(SessionUrn.VAMSASDOCUMENT, SessionUrn.class);\r
+ }\r
+\r
+ /**\r
+ * Creates a SessionUrn object from a String. The string must be a string\r
+ * representation of a URI\r
+ * \r
+ * @param urnString\r
+ * @throws InvalidSessionUrnException\r
+ */\r
+ public SessionUrn(String urnString) throws InvalidSessionUrnException {\r
+ super();\r
+ this.setURN(urnString);\r
+ }\r
+\r
+ /**\r
+ * Generates a sessionURN bases on a session directory location\r
+ * \r
+ * @param sessionLocation\r
+ * the file object to the session directory\r
+ */\r
+ public SessionUrn(File sessionLocation) {// throws MalformedURLException {\r
+ // TODO: LATER: implement switch to have vamsas document or simpleclient\r
+ // sessions for same constructor\r
+ // use URI instead of URL\r
+ super(SIMPLECLIENT, sessionLocation.getAbsoluteFile().toURI());\r
+ }\r
+\r
+ /**\r
+ * Generates a sessionURN bases on a vamsas session\r
+ * \r
+ * @param session\r
+ * a VamsasSession\r
+ * \r
+ * Should return the same URN string than the creation with the\r
+ * session directory\r
+ */\r
+ public SessionUrn(VamsasSession session) {\r
+ // throws MalformedURLException {\r
+ // use URI instead of URL\r
+ super(SIMPLECLIENT, session.sessionDir.getAbsoluteFile().toURI());\r
+ }\r
+\r
+ /**\r
+ * TODO: LATER: think about this again.\r
+ * \r
+ * Retrieves the file associated to the current sessionURN. The sessionURN\r
+ * (URI) is based on the session directory absolute path. Use the raw path of\r
+ * the URN and change the scheme to file to generate a new file URI. Then,\r
+ * from the URI create the File object (a File object can be created from an\r
+ * uri)\r
+ * \r
+ * @return File object representing the session URN // File(urn.getPath())\r
+ */\r
+ public File asFile() {\r
+ String path = this.urn.getRawPath();\r
+\r
+ return new File(URI.create("file://" + path));\r
+ }\r
+ // TODO: add abstract 'handler' methods for resolving the URN to a particular\r
+ // class\r
+}\r