public @Nullable GridSet get(String gridSetId) { return getGridSet(gridSetId).orElse(null); }
@Test public void testRemoveGridset() throws IOException { String gridsetToRemove = GWCConfigIntegrationTestData.GRIDSET_EPSG2163; // remove the only layer referencing the gridset first gridSetBroker.removeGridSet(gridsetToRemove); assertThat(gridSetBroker.getGridSetNames(), not(hasItem(gridsetToRemove))); assertThat(gridSetBroker.getGridSet(gridsetToRemove), notPresent()); } }
/** * Blindly removes a gridset from this gridset broker. * * <p>This method doesn't check whether there's any layer referencing the gridset nor removes it * from the {@link XMLConfiguration}. For such a thing, check {@link * TileLayerDispatcher#removeGridset(String)}, which cascades to this method. * * @param gridSetName * @return */ public synchronized GridSet remove(final String gridSetName) { return getGridSet(gridSetName) .map( g -> { removeGridSet(gridSetName); return g; }) .orElse(null); }
public GridSet getWorldEpsg4326() { // get the internal default. We need it's name, if nothing else. final GridSet internalDefault4326GridSet = getDefaults().worldEpsg4326(); // get the name of the internal default as it may not always be "EPSG:4326" final String internalDefault4326Name = internalDefault4326GridSet.getName(); // Use the highest priority EPSG:4326 gridset we have (either an overriden one, or the // defaults) Optional<GridSet> gridSet = getGridSet(internalDefault4326Name); if (gridSet.isPresent()) { return gridSet.get(); } // probably won't ever hit this, but if 4326 isn't in the configuration at this point, just // return the internal // defaults. return internalDefault4326GridSet; }
public GridSet getWorldEpsg3857() { // get the internal default. We need it's name, if nothing else. final GridSet internalDefault3857GridSet = getDefaults().worldEpsg3857(); // get the name of the internal default as it may not always be "EPSG:3857" final String internalDefault3857Name = internalDefault3857GridSet.getName(); // Use the highest priority EPSG:3857 gridset we have (either an overriden one, or the // defaults) Optional<GridSet> gridSet = getGridSet(internalDefault3857Name); if (gridSet.isPresent()) { return gridSet.get(); } // probably won't ever hit this, but if 3857 isn't in the configuration at this point, just // return the internal // defaults. return internalDefault3857GridSet; }
@Test public void testGetDefaultGridSet() throws IOException { Optional<GridSet> existingGridSet = gridSetBroker.getGridSet(GWCConfigIntegrationTestData.GRIDSET_EPSG4326); assertThat( existingGridSet, isPresent( hasProperty( "name", equalTo(GWCConfigIntegrationTestData.GRIDSET_EPSG4326)))); }
@Test public void testGetGridSet() throws IOException { Optional<GridSet> existingGridSet = gridSetBroker.getGridSet(GWCConfigIntegrationTestData.GRIDSET_EPSG2163); assertThat( existingGridSet, isPresent( hasProperty( "name", equalTo(GWCConfigIntegrationTestData.GRIDSET_EPSG2163)))); }
@Test public void testGetNotPresentGridSet() throws IOException { Optional<GridSet> existingGridSet = gridSetBroker.getGridSet("DOESNOTEXIST"); assertThat(existingGridSet, notPresent()); }