Search in sources :

Example 16 with MigrationStepException

use of com.mulesoft.tools.migration.exception.MigrationStepException in project mule-migration-assistant by mulesoft.

the class SetSecureProperties method execute.

@Override
public void execute(Path projectBasePath, MigrationReport report) throws RuntimeException {
    try {
        List<String> secureProperties = resolveSecureProperties(projectBasePath);
        if (!secureProperties.isEmpty()) {
            MuleArtifactJsonModel currentModel = MuleArtifactJsonModelUtils.buildMuleArtifactJson(projectBasePath.resolve(MULE_ARTIFACT_JSON));
            MuleArtifactJsonModel updatedModel = MuleArtifactJsonModelUtils.buildMinimalMuleArtifactJson(currentModel.getMinMuleVersion(), secureProperties);
            FileUtils.write(projectBasePath.resolve(MULE_ARTIFACT_JSON).toFile(), updatedModel.toString(), MULE_ARTIFACT_DEFAULT_CHARSET);
        }
    } catch (IOException e) {
        throw new MigrationStepException("Could not update secureProperties based on mule-app.properties", e);
    }
}
Also used : MigrationStepException(com.mulesoft.tools.migration.exception.MigrationStepException) MuleArtifactJsonModel(com.mulesoft.tools.migration.project.model.artifact.MuleArtifactJsonModel) IOException(java.io.IOException)

Aggregations

MigrationStepException (com.mulesoft.tools.migration.exception.MigrationStepException)16 Element (org.jdom2.Element)5 MigrationReport (com.mulesoft.tools.migration.step.category.MigrationReport)3 IOException (java.io.IOException)3 Document (org.jdom2.Document)3 ApplicationModel (com.mulesoft.tools.migration.project.model.ApplicationModel)2 ArrayList (java.util.ArrayList)2 List (java.util.List)2 Attribute (org.jdom2.Attribute)2 Namespace (org.jdom2.Namespace)2 Preconditions.checkArgument (com.google.common.base.Preconditions.checkArgument)1 Preconditions.checkState (com.google.common.base.Preconditions.checkState)1 Lists.newArrayList (com.google.common.collect.Lists.newArrayList)1 MigrationAbortException (com.mulesoft.tools.migration.exception.MigrationAbortException)1 MigrationTaskException (com.mulesoft.tools.migration.exception.MigrationTaskException)1 AbstractOSMigrator (com.mulesoft.tools.migration.library.mule.steps.os.AbstractOSMigrator)1 WatermarkSelectorMigrator (com.mulesoft.tools.migration.library.tools.mel.WatermarkSelectorMigrator)1 ApplicationModelUtils.addAttribute (com.mulesoft.tools.migration.project.model.ApplicationModelUtils.addAttribute)1 ApplicationModelUtils.addChildNode (com.mulesoft.tools.migration.project.model.ApplicationModelUtils.addChildNode)1 ApplicationModelUtils.changeAttribute (com.mulesoft.tools.migration.project.model.ApplicationModelUtils.changeAttribute)1