Tabnine Logo
KieServerControllerIllegalArgumentException
Code IndexAdd Tabnine to your IDE (free)

How to use
KieServerControllerIllegalArgumentException
in
org.kie.server.controller.api

Best Java code snippets using org.kie.server.controller.api.KieServerControllerIllegalArgumentException (Showing top 20 results out of 315)

origin: org.kie.server/kie-server-controller-impl

protected KieServicesClient getClient(final String url) {
  KieServicesClientProvider clientProvider = clientProviders.stream().filter(provider -> provider.supports(url)).findFirst().orElseThrow(() -> new KieServerControllerIllegalArgumentException("Kie Services Client Provider not found for url: " + url));
  logger.debug("Using client provider {}", clientProvider);
  KieServicesClient client = clientProvider.get(url);
  logger.debug("Using client {}", client);
  if(client == null){
    throw new KieServerControllerIllegalArgumentException("Kie Services Client not found for url: " + url);
  }
  return client;
}
origin: org.kie.server/kie-server-controller-rest

@ApiOperation(value = "Disposes a specified KIE container in a specified KIE Server template.", code = 204)
@ApiResponses(value = {
    @ApiResponse(code = 204, message = "KIE container successfully disposed"),
    @ApiResponse(code = 404, message = "Container Specification or KIE Server template not found"),
    @ApiResponse(code = 400, message = "Controller exception"),
    @ApiResponse(code = 500, message = "Unexpected error")
})
@DELETE
@Path("servers/{serverTemplateId}/containers/{containerId}")
@Consumes({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON})
public Response deleteContainerSpec(@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 disposed", required = true, example = "evaluation_1.0.0-SNAPSHOT") @PathParam("containerId") String containerSpecId) {
  try {
    specManagementService.deleteContainerSpec(serverTemplateId, containerSpecId);
    // return null to produce 204
    return null;
  } catch (KieServerControllerIllegalArgumentException e) {
    return createCorrectVariant(e.getMessage(), headers, Response.Status.NOT_FOUND);
  } catch (KieServerControllerException e){
    return createCorrectVariant(REQUEST_FAILED_TOBE_PROCESSED + e.getMessage(), headers, Response.Status.BAD_REQUEST);
  } catch (Exception e) {
    logger.error("Remove container with id {} from server template with id {} failed due to {}", containerSpecId, serverTemplateId, e.getMessage(), e);
    return createCorrectVariant("Unknown error " + e.getMessage(), headers, Response.Status.INTERNAL_SERVER_ERROR);
  }
}
origin: org.kie.server/kie-server-controller-impl

protected ServerTemplate getServerTemplate(final String serverTemplateId){
  final ServerTemplate serverTemplate = templateStorage.load(serverTemplateId);
  if (serverTemplate == null) {
    throw new KieServerControllerIllegalArgumentException("No server template found for id " + serverTemplateId);
  }
  return serverTemplate;
}
origin: org.kie.server/kie-server-controller-rest

@ApiOperation(value = "Deletes a specified KIE Server template", code = 204)
@ApiResponses(value = {
    @ApiResponse(code = 204, message = "KIE Server template successfully deleted"),
    @ApiResponse(code = 404, message = "KIE Server template not found"),
    @ApiResponse(code = 400, message = "Controller exception"),
    @ApiResponse(code = 500, message = "Unexpected error")
})
@DELETE
@Path("servers/{serverTemplateId}")
@Consumes({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON})
public Response deleteServerTemplate(@Context HttpHeaders headers,
                   @ApiParam(name = "serverTemplateId", value = "ID of the KIE Server template to be deleted", required = true, example = "test-kie-server") @PathParam("serverTemplateId") String serverTemplateId) {
  try {
    specManagementService.deleteServerTemplate(serverTemplateId);
    // return null to produce 204
    return null;
  } catch (KieServerControllerIllegalArgumentException e) {
    return createCorrectVariant(e.getMessage(), headers, Response.Status.NOT_FOUND);
  } catch (KieServerControllerException e){
    return createCorrectVariant(REQUEST_FAILED_TOBE_PROCESSED + e.getMessage(), headers, Response.Status.BAD_REQUEST);
  } catch (Exception e) {
    logger.error("Remove server template with id {} failed due to {}", serverTemplateId, e.getMessage(), e);
    return createCorrectVariant("Unknown error " + e.getMessage(), headers, Response.Status.INTERNAL_SERVER_ERROR);
  }
}
origin: org.kie.server/kie-server-controller-impl

