@Override public void postActivate(ModuleMetaModel applications) { // Load the tag handlers for (TagHandler handler : applications.getProcessingContext().loadServices(TagHandler.class)) { applications.getProcessingContext().info("Loaded tag handler " + handler.getClass().getName() + " as " + handler.getName()); tags.put(handler.getName(), handler); } // Load the template providers Iterable<TemplateProvider> loader = applications.processingContext.loadServices(TemplateProvider.class); Map<String, TemplateProvider> providers = new HashMap<String, TemplateProvider>(); for (TemplateProvider provider : loader) { providers.put(provider.getSourceExtension(), provider); } // this.providers = providers; }
@Override public void postActivate(ModuleMetaModel applications) { // Load the tag handlers for (TagHandler handler : applications.getProcessingContext().loadServices(TagHandler.class)) { applications.getProcessingContext().info("Loaded tag handler " + handler.getClass().getName() + " as " + handler.getName()); tags.put(handler.getName(), handler); } // Load the template providers Iterable<TemplateProvider> loader = applications.processingContext.loadServices(TemplateProvider.class); Map<String, TemplateProvider> providers = new HashMap<String, TemplateProvider>(); for (TemplateProvider provider : loader) { providers.put(provider.getSourceExtension(), provider); } // this.providers = providers; }
public void init(ProcessingContext env) throws NullPointerException { this.processingContext = env; // HashMap<P, HashSet<Name>> supportedAnnotationsMap = new HashMap<P, HashSet<Name>>(); LinkedHashMap<String, P> pluginMap = new LinkedHashMap<String, P>(); StringBuilder msg = new StringBuilder("Using plugins:"); for (P plugin : env.loadServices(pluginType)) { msg.append(" ").append(plugin.getName()); pluginMap.put(plugin.getName(), plugin); } env.info(msg); // Collect processed annotations HashSet<Class<? extends java.lang.annotation.Annotation>> supportedAnnotations = new HashSet<Class<? extends java.lang.annotation.Annotation>>(); for (P plugin : pluginMap.values()) { HashSet<Name> pluginSupportedAnnotations = new HashSet<Name>(); for (Class<? extends Annotation> annotationType : plugin.init(env)) { pluginSupportedAnnotations.add(Name.create(annotationType)); supportedAnnotations.add(annotationType); } env.info("Plugin " + plugin.getName() + " supports " + pluginSupportedAnnotations); supportedAnnotationsMap.put(plugin, pluginSupportedAnnotations); } // this.pluginMap = pluginMap; this.supportedAnnotationsMap = supportedAnnotationsMap; this.supportedAnnotations = supportedAnnotations; }
public void init(ProcessingContext env) throws NullPointerException { this.processingContext = env; // HashMap<P, HashSet<Name>> supportedAnnotationsMap = new HashMap<P, HashSet<Name>>(); LinkedHashMap<String, P> pluginMap = new LinkedHashMap<String, P>(); StringBuilder msg = new StringBuilder("Using plugins:"); for (P plugin : env.loadServices(pluginType)) { msg.append(" ").append(plugin.getName()); pluginMap.put(plugin.getName(), plugin); } env.info(msg); // Collect processed annotations HashSet<Class<? extends java.lang.annotation.Annotation>> supportedAnnotations = new HashSet<Class<? extends java.lang.annotation.Annotation>>(); for (P plugin : pluginMap.values()) { HashSet<Name> pluginSupportedAnnotations = new HashSet<Name>(); for (Class<? extends Annotation> annotationType : plugin.init(env)) { pluginSupportedAnnotations.add(Name.create(annotationType)); supportedAnnotations.add(annotationType); } env.info("Plugin " + plugin.getName() + " supports " + pluginSupportedAnnotations); supportedAnnotationsMap.put(plugin, pluginSupportedAnnotations); } // this.pluginMap = pluginMap; this.supportedAnnotationsMap = supportedAnnotationsMap; this.supportedAnnotations = supportedAnnotations; }