On Mon, Jan 20, 2020 at 11:33 PM Nuno Oliveira <
nuno.olive...@geo-solutions.it> wrote:

> Dear all,
> long story short, I would like to propose adding a new extension point in
> ResourcePool that would allow extensions to retype a feature type, and
> consequently change the associated features.
> In practice it would allow us to create extensions that would be able to
> add\hide attributes, generate new attributes or even just change the values
> of existing attributes.
>

Works for me.


>
> For those wondering if the current FeatureTypeCallbacl [2] doesn't allow
> us already to do that, the answer is no :)
> FeatureTypeCallBack allow extensions to initiate, and manage, feature
> types that are generated based on user provided information, for example,
> SQL views or Solr feature types, but not to change existing types or
> features.
>

Indeed it does something different now... however... what about adding new
methods to it, with default implementations?
On one side, two focused interfaces are normally better, on the other side
FeatureTypeCallback name is generic, could host more
behavior related to feature types... just considering options out loud, not
pushing in a particular direction.


>
> The extensions code would be executed here [3] and here [4], when a
> feature type is build  (buildFeatureType) and when the source for a feature
> type is returned (getFeatureSource).
> The later would allow us to wrap a feature source, setting the feature
> type we want and\or apply the wrappers we want to the future stream of
> features.
>
> I'm proposing the following interface for the extension point:
>
> /**
>  * Extension point for {@link ResourcePool} allowing us to retype an
> existing {@link FeatureType},
>  * and to rearrange the features produced by the correspondent {@link
> FeatureSource} by wrapping it.
>  * This extension point can be, for example, used to add a new attribute
> or remove an existing one.
>  * If the intend is instead to create a new feature type, the existing
> {@link FeatureTypeCallback}
>  * extension point should be used.
>  */
> public interface RetypeFeatureTypeCallback {
>
>     /**
>      * Gives a chance to this callback to retype the provided feature
> type, if this callback has no
>      * interest in retyping the provided feature type, then the unchanged
> provided feature type
>      * should be returned. NULL should never be returned.
>      *
>      * @param featureTypeInfo non NULL GeoServer feature type info
>      * @param featureType non NULL GeoTools data source feature type
>      * @return retyped feature type or the unchanged provided feature type
>      */
>     FeatureType retypeFeatureType(FeatureTypeInfo featureTypeInfo,
> FeatureType featureType);
>

>     /**
>      * Gives a chance to this callback to wrap the provided feature
> source, if this callback has no
>      * interest in wrapping the provided feature source, then the
> unchanged provided feature source
>      * should be returned. NULL should never be returned.
>      *
>      * @param featureTypeInfo non NULL GeoServer feature type info
>      * @param featureSource non NULL GeoTools feature source
>      * @return wrapped feature source or the unchanged provided feature
> source
>      */
>     <T extends FeatureType, U extends Feature> FeatureSource<T, U>
> wrapFeatureSource(
>             FeatureTypeInfo featureTypeInfo, FeatureSource<T, U>
> featureSource);
> }
>
> If this extension point is accepted, we would also like to backport it to
> 2.16.x, opinions are welcome :)
>

Works for me.

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 fax: +39 0584 1660272 mob: +39 339 8844549
http://www.geo-solutions.it http://twitter.com/geosolutions_it
------------------------------------------------------- *Con riferimento
alla normativa sul trattamento dei dati personali (Reg. UE 2016/679 -
Regolamento generale sulla protezione dei dati “GDPR”), si precisa che ogni
circostanza inerente alla presente email (il suo contenuto, gli eventuali
allegati, etc.) è un dato la cui conoscenza è riservata al/i solo/i
destinatario/i indicati dallo scrivente. Se il messaggio Le è giunto per
errore, è tenuta/o a cancellarlo, ogni altra operazione è illecita. Le
sarei comunque grato se potesse darmene notizia. This email is intended
only for the person or entity to which it is addressed and may contain
information that is privileged, confidential or otherwise protected from
disclosure. We remind that - as provided by European Regulation 2016/679
“GDPR” - copying, dissemination or use of this e-mail or the information
herein by anyone other than the intended recipient is prohibited. If you
have received this email by mistake, please notify us immediately by
telephone or e-mail.*
_______________________________________________
Geoserver-devel mailing list
Geoserver-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-devel

Reply via email to