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

GEODE-5032: Update cluster configuration objects for more intuitive consumption #1848

Closed
wants to merge 10 commits into from

Conversation

PurelyApplied
Copy link
Member

@PurelyApplied PurelyApplied commented Apr 23, 2018

Thank you for submitting a contribution to Apache Geode.

In order to streamline the review of the contribution we ask you
to ensure the following steps have been taken:

For all changes:

  • Is there a JIRA ticket associated with this PR? Is it referenced in the commit message?

  • Has your PR been rebased against the latest commit within the target branch (typically develop)?

  • Is your initial contribution a single, squashed commit?

  • Does gradlew build run cleanly?

  • Have you written or updated unit tests to verify your changes?

  • If adding new dependencies to the code, are these dependencies licensed in a way that is compatible for inclusion under ASF 2.0?

Note:

Please ensure that once the PR is submitted, you check travis-ci for build issues and
submit an update to your PR as soon as possible. If you need help, please send an
email to dev@geode.apache.org.

@PurelyApplied
Copy link
Member Author

I meant to put this in the commit message, but it must've gotten lost when I rebased:

Changes include:

  • Those getters that return a List have been renamed to indicate a plural.
  • Much of the "massaging" has been documented in the bindings.xjb file. Comments document what other adjustments have been made, at time of writing.
  • A more-restrictive xsd has been included in configurationService.xsd that removes deprecated items that should not be supported by this new feature.
  • Configuration classes have been generated as Serializable, as this will be required when the creation commands et al pass configuration objects to instantiate the services they support.

I have included the xjc tasks I used to generate these objects in their respective gradle files, as well as the bindings file each task would produce. These could have future value if this process is repeated, but I could also see the value in keeping our build files from becoming cluttered.

This PR does not update or adjust any of the configuration objects in geode-connectors or geode-lucene. Those can be addressed in another ticket.

~ See the License for the specific language governing permissions and
~ limitations under the License.
-->
<xsd:schema
Copy link
Member

Choose a reason for hiding this comment

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

So we need to check both the cluster-config.xsd, the *.xjb and the generated POJOs into the source tree? It would be ideal if we can do either:

  1. keeping the xsd, and xjb and have the POJOs generated by the build process. Which gives us a nice one place to see all the changes we've made to the schema.
  2. keeping the POJOs only. It would be easier for the developer to add/modify the methods instead of trying to find the way to transform it using a binding file (.xjb).

A third option is:
3. keeping the massaged xsd and the POJOs. the XSD is just a reference to keep all the changes in one place and for future reference. it's not used in the build process.

Not sure which way we would like to go.

Copy link
Member Author

Choose a reason for hiding this comment

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

I'd love to get to the point where we could just generate the POJOs as part of the build process, even if it has to be based on an "internal only" XSD.

During iteration, I found there is some trouble with getting CacheElement to selectively apply to some but not all classes. There are some 3rd party libraries that could help on that front and with gradle integration. I was hesitant to introduce a new dependency for this, though, and don't remember which licenses are compatible with the Apache 2.0.

I don't like the idea that the config classes are all treated like first-class citizens. We're already pushing the line where some config classes are special cases. Every special case is a pitfall for a future developer.

If the massaged XSD isn't actually consumed (and won't be in the future), then I should just remove it from this PR. Future developers won't remember to update the XSD or bindings file with every update to the POJOs, and once it's out of date, its existence will just add confusion.

configProperty.setType("test");
configProperty.setValue("test");
jndiBinding.getConfigProperties().add(configProperty);
cacheConfig.getJndiBindings().getJndiBindings().add(jndiBinding);

Choose a reason for hiding this comment

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

should be `cacheConfig.getJndiBindings().add(jndiBinding)

Copy link
Member Author

Choose a reason for hiding this comment

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

Whoops! Looks like my build alias skips compiling on the test side. That's something I need to fix!

@@ -65,7 +65,7 @@ public void noServiceNoMember() {
@Test
public void hasServiceNoBindingNoMember() {
doReturn(ccService).when(command).getConfigurationService();
when(cacheConfig.getJndiBindings()).thenReturn(Collections.emptyList());
when(cacheConfig.getJndiBindings().getJndiBindings()).thenReturn(Collections.emptyList());

Choose a reason for hiding this comment

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

... another one of these getJndiBindings().getJndiBindings()

@XmlElement(name = "config-property-name", namespace = "http://geode.apache.org/schema/cache",
required = true)
protected String configPropertyName;
protected String name;
Copy link
Member

Choose a reason for hiding this comment

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

I think we changed the name to be "configPropertyName" for some json serialization which requires this name. Do all tests pass?

@@ -174,8 +174,9 @@
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = {"className"})
public static class Instantiator {
public static class Instantiator implements Serializable {
Copy link
Member

Choose a reason for hiding this comment

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

do we need to add the class to geode-core-sanctioned-serializable.txt?

Copy link
Member

@jinmeiliao jinmeiliao left a comment

Choose a reason for hiding this comment

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

It would be nice that for every change we made to the POJO, we would have a junit test to make sure the resulting xml still pass the xsd validation.

@PurelyApplied
Copy link
Member Author

Oops, I messed up my branches and accidentally pushed the restoration of the build files.

Considering the drift between this and the extant iteration, I think I'll just close this PR for now and open a new one if it comes to that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants