use of io.hawt.util.introspect.ClassLoaderProvider in project fabric8 by jboss-fuse.
the class ProfileDynamicJaxbCompiler method recompile.
protected void recompile() {
LOG.debug("Looking for XSDs to recompile");
Set<String> urls = new TreeSet<String>();
FabricService fabric = getFabricService();
Container container = fabric.getCurrentContainer();
String versionId = container.getVersion().getId();
List<String> profileIds = Containers.overlayProfiles(container);
Collection<String> names = listFiles(versionId, profileIds, schemaPath);
for (String name : names) {
if (name.endsWith(".xsd")) {
String prefix = schemaPath;
if (Strings.isNotBlank(prefix)) {
prefix += "/";
}
urls.add("profile:" + prefix + name);
}
}
LOG.info("Recompiling XSDs at URLs: " + urls);
startedFlag.set(false);
ClassLoader classLoader = AriesFrameworkUtil.getClassLoader(bundleContext.getBundle());
if (classLoader == null) {
classLoader = getClass().getClassLoader();
}
DynamicXJC xjc = new DynamicXJC(classLoader);
xjc.setSchemaUrls(new ArrayList<String>(urls));
compileResults = xjc.compileSchemas();
if (handler != null) {
handler.onCompileResults(compileResults);
}
if (introspector != null) {
introspector.setClassLoaderProvider("dynamic.jaxb", new ClassLoaderProvider() {
@Override
public ClassLoader getClassLoader() {
return compileResults.getClassLoader();
}
});
}
}
Aggregations