public static Stage getStage(Pipeline c, Object id, String stageName, String className, String ... afterStage) throws Exception { Stage s = new Stage(stageName, new DatabaseFile()); s.getDatabaseFile().setId(id); StageGroup g = new StageGroup(stageName); c.addGroup(g); g.addStage(s); Map<String, Object> props = new HashMap<String, Object>(); props.put("stageClass", "com.findwise.hydra."+className); if(afterStage!=null && afterStage.length>0) { props.put("queryOptions", new String[]{"touched("+afterStage[0]+",true)"}); } s.setProperties(props); return s; }
.getPipeline(); StageGroup g = new StageGroup(s.getName()); g.addStage(s); pipeline.addGroup(g); mdc.getPipelineWriter().write(pipeline);
private Pipeline getPipeline(Stage.Mode mode) { Pipeline p = new Pipeline(); DBCursor cursor = stages.find(new BasicDBObject(ACTIVE_KEY, mode.toString())); while(cursor.hasNext()) { DBObject obj = cursor.next(); if(!obj.containsField(TYPE_KEY) || STAGE_TYPE.equals(obj.get(TYPE_KEY))) { Stage s = getStage(obj); if(!p.hasGroup(getGroupName(obj))) { p.addGroup(new StageGroup(getGroupName(obj))); } p.getGroup(getGroupName(obj)).addStage(s); } else { addGroup(p, getGroup(obj)); } } return p; }