@Override public Response createContainer(HttpHeaders headers, String id, KieContainerResource container) { ServiceResponse<KieContainerResource> response = server.createContainer(id, container); if( response.getType() == ServiceResponse.ResponseType.SUCCESS ) { return createCorrectVariant(response, headers, Status.CREATED); } return createCorrectVariant(response, headers, Status.BAD_REQUEST); }
public ServiceResponsesList executeScript(CommandScript commands) { List<ServiceResponse<? extends Object>> responses = new ArrayList<ServiceResponse<? extends Object>>(); if( commands != null ) { for (KieServerCommand command : commands.getCommands()) { if (command instanceof CreateContainerCommand) { responses.add(createContainer(((CreateContainerCommand) command).getContainer().getContainerId(), ((CreateContainerCommand) command).getContainer())); } else if (command instanceof GetServerInfoCommand) { responses.add(getInfo()); } else if (command instanceof ListContainersCommand) { responses.add(listContainers()); } else if (command instanceof CallContainerCommand) { responses.add(callContainer(((CallContainerCommand) command).getContainerId(), ((CallContainerCommand) command).getPayload())); } else if (command instanceof DisposeContainerCommand) { responses.add(disposeContainer(((DisposeContainerCommand) command).getContainerId())); } else if (command instanceof GetContainerInfoCommand ) { responses.add(getContainerInfo(((GetContainerInfoCommand) command).getContainerId())); } else if (command instanceof GetScannerInfoCommand ) { responses.add(getScannerInfo(((GetScannerInfoCommand) command).getContainerId())); } else if (command instanceof UpdateScannerCommand ) { responses.add(updateScanner(((UpdateScannerCommand) command).getContainerId(), ((UpdateScannerCommand) command).getScanner())); } else if (command instanceof UpdateReleaseIdCommand ) { responses.add(updateContainerReleaseId(((UpdateReleaseIdCommand) command).getContainerId(), ((UpdateReleaseIdCommand) command).getReleaseId())); } } } return new ServiceResponsesList(responses); }
responses.add(this.kieServer.createContainer(((CreateContainerCommand) command).getContainer().getContainerId(), ((CreateContainerCommand) command).getContainer())); } else if (command instanceof GetServerInfoCommand) { responses.add(this.kieServer.getInfo());
public void installContainersSync(KieServerImpl kieServer, Set<KieContainerResource> containers, KieServerState currentState, KieServerSetup kieServerSetup) { logger.info("About to install containers '{}' on kie server '{}'", containers, kieServer); if (containers == null) { kieServer.markAsReady(); return; } for (KieContainerResource containerResource : containers) { if (KieContainerStatus.STARTED.equals(containerResource.getStatus())) { kieServer.createContainer(containerResource.getContainerId(), containerResource); } else if (KieContainerStatus.DEACTIVATED.equals(containerResource.getStatus())) { kieServer.createContainer(containerResource.getContainerId(), containerResource); kieServer.deactivateContainer(containerResource.getContainerId()); containerResource.setStatus(KieContainerStatus.DEACTIVATED); } } currentState.setContainers(containers); if (kieServerSetup.getServerConfig() != null) { currentState.setConfiguration(kieServerSetup.getServerConfig()); } kieServer.getServerRegistry().getStateRepository().store(KieServerEnvironment.getServerId(), currentState); kieServer.markAsReady(); } }