extra funtionality used by PDOK geoserver workspace builder
This commit is contained in:
parent
c588f2c66b
commit
aca1486450
3
.gitignore
vendored
3
.gitignore
vendored
@ -12,3 +12,6 @@ nb*.xml
|
||||
|
||||
./target
|
||||
target
|
||||
|
||||
/.idea
|
||||
*.iml
|
||||
|
||||
@ -39,6 +39,7 @@ import it.geosolutions.geoserver.rest.encoder.GSResourceEncoder.ProjectionPolicy
|
||||
import it.geosolutions.geoserver.rest.encoder.GSWorkspaceEncoder;
|
||||
import it.geosolutions.geoserver.rest.encoder.coverage.GSCoverageEncoder;
|
||||
import it.geosolutions.geoserver.rest.encoder.feature.GSFeatureTypeEncoder;
|
||||
import it.geosolutions.geoserver.rest.encoder.service.GSServiceSettingsEncoder;
|
||||
import it.geosolutions.geoserver.rest.manager.GeoServerRESTStructuredGridCoverageReaderManager;
|
||||
import it.geosolutions.geoserver.rest.manager.GeoServerRESTStructuredGridCoverageReaderManager.ConfigureCoveragesOption;
|
||||
import it.geosolutions.geoserver.rest.manager.GeoServerRESTStyleManager;
|
||||
@ -3145,4 +3146,130 @@ public class GeoServerRESTPublisher {
|
||||
|
||||
}
|
||||
|
||||
public boolean publishServiceLayer(final String workspace, final String servicetype, final GSServiceSettingsEncoder serviceEncoder) {
|
||||
|
||||
if (workspace == null) {
|
||||
throw new IllegalArgumentException("Null argument");
|
||||
}
|
||||
// TODO: check this usecase, layer should always be defined
|
||||
if (workspace.isEmpty()) {
|
||||
throw new IllegalArgumentException("Empty argument");
|
||||
}
|
||||
|
||||
// rest/services/w[mfc]s/workspaces/schelpdierwater/settings.xml
|
||||
final String url = restURL + "/rest/services/" + servicetype + "/workspaces/" + workspace + "/settings.xml";
|
||||
|
||||
String settingsXml = serviceEncoder.toString();
|
||||
LOGGER.debug("URL: " + url);
|
||||
LOGGER.debug("BODY: " + settingsXml);
|
||||
|
||||
String sendResult = HTTPUtils.putXml(url, settingsXml, gsuser, gspass);
|
||||
if (sendResult != null) {
|
||||
if (LOGGER.isInfoEnabled()) {
|
||||
LOGGER.info( servicetype.toUpperCase() + "Service successfully configured: " + workspace);
|
||||
}
|
||||
} else {
|
||||
if (LOGGER.isWarnEnabled())
|
||||
LOGGER.warn("Error configuring " + servicetype.toUpperCase() + " Servic " + workspace + " (" + sendResult + ")");
|
||||
}
|
||||
|
||||
return sendResult != null;
|
||||
}
|
||||
|
||||
public boolean publishWmsServiceLayer(final String workspace, final GSServiceSettingsEncoder serviceEncoder) {
|
||||
|
||||
if (workspace == null) {
|
||||
throw new IllegalArgumentException("Null argument");
|
||||
}
|
||||
// TODO: check this usecase, layer should always be defined
|
||||
if (workspace.isEmpty()) {
|
||||
throw new IllegalArgumentException("Empty argument");
|
||||
}
|
||||
|
||||
// rest/services/wms/workspaces/schelpdierwater/settings.xml
|
||||
final String url = restURL + "/rest/services/wms/workspaces/" + workspace + "/settings.xml";
|
||||
|
||||
String settingsXml = serviceEncoder.toString();
|
||||
LOGGER.debug("URL: " + url);
|
||||
LOGGER.debug("BODY: " + settingsXml);
|
||||
|
||||
String sendResult = HTTPUtils.putXml(url, settingsXml, gsuser, gspass);
|
||||
if (sendResult != null) {
|
||||
if (LOGGER.isInfoEnabled()) {
|
||||
LOGGER.info("WMS Service successfully configured: " + workspace);
|
||||
}
|
||||
} else {
|
||||
if (LOGGER.isWarnEnabled())
|
||||
LOGGER.warn("Error configuring WMS Servic " + workspace + " (" + sendResult + ")");
|
||||
}
|
||||
|
||||
return sendResult != null;
|
||||
}
|
||||
|
||||
public boolean publishWfsServiceLayer(final String workspace, final GSServiceSettingsEncoder serviceEncoder) {
|
||||
|
||||
if (workspace == null) {
|
||||
throw new IllegalArgumentException("Null argument");
|
||||
}
|
||||
// TODO: check this usecase, layer should always be defined
|
||||
if (workspace.isEmpty()) {
|
||||
throw new IllegalArgumentException("Empty argument");
|
||||
}
|
||||
|
||||
// rest/services/wms/workspaces/schelpdierwater/settings.xml
|
||||
final String url = restURL + "/rest/services/wfs/workspaces/" + workspace + "/settings.xml";
|
||||
|
||||
String settingsXml = serviceEncoder.toString();
|
||||
LOGGER.debug("URL: " + url);
|
||||
LOGGER.debug("BODY: " + settingsXml);
|
||||
|
||||
String sendResult = HTTPUtils.putXml(url, settingsXml, gsuser, gspass);
|
||||
if (sendResult != null) {
|
||||
if (LOGGER.isInfoEnabled()) {
|
||||
LOGGER.info("WFS Service successfully configured: " + workspace);
|
||||
}
|
||||
} else {
|
||||
if (LOGGER.isWarnEnabled())
|
||||
LOGGER.warn("Error configuring WFS Service " + workspace + " (" + sendResult + ")");
|
||||
}
|
||||
|
||||
return sendResult != null;
|
||||
}
|
||||
public boolean publishMosaicLayer(final String workspace, final String storename, final GSCoverageEncoder cove, final GSLayerEncoder layerEncoder) {
|
||||
String ftypeXml = cove.toString();
|
||||
StringBuilder postUrl = new StringBuilder(restURL).append("/rest/workspaces/").append(workspace).append("/coveragestores/").append(storename).append("/coverages.xml");
|
||||
|
||||
final String layername = cove.getNativeName();
|
||||
|
||||
LOGGER.info("URL: " + postUrl.toString());
|
||||
LOGGER.info("BODY: " + ftypeXml);
|
||||
|
||||
String configuredResult = HTTPUtils.postXml(postUrl.toString(), ftypeXml, this.gsuser, this.gspass);
|
||||
boolean published = configuredResult != null;
|
||||
boolean configured = false;
|
||||
|
||||
if (!published) {
|
||||
LOGGER.warn("Error in publishing (" + configuredResult + ") " + workspace + ":" + storename + "/" + layername);
|
||||
} else {
|
||||
LOGGER.info("Mosaic layer successfully added (layer:" + layername + ")");
|
||||
|
||||
if (layerEncoder == null) {
|
||||
if (LOGGER.isErrorEnabled())
|
||||
LOGGER.error("GSLayerEncoder is null: Unable to find the defaultStyle for this layer");
|
||||
return false;
|
||||
}
|
||||
|
||||
configured = configureLayer(workspace, layername, layerEncoder);
|
||||
|
||||
if (!configured) {
|
||||
LOGGER.warn("Error in configuring (" + configuredResult + ") " + workspace + ":" + storename + "/" + layername);
|
||||
} else {
|
||||
LOGGER.info("DB layer successfully configured (layer:" + layername + ")");
|
||||
}
|
||||
}
|
||||
|
||||
return published && configured;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -833,6 +833,22 @@ public class GeoServerRESTReader {
|
||||
return RESTFeatureTypeList.build(load(url));
|
||||
}
|
||||
|
||||
public RESTFeatureTypeList getFeatureTypes(String workspace, String list) {
|
||||
String url = "/rest/workspaces/" + workspace + "/featuretypes.xml?list=" + list;
|
||||
if (LOGGER.isDebugEnabled()) {
|
||||
LOGGER.debug("### Retrieving featuretypes from " + url);
|
||||
}
|
||||
return RESTFeatureTypeList.build(load(url));
|
||||
}
|
||||
|
||||
public RESTCoverageList getCoverageNames(String workspace, String coveragestorename, String list) {
|
||||
String url = "/rest/workspaces/" + workspace + "/coveragestores/" + coveragestorename + "/coverages.xml?list=" + list;
|
||||
if (LOGGER.isDebugEnabled()) {
|
||||
LOGGER.debug("### Retrieving coveragenames from " + url);
|
||||
}
|
||||
return RESTCoverageList.build(load(url));
|
||||
}
|
||||
|
||||
/**
|
||||
* Get detailed info about a given Layer.
|
||||
*
|
||||
|
||||
@ -32,14 +32,19 @@ import org.jdom.Element;
|
||||
* @author ETj (etj at geo-solutions.it)
|
||||
*/
|
||||
public class NameLinkElem {
|
||||
private final Element elem;
|
||||
private final Element elem;
|
||||
|
||||
public NameLinkElem(Element elem) {
|
||||
public NameLinkElem(Element elem) {
|
||||
this.elem = elem;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return elem.getChildText("name");
|
||||
}
|
||||
public String getName() {
|
||||
return elem.getChildText("name");
|
||||
}
|
||||
|
||||
public String getValue() {
|
||||
|
||||
return elem.getContent(0).getValue();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -211,6 +211,26 @@ public class GSLayerEncoder extends PropertyXMLEncoder {
|
||||
stylesEncoder.addContent(el);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param styleName
|
||||
* @param workspaceName
|
||||
*/
|
||||
public void addStyle(String styleName, String workspaceName) {
|
||||
final Element el = new Element("style");
|
||||
|
||||
Element name = new Element("name");
|
||||
Element workspace = new Element("workspace");
|
||||
|
||||
name.setText(styleName);
|
||||
workspace.setText(workspaceName);
|
||||
|
||||
el.addContent(name);
|
||||
el.addContent(workspace);
|
||||
|
||||
stylesEncoder.addContent(el);
|
||||
}
|
||||
|
||||
/**
|
||||
* delete a style from the list of available styles
|
||||
*
|
||||
|
||||
@ -91,6 +91,21 @@ public class GSLayerGroupEncoder23 extends GSLayerGroupEncoder {
|
||||
style.addContent(elem("name", styleName));
|
||||
}
|
||||
}
|
||||
|
||||
public void addLayer(String layer, String styleName, String styleWorkspace) {
|
||||
initPublishables("publishables");
|
||||
|
||||
publishablesElem.addContent(
|
||||
new Element("published").setAttribute("type", "layer").addContent(
|
||||
elem("name", layer)));
|
||||
|
||||
Element style = new Element("style");
|
||||
stylesElem.addContent(style);
|
||||
if (styleName != null) {
|
||||
style.addContent(elem("name", styleName));
|
||||
style.addContent(elem("workspace", styleWorkspace));
|
||||
}
|
||||
}
|
||||
|
||||
public void addLayerGroup(String group) {
|
||||
initPublishables("publishables");
|
||||
|
||||
@ -182,4 +182,26 @@ public class GSCoverageEncoder extends GSResourceEncoder {
|
||||
return null;
|
||||
}
|
||||
|
||||
public void addRequestSRS(String[] requestsrslist) {
|
||||
|
||||
Element requestsrs = new Element("requestSRS");
|
||||
|
||||
for (String request : requestsrslist) {
|
||||
new Element("requestSRS").addContent(new Element("string").setText(request));
|
||||
}
|
||||
|
||||
addContent(requestsrs);
|
||||
}
|
||||
|
||||
public void addResponseSRS(String[] responsesrslist) {
|
||||
|
||||
Element responsesrs = new Element("responseSRS");
|
||||
|
||||
for (String response : responsesrslist) {
|
||||
responsesrs.addContent(new Element("string").setText(response));
|
||||
}
|
||||
|
||||
addContent(responsesrs);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -0,0 +1,71 @@
|
||||
/*
|
||||
* GeoServer-Manager - Simple Manager Library for GeoServer
|
||||
*
|
||||
* Copyright (C) 2007,2012 GeoSolutions S.A.S.
|
||||
* http://www.geo-solutions.it
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
package it.geosolutions.geoserver.rest.encoder.datastore;
|
||||
|
||||
import it.geosolutions.geoserver.rest.GeoServerRESTPublisher.StoreType;
|
||||
import it.geosolutions.geoserver.rest.encoder.GSAbstractStoreEncoder;
|
||||
import it.geosolutions.geoserver.rest.encoder.utils.XmlElement;
|
||||
|
||||
import java.net.URL;
|
||||
|
||||
/**
|
||||
* Encoder for a {@value #TYPE} datastore.
|
||||
*
|
||||
* @author Peter van de Riet
|
||||
*/
|
||||
public class GSGeoTIFFDatastoreEncoder extends GSAbstractStoreEncoder {
|
||||
static final String TYPE = "GeoTIFF";
|
||||
|
||||
public GSGeoTIFFDatastoreEncoder(String name) {
|
||||
super(StoreType.COVERAGESTORES, name);
|
||||
setName(name);
|
||||
|
||||
// Set mandatory parameter
|
||||
setType(TYPE);
|
||||
add("enabled", "true");
|
||||
}
|
||||
|
||||
public void setUrl(URL url) {
|
||||
add("url", url.toString());
|
||||
}
|
||||
/**
|
||||
* @return {@value #TYPE}
|
||||
*/
|
||||
protected String getValidType() {
|
||||
return TYPE;
|
||||
}
|
||||
|
||||
public void setWorkspaceName(String workspaceName) {
|
||||
GsWorkspaceElement workspaceXml = new GsWorkspaceElement(workspaceName);
|
||||
addContent(workspaceXml.getRoot());
|
||||
}
|
||||
|
||||
private class GsWorkspaceElement extends XmlElement {
|
||||
public GsWorkspaceElement(String workspaceName) {
|
||||
super("workspace");
|
||||
add("name", workspaceName);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,73 @@
|
||||
/*
|
||||
* GeoServer-Manager - Simple Manager Library for GeoServer
|
||||
*
|
||||
* Copyright (C) 2007,2012 GeoSolutions S.A.S.
|
||||
* http://www.geo-solutions.it
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
package it.geosolutions.geoserver.rest.encoder.datastore;
|
||||
|
||||
import it.geosolutions.geoserver.rest.GeoServerRESTPublisher.StoreType;
|
||||
import it.geosolutions.geoserver.rest.encoder.GSAbstractStoreEncoder;
|
||||
import it.geosolutions.geoserver.rest.encoder.utils.XmlElement;
|
||||
|
||||
import java.net.URL;
|
||||
|
||||
/**
|
||||
* Encoder for a {@value #TYPE} datastore.
|
||||
*
|
||||
* @author Peter van de Riet
|
||||
*/
|
||||
public class GSMosaicDatastoreEncoder extends GSAbstractStoreEncoder {
|
||||
static final String TYPE = "ImageMosaic";
|
||||
|
||||
public GSMosaicDatastoreEncoder(String name) {
|
||||
super(StoreType.COVERAGESTORES, name);
|
||||
// super(name);
|
||||
setName(name);
|
||||
|
||||
// Set mandatory parameter
|
||||
setType(TYPE);
|
||||
add("enabled", "true");
|
||||
}
|
||||
|
||||
public void setUrl(URL url) {
|
||||
add("url", url.toString());
|
||||
}
|
||||
|
||||
/**
|
||||
* @return {@value #TYPE}
|
||||
*/
|
||||
protected String getValidType() {
|
||||
return TYPE;
|
||||
}
|
||||
|
||||
public void setWorkspaceName(String workspaceName) {
|
||||
GsWorkspaceElement workspaceXml = new GsWorkspaceElement(workspaceName);
|
||||
addContent(workspaceXml.getRoot());
|
||||
}
|
||||
|
||||
private class GsWorkspaceElement extends XmlElement {
|
||||
public GsWorkspaceElement(String workspaceName) {
|
||||
super("workspace");
|
||||
add("name", workspaceName);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,192 @@
|
||||
package it.geosolutions.geoserver.rest.encoder.service;
|
||||
|
||||
import it.geosolutions.geoserver.rest.encoder.utils.PropertyXMLEncoder;
|
||||
import org.jdom.Element;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created with IntelliJ IDEA.
|
||||
* User: nijhur
|
||||
* Date: 9-10-14
|
||||
* Time: 8:46
|
||||
*/
|
||||
public class GSServiceSettingsEncoder extends PropertyXMLEncoder {
|
||||
|
||||
public final static String WORKSPACESTRING = "workspace";
|
||||
public final static String NAMESTRING = "name";
|
||||
public final static String KEYWORDS = "keywords";
|
||||
public final static String METADATA = "metadata";
|
||||
|
||||
|
||||
private final static String MAINTAINER = "http://www.geonovum.nl/dossiers/pdok";
|
||||
private final static String SCHEMABASEURL = "http://schemas.opengis.net";
|
||||
|
||||
final private Element workspaceElement = new Element(WORKSPACESTRING);
|
||||
final private Element nameElement = new Element(NAMESTRING);
|
||||
final private Element keywordsElement = new Element(KEYWORDS);
|
||||
final private Element metadata = new Element(METADATA);
|
||||
|
||||
|
||||
|
||||
public GSServiceSettingsEncoder(String type, String serviceMetadataId) {
|
||||
super(type.toLowerCase());
|
||||
addEnabled();
|
||||
addContent(workspaceElement);
|
||||
nameElement.setText(type.toUpperCase());
|
||||
addContent(nameElement);
|
||||
addContent(keywordsElement);
|
||||
addContent(metadata);
|
||||
if ( "WMS".equals(type.toUpperCase())){
|
||||
addWmsMetadata(serviceMetadataId);
|
||||
addWmsDefaultFields();
|
||||
|
||||
} else if ("WFS".equals(type.toUpperCase())){
|
||||
addWfsMetadata(serviceMetadataId);
|
||||
addWfsDefaultFields();
|
||||
}
|
||||
}
|
||||
|
||||
public void addWfsGmlSettings(){
|
||||
String[][] data = new String[][] { { "V_11", "URN", "false" }, {"V_20", "URN2", "false"}, {"V_10", "XML", "true"} };
|
||||
Element root = new Element("gml");
|
||||
for(String[] entryData : data ){
|
||||
Element entry = new Element("entry");
|
||||
|
||||
Element version = new Element("version");
|
||||
version.setText(entryData[0]);
|
||||
entry.addContent(version);
|
||||
|
||||
Element gml = new Element("gml");
|
||||
|
||||
Element style = new Element("srsNameStyle");
|
||||
style.setText(entryData[1]);
|
||||
gml.addContent(style);
|
||||
|
||||
Element override = new Element("overrideGMLAttributes");
|
||||
override.setText(entryData[2]);
|
||||
gml.addContent(override);
|
||||
|
||||
entry.addContent(gml);
|
||||
|
||||
root.addContent(entry);
|
||||
}
|
||||
|
||||
addContent(root);
|
||||
|
||||
}
|
||||
|
||||
|
||||
private void addWmsMetadata(String wmsMetadataId){
|
||||
String ENTRY = "entry";
|
||||
String KEY = "key";
|
||||
metadata.addContent( createElementWithAttribute(ENTRY, "20", KEY, "jpegCompression"));
|
||||
metadata.addContent( createElementWithAttribute(ENTRY, "100", KEY, "pngCompression"));
|
||||
metadata.addContent( createElementWithAttribute(ENTRY, "auto", KEY, "kmlSuperoverlayMode"));
|
||||
metadata.addContent( createElementWithAttribute(ENTRY, "1000", KEY, "framesDelay"));
|
||||
metadata.addContent( createElementWithAttribute(ENTRY, "refresh", KEY, "kmlReflectorMode"));
|
||||
metadata.addContent( createElementWithAttribute(ENTRY, "", KEY, "inspire.spatialDatasetIdentifier"));
|
||||
metadata.addContent( createElementWithAttribute(ENTRY, "dut", KEY, "inspire.language"));
|
||||
metadata.addContent( createElementWithAttribute(ENTRY, "40", KEY, "kmlKmscore"));
|
||||
metadata.addContent( createElementWithAttribute(ENTRY, "true", KEY, "svgAntiAlias"));
|
||||
metadata.addContent( createElementWithAttribute(ENTRY, "http://www.nationaalgeoregister.nl/geonetwork/srv/eng/csw?service=CSW&version=2.0.2&request=GetRecordById&outputschema=http://www.isotc211.org/2005/gmd&elementsetname=full&id=" + wmsMetadataId, KEY, "inspire.metadataURL"));
|
||||
metadata.addContent( createElementWithAttribute(ENTRY, "false", KEY, "kmlPlacemark"));
|
||||
metadata.addContent( createElementWithAttribute(ENTRY, "true", KEY, "kmlAttr"));
|
||||
metadata.addContent( createElementWithAttribute(ENTRY, "2147483647", KEY, "maxAllowedFrames"));
|
||||
metadata.addContent( createElementWithAttribute(ENTRY, "[{'name': 'PDOK', 'href' : 'http://www.pdok.nl", KEY, "authorityURLs'"));
|
||||
metadata.addContent( createElementWithAttribute(ENTRY, "application/vnd.ogc.csw.GetRecordByIdResponse_xml", KEY, "inspire.metadataURLType"));
|
||||
metadata.addContent( createElementWithAttribute(ENTRY, "false", KEY, "loopContinuously"));
|
||||
metadata.addContent( createElementWithAttribute(ENTRY, "Batik", KEY, "svgRenderer"));
|
||||
}
|
||||
|
||||
private void addWfsMetadata(String wfsMetadataId){
|
||||
String ENTRY = "entry";
|
||||
String KEY = "key";
|
||||
metadata.addContent( createElementWithAttribute(ENTRY, "false", KEY, "SHAPE-ZIP_DEFAULT_PRJ_IS_ESRI"));
|
||||
metadata.addContent( createElementWithAttribute(ENTRY, wfsMetadataId, KEY, "inspire.spatialDatasetIdentifier"));
|
||||
metadata.addContent( createElementWithAttribute(ENTRY, "application/vnd.ogc.csw.GetRecordByIdResponse_xml", KEY, "inspire.metadataURLType"));
|
||||
metadata.addContent( createElementWithAttribute(ENTRY, "http://www.nationaalgeoregister.nl/geonetwork/srv/eng/csw?service=CSW&version=2.0.2&request=GetRecordById&outputschema=http://www.isotc211.org/2005/gmd&elementsetname=full&id=" + wfsMetadataId, KEY, "inspire.metadataURL"));
|
||||
}
|
||||
|
||||
private void addWmsDefaultFields(){
|
||||
add("maintainer", MAINTAINER);
|
||||
add("schemaBaseURL", "http://schemas.opengis.net");
|
||||
add("bboxForEachCRS", "true");
|
||||
//addWatermark();
|
||||
add("maxBuffer", "25");
|
||||
add("maxRequestMemory", "270336");
|
||||
add("maxRenderingTime", "60");
|
||||
add("maxRenderingErrors", "1000");
|
||||
}
|
||||
|
||||
private void addWfsDefaultFields(){
|
||||
add("schemaBaseURL", SCHEMABASEURL);
|
||||
add("serviceLevel", "BASIC");
|
||||
add("maxFeatures", "15000");
|
||||
add("featureBounding", "false");
|
||||
add("canonicalSchemaLocation", "false");
|
||||
add("encodeFeatureMember", "false");
|
||||
addWfsGmlSettings();
|
||||
}
|
||||
|
||||
public void setWorkspace(String workspaceName){
|
||||
final Element name = new Element(NAMESTRING);
|
||||
name.setText(workspaceName);
|
||||
workspaceElement.addContent(name);
|
||||
}
|
||||
|
||||
private void addWatermark(){
|
||||
Element watermark = new Element("watermark");
|
||||
|
||||
Element enabled = new Element("enabled");
|
||||
enabled.setText("false");
|
||||
watermark.addContent(enabled);
|
||||
|
||||
Element position = new Element("position");
|
||||
enabled.setText("BOT_RIGHT");
|
||||
watermark.addContent(position);
|
||||
|
||||
Element transparency = new Element("transparency");
|
||||
enabled.setText("0");
|
||||
watermark.addContent(transparency);
|
||||
|
||||
addContent(watermark);
|
||||
}
|
||||
|
||||
protected void addEnabled(){
|
||||
add("enabled","true");
|
||||
}
|
||||
|
||||
public void setTitle(String title){
|
||||
add("title", title);
|
||||
}
|
||||
|
||||
public void setAbstract(String abstractText){
|
||||
add("abstrct", abstractText);
|
||||
}
|
||||
|
||||
public void setAccessConstraints(String accessConstraints){
|
||||
add("accessConstraints", accessConstraints);
|
||||
}
|
||||
|
||||
public void setFees(String fees){
|
||||
add("fees", fees);
|
||||
}
|
||||
|
||||
public void setSrs(List<String> values){
|
||||
Element srs = new Element("srs");
|
||||
for (String value : values){
|
||||
Element valueElement = new Element("string");
|
||||
valueElement.setText(value);
|
||||
srs.addContent(valueElement);
|
||||
}
|
||||
addContent(srs);
|
||||
}
|
||||
|
||||
public void addKeyword(String keyword){
|
||||
Element valueElement = new Element("string");
|
||||
valueElement.setText(keyword);
|
||||
keywordsElement.addContent(valueElement);
|
||||
}
|
||||
|
||||
}
|
||||
@ -134,6 +134,13 @@ public class PropertyXMLEncoder extends XmlElement {
|
||||
|
||||
}
|
||||
|
||||
protected Element createElementWithAttribute(String elementName, String elementValue, String attributeName, String attributeValue){
|
||||
Element result = new Element(elementName);
|
||||
result.setAttribute(attributeName, attributeValue);
|
||||
result.setText(elementValue);
|
||||
return result;
|
||||
}
|
||||
|
||||
// public void set(final String key, final String value) {
|
||||
// if (key != null && value != null) {
|
||||
// set(getRoot(), key, value);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user