use of com.mulesoft.tools.migration.exception.MigrationAbortException in project mule-migration-assistant by mulesoft.
the class AbstractMigrationTask method execute.
@Override
public void execute(MigrationReport report) throws Exception {
// TODO depending on the project type this may not be true
checkState(applicationModel != null, "An application model must be provided.");
List<MigrationStep> steps = enableReporting(getSteps());
try {
if (steps != null) {
MigrationStepSelector stepSelector = new MigrationStepSelector(steps);
if (shouldExecuteAllSteps(stepSelector)) {
steps.stream().filter(s -> s instanceof ExpressionMigratorAware).forEach(s -> ((ExpressionMigratorAware) s).setExpressionMigrator(getExpressionMigrator()));
stepSelector.getNameSpaceContributionSteps().forEach(s -> s.execute(applicationModel, report));
stepSelector.getApplicationModelContributionSteps().forEach(s -> {
s.setApplicationModel(applicationModel);
fetchAndProcessNodes(report, s, new ArrayList<>());
});
stepSelector.getProjectStructureContributionSteps().forEach(s -> {
s.setApplicationModel(applicationModel);
s.execute(applicationModel.getProjectBasePath(), report);
});
stepSelector.getPomContributionSteps().forEach(s -> {
s.setApplicationModel(applicationModel);
s.execute(applicationModel.getPomModel().orElse(new PomModel()), report);
});
}
}
} catch (MigrationAbortException e) {
throw e;
} catch (Exception e) {
throw new MigrationTaskException("Task execution exception. " + e.getMessage(), e);
}
}
use of com.mulesoft.tools.migration.exception.MigrationAbortException in project mule-migration-assistant by mulesoft.
the class DomainReferencePomContribution method execute.
@Override
public void execute(PomModel object, MigrationReport report) throws RuntimeException {
Properties properties = new Properties();
File file = getApplicationModel().getSourceProjectBasePath().resolve("src" + separator + "main" + separator + "app" + separator + "mule-deploy.properties").toFile();
if (!file.exists()) {
return;
}
try (FileInputStream inStream = new FileInputStream(file)) {
properties.load(inStream);
} catch (IOException e) {
throw new RuntimeException(e);
}
if (!properties.containsKey("domain")) {
return;
}
String domain = properties.getProperty("domain");
if ("default".equals(domain)) {
return;
}
if (getApplicationModel().getDomainDocuments() == null || getApplicationModel().getDomainDocuments().isEmpty()) {
throw new MigrationAbortException(format("The application to migrate references a domain '%s'. " + "Call the migrator with the 'parentDomainBasePath' parameter indicating the Mule 3 source for that domain.", domain));
}
object.addDependency(new DependencyBuilder().withGroupId("org.mule.migrated").withArtifactId(domain).withVersion("1.0.0-M4-SNAPSHOT").withClassifier("mule-domain").withScope("provided").build());
}
Aggregations