Beispiel #1
0
  private static void addSystemProperties(final File file) {
    if (!file.exists()) {
      return;
    }

    final Properties systemProperties;
    try {
      systemProperties = IO.readProperties(file);
    } catch (IOException e) {
      return;
    }

    system.getProperties().putAll(systemProperties);
  }
Beispiel #2
0
  public static void addAdditionalLibraries() throws IOException {
    final File conf = SystemInstance.get().getConf(ADDITIONAL_LIB_CONFIG);
    if (conf == null || !conf.exists()) {
      return;
    }

    final Properties additionalLibProperties = IO.readProperties(conf);

    final List<String> libToCopy = new ArrayList<String>();
    final String toCopy = additionalLibProperties.getProperty(JAR_KEY);
    if (toCopy != null) {
      for (final String lib : toCopy.split(",")) {
        libToCopy.add(realLocation(lib.trim()));
      }
    }
    final String toExtract = additionalLibProperties.getProperty(ZIP_KEY);
    if (toExtract != null) {
      for (final String zip : toExtract.split(",")) {
        libToCopy.addAll(extract(realLocation(zip)));
      }
    }

    final File destination;
    if (additionalLibProperties.containsKey(DESTINATION_KEY)) {
      destination = new File(additionalLibProperties.getProperty(DESTINATION_KEY));
    } else {
      destination =
          new File(SystemInstance.get().getBase().getDirectory(), Embedder.ADDITIONAL_LIB_FOLDER);
    }
    if (!destination.exists()) {
      Files.mkdirs(destination);
    }

    for (final String lib : libToCopy) {
      copy(new File(lib), destination);
    }
  }