예제 #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);
    }
  }
예제 #2
0
 /**
  * Extracts the {@link URI}/{@link Repository} map from the profile.
  *
  * @param p
  * @return
  * @throws URISyntaxException
  */
 public Map<URI, Repository> getRepositories(Profile p) throws Exception {
   Map<URI, Repository> repositories = new HashMap<URI, Repository>();
   for (String repositoryUrl : p.getRepositories()) {
     URI repoUri = new URI(repositoryUrl);
     AgentUtils.addRepository(downloadManager, repositories, repoUri);
   }
   return repositories;
 }