当前位置: 首页>>代码示例>>Java>>正文


Java AnnotationBasedPluginContextConfigurer类代码示例

本文整理汇总了Java中io.gravitee.plugin.core.internal.AnnotationBasedPluginContextConfigurer的典型用法代码示例。如果您正苦于以下问题:Java AnnotationBasedPluginContextConfigurer类的具体用法?Java AnnotationBasedPluginContextConfigurer怎么用?Java AnnotationBasedPluginContextConfigurer使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


AnnotationBasedPluginContextConfigurer类属于io.gravitee.plugin.core.internal包,在下文中一共展示了AnnotationBasedPluginContextConfigurer类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: create0

import io.gravitee.plugin.core.internal.AnnotationBasedPluginContextConfigurer; //导入依赖的package包/类
private <T> T create0(Plugin plugin, Class<T> certificateClass, CertificateConfiguration certificateConfiguration) {
    if (certificateClass == null) {
        return null;
    }

    try {
        T certificateObj = createInstance(certificateClass);
        final Import annImport = certificateClass.getAnnotation(Import.class);
        Set<Class<?>> configurations = (annImport != null) ?
                new HashSet<>(Arrays.asList(annImport.value())) : Collections.emptySet();

        ApplicationContext idpApplicationContext = pluginContextFactory.create(new AnnotationBasedPluginContextConfigurer(plugin) {
            @Override
            public Set<Class<?>> configurations() {
                return configurations;
            }

            @Override
            public ConfigurableApplicationContext applicationContext() {
                ConfigurableApplicationContext configurableApplicationContext = super.applicationContext();

                // Add certificate configuration bean
                configurableApplicationContext.addBeanFactoryPostProcessor(
                        new CertificateConfigurationBeanFactoryPostProcessor(certificateConfiguration));

                return configurableApplicationContext;
            }
        });

        idpApplicationContext.getAutowireCapableBeanFactory().autowireBean(certificateObj);

        if (certificateObj instanceof InitializingBean) {
            ((InitializingBean) certificateObj).afterPropertiesSet();
        }

        return certificateObj;
    } catch (Exception ex) {
        logger.error("An unexpected error occurs while loading certificate", ex);
        return null;
    }
}
 
开发者ID:gravitee-io,项目名称:graviteeio-access-management,代码行数:42,代码来源:CertificatePluginManagerImpl.java

示例2: create0

import io.gravitee.plugin.core.internal.AnnotationBasedPluginContextConfigurer; //导入依赖的package包/类
private <T> T create0(Plugin plugin, Class<T> extensionGrantClass, ExtensionGrantConfiguration extensionGrantConfiguration, AuthenticationProvider authenticationProvider) {
    if (extensionGrantClass == null) {
        return null;
    }

    try {
        T extensionGrantObj = createInstance(extensionGrantClass);
        final Import annImport = extensionGrantClass.getAnnotation(Import.class);
        Set<Class<?>> configurations = (annImport != null) ?
                new HashSet<>(Arrays.asList(annImport.value())) : Collections.emptySet();

        ApplicationContext extensionGrantApplicationContext = pluginContextFactory.create(new AnnotationBasedPluginContextConfigurer(plugin) {
            @Override
            public Set<Class<?>> configurations() {
                return configurations;
            }

            @Override
            public ConfigurableApplicationContext applicationContext() {
                ConfigurableApplicationContext configurableApplicationContext = super.applicationContext();

                // Add extension grant configuration bean
                configurableApplicationContext.addBeanFactoryPostProcessor(
                        new ExtensionGrantConfigurationBeanFactoryPostProcessor(extensionGrantConfiguration));

                // Add extension grant identity provider bean
                configurableApplicationContext.addBeanFactoryPostProcessor(
                        new ExtensionGrantIdentityProviderFactoryPostProcessor(authenticationProvider != null ? authenticationProvider : new NoAuthenticationProvider()));

                return configurableApplicationContext;
            }
        });

        extensionGrantApplicationContext.getAutowireCapableBeanFactory().autowireBean(extensionGrantObj);

        if (extensionGrantObj instanceof InitializingBean) {
            ((InitializingBean) extensionGrantObj).afterPropertiesSet();
        }

        return extensionGrantObj;
    } catch (Exception ex) {
        logger.error("An unexpected error occurs while loading extension grant", ex);
        return null;
    }
}
 
