Package org.geowebcache.diskquota.storage

Examples of org.geowebcache.diskquota.storage.Quota


    public Quota getUsedQuota(final String layerName) {
        if (!isDiskQuotaAvailable()) {
            return null;
        }
        try {
            Quota usedQuotaByLayerName = monitor.getUsedQuotaByLayerName(layerName);
            return usedQuotaByLayerName;
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        return null;
View Full Code Here


            super.warn(warningMsg);
        }
    }

    private Component quotaLink(String id, IModel<Quota> quotaModel) {
        Quota quota = quotaModel.getObject();
        String formattedQuota;
        if (null == quota) {
            formattedQuota = new ResourceModel("CachedLayersPage.quotaLimitNotSet").getObject();
        } else {
            formattedQuota = quota.toNiceString();
        }
        return new Label(id, formattedQuota);
    }
View Full Code Here

                    protected Component getContents(final String id) {
                        final String layerName = getDefaultModelObjectAsString();

                        // show a confirmation panel for all the objects we have to remove
                        final GWC gwcFacade = GWC.get();
                        Quota usedQuota = gwcFacade.getUsedQuota(layerName);
                        if (usedQuota == null) {
                            usedQuota = new Quota();
                        }
                        final String usedQuotaStr = usedQuota.toNiceString();
                        IModel<String> model = new ParamResourceModel(
                                "CachedLayersPage.confirmTruncateMessage", CachedLayersPage.this,
                                layerName, usedQuotaStr);
                        Label confirmLabel = new Label(id, model);
                        confirmLabel.setEscapeModelStrings(false);// allow some html inside, like
View Full Code Here

            @Override
            protected Component getContents(final String id) {
                // show a confirmation panel for all the objects we have to remove
                GWC gwc = GWC.get();
                Quota usedQuota = gwc.getUsedQuota(originalLayerName);
                if (usedQuota == null) {
                    usedQuota = new Quota();
                }
                String usedQuotaStr = usedQuota.toNiceString();
                return new Label(id, new ParamResourceModel("confirmTileLayerRemoval",
                        GeoServerTileLayerEditor.this, usedQuotaStr));
            }

            @Override
View Full Code Here

            final IModel<JDBCConfiguration> jdbcQuotaConfigModel) {
        super(id, diskQuotaConfigModel);

        final DiskQuotaConfig diskQuotaConfig = diskQuotaConfigModel.getObject();

        Quota globalQuota = diskQuotaConfig.getGlobalQuota();
        if (globalQuota == null) {
            LOGGER.info("There's no GWC global disk quota configured, setting a default of 100MiB");
            globalQuota = new Quota(100, StorageUnit.MiB);
            diskQuotaConfig.setGlobalQuota(globalQuota);
        }

        // use this two payload models to let the user configure the global quota as a decimal value
        // plus a storage unit. Then at form sumbission we'll transform them back to a BigInteger
        // representing the quota byte count
        BigInteger bytes = globalQuota.getBytes();
        StorageUnit bestRepresentedUnit = StorageUnit.bestFit(bytes);
        BigDecimal transformedQuota = StorageUnit.B.convertTo(new BigDecimal(bytes),
                bestRepresentedUnit);
        configQuotaValueModel = new Model<Double>(transformedQuota.doubleValue());
View Full Code Here

            @Override
            protected Quota load() {
                GWC gwc = GWC.get();
                if (!gwc.isDiskQuotaAvailable()) {
                    return new Quota();// fake
                }
                return gwc.getGlobalUsedQuota();
            }
        };
View Full Code Here

    }

    private void addGlobalQuotaStatusBar(final IModel<Quota> globalQuotaModel,
            final IModel<Quota> globalUsedQuotaModel, IModel<String> progressMessageModel) {

        Quota limit = globalQuotaModel.getObject();
        Quota used = globalUsedQuotaModel.getObject();

        BigInteger limitValue = limit.getBytes();
        BigInteger usedValue = used.getBytes();

        StorageUnit bestUnitForLimit = StorageUnit.bestFit(limitValue);
        StorageUnit bestUnitForUsed = StorageUnit.bestFit(usedValue);

        StorageUnit biggerUnit = bestUnitForLimit.compareTo(bestUnitForUsed) > 0 ? bestUnitForLimit
View Full Code Here

                protected Component getContents(final String id) {
                    final GWC gwc = GWC.get();

                    final int count = selectedGridsetIds.size();

                    Quota totalQuota = new Quota();

                    for (String gridsetId : selectedGridsetIds) {
                        Quota usedQuotaByGridSet = gwc.getUsedQuotaByGridSet(gridsetId);
                        if (usedQuotaByGridSet != null) {
                            totalQuota.add(usedQuotaByGridSet);
                        }
                    }
View Full Code Here

            Integer zoomLevels = (Integer) property.getModel(itemModel).getObject();
            return new Label(id, zoomLevels.toString());

        } else if (property == GridSetTableProvider.QUOTA_USED) {

            Quota usedQuota = (Quota) property.getModel(itemModel).getObject();
            String quotaStr = usedQuota == null ? "N/A" : usedQuota.toNiceString();
            return new Label(id, quotaStr);

        } else if (property == GridSetTableProvider.ACTION_LINK) {
            String gridSetName = (String) property.getModel(itemModel).getObject();
View Full Code Here

                @Override
                protected Component getContents(final String id) {
                    // show a confirmation panel for all the objects we have to remove
                    final GWC gwcFacade = GWC.get();
                    Quota totalQuota = new Quota();
                    for (String layerName : selectedNames) {
                        Quota usedQuota = gwcFacade.getUsedQuota(layerName);
                        if (usedQuota != null) {
                            totalQuota.add(usedQuota);
                        }
                    }
                    final String usedQuotaStr = totalQuota.toNiceString();
View Full Code Here

TOP

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

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.