Exemplo n.º 1
0
  /**
   * Reinitialise the database configuration. Will close the database connection and reopen it,
   * possibly with new settings.
   *
   * @return ok if successful, 500 if not @HTTP 200 if database was reinitialised successfully @HTTP
   *     500 if there was an error while reinitialising database (see log)
   */
  @POST
  @Path("/database/reinit")
  public Response reinitDatabase() {
    log.info("Reinitialising database after admin user request ...");
    try {
      sesameService.shutdown();
      sesameService.initialise();

      return Response.ok().entity("database reinitialised successfully").build();
    } catch (Exception ex) {
      log.error("Error while reinitalising database ...", ex);
      return ErrorResponse.errorResponse(Response.Status.INTERNAL_SERVER_ERROR, ex);
    }
  }