Debut Proxy server apache camel
This commit is contained in:
parent
a474dcf891
commit
ee34518b7d
56 changed files with 1047 additions and 2441 deletions
|
|
@ -1,124 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4">
|
||||
<component name="FacetManager">
|
||||
<facet type="Spring" name="Spring">
|
||||
<configuration />
|
||||
</facet>
|
||||
<facet type="web" name="Web">
|
||||
<configuration>
|
||||
<webroots />
|
||||
</configuration>
|
||||
</facet>
|
||||
</component>
|
||||
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8">
|
||||
<output url="file://$MODULE_DIR$/target/classes" />
|
||||
<output-test url="file://$MODULE_DIR$/target/test-classes" />
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/target" />
|
||||
</content>
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-web:2.1.0.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter:2.1.0.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot:2.1.0.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-autoconfigure:2.1.0.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-logging:2.1.0.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: ch.qos.logback:logback-classic:1.2.3" level="project" />
|
||||
<orderEntry type="library" name="Maven: ch.qos.logback:logback-core:1.2.3" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.apache.logging.log4j:log4j-to-slf4j:2.11.1" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.apache.logging.log4j:log4j-api:2.11.1" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.slf4j:jul-to-slf4j:1.7.25" level="project" />
|
||||
<orderEntry type="library" name="Maven: javax.annotation:javax.annotation-api:1.3.2" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.yaml:snakeyaml:1.23" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-json:2.1.0.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-databind:2.9.7" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-core:2.9.7" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.fasterxml.jackson.datatype:jackson-datatype-jdk8:2.9.7" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.9.7" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.fasterxml.jackson.module:jackson-module-parameter-names:2.9.7" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.hibernate.validator:hibernate-validator:6.0.13.Final" level="project" />
|
||||
<orderEntry type="library" name="Maven: javax.validation:validation-api:2.0.1.Final" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.jboss.logging:jboss-logging:3.3.2.Final" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.fasterxml:classmate:1.4.0" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework:spring-web:5.1.2.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework:spring-beans:5.1.2.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework:spring-webmvc:5.1.2.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework:spring-aop:5.1.2.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework:spring-context:5.1.2.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework:spring-expression:5.1.2.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-undertow:2.1.0.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: io.undertow:undertow-core:2.0.14.Final" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.jboss.xnio:xnio-api:3.3.8.Final" level="project" />
|
||||
<orderEntry type="library" scope="RUNTIME" name="Maven: org.jboss.xnio:xnio-nio:3.3.8.Final" level="project" />
|
||||
<orderEntry type="library" name="Maven: io.undertow:undertow-servlet:2.0.14.Final" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.jboss.spec.javax.annotation:jboss-annotations-api_1.2_spec:1.0.2.Final" level="project" />
|
||||
<orderEntry type="library" name="Maven: io.undertow:undertow-websockets-jsr:2.0.14.Final" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.jboss.spec.javax.websocket:jboss-websocket-api_1.1_spec:1.1.3.Final" level="project" />
|
||||
<orderEntry type="library" name="Maven: javax.servlet:javax.servlet-api:4.0.1" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.glassfish:javax.el:3.0.0" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.apache.camel:camel-spring-boot-starter:2.23.0" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.apache.camel:camel-spring-boot:2.23.0" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.apache.camel:camel-spring:2.23.0" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework:spring-tx:5.1.2.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.apache.camel:camel-core-starter:2.23.0" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.apache.camel:camel-swagger-java-starter:2.23.0" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.apache.camel:camel-swagger-java:2.23.0" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-annotations:2.9.0" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.fasterxml.jackson.datatype:jackson-datatype-joda:2.9.7" level="project" />
|
||||
<orderEntry type="library" name="Maven: joda-time:joda-time:2.10.1" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.fasterxml.jackson.dataformat:jackson-dataformat-yaml:2.9.7" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.fasterxml.jackson.dataformat:jackson-dataformat-xml:2.9.7" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.codehaus.woodstox:stax2-api:3.1.4" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.fasterxml.woodstox:woodstox-core:5.0.3" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.fasterxml.jackson.jaxrs:jackson-jaxrs-json-provider:2.9.7" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.fasterxml.jackson.jaxrs:jackson-jaxrs-base:2.9.7" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.google.guava:guava:20.0" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.apache.commons:commons-lang3:3.8.1" level="project" />
|
||||
<orderEntry type="library" name="Maven: io.swagger:swagger-core:1.5.21" level="project" />
|
||||
<orderEntry type="library" name="Maven: io.swagger:swagger-models:1.5.21" level="project" />
|
||||
<orderEntry type="library" name="Maven: io.swagger:swagger-annotations:1.5.21" level="project" />
|
||||
<orderEntry type="library" name="Maven: io.swagger:swagger-jaxrs:1.5.21" level="project" />
|
||||
<orderEntry type="library" name="Maven: javax.ws.rs:jsr311-api:1.1.1" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.reflections:reflections:0.9.11" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.javassist:javassist:3.21.0-GA" level="project" />
|
||||
<orderEntry type="library" name="Maven: io.swagger:swagger-parser:1.0.37" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.slf4j:slf4j-ext:1.7.25" level="project" />
|
||||
<orderEntry type="library" name="Maven: commons-io:commons-io:2.6" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.apache.camel:camel-servlet-starter:2.23.0" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.apache.camel:camel-servlet:2.23.0" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.apache.camel:camel-http-common:2.23.0" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.apache.camel:camel-jackson-starter:2.23.0" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.apache.camel:camel-jackson:2.23.0" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.fasterxml.jackson.module:jackson-module-jaxb-annotations:2.9.7" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="Maven: org.springframework.boot:spring-boot-starter-test:2.1.0.RELEASE" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="Maven: org.springframework.boot:spring-boot-test:2.1.0.RELEASE" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="Maven: org.springframework.boot:spring-boot-test-autoconfigure:2.1.0.RELEASE" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="Maven: com.jayway.jsonpath:json-path:2.4.0" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="Maven: net.minidev:json-smart:2.3" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="Maven: net.minidev:accessors-smart:1.2" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="Maven: org.ow2.asm:asm:5.0.4" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.slf4j:slf4j-api:1.7.25" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="Maven: junit:junit:4.12" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="Maven: org.assertj:assertj-core:3.11.1" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="Maven: org.mockito:mockito-core:2.23.0" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="Maven: net.bytebuddy:byte-buddy:1.9.3" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="Maven: net.bytebuddy:byte-buddy-agent:1.9.3" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="Maven: org.objenesis:objenesis:2.6" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="Maven: org.hamcrest:hamcrest-core:1.3" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="Maven: org.hamcrest:hamcrest-library:1.3" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="Maven: org.skyscreamer:jsonassert:1.5.0" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="Maven: com.vaadin.external.google:android-json:0.0.20131108.vaadin1" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework:spring-core:5.1.2.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework:spring-jcl:5.1.2.RELEASE" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="Maven: org.springframework:spring-test:5.1.2.RELEASE" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="Maven: org.xmlunit:xmlunit-core:2.6.2" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="Maven: org.apache.camel:camel-test:2.23.0" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.apache.camel:camel-core:2.23.0" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.sun.xml.bind:jaxb-core:2.3.0" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.sun.xml.bind:jaxb-impl:2.3.0" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.apache.tomcat.embed:tomcat-embed-core:9.0.13" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.apache.tomcat:tomcat-annotations-api:9.0.12" level="project" />
|
||||
</component>
|
||||
</module>
|
||||
|
|
@ -31,11 +31,7 @@
|
|||
<name>Chtijbug :: Business Proxy :: app</name>
|
||||
|
||||
|
||||
<properties>
|
||||
<category>Rest</category>
|
||||
<spring.boot-version>2.1.0.RELEASE</spring.boot-version>
|
||||
<camel.version>2.23.0</camel.version>
|
||||
</properties>
|
||||
|
||||
|
||||
<!-- Spring-Boot and Camel BOM -->
|
||||
<dependencyManagement>
|
||||
|
|
@ -58,6 +54,11 @@
|
|||
</dependencyManagement>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.pymmasoftware.jbpm</groupId>
|
||||
<artifactId>drools-framewwork-business-proxy-persistence</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<!-- Spring Boot -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
|
|
@ -108,6 +109,107 @@
|
|||
<artifactId>tomcat-embed-core</artifactId>
|
||||
<version>9.0.13</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.kie</groupId>
|
||||
<artifactId>kie-api</artifactId>
|
||||
<version>${jbpm.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.kie</groupId>
|
||||
<artifactId>kie-internal</artifactId>
|
||||
<version>${jbpm.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.drools</groupId>
|
||||
<artifactId>drools-compiler</artifactId>
|
||||
<version>${jbpm.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- kie-server -->
|
||||
<dependency>
|
||||
<groupId>org.kie.server</groupId>
|
||||
<artifactId>kie-server-api</artifactId>
|
||||
<version>${jbpm.version}</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>org.optaplanner</groupId>
|
||||
<artifactId>optaplanner-core</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>org.optaplanner</groupId>
|
||||
<artifactId>optaplanner-persistence-xstream</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>org.optaplanner</groupId>
|
||||
<artifactId>optaplanner-persistence-jaxb</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.kie.server</groupId>
|
||||
<artifactId>kie-server-services-common</artifactId>
|
||||
<version>${jbpm.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.pymmasoftware.jbpm</groupId>
|
||||
<artifactId>drools-framework-kie-server-services-drools</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>com.thoughtworks.xstream</groupId>
|
||||
<artifactId>xstream</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>org.apache.activemq</groupId>
|
||||
<artifactId>artemis-jms-client</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>org.jboss.errai</groupId>
|
||||
<artifactId>errai-marshalling</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>io.netty</groupId>
|
||||
<artifactId>netty-buffer</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>io.netty</groupId>
|
||||
<artifactId>netty-transport-native-kqueue</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>io.netty</groupId>
|
||||
<artifactId>netty-codec-http</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>io.netty</groupId>
|
||||
<artifactId>netty-handler</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>io.netty</groupId>
|
||||
<artifactId>netty-codec</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>io.netty</groupId>
|
||||
<artifactId>netty-transport-native-epoll</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>io.netty</groupId>
|
||||
<artifactId>netty-common</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>io.netty</groupId>
|
||||
<artifactId>netty-transport</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>io.netty</groupId>
|
||||
<artifactId>netty-transport-native-unix-common</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>io.netty</groupId>
|
||||
<artifactId>netty-resolver</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
|
|
|
|||
|
|
@ -14,20 +14,23 @@
|
|||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.chtijbug.drools.proxy.camel;
|
||||
package org.chtijbug.drools.proxy;
|
||||
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
|
||||
// CHECKSTYLE:OFF
|
||||
@SpringBootApplication
|
||||
public class Application {
|
||||
public class DroolsBusinessProxyServer {
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Main method to start the application.
|
||||
*/
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(Application.class, args);
|
||||
SpringApplication.run(DroolsBusinessProxyServer.class, args);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,151 @@
|
|||
package org.chtijbug.drools.proxy.camel;
|
||||
|
||||
import org.apache.camel.builder.RouteBuilder;
|
||||
import org.apache.camel.model.rest.RestBindingMode;
|
||||
import org.apache.camel.model.rest.RestParamType;
|
||||
import org.chtijbug.drools.proxy.service.KieServiceCommon;
|
||||
import org.kie.server.api.model.KieContainerResource;
|
||||
import org.kie.server.api.model.KieContainerResourceList;
|
||||
import org.kie.server.api.model.KieServerInfo;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import static org.apache.camel.model.rest.RestParamType.body;
|
||||
import static org.apache.camel.model.rest.RestParamType.path;
|
||||
|
||||
@Component
|
||||
public class AdminRouter extends RouteBuilder {
|
||||
|
||||
|
||||
@Value("${server.port}")
|
||||
private int serverPort;
|
||||
@Value("${camel.component.servlet.mapping.context-path}")
|
||||
private String contextPath;
|
||||
@Resource
|
||||
KieServiceCommon kieServiceCommon;
|
||||
@Override
|
||||
public void configure() throws Exception {
|
||||
System.out.println("coucou");
|
||||
|
||||
restConfiguration()
|
||||
.component("servlet")
|
||||
.bindingMode(RestBindingMode.json)
|
||||
.dataFormatProperty("prettyPrint", "true")
|
||||
.enableCORS(true)
|
||||
.port(serverPort)
|
||||
.contextPath(contextPath.substring(0, contextPath.length() - 2))
|
||||
// turn on swagger api-doc
|
||||
.apiContextPath("/api-doc")
|
||||
.apiProperty("api.title","KIE Server :: Core")
|
||||
.apiProperty("api.version", "1.0.0");
|
||||
|
||||
rest("/server/").description("Retrieves containers deployed to this server, optionally filtered by group, artifact, version or status")
|
||||
.produces("application/json")
|
||||
.consumes("application/json")
|
||||
.get("/").description("Retrieves KIE Server information - id, name, location, capabilities, messages").outType(KieServerInfo.class)
|
||||
.responseMessage().code(200).message("Server Info successfully returned").endResponseMessage()
|
||||
.to("bean:kieService?method=getInfo()");
|
||||
|
||||
rest("/server/containers").description("Retrieves containers deployed to this server, optionally filtered by group, artifact, version or status")
|
||||
.produces("application/json")
|
||||
.consumes("application/json")
|
||||
.get("/").description("Find user by ID").outType(KieContainerResourceList.class)
|
||||
.param().name("groupId").type(RestParamType.query).required(false).description("optional groupId to filter containers by").dataType("string").endParam()
|
||||
.param().name("artifactId").type(RestParamType.query).required(false).description("optional artifactId to filter containers by").dataType("string").endParam()
|
||||
.param().name("version").type(RestParamType.query).required(false).description("optional version to filter containers by").dataType("string").endParam()
|
||||
.param().name("status").type(RestParamType.query).required(false).description("optional status to filter containers by").dataType("string").endParam()
|
||||
|
||||
.responseMessage().code(200).message("containers successfully returned").endResponseMessage()
|
||||
.to("bean:kieService?method=listContainers(${header.groupId},${header.artifactId},${header.version},${header.status})");
|
||||
|
||||
rest("/server/containers").description(" Creates (deploys) new KIE container to this server")
|
||||
.consumes("application/json")
|
||||
.produces("application/json")
|
||||
|
||||
.put("/{id}").description("Container id to be assigned to deployed KIE Container").type(KieContainerResource.class).outType(KieContainerResource.class)
|
||||
.param().name("id").type(path).description("Container id to be assigned to deployed KIE Container").dataType("string").endParam()
|
||||
.param().name("body").type(body).description("KIE Container resource to be deployed as KieContainerResourcee").endParam()
|
||||
.responseMessage().code(200).message("Container successfully created").endResponseMessage()
|
||||
.to("bean:kieService?method=createContainer(${header.id},${body})");
|
||||
rest("/server/containers").description(" Disposes (undeploys) container with given id")
|
||||
.consumes("application/json")
|
||||
.produces("application/json")
|
||||
|
||||
.delete("/{id}").description("Container id to be disposed (undeployed)r")
|
||||
.param().name("id").type(path).description("Container id to be disposed (undeployed)").dataType("string").endParam()
|
||||
.responseMessage().code(200).message("Container successfully created").endResponseMessage()
|
||||
.to("bean:kieService?method=disposeContainer(${header.id})");
|
||||
|
||||
rest("/server/containers/business").description(" Creates (deploys) new KIE container to this server with a business rest interface")
|
||||
.consumes("application/json")
|
||||
.produces("application/json")
|
||||
|
||||
.post("/{id}/{className}").description("Container id to be assigned to deployed KIE Container").type(KieContainerResource.class).outType(KieContainerResource.class)
|
||||
.param().name("id").type(path).description("Container id to be assigned to deployed KIE Container").dataType("string").endParam()
|
||||
.param().name("className").type(path).description("Class Name of the Business Service").dataType("string").endParam()
|
||||
.param().name("body").type(body).description("KIE Container resource to be deployed as KieContainerResourcee").endParam()
|
||||
.responseMessage().code(200).message("Container successfully created").endResponseMessage()
|
||||
.to("bean:kieService?method=createContainerWithRestBusinessService(${header.id},${body},${header.className})");
|
||||
|
||||
}
|
||||
}
|
||||
/**
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@ApiOperation(value="Retrieves server state - configuration that the server is currently running with",
|
||||
response=ServiceResponse.class, code=200)
|
||||
@ApiResponses(value = { @ApiResponse(code = 500, message = "Unexpected error") })
|
||||
@GET
|
||||
@Path("state")
|
||||
@Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON})
|
||||
public Response getServerState(@Context HttpHeaders headers) {
|
||||
return createCorrectVariant(server.getServerState(), headers);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ApiOperation(value="Readiness check for KIE Server that indicates that server is fully booted and ready to accept requests",
|
||||
response=Void.class, code=200)
|
||||
@ApiResponses(value = { @ApiResponse(code = 503, message = "Service not yet available") })
|
||||
@GET
|
||||
@Path("readycheck")
|
||||
@Produces({MediaType.TEXT_PLAIN})
|
||||
public Response readycheck(@Context HttpHeaders headers) {
|
||||
if (server.isKieServerReady()) {
|
||||
return Response.status(Response.Status.OK).build();
|
||||
}
|
||||
return serviceUnavailable();
|
||||
}
|
||||
|
||||
@ApiOperation(value="Liveness check for KIE Server that validates both kie server and all extensions, optionally produces report",
|
||||
response=Message.class, code=200, responseContainer="List")
|
||||
@ApiResponses(value = { @ApiResponse(code = 503, message = "If any of the checks failed") })
|
||||
@GET
|
||||
@Path("healthcheck")
|
||||
@Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON})
|
||||
public Response healthcheck(@Context HttpHeaders headers,
|
||||
@ApiParam(value = "optional report flag to return detailed report of the check, defaults to false", required = false) @QueryParam("report") @DefaultValue("false") boolean report) {
|
||||
List<Message> healthMessages = server.healthCheck(report);
|
||||
|
||||
boolean anyfailures = healthMessages.stream().anyMatch(msg -> msg.getSeverity().equals(Severity.ERROR));
|
||||
if (anyfailures) {
|
||||
if (report) {
|
||||
return createCorrectVariant(healthMessages, headers, Response.Status.SERVICE_UNAVAILABLE);
|
||||
}
|
||||
|
||||
return serviceUnavailable();
|
||||
}
|
||||
if (report) {
|
||||
return createCorrectVariant(healthMessages, headers, Response.Status.OK);
|
||||
}
|
||||
return Response.status(Response.Status.OK).build();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
**/
|
||||
|
|
@ -1,50 +0,0 @@
|
|||
package org.chtijbug.drools.proxy.camel;
|
||||
|
||||
public class Adress {
|
||||
|
||||
private String numRue;
|
||||
private String nomRue;
|
||||
private String codePostal;
|
||||
private String nomVille;
|
||||
private String pays;
|
||||
|
||||
public String getNumRue() {
|
||||
return numRue;
|
||||
}
|
||||
|
||||
public void setNumRue(String numRue) {
|
||||
this.numRue = numRue;
|
||||
}
|
||||
|
||||
public String getNomRue() {
|
||||
return nomRue;
|
||||
}
|
||||
|
||||
public void setNomRue(String nomRue) {
|
||||
this.nomRue = nomRue;
|
||||
}
|
||||
|
||||
public String getCodePostal() {
|
||||
return codePostal;
|
||||
}
|
||||
|
||||
public void setCodePostal(String codePostal) {
|
||||
this.codePostal = codePostal;
|
||||
}
|
||||
|
||||
public String getNomVille() {
|
||||
return nomVille;
|
||||
}
|
||||
|
||||
public void setNomVille(String nomVille) {
|
||||
this.nomVille = nomVille;
|
||||
}
|
||||
|
||||
public String getPays() {
|
||||
return pays;
|
||||
}
|
||||
|
||||
public void setPays(String pays) {
|
||||
this.pays = pays;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,64 +1,43 @@
|
|||
package org.chtijbug.drools.proxy.camel;
|
||||
|
||||
import org.apache.camel.CamelContext;
|
||||
import org.apache.camel.builder.RouteBuilder;
|
||||
import org.apache.camel.model.rest.RestBindingMode;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.kie.server.services.api.KieContainerInstance;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import static org.apache.camel.model.rest.RestParamType.body;
|
||||
import static org.apache.camel.model.rest.RestParamType.path;
|
||||
|
||||
@Component
|
||||
public class DroolsRouter extends RouteBuilder {
|
||||
private int serverPort = 8080;
|
||||
@Value("${camel.component.servlet.mapping.context-path}")
|
||||
private String contextPath;
|
||||
|
||||
private String projectName = "proBTP";
|
||||
|
||||
private String containerId = "1";
|
||||
|
||||
private String processID = "P0";
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(DroolsRouter.class);
|
||||
private String projectName ;
|
||||
private KieContainerInstance kci;
|
||||
private Class<?> clazzUser;
|
||||
|
||||
{
|
||||
try {
|
||||
clazzUser = Class.forName("org.chtijbug.drools.proxy.camel.User");
|
||||
} catch (ClassNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
public DroolsRouter(CamelContext camelContext,Class<?> clazzUser, String projectName,KieContainerInstance kci) {
|
||||
super(camelContext);
|
||||
this.clazzUser = clazzUser;
|
||||
this.projectName=projectName;
|
||||
this.kci = kci;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void configure() throws Exception {
|
||||
|
||||
// @formatter:off
|
||||
System.out.println("coucou");
|
||||
|
||||
// this can also be configured in application.properties
|
||||
restConfiguration()
|
||||
.component("servlet")
|
||||
.bindingMode(RestBindingMode.json)
|
||||
.dataFormatProperty("prettyPrint", "true")
|
||||
.enableCORS(true)
|
||||
.port(serverPort)
|
||||
.contextPath(contextPath.substring(0, contextPath.length() - 2))
|
||||
// turn on swagger api-doc
|
||||
.apiContextPath("/api-doc")
|
||||
.apiProperty("api.title", projectName + " API")
|
||||
.apiProperty("api.version", "1.0.0");
|
||||
rest("/" + projectName).description(projectName + " Rest service")
|
||||
.consumes("application/json")
|
||||
.produces("application/json")
|
||||
|
||||
rest("/" + projectName).description(projectName + " Rest service")
|
||||
.consumes("application/json")
|
||||
.produces("application/json")
|
||||
|
||||
.put("/{containerId}/{processID}").description("Find user by ID").type(clazzUser).outType(clazzUser)
|
||||
.param().name("containerId").type(path).description("Container ID where the rule artefact id deployed").dataType("integer").endParam()
|
||||
.param().name("processID").type(path).description("process ID sot start").dataType("integer").endParam()
|
||||
.param().name("body").type(body).description("The user to update").endParam()
|
||||
.responseMessage().code(200).message("User successfully returned").endResponseMessage()
|
||||
.to("bean:userService?method=calculateUser(${header.containerId},${header.processID},${body})");
|
||||
.put("/{containerId}/{processID}").description("Execute Business Service").type(clazzUser).outType(clazzUser)
|
||||
.param().name("containerId").type(path).description("Container ID where the rule artefact id deployed").dataType("integer").endParam()
|
||||
.param().name("processID").type(path).description("process ID sot start").dataType("integer").endParam()
|
||||
.param().name("body").type(body).description("The Data drools should work on").endParam()
|
||||
.responseMessage().code(200).message("Data drools worked on").endResponseMessage()
|
||||
.to("bean:ruleService?method=runSessionObject(${header.containerId},${header.processID},${body})");
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,55 @@
|
|||
package org.chtijbug.drools.proxy.camel;
|
||||
|
||||
import org.apache.camel.builder.RouteBuilder;
|
||||
import org.apache.camel.model.rest.RestBindingMode;
|
||||
import org.chtijbug.drools.proxy.service.RuleService;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import static org.apache.camel.model.rest.RestParamType.body;
|
||||
import static org.apache.camel.model.rest.RestParamType.path;
|
||||
|
||||
//@Component
|
||||
public class GenericDroolsRouter extends RouteBuilder {
|
||||
@Value("${server.port}")
|
||||
private int serverPort;
|
||||
@Value("${camel.component.servlet.mapping.context-path}")
|
||||
private String contextPath;
|
||||
|
||||
@Resource
|
||||
RuleService ruleServicee;
|
||||
|
||||
@Override
|
||||
public void configure() throws Exception {
|
||||
|
||||
// @formatter:off
|
||||
|
||||
// this can also be configured in application.properties
|
||||
restConfiguration()
|
||||
.component("servlet")
|
||||
.bindingMode(RestBindingMode.json)
|
||||
.dataFormatProperty("prettyPrint", "true")
|
||||
.enableCORS(true)
|
||||
.port(serverPort)
|
||||
.contextPath(contextPath.substring(0, contextPath.length() - 2))
|
||||
// turn on swagger api-doc
|
||||
.apiContextPath("/api-doc")
|
||||
.apiProperty("api.title", "Generic drools API")
|
||||
.apiProperty("api.version", "1.0.0");
|
||||
|
||||
rest("containers/generic/run").description("Drools Generic Rest service")
|
||||
.consumes("application/json")
|
||||
.produces("application/json")
|
||||
|
||||
.post("/{id}/{processId}/{className}").description("Find user by ID")
|
||||
.param().name("id").type(path).description("Container ID where the rule are located").dataType("integer").endParam()
|
||||
.param().name("processId").type(path).description("process ID sot start").dataType("integer").endParam()
|
||||
.param().name("className").type(path).description("Class name of the top class").dataType("integer").endParam()
|
||||
.param().name("body").type(body).description("The user data").endParam()
|
||||
.responseMessage().code(200).message("User successfully returned").endResponseMessage()
|
||||
.to("bean:ruleService?method=runSession(${header.id},${header.processId},${header.className},${body})");
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -1,80 +0,0 @@
|
|||
/**
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* <p>
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* <p>
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.chtijbug.drools.proxy.camel;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* User entity
|
||||
*
|
||||
*/
|
||||
@ApiModel(description = "Represents an user of the system")
|
||||
public class User {
|
||||
|
||||
@ApiModelProperty(value = "The ID of the user", required = true)
|
||||
private Integer id;
|
||||
|
||||
@ApiModelProperty(value = "The name of the user", required = true)
|
||||
private String name;
|
||||
@ApiModelProperty(value = "The list of User adresses", required = false)
|
||||
private List<Adress> addreslist = new ArrayList<>();
|
||||
|
||||
public User() {
|
||||
}
|
||||
|
||||
public User(Integer id, String name) {
|
||||
this.id = id;
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public Integer getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Integer id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public List<Adress> getAddreslist() {
|
||||
return addreslist;
|
||||
}
|
||||
|
||||
public void setAddreslist(List<Adress> addreslist) {
|
||||
this.addreslist = addreslist;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
final StringBuffer sb = new StringBuffer("User{");
|
||||
sb.append("id=").append(id);
|
||||
sb.append(", name='").append(name).append('\'');
|
||||
sb.append('}');
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
||||
|
|
@ -1,53 +0,0 @@
|
|||
/**
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* <p>
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* <p>
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.chtijbug.drools.proxy.camel;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
/**
|
||||
* Service interface for managing users.
|
||||
*
|
||||
*/
|
||||
public interface UserService {
|
||||
|
||||
/**
|
||||
* Find a user by the given ID
|
||||
*
|
||||
* @param id
|
||||
* the ID of the user
|
||||
* @return the user, or <code>null</code> if user not found.
|
||||
*/
|
||||
User findUser(Integer id);
|
||||
|
||||
/**
|
||||
* Find all users
|
||||
*
|
||||
* @return a collection of all users
|
||||
*/
|
||||
Collection<User> findUsers();
|
||||
|
||||
/**
|
||||
* Update the given user
|
||||
*
|
||||
* @param user
|
||||
* the user
|
||||
*/
|
||||
void updateUser(User user);
|
||||
|
||||
public Object calculateUser(String id, String processID, Object input);
|
||||
|
||||
}
|
||||
|
|
@ -1,60 +0,0 @@
|
|||
/**
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* <p>
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* <p>
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.chtijbug.drools.proxy.camel;
|
||||
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Map;
|
||||
import java.util.TreeMap;
|
||||
|
||||
@Service("userService")
|
||||
public class UserServiceImpl implements UserService {
|
||||
|
||||
private final Map<Integer, User> users = new TreeMap<>();
|
||||
|
||||
public UserServiceImpl() {
|
||||
users.put(1, new User(1, "John Coltrane"));
|
||||
users.put(2, new User(2, "Miles Davis"));
|
||||
users.put(3, new User(3, "Sonny Rollins"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public User findUser(Integer id) {
|
||||
return users.get(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<User> findUsers() {
|
||||
return users.values();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateUser(User user) {
|
||||
users.put(user.getId(), user);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object calculateUser(String id, String processID, Object input) {
|
||||
System.out.println("drools");
|
||||
System.out.println("id=" + id);
|
||||
System.out.println("processID=" + processID);
|
||||
System.out.println("ObjectToString=" + input.toString());
|
||||
return input;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,276 @@
|
|||
/*
|
||||
* Copyright 2015 Red Hat, Inc. and/or its affiliates.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.chtijbug.drools.proxy.service;
|
||||
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import org.apache.camel.CamelContext;
|
||||
import org.chtijbug.drools.proxy.camel.DroolsRouter;
|
||||
import org.chtijbug.drools.proxy.persistence.ContainerRepository;
|
||||
import org.chtijbug.drools.proxy.persistence.model.ContainerPojoPersist;
|
||||
import org.chtijbug.kieserver.services.drools.DroolsChtijbugKieServerExtension;
|
||||
import org.chtijbug.kieserver.services.drools.DroolsChtijbugRulesExecutionService;
|
||||
import org.kie.server.api.model.*;
|
||||
import org.kie.server.services.api.KieContainerInstance;
|
||||
import org.kie.server.services.api.KieServerExtension;
|
||||
import org.kie.server.services.api.KieServerRegistry;
|
||||
import org.kie.server.services.impl.KieContainerInstanceImpl;
|
||||
import org.kie.server.services.impl.KieServerImpl;
|
||||
import org.kie.server.services.impl.KieServerLocator;
|
||||
import org.kie.server.services.impl.marshal.MarshallerHelper;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import javax.inject.Inject;
|
||||
import javax.ws.rs.core.Context;
|
||||
import javax.ws.rs.core.HttpHeaders;
|
||||
import java.util.*;
|
||||
|
||||
@Service("kieService")
|
||||
public class KieServiceCommon {
|
||||
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(KieServiceCommon.class);
|
||||
|
||||
private KieServerImpl server;
|
||||
private MarshallerHelper marshallerHelper;
|
||||
private KieServerRegistry registry;
|
||||
private ObjectMapper mapper = new ObjectMapper();
|
||||
private DroolsChtijbugRulesExecutionService droolsChtijbugRulesExecutionService = null;
|
||||
|
||||
private DroolsChtijbugKieServerExtension droolsChtijbugKieServerExtension;
|
||||
@Inject
|
||||
private ContainerRepository containerRepository;
|
||||
|
||||
@Autowired
|
||||
CamelContext camelContext;
|
||||
|
||||
public KieServiceCommon() {
|
||||
// for now, if no server impl is passed as parameter, create one
|
||||
this.server = KieServerLocator.getInstance();
|
||||
|
||||
List<KieServerExtension> serverExtensions = this.server.getServerExtensions();
|
||||
for (KieServerExtension serverExtension : serverExtensions) {
|
||||
if (serverExtension instanceof DroolsChtijbugKieServerExtension) {
|
||||
droolsChtijbugKieServerExtension = (DroolsChtijbugKieServerExtension) serverExtension;
|
||||
if (droolsChtijbugRulesExecutionService == null) {
|
||||
|
||||
droolsChtijbugRulesExecutionService = droolsChtijbugKieServerExtension.getRulesExecutionService();
|
||||
}
|
||||
if (registry == null) {
|
||||
registry = droolsChtijbugRulesExecutionService.getContext();
|
||||
}
|
||||
}
|
||||
}
|
||||
this.marshallerHelper = new MarshallerHelper(this.server.getServerRegistry());
|
||||
|
||||
}
|
||||
@PostConstruct
|
||||
private void initCamelBusinessRoutes(){
|
||||
try {
|
||||
String serverName = System.getProperty("org.kie.server.id");
|
||||
List<ContainerPojoPersist> containers = containerRepository.findByServerName(serverName);
|
||||
for (ContainerPojoPersist container : containers) {
|
||||
String containerId = container.getContainerId();
|
||||
KieContainerInstanceImpl kieContainerInstance = registry.getContainer(containerId);
|
||||
if (kieContainerInstance!= null) {
|
||||
Set<Class<?>> classes = kieContainerInstance.getExtraClasses();
|
||||
String className = container.getClassName();
|
||||
Class foundClass = this.getClassFromName(classes, className);
|
||||
ClassLoader classLoader = foundClass.getClassLoader();
|
||||
Class<?> theClass = classLoader.loadClass(className);
|
||||
camelContext.setApplicationContextClassLoader(classLoader);
|
||||
String projectName = container.getProjectName();
|
||||
DroolsRouter droolsRouter = new DroolsRouter(camelContext, theClass, projectName, kieContainerInstance);
|
||||
camelContext.addRoutes(droolsRouter);
|
||||
}
|
||||
}
|
||||
}catch (Exception e){
|
||||
logger.info("CreationContainer", e);
|
||||
}
|
||||
}
|
||||
|
||||
public KieServerImpl getServer() {
|
||||
return server;
|
||||
}
|
||||
|
||||
public void setServer(KieServerImpl server) {
|
||||
this.server = server;
|
||||
}
|
||||
|
||||
public KieServerInfo getInfo() {
|
||||
ServiceResponse<KieServerInfo> result = server.getInfo();
|
||||
return result.getResult();
|
||||
}
|
||||
|
||||
public KieContainerResourceList listContainers(String groupId, String artifactId, String version, String status) {
|
||||
ReleaseIdFilter releaseIdFilter = new ReleaseIdFilter.Builder()
|
||||
.groupId(groupId)
|
||||
.artifactId(artifactId)
|
||||
.version(version)
|
||||
.build();
|
||||
|
||||
KieContainerStatusFilter statusFilter = KieContainerStatusFilter.parseFromNullableString(status);
|
||||
KieContainerResourceFilter containerFilter = new KieContainerResourceFilter(releaseIdFilter, statusFilter);
|
||||
ServiceResponse<KieContainerResourceList> result = server.listContainers(containerFilter);
|
||||
return result.getResult();
|
||||
}
|
||||
|
||||
|
||||
public KieContainerResource createContainerWithRestBusinessService(String id, KieContainerResource container, String className, String projectName) {
|
||||
|
||||
if (projectName==null){
|
||||
projectName=id;
|
||||
}
|
||||
KieContainerResource containerResource = this.createContainer(id, container);
|
||||
if (containerResource.getMessages().size()==1
|
||||
&& containerResource.getMessages().get(0).getSeverity()!= null
|
||||
&& containerResource.getMessages().get(0).getSeverity().equals(Severity.INFO)) {
|
||||
ClassLoader localClassLoader = null;
|
||||
|
||||
try {
|
||||
localClassLoader = Thread.currentThread()
|
||||
.getContextClassLoader();
|
||||
} catch (ClassCastException e) {
|
||||
logger.info("GenericResource.runSession", e);
|
||||
}
|
||||
try {
|
||||
KieContainerInstance kci = registry.getContainer(id);
|
||||
Set<Class<?>> classes = kci.getExtraClasses();
|
||||
|
||||
Class foundClass = this.getClassFromName(classes, className);
|
||||
if (foundClass != null) {
|
||||
ClassLoader classLoader = foundClass.getClassLoader();
|
||||
Class<?> theClass = classLoader.loadClass(className);
|
||||
camelContext.setApplicationContextClassLoader(classLoader);
|
||||
DroolsRouter droolsRouter = new DroolsRouter(camelContext, theClass, projectName,kci);
|
||||
camelContext.addRoutes(droolsRouter);
|
||||
String serverName= System.getProperty("org.kie.server.id");
|
||||
ContainerPojoPersist containerPojoPersist = containerRepository.findByServerNameAndContainerId(serverName,id);
|
||||
if (containerPojoPersist==null){
|
||||
containerPojoPersist = new ContainerPojoPersist();
|
||||
containerPojoPersist.setId(UUID.randomUUID().toString());
|
||||
containerPojoPersist.setContainerId(id);
|
||||
containerPojoPersist.setClassName(className);
|
||||
containerPojoPersist.setProjectName(projectName);
|
||||
containerPojoPersist.setServerName(serverName);
|
||||
containerRepository.save(containerPojoPersist);
|
||||
}else{
|
||||
containerPojoPersist.setContainerId(id);
|
||||
containerPojoPersist.setClassName(className);
|
||||
containerPojoPersist.setProjectName(projectName);
|
||||
containerPojoPersist.setServerName(serverName);
|
||||
containerRepository.save(containerPojoPersist);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
} catch (ClassNotFoundException e) {
|
||||
logger.error("createContainerWithRestBusinessService", e);
|
||||
} catch (Exception e) {
|
||||
logger.error("createContainerWithRestBusinessService", e);
|
||||
} finally {
|
||||
if (localClassLoader != null) {
|
||||
Thread.currentThread().setContextClassLoader(localClassLoader);
|
||||
}
|
||||
}
|
||||
}
|
||||
return containerResource;
|
||||
|
||||
|
||||
}
|
||||
|
||||
public KieContainerResource createContainer(String id, KieContainerResource container) {
|
||||
|
||||
container.setContainerId(id);
|
||||
ServiceResponse<KieContainerResource> response = server.createContainer(id, container);
|
||||
if (response.getType().equals(KieServiceResponse.ResponseType.SUCCESS)) {
|
||||
return response.getResult();
|
||||
} else {
|
||||
Message m = new Message();
|
||||
List<String> texts = new ArrayList<>();
|
||||
texts.add(response.getMsg());
|
||||
List<Message> messagelist = new ArrayList<>();
|
||||
messagelist.add(m);
|
||||
m.setMessages(texts);
|
||||
container.setMessages(messagelist);
|
||||
return container;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
public ServiceResponse<KieContainerResource> activateContainer(String id) {
|
||||
ServiceResponse<KieContainerResource> response = server.activateContainer(id);
|
||||
|
||||
return response;
|
||||
}
|
||||
|
||||
|
||||
public ServiceResponse<KieContainerResource> deactivateContainer(String id) {
|
||||
ServiceResponse<KieContainerResource> response = server.deactivateContainer(id);
|
||||
return response;
|
||||
}
|
||||
|
||||
public ServiceResponse<KieContainerResource> getContainerInfo(String id) {
|
||||
ServiceResponse<KieContainerResource> result = server.getContainerInfo(id);
|
||||
return result;
|
||||
}
|
||||
|
||||
public ServiceResponse<Void> disposeContainer(String id) {
|
||||
ServiceResponse<Void> result = server.disposeContainer(id);
|
||||
String serverName = System.getProperty("org.kie.server.id");
|
||||
ContainerPojoPersist element = containerRepository.findByServerNameAndContainerId(serverName, id);
|
||||
if (element!= null){
|
||||
containerRepository.delete(element);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
public ServiceResponse<KieServerStateInfo> getServerState(@Context HttpHeaders headers) {
|
||||
ServiceResponse<KieServerStateInfo> result = server.getServerState();
|
||||
return result;
|
||||
}
|
||||
|
||||
public boolean readycheck() {
|
||||
boolean result = server.isKieServerReady();
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
public List<Message> healthcheck(boolean report) {
|
||||
List<Message> healthMessages = server.healthCheck(report);
|
||||
|
||||
|
||||
return healthMessages;
|
||||
}
|
||||
|
||||
private Class getClassFromName(Set<Class<?>> classes, String name) {
|
||||
Class result = null;
|
||||
for (Class c : classes) {
|
||||
if (c.getCanonicalName() != null
|
||||
&& c.getCanonicalName().equals(name)) {
|
||||
result = c;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,163 @@
|
|||
package org.chtijbug.drools.proxy.service;
|
||||
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import org.apache.commons.io.FileUtils;
|
||||
import org.chtijbug.drools.kieserver.extension.KieServerAddOnElement;
|
||||
import org.chtijbug.drools.kieserver.extension.KieServerLoggingDefinition;
|
||||
import org.chtijbug.drools.logging.SessionExecution;
|
||||
import org.chtijbug.drools.proxy.persistence.ContainerRepository;
|
||||
import org.chtijbug.kieserver.services.drools.ChtijbugObjectRequest;
|
||||
import org.chtijbug.kieserver.services.drools.DroolsChtijbugKieServerExtension;
|
||||
import org.chtijbug.kieserver.services.drools.DroolsChtijbugRulesExecutionService;
|
||||
import org.kie.server.services.api.KieContainerInstance;
|
||||
import org.kie.server.services.api.KieServerExtension;
|
||||
import org.kie.server.services.api.KieServerRegistry;
|
||||
import org.kie.server.services.impl.KieServerImpl;
|
||||
import org.kie.server.services.impl.KieServerLocator;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
|
||||
@Service("ruleService")
|
||||
public class RuleService {
|
||||
|
||||
private DroolsChtijbugRulesExecutionService droolsChtijbugRulesExecutionService = null;
|
||||
|
||||
private DroolsChtijbugKieServerExtension droolsChtijbugKieServerExtension;
|
||||
|
||||
private KieServerRegistry registry;
|
||||
private ObjectMapper mapper = new ObjectMapper();
|
||||
|
||||
private KieServerImpl server;
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(RuleService.class);
|
||||
|
||||
|
||||
|
||||
public RuleService() {
|
||||
this.server = KieServerLocator.getInstance();
|
||||
List<KieServerExtension> serverExtensions = this.server.getServerExtensions();
|
||||
for (KieServerExtension serverExtension : serverExtensions) {
|
||||
if (serverExtension instanceof DroolsChtijbugKieServerExtension) {
|
||||
droolsChtijbugKieServerExtension = (DroolsChtijbugKieServerExtension) serverExtension;
|
||||
if (droolsChtijbugRulesExecutionService == null) {
|
||||
|
||||
droolsChtijbugRulesExecutionService = droolsChtijbugKieServerExtension.getRulesExecutionService();
|
||||
}
|
||||
if (registry == null) {
|
||||
registry = droolsChtijbugRulesExecutionService.getContext();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public Object runSessionObject(String id, String processID, Object input) throws IOException {
|
||||
KieContainerInstance kci = registry.getContainer(id);
|
||||
ChtijbugObjectRequest chtijbugObjectRequest = new ChtijbugObjectRequest();
|
||||
chtijbugObjectRequest.setObjectRequest(input);
|
||||
KieServerAddOnElement kieServerAddOnElement = droolsChtijbugRulesExecutionService.getKieServerAddOnElement();
|
||||
if (kieServerAddOnElement != null) {
|
||||
for (KieServerLoggingDefinition kieServerLoggingDefinition : kieServerAddOnElement.getKieServerLoggingDefinitions()) {
|
||||
kieServerLoggingDefinition.OnFireAllrulesStart(kci.getKieContainer().getReleaseId().getGroupId(), kci.getKieContainer().getReleaseId().getArtifactId(), kci.getKieContainer().getReleaseId().getVersion(), input);
|
||||
}
|
||||
}
|
||||
ChtijbugObjectRequest chtijbutObjectResponse = droolsChtijbugRulesExecutionService.FireAllRulesAndStartProcess(kci, chtijbugObjectRequest, processID);
|
||||
/**
|
||||
* remove facts from logging to avoid infinite loop when marshalling to json and size of logging
|
||||
*/
|
||||
SessionExecution sessionExecution = chtijbutObjectResponse.getSessionLogging().getSessionExecution();
|
||||
sessionExecution.getFacts().clear();
|
||||
if (kieServerAddOnElement != null) {
|
||||
|
||||
for (KieServerLoggingDefinition kieServerLoggingDefinition : kieServerAddOnElement.getKieServerLoggingDefinitions()) {
|
||||
kieServerLoggingDefinition.OnFireAllrulesEnd(kci.getKieContainer().getReleaseId().getGroupId(), kci.getKieContainer().getReleaseId().getArtifactId(), kci.getKieContainer().getReleaseId().getVersion(), chtijbutObjectResponse.getObjectRequest(), chtijbutObjectResponse.getSessionLogging());
|
||||
}
|
||||
}
|
||||
String jsonInString = null;
|
||||
String filetrace = System.getProperty("org.chtijbug.server.tracelog");
|
||||
if ("true".equals(filetrace)) {
|
||||
try {
|
||||
Class foundClass = input.getClass();
|
||||
Method traceMethod = foundClass.getMethod("logTrace", String.class);
|
||||
if (traceMethod != null) {
|
||||
jsonInString = mapper.writeValueAsString(chtijbutObjectResponse.getSessionLogging());
|
||||
}
|
||||
traceMethod.invoke(input, jsonInString);
|
||||
} catch (Exception e) {
|
||||
|
||||
}
|
||||
}
|
||||
String fileTemp = System.getProperty("org.chtijbug.server.tracedir");
|
||||
if (fileTemp != null) {
|
||||
if (jsonInString == null) {
|
||||
jsonInString = mapper.writeValueAsString(chtijbutObjectResponse.getSessionLogging());
|
||||
}
|
||||
File traceFile = new File(fileTemp + "/" + UUID.randomUUID().toString());
|
||||
FileUtils.writeStringToFile(traceFile, jsonInString);
|
||||
}
|
||||
|
||||
Object response = chtijbutObjectResponse.getObjectRequest();
|
||||
return response;
|
||||
}
|
||||
|
||||
public String runSession(String id, String processID, String className,
|
||||
String objectRequest) {
|
||||
|
||||
|
||||
ClassLoader localClassLoader = null;
|
||||
Object response = null;
|
||||
try {
|
||||
localClassLoader = Thread.currentThread()
|
||||
.getContextClassLoader();
|
||||
} catch (ClassCastException e) {
|
||||
logger.info("GenericResource.runSession", e);
|
||||
}
|
||||
ChtijbugObjectRequest chtijbugObjectRequest = new ChtijbugObjectRequest();
|
||||
try {
|
||||
|
||||
KieContainerInstance kci = registry.getContainer(id);
|
||||
|
||||
Set<Class<?>> classes = kci.getExtraClasses();
|
||||
Class foundClass = this.getClassFromName(classes, className);
|
||||
if (foundClass != null) {
|
||||
ClassLoader classLoader = foundClass.getClassLoader();
|
||||
Object input = mapper.readValue(objectRequest, classLoader.loadClass(className));
|
||||
response = this.runSessionObject(id, processID, input);
|
||||
}
|
||||
//response.setSessionLogging(jsonInString);
|
||||
logger.debug("Returning OK response with content '{}'", response);
|
||||
String responseText = mapper.writeValueAsString(response);
|
||||
return responseText;
|
||||
} catch (Exception e) {
|
||||
// in case marshalling failed return the FireAllRulesAndStartProcess container response to keep backward compatibility
|
||||
String responseMessage = "Execution failed with error : " + e.getMessage();
|
||||
logger.debug("Returning Failure response with content '{}'", responseMessage);
|
||||
return objectRequest;
|
||||
} finally {
|
||||
if (localClassLoader != null) {
|
||||
Thread.currentThread().setContextClassLoader(localClassLoader);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private Class getClassFromName(Set<Class<?>> classes, String name) {
|
||||
Class result = null;
|
||||
for (Class c : classes) {
|
||||
if (c.getCanonicalName() != null
|
||||
&& c.getCanonicalName().equals(name)) {
|
||||
result = c;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
|
@ -19,19 +19,6 @@ server.port=8090
|
|||
camel.springboot.name=MyCamel
|
||||
# to reconfigure the camel servlet context-path mapping to use /api/* instead of /camel/*
|
||||
camel.component.servlet.mapping.context-path=/api/*
|
||||
# rest can also be configured here instead in the CamelRouter class
|
||||
# rest DSL configuration
|
||||
#camel.rest.component=servlet
|
||||
#camel.rest.binding-mode=json
|
||||
#camel.rest.data-format-property[prettyPrint]=true
|
||||
#camel.rest.enable-cors=true
|
||||
#camel.rest.port=${server.port:8080}
|
||||
#camel.rest.context-path=/api
|
||||
# rest DSL api-doc configuration
|
||||
#camel.rest.api-context-path=/api-doc
|
||||
#camel.rest.api-property[api.title]=User API
|
||||
#camel.rest.api-property[api.version]=1.0.0
|
||||
# to configure logging levels
|
||||
#logging.level.org.springframework = INFO
|
||||
#logging.level.org.apache.camel.spring.boot = INFO
|
||||
#logging.level.org.apache.camel.impl = DEBUG
|
||||
|
||||
spring.data.mongodb.database=businessProxyDB
|
||||
spring.data.mongodb.host=localhost:27017
|
||||
|
|
|
|||
|
|
@ -1,15 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4">
|
||||
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8">
|
||||
<output url="file://$MODULE_DIR$/target/classes" />
|
||||
<output-test url="file://$MODULE_DIR$/target/test-classes" />
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/target" />
|
||||
</content>
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
</component>
|
||||
</module>
|
||||
|
|
@ -0,0 +1,40 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4">
|
||||
<component name="FacetManager">
|
||||
<facet type="Spring" name="Spring">
|
||||
<configuration />
|
||||
</facet>
|
||||
</component>
|
||||
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8">
|
||||
<output url="file://$MODULE_DIR$/target/classes" />
|
||||
<output-test url="file://$MODULE_DIR$/target/test-classes" />
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/target" />
|
||||
</content>
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-data-mongodb:2.1.0.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter:2.1.0.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot:2.1.0.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-autoconfigure:2.1.0.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: javax.annotation:javax.annotation-api:1.3.2" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework:spring-core:5.1.2.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework:spring-jcl:5.1.2.RELEASE" level="project" />
|
||||
<orderEntry type="library" scope="RUNTIME" name="Maven: org.yaml:snakeyaml:1.23" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.mongodb:mongodb-driver:3.8.2" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.mongodb:bson:3.8.2" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.mongodb:mongodb-driver-core:3.8.2" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.data:spring-data-mongodb:2.1.2.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework:spring-tx:5.1.2.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework:spring-context:5.1.2.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework:spring-aop:5.1.2.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework:spring-beans:5.1.2.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework:spring-expression:5.1.2.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.data:spring-data-commons:2.1.2.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.slf4j:slf4j-api:1.7.25" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-annotations:2.9.7" level="project" />
|
||||
</component>
|
||||
</module>
|
||||
|
|
@ -0,0 +1,39 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<parent>
|
||||
<artifactId>drools-framework-business-proxy-parent</artifactId>
|
||||
<groupId>com.pymmasoftware.jbpm</groupId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>drools-framewwork-business-proxy-persistence</artifactId>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-data-mongodb</artifactId>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-logging</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
<version>${spring.boot-version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.core</groupId>
|
||||
<artifactId>jackson-annotations</artifactId>
|
||||
<version>2.9.7</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.core</groupId>
|
||||
<artifactId>jackson-annotations</artifactId>
|
||||
<version>2.9.7</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
|
|
@ -0,0 +1,20 @@
|
|||
package org.chtijbug.drools.proxy.persistence;
|
||||
|
||||
import org.chtijbug.drools.proxy.persistence.model.ContainerPojoPersist;
|
||||
import org.springframework.data.mongodb.repository.MongoRepository;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Repository
|
||||
public interface ContainerRepository extends MongoRepository<ContainerPojoPersist, String> {
|
||||
|
||||
|
||||
ContainerPojoPersist findByServerNameAndContainerId(String serverName,String containerId);
|
||||
|
||||
List<ContainerPojoPersist> findByContainerId(String containerId);
|
||||
|
||||
List<ContainerPojoPersist> findByServerName(String serverName);
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,75 @@
|
|||
package org.chtijbug.drools.proxy.persistence.model;
|
||||
|
||||
import org.springframework.data.annotation.Id;
|
||||
import org.springframework.data.mongodb.core.index.Indexed;
|
||||
import org.springframework.data.mongodb.core.mapping.Document;
|
||||
|
||||
@Document
|
||||
public class ContainerPojoPersist {
|
||||
|
||||
@Id
|
||||
private String id;
|
||||
|
||||
|
||||
@Indexed
|
||||
private String className;
|
||||
@Indexed
|
||||
private String containerId;
|
||||
@Indexed
|
||||
private String serverName;
|
||||
|
||||
|
||||
private String projectName;
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getClassName() {
|
||||
return className;
|
||||
}
|
||||
|
||||
public void setClassName(String className) {
|
||||
this.className = className;
|
||||
}
|
||||
|
||||
public String getContainerId() {
|
||||
return containerId;
|
||||
}
|
||||
|
||||
public void setContainerId(String containerId) {
|
||||
this.containerId = containerId;
|
||||
}
|
||||
|
||||
public String getServerName() {
|
||||
return serverName;
|
||||
}
|
||||
|
||||
public void setServerName(String serverName) {
|
||||
this.serverName = serverName;
|
||||
}
|
||||
|
||||
public String getProjectName() {
|
||||
return projectName;
|
||||
}
|
||||
|
||||
public void setProjectName(String projectName) {
|
||||
this.projectName = projectName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
final StringBuffer sb = new StringBuffer("ContainerPojoPersist{");
|
||||
sb.append("id='").append(id).append('\'');
|
||||
sb.append(", className='").append(className).append('\'');
|
||||
sb.append(", containerId='").append(containerId).append('\'');
|
||||
sb.append(", serverName='").append(serverName).append('\'');
|
||||
sb.append(", projectName='").append(projectName).append('\'');
|
||||
sb.append('}');
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
||||
|
|
@ -11,7 +11,14 @@
|
|||
|
||||
<artifactId>drools-framework-business-proxy-parent</artifactId>
|
||||
<packaging>pom</packaging>
|
||||
|
||||
<properties>
|
||||
<category>Rest</category>
|
||||
<spring.boot-version>2.1.0.RELEASE</spring.boot-version>
|
||||
<camel.version>2.23.0</camel.version>
|
||||
</properties>
|
||||
<modules>
|
||||
<module>drools-framework-business-proxy-app</module>
|
||||
<module>drools-framewwork-business-proxy-persistence</module>
|
||||
</modules>
|
||||
</project>
|
||||
Loading…
Add table
editor.link_modal.header
Reference in a new issue