package be.iminds.jfed.gts_highlevel.tasks;

import be.iminds.ilabt.jfed.highlevel.controller.Task;
import be.iminds.ilabt.jfed.highlevel.controller.TaskExecution;
import be.iminds.ilabt.jfed.lowlevel.JFedException;
import be.iminds.jfed.gts_highlevel.controller.GtsException;

/**
 * User: twalcari
 * Date: 9/24/2015
 * Time: 15:45
 */
public abstract class GtsTask extends Task {

    public GtsTask(String name) {
        super(name);
    }

    @Override
    protected final void doTask(TaskExecution taskExecution) throws JFedException, InterruptedException {
        try {
            doGtsTask(taskExecution);
        } catch (GtsException e) {
            throw new JFedException("Encountered error while performing GTS task: " + e.getLocalizedMessage(), e);
        }
    }

    protected abstract void doGtsTask(TaskExecution taskExecution) throws GtsException;
}
