Search in sources :

Example 1 with ResponseUtils.formatResponse

use of org.commonjava.indy.bind.jaxrs.util.ResponseUtils.formatResponse in project indy by Commonjava.

the class RevisionsAdminResource method pushDataGitUpdates.

@ApiOperation("Push Indy data directory content to the configured remote Git repository (if configured in the [revisions] section)")
@ApiResponse(code = 200, message = "Push complete, or not configured")
@Path("/data/push")
@GET
public Response pushDataGitUpdates() {
    Response response;
    try {
        revisionsManager.pushDataUpdates();
        // FIXME: Return some status
        response = Response.ok().build();
    } catch (final GitSubsystemException e) {
        logger.error("Failed to push git updates for data dir: " + e.getMessage(), e);
        response = ResponseUtils.formatResponse(e, "Failed to push git updates for data dir: " + e.getMessage());
    }
    return response;
}
Also used : ResponseUtils.formatResponse(org.commonjava.indy.bind.jaxrs.util.ResponseUtils.formatResponse) Response(javax.ws.rs.core.Response) ApiResponse(io.swagger.annotations.ApiResponse) GitSubsystemException(org.commonjava.indy.subsys.git.GitSubsystemException) Path(javax.ws.rs.Path) GET(javax.ws.rs.GET) ApiOperation(io.swagger.annotations.ApiOperation) ApiResponse(io.swagger.annotations.ApiResponse)

Example 2 with ResponseUtils.formatResponse

use of org.commonjava.indy.bind.jaxrs.util.ResponseUtils.formatResponse in project indy by Commonjava.

the class RevisionsAdminResource method pullDataGitUpdates.

@ApiOperation("Pull from the configured remote Git repository, updating the Indy data directory with files (merged according to configuration in the [revisions] section)")
@ApiResponse(code = 200, message = "Pull complete")
@Path("/data/pull")
@GET
public Response pullDataGitUpdates() {
    Response response;
    try {
        revisionsManager.pullDataUpdates();
        // FIXME: Return some status
        response = Response.ok().build();
    } catch (final GitSubsystemException e) {
        logger.error("Failed to pull git updates for data dir: " + e.getMessage(), e);
        response = ResponseUtils.formatResponse(e, "Failed to pull git updates for data dir: " + e.getMessage());
    }
    return response;
}
Also used : ResponseUtils.formatResponse(org.commonjava.indy.bind.jaxrs.util.ResponseUtils.formatResponse) Response(javax.ws.rs.core.Response) ApiResponse(io.swagger.annotations.ApiResponse) GitSubsystemException(org.commonjava.indy.subsys.git.GitSubsystemException) Path(javax.ws.rs.Path) GET(javax.ws.rs.GET) ApiOperation(io.swagger.annotations.ApiOperation) ApiResponse(io.swagger.annotations.ApiResponse)

Aggregations

ApiOperation (io.swagger.annotations.ApiOperation)2 ApiResponse (io.swagger.annotations.ApiResponse)2 GET (javax.ws.rs.GET)2 Path (javax.ws.rs.Path)2 Response (javax.ws.rs.core.Response)2 ResponseUtils.formatResponse (org.commonjava.indy.bind.jaxrs.util.ResponseUtils.formatResponse)2 GitSubsystemException (org.commonjava.indy.subsys.git.GitSubsystemException)2