From 4dc46a6340c6641fc76e83734540eb8dd2a2e6d9 Mon Sep 17 00:00:00 2001 From: mdb Date: Sat, 11 May 2002 19:20:15 +0000 Subject: [PATCH] We're back to having the UserManager create the UserRepository but now it does so in a way that can be overridden by derived classes. git-svn-id: https://samskivert.googlecode.com/svn/trunk@733 6335cc39-0255-0410-8fd6-9bcaacd3b74c --- .../samskivert/servlet/user/UserManager.java | 28 ++++++++++++------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/projects/samskivert/src/java/com/samskivert/servlet/user/UserManager.java b/projects/samskivert/src/java/com/samskivert/servlet/user/UserManager.java index 905c0427..5042ed2f 100644 --- a/projects/samskivert/src/java/com/samskivert/servlet/user/UserManager.java +++ b/projects/samskivert/src/java/com/samskivert/servlet/user/UserManager.java @@ -1,5 +1,5 @@ // -// $Id: UserManager.java,v 1.14 2002/05/08 00:25:54 shaper Exp $ +// $Id: UserManager.java,v 1.15 2002/05/11 19:20:15 mdb Exp $ // // samskivert library - useful routines for java programs // Copyright (C) 2001 Michael Bayne @@ -85,11 +85,9 @@ public class UserManager } /** - * A user manager must be supplied with a {@link UserRepository} - * through which it loads and saves user records. + * Constructs a user manager and prepares it for operation. Presently + * the user manager requires the following configuration information: * - *

Presently the user manager requires the following configuration - * information: *

* * @param config the user manager configuration properties. - * @param repository the user repository through which user records - * are loaded and saved. + * @param conprov the database connection provider that will be used + * to obtain a connection to the user database. */ - public UserManager (Properties config, UserRepository repository) + public UserManager (Properties config, ConnectionProvider conprov) throws PersistenceException { - // save off the user repository - _repository = repository; + // create the user repository + _repository = createRepository(conprov); // fetch the login URL from the properties _loginURL = config.getProperty("login_url"); @@ -137,6 +135,16 @@ public class UserManager null, true); } + /** + * Called by the user manager to create the user repository. Derived + * classes can override this and create a specialized repository if + * they so desire. + */ + protected UserRepository createRepository (ConnectionProvider conprov) + { + return new UserRepository(conprov); + } + public void shutdown () { // cancel our session table pruning thread