コード例 #1
0
    /** Create worker-specific fileinstall.cfg file for the master. */
    public void confCreate(final String worker) {
      ensureConf();
      final Conf conf = conf();

      if (!ResourceUtil.hasProject(worker)) {
        Plugin.logWarn("Project#confCreate: missing project: " + worker);
        return;
      }

      final Map<String, String> variables = //
          Conf.variables(ResourceUtil.workspacePath(), worker, ResourceUtil.projectPath(worker));

      final String path =
          ConfUtil.replace( //
              conf.fileinstallPath(), variables);

      final String tempalte =
          ConfUtil.replace( //
              conf.fileinstallTemplate(), variables);

      final File file = ProjectUtil.file(project(), path);

      try {
        FileUtil.writeTextFile(file, tempalte);
        Plugin.logOK("Project#confCreate file: " + file);
      } catch (final Throwable e) {
        Plugin.logErrr("Project#confCreate failure", e);
      }
    }
コード例 #2
0
    /** Delete worker-specific fileinstall.cfg file for the master. */
    public void confDelete(final String worker) {

      if (!ResourceUtil.hasProject(worker)) {
        Plugin.logWarn("Project#confDelete: missing project: " + worker);
        return;
      }

      ensureConf();
      final Conf conf = conf();

      final Map<String, String> variables = //
          Conf.variables(ResourceUtil.workspacePath(), worker, ResourceUtil.projectPath(worker));

      final String path =
          ConfUtil.replace( //
              conf.fileinstallPath(), variables);

      final File file = ProjectUtil.file(project(), path);

      file.delete();

      Plugin.logOK("Project#confDelete file: " + file);
    }