it.geosolutions.geoserver.rest
Class GeoServerRESTPublisher

java.lang.Object
  extended by it.geosolutions.geoserver.rest.GeoServerRESTPublisher

public class GeoServerRESTPublisher
extends Object

Connect to a GeoServer instance to publish or modify data.

There are no modifiable instance fields, so all the calls are thread-safe.

Author:
ETj (etj at geo-solutions.it)

Nested Class Summary
static class GeoServerRESTPublisher.CoverageStoreExtension
          The extension parameter specifies the type of data being uploaded.
static class GeoServerRESTPublisher.DataStoreExtension
          The extension parameter specifies the type of data being uploaded.
static class GeoServerRESTPublisher.DataStoreType
          A data store is a source of spatial data that is vector based.
static class GeoServerRESTPublisher.ParameterConfigure
          The configure parameter is used to control how the data store is configured upon file upload.
static class GeoServerRESTPublisher.ParameterUpdate
          The update parameter is used to control how existing data is handled when the file is PUT into a datastore that (a) already exists and (b) already contains a schema that matches the content of the file.
static class GeoServerRESTPublisher.UploadMethod
          The file, url, and external endpoints are used to specify the method that is used to upload the file.
 
Constructor Summary
GeoServerRESTPublisher(String restURL, String username, String password)
          Creates a GeoServerRESTPublisher for a given GeoServer instance with the given auth credentials.
 
Method Summary
 boolean configureCoverage(GSCoverageEncoder ce, String wsname, String csname)
          Configure an existent coverage in a given workspace and coverage store
 boolean configureLayer(String workspace, String resourceName, GSLayerEncoder layer)
          Allows to configure some layer attributes such and DefaultStyle
 boolean createCoverage(GSCoverageEncoder ce, String wsname, String csname)
          Deprecated. use createCoverage(String, String, GSCoverageEncoder)
 boolean createCoverage(String wsname, String storeName, GSCoverageEncoder ce)
          Create a new coverage in a given workspace and coverage store
 boolean createExternalMosaic(String workspace, String storeName, File mosaicDir, GSCoverageEncoder coverageEncoder, GSLayerEncoder layerEncoder)
          Deprecated. use #publishExternalMosaic(String workspace, final String storeName, File mosaicDir, GSCoverageEncoder coverageEncoder, GSLayerEncoder layerEncoder)
 RESTCoverageStore createExternaMosaicDatastore(String workspace, String storeName, File mosaicDir, GeoServerRESTPublisher.ParameterConfigure configure, GeoServerRESTPublisher.ParameterUpdate update)
          Publish a Mosaic from a filesystem currently readable by GeoServer.
 boolean createPostGISDatastore(String workspace, GSPostGISDatastoreEncoder datastoreEncoder)
          Create a PostGIS datastore.
 boolean createWorkspace(String workspace)
          Create a new Workspace
protected  String encode(String s)
           
 boolean publishDBLayer(String workspace, String storename, GSFeatureTypeEncoder fte, GSLayerEncoder layerEncoder)
          Publish a table in a PostGis store as a new layer.
 boolean publishDBLayer(String workspace, String storename, String layername, String srs, String defaultStyle)
           
 RESTCoverageStore publishExternalGeoTIFF(String workspace, String storeName, File geotiff, GSCoverageEncoder coverageEncoder, GSLayerEncoder layerEncoder)
          Publish a GeoTiff already in a filesystem readable by GeoServer.
 boolean publishExternalGeoTIFF(String workspace, String storeName, File geotiff, String coverageName, String srs, GSResourceEncoder.ProjectionPolicy policy, String defaultStyle)
          Publish a GeoTiff already in a filesystem readable by GeoServer.
 boolean publishExternalMosaic(String workspace, String storeName, File mosaicDir, GSCoverageEncoder coverageEncoder, GSLayerEncoder layerEncoder)
          Publish a Mosaic already in a filesystem readable by GeoServer.
 boolean publishExternalMosaic(String workspace, String storeName, File mosaicDir, String srs, String defaultStyle)
          Publish a Mosaic already in a filesystem readable by GeoServer.
 boolean publishGeoTIFF(String workspace, String storeName, File geotiff)
          Simple wrapper for publishGeoTIFF(String, String, String, File)
 boolean publishGeoTIFF(String workspace, String storeName, String coverageName, File geotiff)
          Publish a GeoTiff.
 boolean publishImageMosaic(String workspace, String storeName, File zipFile)
          Publish imagemosaic as zip file
 boolean publishImageMosaic(String workspace, String storeName, File zipFile, GeoServerRESTPublisher.ParameterConfigure configure, org.apache.commons.httpclient.NameValuePair... params)
          Publish imagemosaic as zip file
 boolean publishShp(String workspace, String storename, String layername, File zipFile)
          Publish a zipped shapefile.
 boolean publishShp(String workspace, String storename, String layername, File zipFile, String srs)
          Publish a zipped shapefile.
 boolean publishShp(String workspace, String storename, String layername, File zipFile, String srs, org.apache.commons.httpclient.NameValuePair... params)
          Publish a zipped shapefile.
