Search in sources :

Example 1 with Translator

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
    }
}
Also used : ModuleLoadException(org.jboss.modules.ModuleLoadException) Translator(org.teiid.translator.Translator) ExecutionFactory(org.teiid.translator.ExecutionFactory) Module(org.jboss.modules.Module)

Aggregations

Module (org.jboss.modules.Module)1 ModuleLoadException (org.jboss.modules.ModuleLoadException)1 ExecutionFactory (org.teiid.translator.ExecutionFactory)1 Translator (org.teiid.translator.Translator)1