This commit is contained in:
Emmanuel Blondel 2013-04-06 05:59:12 -07:00
commit f2708795bb
8 changed files with 923 additions and 583 deletions

View File

@ -1,196 +1,252 @@
/* /*
* GeoServer-Manager - Simple Manager Library for GeoServer * GeoServer-Manager - Simple Manager Library for GeoServer
* *
* Copyright (C) 2007,2011 GeoSolutions S.A.S. * Copyright (C) 2007,2011 GeoSolutions S.A.S.
* http://www.geo-solutions.it * http://www.geo-solutions.it
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy * Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal * of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights * in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is * copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions: * furnished to do so, subject to the following conditions:
* *
* The above copyright notice and this permission notice shall be included in * The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software. * all copies or substantial portions of the Software.
* *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * 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 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE. * THE SOFTWARE.
*/ */
package it.geosolutions.geoserver.rest.decoder; package it.geosolutions.geoserver.rest.decoder;
import it.geosolutions.geoserver.rest.decoder.utils.JDOMBuilder; import it.geosolutions.geoserver.rest.decoder.utils.JDOMBuilder;
import it.geosolutions.geoserver.rest.encoder.feature.FeatureTypeAttribute; import it.geosolutions.geoserver.rest.encoder.feature.FeatureTypeAttribute;
import it.geosolutions.geoserver.rest.encoder.feature.GSAttributeEncoder; import it.geosolutions.geoserver.rest.encoder.feature.GSAttributeEncoder;
import it.geosolutions.geoserver.rest.encoder.metadatalink.GSMetadataLinkInfoEncoder;
import java.util.ArrayList; import it.geosolutions.geoserver.rest.encoder.metadatalink.ResourceMetadataLinkInfo;
import java.util.HashMap;
import java.util.List; import java.util.ArrayList;
import java.util.Map; import java.util.HashMap;
import java.util.List;
import org.jdom.Element; import java.util.Map;
import org.jdom.Namespace;
import org.jdom.Element;
/** import org.jdom.Namespace;
* Parse a resource (FeatureType or Coverage) returned as XML REST objects.
* /**
* @author etj * Parse a resource (FeatureType or Coverage) returned as XML REST objects.
*/ *
public class RESTResource { * @author etj
protected final Element rootElem; * @author Emmanuel Blondel - emmanuel.blondel1@gmail.com | emmanuel.blondel@fao.org
*/
public static RESTResource build(String response) { public class RESTResource {
Element elem = JDOMBuilder.buildElement(response); protected final Element rootElem;
return elem == null ? null : new RESTCoverage(elem);
} public static RESTResource build(String response) {
Element elem = JDOMBuilder.buildElement(response);
public RESTResource(Element resource) { return elem == null ? null : new RESTCoverage(elem);
this.rootElem = resource; }
}
public RESTResource(Element resource) {
public String getName() { this.rootElem = resource;
return rootElem.getChildText("name"); }
}
public String getName() {
public String getTitle() { return rootElem.getChildText("name");
return rootElem.getChildText("title"); }
}
public String getTitle() {
public String getNativeName() { return rootElem.getChildText("title");
return rootElem.getChildText("nativeName"); }
}
public String getNativeName() {
public String getAbstract() { return rootElem.getChildText("nativeName");
return rootElem.getChildText("abstract"); }
}
public String getAbstract() {
public String getNameSpace() { return rootElem.getChildText("abstract");
return rootElem.getChild("namespace").getChildText("name"); }
}
public String getNameSpace() {
public String getStoreName() { return rootElem.getChild("namespace").getChildText("name");
return rootElem.getChild("store").getChildText("name"); }
}
public String getStoreName() {
public String getStoreType() { return rootElem.getChild("store").getChildText("name");
return rootElem.getChild("store").getAttributeValue("class"); }
}
public String getStoreType() {
public String getStoreUrl() { return rootElem.getChild("store").getAttributeValue("class");
Element store = rootElem.getChild("store"); }
Element atom = store.getChild("link",
Namespace.getNamespace("atom", "http://www.w3.org/2005/Atom")); public String getStoreUrl() {
return atom.getAttributeValue("href"); Element store = rootElem.getChild("store");
} Element atom = store.getChild("link",
Namespace.getNamespace("atom", "http://www.w3.org/2005/Atom"));
public String getCRS() { return atom.getAttributeValue("href");
Element elBBox = rootElem.getChild("latLonBoundingBox"); }
return elBBox.getChildText("crs");
} public String getCRS() {
Element elBBox = rootElem.getChild("latLonBoundingBox");
protected double getLatLonEdge(String edge) { return elBBox.getChildText("crs");
Element elBBox = rootElem.getChild("latLonBoundingBox"); }
return Double.parseDouble(elBBox.getChildText(edge));
} protected double getLatLonEdge(String edge) {
Element elBBox = rootElem.getChild("latLonBoundingBox");
public double getMinX() { return Double.parseDouble(elBBox.getChildText(edge));
return getLatLonEdge("minx"); }
}
public double getMinX() {
public double getMaxX() { return getLatLonEdge("minx");
return getLatLonEdge("maxx"); }
}
public double getMaxX() {
public double getMinY() { return getLatLonEdge("maxx");
return getLatLonEdge("miny"); }
}
public double getMinY() {
public double getMaxY() { return getLatLonEdge("miny");
return getLatLonEdge("maxy"); }
}
public double getMaxY() {
public List<Map<FeatureTypeAttribute, String>> getAttributeList() { return getLatLonEdge("maxy");
List<Map<FeatureTypeAttribute, String>> attrsList = null; }
final Element attrsRoot = rootElem.getChild("attributes"); public List<Map<FeatureTypeAttribute, String>> getAttributeList() {
final List<Element> attrs = attrsRoot.getChildren(); List<Map<FeatureTypeAttribute, String>> attrsList = null;
if (attrs != null) {
attrsList = new ArrayList<Map<FeatureTypeAttribute, String>>(attrs.size()); final Element attrsRoot = rootElem.getChild("attributes");
for (Element attr : attrs) { final List<Element> attrs = attrsRoot.getChildren();
Map<FeatureTypeAttribute, String> attrsMap = new HashMap<FeatureTypeAttribute, String>(); if (attrs != null) {
attrsList.add(attrsMap); attrsList = new ArrayList<Map<FeatureTypeAttribute, String>>(attrs.size());
for (FeatureTypeAttribute at : FeatureTypeAttribute.values()) { for (Element attr : attrs) {
String key = at.toString(); Map<FeatureTypeAttribute, String> attrsMap = new HashMap<FeatureTypeAttribute, String>();
attrsMap.put(at, attr.getChildText(key)); attrsList.add(attrsMap);
} for (FeatureTypeAttribute at : FeatureTypeAttribute.values()) {
} String key = at.toString();
} attrsMap.put(at, attr.getChildText(key));
return attrsList; }
} }
}
public List<GSAttributeEncoder> getEncodedAttributeList() { return attrsList;
List<GSAttributeEncoder> attrsList = null; }
final Element attrsRoot = rootElem.getChild("attributes"); public List<GSAttributeEncoder> getEncodedAttributeList() {
final List<Element> attrs = attrsRoot.getChildren(); List<GSAttributeEncoder> attrsList = null;
if (attrs != null) {
attrsList = new ArrayList<GSAttributeEncoder>(attrs.size()); final Element attrsRoot = rootElem.getChild("attributes");
for (Element attr : attrs) { final List<Element> attrs = attrsRoot.getChildren();
final GSAttributeEncoder attrEnc = new GSAttributeEncoder(); if (attrs != null) {
for (FeatureTypeAttribute at : FeatureTypeAttribute.values()) { attrsList = new ArrayList<GSAttributeEncoder>(attrs.size());
String key = at.toString(); for (Element attr : attrs) {
attrEnc.setAttribute(at, attr.getChildText(key)); final GSAttributeEncoder attrEnc = new GSAttributeEncoder();
} for (FeatureTypeAttribute at : FeatureTypeAttribute.values()) {
attrsList.add(attrEnc); String key = at.toString();
} attrEnc.setAttribute(at, attr.getChildText(key));
}
} attrsList.add(attrEnc);
return attrsList; }
}
}
// /** return attrsList;
// * @return the list of available attribute names }
// */
// public List<String> getAttributeNames() { /**
// return getAttributes("name"); *
// } * @author Emmanuel Blondel
// *
// /** * @return the list of metadataLinkInfo
// * @return a list of object which are String representation of Classes */
// */ public List<Map<ResourceMetadataLinkInfo, String>> getMetadataLinkInfoList() {
// public List<String> getAttributeBinding() { List<Map<ResourceMetadataLinkInfo, String>> metaLinksList = null;
// return getAttributes("binding");
// } final Element metaLinksRoot = rootElem.getChild("metadataLinks");
final List<Element> metaLinks = metaLinksRoot.getChildren();
// /** if (metaLinks != null) {
// * <attribute><br> metaLinksList = new ArrayList<Map<ResourceMetadataLinkInfo, String>>(metaLinks.size());
// * <name>NATION</name><br> for (Element metaLink : metaLinks) {
// * <minOccurs>0</minOccurs><br> Map<ResourceMetadataLinkInfo, String> metaLinkMap = new HashMap<ResourceMetadataLinkInfo, String>();
// * <maxOccurs>1</maxOccurs><br> metaLinksList.add(metaLinkMap);
// * <nillable>true</nillable><br> for (ResourceMetadataLinkInfo rmd : ResourceMetadataLinkInfo.values()) {
// * <binding>java.lang.Integer</binding><br> String key = rmd.toString();
// * <length>3</length><br> metaLinkMap.put(rmd, metaLink.getChildText(key));
// * </attribute><br> }
// * }
// * @param name }
// * @return return metaLinksList;
// */ }
// private List<String> getAttributes(String name) {
// final Element attrsRoot = rootElem.getChild("attributes");
// final List<Element> attrs = attrsRoot.getChildren(); /**
// List<String> attrNames = null; *
// if (attrs != null) { * @author Emmanuel Blondel
// attrNames = new ArrayList<String>(attrs.size()); *
// for (Element attr : attrs) { * @return the list of GSMetadataLinkEncoder
// attrNames.add(attr.getChildText(name)); */
// } public List<GSMetadataLinkInfoEncoder> getEncodedMetadataLinkInfoList() {
// } List<GSMetadataLinkInfoEncoder> metaLinksList = null;
// return attrNames;
// } final Element metaLinksRoot = rootElem.getChild("metadataLinks");
} final List<Element> metaLinks = metaLinksRoot.getChildren();
if (metaLinks != null) {
metaLinksList = new ArrayList<GSMetadataLinkInfoEncoder>(metaLinks.size());
for (Element metaLink : metaLinks) {
final GSMetadataLinkInfoEncoder metaLinkEnc = new GSMetadataLinkInfoEncoder();
for (ResourceMetadataLinkInfo rmd : ResourceMetadataLinkInfo.values()) {
String key = rmd.toString();
metaLinkEnc.setMetadataLinkInfoMember(rmd, metaLink.getChildText(key)); //change
}
metaLinksList.add(metaLinkEnc);
}
}
return metaLinksList;
}
// /**
// * @return the list of available attribute names
// */
// public List<String> getAttributeNames() {
// return getAttributes("name");
// }
//
// /**
// * @return a list of object which are String representation of Classes
// */
// public List<String> getAttributeBinding() {
// return getAttributes("binding");
// }
// /**
// * <attribute><br>
// * <name>NATION</name><br>
// * <minOccurs>0</minOccurs><br>
// * <maxOccurs>1</maxOccurs><br>
// * <nillable>true</nillable><br>
// * <binding>java.lang.Integer</binding><br>
// * <length>3</length><br>
// * </attribute><br>
// *
// * @param name
// * @return
// */
// private List<String> getAttributes(String name) {
// final Element attrsRoot = rootElem.getChild("attributes");
// final List<Element> attrs = attrsRoot.getChildren();
// List<String> attrNames = null;
// if (attrs != null) {
// attrNames = new ArrayList<String>(attrs.size());
// for (Element attr : attrs) {
// attrNames.add(attr.getChildText(name));
// }
// }
// return attrNames;
// }
}

