Class AasIvmlMapper
java.lang.Object
de.iip_ecosphere.platform.configuration.ivml.AbstractIvmlModifier
de.iip_ecosphere.platform.configuration.ivml.AasIvmlMapper
- All Implemented Interfaces:
DecisionVariableProvider
Maps an IVML configuration generically into an AAS with references to IIP-Ecosphere.
- Author:
- Holger Eichelberger, SSE
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classRecords an AAS change.private static enumInstantiation modes.protected static classStores intermediary model creation results.private static classA "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
FieldsModifier and TypeFieldDescriptionprivate Supplier<net.ssehub.easy.instantiation.core.model.vilTypes.configuration.Configuration> static final Predicate<net.ssehub.easy.varModel.model.AbstractVariable> static final Predicate<net.ssehub.easy.varModel.model.AbstractVariable> static final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringprotected static final Stringprotected static final Stringprotected static final Stringprotected static final Stringstatic final Stringprivate static final String[]private static final TypeVisitorprivate Predicate<net.ssehub.easy.varModel.model.AbstractVariable> Fields inherited from class de.iip_ecosphere.platform.configuration.ivml.AbstractIvmlModifier
NO_PROJECT_FILTER, NO_TEMPLATE_FILTER -
Constructor Summary
ConstructorsConstructorDescriptionAasIvmlMapper(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
Modifier and TypeMethodDescriptionprivate static booleanacceptTemplateFile(File file, long startTime) Returns whetherfileis acceptable for template copying/publishing.private voidaddMetaProperties(net.ssehub.easy.varModel.confModel.IDecisionVariable var, net.ssehub.easy.varModel.model.datatypes.IDatatype varType, de.iip_ecosphere.platform.support.aas.SubmodelElementContainerBuilder varBuilder, String displayName) 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 voidannotate(net.ssehub.easy.varModel.model.Project prj) Annotatesprjwith the usual binding time.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 voidbindTemplateOperations(de.iip_ecosphere.platform.support.aas.ProtocolServerBuilder sBuilder) Binds the AAS template operations (ensure static lambda functions).private static AasIvmlMapper.ServiceMapcollectServices(net.ssehub.easy.varModel.confModel.Configuration cfg, net.ssehub.easy.varModel.model.datatypes.IDatatype serviceType) Collects all declared services.private ObjectcollectTemplates(long startTime) Collects the generated templates, copies them toConfigurationSetup.getArtifactsFolder()and returns the file names prefixed byConfigurationSetup.getArtifactsUriPrefix()as JSON.private voidcreateAppProject(String appName, String appValueEx, AasIvmlMapper.ModelResults results) Writes an application project with the given new mesh variable.protected FilecreateIvmlConfigPath(String subpath, net.ssehub.easy.varModel.model.Project project) Creates an IVML configuration (not meta-model) model path withsubpathand for projectp.private voidcreateMeshProject(String appName, String meshName, IvmlGraphMapper.IvmlGraph graph, AasIvmlMapper.ModelResults results) Creates a mesh project forgraph.private static de.iip_ecosphere.platform.support.aas.SubmodelElementList.SubmodelElementListBuildercreateTypeCollectionBuilder(de.iip_ecosphere.platform.support.aas.Submodel.SubmodelBuilder smBuilder, String typeName) Creates a AAS collection representing an IVML type.private static voiddeleteAasVariableMapping(de.iip_ecosphere.platform.support.aas.Submodel sm, String typeName, String varName) Deletes the mapping of the specified variable in the AAS.deleteGraph(String appName, 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, 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, String name) Finds a service as IVML variable.private static FilefixZipConvention(File file) Checking and fixing ZIP file conventions for instantiation.private StringgetApplicationProjectName(String appName) Returns the IVML project name for an application.private FileReturns the actual IVML config folder.protected net.ssehub.easy.varModel.confModel.ConfigurationReturns the actual IVML configuration.protected StringgetIvmlSubpath(net.ssehub.easy.varModel.model.Project project) Returns the IVML subpath for the given project.(package private) static StringgetLang()Returns the language to be used forLangString.private StringgetMeshProjectName(String meshName) Returns the IVML project name for a service mesh.(package private) static StringgetStringValueEmptyNull(net.ssehub.easy.varModel.confModel.IDecisionVariable var) Returns the string value ofvar.private static 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, String name, List<String> meshes) Returns the target for a variable to be created.protected net.ssehub.easy.instantiation.core.model.vilTypes.configuration.ConfigurationReturns the actual VIL configuration.private Objectinstantiate(AasIvmlMapper.InstantiationMode mode, String appId, String codeFile) 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(String string) Returns whetherstringis a non-empty string.private static booleanisRefWithName(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 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.SubmodelElementContainerBuilder builder, 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.private voidprepareApplicationProject(net.ssehub.easy.varModel.model.Project app, net.ssehub.easy.varModel.model.Project root, List<String> meshes) Prepares an application project, e.g., adds default imports.private voidprepareMeshProject(net.ssehub.easy.varModel.model.Project mesh, net.ssehub.easy.varModel.model.Project root) Prepares a mesh project, e.g., adds default imports.protected voidReloads the configuration model.Changes an application/graph structure in IVML.private static voidsetSemanticId(de.iip_ecosphere.platform.support.aas.Property.PropertyBuilder pBuilder, String semanticId) Sets a semantic id if available.voidsetShortIdToMeta(Function<String, 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(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 StringTurnsstringinto an identifier, i.e., each non-Java identifier characters into a "_".protected 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 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, getOpenTemplateVariables, getTemplates, getType, getVariable, getVariable, getVariableName, instantiateTemplate, isValidIdentifier, notifyChange, notifyChange, reloadAndValidate, removeConstraintsForVariable, renameVariable, saveTo, setValue, setValue, throwIfFails, toIdentifier, toIdentifierFirstUpper, validateAndPropagate
-
Field Details
-
OP_CHANGE_VALUES
- See Also:
-
OP_GET_GRAPH
- See Also:
-
OP_SET_GRAPH
- See Also:
-
OP_DELETE_GRAPH
- See Also:
-
OP_GET_VARIABLE_NAME
- See Also:
-
OP_CREATE_VARIABLE
- See Also:
-
OP_CREATE_CONSTANT
- See Also:
-
OP_DELETE_VARIABLE
- See Also:
-
OP_RENAME_VARIABLE
- See Also:
-
OP_GEN_INTERFACES
- See Also:
-
OP_GEN_APPS_NO_DEPS
- See Also:
-
OP_GEN_APPS
- See Also:
-
OP_GET_TEMPLATES
- See Also:
-
OP_INSTANTIATE_TEMPLATE
- See Also:
-
OP_GET_OPEN_TEMPLATE_VARIABLES
- See Also:
-
FILTER_NO_CONSTRAINT_VARIABLES
public static final Predicate<net.ssehub.easy.varModel.model.AbstractVariable> FILTER_NO_CONSTRAINT_VARIABLES -
FILTER_NO_ANY
-
META_TYPE_NAME
- See Also:
-
SHORTID_PREFIX_META
-
PROGRESS_COMPONENT_ID
- See Also:
-
PRJ_NAME_ALLCONSTANTS
- See Also:
-
PRJ_NAME_ALLSERVICES
- See Also:
-
PRJ_NAME_ALLTYPES
- See Also:
-
PRJ_NAME_TECHSETUP
- See Also:
-
PROJECT_MAPPING
-
PARENT_MAPPING
-
TYPE_VISITOR
-
TOP_FOLDERS
-
cfgSupplier
private Supplier<net.ssehub.easy.instantiation.core.model.vilTypes.configuration.Configuration> cfgSupplier -
metaShortId
-
variableFilter
-
types
-
-
Constructor Details
-
AasIvmlMapper
public AasIvmlMapper(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:
IllegalArgumentException- ifcfgSupplieris null
-
-
Method Details
-
mapParent
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
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(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.SubmodelElementList.SubmodelElementListBuilder createTypeCollectionBuilder(de.iip_ecosphere.platform.support.aas.Submodel.SubmodelBuilder smBuilder, 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
-
bindTemplateOperations
private static void bindTemplateOperations(de.iip_ecosphere.platform.support.aas.ProtocolServerBuilder sBuilder) Binds the AAS template operations (ensure static lambda functions).- Parameters:
sBuilder- the server builder
-
instantiate
private Object instantiate(AasIvmlMapper.InstantiationMode mode, String appId, String codeFile) throws ExecutionException Instantiates according to the givenconfigurer.- Parameters:
mode- the instantiation modeappId- the app to buildcodeFile- the code file containing the implementation- Returns:
- summary of instantiation results depending on
mode, e.g., list of generated and downloadable template URIs forAasIvmlMapper.InstantiationMode.APPS_NO_DEPSelse null - Throws:
ExecutionException- when the instantiation fails
-
fixZipConvention
Checking and fixing ZIP file conventions for instantiation. The instantiation requires that either the project is directly located in the root folder of the ZIP or in a single contained folder having the same name as the ZIP file. If possible, through renaming/copying, we fix the second situation here.- Parameters:
file- the original ZIP file- Returns:
- the fixed ZIP file, may be
file
-
collectTemplates
Collects the generated templates, copies them toConfigurationSetup.getArtifactsFolder()and returns the file names prefixed byConfigurationSetup.getArtifactsUriPrefix()as JSON.- Parameters:
startTime- the time the generation started (as ms timestamp)- Returns:
- the generated template archives
-
acceptTemplateFile
Returns whetherfileis acceptable for template copying/publishing.- Parameters:
file- the file to checkstartTime- the start timestamp of the generation- Returns:
truefor acceptable,falseelse
-
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 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 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:
-
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:
-
getIvmlSubpath
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
Returns the actual IVML config folder.- Parameters:
ep- the EASy setup instance- Returns:
- the config folder
-
createIvmlConfigPath
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:
-
deleteGraph
Deletes a graph structure in IVML. [public for testing]- Parameters:
appName- the configured name of the application, may be empty or null to delete an individual mesh that is not yet linked into an app (will fail if still linked and deletion happens withoutappNamemeshName- 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:
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 ExecutionException Deletes 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:
ExecutionException- if re-assigning the value fails
-
isNonEmptyString
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 Object setGraph(String appName, String appValueEx, String meshName, String format, String value) throws ExecutionException Changes 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 expression, may be empty or null to indicate that just a mesh shall be modifiedmeshName- 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:
ExecutionException- if setting the graph structure fails
-
getApplicationProjectName
Returns the IVML project name for an application.- Parameters:
appName- the application name- Returns:
- the project name
-
prepareApplicationProject
private void prepareApplicationProject(net.ssehub.easy.varModel.model.Project app, net.ssehub.easy.varModel.model.Project root, List<String> meshes) throws ExecutionException Prepares an application project, e.g., adds default imports.- Parameters:
app- the application projectroot- the root projectmeshes- the meshes to be added as imports, may be null for none- Throws:
ExecutionException- if adding imports fails
-
getMeshProjectName
Returns the IVML project name for a service mesh.- Parameters:
meshName- the configured name of the service mesh- Returns:
- the project name
-
prepareMeshProject
private void prepareMeshProject(net.ssehub.easy.varModel.model.Project mesh, net.ssehub.easy.varModel.model.Project root) throws ExecutionException Prepares a mesh project, e.g., adds default imports.- Parameters:
mesh- the mesh projectroot- the root project- Throws:
ExecutionException- if adding imports fails
-
annotate
Annotatesprjwith the usual binding time.- Parameters:
prj- the project- Throws:
ExecutionException- if the annotation cannot be created
-
createAppProject
private void createAppProject(String appName, String appValueEx, AasIvmlMapper.ModelResults results) throws net.ssehub.easy.varModel.model.ModelQueryException, net.ssehub.easy.basics.modelManagement.ModelManagementException, ExecutionException Writes 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 foundExecutionException- if the application value cannot be set
-
isRefWithName
private static boolean isRefWithName(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(Predicate<net.ssehub.easy.varModel.model.Project> projectFilter) Description copied from class:AbstractIvmlModifierValidates the model and propagates values within the model.- Specified by:
validateAndPropagatein classAbstractIvmlModifier- Parameters:
projectFilter- optional filter on projects to reason on, may be null- 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, 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
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
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(String appName, String meshName, IvmlGraphMapper.IvmlGraph graph, AasIvmlMapper.ModelResults results) throws net.ssehub.easy.varModel.model.ModelQueryException, net.ssehub.easy.basics.modelManagement.ModelManagementException, ExecutionException Creates 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 foundExecutionException- 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, 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
Returns the language to be used forLangString.- Returns:
- the language
-
getStringValueEmptyNull
Returns the string value ofvar. If the value is empty, return null.- Parameters:
var- the variable to read the string value from- Returns:
- the string value or null
-
mapVariable
void mapVariable(net.ssehub.easy.varModel.confModel.IDecisionVariable var, de.iip_ecosphere.platform.support.aas.SubmodelElementContainerBuilder builder, 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
-
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.SubmodelElementContainerBuilder varBuilder, String displayName) 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 todisplayName- the displac name ofvar, may be null for none
-
setSemanticId
private static void setSemanticId(de.iip_ecosphere.platform.support.aas.Property.PropertyBuilder pBuilder, String semanticId) Sets a semantic id if available.- Parameters:
pBuilder- the property buildersemanticId- the semantic id, may be null
-
getValue
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, String typeName, 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
-