On Wed, Jun 25, 2014 at 8:08 AM, Mauro Bartolomeoli <
mauro.bartolomeoli@anonymised.com> wrote:
Hi,
2014-06-25 15:28 GMT+02:00 Justin Deoliveira <jdeolive@anonymised.com>:
at options string to a map and threw it into KvpUtils.parse() that
would work?
The problem is that KvpUtils.parse expects info on the current service,
version and so on to filter out unneeded parsers. My idea would be to
change the KvpParser parse method signature to include an optional parsers
list that FormatOptionsKvpParser (and possibly other parsers) can use to
accomplish their job. Obviously KvpUtils.parse would pass down its internal
parsers list to each called parser.
Right, of course.
What do you think?
Makes sense, so what would this look when calling it from a service
specific parser? Something like:
KvpUtils.parse(kvpMap, KvpUtils.parsers("wms", ...))
?
No, wait, I would't change KvpUtils.parse signature, but KvpParser.parse.
Currently FormatOptionsKvpParser is building a list of parsers internally
with:
GeoServerExtensions.extensions(KvpParser.class, applicationContext)
that obviously picks up all the parsers defined in spring contexts.
What I would do is:
- change the signature of KvpParser.parse(String value) to
KvpParser.parse(String value, List<KvpParser> parsers)
- update parse signature of all parsers extending KvpParser (they would
basically ignore the new argument)
- change FormatOptionsKvpParser parse method to use the passed down list
of parsers, instead of the internally built one if the argument is not null
- change KvpUtils.parse to call, for each used parser:
parser.parse(value, parsers)
where parsers is an already "filtered by service / version / request" list
that KvpUtils is building to do its job.
What do you think?
I am thinking that changing the signature of KvpParser is a pretty invasive
change, and that we should avoid it if possible. I am also thinking it is
kind of letting some implementation details creep into what is now a pretty
simple interface.
Perhaps I am not understanding a subtly in the problem but what I would
rather do is something like the following.
- Expose the functionality from KvpUtils that filters out parsers based on
service, request, version, etc... so that it can be used in other contexts,
like in this case by FormatOptionsKvpParser.
- Overload KvpUtils.parse with a version that takes a explicit/pre-filtered
set of parsers
I think one of the problems will be how does FormatOptionsKvpParser get the
current service/version/etc... info. Probably easiest I can think of is to
get from the thread local Request object, which should have all that info
set by the time FormatOptionsKvpParser executes.
Mauro
--
GeoServer Professional Services from the experts! Visit
http://goo.gl/NWWaa2 for more information.
Dott. Mauro Bartolomeoli
@mauro_bart
Senior Software Engineer
GeoSolutions S.A.S.
Via Poggio alle Viti 1187
55054 Massarosa (LU)
Italy
phone: +39 0584 962313
fax: +39 0584 1660272
http://www.geo-solutions.it
http://twitter.com/geosolutions_it
-------------------------------------------------------
--
*Justin Deoliveira*
Vice President, Engineering | Boundless
jdeolive@anonymised.com
@j_deolive <https://twitter.com/j_deolive>