View File

@ -29,6 +29,7 @@ import it.geosolutions.geoserver.rest.encoder.coverage.GSCoverageEncoder;
import it.geosolutions.geoserver.rest.encoder.feature.GSFeatureTypeEncoder; import it.geosolutions.geoserver.rest.encoder.feature.GSFeatureTypeEncoder;
import it.geosolutions.geoserver.rest.encoder.metadata.GSDimensionInfoEncoder; import it.geosolutions.geoserver.rest.encoder.metadata.GSDimensionInfoEncoder;
import it.geosolutions.geoserver.rest.encoder.metadata.GSFeatureDimensionInfoEncoder; import it.geosolutions.geoserver.rest.encoder.metadata.GSFeatureDimensionInfoEncoder;
import it.geosolutions.geoserver.rest.encoder.metadatalink.GSMetadataLinkInfoEncoder;
import it.geosolutions.geoserver.rest.encoder.utils.ElementUtils; import it.geosolutions.geoserver.rest.encoder.utils.ElementUtils;
import it.geosolutions.geoserver.rest.encoder.utils.NestedElementEncoder; import it.geosolutions.geoserver.rest.encoder.utils.NestedElementEncoder;
import it.geosolutions.geoserver.rest.encoder.utils.PropertyXMLEncoder; import it.geosolutions.geoserver.rest.encoder.utils.PropertyXMLEncoder;
@ -46,15 +47,18 @@ import org.jdom.filter.Filter;
* *
* @author ETj (etj at geo-solutions.it) * @author ETj (etj at geo-solutions.it)
* @author Carlo Cancellieri - carlo.cancellieri@geo-solutions.it * @author Carlo Cancellieri - carlo.cancellieri@geo-solutions.it
* @author Emmanuel Blondel - emmanuel.blondel1@gmail.com | emmanuel.blondel@fao.org
*/ */
public abstract class GSResourceEncoder public abstract class GSResourceEncoder
extends PropertyXMLEncoder { extends PropertyXMLEncoder {
public final static String NAME = "name"; public final static String NAME = "name";
public final static String METADATA="metadata"; public final static String METADATA="metadata";
public final static String KEYWORDS="keywords"; public final static String KEYWORDS="keywords";
public final static String METADATALINKS="metadataLinks";
final private GSMetadataEncoder metadata = new GSMetadataEncoder(); final private GSMetadataEncoder metadata = new GSMetadataEncoder();
final private Element keywordsListEncoder = new Element(KEYWORDS); final private Element keywordsListEncoder = new Element(KEYWORDS);
final private Element metadataLinksListEncoder = new Element(METADATALINKS);
private class GSMetadataEncoder extends NestedElementEncoder{ private class GSMetadataEncoder extends NestedElementEncoder{
public GSMetadataEncoder() { public GSMetadataEncoder() {
@ -75,6 +79,7 @@ public abstract class GSResourceEncoder
// Link members to the parent // Link members to the parent
addContent(metadata.getRoot()); addContent(metadata.getRoot());
addContent(keywordsListEncoder); addContent(keywordsListEncoder);
addContent(metadataLinksListEncoder);
} }
public void setEnabled(boolean enabled) { public void setEnabled(boolean enabled) {
@ -136,6 +141,45 @@ public abstract class GSResourceEncoder
})).size() == 0 ? false : true; })).size() == 0 ? false : true;
} }
/**
* @param MetadataLink the metadataLink to add
*
* @author Emmanuel Blondel
*/
public void addMetadataLinkInfo(GSMetadataLinkInfoEncoder metadataLinkInfo) {
metadataLinksListEncoder.addContent(metadataLinkInfo.getRoot());
}
/** Quick MetadataLinkInfo set-up
*
* @author Emmanuel Blondel
*
* @param type
* @param metadataType
* @param content
*/
public void addMetadataLinkInfo(String type, String metadataType, String content){
final GSMetadataLinkInfoEncoder mde = new GSMetadataLinkInfoEncoder();
mde.setup(type, metadataType, content);
metadataLinksListEncoder.addContent(mde.getRoot());
}
/**
* delete a metadataLinkInfo from the list using the metadataURL (MetadataLinkInfo content)
*
* @author Emmanuel Blondel
*
* @param metadataURL
* @return true if something is removed, false otherwise
*/
public boolean delMetadataLinkInfo(final String metadataURL) {
return (metadataLinksListEncoder.removeContent(GSMetadataLinkInfoEncoder.getFilterByContent(metadataURL))).size() == 0 ? false
: true;
}
/** /**
* Reprojection policy for a published layer. One of: * Reprojection policy for a published layer. One of:
* <ul> * <ul>

View File

@ -0,0 +1,107 @@
/*
* GeoServer-Manager - Simple Manager Library for GeoServer
*
* Copyright (C) 2007,2011 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.metadatalink;
import java.util.Map;
import java.util.Map.Entry;
import org.jdom.Element;
import org.jdom.filter.Filter;
import it.geosolutions.geoserver.rest.encoder.utils.ElementUtils;
import it.geosolutions.geoserver.rest.encoder.utils.PropertyXMLEncoder;
/** GSMetadataLinkEncoder
*
* @author Emmanuel Blondel - emmanuel.blondel1@gmail.com | emmanuel.blondel@fao.org
*
*/
public class GSMetadataLinkInfoEncoder extends PropertyXMLEncoder {
public static class filterByContent implements Filter {
final private String key;
public filterByContent(String content){
this.key=content;
}
private static final long serialVersionUID = 1L;
public boolean matches(Object obj) {
Element el=((Element) obj).getChild(ResourceMetadataLinkInfo.content.toString());
if (el!=null && el.getTextTrim().equals(key)) {
return true;
}
return false;
}
}
public static Filter getFilterByContent(String content){
return new filterByContent(content);
}
public GSMetadataLinkInfoEncoder() {
super("metadataLink");
}
/** quick MetadataLinkInfo set-up
*
* @param type
* @param metadataType
* @param content
*/
public void setup(String type, String metadataType, String content){
set(ResourceMetadataLinkInfo.type.name(), type);
set(ResourceMetadataLinkInfo.metadataType.name(), metadataType);
set(ResourceMetadataLinkInfo.content.name(), content);
}
public void setup(Map<ResourceMetadataLinkInfo, String> metadataLinkInfos){
for (Entry<ResourceMetadataLinkInfo,String> mdLinkInfo:metadataLinkInfos.entrySet()){
set(mdLinkInfo.getKey().toString(),mdLinkInfo.getValue());
}
}
public void setMetadataLinkInfoMember(ResourceMetadataLinkInfo type, String value){
set(type.toString(),value);
}
public boolean delMetadataLinkInfoMember(ResourceMetadataLinkInfo type){
return ElementUtils.remove(this.getRoot(), get(type.toString()));
}
public String getMetadataLinkInfoMember(ResourceMetadataLinkInfo type){
Element el = get(type.toString());
if (el!=null)
return el.getTextTrim();
else
return null;
}
}

