com.github.quartzwebui.service.strategy.SchedulerServiceStrategy Maven / Gradle / Ivy
The newest version!
/**
* Licensed under the Apache License, Version 2.0 (the "License");
*/
package com.github.quartzwebui.service.strategy;
import com.github.quartzwebui.manager.web.QuartzWebUIManager;
import com.github.quartzwebui.service.JSONResult;
import com.github.quartzwebui.service.QuartzWebUIURL;
import com.github.quartzwebui.utils.Assert;
import com.github.quartzwebui.utils.StringUtils;
import java.util.List;
import java.util.Map;
/**
* Scheduler 业务处理策略
* @author quxiucheng [[email protected]]
*/
public class SchedulerServiceStrategy implements ServiceStrategy {
public JSONResult service(ServiceStrategyURL serviceStrategyURL, SchedulerServiceStrategyParameter parameter) {
String url = serviceStrategyURL.getURL();
// 列出信息
if (QuartzWebUIURL.SchedulerURL.INFO.getURL().equals(url)) {
return getInfo();
}
String schedulerName = parameter.getSchedulerName();
// 具体操作
// 启动
if (QuartzWebUIURL.SchedulerURL.START.getURL().equals(url)) {
return start(schedulerName);
}
// 延时启动
if (QuartzWebUIURL.SchedulerURL.START_DELAYED.getURL().equals(url)) {
String delayed = parameter.getDelayed();
return startDelayed(schedulerName, delayed);
}
// 关闭
if (QuartzWebUIURL.SchedulerURL.SHUTDOWN.getURL().equals(url)) {
return shutdown(schedulerName);
}
// 等待job运行结束后关闭
if (QuartzWebUIURL.SchedulerURL.SHUTDOWN_WAIT.getURL().equals(url)) {
return shutdownWait(schedulerName);
}
// 404没有找到url
return JSONResult.build(JSONResult.RESULT_CODE_ERROR, "404 not found");
}
/**
* 实例化接口参数
* @return 接口参数
*/
public SchedulerServiceStrategyParameter newServiceStrategyParameterInstance() {
return new SchedulerServiceStrategyParameter();
}
public JSONResult getInfo(){
try {
List
© 2015 - 2025 Weber Informatics LLC | Privacy Policy