package be.iminds.ilabt.jfed.highlevel.tasks;

import be.iminds.ilabt.jfed.highlevel.controller.Task;
import be.iminds.ilabt.jfed.highlevel.controller.TaskExecution;
import be.iminds.ilabt.jfed.highlevel.util.AggregateManagerWrapperFactory;
import be.iminds.ilabt.jfed.lowlevel.JFedException;
import be.iminds.ilabt.jfed.lowlevel.api_wrapper.AggregateManagerWrapper;
import be.iminds.ilabt.jfed.fedmon.webapi.service.json.*;

/**
 * User: twalcari
 * Date: 6/17/2015
 * Time: 11:12
 */
public class GetVersionTask extends Task {
    private final Server auth;

    private final AggregateManagerWrapperFactory aggregateManagerWrapperFactory;

    public GetVersionTask(Server auth, AggregateManagerWrapperFactory aggregateManagerWrapperFactory) {
        super("GetVersion on " + auth.getName());
        this.auth = auth;
        this.aggregateManagerWrapperFactory = aggregateManagerWrapperFactory;
    }

    @Override
    public void doTask(TaskExecution taskExecution) throws JFedException, InterruptedException {
        AggregateManagerWrapper amWrapper =
                aggregateManagerWrapperFactory.getAggregateManagerWrapper(taskExecution, auth);
        amWrapper.getVersion();
    }

}
