void uninstallProcess(ProcessRequirements requirements) throws Exception { String id = requirements.getId(); Installation installation = findProcessInstallation(id); // for now lets remove it just in case! :) if (installation != null) { ProcessController controller = installation.getController(); try { controller.stop(); } catch (Exception e) { LOG.warn("Ignored exception while trying to stop process " + installation + " " + e); } controller.uninstall(); controller = null; } }
Installation provisionProcess(ProcessRequirements requirements) throws Exception { // TODO check that the installation is the same uninstallProcess(requirements); String id = requirements.getId(); InstallOptions installOptions = requirements.createInstallOptions(); Profile processProfile = getProcessProfile(requirements, true); Profile deployProcessProfile = getProcessProfile(requirements, false); Map<String, String> configuration = getProcessLayout(processProfile, requirements.getLayout()); DownloadManager downloadManager = DownloadManagers.createDownloadManager(fabricService, processProfile, executorService); InstallTask applyConfiguration = new ApplyConfigurationTask(configuration, installOptions.getProperties()); InstallTask applyProfile = new DeploymentTask(downloadManager, deployProcessProfile); InstallTask compositeTask = new CompositeTask(applyConfiguration, applyProfile); Installation installation = processManager.install(installOptions, compositeTask); if (installation != null) { installation.getController().start(); } return installation; }