Mercurial > dive4elements > framework
annotate artifact-database/src/main/java/org/dive4elements/artifactdatabase/DefaultUserFactory.java @ 570:584591f8203c 3.2.x
Upgrade to Log4j 2
author | Tom Gottfried <tom@intevation.de> |
---|---|
date | Mon, 28 Feb 2022 17:41:14 +0100 |
parents | 415df0fc4fa1 |
children |
rev | line source |
---|---|
123
9187abefba8b
Added a default implementation of a UserFactory and a new constructor to create new DefaultUsers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
1 /* |
9187abefba8b
Added a default implementation of a UserFactory and a new constructor to create new DefaultUsers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
2 * Copyright (c) 2010 by Intevation GmbH |
9187abefba8b
Added a default implementation of a UserFactory and a new constructor to create new DefaultUsers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
3 * |
9187abefba8b
Added a default implementation of a UserFactory and a new constructor to create new DefaultUsers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
4 * This program is free software under the LGPL (>=v2.1) |
9187abefba8b
Added a default implementation of a UserFactory and a new constructor to create new DefaultUsers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
5 * Read the file LGPL.txt coming with the software for details |
9187abefba8b
Added a default implementation of a UserFactory and a new constructor to create new DefaultUsers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
6 * or visit http://www.gnu.org/licenses/ if it does not exist. |
9187abefba8b
Added a default implementation of a UserFactory and a new constructor to create new DefaultUsers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
7 */ |
9187abefba8b
Added a default implementation of a UserFactory and a new constructor to create new DefaultUsers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
8 |
475
415df0fc4fa1
Fixed maven group ids
Sascha L. Teichmann <teichmann@intevation.de>
parents:
473
diff
changeset
|
9 package org.dive4elements.artifactdatabase; |
123
9187abefba8b
Added a default implementation of a UserFactory and a new constructor to create new DefaultUsers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
10 |
570 | 11 import org.apache.logging.log4j.Logger; |
12 import org.apache.logging.log4j.LogManager; | |
123
9187abefba8b
Added a default implementation of a UserFactory and a new constructor to create new DefaultUsers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
13 |
9187abefba8b
Added a default implementation of a UserFactory and a new constructor to create new DefaultUsers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
14 import org.w3c.dom.Document; |
130
147610c43863
The UserFactory got a setup() method that is called while bootstrap.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
123
diff
changeset
|
15 import org.w3c.dom.Node; |
123
9187abefba8b
Added a default implementation of a UserFactory and a new constructor to create new DefaultUsers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
16 |
475
415df0fc4fa1
Fixed maven group ids
Sascha L. Teichmann <teichmann@intevation.de>
parents:
473
diff
changeset
|
17 import org.dive4elements.artifacts.User; |
415df0fc4fa1
Fixed maven group ids
Sascha L. Teichmann <teichmann@intevation.de>
parents:
473
diff
changeset
|
18 import org.dive4elements.artifacts.UserFactory; |
123
9187abefba8b
Added a default implementation of a UserFactory and a new constructor to create new DefaultUsers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
19 |
9187abefba8b
Added a default implementation of a UserFactory and a new constructor to create new DefaultUsers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
20 |
9187abefba8b
Added a default implementation of a UserFactory and a new constructor to create new DefaultUsers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
21 /** |
9187abefba8b
Added a default implementation of a UserFactory and a new constructor to create new DefaultUsers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
22 * Default implementation of a UserFactory. |
9187abefba8b
Added a default implementation of a UserFactory and a new constructor to create new DefaultUsers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
23 * |
9187abefba8b
Added a default implementation of a UserFactory and a new constructor to create new DefaultUsers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
24 * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> |
9187abefba8b
Added a default implementation of a UserFactory and a new constructor to create new DefaultUsers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
25 */ |
9187abefba8b
Added a default implementation of a UserFactory and a new constructor to create new DefaultUsers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
26 public class DefaultUserFactory |
9187abefba8b
Added a default implementation of a UserFactory and a new constructor to create new DefaultUsers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
27 implements UserFactory |
9187abefba8b
Added a default implementation of a UserFactory and a new constructor to create new DefaultUsers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
28 { |
9187abefba8b
Added a default implementation of a UserFactory and a new constructor to create new DefaultUsers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
29 /** The logger that is used in this factory.*/ |
570 | 30 private static Logger logger = LogManager.getLogger(DefaultUserFactory.class); |
123
9187abefba8b
Added a default implementation of a UserFactory and a new constructor to create new DefaultUsers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
31 |
9187abefba8b
Added a default implementation of a UserFactory and a new constructor to create new DefaultUsers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
32 |
9187abefba8b
Added a default implementation of a UserFactory and a new constructor to create new DefaultUsers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
33 /** |
9187abefba8b
Added a default implementation of a UserFactory and a new constructor to create new DefaultUsers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
34 * Default constructor. |
9187abefba8b
Added a default implementation of a UserFactory and a new constructor to create new DefaultUsers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
35 */ |
9187abefba8b
Added a default implementation of a UserFactory and a new constructor to create new DefaultUsers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
36 public DefaultUserFactory() { |
9187abefba8b
Added a default implementation of a UserFactory and a new constructor to create new DefaultUsers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
37 } |
9187abefba8b
Added a default implementation of a UserFactory and a new constructor to create new DefaultUsers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
38 |
9187abefba8b
Added a default implementation of a UserFactory and a new constructor to create new DefaultUsers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
39 |
130
147610c43863
The UserFactory got a setup() method that is called while bootstrap.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
123
diff
changeset
|
40 public void setup(Document config, Node factoryNode) { |
147610c43863
The UserFactory got a setup() method that is called while bootstrap.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
123
diff
changeset
|
41 logger.debug("DefaultUserFactory.setup"); |
147610c43863
The UserFactory got a setup() method that is called while bootstrap.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
123
diff
changeset
|
42 } |
147610c43863
The UserFactory got a setup() method that is called while bootstrap.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
123
diff
changeset
|
43 |
147610c43863
The UserFactory got a setup() method that is called while bootstrap.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
123
diff
changeset
|
44 |
123
9187abefba8b
Added a default implementation of a UserFactory and a new constructor to create new DefaultUsers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
45 /** |
9187abefba8b
Added a default implementation of a UserFactory and a new constructor to create new DefaultUsers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
46 * This method creates a new DefaultUser with the given identifier, name and |
9187abefba8b
Added a default implementation of a UserFactory and a new constructor to create new DefaultUsers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
47 * role. |
9187abefba8b
Added a default implementation of a UserFactory and a new constructor to create new DefaultUsers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
48 * |
9187abefba8b
Added a default implementation of a UserFactory and a new constructor to create new DefaultUsers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
49 * @param identifier The identifier for the new user. |
9187abefba8b
Added a default implementation of a UserFactory and a new constructor to create new DefaultUsers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
50 * @param name The name for the new user. |
409
4748949c4f19
Extend user class implementations to handle account information
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
157
diff
changeset
|
51 * @param account The name of the new users account. |
123
9187abefba8b
Added a default implementation of a UserFactory and a new constructor to create new DefaultUsers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
52 * @param role The role for the new user. |
9187abefba8b
Added a default implementation of a UserFactory and a new constructor to create new DefaultUsers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
53 * @param context The CallContext. |
9187abefba8b
Added a default implementation of a UserFactory and a new constructor to create new DefaultUsers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
54 */ |
9187abefba8b
Added a default implementation of a UserFactory and a new constructor to create new DefaultUsers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
55 public User createUser( |
157
6e6965873a48
Simplified creation of users.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
154
diff
changeset
|
56 String identifier, |
123
9187abefba8b
Added a default implementation of a UserFactory and a new constructor to create new DefaultUsers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
57 String name, |
409
4748949c4f19
Extend user class implementations to handle account information
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
157
diff
changeset
|
58 String account, |
123
9187abefba8b
Added a default implementation of a UserFactory and a new constructor to create new DefaultUsers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
59 Document role, |
9187abefba8b
Added a default implementation of a UserFactory and a new constructor to create new DefaultUsers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
60 Object context) |
9187abefba8b
Added a default implementation of a UserFactory and a new constructor to create new DefaultUsers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
61 { |
9187abefba8b
Added a default implementation of a UserFactory and a new constructor to create new DefaultUsers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
62 logger.debug("DefaultUserFactory.createUser: " + name); |
409
4748949c4f19
Extend user class implementations to handle account information
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
157
diff
changeset
|
63 return new DefaultUser(identifier, name, account, role); |
123
9187abefba8b
Added a default implementation of a UserFactory and a new constructor to create new DefaultUsers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
64 } |
9187abefba8b
Added a default implementation of a UserFactory and a new constructor to create new DefaultUsers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
65 } |
9187abefba8b
Added a default implementation of a UserFactory and a new constructor to create new DefaultUsers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
66 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |