Esempio n. 1
0
 private void showAllSchedule(ClientConnection clientConnection) {
   try {
     Vector<Schedule> allSchedule = clientConnection.getAllDefinedSchedule();
     for (Schedule schedule : allSchedule) {
       this.ourShell.out.println(schedule.getName());
     }
   } catch (IOException e) {
     e.printStackTrace();
   }
 }
Esempio n. 2
0
 private void showAllFileset(ClientConnection clientConnection) {
   try {
     Vector<NamedDataGroup> allFileset = clientConnection.getAllDefinedFileset();
     for (NamedDataGroup fileset : allFileset) {
       this.ourShell.out.println(fileset.getName());
     }
   } catch (IOException e) {
     e.printStackTrace();
   }
 }
Esempio n. 3
0
 private void showPeer(ClientConnection clientConnection) {
   try {
     Vector<Identity> peerList = clientConnection.getAllPeer();
     for (Identity peer : peerList) {
       this.ourShell.out.println(
           peer.getHumanReadableAlias() + " (0x" + peer.getUniqueIdString() + ")");
     }
   } catch (IOException e) {
     e.printStackTrace();
   }
 }
Esempio n. 4
0
  /* Shows the transactions made by the host we control
   */
  private void showLocalTransaction(ClientConnection clientConnection) {
    try {
      final String formatString = "%-20s %-10s %-20s %-25s %-25s %-16s %s\n";
      Vector<TransactionBlock> peerTransaction = clientConnection.getAllTransaction();

      if (peerTransaction.isEmpty() == false) {
        this.ourShell.out.printf(
            formatString,
            "DataName",
            "Version",
            "Schedule",
            "Transaction start",
            "Transaction end",
            "Size",
            "#Files");
      }
      for (TransactionBlock tBlock : peerTransaction) {
        Calendar transactionDate = Calendar.getInstance();
        transactionDate.setTimeInMillis(tBlock.getTransactionStartTime());
        String hrDateStart =
            SimpleDateFormat.getDateTimeInstance().format(transactionDate.getTime());

        String hrDateEnd;
        if (tBlock.getTransactionEndTime() != 0) {
          transactionDate.setTimeInMillis(tBlock.getTransactionEndTime());
          hrDateEnd = SimpleDateFormat.getDateTimeInstance().format(transactionDate.getTime());
        } else {
          hrDateEnd = "In progress";
        }

        String humanReadableSize =
            new SuffixedNumber(tBlock.getTransactionSize(), "bytes").toString();
        this.ourShell.out.printf(
            formatString,
            tBlock.getDataName(),
            Long.toHexString(tBlock.getBlockId()),
            tBlock.getScheduleName(),
            hrDateStart,
            hrDateEnd,
            humanReadableSize,
            tBlock.getNumberOfHeaderBlocks());
      }
    } catch (IOException e) {
      e.printStackTrace();
    }
  }