Class PlatformInstantiator.InstantiationConfigurer
java.lang.Object
de.iip_ecosphere.platform.configuration.easyProducer.PlatformInstantiator.InstantiationConfigurer
- Direct Known Subclasses:
PlatformInstantiator.NonCleaningInstantiationConfigurer
- Enclosing class:
PlatformInstantiator
Configures the instantiation. Default is for command line execution, but the configurer allows for adjusting the
execution to jUnit testing.
- Author:
- Holger Eichelberger, SSE
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionInstantiationConfigurer(String[] args) Creates a configurer instance from command line arguments delivered bytoArgs(boolean).InstantiationConfigurer(String ivmlModelName, File modelFolder, File outputFolder) Creates a configurer instance. -
Method Summary
Modifier and TypeMethodDescriptionprotected booleanReturns whether the output folder shall be cleaned before code generation.voidconfigure(ConfigurationSetup setup) Configures the platform instantiation via the givenConfigurationSetup.Enables emitting reasoner warnings.protected FileTurns a textual file name into a file object.Returns the IVML model name.protected intgetLastArgsIndex(String[] args) Returns the last command line argument index consumed by this configurer.Returns the qualified name of the class containing a main method for execution.Returns the meta model folder.Returns the model folder.Returns the VIL output folder.Returns the properties.Returns the VIL start rule name.protected voidHandles an instantiation exception.booleanReturns whether this configurer is currently used for testing.protected booleanReturns whether reasoning warnings shall be emitted.Obtains the lifecycle descriptor.setIvmlMetaModelFolder(File metaModelFolder) Changes the meta model folder.setProperty(String key, String value) Sets a JVM system property for execution.setStartRuleName(String startRuleName) Optionally sets the start rule name.protected StringTurns a file name into a textual file specification.String[]toArgs(boolean all) Turns this configurer into command line arguments.protected voidvalidateConfiguration(net.ssehub.easy.varModel.confModel.Configuration conf) Validates the configuration after reasoning.protected voidvalidateReasoningResult(net.ssehub.easy.reasoning.core.reasoner.ReasoningResult res) Validates the reasoning result.
-
Field Details
-
ivmlModelName
-
outputFolder
-
modelFolder
-
metaModelFolder
-
startRuleName
-
properties
-
emitReasonerWarnings
private boolean emitReasonerWarnings
-
-
Constructor Details
-
InstantiationConfigurer
Creates a configurer instance.- Parameters:
ivmlModelName- the name of the IVML model representing the topmost platform configurationmodelFolder- the folder where the model is located (ignored if null)outputFolder- the output folder for code generation
-
InstantiationConfigurer
Creates a configurer instance from command line arguments delivered bytoArgs(boolean).- Parameters:
args- the command line arguments
-
-
Method Details
-
getLastArgsIndex
Returns the last command line argument index consumed by this configurer.- Parameters:
args- the command line arguments- Returns:
- the index
-
fromArg
Turns a textual file name into a file object.- Parameters:
file- the file name- Returns:
- the file, may be null if
filewas null or "-"
-
toArg
Turns a file name into a textual file specification.- Parameters:
file- the file- Returns:
- the file specification, may be "-" if
filewas null
-
getMainClass
Returns the qualified name of the class containing a main method for execution.- Returns:
- the class name of
PlatformInstantiator
-
inTesting
public boolean inTesting()Returns whether this configurer is currently used for testing.- Returns:
falsefor production (the default),truefor testing
-
toArgs
Turns this configurer into command line arguments.- Parameters:
all-trueadd all arguments for passong on setup between configurers,falseonly command line arguments for execution- Returns:
- the arguments
-
isEmitReasonerWarnings
protected boolean isEmitReasonerWarnings()Returns whether reasoning warnings shall be emitted.- Returns:
truefor warnings,falseelse
-
emitReasonerWarnings
Enables emitting reasoner warnings.- Returns:
- this (builder style)
-
setStartRuleName
Optionally sets the start rule name. The default name is "main".- Parameters:
startRuleName- the start rule name- Returns:
- this (builder style)
-
setIvmlMetaModelFolder
Changes the meta model folder.- Parameters:
metaModelFolder- the meta model folder (ignored if null or does not exist)- Returns:
- the meta model folder
-
configure
Configures the platform instantiation via the givenConfigurationSetup.- Parameters:
setup- the setup instance
-
getStartRuleName
Returns the VIL start rule name. [public for testing]- Returns:
- the VIL start rule name
-
getIvmlModelName
Returns the IVML model name. [testing]- Returns:
- the model name
-
getOutputFolder
Returns the VIL output folder. [testing]- Returns:
- the output folder
-
getModelFolder
Returns the model folder. [testing]- Returns:
- the model folder
-
getMetaModelFolder
Returns the meta model folder. [testing]- Returns:
- the meta model folder
-
cleanOutputFolder
protected boolean cleanOutputFolder()Returns whether the output folder shall be cleaned before code generation.- Returns:
truefor clean,falseelse
-
obtainLifecycleDescriptor
Obtains the lifecycle descriptor.- Returns:
- the descriptor
-
validateConfiguration
protected void validateConfiguration(net.ssehub.easy.varModel.confModel.Configuration conf) throws ExecutionException Validates the configuration after reasoning. May terminate the program or throw an exception.- Parameters:
conf- the configuration- Throws:
ExecutionException- if the validation fails
-
validateReasoningResult
protected void validateReasoningResult(net.ssehub.easy.reasoning.core.reasoner.ReasoningResult res) throws ExecutionException Validates the reasoning result. May terminate the program or throw an exception.- Parameters:
res- the reasoning result- Throws:
ExecutionException- if reasoning fails
-
handleExecutionException
Handles an instantiation exception.- Parameters:
ex- the exception- Throws:
ExecutionException- may re-throw the exception
-
setProperty
Sets a JVM system property for execution.- Parameters:
key- the keyvalue- the value
-
getProperties
Returns the properties.- Returns:
- the properties
-