/** * @param type the type of skin extension * @param resource the resource to register * @param parameters the parameters */ public void use(String type, String resource, Map<String, Object> parameters) { this.asyncContext.use(USER_TYPE, new SkinExtensionInfo(type, resource, parameters)); } }
private void use(Object value) { SkinExtensionInfo info = (SkinExtensionInfo) value; // Find the right skin extension SkinExtension skinExtension; try { skinExtension = this.componentManager.getInstance(SkinExtension.class, info.getType()); } catch (ComponentLookupException e) { this.logger.error("Failed to load the skin extension with type [{}]", info.getType(), e); return; } // Inject the skin extension if (info.getParameters() != null) { skinExtension.use(info.getResource(), info.getParameters()); } else { skinExtension.use(info.getResource()); } }
@Override public void addHTMLHead(StringBuilder meta, Collection<Object> values) { // TODO: A bit hacky right now, the skinx module should be refactored to be fully based on components XWikiContext xcontext = this.xcontextProvider.get(); List<XWikiPluginInterface> plugins = xcontext.getWiki().getPluginManager().getPlugins("endParsing"); for (Object value : values) { SkinExtensionInfo info = (SkinExtensionInfo) value; AbstractSkinExtensionPlugin skinPlugin = getPlugin(info.getType(), plugins); if (skinPlugin != null) { meta.append(skinPlugin.getLink(info.getResource(), xcontext)); } else { this.logger.warn("Cannot find skin extension plugin for resource type [{}]", info.getType()); } } }