Search in sources :

Example 1 with KieServerRestImpl

use of org.kie.server.remote.rest.common.resource.KieServerRestImpl in project droolsjbpm-integration by kiegroup.

the class KieServerExecutor method addServerSingletonResources.

private void addServerSingletonResources() {
    kieServer = new KieServerImpl();
    kieServer.init();
    ResteasyDeployment deployment = new ResteasyDeployment();
    deployment.setApplication(new Application());
    deployment.getResources().add(new KieServerRestImpl(kieServer));
    List<KieServerExtension> extensions = kieServer.getServerExtensions();
    for (KieServerExtension extension : extensions) {
        List<Object> components = extension.getAppComponents(SupportedTransports.REST);
        deployment.getResources().addAll(components);
    }
    server.deploy(deployment);
}
Also used : ResteasyDeployment(org.jboss.resteasy.spi.ResteasyDeployment) KieServerExtension(org.kie.server.services.api.KieServerExtension) KieServerRestImpl(org.kie.server.remote.rest.common.resource.KieServerRestImpl) KieServerImpl(org.kie.server.services.impl.KieServerImpl) Application(javax.ws.rs.core.Application)

Example 2 with KieServerRestImpl

use of org.kie.server.remote.rest.common.resource.KieServerRestImpl in project droolsjbpm-integration by kiegroup.

the class KieServerAutoConfiguration method kieServer.

@Bean(destroyMethod = "destroy")
@ConditionalOnMissingBean(name = "kieServer")
public KieServer kieServer(List<KieServerExtension> extensions, List<KieContainerResource> containers) {
    System.setProperty(KieServerConstants.CFG_SB_CXF_PATH, cxfPath);
    System.setProperty(KieServerConstants.KIE_SERVER_CONTROLLER, properties.getControllers());
    System.setProperty(KieServerConstants.KIE_SERVER_LOCATION, properties.getLocation());
    if (KieServerEnvironment.getServerId() == null) {
        String serverName = properties.getServerName();
        String serverId = properties.getServerId();
        KieServerEnvironment.setServerId(serverId.toString());
        KieServerEnvironment.setServerName(serverName);
    }
    logger.info("KieServer (id {} (name {})) started initialization process", KieServerEnvironment.getServerId(), KieServerEnvironment.getServerName());
    if (properties.isClassPathContainer()) {
        kieServer = new ImmutableSpringBootKieServerImpl(extensions, identityProvider, containers);
    } else {
        kieServer = new SpringBootKieServerImpl(extensions, identityProvider);
    }
    kieServer.init();
    KieServerRestImpl kieServerResource = new KieServerRestImpl(kieServer);
    this.endpoints = new ArrayList<>();
    endpoints.add(kieServerResource);
    // next add any resources from server extensions
    List<KieServerExtension> activeExtensions = kieServer.getServerExtensions();
    for (KieServerExtension extension : activeExtensions) {
        LinkedHashSet<Object> resources = new LinkedHashSet<>(extension.getAppComponents(SupportedTransports.REST));
        endpoints.addAll(resources);
    }
    logger.info("KieServer (id {}) started successfully", KieServerEnvironment.getServerId());
    return kieServer;
}
Also used : SpringBootKieServerImpl(org.kie.server.springboot.SpringBootKieServerImpl) ImmutableSpringBootKieServerImpl(org.kie.server.springboot.ImmutableSpringBootKieServerImpl) LinkedHashSet(java.util.LinkedHashSet) KieServerExtension(org.kie.server.services.api.KieServerExtension) ImmutableSpringBootKieServerImpl(org.kie.server.springboot.ImmutableSpringBootKieServerImpl) KieServerRestImpl(org.kie.server.remote.rest.common.resource.KieServerRestImpl) ConditionalOnMissingBean(org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean) ConditionalOnMissingBean(org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean) ConditionalOnBean(org.springframework.boot.autoconfigure.condition.ConditionalOnBean) JAXRSServerFactoryBean(org.apache.cxf.jaxrs.JAXRSServerFactoryBean) Bean(org.springframework.context.annotation.Bean)

Aggregations

KieServerRestImpl (org.kie.server.remote.rest.common.resource.KieServerRestImpl)2 KieServerExtension (org.kie.server.services.api.KieServerExtension)2 LinkedHashSet (java.util.LinkedHashSet)1 Application (javax.ws.rs.core.Application)1 JAXRSServerFactoryBean (org.apache.cxf.jaxrs.JAXRSServerFactoryBean)1 ResteasyDeployment (org.jboss.resteasy.spi.ResteasyDeployment)1 KieServerImpl (org.kie.server.services.impl.KieServerImpl)1 ImmutableSpringBootKieServerImpl (org.kie.server.springboot.ImmutableSpringBootKieServerImpl)1 SpringBootKieServerImpl (org.kie.server.springboot.SpringBootKieServerImpl)1 ConditionalOnBean (org.springframework.boot.autoconfigure.condition.ConditionalOnBean)1 ConditionalOnMissingBean (org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean)1 Bean (org.springframework.context.annotation.Bean)1