commit
bd9fab09ad
54 changed files with 2020 additions and 1087 deletions
|
|
@ -216,7 +216,102 @@ services:
|
||||||
command: mongod
|
command: mongod
|
||||||
restart: always
|
restart: always
|
||||||
|
|
||||||
|
zoo1:
|
||||||
|
image: zookeeper:3.4.9
|
||||||
|
hostname: zoo1
|
||||||
|
ports:
|
||||||
|
- "2181:2181"
|
||||||
|
environment:
|
||||||
|
ZOO_MY_ID: 1
|
||||||
|
ZOO_PORT: 2181
|
||||||
|
ZOO_SERVERS: server.1=zoo1:2888:3888 server.2=zoo2:2888:3888 server.3=zoo3:2888:3888
|
||||||
|
volumes:
|
||||||
|
- zoo1_data:/data
|
||||||
|
- zoo1_data_datalog:/datalog
|
||||||
|
|
||||||
|
zoo2:
|
||||||
|
image: zookeeper:3.4.9
|
||||||
|
hostname: zoo2
|
||||||
|
ports:
|
||||||
|
- "2182:2182"
|
||||||
|
environment:
|
||||||
|
ZOO_MY_ID: 2
|
||||||
|
ZOO_PORT: 2182
|
||||||
|
ZOO_SERVERS: server.1=zoo1:2888:3888 server.2=zoo2:2888:3888 server.3=zoo3:2888:3888
|
||||||
|
volumes:
|
||||||
|
- zoo2_data:/data
|
||||||
|
- zoo2_data_datalog:/datalog
|
||||||
|
|
||||||
|
zoo3:
|
||||||
|
image: zookeeper:3.4.9
|
||||||
|
hostname: zoo3
|
||||||
|
ports:
|
||||||
|
- "2183:2183"
|
||||||
|
environment:
|
||||||
|
ZOO_MY_ID: 3
|
||||||
|
ZOO_PORT: 2183
|
||||||
|
ZOO_SERVERS: server.1=zoo1:2888:3888 server.2=zoo2:2888:3888 server.3=zoo3:2888:3888
|
||||||
|
volumes:
|
||||||
|
- zoo3_data:/data
|
||||||
|
- zoo3_data_datalog:/datalog
|
||||||
|
|
||||||
|
|
||||||
|
kafka1:
|
||||||
|
image: confluentinc/cp-kafka:5.5.0
|
||||||
|
hostname: kafka1
|
||||||
|
ports:
|
||||||
|
- "9092:9092"
|
||||||
|
environment:
|
||||||
|
KAFKA_ADVERTISED_LISTENERS: LISTENER_DOCKER_INTERNAL://kafka1:19092,LISTENER_DOCKER_EXTERNAL://${DOCKER_HOST_IP:-127.0.0.1}:9092
|
||||||
|
KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: LISTENER_DOCKER_INTERNAL:PLAINTEXT,LISTENER_DOCKER_EXTERNAL:PLAINTEXT
|
||||||
|
KAFKA_INTER_BROKER_LISTENER_NAME: LISTENER_DOCKER_INTERNAL
|
||||||
|
KAFKA_ZOOKEEPER_CONNECT: "zoo1:2181,zoo2:2182,zoo3:2183"
|
||||||
|
KAFKA_BROKER_ID: 1
|
||||||
|
KAFKA_LOG4J_LOGGERS: "kafka.controller=INFO,kafka.producer.async.DefaultEventHandler=INFO,state.change.logger=INFO"
|
||||||
|
volumes:
|
||||||
|
- kafka1_data:/var/lib/kafka/data
|
||||||
|
depends_on:
|
||||||
|
- zoo1
|
||||||
|
- zoo2
|
||||||
|
- zoo3
|
||||||
|
|
||||||
|
kafka2:
|
||||||
|
image: confluentinc/cp-kafka:5.5.0
|
||||||
|
hostname: kafka2
|
||||||
|
ports:
|
||||||
|
- "9093:9093"
|
||||||
|
environment:
|
||||||
|
KAFKA_ADVERTISED_LISTENERS: LISTENER_DOCKER_INTERNAL://kafka2:19093,LISTENER_DOCKER_EXTERNAL://${DOCKER_HOST_IP:-127.0.0.1}:9093
|
||||||
|
KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: LISTENER_DOCKER_INTERNAL:PLAINTEXT,LISTENER_DOCKER_EXTERNAL:PLAINTEXT
|
||||||
|
KAFKA_INTER_BROKER_LISTENER_NAME: LISTENER_DOCKER_INTERNAL
|
||||||
|
KAFKA_ZOOKEEPER_CONNECT: "zoo1:2181,zoo2:2182,zoo3:2183"
|
||||||
|
KAFKA_BROKER_ID: 2
|
||||||
|
KAFKA_LOG4J_LOGGERS: "kafka.controller=INFO,kafka.producer.async.DefaultEventHandler=INFO,state.change.logger=INFO"
|
||||||
|
volumes:
|
||||||
|
- kafka2_data:/var/lib/kafka/data
|
||||||
|
depends_on:
|
||||||
|
- zoo1
|
||||||
|
- zoo2
|
||||||
|
- zoo3
|
||||||
|
|
||||||
|
kafka3:
|
||||||
|
image: confluentinc/cp-kafka:5.5.0
|
||||||
|
hostname: kafka3
|
||||||
|
ports:
|
||||||
|
- "9094:9094"
|
||||||
|
environment:
|
||||||
|
KAFKA_ADVERTISED_LISTENERS: LISTENER_DOCKER_INTERNAL://kafka3:19094,LISTENER_DOCKER_EXTERNAL://${DOCKER_HOST_IP:-127.0.0.1}:9094
|
||||||
|
KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: LISTENER_DOCKER_INTERNAL:PLAINTEXT,LISTENER_DOCKER_EXTERNAL:PLAINTEXT
|
||||||
|
KAFKA_INTER_BROKER_LISTENER_NAME: LISTENER_DOCKER_INTERNAL
|
||||||
|
KAFKA_ZOOKEEPER_CONNECT: "zoo1:2181,zoo2:2182,zoo3:2183"
|
||||||
|
KAFKA_BROKER_ID: 3
|
||||||
|
KAFKA_LOG4J_LOGGERS: "kafka.controller=INFO,kafka.producer.async.DefaultEventHandler=INFO,state.change.logger=INFO"
|
||||||
|
volumes:
|
||||||
|
- kafka3_data:/var/lib/kafka/data
|
||||||
|
depends_on:
|
||||||
|
- zoo1
|
||||||
|
- zoo2
|
||||||
|
- zoo3
|
||||||
|
|
||||||
volumes:
|
volumes:
|
||||||
mongodb:
|
mongodb:
|
||||||
|
|
@ -224,3 +319,12 @@ volumes:
|
||||||
gitdata:
|
gitdata:
|
||||||
lucenedata:
|
lucenedata:
|
||||||
kieserverdir:
|
kieserverdir:
|
||||||
|
zoo1_data:
|
||||||
|
zoo2_data:
|
||||||
|
zoo3_data:
|
||||||
|
zoo1_data_datalog:
|
||||||
|
zoo2_data_datalog:
|
||||||
|
zoo3_data_datalog:
|
||||||
|
kafka1_data:
|
||||||
|
kafka2_data:
|
||||||
|
kafka3_data:
|
||||||
|
|
@ -13,8 +13,8 @@
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
<vaadin.version>12.0.5</vaadin.version>
|
<vaadin.version>12.0.5</vaadin.version>
|
||||||
<spring-boot.version>2.1.2.RELEASE</spring-boot.version>
|
<spring-boot.version>${spring.boot.version}</spring-boot.version>
|
||||||
<spring-version>5.1.2.RELEASE</spring-version>
|
<spring-version>${spring.version}</spring-version>
|
||||||
<webapp.directory>src/main/webapp</webapp.directory>
|
<webapp.directory>src/main/webapp</webapp.directory>
|
||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
|
|
@ -60,7 +60,11 @@
|
||||||
<artifactId>poi</artifactId>
|
<artifactId>poi</artifactId>
|
||||||
<version>4.0.1</version>
|
<version>4.0.1</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.kafka</groupId>
|
||||||
|
<artifactId>spring-kafka</artifactId>
|
||||||
|
<version>${kafka.version}</version>
|
||||||
|
</dependency>
|
||||||
<!-- https://mvnrepository.com/artifact/org.apache.poi/poi-ooxml -->
|
<!-- https://mvnrepository.com/artifact/org.apache.poi/poi-ooxml -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.apache.poi</groupId>
|
<groupId>org.apache.poi</groupId>
|
||||||
|
|
@ -111,10 +115,6 @@
|
||||||
</exclusion>
|
</exclusion>
|
||||||
</exclusions>
|
</exclusions>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
|
||||||
<groupId>com.vaadin</groupId>
|
|
||||||
<artifactId>vaadin-core</artifactId>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.vaadin</groupId>
|
<groupId>com.vaadin</groupId>
|
||||||
<artifactId>vaadin-upload-flow</artifactId>
|
<artifactId>vaadin-upload-flow</artifactId>
|
||||||
|
|
@ -129,11 +129,6 @@
|
||||||
<version>1.1.0</version>
|
<version>1.1.0</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.vaadin</groupId>
|
|
||||||
<artifactId>vaadin-spring</artifactId>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>spring-boot-autoconfigure</artifactId>
|
<artifactId>spring-boot-autoconfigure</artifactId>
|
||||||
|
|
@ -149,22 +144,36 @@
|
||||||
<artifactId>uberfire-rest-client</artifactId>
|
<artifactId>uberfire-rest-client</artifactId>
|
||||||
<version>${jbpm.version}</version>
|
<version>${jbpm.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.kie.server</groupId>
|
||||||
|
<artifactId>kie-server-controller-api</artifactId>
|
||||||
|
<version>${jbpm.version}</version>
|
||||||
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework</groupId>
|
<groupId>org.springframework</groupId>
|
||||||
<artifactId>spring-context</artifactId>
|
<artifactId>spring-context</artifactId>
|
||||||
<version>${spring-version}</version>
|
<version>${spring-version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.fasterxml.jackson.core</groupId>
|
<groupId>com.fasterxml.jackson.core</groupId>
|
||||||
<artifactId>jackson-core</artifactId>
|
<artifactId>jackson-core</artifactId>
|
||||||
<version>2.9.4</version>
|
<version>2.10.3</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.fasterxml.jackson.core</groupId>
|
<groupId>com.fasterxml.jackson.core</groupId>
|
||||||
<artifactId>jackson-annotations</artifactId>
|
<artifactId>jackson-annotations</artifactId>
|
||||||
<version>2.9.4</version>
|
<version>2.10.3</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.fasterxml.jackson.module</groupId>
|
||||||
|
<artifactId>jackson-module-jaxb-annotations</artifactId>
|
||||||
|
<version>2.10.3</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-web</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.fasterxml.jackson.dataformat</groupId>
|
<groupId>com.fasterxml.jackson.dataformat</groupId>
|
||||||
|
|
|
||||||
|
|
@ -1,32 +1,85 @@
|
||||||
package org.chtijbug.drools.console;
|
package org.chtijbug.drools.console;
|
||||||
|
|
||||||
|
|
||||||
|
import org.apache.kafka.clients.admin.AdminClientConfig;
|
||||||
|
import org.apache.kafka.clients.admin.NewTopic;
|
||||||
|
import org.apache.kafka.clients.consumer.ConsumerConfig;
|
||||||
|
import org.apache.kafka.clients.producer.ProducerConfig;
|
||||||
|
import org.apache.kafka.common.serialization.StringDeserializer;
|
||||||
|
import org.apache.kafka.common.serialization.StringSerializer;
|
||||||
|
import org.chtijbug.drools.KieContainerResponse;
|
||||||
|
import org.chtijbug.drools.KieContainerUpdate;
|
||||||
|
import org.chtijbug.drools.ReverseProxyUpdate;
|
||||||
|
import org.chtijbug.drools.common.KafkaTopicConstants;
|
||||||
import org.chtijbug.drools.console.middle.DababaseContentInit;
|
import org.chtijbug.drools.console.middle.DababaseContentInit;
|
||||||
import org.chtijbug.drools.console.service.model.kie.KieConfigurationData;
|
import org.chtijbug.drools.console.service.model.kie.KieConfigurationData;
|
||||||
import org.chtijbug.drools.console.service.util.ApplicationContextProvider;
|
import org.chtijbug.drools.console.service.util.ApplicationContextProvider;
|
||||||
|
import org.chtijbug.drools.console.service.wbconnector.KieBusinessCentralConnector;
|
||||||
|
import org.chtijbug.drools.proxy.persistence.model.ProjectPersist;
|
||||||
|
import org.chtijbug.drools.proxy.persistence.repository.ProjectRepository;
|
||||||
|
import org.kie.server.api.model.KieContainerResource;
|
||||||
|
import org.kie.server.controller.api.model.KieServerSetup;
|
||||||
|
import org.kie.server.controller.api.model.runtime.ServerInstanceKey;
|
||||||
|
import org.kie.server.controller.api.model.runtime.ServerInstanceKeyList;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.boot.SpringApplication;
|
import org.springframework.boot.SpringApplication;
|
||||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||||
import org.springframework.boot.builder.SpringApplicationBuilder;
|
import org.springframework.boot.builder.SpringApplicationBuilder;
|
||||||
import org.springframework.boot.context.event.ApplicationReadyEvent;
|
|
||||||
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
|
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
|
||||||
import org.springframework.context.annotation.*;
|
import org.springframework.context.annotation.Bean;
|
||||||
import org.springframework.context.event.EventListener;
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
import org.springframework.context.annotation.PropertySource;
|
||||||
import org.springframework.data.mongodb.repository.config.EnableMongoRepositories;
|
import org.springframework.data.mongodb.repository.config.EnableMongoRepositories;
|
||||||
|
import org.springframework.kafka.annotation.EnableKafka;
|
||||||
|
import org.springframework.kafka.config.ConcurrentKafkaListenerContainerFactory;
|
||||||
|
import org.springframework.kafka.core.*;
|
||||||
|
import org.springframework.kafka.support.serializer.JsonDeserializer;
|
||||||
|
import org.springframework.kafka.support.serializer.JsonSerializer;
|
||||||
|
import org.springframework.web.servlet.config.annotation.CorsRegistry;
|
||||||
|
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
||||||
|
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
@Configuration
|
@Configuration
|
||||||
@SpringBootApplication
|
@SpringBootApplication
|
||||||
@EnableMongoRepositories("org.chtijbug.drools.proxy.persistence.repository")
|
@EnableMongoRepositories("org.chtijbug.drools.proxy.persistence.repository")
|
||||||
|
@EnableKafka
|
||||||
@PropertySource("classpath:application.properties")
|
@PropertySource("classpath:application.properties")
|
||||||
public class DroolsSpringBootConsoleApplication extends SpringBootServletInitializer {
|
public class DroolsSpringBootConsoleApplication extends SpringBootServletInitializer {
|
||||||
|
|
||||||
@Value("${kie-wb.baseurl}")
|
@Value("${kie-wb.baseurl}")
|
||||||
private String kiewbUrl;
|
private String kiewbUrl;
|
||||||
|
|
||||||
|
@Value(value = "${kafka.bootstrapAddress}")
|
||||||
|
private String bootstrapAddress;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private DababaseContentInit dababaseContentInit;
|
private DababaseContentInit dababaseContentInit;
|
||||||
|
@Autowired
|
||||||
|
private KieBusinessCentralConnector kieBusinessCentralConnector;
|
||||||
|
@Autowired
|
||||||
|
private ProjectRepository projectRepository;
|
||||||
|
|
||||||
|
|
||||||
|
@Bean
|
||||||
|
public WebMvcConfigurer corsConfigurer() {
|
||||||
|
return new WebMvcConfigurerAdapter() {
|
||||||
|
@Override
|
||||||
|
public void addCorsMappings(CorsRegistry registry) {
|
||||||
|
super.addCorsMappings(registry);
|
||||||
|
registry.addMapping("/**")
|
||||||
|
.allowedOrigins("*")
|
||||||
|
.allowedMethods("GET", "POST", "OPTIONS", "DELETE", "PUT")
|
||||||
|
.allowedHeaders("Access-Control-Allow-Origin", "*")
|
||||||
|
.exposedHeaders("Access-Token", "Access-Control-Allow-Origin")
|
||||||
|
.allowCredentials(false).maxAge(3600);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@Bean(name = "applicationContext")
|
@Bean(name = "applicationContext")
|
||||||
public ApplicationContextProvider getAppplicationContext() {
|
public ApplicationContextProvider getAppplicationContext() {
|
||||||
|
|
@ -45,13 +98,109 @@ public class DroolsSpringBootConsoleApplication extends SpringBootServletInitial
|
||||||
return application.sources(DroolsSpringBootConsoleApplication.class);
|
return application.sources(DroolsSpringBootConsoleApplication.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Bean
|
||||||
|
public KafkaAdmin kafkaAdmin() {
|
||||||
|
Map<String, Object> configs = new HashMap<>();
|
||||||
|
configs.put(AdminClientConfig.BOOTSTRAP_SERVERS_CONFIG, bootstrapAddress);
|
||||||
|
return new KafkaAdmin(configs);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Bean
|
||||||
|
public NewTopic loggingTopic() {
|
||||||
|
return new NewTopic(KafkaTopicConstants.REVERSE_PROXY, 1, (short) 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Bean
|
||||||
|
public ProducerFactory<String, ReverseProxyUpdate> producerFactory() {
|
||||||
|
Map<String, Object> configProps = new HashMap<>();
|
||||||
|
configProps.put(
|
||||||
|
ProducerConfig.BOOTSTRAP_SERVERS_CONFIG,
|
||||||
|
bootstrapAddress);
|
||||||
|
configProps.put(
|
||||||
|
ProducerConfig.KEY_SERIALIZER_CLASS_CONFIG,
|
||||||
|
StringSerializer.class);
|
||||||
|
configProps.put(
|
||||||
|
ProducerConfig.VALUE_SERIALIZER_CLASS_CONFIG,
|
||||||
|
JsonSerializer.class);
|
||||||
|
return new DefaultKafkaProducerFactory<>(configProps);
|
||||||
|
}
|
||||||
|
@Bean
|
||||||
|
public ProducerFactory<String, KieContainerUpdate> producerKieContainerUpdateFactory() {
|
||||||
|
Map<String, Object> configProps = new HashMap<>();
|
||||||
|
configProps.put(
|
||||||
|
ProducerConfig.BOOTSTRAP_SERVERS_CONFIG,
|
||||||
|
bootstrapAddress);
|
||||||
|
configProps.put(
|
||||||
|
ProducerConfig.KEY_SERIALIZER_CLASS_CONFIG,
|
||||||
|
StringSerializer.class);
|
||||||
|
configProps.put(
|
||||||
|
ProducerConfig.VALUE_SERIALIZER_CLASS_CONFIG,
|
||||||
|
JsonSerializer.class);
|
||||||
|
return new DefaultKafkaProducerFactory<>(configProps);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Bean
|
||||||
|
public KafkaTemplate<String, ReverseProxyUpdate> kafkaTemplate() {
|
||||||
|
return new KafkaTemplate<>(producerFactory());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Bean
|
||||||
|
public KafkaTemplate<String, KieContainerUpdate> kafkaKieContainerUpdateTemplate() {
|
||||||
|
return new KafkaTemplate<>(producerKieContainerUpdateFactory());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public ConsumerFactory<String, KieContainerResponse> greetingConsumerFactory() {
|
||||||
|
Map<String, Object> props = new HashMap<>();
|
||||||
|
props.put(ConsumerConfig.BOOTSTRAP_SERVERS_CONFIG, bootstrapAddress);
|
||||||
|
props.put(ConsumerConfig.GROUP_ID_CONFIG,"Console");
|
||||||
|
return new DefaultKafkaConsumerFactory<>(props, new StringDeserializer(), new JsonDeserializer<>(KieContainerResponse.class));
|
||||||
|
}
|
||||||
|
@Bean
|
||||||
|
public ConcurrentKafkaListenerContainerFactory<String, KieContainerResponse>
|
||||||
|
ruleKafkaListenerKieContainerUpdateFactory() {
|
||||||
|
|
||||||
|
ConcurrentKafkaListenerContainerFactory<String, KieContainerResponse> factory =
|
||||||
|
new ConcurrentKafkaListenerContainerFactory<>();
|
||||||
|
factory.setConsumerFactory(greetingConsumerFactory());
|
||||||
|
return factory;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
SpringApplication.run(DroolsSpringBootConsoleApplication.class, args);
|
SpringApplication.run(DroolsSpringBootConsoleApplication.class, args);
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventListener(ApplicationReadyEvent.class)
|
// @EventListener(ApplicationReadyEvent.class)
|
||||||
public void InitPlatform(){
|
public void InitPlatform(){
|
||||||
dababaseContentInit.initDatabaseIfNecessary();
|
dababaseContentInit.initDatabaseIfNecessary();
|
||||||
|
Map<String,KieContainerResource> kies = new HashMap<>();
|
||||||
|
KieServerSetup kieServerSetup = kieBusinessCentralConnector.connectToBusinessCentral("nheron", "adminnheron00@");
|
||||||
|
if (kieServerSetup!= null && kieServerSetup.getContainers()!= null) {
|
||||||
|
for (KieContainerResource kieContainerResource : kieServerSetup.getContainers()) {
|
||||||
|
kies.put(kieContainerResource.getContainerId(), kieContainerResource);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (ProjectPersist projectPersist : projectRepository.findAll()){
|
||||||
|
if (projectPersist.getServerNames().size()>0){
|
||||||
|
if (!kies.containsKey(projectPersist.getContainerID())){
|
||||||
|
kieBusinessCentralConnector.createContainer("nheron", "adminnheron00@",projectPersist);
|
||||||
|
}else{
|
||||||
|
kieBusinessCentralConnector.updateContainer("nheron", "adminnheron00@",projectPersist,kies.get(projectPersist.getContainerID()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ServerInstanceKeyList serverInstanceKeyList = kieBusinessCentralConnector.getListInstances("nheron", "adminnheron00@");
|
||||||
|
if (serverInstanceKeyList!=null){
|
||||||
|
for (ServerInstanceKey serverInstanceKey : serverInstanceKeyList.getServerInstanceKeys()){
|
||||||
|
//serverInstanceKey.get
|
||||||
|
|
||||||
|
}
|
||||||
|
System.out.println("coucou");
|
||||||
|
}
|
||||||
|
System.out.println("coucou");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,7 @@ public class ElasticSearchExpose {
|
||||||
|
|
||||||
BusinessTransactionPersistence tmp=null;
|
BusinessTransactionPersistence tmp=null;
|
||||||
|
|
||||||
List<BusinessTransactionPersistence> businessTransactionPersistences = indexerService.getBusinessTransactionPersistenceRepository().findAllByTransactionId(transactionId,new PageRequest(0,5000));
|
List<BusinessTransactionPersistence> businessTransactionPersistences = indexerService.getBusinessTransactionPersistenceRepository().findAllByTransactionId(transactionId,PageRequest.of(0,5000));
|
||||||
|
|
||||||
if(businessTransactionPersistences!=null) {
|
if(businessTransactionPersistences!=null) {
|
||||||
for (BusinessTransactionPersistence b : businessTransactionPersistences) {
|
for (BusinessTransactionPersistence b : businessTransactionPersistences) {
|
||||||
|
|
@ -46,7 +46,7 @@ public class ElasticSearchExpose {
|
||||||
@RequestMapping(value = "/findActionByBusinessId", method = RequestMethod.GET)
|
@RequestMapping(value = "/findActionByBusinessId", method = RequestMethod.GET)
|
||||||
public List<BusinessTransactionAction> findActionById(@RequestParam String businessId, HttpServletRequest request, HttpServletResponse response) {
|
public List<BusinessTransactionAction> findActionById(@RequestParam String businessId, HttpServletRequest request, HttpServletResponse response) {
|
||||||
|
|
||||||
List<BusinessTransactionAction> businessTransactionPersistences = indexerService.getBusinessTransactionActionRepository().findAllByBusinessTransactionId(businessId,new Sort(new Sort.Order(Sort.Direction.ASC,"eventNumber")),new PageRequest(0,5000));
|
List<BusinessTransactionAction> businessTransactionPersistences = indexerService.getBusinessTransactionActionRepository().findAllByBusinessTransactionId(businessId,Sort.by(new Sort.Order(Sort.Direction.ASC,"eventNumber")),PageRequest.of(0,5000));
|
||||||
|
|
||||||
return businessTransactionPersistences;
|
return businessTransactionPersistences;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,9 @@ package org.chtijbug.drools.console.service;
|
||||||
|
|
||||||
import com.vaadin.flow.component.UI;
|
import com.vaadin.flow.component.UI;
|
||||||
import com.vaadin.flow.server.VaadinSession;
|
import com.vaadin.flow.server.VaadinSession;
|
||||||
|
import org.chtijbug.drools.KieContainerUpdate;
|
||||||
|
import org.chtijbug.drools.ReverseProxyUpdate;
|
||||||
|
import org.chtijbug.drools.common.KafkaTopicConstants;
|
||||||
import org.chtijbug.drools.console.AddLog;
|
import org.chtijbug.drools.console.AddLog;
|
||||||
import org.chtijbug.drools.console.service.model.UserConnected;
|
import org.chtijbug.drools.console.service.model.UserConnected;
|
||||||
import org.chtijbug.drools.console.service.model.kie.JobStatus;
|
import org.chtijbug.drools.console.service.model.kie.JobStatus;
|
||||||
|
|
@ -21,6 +24,7 @@ import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.context.annotation.DependsOn;
|
import org.springframework.context.annotation.DependsOn;
|
||||||
|
import org.springframework.kafka.core.KafkaTemplate;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
@ -56,6 +60,11 @@ public class ProjectPersistService {
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private RuntimeRepository runtimeRepository;
|
private RuntimeRepository runtimeRepository;
|
||||||
|
@Autowired
|
||||||
|
private KafkaTemplate<String, ReverseProxyUpdate> kafkaTemplateProxyUpdate;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private KafkaTemplate<String, KieContainerUpdate> kafkaKieContainerUpdateTemplate;
|
||||||
|
|
||||||
public ProjectPersistService() {
|
public ProjectPersistService() {
|
||||||
this.config = AppContext.getApplicationContext().getBean(KieConfigurationData.class);
|
this.config = AppContext.getApplicationContext().getBean(KieConfigurationData.class);
|
||||||
|
|
@ -63,18 +72,16 @@ public class ProjectPersistService {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public void saveIfnotExist(List<PlatformProjectResponse> platformProjectResponses) {
|
public void saveIfnotExist(List<PlatformProjectResponse> platformProjectResponses) {
|
||||||
|
|
||||||
for (PlatformProjectResponse platformProjectResponse : platformProjectResponses) {
|
for (PlatformProjectResponse platformProjectResponse : platformProjectResponses) {
|
||||||
|
|
||||||
ProjectPersist projectPersist = projectRepository.findByProjectNameAndBranch(new KieProject(platformProjectResponse.getSpaceName(), platformProjectResponse.getName()),platformProjectResponse.getBranch());
|
ProjectPersist projectPersist = projectRepository.findByProjectNameAndBranch(new KieProject(platformProjectResponse.getSpaceName(), platformProjectResponse.getName()), platformProjectResponse.getBranch());
|
||||||
|
|
||||||
if (projectPersist == null) {
|
if (projectPersist == null) {
|
||||||
projectPersist = platformProjectResponseToProjectPersist(platformProjectResponse);
|
projectPersist = platformProjectResponseToProjectPersist(platformProjectResponse);
|
||||||
|
|
||||||
projectPersist=projectRepository.save(projectPersist);
|
projectPersist = projectRepository.save(projectPersist);
|
||||||
addProjectToSession(projectPersist, true);
|
addProjectToSession(projectPersist, true);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -101,12 +108,12 @@ public class ProjectPersistService {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isModifiable) {
|
if (isModifiable) {
|
||||||
projectPersists.put(projectPersist.getProjectName().toString()+"-"+projectPersist.getBranch(), projectPersist);
|
projectPersists.put(projectPersist.getProjectName().toString() + "-" + projectPersist.getBranch(), projectPersist);
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
ProjectPersist tmp = projectPersists.get(projectPersist.getProjectName().toString()+"-"+projectPersist.getBranch());
|
ProjectPersist tmp = projectPersists.get(projectPersist.getProjectName().toString() + "-" + projectPersist.getBranch());
|
||||||
if (tmp == null) {
|
if (tmp == null) {
|
||||||
projectPersists.put(projectPersist.getProjectName().toString()+"-"+projectPersist.getBranch(), projectPersist);
|
projectPersists.put(projectPersist.getProjectName().toString() + "-" + projectPersist.getBranch(), projectPersist);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -117,6 +124,8 @@ public class ProjectPersistService {
|
||||||
projectPersist.setStatus(ProjectPersist.Deployable);
|
projectPersist.setStatus(ProjectPersist.Deployable);
|
||||||
projectPersist.setContainerID(projectPersist.getDeploymentName() + "-" + projectPersist.getProjectName());
|
projectPersist.setContainerID(projectPersist.getDeploymentName() + "-" + projectPersist.getProjectName());
|
||||||
projectPersist.getServerNames().clear();
|
projectPersist.getServerNames().clear();
|
||||||
|
ReverseProxyUpdate reverseProxyUpdate = new ReverseProxyUpdate();
|
||||||
|
reverseProxyUpdate.setPath("/" + projectPersist.getContainerID());
|
||||||
for (RuntimePersist runtimePersist : runtimePersists) {
|
for (RuntimePersist runtimePersist : runtimePersists) {
|
||||||
List<String> names = new ArrayList<>();
|
List<String> names = new ArrayList<>();
|
||||||
names.add(runtimePersist.getServerName());
|
names.add(runtimePersist.getServerName());
|
||||||
|
|
@ -132,14 +141,14 @@ public class ProjectPersistService {
|
||||||
newContainer.setArtifactId(projectPersist.getArtifactID());
|
newContainer.setArtifactId(projectPersist.getArtifactID());
|
||||||
newContainer.setVersion(projectPersist.getProjectVersion());
|
newContainer.setVersion(projectPersist.getProjectVersion());
|
||||||
containerRepository.save(newContainer);
|
containerRepository.save(newContainer);
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
String hostName = runtimePersist.getServerUrl() + "/api/" + projectPersist.getContainerID();
|
||||||
|
reverseProxyUpdate.getServerNames().add(hostName);
|
||||||
|
}
|
||||||
projectRepository.save(projectPersist);
|
projectRepository.save(projectPersist);
|
||||||
|
|
||||||
addProjectToSession(projectPersist, true);
|
addProjectToSession(projectPersist, true);
|
||||||
|
kafkaTemplateProxyUpdate.send(KafkaTopicConstants.REVERSE_PROXY, reverseProxyUpdate);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -164,6 +173,8 @@ public class ProjectPersistService {
|
||||||
return projectPersist;
|
return projectPersist;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public void waitForJobToBeEnded(String url, String username, String password, ProjectPersist projectPersist, AddLog workOnGoingView, UI ui) {
|
public void waitForJobToBeEnded(String url, String username, String password, ProjectPersist projectPersist, AddLog workOnGoingView, UI ui) {
|
||||||
|
|
||||||
UserConnected userConnected = userConnectedService.getUserConnected();
|
UserConnected userConnected = userConnectedService.getUserConnected();
|
||||||
|
|
@ -173,17 +184,20 @@ public class ProjectPersistService {
|
||||||
public void run() {
|
public void run() {
|
||||||
|
|
||||||
JobStatus result = kieRepositoryService.buildProject(config.getKiewbUrl(), userConnected.getUserName(),
|
JobStatus result = kieRepositoryService.buildProject(config.getKiewbUrl(), userConnected.getUserName(),
|
||||||
userConnected.getUserPassword(), projectPersist.getProjectName().getSpaceName(), projectPersist.getProjectName().getName(),projectPersist.getBranch(), "compile", workOnGoingView, ui);
|
userConnected.getUserPassword(), projectPersist.getProjectName().getSpaceName(), projectPersist.getProjectName().getName(), projectPersist.getBranch(), "compile", workOnGoingView, ui);
|
||||||
|
|
||||||
executeWrite(url, username, password, workOnGoingView, result.getJobId(), ui);
|
executeWrite(url, username, password, workOnGoingView, result.getJobId(), ui);
|
||||||
|
|
||||||
result = kieRepositoryService.buildProject(config.getKiewbUrl(), userConnected.getUserName(),
|
result = kieRepositoryService.buildProject(config.getKiewbUrl(), userConnected.getUserName(),
|
||||||
userConnected.getUserPassword(), projectPersist.getProjectName().getSpaceName(), projectPersist.getProjectName().getName(),projectPersist.getBranch(), "install", workOnGoingView, ui);
|
userConnected.getUserPassword(), projectPersist.getProjectName().getSpaceName(), projectPersist.getProjectName().getName(), projectPersist.getBranch(), "install", workOnGoingView, ui);
|
||||||
|
|
||||||
executeWrite(url, username, password, workOnGoingView, result.getJobId(), ui);
|
executeWrite(url, username, password, workOnGoingView, result.getJobId(), ui);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
for (String serverName : projectPersist.getServerNames()) {
|
for (String serverName : projectPersist.getServerNames()) {
|
||||||
|
|
||||||
|
|
||||||
List<ContainerRuntimePojoPersist> existingContainers = containerRuntimeRepository.findByServerNameAndContainerId(serverName, projectPersist.getContainerID());
|
List<ContainerRuntimePojoPersist> existingContainers = containerRuntimeRepository.findByServerNameAndContainerId(serverName, projectPersist.getContainerID());
|
||||||
if (!existingContainers.isEmpty()) {
|
if (!existingContainers.isEmpty()) {
|
||||||
for (ContainerRuntimePojoPersist containerRuntimePojoPersist : existingContainers) {
|
for (ContainerRuntimePojoPersist containerRuntimePojoPersist : existingContainers) {
|
||||||
|
|
@ -203,7 +217,15 @@ public class ProjectPersistService {
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
KieContainerUpdate kieContainerUpdate = new KieContainerUpdate();
|
||||||
|
kieContainerUpdate.setMainClass(projectPersist.getMainClass());
|
||||||
|
kieContainerUpdate.setArtifactID(projectPersist.getArtifactID());
|
||||||
|
kieContainerUpdate.setGroupID(projectPersist.getGroupID());
|
||||||
|
kieContainerUpdate.setProjectVersion(projectPersist.getProjectVersion());
|
||||||
|
kieContainerUpdate.setContainerID(projectPersist.getContainerID());
|
||||||
|
kieContainerUpdate.setAction(KieContainerUpdate.STATUS.TODEPLOY);
|
||||||
|
kafkaKieContainerUpdateTemplate.send(serverName,kieContainerUpdate);
|
||||||
|
workOnGoingView.addRow("Deploy Request="+kieContainerUpdate,ui);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
@ -230,7 +252,7 @@ public class ProjectPersistService {
|
||||||
this.wait(1000);
|
this.wait(1000);
|
||||||
}
|
}
|
||||||
} catch (InterruptedException e) {
|
} catch (InterruptedException e) {
|
||||||
logger.error("executeWrite",e);
|
logger.error("executeWrite", e);
|
||||||
Thread.currentThread().interrupt();
|
Thread.currentThread().interrupt();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,38 @@
|
||||||
|
/*
|
||||||
|
* 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.console.service.kieserver;
|
||||||
|
|
||||||
|
import org.kie.server.api.commands.CommandScript;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import javax.ws.rs.core.HttpHeaders;
|
||||||
|
import javax.ws.rs.core.MediaType;
|
||||||
|
import javax.ws.rs.core.Response;
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/server/config")
|
||||||
|
public class KieServerResource {
|
||||||
|
|
||||||
|
public KieServerResource() {
|
||||||
|
|
||||||
|
}
|
||||||
|
@PostMapping(consumes = {MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML}, produces = {MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
|
||||||
|
public Response executeCommands(@RequestHeader HttpHeaders headers,
|
||||||
|
@RequestBody CommandScript command ) {
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,184 @@
|
||||||
|
/*
|
||||||
|
* Copyright 2019 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.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* 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.console.service.kieserver;
|
||||||
|
|
||||||
|
import org.kie.server.api.model.KieContainerResourceFilter;
|
||||||
|
import org.kie.server.api.model.KieContainerStatusFilter;
|
||||||
|
import org.kie.server.api.model.KieServerInfo;
|
||||||
|
import org.kie.server.api.model.ReleaseIdFilter;
|
||||||
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import javax.ws.rs.core.HttpHeaders;
|
||||||
|
import javax.ws.rs.core.MediaType;
|
||||||
|
import javax.ws.rs.core.Response;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
|
||||||
|
import static org.kie.server.api.rest.RestURI.CONTAINER_ID;
|
||||||
|
|
||||||
|
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/server")
|
||||||
|
public class KieServerRestImpl {
|
||||||
|
|
||||||
|
@Value(value = "${org.kie.server.id}")
|
||||||
|
private String kieserverID;
|
||||||
|
|
||||||
|
@Value("${org.kie.server.controller}")
|
||||||
|
private String kiewbUrl;
|
||||||
|
|
||||||
|
@Value("${org.kie.server.location}")
|
||||||
|
private String controlerLocation;
|
||||||
|
|
||||||
|
public KieServerRestImpl() {
|
||||||
|
// for now, if no server impl is passed as parameter, create one
|
||||||
|
|
||||||
|
}
|
||||||
|
//@RequestHeader HttpHeaders headers
|
||||||
|
@GetMapping(produces = {MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
|
||||||
|
public KieServerInfo getInfo() {
|
||||||
|
KieServerInfo kieServerInfo = new KieServerInfo();
|
||||||
|
kieServerInfo.setServerId(kieserverID);
|
||||||
|
kieServerInfo.setLocation(controlerLocation);
|
||||||
|
kieServerInfo.setName(kieserverID);
|
||||||
|
kieServerInfo.setCapabilities(new ArrayList<>());
|
||||||
|
kieServerInfo.getCapabilities().add("BRM");
|
||||||
|
return kieServerInfo;
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping(path = "/containers",
|
||||||
|
produces = {MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
|
||||||
|
public Response listContainers(@RequestHeader HttpHeaders headers,
|
||||||
|
@RequestParam("groupId") String groupId,
|
||||||
|
@RequestParam("artifactId") String artifactId,
|
||||||
|
@RequestParam("version") String version,
|
||||||
|
@RequestParam("status") 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);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@PutMapping(path = "/containers/{" + CONTAINER_ID + "}",
|
||||||
|
consumes = {MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML},
|
||||||
|
produces = {MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
|
||||||
|
public Response createContainer(@RequestHeader HttpHeaders headers,
|
||||||
|
@PathVariable(CONTAINER_ID) String id,
|
||||||
|
String containerPayload) {
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@PutMapping(path = "/containers/{" + CONTAINER_ID + "}/status/activated",
|
||||||
|
consumes = {MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML},
|
||||||
|
produces = {MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
|
||||||
|
public Response activateContainer(@RequestHeader HttpHeaders headers,
|
||||||
|
@PathVariable(CONTAINER_ID) String id) {
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@PutMapping(path="/containers/{" + CONTAINER_ID + "}/status/deactivated",
|
||||||
|
consumes={MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML},
|
||||||
|
produces={MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
|
||||||
|
public Response deactivateContainer(@RequestHeader HttpHeaders headers,
|
||||||
|
@PathVariable(CONTAINER_ID) String id) {
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@GetMapping(path="/containers/{" + CONTAINER_ID + "}",
|
||||||
|
consumes={MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
|
||||||
|
public Response getContainerInfo(@RequestHeader HttpHeaders headers,
|
||||||
|
@PathVariable(CONTAINER_ID) String id) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@DeleteMapping(path="/containers/{" + CONTAINER_ID + "}",
|
||||||
|
produces={MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
|
||||||
|
public Response disposeContainer(@RequestHeader HttpHeaders headers,
|
||||||
|
@PathVariable(CONTAINER_ID) String id) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@GetMapping(path="/containers/{" + CONTAINER_ID + "}/scanner",
|
||||||
|
produces={MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
|
||||||
|
public Response getScannerInfo(@RequestHeader HttpHeaders headers,
|
||||||
|
@PathVariable(CONTAINER_ID) String id) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@PostMapping(path="/containers/{" + CONTAINER_ID + "}/scanner",
|
||||||
|
consumes={MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML},
|
||||||
|
produces={MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
|
||||||
|
public Response updateScanner(@RequestHeader HttpHeaders headers,
|
||||||
|
@PathVariable(CONTAINER_ID) String id,
|
||||||
|
String resourcePayload) {
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping(path="/containers/{" + CONTAINER_ID + "}/release-id",
|
||||||
|
produces={MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
|
||||||
|
public Response getReleaseId(@RequestHeader HttpHeaders headers,
|
||||||
|
@PathVariable(CONTAINER_ID) String id) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@PostMapping(path="/containers/{" + CONTAINER_ID + "}/release-id",
|
||||||
|
consumes={MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML},
|
||||||
|
produces={MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
|
||||||
|
public Response updateReleaseId(@RequestHeader HttpHeaders headers,
|
||||||
|
@PathVariable(CONTAINER_ID) String id,
|
||||||
|
String releaseIdPayload,
|
||||||
|
@RequestParam(value = "resetBeforeUpdate", defaultValue = "false") boolean resetBeforeUpdate) {
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping(path="/state",consumes={MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
|
||||||
|
public Response getServerState(@RequestHeader HttpHeaders headers) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@GetMapping(path="/readycheck",consumes={MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
|
||||||
|
public Response readycheck(@RequestHeader HttpHeaders headers) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping(path="/healthcheck",consumes={MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
|
||||||
|
public Response healthcheck(@RequestHeader HttpHeaders headers,
|
||||||
|
@RequestParam(value = "report", defaultValue = "false") boolean report) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,212 @@
|
||||||
|
package org.chtijbug.drools.console.service.wbconnector;
|
||||||
|
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
|
import com.fasterxml.jackson.module.jaxb.JaxbAnnotationModule;
|
||||||
|
import org.apache.commons.codec.binary.Base64;
|
||||||
|
import org.chtijbug.drools.proxy.persistence.model.ProjectPersist;
|
||||||
|
import org.kie.server.api.model.*;
|
||||||
|
import org.kie.server.controller.api.model.KieServerSetup;
|
||||||
|
import org.kie.server.controller.api.model.runtime.ServerInstanceKeyList;
|
||||||
|
import org.kie.server.controller.api.model.spec.ContainerSpec;
|
||||||
|
import org.kie.server.controller.api.model.spec.ServerTemplateKey;
|
||||||
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
|
import org.springframework.http.HttpHeaders;
|
||||||
|
import org.springframework.http.HttpMethod;
|
||||||
|
import org.springframework.http.MediaType;
|
||||||
|
import org.springframework.http.ResponseEntity;
|
||||||
|
import org.springframework.http.client.BufferingClientHttpRequestFactory;
|
||||||
|
import org.springframework.http.client.ClientHttpRequestFactory;
|
||||||
|
import org.springframework.http.client.SimpleClientHttpRequestFactory;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.util.StreamUtils;
|
||||||
|
import org.springframework.web.client.RequestCallback;
|
||||||
|
import org.springframework.web.client.RestTemplate;
|
||||||
|
|
||||||
|
import java.nio.charset.Charset;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.Scanner;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class KieBusinessCentralConnector {
|
||||||
|
|
||||||
|
@Value(value = "${org.kie.server.id}")
|
||||||
|
private String kieserverID;
|
||||||
|
|
||||||
|
@Value("${org.kie.server.controller}")
|
||||||
|
private String kiewbUrl;
|
||||||
|
|
||||||
|
@Value("${org.kie.server.location}")
|
||||||
|
private String controlerLocation;
|
||||||
|
|
||||||
|
private RestTemplate restTemplateKiewb ;
|
||||||
|
private ObjectMapper mapper = new ObjectMapper();
|
||||||
|
|
||||||
|
public KieBusinessCentralConnector() {
|
||||||
|
ClientHttpRequestFactory factory = new BufferingClientHttpRequestFactory(new SimpleClientHttpRequestFactory());
|
||||||
|
restTemplateKiewb= new RestTemplate(factory);
|
||||||
|
restTemplateKiewb.setInterceptors(Collections.singletonList(new LoggingRequestResponseLoggingInterceptor()));
|
||||||
|
mapper.registerModule(new JaxbAnnotationModule());
|
||||||
|
}
|
||||||
|
|
||||||
|
public String createContainer(String username, String password, ProjectPersist projectPersist){
|
||||||
|
String completeurl=kiewbUrl+"/controller/management/servers/"+kieserverID+"/containers/"+projectPersist.getContainerID();
|
||||||
|
ContainerSpec containerSpec = new ContainerSpec();
|
||||||
|
containerSpec.setId(projectPersist.getContainerID());
|
||||||
|
containerSpec.setContainerName(projectPersist.getContainerID());
|
||||||
|
containerSpec.setReleasedId(new ReleaseId());
|
||||||
|
containerSpec.setStatus(KieContainerStatus.STARTED);
|
||||||
|
containerSpec.getReleasedId().setArtifactId(projectPersist.getArtifactID());
|
||||||
|
containerSpec.getReleasedId().setGroupId(projectPersist.getGroupID());
|
||||||
|
containerSpec.getReleasedId().setVersion(projectPersist.getProjectVersion());
|
||||||
|
|
||||||
|
ResponseEntity<String> response = restTemplateKiewb
|
||||||
|
.execute(completeurl, HttpMethod.PUT, requestCallback(containerSpec, username, password), clientHttpResponse -> {
|
||||||
|
String extractedResponse = null;
|
||||||
|
ResponseEntity<String> extractedValue=null;
|
||||||
|
if (clientHttpResponse.getBody() != null) {
|
||||||
|
Scanner s = new Scanner(clientHttpResponse.getBody()).useDelimiter("\\A");
|
||||||
|
String result = s.hasNext() ? s.next() : "";
|
||||||
|
if (result==null || result.length()==0){
|
||||||
|
|
||||||
|
}else {
|
||||||
|
extractedResponse = mapper.readValue(result, String.class);
|
||||||
|
extractedValue = new ResponseEntity<>(extractedResponse, clientHttpResponse.getHeaders(), clientHttpResponse.getStatusCode());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return extractedValue;
|
||||||
|
});
|
||||||
|
if (response!= null) {
|
||||||
|
return response.getBody();
|
||||||
|
}else {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public String updateContainer(String username, String password, ProjectPersist projectPersist, KieContainerResource kieContainerResource){
|
||||||
|
String completeurl=kiewbUrl+"/controller/management/servers/"+kieserverID+"/containers/"+projectPersist.getContainerID();
|
||||||
|
ContainerSpec containerSpec = new ContainerSpec();
|
||||||
|
containerSpec.setId(projectPersist.getContainerID());
|
||||||
|
containerSpec.setContainerName(projectPersist.getContainerID());
|
||||||
|
containerSpec.setReleasedId(new ReleaseId());
|
||||||
|
containerSpec.setStatus(KieContainerStatus.STARTED);
|
||||||
|
containerSpec.getReleasedId().setArtifactId(projectPersist.getArtifactID());
|
||||||
|
containerSpec.getReleasedId().setGroupId(projectPersist.getGroupID());
|
||||||
|
containerSpec.getReleasedId().setVersion(projectPersist.getProjectVersion());
|
||||||
|
containerSpec.setServerTemplateKey(new ServerTemplateKey());
|
||||||
|
containerSpec.getServerTemplateKey().setId(kieserverID);
|
||||||
|
containerSpec.getServerTemplateKey().setName(kieserverID);
|
||||||
|
ResponseEntity<String> response = restTemplateKiewb
|
||||||
|
.execute(completeurl, HttpMethod.POST, requestCallback(containerSpec, username, password), clientHttpResponse -> {
|
||||||
|
String extractedResponse = null;
|
||||||
|
ResponseEntity<String> extractedValue=null;
|
||||||
|
if (clientHttpResponse.getBody() != null) {
|
||||||
|
Scanner s = new Scanner(clientHttpResponse.getBody()).useDelimiter("\\A");
|
||||||
|
String result = s.hasNext() ? s.next() : "";
|
||||||
|
if (result==null || result.length()==0){
|
||||||
|
|
||||||
|
}else {
|
||||||
|
extractedResponse = mapper.readValue(result, String.class);
|
||||||
|
extractedValue = new ResponseEntity<>(extractedResponse, clientHttpResponse.getHeaders(), clientHttpResponse.getStatusCode());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return extractedValue;
|
||||||
|
});
|
||||||
|
if (response!= null) {
|
||||||
|
return response.getBody();
|
||||||
|
}else {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public ServerInstanceKeyList getListInstances(String username, String password){
|
||||||
|
String completeurl=kiewbUrl+"/controller/runtime/servers/"+kieserverID+"/instances";
|
||||||
|
|
||||||
|
ResponseEntity<ServerInstanceKeyList> response = restTemplateKiewb
|
||||||
|
.execute(completeurl, HttpMethod.GET, requestCallback(null, username, password), clientHttpResponse -> {
|
||||||
|
ServerInstanceKeyList extractedResponse;
|
||||||
|
ResponseEntity<ServerInstanceKeyList> extractedValue=null;
|
||||||
|
|
||||||
|
if (clientHttpResponse.getBody() != null) {
|
||||||
|
//Scanner s = new Scanner(clientHttpResponse.getBody()).useDelimiter("\\A");
|
||||||
|
//String result = s.hasNext() ? s.next() : "";
|
||||||
|
String result = StreamUtils.copyToString(clientHttpResponse.getBody(), Charset.defaultCharset());
|
||||||
|
if (result==null || result.length()==0){
|
||||||
|
|
||||||
|
}else {
|
||||||
|
extractedResponse = mapper.readValue(result, ServerInstanceKeyList.class);
|
||||||
|
extractedValue = new ResponseEntity<>(extractedResponse, clientHttpResponse.getHeaders(), clientHttpResponse.getStatusCode());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return extractedValue;
|
||||||
|
});
|
||||||
|
if (response!= null) {
|
||||||
|
return response.getBody();
|
||||||
|
}else {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public KieServerSetup connectToBusinessCentral(String username, String password){
|
||||||
|
String completeurl=kiewbUrl+"/controller/server/"+kieserverID;
|
||||||
|
KieServerInfo kieServerInfo = new KieServerInfo();
|
||||||
|
kieServerInfo.setVersion("1.0.0");
|
||||||
|
kieServerInfo.setServerId("1");
|
||||||
|
kieServerInfo.setName(kieserverID);
|
||||||
|
kieServerInfo.setMode(KieServerMode.DEVELOPMENT);
|
||||||
|
kieServerInfo.setServerId(kieserverID);
|
||||||
|
kieServerInfo.setLocation(controlerLocation);
|
||||||
|
kieServerInfo.setCapabilities(new ArrayList<>());
|
||||||
|
kieServerInfo.getCapabilities().add("BRM");
|
||||||
|
ResponseEntity<KieServerSetup> response = restTemplateKiewb
|
||||||
|
.execute(completeurl, HttpMethod.PUT, requestCallback(kieServerInfo, username, password), clientHttpResponse -> {
|
||||||
|
KieServerSetup extractedResponse = null;
|
||||||
|
ResponseEntity<KieServerSetup> extractedValue=null;
|
||||||
|
if (clientHttpResponse.getBody() != null) {
|
||||||
|
Scanner s = new Scanner(clientHttpResponse.getBody()).useDelimiter("\\A");
|
||||||
|
String result = s.hasNext() ? s.next() : "";
|
||||||
|
if (result==null || result.length()==0){
|
||||||
|
|
||||||
|
}else {
|
||||||
|
extractedResponse = mapper.readValue(result, KieServerSetup.class);
|
||||||
|
extractedValue = new ResponseEntity<>(extractedResponse, clientHttpResponse.getHeaders(), clientHttpResponse.getStatusCode());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return extractedValue;
|
||||||
|
});
|
||||||
|
if (response!= null) {
|
||||||
|
return response.getBody();
|
||||||
|
}else {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private RequestCallback requestCallback(final Object content, String username, String password) {
|
||||||
|
return clientHttpRequest -> {
|
||||||
|
|
||||||
|
if (content != null) {
|
||||||
|
if (content instanceof KieServerInfo) {
|
||||||
|
KieServerInfo kieServerSetup = (KieServerInfo) content;
|
||||||
|
|
||||||
|
mapper.writeValue(clientHttpRequest.getBody(), kieServerSetup);
|
||||||
|
} else {
|
||||||
|
mapper.writeValue(clientHttpRequest.getBody(), content);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
clientHttpRequest.getHeaders().add(
|
||||||
|
HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON_VALUE);
|
||||||
|
clientHttpRequest.getHeaders().add(
|
||||||
|
HttpHeaders.ACCEPT, MediaType.APPLICATION_JSON_VALUE);
|
||||||
|
String auth = username + ":" + password;
|
||||||
|
byte[] encodedAuth = Base64.encodeBase64(
|
||||||
|
auth.getBytes(Charset.forName("UTF-8")));
|
||||||
|
String authHeader = "Basic " + new String(encodedAuth);
|
||||||
|
clientHttpRequest.getHeaders().add(
|
||||||
|
HttpHeaders.AUTHORIZATION, authHeader);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,49 @@
|
||||||
|
package org.chtijbug.drools.console.service.wbconnector;
|
||||||
|
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
import org.springframework.http.HttpRequest;
|
||||||
|
import org.springframework.http.client.ClientHttpRequestExecution;
|
||||||
|
import org.springframework.http.client.ClientHttpRequestInterceptor;
|
||||||
|
import org.springframework.http.client.ClientHttpResponse;
|
||||||
|
import org.springframework.util.StreamUtils;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.nio.charset.Charset;
|
||||||
|
|
||||||
|
class LoggingRequestResponseLoggingInterceptor implements ClientHttpRequestInterceptor {
|
||||||
|
|
||||||
|
private final Logger log = LoggerFactory.getLogger(this.getClass());
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ClientHttpResponse intercept(HttpRequest request, byte[] body, ClientHttpRequestExecution execution) throws IOException {
|
||||||
|
logRequest(request, body);
|
||||||
|
ClientHttpResponse response = execution.execute(request, body);
|
||||||
|
logResponse(response);
|
||||||
|
return response;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void logRequest(HttpRequest request, byte[] body) throws IOException {
|
||||||
|
|
||||||
|
log.info("===========================request begin================================================");
|
||||||
|
log.info("URI : {}", request.getURI());
|
||||||
|
log.info("Method : {}", request.getMethod());
|
||||||
|
log.info("Headers : {}", request.getHeaders());
|
||||||
|
log.info("Request body: {}", new String(body, "UTF-8"));
|
||||||
|
log.info("==========================request end================================================");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void logResponse(ClientHttpResponse response) throws IOException {
|
||||||
|
|
||||||
|
log.info("============================response begin==========================================");
|
||||||
|
log.info("Status code : {}", response.getStatusCode());
|
||||||
|
log.info("Status text : {}", response.getStatusText());
|
||||||
|
log.info("Headers : {}", response.getHeaders());
|
||||||
|
log.info("Response body: {}", StreamUtils.copyToString(response.getBody(), Charset.defaultCharset()));
|
||||||
|
log.info("=======================response end=================================================");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -1,8 +1,13 @@
|
||||||
package org.chtijbug.drools.console.vaadinComponent.componentView;
|
package org.chtijbug.drools.console.vaadinComponent.componentView;
|
||||||
|
|
||||||
import com.vaadin.flow.component.checkbox.Checkbox;
|
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||||
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
|
import com.vaadin.flow.component.button.Button;
|
||||||
import com.vaadin.flow.component.grid.Grid;
|
import com.vaadin.flow.component.grid.Grid;
|
||||||
import com.vaadin.flow.component.html.Label;
|
import com.vaadin.flow.component.html.Label;
|
||||||
|
import com.vaadin.flow.component.orderedlayout.HorizontalLayout;
|
||||||
|
import com.vaadin.flow.component.orderedlayout.VerticalLayout;
|
||||||
|
import com.vaadin.flow.component.textfield.TextArea;
|
||||||
import com.vaadin.flow.component.textfield.TextField;
|
import com.vaadin.flow.component.textfield.TextField;
|
||||||
import com.vaadin.flow.data.provider.ConfigurableFilterDataProvider;
|
import com.vaadin.flow.data.provider.ConfigurableFilterDataProvider;
|
||||||
import com.vaadin.flow.data.provider.ListDataProvider;
|
import com.vaadin.flow.data.provider.ListDataProvider;
|
||||||
|
|
@ -11,6 +16,8 @@ import com.vaadin.flow.data.value.ValueChangeMode;
|
||||||
import com.vaadin.flow.function.SerializablePredicate;
|
import com.vaadin.flow.function.SerializablePredicate;
|
||||||
import org.chtijbug.drools.console.service.IndexerService;
|
import org.chtijbug.drools.console.service.IndexerService;
|
||||||
import org.chtijbug.drools.console.service.util.AppContext;
|
import org.chtijbug.drools.console.service.util.AppContext;
|
||||||
|
import org.chtijbug.drools.console.vaadinComponent.ComponentPerso.DialogPerso;
|
||||||
|
import org.chtijbug.drools.logging.Fact;
|
||||||
import org.chtijbug.drools.proxy.persistence.model.BusinessTransactionAction;
|
import org.chtijbug.drools.proxy.persistence.model.BusinessTransactionAction;
|
||||||
import org.springframework.data.domain.PageRequest;
|
import org.springframework.data.domain.PageRequest;
|
||||||
import org.springframework.data.domain.Sort;
|
import org.springframework.data.domain.Sort;
|
||||||
|
|
@ -31,151 +38,344 @@ public class GridActionLogging extends Grid<BusinessTransactionAction> {
|
||||||
private TextField ruleFlowGroup;
|
private TextField ruleFlowGroup;
|
||||||
|
|
||||||
|
|
||||||
|
private String strEventType = "EventType";
|
||||||
|
|
||||||
private String strEventType ="EventType";
|
private String strPositionExecution = "Position";
|
||||||
|
|
||||||
private String strPositionExecution ="Position";
|
private String strRuleName = "RuleName";
|
||||||
|
|
||||||
private String strRuleName ="RuleName";
|
private String strPackageName = "Package";
|
||||||
|
|
||||||
private String strPackageName ="Package";
|
private String strRuleFlowGroup = "RuleFlowGroup";
|
||||||
|
private ObjectMapper mapper = new ObjectMapper();
|
||||||
private String strRuleFlowGroup="RuleFlouwGroup";
|
|
||||||
|
|
||||||
private ListDataProvider<BusinessTransactionAction> dataProvider;
|
private ListDataProvider<BusinessTransactionAction> dataProvider;
|
||||||
private ConfigurableFilterDataProvider<BusinessTransactionAction,Void,SerializablePredicate<BusinessTransactionAction>> filterDataProvider;
|
private ConfigurableFilterDataProvider<BusinessTransactionAction, Void, SerializablePredicate<BusinessTransactionAction>> filterDataProvider;
|
||||||
|
|
||||||
private IndexerService indexerService;
|
private IndexerService indexerService;
|
||||||
|
|
||||||
public GridActionLogging(String idRequest){
|
public GridActionLogging(String idRequest) {
|
||||||
|
|
||||||
indexerService = AppContext.getApplicationContext().getBean(IndexerService.class);
|
indexerService = AppContext.getApplicationContext().getBean(IndexerService.class);
|
||||||
|
|
||||||
setClassName("action-log-grid-perso");
|
setClassName("action-log-grid-perso");
|
||||||
setSelectionMode(Grid.SelectionMode.SINGLE);
|
setSelectionMode(Grid.SelectionMode.SINGLE);
|
||||||
|
setVerticalScrollingEnabled(true);
|
||||||
|
|
||||||
addColumn(new ComponentRenderer<>(runtimePersist -> {
|
addColumn(new ComponentRenderer<>(runtimePersist -> {
|
||||||
|
|
||||||
SimpleDateFormat simpleDateFormat=new SimpleDateFormat( "yyyy-MM-dd HH:mm:ss");
|
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS");
|
||||||
Label label=new Label();
|
Label label = new Label();
|
||||||
if(runtimePersist.getRuleExecution()!=null) {
|
if (runtimePersist.getRuleExecution() != null) {
|
||||||
label.setText(simpleDateFormat.format(runtimePersist.getRuleExecution().getStartDate()));
|
label.setText(simpleDateFormat.format(runtimePersist.getRuleExecution().getStartDate()));
|
||||||
}
|
}
|
||||||
return label;
|
return label;
|
||||||
})).setHeader("Début");
|
})).setHeader("Début").setResizable(true);
|
||||||
|
|
||||||
addColumn(new ComponentRenderer<>(runtimePersist -> {
|
addColumn(new ComponentRenderer<>(runtimePersist -> {
|
||||||
|
|
||||||
SimpleDateFormat simpleDateFormat=new SimpleDateFormat( "yyyy-MM-dd HH:mm:ss");
|
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS");
|
||||||
Label label=new Label();
|
Label label = new Label();
|
||||||
if(runtimePersist.getRuleExecution()!=null) {
|
if (runtimePersist.getRuleExecution() != null) {
|
||||||
label.setText(simpleDateFormat.format(runtimePersist.getRuleExecution().getEndDate()));
|
label.setText(simpleDateFormat.format(runtimePersist.getRuleExecution().getEndDate()));
|
||||||
}
|
}
|
||||||
return label;
|
return label;
|
||||||
})).setHeader("Fin");
|
})).setHeader("Fin").setResizable(true);
|
||||||
|
|
||||||
|
|
||||||
Grid.Column<BusinessTransactionAction> enventTypeC=addColumn(runtimePersist -> runtimePersist.getEventType());
|
Grid.Column<BusinessTransactionAction> enventTypeC = addColumn(runtimePersist -> runtimePersist.getEventType());
|
||||||
this.eventType =new TextField(strEventType);
|
this.eventType = new TextField(strEventType);
|
||||||
this.eventType.setValueChangeMode(ValueChangeMode.EAGER);
|
this.eventType.setValueChangeMode(ValueChangeMode.EAGER);
|
||||||
this.eventType.addValueChangeListener(e -> {
|
this.eventType.addValueChangeListener(e -> {
|
||||||
refreshtGrid(this.eventType.getValue(), strEventType);
|
refreshtGrid(this.eventType.getValue(), strEventType);
|
||||||
});
|
});
|
||||||
enventTypeC.setHeader(this.eventType);
|
enventTypeC.setHeader(this.eventType).setResizable(true);
|
||||||
|
|
||||||
Grid.Column<BusinessTransactionAction> positionC=addColumn(runtimePersist -> runtimePersist.getEventNumber());
|
Grid.Column<BusinessTransactionAction> positionC = addColumn(runtimePersist -> runtimePersist.getEventNumber());
|
||||||
|
|
||||||
positionExecution =new TextField(strPositionExecution);
|
positionExecution = new TextField(strPositionExecution);
|
||||||
positionExecution.setValueChangeMode(ValueChangeMode.EAGER);
|
positionExecution.setValueChangeMode(ValueChangeMode.EAGER);
|
||||||
positionExecution.addValueChangeListener(e -> {
|
positionExecution.addValueChangeListener(e -> {
|
||||||
refreshtGrid(positionExecution.getValue(), strPositionExecution);
|
refreshtGrid(positionExecution.getValue(), strPositionExecution);
|
||||||
});
|
});
|
||||||
positionC.setHeader(positionExecution);
|
positionC.setHeader(positionExecution).setResizable(true);
|
||||||
positionC.setWidth("3%");
|
positionC.setWidth("3%");
|
||||||
|
|
||||||
Grid.Column<BusinessTransactionAction> ruleNameC=addColumn(runtimePersist -> runtimePersist.getRuleExecution()!=null?runtimePersist.getRuleExecution().getRuleName():"");
|
Grid.Column<BusinessTransactionAction> ruleNameC = addColumn(runtimePersist -> runtimePersist.getRuleExecution() != null ? runtimePersist.getRuleExecution().getRuleName() : "");
|
||||||
ruleName =new TextField(strRuleName);
|
ruleName = new TextField(strRuleName);
|
||||||
ruleName.setValueChangeMode(ValueChangeMode.EAGER);
|
ruleName.setValueChangeMode(ValueChangeMode.EAGER);
|
||||||
ruleName.addValueChangeListener(e -> {
|
ruleName.addValueChangeListener(e -> {
|
||||||
refreshtGrid(ruleName.getValue(), strRuleName);
|
refreshtGrid(ruleName.getValue(), strRuleName);
|
||||||
});
|
});
|
||||||
ruleNameC.setHeader(ruleName);
|
ruleNameC.setHeader(ruleName).setResizable(true);
|
||||||
|
|
||||||
Grid.Column<BusinessTransactionAction> versionC=addColumn(runtimePersist -> runtimePersist.getRuleExecution()!=null?runtimePersist.getRuleExecution().getPackageName():"");
|
Grid.Column<BusinessTransactionAction> versionC = addColumn(runtimePersist -> runtimePersist.getRuleExecution() != null ? runtimePersist.getRuleExecution().getPackageName() : "");
|
||||||
packageName =new TextField(strPackageName);
|
packageName = new TextField(strPackageName);
|
||||||
packageName.setValueChangeMode(ValueChangeMode.EAGER);
|
packageName.setValueChangeMode(ValueChangeMode.EAGER);
|
||||||
packageName.addValueChangeListener(e -> {
|
packageName.addValueChangeListener(e -> {
|
||||||
refreshtGrid(packageName.getValue(), strPackageName);
|
refreshtGrid(packageName.getValue(), strPackageName);
|
||||||
});
|
});
|
||||||
versionC.setHeader(packageName);
|
versionC.setHeader(packageName).setResizable(true);
|
||||||
|
|
||||||
Grid.Column<BusinessTransactionAction> ruleflowC=addColumn(runtimePersist -> runtimePersist.getRuleflowGroupName()!=null?runtimePersist.getRuleflowGroupName():"");
|
Grid.Column<BusinessTransactionAction> ruleflowC = addColumn(runtimePersist -> runtimePersist.getRuleflowGroupName() != null ? runtimePersist.getRuleflowGroupName() : "");
|
||||||
ruleFlowGroup =new TextField(strRuleFlowGroup);
|
ruleFlowGroup = new TextField(strRuleFlowGroup);
|
||||||
ruleFlowGroup.setValueChangeMode(ValueChangeMode.EAGER);
|
ruleFlowGroup.setValueChangeMode(ValueChangeMode.EAGER);
|
||||||
ruleFlowGroup.addValueChangeListener(e -> {
|
ruleFlowGroup.addValueChangeListener(e -> {
|
||||||
refreshtGrid(ruleFlowGroup.getValue(), strRuleFlowGroup);
|
refreshtGrid(ruleFlowGroup.getValue(), strRuleFlowGroup);
|
||||||
});
|
});
|
||||||
ruleflowC.setHeader(ruleFlowGroup);
|
ruleflowC.setHeader(ruleFlowGroup).setResizable(true);
|
||||||
|
|
||||||
addColumn(new ComponentRenderer<>(runtimePersist -> {
|
addColumn(new ComponentRenderer<>(runtimePersist -> {
|
||||||
|
HorizontalLayout horizontalLayout = new HorizontalLayout();
|
||||||
|
if (runtimePersist.getInputData() != null && runtimePersist.getInputData().getRealFact() != null) {
|
||||||
|
Button inputData = new Button("Input data");
|
||||||
|
inputData.setClassName("menu-button");
|
||||||
|
inputData.setEnabled(true);
|
||||||
|
inputData.addClickListener(buttonClickEvent -> {
|
||||||
|
DialogPerso dialogPerso1 = new DialogPerso();
|
||||||
|
|
||||||
Checkbox label=new Checkbox();
|
BusinessTransactionAction b = runtimePersist;
|
||||||
label.setEnabled(false);
|
|
||||||
label.setValue(false);
|
|
||||||
|
|
||||||
if(runtimePersist.getInputData()!=null&&runtimePersist.getInputData().getRealFact()!=null){
|
if (b != null && b.getInputData() != null && b.getInputData().getRealFact() != null) {
|
||||||
label.setValue(true);
|
|
||||||
}
|
|
||||||
if(runtimePersist.getFact()!=null&&runtimePersist.getFact().getRealFact()!=null){
|
|
||||||
label.setValue(true);
|
|
||||||
}
|
|
||||||
if(runtimePersist.getRuleExecution()!=null&&runtimePersist.getRuleExecution().getThenFacts()!=null&&runtimePersist.getRuleExecution().getThenFacts().size()>0){
|
|
||||||
label.setValue(true);
|
|
||||||
}
|
|
||||||
if(runtimePersist.getRuleExecution()!=null&&runtimePersist.getRuleExecution().getWhenFacts()!=null&&runtimePersist.getRuleExecution().getWhenFacts().size()>0){
|
|
||||||
label.setValue(true);
|
|
||||||
}
|
|
||||||
return label;
|
|
||||||
})).setHeader("Data?");
|
|
||||||
|
|
||||||
|
VerticalLayout verticalLayout = new VerticalLayout();
|
||||||
|
Label label = new Label(b.getEventType().name() );
|
||||||
|
label.setClassName("creation-runtime-title");
|
||||||
|
verticalLayout.add(label);
|
||||||
|
verticalLayout.setClassName("content-action-logging");
|
||||||
|
|
||||||
|
TextArea textArea = new TextArea(b.getInputData().getFactType().name()+"-"+b.getInputData().getFullClassName());
|
||||||
|
textArea.setReadOnly(true);
|
||||||
|
textArea.setClassName("content-log");
|
||||||
|
try {
|
||||||
|
String text = mapper.writerWithDefaultPrettyPrinter().writeValueAsString(b.getInputData().getRealFact());
|
||||||
|
textArea.setValue(text);
|
||||||
|
} catch (JsonProcessingException e) {
|
||||||
|
textArea.setValue(
|
||||||
|
b.getInputData().getRealFact().toString().replaceAll(",", ",\n")
|
||||||
|
.replaceAll("\\{", "\\{\n")
|
||||||
|
.replaceAll("\\}", "\n\\}")
|
||||||
|
.replaceAll("\\[", "\n\\[")
|
||||||
|
|
||||||
|
);
|
||||||
|
}
|
||||||
|
verticalLayout.add(textArea);
|
||||||
|
dialogPerso1.add(verticalLayout);
|
||||||
|
}
|
||||||
|
|
||||||
|
dialogPerso1.open();
|
||||||
|
});
|
||||||
|
horizontalLayout.add(inputData);
|
||||||
|
}
|
||||||
|
if (runtimePersist.getFact() != null && runtimePersist.getFact().getRealFact() != null) {
|
||||||
|
Button realFact = new Button("Insert Data");
|
||||||
|
realFact.setClassName("menu-button");
|
||||||
|
realFact.setEnabled(true);
|
||||||
|
realFact.addClickListener(buttonClickEvent -> {
|
||||||
|
DialogPerso dialogPerso1 = new DialogPerso();
|
||||||
|
|
||||||
|
BusinessTransactionAction b = runtimePersist;
|
||||||
|
|
||||||
|
if (b != null && b.getFact() != null && b.getFact().getRealFact() != null) {
|
||||||
|
|
||||||
|
VerticalLayout verticalLayout = new VerticalLayout();
|
||||||
|
Label label = new Label(b.getEventType().name());
|
||||||
|
label.setClassName("creation-runtime-title");
|
||||||
|
verticalLayout.add(label);
|
||||||
|
verticalLayout.setClassName("content-action-logging");
|
||||||
|
|
||||||
|
TextArea textArea = new TextArea(b.getFact().getFactType().name()+"-"+b.getFact().getFullClassName());
|
||||||
|
textArea.setReadOnly(true);
|
||||||
|
textArea.setClassName("content-log");
|
||||||
|
try {
|
||||||
|
String text = mapper.writerWithDefaultPrettyPrinter().writeValueAsString(b.getFact().getRealFact());
|
||||||
|
textArea.setValue(text);
|
||||||
|
} catch (JsonProcessingException e) {
|
||||||
|
textArea.setValue(
|
||||||
|
b.getFact().getRealFact().toString().replaceAll(",", ",\n")
|
||||||
|
.replaceAll("\\{", "\\{\n")
|
||||||
|
.replaceAll("\\}", "\n\\}")
|
||||||
|
.replaceAll("\\[", "\n\\[")
|
||||||
|
|
||||||
|
);
|
||||||
|
}
|
||||||
|
verticalLayout.add(textArea);
|
||||||
|
dialogPerso1.add(verticalLayout);
|
||||||
|
}
|
||||||
|
|
||||||
|
dialogPerso1.open();
|
||||||
|
});
|
||||||
|
horizontalLayout.add(realFact);
|
||||||
|
}
|
||||||
|
if (runtimePersist.getRuleExecution() != null && runtimePersist.getRuleExecution().getThenFacts() != null && runtimePersist.getRuleExecution().getThenFacts().size() > 0) {
|
||||||
|
Button whenFact = new Button("When Data");
|
||||||
|
whenFact.setClassName("menu-button");
|
||||||
|
whenFact.setEnabled(true);
|
||||||
|
whenFact.addClickListener(buttonClickEvent -> {
|
||||||
|
DialogPerso dialogPerso1 = new DialogPerso();
|
||||||
|
|
||||||
|
BusinessTransactionAction b = runtimePersist;
|
||||||
|
|
||||||
|
if (b != null && b.getRuleExecution() != null && b.getRuleExecution().getWhenFacts() != null) {
|
||||||
|
|
||||||
|
VerticalLayout verticalLayout = new VerticalLayout();
|
||||||
|
Label label = new Label(b.getEventType().name() + " - " + (b.getRuleExecution() != null && b.getRuleExecution().getRuleName() != null ? b.getRuleExecution().getRuleName() : ""));
|
||||||
|
label.setClassName("creation-runtime-title");
|
||||||
|
verticalLayout.add(label);
|
||||||
|
verticalLayout.setClassName("content-action-logging");
|
||||||
|
for (Fact fact : b.getRuleExecution().getWhenFacts()) {
|
||||||
|
if (fact != null && fact.getRealFact() != null) {
|
||||||
|
|
||||||
|
TextArea textArea = new TextArea(fact.getFactType().name()+"-"+fact.getFullClassName());
|
||||||
|
textArea.setReadOnly(true);
|
||||||
|
textArea.setClassName("content-log");
|
||||||
|
try {
|
||||||
|
String text = mapper.writerWithDefaultPrettyPrinter().writeValueAsString(fact.getRealFact());
|
||||||
|
textArea.setValue(text);
|
||||||
|
} catch (JsonProcessingException e) {
|
||||||
|
textArea.setValue(
|
||||||
|
fact.getRealFact().toString().replaceAll(",", ",\n")
|
||||||
|
.replaceAll("\\{", "\\{\n")
|
||||||
|
.replaceAll("\\}", "\n\\}")
|
||||||
|
.replaceAll("\\[", "\n\\[")
|
||||||
|
|
||||||
|
);
|
||||||
|
}
|
||||||
|
verticalLayout.add(textArea);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
dialogPerso1.add(verticalLayout);
|
||||||
|
}
|
||||||
|
|
||||||
|
dialogPerso1.open();
|
||||||
|
});
|
||||||
|
horizontalLayout.add(whenFact);
|
||||||
|
}
|
||||||
|
if (runtimePersist.getRuleExecution() != null && runtimePersist.getRuleExecution().getThenFacts() != null && runtimePersist.getRuleExecution().getThenFacts().size() > 0) {
|
||||||
|
|
||||||
|
Button thenFact = new Button("Then data");
|
||||||
|
thenFact.setClassName("menu-button");
|
||||||
|
thenFact.setEnabled(true);
|
||||||
|
thenFact.addClickListener(buttonClickEvent -> {
|
||||||
|
DialogPerso dialogPerso1 = new DialogPerso();
|
||||||
|
|
||||||
|
BusinessTransactionAction b = runtimePersist;
|
||||||
|
|
||||||
|
if (b != null && b.getRuleExecution() != null && b.getRuleExecution().getThenFacts() != null) {
|
||||||
|
|
||||||
|
VerticalLayout verticalLayout = new VerticalLayout();
|
||||||
|
Label label = new Label(b.getEventType().name() + " - " + (b.getRuleExecution() != null && b.getRuleExecution().getRuleName() != null ? b.getRuleExecution().getRuleName() : ""));
|
||||||
|
label.setClassName("creation-runtime-title");
|
||||||
|
verticalLayout.add(label);
|
||||||
|
verticalLayout.setClassName("content-action-logging");
|
||||||
|
for (Fact fact : b.getRuleExecution().getThenFacts()) {
|
||||||
|
if (fact != null && fact.getRealFact() != null) {
|
||||||
|
|
||||||
|
TextArea textArea = new TextArea(fact.getFactType().name()+"-"+fact.getFullClassName());
|
||||||
|
textArea.setReadOnly(true);
|
||||||
|
textArea.setClassName("content-log");
|
||||||
|
try {
|
||||||
|
String text = mapper.writerWithDefaultPrettyPrinter().writeValueAsString(fact.getRealFact());
|
||||||
|
textArea.setValue(text);
|
||||||
|
} catch (JsonProcessingException e) {
|
||||||
|
textArea.setValue(
|
||||||
|
fact.getRealFact().toString().replaceAll(",", ",\n")
|
||||||
|
.replaceAll("\\{", "\\{\n")
|
||||||
|
.replaceAll("\\}", "\n\\}")
|
||||||
|
.replaceAll("\\[", "\n\\[")
|
||||||
|
|
||||||
|
);
|
||||||
|
}
|
||||||
|
verticalLayout.add(textArea);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
dialogPerso1.add(verticalLayout);
|
||||||
|
}
|
||||||
|
dialogPerso1.open();
|
||||||
|
});
|
||||||
|
horizontalLayout.add(thenFact);
|
||||||
|
}
|
||||||
|
if (runtimePersist.getOutputData() != null && runtimePersist.getOutputData().getRealFact() != null) {
|
||||||
|
Button outputData = new Button("Output data");
|
||||||
|
outputData.setClassName("menu-button");
|
||||||
|
outputData.setEnabled(true);
|
||||||
|
outputData.addClickListener(buttonClickEvent -> {
|
||||||
|
DialogPerso dialogPerso1 = new DialogPerso();
|
||||||
|
|
||||||
|
BusinessTransactionAction b = runtimePersist;
|
||||||
|
|
||||||
|
if (b != null && b.getOutputData() != null && b.getOutputData().getRealFact() != null) {
|
||||||
|
|
||||||
|
VerticalLayout verticalLayout = new VerticalLayout();
|
||||||
|
Label label = new Label(b.getEventType().name() );
|
||||||
|
label.setClassName("creation-runtime-title");
|
||||||
|
verticalLayout.add(label);
|
||||||
|
verticalLayout.setClassName("content-action-logging");
|
||||||
|
|
||||||
|
TextArea textArea = new TextArea(b.getOutputData().getFactType().name()+"-"+b.getOutputData().getFullClassName());
|
||||||
|
textArea.setReadOnly(true);
|
||||||
|
textArea.setClassName("content-log");
|
||||||
|
try {
|
||||||
|
String text = mapper.writerWithDefaultPrettyPrinter().writeValueAsString(b.getOutputData().getRealFact());
|
||||||
|
textArea.setValue(text);
|
||||||
|
} catch (JsonProcessingException e) {
|
||||||
|
textArea.setValue(
|
||||||
|
b.getOutputData().getRealFact().toString().replaceAll(",", ",\n")
|
||||||
|
.replaceAll("\\{", "\\{\n")
|
||||||
|
.replaceAll("\\}", "\n\\}")
|
||||||
|
.replaceAll("\\[", "\n\\[")
|
||||||
|
|
||||||
|
);
|
||||||
|
}
|
||||||
|
verticalLayout.add(textArea);
|
||||||
|
|
||||||
|
|
||||||
|
dialogPerso1.add(verticalLayout);
|
||||||
|
}
|
||||||
|
|
||||||
|
dialogPerso1.open();
|
||||||
|
});
|
||||||
|
horizontalLayout.add(outputData);
|
||||||
|
}
|
||||||
|
return horizontalLayout;
|
||||||
|
})).setHeader("Action");
|
||||||
setDataProvider(idRequest);
|
setDataProvider(idRequest);
|
||||||
}
|
}
|
||||||
private void refreshtGrid(String value,String type){
|
|
||||||
|
|
||||||
filterDataProvider.setFilter(filterGrid(value.toUpperCase(),type));
|
private void refreshtGrid(String value, String type) {
|
||||||
|
|
||||||
|
filterDataProvider.setFilter(filterGrid(value.toUpperCase(), type));
|
||||||
getDataProvider().refreshAll();
|
getDataProvider().refreshAll();
|
||||||
}
|
}
|
||||||
private SerializablePredicate<BusinessTransactionAction> filterGrid(String value, String type){
|
|
||||||
|
private SerializablePredicate<BusinessTransactionAction> filterGrid(String value, String type) {
|
||||||
SerializablePredicate<BusinessTransactionAction> columnPredicate = null;
|
SerializablePredicate<BusinessTransactionAction> columnPredicate = null;
|
||||||
if(value.equals(" ")||type.equals(" ")){
|
if (value.equals(" ") || type.equals(" ")) {
|
||||||
columnPredicate = runtimePersist -> (true);
|
columnPredicate = runtimePersist -> (true);
|
||||||
}else {
|
} else {
|
||||||
if (type.equals(strPositionExecution)) {
|
if (type.equals(strPositionExecution)) {
|
||||||
columnPredicate = runtimePersist -> (String.valueOf(runtimePersist.getEventNumber()).equals(value));
|
columnPredicate = runtimePersist -> (String.valueOf(runtimePersist.getEventNumber()).equals(value));
|
||||||
|
|
||||||
} else if (type.equals(strEventType)) {
|
} else if (type.equals(strEventType)) {
|
||||||
columnPredicate = runtimePersist -> (runtimePersist.getEventType()!=null&&runtimePersist.getEventType().toString().toUpperCase().contains(value));
|
columnPredicate = runtimePersist -> (runtimePersist.getEventType() != null && runtimePersist.getEventType().toString().toUpperCase().contains(value));
|
||||||
|
|
||||||
} else if (type.equals(strRuleName)) {
|
} else if (type.equals(strRuleName)) {
|
||||||
columnPredicate = runtimePersist -> (runtimePersist.getRuleExecution()!=null&&runtimePersist.getRuleExecution().getRuleName()!=null&&runtimePersist.getRuleExecution().getRuleName().toUpperCase().contains(value));
|
columnPredicate = runtimePersist -> (runtimePersist.getRuleExecution() != null && runtimePersist.getRuleExecution().getRuleName() != null && runtimePersist.getRuleExecution().getRuleName().toUpperCase().contains(value));
|
||||||
}
|
} else if (type.equals(strPackageName)) {
|
||||||
else if (type.equals(strPackageName)) {
|
columnPredicate = runtimePersist -> (runtimePersist.getRuleExecution() != null && runtimePersist.getRuleExecution().getPackageName() != null && runtimePersist.getRuleExecution().getPackageName().toUpperCase().contains(value));
|
||||||
columnPredicate = runtimePersist -> (runtimePersist.getRuleExecution()!=null&&runtimePersist.getRuleExecution().getPackageName()!=null&&runtimePersist.getRuleExecution().getPackageName().toUpperCase().contains(value));
|
} else if (type.equals(strRuleFlowGroup)) {
|
||||||
}
|
columnPredicate = runtimePersist -> (runtimePersist.getRuleflowGroupName() != null && runtimePersist.getRuleflowGroupName().toUpperCase().contains(value));
|
||||||
else if (type.equals(strRuleFlowGroup)) {
|
|
||||||
columnPredicate = runtimePersist -> (runtimePersist.getRuleflowGroupName()!=null&&runtimePersist.getRuleflowGroupName().toUpperCase().contains(value));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
return columnPredicate;
|
return columnPredicate;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setDataProvider(String id){
|
public void setDataProvider(String id) {
|
||||||
|
|
||||||
List<BusinessTransactionAction> businessTransactionPersistences = indexerService.getBusinessTransactionActionRepository().findAllByBusinessTransactionId(id,new Sort(new Sort.Order(Sort.Direction.ASC,"eventNumber")),new PageRequest(0,5000));
|
List<BusinessTransactionAction> businessTransactionPersistences = indexerService.getBusinessTransactionActionRepository().findAllByBusinessTransactionId(id, Sort.by(new Sort.Order(Sort.Direction.ASC, "eventNumber")), PageRequest.of(0, 5000));
|
||||||
|
|
||||||
if(businessTransactionPersistences!=null) {
|
if (businessTransactionPersistences != null) {
|
||||||
dataProvider = new ListDataProvider<>(businessTransactionPersistences);
|
dataProvider = new ListDataProvider<>(businessTransactionPersistences);
|
||||||
|
|
||||||
filterDataProvider = dataProvider.withConfigurableFilter();
|
filterDataProvider = dataProvider.withConfigurableFilter();
|
||||||
|
|
@ -185,7 +385,8 @@ public class GridActionLogging extends Grid<BusinessTransactionAction> {
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public void reinitFilter(){
|
|
||||||
|
public void reinitFilter() {
|
||||||
positionExecution.setValue("");
|
positionExecution.setValue("");
|
||||||
ruleName.setValue("");
|
ruleName.setValue("");
|
||||||
eventType.setValue("");
|
eventType.setValue("");
|
||||||
|
|
|
||||||
|
|
@ -103,7 +103,7 @@ public class GridLogging extends Grid<BusinessTransactionPersistence> {
|
||||||
});
|
});
|
||||||
serverNameC.setHeader(serverName);
|
serverNameC.setHeader(serverName);
|
||||||
|
|
||||||
setDataProvider(indexerService.getBusinessTransactionPersistenceRepository().findAll(new PageRequest(0,100)).getContent());
|
setDataProvider(indexerService.getBusinessTransactionPersistenceRepository().findAll(PageRequest.of(0,100)).getContent());
|
||||||
}
|
}
|
||||||
private void refreshtGrid(String value,String type){
|
private void refreshtGrid(String value,String type){
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -38,9 +38,9 @@ public class ActionLogging extends VerticalLayout {
|
||||||
|
|
||||||
if (textFieldStringComponentValueChangeEvent.getValue().isEmpty()) {
|
if (textFieldStringComponentValueChangeEvent.getValue().isEmpty()) {
|
||||||
loggingView.getTitle().setText("Logging : ");
|
loggingView.getTitle().setText("Logging : ");
|
||||||
loggingView.getGridLogging().setDataProvider(indexerService.getBusinessTransactionPersistenceRepository().findAll(new PageRequest(0, 100)).getContent());
|
loggingView.getGridLogging().setDataProvider(indexerService.getBusinessTransactionPersistenceRepository().findAll(PageRequest.of(0, 100)).getContent());
|
||||||
} else {
|
} else {
|
||||||
List<BusinessTransactionPersistence> b = indexerService.getBusinessTransactionPersistenceRepository().findAllByTransactionId(textFieldStringComponentValueChangeEvent.getValue(), new PageRequest(0, 100));
|
List<BusinessTransactionPersistence> b = indexerService.getBusinessTransactionPersistenceRepository().findAllByTransactionId(textFieldStringComponentValueChangeEvent.getValue(), PageRequest.of(0, 100));
|
||||||
|
|
||||||
if (b != null) {
|
if (b != null) {
|
||||||
loggingView.getTitle().setText("Logging : " + textFieldStringComponentValueChangeEvent.getValue());
|
loggingView.getTitle().setText("Logging : " + textFieldStringComponentValueChangeEvent.getValue());
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,8 @@ package org.chtijbug.drools.console.vaadinComponent.leftMenu.Action;
|
||||||
import com.vaadin.flow.component.button.Button;
|
import com.vaadin.flow.component.button.Button;
|
||||||
import com.vaadin.flow.component.icon.VaadinIcon;
|
import com.vaadin.flow.component.icon.VaadinIcon;
|
||||||
import com.vaadin.flow.component.orderedlayout.VerticalLayout;
|
import com.vaadin.flow.component.orderedlayout.VerticalLayout;
|
||||||
|
import org.chtijbug.drools.KieContainerResponse;
|
||||||
|
import org.chtijbug.drools.common.KafkaTopicConstants;
|
||||||
import org.chtijbug.drools.console.service.ProjectPersistService;
|
import org.chtijbug.drools.console.service.ProjectPersistService;
|
||||||
import org.chtijbug.drools.console.service.util.AppContext;
|
import org.chtijbug.drools.console.service.util.AppContext;
|
||||||
import org.chtijbug.drools.console.vaadinComponent.ComponentPerso.DialogPerso;
|
import org.chtijbug.drools.console.vaadinComponent.ComponentPerso.DialogPerso;
|
||||||
|
|
@ -11,6 +13,7 @@ import org.chtijbug.drools.console.vaadinComponent.componentView.AssociateProjec
|
||||||
import org.chtijbug.drools.console.vaadinComponent.componentView.DefineProject;
|
import org.chtijbug.drools.console.vaadinComponent.componentView.DefineProject;
|
||||||
import org.chtijbug.drools.console.view.DeploymentView;
|
import org.chtijbug.drools.console.view.DeploymentView;
|
||||||
import org.chtijbug.drools.proxy.persistence.model.ProjectPersist;
|
import org.chtijbug.drools.proxy.persistence.model.ProjectPersist;
|
||||||
|
import org.springframework.kafka.annotation.KafkaListener;
|
||||||
|
|
||||||
public class DeploymentAction extends VerticalLayout {
|
public class DeploymentAction extends VerticalLayout {
|
||||||
|
|
||||||
|
|
@ -22,11 +25,11 @@ public class DeploymentAction extends VerticalLayout {
|
||||||
private Button deployer;
|
private Button deployer;
|
||||||
|
|
||||||
private ProjectPersistService projectPersistService;
|
private ProjectPersistService projectPersistService;
|
||||||
|
private DeploymentView deploymentView;
|
||||||
|
|
||||||
public DeploymentAction(SqueletteComposant squeletteComposant,DeploymentView deploymentView){
|
public DeploymentAction(SqueletteComposant squeletteComposant,DeploymentView deploymentView){
|
||||||
setClassName("leftMenu-global-action");
|
setClassName("leftMenu-global-action");
|
||||||
|
this.deploymentView=deploymentView;
|
||||||
projectPersistService= AppContext.getApplicationContext().getBean(ProjectPersistService.class);
|
projectPersistService= AppContext.getApplicationContext().getBean(ProjectPersistService.class);
|
||||||
|
|
||||||
definirProject =new Button("Define your project", VaadinIcon.CODE.create());
|
definirProject =new Button("Define your project", VaadinIcon.CODE.create());
|
||||||
|
|
@ -76,6 +79,14 @@ public class DeploymentAction extends VerticalLayout {
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@KafkaListener(
|
||||||
|
topics = KafkaTopicConstants.RESPONSE_DEPLOY_TOPIC,groupId = "Console",
|
||||||
|
containerFactory = "ruleKafkaListenerKieContainerUpdateFactory")
|
||||||
|
public void updateKieServerLogInfo(KieContainerResponse kieContainerResponse){
|
||||||
|
deploymentView.addRow("Deploy Response="+kieContainerResponse.toString(),getUI().get());
|
||||||
|
}
|
||||||
|
|
||||||
private boolean isActive(Button button){
|
private boolean isActive(Button button){
|
||||||
return button.getClassNames().contains("active");
|
return button.getClassNames().contains("active");
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,13 +1,9 @@
|
||||||
package org.chtijbug.drools.console.view;
|
package org.chtijbug.drools.console.view;
|
||||||
|
|
||||||
import com.vaadin.flow.component.button.Button;
|
|
||||||
import com.vaadin.flow.component.html.Label;
|
import com.vaadin.flow.component.html.Label;
|
||||||
import com.vaadin.flow.component.orderedlayout.VerticalLayout;
|
import com.vaadin.flow.component.orderedlayout.VerticalLayout;
|
||||||
import com.vaadin.flow.component.textfield.TextArea;
|
|
||||||
import org.chtijbug.drools.console.vaadinComponent.ComponentPerso.DialogPerso;
|
import org.chtijbug.drools.console.vaadinComponent.ComponentPerso.DialogPerso;
|
||||||
import org.chtijbug.drools.console.vaadinComponent.componentView.GridActionLogging;
|
import org.chtijbug.drools.console.vaadinComponent.componentView.GridActionLogging;
|
||||||
import org.chtijbug.drools.logging.Fact;
|
|
||||||
import org.chtijbug.drools.proxy.persistence.model.BusinessTransactionAction;
|
|
||||||
import org.chtijbug.drools.proxy.persistence.model.BusinessTransactionPersistence;
|
import org.chtijbug.drools.proxy.persistence.model.BusinessTransactionPersistence;
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -17,42 +13,14 @@ public class ActionLoggingView extends VerticalLayout {
|
||||||
|
|
||||||
private GridActionLogging gridActionLogging;
|
private GridActionLogging gridActionLogging;
|
||||||
|
|
||||||
private Button inputData;
|
|
||||||
|
|
||||||
private Button realFact;
|
|
||||||
|
|
||||||
private Button whenFact;
|
|
||||||
|
|
||||||
private Button thenFact;
|
|
||||||
|
|
||||||
public ActionLoggingView(BusinessTransactionPersistence businessTransactionPersistence, DialogPerso dialogPerso){
|
public ActionLoggingView(BusinessTransactionPersistence businessTransactionPersistence, DialogPerso dialogPerso){
|
||||||
|
|
||||||
dialogPerso.getClose().setVisible(false);
|
dialogPerso.getClose().setVisible(false);
|
||||||
|
//Text text = new Text("Sessino Context ");
|
||||||
|
//dialogPerso.getBar().add(text);
|
||||||
|
|
||||||
inputData=new Button("View InputData");
|
|
||||||
inputData.setClassName("menu-button");
|
|
||||||
inputData.setEnabled(false);
|
|
||||||
|
|
||||||
|
|
||||||
dialogPerso.getBar().add(inputData);
|
|
||||||
|
|
||||||
realFact=new Button("View RealFact");
|
|
||||||
realFact.setClassName("menu-button");
|
|
||||||
realFact.setEnabled(false);
|
|
||||||
|
|
||||||
dialogPerso.getBar().add(realFact);
|
|
||||||
|
|
||||||
whenFact=new Button("View WhenFact");
|
|
||||||
whenFact.setClassName("menu-button");
|
|
||||||
whenFact.setEnabled(false);
|
|
||||||
|
|
||||||
dialogPerso.getBar().add(whenFact);
|
|
||||||
|
|
||||||
thenFact=new Button("View ThenFact");
|
|
||||||
thenFact.setClassName("menu-button");
|
|
||||||
thenFact.setEnabled(false);
|
|
||||||
|
|
||||||
dialogPerso.getBar().add(thenFact);
|
|
||||||
|
|
||||||
title=new Label("TransactionID : "+businessTransactionPersistence.getId());
|
title=new Label("TransactionID : "+businessTransactionPersistence.getId());
|
||||||
title.setClassName("creation-runtime-title");
|
title.setClassName("creation-runtime-title");
|
||||||
|
|
@ -63,166 +31,8 @@ public class ActionLoggingView extends VerticalLayout {
|
||||||
gridActionLogging=new GridActionLogging(businessTransactionPersistence.getId());
|
gridActionLogging=new GridActionLogging(businessTransactionPersistence.getId());
|
||||||
add(gridActionLogging);
|
add(gridActionLogging);
|
||||||
|
|
||||||
gridActionLogging.addSelectionListener(selectionEvent -> {
|
|
||||||
|
|
||||||
BusinessTransactionAction b=gridActionLogging.getSelectedItems().stream().findFirst().get();
|
|
||||||
|
|
||||||
if(b!=null){
|
|
||||||
if(b.getInputData()!=null&&b.getInputData().getRealFact()!=null){
|
|
||||||
inputData.setEnabled(true);
|
|
||||||
}else {
|
|
||||||
inputData.setEnabled(false);
|
|
||||||
}
|
|
||||||
if(b.getFact()!=null&&b.getFact().getRealFact()!=null){
|
|
||||||
realFact.setEnabled(true);
|
|
||||||
}else {
|
|
||||||
realFact.setEnabled(false);
|
|
||||||
}
|
|
||||||
if(b.getRuleExecution()!=null&&b.getRuleExecution().getThenFacts()!=null&&b.getRuleExecution().getThenFacts().size()>0){
|
|
||||||
thenFact.setEnabled(true);
|
|
||||||
}else {
|
|
||||||
thenFact.setEnabled(false);
|
|
||||||
}
|
|
||||||
if(b.getRuleExecution()!=null&&b.getRuleExecution().getWhenFacts()!=null&&b.getRuleExecution().getWhenFacts().size()>0){
|
|
||||||
whenFact.setEnabled(true);
|
|
||||||
}else {
|
|
||||||
whenFact.setEnabled(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
inputData.addClickListener(buttonClickEvent -> {
|
|
||||||
DialogPerso dialogPerso1=new DialogPerso();
|
|
||||||
|
|
||||||
BusinessTransactionAction b=gridActionLogging.getSelectedItems().stream().findFirst().get();
|
|
||||||
|
|
||||||
if(b!=null&&b.getInputData()!=null&&b.getInputData().getRealFact()!=null){
|
|
||||||
|
|
||||||
VerticalLayout verticalLayout=new VerticalLayout();
|
|
||||||
Label label=new Label(b.getEventType().name()+" - "+(b.getRuleExecution()!=null&&b.getRuleExecution().getRuleName()!=null?b.getRuleExecution().getRuleName():""));
|
|
||||||
label.setClassName("creation-runtime-title");
|
|
||||||
verticalLayout.add(label);
|
|
||||||
verticalLayout.setClassName("content-action-logging");
|
|
||||||
|
|
||||||
TextArea textArea=new TextArea(b.getInputData().getFactType().name());
|
|
||||||
textArea.setReadOnly(true);
|
|
||||||
textArea.setClassName("content-log");
|
|
||||||
textArea.setValue(
|
|
||||||
b.getInputData().getRealFact().toString().replaceAll(",",",\n")
|
|
||||||
.replaceAll("\\{","\\{\n")
|
|
||||||
.replaceAll("\\}","\n\\}")
|
|
||||||
.replaceAll("\\[","\n\\[")
|
|
||||||
|
|
||||||
);
|
|
||||||
verticalLayout.add(textArea);
|
|
||||||
|
|
||||||
|
|
||||||
dialogPerso1.add(verticalLayout);
|
|
||||||
}
|
|
||||||
|
|
||||||
dialogPerso1.open();
|
|
||||||
});
|
|
||||||
|
|
||||||
realFact.addClickListener(buttonClickEvent -> {
|
|
||||||
DialogPerso dialogPerso1=new DialogPerso();
|
|
||||||
|
|
||||||
BusinessTransactionAction b=gridActionLogging.getSelectedItems().stream().findFirst().get();
|
|
||||||
|
|
||||||
if(b!=null&&b.getFact()!=null&&b.getFact().getRealFact()!=null){
|
|
||||||
|
|
||||||
VerticalLayout verticalLayout=new VerticalLayout();
|
|
||||||
Label label=new Label(b.getEventType().name()+" - "+(b.getRuleExecution()!=null&&b.getRuleExecution().getRuleName()!=null?b.getRuleExecution().getRuleName():""));
|
|
||||||
label.setClassName("creation-runtime-title");
|
|
||||||
verticalLayout.add(label);
|
|
||||||
verticalLayout.setClassName("content-action-logging");
|
|
||||||
|
|
||||||
TextArea textArea=new TextArea(b.getFact().getFactType().name());
|
|
||||||
textArea.setReadOnly(true);
|
|
||||||
textArea.setClassName("content-log");
|
|
||||||
textArea.setValue(
|
|
||||||
b.getFact().getRealFact().toString().replaceAll(",",",\n")
|
|
||||||
.replaceAll("\\{","\\{\n")
|
|
||||||
.replaceAll("\\}","\n\\}")
|
|
||||||
.replaceAll("\\[","\n\\[")
|
|
||||||
|
|
||||||
);
|
|
||||||
verticalLayout.add(textArea);
|
|
||||||
|
|
||||||
|
|
||||||
dialogPerso1.add(verticalLayout);
|
|
||||||
}
|
|
||||||
|
|
||||||
dialogPerso1.open();
|
|
||||||
});
|
|
||||||
|
|
||||||
thenFact.addClickListener(buttonClickEvent -> {
|
|
||||||
DialogPerso dialogPerso1=new DialogPerso();
|
|
||||||
|
|
||||||
BusinessTransactionAction b=gridActionLogging.getSelectedItems().stream().findFirst().get();
|
|
||||||
|
|
||||||
if(b!=null&&b.getRuleExecution()!=null&&b.getRuleExecution().getThenFacts()!=null){
|
|
||||||
|
|
||||||
VerticalLayout verticalLayout=new VerticalLayout();
|
|
||||||
Label label=new Label(b.getEventType().name()+" - "+(b.getRuleExecution()!=null&&b.getRuleExecution().getRuleName()!=null?b.getRuleExecution().getRuleName():""));
|
|
||||||
label.setClassName("creation-runtime-title");
|
|
||||||
verticalLayout.add(label);
|
|
||||||
verticalLayout.setClassName("content-action-logging");
|
|
||||||
for (Fact fact:b.getRuleExecution().getThenFacts()){
|
|
||||||
if(fact!=null&&fact.getRealFact()!=null){
|
|
||||||
|
|
||||||
TextArea textArea=new TextArea(fact.getFactType().name());
|
|
||||||
textArea.setReadOnly(true);
|
|
||||||
textArea.setClassName("content-log");
|
|
||||||
textArea.setValue(
|
|
||||||
fact.getRealFact().toString().replaceAll(",",",\n")
|
|
||||||
.replaceAll("\\{","\\{\n")
|
|
||||||
.replaceAll("\\}","\n\\}")
|
|
||||||
.replaceAll("\\[","\n\\[")
|
|
||||||
|
|
||||||
);
|
|
||||||
verticalLayout.add(textArea);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
dialogPerso1.add(verticalLayout);
|
|
||||||
}
|
|
||||||
|
|
||||||
dialogPerso1.open();
|
|
||||||
});
|
|
||||||
whenFact.addClickListener(buttonClickEvent -> {
|
|
||||||
DialogPerso dialogPerso1=new DialogPerso();
|
|
||||||
|
|
||||||
BusinessTransactionAction b=gridActionLogging.getSelectedItems().stream().findFirst().get();
|
|
||||||
|
|
||||||
if(b!=null&&b.getRuleExecution()!=null&&b.getRuleExecution().getWhenFacts()!=null){
|
|
||||||
|
|
||||||
VerticalLayout verticalLayout=new VerticalLayout();
|
|
||||||
Label label=new Label(b.getEventType().name()+" - "+(b.getRuleExecution()!=null&&b.getRuleExecution().getRuleName()!=null?b.getRuleExecution().getRuleName():""));
|
|
||||||
label.setClassName("creation-runtime-title");
|
|
||||||
verticalLayout.add(label);
|
|
||||||
verticalLayout.setClassName("content-action-logging");
|
|
||||||
for (Fact fact:b.getRuleExecution().getWhenFacts()){
|
|
||||||
if(fact!=null&&fact.getRealFact()!=null){
|
|
||||||
|
|
||||||
TextArea textArea=new TextArea(fact.getFactType().name());
|
|
||||||
textArea.setReadOnly(true);
|
|
||||||
textArea.setClassName("content-log");
|
|
||||||
textArea.setValue(
|
|
||||||
fact.getRealFact().toString().replaceAll(",",",\n")
|
|
||||||
.replaceAll("\\{","\\{\n")
|
|
||||||
.replaceAll("\\}","\n\\}")
|
|
||||||
.replaceAll("\\[","\n\\[")
|
|
||||||
|
|
||||||
);
|
|
||||||
verticalLayout.add(textArea);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
dialogPerso1.add(verticalLayout);
|
|
||||||
}
|
|
||||||
|
|
||||||
dialogPerso1.open();
|
|
||||||
});
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,7 @@ import org.chtijbug.drools.proxy.persistence.model.ProjectPersist;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.HashMap;
|
import java.util.Map;
|
||||||
|
|
||||||
@StyleSheet("css/accueil.css")
|
@StyleSheet("css/accueil.css")
|
||||||
public class DeploymentView extends VerticalLayout implements AddLog {
|
public class DeploymentView extends VerticalLayout implements AddLog {
|
||||||
|
|
@ -215,7 +215,7 @@ public class DeploymentView extends VerticalLayout implements AddLog {
|
||||||
|
|
||||||
public void setDataProvider() {
|
public void setDataProvider() {
|
||||||
|
|
||||||
HashMap<String, ProjectPersist> projectPersists = projectPersistService.getProjectsSession();
|
Map<String, ProjectPersist> projectPersists = projectPersistService.getProjectsSession();
|
||||||
if (projectPersists != null) {
|
if (projectPersists != null) {
|
||||||
dataProvider = new ListDataProvider<>(projectPersists.values());
|
dataProvider = new ListDataProvider<>(projectPersists.values());
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -7,9 +7,11 @@ kie-wb.password=admin
|
||||||
|
|
||||||
adminConsole.tmpdir=/tmp
|
adminConsole.tmpdir=/tmp
|
||||||
|
|
||||||
|
org.kie.server.controller=http://localhost:18080/kie-wb/rest
|
||||||
|
org.kie.server.location=http://localhost:8200/api/server
|
||||||
|
org.kie.server.id=pymmaConsole2
|
||||||
spring.data.mongodb.database=businessProxyDB
|
spring.data.mongodb.database=businessProxyDB
|
||||||
spring.data.mongodb.host=localhost:28017
|
spring.data.mongodb.host=localhost:28017
|
||||||
|
|
||||||
spring.servlet.multipart.enabled=false
|
spring.servlet.multipart.enabled=false
|
||||||
|
kafka.bootstrapAddress=localhost:9092,localhost:9093,localhost:9094
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,8 @@
|
||||||
|
package org.chtijbug.drools.common;
|
||||||
|
|
||||||
|
public class KafkaTopicConstants {
|
||||||
|
public final static String LOGING_TOPIC ="logging";
|
||||||
|
public final static String RESPONSE_TOPIC ="Response";
|
||||||
|
public final static String RESPONSE_DEPLOY_TOPIC ="ResponseDeploy";
|
||||||
|
public final static String REVERSE_PROXY="proxy";
|
||||||
|
}
|
||||||
|
|
@ -8,7 +8,7 @@ import org.chtijbug.drools.common.rest.MultipleInputs;
|
||||||
import org.chtijbug.drools.kieserver.extension.KieServerAddOnElement;
|
import org.chtijbug.drools.kieserver.extension.KieServerAddOnElement;
|
||||||
import org.chtijbug.drools.kieserver.extension.KieServerLoggingDefinition;
|
import org.chtijbug.drools.kieserver.extension.KieServerLoggingDefinition;
|
||||||
import org.chtijbug.drools.logging.SessionExecution;
|
import org.chtijbug.drools.logging.SessionExecution;
|
||||||
import org.chtijbug.kieserver.services.drools.ChtijbugObjectRequest;
|
import org.chtijbug.drools.ChtijbugObjectRequest;
|
||||||
import org.chtijbug.kieserver.services.drools.DroolsChtijbugRulesExecutionService;
|
import org.chtijbug.kieserver.services.drools.DroolsChtijbugRulesExecutionService;
|
||||||
import org.kie.server.services.api.KieContainerInstance;
|
import org.kie.server.services.api.KieContainerInstance;
|
||||||
import org.kie.server.services.api.KieServerRegistry;
|
import org.kie.server.services.api.KieServerRegistry;
|
||||||
|
|
|
||||||
|
|
@ -1,29 +0,0 @@
|
||||||
package org.chtijbug.kieserver.services.drools;
|
|
||||||
|
|
||||||
import org.chtijbug.drools.SessionContext;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Created by nheron on 07/07/2016.
|
|
||||||
*/
|
|
||||||
public class ChtijbugObjectRequest {
|
|
||||||
|
|
||||||
private Object objectRequest;
|
|
||||||
|
|
||||||
private SessionContext sessionLogging;
|
|
||||||
|
|
||||||
public Object getObjectRequest() {
|
|
||||||
return objectRequest;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setObjectRequest(Object objectRequest) {
|
|
||||||
this.objectRequest = objectRequest;
|
|
||||||
}
|
|
||||||
|
|
||||||
public SessionContext getSessionLogging() {
|
|
||||||
return sessionLogging;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setSessionLogging(SessionContext sessionLogging) {
|
|
||||||
this.sessionLogging = sessionLogging;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -19,7 +19,6 @@ import org.chtijbug.drools.kieserver.extension.KieServerAddOnElement;
|
||||||
import org.chtijbug.drools.kieserver.extension.KieServerGlobalVariableDefinition;
|
import org.chtijbug.drools.kieserver.extension.KieServerGlobalVariableDefinition;
|
||||||
import org.chtijbug.drools.kieserver.extension.KieServerListenerDefinition;
|
import org.chtijbug.drools.kieserver.extension.KieServerListenerDefinition;
|
||||||
import org.chtijbug.drools.kieserver.extension.KieServerLoggingDefinition;
|
import org.chtijbug.drools.kieserver.extension.KieServerLoggingDefinition;
|
||||||
import org.chtijbug.kieserver.services.drools.sftp.SftpServerService;
|
|
||||||
import org.drools.compiler.kie.builder.impl.InternalKieModule;
|
import org.drools.compiler.kie.builder.impl.InternalKieModule;
|
||||||
import org.drools.compiler.kie.builder.impl.KieRepositoryImpl;
|
import org.drools.compiler.kie.builder.impl.KieRepositoryImpl;
|
||||||
import org.kie.api.builder.KieRepository;
|
import org.kie.api.builder.KieRepository;
|
||||||
|
|
@ -34,7 +33,6 @@ import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import javax.xml.bind.annotation.XmlRootElement;
|
import javax.xml.bind.annotation.XmlRootElement;
|
||||||
import javax.xml.bind.annotation.XmlType;
|
import javax.xml.bind.annotation.XmlType;
|
||||||
import java.io.IOException;
|
|
||||||
import java.lang.annotation.Annotation;
|
import java.lang.annotation.Annotation;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
|
|
@ -54,7 +52,7 @@ public class DroolsChtijbugKieServerExtension implements KieServerExtension {
|
||||||
|
|
||||||
private boolean initialized = false;
|
private boolean initialized = false;
|
||||||
|
|
||||||
private SftpServerService sftpServerService;
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isInitialized() {
|
public boolean isInitialized() {
|
||||||
|
|
@ -73,12 +71,6 @@ public class DroolsChtijbugKieServerExtension implements KieServerExtension {
|
||||||
this.registry = registry;
|
this.registry = registry;
|
||||||
services.add(rulesExecutionService);
|
services.add(rulesExecutionService);
|
||||||
initialized = true;
|
initialized = true;
|
||||||
sftpServerService = new SftpServerService();
|
|
||||||
try {
|
|
||||||
sftpServerService.initServer();
|
|
||||||
} catch (IOException e) {
|
|
||||||
logger.error("Impossible to create sftp server", e);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initExtensionsList() {
|
private void initExtensionsList() {
|
||||||
|
|
|
||||||
|
|
@ -15,6 +15,7 @@
|
||||||
|
|
||||||
package org.chtijbug.kieserver.services.drools;
|
package org.chtijbug.kieserver.services.drools;
|
||||||
|
|
||||||
|
import org.chtijbug.drools.ChtijbugObjectRequest;
|
||||||
import org.chtijbug.drools.SessionContext;
|
import org.chtijbug.drools.SessionContext;
|
||||||
import org.chtijbug.drools.kieserver.extension.KieServerAddOnElement;
|
import org.chtijbug.drools.kieserver.extension.KieServerAddOnElement;
|
||||||
import org.chtijbug.drools.kieserver.extension.KieServerGlobalVariableDefinition;
|
import org.chtijbug.drools.kieserver.extension.KieServerGlobalVariableDefinition;
|
||||||
|
|
|
||||||
|
|
@ -1,83 +0,0 @@
|
||||||
package org.chtijbug.kieserver.services.drools.sftp;
|
|
||||||
|
|
||||||
|
|
||||||
import org.apache.sshd.common.NamedFactory;
|
|
||||||
import org.apache.sshd.common.PropertyResolverUtils;
|
|
||||||
import org.apache.sshd.common.file.virtualfs.VirtualFileSystemFactory;
|
|
||||||
import org.apache.sshd.server.Command;
|
|
||||||
import org.apache.sshd.server.ServerFactoryManager;
|
|
||||||
import org.apache.sshd.server.SshServer;
|
|
||||||
import org.apache.sshd.server.keyprovider.SimpleGeneratorHostKeyProvider;
|
|
||||||
import org.apache.sshd.server.scp.ScpCommandFactory;
|
|
||||||
import org.apache.sshd.server.subsystem.sftp.SftpSubsystemFactory;
|
|
||||||
import org.slf4j.Logger;
|
|
||||||
import org.slf4j.LoggerFactory;
|
|
||||||
|
|
||||||
import javax.annotation.PostConstruct;
|
|
||||||
import javax.inject.Singleton;
|
|
||||||
import java.io.File;
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.nio.file.Paths;
|
|
||||||
import java.util.Arrays;
|
|
||||||
|
|
||||||
@Singleton
|
|
||||||
public class SftpServerService {
|
|
||||||
|
|
||||||
private final String BANNER =
|
|
||||||
"\n\nWelcome to Pymma Server kie server ssh Server!\n\n";
|
|
||||||
private Logger logger = LoggerFactory.getLogger(this.getClass());
|
|
||||||
private SshServer sshd;
|
|
||||||
private String server = "0.0.0.0";
|
|
||||||
private Integer port = -1;
|
|
||||||
private String login = "kieserver";
|
|
||||||
private String password = "kieserver1";
|
|
||||||
private String sftpDir = System.getProperty("org.chtijbug.server.tracedir");
|
|
||||||
|
|
||||||
|
|
||||||
public SftpServerService() {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@PostConstruct
|
|
||||||
public void initServer() throws IOException {
|
|
||||||
if (System.getProperty("org.chtijbug.server.sftpPort") != null) {
|
|
||||||
try {
|
|
||||||
port = Integer.valueOf(System.getProperty("org.chtijbug.server.sftpPort"));
|
|
||||||
} catch (NumberFormatException e) {
|
|
||||||
port = 9080;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (System.getProperty("org.chtijbug.server.tracedir") != null) {
|
|
||||||
sftpDir = System.getProperty("org.chtijbug.server.tracedir");
|
|
||||||
}
|
|
||||||
sshd = SshServer.setUpDefaultServer();
|
|
||||||
PropertyResolverUtils.updateProperty(
|
|
||||||
sshd,
|
|
||||||
ServerFactoryManager.WELCOME_BANNER,
|
|
||||||
BANNER);
|
|
||||||
|
|
||||||
sshd.setHost(server);
|
|
||||||
sshd.setPort(port);
|
|
||||||
sshd.setPasswordAuthenticator(new MyPasswordAuthenticator(login, password));
|
|
||||||
sshd.setPublickeyAuthenticator(new MyPublickeyAuthenticator());
|
|
||||||
sshd.setKeyPairProvider(new SimpleGeneratorHostKeyProvider());
|
|
||||||
final String filePath = sftpDir;
|
|
||||||
File f = new File(filePath);
|
|
||||||
if (f.exists() == false) {
|
|
||||||
f.mkdir();
|
|
||||||
}
|
|
||||||
sshd.setFileSystemFactory(new VirtualFileSystemFactory(Paths.get(filePath)));
|
|
||||||
SftpSubsystemFactory factory = new SftpSubsystemFactory.Builder().build();
|
|
||||||
sshd.setSubsystemFactories(Arrays.<NamedFactory<Command>>asList(factory));
|
|
||||||
//sshd.setShellFactory(new ProcessShellFactory(new String[] { "/bin/sh", "-i", "-l" }));
|
|
||||||
sshd.setCommandFactory(new ScpCommandFactory());
|
|
||||||
// sshd.setShellFactory( new SshSessionFactory() );
|
|
||||||
sshd.start();
|
|
||||||
logger.info("Serveur SSH demarre sur host " + this.server + " port " + this.port);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public void setServer(String server) {
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -30,6 +30,7 @@ import org.uberfire.ext.security.management.util.SecurityManagementUtils;
|
||||||
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -77,6 +78,11 @@ public class KiePlatformGroupManager implements GroupManager, ContextualManager
|
||||||
throw new UnsupportedServiceCapabilityException(Capability.CAN_READ_GROUP);
|
throw new UnsupportedServiceCapabilityException(Capability.CAN_READ_GROUP);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<Group> getAll() throws SecurityManagementException {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Group create(Group entity) throws SecurityManagementException {
|
public Group create(Group entity) throws SecurityManagementException {
|
||||||
throw new UnsupportedServiceCapabilityException(Capability.CAN_ADD_GROUP);
|
throw new UnsupportedServiceCapabilityException(Capability.CAN_ADD_GROUP);
|
||||||
|
|
|
||||||
|
|
@ -30,6 +30,7 @@ import org.uberfire.ext.security.management.search.IdentifierRuntimeSearchEngine
|
||||||
import org.uberfire.ext.security.management.util.SecurityManagementUtils;
|
import org.uberfire.ext.security.management.util.SecurityManagementUtils;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -79,6 +80,11 @@ public class KiePlatformRoleManager implements RoleManager,ContextualManager {
|
||||||
throw new UnsupportedServiceCapabilityException(Capability.CAN_READ_ROLE);
|
throw new UnsupportedServiceCapabilityException(Capability.CAN_READ_ROLE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<Role> getAll() throws SecurityManagementException {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Role create(Role entity) throws SecurityManagementException {
|
public Role create(Role entity) throws SecurityManagementException {
|
||||||
throw new UnsupportedServiceCapabilityException(Capability.CAN_ADD_ROLE);
|
throw new UnsupportedServiceCapabilityException(Capability.CAN_ADD_ROLE);
|
||||||
|
|
|
||||||
|
|
@ -28,10 +28,7 @@ import org.uberfire.ext.security.management.search.IdentifierRuntimeSearchEngine
|
||||||
import org.uberfire.ext.security.management.search.UsersIdentifierRuntimeSearchEngine;
|
import org.uberfire.ext.security.management.search.UsersIdentifierRuntimeSearchEngine;
|
||||||
import org.uberfire.ext.security.management.util.SecurityManagementUtils;
|
import org.uberfire.ext.security.management.util.SecurityManagementUtils;
|
||||||
|
|
||||||
import java.util.Collection;
|
import java.util.*;
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>Users manager service provider implementation for Apache tomcat, when using default realm based on properties files.</p>
|
* <p>Users manager service provider implementation for Apache tomcat, when using default realm based on properties files.</p>
|
||||||
|
|
@ -82,6 +79,11 @@ public class KiePlatformUserManager implements UserManager, ContextualManager {
|
||||||
throw new UnsupportedServiceCapabilityException(Capability.CAN_READ_USER);
|
throw new UnsupportedServiceCapabilityException(Capability.CAN_READ_USER);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<User> getAll() throws SecurityManagementException {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public User create(User entity) throws SecurityManagementException {
|
public User create(User entity) throws SecurityManagementException {
|
||||||
throw new UnsupportedServiceCapabilityException(Capability.CAN_ADD_USER);
|
throw new UnsupportedServiceCapabilityException(Capability.CAN_ADD_USER);
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,105 @@
|
||||||
|
package org.chtijbug.drools;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by nheron on 07/07/2016.
|
||||||
|
*/
|
||||||
|
public class ChtijbugObjectRequest {
|
||||||
|
|
||||||
|
|
||||||
|
private String transactionID;
|
||||||
|
private LocalDateTime transactionStartTimeStamp;
|
||||||
|
private LocalDateTime transactionEndTimeStamp;
|
||||||
|
|
||||||
|
private String processID;
|
||||||
|
private String containerID;
|
||||||
|
|
||||||
|
private String artifactID;
|
||||||
|
private String groupID;
|
||||||
|
private String version;
|
||||||
|
|
||||||
|
private Object objectRequest;
|
||||||
|
|
||||||
|
private SessionContext sessionLogging;
|
||||||
|
|
||||||
|
public String getTransactionID() {
|
||||||
|
return transactionID;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTransactionID(String transactionID) {
|
||||||
|
this.transactionID = transactionID;
|
||||||
|
}
|
||||||
|
|
||||||
|
public LocalDateTime getTransactionStartTimeStamp() {
|
||||||
|
return transactionStartTimeStamp;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTransactionStartTimeStamp(LocalDateTime transactionStartTimeStamp) {
|
||||||
|
this.transactionStartTimeStamp = transactionStartTimeStamp;
|
||||||
|
}
|
||||||
|
|
||||||
|
public LocalDateTime getTransactionEndTimeStamp() {
|
||||||
|
return transactionEndTimeStamp;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTransactionEndTimeStamp(LocalDateTime transactionEndTimeStamp) {
|
||||||
|
this.transactionEndTimeStamp = transactionEndTimeStamp;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Object getObjectRequest() {
|
||||||
|
return objectRequest;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setObjectRequest(Object objectRequest) {
|
||||||
|
this.objectRequest = objectRequest;
|
||||||
|
}
|
||||||
|
|
||||||
|
public SessionContext getSessionLogging() {
|
||||||
|
return sessionLogging;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSessionLogging(SessionContext sessionLogging) {
|
||||||
|
this.sessionLogging = sessionLogging;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getProcessID() {
|
||||||
|
return processID;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setProcessID(String processID) {
|
||||||
|
this.processID = processID;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getContainerID() {
|
||||||
|
return containerID;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setContainerID(String containerID) {
|
||||||
|
this.containerID = containerID;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getArtifactID() {
|
||||||
|
return artifactID;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setArtifactID(String artifactID) {
|
||||||
|
this.artifactID = artifactID;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getGroupID() {
|
||||||
|
return groupID;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setGroupID(String groupID) {
|
||||||
|
this.groupID = groupID;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getVersion() {
|
||||||
|
return version;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setVersion(String version) {
|
||||||
|
this.version = version;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,62 @@
|
||||||
|
package org.chtijbug.drools;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class KieContainerResponse {
|
||||||
|
|
||||||
|
public enum STATUS {
|
||||||
|
ERROR,
|
||||||
|
SUCCESS
|
||||||
|
}
|
||||||
|
|
||||||
|
private KieContainerUpdate kieContainerUpdate;
|
||||||
|
|
||||||
|
private String messageError;
|
||||||
|
|
||||||
|
private STATUS status;
|
||||||
|
|
||||||
|
private List<String> errorMessages= new ArrayList<>();
|
||||||
|
|
||||||
|
public KieContainerUpdate getKieContainerUpdate() {
|
||||||
|
return kieContainerUpdate;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setKieContainerUpdate(KieContainerUpdate kieContainerUpdate) {
|
||||||
|
this.kieContainerUpdate = kieContainerUpdate;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getMessageError() {
|
||||||
|
return messageError;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMessageError(String messageError) {
|
||||||
|
this.messageError = messageError;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<String> getErrorMessages() {
|
||||||
|
return errorMessages;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setErrorMessages(List<String> errorMessages) {
|
||||||
|
this.errorMessages = errorMessages;
|
||||||
|
}
|
||||||
|
|
||||||
|
public STATUS getStatus() {
|
||||||
|
return status;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setStatus(STATUS status) {
|
||||||
|
this.status = status;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
final StringBuffer sb = new StringBuffer("KieContainerResponse{");
|
||||||
|
sb.append("kieContainerUpdate=").append(kieContainerUpdate);
|
||||||
|
sb.append(", messageError='").append(messageError).append('\'');
|
||||||
|
sb.append(", status=").append(status);
|
||||||
|
sb.append('}');
|
||||||
|
return sb.toString();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,94 @@
|
||||||
|
package org.chtijbug.drools;
|
||||||
|
|
||||||
|
public class KieContainerUpdate {
|
||||||
|
|
||||||
|
public enum STATUS {
|
||||||
|
TODEPLOY,
|
||||||
|
TODELETE
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private String mainClass;
|
||||||
|
|
||||||
|
private String groupID;
|
||||||
|
|
||||||
|
private String artifactID;
|
||||||
|
|
||||||
|
private String processID;
|
||||||
|
|
||||||
|
private String projectVersion;
|
||||||
|
|
||||||
|
private String containerID;
|
||||||
|
|
||||||
|
private STATUS action;
|
||||||
|
|
||||||
|
public String getMainClass() {
|
||||||
|
return mainClass;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMainClass(String mainClass) {
|
||||||
|
this.mainClass = mainClass;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getGroupID() {
|
||||||
|
return groupID;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setGroupID(String groupID) {
|
||||||
|
this.groupID = groupID;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getArtifactID() {
|
||||||
|
return artifactID;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setArtifactID(String artifactID) {
|
||||||
|
this.artifactID = artifactID;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getProcessID() {
|
||||||
|
return processID;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setProcessID(String processID) {
|
||||||
|
this.processID = processID;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getProjectVersion() {
|
||||||
|
return projectVersion;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setProjectVersion(String projectVersion) {
|
||||||
|
this.projectVersion = projectVersion;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getContainerID() {
|
||||||
|
return containerID;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setContainerID(String containerID) {
|
||||||
|
this.containerID = containerID;
|
||||||
|
}
|
||||||
|
|
||||||
|
public STATUS getAction() {
|
||||||
|
return action;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAction(STATUS action) {
|
||||||
|
this.action = action;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
final StringBuffer sb = new StringBuffer("KieContainerUpdate{");
|
||||||
|
sb.append("mainClass='").append(mainClass).append('\'');
|
||||||
|
sb.append(", groupID='").append(groupID).append('\'');
|
||||||
|
sb.append(", artifactID='").append(artifactID).append('\'');
|
||||||
|
sb.append(", processID='").append(processID).append('\'');
|
||||||
|
sb.append(", projectVersion='").append(projectVersion).append('\'');
|
||||||
|
sb.append(", containerID='").append(containerID).append('\'');
|
||||||
|
sb.append(", action=").append(action);
|
||||||
|
sb.append('}');
|
||||||
|
return sb.toString();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,26 @@
|
||||||
|
package org.chtijbug.drools;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class ReverseProxyUpdate {
|
||||||
|
private String path;
|
||||||
|
|
||||||
|
List<String> serverNames = new ArrayList<>();
|
||||||
|
|
||||||
|
public String getPath() {
|
||||||
|
return path;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPath(String path) {
|
||||||
|
this.path = path;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<String> getServerNames() {
|
||||||
|
return serverNames;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setServerNames(List<String> serverNames) {
|
||||||
|
this.serverNames = serverNames;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -23,82 +23,67 @@
|
||||||
<orderEntry type="library" name="Maven: org.kie:kie-internal:7.23.0.Final" level="project" />
|
<orderEntry type="library" name="Maven: org.kie:kie-internal:7.23.0.Final" level="project" />
|
||||||
<orderEntry type="library" name="Maven: org.kie:kie-api:7.23.0.Final" level="project" />
|
<orderEntry type="library" name="Maven: org.kie:kie-api:7.23.0.Final" level="project" />
|
||||||
<orderEntry type="library" name="Maven: org.kie.soup:kie-soup-maven-support:7.23.0.Final" level="project" />
|
<orderEntry type="library" name="Maven: org.kie.soup:kie-soup-maven-support:7.23.0.Final" level="project" />
|
||||||
<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-web:2.2.6.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-starter:2.2.6.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:2.2.6.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-autoconfigure:2.2.6.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: org.springframework.boot:spring-boot-starter-logging:2.2.6.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-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: 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-to-slf4j:2.12.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.apache.logging.log4j:log4j-api:2.12.1" level="project" />
|
||||||
<orderEntry type="library" name="Maven: org.slf4j:jul-to-slf4j:1.7.25" level="project" />
|
<orderEntry type="library" name="Maven: org.slf4j:jul-to-slf4j:1.7.30" level="project" />
|
||||||
<orderEntry type="library" name="Maven: javax.annotation:javax.annotation-api:1.3.2" level="project" />
|
<orderEntry type="library" name="Maven: jakarta.annotation:jakarta.annotation-api:1.3.5" 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-core:5.2.5.RELEASE" level="project" />
|
||||||
<orderEntry type="library" name="Maven: org.springframework:spring-jcl:5.1.2.RELEASE" level="project" />
|
<orderEntry type="library" name="Maven: org.springframework:spring-jcl:5.2.5.RELEASE" level="project" />
|
||||||
<orderEntry type="library" scope="RUNTIME" name="Maven: org.yaml:snakeyaml:1.23" level="project" />
|
<orderEntry type="library" scope="RUNTIME" name="Maven: org.yaml:snakeyaml:1.25" 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: org.springframework.boot:spring-boot-starter-json:2.2.6.RELEASE" 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-jdk8:2.10.3" 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.datatype:jackson-datatype-jsr310:2.10.3" 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: com.fasterxml.jackson.module:jackson-module-parameter-names:2.10.3" level="project" />
|
||||||
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-tomcat:2.1.0.RELEASE" level="project" />
|
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-tomcat:2.2.6.RELEASE" level="project" />
|
||||||
<orderEntry type="library" name="Maven: org.apache.tomcat.embed:tomcat-embed-core:9.0.12" level="project" />
|
<orderEntry type="library" name="Maven: org.apache.tomcat.embed:tomcat-embed-core:9.0.33" level="project" />
|
||||||
<orderEntry type="library" name="Maven: org.apache.tomcat.embed:tomcat-embed-el:9.0.12" level="project" />
|
<orderEntry type="library" name="Maven: org.apache.tomcat.embed:tomcat-embed-el:9.0.33" level="project" />
|
||||||
<orderEntry type="library" name="Maven: org.apache.tomcat.embed:tomcat-embed-websocket:9.0.12" level="project" />
|
<orderEntry type="library" name="Maven: org.apache.tomcat.embed:tomcat-embed-websocket:9.0.33" level="project" />
|
||||||
<orderEntry type="library" name="Maven: org.hibernate.validator:hibernate-validator:6.0.13.Final" level="project" />
|
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-validation:2.2.6.RELEASE" level="project" />
|
||||||
<orderEntry type="library" name="Maven: javax.validation:validation-api:2.0.1.Final" level="project" />
|
<orderEntry type="library" name="Maven: jakarta.validation:jakarta.validation-api:2.0.2" level="project" />
|
||||||
<orderEntry type="library" name="Maven: org.jboss.logging:jboss-logging:3.3.2.Final" level="project" />
|
<orderEntry type="library" name="Maven: org.hibernate.validator:hibernate-validator:6.0.18.Final" level="project" />
|
||||||
<orderEntry type="library" name="Maven: com.fasterxml:classmate:1.4.0" level="project" />
|
<orderEntry type="library" name="Maven: org.jboss.logging:jboss-logging:3.4.1.Final" level="project" />
|
||||||
<orderEntry type="library" name="Maven: org.springframework:spring-web:5.1.2.RELEASE" level="project" />
|
<orderEntry type="library" name="Maven: com.fasterxml:classmate:1.5.1" 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-web:5.2.5.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-beans:5.2.5.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-webmvc:5.2.5.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.2.5.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:spring-expression:5.2.5.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: org.springframework.kafka:spring-kafka:2.3.7.RELEASE" level="project" />
|
||||||
<orderEntry type="library" name="Maven: io.undertow:undertow-core:2.0.14.Final" level="project" />
|
<orderEntry type="library" name="Maven: org.apache.kafka:kafka-clients:2.3.1" level="project" />
|
||||||
<orderEntry type="library" name="Maven: org.jboss.xnio:xnio-api:3.3.8.Final" level="project" />
|
<orderEntry type="library" name="Maven: com.github.luben:zstd-jni:1.4.0-1" 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: org.lz4:lz4-java:1.6.0" level="project" />
|
||||||
<orderEntry type="library" name="Maven: io.undertow:undertow-servlet:2.0.14.Final" level="project" />
|
<orderEntry type="library" name="Maven: org.xerial.snappy:snappy-java:1.1.7.3" 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: org.slf4j:slf4j-api:1.7.30" level="project" />
|
||||||
<orderEntry type="library" name="Maven: io.undertow:undertow-websockets-jsr:2.0.14.Final" level="project" />
|
<orderEntry type="library" name="Maven: org.springframework.retry:spring-retry:1.2.5.RELEASE" 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: org.springframework:spring-context:5.2.5.RELEASE" level="project" />
|
||||||
<orderEntry type="library" name="Maven: javax.servlet:javax.servlet-api:4.0.1" level="project" />
|
<orderEntry type="library" name="Maven: org.springframework:spring-messaging:5.2.5.RELEASE" level="project" />
|
||||||
<orderEntry type="library" name="Maven: org.glassfish:javax.el:3.0.0" level="project" />
|
<orderEntry type="library" name="Maven: org.springframework:spring-tx:5.2.5.RELEASE" 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-quartz2: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: org.slf4j:slf4j-api:1.7.25" level="project" />
|
|
||||||
<orderEntry type="library" name="Maven: org.quartz-scheduler:quartz:2.3.0" level="project" />
|
|
||||||
<orderEntry type="library" name="Maven: com.mchange:mchange-commons-java:0.2.11" level="project" />
|
|
||||||
<orderEntry type="library" name="Maven: com.mchange:c3p0:0.9.5.2" 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="module" module-name="drools-framework-business-proxy-persistence" />
|
<orderEntry type="module" module-name="drools-framework-business-proxy-persistence" />
|
||||||
<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-data-mongodb:2.2.6.RELEASE" level="project" />
|
||||||
<orderEntry type="library" name="Maven: org.mongodb:mongodb-driver:3.8.2" level="project" />
|
<orderEntry type="library" name="Maven: org.mongodb:mongodb-driver:3.11.2" level="project" />
|
||||||
<orderEntry type="library" name="Maven: org.mongodb:bson:3.8.2" level="project" />
|
<orderEntry type="library" name="Maven: org.mongodb:bson:3.11.2" level="project" />
|
||||||
<orderEntry type="library" name="Maven: org.mongodb:mongodb-driver-core:3.8.2" level="project" />
|
<orderEntry type="library" name="Maven: org.mongodb:mongodb-driver-core:3.11.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.data:spring-data-mongodb:2.2.6.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.springframework.data:spring-data-commons:2.2.6.RELEASE" 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.core:jackson-annotations:2.10.3" level="project" />
|
||||||
<orderEntry type="library" name="Maven: org.apache.camel:camel-ftp:2.23.0" level="project" />
|
|
||||||
<orderEntry type="library" name="Maven: com.jcraft:jsch:0.1.54" level="project" />
|
|
||||||
<orderEntry type="library" name="Maven: commons-net:commons-net:3.6" level="project" />
|
|
||||||
<orderEntry type="module" module-name="drools-framework-runtime-entity" />
|
<orderEntry type="module" module-name="drools-framework-runtime-entity" />
|
||||||
<orderEntry type="module" module-name="drools-framework-common" />
|
<orderEntry type="module" module-name="drools-framework-common" />
|
||||||
<orderEntry type="library" name="Maven: junit:junit:4.12" level="project" />
|
<orderEntry type="library" name="Maven: junit:junit:4.12" level="project" />
|
||||||
<orderEntry type="library" name="Maven: org.hamcrest:hamcrest-core:1.3" level="project" />
|
<orderEntry type="library" name="Maven: org.hamcrest:hamcrest-core:2.1" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.hamcrest:hamcrest:2.1" level="project" />
|
||||||
<orderEntry type="library" name="Maven: com.google.guava:guava:13.0.1" level="project" />
|
<orderEntry type="library" name="Maven: com.google.guava:guava:13.0.1" level="project" />
|
||||||
<orderEntry type="library" name="Maven: commons-io:commons-io:2.6" level="project" />
|
<orderEntry type="library" name="Maven: commons-io:commons-io:2.1" 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-databind:2.10.3" 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.core:jackson-core:2.10.3" level="project" />
|
||||||
<orderEntry type="library" name="Maven: org.kie:kie-internal:7.38.0.Final" level="project" />
|
<orderEntry type="library" name="Maven: org.kie:kie-internal:7.39.0.Final" level="project" />
|
||||||
<orderEntry type="library" name="Maven: org.kie:kie-api:7.38.0.Final" level="project" />
|
<orderEntry type="library" name="Maven: org.kie:kie-api:7.39.0.Final" level="project" />
|
||||||
<orderEntry type="library" name="Maven: org.kie.soup:kie-soup-maven-support:7.38.0.Final" level="project" />
|
<orderEntry type="library" name="Maven: org.kie.soup:kie-soup-maven-support:7.39.0.Final" level="project" />
|
||||||
</component>
|
</component>
|
||||||
</module>
|
</module>
|
||||||
|
|
@ -21,13 +21,6 @@
|
||||||
<type>pom</type>
|
<type>pom</type>
|
||||||
<scope>import</scope>
|
<scope>import</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
|
||||||
<groupId>org.apache.camel</groupId>
|
|
||||||
<artifactId>camel-spring-boot-dependencies</artifactId>
|
|
||||||
<version>${camel.version}</version>
|
|
||||||
<type>pom</type>
|
|
||||||
<scope>import</scope>
|
|
||||||
</dependency>
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
</dependencyManagement>
|
</dependencyManagement>
|
||||||
|
|
||||||
|
|
@ -37,31 +30,23 @@
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>spring-boot-starter-web</artifactId>
|
<artifactId>spring-boot-starter-web</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
|
||||||
<groupId>org.springframework.boot</groupId>
|
|
||||||
<artifactId>spring-boot-starter-undertow</artifactId>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<!-- Camel -->
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.apache.camel</groupId>
|
|
||||||
<artifactId>camel-spring-boot-starter</artifactId>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.apache.camel</groupId>
|
<groupId>org.springframework.kafka</groupId>
|
||||||
<artifactId>camel-quartz2</artifactId>
|
<artifactId>spring-kafka</artifactId>
|
||||||
|
<version>${kafka.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<!-- kie-server -->
|
||||||
|
<!--dependency>
|
||||||
|
<groupId>com.fasterxml.jackson.core</groupId>
|
||||||
|
<artifactId>jackson-databind</artifactId>
|
||||||
|
<version>2.9.7</version>
|
||||||
|
</dependency-->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.pymmasoftware.jbpm</groupId>
|
<groupId>com.pymmasoftware.jbpm</groupId>
|
||||||
<artifactId>drools-framework-business-proxy-persistence</artifactId>
|
<artifactId>drools-framework-business-proxy-persistence</artifactId>
|
||||||
<version>${project.version}</version>
|
<version>${project.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
|
||||||
<groupId>org.apache.camel</groupId>
|
|
||||||
<artifactId>camel-ftp</artifactId>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.pymmasoftware.jbpm</groupId>
|
<groupId>com.pymmasoftware.jbpm</groupId>
|
||||||
<artifactId>drools-framework-runtime-entity</artifactId>
|
<artifactId>drools-framework-runtime-entity</artifactId>
|
||||||
|
|
|
||||||
|
|
@ -16,18 +16,53 @@
|
||||||
*/
|
*/
|
||||||
package org.chtijbug.drools.indexer;
|
package org.chtijbug.drools.indexer;
|
||||||
|
|
||||||
|
import org.apache.kafka.clients.consumer.ConsumerConfig;
|
||||||
|
import org.apache.kafka.common.serialization.StringDeserializer;
|
||||||
|
import org.chtijbug.drools.ChtijbugObjectRequest;
|
||||||
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.boot.SpringApplication;
|
import org.springframework.boot.SpringApplication;
|
||||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||||
|
import org.springframework.context.annotation.Bean;
|
||||||
import org.springframework.context.annotation.Configuration;
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
|
||||||
import org.springframework.data.mongodb.repository.config.EnableMongoRepositories;
|
import org.springframework.data.mongodb.repository.config.EnableMongoRepositories;
|
||||||
|
import org.springframework.kafka.annotation.EnableKafka;
|
||||||
|
import org.springframework.kafka.config.ConcurrentKafkaListenerContainerFactory;
|
||||||
|
import org.springframework.kafka.core.ConsumerFactory;
|
||||||
|
import org.springframework.kafka.core.DefaultKafkaConsumerFactory;
|
||||||
|
import org.springframework.kafka.support.serializer.JsonDeserializer;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
// CHECKSTYLE:OFF
|
// CHECKSTYLE:OFF
|
||||||
@SpringBootApplication
|
@SpringBootApplication
|
||||||
@Configuration
|
@Configuration
|
||||||
@EnableMongoRepositories(basePackages = "org.chtijbug.drools.proxy.persistence.repository")
|
@EnableMongoRepositories(basePackages = "org.chtijbug.drools.proxy.persistence.repository")
|
||||||
|
@EnableKafka
|
||||||
public class DroolsBusinessIndexerServer {
|
public class DroolsBusinessIndexerServer {
|
||||||
|
public final static String LOGING_TOPIC ="logging";
|
||||||
|
@Value(value = "${kafka.bootstrapAddress}")
|
||||||
|
private String bootstrapAddress;
|
||||||
|
|
||||||
|
|
||||||
|
@Value(value = "${kafka.index.groupid})")
|
||||||
|
private String groupID;
|
||||||
|
|
||||||
|
public ConsumerFactory<String, ChtijbugObjectRequest> greetingConsumerFactory() {
|
||||||
|
Map<String, Object> props = new HashMap<>();
|
||||||
|
props.put(ConsumerConfig.BOOTSTRAP_SERVERS_CONFIG, bootstrapAddress);
|
||||||
|
props.put(ConsumerConfig.GROUP_ID_CONFIG, groupID);
|
||||||
|
return new DefaultKafkaConsumerFactory<>(props, new StringDeserializer(), new JsonDeserializer<>(ChtijbugObjectRequest.class));
|
||||||
|
}
|
||||||
|
@Bean
|
||||||
|
public ConcurrentKafkaListenerContainerFactory<String, ChtijbugObjectRequest>
|
||||||
|
ruleKafkaListenerContainerFactory() {
|
||||||
|
|
||||||
|
ConcurrentKafkaListenerContainerFactory<String, ChtijbugObjectRequest> factory =
|
||||||
|
new ConcurrentKafkaListenerContainerFactory<>();
|
||||||
|
factory.setConsumerFactory(greetingConsumerFactory());
|
||||||
|
return factory;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -1,12 +0,0 @@
|
||||||
package org.chtijbug.drools.indexer.route;
|
|
||||||
|
|
||||||
import org.apache.camel.builder.RouteBuilder;
|
|
||||||
import org.springframework.stereotype.Component;
|
|
||||||
|
|
||||||
@Component
|
|
||||||
public class DeclareNewSftpRouter extends RouteBuilder {
|
|
||||||
@Override
|
|
||||||
public void configure() throws Exception {
|
|
||||||
from("quartz2://myGroup/myTimerName?cron=0/5+*+*+?+*+*").to("bean:startRouteService?method=updateConfig()");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,35 +0,0 @@
|
||||||
package org.chtijbug.drools.indexer.route;
|
|
||||||
|
|
||||||
import org.apache.camel.builder.RouteBuilder;
|
|
||||||
|
|
||||||
|
|
||||||
public class IndexerRoute extends RouteBuilder {
|
|
||||||
|
|
||||||
private String login;
|
|
||||||
|
|
||||||
private String password;
|
|
||||||
|
|
||||||
private String host;
|
|
||||||
|
|
||||||
private String port;
|
|
||||||
|
|
||||||
private String id;
|
|
||||||
|
|
||||||
public IndexerRoute(String id,String login, String password, String host, String port) {
|
|
||||||
this.login = login;
|
|
||||||
this.password = password;
|
|
||||||
this.host = host;
|
|
||||||
this.port = port;
|
|
||||||
this.id=id;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void configure() throws Exception {
|
|
||||||
//from("sftp://foo@myserver?password=secret&ftpClient.dataTimeout=30000").to("bean:foo");
|
|
||||||
String url="sftp://"+login+"@"+host+":"+port+"?password="+password+"&move=.done";
|
|
||||||
from(url).routeId(id).to("bean:storeService?method=store(${header.CamelFileName},${body})");
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,69 +0,0 @@
|
||||||
package org.chtijbug.drools.indexer.service;
|
|
||||||
|
|
||||||
|
|
||||||
import org.apache.camel.CamelContext;
|
|
||||||
import org.chtijbug.drools.indexer.route.IndexerRoute;
|
|
||||||
import org.chtijbug.drools.proxy.persistence.model.RuntimePersist;
|
|
||||||
import org.chtijbug.drools.proxy.persistence.repository.RuntimeRepository;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
|
|
||||||
import javax.annotation.PostConstruct;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
@Service("startRouteService")
|
|
||||||
public class StartRouteService {
|
|
||||||
@Value("${kieserver.login}")
|
|
||||||
private String login;
|
|
||||||
@Value("${kieserver.password}")
|
|
||||||
private String password;
|
|
||||||
@Autowired
|
|
||||||
CamelContext camelContext;
|
|
||||||
@Autowired
|
|
||||||
RuntimeRepository runtimeRepository;
|
|
||||||
|
|
||||||
|
|
||||||
private Map<String,RuntimePersist> routes = new HashMap<>();
|
|
||||||
private Map<String,IndexerRoute> routesCamel = new HashMap<>();
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public void updateConfig() throws Exception {
|
|
||||||
for (RuntimePersist runtime : runtimeRepository.findAll()){
|
|
||||||
if (routes.containsKey(runtime.getId())==false){
|
|
||||||
IndexerRoute indexerRoute =new IndexerRoute(runtime.getId(),login,password,runtime.getSftpHost(),runtime.getSftpPort());
|
|
||||||
camelContext.addRoutes(indexerRoute);
|
|
||||||
routes.put(runtime.getSftpHost()+":"+runtime.getSftpPort(),runtime.duplicate());
|
|
||||||
routesCamel.put(runtime.getSftpHost()+":"+runtime.getSftpPort(),indexerRoute);
|
|
||||||
}else{
|
|
||||||
RuntimePersist existingRoutes = routes.get(runtime.getId());
|
|
||||||
if (!existingRoutes.getSftpHost().equals(runtime.getSftpHost())
|
|
||||||
|| !existingRoutes.getSftpPort().equals(runtime.getSftpPort())){
|
|
||||||
//routes must be reloaded
|
|
||||||
IndexerRoute routeToDelete=routesCamel.get(runtime.getId());
|
|
||||||
routesCamel.remove(runtime.getId());
|
|
||||||
camelContext.removeRoute(runtime.getId());
|
|
||||||
routes.remove(runtime.getId());
|
|
||||||
|
|
||||||
IndexerRoute indexerRoute =new IndexerRoute(runtime.getId(),login,password,runtime.getSftpHost(),runtime.getSftpPort());
|
|
||||||
camelContext.addRoutes(indexerRoute);
|
|
||||||
routes.put(runtime.getId(),runtime.duplicate());
|
|
||||||
routesCamel.put(runtime.getId(),indexerRoute);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@PostConstruct
|
|
||||||
public void constructIndexerRoute() throws Exception {
|
|
||||||
for (RuntimePersist runtime : runtimeRepository.findAll()){
|
|
||||||
IndexerRoute indexerRoute =new IndexerRoute(runtime.getId(),login,password,runtime.getSftpHost(),runtime.getSftpPort());
|
|
||||||
camelContext.addRoutes(indexerRoute);
|
|
||||||
|
|
||||||
routes.put(runtime.getId(),runtime.duplicate());
|
|
||||||
routesCamel.put(runtime.getId(),indexerRoute);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,7 +1,8 @@
|
||||||
package org.chtijbug.drools.indexer.service;
|
package org.chtijbug.drools.indexer.service;
|
||||||
|
|
||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
import org.chtijbug.drools.ChtijbugObjectRequest;
|
||||||
import org.chtijbug.drools.SessionContext;
|
import org.chtijbug.drools.SessionContext;
|
||||||
|
import org.chtijbug.drools.common.KafkaTopicConstants;
|
||||||
import org.chtijbug.drools.logging.*;
|
import org.chtijbug.drools.logging.*;
|
||||||
import org.chtijbug.drools.proxy.persistence.model.BusinessTransactionAction;
|
import org.chtijbug.drools.proxy.persistence.model.BusinessTransactionAction;
|
||||||
import org.chtijbug.drools.proxy.persistence.model.BusinessTransactionPersistence;
|
import org.chtijbug.drools.proxy.persistence.model.BusinessTransactionPersistence;
|
||||||
|
|
@ -9,34 +10,35 @@ import org.chtijbug.drools.proxy.persistence.model.EventType;
|
||||||
import org.chtijbug.drools.proxy.persistence.repository.BusinessTransactionActionRepository;
|
import org.chtijbug.drools.proxy.persistence.repository.BusinessTransactionActionRepository;
|
||||||
import org.chtijbug.drools.proxy.persistence.repository.BusinessTransactionPersistenceRepository;
|
import org.chtijbug.drools.proxy.persistence.repository.BusinessTransactionPersistenceRepository;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.kafka.annotation.KafkaListener;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
@Service("storeService")
|
@Service("storeService")
|
||||||
public class StoreLoggingService {
|
public class StoreLoggingService {
|
||||||
|
|
||||||
ObjectMapper mapper = new ObjectMapper();
|
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private BusinessTransactionPersistenceRepository transactionRepository;
|
private BusinessTransactionPersistenceRepository transactionRepository;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private BusinessTransactionActionRepository actionRepository;
|
private BusinessTransactionActionRepository actionRepository;
|
||||||
|
|
||||||
public void store(String fileName, String fileContent) {
|
|
||||||
if (fileName!= null) {
|
|
||||||
|
|
||||||
String[] data = fileName.split("-");
|
@KafkaListener(
|
||||||
Integer year = Integer.valueOf(data[0]);
|
topics = KafkaTopicConstants.LOGING_TOPIC,groupId = "${kafka.index.groupid}",
|
||||||
Integer month = Integer.valueOf(data[1]);
|
containerFactory = "ruleKafkaListenerContainerFactory")
|
||||||
Integer day = Integer.valueOf(data[2]);
|
public void store(ChtijbugObjectRequest result) {
|
||||||
Integer hour = Integer.valueOf(data[3]);
|
if (result != null) {
|
||||||
Integer minute = Integer.valueOf(data[4]);
|
|
||||||
Integer second = Integer.valueOf(data[5]);
|
Integer year = result.getTransactionStartTimeStamp().getYear();
|
||||||
Integer millis = Integer.valueOf(data[6]);
|
Integer month = result.getTransactionStartTimeStamp().getMonthValue();
|
||||||
String id = data[7].substring(0,data[7].indexOf("."));
|
Integer day = result.getTransactionStartTimeStamp().getDayOfMonth();
|
||||||
|
Integer hour = result.getTransactionStartTimeStamp().getHour();
|
||||||
|
Integer minute = result.getTransactionStartTimeStamp().getMinute();
|
||||||
|
Integer second = result.getTransactionStartTimeStamp().getSecond();
|
||||||
|
Integer millis = result.getTransactionStartTimeStamp().getNano();
|
||||||
|
String id = result.getTransactionID();
|
||||||
BusinessTransactionPersistence item = new BusinessTransactionPersistence();
|
BusinessTransactionPersistence item = new BusinessTransactionPersistence();
|
||||||
item.setYear(year);
|
item.setYear(year);
|
||||||
item.setMonth(month);
|
item.setMonth(month);
|
||||||
|
|
@ -47,9 +49,9 @@ public class StoreLoggingService {
|
||||||
item.setMillis(millis);
|
item.setMillis(millis);
|
||||||
item.setTransactionId(id);
|
item.setTransactionId(id);
|
||||||
item.setId(UUID.randomUUID().toString());
|
item.setId(UUID.randomUUID().toString());
|
||||||
long ii=1;
|
long ii = 1;
|
||||||
try {
|
|
||||||
SessionContext sessionContext = mapper.readValue(fileContent,SessionContext.class);
|
SessionContext sessionContext = result.getSessionLogging();
|
||||||
item.setContainerId(sessionContext.getContainerId());
|
item.setContainerId(sessionContext.getContainerId());
|
||||||
item.setGroupID(sessionContext.getGroupID());
|
item.setGroupID(sessionContext.getGroupID());
|
||||||
item.setArtefactID(sessionContext.getArtefactID());
|
item.setArtefactID(sessionContext.getArtefactID());
|
||||||
|
|
@ -58,44 +60,44 @@ public class StoreLoggingService {
|
||||||
item.setServerName(sessionContext.getServerName());
|
item.setServerName(sessionContext.getServerName());
|
||||||
Map<Long, BusinessTransactionAction> actions = new HashMap<>();
|
Map<Long, BusinessTransactionAction> actions = new HashMap<>();
|
||||||
SessionExecution sessionExecution = sessionContext.getSessionExecution();
|
SessionExecution sessionExecution = sessionContext.getSessionExecution();
|
||||||
BusinessTransactionAction businessTransactionoutput=null;
|
BusinessTransactionAction businessTransactionoutput = null;
|
||||||
for (Fact fact : sessionExecution.getFacts()){
|
for (Fact fact : sessionExecution.getFacts()) {
|
||||||
BusinessTransactionAction businessTransactionAction = new BusinessTransactionAction();
|
BusinessTransactionAction businessTransactionAction = new BusinessTransactionAction();
|
||||||
businessTransactionAction.setId(UUID.randomUUID().toString());
|
businessTransactionAction.setId(UUID.randomUUID().toString());
|
||||||
businessTransactionAction.setBusinessTransactionId(item.getId());
|
businessTransactionAction.setBusinessTransactionId(item.getId());
|
||||||
if (fact.getFactType().equals(FactType.INPUTDATA)){
|
if (fact.getFactType().equals(FactType.INPUTDATA)) {
|
||||||
businessTransactionAction.setEventType(EventType.INPUT);
|
businessTransactionAction.setEventType(EventType.INPUT);
|
||||||
businessTransactionAction.setInputData(fact);
|
businessTransactionAction.setInputData(fact);
|
||||||
businessTransactionAction.setEventNumber(0);
|
businessTransactionAction.setEventNumber(0);
|
||||||
actions.put(businessTransactionAction.getEventNumber(),businessTransactionAction);
|
actions.put(businessTransactionAction.getEventNumber(), businessTransactionAction);
|
||||||
}else if (fact.getFactType().equals(FactType.OUTPUTDATA)){
|
} else if (fact.getFactType().equals(FactType.OUTPUTDATA)) {
|
||||||
businessTransactionAction.setEventType(EventType.OUPUT);
|
businessTransactionAction.setEventType(EventType.OUPUT);
|
||||||
businessTransactionAction.setOutputData(fact);
|
businessTransactionAction.setOutputData(fact);
|
||||||
businessTransactionoutput=businessTransactionAction;
|
businessTransactionoutput = businessTransactionAction;
|
||||||
|
|
||||||
}else if (fact.getFactType().equals(FactType.INSERTED)){
|
} else if (fact.getFactType().equals(FactType.INSERTED)) {
|
||||||
businessTransactionAction.setEventType(EventType.INSERTFACT);
|
businessTransactionAction.setEventType(EventType.INSERTFACT);
|
||||||
businessTransactionAction.setFact(fact);
|
businessTransactionAction.setFact(fact);
|
||||||
businessTransactionAction.setEventNumber(ii++);
|
businessTransactionAction.setEventNumber(ii++);
|
||||||
actions.put(businessTransactionAction.getEventNumber(),businessTransactionAction);
|
actions.put(businessTransactionAction.getEventNumber(), businessTransactionAction);
|
||||||
} else if (fact.getFactType().equals(FactType.UPDATED_NEWVALUE)){
|
} else if (fact.getFactType().equals(FactType.UPDATED_NEWVALUE)) {
|
||||||
businessTransactionAction.setEventType(EventType.UPDATEFACTNEWVALUE);
|
businessTransactionAction.setEventType(EventType.UPDATEFACTNEWVALUE);
|
||||||
businessTransactionAction.setFact(fact);
|
businessTransactionAction.setFact(fact);
|
||||||
businessTransactionAction.setEventNumber(ii++);
|
businessTransactionAction.setEventNumber(ii++);
|
||||||
actions.put(businessTransactionAction.getEventNumber(),businessTransactionAction);
|
actions.put(businessTransactionAction.getEventNumber(), businessTransactionAction);
|
||||||
}else if (fact.getFactType().equals(FactType.UPDATED_OLDVALUE)){
|
} else if (fact.getFactType().equals(FactType.UPDATED_OLDVALUE)) {
|
||||||
businessTransactionAction.setEventType(EventType.UPDATEFACTOLDVALUE);
|
businessTransactionAction.setEventType(EventType.UPDATEFACTOLDVALUE);
|
||||||
businessTransactionAction.setFact(fact);
|
businessTransactionAction.setFact(fact);
|
||||||
businessTransactionAction.setEventNumber(ii++);
|
businessTransactionAction.setEventNumber(ii++);
|
||||||
actions.put(businessTransactionAction.getEventNumber(),businessTransactionAction);
|
actions.put(businessTransactionAction.getEventNumber(), businessTransactionAction);
|
||||||
}else if (fact.getFactType().equals(FactType.DELETED)){
|
} else if (fact.getFactType().equals(FactType.DELETED)) {
|
||||||
businessTransactionAction.setEventType(EventType.RETRACTFACT);
|
businessTransactionAction.setEventType(EventType.RETRACTFACT);
|
||||||
businessTransactionAction.setFact(fact);
|
businessTransactionAction.setFact(fact);
|
||||||
businessTransactionAction.setEventNumber(ii++);
|
businessTransactionAction.setEventNumber(ii++);
|
||||||
actions.put(businessTransactionAction.getEventNumber(),businessTransactionAction);
|
actions.put(businessTransactionAction.getEventNumber(), businessTransactionAction);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (ProcessExecution processExecution : sessionExecution.getProcessExecutions()){
|
for (ProcessExecution processExecution : sessionExecution.getProcessExecutions()) {
|
||||||
BusinessTransactionAction businessTransactionActionStart = new BusinessTransactionAction();
|
BusinessTransactionAction businessTransactionActionStart = new BusinessTransactionAction();
|
||||||
|
|
||||||
businessTransactionActionStart.setEventType(EventType.STARTPROCESS);
|
businessTransactionActionStart.setEventType(EventType.STARTPROCESS);
|
||||||
|
|
@ -104,8 +106,8 @@ public class StoreLoggingService {
|
||||||
businessTransactionActionStart.setBusinessTransactionId(item.getId());
|
businessTransactionActionStart.setBusinessTransactionId(item.getId());
|
||||||
businessTransactionActionStart.setEventNumber(ii++);
|
businessTransactionActionStart.setEventNumber(ii++);
|
||||||
businessTransactionActionStart.setId(UUID.randomUUID().toString());
|
businessTransactionActionStart.setId(UUID.randomUUID().toString());
|
||||||
actions.put(businessTransactionActionStart.getEventNumber(),businessTransactionActionStart);
|
actions.put(businessTransactionActionStart.getEventNumber(), businessTransactionActionStart);
|
||||||
for (RuleflowGroup rfg : processExecution.getRuleflowGroups()){
|
for (RuleflowGroup rfg : processExecution.getRuleflowGroups()) {
|
||||||
BusinessTransactionAction businessTransactionActionStartRFG = new BusinessTransactionAction();
|
BusinessTransactionAction businessTransactionActionStartRFG = new BusinessTransactionAction();
|
||||||
|
|
||||||
businessTransactionActionStartRFG.setBusinessTransactionId(item.getId());
|
businessTransactionActionStartRFG.setBusinessTransactionId(item.getId());
|
||||||
|
|
@ -113,8 +115,8 @@ public class StoreLoggingService {
|
||||||
businessTransactionActionStartRFG.setRuleflowGroupName(rfg.getRuleflowGroup());
|
businessTransactionActionStartRFG.setRuleflowGroupName(rfg.getRuleflowGroup());
|
||||||
businessTransactionActionStartRFG.setEventNumber(ii++);
|
businessTransactionActionStartRFG.setEventNumber(ii++);
|
||||||
businessTransactionActionStartRFG.setId(UUID.randomUUID().toString());
|
businessTransactionActionStartRFG.setId(UUID.randomUUID().toString());
|
||||||
actions.put(businessTransactionActionStartRFG.getEventNumber(),businessTransactionActionStartRFG);
|
actions.put(businessTransactionActionStartRFG.getEventNumber(), businessTransactionActionStartRFG);
|
||||||
for (RuleExecution ruleExecution : rfg.getRuleExecutionList()){
|
for (RuleExecution ruleExecution : rfg.getRuleExecutionList()) {
|
||||||
BusinessTransactionAction businessTransactionActionRule = new BusinessTransactionAction();
|
BusinessTransactionAction businessTransactionActionRule = new BusinessTransactionAction();
|
||||||
|
|
||||||
businessTransactionActionRule.setEventType(EventType.RULE);
|
businessTransactionActionRule.setEventType(EventType.RULE);
|
||||||
|
|
@ -124,7 +126,7 @@ public class StoreLoggingService {
|
||||||
businessTransactionActionRule.setProcessID(processExecution.getProcessId());
|
businessTransactionActionRule.setProcessID(processExecution.getProcessId());
|
||||||
businessTransactionActionRule.setEventNumber(ii++);
|
businessTransactionActionRule.setEventNumber(ii++);
|
||||||
businessTransactionActionRule.setId(UUID.randomUUID().toString());
|
businessTransactionActionRule.setId(UUID.randomUUID().toString());
|
||||||
actions.put(businessTransactionActionRule.getEventNumber(),businessTransactionActionRule);
|
actions.put(businessTransactionActionRule.getEventNumber(), businessTransactionActionRule);
|
||||||
}
|
}
|
||||||
BusinessTransactionAction businessTransactionActionSTOPRFG = new BusinessTransactionAction();
|
BusinessTransactionAction businessTransactionActionSTOPRFG = new BusinessTransactionAction();
|
||||||
|
|
||||||
|
|
@ -133,7 +135,7 @@ public class StoreLoggingService {
|
||||||
businessTransactionActionSTOPRFG.setBusinessTransactionId(item.getId());
|
businessTransactionActionSTOPRFG.setBusinessTransactionId(item.getId());
|
||||||
businessTransactionActionSTOPRFG.setEventNumber(ii++);
|
businessTransactionActionSTOPRFG.setEventNumber(ii++);
|
||||||
businessTransactionActionSTOPRFG.setId(UUID.randomUUID().toString());
|
businessTransactionActionSTOPRFG.setId(UUID.randomUUID().toString());
|
||||||
actions.put(businessTransactionActionSTOPRFG.getEventNumber(),businessTransactionActionSTOPRFG);
|
actions.put(businessTransactionActionSTOPRFG.getEventNumber(), businessTransactionActionSTOPRFG);
|
||||||
}
|
}
|
||||||
BusinessTransactionAction businessTransactionActionEnd = new BusinessTransactionAction();
|
BusinessTransactionAction businessTransactionActionEnd = new BusinessTransactionAction();
|
||||||
businessTransactionActionEnd.setEventType(EventType.STOPPROCESS);
|
businessTransactionActionEnd.setEventType(EventType.STOPPROCESS);
|
||||||
|
|
@ -142,24 +144,22 @@ public class StoreLoggingService {
|
||||||
businessTransactionActionEnd.setEventNumber(ii++);
|
businessTransactionActionEnd.setEventNumber(ii++);
|
||||||
businessTransactionActionEnd.setId(UUID.randomUUID().toString());
|
businessTransactionActionEnd.setId(UUID.randomUUID().toString());
|
||||||
|
|
||||||
actions.put(businessTransactionActionEnd.getEventNumber(),businessTransactionActionEnd);
|
actions.put(businessTransactionActionEnd.getEventNumber(), businessTransactionActionEnd);
|
||||||
}
|
}
|
||||||
if (businessTransactionoutput!= null) {
|
if (businessTransactionoutput != null) {
|
||||||
businessTransactionoutput.setEventNumber(ii++);
|
businessTransactionoutput.setEventNumber(ii++);
|
||||||
actions.put(businessTransactionoutput.getEventNumber(), businessTransactionoutput);
|
actions.put(businessTransactionoutput.getEventNumber(), businessTransactionoutput);
|
||||||
}
|
}
|
||||||
List<Long> keys = new ArrayList<Long>(actions.keySet());
|
List<Long> keys = new ArrayList<Long>(actions.keySet());
|
||||||
Collections.sort(keys);
|
Collections.sort(keys);
|
||||||
List<BusinessTransactionAction> sortedList= new LinkedList<>();
|
List<BusinessTransactionAction> sortedList = new LinkedList<>();
|
||||||
for (Long i : keys){
|
for (Long i : keys) {
|
||||||
sortedList.add(actions.get(i));
|
sortedList.add(actions.get(i));
|
||||||
}
|
}
|
||||||
transactionRepository.save(item);
|
transactionRepository.save(item);
|
||||||
Iterable<BusinessTransactionAction> toto = actionRepository.saveAll(sortedList);
|
Iterable<BusinessTransactionAction> toto = actionRepository.saveAll(sortedList);
|
||||||
System.out.println("");
|
System.out.println("");
|
||||||
} catch (IOException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
|
|
||||||
//item.setContent(fileContent);
|
//item.setContent(fileContent);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
spring.data.elasticsearch.cluster-nodes=localhost:9300
|
kafka.bootstrapAddress=localhost:9092,localhost:9093,localhost:9094
|
||||||
|
|
||||||
kieserver.login=kieserver
|
kieserver.login=kieserver
|
||||||
kieserver.password=kieserver1
|
kieserver.password=kieserver1
|
||||||
|
kafka.index.groupid=index1
|
||||||
spring.data.mongodb.database=businessProxyDB
|
spring.data.mongodb.database=businessProxyDB
|
||||||
spring.data.mongodb.host=localhost:28017
|
spring.data.mongodb.host=localhost:28017
|
||||||
server.port=5547
|
server.port=5547
|
||||||
|
|
@ -17,14 +17,14 @@
|
||||||
<orderEntry type="library" name="Maven: org.kie:kie-internal:7.23.0.Final" level="project" />
|
<orderEntry type="library" name="Maven: org.kie:kie-internal:7.23.0.Final" level="project" />
|
||||||
<orderEntry type="library" name="Maven: org.kie:kie-api:7.23.0.Final" level="project" />
|
<orderEntry type="library" name="Maven: org.kie:kie-api:7.23.0.Final" level="project" />
|
||||||
<orderEntry type="library" name="Maven: org.kie.soup:kie-soup-maven-support:7.23.0.Final" level="project" />
|
<orderEntry type="library" name="Maven: org.kie.soup:kie-soup-maven-support:7.23.0.Final" level="project" />
|
||||||
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-data-elasticsearch:2.1.0.RELEASE" level="project" />
|
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-data-elasticsearch:2.2.6.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-starter:2.2.6.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:2.2.6.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-autoconfigure:2.2.6.RELEASE" level="project" />
|
||||||
<orderEntry type="library" name="Maven: javax.annotation:javax.annotation-api:1.3.2" level="project" />
|
<orderEntry type="library" name="Maven: jakarta.annotation:jakarta.annotation-api:1.3.5" 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-core:5.2.5.RELEASE" level="project" />
|
||||||
<orderEntry type="library" name="Maven: org.springframework:spring-jcl:5.1.2.RELEASE" level="project" />
|
<orderEntry type="library" name="Maven: org.springframework:spring-jcl:5.2.5.RELEASE" level="project" />
|
||||||
<orderEntry type="library" name="Maven: org.yaml:snakeyaml:1.23" level="project" />
|
<orderEntry type="library" name="Maven: org.yaml:snakeyaml:1.25" level="project" />
|
||||||
<orderEntry type="library" name="Maven: org.springframework.data:spring-data-elasticsearch:3.1.11.RELEASE" level="project" />
|
<orderEntry type="library" name="Maven: org.springframework.data:spring-data-elasticsearch:3.1.11.RELEASE" level="project" />
|
||||||
<orderEntry type="library" name="Maven: org.springframework:spring-context:5.1.10.RELEASE" level="project" />
|
<orderEntry type="library" name="Maven: org.springframework:spring-context:5.1.10.RELEASE" level="project" />
|
||||||
<orderEntry type="library" name="Maven: org.springframework:spring-aop:5.1.10.RELEASE" level="project" />
|
<orderEntry type="library" name="Maven: org.springframework:spring-aop:5.1.10.RELEASE" level="project" />
|
||||||
|
|
@ -95,8 +95,8 @@
|
||||||
<orderEntry type="library" name="Maven: org.hamcrest:hamcrest-core:1.3" level="project" />
|
<orderEntry type="library" name="Maven: org.hamcrest:hamcrest-core:1.3" level="project" />
|
||||||
<orderEntry type="library" name="Maven: com.google.guava:guava:13.0.1" level="project" />
|
<orderEntry type="library" name="Maven: com.google.guava:guava:13.0.1" level="project" />
|
||||||
<orderEntry type="library" name="Maven: commons-io:commons-io:2.1" level="project" />
|
<orderEntry type="library" name="Maven: commons-io:commons-io:2.1" level="project" />
|
||||||
<orderEntry type="library" name="Maven: org.kie:kie-internal:7.38.0.Final" level="project" />
|
<orderEntry type="library" name="Maven: org.kie:kie-internal:7.39.0.Final" level="project" />
|
||||||
<orderEntry type="library" name="Maven: org.kie:kie-api:7.38.0.Final" level="project" />
|
<orderEntry type="library" name="Maven: org.kie:kie-api:7.39.0.Final" level="project" />
|
||||||
<orderEntry type="library" name="Maven: org.kie.soup:kie-soup-maven-support:7.38.0.Final" level="project" />
|
<orderEntry type="library" name="Maven: org.kie.soup:kie-soup-maven-support:7.39.0.Final" level="project" />
|
||||||
</component>
|
</component>
|
||||||
</module>
|
</module>
|
||||||
|
|
@ -109,62 +109,22 @@
|
||||||
<artifactId>camel-test</artifactId>
|
<artifactId>camel-test</artifactId>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
|
||||||
<groupId>org.apache.tomcat.embed</groupId>
|
|
||||||
<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>
|
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.kafka</groupId>
|
||||||
|
<artifactId>spring-kafka</artifactId>
|
||||||
|
<version>${kafka.version}</version>
|
||||||
|
</dependency>
|
||||||
<!-- kie-server -->
|
<!-- 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>
|
<dependency>
|
||||||
<groupId>com.pymmasoftware.jbpm</groupId>
|
<groupId>com.pymmasoftware.jbpm</groupId>
|
||||||
<artifactId>drools-framework-kie-server-services-drools</artifactId>
|
<artifactId>drools-framework-kie-server-services-drools</artifactId>
|
||||||
<version>${project.version}</version>
|
<version>${project.version}</version>
|
||||||
<exclusions>
|
<exclusions>
|
||||||
<exclusion>
|
<!--exclusion>
|
||||||
<groupId>com.thoughtworks.xstream</groupId>
|
<groupId>com.thoughtworks.xstream</groupId>
|
||||||
<artifactId>xstream</artifactId>
|
<artifactId>xstream</artifactId>
|
||||||
</exclusion>
|
</exclusion-->
|
||||||
<exclusion>
|
<exclusion>
|
||||||
<groupId>org.apache.activemq</groupId>
|
<groupId>org.apache.activemq</groupId>
|
||||||
<artifactId>artemis-jms-client</artifactId>
|
<artifactId>artemis-jms-client</artifactId>
|
||||||
|
|
@ -213,6 +173,18 @@
|
||||||
<groupId>io.netty</groupId>
|
<groupId>io.netty</groupId>
|
||||||
<artifactId>netty-resolver</artifactId>
|
<artifactId>netty-resolver</artifactId>
|
||||||
</exclusion>
|
</exclusion>
|
||||||
|
<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>
|
</exclusions>
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
|
||||||
|
|
@ -16,18 +16,123 @@
|
||||||
*/
|
*/
|
||||||
package org.chtijbug.drools.proxy;
|
package org.chtijbug.drools.proxy;
|
||||||
|
|
||||||
|
import org.apache.kafka.clients.admin.AdminClientConfig;
|
||||||
|
import org.apache.kafka.clients.admin.NewTopic;
|
||||||
|
import org.apache.kafka.clients.consumer.ConsumerConfig;
|
||||||
|
import org.apache.kafka.clients.producer.ProducerConfig;
|
||||||
|
import org.apache.kafka.common.serialization.StringDeserializer;
|
||||||
|
import org.apache.kafka.common.serialization.StringSerializer;
|
||||||
|
import org.chtijbug.drools.ChtijbugObjectRequest;
|
||||||
|
import org.chtijbug.drools.KieContainerResponse;
|
||||||
|
import org.chtijbug.drools.KieContainerUpdate;
|
||||||
|
import org.chtijbug.drools.common.KafkaTopicConstants;
|
||||||
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.boot.SpringApplication;
|
import org.springframework.boot.SpringApplication;
|
||||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||||
|
import org.springframework.context.annotation.Bean;
|
||||||
import org.springframework.context.annotation.Configuration;
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
import org.springframework.kafka.annotation.EnableKafka;
|
||||||
|
import org.springframework.kafka.config.ConcurrentKafkaListenerContainerFactory;
|
||||||
|
import org.springframework.kafka.core.*;
|
||||||
|
import org.springframework.kafka.support.serializer.JsonDeserializer;
|
||||||
|
import org.springframework.kafka.support.serializer.JsonSerializer;
|
||||||
|
|
||||||
import java.net.InetAddress;
|
import java.net.InetAddress;
|
||||||
import java.net.UnknownHostException;
|
import java.net.UnknownHostException;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
// CHECKSTYLE:OFF
|
// CHECKSTYLE:OFF
|
||||||
@SpringBootApplication
|
@SpringBootApplication
|
||||||
@Configuration
|
@Configuration
|
||||||
|
@EnableKafka
|
||||||
public class DroolsBusinessProxyServer {
|
public class DroolsBusinessProxyServer {
|
||||||
|
|
||||||
|
@Value(value = "${org.kie.server.id}")
|
||||||
|
private String groupID;
|
||||||
|
|
||||||
|
@Value(value = "${kafka.bootstrapAddress}")
|
||||||
|
private String bootstrapAddress;
|
||||||
|
|
||||||
|
@Bean
|
||||||
|
public KafkaAdmin kafkaAdmin() {
|
||||||
|
Map<String, Object> configs = new HashMap<>();
|
||||||
|
configs.put(AdminClientConfig.BOOTSTRAP_SERVERS_CONFIG, bootstrapAddress);
|
||||||
|
return new KafkaAdmin(configs);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Bean
|
||||||
|
public NewTopic loggingTopic() {
|
||||||
|
return new NewTopic(KafkaTopicConstants.LOGING_TOPIC, 1, (short) 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Bean
|
||||||
|
public NewTopic actionResponseTopic() {
|
||||||
|
return new NewTopic(KafkaTopicConstants.RESPONSE_TOPIC, 1, (short) 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Bean
|
||||||
|
public ProducerFactory<String, ChtijbugObjectRequest> producerFactory() {
|
||||||
|
Map<String, Object> configProps = new HashMap<>();
|
||||||
|
configProps.put(
|
||||||
|
ProducerConfig.BOOTSTRAP_SERVERS_CONFIG,
|
||||||
|
bootstrapAddress);
|
||||||
|
configProps.put(
|
||||||
|
ProducerConfig.KEY_SERIALIZER_CLASS_CONFIG,
|
||||||
|
StringSerializer.class);
|
||||||
|
configProps.put(
|
||||||
|
ProducerConfig.VALUE_SERIALIZER_CLASS_CONFIG,
|
||||||
|
JsonSerializer.class);
|
||||||
|
return new DefaultKafkaProducerFactory<>(configProps);
|
||||||
|
}
|
||||||
|
@Bean
|
||||||
|
public ProducerFactory<String, KieContainerResponse> producerKieContainerResponseactory() {
|
||||||
|
Map<String, Object> configProps = new HashMap<>();
|
||||||
|
configProps.put(
|
||||||
|
ProducerConfig.BOOTSTRAP_SERVERS_CONFIG,
|
||||||
|
bootstrapAddress);
|
||||||
|
configProps.put(
|
||||||
|
ProducerConfig.KEY_SERIALIZER_CLASS_CONFIG,
|
||||||
|
StringSerializer.class);
|
||||||
|
configProps.put(
|
||||||
|
ProducerConfig.VALUE_SERIALIZER_CLASS_CONFIG,
|
||||||
|
JsonSerializer.class);
|
||||||
|
return new DefaultKafkaProducerFactory<>(configProps);
|
||||||
|
}
|
||||||
|
@Bean
|
||||||
|
public KafkaTemplate<String, KieContainerResponse> kafkaKieContainerUpdateResponsableTemplate() {
|
||||||
|
return new KafkaTemplate<>(producerKieContainerResponseactory());
|
||||||
|
}
|
||||||
|
@Bean
|
||||||
|
public NewTopic actionDeployResponseTopic() {
|
||||||
|
return new NewTopic(KafkaTopicConstants.RESPONSE_DEPLOY_TOPIC, 1, (short) 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public ConsumerFactory<String, KieContainerUpdate> greetingConsumerFactory() {
|
||||||
|
Map<String, Object> props = new HashMap<>();
|
||||||
|
props.put(ConsumerConfig.BOOTSTRAP_SERVERS_CONFIG, bootstrapAddress);
|
||||||
|
props.put(ConsumerConfig.GROUP_ID_CONFIG, groupID);
|
||||||
|
return new DefaultKafkaConsumerFactory<>(props, new StringDeserializer(), new JsonDeserializer<>(KieContainerUpdate.class));
|
||||||
|
}
|
||||||
|
@Bean
|
||||||
|
public ConcurrentKafkaListenerContainerFactory<String, KieContainerUpdate>
|
||||||
|
ruleKafkaListenerKieContainerUpdateFactory() {
|
||||||
|
|
||||||
|
ConcurrentKafkaListenerContainerFactory<String, KieContainerUpdate> factory =
|
||||||
|
new ConcurrentKafkaListenerContainerFactory<>();
|
||||||
|
factory.setConsumerFactory(greetingConsumerFactory());
|
||||||
|
return factory;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Bean
|
||||||
|
public KafkaTemplate<String, ChtijbugObjectRequest> kafkaTemplate() {
|
||||||
|
return new KafkaTemplate<>(producerFactory());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Main method to start the application.
|
* Main method to start the application.
|
||||||
|
|
|
||||||
|
|
@ -1,12 +0,0 @@
|
||||||
package org.chtijbug.drools.proxy.camel;
|
|
||||||
|
|
||||||
import org.apache.camel.builder.RouteBuilder;
|
|
||||||
import org.springframework.stereotype.Component;
|
|
||||||
|
|
||||||
@Component
|
|
||||||
public class AutodeployRouter extends RouteBuilder {
|
|
||||||
@Override
|
|
||||||
public void configure() throws Exception {
|
|
||||||
from("quartz2://myGroup/myTimerName?cron=0/5+*+*+?+*+*").to("bean:kieService?method=updateConfig()");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -18,6 +18,9 @@ package org.chtijbug.drools.proxy.service;
|
||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
import org.apache.camel.CamelContext;
|
import org.apache.camel.CamelContext;
|
||||||
import org.apache.camel.Route;
|
import org.apache.camel.Route;
|
||||||
|
import org.chtijbug.drools.KieContainerResponse;
|
||||||
|
import org.chtijbug.drools.KieContainerUpdate;
|
||||||
|
import org.chtijbug.drools.common.KafkaTopicConstants;
|
||||||
import org.chtijbug.drools.proxy.PlatfomKieServerStateRepository;
|
import org.chtijbug.drools.proxy.PlatfomKieServerStateRepository;
|
||||||
import org.chtijbug.drools.proxy.camel.DroolsRouter;
|
import org.chtijbug.drools.proxy.camel.DroolsRouter;
|
||||||
import org.chtijbug.drools.proxy.persistence.model.ContainerPojoPersist;
|
import org.chtijbug.drools.proxy.persistence.model.ContainerPojoPersist;
|
||||||
|
|
@ -39,6 +42,8 @@ import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.context.ApplicationContext;
|
import org.springframework.context.ApplicationContext;
|
||||||
|
import org.springframework.kafka.annotation.KafkaListener;
|
||||||
|
import org.springframework.kafka.core.KafkaTemplate;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import javax.annotation.PostConstruct;
|
import javax.annotation.PostConstruct;
|
||||||
|
|
@ -75,6 +80,9 @@ public class KieServiceCommon {
|
||||||
private String hostName = "localhost";
|
private String hostName = "localhost";
|
||||||
private Map<String, DroolsRouter> routes = new HashMap<>();
|
private Map<String, DroolsRouter> routes = new HashMap<>();
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
KafkaTemplate<String, KieContainerResponse> kafkaKieContainerUpdateResponseTemplate;
|
||||||
|
|
||||||
public KieServiceCommon() {
|
public KieServiceCommon() {
|
||||||
// for now, if no server impl is passed as parameter, create one
|
// for now, if no server impl is passed as parameter, create one
|
||||||
// this.server = KieServerLocator.getInstance();
|
// this.server = KieServerLocator.getInstance();
|
||||||
|
|
@ -108,7 +116,7 @@ public class KieServiceCommon {
|
||||||
this.marshallerHelper = new MarshallerHelper(this.server.getServerRegistry());
|
this.marshallerHelper = new MarshallerHelper(this.server.getServerRegistry());
|
||||||
|
|
||||||
String serverName = KieServiceCommon.getKieServerID();
|
String serverName = KieServiceCommon.getKieServerID();
|
||||||
String sftpPort = System.getProperty("org.chtijbug.server.sftpPort");
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
InetAddress inetAddress = InetAddress.getLocalHost();
|
InetAddress inetAddress = InetAddress.getLocalHost();
|
||||||
|
|
@ -121,7 +129,7 @@ public class KieServiceCommon {
|
||||||
String version = result.getResult().getVersion();
|
String version = result.getResult().getVersion();
|
||||||
if (itIsMes.size() == 0) {
|
if (itIsMes.size() == 0) {
|
||||||
RuntimePersist runtimePersist = new RuntimePersist(serverName, version, hostName,
|
RuntimePersist runtimePersist = new RuntimePersist(serverName, version, hostName,
|
||||||
String.valueOf(serverPort), sftpPort,
|
String.valueOf(serverPort), null,
|
||||||
hostName, RuntimePersist.STATUS.UP.toString());
|
hostName, RuntimePersist.STATUS.UP.toString());
|
||||||
String isSwarm = System.getProperty("org.kie.server.swarm");
|
String isSwarm = System.getProperty("org.kie.server.swarm");
|
||||||
if ("1".equals(isSwarm)) {
|
if ("1".equals(isSwarm)) {
|
||||||
|
|
@ -170,6 +178,8 @@ public class KieServiceCommon {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setTimeStamp() {
|
public void setTimeStamp() {
|
||||||
|
|
@ -210,7 +220,7 @@ public class KieServiceCommon {
|
||||||
Set<Class<?>> classes = kieContainerInstance.getExtraClasses();
|
Set<Class<?>> classes = kieContainerInstance.getExtraClasses();
|
||||||
String className = container.getClassName();
|
String className = container.getClassName();
|
||||||
Class foundClass = this.getClassFromName(classes, className);
|
Class foundClass = this.getClassFromName(classes, className);
|
||||||
if (foundClass!=null) {
|
if (foundClass != null) {
|
||||||
ClassLoader classLoader = foundClass.getClassLoader();
|
ClassLoader classLoader = foundClass.getClassLoader();
|
||||||
Class<?> theClass = classLoader.loadClass(className);
|
Class<?> theClass = classLoader.loadClass(className);
|
||||||
camelContext.setApplicationContextClassLoader(classLoader);
|
camelContext.setApplicationContextClassLoader(classLoader);
|
||||||
|
|
@ -264,41 +274,55 @@ public class KieServiceCommon {
|
||||||
return result.getResult();
|
return result.getResult();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void updateConfig() throws Exception {
|
|
||||||
|
@KafkaListener(
|
||||||
|
topics = "${org.kie.server.id}", groupId = "${org.kie.server.id}",
|
||||||
|
containerFactory = "ruleKafkaListenerKieContainerUpdateFactory")
|
||||||
|
public void updateConfig(KieContainerUpdate update) {
|
||||||
|
try {
|
||||||
String serverName = KieServiceCommon.getKieServerID();
|
String serverName = KieServiceCommon.getKieServerID();
|
||||||
String isSwarm = System.getProperty("org.kie.server.swarm");
|
if (update.getAction().equals(KieContainerUpdate.STATUS.TODEPLOY)) {
|
||||||
List<ContainerRuntimePojoPersist> containers = null;
|
this.disposeContainer(update.getContainerID());
|
||||||
|
|
||||||
containers = containerRuntimeRepository.findByServerNameAndStatusAndHostname(serverName, ContainerRuntimePojoPersist.STATUS.TODEPLOY.toString(), hostName);
|
|
||||||
for (ContainerRuntimePojoPersist element : containers) {
|
|
||||||
ContainerPojoPersist containerIds = containerRepository.findByServerNameAndContainerId(serverName, element.getContainerId());
|
|
||||||
if (containerIds != null) {
|
|
||||||
|
|
||||||
this.disposeContainer(element.getContainerId());
|
|
||||||
KieContainerResource newContainer = new KieContainerResource();
|
KieContainerResource newContainer = new KieContainerResource();
|
||||||
newContainer.setContainerId(element.getContainerId());
|
newContainer.setContainerId(update.getContainerID());
|
||||||
newContainer.setReleaseId(new ReleaseId());
|
newContainer.setReleaseId(new ReleaseId());
|
||||||
newContainer.getReleaseId().setArtifactId(containerIds.getArtifactId());
|
newContainer.getReleaseId().setArtifactId(update.getArtifactID());
|
||||||
newContainer.getReleaseId().setGroupId(containerIds.getGroupId());
|
newContainer.getReleaseId().setGroupId(update.getGroupID());
|
||||||
newContainer.getReleaseId().setVersion(containerIds.getVersion());
|
newContainer.getReleaseId().setVersion(update.getProjectVersion());
|
||||||
this.createContainer(element.getContainerId(), newContainer);
|
this.createContainer(update.getContainerID(), newContainer);
|
||||||
|
ContainerPojoPersist containerIds = containerRepository.findByServerNameAndContainerId(serverName, update.getContainerID());
|
||||||
this.initCamelBusinessRoute(containerIds);
|
this.initCamelBusinessRoute(containerIds);
|
||||||
|
List<ContainerRuntimePojoPersist> containers = containerRuntimeRepository.findByServerNameAndContainerId(serverName, update.getContainerID());
|
||||||
|
for (ContainerRuntimePojoPersist element : containers) {
|
||||||
element.setStatus(ContainerRuntimePojoPersist.STATUS.UP.toString());
|
element.setStatus(ContainerRuntimePojoPersist.STATUS.UP.toString());
|
||||||
containerRuntimeRepository.save(element);
|
containerRuntimeRepository.save(element);
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
}
|
this.disposeContainer(update.getContainerID());
|
||||||
containers = containerRuntimeRepository.findByServerNameAndStatusAndHostname(serverName, ContainerRuntimePojoPersist.STATUS.TODELETE.toString(), hostName);
|
this.deleteCamelBusinessRoute(update.getContainerID());
|
||||||
|
ContainerPojoPersist containerIds = containerRepository.findByServerNameAndContainerId(serverName, update.getContainerID());
|
||||||
|
List<ContainerRuntimePojoPersist> containers = containerRuntimeRepository.findByServerNameAndContainerId(serverName, update.getContainerID());
|
||||||
for (ContainerRuntimePojoPersist element : containers) {
|
for (ContainerRuntimePojoPersist element : containers) {
|
||||||
ContainerPojoPersist containerIds = containerRepository.findByServerNameAndContainerId(serverName, element.getContainerId());
|
element.setStatus(ContainerRuntimePojoPersist.STATUS.UP.toString());
|
||||||
if (containerIds != null) {
|
containerRuntimeRepository.save(element);
|
||||||
this.disposeContainer(element.getContainerId());
|
}
|
||||||
this.deleteCamelBusinessRoute(element.getContainerId());
|
|
||||||
containerRepository.delete(containerIds);
|
containerRepository.delete(containerIds);
|
||||||
}
|
}
|
||||||
}
|
KieContainerResponse kieContainerResponse = new KieContainerResponse();
|
||||||
|
kieContainerResponse.setStatus(KieContainerResponse.STATUS.SUCCESS);
|
||||||
|
|
||||||
|
kafkaKieContainerUpdateResponseTemplate.send(KafkaTopicConstants.RESPONSE_DEPLOY_TOPIC,kieContainerResponse);
|
||||||
|
|
||||||
|
}catch (Exception e){
|
||||||
|
KieContainerResponse kieContainerResponse = new KieContainerResponse();
|
||||||
|
kieContainerResponse.setStatus(KieContainerResponse.STATUS.ERROR);
|
||||||
|
kieContainerResponse.setKieContainerUpdate(update);
|
||||||
|
kieContainerResponse.setMessageError(e.getMessage());
|
||||||
|
for (StackTraceElement stackTraceElement : e.getStackTrace()){
|
||||||
|
kieContainerResponse.getErrorMessages().add(stackTraceElement.toString());
|
||||||
|
}
|
||||||
|
kafkaKieContainerUpdateResponseTemplate.send(KafkaTopicConstants.RESPONSE_DEPLOY_TOPIC,kieContainerResponse);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,38 +1,43 @@
|
||||||
package org.chtijbug.drools.proxy.service;
|
package org.chtijbug.drools.proxy.service;
|
||||||
|
|
||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
import org.chtijbug.drools.ChtijbugObjectRequest;
|
||||||
import org.apache.commons.io.FileUtils;
|
import org.chtijbug.drools.common.KafkaTopicConstants;
|
||||||
import org.chtijbug.drools.kieserver.extension.KieServerAddOnElement;
|
import org.chtijbug.drools.kieserver.extension.KieServerAddOnElement;
|
||||||
import org.chtijbug.drools.kieserver.extension.KieServerLoggingDefinition;
|
import org.chtijbug.drools.kieserver.extension.KieServerLoggingDefinition;
|
||||||
import org.chtijbug.drools.logging.SessionExecution;
|
|
||||||
import org.chtijbug.kieserver.services.drools.ChtijbugObjectRequest;
|
|
||||||
import org.kie.server.services.api.KieContainerInstance;
|
import org.kie.server.services.api.KieContainerInstance;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
import org.springframework.kafka.core.KafkaTemplate;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
import java.io.File;
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.time.temporal.ChronoField;
|
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
@Service("ruleService")
|
@Service("ruleService")
|
||||||
public class RuleService {
|
public class RuleService {
|
||||||
|
|
||||||
private static final Logger logger = LoggerFactory.getLogger(RuleService.class);
|
private static final Logger logger = LoggerFactory.getLogger(RuleService.class);
|
||||||
private ObjectMapper mapper = new ObjectMapper();
|
|
||||||
@Inject
|
@Inject
|
||||||
private KieServiceCommon kieServiceCommon;
|
private KieServiceCommon kieServiceCommon;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
private KafkaTemplate<String, ChtijbugObjectRequest> kafkaTemplateLogging;
|
||||||
|
|
||||||
public RuleService() {
|
public RuleService() {
|
||||||
System.out.println("rulestep01");
|
logger.info("Rule Service created");
|
||||||
}
|
}
|
||||||
|
|
||||||
public Object runSessionObject(String transactionID, String id, String processID, Object input) throws IOException {
|
public Object runSessionObject(String transactionID, String id, String processID, Object input) {
|
||||||
KieContainerInstance kci = kieServiceCommon.getRegistry().getContainer(id);
|
|
||||||
ChtijbugObjectRequest chtijbugObjectRequest = new ChtijbugObjectRequest();
|
ChtijbugObjectRequest chtijbugObjectRequest = new ChtijbugObjectRequest();
|
||||||
|
chtijbugObjectRequest.setTransactionID(transactionID);
|
||||||
|
chtijbugObjectRequest.setProcessID(processID);
|
||||||
|
chtijbugObjectRequest.setContainerID(id);
|
||||||
|
chtijbugObjectRequest.setTransactionStartTimeStamp(LocalDateTime.now());
|
||||||
|
KieContainerInstance kci = kieServiceCommon.getRegistry().getContainer(id);
|
||||||
|
chtijbugObjectRequest.setArtifactID(kci.getKieContainer().getReleaseId().getArtifactId());
|
||||||
|
chtijbugObjectRequest.setGroupID(kci.getKieContainer().getReleaseId().getGroupId());
|
||||||
|
chtijbugObjectRequest.setVersion(kci.getKieContainer().getReleaseId().getVersion());
|
||||||
chtijbugObjectRequest.setObjectRequest(input);
|
chtijbugObjectRequest.setObjectRequest(input);
|
||||||
KieServerAddOnElement kieServerAddOnElement = kieServiceCommon.getDroolsChtijbugRulesExecutionService().getKieServerAddOnElement();
|
KieServerAddOnElement kieServerAddOnElement = kieServiceCommon.getDroolsChtijbugRulesExecutionService().getKieServerAddOnElement();
|
||||||
if (kieServerAddOnElement != null) {
|
if (kieServerAddOnElement != null) {
|
||||||
|
|
@ -44,53 +49,15 @@ public class RuleService {
|
||||||
/**
|
/**
|
||||||
* remove facts from logging to avoid infinite loop when marshalling to json and size of logging
|
* remove facts from logging to avoid infinite loop when marshalling to json and size of logging
|
||||||
*/
|
*/
|
||||||
SessionExecution sessionExecution = chtijbutObjectResponse.getSessionLogging().getSessionExecution();
|
|
||||||
if (kieServerAddOnElement != null) {
|
if (kieServerAddOnElement != null) {
|
||||||
|
|
||||||
for (KieServerLoggingDefinition kieServerLoggingDefinition : kieServerAddOnElement.getKieServerLoggingDefinitions()) {
|
for (KieServerLoggingDefinition kieServerLoggingDefinition : kieServerAddOnElement.getKieServerLoggingDefinitions()) {
|
||||||
kieServerLoggingDefinition.OnFireAllrulesEnd(kci.getKieContainer().getReleaseId().getGroupId(), kci.getKieContainer().getReleaseId().getArtifactId(), kci.getKieContainer().getReleaseId().getVersion(), chtijbutObjectResponse.getObjectRequest(), chtijbutObjectResponse.getSessionLogging());
|
kieServerLoggingDefinition.OnFireAllrulesEnd(kci.getKieContainer().getReleaseId().getGroupId(), kci.getKieContainer().getReleaseId().getArtifactId(), kci.getKieContainer().getReleaseId().getVersion(), chtijbutObjectResponse.getObjectRequest(), chtijbutObjectResponse.getSessionLogging());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
String jsonInString = null;
|
chtijbugObjectRequest.setTransactionEndTimeStamp(LocalDateTime.now());
|
||||||
|
kafkaTemplateLogging.send(KafkaTopicConstants.LOGING_TOPIC,chtijbugObjectRequest);
|
||||||
String fileTemp = System.getProperty("org.chtijbug.server.tracedir");
|
return chtijbutObjectResponse.getObjectRequest();
|
||||||
if (fileTemp != null) {
|
|
||||||
if (jsonInString == null) {
|
|
||||||
jsonInString = mapper.writeValueAsString(chtijbutObjectResponse.getSessionLogging());
|
|
||||||
}
|
|
||||||
String fileUUID = null;
|
|
||||||
if (transactionID == null) {
|
|
||||||
fileUUID = "noTransactionID";
|
|
||||||
} else {
|
|
||||||
fileUUID = transactionID;
|
|
||||||
}
|
|
||||||
LocalDateTime now = LocalDateTime.now();
|
|
||||||
int year = now.getYear();
|
|
||||||
int month = now.getMonthValue();
|
|
||||||
int day = now.getDayOfMonth();
|
|
||||||
int hour = now.getHour();
|
|
||||||
int minute = now.getMinute();
|
|
||||||
int second = now.getSecond();
|
|
||||||
int millis = now.get(ChronoField.MILLI_OF_SECOND);
|
|
||||||
String fileName = year + "-" + month + "-" + day + "-" + hour + "-" + minute + "-" + second + "-" + millis + "-" + fileUUID.replaceAll("-", "") + ".json";
|
|
||||||
File traceFile = new File(fileTemp + "/" + fileName);
|
|
||||||
FileUtils.writeByteArrayToFile(traceFile, jsonInString.getBytes());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Object response = chtijbutObjectResponse.getObjectRequest();
|
|
||||||
return response;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -25,3 +25,4 @@ spring.data.mongodb.host=localhost:28017
|
||||||
|
|
||||||
eureka.client.service-url.defaultZone=http://127.0.0.1:8761/eureka/
|
eureka.client.service-url.defaultZone=http://127.0.0.1:8761/eureka/
|
||||||
spring.application.name=proxy-app-${org.kie.server.id}
|
spring.application.name=proxy-app-${org.kie.server.id}
|
||||||
|
kafka.bootstrapAddress=localhost:9092,localhost:9093,localhost:9094
|
||||||
|
|
@ -26,79 +26,76 @@
|
||||||
<orderEntry type="inheritedJdk" />
|
<orderEntry type="inheritedJdk" />
|
||||||
<orderEntry type="sourceFolder" forTests="false" />
|
<orderEntry type="sourceFolder" forTests="false" />
|
||||||
<orderEntry type="module" module-name="drools-framework-business-proxy-persistence" />
|
<orderEntry type="module" module-name="drools-framework-business-proxy-persistence" />
|
||||||
<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-data-mongodb:2.2.6.RELEASE" level="project" />
|
||||||
<orderEntry type="library" name="Maven: org.mongodb:mongodb-driver:3.8.2" level="project" />
|
<orderEntry type="library" name="Maven: org.mongodb:mongodb-driver:3.11.2" level="project" />
|
||||||
<orderEntry type="library" name="Maven: org.mongodb:bson:3.8.2" level="project" />
|
<orderEntry type="library" name="Maven: org.mongodb:bson:3.11.2" level="project" />
|
||||||
<orderEntry type="library" name="Maven: org.mongodb:mongodb-driver-core:3.8.2" level="project" />
|
<orderEntry type="library" name="Maven: org.mongodb:mongodb-driver-core:3.11.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.data:spring-data-mongodb:2.2.6.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.data:spring-data-commons:2.2.6.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: com.fasterxml.jackson.core:jackson-annotations:2.10.3" level="project" />
|
||||||
<orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-annotations:2.9.0" level="project" />
|
|
||||||
<orderEntry type="module" module-name="drools-framework-runtime-entity" />
|
<orderEntry type="module" module-name="drools-framework-runtime-entity" />
|
||||||
<orderEntry type="module" module-name="drools-framework-common" />
|
<orderEntry type="module" module-name="drools-framework-common" />
|
||||||
<orderEntry type="library" name="Maven: junit:junit:4.12" level="project" />
|
<orderEntry type="library" name="Maven: junit:junit:4.12" level="project" />
|
||||||
<orderEntry type="library" name="Maven: org.hamcrest:hamcrest-core:1.3" level="project" />
|
<orderEntry type="library" name="Maven: org.hamcrest:hamcrest-core:2.1" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.hamcrest:hamcrest:2.1" level="project" />
|
||||||
<orderEntry type="library" name="Maven: com.google.guava:guava:13.0.1" level="project" />
|
<orderEntry type="library" name="Maven: com.google.guava:guava:13.0.1" 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-databind:2.10.3" 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.core:jackson-core:2.10.3" level="project" />
|
||||||
<orderEntry type="library" name="Maven: org.kie:kie-internal:7.38.0.Final" level="project" />
|
<orderEntry type="library" name="Maven: org.kie:kie-internal:7.39.0.Final" level="project" />
|
||||||
<orderEntry type="library" name="Maven: org.kie:kie-api:7.38.0.Final" level="project" />
|
<orderEntry type="library" name="Maven: org.kie:kie-api:7.39.0.Final" level="project" />
|
||||||
<orderEntry type="library" name="Maven: org.kie.soup:kie-soup-maven-support:7.38.0.Final" level="project" />
|
<orderEntry type="library" name="Maven: org.kie.soup:kie-soup-maven-support:7.39.0.Final" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.springframework.kafka:spring-kafka:2.3.7.RELEASE" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.apache.kafka:kafka-clients:2.3.1" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: com.github.luben:zstd-jni:1.4.0-1" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.lz4:lz4-java:1.6.0" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.xerial.snappy:snappy-java:1.1.7.3" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.slf4j:slf4j-api:1.7.30" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.springframework:spring-context:5.2.5.RELEASE" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.springframework:spring-aop:5.2.5.RELEASE" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.springframework:spring-beans:5.2.5.RELEASE" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.springframework:spring-expression:5.2.5.RELEASE" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.springframework:spring-messaging:5.2.5.RELEASE" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.springframework:spring-tx:5.2.5.RELEASE" level="project" />
|
||||||
<orderEntry type="library" name="Maven: com.github.mkopylec:charon-spring-boot-starter:3.1.0" level="project" />
|
<orderEntry type="library" name="Maven: com.github.mkopylec:charon-spring-boot-starter:3.1.0" level="project" />
|
||||||
<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-web:2.2.6.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-starter:2.2.6.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:2.2.6.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-autoconfigure:2.2.6.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: org.springframework.boot:spring-boot-starter-logging:2.2.6.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-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: 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-to-slf4j:2.12.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.apache.logging.log4j:log4j-api:2.12.1" level="project" />
|
||||||
<orderEntry type="library" name="Maven: org.slf4j:jul-to-slf4j:1.7.25" level="project" />
|
<orderEntry type="library" name="Maven: org.slf4j:jul-to-slf4j:1.7.30" level="project" />
|
||||||
<orderEntry type="library" name="Maven: javax.annotation:javax.annotation-api:1.3.2" level="project" />
|
<orderEntry type="library" name="Maven: jakarta.annotation:jakarta.annotation-api:1.3.5" level="project" />
|
||||||
<orderEntry type="library" scope="RUNTIME" name="Maven: org.yaml:snakeyaml:1.23" level="project" />
|
<orderEntry type="library" scope="RUNTIME" name="Maven: org.yaml:snakeyaml:1.25" 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: org.springframework.boot:spring-boot-starter-json:2.2.6.RELEASE" 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-jdk8:2.10.3" 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.datatype:jackson-datatype-jsr310:2.10.3" 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: com.fasterxml.jackson.module:jackson-module-parameter-names:2.10.3" level="project" />
|
||||||
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-tomcat:2.1.0.RELEASE" level="project" />
|
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-tomcat:2.2.6.RELEASE" level="project" />
|
||||||
<orderEntry type="library" name="Maven: org.apache.tomcat.embed:tomcat-embed-core:9.0.12" level="project" />
|
<orderEntry type="library" name="Maven: org.apache.tomcat.embed:tomcat-embed-core:9.0.33" level="project" />
|
||||||
<orderEntry type="library" name="Maven: org.apache.tomcat.embed:tomcat-embed-el:9.0.12" level="project" />
|
<orderEntry type="library" name="Maven: org.apache.tomcat.embed:tomcat-embed-el:9.0.33" level="project" />
|
||||||
<orderEntry type="library" name="Maven: org.apache.tomcat.embed:tomcat-embed-websocket:9.0.12" level="project" />
|
<orderEntry type="library" name="Maven: org.apache.tomcat.embed:tomcat-embed-websocket:9.0.33" level="project" />
|
||||||
<orderEntry type="library" name="Maven: org.hibernate.validator:hibernate-validator:6.0.13.Final" level="project" />
|
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-validation:2.2.6.RELEASE" level="project" />
|
||||||
<orderEntry type="library" name="Maven: javax.validation:validation-api:2.0.1.Final" level="project" />
|
<orderEntry type="library" name="Maven: jakarta.validation:jakarta.validation-api:2.0.2" level="project" />
|
||||||
<orderEntry type="library" name="Maven: org.jboss.logging:jboss-logging:3.3.2.Final" level="project" />
|
<orderEntry type="library" name="Maven: org.hibernate.validator:hibernate-validator:6.0.18.Final" level="project" />
|
||||||
<orderEntry type="library" name="Maven: com.fasterxml:classmate:1.4.0" level="project" />
|
<orderEntry type="library" name="Maven: org.jboss.logging:jboss-logging:3.4.1.Final" level="project" />
|
||||||
<orderEntry type="library" name="Maven: org.springframework:spring-web:5.1.2.RELEASE" level="project" />
|
<orderEntry type="library" name="Maven: com.fasterxml:classmate:1.5.1" 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-web:5.2.5.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-webmvc:5.2.5.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.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.apache.camel:camel-core-starter:2.23.0" level="project" />
|
|
||||||
<orderEntry type="library" name="Maven: org.apache.camel:camel-quartz2: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: org.slf4j:slf4j-api:1.7.25" level="project" />
|
|
||||||
<orderEntry type="library" name="Maven: org.quartz-scheduler:quartz:2.3.0" level="project" />
|
|
||||||
<orderEntry type="library" name="Maven: com.mchange:mchange-commons-java:0.2.11" level="project" />
|
|
||||||
<orderEntry type="library" name="Maven: com.mchange:c3p0:0.9.5.2" 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.commons:commons-lang3:3.8.1" level="project" />
|
<orderEntry type="library" name="Maven: org.apache.commons:commons-lang3:3.8.1" level="project" />
|
||||||
<orderEntry type="library" name="Maven: org.apache.commons:commons-collections4:4.2" level="project" />
|
<orderEntry type="library" name="Maven: org.apache.commons:commons-collections4:4.2" level="project" />
|
||||||
<orderEntry type="library" name="Maven: commons-io:commons-io:2.6" level="project" />
|
<orderEntry type="library" name="Maven: commons-io:commons-io:2.6" level="project" />
|
||||||
<orderEntry type="library" name="Maven: org.apache.httpcomponents:httpclient:4.5.6" level="project" />
|
<orderEntry type="library" name="Maven: org.apache.httpcomponents:httpclient:4.5.6" level="project" />
|
||||||
<orderEntry type="library" name="Maven: org.apache.httpcomponents:httpcore:4.4.10" level="project" />
|
<orderEntry type="library" name="Maven: org.apache.httpcomponents:httpcore:4.4.13" level="project" />
|
||||||
<orderEntry type="library" name="Maven: commons-codec:commons-codec:1.11" level="project" />
|
<orderEntry type="library" name="Maven: commons-codec:commons-codec:1.13" level="project" />
|
||||||
<orderEntry type="library" name="Maven: org.springframework.retry:spring-retry:1.2.2.RELEASE" level="project" />
|
<orderEntry type="library" name="Maven: org.springframework.retry:spring-retry:1.2.2.RELEASE" 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-core:5.2.5.RELEASE" level="project" />
|
||||||
<orderEntry type="library" name="Maven: org.springframework:spring-jcl:5.1.2.RELEASE" level="project" />
|
<orderEntry type="library" name="Maven: org.springframework:spring-jcl:5.2.5.RELEASE" level="project" />
|
||||||
<orderEntry type="library" name="Maven: io.micrometer:micrometer-core:1.1.3" level="project" />
|
<orderEntry type="library" name="Maven: io.micrometer:micrometer-core:1.1.3" level="project" />
|
||||||
<orderEntry type="library" name="Maven: org.hdrhistogram:HdrHistogram:2.1.9" level="project" />
|
<orderEntry type="library" name="Maven: org.hdrhistogram:HdrHistogram:2.1.9" level="project" />
|
||||||
<orderEntry type="library" name="Maven: org.latencyutils:LatencyUtils:2.0.3" level="project" />
|
<orderEntry type="library" name="Maven: org.latencyutils:LatencyUtils:2.0.3" level="project" />
|
||||||
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-configuration-processor:2.1.0.RELEASE" level="project" />
|
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-configuration-processor:2.2.6.RELEASE" level="project" />
|
||||||
</component>
|
</component>
|
||||||
</module>
|
</module>
|
||||||
|
|
@ -17,6 +17,11 @@
|
||||||
<artifactId>drools-framework-business-proxy-persistence</artifactId>
|
<artifactId>drools-framework-business-proxy-persistence</artifactId>
|
||||||
<version>${project.version}</version>
|
<version>${project.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.kafka</groupId>
|
||||||
|
<artifactId>spring-kafka</artifactId>
|
||||||
|
<version>${kafka.version}</version>
|
||||||
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.github.mkopylec</groupId>
|
<groupId>com.github.mkopylec</groupId>
|
||||||
<artifactId>charon-spring-boot-starter</artifactId>
|
<artifactId>charon-spring-boot-starter</artifactId>
|
||||||
|
|
@ -27,15 +32,9 @@
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>spring-boot-starter-web</artifactId>
|
<artifactId>spring-boot-starter-web</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
|
||||||
<groupId>org.apache.camel</groupId>
|
|
||||||
<artifactId>camel-spring-boot-starter</artifactId>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.apache.camel</groupId>
|
|
||||||
<artifactId>camel-quartz2</artifactId>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.apache.commons</groupId>
|
<groupId>org.apache.commons</groupId>
|
||||||
<artifactId>commons-lang3</artifactId>
|
<artifactId>commons-lang3</artifactId>
|
||||||
|
|
|
||||||
|
|
@ -1,14 +1,45 @@
|
||||||
package org.chtijbug.drools.reverseproxy;
|
package org.chtijbug.drools.reverseproxy;
|
||||||
|
|
||||||
|
|
||||||
|
import org.apache.kafka.clients.consumer.ConsumerConfig;
|
||||||
|
import org.apache.kafka.common.serialization.StringDeserializer;
|
||||||
|
import org.chtijbug.drools.ReverseProxyUpdate;
|
||||||
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.boot.SpringApplication;
|
import org.springframework.boot.SpringApplication;
|
||||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||||
|
import org.springframework.context.annotation.Bean;
|
||||||
import org.springframework.data.mongodb.repository.config.EnableMongoRepositories;
|
import org.springframework.data.mongodb.repository.config.EnableMongoRepositories;
|
||||||
|
import org.springframework.kafka.config.ConcurrentKafkaListenerContainerFactory;
|
||||||
|
import org.springframework.kafka.core.ConsumerFactory;
|
||||||
|
import org.springframework.kafka.core.DefaultKafkaConsumerFactory;
|
||||||
|
import org.springframework.kafka.support.serializer.JsonDeserializer;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
@SpringBootApplication
|
@SpringBootApplication
|
||||||
@EnableMongoRepositories(basePackages = "org.chtijbug.drools.proxy.persistence.repository")
|
@EnableMongoRepositories(basePackages = "org.chtijbug.drools.proxy.persistence.repository")
|
||||||
public class DroolsBusinessReverseProxyServer {
|
public class DroolsBusinessReverseProxyServer {
|
||||||
|
|
||||||
|
@Value(value = "${kafka.bootstrapAddress}")
|
||||||
|
private String bootstrapAddress;
|
||||||
|
|
||||||
|
public ConsumerFactory<String, ReverseProxyUpdate> mappingConsumerFactory() {
|
||||||
|
Map<String, Object> props = new HashMap<>();
|
||||||
|
props.put(ConsumerConfig.BOOTSTRAP_SERVERS_CONFIG, bootstrapAddress);
|
||||||
|
props.put(ConsumerConfig.GROUP_ID_CONFIG, "greeting");
|
||||||
|
return new DefaultKafkaConsumerFactory<>(props, new StringDeserializer(), new JsonDeserializer<>(ReverseProxyUpdate.class));
|
||||||
|
}
|
||||||
|
@Bean
|
||||||
|
public ConcurrentKafkaListenerContainerFactory<String, ReverseProxyUpdate>
|
||||||
|
mappingKafkaListenerContainerFactory() {
|
||||||
|
|
||||||
|
ConcurrentKafkaListenerContainerFactory<String, ReverseProxyUpdate> factory =
|
||||||
|
new ConcurrentKafkaListenerContainerFactory<>();
|
||||||
|
factory.setConsumerFactory(mappingConsumerFactory());
|
||||||
|
return factory;
|
||||||
|
}
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
SpringApplication.run(DroolsBusinessReverseProxyServer.class, args);
|
SpringApplication.run(DroolsBusinessReverseProxyServer.class, args);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,12 +0,0 @@
|
||||||
package org.chtijbug.drools.reverseproxy.camel;
|
|
||||||
|
|
||||||
import org.apache.camel.builder.RouteBuilder;
|
|
||||||
import org.springframework.stereotype.Component;
|
|
||||||
|
|
||||||
@Component
|
|
||||||
public class AutodeployRouter extends RouteBuilder {
|
|
||||||
@Override
|
|
||||||
public void configure() throws Exception {
|
|
||||||
from("quartz2://myGroup/myTimerName?cron=0/10+*+*+?+*+*").to("bean:updateService?method=updateConfig()");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -3,14 +3,16 @@ package org.chtijbug.drools.reverseproxy.mappings;
|
||||||
import com.github.mkopylec.charon.configuration.MappingProperties;
|
import com.github.mkopylec.charon.configuration.MappingProperties;
|
||||||
import com.github.mkopylec.charon.core.http.ForwardedRequestInterceptor;
|
import com.github.mkopylec.charon.core.http.ForwardedRequestInterceptor;
|
||||||
import com.github.mkopylec.charon.core.http.RequestData;
|
import com.github.mkopylec.charon.core.http.RequestData;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
public class CustomForwardedRequestInterceptor implements ForwardedRequestInterceptor {
|
public class CustomForwardedRequestInterceptor implements ForwardedRequestInterceptor {
|
||||||
|
private static final Logger logger = LoggerFactory.getLogger(CustomForwardedRequestInterceptor.class);
|
||||||
@Override
|
@Override
|
||||||
public void intercept(RequestData data, MappingProperties mapping) {
|
public void intercept(RequestData data, MappingProperties mapping) {
|
||||||
System.out.println("tptp");
|
logger.debug(data.toString());
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -3,12 +3,15 @@ package org.chtijbug.drools.reverseproxy.mappings;
|
||||||
import com.github.mkopylec.charon.configuration.MappingProperties;
|
import com.github.mkopylec.charon.configuration.MappingProperties;
|
||||||
import com.github.mkopylec.charon.core.http.ReceivedResponseInterceptor;
|
import com.github.mkopylec.charon.core.http.ReceivedResponseInterceptor;
|
||||||
import com.github.mkopylec.charon.core.http.ResponseData;
|
import com.github.mkopylec.charon.core.http.ResponseData;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
public class CustomReceivedResponseInterceptor implements ReceivedResponseInterceptor {
|
public class CustomReceivedResponseInterceptor implements ReceivedResponseInterceptor {
|
||||||
|
private static final Logger logger = LoggerFactory.getLogger(CustomReceivedResponseInterceptor.class);
|
||||||
@Override
|
@Override
|
||||||
public void intercept(ResponseData responseData, MappingProperties mappingProperties) {
|
public void intercept(ResponseData responseData, MappingProperties mappingProperties) {
|
||||||
System.out.println("response");
|
logger.debug(responseData.toString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,8 @@
|
||||||
package org.chtijbug.drools.reverseproxy.service;
|
package org.chtijbug.drools.reverseproxy.service;
|
||||||
|
|
||||||
import com.github.mkopylec.charon.configuration.MappingProperties;
|
import com.github.mkopylec.charon.configuration.MappingProperties;
|
||||||
|
import org.chtijbug.drools.ReverseProxyUpdate;
|
||||||
|
import org.chtijbug.drools.common.KafkaTopicConstants;
|
||||||
import org.chtijbug.drools.proxy.persistence.model.ProjectPersist;
|
import org.chtijbug.drools.proxy.persistence.model.ProjectPersist;
|
||||||
import org.chtijbug.drools.proxy.persistence.model.RuntimePersist;
|
import org.chtijbug.drools.proxy.persistence.model.RuntimePersist;
|
||||||
import org.chtijbug.drools.proxy.persistence.repository.ProjectRepository;
|
import org.chtijbug.drools.proxy.persistence.repository.ProjectRepository;
|
||||||
|
|
@ -9,6 +11,7 @@ import org.chtijbug.drools.reverseproxy.mappings.CustomMappingsProvider;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.kafka.annotation.KafkaListener;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import javax.annotation.PostConstruct;
|
import javax.annotation.PostConstruct;
|
||||||
|
|
@ -28,9 +31,10 @@ public class UpdateService {
|
||||||
|
|
||||||
private Boolean toUpdate = true;
|
private Boolean toUpdate = true;
|
||||||
|
|
||||||
private List<MappingProperties> mappings=new ArrayList<>();
|
private List<MappingProperties> mappings = new ArrayList<>();
|
||||||
|
|
||||||
|
private Map<String, MappingProperties> mappingPropertiesMap = new HashMap<>();
|
||||||
|
|
||||||
private Map<String,MappingProperties> mappingPropertiesMap = new HashMap<>();
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private CustomMappingsProvider customMappingsProvider;
|
private CustomMappingsProvider customMappingsProvider;
|
||||||
|
|
||||||
|
|
@ -38,69 +42,46 @@ public class UpdateService {
|
||||||
return toUpdate;
|
return toUpdate;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void updateConfig() {
|
|
||||||
/**
|
@KafkaListener(
|
||||||
if (this.toUpdate==false) {
|
topics = KafkaTopicConstants.REVERSE_PROXY,
|
||||||
this.toUpdate = isToUpdate();
|
containerFactory = "mappingKafkaListenerContainerFactory")
|
||||||
if (this.toUpdate==true){
|
public void store(ReverseProxyUpdate update) {
|
||||||
generateMappings();
|
boolean found = false;
|
||||||
}
|
for (MappingProperties mappingProperties : mappingPropertiesMap.values()) {
|
||||||
}
|
if (mappingProperties.getPath().equals(update.getPath())) {
|
||||||
**/
|
found = true;
|
||||||
generateMappings();
|
mappingProperties.getDestinations().clear();
|
||||||
|
logger.info("Updating path {}",update.getPath());
|
||||||
|
for (String destination : update.getServerNames()) {
|
||||||
|
mappingProperties.getDestinations().add(destination);
|
||||||
|
logger.info("for path {} adding server {} ",update.getPath(),destination);
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean isToUpdate() {
|
break;
|
||||||
boolean result = false;
|
|
||||||
runtimes.clear();
|
|
||||||
List<RuntimePersist> runtimePersists = runtimeRepository.findAll();
|
|
||||||
Map<String, String> urlMap = new HashMap<>();
|
|
||||||
for (RuntimePersist runtimePersist : runtimePersists) {
|
|
||||||
if (urlMap.containsKey(runtimePersist.getServerName()) == false) {
|
|
||||||
urlMap.put(runtimePersist.getServerName(), runtimePersist.getServerUrl());
|
|
||||||
runtimes.put(runtimePersist.getServerName(), runtimePersist.duplicate());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
List<ProjectPersist> projectPersists = projectRepository.findAll();
|
if (!found) {
|
||||||
List<String> projectOk = new ArrayList<>();
|
MappingProperties newMappingProperties = new MappingProperties();
|
||||||
for (ProjectPersist projectPersist : projectPersists) {
|
newMappingProperties.setPath(update.getPath());
|
||||||
if (projectPersist.getServerNames().size() > 0) {
|
logger.info("Creating path {}",update.getPath());
|
||||||
projectOk.add(projectPersist.getContainerID());
|
for (String destination : update.getServerNames()) {
|
||||||
if (projects.containsKey(projectPersist.getContainerID()) == false) {
|
newMappingProperties.getDestinations().add(destination);
|
||||||
return true;
|
logger.info("for path {} adding server {} ",update.getPath(),destination);
|
||||||
}
|
}
|
||||||
|
mappingPropertiesMap.put(update.getPath(), newMappingProperties);
|
||||||
// if a new project is not in the already displayed
|
|
||||||
|
|
||||||
List<String> list1 = projectPersist.getServerNames();
|
|
||||||
int l1 = list1.size();
|
|
||||||
ProjectPersist run2 = projects.get(projectPersist.getContainerID());
|
|
||||||
List<String> list2 = run2.getServerNames();
|
|
||||||
if (list2.size() != list1.size()) {
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
list1.retainAll(list2);
|
mappings.clear();
|
||||||
if (list2.size() != list1.size()) {
|
mappings.addAll(mappingPropertiesMap.values());
|
||||||
return true;
|
this.toUpdate = true;
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// An existing project in the reverse is no more to be displayed
|
|
||||||
for (String goodId : projects.keySet()) {
|
|
||||||
if (projectOk.contains(goodId) == false) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<MappingProperties> retrievePath() {
|
public List<MappingProperties> retrievePath() {
|
||||||
this.toUpdate=false;
|
this.toUpdate = false;
|
||||||
return mappings;
|
return mappings;
|
||||||
}
|
}
|
||||||
private void generateMappings(){
|
|
||||||
|
private void generateMappings() {
|
||||||
projects.clear();
|
projects.clear();
|
||||||
mappingPropertiesMap.clear();
|
mappingPropertiesMap.clear();
|
||||||
List<MappingProperties> paths = new ArrayList<>();
|
List<MappingProperties> paths = new ArrayList<>();
|
||||||
|
|
@ -117,16 +98,16 @@ public class UpdateService {
|
||||||
if (projectPersist.getServerNames().size() > 0) {
|
if (projectPersist.getServerNames().size() > 0) {
|
||||||
projects.put(projectPersist.getContainerID(), projectPersist.duplicate());
|
projects.put(projectPersist.getContainerID(), projectPersist.duplicate());
|
||||||
MappingProperties mappingProperties2 = new MappingProperties();
|
MappingProperties mappingProperties2 = new MappingProperties();
|
||||||
String servList=null;
|
String servList = null;
|
||||||
for (String serverName : projectPersist.getServerNames()) {
|
for (String serverName : projectPersist.getServerNames()) {
|
||||||
RuntimePersist runtimePersist = runtimes.get(serverName);
|
RuntimePersist runtimePersist = runtimes.get(serverName);
|
||||||
if (runtimePersist!= null) {
|
if (runtimePersist != null) {
|
||||||
String hostName = runtimePersist.getServerUrl() + "/api/" + projectPersist.getContainerID();
|
String hostName = runtimePersist.getServerUrl() + "/api/" + projectPersist.getContainerID();
|
||||||
mappingProperties2.getDestinations().add(hostName);
|
mappingProperties2.getDestinations().add(hostName);
|
||||||
if (servList==null){
|
if (servList == null) {
|
||||||
servList=serverName;
|
servList = serverName;
|
||||||
}else{
|
} else {
|
||||||
servList=servList+":"+serverName;
|
servList = servList + ":" + serverName;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -136,13 +117,17 @@ public class UpdateService {
|
||||||
mappingProperties2.getCustomConfiguration().put("connect", 2000);
|
mappingProperties2.getCustomConfiguration().put("connect", 2000);
|
||||||
mappingProperties2.getCustomConfiguration().put("read", 2000);
|
mappingProperties2.getCustomConfiguration().put("read", 2000);
|
||||||
mappingProperties2.setStripPath(true);
|
mappingProperties2.setStripPath(true);
|
||||||
if ( mappingProperties2.getDestinations().size()>0) {
|
if (mappingProperties2.getDestinations().size() > 0) {
|
||||||
mappingPropertiesMap.put(mappingProperties2.getPath(),mappingProperties2);
|
mappingPropertiesMap.put(mappingProperties2.getPath(), mappingProperties2);
|
||||||
paths.add(mappingProperties2);
|
paths.add(mappingProperties2);
|
||||||
logger.info("Project "+projectPersist.getContainerID()+" defined on servers - "+mappingProperties2.getDestinations().toString());
|
logger.info("Startup creating path {}",mappingProperties2.getPath());
|
||||||
|
for (String serverName : mappingProperties2.getDestinations()){
|
||||||
|
logger.info("---------for path {} adding server {} ",mappingProperties2.getPath(),serverName);
|
||||||
|
}
|
||||||
|
logger.info("---------Project " + projectPersist.getContainerID() + " defined on servers - " + mappingProperties2.getDestinations().toString());
|
||||||
|
|
||||||
}else{
|
} else {
|
||||||
logger.error("Project "+projectPersist.getContainerID()+" defined on non existing server");
|
logger.error("Project " + projectPersist.getContainerID() + " defined on non existing server");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,3 +2,4 @@ server.port=9500
|
||||||
spring.data.mongodb.database=businessProxyDB
|
spring.data.mongodb.database=businessProxyDB
|
||||||
spring.data.mongodb.host=localhost:28017
|
spring.data.mongodb.host=localhost:28017
|
||||||
charon.tracing.enabled=true
|
charon.tracing.enabled=true
|
||||||
|
kafka.bootstrapAddress=localhost:9092,localhost:9093,localhost:9094
|
||||||
|
|
@ -14,8 +14,8 @@
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
<category>Rest</category>
|
<category>Rest</category>
|
||||||
<spring.boot-version>2.1.0.RELEASE</spring.boot-version>
|
<spring.boot-version>${spring.boot.version}</spring.boot-version>
|
||||||
<camel.version>2.23.0</camel.version>
|
<camel.version>2.25.1</camel.version>
|
||||||
</properties>
|
</properties>
|
||||||
<modules>
|
<modules>
|
||||||
<module>drools-framework-business-proxy-app</module>
|
<module>drools-framework-business-proxy-app</module>
|
||||||
|
|
|
||||||
8
pom.xml
8
pom.xml
|
|
@ -17,13 +17,13 @@
|
||||||
<packaging>pom</packaging>
|
<packaging>pom</packaging>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
<jbpm.version>7.38.0.Final</jbpm.version>
|
<jbpm.version>7.39.0.Final</jbpm.version>
|
||||||
<node.version>v10.16.3</node.version>
|
<node.version>v10.16.3</node.version>
|
||||||
<npm.version>6.11.3</npm.version>
|
<npm.version>6.11.3</npm.version>
|
||||||
<frontend-maven-plugin.version>1.8.0</frontend-maven-plugin.version>
|
<frontend-maven-plugin.version>1.8.0</frontend-maven-plugin.version>
|
||||||
<spring.boot.version>2.1.2.RELEASE</spring.boot.version>
|
<spring.boot.version>2.2.6.RELEASE</spring.boot.version>
|
||||||
|
|
||||||
<spring.version>4.3.16.RELEASE</spring.version>
|
<spring.version>5.2.6.RELEASE</spring.version>
|
||||||
<version.thorntail>2.2.1.Final</version.thorntail>
|
<version.thorntail>2.2.1.Final</version.thorntail>
|
||||||
<!--registry.host>registry.hub.docker.com/pymmasoftware</registry.host-->
|
<!--registry.host>registry.hub.docker.com/pymmasoftware</registry.host-->
|
||||||
<registry.host>192.168.1.122:18083</registry.host>
|
<registry.host>192.168.1.122:18083</registry.host>
|
||||||
|
|
@ -31,7 +31,7 @@
|
||||||
<version.org.wildfly.core>4.0.0.Final</version.org.wildfly.core>
|
<version.org.wildfly.core>4.0.0.Final</version.org.wildfly.core>
|
||||||
<version.mongodb.driver>3.8.2</version.mongodb.driver>
|
<version.mongodb.driver>3.8.2</version.mongodb.driver>
|
||||||
<version.number>${git.commit.time}.${git.commit.id.abbrev}</version.number>
|
<version.number>${git.commit.time}.${git.commit.id.abbrev}</version.number>
|
||||||
|
<kafka.version>2.3.7.RELEASE</kafka.version>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
editor.link_modal.header
Reference in a new issue