http://docs.geoserver.org/stable/en/user /restconfig/rest-config-examples/rest- config-examples-curl.html#uploading-a-shapefile
 boolean publishShp(String workspace, String storename, String layerName, File zipFile, String nativeCrs, String defaultStyle)
          Publish a zipped shapefile.
 boolean publishStyle(File sldFile)
          Store and publish an SLD.
 boolean publishStyle(File sldFile, String name)
          Store and publish an SLD, assigning it a name.
 boolean publishStyle(String sldBody)
          Store and publish an SLD.
 boolean publishStyle(String sldBody, String name)
          Store and publish an SLD.
 boolean publishWorldImage(String workspace, String coveragestore, File zipFile)
          publishWorldImage(String, String, File, ParameterConfigure, NameValuePair...)
 boolean publishWorldImage(String workspace, String coveragestore, File zipFile, GeoServerRESTPublisher.ParameterConfigure configure, org.apache.commons.httpclient.NameValuePair... params)
          Publish a zipped worldimage file.
 boolean reload()
          reload the target geoserver configuration
 boolean removeCoverageStore(String workspace, String storename)
          Deprecated. use removeCoverageStore(String, String, boolean)
 boolean removeCoverageStore(String workspace, String storename, boolean recurse)
          Remove a given CoverageStore in a given Workspace.
 boolean removeDatastore(String workspace, String storename)
          Deprecated. will be removed in next release use removeDatastore(String, String, boolean)
 boolean removeDatastore(String workspace, String storename, boolean recurse)
          Remove a given Datastore in a given Workspace.
 boolean removeLayer(String workspace, String layerName)
          remove a generic given layer from a given workspace
 boolean removeLayerGroup(String name)
           
 boolean removeStyle(String styleName)
          Remove a Style.
 boolean removeStyle(String styleName, boolean purge)
          Remove a Style.
The Style will be unpublished and the related SLD file will be removed (if purge==true).
 boolean removeWorkspace(String workspace)
          Deprecated. removeWorkspace(String, boolean)
 boolean removeWorkspace(String workspace, boolean recurse)
          Remove a given Workspace.
 boolean reset()
          reset the target geoserver configuration
protected  String sanitize(String s)
           
 boolean unpublishCoverage(String workspace, String storename, String layerName)
          Remove the Coverage configuration from GeoServer.
 boolean unpublishFeatureType(String workspace, String storename, String layerName)
          Removes the featuretype and the associated layer.
 boolean updateStyle(File sldFile, String name)
          Update an SLD called 'name'.
 boolean updateStyle(String sldBody, String name)
          Update SLD called as 'name'.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GeoServerRESTPublisher

public GeoServerRESTPublisher(String restURL,
                              String username,
                              String password)
Creates a GeoServerRESTPublisher for a given GeoServer instance with the given auth credentials.

