[Yanel-dev] Introducing GroupManager#getGroups(boolean)
Guillaume Déflache
guillaume.deflache at wyona.com
Wed Feb 24 13:58:27 CET 2010
Michael Wechner schrieb:
> Michael Wechner wrote:
>> Hi
>>
>> I have just noticed that the interface
>>
>> src/core/java/org/wyona/security/core/api/GroupManager.java
>>
>> has no method getGroups(boolean refresh)
>>
>> similar to UserManager.getUsers(boolean refresh)
AFAICR UserManager#getUsers() always get fresh users, right?
>> which means depending on the implementation, e.g.
>>
>> src/impl/java/org/wyona/security/impl/yarep/YarepGroupManager.java
>>
>> one does not notice if something has changed within the repo which
>> didn't go through this implementation,
>> but which is quite possible if the repo is decoupled and has other
>> "input/output" points.
>>
>> Hence I think we should introduce such a method.
>>
>> WDYT?
Seems reasonable.
> I was thinking some more about this and I think it's best to introduce
> an interface
>
> interface CacheableGroupManagerV1 {
> void refresh();
> Group[] getGroups(boolean);
> }
>
> which then the YarepGroupManager could implement and
> withint the security-api resource we could ask the implementation
> whether it implements this interface or not.
>
> WDYT?
I'd rather have:
interface CacheableGroupGetterV1 {
void refresh();
Iterator<Group> getGroupsLazily();
}
3 differences:
- the interface is renamed because it's not by itself a GroupManager,
only some aspect of it
- we should not use arrays as it forces us to construct all the objects,
but for only thousands of objects it may be OK anyway
- we'd rather not introduce this boolean because:
- it's always a pain to have boolean in an API, one never knows what
they stand for
- this forces you in every implementation to ensure that
getGroups(true) is identical to getGroups(): and incidentally on the
project I am working on ATM it is not the case!!!
Also see javadoc of UserManager#getUsers where I suggest we replace this
with a search API with sorting and paging:
https://svn.wyona.com/repos/public/security/trunk/src/core/java/org/wyona/security/core/api/UserManager.java
More information about the Yanel-development
mailing list