Package org.geowebcache.diskquota.storage

Examples of org.geowebcache.diskquota.storage.TileSet


        // make sure the layer is there and has stuff
        Quota usedQuota = store.getUsedQuotaByLayerName(oldLayerName);
        assertNotNull(usedQuota);

        TileSet tileSet = tilePageCalculator.getTileSetsFor(oldLayerName).iterator().next();
        TilePage page = new TilePage(tileSet.getId(), 0, 0, (byte) 0);
        store.addHitsAndSetAccesTime(Collections.singleton(new PageStatsPayload(page)));
        store.addToQuotaAndTileCounts(tileSet, new Quota(BigInteger.valueOf(1024)),
                Collections.EMPTY_LIST);

        Quota expectedQuota = store.getUsedQuotaByLayerName(oldLayerName);
        assertEquals(1024L, expectedQuota.getBytes().longValue());

        assertNotNull(store.getTileSetById(tileSet.getId()));

        store.renameLayer(oldLayerName, newLayerName);

        // cascade deleted old layer?
        assertNull(store.getLeastRecentlyUsedPage(Collections.singleton(oldLayerName)));
View Full Code Here


        assertEquals(page2, leastRecentlyUsedPage);
    }

    public void testGetTileSetById() throws Exception {

        TileSet tileSet = store.getTileSetById(testTileSet.getId());
        assertNotNull(tileSet);
        assertEquals(testTileSet, tileSet);

        try {
            store.getTileSetById("NonExistentTileSetId");
View Full Code Here

        public Void call() {
            Transaction transaction = entityStore.getEnvironment().beginTransaction(null, null);
            try {
                EntityCursor<TileSet> tileSets = tileSetsByLayer.entities(transaction, layerName,
                        true, layerName, true, null);
                TileSet tileSet;
                Quota freed;
                Quota global;
                try {
                    while (null != (tileSet = tileSets.next())) {
                        if (tileSet.getGridsetId().equals(gridSetId)) {
                            freed = usedQuotaByTileSetId.get(transaction, tileSet.getId(),
                                    LockMode.DEFAULT);
                            global = usedQuotaByTileSetId.get(transaction, GLOBAL_QUOTA_NAME,
                                    LockMode.DEFAULT);

                            tileSets.delete();
View Full Code Here

        private void copyTileSets(Transaction transaction) {
            EntityCursor<TileSet> tileSets = tileSetsByLayer.entities(transaction, oldLayerName,
                    true, oldLayerName, true, null);
            try {
                TileSet oldTileSet;
                TileSet newTileSet;
                Quota oldQuota;
                Quota newQuota;
                TilePage oldPage;
                TilePage newPage;
                while (null != (oldTileSet = tileSets.next())) {
                    final String gridsetId = oldTileSet.getGridsetId();
                    final String blobFormat = oldTileSet.getBlobFormat();
                    final String parametersId = oldTileSet.getParametersId();
                    newTileSet = new TileSet(newLayerName, gridsetId, blobFormat, parametersId);
                    // this creates the tileset's empty used Quota too
                    newTileSet = getOrCreateTileSet(transaction, newTileSet);

                    final String oldTileSetId = oldTileSet.getId();
                    final String newTileSetId = newTileSet.getId();

                    oldQuota = usedQuotaByTileSetId
                            .get(transaction, oldTileSetId, LockMode.DEFAULT);
                    newQuota = usedQuotaByTileSetId
                            .get(transaction, newTileSetId, LockMode.DEFAULT);
View Full Code Here

            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();
            }
View Full Code Here

        }

        public Void call() throws Exception {
            final Transaction tx = entityStore.getEnvironment().beginTransaction(null, null);
            try {
                TileSet storedTileset = getOrCreateTileSet(tx, tileSet);
                // increase the tileset used quota
                addToUsedQuota(tx, storedTileset, quotaDiff);

                // and each page's fillFactor for lru/lfu expiration
                if (tileCountDiffs.size() > 0) {
View Full Code Here

            PageStats pageStats = null;
            final Transaction tx = entityStore.getEnvironment().beginTransaction(null, null);
            try {
                for (PageStatsPayload payload : statsUpdates) {
                    TilePage page = payload.getPage();
                    TileSet storedTileset = tileSetById.get(tx, page.getTileSetId(),
                            LockMode.DEFAULT);
                    if (null == storedTileset) {
                        log.info("Can't add usage stats. TileSet does not exist. Was it deleted? "
                                + page.getTileSetId());
                        continue;
View Full Code Here

            final Set<String> tileSetIds = new HashSet<String>();
            for (String layerName : layerNames) {
                EntityCursor<TileSet> keys = tileSetsByLayer.entities(layerName, true, layerName,
                        true);
                try {
                    TileSet tileSet;
                    while ((tileSet = keys.next()) != null) {
                        tileSetIds.add(tileSet.getId());
                    }
                } finally {
                    keys.close();
                }
            }
View Full Code Here

            return;
        }
        String gridsetId = tile.getGridSetId();
        String blobFormat = tile.getMimeType().getFormat();
        String parametersId = tile.getParametersId();
        TileSet tileSet = new TileSet(layerName, gridsetId, blobFormat, parametersId);
        long[] tileIndex = tile.getTileIndex().clone();
        UsageStats usageLog = new UsageStats(tileSet, tileIndex);
        try {
            usageStatsQueue.put(usageLog);
        } catch (InterruptedException e) {
View Full Code Here

     * @param updateData
     * @throws InterruptedException
     */
    private void performAggregatedUpdate(final QuotaUpdate updateData) throws InterruptedException {

        final TileSet tileSet = updateData.getTileSet();

        TimedQuotaUpdate accumulatedUpdate = aggregatedDelayedUpdates.get(tileSet);

        if (accumulatedUpdate == null) {
            /*
 
View Full Code Here

TOP

Related Classes of org.geowebcache.diskquota.storage.TileSet

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.