package org.bench4q.monitor.file.windows;

import java.io.PrintWriter;
import org.bench4q.monitor.service.windows.SystemServiceWindows;

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

import org.bench4q.monitor.model.SystemModel;
import org.bench4q.monitor.files.Write;

public class WriteSystemWindows extends Write {
	private SystemServiceWindows SystemServiceWindows;

	public WriteSystemWindows(PrintWriter out, int idleTime) {
		this.out = out;
		this.SystemServiceWindows = new SystemServiceWindows();
		this.idleTime = idleTime;
	}

	public void run() {
		try {
			JAXBContext context = JAXBContext.newInstance(SystemModel.class);
			Marshaller marshaller = context.createMarshaller();
			SystemModel SystemModel = SystemServiceWindows
					.getSystemInfo(idleTime);
			marshaller.marshal(SystemModel, out);
		} catch (Exception e) {
			System.out.println(e);
		}

	}

}
