Package com.findwise.hydra

Examples of com.findwise.hydra.Stage


            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;
    }
View Full Code Here


    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 {
View Full Code Here

    return sg;
  }
 
  @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;
  }
View Full Code Here

  }
 
  @ResponseBody
  @RequestMapping(method = RequestMethod.GET, value = "/stages/{stageName}")
  public Stage getStageInfo(@PathVariable(value = "stageName") String stageName) {
    Stage stageInfo = stagesService.getStageInfo(stageName);
    if (null != stageInfo) {
      return stageInfo;
    } else {
      throw new HttpResourceNotFoundException();
    }
View Full Code Here

   */
  public void addStage(String libraryId, String groupName, String name, String jsonConfig, boolean debug) throws JsonException, IOException {
    if(groupName == null) {
      groupName = name;
    }
    Stage s = new Stage(name, toDatabaseFile(libraryId));
    Map<String, Object> config = SerializationUtils.fromJson(jsonConfig);
    if (null == config) {
      throw new JsonException(new JsonParseException("Configuration was empty"));
    } else if (!config.containsKey("stageClass")) {
      throw new JsonException(new JsonParseException("Required configuration parameter 'stageClass' missing"));
    }
    config.put("stageName", name);
    config.put("stageGroup", groupName);
    config.put("libId", libraryId);
    s.setProperties(config);
    if (debug) {
      s.setMode(Stage.Mode.DEBUG);
    } else {
      s.setMode(Stage.Mode.ACTIVE);
    }
    addStage(s, groupName);
  }
View Full Code Here

  public Map<String, Object> deleteStage(String stageName) throws IOException {
    return deleteStage(stageName, null);
  }
 
  public Map<String, Object> deleteStage(String stageName, String groupName) throws IOException {
    Stage stageToDelete = getStageInfo(stageName);
    Map<String, Object> ret = new HashMap<String, Object>();
    if (stageToDelete == null) {
      ret.put("stageStatus", "Could not find stage " + stageName);
    } else {
      Pipeline pipeline = connector.getPipelineReader().getPipeline();
View Full Code Here

  public void testGetStageGroups() throws Exception {
    MongoConnector mdc = mongoConnectorResource.getConnector();
    Pipeline p = new Pipeline();
    StageGroup singleGroup = new StageGroup("singleStage");
    StageGroup multiGroup = new StageGroup("multi");
    Stage single = new Stage("singleStage", new DatabaseFile());
    Stage multi1 = new Stage("multi1", new DatabaseFile());
    Stage multi2 = new Stage("multi2", new DatabaseFile());
    multiGroup.addStage(multi1);
    multiGroup.addStage(multi2);
    singleGroup.addStage(single);
   
    p.addGroup(multiGroup);
View Full Code Here

  public void testStageGroupProperties() throws Exception {
    MongoConnector mdc = mongoConnectorResource.getConnector();
    Pipeline p = new Pipeline();
    StageGroup singleGroup = new StageGroup("singleStage");
    StageGroup multiGroup = new StageGroup("multi");
    Stage single = new Stage("singleStage", new DatabaseFile());
    Stage multi1 = new Stage("multi1", new DatabaseFile());
    Stage multi2 = new Stage("multi2", new DatabaseFile());
    multiGroup.addStage(multi1);
    multiGroup.addStage(multi2);
    singleGroup.addStage(single);
   
    p.addGroup(multiGroup);
View Full Code Here

 
  @Test
  public void testGetStages() throws Exception {
    Pipeline p = new Pipeline();
    StageGroup g = new StageGroup("1");
    g.addStage(new Stage("stage", Mockito.mock(DatabaseFile.class)));
    g.addStage(new Stage("stage2", Mockito.mock(DatabaseFile.class)));
    p.addGroup(g);
   
    Mockito.when(reader.getPipeline()).thenReturn(p);
   
    List<String> stages = GroupStarter.getStages("localhost", server.getPort(), "1");

    assertTrue(stages.contains("stage"));
    assertTrue(stages.contains("stage2"));
    assertFalse(stages.contains("notingroup"));

    StageGroup g2 = new StageGroup("2");
    g2.addStage(new Stage("debug", Mockito.mock(DatabaseFile.class)));
    Pipeline p2 = new Pipeline();
    p2.addGroup(g2);
   
    Mockito.when(reader.getDebugPipeline()).thenReturn(p2);
    stages = GroupStarter.getStages("localhost", server.getPort(), "2");
View Full Code Here

TOP

Related Classes of com.findwise.hydra.Stage

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.