Parameters:
restURL - the base GeoServer URL (e.g.: http://localhost:8080/geoserver)
username - username auth credential
password - password auth credential
Method Detail

createWorkspace

public boolean createWorkspace(String workspace)
Create a new Workspace

Parameters:
workspace - The name of the new workspace.

This is the equivalent call with cUrl:

 curl -u admin:geoserver -XPOST \
      -H 'Content-type: text/xml' \
      -d "<workspace><name>$WORKSPACE</name></workspace>" \
      http://$GSIP:$GSPORT/$SERVLET/rest/workspaces
 
 

publishStyle

public boolean publishStyle(String sldBody)
Store and publish an SLD.

This is the equivalent call with cUrl:

 curl -u admin:geoserver -XPOST \
      -H 'Content-type: application/vnd.ogc.sld+xml' \
      -d @$FULLSLD \
      http://$GSIP:$GSPORT/$SERVLET/rest/styles
 

Parameters:
sldBody - the SLD document as an XML String.
Returns:
true if the operation completed successfully.

publishStyle

public boolean publishStyle(String sldBody,
                            String name)
                     throws IllegalArgumentException
Store and publish an SLD.

This is the equivalent call with cUrl:

 curl -u admin:geoserver -XPOST \
      -H 'Content-type: application/vnd.ogc.sld+xml' \
      -d @$FULLSLD \
      http://$GSIP:$GSPORT/$SERVLET/rest/styles?name=name
 

Parameters:
sldBody - the SLD document as an XML String.
name - the Style name (can be null).
Returns:
true if the operation completed successfully.
Throws:
IllegalArgumentException - if the style body is null or empty

publishStyle

public boolean publishStyle(File sldFile)
Store and publish an SLD.

Parameters:
sldFile - the File containing the SLD document.
Returns:
true if the operation completed successfully.

publishStyle

public boolean publishStyle(File sldFile,
                            String name)
Store and publish an SLD, assigning it a name.

Parameters:
sldFile - the File containing the SLD document.
name - the Style name.
Returns:
true if the operation completed successfully.

updateStyle

public boolean updateStyle(String sldBody,
                           String name)
                    throws IllegalArgumentException
Update SLD called as 'name'.

This is the equivalent call with cUrl:

 curl -u admin:geoserver -XPUT \
      -H 'Content-type: application/vnd.ogc.sld+xml' \
      -d @$FULLSLD \
      http://$GSIP:$GSPORT/$SERVLET/rest/styles/$NAME
 

Parameters:
sldBody - the SLD document as an XML String.
name - the Style name to modify.
Returns:
true if the operation completed successfully.
Throws:
IllegalArgumentException - if the style body or name are null or empty

updateStyle

public boolean updateStyle(File sldFile,
                           String name)
                    throws IllegalArgumentException
Update an SLD called 'name'.

Parameters:
sldFile - the File containing the SLD document.
name - the Style name.
Returns:
true if the operation completed successfully.
Throws:
IllegalArgumentException - if the sldFile file or name are null or name is empty

removeStyle

public boolean removeStyle(String styleName,
                           boolean purge)
                    throws IllegalArgumentException
Remove a Style.
The Style will be unpublished and the related SLD file will be removed (if purge==true).

Parameters:
styleName - the name of the Style to remove.
purge - and the related SLD file will be removed.
Returns:
true if the operation completed successfully.
Throws:
IllegalArgumentException - if styleName is null or empty

removeStyle

public boolean removeStyle(String styleName)
Remove a Style.

The Style will be unpublished and the related SLD file will be removed.

Parameters:
styleName - the name of the Style to remove.
Returns:
true if the operation completed successfully.

createPostGISDatastore

public boolean createPostGISDatastore(String workspace,
                                      GSPostGISDatastoreEncoder datastoreEncoder)
Create a PostGIS datastore.

Parameters:
workspace - Name of the workspace to contain the database. This will also be the prefix of any layer names created from tables in the database.
datastoreEncoder - the set of parameters to be set to the datastore (including connection params)
Returns:
true if the PostGIS datastore has been successfully created, false otherwise

publishShp

public boolean publishShp(String workspace,
                          String storename,
                          String layername,
                          File zipFile)
                   throws FileNotFoundException
Publish a zipped shapefile.
The CRS will be forced to EPSG:4326.

Parameters:
workspace -
storename -
layername -
zipFile -
Returns:
true if the operation completed successfully.
Throws:
FileNotFoundException

publishShp

public boolean publishShp(String workspace,
                          String storename,
                          String layerName,
                          File zipFile,
                          String nativeCrs,
                          String defaultStyle)
                   throws FileNotFoundException
Publish a zipped shapefile.

Parameters:
workspace -
storename -
layerName -
nativeCrs -
defaultStyle - may be null
Returns:
true if the operation completed successfully.
Throws:
FileNotFoundException

publishShp

public boolean publishShp(String workspace,
                          String storename,
                          String layername,
                          File zipFile,
                          String srs)
                   throws FileNotFoundException
Publish a zipped shapefile.

These are the equivalent calls with cUrl:

 curl -u admin:geoserver -XPUT -H 'Content-type: application/zip' \
       --data-binary @$ZIPFILE \
       http://$GSIP:$GSPORT/$SERVLET/rest/workspaces/$WORKSPACE/datastores/$STORENAME/file.shp
 
 curl -u admin:geoserver -XPOST -H 'Content-type: text/xml'  \
       -d "<featureType><name>$BARE</name><nativeCRS>EPSG:4326</nativeCRS><enabled>true</enabled></featureType>"  \
       http://$GSIP:$GSPORT/$SERVLET/rest/workspaces/$WORKSPACE/datastores/$STORENAME/featuretypes/$LAYERNAME
  
 
publishShp(String, String, String, File, String, NameValuePair...)

Returns:
true if the operation completed successfully.
Throws:
FileNotFoundException

publishShp

public boolean publishShp(String workspace,
                          String storename,
                          String layername,
                          File zipFile,
                          String srs,
                          org.apache.commons.httpclient.NameValuePair... params)
                   throws FileNotFoundException
Publish a zipped shapefile.
http://docs.geoserver.org/stable/en/user /restconfig/rest-config-examples/rest- config-examples-curl.html#uploading-a-shapefile

Parameters:
workspace - the name of the workspace to use
storename - the name of the store to create
layername - the name of the layer to configure
zipFile - the zip file containing the shapefile
srs - the native CRS
params - parameters to append to the url (can be null).
Accepted parameters are:
  • charset used to set the charset
Returns:
true if success false otherwise
Throws:
FileNotFoundException

publishDBLayer

public boolean publishDBLayer(String workspace,
                              String storename,
                              String layername,
                              String srs,
                              String defaultStyle)
Parameters:
workspace -
storename -
layername -
srs -
defaultStyle -
Returns:

publishDBLayer

public boolean publishDBLayer(String workspace,
                              String storename,
                              GSFeatureTypeEncoder fte,
                              GSLayerEncoder layerEncoder)
Publish a table in a PostGis store as a new layer.

This is the equivalent call with cUrl:

 curl -u admin:geoserver -XPOST -H 'Content-type: text/xml' \
      -d "<featureType><name>easia_gaul_1_aggr</name><nativeCRS>EPSG:4326</nativeCRS><enabled>true</enabled></featureType>" \
      http://localhost:8080/geoserver/rest/workspaces/it.geosolutions/datastores/pg_kids/featuretypes
 
 
and a PUT to
restURL + "/rest/layers/" workspace + : + layerName

Parameters:
workspace -
storename -
fte - GSFeatureTypeEncoder encoding creating FeatureType
Returns:
true if layer is successfully created

publishGeoTIFF

public boolean publishGeoTIFF(String workspace,
                              String storeName,
                              File geotiff)
                       throws FileNotFoundException
Simple wrapper for publishGeoTIFF(String, String, String, File)

Throws:
FileNotFoundException

publishGeoTIFF

public boolean publishGeoTIFF(String workspace,
                              String storeName,
                              String coverageName,
                              File geotiff)
                       throws FileNotFoundException,
                              IllegalArgumentException
Publish a GeoTiff. Simple wrapper for publishCoverage(String, String, CoverageStoreExtension, String, File, ParameterConfigure, NameValuePair...)

This is the equivalent call with cUrl:

 curl -u admin:geoserver -XPUT -H 'Content-type: text' -d "file:$FULLPATH" \
       http://$GSIP:$GSPORT/$SERVLET/rest/workspaces/$WORKSPACE/coveragestores/$STORENAME/external.geotiff
  
 

Parameters:
workspace - Workspace to use
storeName - Name of the coveragestore (if null the file name will be used)
coverageName - the name of the coverage (if null the file name will be used)
geotiff - file to upload
Returns:
true if the operation completed successfully.
Throws:
FileNotFoundException - if file does not exists
IllegalArgumentException - if workspace or geotiff are null

publishExternalGeoTIFF

public boolean publishExternalGeoTIFF(String workspace,
                                      String storeName,
                                      File geotiff,
                                      String coverageName,
                                      String srs,
                                      GSResourceEncoder.ProjectionPolicy policy,
                                      String defaultStyle)
                               throws FileNotFoundException,
                                      IllegalArgumentException
Publish a GeoTiff already in a filesystem readable by GeoServer.

Parameters:
workspace - an existing workspace
storeName - the coverageStore to be created
geotiff - the geoTiff to be published
srs -
policy -
defaultStyle -
Returns:
Throws:
FileNotFoundException
IllegalArgumentException

publishExternalGeoTIFF

public RESTCoverageStore publishExternalGeoTIFF(String workspace,
                                                String storeName,
                                                File geotiff,
                                                GSCoverageEncoder coverageEncoder,
                                                GSLayerEncoder layerEncoder)
                                         throws IllegalArgumentException,
                                                FileNotFoundException
Publish a GeoTiff already in a filesystem readable by GeoServer.

Parameters:
workspace - an existing workspace
storeName - the coverageStore to be created
geotiff - the geoTiff to be published
coverageEncoder -
layerEncoder -
Returns:
true if successfully configured
Throws:
FileNotFoundException
IllegalArgumentException - if null parameter

publishWorldImage

public boolean publishWorldImage(String workspace,
                                 String coveragestore,
                                 File zipFile)
                          throws FileNotFoundException
publishWorldImage(String, String, File, ParameterConfigure, NameValuePair...)

Throws:
FileNotFoundException

publishWorldImage

public boolean publishWorldImage(String workspace,
                                 String coveragestore,
                                 File zipFile,
                                 GeoServerRESTPublisher.ParameterConfigure configure,
                                 org.apache.commons.httpclient.NameValuePair... params)
                          throws FileNotFoundException
Publish a zipped worldimage file. It is assumed that the the zip-file contain the *.prj to set the srs.

This is equivalent 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
 

Parameters:
workspace - Workspace to use
coveragestore - Name of the coveragestore
zipFile - zip file to upload
configure - Configure parameter. It may be null.
params - parameters to append to the url (can be null).
Accepted parameters are:
  • coverageName=name coverageName parameter to append. Only works if configure is not set to ParameterConfigure.NONE.
Returns:
true if the operation completed successfully.
Throws:
FileNotFoundException
See Also:
ParameterConfigure}

