Exemplo n.º 1
0
 protected Installation findProcessInstallation(String id) {
   List<Installation> installations = processManager.listInstallations();
   for (Installation installation : installations) {
     String name = installation.getName();
     if (Objects.equal(id, name)) {
       return installation;
     }
   }
   return null;
 }
Exemplo n.º 2
0
  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;
    }
  }
Exemplo n.º 3
0
  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;
  }