2. Outline
• What is Geoserver Shell?
• Why does Geoserver need a CLI?
• What are we administering with CLI?
• How does it work?
• What does it look like in action?
3. What is it?
• Administer Geoserver from a command
line interface (CLI)
• Uses Geoserver Rest interface
• Based on Spring Shell
• Uses GeoServer Manager and GeoTools
• Written in Java
• Open Source MIT License
• Hosted on Github
4. Why a CLI?
• Web UI is a major feature
• Non developers can load data and styles
• CLI is quick, efficient and scriptable
• Once a script is written it can be replayed
on other Geoservers (set up dev, then test,
then production)
15. Install
• Download 0.1 release
• https://github.com/jericks/geoserver-shell/
releases
• Put bin directory on path
• run gs-shell
• Requires Java
16. Spring Shell
• Open source project from Spring Source
• Shell extracted from Spring Roo
• Spring Roo is a Java RAD tool for creating
web apps
17. Spring Shell
• Interactive shell environment
• Tab completion for commands, arguments,
and files
• History support (up and down arrows)
• Knows your commands and when you can
use them
18. Geoserver Shell
• Commands for each major Geoserver
Catalog item
• Methods in command construct a URL,
create a request body (xml, file) and make
an Http Request to Geoserver. The
Geoserver response is parsed and displayed
to the user
20. Workspace Commands
• workspace list
• workspace create --name test
• workspace get --name test
• workspace delete --name test
• workspace default get
• workspace default set --name test
21. Workspace
gs-shell> geoserver set --url http://localhost:8080/geoserver
gs-shell> workspace create --name naturalearth
true
gs-shell> workspace list
topp
nurc
gs-shell> workspace get --name naturalearth
naturalearth
26. Scripts
• Scripts contain the same commands entered
interactively
• History support saves session to geoservershell.log
$ gs-shell --cmdfile mycommands.gs
gs-shell> script --file naturalearth_countries.gs