@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 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); } } }
@Test public void testDropCoverageStore() throws Exception { // build the store Catalog cat = getCatalog(); CatalogBuilder cb = new CatalogBuilder(cat); CoverageStoreInfo store = cb.buildCoverageStore("dem"); store.setURL(MockData.class.getResource("tazdem.tiff").toExternalForm()); store.setType("GeoTIFF"); cat.add(store); // build the coverage cb.setStore(store); CoverageInfo ci = cb.buildCoverage(); cat.add(ci); // build the layer LayerInfo layer = cb.buildLayer(ci); cat.add(layer); // grab a reader just to inizialize the code ci.getGridCoverage(null, null); ci.getGridCoverageReader(null, GeoTools.getDefaultHints()); // now drop the store CascadeDeleteVisitor visitor = new CascadeDeleteVisitor(cat); visitor.visit(store); // and reload (GEOS-4782 -> BOOM!) getGeoServer().reload(); }
@Override public CoverageStoreInfo createStore(ImportData data, WorkspaceInfo workspace, Catalog catalog) throws IOException { File f = file(data); if (f == null) { return null; } CatalogBuilder cb = new CatalogBuilder(catalog); cb.setWorkspace(workspace); CoverageStoreInfo store = cb.buildCoverageStore(data.getName()); store.setURL(f.toURI().toURL().toString()); store.setType(gridFormat().getName()); return store; }
@Override public CoverageStoreInfo createStore(ImportData data, WorkspaceInfo workspace, Catalog catalog) throws IOException { File f = file(data); if (f == null) { return null; } CatalogBuilder cb = new CatalogBuilder(catalog); cb.setWorkspace(workspace); CoverageStoreInfo store = cb.buildCoverageStore(data.getName()); store.setURL(relativeDataFileURL(f.toURI().toURL().toString(), catalog)); store.setType(gridFormat().getName()); return store; }
info = builder.buildCoverageStore(storeName); add = true; } else {
CoverageStoreInfo store = cb.buildCoverageStore("dummy"); store.setType(gridFormat().getName()); cb.setStore(store);
CoverageStoreInfo store = cb.buildCoverageStore("dummy"); store.setType(gridFormat().getName()); cb.setStore(store);
private CoverageStoreInfo createMosaicStore( CatalogBuilder cb, String collection, CollectionLayer layer, final String relativePath) { // good to go, create the store cb.setWorkspace(catalog.getWorkspaceByName(layer.getWorkspace())); CoverageStoreInfo mosaicStore = cb.buildCoverageStore(layer.getLayer()); mosaicStore.setType(new ImageMosaicFormat().getName()); mosaicStore.setDescription("Image mosaic wrapping OpenSearch collection: " + collection); mosaicStore.setURL("file:/" + relativePath); catalog.add(mosaicStore); cb.setStore(mosaicStore); return mosaicStore; }
info = builder.buildCoverageStore(coveragestore); add = true;
cb.setWorkspace(catalog.getDefaultWorkspace()); CoverageStoreInfo store = cb.buildCoverageStore(mosaicName); store.setURL("./" + mosaicName); store.setType("ImageMosaic");
CoverageStoreInfo covstoreInfo = builder.buildCoverageStore(resource .getLocalPart()); covstoreInfo.setType(ImportUtilities.GEOTIFF_FORMAT.getName());
CoverageStoreInfo store = builder.buildCoverageStore("watertemp5"); store.setURL(URLs.fileToUrl(Resources.find(mosaic)).toExternalForm()); store.setWorkspace(ws);
storeInfo = cb.buildCoverageStore((store)); add = true; LOGGER.info("Creating store " + store + " since it did not exist"); cb.buildCoverageStore((name != null ? name : coverage.getName().toString())); add = true; store = (name != null ? name : coverage.getName().toString());
CoverageStoreInfo store = builder.buildCoverageStore("watertemp4"); store.setURL(URLs.fileToUrl(Resources.find(mosaic)).toExternalForm()); store.setWorkspace(ws);