use of org.commonjava.indy.core.expire.Expiration in project indy by Commonjava.
the class SchedulerHandler method getStoreDisableTimeout.
@ApiOperation("Retrieve the expiration information related to re-enablement of a repository")
@ApiResponses({ @ApiResponse(code = 200, message = "Expiration information retrieved successfully.", response = Expiration.class), @ApiResponse(code = 400, message = "Store is manually disabled (doesn't automatically re-enable), or isn't disabled.") })
@Path("store/{packageType}/{type: (hosted|group|remote)}/{name}/disable-timeout")
@GET
public Expiration getStoreDisableTimeout(@ApiParam(value = "Package type (maven, generic-http, npm, etc)", required = true) @PathParam("packageType") String packageType, @ApiParam(allowableValues = "hosted,group,remote", required = true) @PathParam("type") String storeType, @ApiParam(required = true) @PathParam("name") String storeName) {
StoreKey storeKey = new StoreKey(packageType, StoreType.get(storeType), storeName);
Expiration timeout = null;
try {
timeout = controller.getStoreDisableTimeout(storeKey);
} catch (IndyWorkflowException e) {
throwError(e);
}
if (timeout == null) {
throw new WebApplicationException(Response.Status.NOT_FOUND);
}
return timeout;
}
use of org.commonjava.indy.core.expire.Expiration in project indy by Commonjava.
the class SchedulerHandler method deprecatedGetStoreDisableTimeout.
@ApiOperation("[Deprecated] Retrieve the expiration information related to re-enablement of a repository")
@ApiResponses({ @ApiResponse(code = 200, message = "Expiration information retrieved successfully.", response = Expiration.class), @ApiResponse(code = 400, message = "Store is manually disabled (doesn't automatically re-enable), or isn't disabled.") })
@Path("store/{type: (hosted|group|remote)}/{name}/disable-timeout")
@GET
@Deprecated
public Response deprecatedGetStoreDisableTimeout(@ApiParam(allowableValues = "hosted,group,remote", required = true) @PathParam("type") String storeType, @ApiParam(required = true) @PathParam("name") String storeName) {
StoreType type = StoreType.get(storeType);
String altPath = Paths.get("/api/admin/schedule", MAVEN_PKG_KEY, type.singularEndpointName(), storeName).toString();
StoreKey storeKey = new StoreKey(type, storeName);
Expiration timeout = null;
try {
timeout = controller.getStoreDisableTimeout(storeKey);
if (timeout == null) {
throw new WebApplicationException(Response.Status.NOT_FOUND);
}
return formatOkResponseWithJsonEntity(timeout, objectMapper, rb -> markDeprecated(rb, altPath));
} catch (IndyWorkflowException e) {
throwError(e, rb -> markDeprecated(rb, altPath));
}
return null;
}
Aggregations