Search in sources :

Example 1 with ContentCachePersistenceStrategy

use of org.n52.iceland.cache.ContentCachePersistenceStrategy in project SOS by 52North.

the class AdminResetController method post.

@RequestMapping(method = RequestMethod.POST)
public View post() throws ConfigurationError, ConnectionProviderException {
    LOG.debug("Resetting Service.");
    getDatabaseSettingsHandler().delete();
    this.settingsManager.deleteAll();
    ContentCachePersistenceStrategy persistenceStrategy = contentCacheController.getContentCachePersistenceStrategy();
    // delete a cache file if present
    if (persistenceStrategy != null) {
        persistenceStrategy.remove();
    }
    env.setActiveProfiles("undefined");
    contextSwitcher.reset();
    contextSwitcher.loadSettings();
    reloadContext();
    return new RedirectView(ControllerConstants.Paths.ROOT, true);
}
Also used : ContentCachePersistenceStrategy(org.n52.iceland.cache.ContentCachePersistenceStrategy) RedirectView(org.springframework.web.servlet.view.RedirectView) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 2 with ContentCachePersistenceStrategy

use of org.n52.iceland.cache.ContentCachePersistenceStrategy in project SOS by 52North.

the class UpdateSchedulingTest method createController.

private ContentCacheControllerImpl createController() throws ConfigurationError {
    ContentCachePersistenceStrategy persistenceStrategy = new NoOpCachePersistenceStrategy();
    CompleteCacheUpdateFactoryImpl cacheUpdateFactory = new CompleteCacheUpdateFactoryImpl();
    CacheFeederHandler cacheFeederHandler = new NoOpCacheFeederHandler();
    cacheUpdateFactory.setCacheFeederHandler(cacheFeederHandler);
    ContentCacheFactory cacheFactory = InMemoryCacheImpl::new;
    ContentCacheControllerImpl ccc = new ContentCacheControllerImpl();
    ccc.setCacheFactory(cacheFactory);
    ccc.setPersistenceStrategy(persistenceStrategy);
    ccc.setCompleteCacheUpdateFactory(cacheUpdateFactory);
    ccc.setUpdateInterval(0);
    ccc.init();
    return ccc;
}
Also used : NoOpCachePersistenceStrategy(org.n52.iceland.cache.ctrl.persistence.NoOpCachePersistenceStrategy) ContentCachePersistenceStrategy(org.n52.iceland.cache.ContentCachePersistenceStrategy) CompleteCacheUpdateFactoryImpl(org.n52.sos.cache.ctrl.CompleteCacheUpdateFactoryImpl) ContentCacheControllerImpl(org.n52.iceland.cache.ctrl.ContentCacheControllerImpl) CacheFeederHandler(org.n52.sos.ds.CacheFeederHandler) ContentCacheFactory(org.n52.iceland.cache.ctrl.ContentCacheFactory)

Aggregations

ContentCachePersistenceStrategy (org.n52.iceland.cache.ContentCachePersistenceStrategy)2 ContentCacheControllerImpl (org.n52.iceland.cache.ctrl.ContentCacheControllerImpl)1 ContentCacheFactory (org.n52.iceland.cache.ctrl.ContentCacheFactory)1 NoOpCachePersistenceStrategy (org.n52.iceland.cache.ctrl.persistence.NoOpCachePersistenceStrategy)1 CompleteCacheUpdateFactoryImpl (org.n52.sos.cache.ctrl.CompleteCacheUpdateFactoryImpl)1 CacheFeederHandler (org.n52.sos.ds.CacheFeederHandler)1 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)1 RedirectView (org.springframework.web.servlet.view.RedirectView)1