protected ClassPool getPool(UpgradeableComponentResource extCop) throws NotFoundException {
   //	create a pool for every dependency component with external classes
   ClassPool externalPool;
   Object cached = cop2pool.get(extCop);
   if (cached instanceof ClassPool) {
     externalPool = (ClassPool) cached;
   } else {
     externalPool = ClassPool.getDefault();
     String path = extCop.getExtResLocation() + extCop.getCodeBase();
     externalPool.appendClassPath(path);
     // LOG.info(" Creating a ClassPool for dependency Component at "+path);
     cop2pool.put(extCop, externalPool);
   }
   return externalPool;
 }
 protected void manipulate(String classname, CtClass toManipulate, int extRefCount)
     throws NotFoundException, CannotCompileException {
   // LOG.info(extRefCount+" Starting bytecode instrumentation... ");
   // replace all usages of constructors of the external classes found by a factory method of its
   // proxy class (that may return a proxy instance instead).
   extRefCount = 0;
   Iterator extRefs = class2cop.entrySet().iterator();
   while (extRefs.hasNext()) {
     java.util.Map.Entry entry = (java.util.Map.Entry) extRefs.next();
     UpgradeableComponentResource extCop = (UpgradeableComponentResource) entry.getValue();
     String extRef = (String) entry.getKey();
     LOG.info(
         extRefCount
             + "            ... hiding "
             + extRef
             + " in "
             + extCop.getCodeBase()
             + " from "
             + classname);
     String proxyName = null;
     try {
       ClassPool externalPool = getPool(extCop);
       // create and load  a Proxy for external class extRefClass
       Class extRefClass = extCop.getClassLoader().loadClass(extRef);
       ProxyLoader proxyLoader = extCop.getProxyLoader();
       /// ProxyFactory.setNamingConventionOfWrapper(ProxyFactory.proxyJarPrefix, true);
       Class proxyClass =
           TransparentProxyFactory.getProxyClass(
               proxyLoader, extRefClass); // creates the proxy class for the external class
       proxyName = proxyClass.getName();
       // LOG.info(extRefCount+" Created proxy class "+proxyName+" for externally referenced class
       // "+extRef);
       instrument(toManipulate, extRef, externalPool, proxyName, proxyLoader);
     } catch (ClassNotFoundException e) {
       LOG.error(extRefCount + " onWrite: Caught ClassNotFoundException " + e.getException());
     } catch (WrappingException w) {
       LOG.error(extRef, w);
     } finally {
       extRefCount++;
     }
   }
 }