[Geoserver-devel] is CatalogListener.reloaded() dead code?

Hey all,

tried to live-test a CatalogListener.reloaded() implementation, turns out I can’t find any caller in the codebase:

grep “.reloaded()” -R --include=*.java
wms/src/test/java/org/geoserver/wms/capabilities/GetCapabilitiesLegendURLTest.java: ((LegendSampleImpl) GeoServerExtensions.bean(LegendSample.class)).reloaded();

Is it supposed to be replaced by GeoServerLifecycleHandler.onReload(), or at some point we stopped calling it?
There seems to be a couple implementations out there with non-empty bodies:

  • LayerGroupContainmentCache$CatalogChangeListener
  • LegendSampleImpl
  • MimeTypeCacheClearingListener
  • WFSConfiguration’\s anonymous inner class

TIA,
gabe

···

camptocamp
INNOVATIVE SOLUTIONS
BY OPEN SOURCE EXPERTS

Gabriel Roldán
Geospatial Developer

What does happen on catalogue reload? can we restore the event?

···


Jody Garnett

camptocamp
INNOVATIVE SOLUTIONS
BY OPEN SOURCE EXPERTS

Gabriel Roldán
Geospatial Developer

Well, it looks like it was un-deprecated in 2019 but still nobody calls it. For me it’s ok if we have a single extension to listen to reloads (GeoServerLifecycleHandler), especially cause implementers just need to supply a spring bean and not manually add the listener to the catalog.
Just wondering if someone ever noticed these CatalogListeners implementing reloaded() will never be called.

git show 9acd9939f6e2452d69432c277b525af3d1f4f500 – find . -name CatalogListener.java
commit 9acd9939f6e2452d69432c277b525af3d1f4f500
Author: Andrea Aime <andrea.aime@anonymised.com>

Deprecated API checkpoint on main, more deprecated API yet to remove

diff --git a/src/main/src/main/java/org/geoserver/catalog/event/CatalogListener.java b/src/main/src/main/java/org/geoserver/catalog/event/CatalogListener.java
index 6dba393d702…c3d28df435b 100644
— a/src/main/src/main/java/org/geoserver/catalog/event/CatalogListener.java
+++ b/src/main/src/main/java/org/geoserver/catalog/event/CatalogListener.java
@@ -34,12 +34,6 @@ public interface CatalogListener {
/** Handles the event of a post modification to an object in the catalog. */
void handlePostModifyEvent(CatalogPostModifyEvent event) throws CatalogException;

  • /**
    • A callback notifying when GeoServer configuration has been reloaded.
    • This method will be removed in recent version as the idea of a "reload" will not exist.

    • @deprecated.
  • */
  • /** A callback notifying when GeoServer configuration has been reloaded. */
    void reloaded();
    }
···

camptocamp
INNOVATIVE SOLUTIONS
BY OPEN SOURCE EXPERTS

Gabriel Roldán
Geospatial Developer


Jody Garnett

camptocamp
INNOVATIVE SOLUTIONS
BY OPEN SOURCE EXPERTS

Gabriel Roldán
Geospatial Developer

Hi Gabriel,
I don’t remember why it was un-deprecated, I guess the activity was related to removing all
deprecated API and its usage points, and this one seemed to be used.
The was an unfortunate trend back then to deprecate carelessly APIs here and there, without checking usage points and
checking consequences, something that the new QA build luckily forbids (deprecation is possible, but one has to go and
clean up usage points, learn what migration paths are needed and provide them in the PR as well).

I’m only guessing that I saw usage points and un-deprecated, without noticing that there were only
listener implementations, but not callers.

We can remove it, the current listeners using it should be verified… do they need to migrate
on the lifecycle listeners, or are they redundant and simply be removed?

···

Regards,

Andrea Aime

==
GeoServer Professional Services from the experts!

Visit http://bit.ly/gs-services-us for more information.

Ing. Andrea Aime
@geowolf
Technical Lead

GeoSolutions Group
phone: +39 0584 962313

fax: +39 0584 1660272

mob: +39 339 8844549

https://www.geosolutionsgroup.com/

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

camptocamp
INNOVATIVE SOLUTIONS
BY OPEN SOURCE EXPERTS

Gabriel Roldán
Geospatial Developer


Jody Garnett

camptocamp
INNOVATIVE SOLUTIONS
BY OPEN SOURCE EXPERTS

Gabriel Roldán
Geospatial Developer

