예제 #1
0
 private static void describeStorer(int index, String msg) {
   out.println(
       "---------"
           + (msg != null ? " " + msg : "")
           + " DATA STORAGE SERVICE # "
           + index
           + " ---------");
   out.println(
       "EMX: "
           + dataStorers[index].serviceID
           + " at: "
           + AttributesUtil.getHostName(dataStorers[index].attributeSets));
   out.println("Home: " + AttributesUtil.getUserDir(dataStorers[index].attributeSets));
   String groups = AttributesUtil.getGroups(dataStorers[index].attributeSets);
   out.println(
       "Provider name: " + AttributesUtil.getProviderName(dataStorers[index].attributeSets));
   out.println("Groups supported: " + groups);
 }
예제 #2
0
 private int selectRecordByName(String name) {
   for (int i = 0; i < dataStorers.length; i++) {
     if (AttributesUtil.getProviderName(dataStorers[i].attributeSets).equals(name)) return i;
   }
   return -1;
 }
예제 #3
0
  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);
  }