ac9ff8805b54b7a8cc01033d7922c494dd73a190
[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 import java.io.File;
10
11 /**
12  * Defines methods for instantiating Vorba client application agents
13  * @author jimp
14  *
15  * (it's VORBA, not CORBA!)
16  */
17
18 public interface IClientFactory {
19
20      /**
21       * Create a new Vorba Session
22       * @param applicationHandle is the application's VAMSAS handle string
23      * @throws NoDefaultSessionException if more than one session exists that the client may connect to
24       */
25         IClient getIClient(ClientHandle applicationHandle) throws NoDefaultSessionException;
26         /**
27          * returns new Vorba for a given session.
28          * @param applicationHandle
29          * @param sessionUrn session to connect to (or null to create a new session)
30          * @return
31          */
32        IClient getIClient(ClientHandle applicationHandle, String sessionUrn);
33        /**
34         * returns new vorba for a  given session acting as a particular identity
35         * @param applicationHandle
36         * @param userId
37         * @param sessionUrn session to connect to (or null to create a new session)
38         * @return
39         */
40        IClient getIClient(ClientHandle applicationHandle, UserHandle userId, String sessionUrn);
41        /**
42         * New session for application and specific user
43         * @param applicationHandle
44         * @param userId
45         * @return
46        * @throws NoDefaultSessionException if more than one session exists that the client may connect to
47         */
48        IClient getIClient(ClientHandle applicationHandle, UserHandle userId) throws NoDefaultSessionException;
49        /**
50         * Create a new sesssion for the application with the current user
51         * @param applicationHandle
52         * @return
53         */
54        IClient getNewSessionIClient(ClientHandle applicationHandle);
55        /**
56         * Create a new session for the application using a particular user identity
57         * @param applicationHandle
58         * @param userId
59         * @return
60         */
61        IClient getNewSessionIClient(ClientHandle applicationHandle, UserHandle userId);
62        /**
63         * Create a new session and import an existing vamsas document into it.
64         * @param applicationHandle 
65         * @param vamsasDocument
66         * @return
67         */
68        IClient openAsNewSessionIClient(ClientHandle applicationHandle, File vamsasDocument) throws InvalidSessionDocumentException;
69        /**
70         * Create a new session as a particular user and import an existing vamsas document into it.
71         * @param applicationHandle 
72         * @param userId
73         * @param vamsasDocument
74         * @return
75         */
76       IClient openAsNewSessionIClient(ClientHandle applicationHandle, UserHandle userId, File vamsasDocument) throws InvalidSessionDocumentException;
77        /**
78         * enumerate the active sessions this IClientFactory instance knows about.
79         * Can be used by caller to pick a session on catching a NoDefaultSessionException.
80         * LATER: Define interface for discovering more information about a session (so it can be presented to a user in a meaningful way)
81         * @return possibly empty array of sessionUrn strings
82         */
83        public String[] getCurrentSessions();
84
85 }