diff --git a/Bench4Q-Monitor-Sigar/src/main/java/org/bench4q/monitor/api/MainController.java b/Bench4Q-Monitor-Sigar/src/main/java/org/bench4q/monitor/api/MainController.java index 7dd01149..31ea4747 100644 --- a/Bench4Q-Monitor-Sigar/src/main/java/org/bench4q/monitor/api/MainController.java +++ b/Bench4Q-Monitor-Sigar/src/main/java/org/bench4q/monitor/api/MainController.java @@ -1,11 +1,16 @@ package org.bench4q.monitor.api; +import java.util.UUID; import java.util.concurrent.ExecutionException; +import org.bench4q.monitor.model.LimitModel; import org.bench4q.monitor.model.MonitorMain; import org.hyperic.sigar.SigarException; import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.ResponseBody; @Controller @@ -13,9 +18,23 @@ import org.springframework.web.bind.annotation.ResponseBody; public class MainController { @RequestMapping("/all") @ResponseBody - MonitorMain getMainModel() throws SigarException, InterruptedException, ExecutionException { + MonitorMain getMainModel() throws SigarException, InterruptedException, + ExecutionException { MonitorMain retModel = new MonitorMain(); return retModel; } + @RequestMapping("/startMonitor/{testPlanId}") + @ResponseBody + public String start(@PathVariable UUID testPlanId, + @RequestBody LimitModel limits) { + return new String("startted"); + } + + @RequestMapping(value = "/{testPlanId}", method = RequestMethod.GET) + @ResponseBody + MonitorMain brief(@PathVariable UUID testPlanId) throws SigarException, + InterruptedException, ExecutionException { + return new MonitorMain(); + } } diff --git a/Bench4Q-Monitor-Sigar/src/main/java/org/bench4q/monitor/model/LimitModel.java b/Bench4Q-Monitor-Sigar/src/main/java/org/bench4q/monitor/model/LimitModel.java new file mode 100644 index 00000000..dcd37c4d --- /dev/null +++ b/Bench4Q-Monitor-Sigar/src/main/java/org/bench4q/monitor/model/LimitModel.java @@ -0,0 +1,47 @@ +package org.bench4q.monitor.model; + +import java.util.List; + +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlElementWrapper; +import javax.xml.bind.annotation.XmlRootElement; + +@XmlRootElement +public class LimitModel { + @XmlElementWrapper + @XmlElement + private List params; + + public List getParams() { + return params; + } + + public void setParams(List params) { + this.params = params; + } + + @XmlRootElement + public static class ParameterModel { + private String name; + private double limit; + + @XmlElement + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + @XmlElement + public double getLimit() { + return limit; + } + + public void setLimit(double limit) { + this.limit = limit; + } + + } +}