Пример #1
0
  @Override
  public void install(ProcessConfig config, int id, File installDir) throws Exception {
    File baseDir = ProcessUtils.findInstallDir(installDir);
    Set<String> bundles = new LinkedHashSet<String>(profile.getBundles());
    Set<Feature> features = getFeatures(profile);
    LOG.info("Deploying into external container features " + features + " and bundles " + bundles);
    Map<String, File> files =
        AgentUtils.downloadBundles(
            downloadManager, features, bundles, Collections.<String>emptySet());
    Set<Map.Entry<String, File>> entries = files.entrySet();
    for (Map.Entry<String, File> entry : entries) {
      String name = entry.getKey();
      File file = entry.getValue();
      String destPath;
      String fileName = file.getName();
      if (name.startsWith("war:")
          || name.contains("/war/")
          || fileName.toLowerCase().endsWith(".war")) {
        destPath = config.getDeployPath();
      } else {
        destPath = config.getSharedLibraryPath();
      }

      File destDir = new File(baseDir, destPath);
      File destFile = new File(destDir, fileName);
      LOG.debug("Copying file " + fileName + " to :  " + destFile.getCanonicalPath());
      FileUtils.copyFile(file, destFile);
    }
  }