I'm going to go ahead and try this approach on a feature branch and see if it works.
-- 
Dustin Parker - Forward Slope, Inc.
Cell: 619 277 2591

SYBWB UI EXCEFI EK BEIF IRXMSURK SR BTBWF YMHEK
OWRZXBH--KBES, OXEMIUZXB, EKD CWRKV. - Y. X. HBKNABK

H4sIAOlx7FACA02MuQ7CMBQEe3/FdjTgcIWrSUMBFQVI1A5+2BaJ
HcUPTP6eU4J2dmb37o49K0MR4Yw1lVdjnDdiJHGwinFSvsewqmnI
SzH+Uh0o/jiCR92hVifrPEkx+VrRhmul//upxNF27xz8Uj5DIXKJ
ne1ji0jPg5nEJiRopz8W3ahFCu2lEHOJePMoK1WTWDwrT9CqQyIk
V1VIrWMCU+QoBrDMzSrLShWtDK3JimU+zBcj8QDNJmEc9gAAAA==
On 2013-09-06 07:08, Justin Deoliveira wrote:
Hey Dustin,

Module sounds very interesting.

Indeed I don't think there is a clean way to get at the transaction object. I don't see a problem with adding it as a property on TransactionEvent. We'd probably have to add it to TransactionRequest as well in order to pass it into the handlers that issue TransactionEvent. Again I don't see a big problem with that. 

Anyways else have any thoughts on this on?

-Justin



On Thu, Sep 5, 2013 at 4:56 PM, Dustin Parker <[email protected]> wrote:
Hi list,

I'm working on adding a community module to GeoServer (with an eye towards making an extension) that does notifications based on WFS activity. The plugin has some things that tailor it towards our use case, so I'm working on making it more generally usable.

One snag I've hit so far in preparation is the management of GeoTools Transactions during a WFS Transaction (this is going to be confusing, I can tell). The GeoTools Transaction ultimately controls what database transaction is used for database queries, so if two consecutive Insert/Update/Delete elements execute against the same database, GeoServer makes sure they also execute in the same transaction.

The notification plugin notifies on tables related to the one being altered based on some extra configuration data (nothing is published by default). In other words, if view Y depends on table X, altering table X can cause notifications to be sent out about features in view Y. To find those related features, the notification plugin (or an intermediary like App Schema) must issue further queries. If nothing else is done, those secondary queries are in the AUTO_COMMIT transaction, so they don't see the changes that were just made to X. In the past, we did some questionable things that enforced one transaction per data store, but that approach no longer works.

What I've done this time around, as a TransactionListener, is grab the current transaction from any FeatureCollection that happens to be or is backed by ContentFeatureCollection. This entails mild use of Reflection to get at some protected/private fields. Whenever the notification plugin goes to make a secondary query, it applies the Transaction it got from the incoming FeatureCollections. I'd rather not do this, however, as I believe it's a brittle approach; FeatureCollection and FeatureSource can be wrapped by any manner of wrapper objects, so it's impossible to really know what the "real" object is, and since I'm using private/protected fields, this code can break at any time. You can see the gory details here:

https://github.com/dustinparker/geoserver-notification/blob/master/src/main/java/com/fsi/geoserver/wfs/TransactionCache.java

Is there some legitimate way that the TransactionListener can get at the org.geotools.data.Transaction created by org.geoserver.wfs.Transaction.execute()? If there's no current way to do it, I think TransactionEvent makes the most sense.


--
Dustin Parker - Forward Slope, Inc.
Cell: 619 277 2591

SYBWB UI EXCEFI EK BEIF IRXMSURK SR BTBWF YMHEK
OWRZXBH--KBES, OXEMIUZXB, EKD CWRKV. - Y. X. HBKNABK

H4sIAOlx7FACA02MuQ7CMBQEe3/FdjTgcIWrSUMBFQVI1A5+2BaJ
HcUPTP6eU4J2dmb37o49K0MR4Yw1lVdjnDdiJHGwinFSvsewqmnI
SzH+Uh0o/jiCR92hVifrPEkx+VrRhmul//upxNF27xz8Uj5DIXKJ
ne1ji0jPg5nEJiRopz8W3ahFCu2lEHOJePMoK1WTWDwrT9CqQyIk
V1VIrWMCU+QoBrDMzSrLShWtDK3JimU+zBcj8QDNJmEc9gAAAA==



------------------------------------------------------------------------------
Learn the latest--Visual Studio 2012, SharePoint 2013, SQL 2012, more!
Discover the easy way to master current and previous Microsoft technologies
and advance your career. Get an incredible 1,500+ hours of step-by-step
tutorial videos with LearnDevNow. Subscribe today and save!
http://pubads.g.doubleclick.net/gampad/clk?id=58041391&iu=/4140/ostg.clktrk
_______________________________________________
Geoserver-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geoserver-devel




--
Justin Deoliveira
Enterprise support for open source geospatial.

Attachment: smime.p7s
Description: S/MIME Cryptographic Signature

------------------------------------------------------------------------------
Learn the latest--Visual Studio 2012, SharePoint 2013, SQL 2012, more!
Discover the easy way to master current and previous Microsoft technologies
and advance your career. Get an incredible 1,500+ hours of step-by-step
tutorial videos with LearnDevNow. Subscribe today and save!
http://pubads.g.doubleclick.net/gampad/clk?id=58041391&iu=/4140/ostg.clktrk
_______________________________________________
Geoserver-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geoserver-devel

Reply via email to