public DependentLoaderImplementation cloneLoader(
      DependentLoader loader, String aditionalDependency) {
    DependentLoaderImplementation otherAsImplementation = (DependentLoaderImplementation) loader;

    DependentLoaderImplementation newLoader =
        new DependentLoaderImplementation(
            otherAsImplementation.artifact,
            loader.getURLs(),
            exposed,
            otherAsImplementation.parent);
    newLoader.dependencies = otherAsImplementation.dependencies;

    if (!"".equals(aditionalDependency)) {
      DependentLoaderImplementation dependency =
          enshureDependencyJarLoaded(otherAsImplementation.artifact, aditionalDependency);
      ArrayList<DependentLoaderImplementation> depList =
          new ArrayList<DependentLoaderImplementation>();
      for (DependentLoaderImplementation dependentLoaderImplementation : newLoader.dependencies) {
        depList.add(dependentLoaderImplementation);
      }
      depList.add(dependency);
      newLoader.setDependencies(depList.toArray(new DependentLoaderImplementation[depList.size()]));
    }
    visitLoader(newLoader);
    return newLoader;
  }
Beispiel #2
0
 private boolean startLauncher(File dir) {
   try {
     Runtime rt = Runtime.getRuntime();
     ArrayList<String> command = new ArrayList<String>();
     command.add("java");
     command.add("-jar");
     command.add("Launcher.jar");
     String[] cmdarray = command.toArray(new String[command.size()]);
     Process proc = rt.exec(cmdarray, null, dir);
     return true;
   } catch (Exception ex) {
     System.err.println("Unable to start the Launcher program.\n" + ex.getMessage());
     return false;
   }
 }
  public DependentLoaderImplementation[] getLoaded(String filter) {
    DefaultArtifact asArtifact = new DefaultArtifact(filter);
    DependentLoaderImplementation theLoader = findOverride(asArtifact);
    if (theLoader != null) {
      DependentLoaderImplementation[] retVal = {theLoader};
      return retVal;
    }

    if (loaderMap.containsKey(filter)) {
      DependentLoaderImplementation[] retVal = {loaderMap.get(filter)};
      return retVal;
    }

    ArrayList<DependentLoaderImplementation> result = new ArrayList();
    for (String key : loaderMap.keySet()) {
      if (key.startsWith(filter)) {
        result.add(loaderMap.get(key));
      }
    }
    ;
    return Arrays.copyOf(result.toArray(), result.size(), DependentLoaderImplementation[].class);
  }