axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nand...@apache.org
Subject svn commit: r686795 - /webservices/axis2/branches/java/1_4/modules/kernel/src/org/apache/axis2/description/AxisBindingMessage.java
Date Mon, 18 Aug 2008 15:51:45 GMT
Author: nandana
Date: Mon Aug 18 08:51:44 2008
New Revision: 686795

URL: http://svn.apache.org/viewvc?rev=686795&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/AxisBindingMessage.java

Modified: webservices/axis2/branches/java/1_4/modules/kernel/src/org/apache/axis2/description/AxisBindingMessage.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/1_4/modules/kernel/src/org/apache/axis2/description/AxisBindingMessage.java?rev=686795&r1=686794&r2=686795&view=diff
==============================================================================
--- webservices/axis2/branches/java/1_4/modules/kernel/src/org/apache/axis2/description/AxisBindingMessage.java
(original)
+++ webservices/axis2/branches/java/1_4/modules/kernel/src/org/apache/axis2/description/AxisBindingMessage.java
Mon Aug 18 08:51:44 2008
@@ -20,6 +20,7 @@
 package org.apache.axis2.description;
 
 import java.util.ArrayList;
+import java.util.Date;
 import java.util.HashMap;
 import java.util.Map;
 
@@ -50,8 +51,8 @@
 	private boolean fault = false;
 
 	private Policy effectivePolicy = null;
-
-	private boolean policyCalculated = false;
+	
+	private Date lastPolicyCalcuatedTime = null;
 
 	public boolean isFault() {
 		return fault;
@@ -219,11 +220,10 @@
 	}
 
 	public Policy getEffectivePolicy() {
-		if (effectivePolicy == null && !policyCalculated) {
-			effectivePolicy = calculateEffectivePolicy();
-			policyCalculated = true;
-		}
-		return effectivePolicy;
+            if (lastPolicyCalcuatedTime == null || isPolicyUpdated()) {
+                effectivePolicy = calculateEffectivePolicy();
+            }
+            return effectivePolicy;
 	}
 
 	public Policy calculateEffectivePolicy() {
@@ -289,4 +289,74 @@
 
 		return PolicyUtil.getMergedPolicy(policyList, axisService);
 	}
+	
+	private boolean isPolicyUpdated() {
+	    
+	    if (getPolicySubject().getLastUpdatedTime().after(lastPolicyCalcuatedTime)) {
+	            return true;
+	    }
+	    
+	    // AxisBindingOperation
+	    AxisBindingOperation axisBindingOperation = getAxisBindingOperation();
+	    if (axisBindingOperation != null
+	            && axisBindingOperation.getPolicySubject().getLastUpdatedTime()
+	                                                .after(lastPolicyCalcuatedTime)) {
+	        return true;
+	    }
+	                
+	    // AxisBinding
+	    AxisBinding axisBinding = (axisBindingOperation == null) ? null
+	            : axisBindingOperation.getAxisBinding();
+	    if (axisBinding != null
+	            && axisBinding.getPolicySubject().getLastUpdatedTime().after(
+	                                                   lastPolicyCalcuatedTime)) {
+	        return true;
+	    }
+	                
+	    // AxisEndpoint
+	    AxisEndpoint axisEndpoint = (axisBinding == null) ? null : axisBinding
+	                                                                .getAxisEndpoint();
+	    if (axisEndpoint != null
+	            && axisEndpoint.getPolicySubject().getLastUpdatedTime().after(
+	                    lastPolicyCalcuatedTime)) {
+	        return true;
+	    }
+	                
+	    // AxisMessage
+	    if (axisMessage != null
+	            && axisMessage.getPolicySubject().getLastUpdatedTime().after(
+	                                                lastPolicyCalcuatedTime)) {
+	            return true;
+	    }
+	                
+	    // AxisOperation
+	    AxisOperation axisOperation = (axisMessage == null) ? null
+	                                : axisMessage.getAxisOperation();
+	    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