Dmitry Kornilov and Mark Strugberg's initial proposal. There is some open questions I would like to get some input:
1. ConfigProvider: At the moment, I made it an interface. To make it more useful and easier for applications to use, it should be a class. Should we use serviceloader to create an instance of this?
2. Dynamic configuration support: Should we add one more method on ConfigSource to specify the time interval for accessing the new configuration values?
3. Performance issue: for massive ConfigSource, should we specify some policy to ready configuration lazily?
Thoughts?
Emily
To be honest, I must disagree with your claim that MicroProfile doesn't do specs. You probably meant "JSR" specs, which is true. On the other hand, one of the visions of MP is to come up with new Java specifications agreed on by vendors and the community. These specifications cannot be called JSR and would have nothing to do with the JCP unless submitted to the JCP eventually.
But there's nothing stopping us to have both a Microprofile config spec and a Java EE config JSR. Actually, it is necessary to have both as the JCP and MicroProfile have different lifecycles. I would only strongly suggest to not diverge too much so that the efforts can easily become compatible once both specifications are final.
Thanks, Emily, for clarifications about the similarities between the MP proposal and the other activities/projects. I think we're on a good path being close to the expected Java EE config JSR proposal.
--Ondrej
--
You received this message because you are subscribed to the Google Groups "MicroProfile" group.
To unsubscribe from this group and stop receiving emails from it, send an email to microprofile...@googlegroups.com.
To post to this group, send email to microp...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/microprofile/a30a6ad6-77d1-4f3c-ab3b-287be05cf4eb%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
https://blogs.oracle.com/theaquarium/entry/java_ee_8_community_survey2.
> The biggest issue with the ServiceLoader is that it is very minimalistic and it does not work in OSGI.
> I agree with Anatole that using the static ServiceLoader is an anti-pattern and it is hard to reuse in all contexts
ServiceLoader is not natively supported in OSGI gut ALL OSGi environments provide a special Service discovery hook for this standard mechanism.
So it _does_ work in OSGi.
We have to separate 2 things:
1.a.) how the SPI looks to the end user
1.b.) how the SPI does the lookup internally and how it finds the impl.
The SPI in 1.b) might be different depending on the environment. In Apache Geronimo we provide spec API jars which work perfectly fine even in OSGi, even if he Oracle ones do not. Still for the USER they are perfectly portably useable.
> <sources>...
That would totally defeat pluggability. Means whenever you like to just use a library provided by someone else you would have to change your own configuration.
Example: you write a CDI Extension which integrates Apache Oak and have the default config in a oak.properties. How would a user know that? This is reall similar to the jar hell we had before maven...
I agree that magic numbers are not perfect, but the closest you can get to a well working solution.
The hardcoded list of ConfigSources is a show stopper. We would not need any Config mechanism at all. Just add all your config we WEB-INF/web.xml then. You say that makes no sense? EXACTLY!
> The config tree can be regularly reevaluated for changing
What you propose is a mutable Configuration. That's exactly what got ruled out from day 1.
Config should be immutable regarding it's structure. Otherwise it's very hard to get it done in a well performing manner and it's also a pain to maintain it. Example: you got some weird behaviour in production and you cannot reproduce nor even judge where you get the values from. It's also not needed in practice.
> Refreshing may also change the ordinal of a config source,
No, changing the property at runtime would _not_ change the ordinal of the ConfigSource.
> ConfigBuilder.withSourcesBefore(String nameBefore, ConfigSource... sources);
> ConfigBuilder.withSourcesAfter(String nameAfter, ConfigSource... sources);
Wow, that's like in servlets, right? Did you ever work with that stuff? I mean in real world projects? It's totally broken. Why? Because you then need to know all the names of the web-fragments. Because you have to say after NAME or before NAME. In practice you will end up with most fragments saying after OTHERS. But who is the 'others'. In the end you'll end up with undefined ordering again :(
> - as Anatole described, you may easily end up with sources declared in a different order than
> declared by ordinals, making it very hard to read the order of the sources applied at runtime.
No, just add the configuration in the other ConfigSource then.
The nice point with ordinals and freely added ConfigSources is that you can ALWAYS override a configured value in a higher ConfigSource.
Oh and to give you some context: when the sytem with the Ordinals was designed I did not want to write a cool configuraiton system in the first place. I had real problems in real projects. And I just wanted to solve them in a good way. Please do always keep the real problems in your head when you think about any solution.
We moved the discussions to private emails a long time ago to stop certain trolling. I don't like that, but it was the only solution to continue with productive discussions.
I'd be happy to move to a fully open list again, but that requires that people really stick to the topic and don't start trolling again.
I'd like to start with prefacing the technical discussion with a few formal things (copying all that stuff 1:1 from the mails)
----
As usual I like to split each topic into 4 categories. The categorisation is always personal of course:
[BLOCKER]: if something doesn't technically work or is not wide enough. Or if some important use case is not covered. Those are topics which we either must solve or you convince me that it's not really a blocker.
[COMPROMISE]: for topics someone thinks _should_ get solved, but can live if not (yet) addressed. Typically things like 'it works but it's imo ugly or too complicated'.
[DONTCARE]: Not perfect, but can live with it.
[ACK]: all fine and perfectly executed.
----
----
In my opinion why only should make certain design decisions, because
* we know the use case AND
* we know the background AND
* we know how it technically works AND
* we know the reason behind a certain design decision AND
* we know about the benefits of a certain design desision AND
* we of course also know about the downsides of a certain design decision AND
* we thus conclude that we like to include this feature.
We certainly should not make decisions just because 'someone else did it that way'.
----
Now for the question why I don't like the list of XML (or whatever) configured ConfigSources:
This brings us back to the days of EJB XML, Spring-XML and stuff. Anyone likes this still?
So what are the benefits of all those 'hardcoded' way to define things? You have all under your control! You can specify EXACTLY how it should look like.
What is the dowside? You HAVE to EXACTLY define how things should work. The app developer really needs to know all the subtle internals about how all the libraries are to be used and which Filter, Servlet, Listener etc he needs to configure in his web.xml (as an example).
Sticking with Sevlets, how did they solve this? You now have a way to dynamically use plug&play mechanism like Annotation driven activation (@WebSevlet, etc), ServiceLoader based dynamic ways (ServletContainerInitializer) plus you can override it in web.xml.
Coming back to Configuration, the problem is exactly the same. Here is the use case:
You have some container (and it's libs) and you have the developer building his own application.
But inbetween you often have many jars which don't know of either the container (means they need to be potrable across containers) nor the application.
This happens if you write some OSS project. Or if you have an inhous platform group which tprovides common tools for the various inhouse applications.
More general: it happens every time you write some reusable parts which need some configuration. There are tons of such reusable parts!
Those libs will provide a certain default configuration out of the box (by registring their own ConfigSource with an ordinal within the 'defaults' range of < 100). And most of the times the user don't need to think about it. But IF he wants to tweak the configuration, then he can easily just override the values in his own ConfigSource (because it has higher ordinal).
Another use case:
Say Payara (or any other EE server) likes to provide a special cluster mode. In this mode you have a single config source which shares the Config over the cluster (via DB or a common config server doesn't matter to the app)
The ordinal would be between the the defaults (<100) and the ENV and System (>=200). Let's say 170.
That would allow the Ops team to e.g. switch a REST endpoint in a single step without having to change the config on every single cluster node. And if it uses ConfigValue.cacheFor(5, TimeUnit.MINUTES) then you don't even need a restart.
All that is totally transparent to the application! The app (and even more important some reusable code parts) do NOT need to take any care about the existance of such a cluster-wide ConfigSource.
To give you the full picture: we of course have all the ConfigSources (with their Ordinals) and all the configured values available via JMX. And we even have a page where the Ops team can look at the effectively configured values of all apps and from which ConfigSource the effective value was taken.
I completely get your point, you may save words for the explanation how ordinals solve a problem. I'm more interested in describing the problem which ordinals are supposed to solve. I proposed an alternative solution, which you probably misunderstood. But it's easy to misunderstand if we don't specify the problem and talk about different solutions. Maybe we are even trying to solve a different problem, so let's focus on that first.
One of the problems you are trying to solve with ordinals is extensibility. What else? What problems have you experienced with other solutions besides ordinals? Can you update the proposal with the list of usecases?
--Ondrej
One of the problems you are trying to solve with ordinals is extensibility. What else?
What problems have you experienced with other solutions besides ordinals? Can you update the proposal with the list of usecases?
--
You received this message because you are subscribed to the Google Groups "MicroProfile" group.
To unsubscribe from this group and stop receiving emails from it, send an email to microprofile+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/microprofile/985039d2-6d84-4f13-964a-f1882cd44b3c%40googlegroups.com.
--
You received this message because you are subscribed to the Google Groups "MicroProfile" group.
To unsubscribe from this group and stop receiving emails from it, send an email to microprofile+unsubscribe@googlegroups.com.
To post to this group, send email to microp...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/microprofile/87c56fa2-9b52-4188-9ee4-8bf5b60c5f09%40googlegroups.com.
For the record, I am very thankful you and the Payara guys spoke up on this. That is the kind of vendor leadership that gives inspiration to the community. I am hoping the TomEE community will also make its voice heard and I am trying to see if Oracle can be convinced to do something about this sort of thing. I am pretty sure back in the day Sun wouldn't have just stood by idly in this sort of scenario.
On Dec 31, 2016 6:09 PM, "John Clingan" <jcli...@redhat.com> wrote:
Mea Culpa :-)--
On Wednesday, December 28, 2016 at 12:04:50 PM UTC-6, Werner Keil wrote:Guess the kind of trolling we should all be worried about are statements like those by Gartner about the death of Java EEThanks to ex Red Hatter John Clingham http://johnclingan.com/2016/12/19/reanalyzing-the-state-of-java-ee/(like his "Gang-of-Four" analogy, thought it may be a bit more now;-)this was quickly analyzed and responded to by Java EE Guardians and others who believe in Java and Java EE.I pointed out, that even though some parts of Java EE 8 were dropped others especially those used by Microprofile are very active and alive.The JSON-P EG listened to input from the community, including those who would like to introduce proprietary back room mingling here.Imagine the Spec Lead or Expert Group of JSRs like 374 acted in a similar manner;-)Cheers,Werner
You received this message because you are subscribed to the Google Groups "MicroProfile" group.
To unsubscribe from this group and stop receiving emails from it, send an email to microprofile...@googlegroups.com.
--
You received this message because you are subscribed to a topic in the Google Groups "MicroProfile" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/microprofile/VJEEAOsVj5E/unsubscribe.
To unsubscribe from this group and all its topics, send an email to microprofile...@googlegroups.com.
To post to this group, send email to microp...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/microprofile/b44110a8-6d61-4e28-99d3-6cd303458108%40googlegroups.com.
--
You received this message because you are subscribed to the Google Groups "MicroProfile" group.
To unsubscribe from this group and stop receiving emails from it, send an email to microprofile...@googlegroups.com.
To post to this group, send email to microp...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/microprofile/14eda7dc-9745-4907-8058-c905c159b6c3%40googlegroups.com.
--
You received this message because you are subscribed to a topic in the Google Groups "MicroProfile" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/microprofile/VJEEAOsVj5E/unsubscribe.
To unsubscribe from this group and all its topics, send an email to microprofile+unsubscribe@googlegroups.com.
To post to this group, send email to microp...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/microprofile/14eda7dc-9745-4907-8058-c905c159b6c3%40googlegroups.com.
> I think we all agree that YAML reader is not provided out of box but an end user can write their own reader.I'm not convinced yet that YAML shouldn't be supported out of the box. At least it should be considered conceptually right from the beginning, esp. its support for lists and dictionaries. It should be clear how these would be targeted and exposed through the config API.So even if not providing a YAML source by default, one should be implemented as part of this work in order to make sure the API and SPI concepts line up with such more powerful configuration sources.But then, if YAML is what people use these days for config most of the time, I don't see why we should put the burden onto users to implement their own reader.
> The current propose is to standardise the API in MicroProfile.io and then focus on the implementation and tests.Not sure whether that's what you wanted to say, but I think these three things must go hand in hand, i.e. iteratively happen at the same time. Otherwise it's too easy to "spec" something which cannot be implemented or is lacking when using it (as found out during testing).--Gunnar
2017-01-02 23:55 GMT+01:00 'Emily Jiang' via MicroProfile <microp...@googlegroups.com>:
Yes James. Mark made the exact point that an end user can provide the YAML config source themselves. I think we all agree that YAML reader is not provided out of box but an end user can write their own reader.
Let's not worry about JSR for now as we can try to standardise in MicroProfile,io and try to feed into JSR in the future. The current propose is to standardise the API in MicroProfile.io and then focus on the implementation and tests.
Thanks
Emily
On Monday, January 2, 2017 at 7:21:57 PM UTC, Mark Struberg wrote:Werner, I have no clue why you keep going on with mentioning other projects? This thread is about TECHINCAL questions of this very microprofile proposal. The currently proposed ConfigSource mechanism of this very spec in discussion already provides all that.
--
You received this message because you are subscribed to a topic in the Google Groups "MicroProfile" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/microprofile/VJEEAOsVj5E/unsubscribe.
To unsubscribe from this group and all its topics, send an email to microprofile...@googlegroups.com.
To post to this group, send email to microp...@googlegroups.com.
Thanks guys for the good discussions while I switched off! I happened to log on to check my emails and add my 2cents.
As for the ordinal discussion, if the configure sources are added explicitly to ConfigBuilder, what Ondrej proposed should work. The only downside is that the end user cannot visibly view each config source ranking.
One +1 with ordinal is that it can be extended to support the configure sources discovered automatically via service loader per se and added to ConfigBuilder implicitly. This feature can not be provided by other solutions.
Anatole, who creates the ConfigurationBuilder? And how does a 3rd party lib in an application get to this very configuration?
--
You received this message because you are subscribed to a topic in the Google Groups "MicroProfile" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/microprofile/VJEEAOsVj5E/unsubscribe.
To unsubscribe from this group and all its topics, send an email to microprofile+unsubscribe@googlegroups.com.
To post to this group, send email to microp...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/microprofile/34139c71-2e00-418f-875f-f6518097e8cf%40googlegroups.com.
Anatole, who creates the ConfigurationBuilder? And how does a 3rd party lib in an application get to this very configuration?
--
You received this message because you are subscribed to a topic in the Google Groups "MicroProfile" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/microprofile/VJEEAOsVj5E/unsubscribe.
To unsubscribe from this group and all its topics, send an email to microprofile+unsubscribe@googlegroups.com.
To post to this group, send email to microp...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/microprofile/34139c71-2e00-418f-875f-f6518097e8cf%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
To view this discussion on the web visit https://groups.google.com/d/msgid/microprofile/CADGJaX97Q0-Xb242rs-iP8RKTPMpk%3Dt3UKr1F9J9e-DJnEztcg%40mail.gmail.com.
Basically the ConfigurationBuilder is a separate part, using Java 8 something likepublic interface ConfigurationBuilder{...static ConfigurationBuilder create(){...}Configuration build();}It allows to use the Config API similar to what commons-config et al are offering. Obviously building a configuration does not make it accessible. To make it the current default configuration, it must be applied, e.g. by something like:Configuration.setCurrent(ConfigurationBuilder.create().addConfigSources(new EnvPropertiesSource(), new SysPropertiesSource, new EtcSource()).build());So we have decoupled the concerns of configuration creation from making it accessible, which IMO is a very important aspect.J Anatole2017-01-04 11:23 GMT+01:00 Mark Struberg <markst...@gmail.com>:Anatole, who creates the ConfigurationBuilder? And how does a 3rd party lib in an application get to this very configuration?
--
You received this message because you are subscribed to a topic in the Google Groups "MicroProfile" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/microprofile/VJEEAOsVj5E/unsubscribe.
To unsubscribe from this group and all its topics, send an email to microprofile...@googlegroups.com.
To post to this group, send email to microp...@googlegroups.com.To view this discussion on the web visit https://groups.google.com/d/msgid/microprofile/34139c71-2e00-418f-875f-f6518097e8cf%40googlegroups.com.--Anatole TreschPPMC Member Apache TamayaJCP Star Spec LeadSwitzerland, Europe Zurich, GMT+1Twitter: @atsticks, @tamayaconf
--
You received this message because you are subscribed to the Google Groups "MicroProfile" group.
To unsubscribe from this group and stop receiving emails from it, send an email to microprofile...@googlegroups.com.
To post to this group, send email to microp...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/microprofile/CAFJiDbcbnwkfuMmaXDCpD5MHhSGDxWzUnMFd5kU0F7%3DWFR8SMg%40mail.gmail.com.
> 3rd party libs used by the application could receive the effective list of configuration sources when being initialized by the application.
How? Elaborate on the details please. How do the 'Configuration Subsystem' know about all it's users? To me that sounds like reversing the scanning from automatically picking up the producers to automatically picking up the consumers, right? But it still requires some scanning in that case...
> I find such explicit ordering and passing much easier to grasp than relying on ordinals scattered across different places.
Note that the ordering picked up via 'scanning' is only a default and can be changed by the application anyway.
> the list of configuration sources could be passed using a simple JVM option or a defined config file.
you know how good that works with JVM properties? What do you do in case of 3 WAR files running on the same container? Ever tried to do that for jul? How would you solve the problem with 3 WAR files on a small EE server?
@Anatole
You didn't answer my question.
Let me reiterate:
1.a.) What visibility or 'scope' does such a produced configuration have?
1.b.) Who is in charge to assemble the configuration and how do you ensure that there is only one?
1.c.) How do you know that randomlib.jar needs some configuration? Sounds very error-prone.
@James
> I don't like the idea of statics.
If there is some 'factory' involved then I know no other way. Directly or indirectly (via a factory provider) is only an implementation detail.
How to avoid that?
All those proposals in the end lead to *not* having one 'Application Configuration' but each lib has to roll/assemble it's own.
That's not user friendly and the reason why the existing libraries have not been used a lot.
The only solutions which got pretty wide adoption have been DeltaSpike Config and Spring Config.
And both feature an out-of-the-box auto-discovery of ConfigSources.
LieGrue,
strub
--
You received this message because you are subscribed to a topic in the Google Groups "MicroProfile" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/microprofile/VJEEAOsVj5E/unsubscribe.
To unsubscribe from this group and all its topics, send an email to microprofile...@googlegroups.com.
To post to this group, send email to microp...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/microprofile/40b38b11-37d0-4cd9-9e35-cceb5eb596a2%40googlegroups.com.
Nonetheless 'reading' actually means 2 steps:
1.) reading the configured values in your code
2.) configure your project values either within your project (default values, etc) or by the Ops team
The main benefit of DeltaSpike and Spring config systems is exactly that any 'user' does not need to care where the configured values come from or whether they get 'overridden' somehow.
@Gunnar:
> 3rd party libs used by the application could receive the effective list of configuration sources when being initialized by the application.
How? Elaborate on the details please. How do the 'Configuration Subsystem' know about all it's users?
To me that sounds like reversing the scanning from automatically picking up the producers to automatically picking up the consumers, right? But it still requires some scanning in that case...
> I find such explicit ordering and passing much easier to grasp than relying on ordinals scattered across different places.
Note that the ordering picked up via 'scanning' is only a default and can be changed by the application anyway.
> the list of configuration sources could be passed using a simple JVM option or a defined config file.
you know how good that works with JVM properties? What do you do in case of 3 WAR files running on the same container? Ever tried to do that for jul? How would you solve the problem with 3 WAR files on a small EE server?
@Anatole
You didn't answer my question.
Let me reiterate:
1.a.) What visibility or 'scope' does such a produced configuration have?
1.b.) Who is in charge to assemble the configuration and how do you ensure that there is only one?
1.c.) How do you know that randomlib.jar needs some configuration? Sounds very error-prone.
@James
> I don't like the idea of statics.
If there is some 'factory' involved then I know no other way. Directly or indirectly (via a factory provider) is only an implementation detail.
How to avoid that?
All those proposals in the end lead to *not* having one 'Application Configuration' but each lib has to roll/assemble it's own.
That's not user friendly and the reason why the existing libraries have not been used a lot.
The only solutions which got pretty wide adoption have been DeltaSpike Config and Spring Config.
And both feature an out-of-the-box auto-discovery of ConfigSources.
LieGrue,
strub
--
You received this message because you are subscribed to a topic in the Google Groups "MicroProfile" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/microprofile/VJEEAOsVj5E/unsubscribe.
To unsubscribe from this group and all its topics, send an email to microprofile+unsubscribe@googlegroups.com.
To post to this group, send email to microp...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/microprofile/40b38b11-37d0-4cd9-9e35-cceb5eb596a2%40googlegroups.com.
--
You received this message because you are subscribed to a topic in the Google Groups "MicroProfile" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/microprofile/VJEEAOsVj5E/unsubscribe.
To unsubscribe from this group and all its topics, send an email to microprofile+unsubscribe@googlegroups.com.
To post to this group, send email to microp...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/microprofile/4e03f335-ddde-4066-b9b0-5e7a5bbf5b32%40googlegroups.com.
Thanks guys for your valuable comments!
Defining API is definitely needed. +1 to Mark and Werner's comments!
ConfigSource ordering discussion:
1. implicit ordering
2. ordinal
For the user case of programmatically adding ConfigSources to the ConfigBuilder. Both solutions are fine. I think this covers most user scenarios.
When the config sources are loaded automatically via serviceLoader pattern, using ordinal is sufficient to order the config sources.
Without ordinal, with Anotole's approach, a comparator needs to be registered to order the config sources, which adds more work but solves the problem. I see with the Comparator approach, more complex logic can be used to sort the config sources.
It seems both solutions can solve the ordering issues. If I didn't miss anything, I would rather not to bake the ordinal in the APIs to keep the APIs simple, at least for the first version. There are a few unanswered questions posted by Mark.
@Anatole
1.a.) What visibility or 'scope' does such a produced configuration have?
1.b.) Who is in charge to assemble the configuration and how do you ensure that there is only one?
1.c.) How do you know that randomlib.jar needs some configuration? Sounds very error-prone.
@James
> I don't like the idea of statics.
If there is some 'factory' involved then I know no other way. Directly or indirectly (via a factory provider) is only an implementation detail.
How to avoid that?
=============
Gunner,
1. On YAML support: I think the first version of Config api will not support out of box, as it can be easily extended by developers. We can consider it in the next version.
2. Config testing and implementation, I agree what you they will go hand in hand with APIs. The APIs are not final until implementation and tests are ready.
==============
Are there any other issues with the APIs? I would like to encourage the config projects, e.g. DeltaSpike config, Tamaya, etc, to implement the APIs. Thoughts?
Emily,> 1. On YAML support: I think the first version of Config api will not support out of box, as it can be> easily extended by developers. We can consider it in the next version.Putting the question whether to support it out of the box at the side for a minute, how would such an extension look like? E.g. YAML allows for nested values:
connection:
url:jdbc:mysql://localhost:3306/db
poolSize: 5How does the proposed API/SPI deal with that? How would a user access the url value? Dot syntax ("connection.url") may be one idea, but is this described somewhere?
Then YAML has lists and hashes:
protocols:
- http
- https
users:
tom: passwdbob: passwdHow would these be handled? ConfigSource defines the method Map<String, String> getProperties(). How would this one be implemented for lists and hashes? To me it seems not like a good match.How would a user access lists/hashes? Currently I could only doconfig.getValue( "protocols", List.class )resulting in ugly raw type usage and unchecked casting for the user. So you may need to foresee something like Java EE's TypeLiteral (or simply use that one):config.getValue( "protocols", new TypeLiteral<List<String>>{}() )
To unsubscribe from this group and all its topics, send an email to microprofile...@googlegroups.com.
To post to this group, send email to microp...@googlegroups.com.
To unsubscribe from this group and all its topics, send an email to microprofile+unsubscribe@googlegroups.com.
To post to this group, send email to microp...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/microprofile/29dba4f8-746c-42cc-8138-b642615e6314%40googlegroups.com.
This is kind of like XPath or JsonPointer.
> protocols:
> - http
> - https
>
> users:
> tom: passwd
> bob: passwd
>
> How would these be handled?
That's more complicated. In my original proposal I explicitly ruled it out. It is not really a problem with the String, String mapping, but what about the overriding?
What if you e.g. have a DatabaseConfigSource (with higher ordinal) and you want to amend those values?
In this case you come across all the include/exclude problems!
Does the whole List/Map gets replaced? Or is there some 'patch' mechanism in place?
If you can answer this question, then I can tell you how it can be implemented with the current interface.
In my experience it really becomes complicated and thus we left this out for 1.0.
LieGrue,
strub
--
You received this message because you are subscribed to a topic in the Google Groups "MicroProfile" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/microprofile/VJEEAOsVj5E/unsubscribe.
To unsubscribe from this group and all its topics, send an email to microprofile+unsubscribe@googlegroups.com.
To post to this group, send email to microp...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/microprofile/3fdc3672-2c49-497e-94a2-9339de23f46c%40googlegroups.com.
I think it actually is a problem of the spec, because the user must know how to access such nested value when getting it from the Config option. What should they specify as the property name? The API should provide a unified behaviour and experience, so that's something that needs to be defined at the spec level, it shouldn't be specific for single config sources.
Also it needs to be defined whether values for one sub-node may be contributed by different sources or not. Say you have "connection.url" in one source but "connection.poolSize" in another. Is that legal? Or is everything under "connection.*" required to be defined by a single source to avoid unexpected mixing from different sources? I don't have a strong preference either way, but it needs to be answered in the spec.
LieGrue,
strub
To unsubscribe from this group and all its topics, send an email to microprofile...@googlegroups.com.
To post to this group, send email to microp...@googlegroups.com.
As for YAML support, as Mark mentioned earlier, the parser bit is isolated in YAMLConfigSource. In the config source, the parser should be able to flatter the hierarchy. Take your example:
protocols:
> - http
> - https
>
> users:
> tom: passwd
> bob: passwd
The key might be like: protocols.http, protocols.https. It should be in the YAMLConfigSource javadoc.
I don't see the point of disallowing users.* defined in another config source. The config sources are ordered and if a lower rank config source provides the same users.tom, it will be ignored.
If for some reason, the ConfigSource parses the file differently say "protocols", when asking for "protocols", the value will be the structure. A converter will then needed to be passed in and read the object out with http and https. Therefore, it is the implementation details for a particular ConfigSource. I am fine to add the javadoc on the ConfigSource to mandate the implementation of YAML to the flat structure of the config. Thoughts? The same thing should apply to Json files.
I remember we did discuss this in DeltaSpike and ended up to intentionally NOT support it!
And we had the same discussions again in Tamaya and with the same result (initially, not sure what happened in the meantime).
The reason is simple:
* Maps are implicitly supported anyway. user.bob and user.tom are simple keys. Just take all config values which start with user. and be done.
* Lists can be represented as comma separated value. Done.
Ok, that puts a bit more work on the user, but be honest: how often is it used in real world?
I use DeltaSpike Config in about 20 big projects. And needed the list feature for about 5 configured values in those 20 projects.
An example is e.g.
myproject.batches.somebatch.finished.emailTo=a...@comp.any,b.comp.any
Now if the ops team want's to replace this token they simply add the following to the properties table in the app db:
myproject.batches.somebatch.finished.emailTo=o...@comp.any,busine...@comp.any
With anything else than comma separated values you not only need to define a certain format, but you would also introduce the following complexity:
* make the ConfigSource interface more complicated
* introduce metadata (what a pain!)
* define include/exclude rules (serious headache for users most times)
* introduce some kind of patch rules for value overrides (but this trashes the independence of ConfigSources as you need to know exactly WHAT you gonna patch)
Is that really worth it? I'd rather say no.
You might now probably also understand why my original proposal has a few additional features, e.g.
https://github.com/struberg/javaConfig/blob/master/api/src/main/java/io/microprofile/config/Config.java#L73
<T> T convert(String value, Class<T> asType);
That way you can still have a comma separated List but use the registered Converters to fully support custom representations.
We might probably introduce a method
/**
* Resolves the value configured for the given key as comma separated list
* and convert it to an Iterable of the required asType.
*
* Escaping:
* Any ',' in a value is represented as "\,".
* Any '\' in a value is represented as "\\".
*
* @throws UnsupportedOperationException if there is no {@link Converter} registered for asType
*/
<T> Iterable<T> getListValue(String key, Class<T> asType);
That way it is
* easy for developers as we still stick with String, String for all the internal handling
* easy for the users to administer the values as it's just a comma separated list
I'm worried that introducing anything beyond that is rendering the API and usage massively more complex.
So the last open question seems to be how to support Lists and Maps?
I remember we did discuss this in DeltaSpike and ended up to intentionally NOT support it!
And we had the same discussions again in Tamaya and with the same result (initially, not sure what happened in the meantime).
The reason is simple:
* Maps are implicitly supported anyway. user.bob and user.tom are simple keys. Just take all config values which start with user. and be done.
* Lists can be represented as comma separated value. Done.
Ok, that puts a bit more work on the user, but be honest: how often is it used in real world?
I use DeltaSpike Config in about 20 big projects. And needed the list feature for about 5 configured values in those 20 projects.
An example is e.g.
myproject.batches.somebatch.finished.emailTo=a...@comp.any,b.comp.any
Now if the ops team want's to replace this token they simply add the following to the properties table in the app db:
myproject.batches.somebatch.finished.emailTo=o...@comp.any,busine...@comp.any
With anything else than comma separated values you not only need to define a certain format, but you would also introduce the following complexity:
* make the ConfigSource interface more complicated
* introduce metadata (what a pain!)
* define include/exclude rules (serious headache for users most times)
* introduce some kind of patch rules for value overrides (but this trashes the independence of ConfigSources as you need to know exactly WHAT you gonna patch)
Is that really worth it? I'd rather say no.
You might now probably also understand why my original proposal has a few additional features, e.g.
https://github.com/struberg/javaConfig/blob/master/api/src/main/java/io/microprofile/config/Config.java#L73
<T> T convert(String value, Class<T> asType);
That way you can still have a comma separated List but use the registered Converters to fully support custom representations.
We might probably introduce a method
/**
* Resolves the value configured for the given key as comma separated list
* and convert it to an Iterable of the required asType.
*
* Escaping:
* Any ',' in a value is represented as "\,".
* Any '\' in a value is represented as "\\".
*
* @throws UnsupportedOperationException if there is no {@link Converter} registered for asType
*/
<T> Iterable<T> getListValue(String key, Class<T> asType);
That way it is
* easy for developers as we still stick with String, String for all the internal handling
* easy for the users to administer the values as it's just a comma separated list
I'm worried that introducing anything beyond that is rendering the API and usage massively more complex.
--
You received this message because you are subscribed to a topic in the Google Groups "MicroProfile" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/microprofile/VJEEAOsVj5E/unsubscribe.
To unsubscribe from this group and all its topics, send an email to microprofile+unsubscribe@googlegroups.com.
To post to this group, send email to microp...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/microprofile/12319c9f-448a-4d4a-b42e-17664c22ba6a%40googlegroups.com.
Hey,2017-01-06 10:36 GMT+01:00 Mark Struberg <markst...@gmail.com>:So the last open question seems to be how to support Lists and Maps?I don't really know. Have we settled on the ordinal discussion?Personally I find the lack of type-safety discomforting. Having an approach which allows to define the value types, validation rules (legal value ranges etc.) and default values in a central place would be an essential part of the story to me. I made a proposal on this a while ago, and while we may not agree on making this the exclusive approach for the API (I still kinda think it should be), it should be at least be added on top of the unsafe layer.
I remember we did discuss this in DeltaSpike and ended up to intentionally NOT support it!
And we had the same discussions again in Tamaya and with the same result (initially, not sure what happened in the meantime).
The reason is simple:
* Maps are implicitly supported anyway. user.bob and user.tom are simple keys. Just take all config values which start with user. and be done.How would a user do that with the current API?
--
You received this message because you are subscribed to a topic in the Google Groups "MicroProfile" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/microprofile/VJEEAOsVj5E/unsubscribe.
To unsubscribe from this group and all its topics, send an email to microprofile...@googlegroups.com.
To post to this group, send email to microp...@googlegroups.com.
Hi,
On Friday, January 6, 2017 at 12:29:33 PM UTC+1, Gunnar Morling wrote:Hey,2017-01-06 10:36 GMT+01:00 Mark Struberg <markst...@gmail.com>:So the last open question seems to be how to support Lists and Maps?I don't really know. Have we settled on the ordinal discussion?Personally I find the lack of type-safety discomforting. Having an approach which allows to define the value types, validation rules (legal value ranges etc.) and default values in a central place would be an essential part of the story to me. I made a proposal on this a while ago, and while we may not agree on making this the exclusive approach for the API (I still kinda think it should be), it should be at least be added on top of the unsafe layer.
Was that proposal annotation-based? Tamaya does that on top of the "unsafe" base API/SPI layer in an extension module.