View File

@ -0,0 +1,36 @@
/*
* GeoServer-Manager - Simple Manager Library for GeoServer
*
* Copyright (C) 2007,2011 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.metadatalink;
/**
* Enumeration of featureType metadataLink member
*
* @author Emmanuel Blondel - emmanuel.blondel1@gmail.com | emmanuel.blondel@fao.org
*
*/
public enum ResourceMetadataLinkInfo {
type, metadataType, content
}

View File

@ -1,74 +1,92 @@
/* /*
* GeoBatch - Open Source geospatial batch processing system * GeoBatch - Open Source geospatial batch processing system
* https://github.com/nfms4redd/nfms-geobatch * https://github.com/nfms4redd/nfms-geobatch
* Copyright (C) 2007-2012 GeoSolutions S.A.S. * Copyright (C) 2007-2012 GeoSolutions S.A.S.
* http://www.geo-solutions.it * http://www.geo-solutions.it
* *
* GPLv3 + Classpath exception * GPLv3 + Classpath exception
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
package it.geosolutions.geoserver.decoder; package it.geosolutions.geoserver.decoder;
import it.geosolutions.geoserver.rest.decoder.RESTCoverage; import it.geosolutions.geoserver.rest.decoder.RESTCoverage;
import it.geosolutions.geoserver.rest.decoder.RESTDimensionInfo; import it.geosolutions.geoserver.rest.decoder.RESTDimensionInfo;
import it.geosolutions.geoserver.rest.encoder.metadatalink.GSMetadataLinkInfoEncoder;
import java.io.File; import it.geosolutions.geoserver.rest.encoder.metadatalink.ResourceMetadataLinkInfo;
import java.io.IOException;
import java.util.List; import java.io.File;
import java.io.IOException;
import org.apache.commons.io.FileUtils; import java.util.List;
import org.junit.Assert;
import org.junit.Test; import org.apache.commons.io.FileUtils;
import org.springframework.core.io.ClassPathResource; import org.junit.Assert;
import org.junit.Test;
/** import org.springframework.core.io.ClassPathResource;
* @author DamianoG
* /**
*/ * @author DamianoG
public class MetadataDecoderTest { * @author eblondel
*
*/
@Test public class MetadataDecoderTest {
public void testMetadataDimensionInfo() throws IOException {
File coverageFile = new ClassPathResource("testdata/coverageExample.xml").getFile(); @Test
String coverageString = FileUtils.readFileToString(coverageFile); public void testMetadataDimensionInfo() throws IOException {
RESTCoverage coverage = RESTCoverage.build(coverageString);
List<RESTDimensionInfo> list = coverage.getDimensionInfo(); File coverageFile = new ClassPathResource("testdata/coverageExample.xml").getFile();
String coverageString = FileUtils.readFileToString(coverageFile);
Assert.assertEquals(list.size(),2); RESTCoverage coverage = RESTCoverage.build(coverageString);
List<RESTDimensionInfo> list = coverage.getDimensionInfo();
for (RESTDimensionInfo el : list){ Assert.assertEquals(list.size(),2);
if(el.getKey().equals("time")){
Assert.assertEquals(el.getResolution(),null);
Assert.assertEquals(el.getPresentation(),"LIST"); for (RESTDimensionInfo el : list){
Assert.assertEquals(el.getKey(),"time"); if(el.getKey().equals("time")){
Assert.assertEquals(el.isEnabled(),true); Assert.assertEquals(el.getResolution(),null);
} Assert.assertEquals(el.getPresentation(),"LIST");
if(el.getKey().equals("elevation")){ Assert.assertEquals(el.getKey(),"time");
Assert.assertEquals(el.getResolution(),"2"); Assert.assertEquals(el.isEnabled(),true);
Assert.assertEquals(el.getPresentation(),"DISCRETE_INTERVAL"); }
Assert.assertEquals(el.getKey(),"elevation"); if(el.getKey().equals("elevation")){
Assert.assertEquals(el.isEnabled(),true); Assert.assertEquals(el.getResolution(),"2");
} Assert.assertEquals(el.getPresentation(),"DISCRETE_INTERVAL");
} Assert.assertEquals(el.getKey(),"elevation");
Assert.assertEquals(el.isEnabled(),true);
}
}
}
} @Test
} public void testMetadataLinkInfo() throws IOException{
File coverageFile = new ClassPathResource("testdata/coverageExample.xml").getFile();
String coverageString = FileUtils.readFileToString(coverageFile);
RESTCoverage coverage = RESTCoverage.build(coverageString);
List<GSMetadataLinkInfoEncoder> list = coverage.getEncodedMetadataLinkInfoList();
GSMetadataLinkInfoEncoder metadataLinkInfo1 = list.get(0);
Assert.assertEquals(metadataLinkInfo1.getMetadataLinkInfoMember(ResourceMetadataLinkInfo.type),"text/xml");
Assert.assertEquals(metadataLinkInfo1.getMetadataLinkInfoMember(ResourceMetadataLinkInfo.metadataType),"ISO19115:2003");
Assert.assertEquals(metadataLinkInfo1.getMetadataLinkInfoMember(ResourceMetadataLinkInfo.content),"http://www.organization.org/metadata1");
GSMetadataLinkInfoEncoder metadataLinkInfo2 = list.get(1);
Assert.assertEquals(metadataLinkInfo2.getMetadataLinkInfoMember(ResourceMetadataLinkInfo.type),"text/html");
Assert.assertEquals(metadataLinkInfo2.getMetadataLinkInfoMember(ResourceMetadataLinkInfo.metadataType),"ISO19115:2003");
Assert.assertEquals(metadataLinkInfo2.getMetadataLinkInfoMember(ResourceMetadataLinkInfo.content),"http://www.organization.org/metadata2");
}
}

