KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jahia > services > usermanager > JahiaGroupManagerService


1 //
2
// ____.
3
// __/\ ______| |__/\. _______
4
// __ .____| | \ | +----+ \
5
// _______| /--| | | - \ _ | : - \_________
6
// \\______: :---| : : | : | \________>
7
// |__\---\_____________:______: :____|____:_____\
8
// /_____|
9
//
10
// . . . i n j a h i a w e t r u s t . . .
11
//
12
// NK - 18 Dec. 2001 :
13
// 1. Added properties to group
14

15 package org.jahia.services.usermanager;
16
17 import org.jahia.data.JahiaDOMObject;
18 import org.jahia.exceptions.JahiaException;
19 import org.jahia.services.JahiaService;
20
21 import java.util.Properties JavaDoc;
22 import java.util.Set JavaDoc;
23 import java.util.Vector JavaDoc;
24
25
26 public abstract class JahiaGroupManagerService extends JahiaService {
27
28     public static final String JavaDoc USERS_GROUPNAME = "users";
29     public static final String JavaDoc ADMINISTRATORS_GROUPNAME = "administrators";
30     public static final String JavaDoc GUEST_GROUPNAME = "guest";
31
32
33     //-------------------------------------------------------------------------
34
/**
35      * Returns a vector of GroupManagerProviderBean object describing the
36      * available group management providers
37      *
38      * @return result a Vector of GroupManagerProviderBean objects that describe
39      * the providers. This will never be null but may be empty if no providers
40      * are available.
41      */

42     public abstract Vector JavaDoc getProviderList ();
43
44     /**
45      * Create a new group in the system.
46      *
47      * @param int siteID the site owner of this group
48      * @param groupname Group's unique identification name
49      *
50      * @return Retrun a reference on a group object on success, or if the groupname
51      * already exists or another error occured, null is returned.
52      */

53     public abstract JahiaGroup createGroup (int siteID, String JavaDoc name, Properties JavaDoc properties);
54
55
56     //-------------------------------------------------------------------------
57
/**
58      * Lookup the group information from the underlaying system (DB, LDAP, ... )
59      * Try to lookup the group into the cache, if it's not in the cache, then
60      * load it into the cahce from the database.
61      *
62      * @param int siteID the site id
63      * @param groupname Group's unique identification name.
64      *
65      * @return Return a reference on a the specified group name. Return null
66      * if the group doesn't exist or when any error occured.
67      */

68     public abstract JahiaGroup lookupGroup (int siteID, String JavaDoc name);
69
70
71     //-------------------------------------------------------------------------
72
/**
73      * Lookup the group information from the underlaying system (DB, LDAP, ... )
74      * Try to lookup the group into the cache, if it's not in the cache, then
75      * load it into the cahce from the database.
76      *
77      * @param String groupID Group's unique identification id.
78      *
79      * @return Return a reference on a the specified group name. Return null
80      * if the group doesn't exist or when any error occured.
81      */

82     public abstract JahiaGroup lookupGroup (String JavaDoc groupID);
83
84
85     //-------------------------------------------------------------------------
86
/**
87      * Delete a group from the system. Updates the database automatically, and
88      * signal the ACL Manager that the group no longer exists.
89      *
90      * @param group Reference to a JahiaGroup object.
91      *
92      * @return Return true on success, or false on any failure.
93      */

94     public abstract boolean deleteGroup (JahiaGroup group);
95
96
97     //-------------------------------------------------------------------------
98
/**
99      * This function checks on a gived site if the groupname has already been
100      * assigned to another group.
101      *
102      * @param int siteID the site id
103      * @param groupname String representing the unique group name.
104      *
105      * @return Return true if the specified username has not been assigned yet,
106      * return false on any failure.
107      */

108     public abstract boolean groupExists (int siteID, String JavaDoc name);
109
110
111     //-------------------------------------------------------------------------
112
/**
113      * Remove the specified user from all the membership lists of all the groups.
114      *
115      * @param user Reference on an existing user.
116      *
117      * @return Return true on success, or false on any failure.
118      */

119     public abstract boolean removeUserFromAllGroups (JahiaUser user);
120
121     //-------------------------------------------------------------------------
122
/**
123      * Return a <code>Vector</code) of <code>String</code> representing all the
124      * group names.
125      *
126      * @return Return a vector of strings containing all the group names.
127      */

128     public abstract Vector JavaDoc getGroupnameList ();
129
130     //-------------------------------------------------------------------------
131
/**
132      * Return a <code>Vector</code) of <code>String</code> representing all the
133      * group names of a site.
134      *
135      * @param int the site id
136      *
137      * @return Return a vector of strings containing all the group names.
138      */

139     public abstract Vector JavaDoc getGroupnameList (int siteID);
140
141     //-------------------------------------------------------------------------
142
/**
143      * Return a <code>Vector</code) of <code>String</code> representing all the
144      * groups of a site.
145      *
146      * @param int the site id
147      *
148      * @return Return a vector of identifier of all groups of this site.
149      */

150     public abstract Vector JavaDoc getGroupList (int siteID);
151
152     //-------------------------------------------------------------------------
153
/**
154      * Return a <code>Vector</code) of <code>String</code> representing all the
155      * group keys of a site.
156      *
157      * @param int the site id
158      *
159      * @return Return a vector of identifier of all groups of this site.
160      *
161      * @auhtor NK
162      */

163     public abstract Vector JavaDoc getGroupList ();
164
165     //-------------------------------------------------------------------------
166
/**
167      * Return the list of groups to shich the specified user has access.
168      *
169      * @param user Valid reference on an existing group.
170      *
171      * @return Return a vector of strings holding all the group names to
172      * which the user as access.
173      */

174     public abstract Vector JavaDoc getUserMembership (JahiaUser user);
175
176
177     //-------------------------------------------------------------------------
178
/**
179      *
180      */

181     public abstract JahiaGroup getAdministratorGroup (int siteID);
182
183
184     //-------------------------------------------------------------------------
185
/**
186      * Return an instance of the guest group
187      *
188      * @return Return the instance of the guest group. Return null on any failure.
189      */

190     public abstract JahiaGroup getGuestGroup (int siteID);
191
192     /**
193      * Find groups according to a table of name=value properties. If the left
194      * side value is "*" for a property then it will be tested against all the
195      * properties. ie *=test* will match every property that starts with "test"
196      *
197      * @param siteID site identifier
198      * @param searchCriterias a Properties object that contains search criterias
199      * in the format name,value (for example "*"="*" or "groupname"="*test*") or
200      * null to search without criterias
201      *
202      * @return Vector a vector of JahiaGroup elements that correspond to those
203      * search criterias
204      */

205     public abstract Set JavaDoc searchGroups (int siteID, Properties JavaDoc searchCriterias);
206
207     /**
208      * Find groups according to a table of name=value properties. If the left
209      * side value is "*" for a property then it will be tested against all the
210      * properties. ie *=test* will match every property that starts with "test"
211      *
212      * @param providerKey key of the provider in which to search, may be
213      * obtained by calling getProviderList()
214      * @param siteID site identifier
215      * @param searchCriterias a Properties object that contains search criterias
216      * in the format name,value (for example "*"="*" or "username"="*test*") or
217      * null to search without criterias
218      *
219      * @return Set a set of JahiaGroup elements that correspond to those
220      * search criterias
221      */

222     public abstract Set JavaDoc searchGroups (String JavaDoc providerKey, int siteID,
223                                       Properties JavaDoc searchCriterias);
224     //-------------------------------------------------------------------------
225
/**
226      * Get all JahiaSite objects where the user has an access.
227      *
228      * @param JahiaUser user, the user you want to get his access grantes sites list.
229      *
230      * @return Return a vector containing all JahiaSite objects where the user has an access.
231      *
232      * @author Alexandre Kraft
233      */

234     public abstract Vector JavaDoc getAdminGrantedSites (JahiaUser user) throws JahiaException;
235
236
237     //--------------------------------------------------------------------------
238
/**
239      * return a DOM document of all groups of a site
240      *
241      * @param int the site id
242      *
243      * @return JahiaDOMObject a DOM representation of this object
244      *
245      * @author NK
246      */

247     public abstract JahiaDOMObject getGroupsAsDOM (int siteID)
248             throws JahiaException;
249
250     //--------------------------------------------------------------------------
251
/**
252      * return a DOM document of all group props of a site
253      *
254      * @param int the site id
255      *
256      * @return JahiaDOMObject a DOM representation of this object
257      *
258      * @author NK
259      */

260     public abstract JahiaDOMObject getGroupPropsAsDOM (int siteID)
261             throws JahiaException;
262
263
264     //--------------------------------------------------------------------------
265
/**
266      * return a DOM document of all application role groups of a site
267      *
268      * @param int the site id
269      *
270      * @return JahiaDOMObject a DOM representation of this object
271      *
272      * @author NK
273      */

274     public abstract JahiaDOMObject getAppRoleGroupsAsDOM (int siteID)
275             throws JahiaException;
276
277
278     //--------------------------------------------------------------------------
279
/**
280      * return a DOM document of all user group access for a site
281      *
282      * @param int the site id
283      *
284      * @return JahiaDOMObject a DOM representation of this object
285      *
286      * @author NK
287      */

288     public abstract JahiaDOMObject getUserGroupAccessAsDOM (int siteID)
289             throws JahiaException;
290
291
292     //--------------------------------------------------------------------------
293
/**
294      * return a DOM document of all application group access for a site
295      * Here users and groups have access to application role groups ( not normal groups )
296      *
297      * @param int the site id
298      *
299      * @return JahiaDOMObject a DOM representation of this object
300      *
301      * @author NK
302      */

303     public abstract JahiaDOMObject getAppGroupAccessAsDOM (int siteID)
304         throws JahiaException;
305
306     /**
307      * This method indicates that any internal cache for a provider should be
308      * updated because the value has changed and needs to be transmitted to the
309      * other nodes in a clustering environment.
310      * @param jahiaGroup JahiaGroup the group to be updated in the cache.
311      */

312     public abstract void updateCache(JahiaGroup jahiaGroup);
313
314 }
315
Popular Tags