ingo@123: /* ingo@123: * Copyright (c) 2010 by Intevation GmbH ingo@123: * ingo@123: * This program is free software under the LGPL (>=v2.1) ingo@123: * Read the file LGPL.txt coming with the software for details ingo@123: * or visit http://www.gnu.org/licenses/ if it does not exist. ingo@123: */ ingo@123: ingo@123: package de.intevation.artifactdatabase; ingo@123: ingo@123: import org.apache.log4j.Logger; ingo@123: ingo@123: import org.w3c.dom.Document; ingo@130: import org.w3c.dom.Node; ingo@123: ingo@123: import de.intevation.artifacts.User; ingo@123: import de.intevation.artifacts.UserFactory; ingo@123: ingo@123: ingo@123: /** ingo@123: * Default implementation of a UserFactory. ingo@123: * ingo@123: * @author Ingo Weinzierl ingo@123: */ ingo@123: public class DefaultUserFactory ingo@123: implements UserFactory ingo@123: { ingo@123: /** The logger that is used in this factory.*/ ingo@123: private static Logger logger = Logger.getLogger(DefaultUserFactory.class); ingo@123: ingo@123: ingo@123: /** ingo@123: * Default constructor. ingo@123: */ ingo@123: public DefaultUserFactory() { ingo@123: } ingo@123: ingo@123: ingo@130: public void setup(Document config, Node factoryNode) { ingo@130: logger.debug("DefaultUserFactory.setup"); ingo@130: } ingo@130: ingo@130: ingo@123: /** ingo@123: * This method creates a new DefaultUser with the given identifier, name and ingo@123: * role. ingo@123: * ingo@123: * @param identifier The identifier for the new user. ingo@123: * @param name The name for the new user. ingo@123: * @param role The role for the new user. ingo@123: * @param context The CallContext. ingo@123: */ ingo@123: public User createUser( ingo@123: String name, ingo@123: Document role, ingo@123: Object context) ingo@123: { ingo@123: logger.debug("DefaultUserFactory.createUser: " + name); ingo@123: sascha@134: return Backend.getInstance().createUser(name, role); ingo@123: } ingo@123: ingo@123: ingo@123: /** ingo@123: * Deletes the given user. ingo@123: * ingo@123: * @param user The user to be deleted. ingo@123: * @param context The CallContext. ingo@123: */ ingo@123: public void deleteUser(User user, Object context) { ingo@123: logger.debug("DefaultUserFactory.deleteUser: " + user.identifier()); sascha@134: sascha@134: Backend.getInstance().deleteUser(user); ingo@123: } ingo@123: ingo@123: ingo@123: /** ingo@123: * Returns the user with the given identifier. ingo@123: * ingo@123: * @param identifier The identifier of a user. ingo@123: * @param context The CallContext. ingo@123: * ingo@123: * @return the user with the given identifier. ingo@123: */ ingo@123: public User getUser(String identifier, Object context) { ingo@123: logger.debug("DefaultUserFactory.getUser: " + identifier); ingo@123: sascha@134: return Backend.getInstance().getUser(identifier); ingo@123: } ingo@123: ingo@123: ingo@123: /** ingo@123: * Returns a list of users available for this application. ingo@123: * ingo@123: * @param context The CallContext. ingo@123: * ingo@123: * @return a list of users. ingo@123: */ ingo@123: public User [] getUsers(Object context) { ingo@123: logger.debug("DefaultUserFactory.getUsers"); ingo@123: sascha@134: return Backend.getInstance().getUsers(); ingo@123: } ingo@123: } ingo@123: // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :