Class PLPInfo
- java.lang.Object
-
- net.ssehub.easy.producer.core.mgmt.PLPInfo
-
- All Implemented Interfaces:
IModelListener<Script>,IInstantiatorProject
- Direct Known Subclasses:
ProductLineProject
public class PLPInfo extends java.lang.Object implements IInstantiatorProject, IModelListener<Script>
Carries basic information about a product line project.- Author:
- Holger Eichelberger, El-Sharkawy
-
-
Field Summary
Fields Modifier and Type Field Description private static EASyLoggerFactory.EASyLoggerLOGGERprivate ScriptContainermainBuildScriptThe main build script, specifying how to instantiate the whole project.private MemberControllermemberControllerprivate java.lang.Stringnameprivate java.util.List<IProductLineProjectListener>plpListenersprivate java.io.FileprojectLocationprivate ReasonerConfigurationreasonerConfigprivate booleansaveDebugInformationSpecification whether further debug information should be saved.private java.lang.Stringuuidprivate ProjectContainervarModelThe individual variability model for this project.private VilExecutionThreadvilExecutor
-
Constructor Summary
Constructors Constructor Description PLPInfo(java.lang.String uuid, java.lang.String name, java.lang.String version, java.io.File location)Creates an information instance.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.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description voidabortInstantiation()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).voidaddScriptImport(ModelImport<Script> scriptImport)Adds a Script Import to the build script.voidaddVilExecutionListener(IVilExecutionListener newListener)Adds a newIVilExecutionListenerto get informed when the instantiation was finished/aborted.voidbuildScriptWasEdited()Sets the flag for saving the build script.voidclose()Closes this project, which also removes this project from theSPLsManagerand closes all editors.protected voidconfigurationPulled()Informs allIProductLineProjectListeners that the configuration was pulled.protected voidcreateMainRule()Creates a main rule inside the main build script calling the main scripts of all predecessor projects.protected ReasoningProcesscreateReasoningProcess(ReasoningOperation desiredOperation, IReasonerListener listener)Creates a reasoning process.ScriptgetBuildScript()Returns the main build script for building the project (starting point of the instantiation).java.io.FilegetConfigLocation()Returns the folder containing the EASy configuration and the variability models as a subfolder ofgetProjectLocation().ConfigurationgetConfiguration()Returns the configuration for the ivml variability model of this plp.VersiongetHighestVersion()Returns the highest Version that is available for this project.MemberControllergetMemberController()Returns the member controller.java.util.List<SemanticErrorDescription>getParsingExceptions()Returns a list ofSemanticErrorDescriptionwhich occurred while parsing the VarModel (IVML files) and the build script (VIL files).ConfigurationgetPathConfiguration()Returns the (cached) configuration for this project (in terms of aprojectFolder).java.util.List<java.io.File>getPredecessorLocations(boolean checkExisting)Returns the locations of the predecessors.ProjectgetProject()Getter for the ivml project.ProjectContainergetProjectContainer()Returns the encapsulatedProjectContainerfor thegetProject().java.lang.StringgetProjectID()Returns the unique identifier.java.io.FilegetProjectLocation()Returns the physical location of the project.java.lang.StringgetProjectName()Returns the project name.ReasonerConfigurationgetReasonerConfig()Getter for the reasoner settings.booleangetSaveDebugInformation()Specification whether further debug information should be saved.ScriptContainergetScriptContainer()Returns the encapsulatedScriptContainerfor thegetBuildScript().java.io.FilegetScriptLocation()Returns the folder containing the VIL scripts as a subfolder ofgetProjectLocation().java.util.List<java.io.File>getSuccessorLocations()Returns the locations of the successors.java.io.FilegetTemplateLocation()Returns the folder containing the VTL templates as a subfolder ofgetProjectLocation().java.lang.StringgetVersion()Returns the version of the project.booleanhasDefaultMainBuildScript()Returns whether the default main build script exists (also without having loaded it).private voidinitModels()This method is needed inside the constructors for constructing needed legacy models and model managers, like MemberController, InstantiatorController, ...voidinstantiate()Deprecated.Useinstantiate(ProgressObserver)instead.voidinstantiate(ProgressObserver observer)Instantiates the whole project in a separate thread (asynchronous behavior).voidinstantiate(ProgressObserver observer, boolean waitFor)Instantiates the whole project in a separate thread.booleanisPreliminary()Returns whether this is a preliminary information object or a specialized.booleanisSaveable()Checks whether the models and can be saved, or if a dummy was used to avoidNullPointerExceptions.protected booleanisTransformableVIL()Checks whether VIL instantiation should be possible.java.util.List<ModelInfo<Project>>listAvailableModels()Returns a list with all models that are available within this project.voidnotifyReplaced(Script oldModel, Script newModel)Is called to notify thatoldModelis replaced bynewModel.voidpullConfigFromPredecessors()This method copies the variability model, configuration, and build scripts/templates from the predecessors to this project..voidreason(ReasoningOperation desiredOperation, IReasonerListener listener)Starts the reasoning.voidrefresh()Reloads all models (variability model(s), build script(s), template(s)) and refreshes loaded files and folders.voidregister(IProductLineProjectListener listener)Registers a newIProductLineProjectListenerto this project.voidremoveVilExecutionListener(IVilExecutionListener oldListener)Removes anIVilExecutionListener.voidsave()Saves the data of this project persistently to file system.protected voidsetBuildScript(ScriptContainer mainBuildScript)Setter for the main build script.voidsetMainModel(ModelInfo<Project> newMainModel)Sets a model as the "main" model of the project.protected voidsetProject(ProjectContainer project)This method is for an initial setting of the variability model.voidsetReasonerConfig(ReasonerConfiguration reasonerConfig)Setter for the reasoner configuration settings.voidsetSaveDebugInformation(boolean saveDebugInformation)Specification whether further debug information should be saved.java.lang.StringtoString()Overrides the toString method from super class Object.
This is done for debugging.voidunregister(IProductLineProjectListener listener)Unregisters aIProductLineProjectListenerfrom this project.
-
-
-
Field Detail
-
LOGGER
private static final 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.
-
memberController
private MemberController memberController
-
plpListeners
private java.util.List<IProductLineProjectListener> plpListeners
-
reasonerConfig
private 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).
-
vilExecutor
private VilExecutionThread vilExecutor
-
-
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 duringPersistenceUtils.loadRootPLPInfo( net.ssehub.easy.producer.core.persistence.datatypes.PathEnvironment, String, File). Please note, that noProjectand noScriptwill be created/loaded by using this constructor.- Parameters:
uuid- the unique identifiername- the name of the projectversion- the version of the 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)
-
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 duringPersistenceUtils.loadRootPLPInfo( net.ssehub.easy.producer.core.persistence.datatypes.PathEnvironment, String, File). Please note, that noProjectand noScriptwill be created/loaded by using this constructor.- Parameters:
uuid- the unique identifiername- the name of the projectversion- the version of the projectconfigLocation- the physical location of the configuration fileprojectLocation- 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:
getProjectIDin interfaceIInstantiatorProject- Returns:
- the unique identifier
-
getProjectName
public java.lang.String getProjectName()
Returns the project name.- Specified by:
getProjectNamein interfaceIInstantiatorProject- 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(ModelInfo<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:
getProjectLocationin interfaceIInstantiatorProject- 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 ReasonerConfiguration getReasonerConfig()
Getter for the reasoner settings.- Returns:
- The reasoner configuration.
-
setReasonerConfig
public void setReasonerConfig(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 ofgetProjectLocation().- Specified by:
getConfigLocationin interfaceIInstantiatorProject- 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 aprojectFolder).- Returns:
- the configuration of the project
-
getScriptLocation
public java.io.File getScriptLocation()
Returns the folder containing the VIL scripts as a subfolder ofgetProjectLocation().- Returns:
- the folder containing the VIL scripts
-
getTemplateLocation
public java.io.File getTemplateLocation()
Returns the folder containing the VTL templates as a subfolder ofgetProjectLocation().- 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 Project getProject()
Getter for the ivml project.- Returns:
- Returns the complete variability model for this project.
-
getConfiguration
public Configuration getConfiguration()
Returns the configuration for the ivml variability model of this plp.- Specified by:
getConfigurationin interfaceIInstantiatorProject- 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)
Description copied from interface:IInstantiatorProjectReturns the locations of the predecessors.- Specified by:
getPredecessorLocationsin interfaceIInstantiatorProject- Parameters:
checkExisting- return only real locations, i.e., not virtuals that may point into the classpath- Returns:
- the locations of the predecessors
-
getSuccessorLocations
public java.util.List<java.io.File> getSuccessorLocations()
Description copied from interface:IInstantiatorProjectReturns the locations of the successors.- Specified by:
getSuccessorLocationsin interfaceIInstantiatorProject- Returns:
- the locations of the successors
-
getBuildScript
public 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:
trueif the default main build script exists,falseelse
-
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.Useinstantiate(ProgressObserver)instead.Instantiates the whole project in a separate thread.
-
instantiate
public void instantiate(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 nullProgressObserver.NO_OBSERVERwill be used).- See Also:
instantiate(ProgressObserver, boolean),abortInstantiation()
-
instantiate
public void instantiate(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 nullProgressObserver.NO_OBSERVERwill 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)
-
addVilExecutionListener
public void addVilExecutionListener(IVilExecutionListener newListener)
Adds a newIVilExecutionListenerto get informed when the instantiation was finished/aborted.- Parameters:
newListener- The listener to be informed about the VIL execution.- See Also:
removeVilExecutionListener(IVilExecutionListener)
-
removeVilExecutionListener
public void removeVilExecutionListener(IVilExecutionListener oldListener)
Removes anIVilExecutionListener.- Parameters:
oldListener- The old listener, to be removed.- See Also:
addVilExecutionListener(IVilExecutionListener)
-
register
public void register(IProductLineProjectListener listener)
Registers a newIProductLineProjectListenerto this project.- Parameters:
listener- The listener which will be informed in case of changes.
-
unregister
public void unregister(IProductLineProjectListener listener)
Unregisters aIProductLineProjectListenerfrom this project.- Parameters:
listener- the listener which shall be removed.
-
configurationPulled
protected final void configurationPulled()
Informs allIProductLineProjectListeners that the configuration was pulled.
-
close
public void close()
Closes this project, which also removes this project from theSPLsManagerand closes all editors. This method shall be called if the related EASy/IProject will be removed/closed.
-
notifyReplaced
public void notifyReplaced(Script oldModel, Script newModel)
Description copied from interface:IModelListenerIs called to notify thatoldModelis replaced bynewModel. The listener registrations foroldModelwill be adjusted accordingly.
Do not modify the the listeners ofoldModelornewModelduring this method.- Specified by:
notifyReplacedin interfaceIModelListener<Script>- Parameters:
oldModel- the old model being replacednewModel- the new model (the replacement)
-
reason
public void reason(ReasoningOperation desiredOperation, 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 ReasoningProcess createReasoningProcess(ReasoningOperation desiredOperation, 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
ReasoningProcesswhich 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:
toStringin classjava.lang.Object- Returns:
- The name of the current project.
-
listAvailableModels
public java.util.List<ModelInfo<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 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 avoidNullPointerExceptions.- Returns:
- true if loaded models are used and can be saved, false if at least one dummy was used, which should not be saved.
-
save
public void save() throws PersistenceExceptionSaves the data of this project persistently to file system.- Throws:
PersistenceException- If files cannot be written to the file system.
-
getParsingExceptions
public java.util.List<SemanticErrorDescription> getParsingExceptions()
Returns a list ofSemanticErrorDescriptionwhich 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:
trueif instantiation should be possible,falseelse
-
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(ModelImport<Script> scriptImport)
Adds a Script Import to the build script. This method should be used instead during this viagetBuildScript()andAbstractResolvableModel.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 mainScriptof 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.
-
getProjectContainer
public ProjectContainer getProjectContainer()
Returns the encapsulatedProjectContainerfor thegetProject(). This method should only be needed by the Persistencers.- Returns:
- The
ProjectContainerfor the variability model.
-
getScriptContainer
public ScriptContainer getScriptContainer()
Returns the encapsulatedScriptContainerfor thegetBuildScript(). This method should only be needed by the Persistencers.- Returns:
- The
ScriptContainerfor build script.
-
isPreliminary
public boolean isPreliminary()
Returns whether this is a preliminary information object or a specialized.- Returns:
trueif it is preliminary, i.e., directly from this class,falseif it is from a subclass
-
-