Work on Running in Swarm
Debug of reverse proxy
This commit is contained in:
parent
1b8ab0d36b
commit
62eef1370b
11 changed files with 265 additions and 119 deletions
|
|
@ -2,6 +2,7 @@ package org.chtijbug.drools.proxy;
|
|||
|
||||
import org.chtijbug.drools.proxy.persistence.model.ContainerPojoPersist;
|
||||
import org.chtijbug.drools.proxy.persistence.repository.ContainerRepository;
|
||||
import org.chtijbug.drools.proxy.persistence.repository.ContainerRuntimeRepository;
|
||||
import org.chtijbug.drools.proxy.service.KieServiceCommon;
|
||||
import org.kie.server.api.model.KieContainerResource;
|
||||
import org.kie.server.api.model.KieServerConfig;
|
||||
|
|
@ -9,24 +10,40 @@ import org.kie.server.api.model.ReleaseId;
|
|||
import org.kie.server.services.impl.storage.KieServerState;
|
||||
import org.kie.server.services.impl.storage.KieServerStateRepository;
|
||||
import org.kie.server.services.impl.storage.KieServerStateRepositoryUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.net.InetAddress;
|
||||
import java.net.UnknownHostException;
|
||||
import java.util.List;
|
||||
|
||||
public class PlatfomKieServerStateRepository implements KieServerStateRepository {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(PlatfomKieServerStateRepository.class);
|
||||
|
||||
private ContainerRepository containerRepository;
|
||||
|
||||
private ContainerRuntimeRepository containerRuntimeRepository;
|
||||
|
||||
private KieServiceCommon kieServiceCommon;
|
||||
|
||||
private KieServerState kieServerState = new KieServerState();
|
||||
|
||||
public PlatfomKieServerStateRepository(ContainerRepository containerRepository, KieServiceCommon kieServiceCommon) {
|
||||
private String hostName;
|
||||
|
||||
public PlatfomKieServerStateRepository(ContainerRepository containerRepository, ContainerRuntimeRepository containerRuntimeRepository,KieServiceCommon kieServiceCommon) {
|
||||
this.containerRepository = containerRepository;
|
||||
this.containerRuntimeRepository=containerRuntimeRepository;
|
||||
this.kieServiceCommon = kieServiceCommon;
|
||||
KieServerConfig config = new KieServerConfig();
|
||||
KieServerStateRepositoryUtils.populateWithSystemProperties(config);
|
||||
kieServerState.setConfiguration(config);
|
||||
try {
|
||||
InetAddress inetAddress = InetAddress.getLocalHost();
|
||||
hostName = inetAddress.getHostName();
|
||||
} catch (UnknownHostException e) {
|
||||
logger.info("initCamelBusinessRoutes.getLocalHost", e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -39,7 +56,7 @@ public class PlatfomKieServerStateRepository implements KieServerStateRepository
|
|||
|
||||
String serverName = KieServiceCommon.getKieServerID();
|
||||
|
||||
List<ContainerPojoPersist> containers = containerRepository.findByServerNameAndStatus(serverName, ContainerPojoPersist.STATUS.UP.toString());
|
||||
List<ContainerPojoPersist> containers = containerRepository.findByServerName(serverName);
|
||||
for (ContainerPojoPersist element : containers) {
|
||||
KieContainerResource newContainer = new KieContainerResource();
|
||||
newContainer.setContainerId(element.getContainerId());
|
||||
|
|
@ -47,7 +64,8 @@ public class PlatfomKieServerStateRepository implements KieServerStateRepository
|
|||
newContainer.getReleaseId().setArtifactId(element.getArtifactId());
|
||||
newContainer.getReleaseId().setGroupId(element.getGroupId());
|
||||
newContainer.getReleaseId().setVersion(element.getVersion());
|
||||
kieServerState.getContainers().add(newContainer);
|
||||
kieServerState.getContainers().add(newContainer);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -21,8 +21,10 @@ import org.apache.camel.Route;
|
|||
import org.chtijbug.drools.proxy.PlatfomKieServerStateRepository;
|
||||
import org.chtijbug.drools.proxy.camel.DroolsRouter;
|
||||
import org.chtijbug.drools.proxy.persistence.model.ContainerPojoPersist;
|
||||
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.RuntimeRepository;
|
||||
import org.chtijbug.kieserver.services.drools.DroolsChtijbugKieServerExtension;
|
||||
import org.chtijbug.kieserver.services.drools.DroolsChtijbugRulesExecutionService;
|
||||
|
|
@ -64,14 +66,13 @@ public class KieServiceCommon {
|
|||
private ContainerRepository containerRepository;
|
||||
@Inject
|
||||
private RuntimeRepository runtimeRepository;
|
||||
@Inject
|
||||
private ContainerRuntimeRepository containerRuntimeRepository;
|
||||
@Value("${server.port}")
|
||||
private int serverPort;
|
||||
|
||||
@Autowired
|
||||
private ApplicationContext appContext;
|
||||
|
||||
private String hostName= "localhost";
|
||||
|
||||
private String hostName = "localhost";
|
||||
private Map<String, DroolsRouter> routes = new HashMap<>();
|
||||
|
||||
public KieServiceCommon() {
|
||||
|
|
@ -86,7 +87,7 @@ public class KieServiceCommon {
|
|||
@PostConstruct
|
||||
private void initCamelBusinessRoutes() {
|
||||
|
||||
this.server = new KieServerImpl(new PlatfomKieServerStateRepository(containerRepository, this));
|
||||
this.server = new KieServerImpl(new PlatfomKieServerStateRepository(containerRepository, containerRuntimeRepository, this));
|
||||
this.server.init();
|
||||
|
||||
List<KieServerExtension> serverExtensions = this.server.getServerExtensions();
|
||||
|
|
@ -115,53 +116,40 @@ public class KieServiceCommon {
|
|||
} catch (UnknownHostException e) {
|
||||
logger.info("initCamelBusinessRoutes.getLocalHost", e);
|
||||
}
|
||||
List<RuntimePersist> itIsMes = runtimeRepository.findByServerName(serverName);
|
||||
List<RuntimePersist> itIsMes = runtimeRepository.findByServerNameAndHostname(serverName, hostName);
|
||||
ServiceResponse<KieServerInfo> result = server.getInfo();
|
||||
String version = result.getResult().getVersion();
|
||||
String isSwarm=System.getProperty("org.kie.server.swarm");
|
||||
if (itIsMes.size() == 0) {
|
||||
|
||||
RuntimePersist runtimePersist = new RuntimePersist(serverName, version, hostName ,
|
||||
RuntimePersist runtimePersist = new RuntimePersist(serverName, version, hostName,
|
||||
String.valueOf(serverPort), sftpPort,
|
||||
hostName, RuntimePersist.STATUS.UP.toString());
|
||||
String isSwarm = System.getProperty("org.kie.server.swarm");
|
||||
if ("1".equals(isSwarm)) {
|
||||
runtimePersist.setServerUrl("http://" + serverName + ":" + serverPort);
|
||||
}else {
|
||||
} else {
|
||||
runtimePersist.setServerUrl("http://" + hostName + ":" + serverPort);
|
||||
}
|
||||
runtimeRepository.save(runtimePersist);
|
||||
} else {
|
||||
List<RuntimePersist> byServerNameAndHostname = runtimeRepository.findByServerNameAndHostname(serverName, hostName);
|
||||
if (byServerNameAndHostname.size() == 0) {
|
||||
RuntimePersist runtimePersist = new RuntimePersist(serverName, version, hostName ,
|
||||
String.valueOf(serverPort), sftpPort,
|
||||
hostName, RuntimePersist.STATUS.UP.toString());
|
||||
if ("1".equals(isSwarm)) {
|
||||
runtimePersist.setServerUrl("http://" + serverName + ":" + serverPort);
|
||||
}else {
|
||||
runtimePersist.setServerUrl("http://" + hostName + ":" + serverPort);
|
||||
}
|
||||
runtimePersist.setSftpHost(hostName);
|
||||
runtimePersist.setSftpPort(sftpPort);
|
||||
|
||||
runtimeRepository.save(runtimePersist);
|
||||
}else{
|
||||
RuntimePersist runtimePersist =byServerNameAndHostname.get(0);
|
||||
runtimePersist.setStatus(RuntimePersist.STATUS.UP.toString());
|
||||
runtimeRepository.save(runtimePersist);
|
||||
}
|
||||
RuntimePersist runtimePersist = itIsMes.get(0);
|
||||
runtimePersist.setStatus(RuntimePersist.STATUS.UP.toString());
|
||||
runtimeRepository.save(runtimePersist);
|
||||
}
|
||||
try {
|
||||
|
||||
for (KieContainerResource kieContainerResource : this.server.getServerState().getResult().getContainers()) {
|
||||
|
||||
|
||||
// this.createContainer(container.getContainerId(),)
|
||||
|
||||
this.createContainer(kieContainerResource.getContainerId(), kieContainerResource);
|
||||
List<ContainerPojoPersist> containers = containerRepository.findByContainerId(kieContainerResource.getContainerId());
|
||||
if (containers.size() == 1) {
|
||||
this.initCamelBusinessRoute(containers.get(0));
|
||||
ContainerPojoPersist container = containerRepository.findByServerNameAndContainerId(serverName, kieContainerResource.getContainerId());
|
||||
if (container != null) {
|
||||
ContainerRuntimePojoPersist containerRuntimePojoPersist = containerRuntimeRepository.findByServerNameAndContainerIdAndHostname(serverName, kieContainerResource.getContainerId(), hostName);
|
||||
if (containerRuntimePojoPersist == null) {
|
||||
containerRuntimePojoPersist = new ContainerRuntimePojoPersist();
|
||||
containerRuntimePojoPersist.setContainerId(container.getContainerId());
|
||||
containerRuntimePojoPersist.setServerName(serverName);
|
||||
containerRuntimePojoPersist.setHostname(hostName);
|
||||
containerRuntimePojoPersist.setStatus(ContainerRuntimePojoPersist.STATUS.UP.name());
|
||||
containerRuntimeRepository.save(containerRuntimePojoPersist);
|
||||
}
|
||||
this.initCamelBusinessRoute(container);
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
|
|
@ -170,19 +158,23 @@ public class KieServiceCommon {
|
|||
Runtime.getRuntime().addShutdownHook(new Thread() {
|
||||
public void run() {
|
||||
String serverName = KieServiceCommon.getKieServerID();
|
||||
List<RuntimePersist> itIsMes = runtimeRepository.findByServerNameAndHostname(serverName,hostName);
|
||||
List<RuntimePersist> itIsMes = runtimeRepository.findByServerNameAndHostname(serverName, hostName);
|
||||
if (itIsMes.size() == 1) {
|
||||
RuntimePersist runtimePersist = itIsMes.get(0);
|
||||
runtimePersist.setStatus(RuntimePersist.STATUS.DOWN.toString());
|
||||
runtimeRepository.delete(runtimePersist);
|
||||
}
|
||||
}});
|
||||
List<ContainerRuntimePojoPersist> ccc = containerRuntimeRepository.findByServerNameAndHostname(serverName, hostName);
|
||||
if (ccc.size() > 0) {
|
||||
containerRuntimeRepository.deleteAll(ccc);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
public void setTimeStamp(){
|
||||
public void setTimeStamp() {
|
||||
String serverName = KieServiceCommon.getKieServerID();
|
||||
List<RuntimePersist> itIsMes = runtimeRepository.findByServerNameAndHostname(serverName,hostName);
|
||||
List<RuntimePersist> itIsMes = runtimeRepository.findByServerNameAndHostname(serverName, hostName);
|
||||
if (itIsMes.size() == 1) {
|
||||
RuntimePersist runtimePersist = itIsMes.get(0);
|
||||
runtimePersist.setTimeStamp(new Date());
|
||||
|
|
@ -272,28 +264,42 @@ public class KieServiceCommon {
|
|||
|
||||
public void updateConfig() throws Exception {
|
||||
String serverName = KieServiceCommon.getKieServerID();
|
||||
List<ContainerPojoPersist> containers = containerRepository.findByServerNameAndStatus(serverName, ContainerPojoPersist.STATUS.TODEPLOY.toString());
|
||||
for (ContainerPojoPersist element : containers) {
|
||||
this.disposeContainer(element.getContainerId());
|
||||
KieContainerResource newContainer = new KieContainerResource();
|
||||
newContainer.setContainerId(element.getContainerId());
|
||||
newContainer.setReleaseId(new ReleaseId());
|
||||
newContainer.getReleaseId().setArtifactId(element.getArtifactId());
|
||||
newContainer.getReleaseId().setGroupId(element.getGroupId());
|
||||
newContainer.getReleaseId().setVersion(element.getVersion());
|
||||
this.createContainer(element.getContainerId(), newContainer);
|
||||
this.initCamelBusinessRoute(element);
|
||||
element.setStatus(ContainerPojoPersist.STATUS.UP.toString());
|
||||
containerRepository.save(element);
|
||||
String isSwarm = System.getProperty("org.kie.server.swarm");
|
||||
List<ContainerRuntimePojoPersist> containers = null;
|
||||
|
||||
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();
|
||||
newContainer.setContainerId(element.getContainerId());
|
||||
newContainer.setReleaseId(new ReleaseId());
|
||||
newContainer.getReleaseId().setArtifactId(containerIds.getArtifactId());
|
||||
newContainer.getReleaseId().setGroupId(containerIds.getGroupId());
|
||||
newContainer.getReleaseId().setVersion(containerIds.getVersion());
|
||||
this.createContainer(element.getContainerId(), newContainer);
|
||||
this.initCamelBusinessRoute(containerIds);
|
||||
element.setStatus(ContainerRuntimePojoPersist.STATUS.UP.toString());
|
||||
containerRuntimeRepository.save(element);
|
||||
}
|
||||
|
||||
}
|
||||
List<ContainerPojoPersist> containersToDelete = containerRepository.findByServerNameAndStatus(serverName, ContainerPojoPersist.STATUS.TODELETE.toString());
|
||||
for (ContainerPojoPersist element : containersToDelete) {
|
||||
this.disposeContainer(element.getContainerId());
|
||||
this.deleteCamelBusinessRoute(element.getContainerId());
|
||||
containerRepository.delete(element);
|
||||
containers = containerRuntimeRepository.findByServerNameAndStatusAndHostname(serverName, ContainerRuntimePojoPersist.STATUS.TODELETE.toString(), hostName);
|
||||
|
||||
for (ContainerRuntimePojoPersist element : containers) {
|
||||
ContainerPojoPersist containerIds = containerRepository.findByServerNameAndContainerId(serverName, element.getContainerId());
|
||||
if (containerIds != null) {
|
||||
this.disposeContainer(element.getContainerId());
|
||||
this.deleteCamelBusinessRoute(element.getContainerId());
|
||||
containerRepository.delete(containerIds);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
public KieContainerResource createContainerWithRestBusinessService(String id, KieContainerResource container, String className, String processID) {
|
||||
|
||||
|
||||
|
|
@ -387,9 +393,9 @@ public class KieServiceCommon {
|
|||
public ServiceResponse<Void> disposeContainer(String id) {
|
||||
ServiceResponse<Void> result = server.disposeContainer(id);
|
||||
String serverName = KieServiceCommon.getKieServerID();
|
||||
ContainerPojoPersist element = containerRepository.findByServerNameAndContainerId(serverName, id);
|
||||
ContainerRuntimePojoPersist element = containerRuntimeRepository.findByServerNameAndContainerIdAndHostname(serverName, id, hostName);
|
||||
if (element != null) {
|
||||
containerRepository.delete(element);
|
||||
containerRuntimeRepository.delete(element);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,7 +11,9 @@ import org.springframework.boot.autoconfigure.web.ServerProperties;
|
|||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Component
|
||||
public class CustomMappingsProvider extends MappingsProvider {
|
||||
|
|
@ -19,13 +21,22 @@ public class CustomMappingsProvider extends MappingsProvider {
|
|||
|
||||
@Autowired
|
||||
private UpdateService updateService;
|
||||
|
||||
private Map<String,MappingProperties> mappingPropertiesMap = 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(originUri);
|
||||
if (result!= null){
|
||||
return result;
|
||||
}else {
|
||||
return super.resolveMapping(originUri, request);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean shouldUpdateMappings(HttpServletRequest httpServletRequest) {
|
||||
|
|
@ -36,4 +47,8 @@ public class CustomMappingsProvider extends MappingsProvider {
|
|||
protected List<MappingProperties> retrieveMappings() {
|
||||
return updateService.retrievePath();
|
||||
}
|
||||
|
||||
public void setMappingPropertiesMap(Map<String, MappingProperties> mappingPropertiesMap) {
|
||||
this.mappingPropertiesMap = mappingPropertiesMap;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ import org.chtijbug.drools.proxy.persistence.model.ProjectPersist;
|
|||
import org.chtijbug.drools.proxy.persistence.model.RuntimePersist;
|
||||
import org.chtijbug.drools.proxy.persistence.repository.ProjectRepository;
|
||||
import org.chtijbug.drools.proxy.persistence.repository.RuntimeRepository;
|
||||
import org.chtijbug.drools.reverseproxy.mappings.CustomMappingsProvider;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
|
@ -25,10 +26,14 @@ public class UpdateService {
|
|||
private Map<String, RuntimePersist> runtimes = new HashMap<>();
|
||||
private Map<String, ProjectPersist> projects = new HashMap<>();
|
||||
|
||||
private Boolean toUpdate = false;
|
||||
private Boolean toUpdate = true;
|
||||
|
||||
private List<MappingProperties> mappings=new ArrayList<>();
|
||||
|
||||
private Map<String,MappingProperties> mappingPropertiesMap = new HashMap<>();
|
||||
@Autowired
|
||||
private CustomMappingsProvider customMappingsProvider;
|
||||
|
||||
public Boolean getToUpdate() {
|
||||
return toUpdate;
|
||||
}
|
||||
|
|
@ -97,6 +102,7 @@ public class UpdateService {
|
|||
}
|
||||
private void generateMappings(){
|
||||
projects.clear();
|
||||
mappingPropertiesMap.clear();
|
||||
List<MappingProperties> paths = new ArrayList<>();
|
||||
Collection<ProjectPersist> projectPersists = projectRepository.findAll();
|
||||
Map<String, String> urlMap = new HashMap<>();
|
||||
|
|
@ -131,6 +137,7 @@ public class UpdateService {
|
|||
mappingProperties2.getCustomConfiguration().put("read", 2000);
|
||||
mappingProperties2.setStripPath(true);
|
||||
if ( mappingProperties2.getDestinations().size()>0) {
|
||||
mappingPropertiesMap.put(mappingProperties2.getPath(),mappingProperties2);
|
||||
paths.add(mappingProperties2);
|
||||
logger.info("Project "+projectPersist.getContainerID()+" defined on servers - "+mappingProperties2.getDestinations().toString());
|
||||
|
||||
|
|
@ -144,6 +151,7 @@ public class UpdateService {
|
|||
}
|
||||
mappings.clear();
|
||||
mappings.addAll(paths);
|
||||
this.customMappingsProvider.setMappingPropertiesMap(mappingPropertiesMap);
|
||||
}
|
||||
|
||||
@PostConstruct
|
||||
|
|
|
|||
|
|
@ -6,12 +6,7 @@ import org.springframework.data.mongodb.core.mapping.Document;
|
|||
|
||||
@Document
|
||||
public class ContainerPojoPersist {
|
||||
public enum STATUS {
|
||||
UP,
|
||||
DOWN,
|
||||
TODEPLOY,
|
||||
TODELETE
|
||||
}
|
||||
|
||||
@Id
|
||||
private String id;
|
||||
|
||||
|
|
@ -27,7 +22,7 @@ public class ContainerPojoPersist {
|
|||
|
||||
private String projectName;
|
||||
|
||||
private String status;
|
||||
|
||||
|
||||
private String groupId;
|
||||
|
||||
|
|
@ -35,6 +30,7 @@ public class ContainerPojoPersist {
|
|||
|
||||
private String version;
|
||||
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
|
@ -83,13 +79,7 @@ public class ContainerPojoPersist {
|
|||
this.processID = processID;
|
||||
}
|
||||
|
||||
public String getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public void setStatus(String status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
public String getGroupId() {
|
||||
return groupId;
|
||||
|
|
@ -115,6 +105,7 @@ public class ContainerPojoPersist {
|
|||
this.version = version;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
final StringBuffer sb = new StringBuffer("ContainerPojoPersist{");
|
||||
|
|
@ -124,7 +115,6 @@ public class ContainerPojoPersist {
|
|||
sb.append(", serverName='").append(serverName).append('\'');
|
||||
sb.append(", processID='").append(processID).append('\'');
|
||||
sb.append(", projectName='").append(projectName).append('\'');
|
||||
sb.append(", status=").append(status);
|
||||
sb.append(", groupId='").append(groupId).append('\'');
|
||||
sb.append(", artifactId='").append(artifactId).append('\'');
|
||||
sb.append(", version='").append(version).append('\'');
|
||||
|
|
|
|||
|
|
@ -0,0 +1,80 @@
|
|||
package org.chtijbug.drools.proxy.persistence.model;
|
||||
|
||||
import org.springframework.data.annotation.Id;
|
||||
import org.springframework.data.mongodb.core.index.Indexed;
|
||||
import org.springframework.data.mongodb.core.mapping.Document;
|
||||
|
||||
@Document
|
||||
public class ContainerRuntimePojoPersist {
|
||||
public enum STATUS {
|
||||
UP,
|
||||
DOWN,
|
||||
TODEPLOY,
|
||||
TODELETE
|
||||
}
|
||||
@Id
|
||||
private String id;
|
||||
|
||||
@Indexed
|
||||
private String containerId;
|
||||
@Indexed
|
||||
private String serverName;
|
||||
@Indexed
|
||||
private String hostname;
|
||||
|
||||
private String status;
|
||||
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
|
||||
public String getContainerId() {
|
||||
return containerId;
|
||||
}
|
||||
|
||||
public void setContainerId(String containerId) {
|
||||
this.containerId = containerId;
|
||||
}
|
||||
|
||||
public String getServerName() {
|
||||
return serverName;
|
||||
}
|
||||
|
||||
public void setServerName(String serverName) {
|
||||
this.serverName = serverName;
|
||||
}
|
||||
|
||||
public String getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public void setStatus(String status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
public String getHostname() {
|
||||
return hostname;
|
||||
}
|
||||
|
||||
public void setHostname(String hostname) {
|
||||
this.hostname = hostname;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
final StringBuffer sb = new StringBuffer("ContainerRuntimePojoPersist{");
|
||||
sb.append("id='").append(id).append('\'');
|
||||
sb.append(", containerId='").append(containerId).append('\'');
|
||||
sb.append(", serverName='").append(serverName).append('\'');
|
||||
sb.append(", hostname='").append(hostname).append('\'');
|
||||
sb.append(", status='").append(status).append('\'');
|
||||
sb.append('}');
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
||||
|
|
@ -15,7 +15,6 @@ public interface ContainerRepository extends MongoRepository<ContainerPojoPersis
|
|||
List<ContainerPojoPersist> findByContainerId(String containerId);
|
||||
|
||||
List<ContainerPojoPersist> findByServerName(String serverName);
|
||||
List<ContainerPojoPersist> findByServerNameAndStatus(String serverName, String status);
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,21 @@
|
|||
package org.chtijbug.drools.proxy.persistence.repository;
|
||||
|
||||
import org.chtijbug.drools.proxy.persistence.model.ContainerRuntimePojoPersist;
|
||||
import org.springframework.data.mongodb.repository.MongoRepository;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Repository
|
||||
public interface ContainerRuntimeRepository extends MongoRepository<ContainerRuntimePojoPersist, String> {
|
||||
|
||||
|
||||
List<ContainerRuntimePojoPersist> findByServerNameAndContainerId(String serverName, String containerId);
|
||||
List<ContainerRuntimePojoPersist> findByServerNameAndStatus(String serverName, String status);
|
||||
List<ContainerRuntimePojoPersist> findByServerNameAndStatusAndHostname(String serverName, String status,String hostname);
|
||||
List<ContainerRuntimePojoPersist> findByServerNameAndHostname(String serverName, String hostname);
|
||||
ContainerRuntimePojoPersist findByServerNameAndContainerIdAndHostname(String serverName, String containerId,String hostname);
|
||||
|
||||
|
||||
|
||||
}
|
||||
Loading…
Add table
editor.link_modal.header
Reference in a new issue