1 20 21 package golfShop.data.user; 22 23 import java.util.Vector ; 24 import java.util.Enumeration ; 25 import golfShop.data.user.UserDOImpl; 26 import golfShop.data.user.UserStore; 27 28 29 30 38 public class MemoryUserStore extends UserStore { 39 40 43 private Vector allUsers = new Vector (); 44 45 48 protected void initializeUserStore(String dir) {} 49 50 protected void initializeUserStore() { 51 UserDOImpl u = new UserDOImpl("enhydra", "lutris", "", "", "", "", "", "" ,""); 52 allUsers.addElement(u); 53 } 54 55 protected boolean usernameInUserStore(String username) { 56 Enumeration e = allUsers.elements(); 57 while (e.hasMoreElements()) { 58 UserDOImpl u = (UserDOImpl) e.nextElement(); 59 if (username.equals(u.username)) 60 return true; 61 } 62 return false; 63 } 64 65 protected UserDOImpl lookupUserFromUserStore(String username) { 66 Enumeration e = allUsers.elements(); 67 while (e.hasMoreElements()) { 68 UserDOImpl u = (UserDOImpl) e.nextElement(); 69 if (username.equals(u.username)) 70 return u; 71 } 72 return null; 73 } 74 75 protected void addUserToUserStore(UserDOImpl user) { 76 allUsers.addElement(user); 77 } 78 79 84 protected void updateUserInUserStore(UserDOImpl user) { 85 } 86 87 } 88 | Popular Tags |