/** Ensure configuration is extracted for master project. */ public void ensureConf() { try { if (ProjectUtil.hasFile(project(), Conf.PROJ_PATH)) { return; } ProjectUtil.copyFromClasspathIntoProject( Project.class, Conf.KLAZ_PATH, project(), Conf.PROJ_PATH); } catch (final Throwable e) { Plugin.logErrr("Project#ensureConf: failure", e); } }
/** 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); } }
@Override Change next() { return ProjectUtil.severity(project()) // != IMarker.SEVERITY_ERROR ? Change.POSITIVE : Change.NEGATIVE; }
@Override Change next() { return ProjectUtil.manifest(project()) . // exists() ? Change.POSITIVE : Change.NEGATIVE; }
/** 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); }