public void dispose() { if (resourcePool != null) resourcePool.dispose(); facade.dispose(); }
public void sync(CatalogImpl other) { other.facade.syncTo(facade); listeners = other.listeners; if (resourcePool != other.resourcePool) { resourcePool.dispose(); resourcePool = other.resourcePool; resourcePool.setCatalog(this); } resourceLoader = other.resourceLoader; }
public void reset() { // drop all the catalog store/feature types/raster caches catalog.getResourcePool().dispose(); // reset the referencing subsystem CRS.reset("all"); // look for pluggable handlers for (GeoServerLifecycleHandler handler : GeoServerExtensions.extensions(GeoServerLifecycleHandler.class)) { try { handler.onReset(); } catch (Throwable t) { LOGGER.log( Level.SEVERE, "A GeoServer lifecycle handler threw an exception during reset", t); } } } }
@Test public void testLargeNDMosaic() throws Exception { // build a mosaic with 1025 files (the standard ulimit is 1024) File mosaic = new File("./target/largeMosaic"); try { createTimeMosaic(mosaic, 1025); // now configure a new store based on it Catalog cat = getCatalog(); CatalogBuilder cb = new CatalogBuilder(cat); CoverageStoreInfo store = cb.buildCoverageStore("largeMosaic"); store.setURL(mosaic.getAbsolutePath()); store.setType("ImageMosaic"); cat.add(store); // and configure also the coverage cb.setStore(store); CoverageInfo ci = cb.buildCoverage(); cat.add(ci); cat.getResourcePool().dispose(); } finally { if (mosaic.exists() && mosaic.isDirectory()) { FileUtils.deleteDirectory(mosaic); } } }
getCatalog().getResourcePool().dispose();
@Test public void testMosaicParameters() throws Exception { // build a mosaic with 1025 files (the standard ulimit is 1024) File mosaic = new File("./target/smallMosaic"); try { createTimeMosaic(mosaic, 4); // now configure a new store based on it Catalog cat = getCatalog(); CatalogBuilder cb = new CatalogBuilder(cat); CoverageStoreInfo store = cb.buildCoverageStore("smallMosaic"); store.setURL(mosaic.getAbsolutePath()); store.setType("ImageMosaic"); cat.add(store); // and configure also the coverage cb.setStore(store); CoverageInfo ci = cb.buildCoverage(); cat.add(ci); // check the parameters have the default values assertEquals( String.valueOf(-1), ci.getParameters() .get(ImageMosaicFormat.MAX_ALLOWED_TILES.getName().toString())); assertEquals("", ci.getParameters().get(ImageMosaicFormat.FILTER.getName().toString())); cat.getResourcePool().dispose(); } finally { if (mosaic.exists() && mosaic.isDirectory()) { FileUtils.deleteDirectory(mosaic); } } }
@Test public void testAddFilePathWithSpaces() throws Exception { // Other tests mess with or reset the resourcePool, so lets make it is initialised properly GeoServerExtensions.extensions(ResourcePoolInitializer.class) .get(0) .initialize(getGeoServer()); ResourcePool rp = getCatalog().getResourcePool(); CoverageStoreInfo info = getCatalog().getFactory().createCoverageStore(); info.setName("spaces"); info.setType("ImagePyramid"); info.setEnabled(true); info.setURL( "file://./src/test/resources/data_dir/nested_layer_groups/data/pyramid with space"); try { rp.getGridCoverageReader(info, null); } catch (Exception e) { e.printStackTrace(); fail("Unable to add an imagepyramid with a space in it's name"); } rp.dispose(); }
assertNotNull(dataStore); disposeCalled = false; pool.dispose(); assertTrue(disposeCalled);
catalog.getResourcePool().dispose(); catalog.add(ps); sw.stop();