You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@synapse.apache.org by Nuwan Jayawardene <ns...@gmail.com> on 2023/01/22 06:50:40 UTC

Overloading ConfigUtils methods

Hi all,
I'm currently working on modifying the LoadBalance endpoint parameters
(algorithm, members) to support parameter injection similar to how SOAP
<https://github.com/n-jay/synapse/blob/61fb9e4da909b00d6da8dfe9fb57a3c0a5892793/modules/core/src/main/java/org/apache/synapse/endpoints/EndpointDefinition.java#L218>
and WSDL
<https://github.com/n-jay/synapse/blob/61fb9e4da909b00d6da8dfe9fb57a3c0a5892793/modules/core/src/main/java/org/apache/synapse/endpoints/WSDLEndpoint.java#L121>
endpoints were amended in my PR <https://github.com/apache/synapse/pull/55>.
You can note that I've used the fetchEnvironmentVariables method in
ConfigUtils
<https://github.com/n-jay/synapse/blob/61fb9e4da909b00d6da8dfe9fb57a3c0a5892793/modules/core/src/main/java/org/apache/synapse/config/xml/endpoints/utils/ConfigUtils.java>,
for this purpose in the case of SOAP and WSDL endpoints.
However, you'll also note that fetchEnvironmentVariables
<https://github.com/n-jay/synapse/blob/61fb9e4da909b00d6da8dfe9fb57a3c0a5892793/modules/core/src/main/java/org/apache/synapse/config/xml/endpoints/utils/ConfigUtils.java#L26>
currently
takes in a string argument whereas certain parameters deal with custom
types such as LoadBalanceAlgorithm in the setAlgorithm
<https://github.com/apache/synapse/blob/21bd3c960bb0b96cf5e78aa5ad52d782881ed42c/modules/core/src/main/java/org/apache/synapse/endpoints/LoadbalanceEndpoint.java#L267>
method.

Is it recommended that I *overload* the fetchEnvironmentVariables method
for each new type I encounter or is it best if the existing
fetchEnvironmentVariables
method *is **modified* to accommodate multiple types of parameters?

Hoping to get some thoughts on this.
Best
-- 
*Nuwan Jayawardene*
https://www.linkedin.com/m/in/nuwanjaya

Re: Overloading ConfigUtils methods

Posted by Nuwan Jayawardene <ns...@gmail.com>.
Hi all,
upon further discussion, it was decided to avoid the LoadBalanceAlgorithm
parameter for injection functionality.
Focus will instead be shifted to the endpoint and member parameters.

Kind regards



On Mon, Jan 23, 2023 at 10:44 PM Nuwan Jayawardene <ns...@gmail.com>
wrote:

