public static String getTranslatorName(ExecutionFactory factory) { org.teiid.translator.Translator translator = factory.getClass().getAnnotation(org.teiid.translator.Translator.class); if (translator == null) { return null; } return translator.name(); }
@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 } } }
@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 } } }
Translator annotation = ef.getClass().getAnnotation(Translator.class); if (annotation != null) { this.translatorType = annotation.name();
Translator annotation = ef.getClass().getAnnotation(Translator.class); if (annotation != null) { this.translatorType = annotation.name();
metadata.addProperty("deprecated", see); //$NON-NLS-1$ metadata.setName(translator.name()); metadata.setDescription(translator.description()); metadata.setExecutionFactoryClass(factory.getClass());