View File

@ -1,217 +1,231 @@
/* /*
* Copyright (C) 2007 - 2011 GeoSolutions S.A.S. * Copyright (C) 2007 - 2011 GeoSolutions S.A.S.
* http://www.geo-solutions.it * http://www.geo-solutions.it
* *
* GPLv3 + Classpath exception * GPLv3 + Classpath exception
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
package it.geosolutions.geoserver.rest.encoder.feature; package it.geosolutions.geoserver.rest.encoder.feature;
import it.geosolutions.geoserver.rest.GeoServerRESTPublisher; import it.geosolutions.geoserver.rest.GeoServerRESTPublisher;
import it.geosolutions.geoserver.rest.decoder.RESTLayer; import it.geosolutions.geoserver.rest.decoder.RESTLayer;
import it.geosolutions.geoserver.rest.decoder.RESTResource; import it.geosolutions.geoserver.rest.decoder.RESTResource;
import it.geosolutions.geoserver.rest.encoder.GSLayerEncoder; import it.geosolutions.geoserver.rest.encoder.GSLayerEncoder;
import it.geosolutions.geoserver.rest.encoder.GSResourceEncoder; import it.geosolutions.geoserver.rest.encoder.GSResourceEncoder;
import it.geosolutions.geoserver.rest.encoder.metadata.GSDimensionInfoEncoder; import it.geosolutions.geoserver.rest.encoder.metadata.GSDimensionInfoEncoder;
import it.geosolutions.geoserver.rest.encoder.metadata.GSDimensionInfoEncoder.Presentation; import it.geosolutions.geoserver.rest.encoder.metadata.GSDimensionInfoEncoder.Presentation;
import it.geosolutions.geoserver.rest.encoder.metadata.GSDimensionInfoEncoder.PresentationDiscrete; import it.geosolutions.geoserver.rest.encoder.metadata.GSDimensionInfoEncoder.PresentationDiscrete;
import it.geosolutions.geoserver.rest.encoder.metadata.GSFeatureDimensionInfoEncoder; import it.geosolutions.geoserver.rest.encoder.metadata.GSFeatureDimensionInfoEncoder;
import it.geosolutions.geoserver.rest.encoder.utils.ElementUtils; import it.geosolutions.geoserver.rest.encoder.metadatalink.GSMetadataLinkInfoEncoder;
import it.geosolutions.geoserver.rest.publisher.GeoserverRESTPublisherTest; import it.geosolutions.geoserver.rest.encoder.utils.ElementUtils;
import it.geosolutions.geoserver.rest.publisher.GeoserverRESTPublisherTest;
import java.io.File;
import java.io.IOException; import java.io.File;
import java.math.BigDecimal; import java.io.IOException;
import java.util.List; import java.math.BigDecimal;
import java.util.List;
import org.jdom.Element;
import org.junit.Assert; import org.jdom.Element;
import org.junit.Test; import org.junit.Assert;
import org.slf4j.Logger; import org.junit.Test;
import org.slf4j.LoggerFactory; import org.slf4j.Logger;
import org.springframework.core.io.ClassPathResource; import org.slf4j.LoggerFactory;
import org.springframework.core.io.ClassPathResource;
/**
* /**
* @author ETj (etj at geo-solutions.it) *
* @author Carlo Cancellieri - carlo.cancellieri@geo-solutions.it * @author ETj (etj at geo-solutions.it)
*/ * @author Carlo Cancellieri - carlo.cancellieri@geo-solutions.it
public class GSFeatureEncoderTest extends GeoserverRESTPublisherTest { */
protected final static Logger LOGGER = LoggerFactory.getLogger(GSFeatureEncoderTest.class); public class GSFeatureEncoderTest extends GeoserverRESTPublisherTest {
protected final static Logger LOGGER = LoggerFactory.getLogger(GSFeatureEncoderTest.class);
@Test
public void testIntegration() throws IOException { @Test
public void testIntegration() throws IOException {
if (!enabled())
return; if (!enabled())
deleteAll(); return;
deleteAll();
GeoServerRESTPublisher publisher = new GeoServerRESTPublisher(RESTURL, RESTUSER, RESTPW);
GeoServerRESTPublisher publisher = new GeoServerRESTPublisher(RESTURL, RESTUSER, RESTPW);
String storeName = "resttestshp";
String layerName = "cities"; String storeName = "resttestshp";
String layerName = "cities";
GSFeatureTypeEncoder fte = new GSFeatureTypeEncoder();
fte.setName(layerName + "_NEW"); GSFeatureTypeEncoder fte = new GSFeatureTypeEncoder();
fte.setTitle("title"); fte.setName(layerName + "_NEW");
// fte.addKeyword("TODO"); fte.setTitle("title");
fte.setNativeCRS("EPSG:4326"); // fte.addKeyword("TODO");
fte.setDescription("desc"); fte.setNativeCRS("EPSG:4326");
fte.setEnabled(true); fte.setDescription("desc");
fte.setEnabled(true);
GSLayerEncoder layerEncoder = new GSLayerEncoder();
layerEncoder.setEnabled(true); //metadataLink
layerEncoder.setQueryable(true); GSMetadataLinkInfoEncoder metadatalink = new GSMetadataLinkInfoEncoder();
metadatalink.setup("text/xml", "ISO19115:2003","http://www.organization.org/metadata1");
layerEncoder.setDefaultStyle("point"); fte.addMetadataLinkInfo(metadatalink);
publisher.createWorkspace(DEFAULT_WS); GSLayerEncoder layerEncoder = new GSLayerEncoder();
layerEncoder.setEnabled(true);
File zipFile = new ClassPathResource("testdata/resttestshp.zip").getFile(); layerEncoder.setQueryable(true);
// test insert layerEncoder.setDefaultStyle("point");
boolean published = publisher.publishShp(DEFAULT_WS, storeName, layerName, zipFile);
assertTrue("publish() failed", published); publisher.createWorkspace(DEFAULT_WS);
assertTrue(existsLayer(layerName));
File zipFile = new ClassPathResource("testdata/resttestshp.zip").getFile();
publisher.publishStyle(new File(new ClassPathResource("testdata").getFile(),
"default_point.sld")); // test insert
boolean published = publisher.publishShp(DEFAULT_WS, storeName, layerName, zipFile);
// optionally select the attributes to publish assertTrue("publish() failed", published);
RESTLayer layer = reader.getLayer(layerName); assertTrue(existsLayer(layerName));
RESTResource resource = reader.getResource(layer);
List<GSAttributeEncoder> attrs = resource.getEncodedAttributeList(); publisher.publishStyle(new File(new ClassPathResource("testdata").getFile(),
assertNotNull(attrs); "default_point.sld"));
for (GSAttributeEncoder enc : attrs) {
fte.setAttribute(enc); // optionally select the attributes to publish
} RESTLayer layer = reader.getLayer(layerName);
RESTResource resource = reader.getResource(layer);
assertTrue(publisher.publishDBLayer(DEFAULT_WS, storeName, fte, layerEncoder)); List<GSAttributeEncoder> attrs = resource.getEncodedAttributeList();
} assertNotNull(attrs);
for (GSAttributeEncoder enc : attrs) {
@Test fte.setAttribute(enc);
public void testFeatureTypeEncoder() { }
GSFeatureTypeEncoder encoder = new GSFeatureTypeEncoder(); assertTrue(publisher.publishDBLayer(DEFAULT_WS, storeName, fte, layerEncoder));
encoder.addKeyword("KEYWORD_1"); }
encoder.addKeyword("KEYWORD_2");
encoder.addKeyword("..."); @Test
encoder.addKeyword("KEYWORD_N"); public void testFeatureTypeEncoder() {
encoder.setName("Layername"); GSFeatureTypeEncoder encoder = new GSFeatureTypeEncoder();
encoder.addKeyword("KEYWORD_1");
encoder.setTitle("title"); encoder.addKeyword("KEYWORD_2");
encoder.addKeyword("TODO"); encoder.addKeyword("...");
encoder.setNativeCRS("EPSG:4326"); encoder.addKeyword("KEYWORD_N");
encoder.setDescription("desc");
encoder.setEnabled(true); encoder.setName("Layername");
GSAttributeEncoder attribute = new GSAttributeEncoder(); encoder.setTitle("title");
attribute.setAttribute(FeatureTypeAttribute.name, "NAME"); encoder.addKeyword("TODO");
attribute.setAttribute(FeatureTypeAttribute.binding, "java.lang.String"); encoder.setNativeCRS("EPSG:4326");
attribute.setAttribute(FeatureTypeAttribute.maxOccurs, "1"); encoder.setDescription("desc");
attribute.setAttribute(FeatureTypeAttribute.minOccurs, "0"); encoder.setEnabled(true);
attribute.setAttribute(FeatureTypeAttribute.nillable, "true");
GSAttributeEncoder attribute = new GSAttributeEncoder();
encoder.setAttribute(attribute); attribute.setAttribute(FeatureTypeAttribute.name, "NAME");
attribute.setAttribute(FeatureTypeAttribute.binding, "java.lang.String");
encoder.delAttribute("NAME"); attribute.setAttribute(FeatureTypeAttribute.maxOccurs, "1");
attribute.setAttribute(FeatureTypeAttribute.minOccurs, "0");
attribute.setAttribute(FeatureTypeAttribute.name, "NEW_NAME"); attribute.setAttribute(FeatureTypeAttribute.nillable, "true");
encoder.setAttribute(attribute); encoder.setAttribute(attribute);
// TODO encoder.getAttribute("NAME"); encoder.delAttribute("NAME");
GSFeatureDimensionInfoEncoder dim2 = new GSFeatureDimensionInfoEncoder("ELE"); attribute.setAttribute(FeatureTypeAttribute.name, "NEW_NAME");
encoder.addMetadata("elevation", dim2); encoder.setAttribute(attribute);
dim2.setPresentation(PresentationDiscrete.DISCRETE_INTERVAL, BigDecimal.valueOf(10));
Element el = ElementUtils.contains(encoder.getRoot(), GSDimensionInfoEncoder.PRESENTATION); // TODO encoder.getAttribute("NAME");
Assert.assertNotNull(el);
GSFeatureDimensionInfoEncoder dim2 = new GSFeatureDimensionInfoEncoder("ELE");
LOGGER.info("contains_key:" + el.toString());
encoder.addMetadata("elevation", dim2);
dim2.setPresentation(PresentationDiscrete.DISCRETE_INTERVAL, BigDecimal.valueOf(12)); dim2.setPresentation(PresentationDiscrete.DISCRETE_INTERVAL, BigDecimal.valueOf(10));
el = ElementUtils.contains(encoder.getRoot(), GSDimensionInfoEncoder.RESOLUTION); Element el = ElementUtils.contains(encoder.getRoot(), GSDimensionInfoEncoder.PRESENTATION);
Assert.assertNotNull(el); Assert.assertNotNull(el);
Assert.assertEquals("12", el.getText());
LOGGER.info("contains_key:" + el.toString());
dim2.setPresentation(Presentation.CONTINUOUS_INTERVAL);
dim2.setPresentation(PresentationDiscrete.DISCRETE_INTERVAL, BigDecimal.valueOf(12));
encoder.setMetadata("time", new GSFeatureDimensionInfoEncoder("time")); el = ElementUtils.contains(encoder.getRoot(), GSDimensionInfoEncoder.RESOLUTION);
el = ElementUtils.contains(encoder.getRoot(), GSDimensionInfoEncoder.PRESENTATION); Assert.assertNotNull(el);
Assert.assertNotNull(el); Assert.assertEquals("12", el.getText());
el = ElementUtils.contains(encoder.getRoot(), GSDimensionInfoEncoder.RESOLUTION);
Assert.assertNull(el); dim2.setPresentation(Presentation.CONTINUOUS_INTERVAL);
el = ElementUtils.contains(encoder.getRoot(), GSResourceEncoder.METADATA); encoder.setMetadata("time", new GSFeatureDimensionInfoEncoder("time"));
Assert.assertNotNull(el); el = ElementUtils.contains(encoder.getRoot(), GSDimensionInfoEncoder.PRESENTATION);
LOGGER.info("contains_key:" + el.toString()); Assert.assertNotNull(el);
el = ElementUtils.contains(encoder.getRoot(), GSDimensionInfoEncoder.RESOLUTION);
final boolean removed = ElementUtils.remove(encoder.getRoot(), el); Assert.assertNull(el);
LOGGER.info("remove:" + removed);
Assert.assertTrue(removed); el = ElementUtils.contains(encoder.getRoot(), GSResourceEncoder.METADATA);
Assert.assertNotNull(el);
el = ElementUtils.contains(encoder.getRoot(), "metadata"); LOGGER.info("contains_key:" + el.toString());
Assert.assertNull(el);
if (el == null) final boolean removed = ElementUtils.remove(encoder.getRoot(), el);
LOGGER.info("REMOVED"); LOGGER.info("remove:" + removed);
Assert.assertTrue(removed);
if (LOGGER.isInfoEnabled())
LOGGER.info(encoder.toString()); el = ElementUtils.contains(encoder.getRoot(), "metadata");
Assert.assertNull(el);
assertEquals(encoder.getName(),"Layername"); if (el == null)
} LOGGER.info("REMOVED");
@Test if (LOGGER.isInfoEnabled())
public void testModifyFeature() { LOGGER.info(encoder.toString());
GSFeatureTypeEncoder encoder = new GSFeatureTypeEncoder();
encoder.addKeyword("KEYWORD_1"); assertEquals(encoder.getName(),"Layername");
encoder.addKeyword("KEYWORD_2"); }
encoder.addKeyword("...");
encoder.addKeyword("KEYWORD_N"); @Test
public void testModifyFeature() {
Assert.assertTrue(encoder.delKeyword("KEYWORD_2")); GSFeatureTypeEncoder encoder = new GSFeatureTypeEncoder();
Assert.assertFalse(encoder.delKeyword("KEYWORD_M")); encoder.addKeyword("KEYWORD_1");
encoder.addKeyword("KEYWORD_2");
final GSFeatureDimensionInfoEncoder elevationDimension = new GSFeatureDimensionInfoEncoder( encoder.addKeyword("...");
"elevation_field"); encoder.addKeyword("KEYWORD_N");
// if (LOGGER.isInfoEnabled()) Assert.assertTrue(encoder.delKeyword("KEYWORD_2"));
// LOGGER.info(encoder.toString()); Assert.assertFalse(encoder.delKeyword("KEYWORD_M"));
final String metadata = "elevation"; //metadataLinkInfo
encoder.setMetadata(metadata, elevationDimension); encoder.addMetadataLinkInfo("text/xml", "ISO19115:2003","http://www.organization.org/metadata1");
encoder.addMetadataLinkInfo("text/html", "ISO19115:2003","http://www.organization.org/metadata2");
elevationDimension.setPresentation(PresentationDiscrete.DISCRETE_INTERVAL,
BigDecimal.valueOf(10)); Assert.assertTrue(encoder.delMetadataLinkInfo("http://www.organization.org/metadata2"));
Assert.assertFalse(encoder.delMetadataLinkInfo("http://www.organization.org/metadata3"));
if (LOGGER.isInfoEnabled())
LOGGER.info(encoder.toString()); //dimensions
final GSFeatureDimensionInfoEncoder elevationDimension = new GSFeatureDimensionInfoEncoder(
Assert.assertTrue(encoder.delMetadata(metadata)); "elevation_field");
if (LOGGER.isInfoEnabled()) // if (LOGGER.isInfoEnabled())
LOGGER.info(encoder.toString()); // LOGGER.info(encoder.toString());
final Element el = ElementUtils.contains(encoder.getRoot(), final String metadata = "elevation";
GSDimensionInfoEncoder.DIMENSIONINFO); encoder.setMetadata(metadata, elevationDimension);
Assert.assertNull(el);
if (el == null) elevationDimension.setPresentation(PresentationDiscrete.DISCRETE_INTERVAL,
LOGGER.info("REMOVED"); BigDecimal.valueOf(10));
} if (LOGGER.isInfoEnabled())
} LOGGER.info(encoder.toString());
Assert.assertTrue(encoder.delMetadata(metadata));
if (LOGGER.isInfoEnabled())
LOGGER.info(encoder.toString());
final Element el = ElementUtils.contains(encoder.getRoot(),
GSDimensionInfoEncoder.DIMENSIONINFO);
Assert.assertNull(el);
if (el == null)
LOGGER.info("REMOVED");
}
}

