Class ModelPreprocessor
- java.lang.Object
-
- org.apache.sling.maven.slingstart.ModelPreprocessor
-
public class ModelPreprocessor extends Object
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classModelPreprocessor.Environmentstatic classModelPreprocessor.ProjectInfo
-
Constructor Summary
Constructors Constructor Description ModelPreprocessor()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddDependencies(ModelPreprocessor.Environment env)Add dependencies for all projects.protected voidmergeModels(org.apache.sling.provisioning.model.Model base, org.apache.sling.provisioning.model.Model additional)Hook to change the merge behaviorstatic StringnodeValue(org.apache.maven.model.Plugin plugin, String name, String defaultValue)Gets plugins configuration from POM (string parameter).protected org.apache.sling.provisioning.model.ModelpostProcessReadModel(org.apache.sling.provisioning.model.Model result)Hook to post process the local modelprotected org.apache.sling.provisioning.model.ModelreadLocalModel(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.
-
-
-
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- Pluginname- 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, IOExceptionRead all model files from the directory in alphabetical order. Only files ending with .txt or .model are read.- Parameters:
project- The current maven projectinlinedModel- the inlined model to be merged with the models in modelDirectory (may be null)modelDirectory- The directory to scan for modelspattern- Pattern used to find the textual models within the modelDirectorylogger- The logger- Throws:
org.apache.maven.MavenExecutionExceptionIOException
-
postProcessReadModel
protected org.apache.sling.provisioning.model.Model postProcessReadModel(org.apache.sling.provisioning.model.Model result) throws org.apache.maven.MavenExecutionExceptionHook 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.MavenExecutionExceptionHook to change the merge behavior- Parameters:
base- The base modeladditional- The additional model- Throws:
org.apache.maven.MavenExecutionException
-
-