publishImageMosaic

public boolean publishImageMosaic(String workspace,
                                  String storeName,
                                  File zipFile)
                           throws FileNotFoundException
Publish imagemosaic as zip file

Throws:
FileNotFoundException
See Also:
#publishWorldImage(String, String, File)}

publishImageMosaic

public boolean publishImageMosaic(String workspace,
                                  String storeName,
                                  File zipFile,
                                  GeoServerRESTPublisher.ParameterConfigure configure,
                                  org.apache.commons.httpclient.NameValuePair... params)
                           throws FileNotFoundException
Publish imagemosaic as zip file

Throws:
FileNotFoundException
See Also:
#publishWorldImage(String, String, File, ParameterConfigure, NameValuePair...)}

createExternaMosaicDatastore

public RESTCoverageStore createExternaMosaicDatastore(String workspace,
                                                      String storeName,
                                                      File mosaicDir,
                                                      GeoServerRESTPublisher.ParameterConfigure configure,
                                                      GeoServerRESTPublisher.ParameterUpdate update)
                                               throws FileNotFoundException
Publish a Mosaic from a filesystem currently readable by GeoServer.

Sample cUrl usage:
<> curl -u admin:geoserver -XPUT -H 'Content-type: text' -d "file:$ABSPORTDIR" http://$GSIP:$GSPORT/$SERVLET/rest/workspaces/$WORKSPACE/coveragestores/$BAREDIR/external.imagemosaic

Parameters:
workspace - an existing workspace
storeName - the name of the coverageStore to be created
mosaicDir - the directory where the raster images are located
configure - a specify if a coverage should be configured
Returns:
true if the operation completed successfully.
Throws:
FileNotFoundException

publishExternalMosaic

public boolean publishExternalMosaic(String workspace,
                                     String storeName,
                                     File mosaicDir,
                                     String srs,
                                     String defaultStyle)
                              throws FileNotFoundException
Publish a Mosaic already in a filesystem readable by GeoServer.

Sample cUrl usage:
curl -u admin:geoserver -XPUT -H 'Content-type: text' -d "file:$ABSPORTDIR" http://$GSIP:$GSPORT/$SERVLET/rest/workspaces/$WORKSPACE/coveragestores/$BAREDIR/external.imagemosaic

Parameters:
workspace - an existing workspace
storeName - the name of the coverageStore to be created
mosaicDir - the directory where the raster images are located
srs - the coverage declared SRS
defaultStyle - may be null
Returns:
true if the operation completed successfully.
Throws:
FileNotFoundException

createExternalMosaic

public boolean createExternalMosaic(String workspace,
                                    String storeName,
                                    File mosaicDir,
                                    GSCoverageEncoder coverageEncoder,
                                    GSLayerEncoder layerEncoder)
                             throws FileNotFoundException
