Class AbstractIvmlModifier
java.lang.Object
de.iip_ecosphere.platform.configuration.easyProducer.ivml.AbstractIvmlModifier
- All Implemented Interfaces:
DecisionVariableProvider
- Direct Known Subclasses:
AasIvmlMapper
Maps an IVML configuration generically into an AAS.
- Author:
- Holger Eichelberger, SSE
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceSome part listening on configuration changes.protected static classStores original and copied file.private static enumGeneric IVML type indicators.private static classRepresents runtime (collected) information steering the template instantiation.private static enumInstantiation modes to enable reuse of the respective methods by separating creation and value setting so that reference substitutions can be established during creating and used/applied during setting the value.private static interfaceDefines an internal type creation function.private static classApplies substitutions and value adjustments to values. -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final net.ssehub.easy.varModel.persistency.IVMLWriter.EmitFilterprivate Map<String, GraphFormat> private IvmlGraphMapperstatic final Predicate<net.ssehub.easy.varModel.model.Project> static final Predicate<net.ssehub.easy.varModel.model.Project> -
Constructor Summary
ConstructorsConstructorDescriptionAbstractIvmlModifier(IvmlGraphMapper graphMapper, AbstractIvmlModifier.ConfigurationChangeListener changeListener) Creates a mapper with default settings. -
Method Summary
Modifier and TypeMethodDescriptionprotected net.ssehub.easy.varModel.model.ProjectadaptTarget(net.ssehub.easy.varModel.model.Project root, net.ssehub.easy.varModel.model.Project project) Allows to adapt a target IVML project, e.g., in testing context.voidaddGraphFormat(GraphFormat format) Adds a graph format.protected static voidaddImport(net.ssehub.easy.varModel.model.Project target, String imp, net.ssehub.easy.varModel.model.Project root, net.ssehub.easy.varModel.model.Project res) Adds an import statement, if needed, temporarily resolved to be able to create expressions and constraints.private voidaddNameAdjustment(net.ssehub.easy.varModel.confModel.IDecisionVariable decVar, String varName, AbstractIvmlModifier.InstantiationContext context) Adds an adjustment for the name ofdecVarif enabled by#enableNameAdjustment.voidchangeValues(Map<String, String> values) Changes a given set of values and performs reasoning before committing the values into the actual configuration.private Set<net.ssehub.easy.varModel.confModel.IDecisionVariable> collectConstants(net.ssehub.easy.varModel.confModel.Configuration cfg, net.ssehub.easy.varModel.model.Project prj) Collects constants in a given project.private voidcollectTypes(net.ssehub.easy.varModel.confModel.IDecisionVariable var, Set<net.ssehub.easy.varModel.confModel.IDecisionVariable> result) Collects types that are used in a service/connectorvar.protected static AbstractIvmlModifier.CopiedFileCopiesfileto temp iffileexists.protected net.ssehub.easy.varModel.model.ConstraintcreateAssignment(net.ssehub.easy.varModel.model.AbstractVariable varDecl, String valueEx, net.ssehub.easy.varModel.model.Project prj) Creates an assignment ofvalueExtovarDecland adds it toprj.protected net.ssehub.easy.varModel.cst.ConstraintSyntaxTreecreateExpression(net.ssehub.easy.varModel.model.datatypes.IDatatype type, String expression, net.ssehub.easy.varModel.model.Project scope) Creates an IVML expression syntax tree forexpression.protected abstract FilecreateIvmlConfigPath(String subpath, net.ssehub.easy.varModel.model.Project project) Creates an IVML configuration (not meta-model) model path withsubpathand for projectp.voidcreateVariable(String varName, String type, boolean asConst, String valueEx) Creates an IVML variable.voiddeleteVariable(String varName) Deletes an IVML variable.private net.ssehub.easy.varModel.model.datatypes.IDatatypeFinds an IVML type by also resolvingAbstractIvmlModifier.GenericTypeIndicator.Returns a graph structure in IVML.Returns the factory to use to crate graphs.protected GraphFormatgetGraphFormat(String format) Returns a graph format instance.protected abstract net.ssehub.easy.varModel.confModel.ConfigurationReturns the actual IVML configuration.protected FilegetIvmlFile(net.ssehub.easy.varModel.model.Project project) Returns the filename/path forproject.protected abstract StringgetIvmlSubpath(net.ssehub.easy.varModel.model.Project project) Returns the IVML subpath for the given project.private static de.iip_ecosphere.platform.support.logging.LoggerReturns the logger.protected IvmlGraphMapperReturns the graph mapper.private static StringReturns the oktoflow element name from a given decision variable.getOpenTemplateVariables(String varName) Returns the names of the IVML variables that still need values in the template represented by the IVML variablevarName.private static <K,V> V getOrCreate(HashMap<K, V> hash, K key, Supplier<V> creator) Gets a value fromhash, if not adds a value forkeyas created bycreator.Returns the IVML variable names representing application templates.static StringgetType(net.ssehub.easy.varModel.confModel.IDecisionVariable var) Returns the type ofvaras string.net.ssehub.easy.varModel.confModel.IDecisionVariablegetVariable(String qualifiedVarName) Returns a decision variable for a given variable name.protected net.ssehub.easy.varModel.confModel.IDecisionVariablegetVariable(net.ssehub.easy.instantiation.core.model.vilTypes.configuration.Configuration cfg, String qualifiedVarName) Returns an IVML variable.getVariableName(String type, String elementName, String elementVersion) Turns a type name and an element name into a valid IVML variable name.protected net.ssehub.easy.varModel.model.ProjectgetVariableTarget(net.ssehub.easy.varModel.model.Project root, net.ssehub.easy.varModel.model.datatypes.IDatatype type, String name, List<String> meshes) Returns the target for a variable to be created.protected abstract net.ssehub.easy.instantiation.core.model.vilTypes.configuration.ConfigurationReturns the actual VIL configuration.private voidinstantiateMeshes(Set<net.ssehub.easy.varModel.confModel.IDecisionVariable> meshes, AbstractIvmlModifier.Mode mode, AbstractIvmlModifier.InstantiationContext context) Instantiates the given meshes.Instantiates the template by the IVML variablevarNameto an application with givenappName.private net.ssehub.easy.varModel.confModel.IDecisionVariableinstantiateTemplateVariable(net.ssehub.easy.varModel.confModel.IDecisionVariable decVar, String targetType, String varName, AbstractIvmlModifier.Mode mode, AbstractIvmlModifier.InstantiationContext context) Instantiates a template application/mesh variable.private voidinstantiateVariables(Set<net.ssehub.easy.varModel.confModel.IDecisionVariable> vars, String targetPrj, AbstractIvmlModifier.InstantiationContext context) Integrates given variablesvarsintotargetPrj.protected booleanisAllowedForModification(net.ssehub.easy.varModel.model.Project prj) Returns whether the given project is allowed for modification (other than root).(package private) static booleanisValidIdentifier(String name) Limits valid identifiers.mapElementsByName(net.ssehub.easy.varModel.confModel.Configuration cfg, net.ssehub.easy.varModel.model.Project prj) Maps model elements/abstract variables by their name taken from a given project.protected voidnotifyChange(net.ssehub.easy.varModel.confModel.IDecisionVariable var, de.iip_ecosphere.platform.configuration.cfg.ConfigurationChangeType type) Notifies a potential change listener about a configuration change.protected voidnotifyChange(net.ssehub.easy.varModel.model.Project prj, de.iip_ecosphere.platform.configuration.cfg.ConfigurationChangeType type) Notifies a potential change listener about changing a whole project the same way.protected voidreloadAndValidate(Map<net.ssehub.easy.varModel.model.Project, AbstractIvmlModifier.CopiedFile> copies) Reloads the and validates the model, in case of problems, restore changed files fromcopies.protected abstract voidReloads the configuration model.protected voidremoveConstraintsForVariable(net.ssehub.easy.varModel.model.Project prj, net.ssehub.easy.varModel.model.AbstractVariable var) Removes assignment constraints for a givenvar.voidrenameVariable(String varName, String newVarName) Renames an IVML variable.protected static voidSaving model projectprjtofile.protected voidsetValue(net.ssehub.easy.varModel.confModel.IDecisionVariable var, String expression, net.ssehub.easy.varModel.cstEvaluation.EvaluationVisitor eval, net.ssehub.easy.varModel.confModel.AssignmentState state) Changes the value of the decision variablevarby parsingexpressionand evaluating it througheval.protected voidChanges the value of the variable declarationvarby parsingexpression.private voidsetValue(net.ssehub.easy.varModel.model.DecisionVariableDeclaration var, net.ssehub.easy.varModel.model.values.Value val, AbstractIvmlModifier.InstantiationContext context) Sets the configured value forvarasvalconsidering substitutions and adjustments fromcontext.protected voidthrowIfFails(net.ssehub.easy.reasoning.core.reasoner.ReasoningResult res, boolean reloadIfFail) Throws anExecutionExceptionif the reasoning resultresindicates a problem.protected static StringtoIdentifier(String str) Helper to turnstrinto a Java identifier.protected static StringHelper to turn the first char ofstrinto upper case andstrinto an identifier..protected net.ssehub.easy.reasoning.core.reasoner.ReasoningResultValidates the model and propagates values within the model.protected abstract net.ssehub.easy.reasoning.core.reasoner.ReasoningResultvalidateAndPropagate(Predicate<net.ssehub.easy.varModel.model.Project> projectFilter) Validates the model and propagates values within the model.private static voidWritesprjtoout.
-
Field Details
-
NO_PROJECT_FILTER
-
NO_TEMPLATE_FILTER
-
EMIT_FILTER
private static final net.ssehub.easy.varModel.persistency.IVMLWriter.EmitFilter EMIT_FILTER -
graphMapper
-
graphFormats
-
changeListener
-
reservedVariableNames
-
-
Constructor Details
-
AbstractIvmlModifier
public AbstractIvmlModifier(IvmlGraphMapper graphMapper, AbstractIvmlModifier.ConfigurationChangeListener changeListener) Creates a mapper with default settings.- Parameters:
graphMapper- maps a graph from IVML to an internal structurechangeListener- optional configuration change listener, may be null- Throws:
IllegalArgumentException- ifcfgSupplieris null
-
-
Method Details
-
addGraphFormat
Adds a graph format.- Parameters:
format- the format
-
getGraphFactory
Returns the factory to use to crate graphs.- Returns:
- the factory
-
saveTo
protected static void saveTo(net.ssehub.easy.varModel.model.Project prj, File file) throws ExecutionException Saving model projectprjtofile.- Parameters:
prj- the projectfile- the file to write to- Throws:
ExecutionException- if writing fails
-
write
Writesprjtoout.- Parameters:
prj- the project to writeout- the writer to write the project to
-
getIvmlSubpath
Returns the IVML subpath for the given project.- Parameters:
project- the project- Returns:
- the subpath, may be null for a top-level or a non-writable project, may be empty for the top-level folder or a sub-folder
-
createIvmlConfigPath
protected abstract File createIvmlConfigPath(String subpath, net.ssehub.easy.varModel.model.Project project) Creates an IVML configuration (not meta-model) model path withsubpathand for projectp.- Parameters:
subpath- the subpath, may be null for noneproject- the project to create the path for- Returns:
- the file name/path
- See Also:
-
getIvmlFile
Returns the filename/path forproject.- Parameters:
project- the project- Returns:
- the filename/path
- See Also:
-
isAllowedForModification
protected boolean isAllowedForModification(net.ssehub.easy.varModel.model.Project prj) Returns whether the given project is allowed for modification (other than root).- Parameters:
prj- the project- Returns:
trueallowed,falseelse- See Also:
-
deleteVariable
Deletes an IVML variable. In case of a graph, this may subsequently delete further variables. IVML reference to a variable shall be cleaned up before. Left-over references shall lead to a syntax error and to no modification of the model. [public for testing]- Parameters:
varName- the qualified IVML variable name to delete- Throws:
ExecutionException- if creating the variable fails
-
getTemplates
Returns the IVML variable names representing application templates.- Returns:
- the IVML variable names as JSON array
- Throws:
ExecutionException- if the execution of the operation fails
-
getOrCreate
Gets a value fromhash, if not adds a value forkeyas created bycreator.- Type Parameters:
K- the key typeV- the value type- Parameters:
hash- the has to query/modifykey- the key valuecreator- the creator for new values- Returns:
- the retrieved or created value
-
instantiateMeshes
private void instantiateMeshes(Set<net.ssehub.easy.varModel.confModel.IDecisionVariable> meshes, AbstractIvmlModifier.Mode mode, AbstractIvmlModifier.InstantiationContext context) throws ExecutionException, net.ssehub.easy.varModel.confModel.ConfigurationException, net.ssehub.easy.varModel.model.ModelQueryException, net.ssehub.easy.basics.modelManagement.ModelManagementException Instantiates the given meshes.- Parameters:
meshes- the meshesmode- the instantiation modecontext- the instantiation context- Throws:
ExecutionException- if setting IVML values failsnet.ssehub.easy.varModel.confModel.ConfigurationException- if setting IVML values failsnet.ssehub.easy.varModel.model.ModelQueryException- if obtaining IVML types failsnet.ssehub.easy.basics.modelManagement.ModelManagementException- if model management operations fail
-
instantiateTemplate
public String instantiateTemplate(String varName, String appName, Map<String, String> adjustments) throws ExecutionExceptionInstantiates the template by the IVML variablevarNameto an application with givenappName.- Parameters:
varName- the name of the IVML variable representing the templateappName- the (display) name of the application, may be used to derive id/variable nameadjustments- variable settings, as variable=value or variable.field=value, may be null; shall be filled with variable values fromgetOpenTemplateVariables(String), otherwise the instantiation will fail- Returns:
- the IVML variable name of the instantiated application
- Throws:
ExecutionException- if the execution of the operation fails
-
collectTypes
private void collectTypes(net.ssehub.easy.varModel.confModel.IDecisionVariable var, Set<net.ssehub.easy.varModel.confModel.IDecisionVariable> result) Collects types that are used in a service/connectorvar.- Parameters:
var- the variable to inspectresult- the types to be modified as a side effect
-
collectConstants
private Set<net.ssehub.easy.varModel.confModel.IDecisionVariable> collectConstants(net.ssehub.easy.varModel.confModel.Configuration cfg, net.ssehub.easy.varModel.model.Project prj) Collects constants in a given project.- Parameters:
cfg- the configuration to resolve decision variablesprj- the project to scan- Returns:
- the identified constants, may be empty
-
mapElementsByName
private Map<String,net.ssehub.easy.varModel.confModel.IDecisionVariable> mapElementsByName(net.ssehub.easy.varModel.confModel.Configuration cfg, net.ssehub.easy.varModel.model.Project prj) Maps model elements/abstract variables by their name taken from a given project.- Parameters:
cfg- the configuration to resolve decision variablesprj- the project to scan- Returns:
- the identified name-element mappings
-
getName
private static String getName(net.ssehub.easy.varModel.confModel.IDecisionVariable var, String dflt) Returns the oktoflow element name from a given decision variable.- Parameters:
var- the decision variabledflt- the value to take if no name is found- Returns:
- the value or
dflt
-
instantiateVariables
private void instantiateVariables(Set<net.ssehub.easy.varModel.confModel.IDecisionVariable> vars, String targetPrj, AbstractIvmlModifier.InstantiationContext context) throws net.ssehub.easy.varModel.confModel.ConfigurationException, ExecutionException Integrates given variablesvarsintotargetPrj.- Parameters:
vars- the variablestargetPrj- the target project to integrate the variables intocontext- the instantiation context, to be modified as a side effect- Throws:
net.ssehub.easy.varModel.confModel.ConfigurationException- if setting IVML values failsExecutionException- if setting IVML values fails
-
setValue
private void setValue(net.ssehub.easy.varModel.model.DecisionVariableDeclaration var, net.ssehub.easy.varModel.model.values.Value val, AbstractIvmlModifier.InstantiationContext context) throws ExecutionException Sets the configured value forvarasvalconsidering substitutions and adjustments fromcontext.- Parameters:
var- the variable to configureval- the (basic) value to setcontext- the context driving the adjustment of individual values- Throws:
ExecutionException- if setting the value fails
-
instantiateTemplateVariable
private net.ssehub.easy.varModel.confModel.IDecisionVariable instantiateTemplateVariable(net.ssehub.easy.varModel.confModel.IDecisionVariable decVar, String targetType, String varName, AbstractIvmlModifier.Mode mode, AbstractIvmlModifier.InstantiationContext context) throws net.ssehub.easy.basics.modelManagement.ModelManagementException, net.ssehub.easy.varModel.model.ModelQueryException, net.ssehub.easy.varModel.confModel.ConfigurationException, ExecutionException Instantiates a template application/mesh variable.- Parameters:
decVar- the variable representing the templatetargetType- target type of the variablevarName- the name of the variable to create/instantiate (usesAbstractIvmlModifier.InstantiationContext.currentTemplateVariableif null)context- the instantiation context, may be modified as a side effect- Returns:
- the instantiated IVML variable
- Throws:
net.ssehub.easy.basics.modelManagement.ModelManagementException- if model management operations failnet.ssehub.easy.varModel.model.ModelQueryException- if obtaining IVML types failsnet.ssehub.easy.varModel.confModel.ConfigurationException- if setting IVML values failsExecutionException- if adapting the target project fails
-
addNameAdjustment
private void addNameAdjustment(net.ssehub.easy.varModel.confModel.IDecisionVariable decVar, String varName, AbstractIvmlModifier.InstantiationContext context) Adds an adjustment for the name ofdecVarif enabled by#enableNameAdjustment.- Parameters:
decVar- the decision variable to get the value for the adjustment from. If set up,AbstractIvmlModifier.InstantiationContext.prefixVarName(String)will be applied to the value.varName- the original name of the variablecontext- the context to modify
-
getOpenTemplateVariables
Returns the names of the IVML variables that still need values in the template represented by the IVML variablevarName.- Parameters:
varName- the name of the IVML variable representing the template- Returns:
- the open variables as JSON array
- Throws:
ExecutionException- if the execution of the operation fails
-
throwIfFails
protected void throwIfFails(net.ssehub.easy.reasoning.core.reasoner.ReasoningResult res, boolean reloadIfFail) throws ExecutionException Throws anExecutionExceptionif the reasoning resultresindicates a problem.- Parameters:
res- the reasoning resultreloadIfFail- reload the model if there is a failure- Throws:
ExecutionException- the exception if reasoning failed
-
removeConstraintsForVariable
protected void removeConstraintsForVariable(net.ssehub.easy.varModel.model.Project prj, net.ssehub.easy.varModel.model.AbstractVariable var) Removes assignment constraints for a givenvar.- Parameters:
prj- the project to start searching for constraints withinvar- the variable to remove constraints for
-
getVariableTarget
protected net.ssehub.easy.varModel.model.Project getVariableTarget(net.ssehub.easy.varModel.model.Project root, net.ssehub.easy.varModel.model.datatypes.IDatatype type, String name, List<String> meshes) throws ExecutionException Returns the target for a variable to be created.- Parameters:
root- the root project (may be used as default)type- the actual type of the variable to be created, may be null then anyway no variable will be createdname- optional name if the name may influence the target, may be nullmeshes- mesh project names in case of an application project, else ignored; may be null- Returns:
- the target project
- Throws:
ExecutionException- if model management operations fail- See Also:
-
adaptTarget
protected net.ssehub.easy.varModel.model.Project adaptTarget(net.ssehub.easy.varModel.model.Project root, net.ssehub.easy.varModel.model.Project project) throws ExecutionException Allows to adapt a target IVML project, e.g., in testing context.- Parameters:
root- the root project (for type resolution)project- the project to be adapted- Returns:
- the adapted project
- Throws:
ExecutionException- if adapting fails
-
isValidIdentifier
Limits valid identifiers.- Parameters:
name- the name- Returns:
truefor valid identifier,falseelse
-
getVariableName
Turns a type name and an element name into a valid IVML variable name. Potentially adds a number.- Parameters:
type- the IVML type name to use, may but shall not contain whitespaces an non-identifier characterselementName- the element name to use, may contain whitespaces an non-identifier characterselementVersion- the element version to use, may contain whitespaces an non-identifier characters- Returns:
- the usable variable name
-
renameVariable
Renames an IVML variable. [public for testing]- Parameters:
varName- the IVML variable namenewVarName- the new IVML variable name- Throws:
ExecutionException- if creating the variable fails
-
createVariable
public void createVariable(String varName, String type, boolean asConst, String valueEx) throws ExecutionException Creates an IVML variable. [public for testing]- Parameters:
varName- the IVML variable nametype- the (qualified) IVML typevalueEx- the value as IVML expression- Throws:
ExecutionException- if creating the variable fails
-
findType
private net.ssehub.easy.varModel.model.datatypes.IDatatype findType(net.ssehub.easy.varModel.model.Project scope, String type) throws net.ssehub.easy.varModel.model.ModelQueryException Finds an IVML type by also resolvingAbstractIvmlModifier.GenericTypeIndicator.- Parameters:
scope- the scopetype- the type as string- Returns:
- the found type
- Throws:
net.ssehub.easy.varModel.model.ModelQueryException- if finding the type fails
-
changeValues
Changes a given set of values and performs reasoning before committing the values into the actual configuration. For compounds/containers it is advisable to assign complete values to avoid illegal re-assignments. [public for testing]- Parameters:
values- the values, given as qualified IVML variables names mapped to serialized values- Throws:
ExecutionException- if changing values fails
-
setValue
protected void setValue(net.ssehub.easy.varModel.confModel.IDecisionVariable var, String expression, net.ssehub.easy.varModel.cstEvaluation.EvaluationVisitor eval, net.ssehub.easy.varModel.confModel.AssignmentState state) throws ExecutionException Changes the value of the decision variablevarby parsingexpressionand evaluating it througheval.- Parameters:
var- the variable to change, may be a top-level variable andexpressionmay be a compound value expressionexpression- the IVML expressioneval- the expression evaluator to reuse, may be null to create a temporary one withinstate- the assignment state to apply- Throws:
ExecutionException- if parsing, evaluating or assigning fails
-
createExpression
protected net.ssehub.easy.varModel.cst.ConstraintSyntaxTree createExpression(net.ssehub.easy.varModel.model.datatypes.IDatatype type, String expression, net.ssehub.easy.varModel.model.Project scope) throws ExecutionException Creates an IVML expression syntax tree forexpression.- Parameters:
type- the target type, may be null for noneexpression- the expressionscope- the resolution scope, may be null for the root project- Returns:
- the syntax tree
- Throws:
ExecutionException- if the expression cannot be created, e.g., due to syntactic or semantic errors
-
createAssignment
protected net.ssehub.easy.varModel.model.Constraint createAssignment(net.ssehub.easy.varModel.model.AbstractVariable varDecl, String valueEx, net.ssehub.easy.varModel.model.Project prj) throws ExecutionException Creates an assignment ofvalueExtovarDecland adds it toprj.- Parameters:
varDecl- the variable declarationvalueEx- the IVML value expressionprj- the project to add the constraint to- Returns:
- the created constraint
- Throws:
ExecutionException- if creating the constraint fails
-
setValue
protected void setValue(net.ssehub.easy.varModel.model.AbstractVariable var, String expression) throws ExecutionException Changes the value of the variable declarationvarby parsingexpression.- Parameters:
var- the variable to change, may be a top-level variable andexpressionmay be a compound value expressionexpression- the IVML expression- Throws:
ExecutionException- if parsing, evaluating or assigning fails
-
copyToTmp
Copiesfileto temp iffileexists.- Parameters:
file- the file to copy- Returns:
- the copied file, else null
- Throws:
ExecutionException- if copying failed
-
reloadAndValidate
protected void reloadAndValidate(Map<net.ssehub.easy.varModel.model.Project, AbstractIvmlModifier.CopiedFile> copies) throws ExecutionExceptionReloads the and validates the model, in case of problems, restore changed files fromcopies.- Parameters:
copies- copied files to be restored- Throws:
ExecutionException- if reasoning/restoring fails
-
getGraph
Returns a graph structure in IVML. [public for testing]- Parameters:
varName- the IVML variable holding the graphformat- the format of the graph to return- Returns:
- the graph in the specified
format - Throws:
ExecutionException- if reading the graph structure fails
-
getGraphFormat
Returns a graph format instance.- Parameters:
format- the unique name of the graph format- Returns:
- the graph format instance
- Throws:
ExecutionException- if the format instance cannot be found
-
getMapper
Returns the graph mapper.- Returns:
- the graph mapper
-
getVariable
public net.ssehub.easy.varModel.confModel.IDecisionVariable getVariable(String qualifiedVarName) throws ExecutionException Description copied from interface:DecisionVariableProviderReturns a decision variable for a given variable name.- Specified by:
getVariablein interfaceDecisionVariableProvider- Parameters:
qualifiedVarName- the variable name- Returns:
- the associated decision variable, may be null for node
- Throws:
ExecutionException- if retrieving the node fails
-
getVariable
protected net.ssehub.easy.varModel.confModel.IDecisionVariable getVariable(net.ssehub.easy.instantiation.core.model.vilTypes.configuration.Configuration cfg, String qualifiedVarName) throws ExecutionException Returns an IVML variable.- Parameters:
cfg- the configuration to take the variable fromqualifiedVarName- the (qualified) variable name- Returns:
- the variable
- Throws:
ExecutionException- if querying the variable fails
-
addImport
protected static void addImport(net.ssehub.easy.varModel.model.Project target, String imp, net.ssehub.easy.varModel.model.Project root, net.ssehub.easy.varModel.model.Project res) throws net.ssehub.easy.basics.modelManagement.ModelManagementException Adds an import statement, if needed, temporarily resolved to be able to create expressions and constraints.- Parameters:
target- the target project where to add the import toimp- the imported name, may be a wildcardroot- the root project where to resolve projects fromres- already resolved project, takes precedence over resolvingimpfromroot; use to temporarily resolve wildcard imports with one concrete project- Throws:
net.ssehub.easy.basics.modelManagement.ModelManagementException- if resolving/setting the resolved project fails
-
toIdentifierFirstUpper
Helper to turn the first char ofstrinto upper case andstrinto an identifier..- Parameters:
str- the string- Returns:
- the identifier
-
toIdentifier
Helper to turnstrinto a Java identifier.- Parameters:
str- the text- Returns:
- the identifier
-
getVilConfiguration
protected abstract net.ssehub.easy.instantiation.core.model.vilTypes.configuration.Configuration getVilConfiguration()Returns the actual VIL configuration. Shall be consistent withgetIvmlConfiguration().- Returns:
- the configuration
-
getIvmlConfiguration
protected abstract net.ssehub.easy.varModel.confModel.Configuration getIvmlConfiguration()Returns the actual IVML configuration. Shall be consistent withgetVilConfiguration().- Returns:
- the configuration
-
validateAndPropagate
protected net.ssehub.easy.reasoning.core.reasoner.ReasoningResult validateAndPropagate()Validates the model and propagates values within the model.- Returns:
- the reasoning result
-
validateAndPropagate
protected abstract net.ssehub.easy.reasoning.core.reasoner.ReasoningResult validateAndPropagate(Predicate<net.ssehub.easy.varModel.model.Project> projectFilter) Validates the model and propagates values within the model.- Parameters:
projectFilter- optional filter on projects to reason on, may be null- Returns:
- the reasoning result
-
reloadConfiguration
protected abstract void reloadConfiguration()Reloads the configuration model. -
notifyChange
protected void notifyChange(net.ssehub.easy.varModel.confModel.IDecisionVariable var, de.iip_ecosphere.platform.configuration.cfg.ConfigurationChangeType type) Notifies a potential change listener about a configuration change.- Parameters:
var- the variable (may not be part of any configuration anymore)type- the change type
-
notifyChange
protected void notifyChange(net.ssehub.easy.varModel.model.Project prj, de.iip_ecosphere.platform.configuration.cfg.ConfigurationChangeType type) Notifies a potential change listener about changing a whole project the same way.- Parameters:
prj- the projecttype- the change type
-
getType
Returns the type ofvaras string.- Parameters:
var- the variable- Returns:
- the type
-
getLogger
private static de.iip_ecosphere.platform.support.logging.Logger getLogger()Returns the logger.- Returns:
- the logger
-