improvements to close #8 and #7 and partially implements (on shp file) #9

This commit is contained in:
ccancellieri 2012-04-12 19:39:58 +02:00
parent ec4f18e03b
commit c9a81141cb
12 changed files with 859 additions and 747 deletions

View File

@ -70,10 +70,7 @@ public class GSPostGISDatastoreEncoder extends PropertyXMLEncoder {
setMaxOpenPreparedStatements(50); setMaxOpenPreparedStatements(50);
} }
/** protected void addName(String name) {
* @deprecated will be set to protected in the next release
*/
public void addName(String name) {
add("name", name); add("name", name);
} }
@ -81,10 +78,7 @@ public class GSPostGISDatastoreEncoder extends PropertyXMLEncoder {
set("name", name); set("name", name);
} }
/** protected void addDescription(String description) {
* @deprecated will be set to protected in the next release
*/
public void addDescription(String description) {
add("description", description); add("description", description);
} }
@ -92,10 +86,7 @@ public class GSPostGISDatastoreEncoder extends PropertyXMLEncoder {
set("description", description); set("description", description);
} }
/** protected void addType(String type) {
* @deprecated will be set to protected in the next release
*/
public void addType(String type) {
add("type", type); add("type", type);
} }
@ -103,10 +94,7 @@ public class GSPostGISDatastoreEncoder extends PropertyXMLEncoder {
set("type", type); set("type", type);
} }
/** protected void addEnabled(boolean enabled) {
* @deprecated will be set to protected in the next release
*/
public void addEnabled(boolean enabled) {
add("enabled", Boolean.toString(enabled)); add("enabled", Boolean.toString(enabled));
} }
@ -114,10 +102,7 @@ public class GSPostGISDatastoreEncoder extends PropertyXMLEncoder {
set("enabled", Boolean.toString(enabled)); set("enabled", Boolean.toString(enabled));
} }
/** protected void addNamespace(String namespace) {
* @deprecated will be set to protected in the next release
*/
public void addNamespace(String namespace) {
connectionParameters.add("namespace", namespace); connectionParameters.add("namespace", namespace);
} }
@ -125,10 +110,7 @@ public class GSPostGISDatastoreEncoder extends PropertyXMLEncoder {
connectionParameters.set("namespace", namespace); connectionParameters.set("namespace", namespace);
} }
/** protected void addHost(String host) {
* @deprecated will be set to protected in the next release
*/
public void addHost(String host) {
connectionParameters.add("host", host); connectionParameters.add("host", host);
} }
@ -136,10 +118,7 @@ public class GSPostGISDatastoreEncoder extends PropertyXMLEncoder {
connectionParameters.set("host", host); connectionParameters.set("host", host);
} }
/** protected void addPort(int port) {
* @deprecated will be set to protected in the next release
*/
public void addPort(int port) {
connectionParameters.add("port", Integer.toString(port)); connectionParameters.add("port", Integer.toString(port));
} }
@ -147,10 +126,7 @@ public class GSPostGISDatastoreEncoder extends PropertyXMLEncoder {
connectionParameters.set("port", Integer.toString(port)); connectionParameters.set("port", Integer.toString(port));
} }
/** protected void addDatabase(String database) {
* @deprecated will be set to protected in the next release
*/
public void addDatabase(String database) {
connectionParameters.add("database", database); connectionParameters.add("database", database);
} }
@ -158,10 +134,7 @@ public class GSPostGISDatastoreEncoder extends PropertyXMLEncoder {
connectionParameters.set("database", database); connectionParameters.set("database", database);
} }
/** protected void addSchema(String schema) {
* @deprecated will be set to protected in the next release
*/
public void addSchema(String schema) {
connectionParameters.add("schema", schema); connectionParameters.add("schema", schema);
} }
@ -169,10 +142,7 @@ public class GSPostGISDatastoreEncoder extends PropertyXMLEncoder {
connectionParameters.set("schema", schema); connectionParameters.set("schema", schema);
} }
/** protected void addUser(String user) {
* @deprecated will be set to protected in the next release
*/
public void addUser(String user) {
connectionParameters.add("user", user); connectionParameters.add("user", user);
} }
@ -180,10 +150,7 @@ public class GSPostGISDatastoreEncoder extends PropertyXMLEncoder {
connectionParameters.set("user", user); connectionParameters.set("user", user);
} }
/** protected void addPassword(String password) {
* @deprecated will be set to protected in the next release
*/
public void addPassword(String password) {
connectionParameters.add("passwd", password); connectionParameters.add("passwd", password);
} }
@ -191,10 +158,7 @@ public class GSPostGISDatastoreEncoder extends PropertyXMLEncoder {
connectionParameters.set("passwd", password); connectionParameters.set("passwd", password);
} }
/** protected void addDatabaseType(String dbtype) {
* @deprecated will be set to protected in the next release
*/
public void addDatabaseType(String dbtype) {
connectionParameters.add("dbtype", dbtype); connectionParameters.add("dbtype", dbtype);
} }
@ -202,10 +166,7 @@ public class GSPostGISDatastoreEncoder extends PropertyXMLEncoder {
connectionParameters.set("dbtype", dbtype); connectionParameters.set("dbtype", dbtype);
} }
/** protected void addJndiReferenceName(String jndiReferenceName) {
* @deprecated will be set to protected in the next release
*/
public void addJndiReferenceName(String jndiReferenceName) {
connectionParameters.add("jndiReferenceName", jndiReferenceName); connectionParameters.add("jndiReferenceName", jndiReferenceName);
} }
@ -213,10 +174,7 @@ public class GSPostGISDatastoreEncoder extends PropertyXMLEncoder {
connectionParameters.set("jndiReferenceName", jndiReferenceName); connectionParameters.set("jndiReferenceName", jndiReferenceName);
} }
/** protected void addExposePrimaryKeys(boolean exposePrimaryKeys) {
* @deprecated will be set to protected in the next release
*/
public void addExposePrimaryKeys(boolean exposePrimaryKeys) {
connectionParameters.add("Expose primary keys", Boolean.toString(exposePrimaryKeys)); connectionParameters.add("Expose primary keys", Boolean.toString(exposePrimaryKeys));
} }
@ -224,10 +182,7 @@ public class GSPostGISDatastoreEncoder extends PropertyXMLEncoder {
connectionParameters.set("Expose primary keys", Boolean.toString(exposePrimaryKeys)); connectionParameters.set("Expose primary keys", Boolean.toString(exposePrimaryKeys));
} }
/** protected void addMaxConnections(int maxConnections) {
* @deprecated will be set to protected in the next release
*/
public void addMaxConnections(int maxConnections) {
connectionParameters.add("max connections", Integer.toString(maxConnections)); connectionParameters.add("max connections", Integer.toString(maxConnections));
} }
@ -235,10 +190,7 @@ public class GSPostGISDatastoreEncoder extends PropertyXMLEncoder {
connectionParameters.set("max connections", Integer.toString(maxConnections)); connectionParameters.set("max connections", Integer.toString(maxConnections));
} }
/** protected void addMinConnections(int minConnections) {
* @deprecated will be set to protected in the next release
*/
public void addMinConnections(int minConnections) {
connectionParameters.add("min connections", Integer.toString(minConnections)); connectionParameters.add("min connections", Integer.toString(minConnections));
} }
@ -246,10 +198,7 @@ public class GSPostGISDatastoreEncoder extends PropertyXMLEncoder {
connectionParameters.set("min connections", Integer.toString(minConnections)); connectionParameters.set("min connections", Integer.toString(minConnections));
} }
/** protected void addFetchSize(int fetchSize) {
* @deprecated will be set to protected in the next release
*/
public void addFetchSize(int fetchSize) {
connectionParameters.add("fetch size", Integer.toString(fetchSize)); connectionParameters.add("fetch size", Integer.toString(fetchSize));
} }
@ -257,10 +206,7 @@ public class GSPostGISDatastoreEncoder extends PropertyXMLEncoder {
connectionParameters.set("fetch size", Integer.toString(fetchSize)); connectionParameters.set("fetch size", Integer.toString(fetchSize));
} }
/** protected void addConnectionTimeout(int seconds) {
* @deprecated will be set to protected in the next release
*/
public void addConnectionTimeout(int seconds) {
connectionParameters.add("Connection timeout", Integer.toString(seconds)); connectionParameters.add("Connection timeout", Integer.toString(seconds));
} }
@ -268,10 +214,7 @@ public class GSPostGISDatastoreEncoder extends PropertyXMLEncoder {
connectionParameters.set("Connection timeout", Integer.toString(seconds)); connectionParameters.set("Connection timeout", Integer.toString(seconds));
} }
/** protected void addValidateConnections(boolean validateConnections) {
* @deprecated will be set to protected in the next release
*/
public void addValidateConnections(boolean validateConnections) {
connectionParameters.add("validate connections", Boolean.toString(validateConnections)); connectionParameters.add("validate connections", Boolean.toString(validateConnections));
} }
@ -279,10 +222,7 @@ public class GSPostGISDatastoreEncoder extends PropertyXMLEncoder {
connectionParameters.set("validate connections", Boolean.toString(validateConnections)); connectionParameters.set("validate connections", Boolean.toString(validateConnections));
} }
/** protected void addPrimaryKeyMetadataTable(String primaryKeyMetadataTable) {
* @deprecated will be set to protected in the next release
*/
public void addPrimaryKeyMetadataTable(String primaryKeyMetadataTable) {
connectionParameters.add("Primary key metadata table", primaryKeyMetadataTable); connectionParameters.add("Primary key metadata table", primaryKeyMetadataTable);
} }
@ -290,10 +230,7 @@ public class GSPostGISDatastoreEncoder extends PropertyXMLEncoder {
connectionParameters.set("Primary key metadata table", primaryKeyMetadataTable); connectionParameters.set("Primary key metadata table", primaryKeyMetadataTable);
} }
/** protected void addLooseBBox(boolean looseBBox) {
* @deprecated will be set to protected in the next release
*/
public void addLooseBBox(boolean looseBBox) {
connectionParameters.add("Loose bbox", Boolean.toString(looseBBox)); connectionParameters.add("Loose bbox", Boolean.toString(looseBBox));
} }
@ -301,10 +238,7 @@ public class GSPostGISDatastoreEncoder extends PropertyXMLEncoder {
connectionParameters.set("Loose bbox", Boolean.toString(looseBBox)); connectionParameters.set("Loose bbox", Boolean.toString(looseBBox));
} }
/** protected void addPreparedStatements(boolean preparedStatements) {
* @deprecated will be set to protected in the next release
*/
public void addPreparedStatements(boolean preparedStatements) {
connectionParameters.add("preparedStatements", Boolean.toString(preparedStatements)); connectionParameters.add("preparedStatements", Boolean.toString(preparedStatements));
} }
@ -312,10 +246,7 @@ public class GSPostGISDatastoreEncoder extends PropertyXMLEncoder {
connectionParameters.set("preparedStatements", Boolean.toString(preparedStatements)); connectionParameters.set("preparedStatements", Boolean.toString(preparedStatements));
} }
/** protected void addMaxOpenPreparedStatements(int maxOpenPreparedStatements) {
* @deprecated will be set to protected in the next release
*/
public void addMaxOpenPreparedStatements(int maxOpenPreparedStatements) {
connectionParameters.add("Max open prepared statements", Integer.toString(maxOpenPreparedStatements)); connectionParameters.add("Max open prepared statements", Integer.toString(maxOpenPreparedStatements));
} }

