Search in sources :

Example 6 with WebSocketServiceResponse

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

the class WebSocketKieServerClient method getReleaseId.

@Override
public ServiceResponse<ReleaseId> getReleaseId(String containerId) {
    CommandScript script = new CommandScript(Collections.singletonList(new GetReleaseIdCommand(containerId)));
    ServiceResponse<ReleaseId> response = (ServiceResponse<ReleaseId>) 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) WebSocketServiceResponse(org.kie.server.controller.websocket.common.handlers.WebSocketServiceResponse) CommandScript(org.kie.server.api.commands.CommandScript) ReleaseId(org.kie.server.api.model.ReleaseId) GetReleaseIdCommand(org.kie.server.api.commands.GetReleaseIdCommand)

Example 7 with WebSocketServiceResponse

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

the class WebSocketKieServerClient method updateReleaseId.

@Override
public ServiceResponse<ReleaseId> updateReleaseId(String id, ReleaseId releaseId, boolean resetBeforeUpdate) {
    CommandScript script = new CommandScript(Collections.singletonList(new UpdateReleaseIdCommand(id, releaseId, resetBeforeUpdate)));
    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;
}
Also used : UpdateReleaseIdCommand(org.kie.server.api.commands.UpdateReleaseIdCommand) ServiceResponsesList(org.kie.server.api.model.ServiceResponsesList) WebSocketServiceResponse(org.kie.server.controller.websocket.common.handlers.WebSocketServiceResponse) ServiceResponse(org.kie.server.api.model.ServiceResponse) WebSocketServiceResponse(org.kie.server.controller.websocket.common.handlers.WebSocketServiceResponse) CommandScript(org.kie.server.api.commands.CommandScript) ReleaseId(org.kie.server.api.model.ReleaseId)

Example 8 with WebSocketServiceResponse

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

the class WebSocketKieServerClient method updateScanner.

@Override
public ServiceResponse<KieScannerResource> updateScanner(String id, KieScannerResource resource) {
    CommandScript script = new CommandScript(Collections.singletonList((KieServerCommand) new UpdateScannerCommand(id, resource)));
    ServiceResponse<KieScannerResource> response = (ServiceResponse<KieScannerResource>) 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) UpdateScannerCommand(org.kie.server.api.commands.UpdateScannerCommand) KieScannerResource(org.kie.server.api.model.KieScannerResource) WebSocketServiceResponse(org.kie.server.controller.websocket.common.handlers.WebSocketServiceResponse) CommandScript(org.kie.server.api.commands.CommandScript)

Example 9 with WebSocketServiceResponse

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

the class WebSocketKieServerClient method getServerInfo.

@Override
public ServiceResponse<KieServerInfo> getServerInfo() {
    CommandScript script = new CommandScript(Collections.singletonList((KieServerCommand) new GetServerInfoCommand()));
    ServiceResponse<KieServerInfo> response = (ServiceResponse<KieServerInfo>) 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) WebSocketServiceResponse(org.kie.server.controller.websocket.common.handlers.WebSocketServiceResponse) CommandScript(org.kie.server.api.commands.CommandScript) GetServerInfoCommand(org.kie.server.api.commands.GetServerInfoCommand) KieServerInfo(org.kie.server.api.model.KieServerInfo)

Example 10 with WebSocketServiceResponse

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

the class WebSocketKieServerClient method listContainers.

@Override
public ServiceResponse<KieContainerResourceList> listContainers(KieContainerResourceFilter containerFilter) {
    CommandScript script = new CommandScript(Collections.singletonList((KieServerCommand) new ListContainersCommand(containerFilter)));
    ServiceResponse<KieContainerResourceList> response = (ServiceResponse<KieContainerResourceList>) 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) ListContainersCommand(org.kie.server.api.commands.ListContainersCommand) KieContainerResourceList(org.kie.server.api.model.KieContainerResourceList) 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)

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