Package org.geowebcache.config

Examples of org.geowebcache.config.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);
    }
View Full Code Here


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

        String dialectName = config.getDialect();
        String dialectBeanName = dialectName + "QuotaDialect";
        Object bean = appContext.getBean(dialectBeanName);
       
        if(bean == null) {
            throw new ConfigurationException("Could not locate bean " + dialectBeanName
                    + " for dialect " + dialectName + " in the Spring application context");
        } else if(!(bean instanceof SQLDialect)) {
            throw new ConfigurationException("Bean " + dialectBeanName
                    + " for dialect " + dialectName + " was found in the Spring application "
                    + "context, but it's not a SQLDialect object, instead it's a " + bean.getClass().getName());
        }
       
        SQLDialect dialect = (SQLDialect) bean;
View Full Code Here

            // verify the datasource works
            Connection c = null;
            try {
                c = ds.getConnection();
            } catch(SQLException e) {
                throw new ConfigurationException("Failed to get a database connection: " + e.getMessage(), e);
            } finally {
                if(c != null) {
                    try {
                        c.close();
                    } catch(SQLException e) {
                        // nothing we can do about it, but at least let the admin know
                        log.debug("An error occurred while closing the test JDBC connection: " + e.getMessage(), e);
                    }
                }
            }
           
            return ds;
        } catch (NamingException e) {
            throw new ConfigurationException("Failed to locate the data source in JNDI", e);
        }
    }
View Full Code Here

            fis = new FileInputStream(sourceFile);
            JDBCConfiguration conf = (JDBCConfiguration) xs.fromXML(fis);
            validateConfiguration(conf);
            return conf;
        } catch (IOException e) {
            throw new ConfigurationException("Failed to load the configuration from "
                    + sourceFile.getAbsolutePath(), e);
        } finally {
            IOUtils.closeQuietly(fis);
        }
    }
View Full Code Here

        }
    }

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

        FileOutputStream fos = null;
        try {
            fos = new FileOutputStream(file);
            xs.toXML(config, fos);
        } catch (IOException e) {
            throw new ConfigurationException("Failed to store the configuration into "
                    + file.getAbsolutePath(), e);
        } finally {
            IOUtils.closeQuietly(fos);
        }
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.