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
[fixes #428] - Configurable configuration #462
Conversation
* Changed to reference the interface in projects (ConfigurationDispatcher) * Moved XMLConfiguration to own module * Implemented PostgresConfiguration class
Hi Emil, sorry that I've neglected your PRs for so long. I'll try to find time to review this before we hit feature freeze for the next release, but I don't have much hope about finding time to clear it. I am sorry as this does look impressive. It should probably have been brought up on the mailing list before you started work as well. I know your last thread kind of fizzled but this is fairly dramatic change and will have an impact on downstream projects like GeoServer. Those of us who have been with the project for a while tend to set a rather poor example about discussing changes before we start work I know but it is even more important for newcomers. Again, sorry about leaving this so long and we do appreciate the work you're contributing. |
I just spoke to @tbarsballe who may be able to justify some time to review this, but unfortunately we're both rushing to get things done before the GT/GWC/GS code freeze ourselves so it's not too likely. If you want to try to reduce the chance of problems during review. Make sure you have unit tests, have documentation, do whitespace correctly (4 spaces indent in code, 2 spaces in XML, do not use tabs), don't change existing whitespace unnecessarily, don't break GeoServer (or have the changes you need to make to GeoServer ready to go, ideally in a PR referencing this one) and if there's anything you think someone might have questions about, try to add a comment explaining it (in code or attached to the PR) I can't guarantee that will get your PR done in time for the release, but it will help your chances. |
Hi, thanks for looking in to this. I understand that it can be hard to approve the new PostgresConfiguration class without proper time on your side to test it. But for me the most important thing is that you approve and merge the change of moving the XMLConfiguration class out to a separate module and implement it from an interface. And then reference the interface from all other modules to be able have different implementations for it. Then it is just about configuring the needed implementation in spring configuration. This way me and others could create their own implementations and if someone wants to use the PostgresConfiguration they can get it from the fork. Best regards |
Actually the Postgres configuration class was less of a concern because it would be an optional thing to be plugged in. The concerns I have are with whether the changes made to allow it are going to break anything either in GWC or downstream, and how well those changes mesh with the design of GWC such as it is and the needs of the community. If you can do a pull request with just the bare minimum API changes that need to get in I'll try to get it reviewed on Saturday. To avoid the things that tend to delay PRs, make sure you don't have any non-semantic whitespace changes, update any relevant javadocs, add unit tests if appropriate, and describe your thinking when you make architectural decisions or do anything weird or "clever". Also check that GeoServer still works with the changes. We do coordinated releases between GeoTools, GeoWebCache, and GeoServer so we can't break anything downstream at the last minute. If GeoServer needs to be updated, issue a PR there with those changes referencing the PR here on GWC with a note that it should not be merged until the GWC PR has been merged. I've tossed you an invite to a Gitter chat channel so we might be able to resolve things more quickly. My time zone is UTC-8. |
One other thing, new Java files should have an LGPL 3.0 copyright header. This project is a OSGeo "Community Project" and is supposed to be improving our code contribution story. It would be great if you visit http://www.osgeo.org/content/foundation/legal/licenses.html and fill in the a contribution license (sending it to secrectary@osgeo.org). This would save effort so that I do not have to double back and ask permission in the future. If we can't contact you at that time we may have to remove or re-implement your contributions. It's not presently a requirement for contribution to GWC though. If you sign the agreement and send it to OSGeo, you can list them as the copyright holder in the header, otherwise put yourself or your employer as appropriate. You can see examples of the header on the other files. You could also contribute the code now, and then transfer the copyright later. |
I would say that i tried to make it as minimal as possible. I did redo this to avoid the formatting of not changed lines, removed the commenting you mentioned in the patch file i did attach before to the issue and so on. |
…ostgres_configuration # Conflicts: # geowebcache/config_xml/src/main/java/org/geowebcache/config/XMLConfiguration.java
Two things are that you haven't added any new unit tests to confirm your your new functionality works (I can see where you've updated some existing tests to avoid breaking them but that's it), and you haven't added any user documentation, Both of these are not only necessary in their own right but important tools for doing the review itself. |
…ostgres_configuration # Conflicts: # geowebcache/config_xml/src/main/java/org/geowebcache/config/XMLConfiguration.java # geowebcache/core/src/main/java/org/geowebcache/layer/wms/WMSLayer.java
I didnt see the invite. Have not used Gitter before so maybe missed something.
You want unit tests for the PostgresConfiguration class correct? Where and how do you want the documentation to be written? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm a bit wary of using JSON for persistence when everywhere else we use XML for persistence of configuration. GWC is inconsistent enough as it is.
It's also a bit worrying that the Postgres configuration this only works for WMSLayers. I really don't want GWC to suffer from feature fragmentation where "Feature X only works if you don't use Feature Y". As it is I'm surprised we don't have more of that.
It looks like this should also affect GeoServer downstream. Please make a PR there referencing this one with any necessary changes to ensure GeoServer doesn't break. Making your new feature available isn't necessary. Be aware that
Please also add unit tests covering any new functionality or behaviour. The callbacks to the quota system and the Postgres configuration system in particular should be tested. Look at the Posgres disk quota tests for an example of how to do testing against a postgres instance. Our CI build server includes a Postgres instance that can run those tests.
Something this significant also needs some user documentation which is here https://github.com/GeoWebCache/geowebcache/tree/master/documentation/en/user
It's written in Restructured Text format and compiled into HTML using Sphinx.
Please also add copyright headers to any new Java files you made. If you're copying old code into a new class (like in AbsConfigurationDispatcher), please cite the origin so we can keep track of who contributed what.
</dependency> | ||
|
||
<dependency> | ||
<groupId>com.google.code.gson</groupId> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We already have dependencies on json.org, jackson, and jettison, is yet another JSON library really necessary?
</dependency> | ||
|
||
<dependency> | ||
<groupId>net.sf.ehcache</groupId> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We already have other in memory caches particularly Guava cache and Hazelcast used by the In Memory Blobstore. Is there a particular reason you added another new dependency to do this?
} | ||
|
||
/** | ||
* Takes an object and parses it into given class. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a bit vague. It's not really parsing the object so much as a string representation of it, a lexical cast/copy.
} | ||
} | ||
|
||
public void setTemplate(String template) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A lot of methods without Javadocs. Makes this difficult to follow.
try { | ||
s = con.createStatement(); | ||
rs = s.executeQuery( | ||
String.format(SELECT_EXISTS_BY_NAME, getSchema(), layerName)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Dumping values into SQL (Which you do in several places) without any sanitization seems like a bad idea. Admittedly this value shouldn't be possible to set for anyone who isn't an admin, but it still seems like a bad idea just on principle. If nothing else someone might use a reserved word as the name of their schema or include a space or some something silly like that.
* {@link BlobStoreConfig#createInstance() created} of an enabled | ||
* {@link BlobStoreConfig} | ||
* @param layers | ||
* used to get the layer's {@link TileLayer#getBlobStoreId() blobstore id} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Non-semantic whitespace again. Yes it does look nicer but it should be done separately.
@@ -1,212 +0,0 @@ | |||
<?xml version="1.0" encoding="utf-8"?> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You seem to have simply deleted this file rather than moving it like you did for other versions.
* tileLayer = tileLayerDispatcher.getTileLayer(layerName); } catch (GeoWebCacheException e) | ||
* { e.printStackTrace(); continue; } cacheInfoBuilder.buildCacheInfo(tileLayer); } } <<< | ||
*/ | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please don't leave commented out code unless it's an example. For an explanation of when something will happen/be used somewhere else in a way that may be confusing, just use a regular comment. To explain why you made a change, use a Pull Request comment.
// Iterable<TileLayer> allLayers = tileLayerDispatcher.getLayerList(); | ||
// for (TileLayer layer : allLayers) { | ||
// layer.addLayerListener(usageStatsProducer); | ||
// } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Again, please don't leave commented out code unless it's an example or something like that.
} | ||
// for (String layerName : layerNames) { | ||
// createLayerInternal(layerName); | ||
// } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Again, comment explaining where this is being done elsewhere is good, commented out code is bad.
Thank you for review, will try to look into the changes you requested |
@emilzse Have you had a chance to look at the feedback and update the PR? |
I think if someone is interested they can use the fork. With the changes in current GWC version regarding API and configuration this PR needs to be redone |
Thanks @emilzse, sorry this ended up clashing with the other configuration work. I'll close the PR. |
** See geowebcache-core-context.xml for configuration