KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > outerj > daisy > repository > user > UserManager


1 /*
2  * Copyright 2004 Outerthought bvba and Schaubroeck nv
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */

16 package org.outerj.daisy.repository.user;
17
18 import org.outerj.daisy.repository.RepositoryException;
19 import org.outerx.daisy.x10.PublicUserInfosDocument;
20 import org.outerx.daisy.x10.PublicUserInfoDocument;
21
22 /**
23  * Manager for all things user related.
24  */

25 public interface UserManager {
26     /**
27      * Returns all available users. Only Administrators can do this.
28      */

29     Users getUsers() throws RepositoryException;
30
31     long[] getUserIds() throws RepositoryException;
32
33     /**
34      * Returns the publicly available information for a user.
35      */

36     PublicUserInfoDocument getPublicUserInfo(long userId) throws RepositoryException;
37
38     /**
39      * Returns the public information of all users. Contrary to
40      * {@link #getUsers()}, this method can be called by any user.
41      */

42     PublicUserInfosDocument getPublicUserInfos() throws RepositoryException;
43
44     /**
45      * Returns all available roles.
46      */

47     Roles getRoles() throws RepositoryException;
48     
49     /**
50      * Creates a new User.
51      *
52      * <p>The persistency of this object towards the data store
53      * is the responsibility of the client using the User
54      * object itself by calling the {@link User#save()} method.
55
56      * @param login the user login used when authenticating
57      * @return a User object which isn't persistent yet.
58      */

59     User createUser(String JavaDoc login);
60
61     /**
62      * Deletes the User with data store id userId
63      * @param userId data store id of the User to delete
64      */

65     void deleteUser(long userId) throws RepositoryException;
66     
67     /**
68      * Return the User object which is identified by data store id userId.
69      *
70      * <p>Only administrators can retrieve the User object for users that are
71      * not themselve.
72      *
73      * @param userId the data store id of the desired User object
74      * @return the User object corresponding to data store id userId
75      */

76     User getUser(long userId, boolean updateable) throws RepositoryException;
77
78     /**
79      * Return the Role object which is identified by data store id roleId
80      * @param roleId the data store id of the desired Role object
81      * @return the Role object corresponding to data store id roleId
82      */

83     Role getRole(long roleId, boolean updateable) throws RepositoryException;
84     
85     /**
86      * Return the User object which is identified by the specified userLogin
87      * @param userLogin the login by which the desired User object is identified
88      * @return the User object for the user with login userLogin
89      */

90     User getUser(String JavaDoc userLogin, boolean updateable) throws RepositoryException;
91
92     /**
93      * Return the Role object which is identified by the specified roleName
94      * @param roleName the name by which the desired Role object is identified
95      * @return the Role object for the role with name roleName
96      */

97     Role getRole(String JavaDoc roleName, boolean updateable) throws RepositoryException;
98     
99     /**
100      * Creates a new Role.
101      *
102      * @param roleName
103      * @return a Role object
104      */

105     Role createRole(String JavaDoc roleName);
106
107     /**
108      * Deletes the Role with data store id roleId
109      * @param roleId data store id of the Role to delete
110      */

111     void deleteRole(long roleId) throws RepositoryException;
112
113     /**
114      * Retrieves the display name of a user, using the user cache for quick access.
115      * Only administrators are allowed to access the full user object, so this method
116      * enables 'normal' users to resolve user ids to names.
117      *
118      * <p>This is the same as otherwise retrieved from {@link User#getDisplayName()}.
119      *
120      * @throws UserNotFoundException if the user doesn't exist
121      */

122     String JavaDoc getUserDisplayName(long userId) throws RepositoryException;
123
124     /**
125      * Retrieves the login of a user.
126      * Only administrators are allowed to access the full user object, so this method
127      * enables 'normal' users to resolve user ids to logins.
128      *
129      * <p>This is the same as otherwise retrieved from {@link User#getLogin()}.
130      *
131      * @throws UserNotFoundException if the user doesn't exist
132      */

133     String JavaDoc getUserLogin(long userId) throws RepositoryException;
134
135     /**
136      * Retrieves the id of a user based on its login. This method can be used
137      * instead of getUser(login).getId() for non-administrator users.
138      *
139      * @throws UserNotFoundException if the user doesn't exist
140      */

141     long getUserId(String JavaDoc login) throws RepositoryException;
142
143     /**
144      * Retrieves the name of a role, using the user cache for quick access.
145      *
146      * <p>This is the same as otherwise retrieved from {@link Role#getName()}.
147      *
148      * @throws RoleNotFoundException if the role doesn't exist
149      */

150     String JavaDoc getRoleDisplayName(long roleId) throws RepositoryException;
151
152     Users getUsersByEmail(String JavaDoc email) throws RepositoryException;
153
154     AuthenticationSchemeInfos getAuthenticationSchemes() throws RepositoryException;
155 }
156
Popular Tags