[Yanel-dev] Introducing GroupManager#getGroups(boolean)
Michael Wechner
michael.wechner at wyona.com
Wed Feb 24 15:53:13 CET 2010
Guillaume Déflache wrote:
> 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?
no. The YarepUserManager implementation is also caching the users
>
>
>>> 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
makes sense
> - 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
I understand what you are saying re scalability, but you need to explain
to me how to implement this.
Also why do you want to call it getGroupsLazily ?
> - 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
javadoc ;-)
> - 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!!!
how so?
>
> 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
>
ok, will have a look at it, but we cannot replace it, but rather have to
set it to deprecated and enhance it ;-)
Thanks
Michi
More information about the Yanel-development
mailing list