本文整理了Java中org.wildfly.security.manager.WildFlySecurityManager.getClassLoaderPrivileged()
方法的一些代码示例,展示了WildFlySecurityManager.getClassLoaderPrivileged()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。WildFlySecurityManager.getClassLoaderPrivileged()
方法的具体详情如下:
包路径:org.wildfly.security.manager.WildFlySecurityManager
类名称:WildFlySecurityManager
方法名:getClassLoaderPrivileged
[英]Get the class loader for a class, doing a faster permission check that skips having to execute a privileged action frame.
[中]获取类的类加载器,执行更快的权限检查,从而跳过必须执行特权操作框架的操作。
代码示例来源:origin: wildfly/wildfly
public WeldResourceInjectionServices(final ServiceRegistry serviceRegistry, final EEModuleDescription moduleDescription, Module module, boolean warModule) {
super(serviceRegistry, moduleDescription, module);
this.warModule = warModule;
try {
this.context = new InitialContext();
} catch (NamingException e) {
throw new RuntimeException(e);
}
final Iterator<ResourceInjectionResolver> resolvers = ServiceLoader.load(ResourceInjectionResolver.class,
WildFlySecurityManager.getClassLoaderPrivileged(WeldResourceInjectionServices.class)).iterator();
if (!resolvers.hasNext()) {
this.resourceResolvers = Collections.emptyList();
} else {
this.resourceResolvers = new ArrayList<>();
while (resolvers.hasNext()) {
this.resourceResolvers.add(resolvers.next());
}
}
}
代码示例来源:origin: wildfly/wildfly
/**
*
* @param serviceClass
* @param loaderClass
* @return
*/
public static <T> Optional<T> loadSingle(Class<T> serviceClass, Class<?> loaderClass) {
Iterator<T> iterator = ServiceLoader.load(serviceClass, WildFlySecurityManager.getClassLoaderPrivileged(loaderClass)).iterator();
T service = null;
while (iterator.hasNext()) {
if (service != null) {
throw new IllegalStateException("Exactly one service provider is required for: " + serviceClass);
}
service = iterator.next();
}
return Optional.ofNullable(service);
}
代码示例来源:origin: wildfly/wildfly
/**
*
* @param clazz
* @param archive
* @return
*/
public static Map<Class<? extends Service>, Service> loadBeanDeploymentArchiveServices(Class<?> clazz, BeanDeploymentArchive archive) {
ServiceLoader<BeanDeploymentArchiveServicesProvider> serviceLoader = ServiceLoader.load(BeanDeploymentArchiveServicesProvider.class,
WildFlySecurityManager.getClassLoaderPrivileged(clazz));
List<Service> services = new ArrayList<>();
for (BeanDeploymentArchiveServicesProvider provider : serviceLoader) {
services.addAll(provider.getServices(archive));
}
Map<Class<? extends Service>, Service> servicesMap = new HashMap<>();
for (Service service : services) {
for (Class<? extends Service> serviceInterface : identifyServiceInterfaces(service.getClass(), new HashSet<>())) {
servicesMap.put(serviceInterface, service);
}
}
return servicesMap;
}
代码示例来源:origin: wildfly/wildfly
@Override
public BeanDeploymentArchive getBeanDeploymentArchive(final Class<?> beanClass) {
ClassLoader moduleClassLoader = WildFlySecurityManager.getClassLoaderPrivileged(beanClass);
if (moduleClassLoader != null) {
for (BeanDeploymentArchiveImpl bda : beanDeploymentArchives) {
// search in all known classes in that archive
if (bda.getKnownClasses().contains(beanClass.getName()) && moduleClassLoader.equals(bda.getClassLoader())) {
return bda;
}
}
}
/*
* We haven't found this class in a bean archive so probably it was added by an extension and the class itself does
* not come from a BDA. Let's try to find an existing BDA that uses the same classloader
* (and thus has the required accessibility to other BDAs)
*/
if (moduleClassLoader != null && additionalBeanDeploymentArchivesByClassloader.containsKey(moduleClassLoader)) {
return additionalBeanDeploymentArchivesByClassloader.get(moduleClassLoader);
}
return null;
}
}
代码示例来源:origin: wildfly/wildfly
/**
* Returns a list with all {@link ValidationProvider} validation providers.
*
* @return a list with all {@link ValidationProvider} validation providers
*/
@Override
public List<ValidationProvider<?>> getValidationProviders() {
// first try the TCCL
List<ValidationProvider<?>> providers = getValidationProviders(WildFlySecurityManager.getCurrentContextClassLoaderPrivileged());
if (providers != null && !providers.isEmpty()) {
return providers;
}
// otherwise use the loader of this class
else {
return getValidationProviders(WildFlySecurityManager.getClassLoaderPrivileged(WildFlyProviderResolver.class));
}
}
代码示例来源:origin: wildfly/wildfly
/**
* Returns a list with all {@link ValidationProvider} validation providers.
*
* @return a list with all {@link ValidationProvider} validation providers
*/
@Override
public List<ValidationProvider<?>> getValidationProviders() {
// first try the TCCL
List<ValidationProvider<?>> providers = loadProviders(WildFlySecurityManager.getCurrentContextClassLoaderPrivileged());
if (providers != null && !providers.isEmpty()) {
return providers;
}
// otherwise use the loader of this class
else {
return loadProviders(WildFlySecurityManager.getClassLoaderPrivileged(WildFlyProviderResolver.class));
}
}
代码示例来源:origin: wildfly/wildfly
try {
parameterValue = getValue(propertyName, parameterClass, propertyValue,
WildFlySecurityManager.getClassLoaderPrivileged(object.getClass()));
} catch (Throwable t) {
throw new InvocationTargetException(t, t.getMessage());
try {
fieldValue = getValue(propertyName, fieldClass, propertyValue,
WildFlySecurityManager.getClassLoaderPrivileged(object.getClass()));
} catch (Throwable t) {
throw new InvocationTargetException(t, t.getMessage());
代码示例来源:origin: wildfly/wildfly
public Components(DeploymentUnit deploymentUnit, Map<ResourceRoot, Index> indexes) {
componentDescriptionProcessors = ServiceLoader.load(ComponentDescriptionProcessor.class,
WildFlySecurityManager.getClassLoaderPrivileged(BeanArchiveProcessor.class));
for (ComponentDescription component : deploymentUnit.getAttachment(org.jboss.as.ee.component.Attachments.EE_MODULE_DESCRIPTION).getComponentDescriptions()) {
ResourceRoot resourceRoot = null;
DotName componentClassName = DotName.createSimple(component.getComponentClassName());
for (Entry<ResourceRoot, Index> entry : indexes.entrySet()) {
final Index index = entry.getValue();
if (index != null) {
if (index.getClassByName(componentClassName) != null) {
resourceRoot = entry.getKey();
break;
}
}
}
if (resourceRoot == null) {
implicitComponentDescriptions.add(component);
}
if (resourceRoot == null || isClassesRoot(resourceRoot)) {
// special handling
resourceRoot = deploymentUnit.getAttachment(Attachments.DEPLOYMENT_ROOT);
}
componentDescriptions.put(resourceRoot, component);
// Process component descriptions
for (ComponentDescriptionProcessor processor : componentDescriptionProcessors) {
processor.processComponentDescription(resourceRoot, component);
}
}
}
代码示例来源:origin: wildfly/wildfly
WildFlySecurityManager.setCurrentContextClassLoaderPrivileged(WildFlySecurityManager.getClassLoaderPrivileged(this.getClass()));
this.orb = ORB.init(new String[0], properties);
代码示例来源:origin: wildfly/wildfly
/**
* Build this context factory.
*
* @return the context factory
*/
public DirContextFactory build() {
assertNotBuilt();
if (providerUrl == null) {
throw log.noProviderUrlSet();
}
if(this.targetModule != null){
if(WildFlySecurityManager.isChecking()){
WildFlySecurityManager.doChecked(new GetModuleClassLoaderAction(this.targetModule));
} else {
this.targetClassLoader = this.targetModule.getClassLoader();
}
} else {
if(WildFlySecurityManager.isChecking()){
WildFlySecurityManager.getClassLoaderPrivileged(this.getClass());
} else {
this.targetClassLoader = this.getClass().getClassLoader();
}
}
built = true;
return new SimpleDirContextFactory();
}
代码示例来源:origin: wildfly/wildfly
WildFlySecurityManager.getClassLoaderPrivileged(ExternalBeanArchiveProcessor.class));
WildFlySecurityManager.getClassLoaderPrivileged(WeldDeploymentProcessor.class));
代码示例来源:origin: wildfly/wildfly
WildFlySecurityManager.getClassLoaderPrivileged(WeldImplicitDeploymentProcessor.class));
代码示例来源:origin: wildfly/wildfly
WildFlySecurityManager.getClassLoaderPrivileged(WeldComponentIntegrationProcessor.class));
final ComponentInterceptorSupport componentInterceptorSupport = ServiceLoaders.loadSingle(ComponentInterceptorSupport.class,
WeldComponentIntegrationProcessor.class).orElse(null);
代码示例来源:origin: wildfly/wildfly
WildFlySecurityManager.getClassLoaderPrivileged(WeldDeploymentProcessor.class));
final ServiceLoader<ModuleServicesProvider> moduleServicesProviders = ServiceLoader.load(ModuleServicesProvider.class,
WildFlySecurityManager.getClassLoaderPrivileged(WeldDeploymentProcessor.class));
WildFlySecurityManager.getClassLoaderPrivileged(WeldDeploymentProcessor.class));
for (BootstrapDependencyInstaller installer : installers) {
ServiceName serviceName = installer.install(serviceTarget, deploymentUnit, jtsEnabled);
代码示例来源:origin: wildfly/wildfly
WildFlySecurityManager.getClassLoaderPrivileged(WeldComponentService.class))) {
if (support.isProcessing(componentDescription)) {
this.injectionTarget = support.processInjectionTarget(injectionTarget, componentDescription, beanManager);
代码示例来源:origin: wildfly/wildfly
config.setClassCloner(new LocalInvocationClassCloner(WildFlySecurityManager.getClassLoaderPrivileged(invocation.getInvokedProxy().getClass())));
final ObjectCloner resultCloner = createCloner(config);
if (async) {
代码示例来源:origin: wildfly/wildfly
WildFlySecurityManager.getClassLoaderPrivileged(WeldSubsystemAdd.class));
for (DeploymentUnitProcessorProvider provider : processorProviders) {
processorTarget.addDeploymentProcessor(WeldExtension.SUBSYSTEM_NAME, provider.getPhase(), provider.getPriority(), provider.getProcessor());
代码示例来源:origin: org.wildfly/wildfly-osgi-service
static ResourceDescriptionResolver getResolver(String keyPrefix) {
return new StandardResourceDescriptionResolver(keyPrefix, RESOURCE_NAME, WildFlySecurityManager.getClassLoaderPrivileged(OSGiResolvers.class), true, true);
}
代码示例来源:origin: org.jboss.eap/wildfly-weld-common
/**
*
* @param serviceClass
* @param loaderClass
* @return
*/
public static <T> Optional<T> loadSingle(Class<T> serviceClass, Class<?> loaderClass) {
Iterator<T> iterator = ServiceLoader.load(serviceClass, WildFlySecurityManager.getClassLoaderPrivileged(loaderClass)).iterator();
T service = null;
while (iterator.hasNext()) {
if (service != null) {
throw new IllegalStateException("Exactly one service provider is required for: " + serviceClass);
}
service = iterator.next();
}
return Optional.ofNullable(service);
}
代码示例来源:origin: wildfly/wildfly-core
private static void addOptions(OperationContext context, ModelNode properties, OptionMap.Builder builder) throws OperationFailedException {
final ClassLoader loader = WildFlySecurityManager.getClassLoaderPrivileged(ConnectorUtils.class);
for (Property property : properties.asPropertyList()) {
final Option option = getAndValidateOption(loader, property.getName());
String value = PropertyResource.VALUE.resolveModelAttribute(context, property.getValue()).asString();
builder.set(option, option.parseValue(value, loader));
}
}
内容来源于网络,如有侵权,请联系作者删除!