Class GeoServerRESTPublisher
- java.lang.Object
-
- it.geosolutions.geoserver.rest.GeoServerRESTPublisher
-
public class GeoServerRESTPublisher extends java.lang.ObjectConnect to a GeoServer instance to publish or modify its contents via REST API.There are no modifiable instance fields, so all the calls are thread-safe.
- Version:
- $Id: $
- Author:
- ETj (etj at geo-solutions.it), Carlo Cancellieri - carlo.cancellieri@geo-solutions.it, Lennart Karsten - lennart.k@thinking-aloud.eu
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classGeoServerRESTPublisher.CoverageStoreExtensionRaster data format being uploaded.static classGeoServerRESTPublisher.DataStoreExtensionVector data format being uploaded.static classGeoServerRESTPublisher.DataStoreTypeDeprecated.static classGeoServerRESTPublisher.FormatRepresents the format used to GET, PUT or POST information via REST.static classGeoServerRESTPublisher.ParameterConfigureControl if feature types are to be automatically configured upon file upload.static classGeoServerRESTPublisher.ParameterUpdateControls 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 classGeoServerRESTPublisher.Purgestatic classGeoServerRESTPublisher.StoreTypeDataStoreType definitions.static classGeoServerRESTPublisher.UploadMethodSpecifies the method used to publish a resource.
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringDEFAULT_CRSConstantDEFAULT_CRS="EPSG:4326"
-
Constructor Summary
Constructors Constructor Description GeoServerRESTPublisher(java.lang.String restURL, java.lang.String username, java.lang.String password)Creates a GeoServerRESTPublisher to connect against a GeoServer instance with the given URL and user credentials.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description java.lang.Stringbackup(java.lang.String backupDir)Issues a GeoServer BACKUP.java.lang.Stringbackup(java.lang.String backupDir, boolean includedata, boolean includegwc, boolean includelog)Issues a GeoServer BACKUP.booleanconfigureCoverage(GSCoverageEncoder ce, java.lang.String wsname, java.lang.String csname)Configure an existing coverage in a given workspace and coverage storebooleanconfigureCoverage(GSCoverageEncoder ce, java.lang.String wsname, java.lang.String csname, java.lang.String coverageName)Configure an existing coverage in a given workspace and coverage storebooleanconfigureLayer(java.lang.String workspace, java.lang.String resourceName, GSLayerEncoder layer)Allows to configure some layer attributes such as DefaultStylebooleanconfigureLayerGroup(java.lang.String name, GSLayerGroupEncoder group)Update a LayerGroup using the specified encoderbooleanconfigureLayerGroup(java.lang.String workspace, java.lang.String name, GSLayerGroupEncoder group)Update a LayerGroup using the specified encoderbooleanconfigureResource(java.lang.String workspace, GeoServerRESTPublisher.StoreType dsType, java.lang.String storeName, GSResourceEncoder re)Configure a resourcebooleanconfigureResource(java.lang.String workspace, GeoServerRESTPublisher.StoreType dsType, java.lang.String storeName, java.lang.String resourceName, GSResourceEncoder re)Configure a resourcebooleancreateCoverage(GSCoverageEncoder ce, java.lang.String wsname, java.lang.String csname)Deprecated.booleancreateCoverage(java.lang.String wsname, java.lang.String storeName, GSCoverageEncoder ce)Create a new coverage in a given workspace and coverage storebooleancreateExternalMosaic(java.lang.String workspace, java.lang.String storeName, java.io.File mosaicDir, GSCoverageEncoder coverageEncoder, GSLayerEncoder layerEncoder)RESTCoverageStorecreateExternaMosaicDatastore(java.lang.String workspace, java.lang.String storeName, java.io.File mosaicDir, GeoServerRESTPublisher.ParameterConfigure configure, GeoServerRESTPublisher.ParameterUpdate update)Publish a Mosaic from a filesystem currently readable by GeoServer.booleancreateImageMosaic(java.lang.String workspace, java.lang.String coverageStore, java.lang.String path)Create a new ImageMosaic with the provided configuration provided as a zip file.booleancreateImageMosaic(java.lang.String workspace, java.lang.String coverageStore, java.lang.String path, GeoServerRESTStructuredGridCoverageReaderManager.ConfigureCoveragesOption configureOpt)Create a new ImageMosaic with the provided configuration provided as a zip file.booleancreateLayerGroup(java.lang.String name, GSLayerGroupEncoder group)Create a new LayerGroup using the specified encoderbooleancreateLayerGroup(java.lang.String workspace, java.lang.String name, GSLayerGroupEncoder group)Create a new LayerGroup using the specified encoderbooleancreateNamespace(java.lang.String prefix, java.net.URI uri)Create a new Namespace.booleancreatePostGISDatastore(java.lang.String workspace, GSPostGISDatastoreEncoder datastoreEncoder)Deprecated.Will be deleted in next version 1.5.x, useGeoServerRESTStoreManagerinstead.booleancreateResource(java.lang.String workspace, GeoServerRESTPublisher.StoreType dsType, java.lang.String storeName, GSResourceEncoder re)Create a new resource in a given workspace and storebooleancreateStore(java.lang.String workspace, GeoServerRESTPublisher.StoreType dsType, java.lang.String storeName, GeoServerRESTPublisher.UploadMethod method, java.lang.String extension, java.lang.String mimeType, java.net.URI uri, GeoServerRESTPublisher.ParameterConfigure configure, org.apache.commons.httpclient.NameValuePair... params)Upload and publish data (vector or raster), and automatically create the associated Store if needed.booleancreateWorkspace(java.lang.String workspace)Create a new Workspace.booleancreateWorkspace(java.lang.String name, java.net.URI uri)Create both a workspace and its associated namespace.net.sf.json.JSONObjectgetTask(int i, int t)Refers togetTaskmethodbooleanharvestExternal(java.lang.String workspace, java.lang.String coverageStore, java.lang.String format, java.lang.String path)Create a store or harvest the coverage from the provided external path.voidpostImport(int i)Refers topostImportmethodintpostNewImport()Refers topostNewImportmethodintpostNewTaskAsMultiPartForm(int i, java.lang.String data)Refers topostNewTaskAsMultiPartFormmethodbooleanpublishArcGrid(java.lang.String workspace, java.lang.String storeName, java.io.File arcgrid)Upload and publish a ArcGrid image.booleanpublishArcGrid(java.lang.String workspace, java.lang.String storeName, java.lang.String coverageName, java.io.File arcgrid)Upload and publish a ArcGrid image.booleanpublishArcGrid(java.lang.String workspace, java.lang.String storeName, java.lang.String coverageName, java.io.File arcgrid, java.lang.String srs, GSResourceEncoder.ProjectionPolicy policy, java.lang.String defaultStyle, double[] bbox)Upload and publish a ArcGrid image.booleanpublishDBLayer(java.lang.String workspace, java.lang.String storename, GSFeatureTypeEncoder fte, GSLayerEncoder layerEncoder)Publish and configure a new layer from an existing DataStore (v.booleanpublishDBLayer(java.lang.String workspace, java.lang.String storename, java.lang.String layername, java.lang.String srs, java.lang.String defaultStyle)Deprecated.Will be removed in the next release.RESTCoverageStorepublishExternalArcGrid(java.lang.String workspace, java.lang.String storeName, java.io.File arcgrid, GSCoverageEncoder coverageEncoder, GSLayerEncoder layerEncoder)Publish a ArcGrid already in a filesystem readable by GeoServer.booleanpublishExternalArcGrid(java.lang.String workspace, java.lang.String storeName, java.io.File arcgrid, java.lang.String coverageName, java.lang.String srs, GSResourceEncoder.ProjectionPolicy policy, java.lang.String defaultStyle)Publish a ArcGrid already in a filesystem readable by GeoServer.RESTCoverageStorepublishExternalGeoTIFF(java.lang.String workspace, java.lang.String storeName, java.io.File geotiff, GSCoverageEncoder coverageEncoder, GSLayerEncoder layerEncoder)Publish a GeoTiff already in a filesystem readable by GeoServer.booleanpublishExternalGeoTIFF(java.lang.String workspace, java.lang.String storeName, java.io.File geotiff, java.lang.String coverageName, java.lang.String srs, GSResourceEncoder.ProjectionPolicy policy, java.lang.String defaultStyle)Publish a GeoTiff already in a filesystem readable by GeoServer.booleanpublishExternalMosaic(java.lang.String workspace, java.lang.String storeName, java.io.File mosaicDir, GSCoverageEncoder coverageEncoder, GSLayerEncoder layerEncoder)Publish a Mosaic already in a filesystem readable by GeoServer.booleanpublishExternalMosaic(java.lang.String workspace, java.lang.String storeName, java.io.File mosaicDir, java.lang.String srs, java.lang.String defaultStyle)Publish a Mosaic already in a filesystem readable by GeoServer.booleanpublishGeoTIFF(java.lang.String workspace, java.lang.String storeName, java.io.File geotiff)Upload and publish a GeoTIFF image.booleanpublishGeoTIFF(java.lang.String workspace, java.lang.String storeName, java.lang.String coverageName, java.io.File geotiff)Upload and publish a GeoTIFF image.booleanpublishGeoTIFF(java.lang.String workspace, java.lang.String storeName, java.lang.String resourceName, java.io.File geotiff, java.lang.String srs, GSResourceEncoder.ProjectionPolicy policy, java.lang.String defaultStyle)Deprecated.use the former method with bbox set to null.booleanpublishGeoTIFF(java.lang.String workspace, java.lang.String storeName, java.lang.String coverageName, java.io.File geotiff, java.lang.String srs, GSResourceEncoder.ProjectionPolicy policy, java.lang.String defaultStyle, double[] bbox)Upload and publish a GeoTIFF image.booleanpublishImageMosaic(java.lang.String workspace, java.lang.String storeName, java.io.File zipFile)Publish imagemosaic as zip file.booleanpublishImageMosaic(java.lang.String workspace, java.lang.String storeName, java.io.File zipFile, GeoServerRESTPublisher.ParameterConfigure configure, org.apache.commons.httpclient.NameValuePair... params)Publish imagemosaic as zip file.booleanpublishShp(java.lang.String workspace, java.lang.String storename, java.lang.String datasetname, java.io.File zipFile)Upload an publish a local shapefile.booleanpublishShp(java.lang.String workspace, java.lang.String storename, java.lang.String layername, java.io.File zipFile, java.lang.String srs)Publish a zipped shapefile forcing the srs to the one provided.booleanpublishShp(java.lang.String workspace, java.lang.String storename, java.lang.String layerName, java.io.File zipFile, java.lang.String srs, java.lang.String defaultStyle)Publish a zipped shapefile.booleanpublishShp(java.lang.String workspace, java.lang.String storename, java.lang.String layername, java.io.File zipFile, java.lang.String srs, org.apache.commons.httpclient.NameValuePair... params)Publish a zipped shapefile.booleanpublishShp(java.lang.String workspace, java.lang.String storeName, org.apache.commons.httpclient.NameValuePair[] storeParams, java.lang.String datasetName, GeoServerRESTPublisher.UploadMethod method, java.net.URI shapefile, java.lang.String srs, GSResourceEncoder.ProjectionPolicy policy, java.lang.String defaultStyle)Deprecated.usepublishShp(String, String, NameValuePair[], String, UploadMethod, URI, String, String)instead as the behaviour of this method is misleading as it allows you to use wrong ProjectionPolicy values.booleanpublishShp(java.lang.String workspace, java.lang.String storeName, org.apache.commons.httpclient.NameValuePair[] storeParams, java.lang.String datasetName, GeoServerRESTPublisher.UploadMethod method, java.net.URI shapefile, java.lang.String srs, java.lang.String defaultStyle)Publish a shapefile.booleanpublishShp(java.lang.String workspace, java.lang.String storeName, org.apache.commons.httpclient.NameValuePair[] storeParams, java.lang.String datasetName, GeoServerRESTPublisher.UploadMethod method, java.net.URI shapefile, java.lang.String srs, java.lang.String nativeCRS, GSResourceEncoder.ProjectionPolicy policy, java.lang.String defaultStyle)Publish a shapefile.booleanpublishShpCollection(java.lang.String workspace, java.lang.String storeName, java.net.URI resource)Publish a collection of shapefiles.booleanpublishStyle(java.io.File sldFile)Store and publish a Style.booleanpublishStyle(java.io.File sldFile, java.lang.String name)Store and publish a Style, assigning it a name.booleanpublishStyle(java.io.File sldFile, java.lang.String name, boolean raw)Store and publish a Style, assigning it a name and choosing the raw format.booleanpublishStyle(java.lang.String sldBody)Store and publish a Style.booleanpublishStyle(java.lang.String sldBody, java.lang.String name)Store and publish a Style, assigning it a name.booleanpublishStyle(java.lang.String sldBody, java.lang.String name, boolean raw)Store and publish a Style, assigning it a name and choosing the raw format.booleanpublishStyleInWorkspace(java.lang.String workspace, java.io.File sldFile)publishStyleInWorkspacebooleanpublishStyleInWorkspace(java.lang.String workspace, java.io.File sldFile, java.lang.String name)publishStyleInWorkspacebooleanpublishStyleInWorkspace(java.lang.String workspace, java.lang.String sldBody)publishStyleInWorkspacebooleanpublishStyleInWorkspace(java.lang.String workspace, java.lang.String sldBody, java.lang.String name)publishStyleInWorkspacebooleanpublishWorldImage(java.lang.String workspace, java.lang.String coveragestore, java.io.File zipFile)Publish a zipped worldimage file.booleanpublishWorldImage(java.lang.String workspace, java.lang.String coveragestore, java.io.File zipFile, GeoServerRESTPublisher.ParameterConfigure configure, org.apache.commons.httpclient.NameValuePair... params)Publish a zipped worldimage file.voidputTask(int i, int t, java.lang.String json)Refers toputTaskmethodvoidputTaskLayer(int i, int t, java.lang.String json)Refers toputTaskLayermethodbooleanreload()Reload the target geoserver configurationbooleanreloadStore(java.lang.String workspace, java.lang.String storeName, GeoServerRESTPublisher.StoreType storeType)reloadStorebooleanremoveCoverageStore(java.lang.String workspace, java.lang.String storename)Deprecated.booleanremoveCoverageStore(java.lang.String workspace, java.lang.String storename, boolean recurse)Remove a given CoverageStore in a given Workspace.booleanremoveCoverageStore(java.lang.String workspace, java.lang.String storename, boolean recurse, GeoServerRESTPublisher.Purge purge)Remove a given CoverageStore in a given Workspace.booleanremoveDatastore(java.lang.String workspace, java.lang.String storename)Deprecated.will be removed in next release useremoveDatastore(String, String, boolean)booleanremoveDatastore(java.lang.String workspace, java.lang.String storename, boolean recurse)Remove a given Datastore in a given Workspace.booleanremoveDatastore(java.lang.String workspace, java.lang.String storename, boolean recurse, GeoServerRESTPublisher.Purge purge)removeDatastorebooleanremoveGranuleById(java.lang.String workspace, java.lang.String coverageStore, java.lang.String coverage, java.lang.String granuleId)Remove a granule from a structured coverage by id.booleanremoveGranulesByCQL(java.lang.String workspace, java.lang.String coverageStore, java.lang.String coverage, java.lang.String filter)Remove granules from a structured coverage, by providing a CQL filter.booleanremoveLayer(java.lang.String workspace, java.lang.String layerName)remove a generic given layer from a given workspacebooleanremoveLayerGroup(java.lang.String name)Remove a layer group.booleanremoveLayerGroup(java.lang.String workspace, java.lang.String name)Remove a layer group.booleanremoveNamespace(java.lang.String prefix, boolean recurse)Remove a given Namespace.booleanremoveResource(java.lang.String workspace, GeoServerRESTPublisher.StoreType dsType, java.lang.String storeName, java.lang.String resName)Configure resource in a given workspace and storebooleanremoveStore(java.lang.String workspace, java.lang.String storename, GeoServerRESTPublisher.StoreType type, boolean recurse, GeoServerRESTPublisher.Purge purge)Remove a given Datastore in a given Workspace.booleanremoveStyle(java.lang.String styleName)Remove a Style.booleanremoveStyle(java.lang.String styleName, boolean purge)Remove a Style.booleanremoveStyleInWorkspace(java.lang.String workspace, java.lang.String styleName)removeStyleInWorkspacebooleanremoveStyleInWorkspace(java.lang.String workspace, java.lang.String styleName, boolean purge)removeStyleInWorkspacebooleanremoveWorkspace(java.lang.String workspace)Deprecated.booleanremoveWorkspace(java.lang.String workspace, boolean recurse)Remove a given Workspace.booleanreset()Reset the target geoserver configurationjava.lang.Stringrestore(java.lang.String backupDir)Issues a GeoServer RESTORE.protected java.lang.Stringsanitize(java.lang.String s)Appends ".DUMMY" to any string containing a dot (sic).booleanunpublishCoverage(java.lang.String workspace, java.lang.String storename, java.lang.String layerName)Remove the Coverage configuration from GeoServer.booleanunpublishFeatureType(java.lang.String workspace, java.lang.String storename, java.lang.String layerName)Removes the featuretype and the associated layer.booleanupdateNamespace(java.lang.String prefix, java.net.URI uri)Update a Namespace URI.booleanupdateStyle(java.io.File sldFile, java.lang.String name)Update a Style.booleanupdateStyle(java.io.File sldFile, java.lang.String name, boolean raw)Update a Style.booleanupdateStyle(java.lang.String sldBody, java.lang.String name)Update a Style.booleanupdateStyle(java.lang.String sldBody, java.lang.String name, boolean raw)Update a Style.booleanupdateStyleInWorkspace(java.lang.String workspace, java.io.File sldFile, java.lang.String name)updateStyleInWorkspacebooleanupdateStyleInWorkspace(java.lang.String workspace, java.lang.String sldBody, java.lang.String name)updateStyleInWorkspace
-
-
-
Field Detail
-
DEFAULT_CRS
public static final java.lang.String DEFAULT_CRS
ConstantDEFAULT_CRS="EPSG:4326"- See Also:
- Constant Field Values
-
-
Constructor Detail
-
GeoServerRESTPublisher
public GeoServerRESTPublisher(java.lang.String restURL, java.lang.String username, java.lang.String password)Creates a GeoServerRESTPublisher to connect against a GeoServer instance with the given URL and user credentials.- Parameters:
restURL- the base GeoServer URL (e.g.: http://localhost:8080/geoserver)username- auth credentialpassword- auth credential
-
-
Method Detail
-
backup
public java.lang.String backup(java.lang.String backupDir) throws java.lang.IllegalArgumentExceptionIssues a GeoServer BACKUP.Won't include data, cached tiles, or logs. Use
backup(String, boolean, boolean, boolean)to control these parameters.- Parameters:
backupDir- the target Backup Dir String.- Returns:
- id of the backup.
- Throws:
java.lang.IllegalArgumentException- if the backupDir is null or empty
-
backup
public java.lang.String backup(java.lang.String backupDir, boolean includedata, boolean includegwc, boolean includelog) throws java.lang.IllegalArgumentExceptionIssues a GeoServer BACKUP.- Parameters:
backupDir- the target Backup Dir String.includedata- whether or not include the data dir Boolean.includegwc- whether or not include the geowebcache dir Boolean.includelog- whether or not include the log dir Boolean.- Returns:
- id of the backup.
- Throws:
java.lang.IllegalArgumentException- if the backupDir is null or empty.
-
restore
public java.lang.String restore(java.lang.String backupDir) throws java.lang.IllegalArgumentExceptionIssues a GeoServer RESTORE.- Parameters:
backupDir- the source backup dir.- Returns:
- id of the backup.
- Throws:
java.lang.IllegalArgumentException- if the backupDir is null or empty
-
createWorkspace
public boolean createWorkspace(java.lang.String workspace)
Create a new Workspace.GeoServer will automatically create an associated Namespace with the URI being "http://{workspaceName}". To specify a custom Namespace URI, use
createWorkspace(String, URI).- Parameters:
workspace- The name of the new workspace.- Returns:
- true if the workspace was created.
-
createWorkspace
public boolean createWorkspace(java.lang.String name, java.net.URI uri)Create both a workspace and its associated namespace.Note that this method is equivalent to
createNamespace(java.lang.String, java.net.URI).- Parameters:
name- Name for the new workspace, which will be also its associated namespace prefix.uri- Namespace URI. Cannot be empty.- Returns:
- true if the Workspace and its associated namespace were successfully created.
-
createNamespace
public boolean createNamespace(java.lang.String prefix, java.net.URI uri)Create a new Namespace. GeoServer will automatically create the corresponding Workspace. Prefix and URI are mandatory and cannot be empty. If a Namespace with the given prefix already exists, it won't be created.- Parameters:
prefix- The name of the new Namespace.uri- The URI of the new Namespace.- Returns:
- true if the Namespace was successfully created.
- See Also:
- GeoServer Documentation
-
updateNamespace
public boolean updateNamespace(java.lang.String prefix, java.net.URI uri)Update a Namespace URI. Prefix and URI are mandatory and cannot be empty. A Namespace with the given prefix should exist.- Parameters:
prefix- The prefix of an existing Namespace.uri- The new URI.- Returns:
- true if the Namespace was successfully updated.
-
removeNamespace
public boolean removeNamespace(java.lang.String prefix, boolean recurse)Remove a given Namespace. It will remove the associated Workspace as well.- Parameters:
prefix- The Namespace prefixrecurse- The recurse parameter is used to recursively delete all resources contained in the workspace associated with this Namespace. This includes data stores, coverage stores, feature types, etc... Allowable values for this parameter are true or false. The default (safer) value is false.- Returns:
- true if the Namespace was successfully removed.
-
publishStyle
public boolean publishStyle(java.lang.String sldBody)
Store and publish a Style.- Parameters:
sldBody- the full SLD document as a String.- Returns:
- true if the operation completed successfully.
-
publishStyle
public boolean publishStyle(java.lang.String sldBody, java.lang.String name) throws java.lang.IllegalArgumentExceptionStore and publish a Style, assigning it a name.- Parameters:
sldBody- the full SLD document as a String.name- the Style name.- Returns:
- true if the operation completed successfully.
- Throws:
java.lang.IllegalArgumentException- if the style body is null or empty.
-
publishStyle
public boolean publishStyle(java.io.File sldFile)
Store and publish a Style.- Parameters:
sldFile- the File containing the SLD document.- Returns:
- true if the operation completed successfully.
-
publishStyle
public boolean publishStyle(java.io.File sldFile, java.lang.String name)Store and publish a Style, assigning it a name.- Parameters:
sldFile- the File containing the SLD document.name- the Style name.- Returns:
- true if the operation completed successfully.
-
publishStyle
public boolean publishStyle(java.lang.String sldBody, java.lang.String name, boolean raw)Store and publish a Style, assigning it a name and choosing the raw format.- Parameters:
sldBody- the full SLD document as a String.name- the Style name.raw- the raw format- Returns:
- true if the operation completed successfully.
-
publishStyle
public boolean publishStyle(java.io.File sldFile, java.lang.String name, boolean raw)Store and publish a Style, assigning it a name and choosing the raw format.- Parameters:
sldFile- the File containing the SLD document.name- the Style name.raw- the raw format- Returns:
- true if the operation completed successfully.
-
updateStyle
public boolean updateStyle(java.io.File sldFile, java.lang.String name, boolean raw) throws java.lang.IllegalArgumentExceptionUpdate a Style.- Parameters:
sldFile- the File containing the SLD document.name- the Style name.raw- the raw format- Returns:
- true if the operation completed successfully.
- Throws:
java.lang.IllegalArgumentException- if the style body or name are null or empty.
-
updateStyle
public boolean updateStyle(java.lang.String sldBody, java.lang.String name, boolean raw) throws java.lang.IllegalArgumentExceptionUpdate a Style.- Parameters:
sldBody- the new SLD document as a String.name- the Style name.raw- the raw format- Returns:
- true if the operation completed successfully.
- Throws:
java.lang.IllegalArgumentException- if the style body or name are null or empty.
-
updateStyle
public boolean updateStyle(java.lang.String sldBody, java.lang.String name) throws java.lang.IllegalArgumentExceptionUpdate a Style.- Parameters:
sldBody- the new SLD document as a String.name- the Style name to update.- Returns:
- true if the operation completed successfully.
- Throws:
java.lang.IllegalArgumentException- if the style body or name are null or empty.
-
updateStyle
public boolean updateStyle(java.io.File sldFile, java.lang.String name) throws java.lang.IllegalArgumentExceptionUpdate a Style.- Parameters:
sldFile- the File containing the SLD document.name- the Style name.- Returns:
- true if the operation completed successfully.
- Throws:
java.lang.IllegalArgumentException- if the sldFile file or name are null or name is empty.
-
removeStyle
public boolean removeStyle(java.lang.String styleName, boolean purge) throws java.lang.IllegalArgumentExceptionRemove a Style.The Style will be unpublished, and (optionally) the SLD file will be removed.
- Parameters:
styleName- the name of the Style to remove.purge- remove the related SLD file from disk.- Returns:
- true if the operation completed successfully.
- Throws:
java.lang.IllegalArgumentException- if styleName is null or empty.
-
removeStyle
public boolean removeStyle(java.lang.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.
-
publishStyleInWorkspace
public boolean publishStyleInWorkspace(java.lang.String workspace, java.lang.String sldBody)publishStyleInWorkspace
- Parameters:
workspace- aStringobject.sldBody- aStringobject.- Returns:
- a boolean.
- Since:
- GeoServer 2.2
-
publishStyleInWorkspace
public boolean publishStyleInWorkspace(java.lang.String workspace, java.lang.String sldBody, java.lang.String name) throws java.lang.IllegalArgumentExceptionpublishStyleInWorkspace
- Parameters:
workspace- aStringobject.sldBody- aStringobject.name- aStringobject.- Returns:
- a boolean.
- Throws:
java.lang.IllegalArgumentException- if any.- Since:
- GeoServer 2.2
-
publishStyleInWorkspace
public boolean publishStyleInWorkspace(java.lang.String workspace, java.io.File sldFile)publishStyleInWorkspace
- Parameters:
workspace- aStringobject.sldFile- aFileobject.- Returns:
- a boolean.
- Since:
- GeoServer 2.2
- See Also:
GeoServerRESTStyleManager.publishStyleInWorkspace(java.lang.String, java.io.File)
-
publishStyleInWorkspace
public boolean publishStyleInWorkspace(java.lang.String workspace, java.io.File sldFile, java.lang.String name)publishStyleInWorkspace
- Parameters:
workspace- aStringobject.sldFile- aFileobject.name- aStringobject.- Returns:
- a boolean.
- Since:
- GeoServer 2.2
- See Also:
GeoServerRESTStyleManager.publishStyleInWorkspace(java.lang.String, java.io.File, java.lang.String)
-
updateStyleInWorkspace
public boolean updateStyleInWorkspace(java.lang.String workspace, java.lang.String sldBody, java.lang.String name) throws java.lang.IllegalArgumentExceptionupdateStyleInWorkspace
- Parameters:
workspace- aStringobject.sldBody- aStringobject.name- aStringobject.- Returns:
- a boolean.
- Throws:
java.lang.IllegalArgumentException- if any.- Since:
- GeoServer 2.2
- See Also:
GeoServerRESTStyleManager.updateStyleInWorkspace(java.lang.String, java.lang.String, java.lang.String)
-
updateStyleInWorkspace
public boolean updateStyleInWorkspace(java.lang.String workspace, java.io.File sldFile, java.lang.String name) throws java.lang.IllegalArgumentExceptionupdateStyleInWorkspace
- Parameters:
workspace- aStringobject.sldFile- aFileobject.name- aStringobject.- Returns:
- a boolean.
- Throws:
java.lang.IllegalArgumentException- if any.- Since:
- GeoServer 2.2
- See Also:
GeoServerRESTStyleManager.updateStyleInWorkspace(java.lang.String, java.io.File, java.lang.String)
-
removeStyleInWorkspace
public boolean removeStyleInWorkspace(java.lang.String workspace, java.lang.String styleName, boolean purge) throws java.lang.IllegalArgumentExceptionremoveStyleInWorkspace
- Parameters:
workspace- aStringobject.styleName- aStringobject.purge- a boolean.- Returns:
- a boolean.
- Throws:
java.lang.IllegalArgumentException- if any.- Since:
- GeoServer 2.2
- See Also:
GeoServerRESTStyleManager.removeStyleInWorkspace(java.lang.String, java.lang.String, boolean)
-
removeStyleInWorkspace
public boolean removeStyleInWorkspace(java.lang.String workspace, java.lang.String styleName)removeStyleInWorkspace
- Parameters:
workspace- aStringobject.styleName- aStringobject.- Returns:
- a boolean.
- Since:
- GeoServer 2.2
- See Also:
GeoServerRESTStyleManager.removeStyleInWorkspace(java.lang.String, java.lang.String)
-
createStore
public boolean createStore(java.lang.String workspace, GeoServerRESTPublisher.StoreType dsType, java.lang.String storeName, GeoServerRESTPublisher.UploadMethod method, java.lang.String extension, java.lang.String mimeType, java.net.URI uri, GeoServerRESTPublisher.ParameterConfigure configure, org.apache.commons.httpclient.NameValuePair... params) throws java.io.FileNotFoundException, java.lang.IllegalArgumentExceptionUpload and publish data (vector or raster), and automatically create the associated Store if needed. This is a generic method; usecreateDataStore(java.lang.String, java.lang.String, it.geosolutions.geoserver.rest.GeoServerRESTPublisher.UploadMethod, it.geosolutions.geoserver.rest.GeoServerRESTPublisher.DataStoreExtension, java.lang.String, java.net.URI, it.geosolutions.geoserver.rest.GeoServerRESTPublisher.ParameterConfigure, org.apache.commons.httpclient.NameValuePair...)andcreateCoverageStore(java.lang.String, java.lang.String, it.geosolutions.geoserver.rest.GeoServerRESTPublisher.UploadMethod, it.geosolutions.geoserver.rest.GeoServerRESTPublisher.CoverageStoreExtension, java.lang.String, java.net.URI, it.geosolutions.geoserver.rest.GeoServerRESTPublisher.ParameterConfigure, org.apache.commons.httpclient.NameValuePair...)for vector and raster publishing respectively.- Parameters:
workspace- workspace where data will be published.dsType- Store type. SeeGeoServerRESTPublisher.DataStoreType.storeName- Store name. Will be created if doesn't exist.method- Publication method. SeeGeoServerRESTPublisher.UploadMethod.extension- Dataset format. One ofGeoServerRESTPublisher.DataStoreExtensionfor vector data, or one ofGeoServerRESTPublisher.CoverageStoreExtensionfor raster data.mimeType- Dataset MIME type.uri- The data location. A local path forGeoServerRESTPublisher.UploadMethod.FILE, a server path forGeoServerRESTPublisher.UploadMethod.EXTERNAL, or a URL forGeoServerRESTPublisher.UploadMethod.URL.configure- Indicate if associated feature types will be automatically configured. SeeGeoServerRESTPublisher.ParameterConfigure.params- Other parameters to be included in request, such as "update", "charset" or "coverageName". See GeoServer REST documentation for details: dataStore and coverageStore operations.- Returns:
trueif the store was successfully created.- Throws:
java.io.FileNotFoundException- if local file does not exist when using theGeoServerRESTPublisher.UploadMethod.FILEmethod.java.lang.IllegalArgumentException- if any of the mandatoryworkspace,dsType,storeName,method,extension,mimeTypeoruriparameters arenull.
-
createPostGISDatastore
public boolean createPostGISDatastore(java.lang.String workspace, GSPostGISDatastoreEncoder datastoreEncoder)Deprecated.Will be deleted in next version 1.5.x, useGeoServerRESTStoreManagerinstead.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
-
publishDBLayer
public boolean publishDBLayer(java.lang.String workspace, java.lang.String storename, java.lang.String layername, java.lang.String srs, java.lang.String defaultStyle)Deprecated.Will be removed in the next release.publishDBLayer
- Parameters:
workspace- aStringobject.storename- aStringobject.layername- aStringobject.srs- aStringobject.defaultStyle- aStringobject.- Returns:
- a boolean.
-
publishDBLayer
public boolean publishDBLayer(java.lang.String workspace, java.lang.String storename, GSFeatureTypeEncoder fte, GSLayerEncoder layerEncoder)Publish and configure a new layer from an existing DataStore (v. gr. a layer from a DB table).- Parameters:
workspace- Workspace name where DataStore is.storename- DataStore name.fte- FeatureType configuration details using aGSFeatureTypeEncoder.layerEncoder- aGSLayerEncoderobject.- Returns:
trueif layer is successfully created.
-
publishShp
public boolean publishShp(java.lang.String workspace, java.lang.String storename, java.lang.String datasetname, java.io.File zipFile) throws java.io.FileNotFoundException, java.lang.IllegalArgumentExceptionUpload an publish a local shapefile.The SRS will be set to EPSG:4326.
- Parameters:
workspace- The workspace name.storename- The store name.datasetname- The layer name.zipFile- The zipped file to publish.- Returns:
trueif the operation completed successfully.- Throws:
java.io.FileNotFoundException- , IllegalArgumentExceptionjava.lang.IllegalArgumentException- if any.- See Also:
publishShp(java.lang.String, java.lang.String, org.apache.commons.httpclient.NameValuePair[], java.lang.String, it.geosolutions.geoserver.rest.GeoServerRESTPublisher.UploadMethod, java.net.URI, java.lang.String, java.lang.String, it.geosolutions.geoserver.rest.encoder.GSResourceEncoder.ProjectionPolicy, java.lang.String)
-
publishShp
public boolean publishShp(java.lang.String workspace, java.lang.String storeName, org.apache.commons.httpclient.NameValuePair[] storeParams, java.lang.String datasetName, GeoServerRESTPublisher.UploadMethod method, java.net.URI shapefile, java.lang.String srs, java.lang.String nativeCRS, GSResourceEncoder.ProjectionPolicy policy, java.lang.String defaultStyle) throws java.io.FileNotFoundException, java.lang.IllegalArgumentExceptionPublish a shapefile.- Parameters:
workspace- the name of the workspace to usestoreName- the name of the store to createstoreParams- parameters to append to the url (can be null).
Accepted parameters are:
- charset used to set the charset
storeName- the name of the store to createstoreName- the name of the layer to configuremethod-GeoServerRESTPublisher.UploadMethodshapefile- the uri of the file containing the shapefile.It should be:- A zip file if 'method' is file
- A shp file if 'method' is external
- A zip file if 'method' is uri (UNTESTED)
srs- the SRS for this shapefile. It must be an ESPG code or GeoServer will choke.nativeCRS- the nativeCRS for this shapefile. It can be an EPSG code (forGSResourceEncoder.ProjectionPolicy.NONEor a WKT forGSResourceEncoder.ProjectionPolicy.REPROJECT_TO_DECLARED.policy-GSResourceEncoder.ProjectionPolicydefaultStyle- the default style to set (can be null).datasetName- aStringobject.- Returns:
- true if success false otherwise
- Throws:
java.io.FileNotFoundException- if file to upload is not foundjava.lang.IllegalArgumentException- if any of the mandatory arguments arenull.
-
publishShp
public boolean publishShp(java.lang.String workspace, java.lang.String storeName, org.apache.commons.httpclient.NameValuePair[] storeParams, java.lang.String datasetName, GeoServerRESTPublisher.UploadMethod method, java.net.URI shapefile, java.lang.String srs, GSResourceEncoder.ProjectionPolicy policy, java.lang.String defaultStyle) throws java.io.FileNotFoundException, java.lang.IllegalArgumentExceptionDeprecated.usepublishShp(String, String, NameValuePair[], String, UploadMethod, URI, String, String)instead as the behaviour of this method is misleading as it allows you to use wrong ProjectionPolicy values.Publish a shapefile.- Parameters:
workspace- the name of the workspace to usestoreName- the name of the store to createstoreParams- parameters to append to the url (can be null).
Accepted parameters are:
- charset used to set the charset
method-GeoServerRESTPublisher.UploadMethodshapefile- the uri of the file containing the shapefile.It should be:- A zip file if 'method' is file
- A shp file if 'method' is external
- A zip file if 'method' is uri (UNTESTED)
srs- the SRS for this shapefile. It must be an ESPG code or GeoServer will choke. Notice that we can only useGSResourceEncoder.ProjectionPolicy.FORCE_DECLARED.policy-GSResourceEncoder.ProjectionPolicydefaultStyle- the default style to set (can be null).datasetName- aStringobject.- Returns:
- true if success false otherwise
- Throws:
java.io.FileNotFoundException- if file to upload is not foundjava.lang.IllegalArgumentException- if any of the mandatory arguments arenull.
-
publishShp
public boolean publishShp(java.lang.String workspace, java.lang.String storeName, org.apache.commons.httpclient.NameValuePair[] storeParams, java.lang.String datasetName, GeoServerRESTPublisher.UploadMethod method, java.net.URI shapefile, java.lang.String srs, java.lang.String defaultStyle) throws java.io.FileNotFoundException, java.lang.IllegalArgumentExceptionPublish a shapefile.- Parameters:
workspace- the name of the workspace to usestoreName- the name of the store to createstoreParams- parameters to append to the url (can be null).
Accepted parameters are:
- charset used to set the charset
method-GeoServerRESTPublisher.UploadMethodshapefile- the uri of the file containing the shapefile.It should be:- A zip file if 'method' is file
- A shp file if 'method' is external
- A zip file if 'method' is uri (UNTESTED)
srs- the SRS for this shapefile. It must be an ESPG code or GeoServer will choke.defaultStyle- the default style to set (can be null).datasetName- aStringobject.- Returns:
- true if success false otherwise
- Throws:
java.io.FileNotFoundException- if file to upload is not foundjava.lang.IllegalArgumentException- if any of the mandatory arguments arenull.
-
publishShp
public boolean publishShp(java.lang.String workspace, java.lang.String storename, java.lang.String layerName, java.io.File zipFile, java.lang.String srs, java.lang.String defaultStyle) throws java.io.FileNotFoundException, java.lang.IllegalArgumentExceptionPublish a zipped shapefile.- Parameters:
workspace- the name of the workspace to usestorename- the name of the store to createlayerName- the name of the layer to configurezipFile- The zipped file to publishsrs- the srs for this shapefile. It will be forced to use this one in GeoServer usingGSResourceEncoder.ProjectionPolicy.FORCE_DECLARED.defaultStyle- the default style to set (can be null).- Returns:
trueif the operation completed successfully- Throws:
java.io.FileNotFoundException- if file to upload is not foundjava.lang.IllegalArgumentException- if any of the mandatory arguments arenull.- See Also:
publishShp(java.lang.String, java.lang.String, org.apache.commons.httpclient.NameValuePair[], java.lang.String, it.geosolutions.geoserver.rest.GeoServerRESTPublisher.UploadMethod, java.net.URI, java.lang.String, java.lang.String, it.geosolutions.geoserver.rest.encoder.GSResourceEncoder.ProjectionPolicy, java.lang.String)
-
publishShp
public boolean publishShp(java.lang.String workspace, java.lang.String storename, java.lang.String layername, java.io.File zipFile, java.lang.String srs) throws java.io.FileNotFoundExceptionPublish a zipped shapefile forcing the srs to the one provided.- Parameters:
workspace- the name of the workspace to usestorename- the name of the store to createlayername- the name of the layer to configurezipFile- The zipped file to publishsrs- the CRS for this shapefile. It must be an EPSG CODE !- Returns:
trueif the operation completed successfully.- Throws:
java.io.FileNotFoundException- if file to upload is not foundjava.lang.IllegalArgumentException- if any of the mandatory arguments arenull.- See Also:
publishShp(java.lang.String, java.lang.String, org.apache.commons.httpclient.NameValuePair[], java.lang.String, it.geosolutions.geoserver.rest.GeoServerRESTPublisher.UploadMethod, java.net.URI, java.lang.String, java.lang.String, it.geosolutions.geoserver.rest.encoder.GSResourceEncoder.ProjectionPolicy, java.lang.String)
-
publishShp
public boolean publishShp(java.lang.String workspace, java.lang.String storename, java.lang.String layername, java.io.File zipFile, java.lang.String srs, org.apache.commons.httpclient.NameValuePair... params) throws java.io.FileNotFoundException, java.lang.IllegalArgumentExceptionPublish a zipped shapefile.- Parameters:
workspace- the name of the workspace to usestorename- the name of the store to createlayername- the name of the layer to configurezipFile- the zip file containing the shapefilesrs- the shapefile srs. This must be an EPSG Codefor this code to work!params- parameters to append to the url (can be null).
Accepted parameters are:
- charset used to set the charset
- Returns:
trueif the operation completed successfully.- Throws:
java.io.FileNotFoundException- if file to upload is not foundjava.lang.IllegalArgumentException- if any of the mandatory arguments arenull.- See Also:
publishShp(java.lang.String, java.lang.String, org.apache.commons.httpclient.NameValuePair[], java.lang.String, it.geosolutions.geoserver.rest.GeoServerRESTPublisher.UploadMethod, java.net.URI, java.lang.String, java.lang.String, it.geosolutions.geoserver.rest.encoder.GSResourceEncoder.ProjectionPolicy, java.lang.String)
-
publishShpCollection
public boolean publishShpCollection(java.lang.String workspace, java.lang.String storeName, java.net.URI resource) throws java.io.FileNotFoundExceptionPublish a collection of shapefiles.Will automatically create the store and publish each shapefile as a layer.
- Parameters:
workspace- the name of the workspace to usestoreName- the name of the store to createresource- the shapefile collection. It can be:- A path to a directory containing shapefiles in the server.
- A local zip file containing shapefiles that will be uploaded.
- A URL pointing to a shapefile collection in the wild web (not tested).
- Returns:
trueif publication successful.- Throws:
java.io.FileNotFoundException- if the specified zip file does not exist.
-
publishArcGrid
public boolean publishArcGrid(java.lang.String workspace, java.lang.String storeName, java.io.File arcgrid) throws java.io.FileNotFoundExceptionUpload and publish a ArcGrid image.- Parameters:
workspace- Workspace to usestoreName- The store name to be used or created.arcgrid- The ArcGrid file.- Returns:
- true if success.
- Throws:
java.io.FileNotFoundException- if ArcGrid file does not exist.
-
publishArcGrid
public boolean publishArcGrid(java.lang.String workspace, java.lang.String storeName, java.lang.String coverageName, java.io.File arcgrid) throws java.io.FileNotFoundException, java.lang.IllegalArgumentExceptionUpload and publish a ArcGrid image.- Parameters:
workspace- Workspace to usestoreName- 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)arcgrid- file to upload- Returns:
- true if the operation completed successfully.
- Throws:
java.io.FileNotFoundException- if file does not existsjava.lang.IllegalArgumentException- if workspace or arcgrid are null
-
publishArcGrid
public boolean publishArcGrid(java.lang.String workspace, java.lang.String storeName, java.lang.String coverageName, java.io.File arcgrid, java.lang.String srs, GSResourceEncoder.ProjectionPolicy policy, java.lang.String defaultStyle, double[] bbox) throws java.io.FileNotFoundException, java.lang.IllegalArgumentExceptionUpload and publish a ArcGrid image.- Parameters:
workspace- Workspace to usestoreName- 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)arcgrid- file to uploadsrs- the native CRSpolicy- projection policy. SeeGSResourceEncoder.ProjectionPolicy.defaultStyle- the default style to apply.bbox- An array of 4 doubles indicating envelope in EPSG:4326. Order is [Xmin, Ymin, Xmax, Ymax].- Returns:
- true if the operation completed successfully.
- Throws:
java.io.FileNotFoundException- if file does not existsjava.lang.IllegalArgumentException- if workspace or arcgrid are null
-
publishExternalArcGrid
public boolean publishExternalArcGrid(java.lang.String workspace, java.lang.String storeName, java.io.File arcgrid, java.lang.String coverageName, java.lang.String srs, GSResourceEncoder.ProjectionPolicy policy, java.lang.String defaultStyle) throws java.io.FileNotFoundException, java.lang.IllegalArgumentExceptionPublish a ArcGrid already in a filesystem readable by GeoServer.- Parameters:
workspace- an existing workspacestoreName- the coverageStore to be createdarcgrid- the arcGrid to be publishedsrs- the native CRSpolicy- projection policy. SeeGSResourceEncoder.ProjectionPolicy.defaultStyle- the default style to apply.coverageName- aStringobject.- Returns:
- true if the operation completed successfully.
- Throws:
java.io.FileNotFoundException- if file does not existsjava.lang.IllegalArgumentException- if any of the mandatory parameters are null.
-
publishExternalArcGrid
public RESTCoverageStore publishExternalArcGrid(java.lang.String workspace, java.lang.String storeName, java.io.File arcgrid, GSCoverageEncoder coverageEncoder, GSLayerEncoder layerEncoder) throws java.lang.IllegalArgumentException, java.io.FileNotFoundException
Publish a ArcGrid already in a filesystem readable by GeoServer.- Parameters:
workspace- an existing workspacestoreName- the coverageStore to be createdarcgrid- the arcGrid to be publishedcoverageEncoder- coverage details. SeeGSCoverageEncoder.layerEncoder- layer details, SeeGSLayerEncoder.- Returns:
- true if the operation completed successfully.
- Throws:
java.io.FileNotFoundException- if file does not existsjava.lang.IllegalArgumentException- if any of the mandatory parameters are null.
-
publishGeoTIFF
public boolean publishGeoTIFF(java.lang.String workspace, java.lang.String storeName, java.io.File geotiff) throws java.io.FileNotFoundExceptionUpload and publish a GeoTIFF image.- Parameters:
workspace- Workspace to usestoreName- The store name to be used or created.geotiff- The GeoTIFF file.- Returns:
- true if success.
- Throws:
java.io.FileNotFoundException- if GeoTIFF file does not exist.
-
publishGeoTIFF
public boolean publishGeoTIFF(java.lang.String workspace, java.lang.String storeName, java.lang.String coverageName, java.io.File geotiff) throws java.io.FileNotFoundException, java.lang.IllegalArgumentExceptionUpload and publish a GeoTIFF image.- Parameters:
workspace- Workspace to usestoreName- 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:
java.io.FileNotFoundException- if file does not existsjava.lang.IllegalArgumentException- if workspace or geotiff are null
-
publishGeoTIFF
public boolean publishGeoTIFF(java.lang.String workspace, java.lang.String storeName, java.lang.String resourceName, java.io.File geotiff, java.lang.String srs, GSResourceEncoder.ProjectionPolicy policy, java.lang.String defaultStyle) throws java.io.FileNotFoundException, java.lang.IllegalArgumentExceptionDeprecated.use the former method with bbox set to null.Same aspublishGeoTIFF(java.lang.String, java.lang.String, java.lang.String, java.io.File, java.lang.String, it.geosolutions.geoserver.rest.encoder.GSResourceEncoder.ProjectionPolicy, java.lang.String, double[])but without the last parameter (bbox). Kept here for backwards compatibility.- Parameters:
workspace- aStringobject.storeName- aStringobject.resourceName- aStringobject.geotiff- aFileobject.srs- aStringobject.policy- aGSResourceEncoder.ProjectionPolicyobject.defaultStyle- aStringobject.- Returns:
- a boolean.
- Throws:
java.io.FileNotFoundException- if any.java.lang.IllegalArgumentException- if any.
-
publishGeoTIFF
public boolean publishGeoTIFF(java.lang.String workspace, java.lang.String storeName, java.lang.String coverageName, java.io.File geotiff, java.lang.String srs, GSResourceEncoder.ProjectionPolicy policy, java.lang.String defaultStyle, double[] bbox) throws java.io.FileNotFoundException, java.lang.IllegalArgumentExceptionUpload and publish a GeoTIFF image.- Parameters:
workspace- Workspace to usestoreName- 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 uploadsrs- the native CRSpolicy- projection policy. SeeGSResourceEncoder.ProjectionPolicy.defaultStyle- the default style to apply.bbox- An array of 4 doubles indicating envelope in EPSG:4326. Order is [Xmin, Ymin, Xmax, Ymax].- Returns:
- true if the operation completed successfully.
- Throws:
java.io.FileNotFoundException- if file does not existsjava.lang.IllegalArgumentException- if workspace or geotiff are null
-
publishExternalGeoTIFF
public boolean publishExternalGeoTIFF(java.lang.String workspace, java.lang.String storeName, java.io.File geotiff, java.lang.String coverageName, java.lang.String srs, GSResourceEncoder.ProjectionPolicy policy, java.lang.String defaultStyle) throws java.io.FileNotFoundException, java.lang.IllegalArgumentExceptionPublish a GeoTiff already in a filesystem readable by GeoServer.- Parameters:
workspace- an existing workspacestoreName- the coverageStore to be createdgeotiff- the geoTiff to be publishedsrs- the native CRSpolicy- projection policy. SeeGSResourceEncoder.ProjectionPolicy.defaultStyle- the default style to apply.coverageName- aStringobject.- Returns:
- true if the operation completed successfully.
- Throws:
java.io.FileNotFoundException- if file does not existsjava.lang.IllegalArgumentException- if any of the mandatory parameters are null.
-
publishExternalGeoTIFF
public RESTCoverageStore publishExternalGeoTIFF(java.lang.String workspace, java.lang.String storeName, java.io.File geotiff, GSCoverageEncoder coverageEncoder, GSLayerEncoder layerEncoder) throws java.lang.IllegalArgumentException, java.io.FileNotFoundException
Publish a GeoTiff already in a filesystem readable by GeoServer.- Parameters:
workspace- an existing workspacestoreName- the coverageStore to be createdgeotiff- the geoTiff to be publishedcoverageEncoder- coverage details. SeeGSCoverageEncoder.layerEncoder- layer details, SeeGSLayerEncoder.- Returns:
- true if the operation completed successfully.
- Throws:
java.io.FileNotFoundException- if file does not existsjava.lang.IllegalArgumentException- if any of the mandatory parameters are null.
-
publishWorldImage
public boolean publishWorldImage(java.lang.String workspace, java.lang.String coveragestore, java.io.File zipFile) throws java.io.FileNotFoundExceptionPublish a zipped worldimage file. It is assumed that the the zip-file contain the *.prj to set the srs.- Parameters:
workspace- Workspace to usecoveragestore- Name of the coveragestorezipFile- zip file to upload- Returns:
- true if the operation completed successfully.
- Throws:
java.io.FileNotFoundException- if any.
-
publishWorldImage
public boolean publishWorldImage(java.lang.String workspace, java.lang.String coveragestore, java.io.File zipFile, GeoServerRESTPublisher.ParameterConfigure configure, org.apache.commons.httpclient.NameValuePair... params) throws java.io.FileNotFoundExceptionPublish a zipped worldimage file. It is assumed that the the zip-file contain the *.prj to set the srs.- Parameters:
workspace- Workspace to usecoveragestore- Name of the coveragestorezipFile- zip file to uploadconfigure- Configure parameter. SeeGeoServerRESTPublisher.ParameterConfigure. It can 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
GeoServerRESTPublisher.ParameterConfigure.NONE.
- coverageName=name coverageName parameter to append. Only works if configure is not set to
- Returns:
- true if the operation completed successfully.
- Throws:
java.io.FileNotFoundException- if any.
-
publishImageMosaic
public boolean publishImageMosaic(java.lang.String workspace, java.lang.String storeName, java.io.File zipFile) throws java.io.FileNotFoundExceptionPublish imagemosaic as zip file.- Parameters:
workspace- Workspace to usestoreName- Name of the coveragestorezipFile- file to upload- Returns:
- true if the operation completed successfully.
- Throws:
java.io.FileNotFoundException- if any.
-
publishImageMosaic
public boolean publishImageMosaic(java.lang.String workspace, java.lang.String storeName, java.io.File zipFile, GeoServerRESTPublisher.ParameterConfigure configure, org.apache.commons.httpclient.NameValuePair... params) throws java.io.FileNotFoundExceptionPublish imagemosaic as zip file.- Parameters:
workspace- Workspace to usestoreName- Name of the coveragestorezipFile- file to uploadconfigure- Configure parameter. SeeGeoServerRESTPublisher.ParameterConfigure. It can 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:
java.io.FileNotFoundException- if any.
-
createExternaMosaicDatastore
public RESTCoverageStore createExternaMosaicDatastore(java.lang.String workspace, java.lang.String storeName, java.io.File mosaicDir, GeoServerRESTPublisher.ParameterConfigure configure, GeoServerRESTPublisher.ParameterUpdate update) throws java.io.FileNotFoundException
Publish a Mosaic from a filesystem currently readable by GeoServer.- Parameters:
workspace- an existing workspacestoreName- the name of the coverageStore to be createdmosaicDir- the directory where the raster images are locatedconfigure- a specify if a coverage should be configuredupdate- aGeoServerRESTPublisher.ParameterUpdateobject.- Returns:
- true if the operation completed successfully.
- Throws:
java.io.FileNotFoundException- if any.
-
publishExternalMosaic
public boolean publishExternalMosaic(java.lang.String workspace, java.lang.String storeName, java.io.File mosaicDir, java.lang.String srs, java.lang.String defaultStyle) throws java.io.FileNotFoundExceptionPublish a Mosaic already in a filesystem readable by GeoServer.- Parameters:
workspace- an existing workspacestoreName- the name of the coverageStore to be createdmosaicDir- the directory where the raster images are locatedsrs- the coverage declared SRSdefaultStyle- may be null- Returns:
- true if the operation completed successfully.
- Throws:
java.io.FileNotFoundException- if any.
-
createExternalMosaic
public boolean createExternalMosaic(java.lang.String workspace, java.lang.String storeName, java.io.File mosaicDir, GSCoverageEncoder coverageEncoder, GSLayerEncoder layerEncoder) throws java.io.FileNotFoundExceptioncreateExternalMosaic
- Parameters:
workspace- aStringobject.storeName- aStringobject.mosaicDir- aFileobject.coverageEncoder- aGSCoverageEncoderobject.layerEncoder- aGSLayerEncoderobject.- Returns:
- a boolean.
- Throws:
java.io.FileNotFoundException- if any.
-
publishExternalMosaic
public boolean publishExternalMosaic(java.lang.String workspace, java.lang.String storeName, java.io.File mosaicDir, GSCoverageEncoder coverageEncoder, GSLayerEncoder layerEncoder) throws java.io.FileNotFoundException, java.lang.IllegalArgumentExceptionPublish a Mosaic already in a filesystem readable by GeoServer.- Parameters:
workspace- an existing workspacestoreName- the name of the coverageStore to be createdmosaicDir- the directory where the raster images are locatedcoverageEncoder- 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:
java.io.FileNotFoundException- if any.java.lang.IllegalArgumentException- if any.
-
unpublishCoverage
public boolean unpublishCoverage(java.lang.String workspace, java.lang.String storename, java.lang.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.
- Parameters:
workspace- aStringobject.storename- aStringobject.layerName- aStringobject.- Returns:
- true if the operation completed successfully.
-
unpublishFeatureType
public boolean unpublishFeatureType(java.lang.String workspace, java.lang.String storename, java.lang.String layerName)Removes the featuretype and the associated layer.You may also want to
remove the datastore.- Parameters:
workspace- aStringobject.storename- aStringobject.layerName- aStringobject.- Returns:
- true if the operation completed successfully.
-
removeDatastore
public boolean removeDatastore(java.lang.String workspace, java.lang.String storename)Deprecated.will be removed in next release useremoveDatastore(String, String, boolean)Remove recursively a given Datastore in a given Workspace.- Parameters:
workspace- The name of the workspacestorename- The name of the Datastore to remove.- Returns:
- true if the datastore was successfully removed.
-
removeDatastore
public boolean removeDatastore(java.lang.String workspace, java.lang.String storename, boolean recurse) throws java.lang.IllegalArgumentExceptionRemove a given Datastore in a given Workspace.- Parameters:
workspace- The name of the workspacestorename- The name of the Datastore to remove.recurse- if remove should be performed recursively- Returns:
- true if the datastore was successfully removed.
- Throws:
java.lang.IllegalArgumentException- if workspace or storename are null or empty
-
removeDatastore
public boolean removeDatastore(java.lang.String workspace, java.lang.String storename, boolean recurse, GeoServerRESTPublisher.Purge purge) throws java.lang.IllegalArgumentExceptionremoveDatastore
- Parameters:
workspace- aStringobject.storename- aStringobject.recurse- a boolean.purge- aGeoServerRESTPublisher.Purgeobject.- Returns:
- a boolean.
- Throws:
java.lang.IllegalArgumentException- if any.
-
removeCoverageStore
public boolean removeCoverageStore(java.lang.String workspace, java.lang.String storename)Deprecated.Remove recursively a given CoverageStore in a given Workspace.- Parameters:
workspace- The name of the workspacestorename- The name of the CoverageStore to remove.- Returns:
- true if the CoverageStore was successfully removed.
-
removeCoverageStore
public boolean removeCoverageStore(java.lang.String workspace, java.lang.String storename, boolean recurse) throws java.lang.IllegalArgumentExceptionRemove a given CoverageStore in a given Workspace.- Parameters:
workspace- The name of the workspacestorename- The name of the CoverageStore to remove.recurse- if remove should be performed recursively- Returns:
- true if the CoverageStore was successfully removed.
- Throws:
java.lang.IllegalArgumentException- if any.
-
removeCoverageStore
public boolean removeCoverageStore(java.lang.String workspace, java.lang.String storename, boolean recurse, GeoServerRESTPublisher.Purge purge) throws java.lang.IllegalArgumentExceptionRemove a given CoverageStore in a given Workspace. Note that purging may not work when deleting mosaics (https://jira.codehaus.org/browse/GEOT-4613).- Parameters:
workspace- The name of the workspacestorename- The name of the CoverageStore to remove.recurse- if remove should be performed recursivelypurge- the purge method- Returns:
- true if the CoverageStore was successfully removed.
- Throws:
java.lang.IllegalArgumentException- if any.
-
removeStore
public boolean removeStore(java.lang.String workspace, java.lang.String storename, GeoServerRESTPublisher.StoreType type, boolean recurse, GeoServerRESTPublisher.Purge purge) throws java.lang.IllegalArgumentExceptionRemove a given Datastore in a given Workspace.- Parameters:
workspace- The name of the workspacestorename- The name of the Datastore to remove.type- theGeoServerRESTPublisher.StoreTypetyperecurse- if remove should be performed recursivelypurge- the purge method- Returns:
- true if the store was successfully removed.
- Throws:
java.lang.IllegalArgumentException- if workspace or storename are null or empty
-
removeWorkspace
public boolean removeWorkspace(java.lang.String workspace)
Deprecated.Remove the workspace given Workspace using default parameters- Parameters:
workspace- the workspace to remove- Returns:
- true if success, false otherwise
- See Also:
removeWorkspace(String, boolean)
-
removeWorkspace
public boolean removeWorkspace(java.lang.String workspace, boolean recurse) throws java.lang.IllegalArgumentExceptionRemove a given Workspace.- Parameters:
workspace- The name of the workspacerecurse- 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:
java.lang.IllegalArgumentException- if any.
-
removeLayerGroup
public boolean removeLayerGroup(java.lang.String workspace, java.lang.String name)Remove a layer group.- Parameters:
workspace- the layer group workspace.name- the layer group name.- Returns:
- true if succeeded.
-
removeLayerGroup
public boolean removeLayerGroup(java.lang.String name)
Remove a layer group.- Parameters:
name- the layer group name.- Returns:
- true if succeeded.
-
removeLayer
public boolean removeLayer(java.lang.String workspace, java.lang.String layerName)remove a generic given layer from a given workspace- Parameters:
workspace- aStringobject.layerName- aStringobject.- Returns:
- true if success
-
reloadStore
public boolean reloadStore(java.lang.String workspace, java.lang.String storeName, GeoServerRESTPublisher.StoreType storeType) throws java.lang.IllegalArgumentExceptionreloadStore
- Parameters:
workspace- aStringobject.storeName- aStringobject.storeType- aGeoServerRESTPublisher.StoreTypeobject.- Returns:
- true if successfully reloaded
- Throws:
java.lang.IllegalArgumentException- if any.
-
reload
public boolean reload()
Reload the target geoserver configuration- Returns:
- true if success
- See Also:
- GeoServer REST Config API
-
reset
public boolean reset()
Reset the target geoserver configuration- Returns:
- true if success
- See Also:
- GeoServer REST Config API
-
configureLayer
public boolean configureLayer(java.lang.String workspace, java.lang.String resourceName, GSLayerEncoder layer) throws java.lang.IllegalArgumentExceptionAllows to configure some layer attributes such as DefaultStyle- Parameters:
workspace- aStringobject.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:
java.lang.IllegalArgumentException- if some arguments are null or empty
-
createLayerGroup
public boolean createLayerGroup(java.lang.String name, GSLayerGroupEncoder group)Create a new LayerGroup using the specified encoder- Parameters:
name- name of the layer groupgroup- group encoder- Returns:
- true if operation was successful
-
createLayerGroup
public boolean createLayerGroup(java.lang.String workspace, java.lang.String name, GSLayerGroupEncoder group)Create a new LayerGroup using the specified encoder- Parameters:
workspace- name of the workspacename- name of the layer groupgroup- group encoder- Returns:
- true if operation was successful
-
configureLayerGroup
public boolean configureLayerGroup(java.lang.String name, GSLayerGroupEncoder group)Update a LayerGroup using the specified encoder- Parameters:
name- name of the layer groupgroup- group encoder- Returns:
- true if operation was successful
-
configureLayerGroup
public boolean configureLayerGroup(java.lang.String workspace, java.lang.String name, GSLayerGroupEncoder group)Update a LayerGroup using the specified encoder- Parameters:
workspace- name of the workspacename- name of the layer groupgroup- group encoder- Returns:
- true if operation was successful
-
configureCoverage
public boolean configureCoverage(GSCoverageEncoder ce, java.lang.String wsname, java.lang.String csname)
Configure an existing coverage in a given workspace and coverage store- Parameters:
ce- contains the coverage name to configure and the configuration to applywsname- the workspace to search for existent coveragecsname- the coverage store to search for existent coverage- Returns:
- true if success
-
configureCoverage
public boolean configureCoverage(GSCoverageEncoder ce, java.lang.String wsname, java.lang.String csname, java.lang.String coverageName)
Configure an existing coverage in a given workspace and coverage store- Parameters:
ce- contains the coverage name to configure and the configuration to applywsname- the workspace to search for existent coveragecsname- the coverage store to search for existent coveragecoverageName- the name of the coverage, useful for changing name for the coverage itself- Returns:
- true if success
-
createCoverage
public boolean createCoverage(GSCoverageEncoder ce, java.lang.String wsname, java.lang.String csname)
Deprecated.createCoverage
- Parameters:
ce- aGSCoverageEncoderobject.wsname- aStringobject.csname- aStringobject.- Returns:
- a boolean.
-
createCoverage
public boolean createCoverage(java.lang.String wsname, java.lang.String storeName, GSCoverageEncoder ce) throws java.lang.IllegalArgumentExceptionCreate a new coverage in a given workspace and coverage store- Parameters:
wsname- the workspace to search for existent coveragestoreName- an existent store name to use as data sourcece- contains the coverage name to create and the configuration to apply- Returns:
- true if success
- Throws:
java.lang.IllegalArgumentException- if arguments are null or empty
-
createResource
public boolean createResource(java.lang.String workspace, GeoServerRESTPublisher.StoreType dsType, java.lang.String storeName, GSResourceEncoder re) throws java.lang.IllegalArgumentExceptionCreate a new resource in a given workspace and store- Parameters:
workspace- the workspace to search for existent coveragestoreName- an existent store name to use as data sourcere- contains the coverage name to create and the configuration to applydsType- aGeoServerRESTPublisher.StoreTypeobject.- Returns:
- true if success
- Throws:
java.lang.IllegalArgumentException- if arguments are null or empty
-
removeResource
public boolean removeResource(java.lang.String workspace, GeoServerRESTPublisher.StoreType dsType, java.lang.String storeName, java.lang.String resName) throws java.lang.IllegalArgumentExceptionConfigure resource in a given workspace and store- Parameters:
workspace- the workspace to search for existent coveragestoreName- an existent store name to use as data sourceresName- contains the coverage name to create and the configuration to applydsType- aGeoServerRESTPublisher.StoreTypeobject.- Returns:
- true if success
- Throws:
java.lang.IllegalArgumentException- if arguments are null or empty
-
configureResource
public boolean configureResource(java.lang.String workspace, GeoServerRESTPublisher.StoreType dsType, java.lang.String storeName, GSResourceEncoder re) throws java.lang.IllegalArgumentExceptionConfigure a resource- Parameters:
workspace- the workspace to search for existent coveragestoreName- an existent store name to use as data sourcere- contains the configuration to apply with the resource namedsType- aGeoServerRESTPublisher.StoreTypeobject.- Returns:
- true if success
- Throws:
java.lang.IllegalArgumentException- if arguments are null or empty
-
configureResource
public boolean configureResource(java.lang.String workspace, GeoServerRESTPublisher.StoreType dsType, java.lang.String storeName, java.lang.String resourceName, GSResourceEncoder re) throws java.lang.IllegalArgumentExceptionConfigure a resource- Parameters:
workspace- the workspace to search for existent coveragestoreName- an existent store name to use as data sourceresourceName- an existent resource namere- contains the configuration to apply, possibly new resource namedsType- aGeoServerRESTPublisher.StoreTypeobject.- Returns:
- true if success
- Throws:
java.lang.IllegalArgumentException- if arguments are null or empty
-
sanitize
protected java.lang.String sanitize(java.lang.String s)
Appends ".DUMMY" to any string containing a dot (sic).- Parameters:
s- aStringobject.- Returns:
- a
Stringobject.
-
harvestExternal
public boolean harvestExternal(java.lang.String workspace, java.lang.String coverageStore, java.lang.String format, java.lang.String path)Create a store or harvest the coverage from the provided external path.- Parameters:
workspace- the GeoServer workspacecoverageStore- the GeoServer coverageStoreformat- the format of the file to uploadpath- the absolute path to the file to upload- Returns:
trueif the call succeeds orfalseotherwise.
-
createImageMosaic
public boolean createImageMosaic(java.lang.String workspace, java.lang.String coverageStore, java.lang.String path)Create a new ImageMosaic with the provided configuration provided as a zip file.This call configures all the coverages contained in the ImageMosaic.
- Parameters:
workspace- the GeoServer workspacecoverageStore- the GeoServer coverageStorepath- the absolute path to the file to upload- Returns:
trueif the call succeeds orfalseotherwise.- Since:
- geoserver-2.4.0, geoserver-mng-1.6.0
-
createImageMosaic
public boolean createImageMosaic(java.lang.String workspace, java.lang.String coverageStore, java.lang.String path, GeoServerRESTStructuredGridCoverageReaderManager.ConfigureCoveragesOption configureOpt)Create a new ImageMosaic with the provided configuration provided as a zip file.With the options configure we can decide whether or not to configure or not the coverages contained in the ImageMosaic.
- Parameters:
workspace- the GeoServer workspacecoverageStore- the GeoServer coverageStorepath- the absolute path to the file to uploadconfigureOpt- tells GeoServer whether to configure all coverages in this mosaic (ALL) or none of them (NONE).- Returns:
trueif the call succeeds orfalseotherwise.- Since:
- geoserver-2.4.0, geoserver-mng-1.6.0
-
removeGranuleById
public boolean removeGranuleById(java.lang.String workspace, java.lang.String coverageStore, java.lang.String coverage, java.lang.String granuleId)Remove a granule from a structured coverage by id.- Parameters:
workspace- the GeoServer workspacecoverageStore- the GeoServer coverageStorecoverage- the name of the target coverage from which we are going to removegranuleId- aStringobject.- Returns:
nullin case the call does not succeed, or an instance ofRESTStructuredCoverageGranulesList.
-
removeGranulesByCQL
public boolean removeGranulesByCQL(java.lang.String workspace, java.lang.String coverageStore, java.lang.String coverage, java.lang.String filter) throws java.io.UnsupportedEncodingExceptionRemove granules from a structured coverage, by providing a CQL filter.- Parameters:
workspace- the GeoServer workspacecoverageStore- the GeoServer coverageStorecoverageStore- the GeoServer coverageStorecoverage- the name of the target coverage from which we are going to removefilter- the absolute path to the file to upload- Returns:
nullin case the call does not succeed, or an instance ofRESTStructuredCoverageGranulesList.- Throws:
java.io.UnsupportedEncodingException- if any.
-
postNewImport
public int postNewImport() throws java.lang.ExceptionRefers topostNewImportmethod- Returns:
- a int.
- Throws:
java.lang.Exception- if any.
-
postNewTaskAsMultiPartForm
public int postNewTaskAsMultiPartForm(int i, java.lang.String data) throws java.lang.ExceptionRefers topostNewTaskAsMultiPartFormmethod- Parameters:
i- a int.data- aStringobject.- Returns:
- a int.
- Throws:
java.lang.Exception- if any.
-
getTask
public net.sf.json.JSONObject getTask(int i, int t) throws java.lang.ExceptionRefers togetTaskmethod- Parameters:
i- a int.t- a int.- Returns:
- a
JSONObjectobject. - Throws:
java.lang.Exception- if any.
-
putTask
public void putTask(int i, int t, java.lang.String json) throws java.lang.ExceptionRefers toputTaskmethod- Parameters:
i- a int.t- a int.json- aStringobject.- Throws:
java.lang.Exception- if any.
-
putTaskLayer
public void putTaskLayer(int i, int t, java.lang.String json) throws java.lang.ExceptionRefers toputTaskLayermethod- Parameters:
i- a int.t- a int.json- aStringobject.- Throws:
java.lang.Exception- if any.
-
postImport
public void postImport(int i) throws java.lang.ExceptionRefers topostImportmethod- Parameters:
i- a int.- Throws:
java.lang.Exception- if any.
-
-