[Geoserver-devel] Avoiding inadvertent linking between sld files (GEOS-5545)

Hi,
I’m writing to get some discussion and eventually consensus on how to best handle:

http://jira.codehaus.org/browse/GEOS-5545

Long story short, it is possible and relatively easy to get two styles backed by the same sld file, so editing one changes the other as well.

The current situation arises because the sld and xml files are separate, and at least initially, they have the same name, but on rename, only the xml file gets renamed.

Approaches coming to mind:

  • stop naming the sld file after the style name, use the uuid of the StyleInfo. Pro, no conflicts whatsoever are possible anymore, Cons, good luck finding the style you want on disk (you have to get the xml file first and see that the name is)
  • when creating a new style, check if the sld name is already busy, if so, append random numbers to the original name. Pros, still somewhat easy to locate the sld file without opening the xml one (at least up until the style is renamed)
  • have the sld file be named _.xml, and rename the sld when the style is renamed. Adding the styleid in the sld file name prevents conflicts with concurrent file manipulation, but it’s still pretty evident what style the sld file is associated to

Opinions?

Cheers
Andrea

==
Our support, Your Success! Visit http://opensdi.geo-solutions.it for more information.

Ing. Andrea Aime

@geowolf
Technical Lead

GeoSolutions S.A.S.
Via Poggio alle Viti 1187
55054 Massarosa (LU)
Italy
phone: +39 0584 962313
fax: +39 0584 1660272
mob: +39 339 8844549

http://www.geo-solutions.it
http://twitter.com/geosolutions_it


On Fri, Jun 14, 2013 at 4:21 AM, Andrea Aime
<andrea.aime@anonymised.com>wrote:

Hi,
I'm writing to get some discussion and eventually consensus on how to best
handle:
http://jira.codehaus.org/browse/GEOS-5545

Long story short, it is possible and relatively easy to get two styles
backed by the same sld file, so editing one changes the other as well.

The current situation arises because the sld and xml files are separate,
and at least initially, they have the same name, but on rename, only the
xml file gets renamed.

Approaches coming to mind:
* stop naming the sld file after the style name, use the uuid of the
StyleInfo. Pro, no conflicts whatsoever are possible anymore, Cons, good
luck finding the style you want on disk (you have to get the xml file first
and see that the name is)
* when creating a new style, check if the sld name is already busy, if so,
append random numbers to the original name. Pros, still somewhat easy to
locate the sld file without opening the xml one (at least up until the
style is renamed)
* have the sld file be named <stylename>_<styleid>.xml, and rename the sld
when the style is renamed. Adding the styleid in the sld file name prevents
conflicts with concurrent file manipulation, but it's still pretty evident
what style the sld file is associated to

Sorry, I meant to comment on this issue the other day. I would be fine with
either of 2 or 3 here. I guess i would lean toward 2 for readability
purposes but i imagine 3 is simpler to implement.

A twist on 3 would be to try and use a shortened version of the identifier,
sort of like abbreviated git commits ids. Maybe even some sort of hash
scheme similar to git id's to avoid soem of the strange characters from the
uuid. Just thinking out loud. No strong opinion except that I think (1)
makes it too difficult to deal with the sld files from the filesystem.

Opinions?

Cheers
Andrea

--

Our support, Your Success! Visit http://opensdi.geo-solutions.it for more
information.

Ing. Andrea Aime
@geowolf
Technical Lead

GeoSolutions S.A.S.
Via Poggio alle Viti 1187
55054 Massarosa (LU)
Italy
phone: +39 0584 962313
fax: +39 0584 1660272
mob: +39 339 8844549

http://www.geo-solutions.it
http://twitter.com/geosolutions_it

-------------------------------------------------------

------------------------------------------------------------------------------
This SF.net email is sponsored by Windows:

Build for Windows Store.

http://p.sf.net/sfu/windows-dev2dev
_______________________________________________
Geoserver-devel mailing list
Geoserver-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-devel

--
Justin Deoliveira
OpenGeo - http://opengeo.org
Enterprise support for open source geospatial.