コード例 #1
0
ファイル: SystemInstance.java プロジェクト: kdchamil/ASTomEE
  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);
  }
コード例 #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);
    }
  }