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
--
Carsten Ziegeler - Open Source Group, S&N AG
http://www.s-und-n.de
http://www.osoco.org/weblogs/rael/
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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]