6797fa6022d3ba6d4e1b6d3ccac3534b3fd57ef0
[vamsas.git] / src / uk / ac / vamsas / client / IClientFactory.java
1 /*
2  * Created on 13-Sep-2005
3  *
4  * TODO To change the template for this generated file go to
5  * Window - Preferences - Java - Code Style - Code Templates
6  */
7 package uk.ac.vamsas.client;
8
9 /**
10  * Defines methods for instantiating Vorba client application agents
11  * @author jimp
12  *
13  * (it's VORBA, not CORBA!)
14  */
15
16 public interface IClientFactory {
17
18      /**
19       * Create a new Vorba Session
20       * @param applicationHandle is the application's VAMSAS handle string
21      * @throws NoDefaultSessionException if more than one session exists that the client may connect to
22       */
23         IClient getIClient(ClientHandle applicationHandle) throws NoDefaultSessionException;
24         /**
25          * returns new Vorba for a given session.
26          * @param applicationHandle
27          * @param sessionUrn session to connect to (or null to create a new session)
28          * @return
29          */
30        IClient getIClient(ClientHandle applicationHandle, String sessionUrn);
31        /**
32         * returns new vorba for a  given session acting as a particular identity
33         * @param applicationHandle
34         * @param userId
35         * @param sessionUrn session to connect to (or null to create a new session)
36         * @return
37         */
38        IClient getIClient(ClientHandle applicationHandle, UserHandle userId, String sessionUrn);
39        /**
40         * New session for application and specific user
41         * @param applicationHandle
42         * @param userId
43         * @return
44        * @throws NoDefaultSessionException if more than one session exists that the client may connect to
45         */
46        IClient getIClient(ClientHandle applicationHandle, UserHandle userId) throws NoDefaultSessionException;
47        /**
48         * Create a new sesssion for the application with the current user
49         * @param applicationHandle
50         * @return
51         */
52        IClient getNewSessionIClient(ClientHandle applicationHandle);
53        /**
54         * Create a new session for the application using a particular user identity
55         * @param applicationHandle
56         * @param userId
57         * @return
58         */
59        IClient getNewSessionIClient(ClientHandle applicationHandle, UserHandle userId);
60        
61        /**
62         * enumerate the active sessions this IClientFactory instance knows about.
63         * Can be used by caller to pick a session on catching a NoDefaultSessionException.
64         * LATER: Define interface for discovering more information about a session (so it can be presented to a user in a meaningful way)
65         * @return possibly empty array of sessionUrn strings
66         */
67        public String[] getCurrentSessions();
68
69 }