Work and upgrade to version 7.40.0

This commit is contained in:
Nicolas Héron 2020-07-16 11:33:36 +02:00
commit 42795bf9c8
14 changed files with 77 additions and 30 deletions

View file

@ -169,7 +169,7 @@
<dependency>
<groupId>com.fasterxml.jackson.module</groupId>
<artifactId>jackson-module-jaxb-annotations</artifactId>
<version>2.10.3</version>
<version>2.10.4</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
@ -178,7 +178,7 @@
<dependency>
<groupId>com.fasterxml.jackson.dataformat</groupId>
<artifactId>jackson-dataformat-xml</artifactId>
<version>2.9.4</version>
<version>2.10.4</version>
<exclusions>
<exclusion>
<groupId>com.fasterxml.jackson.core</groupId>
@ -194,11 +194,6 @@
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.module</groupId>
<artifactId>jackson-module-jaxb-annotations</artifactId>
<version>2.9.4</version>
</dependency>
<!--dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>

View file

@ -15,21 +15,18 @@ import org.chtijbug.drools.console.middle.DababaseContentInit;
import org.chtijbug.drools.console.service.model.kie.KieConfigurationData;
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.Value;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.context.event.ApplicationReadyEvent;
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.PropertySource;
import org.springframework.context.event.EventListener;
import org.springframework.data.mongodb.repository.config.EnableMongoRepositories;
import org.springframework.kafka.annotation.EnableKafka;
import org.springframework.kafka.config.ConcurrentKafkaListenerContainerFactory;
@ -172,9 +169,11 @@ public class DroolsSpringBootConsoleApplication extends SpringBootServletInitial
SpringApplication.run(DroolsSpringBootConsoleApplication.class, args);
}
// @EventListener(ApplicationReadyEvent.class)
@EventListener(ApplicationReadyEvent.class)
public void InitPlatform(){
dababaseContentInit.initDatabaseIfNecessary();
/**
Map<String,KieContainerResource> kies = new HashMap<>();
KieServerSetup kieServerSetup = kieBusinessCentralConnector.connectToBusinessCentral("nheron", "adminnheron00@");
if (kieServerSetup!= null && kieServerSetup.getContainers()!= null) {
@ -195,12 +194,17 @@ public class DroolsSpringBootConsoleApplication extends SpringBootServletInitial
ServerInstanceKeyList serverInstanceKeyList = kieBusinessCentralConnector.getListInstances("nheron", "adminnheron00@");
if (serverInstanceKeyList!=null){
for (ServerInstanceKey serverInstanceKey : serverInstanceKeyList.getServerInstanceKeys()){
//serverInstanceKey.get
String serverInstanceId = serverInstanceKey.getServerInstanceId();
ContainerList containerList = kieBusinessCentralConnector.getListContainers("nheron", "adminnheron00@", serverInstanceId);
System.out.println("coucou");
for (Container container : containerList.getContainers()){
}
}
System.out.println("coucou");
}
System.out.println("coucou");
**/
}

View file

@ -22,7 +22,7 @@ import javax.ws.rs.core.HttpHeaders;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
@RestController
@RequestMapping("/server/config")
@RequestMapping("/api/server/config")
public class KieServerResource {
public KieServerResource() {

View file

@ -33,7 +33,7 @@ import static org.kie.server.api.rest.RestURI.CONTAINER_ID;
@RestController
@RequestMapping("/server")
@RequestMapping("/api/server")
public class KieServerRestImpl {
@Value(value = "${org.kie.server.id}")

View file

@ -7,6 +7,7 @@ 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.ContainerList;
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;
@ -150,7 +151,34 @@ public class KieBusinessCentralConnector {
return null;
}
}
public ContainerList getListContainers(String username, String password,String serverInstanceId){
String completeurl=kiewbUrl+"/controller/runtime/servers/"+kieserverID+"/instances/"+serverInstanceId+"/containers";
ResponseEntity<ContainerList> response = restTemplateKiewb
.execute(completeurl, HttpMethod.GET, requestCallback(null, username, password), clientHttpResponse -> {
ContainerList extractedResponse;
ResponseEntity<ContainerList> 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, ContainerList.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();

View file

@ -56,6 +56,7 @@ public class GridActionLogging extends Grid<BusinessTransactionAction> {
public GridActionLogging(String idRequest) {
mapper.setDateFormat( new SimpleDateFormat("dd-MM-yyyy hh:mm"));
indexerService = AppContext.getApplicationContext().getBean(IndexerService.class);
setClassName("action-log-grid-perso");
@ -148,6 +149,7 @@ public class GridActionLogging extends Grid<BusinessTransactionAction> {
textArea.setReadOnly(true);
textArea.setClassName("content-log");
try {
mapper.setDateFormat( new SimpleDateFormat("dd-MM-yyyy hh:mm"));
String text = mapper.writerWithDefaultPrettyPrinter().writeValueAsString(b.getInputData().getRealFact());
textArea.setValue(text);
} catch (JsonProcessingException e) {

View file

@ -28,7 +28,7 @@
<dependency>
<groupId>org.kie</groupId>
<artifactId>business-central</artifactId>
<classifier>wildfly18</classifier>
<classifier>wildfly19</classifier>
<version>${jbpm.version}</version>
<type>war</type>
<exclusions>
@ -36,8 +36,17 @@
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
</exclusion>
<exclusion>
<groupId>com.fasterxml.jackson.module</groupId>
<artifactId>jackson-module-jaxb-annotations</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.module</groupId>
<artifactId>jackson-module-jaxb-annotations</artifactId>
<version>2.10.4</version>
</dependency>
<dependency>
<groupId>com.pymmasoftware.jbpm</groupId>
<artifactId>drools-framework-wildfly-login-module</artifactId>
@ -83,7 +92,7 @@
<artifactItem>
<groupId>org.kie</groupId>
<artifactId>business-central</artifactId>
<classifier>wildfly18</classifier>
<classifier>wildfly19</classifier>
<version>${jbpm.version}</version>
<type>war</type>
<outputDirectory>${project.build.directory}/unpack-tmp</outputDirectory>
@ -111,7 +120,7 @@
<overWriteReleases>false</overWriteReleases>
<overWriteSnapshots>false</overWriteSnapshots>
<overWriteIfNewer>true</overWriteIfNewer>
<excludeArtifactIds>drools-framework-wildfly-login-module</excludeArtifactIds>
<excludeArtifactIds>drools-framework-wildfly-login-module,jackson-module-jaxb-annotations:2.9.10</excludeArtifactIds>
<includeGroupIds>com.pymmasoftware.jbpm</includeGroupIds>
</configuration>
</execution>

View file

@ -100,7 +100,7 @@
<dependency>
<groupId>com.fasterxml.jackson.module</groupId>
<artifactId>jackson-module-jaxb-annotations</artifactId>
<version>2.8.9</version>
<version>2.10.4</version>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>

View file

@ -82,8 +82,8 @@
<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.10.3" 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.39.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.39.0.Final" level="project" />
<orderEntry type="library" name="Maven: org.kie:kie-internal:7.40.0.20200703" level="project" />
<orderEntry type="library" name="Maven: org.kie:kie-api:7.40.0.20200703" level="project" />
<orderEntry type="library" name="Maven: org.kie.soup:kie-soup-maven-support:7.40.0.20200703" level="project" />
</component>
</module>

View file

@ -52,6 +52,8 @@ public class DroolsBusinessIndexerServer {
Map<String, Object> props = new HashMap<>();
props.put(ConsumerConfig.BOOTSTRAP_SERVERS_CONFIG, bootstrapAddress);
props.put(ConsumerConfig.GROUP_ID_CONFIG, groupID);
props.put(ConsumerConfig.KEY_DESERIALIZER_CLASS_CONFIG, StringDeserializer.class);
props.put(ConsumerConfig.VALUE_DESERIALIZER_CLASS_CONFIG, JsonDeserializer.class);
return new DefaultKafkaConsumerFactory<>(props, new StringDeserializer(), new JsonDeserializer<>(ChtijbugObjectRequest.class));
}
@Bean

View file

@ -95,8 +95,8 @@
<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: commons-io:commons-io:2.1" 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.39.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.kie:kie-internal:7.40.0.20200703" level="project" />
<orderEntry type="library" name="Maven: org.kie:kie-api:7.40.0.20200703" level="project" />
<orderEntry type="library" name="Maven: org.kie.soup:kie-soup-maven-support:7.40.0.20200703" level="project" />
</component>
</module>

View file

@ -16,6 +16,9 @@
*/
package org.chtijbug.drools.proxy;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
import org.apache.kafka.clients.admin.AdminClientConfig;
import org.apache.kafka.clients.admin.NewTopic;
import org.apache.kafka.clients.consumer.ConsumerConfig;
@ -83,6 +86,10 @@ public class DroolsBusinessProxyServer {
configProps.put(
ProducerConfig.VALUE_SERIALIZER_CLASS_CONFIG,
JsonSerializer.class);
ObjectMapper objectMapper = new ObjectMapper();
objectMapper.registerModule(new JavaTimeModule());
objectMapper.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS);
new DefaultKafkaProducerFactory<>(configProps, new StringSerializer(), new JsonSerializer<ChtijbugObjectRequest>(objectMapper));
return new DefaultKafkaProducerFactory<>(configProps);
}
@Bean

View file

@ -41,9 +41,9 @@
<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.10.3" 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.39.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.39.0.Final" level="project" />
<orderEntry type="library" name="Maven: org.kie:kie-internal:7.40.0.20200703" level="project" />
<orderEntry type="library" name="Maven: org.kie:kie-api:7.40.0.20200703" level="project" />
<orderEntry type="library" name="Maven: org.kie.soup:kie-soup-maven-support:7.40.0.20200703" 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" />

View file

@ -17,7 +17,7 @@
<packaging>pom</packaging>
<properties>
<jbpm.version>7.39.0.Final</jbpm.version>
<jbpm.version>7.40.0.20200703</jbpm.version>
<node.version>v10.16.3</node.version>
<npm.version>6.11.3</npm.version>
<frontend-maven-plugin.version>1.8.0</frontend-maven-plugin.version>