@Override
public ServerTemplate getServerTemplate(String serverTemplateId) {
  final ServerTemplate serverTemplate = templateStorage.load(serverTemplateId);
  if (serverTemplate == null) {
    throw new KieServerControllerIllegalArgumentException("No server template found for id " + serverTemplateId);
  }
  return serverTemplate;
}
origin: org.kie.server/kie-server-controller-rest

  return createCorrectVariant(e.getMessage(), headers, Response.Status.NOT_FOUND);
} catch (KieServerControllerException e){
  return createCorrectVariant(REQUEST_FAILED_TOBE_PROCESSED + e.getMessage(), headers, Response.Status.BAD_REQUEST);
origin: org.kie.server/kie-server-controller-impl

@Override
public ContainerSpec getContainerInfo(String serverTemplateId,
                   String containerId) {
  final ServerTemplate serverTemplate = getServerTemplate(serverTemplateId);
  if (serverTemplate == null) {
    throw new KieServerControllerIllegalArgumentException("No server template found for id " + serverTemplateId);
  }
  final ContainerSpec containerSpec = serverTemplate.getContainerSpec(containerId);
  if (containerSpec == null) {
    throw new KieServerControllerIllegalArgumentException("Server template " + serverTemplateId + " does not have container with id " + containerId);
  }
  return containerSpec;
}
origin: org.kie.server/kie-server-controller-rest

@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);
  }
}
origin: org.kie.server/kie-server-controller-impl

@Override
public ContainerSpecList listContainerSpec(String serverTemplateId) {
  ServerTemplate serverTemplate = templateStorage.load(serverTemplateId);
  if (serverTemplate == null) {
    throw new KieServerControllerIllegalArgumentException("No server template found for id " + serverTemplateId);
  }
  return new ContainerSpecList(serverTemplate.getContainersSpec());
}
origin: org.kie.server/kie-server-controller-rest

  return createCorrectVariant(e.getMessage(), headers, Response.Status.NOT_FOUND);
} catch (KieServerControllerException e){
  return createCorrectVariant(REQUEST_FAILED_TOBE_PROCESSED + e.getMessage(), headers, Response.Status.BAD_REQUEST);
origin: org.kie.server/kie-server-controller-impl

@Override
public synchronized void copyServerTemplate(String serverTemplateId,
                      String newServerTemplateId,
                      String newServerTemplateName) {
  final ServerTemplate serverTemplate = templateStorage.load(serverTemplateId);
  if (serverTemplate == null) {
    throw new KieServerControllerIllegalArgumentException("No server template found for id " + serverTemplateId);
  }
  final Map<Capability, ServerConfig> configMap = new HashMap<Capability, ServerConfig>(serverTemplate.getConfigs().size());
  for (final Map.Entry<Capability, ServerConfig> entry : serverTemplate.getConfigs().entrySet()) {
    configMap.put(entry.getKey(), copy(entry.getValue()));
  }
  final Collection<ContainerSpec> containerSpecs = new ArrayList<ContainerSpec>(serverTemplate.getContainersSpec().size());
  for (final ContainerSpec entry : serverTemplate.getContainersSpec()) {
    containerSpecs.add(copy(entry, newServerTemplateId, newServerTemplateName));
  }
  final ServerTemplate copy = new ServerTemplate(newServerTemplateId,
                          newServerTemplateName,
                          serverTemplate.getCapabilities(),
                          configMap,
                          containerSpecs);
  templateStorage.store(copy);
}
origin: org.kie.server/kie-server-controller-rest

@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);
  }
}
origin: org.kie.server/kie-server-controller-impl

@Override
public synchronized void deleteServerTemplate(String serverTemplateId) {
  if (!templateStorage.exists(serverTemplateId)) {
    throw new KieServerControllerIllegalArgumentException("No server template found for id " + serverTemplateId);
  }
  templateStorage.delete(serverTemplateId);
  notificationService.notify(new ServerTemplateDeleted(serverTemplateId));
}
origin: org.kie.server/kie-server-controller-rest

