public class ModelProcessor extends Object
Handles the processing of models. Facilitates Model Driven Architecture by enabling the generation of source code, configuration files, and other such artifacts from a single or multiple models.
Modifier and Type | Method and Description |
---|---|
protected void |
filterAndSortValidationMessages(List<ModelValidationMessage> messages,
Filters constraints)
Filters out any messages that should not be applied according to the AndroMDA configuration's
constraints and sorts the resulting
messages first by type (i.e. |
static boolean |
getModelValidation()
Gets whether or not model validation should occur.
|
void |
initialize(Configuration configuration)
Initializes this model processor instance with the given
configuration.
|
(package private) List<ModelValidationMessage> |
loadIfNecessary(Repository[] repositories)
Checks to see if any of the repositories contain models
that need to be reloaded, and if so, re-loads them.
|
protected List<ModelValidationMessage> |
loadModelIfNecessary(Model model)
Loads the model into the repository only when necessary (the model has a timestamp
later than the last timestamp of the loaded model).
|
static ModelProcessor |
newInstance()
Creates a new instance the ModelProcessor.
|
protected void |
printConsoleHeader()
Prints the console header.
|
ModelValidationMessage[] |
process(Configuration configuration)
Re-configures this model processor from the given
configuration
instance (if different from that of the one passed in during the call to
initialize(Configuration) ), and runs the model processor. |
void |
setCartridgeFilter(String namespaces)
Sets the current cartridge filter.
|
void |
setFailOnValidationErrors(boolean failOnValidationErrors)
Sets whether or not processing should fail when validation errors occur, default is
true . |
void |
setHistoryDir(String historyDir) |
void |
setLastModifiedCheck(boolean lastModifiedCheck) |
void |
setLoggingConfigurationUri(String loggingConfigurationUri)
Sets the
loggingConfigurationUri for AndroMDA. |
void |
setModelValidation(boolean modelValidationIn)
Sets whether or not model validation should occur.
|
void |
setOutputEncoding(String outputEncoding)
Sets the encoding (UTF-8, ISO-8859-1, etc) for all output
produced during model processing.
|
void |
setXmlValidation(boolean xmlValidation)
Sets
xmlValidation to be true/false. |
protected boolean |
shouldProcess(String namespace)
Indicates whether or not the
namespace should be processed. |
void |
shutdown()
Shuts down the model processor (reclaims any
resources).
|
public static ModelProcessor newInstance()
public ModelValidationMessage[] process(Configuration configuration)
configuration
instance (if different from that of the one passed in during the call to
initialize(Configuration)
), and runs the model processor.configuration
- the configuration from which to configure this model
processor instance.public void setLastModifiedCheck(boolean lastModifiedCheck)
lastModifiedCheck
- the lastModifiedCheck to setpublic void setHistoryDir(String historyDir)
historyDir
- the historyDir to setpublic void initialize(Configuration configuration)
process(Configuration)
configuration
- the configuration instance by which to initialize this
model processor instance.protected final List<ModelValidationMessage> loadModelIfNecessary(Model model)
model
- the model to be loaded.final List<ModelValidationMessage> loadIfNecessary(Repository[] repositories)
repositories
- the repositories from which to load the model(s).protected void printConsoleHeader()
public void setModelValidation(boolean modelValidationIn)
true
.modelValidationIn
- true/false on whether model validation should be performed or not.public static boolean getModelValidation()
true
.public void setFailOnValidationErrors(boolean failOnValidationErrors)
true
.failOnValidationErrors
- whether or not processing should fail if any validation errors are present.protected boolean shouldProcess(String namespace)
namespace
should be processed. This is determined in conjunction with
setCartridgeFilter(String)
. If the cartridgeFilter
is not defined and the namespace is
present within the configuration, then this method will ALWAYS return true.namespace
- the name of the namespace to check whether or not it should be processed.public void setCartridgeFilter(String namespaces)
Sets the current cartridge filter. This is a comma separated list of namespaces (matching cartridges names) that should be processed.
If this filter is defined, then any cartridge names found in this list will be processed , while any other discovered cartridges will not be processed .
namespaces
- a comma separated list of the cartridge namespaces to be processed.public void setOutputEncoding(String outputEncoding)
outputEncoding
- the encoding.public void setXmlValidation(boolean xmlValidation)
xmlValidation
to be true/false. This defines whether XML resources loaded by AndroMDA (such as
plugin descriptors) should be validated. Sometimes underlying parsers don't support XML Schema validation and in
that case, we want to be able to turn it off.xmlValidation
- true/false on whether we should validate XML resources used by AndroMDApublic void setLoggingConfigurationUri(String loggingConfigurationUri)
Sets the loggingConfigurationUri
for AndroMDA. This is the URI to an external logging configuration
file. This is useful when you want to override the default logging configuration of AndroMDA.
You can retrieve the default log4j.xml contained within the org.andromda.core.common
package, customize
it, and then specify the location of this logging file with this operation.
loggingConfigurationUri
- the URI to the external logging configuration file.public void shutdown()
protected void filterAndSortValidationMessages(List<ModelValidationMessage> messages, Filters constraints)
messages
first by type (i.e. the metafacade class)
and then by the name
of the model element to which the validation message applies.messages
- the collection of messages to sort.constraints
- any constraint filters to apply to the validation messages.Copyright © 2003–2014 AndroMDA.org. All rights reserved.