> Hi Isuru,
> that was my reasoning as well when first writing the
> fetchEnvironmentVariables method, however, it seems it would need to
> support arguments and returns types of other setters as in the case of
> LoadbalanceAlgorithm to perform something like this:
> [image: Selection_534.png]
>
> This is currently not possible with a fetchEnvironmentVariables that has
> a return type of string and only ingests string arguments.
> I'm assuming casting is not a possibility here.
>
>
> On Mon, Jan 23, 2023 at 10:31 AM Isuru Udana <is...@gmail.com> wrote:
>
>> Hi Nuwan,
>>
>> fetchEnvironmentVariables is a utility method to fetch a particular
>> environment variable, can there be any other parameter types other than
>> string?
>>
>> On Sun, Jan 22, 2023 at 12:21 PM Nuwan Jayawardene <ns...@gmail.com>
>> wrote:
>>
>>> Hi all,
>>> I'm currently working on modifying the LoadBalance endpoint parameters
>>> (algorithm, members) to support parameter injection similar to how SOAP
>>> <https://github.com/n-jay/synapse/blob/61fb9e4da909b00d6da8dfe9fb57a3c0a5892793/modules/core/src/main/java/org/apache/synapse/endpoints/EndpointDefinition.java#L218>
>>> and WSDL
>>> <https://github.com/n-jay/synapse/blob/61fb9e4da909b00d6da8dfe9fb57a3c0a5892793/modules/core/src/main/java/org/apache/synapse/endpoints/WSDLEndpoint.java#L121>
>>> endpoints were amended in my PR
>>> <https://github.com/apache/synapse/pull/55>.
>>> You can note that I've used the fetchEnvironmentVariables method in
>>> ConfigUtils
>>> <https://github.com/n-jay/synapse/blob/61fb9e4da909b00d6da8dfe9fb57a3c0a5892793/modules/core/src/main/java/org/apache/synapse/config/xml/endpoints/utils/ConfigUtils.java>,
>>> for this purpose in the case of SOAP and WSDL endpoints.
>>> However, you'll also note that fetchEnvironmentVariables
>>> <https://github.com/n-jay/synapse/blob/61fb9e4da909b00d6da8dfe9fb57a3c0a5892793/modules/core/src/main/java/org/apache/synapse/config/xml/endpoints/utils/ConfigUtils.java#L26> currently
>>> takes in a string argument whereas certain parameters deal with custom
>>> types such as LoadBalanceAlgorithm in the setAlgorithm
>>> <https://github.com/apache/synapse/blob/21bd3c960bb0b96cf5e78aa5ad52d782881ed42c/modules/core/src/main/java/org/apache/synapse/endpoints/LoadbalanceEndpoint.java#L267>
>>> method.
>>>
>>> Is it recommended that I *overload* the fetchEnvironmentVariables
>>> method for each new type I encounter or is it best if the existing fetchEnvironmentVariables
>>> method *is **modified* to accommodate multiple types of parameters?
>>>
>>> Hoping to get some thoughts on this.
>>> Best
>>> --
>>> *Nuwan Jayawardene*
>>> https://www.linkedin.com/m/in/nuwanjaya
>>>
>>>
>>>
>>
>> --
>> *Isuru Udana*
>> Director - Engineering
>> WSO2 Inc.; http://wso2.com
>> Member, Apache Software Foundation; http://www.apache.org
>>
>> *email: isudana@gmail.com <is...@gmail.com>* cell: +94 77 3791887
>>
>>
>
> --
> *Nuwan Jayawardene*
> https://www.linkedin.com/m/in/nuwanjaya
>
>

-- 
*Nuwan Jayawardene*
https://www.linkedin.com/m/in/nuwanjaya

Re: Overloading ConfigUtils methods

Posted by Nuwan Jayawardene <ns...@gmail.com>.
Hi Isuru,
that was my reasoning as well when first writing the
fetchEnvironmentVariables method, however, it seems it would need to
support arguments and returns types of other setters as in the case of
LoadbalanceAlgorithm to perform something like this:
[image: Selection_534.png]

This is currently not possible with a fetchEnvironmentVariables that has a
return type of string and only ingests string arguments.
I'm assuming casting is not a possibility here.


On Mon, Jan 23, 2023 at 10:31 AM Isuru Udana <is...@gmail.com> wrote:

> Hi Nuwan,
>
> fetchEnvironmentVariables is a utility method to fetch a particular
> environment variable, can there be any other parameter types other than
> string?
>
> On Sun, Jan 22, 2023 at 12:21 PM Nuwan Jayawardene <ns...@gmail.com>
> wrote:
>
>> Hi all,
>> I'm currently working on modifying the LoadBalance endpoint parameters
>> (algorithm, members) to support parameter injection similar to how SOAP
>> <https://github.com/n-jay/synapse/blob/61fb9e4da909b00d6da8dfe9fb57a3c0a5892793/modules/core/src/main/java/org/apache/synapse/endpoints/EndpointDefinition.java#L218>
>> and WSDL
>> <https://github.com/n-jay/synapse/blob/61fb9e4da909b00d6da8dfe9fb57a3c0a5892793/modules/core/src/main/java/org/apache/synapse/endpoints/WSDLEndpoint.java#L121>
>> endpoints were amended in my PR
>> <https://github.com/apache/synapse/pull/55>.
>> You can note that I've used the fetchEnvironmentVariables method in
>> ConfigUtils
>> <https://github.com/n-jay/synapse/blob/61fb9e4da909b00d6da8dfe9fb57a3c0a5892793/modules/core/src/main/java/org/apache/synapse/config/xml/endpoints/utils/ConfigUtils.java>,
>> for this purpose in the case of SOAP and WSDL endpoints.
>> However, you'll also note that fetchEnvironmentVariables
>> <https://github.com/n-jay/synapse/blob/61fb9e4da909b00d6da8dfe9fb57a3c0a5892793/modules/core/src/main/java/org/apache/synapse/config/xml/endpoints/utils/ConfigUtils.java#L26> currently
>> takes in a string argument whereas certain parameters deal with custom
>> types such as LoadBalanceAlgorithm in the setAlgorithm
>> <https://github.com/apache/synapse/blob/21bd3c960bb0b96cf5e78aa5ad52d782881ed42c/modules/core/src/main/java/org/apache/synapse/endpoints/LoadbalanceEndpoint.java#L267>
>> method.
>>
>> Is it recommended that I *overload* the fetchEnvironmentVariables method
>> for each new type I encounter or is it best if the existing fetchEnvironmentVariables
>> method *is **modified* to accommodate multiple types of parameters?
>>
>> Hoping to get some thoughts on this.
>> Best
>> --
>> *Nuwan Jayawardene*
>> https://www.linkedin.com/m/in/nuwanjaya
>>
>>
>>
>
> --
> *Isuru Udana*
> Director - Engineering
> WSO2 Inc.; http://wso2.com
> Member, Apache Software Foundation; http://www.apache.org
>
> *email: isudana@gmail.com <is...@gmail.com>* cell: +94 77 3791887
>
>

