static ClassLoader loadModule(String moduleName) throws ConfigXMLParseException { try { return Module.getModuleFromCallerModuleLoader(ModuleIdentifier.fromString(moduleName)).getClassLoader(); } catch (ModuleLoadException e) { throw new ConfigXMLParseException(e); } } }
public List<TldMetaData> getSharedTlds(DeploymentUnit deploymentUnit) { final List<TldMetaData> metadata = new ArrayList<TldMetaData>(); try { ModuleClassLoader jstl = Module.getModuleFromCallerModuleLoader(ModuleIdentifier.create("javax.servlet.jstl.api")).getClassLoader(); for (String tld : JSTL_TAGLIBS) { InputStream is = jstl.getResourceAsStream("META-INF/" + tld); if (is != null) { TldMetaData tldMetaData = parseTLD(is); metadata.add(tldMetaData); } } } catch (ModuleLoadException e) { // Ignore } catch (Exception e) { // Ignore } List<TldMetaData> additionalSharedTlds = deploymentUnit.getAttachment(ATTACHMENT_KEY); if (additionalSharedTlds != null) { metadata.addAll(additionalSharedTlds); } return metadata; }
private Map<String, List<TldMetaData>> getMap() { final Map<String, List<TldMetaData>> jsfTldMap = new HashMap<>(); JSFModuleIdFactory moduleFactory = JSFModuleIdFactory.getInstance(); List<String> jsfSlotNames = moduleFactory.getActiveJSFVersions(); for (String slot : jsfSlotNames) { final List<TldMetaData> jsfTlds = new ArrayList<TldMetaData>(); try { ModuleClassLoader jsf = Module.getModuleFromCallerModuleLoader(moduleFactory.getImplModId(slot)).getClassLoader(); for (String tld : JSF_TAGLIBS) { InputStream is = jsf.getResourceAsStream("META-INF/" + tld); if (is != null) { TldMetaData tldMetaData = parseTLD(is); jsfTlds.add(tldMetaData); } } } catch (ModuleLoadException e) { // Ignore } catch (Exception e) { // Ignore } jsfTldMap.put(slot, jsfTlds); } return jsfTldMap; }
/** * Returns the class loader of the given module or throws a {@code ConfigXMLParseException} if the module can not be loaded. * * @param moduleName the name of the module (can not be {@code null} * @return the class loader of the module * @throws ConfigXMLParseException if the module can not be loaded * */ static ClassLoader getClassLoaderFromModule(@Param XMLStreamReader reader, String moduleName) throws ConfigXMLParseException { final ModuleIdentifier identifier = ModuleIdentifier.fromString(moduleName); try { return Module.getModuleFromCallerModuleLoader(identifier).getClassLoader(); } catch (ModuleLoadException e) { throw xmlLog.xmlNoModuleFound(reader, e, identifier.toString()); } } }
private Module findSubsysModule() { try { return Module.getModuleFromCallerModuleLoader(KEYCLOAK_SUBSYSTEM); } catch (ModuleLoadException e) { throw new IllegalStateException("Can't find Keycloak subsystem.", e); } }
private Module findSubsysModule() { try { return Module.getModuleFromCallerModuleLoader(KEYCLOAK_SUBSYSTEM); } catch (ModuleLoadException e) { throw new IllegalStateException("Can't find Keycloak subsystem.", e); } }
private Module findSubsysModule() { try { return Module.getModuleFromCallerModuleLoader(KEYCLOAK_SUBSYSTEM); } catch (ModuleLoadException e) { throw new IllegalStateException("Can't find Keycloak subsystem.", e); } }
private Module findSubsysModule() { try { return Module.getModuleFromCallerModuleLoader(KEYCLOAK_SUBSYSTEM); } catch (ModuleLoadException e) { throw new IllegalStateException("Can't find Keycloak subsystem.", e); } }
/** * Get a module from the current module loader. Note that this must crawl the * stack to determine this, so other mechanisms are more efficient. * @see #getCallerModuleLoader() * * @param identifier the module identifier * @return the module * @throws ModuleLoadException if the module could not be loaded * @deprecated Use {@link #getModuleFromCallerModuleLoader(String)} instead. */ @Deprecated public static Module getModuleFromCallerModuleLoader(final ModuleIdentifier identifier) throws ModuleLoadException { return getModuleFromCallerModuleLoader(identifier.toString()); }
/** * Load a class from a module in the caller's module loader. * * @see #getCallerModuleLoader() * * @param moduleIdentifier the identifier of the module from which the class * should be loaded * @param className the class name to load * @return the class * @throws ModuleLoadException if the module could not be loaded * @throws ClassNotFoundException if the class could not be loaded */ public static Class<?> loadClassFromCallerModuleLoader(final ModuleIdentifier moduleIdentifier, final String className) throws ModuleLoadException, ClassNotFoundException { return Class.forName(className, true, getModuleFromCallerModuleLoader(moduleIdentifier).getClassLoader()); }
/** * Load a class from a module in the caller's module loader. * * @see #getCallerModuleLoader() * * @param name the name of the module from which the class * should be loaded * @param className the class name to load * @return the class * @throws ModuleLoadException if the module could not be loaded * @throws ClassNotFoundException if the class could not be loaded */ public static Class<?> loadClassFromCallerModuleLoader(final String name, final String className) throws ModuleLoadException, ClassNotFoundException { return Class.forName(className, true, getModuleFromCallerModuleLoader(name).getClassLoader()); }
Module module = Module.getModuleFromCallerModuleLoader(ModuleIdentifier.fromString(moduleName)); ModuleClassLoader mcl = module.getClassLoader(); Field pathsField = ModuleClassLoader.class.getDeclaredField("paths");
static ClassLoader loadModule(String moduleName) throws ConfigXMLParseException { try { return Module.getModuleFromCallerModuleLoader(ModuleIdentifier.fromString(moduleName)).getClassLoader(); } catch (ModuleLoadException e) { throw new ConfigXMLParseException(e); } } }
static ClassLoader loadModule(String moduleName) throws ConfigXMLParseException { try { return Module.getModuleFromCallerModuleLoader(ModuleIdentifier.fromString(moduleName)).getClassLoader(); } catch (ModuleLoadException e) { throw new ConfigXMLParseException(e); } } }
static Xnio getXnio() throws ModuleLoadException { return Xnio.getInstance(null, Module.getModuleFromCallerModuleLoader(ModuleIdentifier.fromString("org.jboss.xnio.nio")).getClassLoader()); } }
/** * Returns the class loader of the given module or throws a {@code ConfigXMLParseException} if the module can not be loaded. * * @param moduleName the name of the module (can not be {@code null} * @return the class loader of the module * @throws ConfigXMLParseException if the module can not be loaded * */ static ClassLoader getClassLoaderFromModule(@Param XMLStreamReader reader, String moduleName) throws ConfigXMLParseException { final ModuleIdentifier identifier = ModuleIdentifier.fromString(moduleName); try { return Module.getModuleFromCallerModuleLoader(identifier).getClassLoader(); } catch (ModuleLoadException e) { throw xmlLog.xmlNoModuleFound(reader, e, identifier.toString()); } } }
/** * Returns the class loader of the given module or throws a {@code ConfigXMLParseException} if the module can not be loaded. * * @param moduleName the name of the module (can not be {@code null} * @return the class loader of the module * @throws ConfigXMLParseException if the module can not be loaded * */ static ClassLoader getClassLoaderFromModule(@Param XMLStreamReader reader, String moduleName) throws ConfigXMLParseException { final ModuleIdentifier identifier = ModuleIdentifier.fromString(moduleName); try { return Module.getModuleFromCallerModuleLoader(identifier).getClassLoader(); } catch (ModuleLoadException e) { throw xmlLog.xmlNoModuleFound(reader, e, identifier.toString()); } } }
/** * Returns the class loader of the given module or throws a {@code ConfigXMLParseException} if the module can not be loaded. * * @param moduleName the name of the module (can not be {@code null} * @return the class loader of the module * @throws ConfigXMLParseException if the module can not be loaded * */ static ClassLoader getClassLoaderFromModule(@Param XMLStreamReader reader, String moduleName) throws ConfigXMLParseException { final ModuleIdentifier identifier = ModuleIdentifier.fromString(moduleName); try { return Module.getModuleFromCallerModuleLoader(identifier).getClassLoader(); } catch (ModuleLoadException e) { throw xmlLog.xmlNoModuleFound(reader, e, identifier.toString()); } } }