package org.bench4q.monitor.api;

import java.io.IOException;

import org.bench4q.monitor.entiry.MonitorContorlEntity;
import org.bench4q.monitor.model.LogicalDiskModel;
import org.bench4q.monitor.service.linux.LogicalDiskServiceLinux;
import org.bench4q.monitor.service.windows.LogicalDiskServiceWindows;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
@RequestMapping(value = "/Monitor", method = { RequestMethod.GET,
		RequestMethod.POST })
public class LogicalDiskController extends MonitorContorlEntity {// �Ժ�ʵ��linux��Ҫ����linux��dervice
	@RequestMapping("/LogicalDisk")
	@ResponseBody
	public LogicalDiskModel getLogicalDiskInfo() throws IOException,
			InterruptedException {

		if (this.getOsNameString().contains("windows")) {
			LogicalDiskServiceWindows logicalDiskServiceWindows = new LogicalDiskServiceWindows();
			return logicalDiskServiceWindows.getLogicalDiskInfo(this
					.getIdleTime());
		} else if (this.getOsNameString().contains("linux")) {
			LogicalDiskServiceLinux logicalDiskServiceLinux = new LogicalDiskServiceLinux();
			return logicalDiskServiceLinux.getLogicalDiskInfo(this
					.getIdleTime());
		} else
			return null;
	}

}