Deprecated. use #publishExternalMosaic(String workspace, final String storeName, File mosaicDir, GSCoverageEncoder coverageEncoder, GSLayerEncoder layerEncoder)

Parameters:
workspace -
storeName -
mosaicDir -
coverageEncoder -
layerEncoder -
Returns:
Throws:
FileNotFoundException

publishExternalMosaic

public boolean publishExternalMosaic(String workspace,
                                     String storeName,
                                     File mosaicDir,
                                     GSCoverageEncoder coverageEncoder,
                                     GSLayerEncoder layerEncoder)
                              throws FileNotFoundException,
                                     IllegalArgumentException
Publish a Mosaic already in a filesystem readable by GeoServer.

Sample cUrl usage:
curl -u admin:geoserver -XPUT -H 'Content-type: text' -d "file:$ABSPORTDIR" http://$GSIP:$GSPORT/$SERVLET/rest/workspaces/$WORKSPACE/coveragestores/$BAREDIR/external.imagemosaic

Parameters:
workspace - an existing workspace
storeName - the name of the coverageStore to be created
mosaicDir - the directory where the raster images are located
coverageEncoder - the set of parameters to be set to the coverage (bbox, srs, ...)
layerEncoder - the set of parameters to be set to the layer (defaultstyle, wmspath, ...)
Returns:
true if the operation completed successfully.
Throws:
FileNotFoundException
IllegalArgumentException

unpublishCoverage

public boolean unpublishCoverage(String workspace,
                                 String storename,
                                 String layerName)
Remove the Coverage configuration from GeoServer.
First, the associated layer is removed, then the Coverage configuration itself.

CHECKME Maybe the coveragestore has to be removed as well.

REST URL: http://localhost:8080/geoserver/rest/workspaces/it.geosolutions/coveragestores/gbRESTtestStore/coverages/resttestdem.xml

Returns:
true if the operation completed successfully.

unpublishFeatureType

public boolean unpublishFeatureType(String workspace,
                                    String storename,
                                    String layerName)
Removes the featuretype and the associated layer.
You may also want to remove the datastore.

Returns:
true if the operation completed successfully.

removeDatastore

public boolean removeDatastore(String workspace,
                               String storename)
Deprecated. will be removed in next release use removeDatastore(String, String, boolean)

Remove recursively a given Datastore in a given Workspace.

Parameters:
workspace - The name of the workspace
storename - The name of the Datastore to remove.
Returns:
true if the datastore was successfully removed.

removeDatastore

public boolean removeDatastore(String workspace,
                               String storename,
                               boolean recurse)
                        throws IllegalArgumentException
