added new client factory methods to open a stored session document in a new session.
authorjprocter <jprocter@compbio.dundee.ac.uk>
Fri, 14 Sep 2007 13:45:34 +0000 (13:45 +0000)
committerjprocter <jprocter@compbio.dundee.ac.uk>
Fri, 14 Sep 2007 13:45:34 +0000 (13:45 +0000)
git-svn-id: https://svn.lifesci.dundee.ac.uk/svn/repository/trunk@462 be28352e-c001-0410-b1a7-c7978e42abec

src/uk/ac/vamsas/client/IClientFactory.java
src/uk/ac/vamsas/client/InvalidSessionDocumentException.java [new file with mode: 0644]

index 6797fa6..ac9ff88 100644 (file)
@@ -6,6 +6,8 @@
  */
 package uk.ac.vamsas.client;
 
+import java.io.File;
+
 /**
  * Defines methods for instantiating Vorba client application agents
  * @author jimp
@@ -57,7 +59,21 @@ public interface IClientFactory {
         * @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.
diff --git a/src/uk/ac/vamsas/client/InvalidSessionDocumentException.java b/src/uk/ac/vamsas/client/InvalidSessionDocumentException.java
new file mode 100644 (file)
index 0000000..e988d58
--- /dev/null
@@ -0,0 +1,45 @@
+/**\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