Additional Expansion Steps
AdditionalExpansionSteps are a way to add logic before or after expanding.
Some of the AdditionalExpansionSteps provided by the Expanders you may already know:
- ExtDirectoryCopierStep: copies the
ext
directories for each Component to the expansion folder from the source directory - ExtDirectoryHarvesterStep: harvests the customizations in the
ext
directories - OverlayDirectoryCopierStep: copies overlay files after expansion
Setup
AdditionalExpansionSteps have 2 components:
- An XML file describing the step
- A java implementation implementing the
AdditionalExpansionStepImplementation
interface
- MyExpansionStep.xml
- MyExpansionStep.java
<additionalExpansionStep name="MyExpansionStep" xmlns="https://schemas.normalizedsystems.org/xsd/prime-core/2022/10/1/additionalExpansionStep">
<packageName>net.democritus.some.package</packageName>
<!-- Can be Application, Component or even Elements, like DataElement -->
<elementTypeName>Application</elementTypeName>
<!-- Always java, no alternatives yet -->
<type>java</type>
<!-- phase of the expansion when to run the step -->
<phase>expansion</phase>
<!-- If defined, this expansionStep will only run when the technology is present -->
<technology name="EJB3"/>
<!-- condition when to run the step -->
<isApplicable>true</isApplicable>
<!-- set to false to exclude this step -->
<active value="true"/>
</additionalExpansionStep>
package net.democritus.some.package;
import net.democritus.elements.ApplicationComposite;
import net.democritus.expander.AdditionalExpansionStepImplementation;
import net.democritus.expander.context.ProgramExpansionContext;
public class MyExpansionStep
implements AdditionalExpansionStepImplementation<ProgramExpansionContext<ApplicationComposite>> {
public void run(ProgramExpansionContext<ApplicationComposite> expansionContext) {
// Implement some logic
}
}
packaging
AdditionalExpansionSteps are packaged just like Expanders and Features by the expansionResource
mojo of the expanders-maven-plugin.
Just make sure you have an XML with the additionalExpansionStep
tag and the name of the expansionStep ends with Step
.