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