本文整理了Java中org.geoserver.config.GeoServer.reload()
方法的一些代码示例,展示了GeoServer.reload()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。GeoServer.reload()
方法的具体详情如下:
包路径:org.geoserver.config.GeoServer
类名称:GeoServer
方法名:reload
[英]Clears up all of the caches as well as the configuration information
[中]清除所有缓存以及配置信息
代码示例来源:origin: geoserver/geoserver
@Test
public void testLoadGibberish() throws Exception {
// we should get a log message, but the startup should continue
File service =
new File(getDataDirectory().getResourceLoader().getBaseDirectory(), "service.xml");
FileUtils.writeStringToFile(service, "duDaDa");
getGeoServer().reload();
assertEquals(0, geoServer.getServices().size());
}
代码示例来源:origin: geoserver/geoserver
@RunTestSetup
@Test
public void testGeoServerReload() throws Exception {
Catalog cat = getCatalog();
FeatureTypeInfo lakes =
cat.getFeatureTypeByName(
MockData.LAKES.getNamespaceURI(), MockData.LAKES.getLocalPart());
assertFalse("foo".equals(lakes.getTitle()));
GeoServerDataDirectory dd = new GeoServerDataDirectory(getResourceLoader());
File info = dd.findResourceFile(lakes);
// File info = getResourceLoader().find("featureTypes", "cite_Lakes", "info.xml");
FileReader in = new FileReader(info);
Element dom = ReaderUtils.parse(in);
Element title = ReaderUtils.getChildElement(dom, "title");
title.getFirstChild().setNodeValue("foo");
OutputStream output = new FileOutputStream(info);
try {
TransformerFactory.newInstance()
.newTransformer()
.transform(new DOMSource(dom), new StreamResult(output));
} finally {
output.close();
}
getGeoServer().reload();
lakes =
cat.getFeatureTypeByName(
MockData.LAKES.getNamespaceURI(), MockData.LAKES.getLocalPart());
assertEquals("foo", lakes.getTitle());
}
代码示例来源:origin: geoserver/geoserver
@Test
public void testReloadWithRuinedCoverageStore() throws Exception {
// ruin one coverage description
File root = getDataDirectory().getRoot().dir();
File targetCoverage = new File(root, "workspaces/wcs/BlueMarble/coveragestore.xml");
FileUtils.writeStringToFile(targetCoverage, "boom!");
// reload and check it does not go belly up
getGeoServer().reload();
// check the coverage in question is no more
getCatalog().getCoverageByName(getLayerId(MockData.TASMANIA_BM));
}
}
代码示例来源:origin: geoserver/geoserver
@Test
public void testReloadDefaultStyles() throws Exception {
// clear up all "point" styles
final Resource styles = getDataDirectory().getStyles();
styles.list()
.stream()
.filter(r -> r.getType() == Resource.Type.RESOURCE && r.name().contains("point"))
.forEach(r -> r.delete());
// reload
getGeoServer().reload();
// check the default point style has been re-created
final StyleInfo point = getCatalog().getStyleByName("point");
assertNotNull(point);
}
代码示例来源:origin: geoserver/geoserver
@Override
protected void onSetUp(SystemTestData testData) throws Exception {
super.onSetUp(testData);
LayerInfo li = getCatalog().getLayerByName(getLayerId(SystemTestData.BUILDINGS));
Resource resource = getDataDirectory().config(li);
Document dom;
try (InputStream is = resource.in()) {
dom = dom(resource.in());
}
Element defaultStyle = (Element) dom.getElementsByTagName("defaultStyle").item(0);
Element defaultStyleId = (Element) defaultStyle.getElementsByTagName("id").item(0);
defaultStyleId.setTextContent("danglingReference");
try (OutputStream os = resource.out()) {
print(dom, os);
}
getGeoServer().reload();
}
代码示例来源:origin: geoserver/geoserver
getGeoServer().reload();
rp = getCatalog().getResourcePool();
代码示例来源:origin: geoserver/geoserver
@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();
}
代码示例来源:origin: geoserver/geoserver
getGeoServer().reload();
int listenersAfter = catalog.getListeners().size();
assertEquals(listenersBefore, listenersAfter);
代码示例来源:origin: geoserver/geoserver
@Test
public void testRenameWorspaceAfterReload() throws Exception {
getGeoServer().reload();
getGeoServer().reload();
代码示例来源:origin: geoserver/geoserver
@Test
public void testReloadWithLocalServices() throws Exception {
// setup a non default workspace
WorkspaceInfo ws = getCatalog().getFactory().createWorkspace();
ws.setName("nonDefault");
NamespaceInfo ni = getCatalog().getFactory().createNamespace();
ni.setPrefix("nonDefault");
ni.setURI("http://www.geoserver.org/nonDefault");
getCatalog().add(ws);
getCatalog().add(ni);
// create a ws specific setting
SettingsInfo s = geoServer.getFactory().createSettings();
s.setWorkspace(ws);
geoServer.add(s);
getGeoServer().reload();
}
代码示例来源:origin: org.geoserver/gs-restconfig
@RequestMapping(
value = "/reload",
method = {RequestMethod.POST, RequestMethod.PUT}
)
public void reload() throws Exception {
geoServer.reload();
}
代码示例来源:origin: org.geoserver.community/gs-hz-cluster
@Override
public void run() {
// lock during event processing
eventLock.set(true);
try {
gs.reload();
} catch (Exception e) {
LOGGER.log(Level.WARNING, "Reload failed", e);
} finally {
eventLock.set(false);
}
}
});
代码示例来源:origin: org.geoserver/restconfig
/**
* Method to reload the catalog
*/
protected void reloadCatalog() throws Exception {
if(forceReset) {
geoServer.reset();
} else {
geoServer.reload();
}
}
}
代码示例来源:origin: org.geoserver.web/web-core
@Override
public void onClick(AjaxRequestTarget target) {
try {
getGeoServer().reload();
info(getLocalizer().getString("catalogConfigReloadedSuccessfully", StatusPage.this));
} catch(Throwable t) {
LOGGER.log(Level.SEVERE, "An error occurred while reloading the catalog", t);
error(t);
}
target.addComponent(feedbackPanel);
}
});
代码示例来源:origin: org.geoserver.web/gs-web-core
@Override
public void onClick(AjaxRequestTarget target) {
try {
parent.getGeoServer().reload();
info(
getLocalizer()
.getString(
"catalogConfigReloadedSuccessfully",
StatusPanel.this));
} catch (Throwable t) {
LOGGER.log(
Level.SEVERE,
"An error occurred while reloading the catalog",
t);
error(t);
}
parent.addFeedbackPanels(target);
}
});
代码示例来源:origin: org.geoserver/gs-wms
@Test
public void testWMSLifecycleHandlerGraphicCacheReset() throws Exception {
Iterator<ExternalGraphicFactory> it =
DynamicSymbolFactoryFinder.getExternalGraphicFactories();
Map<URL, BufferedImage> imageCache = null;
while (it.hasNext()) {
ExternalGraphicFactory egf = it.next();
if (egf instanceof ImageGraphicFactory) {
Field cache = egf.getClass().getDeclaredField("imageCache");
cache.setAccessible(true);
imageCache = (Map) cache.get(egf);
URL u = new URL("http://boundless.org");
BufferedImage b = new BufferedImage(6, 6, 8);
imageCache.put(u, b);
}
}
assertNotEquals(0, imageCache.size());
getGeoServer().reload();
assertEquals(0, imageCache.size());
}
}
代码示例来源:origin: org.geoserver.community/gs-taskmanager-core
@Before
public final void setupAndLoadDataDirectory() throws Exception {
if (setupDataDirectory()) {
DATA_DIRECTORY.setUp();
geoServer.reload();
}
}
代码示例来源:origin: org.geoserver/gwc
/**
* Commented out for the moment, we need a new release of GWC
public void testPreserveHeaders() throws Exception {
MockHttpServletResponse response = getAsServletResponse("gwc/service/wms?service=wms&version=1.1.0&request=GetCapabilities");
assertEquals("application/vnd.ogc.wms_xml", response.getContentType());
assertEquals("inline;filename=wms-getcapabilities.xml", response.getHeader("content-disposition"));
}
*/
public void testSaveConfig() throws Exception {
GWCConfig config = GWC.get().getConfig();
// set a large gutter
config.setGutter(100);
// save the config
GWC.get().saveConfig(config);
// force a reload
getGeoServer().reload();
// grab the config, make sure it was saved as expected
assertEquals(100, GWC.get().getConfig().getGutter());
}
}
代码示例来源:origin: org.geoserver/gwc
public void testRemoveLayerAfterReload() throws Exception {
Catalog cat = getCatalog();
TileLayerDispatcher tld = GeoWebCacheExtensions.bean(TileLayerDispatcher.class);
LayerInfo li = cat.getLayerByName(super.getLayerId(MockData.MPOINTS));
String layerName = tileLayerName(li);
assertNotNull(tld.getTileLayer(layerName));
// force reload
getGeoServer().reload();
// now remove the layer and check it has been removed from GWC as well
cat.remove(li);
try {
tld.getTileLayer(layerName);
fail("Layer should not exist");
} catch (GeoWebCacheException gwce) {
// fine
}
}
}
代码示例来源:origin: org.geoserver/gwc
/**
* See GEOS-5092, check server startup is not hurt by a tile layer out of sync (say someone
* manually removed the GeoServer layer)
*/
public void testMissingGeoServerLayerAtStartUp() throws Exception {
Catalog catalog = getCatalog();
GWC mediator = GWC.get();
final String layerName = getLayerId(BASIC_POLYGONS);
LayerInfo layerInfo = catalog.getLayerByName(layerName);
assertNotNull(layerInfo);
TileLayer tileLayer = mediator.getTileLayerByName(layerName);
assertNotNull(tileLayer);
assertTrue(tileLayer.isEnabled());
MockData testData = getTestData();
testData.removeFeatureType(BASIC_POLYGONS);
getGeoServer().reload();
assertNull(catalog.getLayerByName(layerName));
CatalogConfiguration config = GeoServerExtensions.bean(CatalogConfiguration.class);
assertNull(config.getTileLayer(layerName));
try {
mediator.getTileLayerByName(layerName);
fail("Expected IAE");
} catch (IllegalArgumentException e) {
assertTrue(true);
}
}
内容来源于网络,如有侵权,请联系作者删除!