Class PLPInfo

  • All Implemented Interfaces:
    net.ssehub.easy.basics.modelManagement.IModelListener<net.ssehub.easy.instantiation.core.model.buildlangModel.Script>, net.ssehub.easy.instantiation.core.model.IInstantiatorProject

    public class PLPInfo
    extends java.lang.Object
    implements net.ssehub.easy.instantiation.core.model.IInstantiatorProject, net.ssehub.easy.basics.modelManagement.IModelListener<net.ssehub.easy.instantiation.core.model.buildlangModel.Script>
    Carries basic information about a product line project.
    Author:
    Holger Eichelberger, El-Sharkawy
    • Field Detail

      • LOGGER

        private static final net.ssehub.easy.basics.logger.EASyLoggerFactory.EASyLogger LOGGER
      • uuid

        private java.lang.String uuid
      • name

        private java.lang.String name
      • projectLocation

        private java.io.File projectLocation
      • varModel

        private ProjectContainer varModel
        The individual variability model for this project.
      • mainBuildScript

        private ScriptContainer mainBuildScript
        The main build script, specifying how to instantiate the whole project.
      • reasonerConfig

        private net.ssehub.easy.reasoning.core.reasoner.ReasonerConfiguration reasonerConfig
      • saveDebugInformation

        private boolean saveDebugInformation
        Specification whether further debug information should be saved.
        • true: Debug information will be saved.
        • false: Debug information will not be saved (default value).
    • Constructor Detail

      • PLPInfo

        public PLPInfo​(java.lang.String uuid,
                       java.lang.String name,
                       java.lang.String version,
                       java.io.File location)
        Creates an information instance. This constructor is used during PersistenceUtils.loadRootPLPInfo( net.ssehub.easy.producer.core.persistence.datatypes.PathEnvironment, String, File). Please note, that no Project and no Script will be created/loaded by using this constructor.
        Parameters:
        uuid - the unique identifier
        name - the name of the project
        version - the version of the project
        location - the physical location of the PLP (may be null, shall not be null in case of archived PLPs such as ones in JAR files)
      • PLPInfo

        public PLPInfo​(java.lang.String uuid,
                       java.lang.String name,
                       java.lang.String version,
                       java.io.File configLocation,
                       java.io.File projectLocation)
        Creates an information instance. This constructor is used during PersistenceUtils.loadRootPLPInfo( net.ssehub.easy.producer.core.persistence.datatypes.PathEnvironment, String, File). Please note, that no Project and no Script will be created/loaded by using this constructor.
        Parameters:
        uuid - the unique identifier
        name - the name of the project
        version - the version of the project
        configLocation - the physical location of the configuration file
        projectLocation - the physical location of the PLP (may be null, shall not be null in case of archived PLPs such as ones in JAR files)
    • Method Detail

      • getSaveDebugInformation

        public boolean getSaveDebugInformation()
        Specification whether further debug information should be saved.
        Returns:
        • true: Debug information will be saved.
        • false: Debug information will not be saved (default value).
      • setSaveDebugInformation

        public void setSaveDebugInformation​(boolean saveDebugInformation)
        Specification whether further debug information should be saved.
        Parameters:
        saveDebugInformation -
        • true: Debug information will be saved.
        • false: Debug information will not be saved.
      • getProjectID

        public java.lang.String getProjectID()
        Returns the unique identifier.
        Specified by:
        getProjectID in interface net.ssehub.easy.instantiation.core.model.IInstantiatorProject
        Returns:
        the unique identifier
      • getProjectName

        public java.lang.String getProjectName()
        Returns the project name.
        Specified by:
        getProjectName in interface net.ssehub.easy.instantiation.core.model.IInstantiatorProject
        Returns:
        the name of the project
      • getVersion

        public java.lang.String getVersion()
        Returns the version of the project.
        Returns:
        the version (may be null)
      • setMainModel

        public void setMainModel​(net.ssehub.easy.basics.modelManagement.ModelInfo<net.ssehub.easy.varModel.model.Project> newMainModel)
        Sets a model as the "main" model of the project.
        Parameters:
        newMainModel - The model that is to be set as the main model.
      • getProjectLocation

        public java.io.File getProjectLocation()
        Returns the physical location of the project.
        Specified by:
        getProjectLocation in interface net.ssehub.easy.instantiation.core.model.IInstantiatorProject
        Returns:
        the physical location (may be null)
      • refresh

        public void refresh()
        Reloads all models (variability model(s), build script(s), template(s)) and refreshes loaded files and folders.
      • getReasonerConfig

        public net.ssehub.easy.reasoning.core.reasoner.ReasonerConfiguration getReasonerConfig()
        Getter for the reasoner settings.
        Returns:
        The reasoner configuration.
      • setReasonerConfig

        public void setReasonerConfig​(net.ssehub.easy.reasoning.core.reasoner.ReasonerConfiguration reasonerConfig)
        Setter for the reasoner configuration settings.
        Parameters:
        reasonerConfig - The configuration of the reasoners for this project.
      • getConfigLocation

        public java.io.File getConfigLocation()
        Returns the folder containing the EASy configuration and the variability models as a subfolder of getProjectLocation().
        Specified by:
        getConfigLocation in interface net.ssehub.easy.instantiation.core.model.IInstantiatorProject
        Returns:
        the folder containing the EASy configuration and the variability model
      • getPathConfiguration

        public Configuration getPathConfiguration()
        Returns the (cached) configuration for this project (in terms of a projectFolder).
        Returns:
        the configuration of the project
      • getScriptLocation

        public java.io.File getScriptLocation()
        Returns the folder containing the VIL scripts as a subfolder of getProjectLocation().
        Returns:
        the folder containing the VIL scripts
      • getTemplateLocation

        public java.io.File getTemplateLocation()
        Returns the folder containing the VTL templates as a subfolder of getProjectLocation().
        Returns:
        the folder containing the VTL templates.
      • setProject

        protected void setProject​(ProjectContainer project)
        This method is for an initial setting of the variability model. This method also sets a project listener for this variability model to the varmodel class for getting informed in case that the project is replaced by a new one.
        Parameters:
        project - The variability model for this project.
      • getProject

        public net.ssehub.easy.varModel.model.Project getProject()
        Getter for the ivml project.
        Returns:
        Returns the complete variability model for this project.
      • getConfiguration

        public net.ssehub.easy.varModel.confModel.Configuration getConfiguration()
        Returns the configuration for the ivml variability model of this plp.
        Specified by:
        getConfiguration in interface net.ssehub.easy.instantiation.core.model.IInstantiatorProject
        Returns:
        the configuration for the ivml project.
        See Also:
        getProject()
      • initModels

        private void initModels()
        This method is needed inside the constructors for constructing needed legacy models and model managers, like MemberController, InstantiatorController, ...
      • getMemberController

        public MemberController getMemberController()
        Returns the member controller.
        Returns:
        the memberController
      • getPredecessorLocations

        public java.util.List<java.io.File> getPredecessorLocations​(boolean checkExisting)
        Specified by:
        getPredecessorLocations in interface net.ssehub.easy.instantiation.core.model.IInstantiatorProject
      • getSuccessorLocations

        public java.util.List<java.io.File> getSuccessorLocations()
        Specified by:
        getSuccessorLocations in interface net.ssehub.easy.instantiation.core.model.IInstantiatorProject
      • getBuildScript

        public net.ssehub.easy.instantiation.core.model.buildlangModel.Script getBuildScript()
        Returns the main build script for building the project (starting point of the instantiation).
        Returns:
        The main build script for building the project (starting point of the instantiation).
      • hasDefaultMainBuildScript

        public boolean hasDefaultMainBuildScript()
        Returns whether the default main build script exists (also without having loaded it).
        Returns:
        true if the default main build script exists, false else
      • createMainRule

        protected void createMainRule()
        Creates a main rule inside the main build script calling the main scripts of all predecessor projects. If no main script exists, a main script is created.
      • setBuildScript

        protected void setBuildScript​(ScriptContainer mainBuildScript)
        Setter for the main build script.
        Parameters:
        mainBuildScript - A script specifying how to instantiate the whole project.
      • instantiate

        @Deprecated
        public void instantiate()
        Deprecated.
        Instantiates the whole project in a separate thread.
      • instantiate

        public void instantiate​(net.ssehub.easy.basics.progress.ProgressObserver observer)
        Instantiates the whole project in a separate thread (asynchronous behavior).
        Parameters:
        observer - The observer to inform about the current progress (in case of null ProgressObserver.NO_OBSERVER will be used).
        See Also:
        instantiate(ProgressObserver, boolean), abortInstantiation()
      • instantiate

        public void instantiate​(net.ssehub.easy.basics.progress.ProgressObserver observer,
                                boolean waitFor)
        Instantiates the whole project in a separate thread.
        Parameters:
        observer - The observer to inform about the current progress (in case of null ProgressObserver.NO_OBSERVER will be used).
        waitFor - true This method will wait until the script was processed completely (blocking method), false script will be processed in an asynchronous manner (usually used in an GUI environment).
        See Also:
        instantiate(ProgressObserver), abortInstantiation()
      • abortInstantiation

        public void abortInstantiation()
        Aborts the current execution of the VIL script at the next possible point (that is not any time possible, e.g., during the execution of third party tools like embedded maven scripts).
        See Also:
        instantiate(ProgressObserver)
      • configurationPulled

        protected final void configurationPulled()
        Informs all IProductLineProjectListeners that the configuration was pulled.
      • close

        public void close()
        Closes this project, which also removes this project from the SPLsManager and closes all editors. This method shall be called if the related EASy/IProject will be removed/closed.
      • notifyReplaced

        public void notifyReplaced​(net.ssehub.easy.instantiation.core.model.buildlangModel.Script oldModel,
                                   net.ssehub.easy.instantiation.core.model.buildlangModel.Script newModel)
        Specified by:
        notifyReplaced in interface net.ssehub.easy.basics.modelManagement.IModelListener<net.ssehub.easy.instantiation.core.model.buildlangModel.Script>
      • reason

        public void reason​(net.ssehub.easy.reasoning.core.reasoner.ReasoningOperation desiredOperation,
                           net.ssehub.easy.reasoning.core.frontend.IReasonerListener listener)
        Starts the reasoning.
        Parameters:
        desiredOperation - Specifies which reasoning operation should be performed.
        listener - listener A listener which will be called after the reasoning has been finished. Can be null, if no action shall be executed after the reasoning is finished.
      • createReasoningProcess

        protected final net.ssehub.easy.reasoning.core.frontend.ReasoningProcess createReasoningProcess​(net.ssehub.easy.reasoning.core.reasoner.ReasoningOperation desiredOperation,
                                                                                                        net.ssehub.easy.reasoning.core.frontend.IReasonerListener listener)
        Creates a reasoning process.
        Parameters:
        desiredOperation - Specifies which reasoning operation should be performed.
        listener - listener A listener which will be called after the reasoning has been finished. Can be null, if no action shall be executed after the reasoning is finished.
        Returns:
        A ReasoningProcess which can be used for reasoning (cf. ReasoningProcess.run()).
      • toString

        public java.lang.String toString()
        Overrides the toString method from super class Object.
        This is done for debugging.
        Overrides:
        toString in class java.lang.Object
        Returns:
        The name of the current project.
      • listAvailableModels

        public java.util.List<net.ssehub.easy.basics.modelManagement.ModelInfo<net.ssehub.easy.varModel.model.Project>> listAvailableModels()
        Returns a list with all models that are available within this project.
        Returns:
        A list with all models of this project.
      • getHighestVersion

        public net.ssehub.easy.basics.modelManagement.Version getHighestVersion()
        Returns the highest Version that is available for this project.
        Returns:
        The highest version that exists within all models of this project (null if no model exists).
      • isSaveable

        public boolean isSaveable()
        Checks whether the models and can be saved, or if a dummy was used to avoid NullPointerExceptions.
        Returns:
        true if loaded models are used and can be saved, false if at least one dummy was used, which should not be saved.
      • getParsingExceptions

        public java.util.List<SemanticErrorDescription> getParsingExceptions()
        Returns a list of SemanticErrorDescription which occurred while parsing the VarModel (IVML files) and the build script (VIL files).
        Returns:
        a list of parsing errors. Should be empty iff no semantic errors exist inside the files.
      • isTransformableVIL

        protected final boolean isTransformableVIL()
        Checks whether VIL instantiation should be possible. Currently, we check whether there is a start rule (main-rule matching the script parameters) which either has a body or some kind of precondition or some kind of postcondition.
        Returns:
        true if instantiation should be possible, false else
      • pullConfigFromPredecessors

        public void pullConfigFromPredecessors()
        This method copies the variability model, configuration, and build scripts/templates from the predecessors to this project..
        Throws:
        VarModelConflictException
      • addScriptImport

        public void addScriptImport​(net.ssehub.easy.basics.modelManagement.ModelImport<net.ssehub.easy.instantiation.core.model.buildlangModel.Script> scriptImport)
        Adds a Script Import to the build script. This method should be used instead during this via getBuildScript() and AbstractResolvableModel.addImport(ModelImport). This will ensure that the included import will also be saved, when this plp is saved.
        Parameters:
        scriptImport - A import which shall be added to the main Script of this project.
      • buildScriptWasEdited

        public void buildScriptWasEdited()
        Sets the flag for saving the build script. This should be called whenever the build script was modified via EASy and the changes should be saved when this plp is saved. If this flag was not set, all the (changed) build script will not be saved.
      • isPreliminary

        public boolean isPreliminary()
        Returns whether this is a preliminary information object or a specialized.
        Returns:
        true if it is preliminary, i.e., directly from this class, false if it is from a subclass