// Path: src/main/java/org/wmaop/aop/advice/Advice.java
// public class Advice {
// 
// 	private final PointCut pointCut;
// 	private final Interceptor interceptor;
// 	private final String id;
// 	private AdviceState adviceState = AdviceState.NEW;
// 	private final Remit remit;
// 
// 	public Advice(String id, Remit remit, PointCut pointCut, Interceptor interceptor) {
// 		this.pointCut = pointCut;
// 		this.interceptor = interceptor;
// 		this.id = id;
// 		this.remit = remit;
// 	}
// 
// 	public Remit getRemit() {
// 		return remit;
// 	}
// 
// 	public PointCut getPointCut() {
// 		return pointCut;
// 	}
// 
// 	public boolean isApplicable(FlowPosition pipelinePosition, IData idata){
// 		return pointCut.isApplicable(pipelinePosition, idata) && remit.isApplicable();
// 	}
// 	
// 	public Interceptor getInterceptor() {
// 		return interceptor;
// 	}
// 
// 	public String getId() {
// 		return id;
// 	}
// 
// 	public AdviceState getAdviceState() {
// 		return adviceState;
// 	}
// 
// 	public void setAdviceState(AdviceState adviceState) {
// 		this.adviceState = adviceState;
// 	}
// 
// 	@Override
// 	public String toString() {
// 		return id + ' ' + adviceState + ' ' + pointCut + ' ' + interceptor + ' ' + pointCut.getInterceptPoint() + ' ' + remit;
// 	}
// 	
// 	public Map<String, Object> toMap() {
// 		Map<String, Object> am = new HashMap<>();
// 		am.put("state", adviceState.toString());
// 		am.put("adviceId", id);
// 		am.put("pointcut", pointCut.toMap());
// 		am.put("interceptor", interceptor.toMap());
// 		am.put("remit", remit.toString());
// 		return am;
// 	}
// 
// 	@Override
// 	public int hashCode() {
// 		final int prime = 31;
// 		int result = 1;
// 		result = prime * result + ((id == null) ? 0 : id.hashCode());
// 		return result;
// 	}
// 
// 	@Override
// 	public boolean equals(Object obj) {
// 		if (this == obj)
// 			return true;
// 		if (obj == null)
// 			return false;
// 		if (getClass() != obj.getClass())
// 			return false;
// 		Advice other = (Advice) obj;
// 		if (id == null) {
// 			if (other.id != null)
// 				return false;
// 		} else if (!id.equals(other.id))
// 			return false;
// 		return true;
// 	}
// }


import java.io.File;
import java.io.IOException;
import java.nio.file.FileVisitResult;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.nio.file.SimpleFileVisitor;
import java.nio.file.attribute.BasicFileAttributes;
import java.util.HashSet;
import java.util.Set;
import org.wmaop.aop.advice.Advice;
import org.wmaop.util.logger.Logger;
import com.wm.app.b2b.server.BaseService;
import com.wm.app.b2b.server.Package;
import com.wm.app.b2b.server.PackageManager;
import com.wm.app.b2b.server.ServerAPI;
import com.wm.app.b2b.server.ServiceSetupException;
import com.wm.app.b2b.server.ns.Namespace;
import com.wm.lang.ns.NSException;
import com.wm.lang.ns.NSName;
import com.wm.lang.ns.NSNode;
import com.wm.lang.ns.NSServiceType;
		Package pkg = PackageManager.getPackage(SUPPORTING_PKG);
		if (pkg != null) {
			NSName name = NSName.create(svcName);
			BaseService svc = Namespace.getService(name);
			if (svc != null && SUPPORTING_PKG.equals(svc.getPackageName())) {
				Namespace.current().deleteNode(name, true, pkg);
				stubbedServices.remove(svcName);
			}
		}
	}

	public void clearStubs()  {
		Package pkg = PackageManager.getPackage(SUPPORTING_PKG);
		if (pkg == null) {
			return;
		}
		for (Object node : Namespace.current().getNodes(pkg)) {
			try {
				Namespace.current().deleteNode(((NSNode) node).getNSName(), true, pkg);
			} catch (NSException e) {
				throw new StubLifecycleException("Internal namespace exception clearing stubs", e);
			}
		}
		stubbedServices.clear();
	}

	public boolean hasStub(String svcName) {
		return stubbedServices.contains(svcName);
	}
	
