1 37 38 package net.sourceforge.cruisecontrol.publishers.email; 39 40 import net.sourceforge.cruisecontrol.CruiseControlException; 41 42 import org.apache.log4j.Logger; 43 import java.util.Set ; 44 import java.util.Iterator ; 45 46 public class EmailAddressMapper extends EmailMapper { 47 48 private static final Logger LOG = Logger.getLogger(EmailAddressMapper.class); 49 50 public EmailAddressMapper() { 51 } 52 53 57 public void open() throws CruiseControlException { 58 } 59 60 64 public void close() { 65 } 66 67 71 public String mapUser(String user) { 72 return null; 73 } 74 78 public boolean cacheable() { 79 return true; 80 } 81 82 87 public final void mapUsers(Set users, Set mappedUsers) { 88 try { 89 open(); 90 91 for (Iterator userIterator = users.iterator(); userIterator.hasNext(); ) { 93 String user = (String ) userIterator.next(); 94 String mappedUser = mapUser(user); 95 96 if (mappedUser != null) { 98 LOG.debug("Mapped user " + user + " to " + mappedUser); 99 mappedUsers.add(mappedUser); 100 userIterator.remove(); 101 if (cacheable()) { 103 EmailMapperHelper.addCacheEntry(getEmailPublisher(), user, mappedUser); 104 } 105 } 106 } 107 } catch (CruiseControlException ce) { 108 LOG.error(ce.getMessage()); 109 } finally { 110 close(); 111 } 112 } 113 } 114 | Popular Tags |