本文整理了Java中org.geoserver.config.GeoServer.save()
方法的一些代码示例,展示了GeoServer.save()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。GeoServer.save()
方法的具体详情如下:
包路径:org.geoserver.config.GeoServer
类名称:GeoServer
方法名:save
[英]Saves the global geoserver configuration after modification.
[中]修改后保存全局地理服务器配置。
代码示例来源:origin: geoserver/geoserver
@Test
public void testProxyBase() {
GeoServerInfo gi = getGeoServer().getGlobal();
gi.getSettings().setProxyBaseUrl("http://geoserver.org/");
getGeoServer().save(gi);
String url = buildURL(BASEURL, "test", null, URLType.SERVICE);
assertEquals("http://geoserver.org/test", url);
}
}
代码示例来源:origin: geoserver/geoserver
if (workspace != null) {
ws = catalog.getWorkspaceByName(workspace);
old = geoServer.getService(ws, serviceClass);
} else {
old = geoServer.getService(serviceClass);
geoServer.save(old);
} else {
代码示例来源:origin: org.geoserver/gs-wfs
@Test
public void testReplaceOnTransactionalLevel() throws Exception {
GeoServer gs = getGeoServer();
WFSInfo wfs = gs.getService(WFSInfo.class);
wfs.setServiceLevel(WFSInfo.ServiceLevel.TRANSACTIONAL);
gs.save(wfs);
try {
testReplace();
} finally {
wfs.setServiceLevel(WFSInfo.ServiceLevel.COMPLETE);
gs.save(wfs);
}
}
代码示例来源:origin: org.geoserver/gs-wcs1_1
@Test
public void testEnabledServiceResponse() throws Exception {
WCSInfo wcs = getGeoServer().getService(WCSInfo.class);
wcs.setEnabled(true);
getGeoServer().save(wcs);
Document doc = getAsDOM("wcs?service=WCS&request=getCapabilities");
assertEquals("wcs:Capabilities", doc.getDocumentElement().getNodeName());
}
}
代码示例来源:origin: geoserver/geoserver
@Test
public void testModifyGlobal() throws Exception {
GeoServerInfo global = getGeoServer().getGlobal();
global.setAdminUsername("roadRunner");
global.setTitle("ACME");
getGeoServer().save(global);
File f = new File(testData.getDataDirectoryRoot(), "global.xml");
Document dom = dom(f);
assertXpathEvaluatesTo("roadRunner", "/global/adminUsername", dom);
assertXpathEvaluatesTo("ACME", "/global/settings/title", dom);
}
代码示例来源:origin: org.geoserver/gs-gwc
/**
* Before using {@code gwc-gs.xml} to hold the integrated GWC configuration, the only property
* configured was whether the direct WMS integration option was enabled, and it was saved as
* part of the {@link WMSInfo} metadata map under the {@code GWC_WMS_Integration} key. This
* method removes that key from WMSInfo if present and sets its value to the {@code gwcConfig}
* instead.
*/
private void upgradeWMSIntegrationConfig(final GeoServer geoServer, final GWCConfig gwcConfig)
throws IOException {
// Check whether we're using the old way of storing this information, and get rid of it
WMSInfo service = geoServer.getService(WMSInfo.class);
if (service != null) {
MetadataMap metadata = service.getMetadata();
if (service != null && metadata != null) {
Boolean storedValue = metadata.get(WMS_INTEGRATION_ENABLED_KEY, Boolean.class);
if (storedValue != null) {
boolean enabled = storedValue.booleanValue();
gwcConfig.setDirectWMSIntegrationEnabled(enabled);
metadata.remove(WMS_INTEGRATION_ENABLED_KEY);
geoServer.save(service);
}
}
}
}
代码示例来源:origin: org.geoserver/gs-wms
@Test
public void testEnabledServiceResponse() throws Exception {
WMSInfo wms = getGeoServer().getService(WMSInfo.class);
wms.setEnabled(true);
getGeoServer().save(wms);
Document doc = getAsDOM("wms?service=WMS&version=1.1.1&request=getCapabilities");
assertEquals("WMT_MS_Capabilities", doc.getDocumentElement().getNodeName());
}
}
代码示例来源:origin: geoserver/geoserver
@Test
public void testConfigureFeatureTypeCacheSize() {
GeoServer gs = getGeoServer();
GeoServerInfo global = gs.getGlobal();
global.setFeatureTypeCacheSize(200);
gs.save(global);
Catalog catalog = getCatalog();
// we actually keep two versions of the feature type in the cache, so we need it
// twice as big
assertEquals(
400,
((SoftValueHashMap) catalog.getResourcePool().getFeatureTypeCache())
.getHardReferencesCount());
}
代码示例来源:origin: org.geoserver/gs-restconfig
public void serviceSettingsPut(ServiceInfo info, String workspaceName) {
WorkspaceInfo ws = null;
if (workspaceName != null) ws = geoServer.getCatalog().getWorkspaceByName(workspaceName);
ServiceInfo originalInfo;
if (ws != null) {
originalInfo = geoServer.getService(ws, clazz);
} else {
originalInfo = geoServer.getService(clazz);
}
if (originalInfo != null) {
OwsUtils.copy(info, originalInfo, clazz);
geoServer.save(originalInfo);
} else {
if (ws != null) {
info.setWorkspace(ws);
}
geoServer.add(info);
}
}
代码示例来源:origin: org.geoserver/gs-wfs
@Test
public void testEnabledServiceResponse() throws Exception {
WFSInfo wfs = getGeoServer().getService(WFSInfo.class);
wfs.setEnabled(true);
getGeoServer().save(wfs);
Document doc = getAsDOM("wfs?service=WFS&version=1.1.0&request=getCapabilities");
assertEquals("wfs:WFS_Capabilities", doc.getDocumentElement().getNodeName());
}
}
代码示例来源:origin: geoserver/geoserver
@Test
public void testServiceUpdates() {
GeoServerInfo global = getGeoServer().getGlobal();
long updateSequence = global.getUpdateSequence();
// change a flag in the config
global.setVerbose(true);
getGeoServer().save(global);
long newUpdateSequence = getGeoServer().getGlobal().getUpdateSequence();
assertTrue(newUpdateSequence > updateSequence);
}
}
代码示例来源:origin: org.geoserver/gs-wfs
private void setupESRIFormatByDefault(GeoServer geoServer, Boolean value) throws IOException {
WFSInfo wfsInfo = geoServer.getService(WFSInfo.class);
MetadataMap metadata = wfsInfo.getMetadata();
metadata.put(ShapeZipOutputFormat.SHAPE_ZIP_DEFAULT_PRJ_IS_ESRI, value);
geoServer.save(wfsInfo);
}
代码示例来源:origin: org.geoserver/gs-wcs1_1
@Test
public void testDisabledServiceResponse() throws Exception {
WCSInfo wcs = getGeoServer().getService(WCSInfo.class);
wcs.setEnabled(false);
getGeoServer().save(wcs);
Document doc = getAsDOM("wcs?service=WCS&request=getCapabilities");
assertEquals("ows:ExceptionReport", doc.getDocumentElement().getNodeName());
}
代码示例来源:origin: geoserver/geoserver
@Test
public void testModifySettings() throws Exception {
testAddSettings();
WorkspaceInfo ws = catalog.getWorkspaceByName("acme");
SettingsInfo settings = getGeoServer().getSettings(ws);
settings.setTitle("FOO");
getGeoServer().save(settings);
File f = catalog.getResourceLoader().find("workspaces", ws.getName(), "settings.xml");
assertNotNull(f);
Document dom = dom(f);
assertXpathEvaluatesTo("FOO", "/settings/title", dom);
}
代码示例来源:origin: org.geoserver/gs-wcs1_1
protected void setOutputLimit(int kbytes) {
GeoServer gs = getGeoServer();
WCSInfo info = gs.getService(WCSInfo.class);
info.setMaxOutputMemory(kbytes);
gs.save(info);
}
代码示例来源:origin: org.geoserver/gs-wms
@Test
public void testDisabledServiceResponse() throws Exception {
Logging.getLogger("org.geoserver.ows").setLevel(Level.OFF);
WMSInfo wms = getGeoServer().getService(WMSInfo.class);
wms.setEnabled(false);
getGeoServer().save(wms);
Document doc = getAsDOM("wms?service=WMS&version=1.1.1&request=getCapabilities");
assertEquals("ows:ExceptionReport", doc.getDocumentElement().getNodeName());
}
代码示例来源:origin: geoserver/geoserver
@Test
public void testModifySettingsChangeWorkspace() throws Exception {
testAddSettings();
WorkspaceInfo ws1 = catalog.getWorkspaceByName("acme");
WorkspaceInfo ws2 = catalog.getFactory().createWorkspace();
ws2.setName("foo");
catalog.add(ws2);
SettingsInfo settings = getGeoServer().getSettings(ws1);
settings.setWorkspace(ws2);
getGeoServer().save(settings);
File f = catalog.getResourceLoader().find("workspaces", ws1.getName(), "settings.xml");
assertNull(f);
f = catalog.getResourceLoader().find("workspaces", ws2.getName(), "settings.xml");
assertNotNull(f);
Document dom = dom(f);
assertXpathEvaluatesTo(ws2.getId(), "/settings/workspace/id", dom);
}
代码示例来源:origin: org.geoserver/gs-wcs2_0
protected void setInputLimit(int kbytes) {
GeoServer gs = getGeoServer();
WCSInfo info = gs.getService(WCSInfo.class);
info.setMaxInputMemory(kbytes);
gs.save(info);
}
代码示例来源:origin: org.geoserver/gs-wfs
@Test
public void testDisabledServiceResponse() throws Exception {
WFSInfo wfs = getGeoServer().getService(WFSInfo.class);
wfs.setEnabled(false);
getGeoServer().save(wfs);
Document doc = getAsDOM("wfs?service=WFS&version=1.0.0&request=getCapabilities");
assertEquals("ows:ExceptionReport", doc.getDocumentElement().getNodeName());
}
代码示例来源:origin: org.geoserver/gs-wfs
@Test
public void testGetFeatureReproject11() throws Exception {
WFSInfo wfs = getWFS();
wfs.setFeatureBounding(true);
getGeoServer().save(wfs);
Document doc =
getAsDOM(
"wfs?request=GetFeature&typename=cite:Geometryless&version=1.1.0&service=wfs&srsName=EPSG:900913");
assertEquals("wfs:FeatureCollection", doc.getDocumentElement().getNodeName());
NodeList featureMembers = doc.getElementsByTagName("gml:featureMembers");
assertFalse(featureMembers.getLength() == 0);
NodeList features = doc.getElementsByTagName("cite:Geometryless");
assertEquals(3, features.getLength());
}
内容来源于网络,如有侵权,请联系作者删除!