public String[] getConfigurations() {
   Set<ConfigSpec> configSpecs = propertiesPerConfig.keySet();
   List<String> result = new ArrayList<String>();
   for (ConfigSpec configSpec : configSpecs) {
     result.add(configSpec.toStringForAdvice());
   }
   return result.toArray(new String[result.size()]);
 }
 private static void ensureRootFilesConfigured(
     RootFilesProperties rootProperties, ConfigSpec configuration) {
   if (rootProperties.getFileMap().keySet().size() == 0) {
     String message;
     if (configuration.equals(ConfigSpec.GLOBAL)) {
       message = "Cannot set permissions or symbolic links if there are no root files";
     } else {
       message =
           "Cannot set permissions or symbolic links for "
               + configuration.toOsString()
               + " if there are no root files for that configuration";
     }
     throw new IllegalArgumentException(message);
   }
 }
 private FileSetDescriptor initDescriptor(ConfigSpec configuration, String configurationAsString) {
   String fileSetDescriptorKey =
       configuration.equals(ConfigSpec.GLOBAL)
           ? RootPropertiesParser.ROOT_KEY_SEGMENT
           : RootPropertiesParser.ROOT_KEY_SEGMENT + '.' + configurationAsString;
   FileSetDescriptor rootFilesDescriptor =
       new FileSetDescriptor(fileSetDescriptorKey, configurationAsString);
   return rootFilesDescriptor;
 }
  public FileSetDescriptor getDescriptor(String wsOsArch) {
    ConfigSpec configuration = ConfigSpec.createFromWsOsArch(wsOsArch);
    RootFilesProperties rootProperties = propertiesPerConfig.get(configuration);
    if (rootProperties == null) return null;

    // p2 will ignore permissions unless there are root files configured for the same configuration
    ensureRootFilesConfigured(rootProperties, configuration);

    FileSetDescriptor rootFilesDescriptor = initDescriptor(configuration, wsOsArch);
    copyRootPropertiesToDescriptor(rootProperties, rootFilesDescriptor);
    return rootFilesDescriptor;
  }
 private String fixLoadRule(String loadRule) {
   if (StringUtils.isBlank(loadRule)) {
     return loadRule;
   }
   // Remove leading file separator, we don't need it when using add_loadrules
   String quotedLR = ConfigSpec.cleanLoadRule(loadRule, getLauncher().getLauncher().isUnix());
   if (quotedLR.startsWith("\"") && quotedLR.endsWith("\"")) {
     return "\"" + quotedLR.substring(2);
   } else {
     return quotedLR.substring(1);
   }
 }
  public IPathComputer getRootFileComputer(final String configSpec) {
    final FileToPathMap filesMap =
        propertiesPerConfig.get(ConfigSpec.createFromWsOsArch(configSpec)).getFileMap();

    return new IPathComputer() {
      public void reset() {
        // do nothing
      }

      public IPath computePath(File fileInSources) {
        IPath fileInInstallation = filesMap.get(fileInSources);
        return fileInInstallation;
      }
    };
  }