// Path: src/main/java/org/wmaop/aop/advice/remit/Remit.java
// public interface Remit {
// 	boolean isApplicable();
// 	boolean isApplicable(Scope scope);
// }
// 
// Path: src/main/java/org/wmaop/aop/interceptor/CompositeInterceptor.java
// public interface CompositeInterceptor extends Interceptor {
// 
// 	<T extends Interceptor> List<T> getInterceptorsOfType(Class<T> type);
// 	
// 	List<Interceptor> getInterceptors();
// }
// 
// Path: src/main/java/org/wmaop/aop/interceptor/InterceptPoint.java
// public enum InterceptPoint {
// 		BEFORE,INVOKE,AFTER;
// 
// }
// 
// Path: src/main/java/org/wmaop/aop/interceptor/Interceptor.java
// public interface Interceptor {
// 
// 	InterceptResult intercept(FlowPosition flowPosition, IData idata);
// 
// 	int getInvokeCount();
// 
// 	String getName();
// 
// 	Map<String, Object> toMap();
// 
// }


import static org.wmaop.aop.advice.AdviceState.DISPOSED;
import static org.wmaop.aop.advice.AdviceState.ENABLED;
import java.util.ArrayList;
import java.util.EnumMap;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Observable;
import org.wmaop.aop.advice.remit.Remit;
import org.wmaop.aop.interceptor.CompositeInterceptor;
import org.wmaop.aop.interceptor.InterceptPoint;
import org.wmaop.aop.interceptor.Interceptor;
import org.wmaop.util.logger.Logger;
			for (InterceptPoint ip : InterceptPoint.values()) {
				advices.put(ip, new ArrayList<Advice>());
			}
		} else {
			conditionallyUnregisterAdvice(scope);
		}
	}

	private void conditionallyUnregisterAdvice(Scope scope) {
		for (Entry<String, Advice> advRef : new HashMap<String, Advice>(idAdvice).entrySet()) {
			Advice adv = advRef.getValue();
			Remit remit = adv.getRemit();
			if (scope == null) {
				if (!remit.isApplicable(Scope.GLOBAL)) { // No scope so remove user and session only - ie not global
					unregisterAdvice(adv);
				}
			} else if (remit.isApplicable(scope)) { // Only unregister for applicable scope
				unregisterAdvice(adv);
			}
		}
	}

	public List<Advice> getAdvicesForInterceptPoint(InterceptPoint interceptPoint) {
		return advices.get(interceptPoint);
	}

	public int getInvokeCountForPrefix(String prefix) {
		int invokeCount = 0;
		for (Entry<String, Advice> e : idAdvice.entrySet()) {
			Advice advice = e.getValue();
// Path: src/main/java/org/wmaop/aop/advice/remit/Remit.java
// public interface Remit {
// 	boolean isApplicable();
// 	boolean isApplicable(Scope scope);
// }
// 
// Path: src/main/java/org/wmaop/aop/interceptor/CompositeInterceptor.java
// public interface CompositeInterceptor extends Interceptor {
// 
// 	<T extends Interceptor> List<T> getInterceptorsOfType(Class<T> type);
// 	
// 	List<Interceptor> getInterceptors();
// }
// 
// Path: src/main/java/org/wmaop/aop/interceptor/InterceptPoint.java
// public enum InterceptPoint {
// 		BEFORE,INVOKE,AFTER;
// 
// }
// 
// Path: src/main/java/org/wmaop/aop/interceptor/Interceptor.java
// public interface Interceptor {
// 
// 	InterceptResult intercept(FlowPosition flowPosition, IData idata);
// 
// 	int getInvokeCount();
// 
// 	String getName();
// 
// 	Map<String, Object> toMap();
// 
// }


// Path: src/main/java/org/wmaop/aop/advice/AdviceManager.java
import static org.wmaop.aop.advice.AdviceState.DISPOSED;
import static org.wmaop.aop.advice.AdviceState.ENABLED;
import java.util.ArrayList;
import java.util.EnumMap;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Observable;
import org.wmaop.aop.advice.remit.Remit;
import org.wmaop.aop.interceptor.CompositeInterceptor;
import org.wmaop.aop.interceptor.InterceptPoint;
import org.wmaop.aop.interceptor.Interceptor;
import org.wmaop.util.logger.Logger;

			for (InterceptPoint ip : InterceptPoint.values()) {
				advices.put(ip, new ArrayList<Advice>());
			}
		} else {
			conditionallyUnregisterAdvice(scope);
		}
	}

	private void conditionallyUnregisterAdvice(Scope scope) {
		for (Entry<String, Advice> advRef : new HashMap<String, Advice>(idAdvice).entrySet()) {
			Advice adv = advRef.getValue();
			Remit remit = adv.getRemit();
			if (scope == null) {
				if (!remit.isApplicable(Scope.GLOBAL)) { // No scope so remove user and session only - ie not global
					unregisterAdvice(adv);
				}
			} else if (remit.isApplicable(scope)) { // Only unregister for applicable scope
				unregisterAdvice(adv);
			}
		}
	}

	public List<Advice> getAdvicesForInterceptPoint(InterceptPoint interceptPoint) {
		return advices.get(interceptPoint);
	}

	public int getInvokeCountForPrefix(String prefix) {
		int invokeCount = 0;
		for (Entry<String, Advice> e : idAdvice.entrySet()) {
			Advice advice = e.getValue();
			Interceptor i = advice.getInterceptor();