@Override public ServiceResponse<ReleaseId> updateReleaseId(String id, ReleaseId releaseId) { if( config.isRest() ) { return makeHttpPostRequestAndCreateServiceResponse( baseURI + "/containers/" + id + "/release-id", releaseId, ReleaseId.class ); } else { CommandScript script = new CommandScript( Collections.singletonList( (KieServerCommand) new UpdateReleaseIdCommand( id, releaseId ) ) ); return (ServiceResponse<ReleaseId>) executeJmsCommand( script ).getResponses().get( 0 ); } }
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); }
continue; responses.add(this.kieServer.updateContainerReleaseId(((UpdateReleaseIdCommand) command).getContainerId(), ((UpdateReleaseIdCommand) command).getReleaseId())); } else if (command instanceof GetServerStateCommand) { responses.add(this.kieServer.getServerState());
@Override public ServiceResponse<ReleaseId> updateReleaseId(String id, ReleaseId releaseId) { CommandScript script = new CommandScript(Collections.singletonList((KieServerCommand) new UpdateReleaseIdCommand(id, releaseId))); ServiceResponse<ReleaseId> response = (ServiceResponse<ReleaseId>) sendCommandToAllSessions(script, new WebSocketServiceResponse(true, (message) -> { ServiceResponsesList list = WebSocketUtils.unmarshal(message, ServiceResponsesList.class); return list.getResponses().get(0); })).getResponses().get(0); return response; }
@Override public ServiceResponse<ReleaseId> updateReleaseId(String id, ReleaseId releaseId) { if (config.isRest()) { return makeHttpPostRequestAndCreateServiceResponse( loadBalancer.getUrl() + "/containers/" + id + "/release-id", releaseId, ReleaseId.class ); } else { CommandScript script = new CommandScript(Collections.singletonList((KieServerCommand) new UpdateReleaseIdCommand(id, releaseId))); ServiceResponse<ReleaseId> response = (ServiceResponse<ReleaseId>) executeJmsCommand(script, null, null, id).getResponses().get(0); return getResponseOrNullIfNoResponse(response); } }