Ejemplo n.º 1
0
  @RvdAuth
  @PUT
  @Path("{name}/upgrade")
  public Response upgradeProject(@PathParam("name") String projectName) {

    // TODO IMPORTANT!!! sanitize the project name!!
    if (!RvdUtils.isEmpty(projectName)) {
      try {
        UpgradeService upgradeService = new UpgradeService(workspaceStorage);
        upgradeService.upgradeProject(projectName);
        logger.info(
            "project '"
                + projectName
                + "' upgraded to version "
                + RvdConfiguration.getRvdProjectVersion());
        // re-build project
        BuildService buildService = new BuildService(workspaceStorage);
        buildService.buildProject(projectName, activeProject);
        logger.info("project '" + projectName + "' built");
        return Response.ok().build();
      } catch (StorageException e) {
        return Response.status(Status.INTERNAL_SERVER_ERROR).build();
      } catch (UpgradeException e) {
        logger.error(e.getMessage(), e);
        return Response.status(Status.INTERNAL_SERVER_ERROR)
            .entity(e.asJson())
            .type(MediaType.APPLICATION_JSON)
            .build();
      }
    } else return Response.status(Status.BAD_REQUEST).build();
  }
Ejemplo n.º 2
0
 @PostConstruct
 void init() {
   rvdContext = new RvdContext(request, servletContext);
   rvdSettings = rvdContext.getSettings();
   marshaler = rvdContext.getMarshaler();
   workspaceStorage = new WorkspaceStorage(rvdSettings.getWorkspaceBasePath(), marshaler);
   projectService = new ProjectService(rvdContext, workspaceStorage);
 }