本文整理了Java中org.jboss.modules.Module.getClassLoaderPrivate()
方法的一些代码示例,展示了Module.getClassLoaderPrivate()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Module.getClassLoaderPrivate()
方法的具体详情如下:
包路径:org.jboss.modules.Module
类名称:Module
方法名:getClassLoaderPrivate
暂无
代码示例来源:origin: org.jboss.modules/jboss-modules
public ModuleClassLoader getClassLoaderOf(final Module module) {
return module.getClassLoaderPrivate();
}
};
代码示例来源:origin: org.jboss.modules/jboss-modules
/**
* Define a class.
*
* @param module the module to define the class to (must not be {@code null})
* @param className the new class name (must not be {@code null})
* @param protectionDomain the protection domain of the new class (must not be {@code null})
* @param classBytes the new class bytes (must not be {@code null})
* @return the defined class (not {@code null})
*/
public Class<?> defineClass(Module module, String className, ProtectionDomain protectionDomain, ByteBuffer classBytes) {
return module.getClassLoaderPrivate().defineClassInternal(className, classBytes, protectionDomain);
}
代码示例来源:origin: org.jboss.forge/jboss-modules
Dependency getDependency(final Module module) {
return new ModuleClassLoaderDependency(exportFilter, importFilter, resourceExportFilter, resourceImportFilter, classExportFilter, classImportFilter, module.getClassLoaderPrivate());
}
代码示例来源:origin: org.jboss.modules/jboss-modules
/**
* Define a class.
*
* @param module the module to define the class to (must not be {@code null})
* @param className the new class name (must not be {@code null})
* @param protectionDomain the protection domain of the new class (must not be {@code null})
* @param classBytes the new class bytes (must not be {@code null})
* @param off the offset into the {@code classBytes} array
* @param len the number of bytes to use from the {@code classBytes} array
* @return the defined class (not {@code null})
*/
public Class<?> defineClass(Module module, String className, ProtectionDomain protectionDomain, byte[] classBytes, int off, int len) {
return module.getClassLoaderPrivate().defineClassInternal(className, classBytes, off, len, protectionDomain);
}
代码示例来源:origin: org.jboss.forge/jboss-modules
Dependency getDependency(final Module module) {
return new ModuleClassLoaderDependency(exportFilter, importFilter, module.getClassLoaderPrivate());
}
代码示例来源:origin: org.jboss.forge/jboss-modules
private List<ResourceLoaderInfo> doGetResourceLoaders(final Module module) {
final ModuleClassLoader classLoader = module.getClassLoaderPrivate();
final ResourceLoader[] loaders = classLoader.getResourceLoaders();
final ArrayList<ResourceLoaderInfo> list = new ArrayList<ResourceLoaderInfo>(loaders.length);
for (ResourceLoader resourceLoader : loaders) {
list.add(new ResourceLoaderInfo(resourceLoader.getClass().getName(), new ArrayList<String>(resourceLoader.getPaths())));
}
return list;
}
代码示例来源:origin: org.jboss.modules/jboss-modules
private List<ResourceLoaderInfo> doGetResourceLoaders(final Module module) {
final ModuleClassLoader classLoader = module.getClassLoaderPrivate();
final ResourceLoader[] loaders = classLoader.getResourceLoaders();
final ArrayList<ResourceLoaderInfo> list = new ArrayList<ResourceLoaderInfo>(loaders.length);
for (ResourceLoader resourceLoader : loaders) {
list.add(new ResourceLoaderInfo(resourceLoader.getClass().getName(), String.valueOf(resourceLoader.getLocation()), new ArrayList<>(resourceLoader.getPaths())));
}
return list;
}
代码示例来源:origin: org.jboss.modules/jboss-modules
/**
* Define a class using the module of an existing class.
*
* @param originalClass the existing class (must not be {@code null})
* @param className the new class name (must not be {@code null})
* @param protectionDomain the protection domain of the new class (must not be {@code null})
* @param classBytes the new class bytes (must not be {@code null})
* @return the defined class (not {@code null})
*/
public Class<?> defineClass(Class<?> originalClass, String className, ProtectionDomain protectionDomain, ByteBuffer classBytes) {
final Module module = Module.forClass(originalClass);
if (module == null) throw new IllegalArgumentException("Original " + originalClass + " does not have a module");
return module.getClassLoaderPrivate().defineClassInternal(className, classBytes, protectionDomain);
}
代码示例来源:origin: org.jboss.modules/jboss-modules
/**
* Replaces the resources loaders for the specified module and refreshes the
* internal path list that is derived from the loaders. This is an advanced
* method that should be used carefully, since it alters a live module.
* Modules that import resources from the specified module will not
* automatically be updated to reflect the change. For this to occur
* {@link #relink(Module)} must be called on all of them.
*
* @param module the module to update and refresh
* @param loaders the new collection of loaders the module should use
* @throws SecurityException if the module was not defined by this module loader, or if the module loader does not
* have the required permissions associated with it
*/
protected void setAndRefreshResourceLoaders(Module module, Collection<ResourceLoaderSpec> loaders) {
if (! canRedefine) {
throw new SecurityException("Module redefinition requires canRedefineModule permission");
}
if (module.getModuleLoader() != this) {
throw new SecurityException("Module is not defined by this module loader");
}
module.getClassLoaderPrivate().setResourceLoaders(loaders.toArray(new ResourceLoaderSpec[loaders.size()]));
}
代码示例来源:origin: org.jboss.modules/jboss-modules
/**
* Define a class using the module of an existing class.
*
* @param originalClass the existing class (must not be {@code null})
* @param className the new class name (must not be {@code null})
* @param protectionDomain the protection domain of the new class (must not be {@code null})
* @param classBytes the new class bytes (must not be {@code null})
* @param off the offset into the {@code classBytes} array
* @param len the number of bytes to use from the {@code classBytes} array
* @return the defined class (not {@code null})
*/
public Class<?> defineClass(Class<?> originalClass, String className, ProtectionDomain protectionDomain, byte[] classBytes, int off, int len) {
final Module module = Module.forClass(originalClass);
if (module == null) throw new IllegalArgumentException("Original " + originalClass + " does not have a module");
return module.getClassLoaderPrivate().defineClassInternal(className, classBytes, off, len, protectionDomain);
}
代码示例来源:origin: org.jboss.modules/jboss-modules
/**
* Refreshes the paths provided by resource loaders associated with the
* specified Module. This is an advanced method that is intended to be
* called on modules that have a resource loader implementation that has
* changed and is returning different paths.
*
* @param module the module to refresh
* @throws SecurityException if the module was not defined by this module loader, or if the module loader does not
* have the required permissions associated with it
*/
protected void refreshResourceLoaders(Module module) {
if (! canRedefine) {
throw new SecurityException("Module redefinition requires canRedefineModule permission");
}
if (module.getModuleLoader() != this) {
throw new SecurityException("Module is not defined by this module loader");
}
module.getClassLoaderPrivate().recalculate();
}
代码示例来源:origin: org.jboss.forge/jboss-modules
/**
* Replaces the resources loaders for the specified module and refreshes the
* internal path list that is derived from the loaders. This is an advanced
* method that should be used carefully, since it alters a live module.
* Modules that import resources from the specified module will not
* automatically be updated to reflect the change. For this to occur
* {@link #relink(Module)} must be called on all of them.
*
* @param module the module to update and refresh
* @param loaders the new collection of loaders the module should use
* @throws SecurityException if the module was not defined by this module loader, or if the module loader does not
* have the required permissions associated with it
*/
protected void setAndRefreshResourceLoaders(Module module, Collection<ResourceLoaderSpec> loaders) {
if (! canRedefine) {
throw new SecurityException("Module redefinition requires canRedefineModule permission");
}
if (module.getModuleLoader() != this) {
throw new SecurityException("Module is not defined by this module loader");
}
module.getClassLoaderPrivate().setResourceLoaders(loaders.toArray(new ResourceLoaderSpec[loaders.size()]));
}
代码示例来源:origin: org.jboss.forge/jboss-modules
/**
* Refreshes the paths provided by resource loaders associated with the
* specified Module. This is an advanced method that is intended to be
* called on modules that have a resource loader implementation that has
* changed and is returning different paths.
*
* @param module the module to refresh
* @throws SecurityException if the module was not defined by this module loader, or if the module loader does not
* have the required permissions associated with it
*/
protected void refreshResourceLoaders(Module module) {
if (! canRedefine) {
throw new SecurityException("Module redefinition requires canRedefineModule permission");
}
if (module.getModuleLoader() != this) {
throw new SecurityException("Module is not defined by this module loader");
}
module.getClassLoaderPrivate().recalculate();
}
代码示例来源:origin: org.jboss.forge/jboss-modules
return;
final Iterator<SecurityManager> iterator = ServiceLoader.load(SecurityManager.class, loadedModule.getClassLoaderPrivate()).iterator();
if (iterator.hasNext()) {
System.setSecurityManager(iterator.next());
final ModuleClassLoader bootClassLoader = module.getClassLoaderPrivate();
setContextClassLoader(bootClassLoader);
代码示例来源:origin: org.jboss.modules/jboss-modules
return;
final Iterator<SecurityManager> iterator = ServiceLoader.load(SecurityManager.class, loadedModule.getClassLoaderPrivate()).iterator();
if (iterator.hasNext()) {
System.setSecurityManager(iterator.next());
final ModuleClassLoader bootClassLoader = module.getClassLoaderPrivate();
setContextClassLoader(bootClassLoader);
final Class<? extends Provider> providerClass;
try {
providerClass = Class.forName(provClazz, false, environmentLoader.loadModule(provModule).getClassLoaderPrivate()).asSubclass(Provider.class);
final ModuleClassLoader classLoader = environmentLoader.loadModule(addedProvider).getClassLoaderPrivate();
final ServiceLoader<Provider> providerServiceLoader = ServiceLoader.load(Provider.class, classLoader);
final Iterator<Provider> iterator = providerServiceLoader.iterator();
代码示例来源:origin: org.jboss.modules/jboss-modules
public ModuleInfo getModuleDescription(final String name) {
ModuleLoader loader = getModuleLoader();
final Module module = loadModule(name, loader);
final List<DependencyInfo> dependencies = doGetDependencies(module);
final List<ResourceLoaderInfo> resourceLoaders = doGetResourceLoaders(module);
final LocalLoader fallbackLoader = module.getFallbackLoader();
final String fallbackLoaderString = fallbackLoader == null ? null : fallbackLoader.toString();
return new ModuleInfo(module.getIdentifier().toString(), module.getModuleLoader().mxBean, dependencies, resourceLoaders, module.getMainClass(), module.getClassLoaderPrivate().toString(), fallbackLoaderString);
}
代码示例来源:origin: org.jboss.modules/jboss-modules
Dependency getDependency(final Module module) {
return new ModuleClassLoaderDependency(getExportFilter(), getImportFilter(), getResourceExportFilter(), getResourceImportFilter(), getClassExportFilter(), getClassImportFilter(), module.getClassLoaderPrivate());
}
代码示例来源:origin: org.jboss.forge/jboss-modules
public ModuleInfo getModuleDescription(final String name) {
ModuleLoader loader = getModuleLoader();
final Module module = loadModule(name, loader);
final List<DependencyInfo> dependencies = doGetDependencies(module);
final List<ResourceLoaderInfo> resourceLoaders = doGetResourceLoaders(module);
final LocalLoader fallbackLoader = module.getFallbackLoader();
final String fallbackLoaderString = fallbackLoader == null ? null : fallbackLoader.toString();
return new ModuleInfo(module.getIdentifier().toString(), module.getModuleLoader().mxBean, dependencies, resourceLoaders, module.getMainClass(), module.getClassLoaderPrivate().toString(), fallbackLoaderString);
}
代码示例来源:origin: org.jboss.forge/jboss-modules
public Module run() throws Exception {
final ModuleLogger log = Module.log;
final ModuleIdentifier moduleIdentifier = moduleSpec.getModuleIdentifier();
final Module module = new Module(moduleSpec, ModuleLoader.this);
module.getClassLoaderPrivate().recalculate();
module.setDependencies(moduleSpec.getDependenciesInternal());
log.moduleDefined(moduleIdentifier, ModuleLoader.this);
try {
futureModule.setModule(module);
return module;
} catch (RuntimeException e) {
log.trace(e, "Failed to load module %s", moduleIdentifier);
throw e;
} catch (Error e) {
log.trace(e, "Failed to load module %s", moduleIdentifier);
throw e;
}
}
});
代码示例来源:origin: org.jboss.modules/jboss-modules
public Module run() throws Exception {
final ModuleLogger log = Module.log;
final String name = moduleSpec.getName();
final Module module = new Module(moduleSpec, ModuleLoader.this);
module.getClassLoaderPrivate().recalculate();
module.setDependencies(moduleSpec.getDependenciesInternal());
log.moduleDefined(name, ModuleLoader.this);
try {
futureModule.setModule(module);
return module;
} catch (RuntimeException e) {
log.trace(e, "Failed to load module %s", name);
throw e;
} catch (Error e) {
log.trace(e, "Failed to load module %s", name);
throw e;
}
}
});
内容来源于网络,如有侵权,请联系作者删除!