use of org.teiid.translator.Translator in project wildfly-swarm by wildfly-swarm.
the class TranslatorCustomizer method loadTranslators.
@SuppressWarnings("rawtypes")
private void loadTranslators(String moduleName) {
ClassLoader translatorLoader = this.getClass().getClassLoader();
try {
final Module module = Module.getBootModuleLoader().loadModule(moduleName);
if (module != null) {
translatorLoader = module.getClassLoader();
final ServiceLoader<ExecutionFactory> serviceLoader = ServiceLoader.load(ExecutionFactory.class, translatorLoader);
if (serviceLoader != null) {
for (ExecutionFactory ef : serviceLoader) {
Translator t = ef.getClass().getAnnotation(Translator.class);
fraction.translator(t.name(), x -> x.module(moduleName));
}
}
}
} catch (ModuleLoadException e) {
// no-op
}
}
Aggregations