本文整理了Java中org.jboss.modules.Module.getCallerModule()
方法的一些代码示例,展示了Module.getCallerModule()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Module.getCallerModule()
方法的具体详情如下:
包路径:org.jboss.modules.Module
类名称:Module
方法名:getCallerModule
[英]Get the caller's module. The caller's module is the module containing the method that calls this method. Note that this method crawls the stack so other ways of obtaining the module are more efficient.
[中]获取调用方的模块。调用方的模块是包含调用此方法的方法的模块。请注意,这种方法会对堆栈进行爬网,因此其他获取模块的方法更有效。
代码示例来源:origin: org.jboss.modules/jboss-modules
/**
* Gets the current module loader. The current module loader is the
* loader of the module from the calling class. Note that this method
* must crawl the stack to determine this, so other mechanisms are more
* efficient.
*
* @return the current module loader, or {@code null} if this method is called outside of a module
*/
public static ModuleLoader getCallerModuleLoader() {
Module callerModule = getCallerModule();
return callerModule == null ? null : callerModule.getModuleLoader();
}
代码示例来源:origin: org.jboss.forge/jboss-modules
/**
* Gets the current module loader. The current module loader is the
* loader of the module from the calling class. Note that this method
* must crawl the stack to determine this, so other mechanisms are more
* efficient.
*
* @return the current module loader, or {@code null} if this method is called outside of a module
*/
public static ModuleLoader getCallerModuleLoader() {
Module callerModule = getCallerModule();
return callerModule == null ? null : callerModule.getModuleLoader();
}
代码示例来源:origin: wildfly/wildfly-core
static ClassLoader resolveClassLoader(String module) throws ModuleLoadException {
Module current = Module.getCallerModule();
if (module != null && current != null) {
ModuleIdentifier mi = ModuleIdentifier.fromString(module);
current = current.getModule(mi);
}
return current != null ? current.getClassLoader() : ClassLoadingAttributeDefinitions.class.getClassLoader();
}
代码示例来源:origin: org.wildfly/wildfly-picketlink
private Module getModule(ModelNode moduleNode) {
Module module;
if (moduleNode.isDefined()) {
ModuleLoader moduleLoader = Module.getBootModuleLoader();
try {
module = moduleLoader.loadModule(ModuleIdentifier.fromString(moduleNode.asString()));
} catch (ModuleLoadException e) {
throw ROOT_LOGGER.moduleCouldNotLoad(moduleNode.asString(), e);
}
} else {
// fallback to caller module.
module = Module.getCallerModule();
}
return module;
}
代码示例来源:origin: org.jboss.eap/wildfly-picketlink
private Module getModule(ModelNode moduleNode) {
Module module;
if (moduleNode.isDefined()) {
ModuleLoader moduleLoader = Module.getBootModuleLoader();
try {
module = moduleLoader.loadModule(ModuleIdentifier.fromString(moduleNode.asString()));
} catch (ModuleLoadException e) {
throw ROOT_LOGGER.moduleCouldNotLoad(moduleNode.asString(), e);
}
} else {
// fallback to caller module.
module = Module.getCallerModule();
}
return module;
}
代码示例来源:origin: org.wildfly.core/wildfly-controller
public void loadAndRegisterTransformers(String name, ModelVersion subsystemVersion, String extensionModuleName) {
try {
SubsystemTransformerRegistration transformerRegistration = new SubsystemTransformerRegistrationImpl(name, subsystemVersion);
if (Module.getCallerModule() != null) { //only register when running in modular environment, testsuite does its own loading
for (ExtensionTransformerRegistration registration : Module.loadServiceFromCallerModuleLoader(ModuleIdentifier.fromString(extensionModuleName), ExtensionTransformerRegistration.class)) {
if (registration.getSubsystemName().equals(name)) { //to prevent registering transformers for different subsystems
registration.registerTransformers(transformerRegistration);
}
}
}
} catch (ModuleLoadException e) {
throw ControllerLogger.ROOT_LOGGER.couldNotLoadModuleForTransformers(extensionModuleName, e);
}
}
代码示例来源:origin: wildfly/wildfly-core
public void loadAndRegisterTransformers(String name, ModelVersion subsystemVersion, String extensionModuleName) {
try {
SubsystemTransformerRegistration transformerRegistration = new SubsystemTransformerRegistrationImpl(name, subsystemVersion);
if (Module.getCallerModule() != null) { //only register when running in modular environment, testsuite does its own loading
for (ExtensionTransformerRegistration registration : Module.loadServiceFromCallerModuleLoader(ModuleIdentifier.fromString(extensionModuleName), ExtensionTransformerRegistration.class)) {
if (registration.getSubsystemName().equals(name)) { //to prevent registering transformers for different subsystems
registration.registerTransformers(transformerRegistration);
}
}
}
} catch (ModuleLoadException e) {
throw ControllerLogger.ROOT_LOGGER.couldNotLoadModuleForTransformers(extensionModuleName, e);
}
}
代码示例来源:origin: org.picketlink/picketlink-as-extension
alternativeModule = Module.getCallerModule();
代码示例来源:origin: wildfly/wildfly-core
if(moduleName != null && !"".equals(moduleName)){
try {
Module cm = Module.getCallerModule();
ModuleIdentifier mi = ModuleIdentifier.create(moduleName);
代码示例来源:origin: wildfly/wildfly-core
private static java.security.Permission createPermission(Permission permission) throws StartException {
Module currentModule = Module.getCallerModule();
if (permission.getModule() != null && currentModule != null) {
ModuleIdentifier mi = ModuleIdentifier.fromString(permission.getModule());
try {
currentModule = currentModule.getModule(mi);
} catch (ModuleLoadException e) {
// If we cannot load it, it can never be checked.
throw ElytronSubsystemMessages.ROOT_LOGGER.invalidPermissionModule(permission.getModule(), e);
}
}
ClassLoader classLoader = currentModule != null ? currentModule.getClassLoader() : PermissionMapperDefinitions.class.getClassLoader();
try {
return PermissionUtil.createPermission(classLoader, permission.getClassName(), permission.getTargetName(), permission.getAction());
} catch (InvalidPermissionClassException e) {
throw ElytronSubsystemMessages.ROOT_LOGGER.invalidPermissionClass(permission.getClassName());
} catch (Throwable e) {
throw ElytronSubsystemMessages.ROOT_LOGGER.exceptionWhileCreatingPermission(permission.getClassName(), e);
}
}
内容来源于网络,如有侵权,请联系作者删除!