Hi Anjana,

On Thu, Apr 3, 2014 at 3:04 PM, Anjana Fernando <anj...@wso2.com> wrote:

> Hi Maduranga,
>
> Yeah, seems like the packages exported from the stub is not correct. We
> will have to fix those eventually, @Chanika please note.
>
> But for your requirement, I'm guessing you will have your own admin
> service operations when adding user stores and all. So calling another
> service from through a backend service is overkill, you can directly call
> the required functionality directly. Check here [1] to see how
> "testDataSourceConnection()" is implemented, you just have to use a logic
> similar to do it.
>

We are not calling the service from the BE. We are using the same
ndatasource stub to call the web service from the UI component itself.

We find that the nadatasource UI component is doing quite a lot of
processing and creating a complex object before sending  the request to the
back end. I don't think all that processing is needed in the UI. Due to
this we also had to duplicate all that code in our
user.store.configuration.ui. Effectively you should only need the
connection URL, username, password and Driver class to test the JDBC
connection from the UI. If the service was accepting only these parameters
our lives would have been much easier.

Another problem with this is that we cannot use the same service to do
validation from our backend components. What comes to my mind right now as
a work around is to have all that code we duplicated in a common bundle and
use it in both FE and BE components. I wonder if you are doing this
validation both in FE and BE and if so how you are doing it.

If you are doing any changes related to these components please consider
the above improvements.


> But then again, if your requirement is directly from the UI to check the
> validity of database connection information, then yeah, do fix the data
> source UI component as you've done, but you have to check all the usages of
> those packages and fix those as well.
>
> [1]
> https://svn.wso2.org/repos/wso2/carbon/kernel/branches/4.2.0/core/org.wso2.carbon.ndatasource.core/4.2.0/src/main/java/org/wso2/carbon/ndatasource/core/services/NDataSourceAdminService.java
>
> Cheers,
> Anjana.
>
>
> On Thu, Apr 3, 2014 at 1:32 PM, Maduranga Siriwardena 
> <madura...@wso2.com>wrote:
>
>> Hi all,
>> In the IS, when a secondary JDBC user store is creating the database
>> connection is not tested. So when we do a operation on the user store,
>> exceptions are thrown. So to fix the issue, I need to check the database
>> connection before creating the user store.
>>
>> Same scenario happens in DSS. It uses org.wso2.carbon.ndatasource.stub
>> and generate a client and call the relevant methods. But as you can see
>> imports are done as org.wso2.carbon.ndatasource.ui.stub in [1]. So if I
>> do the same thing and build my component, I builds without errors. But when
>> I add the jar to the pack and run the server it gives runtime errors(can't
>> remember the exact error. but it was about problems with finding the
>> correct packages and classes.). But if I add
>> the org.wso2.carbon.ndatasource.ui component also to the dropins folder, it
>> works without errors.
>>
>> But I can't add the UI component to the IS as it will change the UI of
>> the IS.
>> When I checked the folder structure of the jar of the stub, it was like 
>> org/wso2/carbon/ndatasource/ui/stub.
>> So I think there is a problem with exporting the packages in the stub. So I
>> did some changes to the pom of the stub (in the maven-antrun-plugin
>> section) changing some package names when generating the stub from
>> wsdl2java (changed pom and diff are attached here). So by doing this, I can
>> test the connection in IS without a problem.
>> As changing the stub will break the other components that user the stub,
>> I changed the above mentioned UI component. Now it is working without a
>> problem. (not much sure of any other component that use the stub)
>>
>> Can someone please comment about the suitability of this approach.
>>
>>
>>
>> [1]
>> https://svn.wso2.org/repos/wso2/carbon/platform/branches/turing/components/ndatasource/org.wso2.carbon.ndatasource.ui/4.2.2/src/main/java/org/wso2/carbon/ndatasource/ui/NDataSourceAdminServiceClient.java
>>
>> Thank you,
>> Maduranga
>>
>> _______________________________________________
>> Dev mailing list
>> Dev@wso2.org
>> http://wso2.org/cgi-bin/mailman/listinfo/dev
>>
>>
>
>
> --
> *Anjana Fernando*
> Technical Lead
> WSO2 Inc. | http://wso2.com
> lean . enterprise . middleware
>
> _______________________________________________
> Dev mailing list
> Dev@wso2.org
> http://wso2.org/cgi-bin/mailman/listinfo/dev
>
>


-- 
Thanks & Regards,

*Johann Dilantha Nallathamby*
Senior Software Engineer
Integration Technologies Team
WSO2, Inc.
lean.enterprise.middleware

Mobile - *+94777776950*
Blog - *http://nallaa.wordpress.com <http://nallaa.wordpress.com>*
_______________________________________________
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev

Reply via email to