From: jprocter Date: Fri, 14 Sep 2007 13:45:34 +0000 (+0000) Subject: added new client factory methods to open a stored session document in a new session. X-Git-Tag: Release_0.2~58 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=15da9787fbd803755093dc75d11682a10bfd010a;p=vamsas.git added new client factory methods to open a stored session document in a new session. git-svn-id: https://svn.lifesci.dundee.ac.uk/svn/repository/trunk@462 be28352e-c001-0410-b1a7-c7978e42abec --- diff --git a/src/uk/ac/vamsas/client/IClientFactory.java b/src/uk/ac/vamsas/client/IClientFactory.java index 6797fa6..ac9ff88 100644 --- a/src/uk/ac/vamsas/client/IClientFactory.java +++ b/src/uk/ac/vamsas/client/IClientFactory.java @@ -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 index 0000000..e988d58 --- /dev/null +++ b/src/uk/ac/vamsas/client/InvalidSessionDocumentException.java @@ -0,0 +1,45 @@ +/** + * + */ +package uk.ac.vamsas.client; + +/** + * @author JimP + * + */ +public class InvalidSessionDocumentException extends Exception +{ + /** + * basic error for this exception + */ + public static final String INVALID_DOC = "Invalid Shared Document."; + /** + * + */ + public InvalidSessionDocumentException() { + super(INVALID_DOC); + } + + /** + * @param message + */ + public InvalidSessionDocumentException(String message) { + super(INVALID_DOC+":"+message); + } + + /** + * @param cause + */ + public InvalidSessionDocumentException(Throwable cause) { + super(INVALID_DOC, cause); + } + + /** + * @param message + * @param cause + */ + public InvalidSessionDocumentException(String message, Throwable cause) { + super(INVALID_DOC+":"+message, cause); + } + +}