package be.iminds.ilabt.jfed.highlevel.jobs.parts;

import be.iminds.ilabt.jfed.experiment.Experiment;
import be.iminds.ilabt.jfed.experiment.ExperimentPart;
import be.iminds.ilabt.jfed.experiment.ExperimentPartsContainer;
import be.iminds.ilabt.jfed.highlevel.jobs.ExperimentPartStateSlice;
import be.iminds.ilabt.jfed.highlevel.jobs.Job;
import be.iminds.ilabt.jfed.highlevel.jobs.StateSlice;

import javax.annotation.Nullable;

/**
 * User: twalcari
 * Date: 1/18/2016
 * Time: 17:52
 */
public interface NonSfaExperimentPartController<EP extends ExperimentPart, EPC extends ExperimentPartsContainer> extends ExperimentPartController<EP> {

    /**
     * This method is run right after the Slice has been created on the Slice-Authority.
     * <p/>
     * It gives non-SFA ExperimentPartControllers the chance to setup their own "experiment container" for this experiment.
     */
    @Nullable
    StateSlice initializeContainer(Job<?> job);

    /**
     * This method is run right after all experimentparts of a certain type have been deleted
     * <p/>
     * It gives non-SFA ExperimentPartControllers the chance to destroy their own "experiment container" for this experiment.
     */
    @Nullable
    StateSlice destroyContainer(Job<?> job, EPC container);

    @Nullable
    Class<EPC> getContainerClass();

    void populateExperimentParts(Experiment experiment);

    ExperimentPartStateSlice<EP> start(Job<?> job, EP experimentPart);
}
