Search in sources :

Example 11 with WebSocketServiceResponse

use of org.kie.server.controller.websocket.common.handlers.WebSocketServiceResponse in project droolsjbpm-integration by kiegroup.

the class WebSocketKieServerClient method disposeContainer.

@Override
public ServiceResponse<Void> disposeContainer(String id) {
    CommandScript script = new CommandScript(Collections.singletonList((KieServerCommand) new DisposeContainerCommand(id)));
    ServiceResponse<Void> response = (ServiceResponse<Void>) sendCommandToAllSessions(script, new WebSocketServiceResponse(true, (message) -> {
        ServiceResponsesList list = WebSocketUtils.unmarshal(message, ServiceResponsesList.class);
        return list.getResponses().get(0);
    })).getResponses().get(0);
    return response;
}
Also used : ServiceResponsesList(org.kie.server.api.model.ServiceResponsesList) WebSocketServiceResponse(org.kie.server.controller.websocket.common.handlers.WebSocketServiceResponse) ServiceResponse(org.kie.server.api.model.ServiceResponse) KieServerCommand(org.kie.server.api.model.KieServerCommand) WebSocketServiceResponse(org.kie.server.controller.websocket.common.handlers.WebSocketServiceResponse) CommandScript(org.kie.server.api.commands.CommandScript) DisposeContainerCommand(org.kie.server.api.commands.DisposeContainerCommand)

Example 12 with WebSocketServiceResponse

use of org.kie.server.controller.websocket.common.handlers.WebSocketServiceResponse in project droolsjbpm-integration by kiegroup.

the class WebSocketKieServerClient method activateContainer.

@Override
public ServiceResponse<KieContainerResource> activateContainer(String id) {
    CommandScript script = new CommandScript(Collections.singletonList((KieServerCommand) new ActivateContainerCommand(id)));
    ServiceResponse<KieContainerResource> response = (ServiceResponse<KieContainerResource>) sendCommandToAllSessions(script, new WebSocketServiceResponse(true, (message) -> {
        ServiceResponsesList list = WebSocketUtils.unmarshal(message, ServiceResponsesList.class);
        return list.getResponses().get(0);
    })).getResponses().get(0);
    return response;
}
Also used : ServiceResponsesList(org.kie.server.api.model.ServiceResponsesList) WebSocketServiceResponse(org.kie.server.controller.websocket.common.handlers.WebSocketServiceResponse) ServiceResponse(org.kie.server.api.model.ServiceResponse) KieServerCommand(org.kie.server.api.model.KieServerCommand) WebSocketServiceResponse(org.kie.server.controller.websocket.common.handlers.WebSocketServiceResponse) ActivateContainerCommand(org.kie.server.api.commands.ActivateContainerCommand) CommandScript(org.kie.server.api.commands.CommandScript) KieContainerResource(org.kie.server.api.model.KieContainerResource)

Example 13 with WebSocketServiceResponse

use of org.kie.server.controller.websocket.common.handlers.WebSocketServiceResponse in project droolsjbpm-integration by kiegroup.

the class WebSocketKieServerClient method createContainer.

@Override
public ServiceResponse<KieContainerResource> createContainer(String id, KieContainerResource resource) {
    CommandScript script = new CommandScript(Collections.singletonList((KieServerCommand) new CreateContainerCommand(resource)));
    ServiceResponse<KieContainerResource> response = (ServiceResponse<KieContainerResource>) sendCommandToAllSessions(script, new WebSocketServiceResponse(true, (message) -> {
        ServiceResponsesList list = WebSocketUtils.unmarshal(message, ServiceResponsesList.class);
        return list.getResponses().get(0);
    })).getResponses().get(0);
    return response;
}
Also used : ServiceResponsesList(org.kie.server.api.model.ServiceResponsesList) WebSocketServiceResponse(org.kie.server.controller.websocket.common.handlers.WebSocketServiceResponse) ServiceResponse(org.kie.server.api.model.ServiceResponse) KieServerCommand(org.kie.server.api.model.KieServerCommand) WebSocketServiceResponse(org.kie.server.controller.websocket.common.handlers.WebSocketServiceResponse) CreateContainerCommand(org.kie.server.api.commands.CreateContainerCommand) CommandScript(org.kie.server.api.commands.CommandScript) KieContainerResource(org.kie.server.api.model.KieContainerResource)

Example 14 with WebSocketServiceResponse

use of org.kie.server.controller.websocket.common.handlers.WebSocketServiceResponse in project droolsjbpm-integration by kiegroup.

the class WebSocketKieServerClient method getScannerInfo.

@Override
public ServiceResponse<KieScannerResource> getScannerInfo(String id) {
    CommandScript script = new CommandScript(Collections.singletonList((KieServerCommand) new GetScannerInfoCommand(id)));
    ServiceResponse<KieScannerResource> response = (ServiceResponse<KieScannerResource>) sendCommand(script, new WebSocketServiceResponse(true, (message) -> {
        ServiceResponsesList list = WebSocketUtils.unmarshal(message, ServiceResponsesList.class);
        return list.getResponses().get(0);
    })).getResponses().get(0);
    return response;
}
Also used : ServiceResponsesList(org.kie.server.api.model.ServiceResponsesList) WebSocketServiceResponse(org.kie.server.controller.websocket.common.handlers.WebSocketServiceResponse) ServiceResponse(org.kie.server.api.model.ServiceResponse) KieServerCommand(org.kie.server.api.model.KieServerCommand) KieScannerResource(org.kie.server.api.model.KieScannerResource) WebSocketServiceResponse(org.kie.server.controller.websocket.common.handlers.WebSocketServiceResponse) CommandScript(org.kie.server.api.commands.CommandScript) GetScannerInfoCommand(org.kie.server.api.commands.GetScannerInfoCommand)

Aggregations

WebSocketServiceResponse (org.kie.server.controller.websocket.common.handlers.WebSocketServiceResponse)14 ServiceResponse (org.kie.server.api.model.ServiceResponse)13 ServiceResponsesList (org.kie.server.api.model.ServiceResponsesList)13 CommandScript (org.kie.server.api.commands.CommandScript)12 KieServerCommand (org.kie.server.api.model.KieServerCommand)10 KieContainerResource (org.kie.server.api.model.KieContainerResource)4 IOException (java.io.IOException)2 KieScannerResource (org.kie.server.api.model.KieScannerResource)2 ReleaseId (org.kie.server.api.model.ReleaseId)2 ArrayList (java.util.ArrayList)1 Session (javax.websocket.Session)1 ActivateContainerCommand (org.kie.server.api.commands.ActivateContainerCommand)1 CreateContainerCommand (org.kie.server.api.commands.CreateContainerCommand)1 DeactivateContainerCommand (org.kie.server.api.commands.DeactivateContainerCommand)1 DisposeContainerCommand (org.kie.server.api.commands.DisposeContainerCommand)1 GetContainerInfoCommand (org.kie.server.api.commands.GetContainerInfoCommand)1 GetReleaseIdCommand (org.kie.server.api.commands.GetReleaseIdCommand)1 GetScannerInfoCommand (org.kie.server.api.commands.GetScannerInfoCommand)1 GetServerInfoCommand (org.kie.server.api.commands.GetServerInfoCommand)1 GetServerStateCommand (org.kie.server.api.commands.GetServerStateCommand)1