package org.bench4q.monitor.file.Linux;

import java.io.FileNotFoundException;
import java.io.PrintWriter;

import javax.xml.bind.JAXBContext;
import javax.xml.bind.Marshaller;

import org.bench4q.monitor.files.Write;
import org.bench4q.monitor.model.LogicalDiskModel;
import org.bench4q.monitor.performance.linux.LogicalDiskMonitor;


public class WriteLogicalDiskLinux extends Write{
	
	private LogicalDiskMonitor logicalDiskMonitor;
	public WriteLogicalDiskLinux(PrintWriter out,int idleTime) throws FileNotFoundException{
		this.out=out;
		this.logicalDiskMonitor=new LogicalDiskMonitor();
		this.idleTime=idleTime;
	}
	public void run(){
		try{
     JAXBContext context = JAXBContext.newInstance(LogicalDiskModel.class);  
     Marshaller marshaller = context.createMarshaller();  
     LogicalDiskModel logicalDiskModel=logicalDiskMonitor.getLogicalDiskInfo(idleTime);
     marshaller.marshal(logicalDiskModel, out);  
     }
		catch(Exception e){
			System.out.println(e);
		}
 }  
		    
}
