You are viewing a plain text version of this content. The canonical link for it is here.
Posted to axis-cvs@ws.apache.org by gd...@apache.org on 2007/06/28 18:41:37 UTC

svn commit: r551618 - in /webservices/axis2/trunk/java/modules: addressing/src/org/apache/axis2/handlers/addressing/ kernel/src/org/apache/axis2/context/ kernel/src/org/apache/axis2/description/ kernel/test/org/apache/axis2/engine/

Author: gdaniels
Date: Thu Jun 28 09:41:34 2007
New Revision: 551618

URL: http://svn.apache.org/viewvc?view=rev&rev=551618
Log:
* Split out property storage for MessageContext and Options.  MC searches Options, but no longer uses it as the primary storage.  This resolves https://issues.apache.org/jira/browse/AXIS2-2854

* A few little fixes/cleanups

Modified:
    webservices/axis2/trunk/java/modules/addressing/src/org/apache/axis2/handlers/addressing/AddressingOutHandler.java
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/context/AbstractContext.java
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/context/MessageContext.java
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisDescription.java
    webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/engine/MessageContextSaveATest.java
    webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/engine/SOAPActionBasedDispatcherTest.java

Modified: webservices/axis2/trunk/java/modules/addressing/src/org/apache/axis2/handlers/addressing/AddressingOutHandler.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/addressing/src/org/apache/axis2/handlers/addressing/AddressingOutHandler.java?view=diff&rev=551618&r1=551617&r2=551618
==============================================================================
--- webservices/axis2/trunk/java/modules/addressing/src/org/apache/axis2/handlers/addressing/AddressingOutHandler.java (original)
+++ webservices/axis2/trunk/java/modules/addressing/src/org/apache/axis2/handlers/addressing/AddressingOutHandler.java Thu Jun 28 09:41:34 2007
@@ -196,8 +196,8 @@
             if (messageID != null && !isAddressingHeaderAlreadyAvailable(WSA_MESSAGE_ID, false))
             {//optional
                 OMElement oe = processStringInfo(messageID, WSA_MESSAGE_ID);
-                ArrayList attributes = (ArrayList)messageContextOptions
-                        .getProperty(AddressingConstants.MESSAGEID_ATTRIBUTES);
+                ArrayList attributes = (ArrayList)messageContext.getProperty(
+                        AddressingConstants.MESSAGEID_ATTRIBUTES);
                 if (attributes != null && !attributes.isEmpty()) {
                     Iterator attrIterator = attributes.iterator();
                     while (attrIterator.hasNext()) {
@@ -260,8 +260,8 @@
                     }
                     // Otherwise just add the header
                     OMElement oe = processStringInfo(action, WSA_ACTION);
-                    ArrayList attributes = (ArrayList)messageContextOptions
-                            .getProperty(AddressingConstants.ACTION_ATTRIBUTES);
+                    ArrayList attributes = (ArrayList)messageContext.getProperty(
+                            AddressingConstants.ACTION_ATTRIBUTES);
                     if (attributes != null && !attributes.isEmpty()) {
                         Iterator attrIterator = attributes.iterator();
                         while (attrIterator.hasNext()) {

Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/context/AbstractContext.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/context/AbstractContext.java?view=diff&rev=551618&r1=551617&r2=551618
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/context/AbstractContext.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/context/AbstractContext.java Thu Jun 28 09:41:34 2007
@@ -129,9 +129,12 @@
     }
 
     private synchronized void addPropertyDifference(String key) {
+        ConfigurationContext cc = getRootContext();
+        if (cc == null) return;
+
         // Add the property differences only if Context replication is enabled,
         // and there are members in the cluster
-        ClusterManager clusterManager = getRootContext().getAxisConfiguration().getClusterManager();
+        ClusterManager clusterManager = cc.getAxisConfiguration().getClusterManager();
         if (clusterManager != null &&
             clusterManager.getContextManager() != null) {
             propertyDifferences.put(key, new PropertyDifference(key, false));

Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/context/MessageContext.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/context/MessageContext.java?view=diff&rev=551618&r1=551617&r2=551618
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/context/MessageContext.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/context/MessageContext.java Thu Jun 28 09:41:34 2007
@@ -849,18 +849,6 @@
     }
 
     /**
-     * Set a property for this message context.
-     *
-     * @param name  name of the property
-     * @param value the value to set
-     */
-    public void setProperty(String name, Object value) {
-        // we override this method here to make sure the properties are set on
-        // options rather than in the inherited property bag.
-        options.setProperty(name, value);
-    }
-
-    /**
      * Retrieves a property value. 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
@@ -875,7 +863,12 @@
         }
 
         // search in my own options
-        Object obj = options.getProperty(name);
+        Object obj = super.getProperty(name);
+        if (obj != null) {
+            return obj;
+        }
+
+        obj = options.getProperty(name);
         if (obj != null) {
             return obj;
         }
@@ -2740,7 +2733,7 @@
         //---------------------------------------------------------
         // properties
         //---------------------------------------------------------
-        Map tmpMap = getProperties();
+        Map tmpMap = properties;
 
         HashMap tmpHashMap = null;
 

Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisDescription.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisDescription.java?view=diff&rev=551618&r1=551617&r2=551618
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisDescription.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisDescription.java Thu Jun 28 09:41:34 2007
@@ -108,10 +108,7 @@
 
     public boolean isParameterTrue(String name) {
         Parameter param = getParameter(name);
-        if (param == null) {
-            return false;
-        }
-        return JavaUtils.isTrue(param.getValue());
+        return param != null && JavaUtils.isTrue(param.getValue());
     }
 
     public ArrayList getParameters() {
@@ -436,12 +433,13 @@
                         existing));
             }
         }
-        //We need to call engageNotify before we engage the module , then only
-        // we can make sure everything is ok to engage the module to description (as an example policy)
+
+        // Let the Module know it's being engaged.  If it's not happy about it, it can throw.
         Module module = axisModule.getModule();
         if (module != null) {
             module.engageNotify(this);
         }
+
         // If we have anything specific to do, let that happen
         onEngage(axisModule, source);
 
@@ -465,10 +463,7 @@
      * TODO: Handle versions?  isEngaged("addressing") should be true even for versioned modulename...
      */
     public boolean isEngaged(String moduleName) {
-        if (engagedModules != null) {
-            return engagedModules.keySet().contains(moduleName);
-        }
-        return false;
+        return engagedModules != null && engagedModules.keySet().contains(moduleName);
     }
 
     public void disengageModule(AxisModule module) throws AxisFault {

Modified: webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/engine/MessageContextSaveATest.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/engine/MessageContextSaveATest.java?view=diff&rev=551618&r1=551617&r2=551618
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/engine/MessageContextSaveATest.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/engine/MessageContextSaveATest.java Thu Jun 28 09:41:34 2007
@@ -859,7 +859,7 @@
                 Integer value3 = (Integer) restoredSimpleMsg.getProperty("key3");
                 Long value4 = (Long) restoredSimpleMsg.getProperty("key4");
 
-                assertEquals(value1, "value1");
+                assertEquals("value1", value1);
                 assertNull(value2);
 
                 boolean isOk = false;

Modified: webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/engine/SOAPActionBasedDispatcherTest.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/engine/SOAPActionBasedDispatcherTest.java?view=diff&rev=551618&r1=551617&r2=551618
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/engine/SOAPActionBasedDispatcherTest.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/engine/SOAPActionBasedDispatcherTest.java Thu Jun 28 09:41:34 2007
@@ -15,6 +15,7 @@
 
 import junit.framework.TestCase;
 import org.apache.axis2.context.MessageContext;
+import org.apache.axis2.context.ConfigurationContext;
 import org.apache.axis2.description.AxisOperation;
 import org.apache.axis2.description.AxisService;
 import org.apache.axis2.description.InOnlyAxisOperation;
@@ -25,7 +26,8 @@
 public class SOAPActionBasedDispatcherTest extends TestCase {
 
     public void testFindOperation() throws Exception {
-        MessageContext messageContext = new MessageContext();
+        ConfigurationContext cc = new ConfigurationContext(new AxisConfiguration());
+        MessageContext messageContext = cc.createMessageContext();
         AxisService as = new AxisService("Service1");
         messageContext.setAxisService(as);
 



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