Beispiel #1
0
 public ProjectTool() {
   final File basedir = new File(Constants.getSystemBaseDir());
   /** Initialize the log4j logger */
   PropertyConfigurator.configure(
       new File(new File(basedir, "etc"), "log4j.properties").getAbsolutePath());
   framework = Framework.getInstance(Constants.getSystemBaseDir());
 }
Beispiel #2
0
  /**
   * Create project.properties file based on $RDECK_BASE/etc/project.properties
   *
   * @param overwrite Overwrite existing properties file
   */
  protected void generateProjectPropertiesFile(final boolean overwrite) {
    Copy copyTask = new Copy();
    Project antProject = new Project();
    antProject.setProperty("project.name", getName());
    Property propTask = new Property();
    propTask.setProject(antProject);
    propTask.setFile(
        new File(
            Constants.getFrameworkProperties(
                getFrameworkProjectMgr().getFramework().getBaseDir().getAbsolutePath())));
    propTask.execute();
    copyTask.setProject(antProject);
    copyTask.setOverwrite(overwrite);
    final File destfile = new File(getEtcDir(), PROP_FILENAME);
    copyTask.setTofile(destfile);
    copyTask.setFile(
        new File(getFrameworkProjectMgr().getFramework().getConfigDir(), PROP_FILENAME));
    copyTask.setFiltering(true);
    copyTask.createFilterChain().add(new ExpandProperties());

    // execute the task
    copyTask.execute();
    getLogger().debug("generated project.properties: " + destfile.getAbsolutePath());
  }
  JarPluginScanner(
      final File extdir,
      final File cachedir,
      final FileCache<ProviderLoader> filecache,
      final int rescanInterval) {
    super(extdir, filecache, rescanInterval);
    this.cachedir = cachedir;
    this.pluginJarCacheDirectory =
        new File(Constants.getBaseTempDirectory() + Constants.FILE_SEP + JAR_SCRATCH_DIRECTORY);

    // Clean up old caches on startup.
    log.info(String.format("Deleting plugin jar cache at %s", pluginJarCacheDirectory));
    if (pluginJarCacheDirectory.exists() && !FileUtils.deleteDir(pluginJarCacheDirectory)) {
      log.warn("Could not delete plugin jar cache");
    }
    log.info(String.format("Deleting plugin lib dependency directory at %s", this.cachedir));
    if (this.cachedir.exists() && !FileUtils.deleteDir(this.cachedir)) {
      log.warn("Could not delete plugin lib dependency directory");
    }

    // Create the directories
    this.cachedir.mkdirs();
    this.pluginJarCacheDirectory.mkdirs();
  }