org.geowebcache.diskquota.storage.Quota.add()方法的使用及代码示例

x33g5p2x  于2022-01-28 转载在 其他  
字(5.3k)|赞(0)|评价(0)|浏览(91)

本文整理了Java中org.geowebcache.diskquota.storage.Quota.add方法的一些代码示例,展示了Quota.add的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Quota.add方法的具体详情如下:
包路径:org.geowebcache.diskquota.storage.Quota
类名称:Quota
方法名:add

Quota.add介绍

[英]Shorthand for #add(BigInteger)
[中]#add(BigInteger)的缩写

代码示例

代码示例来源:origin: org.geoserver/gs-gwc

@Override
  public void visit(final TileSet tileSet, final QuotaStore store) {
    if (!gridSetName.equals(tileSet.getGridsetId())) {
      return;
    }
    final String tileSetId = tileSet.getId();
    try {
      Quota used = store.getUsedQuotaByTileSetId(tileSetId);
      quota.add(used);
    } catch (InterruptedException e) {
      log.fine(e.getMessage());
      return;
    }
  }
};

代码示例来源:origin: org.geoserver/gwc

@Override
  public void visit(final TileSet tileSet, final QuotaStore store) {
    if (!gridSetName.equals(tileSet.getGridsetId())) {
      return;
    }
    final String tileSetId = tileSet.getId();
    try {
      Quota used = store.getUsedQuotaByTileSetId(tileSetId);
      quota.add(used);
    } catch (InterruptedException e) {
      log.fine(e.getMessage());
      return;
    }
  }
};

代码示例来源:origin: GeoWebCache/geowebcache

private void addToUsedQuota(
      final Transaction tx, final TileSet tileSet, final Quota quotaDiff) {
    Quota usedQuota = usedQuotaByTileSetId.get(tx, tileSet.getId(), LockMode.DEFAULT);
    Quota globalQuota = usedQuotaByTileSetId.get(tx, GLOBAL_QUOTA_NAME, LockMode.DEFAULT);
    usedQuota.add(quotaDiff);
    globalQuota.add(quotaDiff);
    usedQuotaById.putNoReturn(tx, usedQuota);
    usedQuotaById.putNoReturn(tx, globalQuota);
  }
}

代码示例来源:origin: GeoWebCache/geowebcache

@SuppressWarnings("unchecked")
@Test
public void testGetUsedQuotaByTileSetId() throws Exception {
  String layerName = "topp:states2";
  List<TileSet> tileSets;
  tileSets = new ArrayList<TileSet>(tilePageCalculator.getTileSetsFor(layerName));
  Map<String, Quota> expectedById = new HashMap<String, Quota>();
  for (TileSet tset : tileSets) {
    Quota quotaDiff = new Quota(10D * Math.random(), StorageUnit.MiB);
    store.addToQuotaAndTileCounts(tset, quotaDiff, Collections.EMPTY_SET);
    store.addToQuotaAndTileCounts(tset, quotaDiff, Collections.EMPTY_SET);
    Quota tsetQuota = new Quota(quotaDiff);
    tsetQuota.add(quotaDiff);
    expectedById.put(tset.getId(), tsetQuota);
  }
  for (Map.Entry<String, Quota> expected : expectedById.entrySet()) {
    BigInteger expectedValaue = expected.getValue().getBytes();
    String tsetId = expected.getKey();
    assertEquals(expectedValaue, store.getUsedQuotaByTileSetId(tsetId).getBytes());
  }
}

代码示例来源:origin: GeoWebCache/geowebcache

@SuppressWarnings("unchecked")
@Test
public void testGetUsedQuotaByTileSetId() throws Exception {
  String layerName = "topp:states2";
  List<TileSet> tileSets;
  tileSets = new ArrayList<TileSet>(tilePageCalculator.getTileSetsFor(layerName));
  Map<String, Quota> expectedById = new HashMap<String, Quota>();
  for (TileSet tset : tileSets) {
    Quota quotaDiff = new Quota(10D * Math.random(), StorageUnit.MiB);
    store.addToQuotaAndTileCounts(tset, quotaDiff, Collections.EMPTY_SET);
    store.addToQuotaAndTileCounts(tset, quotaDiff, Collections.EMPTY_SET);
    Quota tsetQuota = new Quota(quotaDiff);
    tsetQuota.add(quotaDiff);
    expectedById.put(tset.getId(), tsetQuota);
  }
  for (Map.Entry<String, Quota> expected : expectedById.entrySet()) {
    BigInteger expectedValue = expected.getValue().getBytes();
    String tsetId = expected.getKey();
    assertThat(store.getUsedQuotaByTileSetId(tsetId), bytes(expectedValue));
  }
}

代码示例来源:origin: GeoWebCache/geowebcache

public Quota call() throws Exception {
    Quota aggregated = null;
    EntityCursor<TileSet> layerTileSetsIds;
    layerTileSetsIds =
        tileSetsByLayer.entities(
            null, layerName, true, layerName, true, CursorConfig.DEFAULT);
    TileSet tileSet;
    try {
      Quota tileSetUsedQuota;
      while (null != (tileSet = layerTileSetsIds.next())) {
        if (aggregated == null) {
          aggregated = new Quota();
        }
        tileSetUsedQuota = new UsedQuotaByTileSetId(tileSet.getId()).call();
        aggregated.add(tileSetUsedQuota);
      }
    } finally {
      layerTileSetsIds.close();
    }
    if (aggregated == null) {
      aggregated = new Quota();
    }
    return aggregated;
  }
}

代码示例来源:origin: GeoWebCache/geowebcache

@SuppressWarnings("unchecked")
@Test
public void testGetUsedQuotaByLayerName() throws Exception {
  String layerName = "topp:states2";
  List<TileSet> tileSets;
  tileSets = new ArrayList<TileSet>(tilePageCalculator.getTileSetsFor(layerName));
  Quota expected = new Quota();
  for (TileSet tset : tileSets) {
    Quota quotaDiff = new Quota(10, StorageUnit.MiB);
    expected.add(quotaDiff);
    store.addToQuotaAndTileCounts(tset, quotaDiff, Collections.EMPTY_SET);
  }
  assertThat(store.getUsedQuotaByLayerName(layerName), bytes(expected.getBytes()));
}

代码示例来源:origin: GeoWebCache/geowebcache

@SuppressWarnings("unchecked")
@Test
public void testGetUsedQuotaByLayerName() throws Exception {
  String layerName = "topp:states2";
  List<TileSet> tileSets;
  tileSets = new ArrayList<TileSet>(tilePageCalculator.getTileSetsFor(layerName));
  Quota expected = new Quota();
  for (TileSet tset : tileSets) {
    Quota quotaDiff = new Quota(10, StorageUnit.MiB);
    expected.add(quotaDiff);
    store.addToQuotaAndTileCounts(tset, quotaDiff, Collections.EMPTY_SET);
  }
  Quota usedQuotaByLayerName = store.getUsedQuotaByLayerName(layerName);
  assertEquals(expected.getBytes(), usedQuotaByLayerName.getBytes());
}

代码示例来源:origin: GeoWebCache/geowebcache

Quota globalQuota = store.getGloballyUsedQuota();
Quota sum = new Quota();
sum.add(tset1Quota);
sum.add(tset2Quota);
assertEquals(globalQuota.getBytes(), sum.getBytes());

代码示例来源:origin: GeoWebCache/geowebcache

sum.add(tset1Quota);
sum.add(tset2Quota);
sum.add(tset3Quota);
sum.add(tset4Quota);
assertEquals(globalQuota.getBytes(), sum.getBytes());

相关文章