Theodor Foerster ha scritto:
Hi,
It is not that important, as it is only research and is only meant as a
proof-of-concept. Anyway, in my architecture, I pass a special ID,
specifying the type of user. Then the dataStore preforms some querying
according to this type of user and the scale of the requested map.
That's it. If this is too much of work, I could just maintain two
separate layers one for user a and one for user b, and the client would
then select the correct layer. That's it.
So if this is too difficult, then I might just use this dirty hack.
However, I guess, that the capability of handling vendor specific
parameters inside geoserver is not that unrealistic? Thus this would be
interesting for geoserver in general, right?
For normal datastores, that is, those that are pure data sources, what you're asking is probably not useful. But I guess in your case
the datastore is a processing one, something which in GeoTools is
simply not there, mostly because datastore interface is not meant to do
processing (we're rolling out some processing oriented interfaces
right now btw).
The "chosen path" for geotools is to have some other classes perform
processing, and then have those emit a FeatureSource that you
can evantually glue to xml encoding or map rendering.
Adding a parameter to GetMap is in fact not so easy, since it
requires changing the typesafe class we use to make parameters
travel from parsing to actual map rendering, and create a kvp
parser for it. Using the special "format_options" map you could
avoid that, even if that does not see exactly the best name,
since in you case it would be more of a "data_option".
Once you have the parameter set, you'd have to alter the way
the FeatureSources are set up for each layer, see if one of
them implements a special interface of your own that allows
extra params to be passed in, and in that case cast and pass
the parameters (since the standard gt2 interface does not
have any way to pass those). Or something like that...
Have a look at org.vfny.geoserver.wms.responses.GetMapResponse
to see how the MapContext used by the renderer is built up.
In any case yes, chances are that to pass extra parameters
you'll have to create/modify various classes.
So far we added a few vendor parameters,
but none so far had to talk directly to datastores in a way
that is not built-in into the gt2 interfaces.
Cheers
Andrea