diff --git a/source/java/org/alfresco/repo/policy/BehaviourChangeObserver.java b/source/java/org/alfresco/repo/policy/BehaviourChangeObserver.java index c88f326d91..33c42a568e 100644 --- a/source/java/org/alfresco/repo/policy/BehaviourChangeObserver.java +++ b/source/java/org/alfresco/repo/policy/BehaviourChangeObserver.java @@ -34,5 +34,7 @@ package org.alfresco.repo.policy; * @param binding the binding * @param behaviour the behaviour attached to the binding */ - public void addition(B binding, Behaviour behaviour); + void addition(B binding, Behaviour behaviour); + + void removal(B binding, Behaviour behaviour); } diff --git a/source/java/org/alfresco/repo/policy/BehaviourMap.java b/source/java/org/alfresco/repo/policy/BehaviourMap.java index 9fc29d2c7d..dd4e509c81 100644 --- a/source/java/org/alfresco/repo/policy/BehaviourMap.java +++ b/source/java/org/alfresco/repo/policy/BehaviourMap.java @@ -95,8 +95,12 @@ import java.util.Map; { existing.remove(behaviourDefinition); size--; - } + for (BehaviourChangeObserver listener : observers) + { + listener.removal(binding, behaviourDefinition.getBehaviour()); + } + } } diff --git a/source/java/org/alfresco/repo/policy/CachedPolicyFactory.java b/source/java/org/alfresco/repo/policy/CachedPolicyFactory.java index ae7be50130..01daa3ace1 100644 --- a/source/java/org/alfresco/repo/policy/CachedPolicyFactory.java +++ b/source/java/org/alfresco/repo/policy/CachedPolicyFactory.java @@ -89,6 +89,12 @@ import org.apache.commons.logging.LogFactory; clearCache("aggregate delegate", singleCache, binding); clearCache("delegate collection", listCache, binding); } + + public void removal(B binding, Behaviour behaviour) + { + clearCache("aggregate delegate", singleCache, binding); + clearCache("delegate collection", listCache, binding); + } }); } diff --git a/source/java/org/alfresco/repo/policy/ClassBehaviourIndex.java b/source/java/org/alfresco/repo/policy/ClassBehaviourIndex.java index 4ac7b17203..3af61b8e8b 100644 --- a/source/java/org/alfresco/repo/policy/ClassBehaviourIndex.java +++ b/source/java/org/alfresco/repo/policy/ClassBehaviourIndex.java @@ -77,6 +77,33 @@ import org.alfresco.util.LockHelper; listener.addition(binding, behaviour); } } + + public void removal(B binding, Behaviour behaviour) + { + for (BehaviourChangeObserver listener : observers) + { + listener.removal(binding, behaviour); + } + } + }); + + this.classMap.addChangeObserver(new BehaviourChangeObserver() + { + public void addition(B binding, Behaviour behaviour) + { + for (BehaviourChangeObserver listener : observers) + { + listener.addition(binding, behaviour); + } + } + + public void removal(B binding, Behaviour behaviour) + { + for (BehaviourChangeObserver listener : observers) + { + listener.removal(binding, behaviour); + } + } }); // Observe service binding changes and propagate to our own observers @@ -90,6 +117,14 @@ import org.alfresco.util.LockHelper; listener.addition(null, behaviour); } } + + public void removal(ServiceBehaviourBinding binding, Behaviour behaviour) + { + for (BehaviourChangeObserver listener : observers) + { + listener.removal(null, behaviour); + } + } }); // Setup state