A User which is stored, along with his or her associated {@link Subscription}s, in a {@link UserDatabase}.
135136137138139140141142143
// See interface for Javadoc public User[] findUsers() { synchronized (users) { User results[] = new User[users.size()]; return ((User[]) users.values().toArray(results)); } }
236237238239240241242243244245246
// 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[] =
324325326327328329330331332333334335
} 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"; }
374375376377378379380381382383384385
} 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); }
198199200201202203204205206207
* <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)); } }
312313314315316317318319320321322
// 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();
400401402403404405406407408409410411
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) ||
444445446447448449450451452453454455
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); }