Mercurial > dive4elements > framework
annotate artifact-database/src/main/java/de/intevation/artifactdatabase/DefaultUserFactory.java @ 126:76744dcbe826
Added a user-factory configuration to the demo-config.
artifacts/trunk@1350 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Ingo Weinzierl <ingo.weinzierl@intevation.de> |
---|---|
date | Tue, 01 Mar 2011 17:49:17 +0000 |
parents | 9187abefba8b |
children | 147610c43863 |
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 |
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
|
9 package de.intevation.artifactdatabase; |
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 |
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
|
11 import org.apache.log4j.Logger; |
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
|
12 |
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 import org.w3c.dom.Document; |
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 |
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
|
15 import de.intevation.artifacts.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
|
16 import de.intevation.artifacts.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
|
17 |
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
|
18 |
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 * 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
|
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 * @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
|
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 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
|
25 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
|
26 { |
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 /** The logger that is used in this factory.*/ |
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 private static Logger logger = Logger.getLogger(DefaultUserFactory.class); |
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 |
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
|
30 |
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 * 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
|
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 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
|
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 |
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 * 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
|
40 * 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
|
41 * |
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
|
42 * @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
|
43 * @param name The name 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
|
44 * @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
|
45 * @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
|
46 */ |
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 public User createUser( |
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 String identifier, |
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 String name, |
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 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
|
51 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
|
52 { |
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 logger.debug("DefaultUserFactory.createUser: " + name); |
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 return new DefaultUser(identifier, name, 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
|
56 } |
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 |
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
|
58 |
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 /** |
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 * Deletes the given 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
|
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 * @param user The user to be deleted. |
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
|
63 * @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
|
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 public void deleteUser(User user, 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
|
66 logger.debug("DefaultUserFactory.deleteUser: " + user.identifier()); |
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
|
67 } |
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
|
68 |
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
|
69 |
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
|
70 /** |
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
|
71 * Returns the user with the given identifier. |
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
|
72 * |
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
|
73 * @param identifier The identifier of a 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
|
74 * @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
|
75 * |
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
|
76 * @return the user with the given identifier. |
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
|
77 */ |
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
|
78 public User getUser(String identifier, 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
|
79 logger.debug("DefaultUserFactory.getUser: " + identifier); |
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
|
80 |
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
|
81 // TODO Implement me |
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
|
82 return null; |
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
|
83 } |
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
|
84 |
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
|
85 |
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
|
86 /** |
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
|
87 * Returns a list of users available for this application. |
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
|
88 * |
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
|
89 * @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
|
90 * |
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
|
91 * @return a list of users. |
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
|
92 */ |
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
|
93 public User [] getUsers(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
|
94 logger.debug("DefaultUserFactory.getUsers"); |
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
|
95 |
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
|
96 // TODO Implement me |
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
|
97 return null; |
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
|
98 } |
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
|
99 } |
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
|
100 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |