コード例 #1
0
ファイル: ExertionSorter.java プロジェクト: dudzislaw/SORCER
  /**
   * Find the dependencies that result from the pipes specified between tasks
   *
   * @param topXrt
   * @throws CycleDetectedException
   * @throws SortingException
   */
  private void getMapping(Exertion topXrt)
      throws CycleDetectedException, ContextException, SortingException {
    for (Iterator i = topXrt.getMograms().iterator(); i.hasNext(); ) {
      Exertion project = (Exertion) i.next();
      String id = project.getId().toString();
      String topId = topXrt.getId().toString();
      dag.addEdge(id, topId);

      Map<String, Map<String, String>> metaCtx = project.getDataContext().getMetacontext();
      Map<String, String> ctxMapping = metaCtx.get("cid");
      if (ctxMapping != null) {
        for (Map.Entry<String, String> mapping : ctxMapping.entrySet()) {
          if (mapping.getValue() != null && mapping.getValue().length() > 0) {
            String dependencyId = revContextIdsMap.get(mapping.getValue());
            logger.debug("Map: " + mapping.getKey() + " to " + dependencyId);
            if (dag.getVertex(dependencyId) != null) {
              dag.addEdge(id, dependencyId);
            }
          }
        }
      }
      if (project instanceof Job) {
        getMapping(project);
      }
    }
  }