*/
package uk.ac.vamsas.client;
+import java.io.File;
+
/**
* Defines methods for instantiating Vorba client application agents
* @author jimp
* @return
*/
IClient getNewSessionIClient(ClientHandle applicationHandle, UserHandle userId);
-
+ /**
+ * Create a new session and import an existing vamsas document into it.
+ * @param applicationHandle
+ * @param vamsasDocument
+ * @return
+ */
+ IClient openAsNewSessionIClient(ClientHandle applicationHandle, File vamsasDocument) throws InvalidSessionDocumentException;
+ /**
+ * Create a new session as a particular user and import an existing vamsas document into it.
+ * @param applicationHandle
+ * @param userId
+ * @param vamsasDocument
+ * @return
+ */
+ IClient openAsNewSessionIClient(ClientHandle applicationHandle, UserHandle userId, File vamsasDocument) throws InvalidSessionDocumentException;
/**
* enumerate the active sessions this IClientFactory instance knows about.
* Can be used by caller to pick a session on catching a NoDefaultSessionException.
--- /dev/null
+/**\r
+ * \r
+ */\r
+package uk.ac.vamsas.client;\r
+\r
+/**\r
+ * @author JimP\r
+ *\r
+ */\r
+public class InvalidSessionDocumentException extends Exception\r
+{\r
+ /**\r
+ * basic error for this exception\r
+ */\r
+ public static final String INVALID_DOC = "Invalid Shared Document.";\r
+ /**\r
+ * \r
+ */\r
+ public InvalidSessionDocumentException() {\r
+ super(INVALID_DOC);\r
+ }\r
+\r
+ /**\r
+ * @param message\r
+ */\r
+ public InvalidSessionDocumentException(String message) {\r
+ super(INVALID_DOC+":"+message);\r
+ }\r
+\r
+ /**\r
+ * @param cause\r
+ */\r
+ public InvalidSessionDocumentException(Throwable cause) {\r
+ super(INVALID_DOC, cause);\r
+ }\r
+\r
+ /**\r
+ * @param message\r
+ * @param cause\r
+ */\r
+ public InvalidSessionDocumentException(String message, Throwable cause) {\r
+ super(INVALID_DOC+":"+message, cause);\r
+ }\r
+\r
+}\r