org.apache.sling.maven.slingstart

## Class ModelPreprocessor

- java.lang.Object
- - org.apache.sling.maven.slingstart.ModelPreprocessor

    public class ModelPreprocessor
    extends Object

### Nested Class Summary

Nested Classes
`static class` `ModelPreprocessor.Environment`
`static class` `ModelPreprocessor.ProjectInfo`

### Constructor Summary

Constructors
Constructor and Description
`ModelPreprocessor()`

### Method Summary

All Methods Static Methods Instance Methods Concrete Methods
`void` `addDependencies(ModelPreprocessor.Environment env)` Add dependencies for all projects.
`protected void` `mergeModels(org.apache.sling.provisioning.model.Model base, org.apache.sling.provisioning.model.Model additional)` Hook to change the merge behavior
`static String` `nodeValue(org.apache.maven.model.Plugin plugin, String name, String defaultValue)` Gets plugins configuration from POM (string parameter).
`protected org.apache.sling.provisioning.model.Model` `postProcessReadModel(org.apache.sling.provisioning.model.Model result)` Hook to post process the local model
`protected org.apache.sling.provisioning.model.Model` `readLocalModel(org.apache.maven.project.MavenProject project, String inlinedModel, File modelDirectory, String pattern, org.codehaus.plexus.logging.Logger logger)` Read all model files from the directory in alphabetical order.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Constructor Detail

#### ModelPreprocessor

    public ModelPreprocessor()

### Method Detail

#### addDependencies

    public void addDependencies(ModelPreprocessor.Environment env)
                         throws org.apache.maven.MavenExecutionException

Add dependencies for all projects.

Parameters:
  `env` - The environment with all maven settings and projects
Throws:
  `org.apache.maven.MavenExecutionException` - If anything goes wrong.

#### nodeValue

    public static String nodeValue(org.apache.maven.model.Plugin plugin,
                                   String name,
                                   String defaultValue)

Gets plugins configuration from POM (string parameter).

Parameters:
  `plugin` - Plugin
  `name` - Configuration parameter.
  `defaultValue` - Default value that is returned if parameter is not set
Returns:
  Parameter value or default value.

#### readLocalModel

    protected org.apache.sling.provisioning.model.Model readLocalModel(org.apache.maven.project.MavenProject project,
                                                                       String inlinedModel,
                                                                       File modelDirectory,
                                                                       String pattern,
                                                                       org.codehaus.plexus.logging.Logger logger)
                                                                throws org.apache.maven.MavenExecutionException,
                                                                       IOException

Read all model files from the directory in alphabetical order. Only files ending with .txt or .model are read.

Parameters:
  `project` - The current maven project
  `inlinedModel` - the inlined model to be merged with the models in modelDirectory (may be null)
  `modelDirectory` - The directory to scan for models
  `pattern` - Pattern used to find the textual models within the modelDirectory
  `logger` - The logger
Throws:
  `org.apache.maven.MavenExecutionException`
  `IOException`

#### postProcessReadModel

    protected org.apache.sling.provisioning.model.Model postProcessReadModel(org.apache.sling.provisioning.model.Model result)
                                                                      throws org.apache.maven.MavenExecutionException

Hook to post process the local model

Parameters:
  `result` - The read model
Returns:
  The post processed model
Throws:
  `org.apache.maven.MavenExecutionException`

#### mergeModels

    protected void mergeModels(org.apache.sling.provisioning.model.Model base,
                               org.apache.sling.provisioning.model.Model additional)
                        throws org.apache.maven.MavenExecutionException

Hook to change the merge behavior

Parameters:
  `base` - The base model
  `additional` - The additional model
Throws:
  `org.apache.maven.MavenExecutionException`