View File

@ -0,0 +1,53 @@
/*
* Copyright (C) 2007 - 2011 GeoSolutions S.A.S.
* http://www.geo-solutions.it
*
* GPLv3 + Classpath exception
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package it.geosolutions.geoserver.rest.encoder.metadatalink;
import junit.framework.Assert;
import org.junit.Test;
/**
*
* @author eblondel
*
*/
public class GSMetadataLinkInfoEncoderTest {
@Test
public void metadataLinkInfoTest(){
GSMetadataLinkInfoEncoder encoder = new GSMetadataLinkInfoEncoder();
encoder.setup("text/xml", "ISO19115:2003","http://www.organization.org/metadata1");
Assert.assertEquals("text/xml", encoder.getMetadataLinkInfoMember(ResourceMetadataLinkInfo.type));
Assert.assertEquals("ISO19115:2003", encoder.getMetadataLinkInfoMember(ResourceMetadataLinkInfo.metadataType));
Assert.assertEquals("http://www.organization.org/metadata1", encoder.getMetadataLinkInfoMember(ResourceMetadataLinkInfo.content));
Assert.assertTrue(encoder.delMetadataLinkInfoMember(ResourceMetadataLinkInfo.content));
Assert.assertNull(encoder.getMetadataLinkInfoMember(ResourceMetadataLinkInfo.content));
encoder.setMetadataLinkInfoMember(ResourceMetadataLinkInfo.type, "text/html");
encoder.setMetadataLinkInfoMember(ResourceMetadataLinkInfo.metadataType, "FGDC");
encoder.setMetadataLinkInfoMember(ResourceMetadataLinkInfo.content, "http://www.organization.org/metadata2");
Assert.assertEquals("text/html", encoder.getMetadataLinkInfoMember(ResourceMetadataLinkInfo.type));
Assert.assertEquals("FGDC", encoder.getMetadataLinkInfoMember(ResourceMetadataLinkInfo.metadataType));
Assert.assertEquals("http://www.organization.org/metadata2", encoder.getMetadataLinkInfoMember(ResourceMetadataLinkInfo.content));
}
}

