axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nand...@apache.org
Subject svn commit: r686796 - /webservices/axis2/branches/java/1_4/modules/kernel/src/org/apache/axis2/description/AxisMessage.java
Date Mon, 18 Aug 2008 15:52:10 GMT
Author: nandana
Date: Mon Aug 18 08:52:09 2008
New Revision: 686796

URL: http://svn.apache.org/viewvc?rev=686796&view=rev
Log:
Policies are not updated correctly, fixing an issue found during testing

Modified:
    webservices/axis2/branches/java/1_4/modules/kernel/src/org/apache/axis2/description/AxisMessage.java

Modified: webservices/axis2/branches/java/1_4/modules/kernel/src/org/apache/axis2/description/AxisMessage.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/1_4/modules/kernel/src/org/apache/axis2/description/AxisMessage.java?rev=686796&r1=686795&r2=686796&view=diff
==============================================================================
--- webservices/axis2/branches/java/1_4/modules/kernel/src/org/apache/axis2/description/AxisMessage.java
(original)
+++ webservices/axis2/branches/java/1_4/modules/kernel/src/org/apache/axis2/description/AxisMessage.java
Mon Aug 18 08:52:09 2008
@@ -34,6 +34,7 @@
 
 import javax.xml.namespace.QName;
 import java.util.ArrayList;
+import java.util.Date;
 import java.util.Iterator;
 import java.util.List;
 
@@ -65,7 +66,7 @@
     
     private Policy effectivePolicy = null;
     
-	private boolean policyCalculated = false;
+    private Date lastPolicyCalcuatedTime = null;
 
     public String getMessagePartName() {
 		return messagePartName;
@@ -240,14 +241,10 @@
     }
     
 	public Policy getEffectivePolicy() {
-		if (getPolicySubject().isUpdated()) {
-			effectivePolicy = calculateEffectivePolicy();
-		} else {
-			if (effectivePolicy == null && !policyCalculated) {
-				effectivePolicy = calculateEffectivePolicy();
-			}
-		}
-		return effectivePolicy;
+            if (lastPolicyCalcuatedTime == null || isPolicyUpdated()) {
+                effectivePolicy = calculateEffectivePolicy();
+            }
+            return effectivePolicy;
 	}
 
 	public Policy calculateEffectivePolicy() {
@@ -282,38 +279,39 @@
 		}
 
 		Policy result = PolicyUtil.getMergedPolicy(policyList, axisService);
-		policyCalculated = true;
+		lastPolicyCalcuatedTime = new Date();
 		return result;
 	}
 	
 	public boolean isPolicyUpdated() {
-		// AxisMessage
-		PolicySubject policySubject = getPolicySubject();
-		if (policySubject.isUpdated()) {
-			return true;
-		}
-
-		// AxisOperation
-		AxisOperation axisOperation = getAxisOperation();
-		if (axisOperation != null
-				&& axisOperation.getPolicySubject().isUpdated()) {
-			return true;
-		}
-
-		// AxisService
-		AxisService axisService = (axisOperation == null) ? null
-				: axisOperation.getAxisService();
-		if (axisService != null && axisService.getPolicySubject().isUpdated()) {
-			return true;
-		}
-
-		// AxisConfiguration
-		AxisConfiguration axisConfiguration = (axisService == null) ? null
-				: axisService.getAxisConfiguration();
-		if (axisConfiguration != null
-				&& axisConfiguration.getPolicySubject().isUpdated()) {
-			return true;
-		}
-		return false;
+            // AxisMessage
+            if (getPolicySubject().getLastUpdatedTime().after(
+                            lastPolicyCalcuatedTime)) {
+                    return true;
+            }
+            // AxisOperation
+            AxisOperation axisOperation = (AxisOperation) parent;
+            if (axisOperation != null
+                            && axisOperation.getPolicySubject().getLastUpdatedTime().after(
+                                            lastPolicyCalcuatedTime)) {
+                    return true;
+            }
+            // AxisService
+            AxisService axisService = (axisOperation == null) ? null
+                            : axisOperation.getAxisService();
+            if (axisService != null
+                            && axisService.getPolicySubject().getLastUpdatedTime().after(
+                                            lastPolicyCalcuatedTime)) {
+                    return true;
+            }
+            // AxisConfiguration
+            AxisConfiguration axisConfiguration = (axisService == null) ? null
+                            : axisService.getAxisConfiguration();
+            if (axisConfiguration != null
+                            && axisConfiguration.getPolicySubject().getLastUpdatedTime()
+                                            .after(lastPolicyCalcuatedTime)) {
+                    return true;
+            }
+            return false;
 	}
 }



Mime
View raw message