|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectit.geosolutions.geoserver.rest.GeoServerRESTPublisher
public class GeoServerRESTPublisher
Connect to a GeoServer instance to publish or modify data.
There are no modifiable instance fields, so all the calls are thread-safe.
| Constructor Summary | |
|---|---|
GeoServerRESTPublisher(String restURL,
String username,
String password)
Creates a GeoServerRESTPublisher for a given GeoServer instance with the given auth credentials. |
|
| Method Summary | |
|---|---|
protected boolean |
configureCoverage(GSCoverageEncoder ce,
String wsname,
String csname,
String cname)
Allows to configure some coverage's attributes |
RESTCoverageStore |
configureExternaMosaicDatastore(String workspace,
String storeName,
File mosaicDir)
Deprecated. work in progress |
protected boolean |
configureLayer(GSLayerEncoder layer,
String layerName)
Allows to configure some layer attributes such as WmsPath and DefaultStyle |
boolean |
createWorkspace(String workspace)
Create a new Workspace |
protected String |
encode(String s)
|
boolean |
publishDBLayer(String workspace,
String storename,
String layername,
String srs,
String defaultStyle)
Publish a table in a PostGis store as a new layer. |
RESTCoverageStore |
publishExternalGeoTIFF(String workspace,
String storeName,
File geotiff,
String srs,
String defaultStyle)
Publish a GeoTiff already in a filesystem readable by GeoServer. |
RESTCoverageStore |
publishExternalMosaic(String workspace,
String storeName,
File mosaicDir,
String srs,
String defaultStyle)
Deprecated. work in progress |
boolean |
publishGeoTIFF(String workspace,
String storeName,
File geotiff)
Deprecated. UNTESTED |
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 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 |
removeCoverageStore(String workspace,
String storename)
Remove a given CoverageStore in a given Workspace. |
boolean |
removeDatastore(String workspace,
String storename)
Remove a given Datastore in a given Workspace. |
boolean |
removeLayerGroup(String name)
|
boolean |
removeStyle(String styleName)
Remove a Style. |
boolean |
removeWorkspace(String workspace)
Remove a given Workspace. |
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. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public GeoServerRESTPublisher(String restURL,
String username,
String password)
restURL - the base GeoServer URL (e.g.: http://localhost:8080/geoserver)username - username auth credentialpassword - password auth credential| Method Detail |
|---|
public boolean createWorkspace(String workspace)
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
public boolean publishStyle(String sldBody)
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
sldBody - the SLD document as an XML String.
public boolean publishStyle(File sldFile)
sldFile - the File containing the SLD document.
public boolean publishStyle(File sldFile,
String name)
sldFile - the File containing the SLD document.name - the Style name.
public boolean removeStyle(String styleName)
The Style will be unpublished and the related SLD file will be removed.
styleName - the name of the Style to remove.
public boolean publishShp(String workspace,
String storename,
String layername,
File zipFile)
throws FileNotFoundException
workspace - storename - layername - zipFile -
FileNotFoundException
public boolean publishShp(String workspace,
String storename,
String layerName,
File zipFile,
String nativeCrs,
String defaultStyle)
throws FileNotFoundException
workspace - storename - layerName - nativeCrs - defaultStyle - may be null
FileNotFoundException
public boolean publishShp(String workspace,
String storename,
String layername,
File zipFile,
String srs)
throws FileNotFoundException
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
FileNotFoundException
public boolean publishDBLayer(String workspace,
String storename,
String layername,
String srs,
String defaultStyle)
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
public boolean publishGeoTIFF(String workspace,
String storeName,
File geotiff)
throws FileNotFoundException
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
FileNotFoundException
public RESTCoverageStore publishExternalGeoTIFF(String workspace,
String storeName,
File geotiff,
String srs,
String defaultStyle)
throws FileNotFoundException
workspace - an existing workspacestoreName - the coverageStore to be createdgeotiff - the geoTiff to be published
FileNotFoundException
public RESTCoverageStore configureExternaMosaicDatastore(String workspace,
String storeName,
File mosaicDir)
throws FileNotFoundException
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
workspace - an existing workspacestoreName - the name of the coverageStore to be createdmosaicDir - the directory where the raster images are located
FileNotFoundException
public RESTCoverageStore publishExternalMosaic(String workspace,
String storeName,
File mosaicDir,
String srs,
String defaultStyle)
throws FileNotFoundException
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
workspace - an existing workspacestoreName - the name of the coverageStore to be createdmosaicDir - the directory where the raster images are locateddefaultStyle - may be null
FileNotFoundException
public boolean unpublishCoverage(String workspace,
String storename,
String layername)
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
public boolean unpublishFeatureType(String workspace,
String storename,
String layername)
remove the datastore.
public boolean removeDatastore(String workspace,
String storename)
workspace - The name of the workspacestorename - The name of the Datastore to remove.
public boolean removeCoverageStore(String workspace,
String storename)
workspace - The name of the workspacestorename - The name of the CoverageStore to remove.
public boolean removeWorkspace(String workspace)
workspace - The name of the workspace
public boolean removeLayerGroup(String name)
protected boolean configureLayer(GSLayerEncoder layer,
String layerName)
protected boolean configureCoverage(GSCoverageEncoder ce,
String wsname,
String csname,
String cname)
protected String sanitize(String s)
protected String encode(String s)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||