@Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML } )
@RedbackAuthorization( noRestriction = true )
ArchivaRuntimeInfo archivaRuntimeInfo();
+
+
+ @Path( "validateCronExpression" )
+ @GET
+ @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML } )
+ @RedbackAuthorization( noRestriction = true )
+ Boolean validateCronExpression( @QueryParam( "cronExpression" ) String cronExpression )
+ throws ArchivaRestServiceException;
+
}
import org.apache.archiva.rest.api.services.CommonServices;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang.StringUtils;
+import org.codehaus.redback.components.scheduler.CronExpressionValidator;
import org.codehaus.redback.rest.api.services.RedbackServiceException;
import org.codehaus.redback.rest.api.services.UtilServices;
import org.slf4j.Logger;
import org.springframework.stereotype.Service;
import javax.inject.Inject;
+import javax.ws.rs.QueryParam;
import javax.ws.rs.core.Response;
import java.io.ByteArrayInputStream;
import java.io.IOException;
@Inject
private UtilServices utilServices;
+ @Inject
+ protected CronExpressionValidator cronExpressionValidator;
+
public String getI18nResources( String locale )
throws ArchivaRestServiceException
{
{
return new ArchivaRuntimeInfo();
}
+
+ public Boolean validateCronExpression( @QueryParam( "cronExpression" ) String cronExpression )
+ throws ArchivaRestServiceException
+ {
+ return cronExpressionValidator.validate( cronExpression );
+ }
}