Class AasIvmlMapper
- java.lang.Object
-
- de.iip_ecosphere.platform.configuration.ivml.AbstractIvmlModifier
-
- de.iip_ecosphere.platform.configuration.ivml.AasIvmlMapper
-
- All Implemented Interfaces:
DecisionVariableProvider
public class AasIvmlMapper extends AbstractIvmlModifier
Maps an IVML configuration generically into an AAS with references to IIP-Ecosphere.- Author:
- Holger Eichelberger, SSE
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classAasIvmlMapper.AasChangeRecords an AAS change.private static classAasIvmlMapper.InstantiationModeInstantiation modes.protected static classAasIvmlMapper.ModelResultsStores intermediary model creation results.private static classAasIvmlMapper.ServiceMapA "map" holding names/id to service mappings.-
Nested classes/interfaces inherited from class de.iip_ecosphere.platform.configuration.ivml.AbstractIvmlModifier
AbstractIvmlModifier.ConfigurationChangeListener, AbstractIvmlModifier.ConfigurationChangeType, AbstractIvmlModifier.CopiedFile
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.function.Supplier<net.ssehub.easy.instantiation.core.model.vilTypes.configuration.Configuration>cfgSupplierstatic java.util.function.Predicate<net.ssehub.easy.varModel.model.AbstractVariable>FILTER_NO_CONSTRAINT_VARIABLESstatic java.lang.StringMETA_TYPE_NAMEprivate java.util.function.Function<java.lang.String,java.lang.String>metaShortIdstatic java.lang.StringOP_CHANGE_VALUESstatic java.lang.StringOP_CREATE_VARIABLEstatic java.lang.StringOP_DELETE_GRAPHstatic java.lang.StringOP_DELETE_VARIABLEstatic java.lang.StringOP_GEN_APPSstatic java.lang.StringOP_GEN_APPS_NO_DEPSstatic java.lang.StringOP_GEN_INTERFACESstatic java.lang.StringOP_GET_GRAPHstatic java.lang.StringOP_SET_GRAPHprivate static java.util.Map<java.lang.String,java.lang.String>PARENT_MAPPINGprotected static java.lang.StringPRJ_NAME_ALLCONSTANTSprotected static java.lang.StringPRJ_NAME_ALLSERVICESprotected static java.lang.StringPRJ_NAME_ALLTYPESprotected static java.lang.StringPRJ_NAME_TECHSETUPprivate static java.lang.StringPROGRESS_COMPONENT_IDprivate static java.util.Map<java.lang.String,java.lang.String>PROJECT_MAPPINGstatic java.util.function.Function<java.lang.String,java.lang.String>SHORTID_PREFIX_METAprivate static TypeVisitorTYPE_VISITORprivate java.util.Map<java.lang.String,de.iip_ecosphere.platform.support.aas.SubmodelElementCollection.SubmodelElementCollectionBuilder>typesprivate java.util.function.Predicate<net.ssehub.easy.varModel.model.AbstractVariable>variableFilter
-
Constructor Summary
Constructors Constructor Description AasIvmlMapper(java.util.function.Supplier<net.ssehub.easy.instantiation.core.model.vilTypes.configuration.Configuration> cfgSupplier, IvmlGraphMapper graphMapper, AbstractIvmlModifier.ConfigurationChangeListener changeListener)Creates a mapper with default settings, e.g., short ids for meta IVML information are prefixed by "meta" (SHORTID_PREFIX_META) and the variable filter excludes all IVML constraint variables (FILTER_NO_CONSTRAINT_VARIABLES).
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private voidaddMetaDefault(net.ssehub.easy.varModel.confModel.IDecisionVariable var, de.iip_ecosphere.platform.support.aas.SubmodelElementCollection.SubmodelElementCollectionBuilder varBuilder)Adds the default value ofvarif there is a default value.private voidaddMetaDefault(net.ssehub.easy.varModel.model.AbstractVariable decl, de.iip_ecosphere.platform.support.aas.SubmodelElementCollection.SubmodelElementCollectionBuilder varBuilder)Adds the default value ofvarif there is a default value.private voidaddMetaProperties(net.ssehub.easy.varModel.confModel.IDecisionVariable var, net.ssehub.easy.varModel.model.datatypes.IDatatype varType, de.iip_ecosphere.platform.support.aas.SubmodelElementCollection.SubmodelElementCollectionBuilder varBuilder)Adds the meta properties ofvarof typevarTypetovarBuilder.private voidaddOperations(de.iip_ecosphere.platform.support.aas.Submodel.SubmodelBuilder smBuilder, de.iip_ecosphere.platform.support.aas.InvocablesCreator iCreator)Adds the default AAS operations for obtaining information on the configuration model / changing the model.private static voidbind(de.iip_ecosphere.platform.support.aas.ProtocolServerBuilder sBuilder)Binds the AAS operations (ensure static lambda functions).voidbindOperations(de.iip_ecosphere.platform.support.aas.ProtocolServerBuilder sBuilder)Binds the AAS operations.private static AasIvmlMapper.ServiceMapcollectServices(net.ssehub.easy.varModel.confModel.Configuration cfg, net.ssehub.easy.varModel.model.datatypes.IDatatype serviceType)Collects all declared services.private voidcreateAppProject(java.lang.String appName, java.lang.String appValueEx, AasIvmlMapper.ModelResults results)Writes an application project with the given new mesh variable.private PlatformInstantiator.InstantiationConfigurercreateInstantiationConfigurer(AasIvmlMapper.InstantiationMode mode, java.lang.String appId, java.lang.String fileName)Creates an instantiation configurer fromConfigurationSetupto create application code.protected java.io.FilecreateIvmlConfigPath(java.lang.String subpath, net.ssehub.easy.varModel.model.Project project)Creates an IVML configuration (not meta-model) model path withsubpathand for projectp.private voidcreateMeshProject(java.lang.String appName, java.lang.String meshName, IvmlGraphMapper.IvmlGraph graph, AasIvmlMapper.ModelResults results)Creates a mesh project forgraph.private static de.iip_ecosphere.platform.support.aas.SubmodelElementCollection.SubmodelElementCollectionBuildercreateTypeCollectionBuilder(de.iip_ecosphere.platform.support.aas.Submodel.SubmodelBuilder smBuilder, java.lang.String typeName)Creates a AAS collection representing an IVML type.private static voiddeleteAasVariableMapping(de.iip_ecosphere.platform.support.aas.Submodel sm, java.lang.String typeName, java.lang.String varName)Deletes the mapping of the specified variable in the AAS.java.lang.ObjectdeleteGraph(java.lang.String appName, java.lang.String meshName)Deletes a graph structure in IVML.private net.ssehub.easy.varModel.model.values.ContainerValuedeleteReferenceFromContainerValue(net.ssehub.easy.varModel.confModel.IDecisionVariable var, net.ssehub.easy.varModel.model.AbstractVariable search)Deletes a reference from a container value and sets the new value.private net.ssehub.easy.varModel.model.ProjectfindOrCreateProject(net.ssehub.easy.varModel.model.Project scope, java.lang.String projectName, boolean find)Finds an existing IVML project inscopewith given name or creates a new one with default freeze block.private static net.ssehub.easy.varModel.model.AbstractVariablefindServiceVar(AasIvmlMapper.ServiceMap services, java.lang.String name)Finds a service as IVML variable.private java.lang.StringgetApplicationProjectName(java.lang.String appName)Returns the IVML project name for an application.private java.io.FilegetIvmlConfigFolder(EasySetup ep)Returns the actual IVML config folder.protected net.ssehub.easy.varModel.confModel.ConfigurationgetIvmlConfiguration()Returns the actual IVML configuration.protected java.lang.StringgetIvmlSubpath(net.ssehub.easy.varModel.model.Project project)Returns the IVML subpath for the given project.(package private) static java.lang.StringgetLang()Returns the language to be used forLangString.private java.lang.StringgetMeshProjectName(java.lang.String appName, java.lang.String meshName)Returns the IVML project name for a service mesh.private static java.lang.ObjectgetValue(net.ssehub.easy.varModel.confModel.IDecisionVariable var)Returns the value of a variable.protected net.ssehub.easy.varModel.model.ProjectgetVariableTarget(net.ssehub.easy.varModel.model.Project root, net.ssehub.easy.varModel.model.datatypes.IDatatype type)Returns the target for a variable to be created.protected net.ssehub.easy.instantiation.core.model.vilTypes.configuration.ConfigurationgetVilConfiguration()Returns the actual VIL configuration.private java.lang.Objectinstantiate(PlatformInstantiator.InstantiationConfigurer configurer)Instantiates according to the givenconfigurer.protected booleanisAllowedForModification(net.ssehub.easy.varModel.model.Project prj)Returns whether the given project is allowed for modification (other than root).private static booleanisNonEmptyString(java.lang.String string)Returns whetherstringis a non-empty string.private static booleanisRefWithName(java.lang.String name, net.ssehub.easy.varModel.confModel.Configuration cfg, net.ssehub.easy.varModel.model.values.Value mVal)Returns ifmValis a reference to a variable with a field name with valuename.voidmapByType(de.iip_ecosphere.platform.support.aas.Submodel.SubmodelBuilder smBuilder, de.iip_ecosphere.platform.support.aas.InvocablesCreator iCreator)Mapscfginto the submodel represented bysmBuilder.private static java.lang.StringmapParent(net.ssehub.easy.varModel.confModel.IDecisionVariable var)Returns the name of the parent project ofvarwhile consideringPARENT_MAPPING.private net.ssehub.easy.varModel.model.datatypes.CompoundmapType(net.ssehub.easy.varModel.model.datatypes.Compound type)Maps the type of an IVML variable into the configuration submodel, usually searching for the top-most parent of compound types.private net.ssehub.easy.varModel.model.datatypes.IDatatypemapType(net.ssehub.easy.varModel.model.datatypes.IDatatype type)Maps the type of an IVML variable into the configuration submodel, usually searching for the top-most parent of compound types.(package private) voidmapVariable(net.ssehub.easy.varModel.confModel.IDecisionVariable var, de.iip_ecosphere.platform.support.aas.SubmodelElementCollection.SubmodelElementCollectionBuilder builder, java.lang.String id)Maps a single variablevarintobuilder.private voidmapVariableToAas(de.iip_ecosphere.platform.support.aas.Submodel.SubmodelBuilder smB, net.ssehub.easy.varModel.confModel.IDecisionVariable var)Mapsvarinto the submodel represented bysmB.protected voidreloadConfiguration()Reloads the configuration model.java.lang.ObjectsetGraph(java.lang.String appName, java.lang.String appValueEx, java.lang.String meshName, java.lang.String format, java.lang.String value)Changes an application/graph structure in IVML.private static voidsetSemanticId(de.iip_ecosphere.platform.support.aas.Property.PropertyBuilder pBuilder, java.lang.String semanticId)Sets a semantic id if available.voidsetShortIdToMeta(java.util.function.Function<java.lang.String,java.lang.String> metaShortId)Defines a function that turns an IVML name for a meta value, e.g., type or status, into an AAS short id candidate.voidsetVariableFilter(java.util.function.Predicate<net.ssehub.easy.varModel.model.AbstractVariable> variableFilter)Defines a predicate acting as IVML variable filter, i.e., variables to be included into the configuration AAS.private static java.lang.StringtoId(java.lang.String string)Turnsstringinto an identifier, i.e., each non-Java identifier characters into a "_".protected net.ssehub.easy.reasoning.core.reasoner.ReasoningResultvalidateAndPropagate()Validates the model and propagates values within the model.private java.lang.StringvalidateName(IvmlGraphMapper.IvmlGraphNode node, int count)Validates the name of a node and if there is none, sets a pseudo name based oncount.-
Methods inherited from class de.iip_ecosphere.platform.configuration.ivml.AbstractIvmlModifier
adaptTarget, addGraphFormat, addImport, changeValues, copyToTmp, createAssignment, createExpression, createVariable, deleteVariable, getGraph, getGraphFactory, getGraphFormat, getIvmlFile, getMapper, getType, getVariable, getVariable, isValidIdentifier, notifyChange, notifyChange, reloadAndValidate, removeConstraintsForVariable, saveTo, setValue, setValue, throwIfFails, toIdentifier, toIdentifierFirstUpper
-
-
-
-
Field Detail
-
OP_CHANGE_VALUES
public static final java.lang.String OP_CHANGE_VALUES
- See Also:
- Constant Field Values
-
OP_GET_GRAPH
public static final java.lang.String OP_GET_GRAPH
- See Also:
- Constant Field Values
-
OP_SET_GRAPH
public static final java.lang.String OP_SET_GRAPH
- See Also:
- Constant Field Values
-
OP_DELETE_GRAPH
public static final java.lang.String OP_DELETE_GRAPH
- See Also:
- Constant Field Values
-
OP_CREATE_VARIABLE
public static final java.lang.String OP_CREATE_VARIABLE
- See Also:
- Constant Field Values
-
OP_DELETE_VARIABLE
public static final java.lang.String OP_DELETE_VARIABLE
- See Also:
- Constant Field Values
-
OP_GEN_INTERFACES
public static final java.lang.String OP_GEN_INTERFACES
- See Also:
- Constant Field Values
-
OP_GEN_APPS_NO_DEPS
public static final java.lang.String OP_GEN_APPS_NO_DEPS
- See Also:
- Constant Field Values
-
OP_GEN_APPS
public static final java.lang.String OP_GEN_APPS
- See Also:
- Constant Field Values
-
FILTER_NO_CONSTRAINT_VARIABLES
public static final java.util.function.Predicate<net.ssehub.easy.varModel.model.AbstractVariable> FILTER_NO_CONSTRAINT_VARIABLES
-
META_TYPE_NAME
public static final java.lang.String META_TYPE_NAME
- See Also:
- Constant Field Values
-
SHORTID_PREFIX_META
public static final java.util.function.Function<java.lang.String,java.lang.String> SHORTID_PREFIX_META
-
PRJ_NAME_ALLCONSTANTS
protected static final java.lang.String PRJ_NAME_ALLCONSTANTS
- See Also:
- Constant Field Values
-
PRJ_NAME_ALLSERVICES
protected static final java.lang.String PRJ_NAME_ALLSERVICES
- See Also:
- Constant Field Values
-
PRJ_NAME_ALLTYPES
protected static final java.lang.String PRJ_NAME_ALLTYPES
- See Also:
- Constant Field Values
-
PRJ_NAME_TECHSETUP
protected static final java.lang.String PRJ_NAME_TECHSETUP
- See Also:
- Constant Field Values
-
PROJECT_MAPPING
private static final java.util.Map<java.lang.String,java.lang.String> PROJECT_MAPPING
-
PARENT_MAPPING
private static final java.util.Map<java.lang.String,java.lang.String> PARENT_MAPPING
-
TYPE_VISITOR
private static final TypeVisitor TYPE_VISITOR
-
PROGRESS_COMPONENT_ID
private static final java.lang.String PROGRESS_COMPONENT_ID
- See Also:
- Constant Field Values
-
cfgSupplier
private java.util.function.Supplier<net.ssehub.easy.instantiation.core.model.vilTypes.configuration.Configuration> cfgSupplier
-
metaShortId
private java.util.function.Function<java.lang.String,java.lang.String> metaShortId
-
variableFilter
private java.util.function.Predicate<net.ssehub.easy.varModel.model.AbstractVariable> variableFilter
-
types
private java.util.Map<java.lang.String,de.iip_ecosphere.platform.support.aas.SubmodelElementCollection.SubmodelElementCollectionBuilder> types
-
-
Constructor Detail
-
AasIvmlMapper
public AasIvmlMapper(java.util.function.Supplier<net.ssehub.easy.instantiation.core.model.vilTypes.configuration.Configuration> cfgSupplier, IvmlGraphMapper graphMapper, AbstractIvmlModifier.ConfigurationChangeListener changeListener)Creates a mapper with default settings, e.g., short ids for meta IVML information are prefixed by "meta" (SHORTID_PREFIX_META) and the variable filter excludes all IVML constraint variables (FILTER_NO_CONSTRAINT_VARIABLES).- Parameters:
cfgSupplier- a supplier providing the actual configuration instancegraphMapper- maps a graph from IVML to an internal structurechangeListener- optional configuration change listener, may be null- Throws:
java.lang.IllegalArgumentException- ifcfgSupplieris null
-
-
Method Detail
-
mapParent
private static java.lang.String mapParent(net.ssehub.easy.varModel.confModel.IDecisionVariable var)
Returns the name of the parent project ofvarwhile consideringPARENT_MAPPING. If there is no mapping, the name of the parent project is returned.- Parameters:
var- the variable to map- Returns:
- the (mapped) name of the (declaring) parent project
-
setShortIdToMeta
public void setShortIdToMeta(java.util.function.Function<java.lang.String,java.lang.String> metaShortId)
Defines a function that turns an IVML name for a meta value, e.g., type or status, into an AAS short id candidate. The result of a function call will be validated byAasUtils.fixId(String). The default value is to prefix a given name with "meta".- Parameters:
metaShortId- the functor, ignored if null
-
setVariableFilter
public void setVariableFilter(java.util.function.Predicate<net.ssehub.easy.varModel.model.AbstractVariable> variableFilter)
Defines a predicate acting as IVML variable filter, i.e., variables to be included into the configuration AAS.- Parameters:
variableFilter- the predicate, ignored if null
-
mapByType
public void mapByType(de.iip_ecosphere.platform.support.aas.Submodel.SubmodelBuilder smBuilder, de.iip_ecosphere.platform.support.aas.InvocablesCreator iCreator)Mapscfginto the submodel represented bysmBuilder.- Parameters:
smBuilder- the submodel builder representing the targetiCreator- the invocables creator for operations
-
mapType
private net.ssehub.easy.varModel.model.datatypes.IDatatype mapType(net.ssehub.easy.varModel.model.datatypes.IDatatype type)
Maps the type of an IVML variable into the configuration submodel, usually searching for the top-most parent of compound types.- Parameters:
type- the type to map- Returns:
- the mapped type, may be
type
-
mapType
private net.ssehub.easy.varModel.model.datatypes.Compound mapType(net.ssehub.easy.varModel.model.datatypes.Compound type)
Maps the type of an IVML variable into the configuration submodel, usually searching for the top-most parent of compound types.- Parameters:
type- the type to map- Returns:
- the mapped type, may be
type
-
createTypeCollectionBuilder
private static de.iip_ecosphere.platform.support.aas.SubmodelElementCollection.SubmodelElementCollectionBuilder createTypeCollectionBuilder(de.iip_ecosphere.platform.support.aas.Submodel.SubmodelBuilder smBuilder, java.lang.String typeName)Creates a AAS collection representing an IVML type.- Parameters:
smBuilder- the submodel buildertypeName- the type name (turned into an AAS shortID)- Returns:
- the collection builder
-
bindOperations
public void bindOperations(de.iip_ecosphere.platform.support.aas.ProtocolServerBuilder sBuilder)
Binds the AAS operations.- Parameters:
sBuilder- the server builder
-
bind
private static void bind(de.iip_ecosphere.platform.support.aas.ProtocolServerBuilder sBuilder)
Binds the AAS operations (ensure static lambda functions).- Parameters:
sBuilder- the server builder
-
instantiate
private java.lang.Object instantiate(PlatformInstantiator.InstantiationConfigurer configurer) throws java.util.concurrent.ExecutionException
Instantiates according to the givenconfigurer.- Parameters:
configurer- the configurer- Returns:
- null
- Throws:
java.util.concurrent.ExecutionException- when the instantiation fails
-
createInstantiationConfigurer
private PlatformInstantiator.InstantiationConfigurer createInstantiationConfigurer(AasIvmlMapper.InstantiationMode mode, java.lang.String appId, java.lang.String fileName)
Creates an instantiation configurer fromConfigurationSetupto create application code.- Parameters:
mode- the instantiation modeappId- the id of the application to instantiate, may be empty or null for nonefileName- the name of the implementation artifact to integrate, may be empty or null for none- Returns:
- the configurer
-
getVariableTarget
protected net.ssehub.easy.varModel.model.Project getVariableTarget(net.ssehub.easy.varModel.model.Project root, net.ssehub.easy.varModel.model.datatypes.IDatatype type)Description copied from class:AbstractIvmlModifierReturns the target for a variable to be created.- Overrides:
getVariableTargetin classAbstractIvmlModifier- 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 created- Returns:
- the target project
- See Also:
AbstractIvmlModifier.isAllowedForModification(Project prj)
-
isAllowedForModification
protected boolean isAllowedForModification(net.ssehub.easy.varModel.model.Project prj)
Description copied from class:AbstractIvmlModifierReturns whether the given project is allowed for modification (other than root).- Overrides:
isAllowedForModificationin classAbstractIvmlModifier- Parameters:
prj- the project- Returns:
trueallowed,falseelse- See Also:
AbstractIvmlModifier.getVariableTarget(Project, IDatatype)
-
getIvmlSubpath
protected java.lang.String getIvmlSubpath(net.ssehub.easy.varModel.model.Project project)
Description copied from class:AbstractIvmlModifierReturns the IVML subpath for the given project.- Specified by:
getIvmlSubpathin classAbstractIvmlModifier- 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
-
getIvmlConfigFolder
private java.io.File getIvmlConfigFolder(EasySetup ep)
Returns the actual IVML config folder.- Parameters:
ep- the EASy setup instance- Returns:
- the config folder
-
createIvmlConfigPath
protected java.io.File createIvmlConfigPath(java.lang.String subpath, net.ssehub.easy.varModel.model.Project project)Description copied from class:AbstractIvmlModifierCreates an IVML configuration (not meta-model) model path withsubpathand for projectp.- Specified by:
createIvmlConfigPathin classAbstractIvmlModifier- Parameters:
subpath- the subpath, may be null for noneproject- the project to create the path for- Returns:
- the file name/path
- See Also:
AbstractIvmlModifier.getIvmlSubpath(Project)
-
deleteGraph
public java.lang.Object deleteGraph(java.lang.String appName, java.lang.String meshName) throws java.util.concurrent.ExecutionExceptionDeletes a graph structure in IVML. [public for testing]- Parameters:
appName- the configured name of the applicationmeshName- the configured name of the service mesh to delete a specific mesh inappName, may be null or empty to delete the entire app- Returns:
- null always
- Throws:
java.util.concurrent.ExecutionException- if setting the graph structure fails
-
deleteReferenceFromContainerValue
private net.ssehub.easy.varModel.model.values.ContainerValue deleteReferenceFromContainerValue(net.ssehub.easy.varModel.confModel.IDecisionVariable var, net.ssehub.easy.varModel.model.AbstractVariable search) throws java.util.concurrent.ExecutionExceptionDeletes a reference from a container value and sets the new value.- Parameters:
var- the variable to take the value from, may be nullsearch- the variable declaration to search the reference for- Returns:
- the new container value, may be null for not found
- Throws:
java.util.concurrent.ExecutionException- if re-assigning the value fails
-
isNonEmptyString
private static boolean isNonEmptyString(java.lang.String string)
Returns whetherstringis a non-empty string.- Parameters:
string- the string to test- Returns:
truefor a non-empty string,falsefor an empty string or null
-
setGraph
public java.lang.Object setGraph(java.lang.String appName, java.lang.String appValueEx, java.lang.String meshName, java.lang.String format, java.lang.String value) throws java.util.concurrent.ExecutionExceptionChanges an application/graph structure in IVML. Application/mesh files are dynamically linked and require a different approach as, e.g., constants. [public for testing]- Parameters:
appName- the configured name of the applicationappValueEx- the application value as IVML expressionmeshName- the configured name of the service mesh (may be null or empty for none; used as import resolution if given, existing andformatorvalueare not given).format- the format of the graph (may be null or empty for none).value- the value (may be null or empty for none).- Returns:
- null always
- Throws:
java.util.concurrent.ExecutionException- if setting the graph structure fails
-
getApplicationProjectName
private java.lang.String getApplicationProjectName(java.lang.String appName)
Returns the IVML project name for an application.- Parameters:
appName- the application name- Returns:
- the project name
-
getMeshProjectName
private java.lang.String getMeshProjectName(java.lang.String appName, java.lang.String meshName)Returns the IVML project name for a service mesh.- Parameters:
appName- the application namemeshName- the configured name of the service mesh- Returns:
- the project name
-
createAppProject
private void createAppProject(java.lang.String appName, java.lang.String appValueEx, AasIvmlMapper.ModelResults results) throws net.ssehub.easy.varModel.model.ModelQueryException, net.ssehub.easy.basics.modelManagement.ModelManagementException, java.util.concurrent.ExecutionExceptionWrites an application project with the given new mesh variable.- Parameters:
appName- the application nameappValueEx- the IVML value expression for the applicationresults- collected result information- Throws:
net.ssehub.easy.varModel.model.ModelQueryException- if IVML types/variables cannot be foundnet.ssehub.easy.basics.modelManagement.ModelManagementException- if IVML types/variables cannot be foundjava.util.concurrent.ExecutionException- if the application value cannot be set
-
isRefWithName
private static boolean isRefWithName(java.lang.String name, net.ssehub.easy.varModel.confModel.Configuration cfg, net.ssehub.easy.varModel.model.values.Value mVal)Returns ifmValis a reference to a variable with a field name with valuename.- Parameters:
name- the name to look forcfg- the configuration to resolve the referencemVal- the value possibly containing a reference value- Returns:
trueif it is a reference with the desired property,falseelse
-
getVilConfiguration
protected net.ssehub.easy.instantiation.core.model.vilTypes.configuration.Configuration getVilConfiguration()
Description copied from class:AbstractIvmlModifierReturns the actual VIL configuration. Shall be consistent withAbstractIvmlModifier.getIvmlConfiguration().- Specified by:
getVilConfigurationin classAbstractIvmlModifier- Returns:
- the configuration
-
getIvmlConfiguration
protected net.ssehub.easy.varModel.confModel.Configuration getIvmlConfiguration()
Description copied from class:AbstractIvmlModifierReturns the actual IVML configuration. Shall be consistent withAbstractIvmlModifier.getVilConfiguration().- Specified by:
getIvmlConfigurationin classAbstractIvmlModifier- Returns:
- the configuration
-
validateAndPropagate
protected net.ssehub.easy.reasoning.core.reasoner.ReasoningResult validateAndPropagate()
Description copied from class:AbstractIvmlModifierValidates the model and propagates values within the model.- Specified by:
validateAndPropagatein classAbstractIvmlModifier- Returns:
- the reasoning result
-
reloadConfiguration
protected void reloadConfiguration()
Description copied from class:AbstractIvmlModifierReloads the configuration model.- Specified by:
reloadConfigurationin classAbstractIvmlModifier
-
findOrCreateProject
private net.ssehub.easy.varModel.model.Project findOrCreateProject(net.ssehub.easy.varModel.model.Project scope, java.lang.String projectName, boolean find)Finds an existing IVML project inscopewith given name or creates a new one with default freeze block.- Parameters:
scope- the scope to look forprojectName- the project namefind- try to find the project or directly create a new project- Returns:
- the project, created or found
-
validateName
private java.lang.String validateName(IvmlGraphMapper.IvmlGraphNode node, int count)
Validates the name of a node and if there is none, sets a pseudo name based oncount.- Parameters:
node- the node to validatecount- unique node counter per mesh- Returns:
- the name of
node
-
toId
private static java.lang.String toId(java.lang.String string)
Turnsstringinto an identifier, i.e., each non-Java identifier characters into a "_".- Parameters:
string- the string to be checked- Returns:
- the validated string, potentially modified to be an id
-
createMeshProject
private void createMeshProject(java.lang.String appName, java.lang.String meshName, IvmlGraphMapper.IvmlGraph graph, AasIvmlMapper.ModelResults results) throws net.ssehub.easy.varModel.model.ModelQueryException, net.ssehub.easy.basics.modelManagement.ModelManagementException, java.util.concurrent.ExecutionExceptionCreates a mesh project forgraph.- Parameters:
appName- the application namemeshName- the mesh namegraph- the graph to create the mesh project forresults- the results to be modified as a side effect- Throws:
net.ssehub.easy.varModel.model.ModelQueryException- if IVML types/variables cannot be foundnet.ssehub.easy.basics.modelManagement.ModelManagementException- if IVML types/variables cannot be foundjava.util.concurrent.ExecutionException- if setting IVML values fails
-
collectServices
private static AasIvmlMapper.ServiceMap collectServices(net.ssehub.easy.varModel.confModel.Configuration cfg, net.ssehub.easy.varModel.model.datatypes.IDatatype serviceType)
Collects all declared services.- Parameters:
cfg- the configuration to take the services fromserviceType- the IVML data type used to select services- Returns:
- a mapping between service names and configured IVML variables
-
findServiceVar
private static net.ssehub.easy.varModel.model.AbstractVariable findServiceVar(AasIvmlMapper.ServiceMap services, java.lang.String name)
Finds a service as IVML variable.- Parameters:
services- the mapped servicesname- the service name to search for- Returns:
- the service IVML variable, or null for not found
-
addOperations
private void addOperations(de.iip_ecosphere.platform.support.aas.Submodel.SubmodelBuilder smBuilder, de.iip_ecosphere.platform.support.aas.InvocablesCreator iCreator)Adds the default AAS operations for obtaining information on the configuration model / changing the model.- Parameters:
smBuilder- the submodel builder representing the targetiCreator- the invocables creator for operations
-
getLang
static java.lang.String getLang()
Returns the language to be used forLangString.- Returns:
- the language
-
mapVariable
void mapVariable(net.ssehub.easy.varModel.confModel.IDecisionVariable var, de.iip_ecosphere.platform.support.aas.SubmodelElementCollection.SubmodelElementCollectionBuilder builder, java.lang.String id)Maps a single variablevarintobuilder.- Parameters:
var- the variable to map as sourcebuilder- the builder as target (representing the parent ofvar)id- the id to use as variable name instead of the variable name itself, may be null for the variable name
-
addMetaDefault
private void addMetaDefault(net.ssehub.easy.varModel.confModel.IDecisionVariable var, de.iip_ecosphere.platform.support.aas.SubmodelElementCollection.SubmodelElementCollectionBuilder varBuilder)Adds the default value ofvarif there is a default value.- Parameters:
var- the variable to take the default value fromvarBuilder- the variable builder to add the meta-value to
-
addMetaDefault
private void addMetaDefault(net.ssehub.easy.varModel.model.AbstractVariable decl, de.iip_ecosphere.platform.support.aas.SubmodelElementCollection.SubmodelElementCollectionBuilder varBuilder)Adds the default value ofvarif there is a default value.- Parameters:
decl- the variable declaration to take the default value fromvarBuilder- the variable builder to add the meta-value to
-
addMetaProperties
private void addMetaProperties(net.ssehub.easy.varModel.confModel.IDecisionVariable var, net.ssehub.easy.varModel.model.datatypes.IDatatype varType, de.iip_ecosphere.platform.support.aas.SubmodelElementCollection.SubmodelElementCollectionBuilder varBuilder)Adds the meta properties ofvarof typevarTypetovarBuilder.- Parameters:
var- the variable to take the meta-properties fromvarType- the type ofvar(as we already have determined it)varBuilder- the AAS builder representingvarto add the AAS properties to
-
setSemanticId
private static void setSemanticId(de.iip_ecosphere.platform.support.aas.Property.PropertyBuilder pBuilder, java.lang.String semanticId)Sets a semantic id if available.- Parameters:
pBuilder- the property buildersemanticId- the semantic id, may be null
-
getValue
private static java.lang.Object getValue(net.ssehub.easy.varModel.confModel.IDecisionVariable var)
Returns the value of a variable.- Parameters:
var- the variable- Returns:
- the value
-
deleteAasVariableMapping
private static void deleteAasVariableMapping(de.iip_ecosphere.platform.support.aas.Submodel sm, java.lang.String typeName, java.lang.String varName)Deletes the mapping of the specified variable in the AAS.- Parameters:
sm- the submodel to delete fromtypeName- the type namevarName- the variable name
-
mapVariableToAas
private void mapVariableToAas(de.iip_ecosphere.platform.support.aas.Submodel.SubmodelBuilder smB, net.ssehub.easy.varModel.confModel.IDecisionVariable var)Mapsvarinto the submodel represented bysmB.- Parameters:
smB- the submodel buildervar- the variable
-
-