2 * This file is part of the Vamsas Client version 0.2.
3 * Copyright 2010 by Jim Procter, Iain Milne, Pierre Marguerite,
4 * Andrew Waterhouse and Dominik Lindner.
6 * Earlier versions have also been incorporated into Jalview version 2.4
7 * since 2008, and TOPALi version 2 since 2007.
9 * The Vamsas Client is free software: you can redistribute it and/or modify
10 * it under the terms of the GNU Lesser General Public License as published by
11 * the Free Software Foundation, either version 3 of the License, or
12 * (at your option) any later version.
14 * The Vamsas Client is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU Lesser General Public License for more details.
19 * You should have received a copy of the GNU Lesser General Public License
20 * along with the Vamsas Client. If not, see <http://www.gnu.org/licenses/>.
22 package uk.ac.vamsas.client;
27 * Defines methods for instantiating Vorba client application agents
31 * @note (it's VORBA, not CORBA!)
32 * @history added additional sessionName argument for openAsNewSessionIClient method (v0.2)
35 public interface IClientFactory {
38 * Create a new Vorba Session
40 * @param applicationHandle
41 * is the application's VAMSAS handle string
42 * @throws NoDefaultSessionException
43 * if more than one session exists that the client may connect to
45 IClient getIClient(ClientHandle applicationHandle)
46 throws NoDefaultSessionException;
49 * returns new Vorba for a given session.
51 * @param applicationHandle
53 * session to connect to (or null to create a new session)
56 IClient getIClient(ClientHandle applicationHandle, String sessionUrn);
59 * returns new vorba for a given session acting as a particular identity
61 * @param applicationHandle
64 * session to connect to (or null to create a new session)
67 IClient getIClient(ClientHandle applicationHandle, UserHandle userId,
71 * New session for application and specific user
73 * @param applicationHandle
76 * @throws NoDefaultSessionException
77 * if more than one session exists that the client may connect to
79 IClient getIClient(ClientHandle applicationHandle, UserHandle userId)
80 throws NoDefaultSessionException;
83 * Create a new sesssion for the application with the current user
85 * @param applicationHandle
88 IClient getNewSessionIClient(ClientHandle applicationHandle);
91 * Create a new session for the application using a particular user identity
93 * @param applicationHandle
97 IClient getNewSessionIClient(ClientHandle applicationHandle, UserHandle userId);
100 * Create a new session and import an existing vamsas document into it.
101 * Session name will inherit from vamsasDocument path.
102 * @param applicationHandle
103 * @param vamsasDocument
106 IClient openAsNewSessionIClient(ClientHandle applicationHandle,
107 File vamsasDocument) throws InvalidSessionDocumentException;
110 * Create a new session and import an existing vamsas document into it.
112 * @param applicationHandle
113 * @param vamsasDocument
114 * @param sessionName - preferred session name (may be null)
117 IClient openAsNewSessionIClient(ClientHandle applicationHandle,
118 File vamsasDocument, String sessionName) throws InvalidSessionDocumentException;
121 * Create a new session as a particular user and import an existing vamsas
124 * @param applicationHandle
126 * @param vamsasDocument
129 IClient openAsNewSessionIClient(ClientHandle applicationHandle,
130 UserHandle userId, File vamsasDocument)
131 throws InvalidSessionDocumentException;
133 * Create a new session as a particular user and import an existing vamsas
136 * @param applicationHandle
138 * @param vamsasDocument
139 * @param sessionName - preferred session name (may be null)
142 IClient openAsNewSessionIClient(ClientHandle applicationHandle,
143 UserHandle userId, File vamsasDocument, String sessionName)
144 throws InvalidSessionDocumentException;
146 * enumerate the active sessions this IClientFactory instance knows about. Can
147 * be used by caller to pick a session on catching a
148 * NoDefaultSessionException. LATER: Define interface for discovering more
149 * information about a session (so it can be presented to a user in a
152 * @return possibly empty array of sessionUrn strings
154 public String[] getCurrentSessions();