Carsten Ziegeler wrote:
>Deepal Jayasinghe wrote:
>
>
>>If you are happy with unmodifiable map then I have no objection , any
>>way if some one want to modify property (or properties) he can easily do
>>that no need to call the getProperties and then modify the map.
>>
>>So lets keep what we have now :)
>>
>>
>>
>You mean with my patch :) (Because the current impl always returns an
>empty map).
>I updated the patch to create an unmodifiable map and added some javadocs.
>
>
The one return unmodifiable 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 421208)
>+++
>D:/dev/workspace/axis2/modules/core/src/org/apache/axis2/context/MessageContext.java
> (working copy)
>@@ -30,6 +30,9 @@
>
> import javax.xml.namespace.QName;
> import java.util.ArrayList;
>+import java.util.Collections;
>+import java.util.HashMap;
>+import java.util.Map;
>
> /**
> * MessageContext holds service specific state information.
>@@ -471,6 +474,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, it will start at whatever
>level
>+ * has been set and start there.
>+ * The returned map is unmodifiable, so any changes to the properties have
>+ * to be done by calling [EMAIL PROTECTED] #setProperty(String, Object)}.
>In addition,
>+ * any changes to the properties are not reflected on this map.
>+ *
>+ * @return An unmodifiable map containing 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
>+ resultMap.putAll(options.getProperties());
>+ return Collections.unmodifiableMap(resultMap);
>+ }
>+
>+ /**
> * @return Returns RelatesTo array.
> */
> public RelatesTo[] getRelationships() {
>
>
>
>------------------------------------------------------------------------
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]
>
--
Thanks,
Deepal
................................................................
~Future is Open~
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]