Ejemplo n.º 1
0
  /**
   * update storage summary with binaries repositories
   *
   * @param storageSummaryModel - storageSummary Model
   */
  private void updateFileStoreSummary(StorageSummaryImpl storageSummaryModel) {

    StorageService storageService = ContextHelper.get().beanForType(StorageService.class);

    FileStoreStorageSummary fileStoreSummaryInfo = storageService.getFileStoreStorageSummary();
    FileStoreSummary fileStoreSummary = new FileStoreSummary();
    fileStoreSummary.setStorageType(fileStoreSummaryInfo.getBinariesStorageType().toString());
    List<File> binariesFolders = fileStoreSummaryInfo.getBinariesFolders();
    String storageDirLabel = "Filesystem storage is not used";
    if (binariesFolders != null && !binariesFolders.isEmpty()) {
      storageDirLabel =
          String.join(
              ", ",
              binariesFolders.stream().map(File::getAbsolutePath).collect(Collectors.toList()));
    }
    fileStoreSummary.setStorageDirectory(storageDirLabel);
    fileStoreSummary.setTotalSpace(
        StorageUnit.toReadableString(fileStoreSummaryInfo.getTotalSpace()));
    fileStoreSummary.setUsedSpace(
        StorageUnit.toReadableString(fileStoreSummaryInfo.getUsedSpace())
            + " ("
            + NumberFormatter.formatPercentage(fileStoreSummaryInfo.getUsedSpaceFraction())
            + ")");
    fileStoreSummary.setFreeSpace(
        StorageUnit.toReadableString(fileStoreSummaryInfo.getFreeSpace())
            + " ("
            + NumberFormatter.formatPercentage(fileStoreSummaryInfo.getFreeSpaceFraction())
            + ")");
    storageSummaryModel.setFileStoreSummary(fileStoreSummary);
  }
Ejemplo n.º 2
0
  /**
   * update storage summary with binaries repositories
   *
   * @param storageSummaryInfo - storage info
   * @param storageSummaryModel - storageSummary Model
   */
  private void updateBinariesSummary(
      StorageSummaryInfo storageSummaryInfo, StorageSummaryImpl storageSummaryModel) {
    BinariesSummary binariesSummary = new BinariesSummary();
    binariesSummary.setBinariesCount(
        NumberFormatter.formatLong(storageSummaryInfo.getBinariesInfo().getBinariesCount()));

    binariesSummary.setBinariesSize(
        StorageUnit.toReadableString(storageSummaryInfo.getBinariesInfo().getBinariesSize()));

    binariesSummary.setOptimization(
        NumberFormatter.formatPercentage(storageSummaryInfo.getOptimization()));
    binariesSummary.setArtifactsSize(
        StorageUnit.toReadableString(storageSummaryInfo.getTotalSize()));
    binariesSummary.setItemsCount(NumberFormatter.formatLong((storageSummaryInfo.getTotalItems())));
    binariesSummary.setArtifactsCount(
        NumberFormatter.formatLong((storageSummaryInfo.getTotalFiles())));

    storageSummaryModel.setBinariesSummary(binariesSummary);
  }