@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);
  }
}
origin: org.kie.server/kie-server-controller-impl

@Override
public synchronized void deleteContainerSpec(String serverTemplateId,
                       String containerSpecId) {
  ServerTemplate serverTemplate = templateStorage.load(serverTemplateId);
  if (serverTemplate == null) {
    throw new KieServerControllerIllegalArgumentException("No server template found for id " + serverTemplateId);
  }
  if (serverTemplate.hasContainerSpec(containerSpecId)) {
    ContainerSpec containerSpec = serverTemplate.getContainerSpec(containerSpecId);
    kieServerInstanceManager.stopContainer(serverTemplate, containerSpec);
    serverTemplate.deleteContainerSpec(containerSpecId);
    templateStorage.update(serverTemplate);
    notificationService.notify(new ServerTemplateUpdated(serverTemplate));
  } else {
    throw new KieServerControllerIllegalArgumentException("Container " + containerSpecId + " not found");
  }
}
origin: org.kie.server/kie-server-controller-rest

@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);
  }
}
origin: org.kie.server/kie-server-controller-impl

@Override
public synchronized void updateServerTemplateConfig(String serverTemplateId,
                          Capability capability,
                          ServerConfig serverTemplateConfig) {
  ServerTemplate serverTemplate = templateStorage.load(serverTemplateId);
  if (serverTemplate == null) {
    throw new KieServerControllerIllegalArgumentException("No server template found for id " + serverTemplateId);
  }
  Map<Capability, ServerConfig> configs = serverTemplate.getConfigs();
  configs.put(capability, serverTemplateConfig);
  serverTemplate.setConfigs(configs);
  templateStorage.update(serverTemplate);
  notificationService.notify(new ServerTemplateUpdated(serverTemplate));
}
origin: org.kie.server/kie-server-controller-rest

  return createCorrectVariant("", headers, Response.Status.CREATED);
} catch (KieServerControllerIllegalArgumentException e) {
  return createCorrectVariant(e.getMessage(), headers, Response.Status.NOT_FOUND);
} catch (KieServerControllerException e){
  return createCorrectVariant(REQUEST_FAILED_TOBE_PROCESSED + e.getMessage(), headers, Response.Status.BAD_REQUEST);
origin: org.kie.server/kie-server-controller-impl

public ContainerList getServerTemplateContainers(final String serverTemplateId,
                          final String containerSpecId) {
  final ServerTemplate serverTemplate = getServerTemplate(serverTemplateId);
  if (serverTemplate.hasContainerSpec(containerSpecId) == false) {
    throw new KieServerControllerIllegalArgumentException("Server template with id " + serverTemplateId + " has no container with id " + containerSpecId);
  }
  final ContainerSpec containerSpec = serverTemplate.getContainerSpec(containerSpecId);
  Collection<Container> containers = kieServerInstanceManager.getContainers(serverTemplate,
                                       containerSpec);
  return new ContainerList(containers);
}
origin: org.kie.server/kie-server-controller-rest

  return createCorrectVariant(e.getMessage(), headers, Response.Status.NOT_FOUND);
} catch (KieServerControllerException e){
  return createCorrectVariant(REQUEST_FAILED_TOBE_PROCESSED + e.getMessage(), headers, Response.Status.BAD_REQUEST);
org.kie.server.controller.apiKieServerControllerIllegalArgumentException

Most used methods

  • <init>
  • getMessage

Popular in Java

  • Creating JSON documents from java classes using gson
  • requestLocationUpdates (LocationManager)
  • getOriginalFilename (MultipartFile)
    Return the original filename in the client's filesystem.This may contain path information depending
  • getSupportFragmentManager (FragmentActivity)
  • FileOutputStream (java.io)
    An output stream that writes bytes to a file. If the output file exists, it can be replaced or appen
  • IOException (java.io)
    Signals a general, I/O-related error. Error details may be specified when calling the constructor, a
  • InputStreamReader (java.io)
    A class for turning a byte stream into a character stream. Data read from the source input stream is
  • Servlet (javax.servlet)
    Defines methods that all servlets must implement. A servlet is a small Java program that runs within
  • JButton (javax.swing)
  • Response (javax.ws.rs.core)
    Defines the contract between a returned instance and the runtime when an application needs to provid
  • Best plugins for Eclipse
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now