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.
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.
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
Kind regards,
Nuno Oliveira
[1] https://github.com/geoserver/geoserver/blob/master/src/main/src/main/java/org/geoserver/catalog/ResourcePool.java
[2] https://github.com/geoserver/geoserver/blob/master/src/main/src/main/java/org/geoserver/catalog/FeatureTypeCallback.java
[3] https://github.com/geoserver/geoserver/blob/master/src/main/src/main/java/org/geoserver/catalog/ResourcePool.java#L1114
[4] https://github.com/geoserver/geoserver/blob/master/src/main/src/main/java/org/geoserver/catalog/ResourcePool.java#L1393
--
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
fax: +39 0584 1660272
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.