private void validateQuota(Quota quota) throws ConfigurationException { 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); }
throw new ConfigurationException( "Layer " + lq.getLayer() + layer + ". Error message is: " + e.getMessage() + ". Quota removed from runtime configuration."); quotaConfig.remove(lq);
private synchronized void checkGridSubsets() { if (this.subSets == null) { ReferencedEnvelope latLongBbox = getLatLonBbox(); try { this.subSets = getGrids(latLongBbox, gridSetBroker); } catch (ConfigurationException e) { String msg = "Can't create grids for '" + getName() + "': " + e.getMessage(); LOGGER.log(Level.WARNING, msg, e); setConfigErrorMessage(msg); } } }
private synchronized void checkGridSubsets() { if (this.subSets == null) { ReferencedEnvelope latLongBbox = getLatLonBbox(); try { this.subSets = getGrids(latLongBbox, gridSetBroker); } catch (ConfigurationException e) { String msg = "Can't create grids for '" + getName() + "': " + e.getMessage(); LOGGER.log(Level.WARNING, msg, e); setConfigErrorMessage(msg); } } }
public static void store(JDBCConfiguration config, File file) throws ConfigurationException { FileOutputStream fos = null; try { fos = new FileOutputStream(file); store(config, fos); } catch (IOException e) { throw new ConfigurationException( "Failed to store the configuration into " + file.getAbsolutePath(), e); } finally { IOUtils.closeQuietly(fos); } }
/** * @return The root path where configuration is stored * @throws ConfigurationException */ public String getConfigLocation() throws ConfigurationException { try { return resourceProvider.getLocation(); } catch (IOException e) { throw new ConfigurationException(e.getMessage(), e); } }
public synchronized String getDefaultPath() throws ConfigurationException { if (this.defaultPrefix == null) { determineDefaultPrefix(); if (this.defaultPrefix == null) { throw new ConfigurationException("Unable to find writable path for cache."); } } return this.defaultPrefix; }
/** * Loads a XML configuration from the specified file. The file must adhere to the {@code * geowebcache-diskquota-jdbc.xsd} schema. * * @param sourceFile * @return * @throws IOException */ public static JDBCConfiguration load(File sourceFile) throws ConfigurationException { FileInputStream fis = null; try { fis = new FileInputStream(sourceFile); return load(fis); } catch (IOException e) { throw new ConfigurationException( "Failed to load the configuration from " + sourceFile.getAbsolutePath(), e); } finally { IOUtils.closeQuietly(fis); } }
private static void validateConfiguration(JDBCConfiguration conf) throws ConfigurationException { if (conf.getDialect() == null) { throw new ConfigurationException( "A dialect must be provided, possible values are H2, Oracle, PostgresSQL"); } ConnectionPoolConfiguration cp = conf.getConnectionPool(); if (conf.getJNDISource() == null && cp == null && !"H2".equals(conf.getDialect())) { throw new ConfigurationException( "No data source provided, either configure JNDISource or connectionPool"); } if (cp != null) { if (cp.getDriver() == null) { throw new ConfigurationException("No JDBC driver provided"); } if (cp.getUrl() == null) { throw new ConfigurationException("No JDBC URL provided"); } } }
@Override public void handleRemoveBlobStore(BlobStoreInfo removedBlobStore) throws ConfigurationException, StorageException { if (removedBlobStore .getName() .equals(blobStores.get(DEFAULT_STORE_DEFAULT_ID).config.getName())) { throw new ConfigurationException( "The default blob store can't be removed: " + removedBlobStore.getName()); } blobStores.remove(removedBlobStore.getName()); }
/** * Gets the XML document and parses it, creates WMSLayers for the relevant * * @return the layers described at the given URL */ private synchronized List<TileLayer> getTileLayers(boolean reload) throws GeoWebCacheException { List<TileLayer> layers = null; WebMapServer wms = getWMS(); if (wms == null) { throw new ConfigurationException("Unable to connect to " + this.url); } String wmsUrl = getWMSUrl(wms); log.info("Using " + wmsUrl + " to generate URLs for WMS requests"); String urlVersion = parseVersion(url); layers = getLayers(wms, wmsUrl, urlVersion); if (layers == null || layers.size() < 1) { log.error("Unable to find any layers based on " + url); } else { log.info("Loaded " + layers.size() + " layers from " + url); } return layers; }
/** * Gets the XML document and parses it, creates WMSLayers for the relevant * * @return the layers described at the given URL */ private synchronized List<TileLayer> getTileLayers(boolean reload) throws GeoWebCacheException { final List<TileLayer> layers; final WebMapServer wms; try { wms = getWMS(); } catch (ServiceException | IOException e) { throw new ConfigurationException( "Could not retrieve (or parse) GetCapaibilities " + this.url + " :" + e.getMessage(), e); } String wmsUrl = getWMSUrl(wms); log.info("Using GetCapabilities " + wmsUrl + " to generate URLs for WMS requests"); String urlVersion = parseVersion(url); layers = getLayers(wms, wmsUrl, urlVersion); if (layers == null || layers.size() < 1) { log.error("Unable to find any layers based on " + url); } else { log.info("Loaded " + layers.size() + " layers from " + url); } return layers; }
private GeoWebCacheConfiguration loadConfiguration() throws ConfigurationException { Assert.isTrue(resourceProvider.hasInput()); InputStream in; try { in = resourceProvider.in(); try { return loadConfiguration(in); } finally { in.close(); } } catch (IOException e) { throw new ConfigurationException( "Error parsing config file " + resourceProvider.getId(), e); } }
throw new ConfigurationException("No id provided for blob store " + config); throw new ConfigurationException( "Duplicate blob store id: " + id + ". Check your configuration."); throw new ConfigurationException( CompositeBlobStore.DEFAULT_STORE_DEFAULT_ID + " is a reserved identifier, please don't use it in the configuration"); if (defaultStore == null || defaultStore.config.getName().equals(config.getName())) { if (!enabled) { throw new ConfigurationException( "The default blob store can't be disabled: " + config.getName()); throw new ConfigurationException( "Duplicate default blob store: " + defaultStore.config.getName()
private void validateConfig(DiskQuotaConfig quotaConfig) throws ConfigurationException { int cacheCleanUpFrequency = quotaConfig.getCacheCleanUpFrequency(); if (cacheCleanUpFrequency <= 0) { throw new ConfigurationException("cacheCleanUpFrequency shall be a positive integer"); throw new ConfigurationException( "cacheCleanUpUnits shall be specified. Expected one of SECONDS, MINUTES, HOURS, DAYS. Got null"); throw new ConfigurationException( "Disk block size shall be specified and be a positive integer"); throw new ConfigurationException( "maxConcurrentCleanUps shall be specified as a positive integer");
throw new ConfigurationException("Unable to parse after transform."); } else {
throw new ConfigurationException("Error saving config", ex);
throw new ConfigurationException( "Could not locate bean " + dialectBeanName + " in the Spring application context"); } else if (!(bean instanceof SQLDialect)) { throw new ConfigurationException( "Bean " + dialectBeanName
public DiskQuotaConfig loadConfig() throws IOException, ConfigurationException { DiskQuotaConfig quotaConfig = null; if (resourceProvider.hasInput()) { log.info("Quota config is: " + resourceProvider.getLocation()); try (InputStream configIn = resourceProvider.in()) { quotaConfig = loadConfiguration(configIn); if (null == quotaConfig) { throw new ConfigurationException( "Couldn't parse configuration file " + resourceProvider.getLocation()); } } catch (IOException | RuntimeException e) { log.error( "Error loading DiskQuota configuration from " + resourceProvider.getLocation() + ": " + e.getMessage() + ". Deferring to a default (disabled) configuration", e); } } else { log.info("DiskQuota configuration is not readable: " + resourceProvider.getLocation()); } if (quotaConfig == null) { quotaConfig = new DiskQuotaConfig(); } // set default values quotaConfig.setDefaults(); validateConfig(quotaConfig); return quotaConfig; }
c = ds.getConnection(); } catch (SQLException e) { throw new ConfigurationException( "Failed to get a database connection: " + e.getMessage(), e); } finally { throw new ConfigurationException("Failed to locate the data source in JNDI", e);