A User which is stored, along with his or her associated {@link Subscription}s, in a {@link UserDatabase}.
153154155156157158159160161162
* <p>Return the set of {@link User}s defined in this user database.</p> */ public User[] findUsers() { synchronized (users) { User results[] = new User[users.size()]; return ((User[]) users.values().toArray(results)); } }
267268269270271272273274275276277
// Print the file prolog writer.println("<?xml version='1.0'?>"); writer.println("<database>"); // Print entries for each defined user and associated subscriptions User users[] = findUsers(); for (int i = 0; i < users.length; i++) { writer.print(" "); writer.println(users[i]); Subscription subscriptions[] = users[i].getSubscriptions();
355356357358359360361362363364365366
this.digester = digester; } public Object createObject(Attributes attributes) { String host = attributes.getValue("host"); User user = (User) digester.peek(); Subscription subscription = user.createSubscription(host); String autoConnect = attributes.getValue("autoConnect"); if (autoConnect == null) { autoConnect = "false"; } if ("true".equalsIgnoreCase(autoConnect) ||
399400401402403404405406407408409410
this.digester = digester; } public Object createObject(Attributes attributes) { String username = attributes.getValue("username"); User user = database.createUser(username); user.setFromAddress(attributes.getValue("fromAddress")); user.setFullName(attributes.getValue("fullName")); user.setPassword(attributes.getValue("password")); user.setReplyToAddress(attributes.getValue("replyToAddress")); return (user); }