Examples of QuotaStore


Examples of org.geowebcache.diskquota.QuotaStore

            return;
        }
       
        // get the quota store name
        DiskQuotaConfig config = loader.loadConfig();
        QuotaStore store  = null;
        if(!config.isEnabled()) {
            // it would be nice to just return null, but the other portions of the
            // disk quota system will throw exceptions if we did while the quota store
            // is not disable via system variable. Let's just give it a dummy quota store instead.
            store = new DummyQuotaStore(calculator);
        } else {
            String quotaStoreName = config.getQuotaStore();
            // in case it's null GeoServer defaults to H2 store, we don't have the
            // BDB store in the classpath
            if(quotaStoreName == null) {
                quotaStoreName = JDBCQuotaStoreFactory.H2_STORE;
            }
           
            try {
                store = getQuotaStoreByName(quotaStoreName);
                exception = null;
            } catch(Exception e) {
                LOGGER.log(Level.SEVERE, "Failed to get a quota store, " +
                    "the GeoWebCache disk quota subsystem will stop working now", e);
                this.exception = e;
                store = new DummyQuotaStore(calculator);
            }
        }
       
        if (this.store == null) {
            this.store = new ConfigurableQuotaStore(store);
        } else {
            ConfigurableQuotaStore configurable = (ConfigurableQuotaStore) this.store;
            QuotaStore oldStore = configurable.getStore();
            configurable.setStore(store);
            // clean up the quota information gathered so far, otherwise when re-enabling
            // we'll have in the db stale information
            if(!(oldStore instanceof DummyQuotaStore)) {
                try {
                    for (TileLayer tl : GWC.get().getTileLayers()) {
                        oldStore.deleteLayer(tl.getName());
                    }
                } finally {
                    try {
                        oldStore.close();
                    } catch (Exception e) {
                        LOGGER.log(Level.SEVERE,
                                "An error occurred while closing up the previous quota store", e);
                    }
                }
View Full Code Here

Examples of org.geowebcache.diskquota.QuotaStore

     * @throws ConfigurationException
     */
    public void testQuotaConfiguration(JDBCConfiguration jdbcConfiguration)
            throws ConfigurationException, IOException {
        JDBCQuotaStoreFactory factory = GeoServerExtensions.bean(JDBCQuotaStoreFactory.class);
        QuotaStore qs = null;
        try {
            qs = factory.getJDBCStore(applicationContext, jdbcConfiguration);
        } finally {
            if (qs != null) {
                try {
                    qs.close();
                } catch (Exception e) {
                    LOGGER.log(Level.FINE, "Failed to dispose test quota store", e);
                }
            }
        }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.