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 11 /** The persistant layer for the ManualAccontMapper. Store a set of mappings 12 * to be used by the ManualAccountMapper itself. This interface allows the 13 * mapping to be stored in different ways (i.e. LDAP, database, file, ...). 14 * <P> 15 * The persistance layer shouldn't be doing any kind of caching, which will be 16 * handled by the ManualAccontMapper itself. 17 * 18 * @author Gabriele Carcassi, Jay Packard 19 */ 20 public interface ManualAccountMapperDB { 21 /** 22 * Saves in the DB the new mapping between the userDN and the account. 23 * If a mapping for the given user is already present, an exception should 24 * be thrown. 25 * 26 * @todo should decide which excpetion to throw if the account was found, 27 * and should modify the unit tests to test the error condition 28 * @param userDN a certificate DN 29 * @param account a UNIX account name 30 */ 31 void createMapping(String userDN, String account); 32 33 /** 34 * Removes the mapping for the given user. 35 * 36 * @param userDN a certificate DN 37 * @return true if a mapping was deleted 38 * @todo should probabily test the result value in unit tests 39 */ 40 boolean removeMapping(String userDN); 41 42 /** 43 * Retrieves a user mapping from the database. 44 * 45 * @param userDN a certificate DN 46 * @return the UNIX account provided by the mapping 47 */ 48 String retrieveMapping(String userDN); 49 50 /** 51 * Retrieves user mappings from the database. 52 * 53 * @return all the mappings 54 */ 55 java.util.List retrieveMappings(); 56 }