// Path: src/main/java/org/wmaop/aop/advice/Advice.java
// public class Advice {
// 
// 	private final PointCut pointCut;
// 	private final Interceptor interceptor;
// 	private final String id;
// 	private AdviceState adviceState = AdviceState.NEW;
// 	private final Remit remit;
// 
// 	public Advice(String id, Remit remit, PointCut pointCut, Interceptor interceptor) {
// 		this.pointCut = pointCut;
// 		this.interceptor = interceptor;
// 		this.id = id;
// 		this.remit = remit;
// 	}
// 
// 	public Remit getRemit() {
// 		return remit;
// 	}
// 
// 	public PointCut getPointCut() {
// 		return pointCut;
// 	}
// 
// 	public boolean isApplicable(FlowPosition pipelinePosition, IData idata){
// 		return pointCut.isApplicable(pipelinePosition, idata) && remit.isApplicable();
// 	}
// 	
// 	public Interceptor getInterceptor() {
// 		return interceptor;
// 	}
// 
// 	public String getId() {
// 		return id;
// 	}
// 
// 	public AdviceState getAdviceState() {
// 		return adviceState;
// 	}
// 
// 	public void setAdviceState(AdviceState adviceState) {
// 		this.adviceState = adviceState;
// 	}
// 
// 	@Override
// 	public String toString() {
// 		return id + ' ' + adviceState + ' ' + pointCut + ' ' + interceptor + ' ' + pointCut.getInterceptPoint() + ' ' + remit;
// 	}
// 	
// 	public Map<String, Object> toMap() {
// 		Map<String, Object> am = new HashMap<>();
// 		am.put("state", adviceState.toString());
// 		am.put("adviceId", id);
// 		am.put("pointcut", pointCut.toMap());
// 		am.put("interceptor", interceptor.toMap());
// 		am.put("remit", remit.toString());
// 		return am;
// 	}
// 
// 	@Override
// 	public int hashCode() {
// 		final int prime = 31;
// 		int result = 1;
// 		result = prime * result + ((id == null) ? 0 : id.hashCode());
// 		return result;
// 	}
// 
// 	@Override
// 	public boolean equals(Object obj) {
// 		if (this == obj)
// 			return true;
// 		if (obj == null)
// 			return false;
// 		if (getClass() != obj.getClass())
// 			return false;
// 		Advice other = (Advice) obj;
// 		if (id == null) {
// 			if (other.id != null)
// 				return false;
// 		} else if (!id.equals(other.id))
// 			return false;
// 		return true;
// 	}
// }


// Path: src/main/java/org/wmaop/aop/stub/StubManager.java
import java.io.File;
import java.io.IOException;
import java.nio.file.FileVisitResult;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.nio.file.SimpleFileVisitor;
import java.nio.file.attribute.BasicFileAttributes;
import java.util.HashSet;
import java.util.Set;
import org.wmaop.aop.advice.Advice;
import org.wmaop.util.logger.Logger;
import com.wm.app.b2b.server.BaseService;
import com.wm.app.b2b.server.Package;
import com.wm.app.b2b.server.PackageManager;
import com.wm.app.b2b.server.ServerAPI;
import com.wm.app.b2b.server.ServiceSetupException;
import com.wm.app.b2b.server.ns.Namespace;
import com.wm.lang.ns.NSException;
import com.wm.lang.ns.NSName;
import com.wm.lang.ns.NSNode;
import com.wm.lang.ns.NSServiceType;

		Package pkg = PackageManager.getPackage(SUPPORTING_PKG);
		if (pkg != null) {
			NSName name = NSName.create(svcName);
			BaseService svc = Namespace.getService(name);
			if (svc != null && SUPPORTING_PKG.equals(svc.getPackageName())) {
				Namespace.current().deleteNode(name, true, pkg);
				stubbedServices.remove(svcName);
			}
		}
	}

	public void clearStubs()  {
		Package pkg = PackageManager.getPackage(SUPPORTING_PKG);
		if (pkg == null) {
			return;
		}
		for (Object node : Namespace.current().getNodes(pkg)) {
			try {
				Namespace.current().deleteNode(((NSNode) node).getNSName(), true, pkg);
			} catch (NSException e) {
				throw new StubLifecycleException("Internal namespace exception clearing stubs", e);
			}
		}
		stubbedServices.clear();
	}

	public boolean hasStub(String svcName) {
		return stubbedServices.contains(svcName);
	}
	
	public boolean hasStub(Advice advice) {