Search in sources :

Example 1 with ElytronIdentityProvider

use of org.kie.server.services.impl.security.ElytronIdentityProvider in project droolsjbpm-integration by kiegroup.

the class KieServerImpl method init.

protected void init(StartupStrategy startupStrategy) {
    logger.info("Selected startup strategy {}", startupStrategy);
    for (KieServerStateRepository repo : serverStateRepos) {
        if (repo.getClass().getSimpleName().equals(startupStrategy.getRepositoryType())) {
            this.repository = repo;
            break;
        }
    }
    logger.info("Configured '{}' server state repository", this.repository.getClass().getSimpleName());
    this.context = new KieServerRegistryImpl();
    if (ElytronIdentityProvider.available()) {
        this.context.registerIdentityProvider(new ElytronIdentityProvider());
    } else {
        this.context.registerIdentityProvider(new JACCIdentityProvider());
    }
    this.context.registerStateRepository(repository);
    // load available container locators
    ContainerLocatorProvider.get();
    ContainerManager containerManager = getContainerManager();
    KieServerState currentState = repository.load(KieServerEnvironment.getServerId());
    // if there is an update we just need to store it again
    if (updateMutableEnvironmentState(currentState)) {
        repository.store(KieServerEnvironment.getServerId(), currentState);
    }
    List<KieServerExtension> extensions = sortKnownExtensions();
    for (KieServerExtension extension : extensions) {
        logger.trace("{} processing", extension);
        if (!extension.isActive()) {
            continue;
        }
        try {
            extension.init(this, this.context);
            this.context.registerServerExtension(extension);
            if (extension.isInitialized()) {
                logger.info("{} has been successfully registered as server extension", extension);
            } else {
                logger.warn("{} has not been registered as server extension", extension);
            }
        } catch (Exception e) {
            serverMessages.add(new Message(Severity.ERROR, "Error when initializing server extension of type " + extension + " due to " + e.getMessage()));
            logger.error("Error when initializing server extension of type {}", extension, e);
        }
    }
    // start policy manager
    policyManager = new PolicyManager();
    policyManager.start(this, context);
    kieServerActive.set(true);
    eventSupport.fireBeforeServerStarted(this);
    startTimestamp = System.currentTimeMillis();
    startupStrategy.startup(this, containerManager, currentState, kieServerActive);
    eventSupport.fireAfterServerStarted(this);
}
Also used : KieServerState(org.kie.server.services.impl.storage.KieServerState) PolicyManager(org.kie.server.services.impl.policy.PolicyManager) KieServerStateRepository(org.kie.server.services.impl.storage.KieServerStateRepository) ElytronIdentityProvider(org.kie.server.services.impl.security.ElytronIdentityProvider) Message(org.kie.server.api.model.Message) JACCIdentityProvider(org.kie.server.services.impl.security.JACCIdentityProvider) KieServerExtension(org.kie.server.services.api.KieServerExtension)

Aggregations

Message (org.kie.server.api.model.Message)1 KieServerExtension (org.kie.server.services.api.KieServerExtension)1 PolicyManager (org.kie.server.services.impl.policy.PolicyManager)1 ElytronIdentityProvider (org.kie.server.services.impl.security.ElytronIdentityProvider)1 JACCIdentityProvider (org.kie.server.services.impl.security.JACCIdentityProvider)1 KieServerState (org.kie.server.services.impl.storage.KieServerState)1 KieServerStateRepository (org.kie.server.services.impl.storage.KieServerStateRepository)1