diff --git a/src/main/java/it/geosolutions/geoserver/rest/GeoServerRESTPublisher.java b/src/main/java/it/geosolutions/geoserver/rest/GeoServerRESTPublisher.java
index 90b00b0..b1cfc11 100644
--- a/src/main/java/it/geosolutions/geoserver/rest/GeoServerRESTPublisher.java
+++ b/src/main/java/it/geosolutions/geoserver/rest/GeoServerRESTPublisher.java
@@ -29,6 +29,7 @@ import it.geosolutions.geoserver.rest.decoder.RESTCoverageStore;
import it.geosolutions.geoserver.rest.decoder.utils.NameLinkElem;
import it.geosolutions.geoserver.rest.encoder.GSLayerEncoder;
import it.geosolutions.geoserver.rest.encoder.GSPostGISDatastoreEncoder;
+import it.geosolutions.geoserver.rest.encoder.GSResourceEncoder;
import it.geosolutions.geoserver.rest.encoder.GSResourceEncoder.ProjectionPolicy;
import it.geosolutions.geoserver.rest.encoder.GSWorkspaceEncoder;
import it.geosolutions.geoserver.rest.encoder.coverage.GSCoverageEncoder;
@@ -53,6 +54,7 @@ import org.apache.log4j.Logger;
* There are no modifiable instance fields, so all the calls are thread-safe.
*
* @author ETj (etj at geo-solutions.it)
+ * @author Carlo Cancellieri - carlo.cancellieri@geo-solutions.it
*/
public class GeoServerRESTPublisher {
@@ -265,7 +267,7 @@ public class GeoServerRESTPublisher {
*
* @throws IllegalArgumentException
* if the sldFile file or name are null or name is empty
- *
+ *
*/
public boolean updateStyle(final File sldFile, final String name)
throws IllegalArgumentException {
@@ -344,121 +346,139 @@ public class GeoServerRESTPublisher {
}
return false;
}
-
- private boolean createDataStore(String workspace, String storeName,
- UploadMethod method, DataStoreExtension extension, String mimeType, URI uri,
- ParameterConfigure configure, NameValuePair... params)
- throws FileNotFoundException, IllegalArgumentException {
- return createStore(workspace, DataStoreType.datastores, storeName, method, extension, mimeType, uri, configure, params);
- }
-
- private boolean createCoverageStore(String workspace, String storeName,
- UploadMethod method, CoverageStoreExtension extension, String mimeType, URI uri,
- ParameterConfigure configure, NameValuePair... params)
- throws FileNotFoundException, IllegalArgumentException {
- return createStore(workspace, DataStoreType.coveragestores, storeName, method, extension, mimeType, uri, configure, params);
- }
- /**
- *
- * @param workspace
- * @param dsType
- * @param storeName
- * @param method
- * @param extension
- * @param mimeType
- * @param uri
- * @param configure
- * @param params
- * @return
- * @throws FileNotFoundException
- * @throws IllegalArgumentException
- */
- private boolean createStore(String workspace, DataStoreType dsType, String storeName, UploadMethod method, Enum extension,
- String mimeType, URI uri, ParameterConfigure configure, NameValuePair... params)
- throws FileNotFoundException, IllegalArgumentException {
- if (workspace==null||dsType==null||storeName==null||method==null|extension==null||mimeType==null||uri==null){
- throw new IllegalArgumentException("Null argument");
- }
- StringBuilder sbUrl = new StringBuilder(restURL)
- .append("/rest/workspaces/").append(workspace)
- .append("/").append(dsType).append("/").append(storeName)
- .append("/").append(method).append(".").append(extension);
-
- if (configure != null) {
- sbUrl.append("?configure=").append(configure);
- if (params != (NameValuePair[]) null
- && !configure.equals(ParameterConfigure.NONE)) {
- final String paramString = appendParameters(params);
- if (!paramString.isEmpty()) {
- sbUrl.append("&").append(paramString);
- }
- }
- }
-
-
- String sentResult =null;
+ private boolean createDataStore(String workspace, String storeName,
+ UploadMethod method, DataStoreExtension extension, String mimeType,
+ URI uri, ParameterConfigure configure, NameValuePair... params)
+ throws FileNotFoundException, IllegalArgumentException {
+ return createStore(workspace, DataStoreType.datastores, storeName,
+ method, extension, mimeType, uri, configure, params);
+ }
- if (method.equals(UploadMethod.file)){
- final File file=new File(uri);
- if (!file.exists())
- throw new FileNotFoundException("unable to locate file: "+file);
- sentResult = HTTPUtils.put(sbUrl.toString(), file, mimeType, gsuser, gspass);
- } else if (method.equals(UploadMethod.external)){
- sentResult = HTTPUtils.put(sbUrl.toString(), uri.toString(), mimeType, gsuser, gspass);
- } else if (method.equals(UploadMethod.url)){
- // TODO check
- sentResult = HTTPUtils.put(sbUrl.toString(), uri.toString(), mimeType, gsuser, gspass);
- }
+ private boolean createCoverageStore(String workspace, String storeName,
+ UploadMethod method, CoverageStoreExtension extension,
+ String mimeType, URI uri, ParameterConfigure configure,
+ NameValuePair... params) throws FileNotFoundException,
+ IllegalArgumentException {
+ return createStore(workspace, DataStoreType.coveragestores, storeName,
+ method, extension, mimeType, uri, configure, params);
+ }
- if (sentResult != null) {
- if (LOGGER.isInfoEnabled())
- LOGGER.info("Store successfully created using ( " + uri + " )");
- return true;
- } else {
- if (LOGGER.isEnabledFor(Level.ERROR))
- LOGGER.error("Error in creating store using: " + uri);
- return false;
- }
+ /**
+ *
+ * @param workspace
+ * @param dsType
+ * @param storeName
+ * @param method
+ * @param extension
+ * @param mimeType
+ * @param uri
+ * @param configure
+ * @param params
+ * @return
+ * @throws FileNotFoundException
+ * @throws IllegalArgumentException
+ */
+ private boolean createStore(String workspace, DataStoreType dsType,
+ String storeName, UploadMethod method, Enum extension,
+ String mimeType, URI uri, ParameterConfigure configure,
+ NameValuePair... params) throws FileNotFoundException,
+ IllegalArgumentException {
+ if (workspace == null || dsType == null || storeName == null
+ || method == null | extension == null || mimeType == null
+ || uri == null) {
+ throw new IllegalArgumentException("Null argument");
+ }
+ StringBuilder sbUrl = new StringBuilder(restURL)
+ .append("/rest/workspaces/").append(workspace).append("/")
+ .append(dsType).append("/").append(storeName).append("/")
+ .append(method).append(".").append(extension);
+
+ if (configure != null) {
+ sbUrl.append("?configure=").append(configure);
+ if (params != (NameValuePair[]) null) {
+ final String paramString = appendParameters(params);
+ if (!paramString.isEmpty()) {
+ sbUrl.append("&").append(paramString);
+ }
+ }
+ }
+
+ String sentResult = null;
+
+ if (method.equals(UploadMethod.file)) {
+ final File file = new File(uri);
+ if (!file.exists())
+ throw new FileNotFoundException("unable to locate file: "
+ + file);
+ sentResult = HTTPUtils.put(sbUrl.toString(), file, mimeType,
+ gsuser, gspass);
+ } else if (method.equals(UploadMethod.external)) {
+ sentResult = HTTPUtils.put(sbUrl.toString(), uri.toString(),
+ mimeType, gsuser, gspass);
+ } else if (method.equals(UploadMethod.url)) {
+ // TODO check
+ sentResult = HTTPUtils.put(sbUrl.toString(), uri.toString(),
+ mimeType, gsuser, gspass);
+ }
+
+ if (sentResult != null) {
+ if (LOGGER.isInfoEnabled())
+ LOGGER.info("Store successfully created using ( " + uri + " )");
+ return true;
+ } else {
+ if (LOGGER.isEnabledFor(Level.ERROR))
+ LOGGER.error("Error in creating store using: " + uri);
+ return false;
+ }
}
- /**
- * A data store is a source of spatial data that is vector based. It can be
- * a file in the case of a Shapefile, a database in the case of PostGIS, or
- * a server in the case of a remote Web Feature Service.
- *
- * A coverage store is a source of spatial data that is raster based.
- *
- * @author Carlo Cancellieri - carlo.cancellieri@geo-solutions.it
- *
- */
- public enum DataStoreType{
- coveragestores,
- datastores
+ /**
+ * A data store is a source of spatial data that is vector based. It can be
+ * a file in the case of a Shapefile, a database in the case of PostGIS, or
+ * a server in the case of a remote Web Feature Service.
+ *
+ * A coverage store is a source of spatial data that is raster based.
+ *
+ * @author Carlo Cancellieri - carlo.cancellieri@geo-solutions.it
+ *
+ */
+ public enum DataStoreType {
+ coveragestores, datastores;
+
+ public static String getTypeName(DataStoreType type) {
+ switch (type) {
+ case coveragestores:
+ return "coverages.xml"; // Format
+ case datastores:
+ return "featuretypes.xml";
+ default:
+ return "coverages.xml";
+ }
+ }
}
- /**
- * The file, url, and external endpoints are used to specify the method that
- * is used to upload the file.
- *
- * The file method is used to directly upload a file from a local source.
- * The body of the request is the file itself.
- *
- * The url method is used to indirectly upload a file from an remote source.
- * The body of the request is a url pointing to the file to upload. This url
- * must be visible from the server.
- *
- * The external method is used to forgo upload and use an existing file on
- * the server. The body of the request is the absolute path to the existing
- * file.
- *
- * @author Carlo Cancellieri - carlo.cancellieri@geo-solutions.it
- *
- */
+
+ /**
+ * The file, url, and external endpoints are used to specify the method that
+ * is used to upload the file.
+ *
+ * The file method is used to directly upload a file from a local source.
+ * The body of the request is the file itself.
+ *
+ * The url method is used to indirectly upload a file from an remote source.
+ * The body of the request is a url pointing to the file to upload. This url
+ * must be visible from the server.
+ *
+ * The external method is used to forgo upload and use an existing file on
+ * the server. The body of the request is the absolute path to the existing
+ * file.
+ *
+ * @author Carlo Cancellieri - carlo.cancellieri@geo-solutions.it
+ *
+ */
public enum UploadMethod {
- file,
- url,
- external
+ file, url, external
}
// ==========================================================================
@@ -494,21 +514,112 @@ public class GeoServerRESTPublisher {
/**
* Publish a zipped shapefile.
- * The CRS will be forced to EPSG:4326.
+ * The defaultCRS will be set to EPSG:4326.
+ *
+ * @see {@link #publishShp(String, String, NameValuePair[], String, UploadMethod, URI, String, ProjectionPolicy, String)}
*
* @param workspace
* @param storename
* @param layername
* @param zipFile
* @return true if the operation completed successfully.
- * @throws FileNotFoundException
+ * @throws FileNotFoundException, IllegalArgumentException
*/
public boolean publishShp(String workspace, String storename,
- String layername, File zipFile) throws FileNotFoundException {
- return publishShp(workspace, storename, layername, zipFile, "EPSG:4326");
+ String datasetname, File zipFile) throws FileNotFoundException, IllegalArgumentException {
+ return publishShp(workspace, storename, new NameValuePair[0], datasetname,UploadMethod.file, zipFile.toURI(), "EPSG:4326", ProjectionPolicy.NONE,null);
}
/**
+ *
+ * Publish a shapefile.
+ *
+ * @param workspace
+ * the name of the workspace to use
+ * @param storename
+ * the name of the store to create
+ * @param storeParams
+ * parameters to append to the url (can be null).
+ * Accepted parameters are:
+ *
* These are the equivalent calls with cUrl:
*
@@ -559,21 +658,20 @@ public class GeoServerRESTPublisher {
* }
*
*
- * {@link #publishShp(String, String, String, File, String, NameValuePair...)}
- *
* @return true if the operation completed successfully.
*/
public boolean publishShp(String workspace, String storename,
String layername, File zipFile, String srs)
throws FileNotFoundException {
- return publishShp(workspace, storename, layername, zipFile, srs,
- new NameValuePair[0]);
+ return publishShp(workspace, storename, (NameValuePair[])null, layername, UploadMethod.file, zipFile.toURI(), srs, ProjectionPolicy.NONE,null);
}
/**
*
* Publish a zipped shapefile.
*
+ * @see {@link #publishShp(String, String, NameValuePair[], String, UploadMethod, URI, String, ProjectionPolicy, String)}
+ *
* http://docs.geoserver.org/stable/en/user
* /restconfig/rest-config-examples/rest-
* config-examples-curl.html#uploading-a-shapefile
@@ -595,63 +693,13 @@ public class GeoServerRESTPublisher {
*
* This is an example with cUrl: * @@ -835,142 +884,134 @@ public class GeoServerRESTPublisher { CoverageStoreExtension extension, String mimeType, File file, ParameterConfigure configure, NameValuePair... params) throws FileNotFoundException { - return createCoverageStore(workspace, coveragestore, UploadMethod.file, extension, mimeType, file.toURI(), configure, params); -// // build full URL -// StringBuilder sbUrl = new StringBuilder(restURL) -// .append("/rest/workspaces/").append(workspace) -// .append("/coveragestores/").append(coveragestore) -// .append("/file.").append(format); -// -// if (configure != null) { -// sbUrl.append("?configure=").append(configure); -// if (params != (NameValuePair[]) null -// && !configure.equals(ParameterConfigure.NONE)) { -// final String paramString = appendParameters(params); -// if (!paramString.isEmpty()) { -// sbUrl.append("&").append(paramString); -// } -// } -// } -// String sentResult = HTTPUtils.put(sbUrl.toString(), file, mimeType, -// gsuser, gspass); -// boolean fileSent = sentResult != null; -// -// if (fileSent) { -// if (LOGGER.isInfoEnabled()) -// LOGGER.info("File successfully uploaded ( " + file + ")"); -// } else { -// if (LOGGER.isEnabledFor(Level.WARN)) -// LOGGER.warn("Error in sending file " + file); -// } -// return fileSent; + return createCoverageStore(workspace, coveragestore, UploadMethod.file, + extension, mimeType, file.toURI(), configure, params); } - - /** - * - * The extension parameter specifies the type of data being uploaded. The - * following extensions are supported: - *
- * Here is an example call with cUrl: - * - *
- * {@code
- * curl -u admin:geoserver -XPUT -H 'Content-type: application/zip' \
- *
- * --data-binary @$ZIPFILE \
- *
- * http://$GSIP:$GSPORT/$SERVLET/rest/workspaces/$WORKSPACE/coveragestores/$COVERAGESTORE/file.worldimage
- *
- *
- * @param workspace
- * Workspace to use
- * @param coveragestore
- * Name of the coveragestore
- * @param file
- * file to upload
- * @param configure
- * Configure parameter. It may be null.
- * @param update
- * Accepted parameters are:
- * + * Here is an example call with cUrl: + * + *
+ * {@code
+ * curl -u admin:geoserver -XPUT -H 'Content-type: application/zip' \
+ *
+ * --data-binary @$ZIPFILE \
+ *
+ * http://$GSIP:$GSPORT/$SERVLET/rest/workspaces/$WORKSPACE/coveragestores/$COVERAGESTORE/file.worldimage
+ *
+ *
+ * @param workspace
+ * Workspace to use
+ * @param coveragestore
+ * Name of the coveragestore
+ * @param file
+ * file to upload
+ * @param configure
+ * Configure parameter. It may be null.
+ * @param update
+ * Accepted parameters are:
+ * - * This is the equivalent call with cUrl: - * - *
- * {@code
- * curl -u admin:geoserver -XPUT -H 'Content-type: text' -d "file:$FULLPATH" \
- * http://$GSIP:$GSPORT/$SERVLET/rest/workspaces/$WORKSPACE/coveragestores/$STORENAME/external.geotiff
- * }
- *
- *
- * @param workspace Workspace to use
- * @param storeName Name of the coveragestore (if null the file name will be used)
- * @param coverageName the name of the coverage (if null the file name will be used)
- * @param geotiff file to upload
- * @return true if the operation completed successfully.
- * @throws FileNotFoundException if file does not exists
- * @throws IllegalArgumentException if workspace or geotiff are null
- */
- public boolean publishGeoTIFF(final String workspace, final String storeName, final String coverageName,
- final File geotiff) throws FileNotFoundException, IllegalArgumentException {
- if (workspace==null || geotiff==null)
- throw new IllegalArgumentException("Unable to proceed, some arguments are null");
-
- return publishCoverage(workspace, (storeName!=null)?storeName:FilenameUtils.getBaseName(geotiff.getAbsolutePath()), CoverageStoreExtension.geotiff,
- "image/geotiff", geotiff, ParameterConfigure.FIRST,
- (coverageName!=null)?new NameValuePair[]{new NameValuePair("coverageName", coverageName)}:(NameValuePair[]) null);
- }
- /**
- *
- * Publish a GeoTiff already in a filesystem readable by GeoServer.
- *
- * @param workspace
- * an existing workspace
- * @param storeName
- * the coverageStore to be created
- * @param geotiff
- * the geoTiff to be published
- * @param srs
- * @param policy
- * @param defaultStyle
- * @return
- * @throws FileNotFoundException
- */
- public boolean publishExternalGeoTIFF(String workspace,
- String storeName, File geotiff, String coverageName, String srs, ProjectionPolicy policy, String defaultStyle)
- throws FileNotFoundException, IllegalArgumentException {
- if (workspace==null || storeName==null || geotiff==null || coverageName==null || srs==null || policy==null || defaultStyle==null)
- throw new IllegalArgumentException("Unable to run: null parameter");
-
- // config coverage props (srs)
- final GSCoverageEncoder coverageEncoder = new GSCoverageEncoder();
- coverageEncoder.setName(coverageName);
- coverageEncoder.setSRS(srs);
- coverageEncoder.setProjectionPolicy(policy);
-
- // config layer props (style, ...)
- final GSLayerEncoder layerEncoder = new GSLayerEncoder();
- layerEncoder.setDefaultStyle(defaultStyle);
-
- return publishExternalGeoTIFF(workspace, storeName, geotiff, coverageEncoder, layerEncoder)!=null?true:false;
- }
-
-// /**
-// *
-// * @param workspace
-// * @param storeName
-// * @param geotiff
-// * @param srs
-// * @param defaultStyle
-// * @return
-// * @throws FileNotFoundException
-// * @deprecated
-// */
-// public RESTCoverageStore publishExternalGeoTIFF(String workspace,
-// String storeName, File geotiff, String srs, String defaultStyle)
-// throws FileNotFoundException {
-//
-// if (publishExternalGeoTIFF(workspace, storeName, geotiff, storeName, srs,ProjectionPolicy.FORCE_DECLARED,defaultStyle)){
-// GeoServerRESTReader reader=new GeoServerRESTReader(this.restURL, this.gsuser, this.gspass);
-// return reader.getCoverageStore(workspace, storeName);
-// }
-// return null;
-// }
-
- /**
- * Publish a GeoTiff already in a filesystem readable by GeoServer.
- *
- * @param workspace
- * an existing workspace
- * @param storeName
- * the coverageStore to be created
- * @param geotiff
- * the geoTiff to be published
- * @param coverageEncoder
- * @param layerEncoder
- * @return true if successfully configured
- *
- *
- * @throws FileNotFoundException
- * @throws IllegalArgumentException if null parameter
- */
- public RESTCoverageStore publishExternalGeoTIFF(final String workspace, final String storeName, final File geotiff, final GSCoverageEncoder coverageEncoder,final GSLayerEncoder layerEncoder)
- throws IllegalArgumentException, FileNotFoundException {
-
- if (workspace==null || geotiff==null || storeName==null || layerEncoder==null || coverageEncoder==null)
- throw new IllegalArgumentException("Unable to run: null parameter");
-
- final String coverageName=coverageEncoder.getName();
- if (coverageName.isEmpty()){
- throw new IllegalArgumentException("Unable to run: empty coverage store name");
- }
-
- // create store
- final boolean store=publishExternalCoverage(workspace, storeName, CoverageStoreExtension.geotiff, "text/plain", geotiff, ParameterConfigure.NONE, ParameterUpdate.OVERWRITE);
- if (!store) {
- return null;
- }
-
- // create Coverage Store
- if (!createCoverage(workspace, storeName, coverageEncoder)) {
- if (LOGGER.isEnabledFor(Level.ERROR))
- LOGGER.error("Unable to create a coverage for the store:"+ coverageName);
- return null;
- }
-
- // create Layer
- if (configureLayer(workspace, coverageName, layerEncoder)){
- GeoServerRESTReader reader;
- try {
- reader = new GeoServerRESTReader(this.restURL, this.gsuser, this.gspass);
- return reader.getCoverageStore(workspace, storeName);
- } catch (MalformedURLException e) {
- LOGGER.log(Level.ERROR, e.getMessage(), e);
- }
- }
- return null;
- }
+ /**
+ * Publish a GeoTiff. Simple wrapper for
+ * {@link #publishCoverage(String, String, CoverageStoreExtension, String, File, ParameterConfigure, NameValuePair...)}
+ * + * This is the equivalent call with cUrl: + * + *
+ * {@code
+ * curl -u admin:geoserver -XPUT -H 'Content-type: text' -d "file:$FULLPATH" \
+ * http://$GSIP:$GSPORT/$SERVLET/rest/workspaces/$WORKSPACE/coveragestores/$STORENAME/external.geotiff
+ * }
+ *
+ *
+ * @param workspace
+ * Workspace to use
+ * @param storeName
+ * Name of the coveragestore (if null the file name will be used)
+ * @param coverageName
+ * the name of the coverage (if null the file name will be used)
+ * @param geotiff
+ * file to upload
+ * @return true if the operation completed successfully.
+ * @throws FileNotFoundException
+ * if file does not exists
+ * @throws IllegalArgumentException
+ * if workspace or geotiff are null
+ */
+ public boolean publishGeoTIFF(final String workspace,
+ final String storeName, final String coverageName,
+ final File geotiff) throws FileNotFoundException,
+ IllegalArgumentException {
+ if (workspace == null || geotiff == null)
+ throw new IllegalArgumentException(
+ "Unable to proceed, some arguments are null");
+
+ return publishCoverage(
+ workspace,
+ (storeName != null) ? storeName : FilenameUtils
+ .getBaseName(geotiff.getAbsolutePath()),
+ CoverageStoreExtension.geotiff,
+ "image/geotiff",
+ geotiff,
+ ParameterConfigure.FIRST,
+ (coverageName != null) ? new NameValuePair[] { new NameValuePair(
+ "coverageName", coverageName) }
+ : (NameValuePair[]) null);
+ }
+
+ /**
+ * @see {@link #publishExternalGeoTIFF(String, String, File, String, String, ProjectionPolicy, String)}
+ * @param workspace
+ * @param storeName
+ * @param resourceName
+ * @param geotiff
+ * @param srs
+ * @param policy
+ * @param defaultStyle
+ * @return
+ * @throws FileNotFoundException
+ * @throws IllegalArgumentException
+ */
+ public boolean publishGeoTIFF(String workspace, String storeName,
+ String resourceName, File geotiff, String srs,
+ ProjectionPolicy policy, String defaultStyle)
+ throws FileNotFoundException, IllegalArgumentException {
+ if (workspace == null || storeName == null || geotiff == null
+ || resourceName == null || srs == null || policy == null
+ || defaultStyle == null)
+ throw new IllegalArgumentException("Unable to run: null parameter");
+
+ if (!createCoverageStore(workspace, (storeName != null) ? storeName
+ : FilenameUtils.getBaseName(geotiff.getAbsolutePath()),
+ UploadMethod.file, CoverageStoreExtension.geotiff,
+ "image/geotiff", geotiff.toURI(), ParameterConfigure.NONE,
+ (NameValuePair[]) null)) {
+ LOGGER.error("Unable to create coverage store for coverage: "
+ + geotiff);
+ return false;
+ }
+
+ // config coverage props (srs)
+ final GSCoverageEncoder coverageEncoder = new GSCoverageEncoder();
+ coverageEncoder.setName(resourceName);
+ coverageEncoder.setSRS(srs);
+ coverageEncoder.setProjectionPolicy(policy);
+
+ if (!createCoverage(workspace, storeName, coverageEncoder)) {
+ LOGGER.error("Unable to create a coverage store for coverage: "
+ + geotiff);
+ return false;
+ }
+
+ // config layer props (style, ...)
+ final GSLayerEncoder layerEncoder = new GSLayerEncoder();
+ layerEncoder.setDefaultStyle(defaultStyle);
+
+ return configureLayer(workspace, resourceName, layerEncoder);
+ }
+
+ /**
+ *
+ * Publish a GeoTiff already in a filesystem readable by GeoServer.
+ *
+ * @param workspace
+ * an existing workspace
+ * @param storeName
+ * the coverageStore to be created
+ * @param geotiff
+ * the geoTiff to be published
+ * @param srs
+ * @param policy
+ * @param defaultStyle
+ * @return
+ * @throws FileNotFoundException
+ */
+ public boolean publishExternalGeoTIFF(String workspace, String storeName,
+ File geotiff, String coverageName, String srs,
+ ProjectionPolicy policy, String defaultStyle)
+ throws FileNotFoundException, IllegalArgumentException {
+ if (workspace == null || storeName == null || geotiff == null
+ || coverageName == null || srs == null || policy == null
+ || defaultStyle == null)
+ throw new IllegalArgumentException("Unable to run: null parameter");
+
+ // config coverage props (srs)
+ final GSCoverageEncoder coverageEncoder = new GSCoverageEncoder();
+ coverageEncoder.setName(coverageName);
+ coverageEncoder.setSRS(srs);
+ coverageEncoder.setProjectionPolicy(policy);
+
+ // config layer props (style, ...)
+ final GSLayerEncoder layerEncoder = new GSLayerEncoder();
+ layerEncoder.setDefaultStyle(defaultStyle);
+
+ return publishExternalGeoTIFF(workspace, storeName, geotiff,
+ coverageEncoder, layerEncoder) != null ? true : false;
+ }
+
+ /**
+ * Publish a GeoTiff already in a filesystem readable by GeoServer.
+ *
+ * @param workspace
+ * an existing workspace
+ * @param storeName
+ * the coverageStore to be created
+ * @param geotiff
+ * the geoTiff to be published
+ * @param coverageEncoder
+ * @param layerEncoder
+ * @return true if successfully configured
+ *
+ *
+ * @throws FileNotFoundException
+ * @throws IllegalArgumentException
+ * if null parameter
+ */
+ public RESTCoverageStore publishExternalGeoTIFF(final String workspace,
+ final String storeName, final File geotiff,
+ final GSCoverageEncoder coverageEncoder,
+ final GSLayerEncoder layerEncoder) throws IllegalArgumentException,
+ FileNotFoundException {
+
+ if (workspace == null || geotiff == null || storeName == null
+ || layerEncoder == null || coverageEncoder == null)
+ throw new IllegalArgumentException("Unable to run: null parameter");
+
+ final String coverageName = coverageEncoder.getName();
+ if (coverageName.isEmpty()) {
+ throw new IllegalArgumentException(
+ "Unable to run: empty coverage store name");
+ }
+
+ // create store
+ final boolean store = publishExternalCoverage(workspace, storeName,
+ CoverageStoreExtension.geotiff, "text/plain", geotiff,
+ ParameterConfigure.NONE, ParameterUpdate.OVERWRITE);
+ if (!store) {
+ return null;
+ }
+
+ // create Coverage Store
+ if (!createCoverage(workspace, storeName, coverageEncoder)) {
+ if (LOGGER.isEnabledFor(Level.ERROR))
+ LOGGER.error("Unable to create a coverage for the store:"
+ + coverageName);
+ return null;
+ }
+
+ // create Layer
+ if (configureLayer(workspace, coverageName, layerEncoder)) {
+ GeoServerRESTReader reader;
+ try {
+ reader = new GeoServerRESTReader(this.restURL, this.gsuser,
+ this.gspass);
+ return reader.getCoverageStore(workspace, storeName);
+ } catch (MalformedURLException e) {
+ LOGGER.log(Level.ERROR, e.getMessage(), e);
+ }
+ }
+ return null;
+ }
// ==========================================================================
// === WORLDIMAGE
@@ -1179,8 +1280,9 @@ public class GeoServerRESTPublisher {
public boolean publishWorldImage(String workspace, String coveragestore,
File zipFile, ParameterConfigure configure, NameValuePair... params)
throws FileNotFoundException {
- return publishCoverage(workspace, coveragestore, CoverageStoreExtension.worldimage,
- "application/zip", zipFile, configure, params);
+ return publishCoverage(workspace, coveragestore,
+ CoverageStoreExtension.worldimage, "application/zip", zipFile,
+ configure, params);
}
// ==========================================================================
@@ -1194,9 +1296,9 @@ public class GeoServerRESTPublisher {
*/
public boolean publishImageMosaic(String workspace, String storeName,
File zipFile) throws FileNotFoundException {
- return publishCoverage(workspace, storeName, CoverageStoreExtension.imagemosaic,
- "application/zip", zipFile, ParameterConfigure.FIRST,
- (NameValuePair[]) null);
+ return publishCoverage(workspace, storeName,
+ CoverageStoreExtension.imagemosaic, "application/zip", zipFile,
+ ParameterConfigure.FIRST, (NameValuePair[]) null);
}
/**
@@ -1207,8 +1309,9 @@ public class GeoServerRESTPublisher {
public boolean publishImageMosaic(String workspace, String storeName,
File zipFile, ParameterConfigure configure, NameValuePair... params)
throws FileNotFoundException {
- return publishCoverage(workspace, storeName, CoverageStoreExtension.imagemosaic,
- "application/zip", zipFile, configure, params);
+ return publishCoverage(workspace, storeName,
+ CoverageStoreExtension.imagemosaic, "application/zip", zipFile,
+ configure, params);
}
/**
@@ -1255,22 +1358,6 @@ public class GeoServerRESTPublisher {
return RESTCoverageStore.build(sendResult);
}
- /**
- * @deprecated provided for backward compatibility use {@link
- * createExternaMosaicDatastore(String workspace, String
- * storeName, File mosaicDir, CoverageConfigure configure)}
- * @param workspace
- * @param storeName
- * @param mosaicDir
- * @return
- * @throws FileNotFoundException
- */
-// public RESTCoverageStore configureExternaMosaicDatastore(String workspace,
-// String storeName, File mosaicDir) throws FileNotFoundException {
-// return createExternaMosaicDatastore(workspace, storeName, mosaicDir,
-// ParameterConfigure.FIRST, ParameterUpdate.APPEND);
-// }
-
/**
* Publish a Mosaic already in a filesystem readable by GeoServer.
*
@@ -1294,25 +1381,26 @@ public class GeoServerRESTPublisher {
*
* @throws FileNotFoundException
*/
- public boolean publishExternalMosaic(String workspace,
- String storeName, File mosaicDir, String srs, String defaultStyle)
+ public boolean publishExternalMosaic(String workspace, String storeName,
+ File mosaicDir, String srs, String defaultStyle)
throws FileNotFoundException {
-
+
final GSCoverageEncoder coverageEncoder = new GSCoverageEncoder();
coverageEncoder.setSRS(srs);
- final String name=FilenameUtils.getBaseName(mosaicDir.getName());
+ final String name = FilenameUtils.getBaseName(mosaicDir.getName());
coverageEncoder.setName(name);
-
+
final GSLayerEncoder layerEncoder = new GSLayerEncoder();
layerEncoder.setDefaultStyle(defaultStyle);
- return publishExternalMosaic(workspace, storeName, mosaicDir, coverageEncoder, layerEncoder);
+ return publishExternalMosaic(workspace, storeName, mosaicDir,
+ coverageEncoder, layerEncoder);
}
-
/**
- * @deprecated use {@link #publishExternalMosaic(String workspace, final String storeName, File mosaicDir, GSCoverageEncoder coverageEncoder,
- GSLayerEncoder layerEncoder)}
+ * @deprecated use {@link #publishExternalMosaic(String workspace, final
+ * String storeName, File mosaicDir, GSCoverageEncoder
+ * coverageEncoder, GSLayerEncoder layerEncoder)}
* @param workspace
* @param storeName
* @param mosaicDir
@@ -1322,9 +1410,10 @@ public class GeoServerRESTPublisher {
* @throws FileNotFoundException
*/
public boolean createExternalMosaic(String workspace, String storeName,
- File mosaicDir, GSCoverageEncoder coverageEncoder,
- GSLayerEncoder layerEncoder) throws FileNotFoundException {
- return publishExternalMosaic(workspace, storeName, mosaicDir, coverageEncoder, layerEncoder);
+ File mosaicDir, GSCoverageEncoder coverageEncoder,
+ GSLayerEncoder layerEncoder) throws FileNotFoundException {
+ return publishExternalMosaic(workspace, storeName, mosaicDir,
+ coverageEncoder, layerEncoder);
}
/**
@@ -1351,37 +1440,43 @@ public class GeoServerRESTPublisher {
*
* @throws FileNotFoundException
*/
- public boolean publishExternalMosaic(String workspace, final String storeName, File mosaicDir, GSCoverageEncoder coverageEncoder,
- GSLayerEncoder layerEncoder) throws FileNotFoundException,IllegalArgumentException {
+ public boolean publishExternalMosaic(String workspace,
+ final String storeName, File mosaicDir,
+ GSCoverageEncoder coverageEncoder, GSLayerEncoder layerEncoder)
+ throws FileNotFoundException, IllegalArgumentException {
if (coverageEncoder == null) {
- throw new IllegalArgumentException("no coverageEncoder provided for mosaic " + mosaicDir);
+ throw new IllegalArgumentException(
+ "no coverageEncoder provided for mosaic " + mosaicDir);
}
- // override name to match the FIRST configured coverage
- String coverageName=coverageEncoder.getName();
+ // override name to match the FIRST configured coverage
+ String coverageName = coverageEncoder.getName();
if (layerEncoder == null) {
- throw new IllegalArgumentException("no layerEncoder provided for " + workspace + ":"
- + coverageName);
+ throw new IllegalArgumentException("no layerEncoder provided for "
+ + workspace + ":" + coverageName);
}
- RESTCoverageStore store = createExternaMosaicDatastore(workspace, storeName, mosaicDir, ParameterConfigure.NONE,
- ParameterUpdate.OVERWRITE);
+ RESTCoverageStore store = createExternaMosaicDatastore(workspace,
+ storeName, mosaicDir, ParameterConfigure.NONE,
+ ParameterUpdate.OVERWRITE);
if (store == null) {
- return false;
+ return false;
}
- if (!createCoverage(workspace, storeName, coverageEncoder)) {
- if (LOGGER.isEnabledFor(Level.ERROR))
- LOGGER.error("Unable to create a coverage for the store:" + coverageName);
- return false;
- }
- if (!configureLayer(workspace, coverageName, layerEncoder)) {
- if (LOGGER.isEnabledFor(Level.ERROR))
- LOGGER.error("Unable to configure the Layer for the coverage:" + coverageName);
- return false;
- }
- return true;
+ if (!createCoverage(workspace, storeName, coverageEncoder)) {
+ if (LOGGER.isEnabledFor(Level.ERROR))
+ LOGGER.error("Unable to create a coverage for the store:"
+ + coverageName);
+ return false;
+ }
+ if (!configureLayer(workspace, coverageName, layerEncoder)) {
+ if (LOGGER.isEnabledFor(Level.ERROR))
+ LOGGER.error("Unable to configure the Layer for the coverage:"
+ + coverageName);
+ return false;
+ }
+ return true;
}
// ==========================================================================
@@ -1825,42 +1920,48 @@ public class GeoServerRESTPublisher {
/**
* Allows to configure some layer attributes such and DefaultStyle
- *
+ *
* @param workspace
- * @param resourceName the name of the resource to use (featureStore or coverageStore name)
- * @param layer the layer encoder used to configure the layer
+ * @param resourceName
+ * the name of the resource to use (featureStore or coverageStore
+ * name)
+ * @param layer
+ * the layer encoder used to configure the layer
* @return true if success
- * @throws IllegalArgumentException if some arguments are null or empty
- *
- * @TODO WmsPath
- */
+ * @throws IllegalArgumentException
+ * if some arguments are null or empty
+ *
+ * @TODO WmsPath
+ */
public boolean configureLayer(final String workspace,
- final String resourceName, final GSLayerEncoder layer) throws IllegalArgumentException {
-
- if (workspace == null || resourceName == null || layer == null) {
- throw new IllegalArgumentException("Null argument");
- }
- // TODO: check this usecase, layer should always be defined
- if (workspace.isEmpty() || resourceName.isEmpty() || layer.isEmpty()) {
- throw new IllegalArgumentException("Empty argument");
- }
-
- final String fqLayerName = workspace + ":" + resourceName;
-
- final String url = restURL + "/rest/layers/" + fqLayerName;
-
- String layerXml = layer.toString();
- String sendResult = HTTPUtils.putXml(url, layerXml, gsuser, gspass);
- if (sendResult != null) {
- if (LOGGER.isInfoEnabled()) {
- LOGGER.info("Layer successfully configured: " + fqLayerName);
- }
- } else {
- if (LOGGER.isEnabledFor(Level.WARN))
- LOGGER.warn("Error configuring layer " + fqLayerName + " (" + sendResult + ")");
- }
-
- return sendResult != null;
+ final String resourceName, final GSLayerEncoder layer)
+ throws IllegalArgumentException {
+
+ if (workspace == null || resourceName == null || layer == null) {
+ throw new IllegalArgumentException("Null argument");
+ }
+ // TODO: check this usecase, layer should always be defined
+ if (workspace.isEmpty() || resourceName.isEmpty() || layer.isEmpty()) {
+ throw new IllegalArgumentException("Empty argument");
+ }
+
+ final String fqLayerName = workspace + ":" + resourceName;
+
+ final String url = restURL + "/rest/layers/" + fqLayerName;
+
+ String layerXml = layer.toString();
+ String sendResult = HTTPUtils.putXml(url, layerXml, gsuser, gspass);
+ if (sendResult != null) {
+ if (LOGGER.isInfoEnabled()) {
+ LOGGER.info("Layer successfully configured: " + fqLayerName);
+ }
+ } else {
+ if (LOGGER.isEnabledFor(Level.WARN))
+ LOGGER.warn("Error configuring layer " + fqLayerName + " ("
+ + sendResult + ")");
+ }
+
+ return sendResult != null;
}
/**
@@ -1936,60 +2037,102 @@ public class GeoServerRESTPublisher {
return sendResult != null;
}
-
+
/**
- * @deprecated use {@link #createCoverage(String, String, GSCoverageEncoder)}
+ * @deprecated use
+ * {@link #createCoverage(String, String, GSCoverageEncoder)}
* @param ce
* @param wsname
* @param csname
* @return
*/
- public boolean createCoverage(final GSCoverageEncoder ce, final String wsname, final String csname) {
- return createCoverage(wsname, csname, ce);
+ public boolean createCoverage(final GSCoverageEncoder ce,
+ final String wsname, final String csname) {
+ return createCoverage(wsname, csname, ce);
}
-
+
/**
- * Create a new coverage in a given workspace and coverage store
+ * Create a new coverage in a given workspace and coverage store
+ *
* @param wsname
- * the workspace to search for existent coverage
+ * the workspace to search for existent coverage
* @param storeName
- * an existent store name to use as data source
+ * an existent store name to use as data source
* @param ce
- * contains the coverage name to create and the configuration to
- * apply
+ * contains the coverage name to create and the configuration to
+ * apply
* @return true if success
- * @throws IllegalArgumentException if arguments are null or empty
+ * @throws IllegalArgumentException
+ * if arguments are null or empty
*/
- public boolean createCoverage(final String wsname, final String storeName, final GSCoverageEncoder ce)
- throws IllegalArgumentException {
-
- if (wsname.isEmpty() || wsname==null || ce == null || ce.isEmpty()) {
- throw new IllegalArgumentException(
- "Unable to configure a coverage with null or empty arguments");
- }
- final String coverageName = ce.getName();
- if (coverageName == null) {
- throw new IllegalArgumentException("Unable to configure a coverage with unnamed coverage encoder");
- }
-
- // configure the selected coverage
- final String url = restURL + "/rest/workspaces/" + wsname + "/coveragestores/" + storeName
- + "/coverages.xml";
-
- final String xmlBody = ce.toString();
- final String sendResult = HTTPUtils.postXml(url, xmlBody, gsuser, gspass);
- if (sendResult != null) {
- if (LOGGER.isDebugEnabled()) {
- LOGGER.debug("Coverage successfully created " + wsname + ":" + storeName + ":" + coverageName);
- }
- } else {
- if (LOGGER.isEnabledFor(Level.WARN))
- LOGGER.warn("Error creating coverage " + wsname + ":" + storeName + ":" + coverageName + " ("
- + sendResult + ")");
- }
-
- return sendResult != null;
- }
+ public boolean createCoverage(final String wsname, final String storeName,
+ final GSCoverageEncoder ce) throws IllegalArgumentException {
+ return createResource(wsname, DataStoreType.coveragestores, storeName,
+ ce);
+ }
+
+ /**
+ * Create a new resource in a given workspace and store
+ *
+ * @param wsname
+ * the workspace to search for existent coverage
+ * @param storeName
+ * an existent store name to use as data source
+ * @param re
+ * contains the coverage name to create and the configuration to
+ * apply
+ *
+ * @TODO For FeatureType: The list parameter is used to control the category
+ * of feature types that are returned. It can take one of the three
+ * values configured, available, or all.
+ *
+ * configured - Only setup or configured feature types are returned.
+ * This is the default value. available - Only unconfigured feature
+ * types (not yet setup) but are available from the specified
+ * datastore will be returned. available_with_geom - Same as available
+ * but only includes feature types that have a geometry attribute. all
+ * - The union of configured and available.
+ *
+ *
+ * @return true if success
+ * @throws IllegalArgumentException
+ * if arguments are null or empty
+ */
+ private boolean createResource(String workspace, DataStoreType dsType,
+ String storeName, GSResourceEncoder re)
+ throws IllegalArgumentException {
+ if (workspace == null || dsType == null || storeName == null
+ || re == null) {
+ throw new IllegalArgumentException("Null argument");
+ }
+ StringBuilder sbUrl = new StringBuilder(restURL)
+ .append("/rest/workspaces/").append(workspace).append("/")
+ .append(dsType).append("/").append(storeName).append("/")
+ .append(DataStoreType.getTypeName(dsType));
+
+ final String resourceName = re.getName();
+ if (resourceName == null) {
+ throw new IllegalArgumentException(
+ "Unable to configure a coverage using unnamed coverage encoder");
+ }
+
+ final String xmlBody = re.toString();
+ final String sendResult = HTTPUtils.postXml(sbUrl.toString(), xmlBody,
+ gsuser, gspass);
+ if (sendResult != null) {
+ if (LOGGER.isDebugEnabled()) {
+ LOGGER.debug(dsType + " successfully created " + workspace
+ + ":" + storeName + ":" + resourceName);
+ }
+ } else {
+ if (LOGGER.isEnabledFor(Level.ERROR))
+ LOGGER.error("Error creating coverage " + workspace + ":"
+ + storeName + ":" + resourceName + " (" + sendResult
+ + ")");
+ }
+
+ return sendResult != null;
+ }
/**
*
diff --git a/src/main/java/it/geosolutions/geoserver/rest/encoder/GSPostGISDatastoreEncoder.java b/src/main/java/it/geosolutions/geoserver/rest/encoder/GSPostGISDatastoreEncoder.java
index 5f9e28d..1db6613 100644
--- a/src/main/java/it/geosolutions/geoserver/rest/encoder/GSPostGISDatastoreEncoder.java
+++ b/src/main/java/it/geosolutions/geoserver/rest/encoder/GSPostGISDatastoreEncoder.java
@@ -70,10 +70,7 @@ public class GSPostGISDatastoreEncoder extends PropertyXMLEncoder {
setMaxOpenPreparedStatements(50);
}
- /**
- * @deprecated will be set to protected in the next release
- */
- public void addName(String name) {
+ protected void addName(String name) {
add("name", name);
}
@@ -81,10 +78,7 @@ public class GSPostGISDatastoreEncoder extends PropertyXMLEncoder {
set("name", name);
}
- /**
- * @deprecated will be set to protected in the next release
- */
- public void addDescription(String description) {
+ protected void addDescription(String description) {
add("description", description);
}
@@ -92,10 +86,7 @@ public class GSPostGISDatastoreEncoder extends PropertyXMLEncoder {
set("description", description);
}
- /**
- * @deprecated will be set to protected in the next release
- */
- public void addType(String type) {
+ protected void addType(String type) {
add("type", type);
}
@@ -103,10 +94,7 @@ public class GSPostGISDatastoreEncoder extends PropertyXMLEncoder {
set("type", type);
}
- /**
- * @deprecated will be set to protected in the next release
- */
- public void addEnabled(boolean enabled) {
+ protected void addEnabled(boolean enabled) {
add("enabled", Boolean.toString(enabled));
}
@@ -114,10 +102,7 @@ public class GSPostGISDatastoreEncoder extends PropertyXMLEncoder {
set("enabled", Boolean.toString(enabled));
}
- /**
- * @deprecated will be set to protected in the next release
- */
- public void addNamespace(String namespace) {
+ protected void addNamespace(String namespace) {
connectionParameters.add("namespace", namespace);
}
@@ -125,10 +110,7 @@ public class GSPostGISDatastoreEncoder extends PropertyXMLEncoder {
connectionParameters.set("namespace", namespace);
}
- /**
- * @deprecated will be set to protected in the next release
- */
- public void addHost(String host) {
+ protected void addHost(String host) {
connectionParameters.add("host", host);
}
@@ -136,10 +118,7 @@ public class GSPostGISDatastoreEncoder extends PropertyXMLEncoder {
connectionParameters.set("host", host);
}
- /**
- * @deprecated will be set to protected in the next release
- */
- public void addPort(int port) {
+ protected void addPort(int port) {
connectionParameters.add("port", Integer.toString(port));
}
@@ -147,10 +126,7 @@ public class GSPostGISDatastoreEncoder extends PropertyXMLEncoder {
connectionParameters.set("port", Integer.toString(port));
}
- /**
- * @deprecated will be set to protected in the next release
- */
- public void addDatabase(String database) {
+ protected void addDatabase(String database) {
connectionParameters.add("database", database);
}
@@ -158,10 +134,7 @@ public class GSPostGISDatastoreEncoder extends PropertyXMLEncoder {
connectionParameters.set("database", database);
}
- /**
- * @deprecated will be set to protected in the next release
- */
- public void addSchema(String schema) {
+ protected void addSchema(String schema) {
connectionParameters.add("schema", schema);
}
@@ -169,10 +142,7 @@ public class GSPostGISDatastoreEncoder extends PropertyXMLEncoder {
connectionParameters.set("schema", schema);
}
- /**
- * @deprecated will be set to protected in the next release
- */
- public void addUser(String user) {
+ protected void addUser(String user) {
connectionParameters.add("user", user);
}
@@ -180,10 +150,7 @@ public class GSPostGISDatastoreEncoder extends PropertyXMLEncoder {
connectionParameters.set("user", user);
}
- /**
- * @deprecated will be set to protected in the next release
- */
- public void addPassword(String password) {
+ protected void addPassword(String password) {
connectionParameters.add("passwd", password);
}
@@ -191,10 +158,7 @@ public class GSPostGISDatastoreEncoder extends PropertyXMLEncoder {
connectionParameters.set("passwd", password);
}
- /**
- * @deprecated will be set to protected in the next release
- */
- public void addDatabaseType(String dbtype) {
+ protected void addDatabaseType(String dbtype) {
connectionParameters.add("dbtype", dbtype);
}
@@ -202,10 +166,7 @@ public class GSPostGISDatastoreEncoder extends PropertyXMLEncoder {
connectionParameters.set("dbtype", dbtype);
}
- /**
- * @deprecated will be set to protected in the next release
- */
- public void addJndiReferenceName(String jndiReferenceName) {
+ protected void addJndiReferenceName(String jndiReferenceName) {
connectionParameters.add("jndiReferenceName", jndiReferenceName);
}
@@ -213,10 +174,7 @@ public class GSPostGISDatastoreEncoder extends PropertyXMLEncoder {
connectionParameters.set("jndiReferenceName", jndiReferenceName);
}
- /**
- * @deprecated will be set to protected in the next release
- */
- public void addExposePrimaryKeys(boolean exposePrimaryKeys) {
+ protected void addExposePrimaryKeys(boolean 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));
}
- /**
- * @deprecated will be set to protected in the next release
- */
- public void addMaxConnections(int maxConnections) {
+ protected void addMaxConnections(int maxConnections) {
connectionParameters.add("max connections", Integer.toString(maxConnections));
}
@@ -235,10 +190,7 @@ public class GSPostGISDatastoreEncoder extends PropertyXMLEncoder {
connectionParameters.set("max connections", Integer.toString(maxConnections));
}
- /**
- * @deprecated will be set to protected in the next release
- */
- public void addMinConnections(int minConnections) {
+ protected void addMinConnections(int minConnections) {
connectionParameters.add("min connections", Integer.toString(minConnections));
}
@@ -246,10 +198,7 @@ public class GSPostGISDatastoreEncoder extends PropertyXMLEncoder {
connectionParameters.set("min connections", Integer.toString(minConnections));
}
- /**
- * @deprecated will be set to protected in the next release
- */
- public void addFetchSize(int fetchSize) {
+ protected void addFetchSize(int fetchSize) {
connectionParameters.add("fetch size", Integer.toString(fetchSize));
}
@@ -257,10 +206,7 @@ public class GSPostGISDatastoreEncoder extends PropertyXMLEncoder {
connectionParameters.set("fetch size", Integer.toString(fetchSize));
}
- /**
- * @deprecated will be set to protected in the next release
- */
- public void addConnectionTimeout(int seconds) {
+ protected void addConnectionTimeout(int seconds) {
connectionParameters.add("Connection timeout", Integer.toString(seconds));
}
@@ -268,10 +214,7 @@ public class GSPostGISDatastoreEncoder extends PropertyXMLEncoder {
connectionParameters.set("Connection timeout", Integer.toString(seconds));
}
- /**
- * @deprecated will be set to protected in the next release
- */
- public void addValidateConnections(boolean validateConnections) {
+ protected void addValidateConnections(boolean validateConnections) {
connectionParameters.add("validate connections", Boolean.toString(validateConnections));
}
@@ -279,10 +222,7 @@ public class GSPostGISDatastoreEncoder extends PropertyXMLEncoder {
connectionParameters.set("validate connections", Boolean.toString(validateConnections));
}
- /**
- * @deprecated will be set to protected in the next release
- */
- public void addPrimaryKeyMetadataTable(String primaryKeyMetadataTable) {
+ protected void addPrimaryKeyMetadataTable(String primaryKeyMetadataTable) {
connectionParameters.add("Primary key metadata table", primaryKeyMetadataTable);
}
@@ -290,10 +230,7 @@ public class GSPostGISDatastoreEncoder extends PropertyXMLEncoder {
connectionParameters.set("Primary key metadata table", primaryKeyMetadataTable);
}
- /**
- * @deprecated will be set to protected in the next release
- */
- public void addLooseBBox(boolean looseBBox) {
+ protected void addLooseBBox(boolean looseBBox) {
connectionParameters.add("Loose bbox", Boolean.toString(looseBBox));
}
@@ -301,10 +238,7 @@ public class GSPostGISDatastoreEncoder extends PropertyXMLEncoder {
connectionParameters.set("Loose bbox", Boolean.toString(looseBBox));
}
- /**
- * @deprecated will be set to protected in the next release
- */
- public void addPreparedStatements(boolean preparedStatements) {
+ protected void addPreparedStatements(boolean preparedStatements) {
connectionParameters.add("preparedStatements", Boolean.toString(preparedStatements));
}
@@ -312,10 +246,7 @@ public class GSPostGISDatastoreEncoder extends PropertyXMLEncoder {
connectionParameters.set("preparedStatements", Boolean.toString(preparedStatements));
}
- /**
- * @deprecated will be set to protected in the next release
- */
- public void addMaxOpenPreparedStatements(int maxOpenPreparedStatements) {
+ protected void addMaxOpenPreparedStatements(int maxOpenPreparedStatements) {
connectionParameters.add("Max open prepared statements", Integer.toString(maxOpenPreparedStatements));
}
diff --git a/src/main/java/it/geosolutions/geoserver/rest/encoder/GSResourceEncoder.java b/src/main/java/it/geosolutions/geoserver/rest/encoder/GSResourceEncoder.java
index 99e6284..44fbdda 100644
--- a/src/main/java/it/geosolutions/geoserver/rest/encoder/GSResourceEncoder.java
+++ b/src/main/java/it/geosolutions/geoserver/rest/encoder/GSResourceEncoder.java
@@ -38,8 +38,7 @@ import org.jdom.filter.Filter;
/**
*
- * Encode a GeoServer resouce. The