com.aeontronix.enhancedmule.tools.anypoint.application.deploy.RuntimeDeploymentRequest Maven / Gradle / Ivy
/*
* Copyright (c) Aeontronix 2021
*/
package com.aeontronix.enhancedmule.tools.anypoint.application.deploy;
import com.aeontronix.enhancedmule.tools.anypoint.Environment;
import com.aeontronix.enhancedmule.tools.application.ApplicationDescriptor;
import com.aeontronix.enhancedmule.tools.application.deployment.DeploymentParameters;
import com.aeontronix.enhancedmule.tools.anypoint.provisioning.ProvisioningRequest;
import com.aeontronix.enhancedmule.tools.runtime.CHApplication;
import com.fasterxml.jackson.databind.JsonNode;
import org.slf4j.Logger;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.util.*;
import static java.lang.Boolean.TRUE;
import static org.slf4j.LoggerFactory.getLogger;
public class RuntimeDeploymentRequest extends AbstractDeploymentRequest implements ProvisioningRequest {
private static final Logger logger = getLogger(RuntimeDeploymentRequest.class);
private ApplicationDescriptor applicationDescriptor;
private String appName;
private String artifactId;
private Environment environment;
private boolean injectEnvInfo;
private String target;
private String filename;
private final HashMap vars = new HashMap<>();
private final HashMap properties = new HashMap<>();
private HashSet overrideProperties = new HashSet<>();
private Map fileProperties;
private String filePropertiesPath = "config.properties";
private boolean filePropertiesSecure;
private boolean skipWait;
private boolean skipProvisioning;
private JsonNode legacyAppDescriptor;
private boolean deleteSnapshots;
public RuntimeDeploymentRequest(String filename, String appName, String artifactId, String buildNumber,
Map vars, Map properties, File propertyfile,
boolean ignoreMissingPropertyFile, String target, Environment environment, boolean injectEnvInfo, boolean skipWait,
boolean skipProvisioning, JsonNode legacyAppDescriptor) throws IOException {
super(buildNumber);
this.filename = filename;
this.appName = appName;
this.artifactId = artifactId;
this.environment = environment;
this.injectEnvInfo = injectEnvInfo;
this.skipWait = skipWait;
this.skipProvisioning = skipProvisioning;
this.legacyAppDescriptor = legacyAppDescriptor;
if (vars != null && !vars.isEmpty()) {
this.vars.putAll(vars);
}
this.properties.putAll(buildProperties(properties, propertyfile, ignoreMissingPropertyFile, injectEnvInfo));
this.target = target;
this.vars.put("environment.id", environment.getId());
this.vars.put("environment.name", environment.getName());
this.vars.put("environment.lname", environment.getLName());
this.vars.put("environment.suffix", environment.getSuffix());
this.vars.put("environment.type", environment.getType() != null ? environment.getType().name() : null);
this.vars.put("organization.name", environment.getOrganization().getName());
this.vars.put("organization.lname", environment.getOrganization().getName().replace(" ", "_").toLowerCase());
}
private Map buildProperties(Map properties, File propertyfile, boolean ignoreMissingPropertyFile,
boolean injectEnvInfo) throws IOException {
if (properties == null) {
properties = new HashMap<>();
}
if (propertyfile != null) {
if (propertyfile.exists()) {
Properties fileProps = new Properties();
try (FileInputStream fis = new FileInputStream(propertyfile)) {
fileProps.load(fis);
}
for (Map.Entry
© 2015 - 2025 Weber Informatics LLC | Privacy Policy