fabric8-maven-plugin icon indicating copy to clipboard operation
fabric8-maven-plugin copied to clipboard

Allow deep configuration for enrichers

Open rhuss opened this issue 5 years ago • 3 comments

Description

Currently only flat configuration is supported by default (i.e. a simple key-value map). However, there are already enrichers (e.g. the VertxHealthCheckEnricher) which examines the plugin configuration on is own by parsing the XML. However those enrichers are tightly coupled to maven and can't easily reused outside a Maven context.

This should not be required, but the enrichers should support nested configurations by default, which actually should be a plain map of maps with plain string values (could also contain lists).

rhuss avatar Sep 11 '18 20:09 rhuss

What I can see is that in VertxHealthCheckEnricher we need two things from Maven configuration, the first one is the proeprties, and the second one the configuration.

So the problem is that VertxHealthCheckEnricher and any class that needs these parameters it uses EnricherContext https://github.com/fabric8io/fabric8-maven-plugin/blob/master/enricher/api/src/main/java/io/fabric8/maven/enricher/api/EnricherContext.java.

The problem is that these parameters are not simply exposed by EnricherContext in a JDK types, but as Maven types, so the ones who needs them needs to deal with these Maven objects as well. See for example: https://github.com/fabric8io/fabric8-maven-plugin/blob/master/enricher/fabric8/src/main/java/io/fabric8/maven/enricher/fabric8/VertxHealthCheckEnricher.java#L318

So my idea would be that all these Maven types (Xpp3Dom) are just valid inside EnricherContext and we can create some methods in EnricherContext so any caller just calls them and receives JDK types. In this way enrichers will have an easy way to query configuration information without have to deal with Maven types or parsing XMLs.

What do you think about this approach? Or you have other thing in mind?

lordofthejars avatar Oct 01 '18 08:10 lordofthejars

@rhuss You reopened this issue to improve how we can pass the custom configuration to an enricher. We didn't talk about but what could be this improvement. Do you have for example something in mind like an xpath for objects, so you say I want to attribute as string /a/b/c and the method takes the map and navigates through it, or you are thinking in using for example reflection to fill up a POJO?

lordofthejars avatar Nov 15 '18 13:11 lordofthejars

This issue has been automatically marked as stale because it has not had any activity since 90 days. It will be closed if no further activity occurs within 7 days. Thank you for your contributions!

stale[bot] avatar Feb 13 '19 13:02 stale[bot]