View File

@ -38,8 +38,7 @@ import org.jdom.filter.Filter;
/** /**
* *
* Encode a GeoServer resouce. The <T> type regards the GDSDimensionInfoEncoder * Encode a GeoServer resource.
* metadata Type which has different specialization for Features.
* *
* @see GSDimensionInfoEncoder * @see GSDimensionInfoEncoder
* @see GSFeatureDimensionInfoEncoder * @see GSFeatureDimensionInfoEncoder
@ -89,13 +88,12 @@ public abstract class GSResourceEncoder
/** /**
* @param key * @param key
* @param dimensionInfo * @param dimensionInfo
* @deprecated will be set to protected in the next release
*/ */
protected void addMetadata(String key, XmlElement dimensionInfo) { protected void addMetadata(String key, XmlElement dimensionInfo) {
metadata.add(key, dimensionInfo.getRoot()); metadata.add(key, dimensionInfo.getRoot());
} }
protected void setMetadata(String key, XmlElement dimensionInfo) { public void setMetadata(String key, XmlElement dimensionInfo) {
metadata.set(key, dimensionInfo.getRoot()); metadata.set(key, dimensionInfo.getRoot());
} }
@ -149,10 +147,8 @@ public abstract class GSResourceEncoder
/** /**
* NONE, REPROJECT_TO_DECLARED, FORCE_DECLARED * NONE, REPROJECT_TO_DECLARED, FORCE_DECLARED
* *
* @deprecated use the setProjectionPolicy. <br>
* This method will be set as protected in the next release
*/ */
public void addProjectionPolicy(ProjectionPolicy policy) { protected void addProjectionPolicy(ProjectionPolicy policy) {
add(PROJECTIONPOLICY, policy.toString()); add(PROJECTIONPOLICY, policy.toString());
} }
@ -167,10 +163,8 @@ public abstract class GSResourceEncoder
* Add the 'name' node with a text value from 'name' * Add the 'name' node with a text value from 'name'
* *
* @note REQUIRED to configure a resource * @note REQUIRED to configure a resource
* @deprecated use the setName. <br>
* This method will be set as protected in the next release
*/ */
public void addName(final String name) { protected void addName(final String name) {
add(NAME, name); add(NAME, name);
} }
@ -196,10 +190,8 @@ public abstract class GSResourceEncoder
/** /**
* Add the 'title' node with a text value from 'title' * Add the 'title' node with a text value from 'title'
* *
* @deprecated use the setTitle. <br>
* This method will be set as protected in the next release
*/ */
public void addTitle(final String title) { protected void addTitle(final String title) {
add(TITLE, title); add(TITLE, title);
} }
@ -214,11 +206,8 @@ public abstract class GSResourceEncoder
/** /**
* Add the 'SRS' node with a text value from 'srs' * Add the 'SRS' node with a text value from 'srs'
*
* @deprecated use the setSRS. <br>
* This method will be set as protected in the next release
*/ */
public void addSRS(final String srs) { protected void addSRS(final String srs) {
add(SRS, srs); add(SRS, srs);
} }
@ -236,8 +225,6 @@ public abstract class GSResourceEncoder
private final static String LATLONBBCRS = "latLonBoundingBox/crs"; private final static String LATLONBBCRS = "latLonBoundingBox/crs";
/** /**
* @deprecated use the setSRS. <br>
* This method will be set as protected in the next release
* *
* @param minx * @param minx
* @param maxy * @param maxy
@ -245,7 +232,7 @@ public abstract class GSResourceEncoder
* @param miny * @param miny
* @param crs * @param crs
*/ */
public void addLatLonBoundingBox(double minx, double miny, double maxx, protected void addLatLonBoundingBox(double minx, double miny, double maxx,
double maxy, final String crs) { double maxy, final String crs) {
add(LATLONBBMINX, String.valueOf(minx)); add(LATLONBBMINX, String.valueOf(minx));
add(LATLONBBMINY, String.valueOf(miny)); add(LATLONBBMINY, String.valueOf(miny));
@ -270,16 +257,13 @@ public abstract class GSResourceEncoder
private final static String NATIVEBBCRS = "nativeBoundingBox/crs"; private final static String NATIVEBBCRS = "nativeBoundingBox/crs";
/** /**
* @deprecated use the setSRS. <br>
* This method will be set as protected in the next release
*
* @param minx * @param minx
* @param maxy * @param maxy
* @param maxx * @param maxx
* @param miny * @param miny
* @param crs * @param crs
*/ */
public void addNativeBoundingBox(double minx, double miny, double maxx, protected void addNativeBoundingBox(double minx, double miny, double maxx,
double maxy, final String crs) { double maxy, final String crs) {
add(NATIVEBBMINX, String.valueOf(minx)); add(NATIVEBBMINX, String.valueOf(minx));
add(NATIVEBBMAXY, String.valueOf(maxy)); add(NATIVEBBMAXY, String.valueOf(maxy));

View File

@ -55,9 +55,8 @@ public class GSWorkspaceEncoder extends PropertyXMLEncoder {
* Add the name to this workspace * Add the name to this workspace
* @param name * @param name
* @throws IllegalStateException if name is already set * @throws IllegalStateException if name is already set
* @deprecated will be set to protected in the next release
*/ */
public void addName(final String name) { protected void addName(final String name) {
final Element el=ElementUtils.contains(getRoot(),NAME); final Element el=ElementUtils.contains(getRoot(),NAME);
if (el==null) if (el==null)
add(NAME, name); add(NAME, name);

View File

@ -37,7 +37,7 @@ import it.geosolutions.geoserver.rest.encoder.metadata.GSFeatureDimensionInfoEnc
* @author Carlo Cancellieri - carlo.cancellieri@geo-solutions.it * @author Carlo Cancellieri - carlo.cancellieri@geo-solutions.it
* *
*/ */
public class GSCoverageEncoder extends GSResourceEncoder/*<GSDimensionInfoEncoder>*/ { public class GSCoverageEncoder extends GSResourceEncoder {
public GSCoverageEncoder() { public GSCoverageEncoder() {
super("coverage"); super("coverage");
@ -46,9 +46,8 @@ public class GSCoverageEncoder extends GSResourceEncoder/*<GSDimensionInfoEncode
/** /**
* @param key * @param key
* @param dimensionInfo * @param dimensionInfo
* @deprecated will be set to protected in the next release
*/ */
public void addMetadata(String key, GSDimensionInfoEncoder dimensionInfo) { protected void addMetadata(String key, GSDimensionInfoEncoder dimensionInfo) {
super.addMetadata(key, dimensionInfo); super.addMetadata(key, dimensionInfo);
} }

View File

@ -87,10 +87,9 @@ public class GSImageMosaicEncoder extends GSCoverageEncoder {
private final static String allowMultithreading="AllowMultithreading"; private final static String allowMultithreading="AllowMultithreading";
/** /**
* @deprecated will be set to protected in the next release
* @param val * @param val
*/ */
public void addAllowMultithreading(final boolean val){ protected void addAllowMultithreading(final boolean val){
final List<Element> list=new ArrayList<Element>(2); final List<Element> list=new ArrayList<Element>(2);
list.add(new Element(STRING).setText(allowMultithreading)); list.add(new Element(STRING).setText(allowMultithreading));
list.add(new Element(STRING).setText((val)?"true":"false")); list.add(new Element(STRING).setText((val)?"true":"false"));
@ -106,10 +105,9 @@ public class GSImageMosaicEncoder extends GSCoverageEncoder {
private final static String filter="Filter"; private final static String filter="Filter";
/** /**
* @deprecated will be set to protected in the next release
* @param val * @param val
*/ */
public void addFilter(final String val){ protected void addFilter(final String val){
final List<Element> list=new ArrayList<Element>(2); final List<Element> list=new ArrayList<Element>(2);
list.add(new Element(STRING).setText(filter)); list.add(new Element(STRING).setText(filter));
list.add(new Element(STRING).setText(val)); list.add(new Element(STRING).setText(val));
@ -124,10 +122,9 @@ public class GSImageMosaicEncoder extends GSCoverageEncoder {
private final static String maxAllowedTiles="MaxAllowedTiles"; private final static String maxAllowedTiles="MaxAllowedTiles";
/** /**
* @deprecated will be set to protected in the next release
* @param val * @param val
*/ */
public void addMaxAllowedTiles(final int val){ protected void addMaxAllowedTiles(final int val){
final List<Element> list=new ArrayList<Element>(2); final List<Element> list=new ArrayList<Element>(2);
list.add(new Element(STRING).setText(maxAllowedTiles)); list.add(new Element(STRING).setText(maxAllowedTiles));
list.add(new Element(STRING).setText(String.valueOf(val))); list.add(new Element(STRING).setText(String.valueOf(val)));
@ -142,10 +139,9 @@ public class GSImageMosaicEncoder extends GSCoverageEncoder {
private final static String inputTransparentColor="InputTransparentColor"; private final static String inputTransparentColor="InputTransparentColor";
/** /**
* @deprecated will be set to protected in the next release
* @param val * @param val
*/ */
public void addInputTransparentColor(final String val){ protected void addInputTransparentColor(final String val){
final List<Element> list=new ArrayList<Element>(2); final List<Element> list=new ArrayList<Element>(2);
list.add(new Element(STRING).setText(inputTransparentColor)); list.add(new Element(STRING).setText(inputTransparentColor));
list.add(new Element(STRING).setText(val)); list.add(new Element(STRING).setText(val));
@ -160,10 +156,9 @@ public class GSImageMosaicEncoder extends GSCoverageEncoder {
private final static String outputTransparentColor="OutputTransparentColor"; private final static String outputTransparentColor="OutputTransparentColor";
/** /**
* @deprecated will be set to protected in the next release
* @param val * @param val
*/ */
public void addOutputTransparentColor(final String val){ protected void addOutputTransparentColor(final String val){
final List<Element> list=new ArrayList<Element>(2); final List<Element> list=new ArrayList<Element>(2);
list.add(new Element(STRING).setText(outputTransparentColor)); list.add(new Element(STRING).setText(outputTransparentColor));
list.add(new Element(STRING).setText(val)); list.add(new Element(STRING).setText(val));
@ -178,11 +173,9 @@ public class GSImageMosaicEncoder extends GSCoverageEncoder {
private final static String SUGGESTED_TILE_SIZE="SUGGESTED_TILE_SIZE"; private final static String SUGGESTED_TILE_SIZE="SUGGESTED_TILE_SIZE";
/** /**
*
* @param val * @param val
* @deprecated will be set to protected in the next release
*/ */
public void addSUGGESTED_TILE_SIZE(final String val){ protected void addSUGGESTED_TILE_SIZE(final String val){
final List<Element> list=new ArrayList<Element>(2); final List<Element> list=new ArrayList<Element>(2);
list.add(new Element(STRING).setText(SUGGESTED_TILE_SIZE)); list.add(new Element(STRING).setText(SUGGESTED_TILE_SIZE));
list.add(new Element(STRING).setText(val)); list.add(new Element(STRING).setText(val));
@ -197,10 +190,9 @@ public class GSImageMosaicEncoder extends GSCoverageEncoder {
private final static String USE_JAI_IMAGEREAD="USE_JAI_IMAGEREAD"; private final static String USE_JAI_IMAGEREAD="USE_JAI_IMAGEREAD";
/** /**
* @deprecated will be set to protected in the next release
* @param val * @param val
*/ */
public void addUSE_JAI_IMAGEREAD(final boolean val){ protected void addUSE_JAI_IMAGEREAD(final boolean val){
final List<Element> list=new ArrayList<Element>(2); final List<Element> list=new ArrayList<Element>(2);
list.add(new Element(STRING).setText(USE_JAI_IMAGEREAD)); list.add(new Element(STRING).setText(USE_JAI_IMAGEREAD));
list.add(new Element(STRING).setText((val)?"true":"false")); list.add(new Element(STRING).setText((val)?"true":"false"));
@ -215,10 +207,9 @@ public class GSImageMosaicEncoder extends GSCoverageEncoder {
private final static String backgroundValues="BackgroundValues"; private final static String backgroundValues="BackgroundValues";
/** /**
* @deprecated will be set to protected in the next release
* @param val * @param val
*/ */
public void addBackgroundValues(final String val){ protected void addBackgroundValues(final String val){
final List<Element> list=new ArrayList<Element>(2); final List<Element> list=new ArrayList<Element>(2);
list.add(new Element(STRING).setText(backgroundValues)); list.add(new Element(STRING).setText(backgroundValues));
list.add(new Element(STRING).setText(val)); list.add(new Element(STRING).setText(val));

View File

@ -25,11 +25,8 @@
package it.geosolutions.geoserver.rest.encoder.feature; package it.geosolutions.geoserver.rest.encoder.feature;
import java.net.URL;
import it.geosolutions.geoserver.rest.encoder.GSResourceEncoder; import it.geosolutions.geoserver.rest.encoder.GSResourceEncoder;
import it.geosolutions.geoserver.rest.encoder.metadata.GSFeatureDimensionInfoEncoder; import it.geosolutions.geoserver.rest.encoder.metadata.GSFeatureDimensionInfoEncoder;
import it.geosolutions.geoserver.rest.encoder.utils.XmlElement;
/** /**
* *
@ -38,7 +35,7 @@ import it.geosolutions.geoserver.rest.encoder.utils.XmlElement;
* @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
*/ */
public class GSFeatureTypeEncoder extends GSResourceEncoder/*<GSFeatureDimensionInfoEncoder>*/ { public class GSFeatureTypeEncoder extends GSResourceEncoder {
public GSFeatureTypeEncoder() { public GSFeatureTypeEncoder() {
super("featureType"); super("featureType");
@ -47,9 +44,8 @@ public class GSFeatureTypeEncoder extends GSResourceEncoder/*<GSFeatureDimension
/** /**
* @param key * @param key
* @param dimensionInfo * @param dimensionInfo
* @deprecated will be set to protected in the next release
*/ */
public void addMetadata(String key, GSFeatureDimensionInfoEncoder dimensionInfo) { protected void addMetadata(String key, GSFeatureDimensionInfoEncoder dimensionInfo) {
super.addMetadata(key, dimensionInfo); super.addMetadata(key, dimensionInfo);
} }

View File

@ -82,10 +82,9 @@ public class GSDimensionInfoEncoder extends XmlElement{
} }
/** /**
* @deprecated will be set to protected in the next release {@link setPresentation(final Presentation pres)}
* @param pres * @param pres
*/ */
public void addPresentation(final Presentation pres){ protected void addPresentation(final Presentation pres){
if (enabled){ if (enabled){
add(PRESENTATION,pres.toString()); add(PRESENTATION,pres.toString());
} }
@ -101,9 +100,8 @@ public class GSDimensionInfoEncoder extends XmlElement{
/** /**
* @param pres * @param pres
* @param interval * @param interval
* @deprecated will be set to protected in the next release {@link setPresentation(final PresentationDiscrete pres, final BigDecimal interval)}
*/ */
public void addPresentation(final PresentationDiscrete pres, final BigDecimal interval){ protected void addPresentation(final PresentationDiscrete pres, final BigDecimal interval){
if (enabled){ if (enabled){
add(PRESENTATION,pres.toString()); add(PRESENTATION,pres.toString());
add(RESOLUTION,String.valueOf(interval)); add(RESOLUTION,String.valueOf(interval));

View File

@ -26,10 +26,7 @@
package it.geosolutions.geoserver.rest; package it.geosolutions.geoserver.rest;
import it.geosolutions.geoserver.rest.decoder.RESTCoverageStore;
import it.geosolutions.geoserver.rest.encoder.GSLayerEncoder;
import it.geosolutions.geoserver.rest.encoder.GSResourceEncoder.ProjectionPolicy; import it.geosolutions.geoserver.rest.encoder.GSResourceEncoder.ProjectionPolicy;
import it.geosolutions.geoserver.rest.encoder.coverage.GSCoverageEncoder;
import java.io.File; import java.io.File;
import java.io.FileNotFoundException; import java.io.FileNotFoundException;

View File

@ -62,7 +62,7 @@ public class GSFeatureEncoderTest extends TestCase {
encoder.addMetadata("elevation", dim2); encoder.addMetadata("elevation", dim2);
dim2.addPresentation(PresentationDiscrete.DISCRETE_INTERVAL, dim2.setPresentation(PresentationDiscrete.DISCRETE_INTERVAL,
BigDecimal.valueOf(10)); BigDecimal.valueOf(10));
Element el=ElementUtils.contains(encoder.getRoot(),GSDimensionInfoEncoder.PRESENTATION); Element el=ElementUtils.contains(encoder.getRoot(),GSDimensionInfoEncoder.PRESENTATION);

View File

@ -107,7 +107,11 @@ public class GeoserverRESTGeoTiffTest extends GeoserverRESTTest {
pub = publisher.publishGeoTIFF(DEFAULT_WS, storeName+"another", "layername", geotiff); pub = publisher.publishGeoTIFF(DEFAULT_WS, storeName+"another", "layername", geotiff);
assertNotNull("publish() failed", pub); assertTrue("publish() failed", pub);
pub = publisher.publishGeoTIFF(DEFAULT_WS, storeName+"another_complex", "layername_complex", geotiff, "EPSG:4326", ProjectionPolicy.REPROJECT_TO_DECLARED,"raster");
assertTrue("publish() failed", pub);
//delete //delete
assertTrue("Unpublish() failed", publisher.removeCoverageStore(DEFAULT_WS, storeName,true)); assertTrue("Unpublish() failed", publisher.removeCoverageStore(DEFAULT_WS, storeName,true));

View File

@ -26,7 +26,9 @@
package it.geosolutions.geoserver.rest.publisher; package it.geosolutions.geoserver.rest.publisher;
import it.geosolutions.geoserver.rest.GeoserverRESTTest; import it.geosolutions.geoserver.rest.GeoserverRESTTest;
import it.geosolutions.geoserver.rest.GeoServerRESTPublisher.UploadMethod;
import it.geosolutions.geoserver.rest.decoder.RESTLayer; import it.geosolutions.geoserver.rest.decoder.RESTLayer;
import it.geosolutions.geoserver.rest.encoder.GSResourceEncoder.ProjectionPolicy;
import java.io.File; import java.io.File;
import java.io.FileNotFoundException; import java.io.FileNotFoundException;
@ -51,6 +53,7 @@ public class GeoserverRESTShapeTest extends GeoserverRESTTest {
public GeoserverRESTShapeTest(String testName) { public GeoserverRESTShapeTest(String testName) {
super(testName); super(testName);
} }
public void testPublishDeleteShapeZip() throws FileNotFoundException, IOException { public void testPublishDeleteShapeZip() throws FileNotFoundException, IOException {
if (!enabled()) { if (!enabled()) {
@ -86,6 +89,73 @@ public class GeoserverRESTShapeTest extends GeoserverRESTTest {
} }
public void testPublishDeleteExternalComplexShapeZip() throws FileNotFoundException, IOException {
if (!enabled()) {
return;
}
// Assume.assumeTrue(enabled);
deleteAllWorkspaces();
assertTrue(publisher.createWorkspace(DEFAULT_WS));
String storeName = "resttestshp_complex";
String datasetName = "cities";
File zipFile = new ClassPathResource("testdata/shapefile/cities.shp").getFile();
// test insert
boolean published = publisher.publishShp(DEFAULT_WS, storeName, new NameValuePair[]{new NameValuePair("charset", "UTF-8")},datasetName, UploadMethod.external, zipFile.toURI(), "EPSG:4326",ProjectionPolicy.REPROJECT_TO_DECLARED,"polygon");
assertTrue("publish() failed", published);
assertTrue(existsLayer(datasetName));
RESTLayer layer = reader.getLayer(datasetName);
LOGGER.info("Layer style is " + layer.getDefaultStyle());
//test delete
boolean ok = publisher.unpublishFeatureType(DEFAULT_WS, storeName, datasetName);
assertTrue("Unpublish() failed", ok);
assertFalse(existsLayer(datasetName));
// remove also datastore
boolean dsRemoved = publisher.removeDatastore(DEFAULT_WS, storeName,false);
assertTrue("removeDatastore() failed", dsRemoved);
}
public void testPublishDeleteComplexShapeZip() throws FileNotFoundException, IOException {
if (!enabled()) {
return;
}
// Assume.assumeTrue(enabled);
deleteAllWorkspaces();
assertTrue(publisher.createWorkspace(DEFAULT_WS));
String storeName = "resttestshp_complex";
String datasetName = "cities";
File zipFile = new ClassPathResource("testdata/resttestshp.zip").getFile();
// test insert
boolean published = publisher.publishShp(DEFAULT_WS, storeName, new NameValuePair[]{new NameValuePair("charset", "UTF-8")},datasetName, UploadMethod.file, zipFile.toURI(), "EPSG:4326",ProjectionPolicy.REPROJECT_TO_DECLARED,"polygon");
assertTrue("publish() failed", published);
assertTrue(existsLayer(datasetName));
RESTLayer layer = reader.getLayer(datasetName);
LOGGER.info("Layer style is " + layer.getDefaultStyle());
//test delete
boolean ok = publisher.unpublishFeatureType(DEFAULT_WS, storeName, datasetName);
assertTrue("Unpublish() failed", ok);
assertFalse(existsLayer(datasetName));
// remove also datastore
boolean dsRemoved = publisher.removeDatastore(DEFAULT_WS, storeName,false);
assertTrue("removeDatastore() failed", dsRemoved);
}
public void testPublishDeleteStyledShapeZip() throws FileNotFoundException, IOException { public void testPublishDeleteStyledShapeZip() throws FileNotFoundException, IOException {
if (!enabled()) { if (!enabled()) {
return; return;