1
2
3
4
5
6
7 package gov.bnl.gums;
8
9 import java.util.Date;
10 import java.util.List;
11 import java.util.Map;
12
13 /*** Provides the set of accounts for the AccountPoolMapper class which
14 * assignes accounts from a pool.
15 * <p>
16 * The implementation shouldn't buffer the information, as it the
17 * AccountPoolMapper responsability to do so.
18 *
19 * @author Gabriele Carcassi
20 */
21 public interface AccountPoolMapperDB {
22
23 /*** Retrieves the accounts that are already mapped to a user.
24 * @return a Map between the userDN (String) as the key and the account (String).
25 */
26 Map retrieveAccountMap();
27
28 /*** Retrieves the account associated to the Grid identity.
29 * @param userDN the certificate DN
30 * @return the account or null if the user wasn't mapped
31 */
32 String retrieveAccount(String userDN);
33
34 /*** Assigns a new account from the pool to the user. If the user is already
35 * mapped, will throw an exception.
36 * @todo decide which exception are thrown when
37 * @param userDN the user to be mapped
38 * @return the account or null if no more accounts are available
39 */
40 String assignAccount(String userDN);
41
42 /*** Adds an account to the pool of free accounts.
43 * @param account the account to be added
44 */
45 void addAccount(String account);
46
47 /*** Retrieve the list of account not in use since the given date/
48 * @param date the time since the accounts haven't been used.
49 * @return a list of String with the accounts
50 */
51 List retrieveUsersNotUsedSince(Date date);
52
53 /*** Removes an account from the mapping, and renders it available to the pool.
54 * @param user the user that shouldn't be mapped anymore
55 */
56 void unassignUser(String user);
57 }