use of com.thoughtworks.go.domain.PiplineConfigVisitor in project gocd by gocd.
the class GoDashboardCurrentStateLoader method allPipelines.
public List<GoDashboardPipeline> allPipelines(CruiseConfig config) {
List<String> pipelineNames = CaseInsensitiveString.toStringList(config.getAllPipelineNames());
PipelineInstanceModels historyForDashboard = loadHistoryForPipelines(pipelineNames);
LOGGER.debug("Loading permissions from authority");
final Map<CaseInsensitiveString, Permissions> pipelinesAndTheirPermissions = permissionsAuthority.pipelinesAndTheirPermissions();
final List<GoDashboardPipeline> pipelines = new ArrayList<>(1024);
LOGGER.debug("Populating dashboard pipelines");
config.accept(new PipelineGroupVisitor() {
@Override
public void visit(final PipelineConfigs group) {
group.accept(new PiplineConfigVisitor() {
@Override
public void visit(PipelineConfig pipelineConfig) {
long start = System.currentTimeMillis();
Permissions permissions = permissionsFor(pipelineConfig, pipelinesAndTheirPermissions);
pipelines.add(createGoDashboardPipeline(pipelineConfig, permissions, historyForDashboard, group));
LOGGER.debug("It took {}ms to process pipeline {}", (System.currentTimeMillis() - start), pipelineConfig.getName());
}
});
}
});
LOGGER.debug("Done populating dashboard pipelines");
this.everLoadedCurrentState = true;
return pipelines;
}
use of com.thoughtworks.go.domain.PiplineConfigVisitor in project gocd by gocd.
the class PipelineScheduler method onConfigChange.
public void onConfigChange(CruiseConfig newCruiseConfig) {
synchronized (pipelines) {
newCruiseConfig.accept(new PiplineConfigVisitor() {
public void visit(PipelineConfig pipelineConfig) {
addPipelineIfNotPresent(pipelineConfig, pipelines);
}
});
List<String> deletedPipeline = new ArrayList<>();
for (String pipelineName : pipelines.keySet()) {
if (!newCruiseConfig.hasPipelineNamed(new CaseInsensitiveString(pipelineName))) {
deletedPipeline.add(pipelineName);
}
}
for (String pipelineName : deletedPipeline) {
pipelines.remove(pipelineName);
}
}
}
Aggregations