MessageProcessorSelector class does not provide correct picture here, as an
example before MessageProcessorSelector class get introduced
msgContext.getParameter() scattered in following places[1] and there can be
some other places too. When I introduce MessageProcessorSelector class to
fix AXIS2-5374[2]  I also found same issue and tired for few fixes
including Azeez suggestion below  but each attempt I end up with getting
large number of test failures on Axis2 and Synpase so decided to keep it as
it is because I was fixing different urgent issue.  To fix this it's
required to have significant effort and review Axis2/Synapse code bases
because some of the msgContext.getParameter() calls introduced in the very
beginning of the Axis2 project.

BTW +1 if someone can fix and make sure there is no Axis2/Synapse test
failures.

[1] - http://svn.apache.org/viewvc?view=revision&revision=1387522

[2] - https://issues.apache.org/jira/browse/AXIS2-5374

Thanks !



On Tue, Nov 5, 2013 at 8:04 PM, Afkham Azeez <[email protected]> wrote:

> private static String getMessageFormatterProperty(MessageContext msgContext) {
>         String messageFormatterProperty = null;
>         Object property = msgContext
>                 .getProperty(Constants.Configuration.MESSAGE_TYPE);
>         if (property != null) {
>             messageFormatterProperty = (String) property;
>         }
>         if (messageFormatterProperty == null) {
>             *Parameter parameter = msgContext
>                     .getParameter(Constants.Configuration.MESSAGE_TYPE);*
>             if (parameter != null) {
>                 messageFormatterProperty = (String) parameter.getValue();
>             }
>         }
>         return messageFormatterProperty;
>     }
>
>
> Bold line should have been AxisMessage.getParameter(), which should look up 
> the config hierarchy to get the relevant parameter.
>
>
>
> On Tue, Nov 5, 2013 at 7:46 PM, Nirmal Fernando <[email protected]> wrote:
>
>> FYI org.apache.axis2.util.MessageProcessorSelector uses that.
>>
>>
>> On Tue, Nov 5, 2013 at 7:38 PM, Afkham Azeez <[email protected]> wrote:
>>
>>> We don't generally use parameters with contexts. We use properties with
>>> contexts. Parameters are used only with static config stuff. IMO, that
>>> method should not be used. If a parameter is required, it should be fetched
>>> from the relevant config, not the context.
>>>
>>>
>>> On Tue, Nov 5, 2013 at 7:32 PM, Nirmal Fernando <[email protected]> wrote:
>>>
>>>> Hi All,
>>>>
>>>> Just happened to see following broken logic.
>>>>
>>>>  /**
>>>>      * Retrieves configuration descriptor parameters at any level. The
>>>> order of
>>>>      * search is as follows:
>>>>      * <ol>
>>>>      * <li> Search in message description if it exists </li>
>>>>      * <li> If parameter is not found or if axisMessage is null, search
>>>> in
>>>>      * AxisOperation </li>
>>>>      * <li> If parameter is not found or if operationContext is null,
>>>> search in
>>>>      * AxisService </li>
>>>>      * <li> If parameter is not found or if axisService is null, search
>>>> in
>>>>      * AxisConfiguration </li>
>>>>      * </ol>
>>>>      *
>>>>      * @param key name of desired parameter
>>>>      * @return Parameter <code>Parameter</code>
>>>>      */
>>>>     public Parameter getParameter(String key) {
>>>>
>>>>         if( axisMessage != null ) {
>>>>             return axisMessage.getParameter(key);
>>>>         }
>>>>
>>>>         if (axisOperation != null) {
>>>>             return axisOperation.getParameter(key);
>>>>         }
>>>>
>>>>         if (axisService != null) {
>>>>             return axisService.getParameter(key);
>>>>         }
>>>>
>>>>         if (axisServiceGroup != null) {
>>>>             return axisServiceGroup.getParameter(key);
>>>>         }
>>>>
>>>>         if (configurationContext != null) {
>>>>             AxisConfiguration baseConfig = configurationContext
>>>>                     .getAxisConfiguration();
>>>>             return baseConfig.getParameter(key);
>>>>         }
>>>>         return null;
>>>>     }
>>>>
>>>> --
>>>>
>>>> Thanks & regards,
>>>> Nirmal
>>>>
>>>> Senior Software Engineer- Platform Technologies Team, WSO2 Inc.
>>>> Mobile: +94715779733
>>>> Blog: http://nirmalfdo.blogspot.com/
>>>>
>>>>
>>>
>>>
>>> --
>>> *Afkham Azeez*
>>> Director of Architecture; WSO2, Inc.; http://wso2.com
>>> Member; Apache Software Foundation; http://www.apache.org/
>>> * <http://www.apache.org/>*
>>> *email: **[email protected]* <[email protected]>
>>> * cell: +94 77 3320919 <%2B94%2077%203320919> blog: *
>>> *http://blog.afkham.org* <http://blog.afkham.org>
>>> *twitter: 
>>> **http://twitter.com/afkham_azeez*<http://twitter.com/afkham_azeez>
>>> * linked-in: **http://lk.linkedin.com/in/afkhamazeez
>>> <http://lk.linkedin.com/in/afkhamazeez>*
>>>
>>> *Lean . Enterprise . Middleware*
>>>
>>
>>
>>
>> --
>>
>> Thanks & regards,
>> Nirmal
>>
>> Senior Software Engineer- Platform Technologies Team, WSO2 Inc.
>> Mobile: +94715779733
>> Blog: http://nirmalfdo.blogspot.com/
>>
>>
>
>
> --
> *Afkham Azeez*
> Director of Architecture; WSO2, Inc.; http://wso2.com
> Member; Apache Software Foundation; http://www.apache.org/
> * <http://www.apache.org/>*
> *email: **[email protected]* <[email protected]>
> * cell: +94 77 3320919 <%2B94%2077%203320919> blog: *
> *http://blog.afkham.org* <http://blog.afkham.org>
> *twitter: **http://twitter.com/afkham_azeez*<http://twitter.com/afkham_azeez>
> * linked-in: **http://lk.linkedin.com/in/afkhamazeez
> <http://lk.linkedin.com/in/afkhamazeez>*
>
> *Lean . Enterprise . Middleware*
>



-- 
Sagara Gunathunga

Senior Technical Lead; WSO2, Inc.;  http://wso2.com
V.P Apache Web Services;    http://ws.apache.org/
Linkedin; http://www.linkedin.com/in/ssagara
Blog ;  http://ssagara.blogspot.com
_______________________________________________
Dev mailing list
[email protected]
http://wso2.org/cgi-bin/mailman/listinfo/dev

Reply via email to