Hi Folks,

I'm in the process of evaluating geoserver as the WFS backend for a web-based 
mapping app with both view and modify capabilities.
So far things are going pretty smoothly using GS 2.11 and the Boundless 
web-sdk/openlayers, but now I'm facing some interesting issues around 
integration with other systems.

One requirement I have is that when modifications are made to layers via WFS-T, 
certain fields should be validated serverside, potentially in quite complex 
ways. Some examples are:

* certain field values should match a regular expression
* if field A is modified, B should also be modified (and valid) in the same 
transaction
* for some fields, new values should be passed to an external web service that 
approves/rejects the value.

It would also be useful (although a little less critical) if certain fields 
could be modified serverside, between receiving and updating the data-store.

One simple example is to automatically populate an 'edited_by' field, if 
present, with the currently autheticated geoserver user. More complex would be 
passing the received value to an external service, and passing the result of 
that instead of the original value to the data-store.

I've come up with a couple of different approaches, and am looking for advice 
on which would be easiest/best, or if there are alternatives I haven't thought 
of.

1) Validation as triggers/rules in PostGIS datastore
+ can handle regex constraints
+ before-update and before-insert triggers could do cross-field validation
- no simple way to lookup/validate via an external service (maybe with pl/??? 
and libraries, or FDW, but probably not ideal)
- could be tricky to deploy/keep updated rules with business requirements
- can't operate on data it doesn't have (e.g. geoserver auth username - 
although maybe with the session scripts that would work)

2) Use Geoserver Scripting Extension with WFS TX hooks
+ doesn't require modifying/recompiling (bits of) geoserver
+ easier to develop/test/deploy than DB constraints
+ easy to call external services
- community module => possible reliability/support concerns?
- not much documentation (AFAICT) on the APIs & hook parameters, e.g.: 
http://docs.geoserver.org/stable/en/user/community/scripting/py/api/index.html

3) Write a custom Geoserver TransactionPlugin to intercept/validate/modify
+ quite easy to test/deploy new rule sets
+ should be easy to call external sources
+ working in java brings benefits of tooling / integration with existing 
geoserver code
- need to understand the GS build process and initial plugin development/setup
- also seems to be lacking docs in the manual, assuming 
http://docs.geoserver.org/stable/en/developer/programming-guide/extension-points/index.html
 is the right place to look.

4) HTTP Interception/rewrite Proxy in front of geoserver /wfs endpoint
- This is probably a terrible idea :)
+ doesn't require plugins/changes to geoserver
- potentially an absolute beast to debug and test 
- doesn't have access to geoserver internals which could be useful/essential 
for some tasks

That's what I've come up with so far. I've spent a bit of time, mostly on (2) 
using the python-scripting extension
and exploring what values are passed to the hooks, and how to extract and 
manipulate them. I very briefly looked into (3), but ran into some issues 
getting the dev environment running/building properly, so I've put that on hold 
for now.

One downside to this is the plugin is using jython-2.5.2, which is Python2.5ish 
language support, which excludes a lot of
language features I've come to rely on, and makes installing 3rd party modules 
somewhat tricky.

Extracting and modifying the transaction parameters also involves quite a bit 
of guesswork and experimentation, and I'm a
little concerned that it might be quite fragile to internal geoserver changes, 
or even request-data/structure dependent without a lot more testing.

Has anyone else on the list faced similar requirements, and if so, how did you 
go about handling them?

If it turns out I am on the right track with either (2) or (3), I can try to 
find time to contribute some improvements to the docs, if there's any interest.

Thanks for reading,

Tom


-- 
Tom Feist-Hassan <[email protected]>

Senior Engineer, MHN Ltd.
1.5 Techcube, Summerhall
Edinburgh, EH9 1PL
Company Registered in Scotland number SC304505 | 6 ATHOLL CRESCENT PERTH PH1 5JN

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Geoserver-users mailing list

Please make sure you read the following two resources before posting to this 
list:
- Earning your support instead of buying it, but Ian Turton: 
http://www.ianturton.com/talks/foss4g.html#/
- The GeoServer user list posting guidelines: 
http://geoserver.org/comm/userlist-guidelines.html

[email protected]
https://lists.sourceforge.net/lists/listinfo/geoserver-users

Reply via email to