On Wed, Feb 29, 2012 at 11:33 PM, Martin Davis <mdavis@anonymised.com> wrote:
A stateful transformation is dangeours business, as you have just one
instantiated,
ever (styles are cached, and so is whatever is inside of them),
and it serves all concurrent requests for all possible requests, maybe
for different
maps or with different parameters.
Hmmm... do you mean there is a single copy of the process object shared
across all styles which reference that process? Or is there a separate one
created for each style which uses it? If the former, then yes, I have a
problem!
Hmm... good question... I had to look it up in the code.
So, process factories are free to instantiate a process multiple times,
each time create(Name) is called, but the Spring based one will
end up calling:
return applicationContext.getBean(beanName);
which means Spring will return the actual process bean, and that normally
means it's a singleton, unless you declared otherwise in the application
context.
However rendering transformations are filter functions, wrappers around
processes, created by the ProcessFunctionFactory.. and as far as I can
see there too you get the on the fly creation of the process.
That said, styles are cached and they refer to the filter function wrapping
the process directly, which means each style has its own private
rendering transform, but that one is long lived, that is, all requests hitting
that style will share the same function instance and thus the same process.
I totally agree stateless is best. And I'm certainly not criticizing the
original design - Rendering Transformations are very powerful and extremely
useful!
The original design has limits, it was a first attempt to do transformations on
the fly, and could certainly be improved. Since I'm not able to provide you
with solutions to your case it certainly looks there are holes and
that improvements
could be made, I was ponting at the only tool that can work out improvements.
I am just not seeing how I can take advantage of the inveryQuery method to
alter the query window as needed (and as the original proposal stated as a
design goal).
Mumble... if you directly implement a FilterFunction you should have the
full list of arguments _before_ execute is called (since when the function
the arguemnts are known) and... oh...
Have a look at the RenderingProcess interface, which an annotated
process can implement to get rendering transform support and... voilà, see
the method signatures:
Query invertQuery(Map<String, Object> input, Query targetQuery,
GridGeometry gridGeometry) throws ProcessException;
GridGeometry invertGridGeometry(Map<String, Object> input, Query targetQuery,
GridGeometry targetGridGeometry) throws ProcessException;
You actually get full access to the parameters in the map form.
I believe that's what you're looking for.
Doh, I added that interface over six months ago and I did not remember
it was there
Cheers
Andrea
--
-------------------------------------------------------
Ing. Andrea Aime
GeoSolutions S.A.S.
Tech lead
Via Poggio alle Viti 1187
55054 Massarosa (LU)
Italy
phone: +39 0584 962313
fax: +39 0584 962313
mob: +39 339 8844549
http://www.geo-solutions.it
http://geo-solutions.blogspot.com/
http://www.youtube.com/user/GeoSolutionsIT
http://www.linkedin.com/in/andreaaime
http://twitter.com/geowolf
-------------------------------------------------------