Source:
public void deploy() throws DeploymentException { cloudhubApi.init(); info("Deploying application " + getApplicationName() + " to Cloudhub"); if (!getApplicationFile().exists()) { throw new DeploymentException("Application file " + getApplicationFile() + " does not exist."); } try { boolean domainAvailable = cloudhubApi.isNameAvailable(getApplicationName()); if (domainAvailable) { info("Creating application " + getApplicationName()); cloudhubApi.createApplication(getApplicationName(), region, muleVersion, workers, workerType, properties); } else { Application app = findApplicationFromCurrentUser(getApplicationName()); if (app != null) { info("Application " + getApplicationName() + " already exists, redeploying"); String updateRegion = (region == null) ? app.region : region; String updateMuleVersion = (muleVersion == null) ? app.muleVersion : muleVersion; Integer updateWorkers = (workers == null) ? app.workers : workers; String updateWorkerType = (workerType == null) ? app.workerType : workerType; Map<String, String> updateProperties = (properties == null || properties.isEmpty()) ? null : properties; cloudhubApi.updateApplication(getApplicationName(), updateRegion, updateMuleVersion, updateWorkers, updateWorkerType, updateProperties); } else { error("Domain " + getApplicationName() + " is not available. Aborting."); throw new DeploymentException("Domain " + getApplicationName() + " is not available. Aborting."); } } info("Uploading application contents " + getApplicationName()); cloudhubApi.uploadFile(getApplicationName(), getApplicationFile()); info("Starting application " + getApplicationName()); cloudhubApi.startApplication(getApplicationName()); } catch (ApiException e) { error("Failed: " + e.getMessage()); throw new DeploymentException("Failed to deploy application " + getApplicationName(), e); } }

Target:
public void deploy() throws DeploymentException { cloudhubApi.init(); info("Deploying application " + getApplicationName() + " to Cloudhub"); if (!getApplicationFile().exists()) { throw new DeploymentException("Application file " + getApplicationFile() + " does not exist."); } try { boolean domainAvailable = cloudhubApi.isNameAvailable(getApplicationName()); if (domainAvailable) { info("Creating application " + getApplicationName()); cloudhubApi.createApplication(getApplicationName(), region, muleVersion, workers, workerType, properties); } else { Application app = findApplicationFromCurrentUser(getApplicationName()); if (app != null) { info("Application " + getApplicationName() + " already exists, redeploying"); String updateRegion = (region == null) ? app.region : region; String updateMuleVersion = (muleVersion == null) ? app.muleVersion : muleVersion; Integer updateWorkers = (workers == null) ? app.workers : workers; String updateWorkerType = (workerType == null) ? app.workerType : workerType; cloudhubApi.updateApplication(getApplicationName(), updateRegion, updateMuleVersion, updateWorkers, updateWorkerType, properties); } else { error("Domain " + getApplicationName() + " is not available. Aborting."); throw new DeploymentException("Domain " + getApplicationName() + " is not available. Aborting."); } } info("Uploading application contents " + getApplicationName()); cloudhubApi.uploadFile(getApplicationName(), getApplicationFile()); info("Starting application " + getApplicationName()); cloudhubApi.startApplication(getApplicationName()); } catch (ApiException e) { error("Failed: " + e.getMessage()); throw new DeploymentException("Failed to deploy application " + getApplicationName(), e); } }