-- 
*Nuwan Jayawardene*
https://www.linkedin.com/m/in/nuwanjaya

Re: Overloading ConfigUtils methods

Posted by Isuru Udana <is...@gmail.com>.
Hi Nuwan,

fetchEnvironmentVariables is a utility method to fetch a particular
environment variable, can there be any other parameter types other than
string?

On Sun, Jan 22, 2023 at 12:21 PM Nuwan Jayawardene <ns...@gmail.com>
wrote:

> Hi all,
> I'm currently working on modifying the LoadBalance endpoint parameters
> (algorithm, members) to support parameter injection similar to how SOAP
> <https://github.com/n-jay/synapse/blob/61fb9e4da909b00d6da8dfe9fb57a3c0a5892793/modules/core/src/main/java/org/apache/synapse/endpoints/EndpointDefinition.java#L218>
> and WSDL
> <https://github.com/n-jay/synapse/blob/61fb9e4da909b00d6da8dfe9fb57a3c0a5892793/modules/core/src/main/java/org/apache/synapse/endpoints/WSDLEndpoint.java#L121>
> endpoints were amended in my PR
> <https://github.com/apache/synapse/pull/55>.
> You can note that I've used the fetchEnvironmentVariables method in
> ConfigUtils
> <https://github.com/n-jay/synapse/blob/61fb9e4da909b00d6da8dfe9fb57a3c0a5892793/modules/core/src/main/java/org/apache/synapse/config/xml/endpoints/utils/ConfigUtils.java>,
> for this purpose in the case of SOAP and WSDL endpoints.
> However, you'll also note that fetchEnvironmentVariables
> <https://github.com/n-jay/synapse/blob/61fb9e4da909b00d6da8dfe9fb57a3c0a5892793/modules/core/src/main/java/org/apache/synapse/config/xml/endpoints/utils/ConfigUtils.java#L26> currently
> takes in a string argument whereas certain parameters deal with custom
> types such as LoadBalanceAlgorithm in the setAlgorithm
> <https://github.com/apache/synapse/blob/21bd3c960bb0b96cf5e78aa5ad52d782881ed42c/modules/core/src/main/java/org/apache/synapse/endpoints/LoadbalanceEndpoint.java#L267>
> method.
>
> Is it recommended that I *overload* the fetchEnvironmentVariables method
> for each new type I encounter or is it best if the existing fetchEnvironmentVariables
> method *is **modified* to accommodate multiple types of parameters?
>
> Hoping to get some thoughts on this.
> Best
> --
> *Nuwan Jayawardene*
> https://www.linkedin.com/m/in/nuwanjaya
>
>
>

-- 
*Isuru Udana*
Director - Engineering
WSO2 Inc.; http://wso2.com
Member, Apache Software Foundation; http://www.apache.org

*email: isudana@gmail.com <is...@gmail.com>* cell: +94 77 3791887