[jira] [Commented] (OFBIZ-10650) Allow service engines to directly access their parameters

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[jira] [Commented] (OFBIZ-10650) Allow service engines to directly access their parameters

Nicolas Malin (Jira)

    [ https://issues.apache.org/jira/browse/OFBIZ-10650?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16689691#comment-16689691 ]

Mathieu Lirzin commented on OFBIZ-10650:
----------------------------------------

I have included [^OFBIZ-10650_Allow-engines-to-access-their-parameters-directly.patch] to achieve the intended result. I am not completely satisfied by the approach I used which is still using a {{public abstract class}} and require to adapt the class load mechanism.

I have made sure that external engine that do not provide a 2 argument constructor are still properly loaded.

> Allow service engines to directly access their parameters
> ---------------------------------------------------------
>
>                 Key: OFBIZ-10650
>                 URL: https://issues.apache.org/jira/browse/OFBIZ-10650
>             Project: OFBiz
>          Issue Type: Improvement
>          Components: framework
>    Affects Versions: Trunk
>            Reporter: Mathieu Lirzin
>            Priority: Major
>             Fix For: Upcoming Branch
>
>         Attachments: OFBIZ-10650_Allow-engines-to-access-their-parameters-directly.patch
>
>
> Currently service engines don't have a direct access to the parameters passed in engine XML definition, like in the following example:
> {code:xml}
> <engine name="foo" class="org.example.Foo">
>     <parameter name="authUrl" value="..."/>
>     <parameter name="apiServer" value="..."/>
>     <parameter name="login" value="..."/>
>     <parameter name="password" value="..."/>
>     <parameter name="clientId" value="..."/>
>     <parameter name="secretId" value="..."/>
>     <parameter name="apiKey" value="..."/>
> </engine>
> {code}
> For example in the XML-RPC engine we can find code similar to the following snippet to retrieve the parameters:
> {code:java}
> String engine = modelService.engineName;
> try {
>     url = ServiceConfigUtil.getEngineParameter(engine, "url");
>     login = ServiceConfigUtil.getEngineParameter(engine, "login");
>     password = ServiceConfigUtil.getEngineParameter(engine, "password");
> } catch (GenericConfigException e) {
>     throw new GenericServiceException("Cannot invoke service : engine parameters are not correct");
> }
> {code}
> This is somewhat convoluted to pass via the service model to retrieve the engine name, and finally to get the parameter from the engine model.
> It would be nice if the parameters were directly accessible.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)