View Javadoc

1   /*
2    * ManualAccountMapperDB.java
3    *
4    * Created on May 25, 2004, 5:09 PM
5    */
6   
7   package gov.bnl.gums;
8   
9   /*** The persistant layer for the ManualAccontMapper. Store a set of mappings
10   * to be used by the ManualAccountMapper itself. This interface allows the 
11   * mapping to be stored in different ways (i.e. LDAP, database, file, ...).
12   * <P>
13   * The persistance layer shouldn't be doing any kind of caching, which will be
14   * handled by the ManualAccontMapper itself.
15   *
16   * @author  Gabriele Carcassi
17   */
18  public interface ManualAccountMapperDB {
19      /***
20       * Saves in the DB the new mapping between the userDN and the account.
21       * If a mapping for the given user is already present, an exception should
22       * be thrown.
23       * @todo should decide which excpetion to throw if the account was found,
24       * and should modify the unit tests to test the error condition
25       * @param userDN a certificate DN
26       * @param account a UNIX account name
27       */
28      void createMapping(String userDN, String account);
29      /***
30       * Removes the mapping for the given user.
31       * @param userDN a certificate DN
32       * @return true if a mapping was deleted
33       * @todo should probabily test the result value in unit tests
34       */
35      boolean removeMapping(String userDN);
36      /***
37       * Retrieves a user mapping from the database.
38       * @param userDN a certificate DN
39       * @return the UNIX account provided by the mapping
40       */
41      String retrieveMapping(String userDN);
42  }