All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.zeroturnaround.javarebel.integration.glassfish.FelixContentLoaderImplCBP Maven / Gradle / Ivy

The newest version!
package org.zeroturnaround.javarebel.integration.glassfish;

import org.zeroturnaround.bundled.javassist.ClassPool;
import org.zeroturnaround.bundled.javassist.CtClass;
import org.zeroturnaround.bundled.javassist.NotFoundException;
import org.zeroturnaround.javarebel.integration.support.JavassistClassBytecodeProcessor;

/**
 * Transforms org.apache.felix.framework.searchpolicy.ContentLoaderImpl.
 * 
 * @author Rein Raudjärv
 */
public class FelixContentLoaderImplCBP extends JavassistClassBytecodeProcessor {
  
  public void process(ClassPool cp, ClassLoader cl, CtClass ctClass) throws Exception {
    cp.importPackage("org.zeroturnaround.javarebel");
    
    ctClass.getDeclaredMethod("setURLPolicy").insertAfter(
        "{" +
        "  IntegrationFactory.getInstance().reinitializeClassLoader(m_classLoader);" +
        "}");
    
    try {
      ctClass.getDeclaredMethod("close").insertAfter(
          "{" +
          "  IntegrationFactory.getInstance().unregisterClassLoader(m_classLoader);" +
      "}");
    } catch (NotFoundException e) {
    }
  }
  
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy