コード例 #1
0
ファイル: ExertionSorter.java プロジェクト: dudzislaw/SORCER
  /**
   * Add the job and all inner exertions as vertexes
   *
   * @param topXrt
   * @throws SortingException
   */
  private void addVertex(Exertion topXrt) throws ContextException, SortingException {

    String id = topXrt.getId().toString();
    dag.addVertex(id);
    projectMap.put(id, topXrt);
    contextIdsMap.put(id, topXrt.getDataContext().getId().toString());
    revContextIdsMap.put(topXrt.getDataContext().getId().toString(), id);

    for (Iterator i = topXrt.getMograms().iterator(); i.hasNext(); ) {
      Exertion project = (Exertion) i.next();

      id = project.getId().toString();

      if (dag.getVertex(id) != null) {
        throw new SortingException(
            "Exertion '"
                + project.getName()
                + "'("
                + id
                + ") is duplicated in the job: '"
                + topXrt.getName()
                + "' ("
                + topXrt.getId()
                + ")");
      }

      dag.addVertex(id);
      projectMap.put(id, project);
      contextIdsMap.put(id, project.getDataContext().getId().toString());
      revContextIdsMap.put(project.getDataContext().getId().toString(), id);

      if (project instanceof Job) {
        addVertex(project);
      }
    }
  }
コード例 #2
0
ファイル: DataStorageCmd.java プロジェクト: dudzislaw/SORCER
  private void printRecords(Store type) throws RemoteException, MonitorException {
    if (dataStorers == null || dataStorers.length == 0) {
      findStorers();
    }
    Map<Uuid, ObjectInfo> all;
    if (selectedDataStorer >= 0) {
      out.println(
          "From Data Storage: "
              + AttributesUtil.getProviderName(dataStorers[selectedDataStorer].attributeSets)
              + " at: "
              + AttributesUtil.getHostName(dataStorers[selectedDataStorer].attributeSets));
      //			all = ((StorageManagement) dataStorers[selectedDataStorer].service)
      //					.getMonitorableExertionInfo(type,
      //							NetworkShell.getPrincipal());

      Context cxt = null;
      try {
        store("test-only");
        out.println("XXXXXXXXXXXXX service item: " + dataStorers[selectedDataStorer]);
        out.println(
            "XXXXXXXXXXXXX service: " + (DatabaseStorer) dataStorers[selectedDataStorer].service);
        out.println(
            "XXXXXXXXXXXXX interfaces: "
                + Arrays.toString(
                    dataStorers[selectedDataStorer].service.getClass().getInterfaces()));
        out.println(
            "XXXXXXXXXXXXX name: "
                + ((Provider) dataStorers[selectedDataStorer].service).getProviderName());
        try {
          cxt =
              ((DatabaseStorer) dataStorers[selectedDataStorer].service)
                  .contextList(SdbUtil.getListContext(Store.object));
        } catch (MalformedURLException e) {
          e.printStackTrace();
        }
        out.println("XXXXXXXXXXXXX context: " + cxt);
        try {
          store("test-only");
          List<String> records = list(Store.object);
          out.println("XXXXXXXXXXXXX records; " + records);
        } catch (ExertionException e) {
          // TODO Auto-generated catch block
          e.printStackTrace();
        } catch (SignatureException e) {
          // TODO Auto-generated catch block
          e.printStackTrace();
        }
        out.println(cxt.getValue(DatabaseStorer.store_content_list));
        //			} catch (ExertionException e) {
        //				e.printStackTrace();
        //			} catch (SignatureException e) {
        //				e.printStackTrace();
      } catch (ContextException e) {
        e.printStackTrace();
      }

    } else {
      Map<Uuid, ObjectInfo> ri = null;
      all = new HashMap<Uuid, ObjectInfo>();
      for (int i = 0; i < dataStorers.length; i++) {
        out.println(
            "From Data Storage "
                + AttributesUtil.getProviderName(dataStorers[i].attributeSets)
                + " at: "
                + AttributesUtil.getHostName(dataStorers[i].attributeSets));

        DatabaseStorer emx = (DatabaseStorer) dataStorers[i].service;
        //				ri = emx.getMonitorableExertionInfo(type,
        //						NetworkShell.getPrincipal());
        if (ri != null && ri.size() > 0) {
          all.putAll(ri);
        }
        // populate exertion/EMX map
        dataStorerMap.clear();
        for (ObjectInfo ei : ri.values()) {
          dataStorerMap.put(ei.uuid, dataStorers[i]);
        }
      }
    }
    //		if (all.size() == 0) {
    //			out.println("No monitored exertions at this time.");
    //			return;
    //		}
    //		recordInfos = new RecordInfo[all.size()];
    //		all.values().toArray(recordInfos);
    //		printRecordInfos(recordInfos);
  }