Remove a given Datastore in a given Workspace.

Parameters:
workspace - The name of the workspace
storename - The name of the Datastore to remove.
recurse - if remove should be performed recursively
Returns:
true if the datastore was successfully removed.
Throws:
IllegalArgumentException - if workspace or storename are null or empty

removeCoverageStore

public boolean removeCoverageStore(String workspace,
                                   String storename)
Deprecated. use removeCoverageStore(String, String, boolean)

Remove recursively a given CoverageStore in a given Workspace.

Parameters:
workspace - The name of the workspace
storename - The name of the CoverageStore to remove.
Returns:
true if the CoverageStore was successfully removed.

removeCoverageStore

public boolean removeCoverageStore(String workspace,
                                   String storename,
                                   boolean recurse)
                            throws IllegalArgumentException
Remove a given CoverageStore in a given Workspace.

Parameters:
workspace - The name of the workspace
storename - The name of the CoverageStore to remove.
recurse - if remove should be performed recursively
Returns:
true if the CoverageStore was successfully removed.
Throws:
IllegalArgumentException

removeWorkspace

public boolean removeWorkspace(String workspace)
Deprecated. removeWorkspace(String, boolean)

Remove the workspace given Workspace using default parameters

Parameters:
workspace - the workspace to remove
Returns:
true if success, false otherwise
See Also:
GeoServerRESTPublisher#removeWorkspace(String, boolean)}

removeWorkspace

public boolean removeWorkspace(String workspace,
                               boolean recurse)
                        throws IllegalArgumentException
Remove a given Workspace.

Parameters:
workspace - The name of the workspace
recurse - The recurse parameter is used to recursively delete all resources contained by the specified workspace. This includes data stores, coverage stores, feature types, etc... Allowable values for this parameter are true or false. The default value is false.
Returns:
true if the WorkSpace was successfully removed.
Throws:
IllegalArgumentException

reload

public boolean reload()
reload the target geoserver configuration

Returns:
true if success
See Also:
://docs.geoserver.org/stable/en/user/restconfig/rest-config-api.html

reset

public boolean reset()
reset the target geoserver configuration

Returns:
true if success
See Also:
://docs.geoserver.org/stable/en/user/restconfig/rest-config-api.html

removeLayerGroup

public boolean removeLayerGroup(String name)

removeLayer

public boolean removeLayer(String workspace,
                           String layerName)
remove a generic given layer from a given workspace

Parameters:
workspace -
layerName -
Returns:
true if success

configureLayer

public boolean configureLayer(String workspace,
                              String resourceName,
                              GSLayerEncoder layer)
                       throws IllegalArgumentException
Allows to configure some layer attributes such and DefaultStyle

Parameters:
workspace -
resourceName - the name of the resource to use (featureStore or coverageStore name)
layer - the layer encoder used to configure the layer
Returns:
true if success
Throws:
IllegalArgumentException - if some arguments are null or empty

configureCoverage

public boolean configureCoverage(GSCoverageEncoder ce,
                                 String wsname,
                                 String csname)
Configure an existent coverage in a given workspace and coverage store

Parameters:
ce - contains the coverage name to configure and the configuration to apply
wsname - the workspace to search for existent coverage
csname - the coverage store to search for existent coverage
Returns:
true if success

createCoverage

public boolean createCoverage(GSCoverageEncoder ce,
                              String wsname,
                              String csname)
Deprecated. use createCoverage(String, String, GSCoverageEncoder)

Parameters:
ce -
wsname -
csname -
Returns:

createCoverage

public boolean createCoverage(String wsname,
                              String storeName,
                              GSCoverageEncoder ce)
                       throws IllegalArgumentException
Create a new coverage in a given workspace and coverage store

Parameters:
wsname - the workspace to search for existent coverage
storeName - an existent store name to use as data source
ce - contains the coverage name to create and the configuration to apply
Returns:
true if success
Throws:
IllegalArgumentException - if arguments are null or empty

sanitize

protected String sanitize(String s)

encode

protected String encode(String s)


Copyright © 2007-2012 GeoSolutions. All Rights Reserved.