public List<Stage> createStages(PipelineConfiguration pipelineConfig) { List<Stage> stages = new ArrayList<Stage>(); for (Map<String, Object> stageConfig : pipelineConfig) { String jarId = (String) stageConfig.get(JAR_ID); String stageName = (String) stageConfig.get(STAGE_NAME); DatabaseFile df = new DatabaseFile(); df.setId(jarId); Stage s = new Stage(stageName, df); s.setProperties(stageConfig); s.setMode(Stage.Mode.ACTIVE); stages.add(s); } return stages; } }
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; }
df.setId(libraryId); Stage s = new Stage(name, df); s.setProperties(map); if(debug) {
@SuppressWarnings("unchecked") private Stage getStage(DBObject dbo) { Stage stage = new Stage((String)dbo.get(STAGE_KEY), getFile(dbo.get(FILE_KEY))); DBObject props = (DBObject) dbo.get(PROPERTIES_KEY); stage.setMode(Mode.valueOf((String)dbo.get(ACTIVE_KEY))); stage.setPropertiesModifiedDate((Date)props.get(PROPERTIES_DATE_SUBKEY)); DBObject properties = (DBObject) props.get(PROPERTIES_MAP_SUBKEY); HashMap<String, Object> map = new HashMap<String, Object>(); if(properties!=null) { map.putAll(properties.toMap()); } stage.setProperties(map); return stage; }