Hi Andrea,
yes I remember you had to deal with the reckless deprecation trend, all good. I didn’t check exactly when CatalogListener.reloaded() stopped being called though.
In any case, the ones I’ve in the classpath look pretty important (see below).
About migrating the current CatalogListeners to GeoServerLifecycleHandlers, I think that’d be rather complicated.
What if instead we had a GeoServerLifecycleHandler that on its onReload() method calls reloaded() on all the catalog listeners?
GeoServerImpl.reload(Catalog newCatalog) seems to be the only entry point to trigger the config and catalog reload, and it end up by doing

callLifecycleHandlers(GeoServerLifecycleHandler::onReload, “onReload”);

so it seems like it could work out of the box?

  • LayerGroupContainmentCache$CatalogChangeListener:
    @Override
    public void reloaded() {
    // rebuild the containment cache
    buildLayerGroupCaches();
    }

  • LegendSampleImpl:
    @Override
    public void reloaded() {
    clean();
    }

  • MimeTypeCacheClearingListener:
    @Override
    public void reloaded() {
    outputMimeTypes.clear();
    }

  • WFSConfiguration’\s anonymous inner class:
    @Override
    public void reloaded() {
    wfs.dispose();
    }

···

camptocamp
INNOVATIVE SOLUTIONS
BY OPEN SOURCE EXPERTS

Gabriel Roldán
Geospatial Developer

Regards,

Andrea Aime

==
GeoServer Professional Services from the experts!

Visit http://bit.ly/gs-services-us for more information.

Ing. Andrea Aime
@geowolf
Technical Lead

GeoSolutions Group
phone: +39 0584 962313

fax: +39 0584 1660272

mob: +39 339 8844549

https://www.geosolutionsgroup.com/

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

camptocamp
INNOVATIVE SOLUTIONS
BY OPEN SOURCE EXPERTS

Gabriel Roldán
Geospatial Developer


Jody Garnett

camptocamp
INNOVATIVE SOLUTIONS
BY OPEN SOURCE EXPERTS

Gabriel Roldán
Geospatial Developer

Hi Gabriel,
yes that seems a good idea!

···

Regards,

Andrea Aime

==
GeoServer Professional Services from the experts!

Visit http://bit.ly/gs-services-us for more information.

Ing. Andrea Aime
@geowolf
Technical Lead

GeoSolutions Group
phone: +39 0584 962313

fax: +39 0584 1660272

mob: +39 339 8844549

https://www.geosolutionsgroup.com/

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

camptocamp
INNOVATIVE SOLUTIONS
BY OPEN SOURCE EXPERTS

Gabriel Roldán
Geospatial Developer

Regards,

Andrea Aime

==
GeoServer Professional Services from the experts!

Visit http://bit.ly/gs-services-us for more information.

Ing. Andrea Aime
@geowolf
Technical Lead

GeoSolutions Group
phone: +39 0584 962313

fax: +39 0584 1660272

mob: +39 339 8844549

https://www.geosolutionsgroup.com/

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

camptocamp
INNOVATIVE SOLUTIONS
BY OPEN SOURCE EXPERTS

Gabriel Roldán
Geospatial Developer


Jody Garnett

camptocamp
INNOVATIVE SOLUTIONS
BY OPEN SOURCE EXPERTS

Gabriel Roldán
Geospatial Developer

Cool,
created https://osgeo-org.atlassian.net/browse/GEOS-11420

···

camptocamp
INNOVATIVE SOLUTIONS
BY OPEN SOURCE EXPERTS

Gabriel Roldán
Geospatial Developer

Regards,

Andrea Aime

==
GeoServer Professional Services from the experts!

Visit http://bit.ly/gs-services-us for more information.

Ing. Andrea Aime
@geowolf
Technical Lead

GeoSolutions Group
phone: +39 0584 962313

fax: +39 0584 1660272

mob: +39 339 8844549

https://www.geosolutionsgroup.com/

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

camptocamp
INNOVATIVE SOLUTIONS
BY OPEN SOURCE EXPERTS

Gabriel Roldán
Geospatial Developer

Regards,

Andrea Aime

==
GeoServer Professional Services from the experts!

Visit http://bit.ly/gs-services-us for more information.

Ing. Andrea Aime
@geowolf
Technical Lead

GeoSolutions Group
phone: +39 0584 962313

fax: +39 0584 1660272

mob: +39 339 8844549

https://www.geosolutionsgroup.com/

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

camptocamp
INNOVATIVE SOLUTIONS
BY OPEN SOURCE EXPERTS

Gabriel Roldán
Geospatial Developer


Jody Garnett

camptocamp
INNOVATIVE SOLUTIONS
BY OPEN SOURCE EXPERTS

Gabriel Roldán
Geospatial Developer