All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.btrplace.plan.ReconfigurationPlan Maven / Gradle / Ivy

/*
 * Copyright  2020 The BtrPlace Authors. All rights reserved.
 * Use of this source code is governed by a LGPL-style
 * license that can be found in the LICENSE.txt file.
 */

package org.btrplace.plan;

import org.btrplace.model.Model;
import org.btrplace.plan.event.Action;

import java.util.Set;

/**
 * A reconfiguration plan is a set of actions to execute
 * to reconfigure an infrastructure starting from a given model.
 * 

* Actions must be sorted using a {@link TimedBasedActionComparator} that differentiate * simultaneous but not equals actions. * * @author Fabien Hermenier */ public interface ReconfigurationPlan extends Iterable { /** * Get the model that is used as a starting point * to perform the reconfiguration. * * @return the original model */ Model getOrigin(); /** * Add a new action to a plan. * * @param a the action to add * @return {@code true} iff the action has been added */ boolean add(Action a); /** * Get the number of actions in the plan. * * @return a positive integer */ int getSize(); /** * Return the theoretical duration of a reconfiguration plan. * * @return the end moment of the last executed action */ int getDuration(); /** * Get all the actions to perform. * * @return a list of actions. May be empty */ Set getActions(); /** * Get the resulting model once all the actions are executed. * * @return the resulting model or {@code null} if the plan cannot be applied */ Model getResult(); /** * Check if all the actions can be applied according * to their schedule. * In practice, it calls every {@link Action#apply(org.btrplace.model.Model)} while * respecting their ordering * * @return {@code true} iff the actions can be applied */ boolean isApplyable(); /** * Get the actions that have to be executed before * a given action. Transitive dependencies are ignored. * * @param a the action * @return a set of dependencies that may be empty. */ Set getDirectDependencies(Action a); /** * Get the applier that is used to simulate the actions application * on the starting model. * * @return the applier in use. */ ReconfigurationPlanApplier getReconfigurationApplier(); /** * Set the applier to use to simulate the actions application. * * @param ra the applier to use */ void setReconfigurationApplier(ReconfigurationPlanApplier ra); }





© 2015 - 2025 Weber Informatics LLC | Privacy Policy