Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GSIP-157 / GEOS-7987 - Track modified properties in CatalogPostModifyEvent #2101

Merged
merged 2 commits into from
Apr 11, 2017

Conversation

tbarsballe
Copy link
Member

@tbarsballe tbarsballe commented Feb 9, 2017

GSIP Here: https://github.com/geoserver/geoserver/wiki/GSIP-157

API Changes:

  • Public methods getPropertyNames,getOldValues,getNewValues added to CatalogPostModifyEvent interface.
  • Public methods getPropertyNames, setPropertyNames, getNewValues, setNewValues, getOldValues, setOldValues added to CatalogPostModifyEventImpl.
  • The arguments List<String> propertyNames, List oldValues, List newValues have been added to the package private method firePostModified of AbstractCatalogDecorator, AbstractFilteredCatalog, CatalogImpl, and SecureCatalogImpl, and to the protected methods beforeSaved and afterSaved of AbstractCatalogFacade.

All invocations of above methods and classes have been updated accordingly.

Given that all the changes are internal (protected or package private) to the Catalog, this seems likely to be a relatively safe change (Although I think it should not be backported, as it is still an API change)

@aaime
Copy link
Member

aaime commented Feb 10, 2017

Big API break Batman! There is no such a thing as a package protected method for an interface, they are all public.
http://stackoverflow.com/questions/5376970/protected-in-interfaces

In this current form the change is proposal worthy and non backportable. Any chance you can use default methods to fix the backwards compatibility issues?

@tbarsballe
Copy link
Member Author

There is no such a thing as a package protected method for an interface, they are all public.

Huh, learned something new today. Seems like that should have been obvious in retrospect.

GSIP incoming.

There are a few ways I could see of maintaining API backwards-compatibility. Unfortunately, they all run into the same problem:

By necessity, anything using these methods would not set the changed values. This means that anything listening on CatalogPostModifiedEvent can no longer rely on an empty list of properties meaning nothing has changed.
If we can't rely on the list of changed values being valid, then this substantially reduces the utility of this change.

@aaime
Copy link
Member

aaime commented Mar 18, 2017

Master is ready for breaking changes :-)

@tbarsballe tbarsballe changed the title [GEOS-7987] Track modified properties in CatalogPostModifyEvent GSIP-157 / GEOS-7987 - Track modified properties in CatalogPostModifyEvent Mar 20, 2017
@tbarsballe
Copy link
Member Author

tbarsballe commented Mar 20, 2017 via email

@@ -200,10 +200,17 @@ public void remove(StoreInfo store) {
}

public void save(StoreInfo store) {
beforeSaved(store);
ModificationProxy h = (ModificationProxy) Proxy.getInvocationHandler(store);
Copy link
Member

@aaime aaime Mar 20, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see this pattern repeated over and over and over... how about a method taking a lambda to do the bit in the middle, after the notication and before commitProxy? Just thinking out loud.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That sounds like a good idea, although I don't know how to implement it (I am still not especially familiar with lambdas in java). If you've got an example of what you are suggesting, I could certainly apply it to the relevant places.

@tbarsballe tbarsballe merged commit e632de2 into geoserver:master Apr 11, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants