Enable/disable kie logging #271
Allow to define a JMT token to give access to a project over reverse proxy #274 Hot deploy management #269 => UI for defiinition
This commit is contained in:
parent
a3fc3ae71f
commit
488870e587
32 changed files with 664 additions and 167 deletions
|
|
@ -254,6 +254,21 @@
|
|||
<artifactId>springfox-swagger-ui</artifactId>
|
||||
<version>3.0.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.jsonwebtoken</groupId>
|
||||
<artifactId>jjwt</artifactId>
|
||||
<version>0.9.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.jsonwebtoken</groupId>
|
||||
<artifactId>jjwt</artifactId>
|
||||
<version>0.9.1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.vaadin.olli</groupId>
|
||||
<artifactId>clipboardhelper</artifactId>
|
||||
<version>1.1.2</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,64 @@
|
|||
package org.chtijbug.drools.console.middle;
|
||||
|
||||
import io.jsonwebtoken.Claims;
|
||||
import io.jsonwebtoken.JwtBuilder;
|
||||
import io.jsonwebtoken.Jwts;
|
||||
import io.jsonwebtoken.SignatureAlgorithm;
|
||||
import org.chtijbug.drools.proxy.persistence.model.ProjectPersist;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.crypto.spec.SecretKeySpec;
|
||||
import javax.xml.bind.DatatypeConverter;
|
||||
import java.security.Key;
|
||||
import java.util.Date;
|
||||
|
||||
@Service
|
||||
public class JwtService {
|
||||
|
||||
@Value("${secretkey}")
|
||||
public String secretKey;
|
||||
|
||||
public String createJWT(ProjectPersist projectPersist, long ttlMillis) {
|
||||
|
||||
//The JWT signature algorithm we will be using to sign the token
|
||||
SignatureAlgorithm signatureAlgorithm = SignatureAlgorithm.HS256;
|
||||
|
||||
long nowMillis = System.currentTimeMillis();
|
||||
Date now = new Date(nowMillis);
|
||||
|
||||
//We will sign our JWT with our ApiKey secret
|
||||
byte[] apiKeySecretBytes = DatatypeConverter.parseBase64Binary(secretKey);
|
||||
Key signingKey = new SecretKeySpec(apiKeySecretBytes, signatureAlgorithm.getJcaName());
|
||||
|
||||
//Let's set the JWT Claims
|
||||
JwtBuilder builder = Jwts.builder().setId(projectPersist.getUuid())
|
||||
.setIssuedAt(now)
|
||||
.setSubject("api")
|
||||
.setIssuer("pymma")
|
||||
.claim("groupID",projectPersist.getGroupID())
|
||||
.claim("artifactID",projectPersist.getArtifactID())
|
||||
.claim("branch",projectPersist.getBranch())
|
||||
.claim("mainClass",projectPersist.getMainClass())
|
||||
.claim("uuid",projectPersist.getUuid())
|
||||
.signWith(signatureAlgorithm, signingKey);
|
||||
|
||||
//if it has been specified, let's add the expiration
|
||||
if (ttlMillis >= 0) {
|
||||
long expMillis = nowMillis + ttlMillis;
|
||||
Date exp = new Date(expMillis);
|
||||
builder.setExpiration(exp);
|
||||
}
|
||||
|
||||
//Builds the JWT and serializes it to a compact, URL-safe string
|
||||
return builder.compact();
|
||||
}
|
||||
|
||||
|
||||
public Claims decodeJWT(String jwt) {
|
||||
return Jwts.parser()
|
||||
.setSigningKey(DatatypeConverter.parseBase64Binary(secretKey))
|
||||
.parseClaimsJws(jwt.replace("bearer","")).getBody();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -187,7 +187,12 @@ public class ProjectPersistService {
|
|||
projectPersist.setContainerID(projectPersist.getDeploymentName() + "-" + projectPersist.getProjectName());
|
||||
projectPersist.getServerNames().clear();
|
||||
ReverseProxyUpdate reverseProxyUpdate = new ReverseProxyUpdate();
|
||||
reverseProxyUpdate.setPath("/" + projectPersist.getContainerID());
|
||||
reverseProxyUpdate.setContainerID(projectPersist.getContainerID());
|
||||
if (projectPersist.isUseJWTToConnect()) {
|
||||
reverseProxyUpdate.setTokenUUID(projectPersist.getUuid());
|
||||
}else{
|
||||
reverseProxyUpdate.setPath("/" + projectPersist.getContainerID());
|
||||
}
|
||||
for (RuntimePersist runtimePersist : runtimePersists) {
|
||||
List<String> names = new ArrayList<>();
|
||||
names.add(runtimePersist.getServerName());
|
||||
|
|
@ -201,7 +206,8 @@ public class ProjectPersistService {
|
|||
newContainer.setServerName(runtimePersist.getServerName());
|
||||
newContainer.setGroupId(projectPersist.getGroupID());
|
||||
newContainer.setArtifactId(projectPersist.getArtifactID());
|
||||
|
||||
newContainer.setProjectUUID(projectPersist.getUuid());
|
||||
newContainer.setDisableRuleLogging(projectPersist.isDisableRuleLogging());
|
||||
newContainer.setVersion(projectPersist.getProjectVersion());
|
||||
containerRepository.save(newContainer);
|
||||
List<ContainerRuntimePojoPersist> elts = containerRuntimeRepository.findByServerNameAndContainerId(runtimePersist.getServerName(), projectPersist.getContainerID());
|
||||
|
|
@ -217,9 +223,15 @@ public class ProjectPersistService {
|
|||
runtimePojoPersist.setHostname(runtimePersist.getHostname());
|
||||
runtimePojoPersist.setContainerId(projectPersist.getContainerID());
|
||||
runtimePojoPersist.setStatus(ContainerRuntimePojoPersist.STATUS.TODEPLOY.name());
|
||||
runtimePojoPersist.setProjectUUID(projectPersist.getUuid());
|
||||
runtimePojoPersist.setDisableRuleLogging(projectPersist.isDisableRuleLogging());
|
||||
containerRuntimeRepository.save(runtimePojoPersist);
|
||||
}
|
||||
|
||||
}else{
|
||||
existingContainer.setDisableRuleLogging(projectPersist.isDisableRuleLogging());
|
||||
existingContainer.setProjectUUID(projectPersist.getUuid());
|
||||
containerRepository.save(existingContainer);
|
||||
}
|
||||
|
||||
String hostName = runtimePersist.getServerUrl() + "/api/" + projectPersist.getContainerID();
|
||||
|
|
@ -288,6 +300,7 @@ public class ProjectPersistService {
|
|||
runtimePojoPersist.setHostname(server.getHostname());
|
||||
runtimePojoPersist.setContainerId(projectPersist.getContainerID());
|
||||
runtimePojoPersist.setStatus(ContainerRuntimePojoPersist.STATUS.TODEPLOY.name());
|
||||
runtimePojoPersist.setProjectUUID(projectPersist.getUuid());
|
||||
containerRuntimeRepository.save(runtimePojoPersist);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,11 @@
|
|||
package org.chtijbug.drools.console.service;
|
||||
|
||||
import org.chtijbug.drools.console.service.model.ReturnPerso;
|
||||
import org.chtijbug.drools.proxy.persistence.model.ContainerPojoPersist;
|
||||
import org.chtijbug.drools.proxy.persistence.model.ContainerRuntimePojoPersist;
|
||||
import org.chtijbug.drools.proxy.persistence.model.ProjectPersist;
|
||||
import org.chtijbug.drools.proxy.persistence.repository.ContainerRepository;
|
||||
import org.chtijbug.drools.proxy.persistence.repository.ContainerRuntimeRepository;
|
||||
import org.chtijbug.drools.proxy.persistence.repository.RuntimeRepository;
|
||||
import org.chtijbug.drools.proxy.persistence.model.RuntimePersist;
|
||||
import org.kie.server.api.model.KieServerInfo;
|
||||
|
|
@ -16,6 +21,8 @@ import org.springframework.http.ResponseEntity;
|
|||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.web.client.RestTemplate;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
@DependsOn("applicationContext")
|
||||
public class RuntimeService {
|
||||
|
|
@ -26,6 +33,12 @@ public class RuntimeService {
|
|||
@Autowired
|
||||
private RuntimeRepository runtimeRepository;
|
||||
|
||||
@Autowired
|
||||
private ContainerRepository containerRepository;
|
||||
|
||||
@Autowired
|
||||
private ContainerRuntimeRepository containerRuntimeRepository;
|
||||
|
||||
private RestTemplate restTemplateKiewb = new RestTemplate();
|
||||
|
||||
public ReturnPerso<KieServerInfo> verifyIfKieServerExist(String url) {
|
||||
|
|
@ -64,4 +77,22 @@ public class RuntimeService {
|
|||
public void setRuntimeRepository(RuntimeRepository runtimeRepository) {
|
||||
this.runtimeRepository = runtimeRepository;
|
||||
}
|
||||
|
||||
public void updateRuntimes(ProjectPersist projectPersist) {
|
||||
if (projectPersist!= null && projectPersist.getUuid()!= null) {
|
||||
List<ContainerPojoPersist> containerPojoPersists = containerRepository.findByProjectUUID(projectPersist.getUuid());
|
||||
for (ContainerPojoPersist containerPojoPersist : containerPojoPersists){
|
||||
containerPojoPersist.setDisableRuleLogging(projectPersist.isDisableRuleLogging());
|
||||
containerRepository.save(containerPojoPersist);
|
||||
|
||||
List<ContainerRuntimePojoPersist> containerRuntimePojoPersists = containerRuntimeRepository.findByContainerId(containerPojoPersist.getContainerId());
|
||||
for (ContainerRuntimePojoPersist containerRuntimePojoPersist : containerRuntimePojoPersists){
|
||||
containerRuntimePojoPersist.setDisableRuleLogging(projectPersist.isDisableRuleLogging());
|
||||
containerRuntimePojoPersist.setProjectUUID(projectPersist.getUuid());
|
||||
containerRuntimeRepository.save(containerRuntimePojoPersist);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,18 +1,27 @@
|
|||
package org.chtijbug.drools.console.vaadincomponent.componentview;
|
||||
|
||||
import com.vaadin.flow.component.AbstractField;
|
||||
import com.vaadin.flow.component.ClickEvent;
|
||||
import com.vaadin.flow.component.ComponentEventListener;
|
||||
import com.vaadin.flow.component.HasValue;
|
||||
import com.vaadin.flow.component.button.Button;
|
||||
import com.vaadin.flow.component.checkbox.Checkbox;
|
||||
import com.vaadin.flow.component.dialog.Dialog;
|
||||
import com.vaadin.flow.component.html.Label;
|
||||
import com.vaadin.flow.component.icon.VaadinIcon;
|
||||
import com.vaadin.flow.component.notification.Notification;
|
||||
import com.vaadin.flow.component.orderedlayout.VerticalLayout;
|
||||
import com.vaadin.flow.data.value.ValueChangeMode;
|
||||
import io.jsonwebtoken.Claims;
|
||||
import org.chtijbug.drools.console.middle.JwtService;
|
||||
import org.chtijbug.drools.console.service.ProjectPersistService;
|
||||
import org.chtijbug.drools.console.service.RuntimeService;
|
||||
import org.chtijbug.drools.console.service.util.AppContext;
|
||||
import org.chtijbug.drools.console.vaadincomponent.componentperso.ComboBoxPerso;
|
||||
import org.chtijbug.drools.console.vaadincomponent.componentperso.TextFieldPerso;
|
||||
import org.chtijbug.drools.console.view.DeploymentView;
|
||||
import org.chtijbug.drools.proxy.persistence.model.ProjectPersist;
|
||||
import org.vaadin.olli.ClipboardHelper;
|
||||
|
||||
public class DefineProject extends VerticalLayout {
|
||||
|
||||
|
|
@ -30,12 +39,31 @@ public class DefineProject extends VerticalLayout {
|
|||
|
||||
private Button valider;
|
||||
|
||||
private Checkbox disableRuleLoggingCheckbox;
|
||||
|
||||
private Checkbox enableHotDeployCheckbox;
|
||||
private Checkbox useJWTToConnectCheckbox;
|
||||
|
||||
private TextFieldPerso jwtTokenTextField;
|
||||
|
||||
private TextFieldPerso jwtPeriod;
|
||||
|
||||
private Button createJWTButton;
|
||||
|
||||
private Button copyJWTTextButton;
|
||||
|
||||
private transient ProjectPersistService projectPersistService;
|
||||
|
||||
private transient RuntimeService runtimeService;
|
||||
|
||||
private boolean createMode;
|
||||
|
||||
private JwtService jwtService;
|
||||
|
||||
public DefineProject(DeploymentView deploymentView,Dialog dialog, ProjectPersist projectPersist){
|
||||
|
||||
|
||||
jwtService = AppContext.getApplicationContext().getBean(JwtService.class);
|
||||
runtimeService = AppContext.getApplicationContext().getBean(RuntimeService.class);
|
||||
projectPersistService=AppContext.getApplicationContext().getBean(ProjectPersistService.class);
|
||||
|
||||
setClassName("creation-runtime-content");
|
||||
|
|
@ -44,7 +72,7 @@ public class DefineProject extends VerticalLayout {
|
|||
label.setClassName("creation-runtime-title");
|
||||
add(label);
|
||||
|
||||
label2=new Label("this step is essential before you can associate your project with a workbench");
|
||||
label2=new Label("this step is essential before you can work on your project");
|
||||
label2.setClassName("creation-runtime-title2");
|
||||
add(label2);
|
||||
|
||||
|
|
@ -98,6 +126,106 @@ public class DefineProject extends VerticalLayout {
|
|||
|
||||
add(processID);
|
||||
|
||||
enableHotDeployCheckbox = new Checkbox("Enable Hot deployment (needs 2 runtimes)");
|
||||
if (projectPersist.isEnableHotDeploy()){
|
||||
enableHotDeployCheckbox.setValue(true);
|
||||
}else{
|
||||
enableHotDeployCheckbox.setValue(false);
|
||||
}
|
||||
enableHotDeployCheckbox.addValueChangeListener(new HasValue.ValueChangeListener<AbstractField.ComponentValueChangeEvent<Checkbox, Boolean>>() {
|
||||
@Override
|
||||
public void valueChanged(AbstractField.ComponentValueChangeEvent<Checkbox, Boolean> checkboxBooleanComponentValueChangeEvent) {
|
||||
projectPersist.setEnableHotDeploy(checkboxBooleanComponentValueChangeEvent.getValue());
|
||||
}
|
||||
});
|
||||
add(enableHotDeployCheckbox);
|
||||
|
||||
disableRuleLoggingCheckbox = new Checkbox("Disable Rule logging");
|
||||
if (projectPersist.isDisableRuleLogging()){
|
||||
disableRuleLoggingCheckbox.setValue(true);
|
||||
}else{
|
||||
disableRuleLoggingCheckbox.setValue(false);
|
||||
}
|
||||
disableRuleLoggingCheckbox.addValueChangeListener(new HasValue.ValueChangeListener<AbstractField.ComponentValueChangeEvent<Checkbox, Boolean>>() {
|
||||
@Override
|
||||
public void valueChanged(AbstractField.ComponentValueChangeEvent<Checkbox, Boolean> checkboxBooleanComponentValueChangeEvent) {
|
||||
projectPersist.setDisableRuleLogging(disableRuleLoggingCheckbox.getValue());
|
||||
}
|
||||
});
|
||||
add(disableRuleLoggingCheckbox);
|
||||
|
||||
useJWTToConnectCheckbox =new Checkbox("Use JWT token to connect to API");
|
||||
add(useJWTToConnectCheckbox);
|
||||
|
||||
|
||||
|
||||
jwtTokenTextField=new TextFieldPerso("JWT Token for API","",VaadinIcon.TASKS.create());
|
||||
|
||||
if (projectPersist.getJwtAPIToken()!= null
|
||||
&& projectPersist.getJwtAPIToken().length()>0){
|
||||
jwtTokenTextField.getTextField().setValue(projectPersist.getJwtAPIToken());
|
||||
}
|
||||
jwtTokenTextField.getTextField().setEnabled(false);
|
||||
|
||||
|
||||
add(jwtTokenTextField);
|
||||
copyJWTTextButton = new Button("Copy JWT token");
|
||||
ClipboardHelper clipboardHelper = new ClipboardHelper(projectPersist.getJwtAPIToken(), copyJWTTextButton);
|
||||
add(clipboardHelper);
|
||||
jwtPeriod=new TextFieldPerso("JWT validity for API","",VaadinIcon.TASKS.create());
|
||||
jwtPeriod.setEnabled(false);
|
||||
if (projectPersist.getJwtAPIToken()!= null
|
||||
&& projectPersist.getJwtAPIToken().length()>0){
|
||||
try {
|
||||
Claims claims = jwtService.decodeJWT(projectPersist.getJwtAPIToken());
|
||||
jwtPeriod.getTextField().setValue(claims.getExpiration().toString());
|
||||
}catch (Exception e){
|
||||
|
||||
}
|
||||
jwtTokenTextField.getTextField().setValue(projectPersist.getJwtAPIToken());
|
||||
}
|
||||
add(jwtPeriod);
|
||||
createJWTButton = new Button("Generate JWT token for one year");
|
||||
createJWTButton.addClickListener(new ComponentEventListener<ClickEvent<Button>>() {
|
||||
@Override
|
||||
public void onComponentEvent(ClickEvent<Button> buttonClickEvent) {
|
||||
String token = jwtService.createJWT(projectPersist, 1000*3600*24*(long)365);
|
||||
projectPersist.setJwtAPIToken(token);
|
||||
jwtTokenTextField.getTextField().setValue(token);
|
||||
Claims claims = jwtService.decodeJWT(projectPersist.getJwtAPIToken());
|
||||
jwtPeriod.getTextField().setValue(claims.getExpiration().toString());
|
||||
}
|
||||
});
|
||||
add(createJWTButton);
|
||||
if (projectPersist.isUseJWTToConnect()){
|
||||
useJWTToConnectCheckbox.setValue(true);
|
||||
}else{
|
||||
useJWTToConnectCheckbox.setValue(false);
|
||||
jwtTokenTextField.getTextField().setValue("");
|
||||
jwtTokenTextField.setEnabled(false);
|
||||
projectPersist.setJwtAPIToken(null);
|
||||
createJWTButton.setEnabled(false);
|
||||
jwtPeriod.getTextField().setValue("");
|
||||
copyJWTTextButton.setEnabled(false);
|
||||
}
|
||||
useJWTToConnectCheckbox.addValueChangeListener(new HasValue.ValueChangeListener<AbstractField.ComponentValueChangeEvent<Checkbox, Boolean>>() {
|
||||
@Override
|
||||
public void valueChanged(AbstractField.ComponentValueChangeEvent<Checkbox, Boolean> checkboxBooleanComponentValueChangeEvent) {
|
||||
projectPersist.setUseJWTToConnect(useJWTToConnectCheckbox.getValue());
|
||||
if (!useJWTToConnectCheckbox.getValue()){
|
||||
jwtTokenTextField.getTextField().setValue("");
|
||||
createJWTButton.setEnabled(false);
|
||||
projectPersist.setJwtAPIToken(null);
|
||||
jwtPeriod.getTextField().setValue("");
|
||||
copyJWTTextButton.setEnabled(false);
|
||||
}else{
|
||||
jwtTokenTextField.setEnabled(true);
|
||||
copyJWTTextButton.setEnabled(true);
|
||||
createJWTButton.setEnabled(true);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
valider=new Button("Save");
|
||||
if (projectPersist.getProcessID()!= null
|
||||
&& projectPersist.getProcessID().length()>0){
|
||||
|
|
@ -112,6 +240,7 @@ public class DefineProject extends VerticalLayout {
|
|||
if (createMode) {
|
||||
projectPersist.setStatus(ProjectPersist.DEFINI);
|
||||
}
|
||||
runtimeService.updateRuntimes(projectPersist);
|
||||
projectPersistService.getProjectRepository().save(projectPersist);
|
||||
deploymentView.setDataProvider();
|
||||
dialog.close();
|
||||
|
|
@ -128,5 +257,10 @@ public class DefineProject extends VerticalLayout {
|
|||
valider.setEnabled(true);
|
||||
}
|
||||
}
|
||||
public void verifyToken(){
|
||||
|
||||
valider.setEnabled(true);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,7 +3,9 @@ package org.chtijbug.drools.console.vaadincomponent.leftMenu.Action;
|
|||
import com.vaadin.flow.component.button.Button;
|
||||
import com.vaadin.flow.component.icon.VaadinIcon;
|
||||
import com.vaadin.flow.component.orderedlayout.VerticalLayout;
|
||||
import org.chtijbug.drools.console.middle.JwtService;
|
||||
import org.chtijbug.drools.console.service.ProjectPersistService;
|
||||
import org.chtijbug.drools.console.service.UserConnectedService;
|
||||
import org.chtijbug.drools.console.service.util.AppContext;
|
||||
import org.chtijbug.drools.console.vaadincomponent.componentperso.DialogPerso;
|
||||
import org.chtijbug.drools.console.vaadincomponent.Squelette.SqueletteComposant;
|
||||
|
|
|
|||
|
|
@ -31,4 +31,7 @@ spring.servlet.multipart.max-request-size=100MB
|
|||
|
||||
# Server properties
|
||||
server.tomcat.max-http-post-size=100000000
|
||||
server.tomcat.max-swallow-size=100MB
|
||||
server.tomcat.max-swallow-size=100MB
|
||||
|
||||
|
||||
secretkey=eRaYY7Wo24sDqKSX3IM9ASGmdGPmkTd9jo1QTy4b7P9Ze5_9hKolVX8xNrQDcNRfVEdTZNOuOyqEGhXEbdJI-ZQ19k_o9MI0y3eZN2lp9jow55FfXMiINEdt1XR85VipRLSOkT6kSpzs2x-jbLDiz9iFVzkd81YKxMgPA7VfZeQUm4n-mOmnWMaVX30zGFU4L3oPBctYKkl4dYfqYWqRNfrgPJVi5DGFjywgxx0ASEiJHtV72paI3fDR2XwlSkyhhmY-ICjCRmsJN4fX1pdoL8a18-aQrvyu4j0Os6dVPYIoPvvY0SAZtWYKHfM15g7A3HD4cVREf9cUsprCRK93w
|
||||
|
|
|
|||
|
|
@ -0,0 +1,5 @@
|
|||
package org.chtijbug.drools.common.rest;
|
||||
|
||||
public class Constants {
|
||||
public final static String AUTHORISATION_HEADER = "Authorization";
|
||||
}
|
||||
|
|
@ -32,7 +32,7 @@ import org.springframework.context.annotation.PropertySource;
|
|||
|
||||
@EnableAutoConfiguration
|
||||
@PropertySource("classpath:application.properties")
|
||||
public class Application {
|
||||
public class SwimmingPoolApplication {
|
||||
|
||||
@Value(value = "${url.swimmingpool.calculate}")
|
||||
private String url;
|
||||
|
|
@ -42,7 +42,7 @@ public class Application {
|
|||
private String password;
|
||||
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(Application.class, args);
|
||||
SpringApplication.run(SwimmingPoolApplication.class, args);
|
||||
}
|
||||
|
||||
@Bean
|
||||
|
|
@ -27,6 +27,6 @@ import org.springframework.boot.web.servlet.support.SpringBootServletInitializer
|
|||
public class WebInitializer extends SpringBootServletInitializer {
|
||||
@Override
|
||||
protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
|
||||
return application.sources(Application.class);
|
||||
return application.sources(SwimmingPoolApplication.class);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@ package org.chtijbug.swimmingpool.web.controller;
|
|||
|
||||
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import org.chtijbug.drools.common.rest.Constants;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
|
|
@ -52,10 +53,10 @@ public class QuoteController {
|
|||
Quote responseMoteur=null;
|
||||
try {
|
||||
|
||||
String completeurl = urlCalcul+"/"+containerid;
|
||||
String completeurl = urlCalcul+"/";
|
||||
logger.info("url moteur reco : " + completeurl);
|
||||
ResponseEntity<Quote> response = restTemplateKieServer
|
||||
.execute(completeurl, HttpMethod.PUT, requestCallback(quoteRequest), clientHttpResponse -> {
|
||||
.execute(completeurl, HttpMethod.PUT, requestCallback(quoteRequest,containerid), clientHttpResponse -> {
|
||||
Quote extractedResponse = null;
|
||||
if (clientHttpResponse.getBody() != null) {
|
||||
Scanner s = new Scanner(clientHttpResponse.getBody()).useDelimiter("\\A");
|
||||
|
|
@ -79,7 +80,7 @@ public class QuoteController {
|
|||
}
|
||||
return responseMoteur;
|
||||
}
|
||||
private RequestCallback requestCallback(final Quote updatedInstance) {
|
||||
private RequestCallback requestCallback(final Quote updatedInstance,String token) {
|
||||
return clientHttpRequest -> {
|
||||
ObjectMapper mapper = new ObjectMapper();
|
||||
mapper.writeValue(clientHttpRequest.getBody(), updatedInstance);
|
||||
|
|
@ -89,6 +90,8 @@ public class QuoteController {
|
|||
"transactionId", updatedInstance.getSessionLogging());
|
||||
|
||||
}
|
||||
clientHttpRequest.getHeaders().add(
|
||||
Constants.AUTHORISATION_HEADER, token);
|
||||
clientHttpRequest.getHeaders().add(
|
||||
HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON_VALUE);
|
||||
clientHttpRequest.getHeaders().add(
|
||||
|
|
|
|||
|
|
@ -1,7 +1,8 @@
|
|||
# See http://docs.spring.io/spring-boot/docs/1.1.4.RELEASE/reference/htmlsingle/#boot-features-external-config-profile-specific-properties
|
||||
# for more details about creating profile-specific property files
|
||||
# See http://docs.spring.io/spring-boot/docs/1.1.4.RELEASE/reference/htmlsingle/#howto-initialize-a-database-using-jpa
|
||||
url.swimmingpool.calculate=http://localhost:9500/
|
||||
url.swimmingpool.calculate=http://localhost:9500
|
||||
#url.swimmingpool.calculate=https://proxy.kie.infra.pymma-software.net
|
||||
url.swimmingpool.calculate.username=kieserver
|
||||
url.swimmingpool.calculate.password=kieserver1!
|
||||
server.port=12099
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@
|
|||
|
||||
<tr>
|
||||
<td><label for="containerid" class="control-label">Container id :</label></td>
|
||||
<td><input id="containerid" type="text" ng-model="containerid" ng-maxlength="30"/></td>
|
||||
<td><input id="containerid" type="text" ng-model="containerid" ng-maxlength="20000"/></td>
|
||||
|
||||
<td><label for="aClassName" class="control-label">Class name :</label></td>
|
||||
<td><input id="aClassName" type="text" ng-model="aClassName" ng-maxlength="50"/></td>
|
||||
|
|
|
|||
|
|
@ -66,7 +66,7 @@ productManagerModule.controller('quoteManagerController', function ($scope, $htt
|
|||
$scope.productSearch = "";
|
||||
$http.defaults.headers.post["Content-Type"] = "application/json";
|
||||
$scope.allSessionExecutionDetails = [];
|
||||
$scope.containerid = "dev";
|
||||
$scope.containerid = "eyJhbGciOiJIUzI1NiJ9.eyJqdGkiOiI2MDk5OWEyZGQ3YWUyODNmY2MyNWFhNzciLCJpYXQiOjE2MjY4NzkxMjUsInN1YiI6ImFwaSIsImlzcyI6InB5bW1hIiwiZ3JvdXBJRCI6ImNvbS5weW1tYXNvZnR3YXJlLmpicG0udHJhaW5pbmciLCJhcnRpZmFjdElEIjoic3dpbW1pbmdwb29sLXR1dG9yaWFsIiwicHJvamVjdFZlcnNpb24iOiIyLjAuMC1TTkFQU0hPVCIsImJyYW5jaCI6Im1hc3RlciIsIm1haW5DbGFzcyI6Im9yZy50cmFpbmluZy5sZWlzdXJlLnN3aW1taW5ncG9vbC5RdW90ZSIsImV4cCI6MTY1ODQxNTEyNX0.sKYOY98Hsk4JcS546f7xmj1tPNxdrqRtw5y6w0qdu88";
|
||||
$scope.aClassName = "org.training.leisure.swimmingpool.Quote";
|
||||
var _lastGoodResult = '';
|
||||
$scope.toPrettyJSON = function (objStr, tabWidth) {
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@ package org.chtijbug.kieserver.services.drools;
|
|||
|
||||
import org.chtijbug.drools.ChtijbugObjectRequest;
|
||||
import org.chtijbug.drools.SessionContext;
|
||||
import org.chtijbug.drools.entity.history.HistoryEvent;
|
||||
import org.chtijbug.drools.kieserver.extension.KieServerAddOnElement;
|
||||
import org.chtijbug.drools.kieserver.extension.KieServerGlobalVariableDefinition;
|
||||
import org.chtijbug.drools.kieserver.extension.KieServerListenerDefinition;
|
||||
|
|
@ -32,9 +33,7 @@ import org.kie.server.services.api.KieServerRegistry;
|
|||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* Direct rules execution service that allow use of typed objects instead of string only
|
||||
|
|
@ -130,7 +129,10 @@ public class DroolsChtijbugRulesExecutionService {
|
|||
RuleBasePackage ruleBasePackage = this.ruleBasePackages.get(kci.getResource().getContainerId());
|
||||
if (ruleBasePackage != null) {
|
||||
Date startTime = new Date();
|
||||
ChtijbugHistoryListener chtijbugHistoryListener = new ChtijbugHistoryListener();
|
||||
ChtijbugHistoryListener chtijbugHistoryListener=null;
|
||||
if (!chtijbugObjectRequest.isDisableLogging()) {
|
||||
chtijbugHistoryListener = new ChtijbugHistoryListener();
|
||||
}
|
||||
RuleBaseSession session = ruleBasePackage.createRuleBaseSession(sessionMaxNumberRulesToExecute, chtijbugHistoryListener, sessionName);
|
||||
if (kieServerAddOnElement != null) {
|
||||
|
||||
|
|
@ -145,7 +147,11 @@ public class DroolsChtijbugRulesExecutionService {
|
|||
result = session.fireAllRulesAndStartProcess(chtijbugObjectRequest.getObjectRequest(), processID);
|
||||
session.dispose();
|
||||
Date stopTime = new Date();
|
||||
SessionContext sessionContext = this.messageHandlerResolver.getSessionFromHistoryEvent(chtijbugHistoryListener.getHistoryEventLinkedList());
|
||||
List<HistoryEvent> events=new ArrayList<>();
|
||||
if (chtijbugHistoryListener!= null){
|
||||
events = chtijbugHistoryListener.getHistoryEventLinkedList();
|
||||
}
|
||||
SessionContext sessionContext = this.messageHandlerResolver.getSessionFromHistoryEvent(events);
|
||||
sessionContext.setGroupID(kci.getResource().getReleaseId().getGroupId());
|
||||
sessionContext.setArtefactID(kci.getResource().getReleaseId().getArtifactId());
|
||||
sessionContext.setVersion(kci.getResource().getReleaseId().getVersion());
|
||||
|
|
|
|||
|
|
@ -23,6 +23,8 @@ public class ChtijbugObjectRequest {
|
|||
|
||||
private SessionContext sessionLogging;
|
||||
|
||||
private boolean disableLogging;
|
||||
|
||||
public String getTransactionID() {
|
||||
return transactionID;
|
||||
}
|
||||
|
|
@ -102,4 +104,12 @@ public class ChtijbugObjectRequest {
|
|||
public void setVersion(String version) {
|
||||
this.version = version;
|
||||
}
|
||||
|
||||
public boolean isDisableLogging() {
|
||||
return disableLogging;
|
||||
}
|
||||
|
||||
public void setDisableLogging(boolean disableLogging) {
|
||||
this.disableLogging = disableLogging;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,6 +6,10 @@ import java.util.List;
|
|||
public class ReverseProxyUpdate {
|
||||
private String path;
|
||||
|
||||
private String tokenUUID;
|
||||
|
||||
private String containerID;
|
||||
|
||||
List<String> serverNames = new ArrayList<>();
|
||||
|
||||
public String getPath() {
|
||||
|
|
@ -16,6 +20,14 @@ public class ReverseProxyUpdate {
|
|||
this.path = path;
|
||||
}
|
||||
|
||||
public String getTokenUUID() {
|
||||
return tokenUUID;
|
||||
}
|
||||
|
||||
public void setTokenUUID(String tokenUUID) {
|
||||
this.tokenUUID = tokenUUID;
|
||||
}
|
||||
|
||||
public List<String> getServerNames() {
|
||||
return serverNames;
|
||||
}
|
||||
|
|
@ -23,4 +35,12 @@ public class ReverseProxyUpdate {
|
|||
public void setServerNames(List<String> serverNames) {
|
||||
this.serverNames = serverNames;
|
||||
}
|
||||
|
||||
public void setContainerID(String containerID) {
|
||||
this.containerID = containerID;
|
||||
}
|
||||
|
||||
public String getContainerID() {
|
||||
return containerID;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -64,95 +64,98 @@ public class StoreLoggingService {
|
|||
item.setServerName(sessionContext.getServerName());
|
||||
Map<Long, BusinessTransactionAction> actions = new HashMap<>();
|
||||
SessionExecution sessionExecution = sessionContext.getSessionExecution();
|
||||
BusinessTransactionAction businessTransactionoutput = null;
|
||||
for (Fact fact : sessionExecution.getFacts()) {
|
||||
BusinessTransactionAction businessTransactionAction = new BusinessTransactionAction();
|
||||
businessTransactionAction.setId(UUID.randomUUID().toString());
|
||||
businessTransactionAction.setBusinessTransactionId(item.getId());
|
||||
if (fact.getFactType().equals(FactType.INPUTDATA)) {
|
||||
businessTransactionAction.setEventType(EventType.INPUT);
|
||||
businessTransactionAction.setInputData(fact);
|
||||
businessTransactionAction.setEventNumber(0);
|
||||
actions.put(businessTransactionAction.getEventNumber(), businessTransactionAction);
|
||||
} else if (fact.getFactType().equals(FactType.OUTPUTDATA)) {
|
||||
businessTransactionAction.setEventType(EventType.OUPUT);
|
||||
businessTransactionAction.setOutputData(fact);
|
||||
businessTransactionoutput = businessTransactionAction;
|
||||
if (sessionExecution != null) {
|
||||
BusinessTransactionAction businessTransactionoutput = null;
|
||||
for (Fact fact : sessionExecution.getFacts()) {
|
||||
BusinessTransactionAction businessTransactionAction = new BusinessTransactionAction();
|
||||
businessTransactionAction.setId(UUID.randomUUID().toString());
|
||||
businessTransactionAction.setBusinessTransactionId(item.getId());
|
||||
if (fact.getFactType().equals(FactType.INPUTDATA)) {
|
||||
businessTransactionAction.setEventType(EventType.INPUT);
|
||||
businessTransactionAction.setInputData(fact);
|
||||
businessTransactionAction.setEventNumber(0);
|
||||
actions.put(businessTransactionAction.getEventNumber(), businessTransactionAction);
|
||||
} else if (fact.getFactType().equals(FactType.OUTPUTDATA)) {
|
||||
businessTransactionAction.setEventType(EventType.OUPUT);
|
||||
businessTransactionAction.setOutputData(fact);
|
||||
businessTransactionoutput = businessTransactionAction;
|
||||
|
||||
} else if (fact.getFactType().equals(FactType.INSERTED)) {
|
||||
businessTransactionAction.setEventType(EventType.INSERTFACT);
|
||||
businessTransactionAction.setFact(fact);
|
||||
businessTransactionAction.setEventNumber(ii++);
|
||||
actions.put(businessTransactionAction.getEventNumber(), businessTransactionAction);
|
||||
} else if (fact.getFactType().equals(FactType.UPDATED_NEWVALUE)) {
|
||||
businessTransactionAction.setEventType(EventType.UPDATEFACTNEWVALUE);
|
||||
businessTransactionAction.setFact(fact);
|
||||
businessTransactionAction.setEventNumber(ii++);
|
||||
actions.put(businessTransactionAction.getEventNumber(), businessTransactionAction);
|
||||
} else if (fact.getFactType().equals(FactType.UPDATED_OLDVALUE)) {
|
||||
businessTransactionAction.setEventType(EventType.UPDATEFACTOLDVALUE);
|
||||
businessTransactionAction.setFact(fact);
|
||||
businessTransactionAction.setEventNumber(ii++);
|
||||
actions.put(businessTransactionAction.getEventNumber(), businessTransactionAction);
|
||||
} else if (fact.getFactType().equals(FactType.DELETED)) {
|
||||
businessTransactionAction.setEventType(EventType.RETRACTFACT);
|
||||
businessTransactionAction.setFact(fact);
|
||||
businessTransactionAction.setEventNumber(ii++);
|
||||
actions.put(businessTransactionAction.getEventNumber(), businessTransactionAction);
|
||||
}
|
||||
}
|
||||
for (ProcessExecution processExecution : sessionExecution.getProcessExecutions()) {
|
||||
BusinessTransactionAction businessTransactionActionStart = new BusinessTransactionAction();
|
||||
|
||||
businessTransactionActionStart.setEventType(EventType.STARTPROCESS);
|
||||
businessTransactionActionStart.setProcessID(processExecution.getProcessId());
|
||||
|
||||
businessTransactionActionStart.setBusinessTransactionId(item.getId());
|
||||
businessTransactionActionStart.setEventNumber(ii++);
|
||||
businessTransactionActionStart.setId(UUID.randomUUID().toString());
|
||||
actions.put(businessTransactionActionStart.getEventNumber(), businessTransactionActionStart);
|
||||
for (RuleflowGroup rfg : processExecution.getRuleflowGroups()) {
|
||||
BusinessTransactionAction businessTransactionActionStartRFG = new BusinessTransactionAction();
|
||||
|
||||
businessTransactionActionStartRFG.setBusinessTransactionId(item.getId());
|
||||
businessTransactionActionStartRFG.setEventType(EventType.STARTRULEFLOWGROUP);
|
||||
businessTransactionActionStartRFG.setRuleflowGroupName(rfg.getRuleflowGroup());
|
||||
businessTransactionActionStartRFG.setEventNumber(ii++);
|
||||
businessTransactionActionStartRFG.setId(UUID.randomUUID().toString());
|
||||
actions.put(businessTransactionActionStartRFG.getEventNumber(), businessTransactionActionStartRFG);
|
||||
for (RuleExecution ruleExecution : rfg.getRuleExecutionList()) {
|
||||
BusinessTransactionAction businessTransactionActionRule = new BusinessTransactionAction();
|
||||
|
||||
businessTransactionActionRule.setEventType(EventType.RULE);
|
||||
businessTransactionActionRule.setRuleflowGroupName(rfg.getRuleflowGroup());
|
||||
businessTransactionActionRule.setRuleExecution(ruleExecution);
|
||||
businessTransactionActionRule.setBusinessTransactionId(item.getId());
|
||||
businessTransactionActionRule.setProcessID(processExecution.getProcessId());
|
||||
businessTransactionActionRule.setEventNumber(ii++);
|
||||
businessTransactionActionRule.setId(UUID.randomUUID().toString());
|
||||
actions.put(businessTransactionActionRule.getEventNumber(), businessTransactionActionRule);
|
||||
} else if (fact.getFactType().equals(FactType.INSERTED)) {
|
||||
businessTransactionAction.setEventType(EventType.INSERTFACT);
|
||||
businessTransactionAction.setFact(fact);
|
||||
businessTransactionAction.setEventNumber(ii++);
|
||||
actions.put(businessTransactionAction.getEventNumber(), businessTransactionAction);
|
||||
} else if (fact.getFactType().equals(FactType.UPDATED_NEWVALUE)) {
|
||||
businessTransactionAction.setEventType(EventType.UPDATEFACTNEWVALUE);
|
||||
businessTransactionAction.setFact(fact);
|
||||
businessTransactionAction.setEventNumber(ii++);
|
||||
actions.put(businessTransactionAction.getEventNumber(), businessTransactionAction);
|
||||
} else if (fact.getFactType().equals(FactType.UPDATED_OLDVALUE)) {
|
||||
businessTransactionAction.setEventType(EventType.UPDATEFACTOLDVALUE);
|
||||
businessTransactionAction.setFact(fact);
|
||||
businessTransactionAction.setEventNumber(ii++);
|
||||
actions.put(businessTransactionAction.getEventNumber(), businessTransactionAction);
|
||||
} else if (fact.getFactType().equals(FactType.DELETED)) {
|
||||
businessTransactionAction.setEventType(EventType.RETRACTFACT);
|
||||
businessTransactionAction.setFact(fact);
|
||||
businessTransactionAction.setEventNumber(ii++);
|
||||
actions.put(businessTransactionAction.getEventNumber(), businessTransactionAction);
|
||||
}
|
||||
BusinessTransactionAction businessTransactionActionSTOPRFG = new BusinessTransactionAction();
|
||||
|
||||
businessTransactionActionSTOPRFG.setEventType(EventType.STOPTRULEFLOWGROUP);
|
||||
businessTransactionActionSTOPRFG.setRuleflowGroupName(rfg.getRuleflowGroup());
|
||||
businessTransactionActionSTOPRFG.setBusinessTransactionId(item.getId());
|
||||
businessTransactionActionSTOPRFG.setEventNumber(ii++);
|
||||
businessTransactionActionSTOPRFG.setId(UUID.randomUUID().toString());
|
||||
actions.put(businessTransactionActionSTOPRFG.getEventNumber(), businessTransactionActionSTOPRFG);
|
||||
}
|
||||
BusinessTransactionAction businessTransactionActionEnd = new BusinessTransactionAction();
|
||||
businessTransactionActionEnd.setEventType(EventType.STOPPROCESS);
|
||||
businessTransactionActionEnd.setProcessID(processExecution.getProcessId());
|
||||
businessTransactionActionEnd.setBusinessTransactionId(item.getId());
|
||||
businessTransactionActionEnd.setEventNumber(ii++);
|
||||
businessTransactionActionEnd.setId(UUID.randomUUID().toString());
|
||||
for (ProcessExecution processExecution : sessionExecution.getProcessExecutions()) {
|
||||
BusinessTransactionAction businessTransactionActionStart = new BusinessTransactionAction();
|
||||
|
||||
actions.put(businessTransactionActionEnd.getEventNumber(), businessTransactionActionEnd);
|
||||
}
|
||||
if (businessTransactionoutput != null) {
|
||||
businessTransactionoutput.setEventNumber(ii++);
|
||||
actions.put(businessTransactionoutput.getEventNumber(), businessTransactionoutput);
|
||||
businessTransactionActionStart.setEventType(EventType.STARTPROCESS);
|
||||
businessTransactionActionStart.setProcessID(processExecution.getProcessId());
|
||||
|
||||
businessTransactionActionStart.setBusinessTransactionId(item.getId());
|
||||
businessTransactionActionStart.setEventNumber(ii++);
|
||||
businessTransactionActionStart.setId(UUID.randomUUID().toString());
|
||||
actions.put(businessTransactionActionStart.getEventNumber(), businessTransactionActionStart);
|
||||
for (RuleflowGroup rfg : processExecution.getRuleflowGroups()) {
|
||||
BusinessTransactionAction businessTransactionActionStartRFG = new BusinessTransactionAction();
|
||||
|
||||
businessTransactionActionStartRFG.setBusinessTransactionId(item.getId());
|
||||
businessTransactionActionStartRFG.setEventType(EventType.STARTRULEFLOWGROUP);
|
||||
businessTransactionActionStartRFG.setRuleflowGroupName(rfg.getRuleflowGroup());
|
||||
businessTransactionActionStartRFG.setEventNumber(ii++);
|
||||
businessTransactionActionStartRFG.setId(UUID.randomUUID().toString());
|
||||
actions.put(businessTransactionActionStartRFG.getEventNumber(), businessTransactionActionStartRFG);
|
||||
for (RuleExecution ruleExecution : rfg.getRuleExecutionList()) {
|
||||
BusinessTransactionAction businessTransactionActionRule = new BusinessTransactionAction();
|
||||
|
||||
businessTransactionActionRule.setEventType(EventType.RULE);
|
||||
businessTransactionActionRule.setRuleflowGroupName(rfg.getRuleflowGroup());
|
||||
businessTransactionActionRule.setRuleExecution(ruleExecution);
|
||||
businessTransactionActionRule.setBusinessTransactionId(item.getId());
|
||||
businessTransactionActionRule.setProcessID(processExecution.getProcessId());
|
||||
businessTransactionActionRule.setEventNumber(ii++);
|
||||
businessTransactionActionRule.setId(UUID.randomUUID().toString());
|
||||
actions.put(businessTransactionActionRule.getEventNumber(), businessTransactionActionRule);
|
||||
}
|
||||
BusinessTransactionAction businessTransactionActionSTOPRFG = new BusinessTransactionAction();
|
||||
|
||||
businessTransactionActionSTOPRFG.setEventType(EventType.STOPTRULEFLOWGROUP);
|
||||
businessTransactionActionSTOPRFG.setRuleflowGroupName(rfg.getRuleflowGroup());
|
||||
businessTransactionActionSTOPRFG.setBusinessTransactionId(item.getId());
|
||||
businessTransactionActionSTOPRFG.setEventNumber(ii++);
|
||||
businessTransactionActionSTOPRFG.setId(UUID.randomUUID().toString());
|
||||
actions.put(businessTransactionActionSTOPRFG.getEventNumber(), businessTransactionActionSTOPRFG);
|
||||
}
|
||||
BusinessTransactionAction businessTransactionActionEnd = new BusinessTransactionAction();
|
||||
businessTransactionActionEnd.setEventType(EventType.STOPPROCESS);
|
||||
businessTransactionActionEnd.setProcessID(processExecution.getProcessId());
|
||||
businessTransactionActionEnd.setBusinessTransactionId(item.getId());
|
||||
businessTransactionActionEnd.setEventNumber(ii++);
|
||||
businessTransactionActionEnd.setId(UUID.randomUUID().toString());
|
||||
|
||||
actions.put(businessTransactionActionEnd.getEventNumber(), businessTransactionActionEnd);
|
||||
}
|
||||
|
||||
if (businessTransactionoutput != null) {
|
||||
businessTransactionoutput.setEventNumber(ii++);
|
||||
actions.put(businessTransactionoutput.getEventNumber(), businessTransactionoutput);
|
||||
}
|
||||
}
|
||||
List<Long> keys = new ArrayList<>(actions.keySet());
|
||||
Collections.sort(keys);
|
||||
|
|
|
|||
|
|
@ -13,12 +13,14 @@ public class DroolsRouter extends RouteBuilder {
|
|||
private String projectName;
|
||||
private Class<?> clazzUser;
|
||||
private String processID;
|
||||
private boolean disableRuleLogging;
|
||||
|
||||
public DroolsRouter(CamelContext camelContext, Class<?> clazzUser, String projectName, String processID) {
|
||||
public DroolsRouter(CamelContext camelContext, Class<?> clazzUser, String projectName, String processID, boolean disableRuleLogging) {
|
||||
super(camelContext);
|
||||
this.clazzUser = clazzUser;
|
||||
this.projectName = projectName;
|
||||
this.processID = processID;
|
||||
this.disableRuleLogging = disableRuleLogging;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -33,6 +35,6 @@ public class DroolsRouter extends RouteBuilder {
|
|||
.param().name("body").type(body).description("The Data drools should work on").endParam()
|
||||
.responseMessage().code(200).message("Data drools worked on").endResponseMessage()
|
||||
|
||||
.to("bean:ruleService?method=runSessionObject(${header.transactionId}," + this.projectName + "," + this.processID + ",${body})");
|
||||
.to("bean:ruleService?method=runSessionObject(${header.transactionId}," + this.projectName + "," + this.processID + ",${body},"+disableRuleLogging+")");
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@ import org.chtijbug.drools.proxy.persistence.model.ContainerRuntimePojoPersist;
|
|||
import org.chtijbug.drools.proxy.persistence.model.RuntimePersist;
|
||||
import org.chtijbug.drools.proxy.persistence.repository.ContainerRepository;
|
||||
import org.chtijbug.drools.proxy.persistence.repository.ContainerRuntimeRepository;
|
||||
import org.chtijbug.drools.proxy.persistence.repository.ProjectRepository;
|
||||
import org.chtijbug.drools.proxy.persistence.repository.RuntimeRepository;
|
||||
import org.chtijbug.kieserver.services.drools.DroolsChtijbugKieServerExtension;
|
||||
import org.chtijbug.kieserver.services.drools.DroolsChtijbugRulesExecutionService;
|
||||
|
|
@ -72,6 +73,8 @@ public class KieServiceCommon {
|
|||
private RuntimeRepository runtimeRepository;
|
||||
@Inject
|
||||
private ContainerRuntimeRepository containerRuntimeRepository;
|
||||
@Inject
|
||||
private ProjectRepository projectRepository;
|
||||
|
||||
@Value("${server.port}")
|
||||
private int serverPort;
|
||||
|
|
@ -185,6 +188,7 @@ public class KieServiceCommon {
|
|||
containerRuntimePojoPersist.setServerName(serverName);
|
||||
containerRuntimePojoPersist.setHostname(hostName);
|
||||
containerRuntimePojoPersist.setStatus(ContainerRuntimePojoPersist.STATUS.UP.name());
|
||||
containerRuntimePojoPersist.setProjectUUID(container.getProjectUUID());
|
||||
containerRuntimeRepository.save(containerRuntimePojoPersist);
|
||||
this.createContainer(kieContainerResource.getContainerId(), kieContainerResource);
|
||||
this.initCamelBusinessRoute(container);
|
||||
|
|
@ -260,7 +264,7 @@ public class KieServiceCommon {
|
|||
String projectName = container.getContainerId();
|
||||
String processId = container.getProcessID();
|
||||
this.deleteCamelBusinessRoute(projectName);
|
||||
DroolsRouter droolsRouter = new DroolsRouter(camelContext, theClass, projectName, processId);
|
||||
DroolsRouter droolsRouter = new DroolsRouter(camelContext, theClass, projectName, processId,container.isDisableRuleLogging());
|
||||
camelContext.addRoutes(droolsRouter);
|
||||
routes.put(containerId, droolsRouter);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -27,12 +27,13 @@ public class RuleService {
|
|||
logger.info("Rule Service created");
|
||||
}
|
||||
|
||||
public Object runSessionObject(String transactionID, String id, String processID, Object input) {
|
||||
public Object runSessionObject(String transactionID, String id, String processID, Object input, boolean disableRuleLogging) {
|
||||
|
||||
ChtijbugObjectRequest chtijbugObjectRequest = new ChtijbugObjectRequest();
|
||||
chtijbugObjectRequest.setTransactionID(transactionID);
|
||||
chtijbugObjectRequest.setProcessID(processID);
|
||||
chtijbugObjectRequest.setContainerID(id);
|
||||
chtijbugObjectRequest.setDisableLogging(disableRuleLogging);
|
||||
chtijbugObjectRequest.setTransactionStartTimeStamp(LocalDateTime.now());
|
||||
KieContainerInstance kci = kieServiceCommon.getRegistry().getContainer(id);
|
||||
chtijbugObjectRequest.setArtifactID(kci.getKieContainer().getReleaseId().getArtifactId());
|
||||
|
|
|
|||
|
|
@ -4,15 +4,19 @@ import org.springframework.data.annotation.Id;
|
|||
import org.springframework.data.mongodb.core.index.Indexed;
|
||||
import org.springframework.data.mongodb.core.mapping.Document;
|
||||
|
||||
import java.security.PrivateKey;
|
||||
|
||||
@Document
|
||||
public class ContainerPojoPersist {
|
||||
|
||||
@Id
|
||||
private String id;
|
||||
|
||||
private boolean disableRuleLogging;
|
||||
|
||||
@Indexed
|
||||
private String className;
|
||||
|
||||
@Indexed
|
||||
private String containerId;
|
||||
@Indexed
|
||||
|
|
@ -22,14 +26,13 @@ public class ContainerPojoPersist {
|
|||
|
||||
private String projectName;
|
||||
|
||||
|
||||
|
||||
private String groupId;
|
||||
|
||||
private String artifactId;
|
||||
|
||||
private String version;
|
||||
|
||||
private String projectUUID;
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
|
|
@ -79,7 +82,21 @@ public class ContainerPojoPersist {
|
|||
this.processID = processID;
|
||||
}
|
||||
|
||||
public String getProjectUUID() {
|
||||
return projectUUID;
|
||||
}
|
||||
|
||||
public void setProjectUUID(String projectUUID) {
|
||||
this.projectUUID = projectUUID;
|
||||
}
|
||||
|
||||
public boolean isDisableRuleLogging() {
|
||||
return disableRuleLogging;
|
||||
}
|
||||
|
||||
public void setDisableRuleLogging(boolean disableRuleLogging) {
|
||||
this.disableRuleLogging = disableRuleLogging;
|
||||
}
|
||||
|
||||
public String getGroupId() {
|
||||
return groupId;
|
||||
|
|
|
|||
|
|
@ -24,6 +24,9 @@ public class ContainerRuntimePojoPersist {
|
|||
|
||||
private String status;
|
||||
|
||||
private String projectUUID;
|
||||
|
||||
private boolean disableRuleLogging;
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
|
|
@ -33,6 +36,21 @@ public class ContainerRuntimePojoPersist {
|
|||
this.id = id;
|
||||
}
|
||||
|
||||
public String getProjectUUID() {
|
||||
return projectUUID;
|
||||
}
|
||||
|
||||
public void setProjectUUID(String projectUUID) {
|
||||
this.projectUUID = projectUUID;
|
||||
}
|
||||
|
||||
public boolean isDisableRuleLogging() {
|
||||
return disableRuleLogging;
|
||||
}
|
||||
|
||||
public void setDisableRuleLogging(boolean disableRuleLogging) {
|
||||
this.disableRuleLogging = disableRuleLogging;
|
||||
}
|
||||
|
||||
public String getContainerId() {
|
||||
return containerId;
|
||||
|
|
|
|||
|
|
@ -16,13 +16,13 @@ import java.util.List;
|
|||
@CompoundIndexes({
|
||||
@CompoundIndex(def = "{'projectName':1, 'branch':1}", name = "projectName_branch_Index")
|
||||
})
|
||||
public class ProjectPersist implements Serializable {
|
||||
public class ProjectPersist implements Serializable {
|
||||
|
||||
public static final String ADEFINIR="A définir";
|
||||
public static final String ADEFINIR = "A définir";
|
||||
|
||||
public static final String DEFINI="Défini";
|
||||
public static final String DEFINI = "Défini";
|
||||
|
||||
public static final String Deployable="Déployable";
|
||||
public static final String Deployable = "Déployable";
|
||||
|
||||
@Indexed
|
||||
private String deploymentName;
|
||||
|
|
@ -51,13 +51,22 @@ public class ProjectPersist implements Serializable {
|
|||
|
||||
private String branch;
|
||||
|
||||
private List<String> serverNames= new ArrayList<>();
|
||||
private List<String> serverNames = new ArrayList<>();
|
||||
|
||||
private String status;
|
||||
|
||||
private List<String> classNameList;
|
||||
|
||||
public ProjectPersist(){}
|
||||
private boolean disableRuleLogging;
|
||||
|
||||
private boolean enableHotDeploy;
|
||||
|
||||
private boolean useJWTToConnect;
|
||||
|
||||
private String jwtAPIToken;
|
||||
|
||||
public ProjectPersist() {
|
||||
}
|
||||
|
||||
public ProjectPersist(String deploymentName, KieProject projectName, String mainClass, String groupID, String artifactID, String processID, String projectVersion, String containerID, List<String> serverNames, String status) {
|
||||
this.deploymentName = deploymentName;
|
||||
|
|
@ -72,6 +81,10 @@ public class ProjectPersist implements Serializable {
|
|||
this.status = status;
|
||||
}
|
||||
|
||||
public String getUuid() {
|
||||
return uuid;
|
||||
}
|
||||
|
||||
public String getDeploymentName() {
|
||||
return deploymentName;
|
||||
}
|
||||
|
|
@ -180,22 +193,60 @@ public class ProjectPersist implements Serializable {
|
|||
this.serverNames = serverNames;
|
||||
}
|
||||
|
||||
public String getWorkspaceName(){
|
||||
if (this.projectName!= null){
|
||||
public String getWorkspaceName() {
|
||||
if (this.projectName != null) {
|
||||
return projectName.getSpaceName();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
public String getKieProjectName(){
|
||||
if (this.projectName!= null){
|
||||
return projectName.getName()+"-"+this.branch;
|
||||
|
||||
public boolean isUseJWTToConnect() {
|
||||
return useJWTToConnect;
|
||||
}
|
||||
|
||||
public void setUseJWTToConnect(boolean useJWTToConnect) {
|
||||
this.useJWTToConnect = useJWTToConnect;
|
||||
}
|
||||
|
||||
public String getKieProjectName() {
|
||||
if (this.projectName != null) {
|
||||
return projectName.getName() + "-" + this.branch;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
public ProjectPersist duplicate(){
|
||||
|
||||
public boolean isDisableRuleLogging() {
|
||||
return disableRuleLogging;
|
||||
}
|
||||
|
||||
public void setDisableRuleLogging(boolean disableRuleLogging) {
|
||||
this.disableRuleLogging = disableRuleLogging;
|
||||
}
|
||||
|
||||
public boolean isEnableHotDeploy() {
|
||||
return enableHotDeploy;
|
||||
}
|
||||
|
||||
public void setEnableHotDeploy(boolean enableHotDeploy) {
|
||||
this.enableHotDeploy = enableHotDeploy;
|
||||
}
|
||||
|
||||
public String getJwtAPIToken() {
|
||||
return jwtAPIToken;
|
||||
}
|
||||
|
||||
public void setJwtAPIToken(String jwtAPIToken) {
|
||||
this.jwtAPIToken = jwtAPIToken;
|
||||
}
|
||||
|
||||
public ProjectPersist duplicate() {
|
||||
ArrayList<String> listServerNames = new ArrayList<String>();
|
||||
listServerNames.addAll(serverNames);
|
||||
ProjectPersist duplicate = new ProjectPersist(deploymentName,projectName,mainClass,groupID,artifactID,processID,projectVersion,containerID,listServerNames,status);
|
||||
ProjectPersist duplicate = new ProjectPersist(deploymentName, projectName, mainClass, groupID, artifactID, processID, projectVersion, containerID, listServerNames, status);
|
||||
duplicate.setEnableHotDeploy(enableHotDeploy);
|
||||
duplicate.setJwtAPIToken(jwtAPIToken);
|
||||
duplicate.setDisableRuleLogging(disableRuleLogging);
|
||||
duplicate.setUseJWTToConnect(useJWTToConnect);
|
||||
return duplicate;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@ public interface ContainerRepository extends MongoRepository<ContainerPojoPersis
|
|||
|
||||
List<ContainerPojoPersist> findByServerName(String serverName);
|
||||
|
||||
List<ContainerPojoPersist> findByProjectUUID(String projectUUID);
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,6 +14,9 @@ public interface ContainerRuntimeRepository extends MongoRepository<ContainerRun
|
|||
List<ContainerRuntimePojoPersist> findByServerNameAndStatus(String serverName, String status);
|
||||
List<ContainerRuntimePojoPersist> findByServerNameAndStatusAndHostname(String serverName, String status,String hostname);
|
||||
List<ContainerRuntimePojoPersist> findByServerNameAndHostname(String serverName, String hostname);
|
||||
List<ContainerRuntimePojoPersist> findByProjectUUID(String projectUUID);
|
||||
List<ContainerRuntimePojoPersist> findByContainerId(String continuerID);
|
||||
|
||||
ContainerRuntimePojoPersist findByServerNameAndContainerIdAndHostname(String serverName, String containerId,String hostname);
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@ public interface ProjectRepository extends MongoRepository<ProjectPersist, Strin
|
|||
public List<ProjectPersist> findByProjectName(KieProject projectName);
|
||||
public ProjectPersist findByProjectNameAndBranch(KieProject projectName,String branch);
|
||||
public ProjectPersist findByDeploymentName(String deploymentName);
|
||||
public ProjectPersist findByUuid(String UUID);
|
||||
public List<ProjectPersist> findByServerNamesIn(List<String> serverNames);
|
||||
public List<ProjectPersist> findByServerNamesInAndDeploymentName(List<String> serverNames,String deploymentName);
|
||||
public List<ProjectPersist> findByKieWorkbench(KieWorkbench kieWorkbench);
|
||||
|
|
|
|||
|
|
@ -72,6 +72,17 @@
|
|||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-configuration-processor</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.jsonwebtoken</groupId>
|
||||
<artifactId>jjwt</artifactId>
|
||||
<version>0.9.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.jsonwebtoken</groupId>
|
||||
<artifactId>jjwt</artifactId>
|
||||
<version>0.9.1</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
<!-- Spring-Boot and Camel BOM -->
|
||||
<dependencyManagement>
|
||||
|
|
|
|||
|
|
@ -5,12 +5,16 @@ import com.github.mkopylec.charon.configuration.MappingProperties;
|
|||
import com.github.mkopylec.charon.core.http.HttpClientProvider;
|
||||
import com.github.mkopylec.charon.core.mappings.MappingsCorrector;
|
||||
import com.github.mkopylec.charon.core.mappings.MappingsProvider;
|
||||
import io.jsonwebtoken.Claims;
|
||||
import org.chtijbug.drools.common.rest.Constants;
|
||||
import org.chtijbug.drools.reverseproxy.service.JwtService;
|
||||
import org.chtijbug.drools.reverseproxy.service.UpdateService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.autoconfigure.web.ServerProperties;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
|
@ -18,23 +22,40 @@ import java.util.Map;
|
|||
@Component
|
||||
public class CustomMappingsProvider extends MappingsProvider {
|
||||
|
||||
|
||||
@Autowired
|
||||
private UpdateService updateService;
|
||||
|
||||
@Autowired
|
||||
private JwtService jwtService;
|
||||
|
||||
private Map<String,MappingProperties> mappingPropertiesMap = new HashMap<>();
|
||||
|
||||
private Map<String, MappingProperties> mappingJWTPropertiesMap = new HashMap<>();
|
||||
|
||||
public CustomMappingsProvider(ServerProperties server, CharonProperties charon, MappingsCorrector mappingsCorrector, HttpClientProvider httpClientProvider) {
|
||||
super(server, charon, mappingsCorrector,httpClientProvider);
|
||||
}
|
||||
|
||||
@Override
|
||||
public MappingProperties resolveMapping(String originUri, HttpServletRequest request) {
|
||||
|
||||
MappingProperties result = mappingPropertiesMap.get(UpdateService.removeSlach(originUri));
|
||||
if (result!= null){
|
||||
return result;
|
||||
String token = request.getHeader(Constants.AUTHORISATION_HEADER);
|
||||
if (token!= null && token.length()>0){
|
||||
Claims claims = jwtService.decodeJWT(token);
|
||||
String uuid = (String)claims.get("uuid");
|
||||
MappingProperties result = mappingJWTPropertiesMap.get(uuid);
|
||||
if (result != null) {
|
||||
return result;
|
||||
} else {
|
||||
return super.resolveMapping(originUri, request);
|
||||
}
|
||||
}else {
|
||||
return super.resolveMapping(originUri, request);
|
||||
|
||||
MappingProperties result = mappingPropertiesMap.get(UpdateService.removeSlach(originUri));
|
||||
if (result != null) {
|
||||
return result;
|
||||
} else {
|
||||
return super.resolveMapping(originUri, request);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -45,10 +66,17 @@ public class CustomMappingsProvider extends MappingsProvider {
|
|||
|
||||
@Override
|
||||
protected List<MappingProperties> retrieveMappings() {
|
||||
return updateService.retrievePath();
|
||||
List<MappingProperties> paths= new ArrayList<>();
|
||||
paths.addAll(mappingPropertiesMap.values());
|
||||
paths.addAll(mappingJWTPropertiesMap.values());
|
||||
return paths;
|
||||
}
|
||||
|
||||
public void setMappingPropertiesMap(Map<String, MappingProperties> mappingPropertiesMap) {
|
||||
this.mappingPropertiesMap = mappingPropertiesMap;
|
||||
}
|
||||
|
||||
public void setMappingJWTPropertiesMap(Map<String, MappingProperties> mappingJWTPropertiesMap) {
|
||||
this.mappingJWTPropertiesMap = mappingJWTPropertiesMap;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,28 @@
|
|||
package org.chtijbug.drools.reverseproxy.service;
|
||||
|
||||
import io.jsonwebtoken.Claims;
|
||||
import io.jsonwebtoken.JwtBuilder;
|
||||
import io.jsonwebtoken.Jwts;
|
||||
import io.jsonwebtoken.SignatureAlgorithm;
|
||||
import org.chtijbug.drools.proxy.persistence.model.ProjectPersist;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.crypto.spec.SecretKeySpec;
|
||||
import javax.xml.bind.DatatypeConverter;
|
||||
import java.security.Key;
|
||||
import java.util.Date;
|
||||
|
||||
@Service
|
||||
public class JwtService {
|
||||
|
||||
@Value("${secretkey}")
|
||||
public String secretKey;
|
||||
|
||||
public Claims decodeJWT(String jwt) {
|
||||
return Jwts.parser()
|
||||
.setSigningKey(DatatypeConverter.parseBase64Binary(secretKey))
|
||||
.parseClaimsJws(jwt.replace("bearer","")).getBody();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -31,10 +31,10 @@ public class UpdateService {
|
|||
|
||||
private Boolean toUpdate = true;
|
||||
|
||||
private List<MappingProperties> mappings = new ArrayList<>();
|
||||
|
||||
|
||||
private Map<String, MappingProperties> mappingPropertiesMap = new HashMap<>();
|
||||
|
||||
private Map<String, MappingProperties> mappingJWTPropertiesMap = new HashMap<>();
|
||||
@Autowired
|
||||
private CustomMappingsProvider customMappingsProvider;
|
||||
|
||||
|
|
@ -48,42 +48,54 @@ public class UpdateService {
|
|||
containerFactory = "mappingKafkaListenerContainerFactory")
|
||||
public void store(ReverseProxyUpdate update) {
|
||||
boolean found = false;
|
||||
for (MappingProperties mappingProperties : mappingPropertiesMap.values()) {
|
||||
if (UpdateService.removeSlach(mappingProperties.getPath()).equals(UpdateService.removeSlach(update.getPath()))) {
|
||||
MappingProperties mappingProperties = null;
|
||||
if (update.getTokenUUID() != null && update.getTokenUUID().length() > 0) {
|
||||
mappingProperties = mappingJWTPropertiesMap.get(update.getTokenUUID());
|
||||
if (mappingProperties != null) {
|
||||
found = true;
|
||||
}
|
||||
} else {
|
||||
mappingProperties = mappingPropertiesMap.get(UpdateService.removeSlach(update.getPath()));
|
||||
if (mappingProperties != null) {
|
||||
found = true;
|
||||
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);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!found) {
|
||||
if (found) {
|
||||
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);
|
||||
}
|
||||
} else {
|
||||
MappingProperties newMappingProperties = new MappingProperties();
|
||||
newMappingProperties.setPath(UpdateService.removeSlach(update.getPath()));
|
||||
logger.info("Creating path {}",update.getPath());
|
||||
|
||||
if (update.getTokenUUID() != null && update.getTokenUUID().length() > 0) {
|
||||
mappingJWTPropertiesMap.put(update.getTokenUUID(), newMappingProperties);
|
||||
} else {
|
||||
newMappingProperties.setPath(UpdateService.removeSlach(update.getPath()));
|
||||
logger.info("Creating path {}", update.getPath());
|
||||
mappingPropertiesMap.put(UpdateService.removeSlach(update.getPath()), newMappingProperties);
|
||||
}
|
||||
newMappingProperties.setName(update.getContainerID());
|
||||
|
||||
newMappingProperties.getCustomConfiguration().put("connect", 2000);
|
||||
newMappingProperties.getCustomConfiguration().put("read", 2000);
|
||||
newMappingProperties.setStripPath(true);
|
||||
for (String destination : update.getServerNames()) {
|
||||
newMappingProperties.getDestinations().add(destination);
|
||||
logger.info("for path {} adding server {} ",update.getPath(),destination);
|
||||
logger.info("for path {} adding server {} ", update.getPath(), destination);
|
||||
}
|
||||
mappingPropertiesMap.put(UpdateService.removeSlach(update.getPath()), newMappingProperties);
|
||||
}
|
||||
mappings.clear();
|
||||
mappings.addAll(mappingPropertiesMap.values());
|
||||
|
||||
this.toUpdate = true;
|
||||
}
|
||||
|
||||
public List<MappingProperties> retrievePath() {
|
||||
this.toUpdate = false;
|
||||
return mappings;
|
||||
}
|
||||
|
||||
public static String removeSlach(String target){
|
||||
if (target!= null) {
|
||||
return target.replace("/", "").replace(" ","");
|
||||
|
||||
public static String removeSlach(String target) {
|
||||
if (target != null) {
|
||||
return target.replace("/", "").replace(" ", "");
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
|
@ -125,14 +137,24 @@ public class UpdateService {
|
|||
mappingProperties2.getCustomConfiguration().put("read", 2000);
|
||||
mappingProperties2.setStripPath(true);
|
||||
if (mappingProperties2.getDestinations().size() > 0) {
|
||||
mappingPropertiesMap.put(UpdateService.removeSlach(mappingProperties2.getPath()), mappingProperties2);
|
||||
paths.add(mappingProperties2);
|
||||
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());
|
||||
if (projectPersist.isUseJWTToConnect()) {
|
||||
mappingJWTPropertiesMap.put(projectPersist.getUuid(), mappingProperties2);
|
||||
paths.add(mappingProperties2);
|
||||
logger.info("Startup creating path / and for token uuid {}", projectPersist.getUuid());
|
||||
for (String serverName : mappingProperties2.getDestinations()) {
|
||||
logger.info("---------for uuid {} adding server {} ", projectPersist.getUuid(), serverName);
|
||||
}
|
||||
logger.info("---------Project " + projectPersist.getContainerID() + " defined on servers - " + mappingProperties2.getDestinations().toString());
|
||||
|
||||
} else {
|
||||
mappingPropertiesMap.put(UpdateService.removeSlach(mappingProperties2.getPath()), mappingProperties2);
|
||||
paths.add(mappingProperties2);
|
||||
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 {
|
||||
logger.error("Project " + projectPersist.getContainerID() + " defined on non existing server");
|
||||
}
|
||||
|
|
@ -141,9 +163,8 @@ public class UpdateService {
|
|||
}
|
||||
|
||||
}
|
||||
mappings.clear();
|
||||
mappings.addAll(paths);
|
||||
this.customMappingsProvider.setMappingPropertiesMap(mappingPropertiesMap);
|
||||
this.customMappingsProvider.setMappingJWTPropertiesMap(mappingJWTPropertiesMap);
|
||||
}
|
||||
|
||||
@PostConstruct
|
||||
|
|
|
|||
|
|
@ -11,4 +11,5 @@ pymma.kafka.sslTruststorePassword=${PYMMA_KAFKA_SSL_TRUSTSTORE_PASSWORD:}
|
|||
pymma.kafka.sslKeyPassword=${PYMMA_KAFKA_KEY_PASSWORD:}
|
||||
pymma.kafka.sslKeystorePassword=${PYMMA_KAFKA_SSL_KEYSTORE_PASSWORD:}
|
||||
pymma.kafka.sslKeystoreLocation=${PYMMA_KAFKA_SSL_KEYSTORE_LOCATION:}
|
||||
pymma.kafka.sslKeystoreType=${PYMMA_KAFKA_SSL_KEYSTORE_TYPE:}
|
||||
pymma.kafka.sslKeystoreType=${PYMMA_KAFKA_SSL_KEYSTORE_TYPE:}
|
||||
secretkey=eRaYY7Wo24sDqKSX3IM9ASGmdGPmkTd9jo1QTy4b7P9Ze5_9hKolVX8xNrQDcNRfVEdTZNOuOyqEGhXEbdJI-ZQ19k_o9MI0y3eZN2lp9jow55FfXMiINEdt1XR85VipRLSOkT6kSpzs2x-jbLDiz9iFVzkd81YKxMgPA7VfZeQUm4n-mOmnWMaVX30zGFU4L3oPBctYKkl4dYfqYWqRNfrgPJVi5DGFjywgxx0ASEiJHtV72paI3fDR2XwlSkyhhmY-ICjCRmsJN4fX1pdoL8a18-aQrvyu4j0Os6dVPYIoPvvY0SAZtWYKHfM15g7A3HD4cVREf9cUsprCRK93w
|
||||
|
|
|
|||
Loading…
Add table
editor.link_modal.header
Reference in a new issue