@ApiOperation(value = "Stops a specified KIE container in a specified KIE Server template") @ApiResponses(value = { @ApiResponse(code = 200, message = "KIE container successfully stopped"), @ApiResponse(code = 404, message = "KIE container or KIE Server template not found"), @ApiResponse(code = 400, message = "Controller exception"), @ApiResponse(code = 500, message = "Unexpected error") }) @POST @Path("servers/{serverTemplateId}/containers/{containerId}/status/stopped") @Consumes({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) public Response stopContainer(@Context HttpHeaders headers, @ApiParam(name = "serverTemplateId", value = "ID of the KIE Server template associated with the KIE container", required = true, example = "test-kie-server") @PathParam("serverTemplateId") String serverTemplateId, @ApiParam(name = "containerId", value = "ID of the KIE container to be stopped", required = true, example = "evaluation_1.0.0-SNAPSHOT") @PathParam("containerId") String containerId) { logger.debug("Requesting stop container with id {} server instance: {}", containerId, serverTemplateId); try { ContainerSpecKey containerSpecKey = new ContainerSpecKey(); containerSpecKey.setId(containerId); containerSpecKey.setServerTemplateKey(new ServerTemplateKey(serverTemplateId, "")); specManagementService.stopContainer(containerSpecKey); logger.debug("Returning response for stop container with id {} server instance: {}", containerId, serverTemplateId); return createCorrectVariant("", headers, Response.Status.OK); } catch (KieServerControllerIllegalArgumentException e) { return createCorrectVariant(e.getMessage(), headers, Response.Status.NOT_FOUND); } catch (Exception e) { logger.error("Stop container failed due to {}", e.getMessage(), e); return createCorrectVariant("Unknown error " + e.getMessage(), headers, Response.Status.INTERNAL_SERVER_ERROR); } }
@ApiOperation(value = "Starts a specified KIE container in a specified KIE Server template") @ApiResponses(value = { @ApiResponse(code = 200, message = "KIE Container successfully started"), @ApiResponse(code = 404, message = "KIE container or KIE Server template not found"), @ApiResponse(code = 400, message = "Controller exception"), @ApiResponse(code = 500, message = "Unexpected error") }) @POST @Path("servers/{serverTemplateId}/containers/{containerId}/status/started") @Consumes({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) public Response startContainer(@Context HttpHeaders headers, @ApiParam(name = "serverTemplateId", value = "ID of the KIE Server template associated with the KIE container", required = true, example = "test-kie-server") @PathParam("serverTemplateId") String serverTemplateId, @ApiParam(name = "containerId", value = "ID of the KIE container to be started", required = true, example = "evaluation_1.0.0-SNAPSHOT") @PathParam("containerId") String containerId) { logger.debug("Requesting start container with id {} server instance: {}", containerId, serverTemplateId); try { ContainerSpecKey containerSpecKey = new ContainerSpecKey(); containerSpecKey.setId(containerId); containerSpecKey.setServerTemplateKey(new ServerTemplateKey(serverTemplateId, "")); specManagementService.startContainer(containerSpecKey); logger.debug("Returning response for start container with id {} server instance: {}", containerId, serverTemplateId); return createCorrectVariant("", headers, Response.Status.OK); } catch (KieServerControllerIllegalArgumentException e) { return createCorrectVariant(e.getMessage(), headers, Response.Status.NOT_FOUND); } catch (Exception e) { logger.error("Start container failed due to {}", e.getMessage(), e); return createCorrectVariant("Unknown error " + e.getMessage(), headers, Response.Status.INTERNAL_SERVER_ERROR); } }
@ApiOperation(value = "Activates a specified KIE container in a specified KIE Server template") @ApiResponses(value = { @ApiResponse(code = 200, message = "KIE container successfully activated"), @ApiResponse(code = 404, message = "KIE container or KIE Server template not found"), @ApiResponse(code = 400, message = "Controller exception"), @ApiResponse(code = 500, message = "Unexpected error") }) @POST @Path("servers/{serverTemplateId}/containers/{containerId}/status/activated") @Consumes({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) public Response activateContainer(@Context HttpHeaders headers, @ApiParam(name = "serverTemplateId", value = "ID of the KIE Server template associated with the KIE container", required = true, example = "test-kie-server") @PathParam("serverTemplateId") String serverTemplateId, @ApiParam(name = "containerId", value = "ID of the KIE container to be activated", required = true, example = "evaluation_1.0.0-SNAPSHOT") @PathParam("containerId") String containerId) { logger.debug("Requesting activate container with id {} server instance: {}", containerId, serverTemplateId); try { ContainerSpecKey containerSpecKey = new ContainerSpecKey(); containerSpecKey.setId(containerId); containerSpecKey.setServerTemplateKey(new ServerTemplateKey(serverTemplateId, "")); specManagementService.activateContainer(containerSpecKey); logger.debug("Returning response for activate container with id {} server instance: {}", containerId, serverTemplateId); return createCorrectVariant("", headers, Response.Status.OK); } catch (KieServerControllerIllegalArgumentException e) { return createCorrectVariant(e.getMessage(), headers, Response.Status.NOT_FOUND); } catch (Exception e) { logger.error("Stop container failed due to {}", e.getMessage(), e); return createCorrectVariant("Unknown error " + e.getMessage(), headers, Response.Status.INTERNAL_SERVER_ERROR); } }
@ApiOperation(value = "Deactivates a specified KIE container in a specified KIE Server template") @ApiResponses(value = { @ApiResponse(code = 200, message = "KIE container successfully deactivated"), @ApiResponse(code = 404, message = "KIE container or KIE Server template not found"), @ApiResponse(code = 400, message = "Controller exception"), @ApiResponse(code = 500, message = "Unexpected error") }) @POST @Path("servers/{serverTemplateId}/containers/{containerId}/status/deactivated") @Consumes({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) public Response deactivateContainer(@Context HttpHeaders headers, @ApiParam(name = "serverTemplateId", value = "ID of the KIE Server template associated with the KIE container", required = true, example = "test-kie-server") @PathParam("serverTemplateId") String serverTemplateId, @ApiParam(name = "containerId", value = "ID of the KIE container to be deactivated", required = true, example = "evaluation_1.0.0-SNAPSHOT") @PathParam("containerId") String containerId) { logger.debug("Requesting deactivate container with id {} server instance: {}", containerId, serverTemplateId); try { ContainerSpecKey containerSpecKey = new ContainerSpecKey(); containerSpecKey.setId(containerId); containerSpecKey.setServerTemplateKey(new ServerTemplateKey(serverTemplateId, "")); specManagementService.deactivateContainer(containerSpecKey); logger.debug("Returning response for deactivate container with id {} server instance: {}", containerId, serverTemplateId); return createCorrectVariant("", headers, Response.Status.OK); } catch (KieServerControllerIllegalArgumentException e) { return createCorrectVariant(e.getMessage(), headers, Response.Status.NOT_FOUND); } catch (Exception e) { logger.error("Start container failed due to {}", e.getMessage(), e); return createCorrectVariant("Unknown error " + e.getMessage(), headers, Response.Status.INTERNAL_SERVER_ERROR); } }