Ok folks,
here is a pull request with the two new extension points:
https://github.com/geoserver/geoserver/pull/2615
GetFeatureCallback has been reduced to simply being able to replace the
Query.
Testing showed that most significant modifications (changing feature type,
adding attributes,
even reprojecting) either cause code crashes or do not lead to the expected
results.
Review welcomed! :-)
Cheers
Andrea
On Fri, Oct 27, 2017 at 9:52 AM, Nuno Oliveira <
nuno.olive...@geo-solutions.it> wrote:
> +1 from me too.
>
>
> On 10/26/2017 06:49 PM, Andrea Aime wrote:
>
> Hi folks,
> for some work we are doing on a new community module (the NSG profile for
> WFS, will talk about it in
> a separate mail) we need to have TransactionPlugin be able to alter
> transactions.
> Unfortunately when WFS 2.0 was introduced the refactoring broke it and it
> cannot do that any more,
> ticket here:
>
> https://osgeo-org.atlassian.net/browse/GEOS-7403
>
> What is more, the thing cannot just be fixed, it has to be replaced,
> because WFS 2.0 transactions
> cannot be translated down to WFS 1.1 ones and brought back without losing
> some information
> (in particular, the new Replace element).
> So, I'm proposing to create a new TransactionPlugin2 that takes the
> TransactionRequest object,
> and make the latter modifyable enough to allow transaction manipulation.
> The interface looks the same and it's easy to migrate from the old one
> (I've just migrated two
> implementations quickly):
>
> public interface TransactionPlugin2 extends TransactionListener,
> ExtensionPriority {
> /** * Check/alter the transaction request elements */
> TransactionRequest beforeTransaction(TransactionRequest request)
> throws WFSException;
>
> /** * Say the last word before we actually commit the transaction
> */ void beforeCommit(TransactionRequest request) throws WFSException;
>
> /** * Notification the transaction ended * * @param request
> * the originating transaction request * @param result *
> {@code null} if {@code committed == false}, the transaction result
> object to be * sent back to the client otherwise. * *
> @param committed * true if the transaction was successful,
> false if the transaction was aborted for * any reason */
> void afterTransaction(TransactionRequest request, TransactionResponse
> result, boolean committed);
>
> @Override default int getPriority() {
> return ExtensionPriority.LOWEST;
> }
> }
>
>
> (given the similarty to the old one, and the fact it is there to fix a
> regression, I counted this as a half new extension point :-p)
>
> For the same NSG plugin we need to also be able to alter GetFeature
> request before they hit the database, for that we'd introduce this
> new interface:
>
> public interface GetFeatureCallback extends ExtensionPriority {
>
> void beforeQuerying(GetFeatureContext context);
>
> @Override default int getPriority() {
> return ExtensionPriority.LOWEST;
> }
> }
>
>
> public final class GetFeatureContext {
>
> private final GetFeatureRequest request;
> private FeatureSource<? extends FeatureType, ? extends Feature>
> featureSource;
> private Query query;
> private final FeatureTypeInfo featureTypeInfo;
>
> public GetFeatureContext(GetFeatureRequest request, FeatureSource<?
> extends FeatureType, ? extends Feature> featureSource,
> Query query, FeatureTypeInfo featureTypeInfo) {
> this.request = request;
> this.featureSource = featureSource;
> this.query = query;
> this.featureTypeInfo = featureTypeInfo;
> }
>
> public GetFeatureRequest getRequest() {
> return request;
> }
>
> public FeatureSource<? extends FeatureType, ? extends Feature>
> getFeatureSource() {
> return featureSource;
> }
>
> public void setFeatureSource(FeatureSource<? extends FeatureType, ?
> extends Feature> featureSource) {
> this.featureSource = featureSource;
> }
>
> public Query getQuery() {
> return query;
> }
>
> public void setQuery(Query query) {
> this.query = query;
> }
>
> public FeatureTypeInfo getFeatureTypeInfo() {
> return featureTypeInfo;
> }
>
> }
>
>
> The idea is that implementors are free to wrap/replace the feature source
> and the query. It's up to the implementor to
> make sure the changes are not going to break the WFS protocol (or even
> feel free to break it, if they are in complete
> control of the client, as sometimes happens).
> The feature type and request are viewable, but not changeable, because at
> the point where the callback is called,
> they have been both used already to do various things, so so allowing to
> change them might give the wrong
> idea to implementors (that they can get effects they really cannot
> achieve).
>
> So, two questions:
>
> - Any feedback?
> - Do you think the above is proposal worthy?
>
> If I don't hear anything I'll assume nobody is worried and no proposal is
> required. Ah, I have no intention of backporting
> for the time being.
>
> Cheers
> Andrea
>
> == GeoServer Professional Services from the experts! Visit
> http://goo.gl/it488V for more information. == Ing. Andrea Aime @geowolf
> Technical
> Lead GeoSolutions S.A.S. Via di Montramito 3/A 55054 Massarosa (LU) phone:
> +39 0584 962313 <+39%200584%20962313> fax: +39 0584 1660272
> <+39%200584%20166%200272> mob: +39 339 8844549 <+39%20339%20884%204549>
> http://www.geo-solutions.it http://twitter.com/geosolutions_it
>
> AVVERTENZE AI SENSI DEL D.Lgs. 196/2003
>
> Le informazioni contenute in questo messaggio di posta elettronica e/o
> nel/i file/s allegato/i sono da considerarsi strettamente riservate. Il
> loro utilizzo è consentito esclusivamente al destinatario del messaggio,
> per le finalità indicate nel messaggio stesso. Qualora riceviate questo
> messaggio senza esserne il destinatario, Vi preghiamo cortesemente di
> darcene notizia via e-mail e di procedere alla distruzione del messaggio
> stesso, cancellandolo dal Vostro sistema. Conservare il messaggio stesso,
> divulgarlo anche in parte, distribuirlo ad altri soggetti, copiarlo, od
> utilizzarlo per finalità diverse, costituisce comportamento contrario ai
> principi dettati dal D.Lgs. 196/2003.
>
> The information in this message and/or attachments, is intended solely for
> the attention and use of the named addressee(s) and may be confidential or
> proprietary in nature or covered by the provisions of privacy act
> (Legislative Decree June, 30 2003, no.196 - Italy's New Data Protection
> Code).Any use not in accord with its purpose, any disclosure, reproduction,
> copying, distribution, or either dissemination, either whole or partial, is
> strictly forbidden except previous formal approval of the named
> addressee(s). If you are not the intended recipient, please contact
> immediately the sender by telephone, fax or e-mail and delete the
> information in this message that has been received in error. The sender
> does not give any warranty or accept liability as the content, accuracy or
> completeness of sent messages and accepts no responsibility for changes
> made after they were sent or for other risks which arise as a result of
> e-mail transmission, viruses, etc.
>
>
> ------------------------------------------------------------------------------
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
>
>
>
> _______________________________________________
> Geoserver-devel mailing
> listGeoserver-devel@lists.sourceforge.nethttps://lists.sourceforge.net/lists/listinfo/geoserver-devel
>
>
> --
> Regards,
> Nuno Oliveira
> ==
> GeoServer Professional Services from the experts! Visit http://goo.gl/it488V
> for more information.
> ==
>
> Nuno Miguel Carvalho Oliveira
> @nmcoliveira
> Software Engineer
>
> GeoSolutions S.A.S.
> Via di Montramito 3/A
> 55054 Massarosa (LU)
> Italy
> phone: +39 0584 962313 <+39%200584%20962313>
> fax: +39 0584 1660272 <+39%200584%20166%200272>
> http://www.geo-solutions.ithttp://twitter.com/geosolutions_it
>
> -------------------------------------------------------
> AVVERTENZE AI SENSI DEL D.Lgs. 196/2003
> Le informazioni contenute in questo messaggio di posta elettronica e/o nel/i
> file/s allegato/i sono da considerarsi strettamente riservate. Il loro
> utilizzo è consentito esclusivamente al destinatario del messaggio, per le
> finalità indicate nel messaggio stesso. Qualora riceviate questo messaggio
> senza esserne il destinatario, Vi preghiamo cortesemente di darcene notizia
> via e-mail e di procedere alla distruzione del messaggio stesso,
> cancellandolo dal Vostro sistema. Conservare il messaggio stesso, divulgarlo
> anche in parte, distribuirlo ad altri soggetti, copiarlo, od utilizzarlo per
> finalità diverse, costituisce comportamento contrario ai principi dettati dal
> D.Lgs. 196/2003.
>
> The information in this message and/or attachments, is intended solely for
> the attention and use of the named addressee(s) and may be confidential or
> proprietary in nature or covered by the provisions of privacy act
> (Legislative Decree June, 30 2003, no.196 - Italy's New Data Protection
> Code).Any use not in accord with its purpose, any disclosure, reproduction,
> copying, distribution, or either dissemination, either whole or partial, is
> strictly forbidden except previous formal approval of the named addressee(s).
> If you are not the intended recipient, please contact immediately the sender
> by telephone, fax or e-mail and delete the information in this message that
> has been received in error. The sender does not give any warranty or accept
> liability as the content, accuracy or completeness of sent messages and
> accepts no responsibility for changes made after they were sent or for other
> risks which arise as a result of e-mail transmission, viruses, etc.
>
>
> ------------------------------------------------------------
> ------------------
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
> _______________________________________________
> Geoserver-devel mailing list
> Geoserver-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/geoserver-devel
>
>
--
Regards,
Andrea Aime
==
GeoServer Professional Services from the experts! Visit http://goo.gl/it488V
for more information.
==
Ing. Andrea Aime
@geowolf
Technical Lead
GeoSolutions S.A.S.
Via di Montramito 3/A
55054 Massarosa (LU)
phone: +39 0584 962313
fax: +39 0584 1660272
mob: +39 339 8844549
http://www.geo-solutions.it
http://twitter.com/geosolutions_it
AVVERTENZE AI SENSI DEL D.Lgs. 196/2003
Le informazioni contenute in questo messaggio di posta elettronica e/o
nel/i file/s allegato/i sono da considerarsi strettamente riservate. Il
loro utilizzo è consentito esclusivamente al destinatario del messaggio,
per le finalità indicate nel messaggio stesso. Qualora riceviate questo
messaggio senza esserne il destinatario, Vi preghiamo cortesemente di
darcene notizia via e-mail e di procedere alla distruzione del messaggio
stesso, cancellandolo dal Vostro sistema. Conservare il messaggio stesso,
divulgarlo anche in parte, distribuirlo ad altri soggetti, copiarlo, od
utilizzarlo per finalità diverse, costituisce comportamento contrario ai
principi dettati dal D.Lgs. 196/2003.
The information in this message and/or attachments, is intended solely for
the attention and use of the named addressee(s) and may be confidential or
proprietary in nature or covered by the provisions of privacy act
(Legislative Decree June, 30 2003, no.196 - Italy's New Data Protection
Code).Any use not in accord with its purpose, any disclosure, reproduction,
copying, distribution, or either dissemination, either whole or partial, is
strictly forbidden except previous formal approval of the named
addressee(s). If you are not the intended recipient, please contact
immediately the sender by telephone, fax or e-mail and delete the
information in this message that has been received in error. The sender
does not give any warranty or accept liability as the content, accuracy or
completeness of sent messages and accepts no responsibility for changes
made after they were sent or for other risks which arise as a result of
e-mail transmission, viruses, etc.
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Geoserver-devel mailing list
Geoserver-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-devel