public StageGroup getGroupForStage(String name) { for (StageGroup g : getStageGroups()) { if (g.hasStage(name)) { return g; } } return null; }
public Set<Stage> getStages() { HashSet<Stage> stages = new HashSet<Stage>(); for(StageGroup g : getStageGroups()) { stages.addAll(g.getStages()); } return stages; }
@Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null || getClass() != obj.getClass()) { return false; } Pipeline other = (Pipeline) obj; if(other.getStageGroups().size()==getStageGroups().size()) { for(StageGroup g : other.getStageGroups()) { if(!hasGroup(g.getName()) || !g.equals(getGroup(g.getName()))) { return false; } } return true; } return false; }
private Set<String> getChangedGroups(Pipeline newPipeline) { HashSet<String> list = new HashSet<String>(); for(StageGroup group : pipeline.getStageGroups()) { if(!newPipeline.hasGroup(group.getName()) || !group.equals(newPipeline.getGroup(group.getName()))) { list.add(group.getName()); } } return list; }
private void addMissingGroups(Pipeline newPipeline) { for(StageGroup group : newPipeline.getStageGroups()) { if(!pipeline.hasGroup(group.getName())) { pipeline.addGroup(group); if(attachFiles(group)) { sm.addRunner(new StageRunner(group, new File(namespace), port, conf.isPerformanceLogging(), conf.getLoggingPort(), shutdownHandler)); } else { logger.error("Was unable to start the stage group '"+group.getName()+"' due to missing libraries."); } } } }
@Override public void write(Pipeline p) throws IOException { Pipeline old = reader.getPipeline(); for(Stage s : old.getStages()) { inactivate(s); } for(StageGroup g : p.getStageGroups()) { write(g); } }
public static void removeStage(MongoConnector mdc, CommandLine cmd) throws IOException { if(!cmd.hasOption("n")) { System.out.println("No stage name specified\n"); printUsage(cmd); return; } String name = cmd.getOptionValue("n"); Pipeline pipeline = mdc.getPipelineReader().getPipeline(); if(pipeline.getStage(name) == null) { System.out.println("Specified stage '"+name+"' did not exist\n"); return; } boolean found = false; for(StageGroup g : pipeline.getStageGroups()) { if(g.hasStage(name)) { g.removeStage(name); found = true; break; } } if(found) { mdc.getPipelineWriter().write(pipeline); System.out.println("Successfully removed stage '"+name+"'"); } else { System.out.println("Unable to delete '"+name+"'. Stage did not exist."); } }
for(StageGroup g : pipeline.getStageGroups()) { if(g.hasStage(s.getName())) { g.removeStage(s.getName());