axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Deepal Jayasinghe <dee...@opensource.lk>
Subject Re: [Axis2] Problems with MessageContext
Date Tue, 11 Jul 2006 17:03:06 GMT
Hi Carsten;

I went through your patch and realized that , you are giving read only
access to the properties . So if someone want to change the value of
property (properties) then he wont be able to do that. I think we need
to provide way to change them as well .



Carsten Ziegeler wrote:

>Sanjiva Weerawarana wrote:
>  
>
>>On Tue, 2006-07-11 at 08:19 +0200, Carsten Ziegeler wrote:
>>    
>>
>>>>So in effect the properties hashtable inherited from the superclass is
>>>>not used by the MessageContext class.
>>>>
>>>>        
>>>>
>>>Yes, except in the getProperties() method. If you do a setProperty("A",
>>>"B") on the message context and then do a getProperties().get("A"), you
>>>end up with getting null and not "B". So I think it should be fixed.
>>>      
>>>
>>Oops, you're right of course! Send a patch? :)
>>    
>>
>
>Sure, here we go :)
>
>The implementation is adding the properties from the various contexts
>into a map (reversing the search order) and returns the combined map.
>
>Carsten
>  
>
>------------------------------------------------------------------------
>
>Index: D:/dev/workspace/axis2/modules/core/src/org/apache/axis2/context/MessageContext.java
>===================================================================
>--- D:/dev/workspace/axis2/modules/core/src/org/apache/axis2/context/MessageContext.java
(revision 420740)
>+++ D:/dev/workspace/axis2/modules/core/src/org/apache/axis2/context/MessageContext.java
(working copy)
>@@ -30,6 +30,8 @@
> 
> import javax.xml.namespace.QName;
> import java.util.ArrayList;
>+import java.util.HashMap;
>+import java.util.Map;
> 
> /**
>  * MessageContext holds service specific state information.
>@@ -471,6 +473,42 @@
>     }
> 
>     /**
>+     * Retrieves all property values. The order of search is as follows: search in
>+     * my own options and then look in my context hierarchy. Since its possible
>+     * that the entire hierarchy is not present, I will start at whatever level
>+     * has been set and start there.
>+     *
>+     * @return the combination of all available properties or an empty map
>+     */
>+    public Map getProperties() {
>+        final Map resultMap = new HashMap();
>+
>+        // My own context hierarchy may not all be present. So look for whatever
>+        // nearest level is present and add the properties
>+        // We have to access the contexts in reverse order, in order to allow
>+        // a nearer context to overwrite values from a more distant context
>+        if (configurationContext != null) {
>+            resultMap.putAll(configurationContext.getProperties());
>+        }
>+        if (serviceGroupContext != null) {
>+            resultMap.putAll(serviceGroupContext.getProperties());
>+        }
>+        if (serviceContext != null) {
>+            resultMap.putAll(serviceContext.getProperties());
>+        }
>+        if (operationContext != null) {
>+            resultMap.putAll(operationContext.getProperties());
>+        }
>+
>+        // and now add options, or if the map is empty so far just return them
>+        if ( resultMap.isEmpty() ) {
>+            return options.getProperties();
>+        }
>+        resultMap.putAll(options.getProperties());
>+        return resultMap;
>+    }
>+
>+    /**
>      * @return Returns RelatesTo array.
>      */
>     public RelatesTo[] getRelationships() {
>
>  
>
>------------------------------------------------------------------------
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: axis-dev-unsubscribe@ws.apache.org
>For additional commands, e-mail: axis-dev-help@ws.apache.org
>

-- 
Thanks,
Deepal
................................................................
~Future is Open~ 




---------------------------------------------------------------------
To unsubscribe, e-mail: axis-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-dev-help@ws.apache.org


Mime
View raw message