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);
}