Some changes to add metadataLinks. Switched to 1.3-SNAPSHOT version.
This commit is contained in:
parent
e9aab4f744
commit
2b74af5b7b
2
pom.xml
2
pom.xml
@ -31,7 +31,7 @@
|
||||
|
||||
<groupId>it.geosolutions</groupId>
|
||||
<artifactId>geoserver-manager</artifactId>
|
||||
<version>1.2-SNAPSHOT</version>
|
||||
<version>1.3-SNAPSHOT</version>
|
||||
|
||||
<packaging>jar</packaging>
|
||||
|
||||
|
||||
@ -602,6 +602,7 @@ public class GeoServerRESTPublisher {
|
||||
public RESTCoverageStore createExternaMosaicDatastore(String workspace,
|
||||
String storeName, File mosaicDir, ParameterConfigure configure,
|
||||
ParameterUpdate update) throws FileNotFoundException {
|
||||
|
||||
/*
|
||||
* Carlo (23 Nov 2011):
|
||||
* commented out since this directory should be readable by targhet GeoServer
|
||||
|
||||
@ -26,11 +26,12 @@
|
||||
package it.geosolutions.geoserver.rest.encoder;
|
||||
|
||||
import it.geosolutions.geoserver.rest.encoder.coverage.GSCoverageEncoder;
|
||||
import it.geosolutions.geoserver.rest.encoder.feature.GSFeatureDimensionInfoEncoder;
|
||||
import it.geosolutions.geoserver.rest.encoder.feature.GSFeatureTypeEncoder;
|
||||
import it.geosolutions.geoserver.rest.encoder.metadata.GSDimensionInfoEncoder;
|
||||
import it.geosolutions.geoserver.rest.encoder.metadata.GSMetadataEncoder;
|
||||
import it.geosolutions.geoserver.rest.encoder.metadata.GSFeatureDimensionInfoEncoder;
|
||||
import it.geosolutions.geoserver.rest.encoder.utils.NestedElementEncoder;
|
||||
import it.geosolutions.geoserver.rest.encoder.utils.PropertyXMLEncoder;
|
||||
import it.geosolutions.geoserver.rest.encoder.utils.XmlElement;
|
||||
|
||||
import org.jdom.Element;
|
||||
import org.jdom.filter.Filter;
|
||||
@ -46,12 +47,20 @@ import org.jdom.filter.Filter;
|
||||
* @author ETj (etj at geo-solutions.it)
|
||||
* @author Carlo Cancellieri - carlo.cancellieri@geo-solutions.it
|
||||
*/
|
||||
public abstract class GSResourceEncoder<T extends GSDimensionInfoEncoder>
|
||||
public abstract class GSResourceEncoder
|
||||
extends PropertyXMLEncoder {
|
||||
private final static String NAME = "name";
|
||||
public final static String NAME = "name";
|
||||
public final static String METADATA="metadata";
|
||||
public final static String KEYWORDS="keywords";
|
||||
|
||||
final private GSMetadataEncoder<T> metadata = new GSMetadataEncoder<T>();
|
||||
final private Element keywordsListEncoder = new Element("keywords");
|
||||
final private GSMetadataEncoder metadata = new GSMetadataEncoder();
|
||||
final private Element keywordsListEncoder = new Element(KEYWORDS);
|
||||
|
||||
private class GSMetadataEncoder extends NestedElementEncoder{
|
||||
public GSMetadataEncoder() {
|
||||
super(METADATA);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param rootName
|
||||
@ -72,15 +81,25 @@ public abstract class GSResourceEncoder<T extends GSDimensionInfoEncoder>
|
||||
set("enabled", (enabled) ? "true" : "false");
|
||||
}
|
||||
|
||||
// TODO MetadataLink
|
||||
// public void setMetadata(String key, String url){
|
||||
// metadata.set(key, url);
|
||||
// }
|
||||
|
||||
/**
|
||||
* @param key
|
||||
* @param dimensionInfo
|
||||
* @deprecated will be set to protected in the next release
|
||||
*/
|
||||
public void addMetadata(String key, T dimensionInfo) {
|
||||
protected void addMetadata(String key, XmlElement dimensionInfo) {
|
||||
metadata.add(key, dimensionInfo.getRoot());
|
||||
}
|
||||
|
||||
protected void setMetadata(String key, XmlElement dimensionInfo) {
|
||||
metadata.set(key, dimensionInfo.getRoot());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param key
|
||||
* the name of the metadata to add (f.e.: elevation, time)
|
||||
@ -90,9 +109,6 @@ public abstract class GSResourceEncoder<T extends GSDimensionInfoEncoder>
|
||||
return metadata.remove(key);
|
||||
}
|
||||
|
||||
public void setMetadata(String key, T dimensionInfo) {
|
||||
metadata.set(key, dimensionInfo.getRoot());
|
||||
}
|
||||
|
||||
public void addKeyword(String keyword) {
|
||||
final Element el = new Element("string");
|
||||
|
||||
@ -27,6 +27,7 @@ package it.geosolutions.geoserver.rest.encoder.coverage;
|
||||
|
||||
import it.geosolutions.geoserver.rest.encoder.GSResourceEncoder;
|
||||
import it.geosolutions.geoserver.rest.encoder.metadata.GSDimensionInfoEncoder;
|
||||
import it.geosolutions.geoserver.rest.encoder.metadata.GSFeatureDimensionInfoEncoder;
|
||||
|
||||
|
||||
/**
|
||||
@ -36,10 +37,22 @@ import it.geosolutions.geoserver.rest.encoder.metadata.GSDimensionInfoEncoder;
|
||||
* @author Carlo Cancellieri - carlo.cancellieri@geo-solutions.it
|
||||
*
|
||||
*/
|
||||
public class GSCoverageEncoder extends GSResourceEncoder<GSDimensionInfoEncoder> {
|
||||
public class GSCoverageEncoder extends GSResourceEncoder/*<GSDimensionInfoEncoder>*/ {
|
||||
|
||||
public GSCoverageEncoder() {
|
||||
super("coverage");
|
||||
}
|
||||
|
||||
/**
|
||||
* @param key
|
||||
* @param dimensionInfo
|
||||
* @deprecated will be set to protected in the next release
|
||||
*/
|
||||
public void addMetadata(String key, GSDimensionInfoEncoder dimensionInfo) {
|
||||
super.addMetadata(key, dimensionInfo);
|
||||
}
|
||||
|
||||
public void setMetadata(String key, GSDimensionInfoEncoder dimensionInfo) {
|
||||
super.setMetadata(key, dimensionInfo);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,52 +0,0 @@
|
||||
/*
|
||||
* 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.feature;
|
||||
|
||||
import it.geosolutions.geoserver.rest.encoder.metadata.GSDimensionInfoEncoder;
|
||||
|
||||
public class GSFeatureDimensionInfoEncoder extends GSDimensionInfoEncoder {
|
||||
public final static String ATTRIBUTE="attribute";
|
||||
|
||||
/**
|
||||
* if this dimension is enabled this constructor should be called.
|
||||
* @param attribute the attribute field name to use as dimension
|
||||
*/
|
||||
public GSFeatureDimensionInfoEncoder(final String attribute){
|
||||
super(true);
|
||||
add(ATTRIBUTE, attribute);
|
||||
}
|
||||
|
||||
/**
|
||||
* Change the attribute used as dimension
|
||||
* @param attribute the attribute to use as dimension
|
||||
*/
|
||||
public void setAttribute(final String attribute){
|
||||
set(ATTRIBUTE, attribute);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@ -25,7 +25,11 @@
|
||||
|
||||
package it.geosolutions.geoserver.rest.encoder.feature;
|
||||
|
||||
import java.net.URL;
|
||||
|
||||
import it.geosolutions.geoserver.rest.encoder.GSResourceEncoder;
|
||||
import it.geosolutions.geoserver.rest.encoder.metadata.GSFeatureDimensionInfoEncoder;
|
||||
import it.geosolutions.geoserver.rest.encoder.utils.XmlElement;
|
||||
|
||||
/**
|
||||
*
|
||||
@ -34,9 +38,22 @@ import it.geosolutions.geoserver.rest.encoder.GSResourceEncoder;
|
||||
* @author ETj (etj at geo-solutions.it)
|
||||
* @author Carlo Cancellieri - carlo.cancellieri@geo-solutions.it
|
||||
*/
|
||||
public class GSFeatureTypeEncoder extends GSResourceEncoder<GSFeatureDimensionInfoEncoder> {
|
||||
public class GSFeatureTypeEncoder extends GSResourceEncoder/*<GSFeatureDimensionInfoEncoder>*/ {
|
||||
|
||||
public GSFeatureTypeEncoder() {
|
||||
super("featureType");
|
||||
}
|
||||
|
||||
/**
|
||||
* @param key
|
||||
* @param dimensionInfo
|
||||
* @deprecated will be set to protected in the next release
|
||||
*/
|
||||
public void addMetadata(String key, GSFeatureDimensionInfoEncoder dimensionInfo) {
|
||||
super.addMetadata(key, dimensionInfo);
|
||||
}
|
||||
|
||||
public void setMetadata(String key, GSFeatureDimensionInfoEncoder dimensionInfo) {
|
||||
super.setMetadata(key, dimensionInfo);
|
||||
}
|
||||
}
|
||||
@ -1,42 +0,0 @@
|
||||
/*
|
||||
* 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.metadata;
|
||||
|
||||
import it.geosolutions.geoserver.rest.encoder.utils.NestedElementEncoder;
|
||||
|
||||
public class GSMetadataEncoder <T extends GSDimensionInfoEncoder> extends NestedElementEncoder{
|
||||
|
||||
public final static String METADATA="metadata";
|
||||
|
||||
public GSMetadataEncoder() {
|
||||
super(METADATA);
|
||||
}
|
||||
|
||||
// public void addMetadata(final String key, final T value) {
|
||||
// this.add(key, value.getRoot());
|
||||
// }
|
||||
|
||||
}
|
||||
@ -28,7 +28,6 @@ package it.geosolutions.geoserver.rest.encoder.utils;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import org.jdom.Content;
|
||||
import org.jdom.Element;
|
||||
import org.jdom.filter.Filter;
|
||||
|
||||
|
||||
@ -22,7 +22,6 @@ package it.geosolutions.geoserver.rest.encoder;
|
||||
import junit.framework.TestCase;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
|
||||
/**
|
||||
|
||||
@ -21,9 +21,7 @@ package it.geosolutions.geoserver.rest.encoder.coverage;
|
||||
|
||||
import it.geosolutions.geoserver.rest.encoder.GSResourceEncoder;
|
||||
import it.geosolutions.geoserver.rest.encoder.GSResourceEncoder.ProjectionPolicy;
|
||||
import it.geosolutions.geoserver.rest.encoder.coverage.GSCoverageEncoder;
|
||||
import it.geosolutions.geoserver.rest.encoder.metadata.GSDimensionInfoEncoder;
|
||||
import it.geosolutions.geoserver.rest.encoder.metadata.GSMetadataEncoder;
|
||||
import it.geosolutions.geoserver.rest.encoder.metadata.GSDimensionInfoEncoder.Presentation;
|
||||
import it.geosolutions.geoserver.rest.encoder.utils.ElementUtils;
|
||||
import junit.framework.TestCase;
|
||||
@ -52,7 +50,7 @@ public class GSCoverageEncoderTest extends TestCase {
|
||||
*/
|
||||
@Test
|
||||
public void testReprojection(){
|
||||
GSResourceEncoder<GSDimensionInfoEncoder> re=new GSCoverageEncoder();
|
||||
GSResourceEncoder/*<GSDimensionInfoEncoder>*/ re=new GSCoverageEncoder();
|
||||
|
||||
re.setProjectionPolicy(ProjectionPolicy.FORCE_DECLARED);
|
||||
Assert.assertNotNull(ElementUtils.contains(re.getRoot(),"projectionPolicy",ProjectionPolicy.FORCE_DECLARED.toString()));
|
||||
@ -67,7 +65,7 @@ public class GSCoverageEncoderTest extends TestCase {
|
||||
*/
|
||||
@Test
|
||||
public void testBB(){
|
||||
GSResourceEncoder<GSDimensionInfoEncoder> re=new GSCoverageEncoder();
|
||||
GSResourceEncoder/*<GSDimensionInfoEncoder>*/ re=new GSCoverageEncoder();
|
||||
|
||||
re.setLatLonBoundingBox(-180d, 90d, 180d, -90d, null);
|
||||
Assert.assertNotNull(ElementUtils.contains(re.getRoot(),"minx","-180.0"));
|
||||
@ -93,7 +91,7 @@ public class GSCoverageEncoderTest extends TestCase {
|
||||
if (LOGGER.isInfoEnabled())
|
||||
LOGGER.info(encoder.toString());
|
||||
|
||||
final Element el=ElementUtils.contains(encoder.getRoot(),GSMetadataEncoder.METADATA);
|
||||
final Element el=ElementUtils.contains(encoder.getRoot(),GSResourceEncoder.METADATA);
|
||||
Assert.assertNotNull(el);
|
||||
LOGGER.info("contains_key:"+el.toString());
|
||||
|
||||
@ -112,7 +110,7 @@ public class GSCoverageEncoderTest extends TestCase {
|
||||
if (LOGGER.isInfoEnabled())
|
||||
LOGGER.info(encoder.toString());
|
||||
|
||||
final Element el3=ElementUtils.contains(encoder.getRoot(),GSMetadataEncoder.METADATA);
|
||||
final Element el3=ElementUtils.contains(encoder.getRoot(),GSResourceEncoder.METADATA);
|
||||
Assert.assertNotNull(el3);
|
||||
LOGGER.info("contains_by_node:"+el3.toString());
|
||||
|
||||
@ -120,7 +118,7 @@ public class GSCoverageEncoderTest extends TestCase {
|
||||
LOGGER.info("remove:"+removed);
|
||||
Assert.assertTrue(removed);
|
||||
|
||||
final Element el4=ElementUtils.contains(encoder.getRoot(),GSMetadataEncoder.METADATA);
|
||||
final Element el4=ElementUtils.contains(encoder.getRoot(),GSResourceEncoder.METADATA);
|
||||
Assert.assertNull(el4);
|
||||
if (el4==null)
|
||||
LOGGER.info("REMOVED");
|
||||
|
||||
@ -38,6 +38,9 @@ public class GSImageMosaicEncoderTest extends TestCase {
|
||||
*/
|
||||
protected final static Logger LOGGER = Logger.getLogger(GSImageMosaicEncoderTest.class);
|
||||
|
||||
/**
|
||||
* TODO implement this test
|
||||
*/
|
||||
@Test
|
||||
public void testAll() {
|
||||
final GSImageMosaicEncoder encoder=new GSImageMosaicEncoder();
|
||||
@ -51,11 +54,5 @@ public class GSImageMosaicEncoderTest extends TestCase {
|
||||
encoder.addSUGGESTED_TILE_SIZE("512,512");
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
package it.geosolutions.geoserver.rest.encoder.feature;
|
||||
|
||||
import it.geosolutions.geoserver.rest.encoder.metadata.GSDimensionInfoEncoder;
|
||||
import it.geosolutions.geoserver.rest.encoder.metadata.GSFeatureDimensionInfoEncoder;
|
||||
import it.geosolutions.geoserver.rest.encoder.metadata.GSDimensionInfoEncoder.Presentation;
|
||||
import it.geosolutions.geoserver.rest.encoder.metadata.GSDimensionInfoEncoder.PresentationDiscrete;
|
||||
import it.geosolutions.geoserver.rest.encoder.utils.ElementUtils;
|
||||
|
||||
@ -19,20 +19,19 @@
|
||||
*/
|
||||
package it.geosolutions.geoserver.rest.encoder.feature;
|
||||
|
||||
import it.geosolutions.geoserver.rest.encoder.GSResourceEncoder;
|
||||
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.PresentationDiscrete;
|
||||
import it.geosolutions.geoserver.rest.encoder.metadata.GSMetadataEncoder;
|
||||
import it.geosolutions.geoserver.rest.encoder.metadata.GSFeatureDimensionInfoEncoder;
|
||||
import it.geosolutions.geoserver.rest.encoder.utils.ElementUtils;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.jdom.Element;
|
||||
import org.jdom.filter.Filter;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
|
||||
@ -90,7 +89,7 @@ public class GSFeatureEncoderTest extends TestCase {
|
||||
el=ElementUtils.contains(encoder.getRoot(),GSDimensionInfoEncoder.RESOLUTION);
|
||||
Assert.assertNull(el);
|
||||
|
||||
el=ElementUtils.contains(encoder.getRoot(),GSMetadataEncoder.METADATA);
|
||||
el=ElementUtils.contains(encoder.getRoot(),GSResourceEncoder.METADATA);
|
||||
Assert.assertNotNull(el);
|
||||
LOGGER.info("contains_key:"+el.toString());
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user