[Geoserver-devel] New UI functionality: copying resources

Hi all,
some time ago I was playing with a GeoServer install where I had to create config variations out of a
basic pattern, in particular, create multiple layer groups with the same layers, in the same order,
and different styles, and could also have used a way to do a full recursive copy of a store, to keep
the old one, but also have a new one that I could attach to a different data source offering the same layers.

The “bulk copy” tool was not fully working for that case, so I ended up doing lightly scripted manipulation of
XML files instead… and set a mental note aside to actually do something about it.

First thing, took (quite!) some time to do a CatalogVisitor that would do a full clone of whatever catalog object
was passed onto it, handling also workspace specific resources and the like, having lots of fun with nested
layer groups. I have that working and with a nice test suite.

Now, it’s time to hook it up to the GUI. Since a copy operation is not destructive, I’m leaning towards a
“file system” like copy, select what you want, copy, done, no questions asked. Made a couple of examples,
groups and workspaces, for you to look at.

Here is an example with layer groups, before copy:

image.png

and right after it:

image.png

Gets more interesting copying workspaces though. Here is right after copying “topp”, in various places:

image.png

image.png

image.png

(the release data dir does not have workspace specific styles and groups, so nothing to show there).

One thing I was thinking about, is whether we want to have the copy to always be recursive.
There are only two cases where there is actual recursion though:

  • Workspaces. Well, don’t think one wants to copy a workspace to save keystrokes in the namespace URI :smiley:
  • Stores. In this case the recursion copies all layers too. Here one may like to just copy the store config, some are pretty elaborate. How about a checkbox on the side of the copy link, to enable/disable recursion?
    If anyone wants to play with the above live, or have a look at the code, it’s in this branch (commits still messy, will clean them up before making a PR):

https://github.com/aaime/geoserver/tree/copy_all

Cheers
Andrea

···

== GeoServer Professional Services from the experts! Visit http://goo.gl/it488V for more information. == Ing. Andrea Aime @geowolf Technical Lead GeoSolutions S.A.S. Via di Montramito 3/A 55054 Massarosa (LU) phone: +39 0584 962313 fax: +39 0584 1660272 mob: +39 339 8844549 http://www.geo-solutions.it http://twitter.com/geosolutions_it ------------------------------------------------------- Con riferimento alla normativa sul trattamento dei dati personali (Reg. UE 2016/679 - Regolamento generale sulla protezione dei dati “GDPR”), si precisa che ogni circostanza inerente alla presente email (il suo contenuto, gli eventuali allegati, etc.) è un dato la cui conoscenza è riservata al/i solo/i destinatario/i indicati dallo scrivente. Se il messaggio Le è giunto per errore, è tenuta/o a cancellarlo, ogni altra operazione è illecita. Le sarei comunque grato se potesse darmene notizia. This email is intended only for the person or entity to which it is addressed and may contain information that is privileged, confidential or otherwise protected from disclosure. We remind that - as provided by European Regulation 2016/679 “GDPR” - copying, dissemination or use of this e-mail or the information herein by anyone other than the intended recipient is prohibited. If you have received this email by mistake, please notify us immediately by telephone or e-mail.