use of org.commonjava.maven.ext.core.util.ManipulatorPriorityComparator in project pom-manipulation-ext by release-engineering.
the class ManipulationManager method init.
/**
* Initialize {@link ManipulationSession} using the given {@link MavenSession} instance, along with any state managed by the individual
* {@link Manipulator} components.
*
* @param session the container session for manipulation.
* @throws ManipulationException if an error occurs.
*/
public void init(final ManipulationSession session) throws ManipulationException {
logger.debug("Initialising ManipulationManager with user properties {}", session.getUserProperties());
for (final ExtensionInfrastructure infra : infrastructure.values()) {
infra.init(session.getTargetDir(), session.getRemoteRepositories(), session.getLocalRepository(), session.getSettings(), session.getActiveProfiles());
}
orderedManipulators = new ArrayList<>(manipulators.values());
// The RESTState depends upon the VersionState being initialised. Therefore initialise in reverse order
// and do a final sort to run in the correct order. See the Manipulator interface for detailed discussion
// on ordered.
Collections.sort(orderedManipulators, Collections.reverseOrder(new ManipulatorPriorityComparator()));
for (final Manipulator manipulator : orderedManipulators) {
logger.debug("Initialising manipulator " + manipulator.getClass().getSimpleName());
manipulator.init(session);
}
Collections.sort(orderedManipulators, new ManipulatorPriorityComparator());
// Now init the common state
session.setState(new CommonState(session.getUserProperties()));
}
Aggregations