Package com.elastisys.scale.commons.rest.types

Examples of com.elastisys.scale.commons.rest.types.ErrorType


  public Response getConfigurationSchema() {
    log.info("GET /config/schema");
    Optional<JsonObject> schema = this.cloudAdapter
        .getConfigurationSchema();
    if (!schema.isPresent()) {
      ErrorType entity = new ErrorType(
          "cloud adapter does not publish a configuration schema");
      return Response.status(Status.NOT_FOUND).entity(entity).build();

    }
    return Response.ok(schema.get()).build();
View Full Code Here


    log.info("GET /config");
    try {
      Optional<JsonObject> configuration = this.cloudAdapter
          .getConfiguration();
      if (!configuration.isPresent()) {
        ErrorType entity = new ErrorType(
            "no cloud adapter configuration has been set");
        return Response.status(Status.NOT_FOUND).entity(entity).build();
      }
      return Response.ok(configuration.get()).build();
    } catch (Exception e) {
      String message = "failure to process config get request: "
          + e.getMessage();
      log.error(message, e);
      return Response.status(Status.INTERNAL_SERVER_ERROR)
          .entity(new ErrorType(message, e)).build();
    }
  }
View Full Code Here

      return Response.ok().build();
    } catch (IllegalArgumentException e) {
      String message = "illegal input: " + e.getMessage();
      log.error(message, e);
      return Response.status(Status.BAD_REQUEST)
          .entity(new ErrorType(message, e)).build();
    } catch (Exception e) {
      String message = "failure to process config set request: "
          + e.getMessage();
      log.error(message, e);
      return Response.status(Status.INTERNAL_SERVER_ERROR)
          .entity(new ErrorType(message, e)).build();
    }
  }
View Full Code Here

    } catch (Exception e) {
      String message = "failure to process pool get request: "
          + e.getMessage();
      log.error(message, e);
      return Response.status(Status.INTERNAL_SERVER_ERROR)
          .entity(new ErrorType(message, e)).build();
    }
  }
View Full Code Here

      return Response.ok().build();
    } catch (IllegalArgumentException e) {
      String message = "illegal input: " + e.getMessage();
      log.error(message, e);
      return Response.status(Status.BAD_REQUEST)
          .entity(new ErrorType(message, e)).build();
    } catch (Exception e) {
      String message = "failure to process pool resize request: "
          + e.getMessage();
      log.error(message, e);
      return Response.status(Status.INTERNAL_SERVER_ERROR)
          .entity(new ErrorType(message, e)).build();
    } finally {
      log.debug("Finished handling POST /pool");
      this.lock.unlock();
    }
View Full Code Here

          "failed to parse JSON object: entity stream is empty");
      return JsonUtils.parseJsonString(entity);
    } catch (IllegalArgumentException e) {
      // produce a 400 http response
      throw new WebApplicationException(e, Response
          .status(Status.BAD_REQUEST).entity(new ErrorType(e))
          .build());
    } catch (JsonParseException e) {
      // produce a 400 http response
      throw new WebApplicationException(e, Response
          .status(Status.BAD_REQUEST).entity(new ErrorType(e))
          .build());
    }
  }
View Full Code Here

TOP

Related Classes of com.elastisys.scale.commons.rest.types.ErrorType

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.