Hello Nuwandi,

Thank you for your answer. Actually, I found the current implementation
from the org.wso2.carbon.identity.user.store.count_5.7.5.jar located in
<WSO2EI_HOME>/repository/components/plugins from where I found which
dependency to add to my POM and tried to implement one myself but that did
not work. I think some of the OSGi notion are missing on my side, because
even if I register my "UserSotreCountRetriever", that does not work. The
code I wrote was something like:

    protected void activate(ComponentContext ctxt) {
>         BundleContext bundleContext = ctxt.getBundleContext();
>
>         MyUserStoreManager userStoreManager = new MyUserStoreManager();
>         bundleContext.registerService(UserStoreManager.class.getName(),
> userStoreManager, null);
>
> bundleContext.registerService(UserStoreCountRetriever.class.getName(),
> userStoreManager, null);
>     }
>

Of course, MyUserStoreManager implemented the UserStoreCountRetriever
interface

So, I concluded by just removing the custom "UserStoreCountRetriever" class
property and I can retrieve my usernames without any error message
concerning the counting;

However, if you have a tutorial or a documentation to implement custom
things like that for realzies, that would be cool :)

Regards,

Thomas

2017-07-28 4:17 GMT+02:00 Nuwandi Wickramasinghe <[email protected]>:

> Hi Thomas,
>
> User counter is different from "UserStoreManager". Therefore you cannot
> give your custom User store manager class as CountRetrieverClass. [1] is
> the class used for this by default. You should be able to customize the
> count implementation by writing a new count retriever extending
> *AbstractUserStoreCountRetriever *and then providing that class as the
> "UserStoreCountRetriever". In your custom count retriever class override
> "countUsers" method and change the implementation as you wish.
>
> regards
> Nuwandi
>
> On Thu, Jul 27, 2017 at 6:59 PM, Thomas LEGRAND <
> [email protected]> wrote:
>
>> Hello,
>>
>> For the second problem, I know from where this came from. It is just my
>> String[] contained a null value which triggered a NPE during the
>> verification of the presence of a '|' in the name like it is written at
>> line 180 of this source code [1].
>>
>> However, the other problem remains concerning the UserStoreCountService
>> because I always have:
>>
>> [2017-07-27 15:26:20,293] ERROR {org.wso2.carbon.identity.user
>>> .store.count.UserStoreCountService} -  Error while getting user count
>>> from user store domain : myUserStore
>>> org.wso2.carbon.identity.user.store.count.exception.UserStoreCounterException:
>>> ORA-00942: Table ou vue inexistante
>>>
>>
>> Regards,
>>
>> Thomas
>>
>> [1] https://github.com/wso2-attic/carbon-identity/blob/master/co
>> mponents/user-mgt/org.wso2.carbon.user.mgt/src/main/java/org
>> /wso2/carbon/user/mgt/UserRealmProxy.java#L180
>>
>>
>> 2017-07-27 11:14 GMT+02:00 Thomas LEGRAND <[email protected]>:
>>
>>> Hello,
>>>
>>> I am trying to create a custom JDBC user store by extending the
>>> org.wso2.carbon.user.core.jdbc.JDBCUserStoreManager. For the moment, I
>>> just implemented the doListUsers method to display them in the IS. But I
>>> can't even list my users because I have two problems:
>>>
>>> - The first one concerns the method to count the retrieved users. I
>>> noticed the default used class is org.wso2.carbon.identity.us
>>> er.store.count.jdbc.JDBCUserStoreCountRetriever but it seems to use the
>>> SQL request defined in the properties to execute the count. So I configured
>>> my user-store configuration file to use my custom JDBCUserStoreManager as
>>> "UserStoreCountRetriever". But now, the error appearing is it want to
>>> execute the "countUsers" method that I can't even see in the source code in
>>> [1]. Which interface/class should I implement/extend to allow my custom
>>> JDBCUserStoreManager to use itself as "UserStoreCountRetriever". I ask that
>>> because I have not found the source code of this class :(
>>> - The second one is the content of the list of users itself. So the call
>>> of the doListUsers. My SQL request is executed but I have a problem because
>>> a stacktrace appears tellming me that a NPE occured in the class
>>> UserRealmProxy and I don't know what to do:
>>>
>>> [2017-07-27 11:03:45,555] ERROR {org.wso2.carbon.user.mgt.UserRealmProxy}
>>>> -
>>>> java.lang.NullPointerException
>>>>         at org.wso2.carbon.user.mgt.UserRealmProxy.listAllUsers(UserRea
>>>> lmProxy.java:180)
>>>>         at org.wso2.carbon.user.mgt.UserAdmin.listAllUsers(UserAdmin.ja
>>>> va:82)
>>>>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>>>         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAcce
>>>> ssorImpl.java:62)
>>>>         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMe
>>>> thodAccessorImpl.java:43)
>>>>         at java.lang.reflect.Method.invoke(Method.java:498)
>>>>         ...
>>>
>>>
>>> In addition, I followed the documentation [1] but it is not complete
>>> because the part to register the OSGi bundle is missing. So I followed the
>>> end of the tuto [2] to do so (the part "Register Custom User Store Manager
>>> in OSGI framework"). And if I can make a comment, most of the tuto does not
>>> display which packages to use which is very wrong (hopefully, there was a
>>> sample :)) because there is a big difference between importing
>>> org.wso2.carbon.user.api.UserStoreManager and importing
>>> org.wso2.carbon.user.core.UserStoreManager. There is no way to know
>>> which one to use.
>>>
>>> Can you help me, please?
>>>
>>> Regards,
>>>
>>> Thomas
>>>
>>> [1] https://docs.wso2.com/display/IS530/Writing+a+Custom+Use
>>> r+Store+Manager#WritingaCustomUserStoreManager-Deployingandc
>>> onfiguringthecustomuserstoremanager
>>> [2] http://pushpalankajaya.blogspot.fr/2013/09/how-to-write-
>>> custom-user-store-manager.html
>>>
>>
>>
>> _______________________________________________
>> Dev mailing list
>> [email protected]
>> http://wso2.org/cgi-bin/mailman/listinfo/dev
>>
>>
>
>
> --
>
> Best Regards,
>
> Nuwandi Wickramasinghe
>
> Software Engineer
>
> WSO2 Inc.
>
> Web : http://wso2.com
>
> Mobile : 0719214873
>
_______________________________________________
Dev mailing list
[email protected]
http://wso2.org/cgi-bin/mailman/listinfo/dev

Reply via email to