Package org.geowebcache.config

Examples of org.geowebcache.config.ConfigurationException


        } finally {
            configOut.close();
        }
        configFile.delete();
        if (!tmpConfigFile.renameTo(configFile)) {
            throw new ConfigurationException("Couldn't save disk quota config file "
                    + configFile.getAbsolutePath());
        }
    }
View Full Code Here


            log.info("Quota config is: " + configFile.getAbsolutePath());
            InputStream configIn = new FileInputStream(configFile);
            try {
                quotaConfig = loadConfiguration(configIn);
                if (null == quotaConfig) {
                    throw new ConfigurationException("Couldn't parse configuration file "
                            + configFile.getAbsolutePath());
                }
            } catch (RuntimeException e) {
                log.error(
                        "Error loading DiskQuota configuration from "
View Full Code Here

    private File getConfigResource() throws ConfigurationException, FileNotFoundException {
        String cachePath;
        try {
            cachePath = storageFinder.getDefaultPath();
        } catch (StorageException e) {
            throw new ConfigurationException(e.getMessage());
        }

        File file = new File(cachePath, CONFIGURATION_FILE_NAME);

        return file;
View Full Code Here

    }

    private void validateConfig(DiskQuotaConfig quotaConfig) throws ConfigurationException {
        int cacheCleanUpFrequency = quotaConfig.getCacheCleanUpFrequency();
        if (cacheCleanUpFrequency <= 0) {
            throw new ConfigurationException("cacheCleanUpFrequency shall be a positive integer");
        }
        TimeUnit cacheCleanUpUnits = quotaConfig.getCacheCleanUpUnits();
        if (cacheCleanUpUnits == null) {
            throw new ConfigurationException(
                    "cacheCleanUpUnits shall be specified. Expected one of SECONDS, MINUTES, HOURS, DAYS. Got null");
        }
        int diskBlockSize = quotaConfig.getDiskBlockSize();
        if (diskBlockSize <= 0) {
            throw new ConfigurationException(
                    "Disk block size shall be specified and be a positive integer");
        }

        int maxConcurrentCleanUps = quotaConfig.getMaxConcurrentCleanUps();
        if (maxConcurrentCleanUps <= 0) {
            throw new ConfigurationException(
                    "maxConcurrentCleanUps shall be specified as a positive integer");
        }

        if (null != quotaConfig.getLayerQuotas()) {
            for (LayerQuota lq : new ArrayList<LayerQuota>(quotaConfig.getLayerQuotas())) {
View Full Code Here

        final ExpirationPolicy expirationPolicyName = lq.getExpirationPolicyName();
        if (expirationPolicyName == null) {
            // if expiration policy is not defined, then there should be no quota defined either,
            // as it means the layer is managed by the global expiration policy, if any
            if (lq.getQuota() != null) {
                throw new ConfigurationException("Layer " + lq.getLayer()
                        + " has no expiration policy, but does have a quota defined. "
                        + "Either both or neither should be present");
            }
            return;
        }
View Full Code Here

        if (quota == null) {
            throw new IllegalArgumentException("No quota defined");
        }
        BigInteger limit = quota.getBytes();
        if (limit.compareTo(BigInteger.ZERO) < 0) {
            throw new ConfigurationException("Limit shall be >= 0: " + limit + ". " + quota);
        }

        log.debug("Quota validated: " + quota);
    }
View Full Code Here

        } finally {
            configOut.close();
        }
        configFile.delete();
        if (!tmpConfigFile.renameTo(configFile)) {
            throw new ConfigurationException("Couldn't save disk quota config file "
                    + configFile.getAbsolutePath());
        }
    }
View Full Code Here

            log.info("Quota config is: " + configFile.getAbsolutePath());
            InputStream configIn = new FileInputStream(configFile);
            try {
                quotaConfig = loadConfiguration(configIn);
                if (null == quotaConfig) {
                    throw new ConfigurationException("Couldn't parse configuration file "
                            + configFile.getAbsolutePath());
                }
            } catch (RuntimeException e) {
                log.error(
                        "Error loading DiskQuota configuration from "
View Full Code Here

    }

    private void validateConfig(DiskQuotaConfig quotaConfig) throws ConfigurationException {
        int cacheCleanUpFrequency = quotaConfig.getCacheCleanUpFrequency();
        if (cacheCleanUpFrequency <= 0) {
            throw new ConfigurationException("cacheCleanUpFrequency shall be a positive integer");
        }
        TimeUnit cacheCleanUpUnits = quotaConfig.getCacheCleanUpUnits();
        if (cacheCleanUpUnits == null) {
            throw new ConfigurationException(
                    "cacheCleanUpUnits shall be specified. Expected one of SECONDS, MINUTES, HOURS, DAYS. Got null");
        }
        int diskBlockSize = quotaConfig.getDiskBlockSize();
        if (diskBlockSize <= 0) {
            throw new ConfigurationException(
                    "Disk block size shall be specified and be a positive integer");
        }

        int maxConcurrentCleanUps = quotaConfig.getMaxConcurrentCleanUps();
        if (maxConcurrentCleanUps <= 0) {
            throw new ConfigurationException(
                    "maxConcurrentCleanUps shall be specified as a positive integer");
        }

        if (null != quotaConfig.getLayerQuotas()) {
            for (LayerQuota lq : new ArrayList<LayerQuota>(quotaConfig.getLayerQuotas())) {
View Full Code Here

        final ExpirationPolicy expirationPolicyName = lq.getExpirationPolicyName();
        if (expirationPolicyName == null) {
            // if expiration policy is not defined, then there should be no quota defined either,
            // as it means the layer is managed by the global expiration policy, if any
            if (lq.getQuota() != null) {
                throw new ConfigurationException("Layer " + lq.getLayer()
                        + " has no expiration policy, but does have a quota defined. "
                        + "Either both or neither should be present");
            }
            return;
        }
View Full Code Here

TOP

Related Classes of org.geowebcache.config.ConfigurationException

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.