use of io.github.lukehutch.fastclasspathscanner.FastClasspathScanner in project uavstack by uavorg.
the class WebServiceListener method doInstallDProxy.
public void doInstallDProxy(ClassLoader webapploader, final String appid, String contextPath) {
// like SMS, which uses the sun jax-ws RI/Metro-jax-ws RI bind webservices when the servlet starts should
// profile in ComponentProfileHandler
FastClasspathScanner fcs = new FastClasspathScanner(new ClassLoader[] { webapploader });
fcs.scan();
List<String> endPoints = fcs.getNamesOfDirectSubclassesOf("javax.xml.ws.Endpoint");
if (!endPoints.isEmpty()) {
dpInstall.setTargetClassLoader(webapploader);
for (int i = 0; i < endPoints.size(); i++) {
dpInstall.installProxy(endPoints.get(i), new String[] { "com.creditease.uav.monitorframework.webservice.interceptors" }, new DynamicProxyProcessor() {
@Override
public void process(DPMethod m) throws Exception {
if ("publish".equals(m.getName()) && m.getParameterTypes().length > 0 && m.getParameterTypes()[0].getSimpleName().equals("String")) {
dpInstall.defineLocalVal(m, "mObj", WebServiceListenerIT.class);
m.insertBefore("{mObj=new WebServiceListenerIT(\"" + appid + "\");mObj.obtainWsInfo($1,getImplementor());}");
}
}
}, false);
}
// release loader
dpInstall.releaseTargetClassLoader();
}
}
use of io.github.lukehutch.fastclasspathscanner.FastClasspathScanner in project Orchid by JavaEden.
the class Orchid method findOptions.
public static List<OrchidOption> findOptions() {
if (Orchid.orchidOptions == null) {
Orchid.orchidOptions = new ArrayList<>();
FastClasspathScanner scanner = new FastClasspathScanner();
scanner.matchSubclassesOf(OrchidOption.class, (matchingClass) -> {
try {
OrchidOption option = matchingClass.newInstance();
if (option != null) {
Orchid.orchidOptions.add(option);
}
} catch (Exception e) {
e.printStackTrace();
}
});
scanner.scan();
}
return Orchid.orchidOptions;
}
use of io.github.lukehutch.fastclasspathscanner.FastClasspathScanner in project Orchid by JavaEden.
the class Orchid method findModules.
public static List<AbstractModule> findModules(Map<String, String[]> options) {
if (Orchid.modules == null) {
Orchid.modules = new ArrayList<>();
FastClasspathScanner scanner = new FastClasspathScanner();
scanner.matchSubclassesOf(OrchidModule.class, (matchingClass) -> {
try {
AbstractModule provider = matchingClass.newInstance();
if (provider != null) {
Orchid.modules.add(provider);
}
} catch (Exception e) {
e.printStackTrace();
}
});
scanner.scan();
}
return Orchid.modules;
}
use of io.github.lukehutch.fastclasspathscanner.FastClasspathScanner in project typescript-generator by vojtechhabarta.
the class InputTest method testScanner.
@Test
public void testScanner() {
final ScanResult scanResult = new FastClasspathScanner().scan();
final List<String> allClassNames = scanResult.getNamesOfAllClasses();
final List<String> testClassNames = Input.filterClassNames(allClassNames, Arrays.asList("cz.habarta.typescript.generator.**Test"));
Assert.assertTrue("Typescript-generator must have at least 20 tests :-)", testClassNames.size() > 20);
}
use of io.github.lukehutch.fastclasspathscanner.FastClasspathScanner in project geode by apache.
the class DeployedJar method findFunctionsInThisJar.
private List<String> findFunctionsInThisJar() throws IOException {
URLClassLoader urlClassLoader = new URLClassLoader(new URL[] { this.getFile().getCanonicalFile().toURL() });
FastClasspathScanner fastClasspathScanner = new FastClasspathScanner().removeTemporaryFilesAfterScan(true).overrideClassLoaders(urlClassLoader);
ScanResult scanResult = fastClasspathScanner.scan();
return scanResult.getNamesOfClassesImplementing(Function.class);
}
Aggregations