开发者ID:gravitee-io,项目名称:graviteeio-access-management,代码行数:46,代码来源:ExtensionGrantPluginManagerImpl.java

示例3: create0

import io.gravitee.plugin.core.internal.AnnotationBasedPluginContextConfigurer; //导入依赖的package包/类
private <T> T create0(Plugin plugin, Class<T> identityClass, IdentityProviderConfiguration identityProviderConfiguration,
                      IdentityProviderMapper identityProviderMapper, IdentityProviderRoleMapper identityProviderRoleMapper) {
    if (identityClass == null) {
        return null;
    }

    try {
        T identityObj = createInstance(identityClass);
        final Import annImport = identityClass.getAnnotation(Import.class);
        Set<Class<?>> configurations = (annImport != null) ?
                new HashSet<>(Arrays.asList(annImport.value())) : Collections.emptySet();

        ApplicationContext idpApplicationContext = pluginContextFactory.create(new AnnotationBasedPluginContextConfigurer(plugin) {
            @Override
            public Set<Class<?>> configurations() {
                return configurations;
            }

            @Override
            public ConfigurableApplicationContext applicationContext() {
                ConfigurableApplicationContext configurableApplicationContext = super.applicationContext();

                // Add identity provider configuration bean
                configurableApplicationContext.addBeanFactoryPostProcessor(
                        new IdentityProviderConfigurationBeanFactoryPostProcessor(identityProviderConfiguration));

                // Add identity provider mapper bean
                configurableApplicationContext.addBeanFactoryPostProcessor(
                        new IdentityProviderMapperBeanFactoryPostProcessor(identityProviderMapper));

                // Add identity provider role mapper bean
                configurableApplicationContext.addBeanFactoryPostProcessor(
                        new IdentityProviderRoleMapperBeanFactoryPostProcessor(identityProviderRoleMapper));

                return configurableApplicationContext;
            }
        });

        idpApplicationContext.getAutowireCapableBeanFactory().autowireBean(identityObj);

        if (identityObj instanceof InitializingBean) {
            ((InitializingBean) identityObj).afterPropertiesSet();
        }

        return identityObj;
    } catch (Exception ex) {
        logger.error("An unexpected error occurs while loading identity provider", ex);
        return null;
    }
}
 
开发者ID:gravitee-io,项目名称:graviteeio-access-management,代码行数:51,代码来源:IdentityProviderPluginManagerImpl.java

示例4: create

import io.gravitee.plugin.core.internal.AnnotationBasedPluginContextConfigurer; //导入依赖的package包/类
private <T> T create(Plugin plugin, Class<T> identityClass, Map<String, Object> properties) {
    if (identityClass == null) {
        return null;
    }

    try {
        T identityObj = createInstance(identityClass);
        final Import annImport = identityClass.getAnnotation(Import.class);
        Set<Class<?>> configurations = (annImport != null) ?
                new HashSet<>(Arrays.asList(annImport.value())) : Collections.emptySet();

        ApplicationContext idpApplicationContext = pluginContextFactory.create(new AnnotationBasedPluginContextConfigurer(plugin) {
            @Override
            public Set<Class<?>> configurations() {
                return configurations;
            }

            @Override
            public ConfigurableEnvironment environment() {
                return new StandardEnvironment() {
                    @Override
                    protected void customizePropertySources(MutablePropertySources propertySources) {
                        propertySources.addFirst(new MapPropertySource(plugin.id(), properties));
                        super.customizePropertySources(propertySources);
                    }
                };
            }
        });

        idpApplicationContext.getAutowireCapableBeanFactory().autowireBean(identityObj);

        if (identityObj instanceof InitializingBean) {
            ((InitializingBean) identityObj).afterPropertiesSet();
        }

        return identityObj;
    } catch (Exception ex) {
        LOGGER.error("An unexpected error occurs while loading identity provider", ex);
        return null;
    }
}
 
开发者ID:gravitee-io,项目名称:gravitee-management-rest-api,代码行数:42,代码来源:IdentityProviderManagerImpl.java


注:本文中的io.gravitee.plugin.core.internal.AnnotationBasedPluginContextConfigurer类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。