org.zeroturnaround.javarebel.integration.glassfish.FelixContentClassLoaderCBP 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.generic.FindClassClassBytecodeProcessor;
/**
* Transforms org.apache.felix.framework.searchpolicy.ContentClassLoader
.
*
* @see FindClassClassBytecodeProcessor
*
* @author Rein Raudjärv
*/
public class FelixContentClassLoaderCBP extends FindClassClassBytecodeProcessor {
public void process(ClassPool cp, ClassLoader cl, CtClass ctClass) throws Exception {
super.process(cp, cl, ctClass);
cp.importPackage("org.zeroturnaround.javarebel");
try {
ctClass.getDeclaredMethod("getResource").insertBefore(
"{" +
" Integration integration = IntegrationFactory.getInstance();" +
" if (integration.isResourceReplaced($0, $1))" +
" return integration.findResource($0, $1);" +
"}");
} catch (NotFoundException e) {}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy