use of org.keycloak.provider.ProviderManager in project keycloak by keycloak.
the class FeatureDeployerUtil method undeployFactoriesAfterFeatureDisabled.
public static void undeployFactoriesAfterFeatureDisabled(Profile.Feature feature) {
ProviderManager manager = deployersCache.get(feature);
if (manager == null) {
// This is used if some feature is enabled by default and then disabled
// Need to figure which provider factories were enabled after feature was enabled. Create deployer based on it and save it to the cache
Map<ProviderFactory, Spi> factoriesBeforeDisable = initializer.remove(feature);
Map<ProviderFactory, Spi> factoriesAfterDisable = loadEnabledEnvironmentFactories();
Map<ProviderFactory, Spi> factories = getFactoriesDependentOnFeature(factoriesAfterDisable, factoriesBeforeDisable);
KeycloakDeploymentInfo di = createDeploymentInfo(factories);
manager = new ProviderManager(di, FeatureDeployerUtil.class.getClassLoader());
loadFactories(manager);
deployersCache.put(feature, manager);
}
ProviderManagerRegistry.SINGLETON.undeploy(manager);
}
use of org.keycloak.provider.ProviderManager in project keycloak by keycloak.
the class DefaultKeycloakSessionFactory method init.
public void init() {
serverStartupTimestamp = System.currentTimeMillis();
ProviderManager pm = new ProviderManager(KeycloakDeploymentInfo.create().services(), getClass().getClassLoader(), Config.scope().getArray("providers"));
for (Spi spi : pm.loadSpis()) {
if (spi.isEnabled()) {
spis.add(spi);
}
}
factoriesMap = loadFactories(pm);
synchronized (ProviderManagerRegistry.SINGLETON) {
for (ProviderManager manager : ProviderManagerRegistry.SINGLETON.getPreBoot()) {
Map<Class<? extends Provider>, Map<String, ProviderFactory>> factoryMap = loadFactories(manager);
for (Map.Entry<Class<? extends Provider>, Map<String, ProviderFactory>> entry : factoryMap.entrySet()) {
Map<String, ProviderFactory> factories = factoriesMap.get(entry.getKey());
if (factories == null) {
factoriesMap.put(entry.getKey(), entry.getValue());
} else {
factories.putAll(entry.getValue());
}
}
}
checkProvider();
// Component factory must be initialized first, so that postInit in other factories can use component factories
updateComponentFactoryProviderFactory();
if (componentFactoryPF != null) {
componentFactoryPF.postInit(this);
}
for (Map<String, ProviderFactory> factories : factoriesMap.values()) {
for (ProviderFactory factory : factories.values()) {
if (factory != componentFactoryPF) {
factory.postInit(this);
}
}
}
// make the session factory ready for hot deployment
ProviderManagerRegistry.SINGLETON.setDeployer(this);
}
AdminPermissions.registerListener(this);
}
Aggregations