public ModuleSpec getModuleSpec() throws ModuleLoadException { if (startException != null) throw new ModuleLoadException(startException.getCause()); return moduleSpec; } }
/** * Convert to an unchecked error type. * * @return the unchecked error */ public ModuleLoadError toError() { final ModuleLoadError error = new ModuleLoadError(getMessage(), getCause()); error.setStackTrace(getStackTrace()); return error; } }
public void relink(final String name) { final SecurityManager sm = System.getSecurityManager(); if (sm != null) { sm.checkPermission(MODULE_REDEFINE_ANY_PERM); } final ModuleLoader loader = getModuleLoader(); final Module module = loadModule(name, loader); try { loader.relink(module); } catch (ModuleLoadException e) { throw new IllegalStateException("Module load failure for module " + name + ": " + e.toString()); } }
/** * Convert to an unchecked error type. * * @return the unchecked error */ public ModuleLoadError toError() { return new ModuleLoadError(getMessage(), getCause()); } }
private List<PlugInProvider> loadPlugInProvider(final String name) { synchronized (cachedProviders) { List<PlugInProvider> response; if (cachedProviders.containsKey(name)) { response = cachedProviders.get(name); } else { List<PlugInProvider> providers = new LinkedList<PlugInProvider>(); try { for (PlugInProvider current : Module.loadServiceFromCallerModuleLoader(ModuleIdentifier.fromString(name), PlugInProvider.class)) { providers.add(current); } } catch (ModuleLoadException e) { throw DomainManagementLogger.ROOT_LOGGER.unableToLoadPlugInProviders(name, e.getMessage()); } if (providers.size() > 0) { cachedProviders.put(name, providers); response = providers; } else { throw DomainManagementLogger.ROOT_LOGGER.noPlugInProvidersLoaded(name); } } return response; } }
Map<String, List<LocalLoader>> getPathsUnchecked() { try { return getPaths(); } catch (ModuleLoadException e) { throw e.toError(); } }
private List<PlugInProvider> loadPlugInProvider(final String name) { synchronized (cachedProviders) { List<PlugInProvider> response; if (cachedProviders.containsKey(name)) { response = cachedProviders.get(name); } else { List<PlugInProvider> providers = new LinkedList<PlugInProvider>(); try { for (PlugInProvider current : Module.loadServiceFromCallerModuleLoader(ModuleIdentifier.fromString(name), PlugInProvider.class)) { providers.add(current); } } catch (ModuleLoadException e) { throw DomainManagementLogger.ROOT_LOGGER.unableToLoadPlugInProviders(name, e.getMessage()); } if (providers.size() > 0) { cachedProviders.put(name, providers); response = providers; } else { throw DomainManagementLogger.ROOT_LOGGER.noPlugInProvidersLoaded(name); } } return response; } }
Map<String, List<LocalLoader>> getPathsUnchecked() { try { return getPaths(); } catch (ModuleLoadException e) { throw e.toError(); } }
public ModuleSpec getModuleSpec() throws ModuleLoadException { if (startException != null) throw new ModuleLoadException(startException.getCause()); return moduleSpec; } }
private Module loadModule(String moduleSpec) { // If the module was not already loaded, load it try { Module module = loadedModules.get(moduleSpec); if (module == null) { ModuleLoader loader = ModuleLoader.forClass(this.getClass()); if (loader == null) { throw new ConfigurationException(String.format("The module '%1$s' cannot be loaded as the module system isn't enabled.", moduleSpec)); } module = loader.loadModule(ModuleIdentifier.fromString(moduleSpec)); loadedModules.put(moduleSpec, module); } return module; } catch (ModuleLoadException exception) { throw new ConfigurationException(String.format("The module '%1$s' cannot be loaded: %2$s", moduleSpec, exception.getMessage()), exception); } }
public void relink(final String name) { final SecurityManager sm = System.getSecurityManager(); if (sm != null) { sm.checkPermission(MODULE_REDEFINE_ANY_PERM); } final ModuleLoader loader = getModuleLoader(); final Module module = loadModule(name, loader); try { loader.relink(module); } catch (ModuleLoadException e) { throw new IllegalStateException("Module load failure for module " + name + ": " + e.toString()); } }
public ModuleSpec getModuleSpec() throws ModuleLoadException { if (startException != null) throw new ModuleLoadException(startException.getCause()); return moduleSpec; } }
void initializeExtension(String module) throws OperationFailedException { try { boolean unknownModule = false; for (Extension extension : Module.loadServiceFromCallerModuleLoader(ModuleIdentifier.fromString(module), Extension.class)) { ClassLoader oldTccl = SecurityActions.setThreadContextClassLoader(extension.getClass()); try { if (unknownModule || !extensionRegistry.getExtensionModuleNames().contains(module)) { // This extension wasn't handled by the standalone.xml or domain.xml parsing logic, so we // need to initialize its parsers so we can display what XML namespaces it supports extension.initializeParsers(extensionRegistry.getExtensionParsingContext(module, null)); // AS7-6190 - ensure we initialize parsers for other extensions from this module // now that we know the registry was unaware of the module unknownModule = true; } extension.initialize(extensionRegistry.getExtensionContext(module, !standalone && !slaveHC)); } finally { SecurityActions.setThreadContextClassLoader(oldTccl); } } } catch (ModuleLoadException e) { throw new OperationFailedException(new ModelNode().set(e.toString())); } }
public ModuleSpec getModuleSpec() throws ModuleLoadException { if (startException != null) throw new ModuleLoadException(startException.getCause()); return moduleSpec; } }
/** * Convert to a checked exception type. * * @return the checked exception */ public ModuleLoadException toException() { return new ModuleLoadException(getMessage(), getCause()); } }
/** * Convert to a checked exception type. * * @return the checked exception */ public ModuleLoadException toException() { return new ModuleLoadException(getMessage(), getCause()); } }
/** * Parse a {@code module.xml} file. * * @param factory the resource root factory to use (must not be {@code null}) * @param moduleLoader the module loader to use for dependency specifications * @param moduleName the name of the module to load * @param root the module path root * @param moduleInfoFile the {@code File} of the {@code module.xml} content * @return a module specification * @throws ModuleLoadException if a dependency could not be established or another error occurs * @throws IOException if I/O fails */ public static ModuleSpec parseModuleXml(final ResourceRootFactory factory, final ModuleLoader moduleLoader, final String moduleName, final File root, final File moduleInfoFile) throws ModuleLoadException, IOException { final FileInputStream fis; try { fis = new FileInputStream(moduleInfoFile); } catch (FileNotFoundException e) { throw new ModuleLoadException("No module.xml file found at " + moduleInfoFile); } try { return parseModuleXml(factory, root.getPath(), new BufferedInputStream(fis), moduleInfoFile.getPath(), moduleLoader, moduleName); } finally { safeClose(fis); } }
throw new ModuleLoadException(e); } catch (Throwable t) { t.printStackTrace(); in.close(); } catch (IOException e) { throw new ModuleLoadException(e);
static ModuleSpec parseModuleXml(final ModuleLoader moduleLoader, final ModuleIdentifier moduleIdentifier, final File root, final File moduleInfoFile, final AccessControlContext context) throws ModuleLoadException, IOException { final FileInputStream fis; try { fis = new FileInputStream(moduleInfoFile); } catch (FileNotFoundException e) { throw new ModuleLoadException("No module.xml file found at " + moduleInfoFile); } try { return parseModuleXml(new ResourceRootFactory() { public ResourceLoader createResourceLoader(final String rootPath, final String loaderPath, final String loaderName) throws IOException { File file = new File(rootPath, loaderPath); if (file.isDirectory()) { return new FileResourceLoader(loaderName, file, context); } else { final JarFile jarFile = new JarFile(file, true); return new JarFileResourceLoader(loaderName, jarFile); } } }, root.getPath(), new BufferedInputStream(fis), moduleInfoFile.getPath(), moduleLoader, moduleIdentifier); } finally { StreamUtil.safeClose(fis); } }
throw new ModuleLoadException(e); } finally { try { in.close(); } catch (IOException e) { throw new ModuleLoadException(e);