View File

@ -1,97 +1,109 @@
<coverage> <coverage>
<name>granuleTestMosaic</name> <name>granuleTestMosaic</name>
<nativeName>granuleTestMosaic</nativeName> <nativeName>granuleTestMosaic</nativeName>
<namespace> <namespace>
<name>topp</name> <name>topp</name>
<atom:link xmlns:atom="http://www.w3.org/2005/Atom" rel="alternate" href="http://localhost:8080/geoserver/rest/namespaces/topp.xml" type="application/xml"/> <atom:link xmlns:atom="http://www.w3.org/2005/Atom" rel="alternate" href="http://localhost:8080/geoserver/rest/namespaces/topp.xml" type="application/xml"/>
</namespace> </namespace>
<title>granuleTestMosaic</title> <title>granuleTestMosaic</title>
<nativeCRS>GEOGCS[&quot;WGS 84&quot;, &#xd; <metadataLinks>
DATUM[&quot;World Geodetic System 1984&quot;, &#xd; <metadataLink>
SPHEROID[&quot;WGS 84&quot;, 6378137.0, 298.257223563, AUTHORITY[&quot;EPSG&quot;,&quot;7030&quot;]], &#xd; <type>text/xml</type>
AUTHORITY[&quot;EPSG&quot;,&quot;6326&quot;]], &#xd; <metadataType>ISO19115:2003</metadataType>
PRIMEM[&quot;Greenwich&quot;, 0.0, AUTHORITY[&quot;EPSG&quot;,&quot;8901&quot;]], &#xd; <content>http://www.organization.org/metadata1</content>
UNIT[&quot;degree&quot;, 0.017453292519943295], &#xd; </metadataLink>
AXIS[&quot;Geodetic longitude&quot;, EAST], &#xd; <metadataLink>
AXIS[&quot;Geodetic latitude&quot;, NORTH], &#xd; <type>text/html</type>
AUTHORITY[&quot;EPSG&quot;,&quot;4326&quot;]]</nativeCRS> <metadataType>ISO19115:2003</metadataType>
<srs>EPSG:4326</srs> <content>http://www.organization.org/metadata2</content>
<nativeBoundingBox> </metadataLink>
<minx>-180.0</minx> </metadataLinks>
<maxx>180.0</maxx> <nativeCRS>GEOGCS[&quot;WGS 84&quot;, &#xd;
<miny>-90.0</miny> DATUM[&quot;World Geodetic System 1984&quot;, &#xd;
<maxy>90.0</maxy> SPHEROID[&quot;WGS 84&quot;, 6378137.0, 298.257223563, AUTHORITY[&quot;EPSG&quot;,&quot;7030&quot;]], &#xd;
<crs>EPSG:4326</crs> AUTHORITY[&quot;EPSG&quot;,&quot;6326&quot;]], &#xd;
</nativeBoundingBox> PRIMEM[&quot;Greenwich&quot;, 0.0, AUTHORITY[&quot;EPSG&quot;,&quot;8901&quot;]], &#xd;
<latLonBoundingBox> UNIT[&quot;degree&quot;, 0.017453292519943295], &#xd;
<minx>-180.0</minx> AXIS[&quot;Geodetic longitude&quot;, EAST], &#xd;
<maxx>180.0</maxx> AXIS[&quot;Geodetic latitude&quot;, NORTH], &#xd;
<miny>-90.0</miny> AUTHORITY[&quot;EPSG&quot;,&quot;4326&quot;]]</nativeCRS>
<maxy>90.0</maxy> <srs>EPSG:4326</srs>
<crs>EPSG:4326</crs> <nativeBoundingBox>
</latLonBoundingBox> <minx>-180.0</minx>
<projectionPolicy>NONE</projectionPolicy> <maxx>180.0</maxx>
<enabled>true</enabled> <miny>-90.0</miny>
<advertised>true</advertised> <maxy>90.0</maxy>
<metadata> <crs>EPSG:4326</crs>
<entry key="time"> </nativeBoundingBox>
<dimensionInfo> <latLonBoundingBox>
<enabled>true</enabled> <minx>-180.0</minx>
<presentation>LIST</presentation> <maxx>180.0</maxx>
</dimensionInfo> <miny>-90.0</miny>
</entry> <maxy>90.0</maxy>
<entry key="elevation"> <crs>EPSG:4326</crs>
<dimensionInfo> </latLonBoundingBox>
<enabled>true</enabled> <projectionPolicy>NONE</projectionPolicy>
<presentation>DISCRETE_INTERVAL</presentation> <enabled>true</enabled>
<resolution>2</resolution> <advertised>true</advertised>
</dimensionInfo> <metadata>
</entry> <entry key="time">
</metadata> <dimensionInfo>
<store class="coverageStore"> <enabled>true</enabled>
<name>granuleTestMosaic</name> <presentation>LIST</presentation>
<atom:link xmlns:atom="http://www.w3.org/2005/Atom" rel="alternate" href="http://localhost:8080/geoserver/rest/workspaces/topp/coveragestores/granuleTestMosaic.xml" type="application/xml"/> </dimensionInfo>
</store> </entry>
<grid dimension="2"> <entry key="elevation">
<range> <dimensionInfo>
<low>0 0</low> <enabled>true</enabled>
<high>540 270</high> <presentation>DISCRETE_INTERVAL</presentation>
</range> <resolution>2</resolution>
<transform> </dimensionInfo>
<scaleX>0.6666666666666666</scaleX> </entry>
<scaleY>-0.6666666666666666</scaleY> </metadata>
<shearX>0.0</shearX> <store class="coverageStore">
<shearY>0.0</shearY> <name>granuleTestMosaic</name>
<translateX>-179.66666666666666</translateX> <atom:link xmlns:atom="http://www.w3.org/2005/Atom" rel="alternate" href="http://localhost:8080/geoserver/rest/workspaces/topp/coveragestores/granuleTestMosaic.xml" type="application/xml"/>
<translateY>89.66666666666667</translateY> </store>
</transform> <grid dimension="2">
<crs>EPSG:4326</crs> <range>
</grid> <low>0 0</low>
<parameters> <high>540 270</high>
<entry> </range>
<string>AllowMultithreading</string> <transform>
<string>false</string> <scaleX>0.6666666666666666</scaleX>
</entry> <scaleY>-0.6666666666666666</scaleY>
<entry> <shearX>0.0</shearX>
<string>MaxAllowedTiles</string> <shearY>0.0</shearY>
<string>2147483647</string> <translateX>-179.66666666666666</translateX>
</entry> <translateY>89.66666666666667</translateY>
<entry> </transform>
<string>InputTransparentColor</string> <crs>EPSG:4326</crs>
<string></string> </grid>
</entry> <parameters>
<entry> <entry>
<string>SUGGESTED_TILE_SIZE</string> <string>AllowMultithreading</string>
<string>256,256</string> <string>false</string>
</entry> </entry>
<entry> <entry>
<string>USE_JAI_IMAGEREAD</string> <string>MaxAllowedTiles</string>
<string>false</string> <string>2147483647</string>
</entry> </entry>
<entry> <entry>
<string>BackgroundValues</string> <string>InputTransparentColor</string>
<string>-1.0</string> <string></string>
</entry> </entry>
</parameters> <entry>
<string>SUGGESTED_TILE_SIZE</string>
<string>256,256</string>
</entry>
<entry>
<string>USE_JAI_IMAGEREAD</string>
<string>false</string>
</entry>
<entry>
<string>BackgroundValues</string>
<string>-1.0</string>
</entry>
</parameters>
</coverage> </coverage>